Sub Main fixmovefor680 end sub Sub acb_moveSentenceBackwards ' Very old macro, cleaned up in Feb 2011 ' debugging colours left in for clarity. ' old comments left in for history ' 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() ) mySelection.gotoStartofSentence(TRUE) ' mySelection.CharBackColor=("&Hff0000") contents=mySelection.getString() p=len(mySelection.getString()) ' check for m84 workaround follows. if p=0 then mySelection.GoLeft(1,TRUE) ' mySelection.CharBackColor=("&Hff0000") mySelection.gotoStartofSentence(TRUE) ' mySelection.CharBackColor=("&Hff0000") end if ' mySelection.CharBackColor=("&H007700") dodgystring=mySelection.getString() ' OK test if there is a sentence break in this. ' First go back to what the API thinks is the beginning of the sentence (ie "q") ' q=brk.beginOfSentence(dodgystring,p,aLocale) ' Then go forward from there to see is there is in fact a sentence break ' in the text portion we have just spanned. ' carriage_return=brk.nextCharBlock(dodgystring,0,aLocale,15) ' control (ie "15") shows up if there is a paragraph break here. ' mySelection.CharBackColor=("&Hffffff") mySelection.collapseToStart() oVCursor.gotoRange(MySelection,FALSE) end sub Sub acb_deleteToBeginningOfSentence ' 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. mySelection.setString("") mySelection.collapseToStart oVCursor.gotoRange(MySelection,FALSE) end sub