Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Va alla num-esima intestazione
- ' Macro personali\Standard\Module1\GoHeading
- 'macro:///Standard.Module1.GoHeading($heading)
- Sub GoHeading(num as integer)
- REM Author: Andrew Pitonyak
- REM Modified: Daniele Primon
- Dim oParEnum 'Enumerator used to enumerate the paragraphs
- Dim oPar 'The enumerated paragraph
- Dim s$
- Dim i as Integer
- IF IsNull(num) or num=0 then
- ' exit sub
- num = 1
- endif
- ' print "Cappello"
- Dim oFrame
- Dim oDisp
- oFrame = ThisComponent.CurrentController.Frame
- oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
- REM Enumerate the paragraphs.
- REM Tables are enumerated along with paragraphs
- oParEnum = ThisComponent.getText().createEnumeration()
- i=1
- 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 Len(oPar.NumberingStyleName) > 0 Then
- If InStr(oPar.ParaStyleName, "Heading ") = 1 Then
- ' print oPar.NumberingStyleName+" "+oPar.ParaStyleName
- ' If RefreshStyle(oPar.NumberingStyleName) Then
- if i=num or Not oParEnum.hasMoreElements() then
- ' print "carrramba! "+i
- ThisComponent.getCurrentController().select(oPar)
- xViewCursor=ThisComponent.getCurrentController().getViewCursor()
- xViewCursor.gotoStartOfLine(false)
- exit do
- end if
- ' msgbox "selezione?"
- i=i+1
- ' EndIf
- End If
- ' End If
- ' ElseIf oPar.supportsService("com.sun.staar.text.TextTable") Then
- 'Print "I found a TextTable"
- ' Else
- 'Print "What did I find?"
- End If
- Loop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement