Apache OpenOffice (AOO) Bugzilla – Issue 55624
TextPortion Enumeration not working with redlines
Last modified: 2013-02-24 21:09:14 UTC
I am seeing a bug when enumerating text portions within a paragraph. I have created a paragraph consisting of the word "Delete". I then turned on Change Tracking and inserted the word "Insert" and deleted the original word "Delete". I now have 2 redlines, a Deletion and an Insertion. The first macro below returns the following output: "Redline Start" "Delete" "Redline End" "Redline Start" "Insert" "Redline End" The second macro just moves the start range by one but just returns: "eleteInsert" No redline portion is being detected. Is this a bug? Am I doing something incorrectly? rem First Macro Sub Main oDocument = ThisComponent oText = oDocument.Text oCursor = oText.createTextCursor oCursor.goRight(0,False) oCursor.GotoEnd(True) enum = oCursor.createEnumeration() While enum.hasMoreElements() element = enum.nextElement() newenum = element.createEnumeration() While newenum.hasMoreElements() newelement = newenum.nextElement() If newelement.supportsService( "com.sun.star.text.TextPortion") Then if newelement.TextPortionType = "Redline" Then if newelement.IsStart Then msgbox "Redline Start" Else msgbox "Redline End" End IF Else msgbox newelement.getString() End If End If wend Wend End Sub rem Second Macro Sub Main oDocument = ThisComponent oText = oDocument.Text oCursor = oText.createTextCursor oCursor.goRight(1,False) oCursor.GotoEnd(True) enum = oCursor.createEnumeration() While enum.hasMoreElements() element = enum.nextElement() newenum = element.createEnumeration() While newenum.hasMoreElements() newelement = newenum.nextElement() If newelement.supportsService( "com.sun.star.text.TextPortion") Then if newelement.TextPortionType = "Redline" Then if newelement.IsStart Then msgbox "Redline Start" Else msgbox "Redline End" End IF Else msgbox newelement.getString() End If End If wend Wend End Sub
Macro Issue. Reassigned to JSK.
jsk->sw: This is more API than BASIC. The BASIC API, so to speak. Ahöhö ;-)
Created attachment 30336 [details] bugdoc
The attached bugdoc contains two methods ... executing “Works†returns the following output: "Redline Start" "Insert" "Redline End" "Redline Start" "Delete" "Redline End" executing “Fails†which moves the start range by one, just returns "nsertdelete" and no redline portion is being detected.
mtg->sw,os: Going to take a look at this one under the hood. Has anyone looked at it yet? If so, have they discovered anything that might help ? Danke.
Reassign to mtg, fix commited to CWS 'mtg2'.
Will 'smoke test' fix tomorrow. In the mean time, if tl or os could take a look at: http://sw.openoffice.org/source/browse/sw/sw/source/core/unocore/unoportenum.cxx?r1=1.30&r2=1.30.120.1 They could do a quick code review on my changes. Thanks, Martin
fixed on CWS mtg2
reopen for reassignment
mtg->sw: Hi there, fixes for #i55624#, #i58436# and #i58438# are commited in CWS mtg2. Can you test them please ? Thanks, Martin
Fixed in CWS mtg2
looks good in cws mtg2 => verified
ok in src680_m148 => closed