Michele wrote:
Hello Andrew,

The issue is fixed in sw30bf09 which I hope will be included in m26.

On a different issue related to numbering.

When I updated the Writer guide to the new template, I have introduced
some new list styles, so I thought it was a good idea to remove the
old list styles. At present OOo does not allow you to search for list
styles and in some occasions, when trying to remove an old list style
OOo complained that the style was in used and did not allow me.

In some occasions I discovered (by chance) where the old list style
was used, in other chapters I was not so lucky, so I was wondering how
difficult it is to build a macro that parses the document and removes
OOoNumbering and OOoBullets list styles.

Cheers,

Michele
Sorry for the delay in the reply...

I was not reading the list... How about something really really simple like this (I spent about ten minutes on this, but I could make it much more complex). This searches for the first occurrence with the specified name, selects it, and stops. This does NOT look inside of text tables or frames, only the regular text. If you want something more complicated, let me know.

also, if something "inherits" from this style, then you can not delete it. I do not check for that. This would require me to check all numbering styles to see if they related back to this one as a parent (do a recursive walk) and then find all of these styles. Let me know more specifics as you desire.



Sub FindNumberingX
 EnumerateParagraphsForNumStyleStyle("_Chapters")
End Sub


Sub EnumerateParagraphsForNumStyleStyle (sName$)
 REM Author: Andrew Pitonyak
 Dim oParEnum     'Enumerator used to enumerate the paragraphs
 Dim oPar         'The enumerated paragraph
 Dim s$

 REM Enumerate the paragraphs.
 REM Tables are enumerated along with paragraphs
 oParEnum = ThisComponent.getText().createEnumeration()
 Do While oParEnum.hasMoreElements()
   oPar = oParEnum.nextElement()
REM This avoids the tables. Add an else statement if you want to
   REM process the tables.
   If oPar.supportsService("com.sun.star.text.Paragraph") Then
     'MsgBox oPar.getString(), 0, "I found a paragraph"
     If oPar.NumberingStyleName = sName Then
       Print "Found instance"
       ThisComponent.currentController.select(oPar)
       Exit Sub
     End If
   ElseIf oPar.supportsService("com.sun.star.text.TextTable") Then
     'Print "I found a TextTable"
   Else
     'Print "What did I find?"
   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

Reply via email to