Assuming a simple text document, I can enumerate text sections. I thought that I could find red line text by checking for the RedlinePortion service, but I can not. The example below finds redline sections by checking for the existance of a specific property in the property set information object. Am I missing something?

Sub MainRedLine
 Dim oPar
 Dim oParsEnum
 Dim oTextElementEnum
 Dim oSection
 Dim s$

 ' Enumerate over the paragraphs.
 oParsEnum = thisComponent.getText().createEnumeration()
 'or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()
 ' loop over all text elements
 Do While oParsEnum.hasMoreElements()
   oPar = oParsEnum.nextElement
   REM Search through paragraphs and ignore the rest.
   If oPar.supportsService("com.sun.star.text.Paragraph") Then
     oTextElementEnum = oPar.createEnumeration()
     Do While oTextElementEnum.hasMoreElements()
       oSection = oTextElementEnum.nextElement
REM Sections with redlines will support the following properties:
       'STRING/void  RedlineAuthor = Andrew Pitonyak
       'STRING/void  RedlineComment =
       'OBJECT/void  RedlineDateTime = [Can not convert Object to a string]
       'STRING/void  RedlineIdentifier = -371500180
       'ARRAY/void  RedlineSuccessorData = Empty
       'OBJECT/void  RedlineText = Empty
       'STRING/void  RedlineType = Insert
REM Surprisingly, this is NEVER true, but I do find redline sections.
       If oSection.supportsService("com.sun.star.text.RedlinePortion") Then
        MsgBox "The current block contains a redline."
       End If
REM This will find them, however. Very odd indeed! If oSection.getPropertySetInfo().hasPropertyByName("RedlineType") Then
         MsgBox "(2) The current block contains a redline."
       End If
     Loop
   End If
 Loop
End Sub




--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to