Sub Main fixmovefor680 end sub Sub fixmovefor680 ' Fixed up for m_56 using a breakiterator, which works for almost every case ' October 12 04 ' redone for m84 to deal with the broken empty paragraph problem -- changed previous sentence to startof sentence, and ' put in a check for when this doesn't work. dim oDoc,oText,oVCursor,mySelection,testright,testleft,brk,dodgystring,p,q,cr dim aLocale as new com.sun.star.lang.Locale aLocale.Language="en" aLocale.Country="GB" oDoc = thiscomponent oText = oDoc.getText() brk=createUnoService("com.sun.star.i18n.BreakIterator") oVCursor = oDoc.getCurrentController().getViewCursor() mySelection = oText.createTextCursorByRange ( oVCursor.getstart() ) ' except at the end of a paragraph, going to the end of the sentence ' before going back to the beginning ' gets things straight mySelection.gotoStartofSentence(TRUE) p=len(mySelection.getString()) ' check for m84 workaround follows. if p=0 then mySelection.GoLeft(1,TRUE) mySelection.gotoStartofSentence(TRUE) end if dodgystring=mySelection.getString() ' OK test if there is a sentence break in this. q=brk.beginOfSentence(dodgystring,p,aLocale) carriage_return=brk.nextCharBlock(dodgystring,0,aLocale,15) ' control works ' debug section ' msgbox(p,0,"Dodgystring length") ' msgbox(q,0,"q") ' msgbox (carriage_return,0,"carriage_return") mySelection.collapseToStart() if q>0 then mySelection.gotoNextSentence(FALSE) if q-carriage_return=2 then ' msgbox("need to go forward?") myselection.goToNextSentence(FALSE) mySelection.goRight(1,FALSE) elseif carriage_return=-1 then ' workaround for empty paragraph myselection.goLeft(3,FALSE) end if end if oVCursor.gotoRange(MySelection,FALSE) end sub Sub fixkillfor680 ' Fixed up for m_56 using a breakiterator, which works for almost every case ' October 12 04 dim oDoc,oText,oVCursor,mySelection,testright,testleft,brk,dodgystring,p,q dim aLocale as new com.sun.star.lang.Locale aLocale.Language="en" 'atend is a boolean to check for end of doc condition oDoc = thiscomponent oText = oDoc.getText() brk=createUnoService("com.sun.star.i18n.BreakIterator") oVCursor = oDoc.getCurrentController().getViewCursor() mySelection = oText.createTextCursorByRange ( oVCursor.getstart() ) mySelection.gotoStartofSentence(TRUE) p=len(mySelection.getString()) ' check for m84 workaround follows. if p=0 then mySelection.GoLeft(1,TRUE) mySelection.gotoStartofSentence(TRUE) end if dodgystring=mySelection.getString() ' OK test if there is a sentence break in this. q=brk.beginOfSentence(dodgystring,p,aLocale) carriage_return=brk.nextCharBlock(dodgystring,0,aLocale,15) ' control works if q>0 then mySelection.gotoNextSentence(TRUE) if q-carriage_return=2 then ' msgbox("need to go forward?") myselection.goToNextSentence(TRUE) ' mySelection.goRight(1,TRUE) elseif carriage_return=-1 then ' workaround for empty paragraph myselection.goLeft(3,FALSE) end if end if mySelection.setString("") mySelection.collapseToStart oVCursor.gotoRange(MySelection,FALSE) end sub