' ============================================ sub SelectionSufferingsRight() ' Last update 21-11-2007 16:14 BasicLibraries.loadLibrary("XrayTool") if fnWhichComponent(thisComponent) = "Text" then oCurSelection = thisComponent.getCurrentSelection() if oCurSelection.supportsService("com.sun.star.text.TextRanges") then oVC = thisComponent.getCurrentController.getViewCursor oCursor = oVC.getText.createTextCursorByRange(oVC) ' xray oVC if oCurSelection.getbyIndex(0).String="" then oVC.goRight(1,false) if oCurSelection.getbyIndex(0).String<>"" then oVC.gotoRange(oCurSelection.getByIndex(0).End,false) end if end if end sub sub SelectionSufferingsLeft() ' Last update 21-11-2007 16:14 ' BasicLibraries.loadLibrary("XrayTool") if fnWhichComponent(thisComponent) = "Text" then oCurSelection = thisComponent.getCurrentSelection() if oCurSelection.supportsService("com.sun.star.text.TextRanges") then oVC = thisComponent.getCurrentController.getViewCursor oCursor = oVC.getText.createTextCursorByRange(oVC) ' xray oCurSelection.getbyIndex(0) if oCurSelection.getbyIndex(0).String="" then oVC.goLeft(1,false) if oCurSelection.getbyIndex(0).String<>"" then oVC.gotoRange(oCurSelection.getByIndex(0).Start,false) end if end if end sub function fnWhichComponent(oDoc) as string ' Last update 21-11-2007 11:09 if HasUnoInterfaces(oDoc, "com.sun.star.lang.XServiceInfo") then if thisComponent.supportsService ("com.sun.star.text.GenericTextDocument") then fnWhichComponent = "Text" elseif thisComponent.supportsService("com.sun.star.sheet.SpreadsheetDocument") then fnWhichComponent = "Spreadsheet" elseif thisComponent.supportsService("com.sun.star.presentation.PresentationDocument") then fnWhichComponent = "Presentation" elseif thisComponent.supportsService("com.sun.star.drawing.GenericDrawingDocument") then fnWhichComponent = "Drawing" else fnWhichComponent = "Oops current document something else" end if else fnWhichComponent = "Not a document" end if End function ' ============================================