Since we're talking macros:

When going through a document to do the final layout  I occasionally need to adjust page breaks manually. Writer allows page breaks to be a property of a paragraph but the property is buried deep down in a dialog: Format - Paragraph - Text Flow - Breaks.

With this macro toggling a page break for the current paragraph is at the tip of your finger (after you assigned the macro to a shortcut key using Tools - Customize):

sub TogglePagebreak
Dim oVCur As Object
    On Error Goto ERRORHANDLER
   
    oSel = thiscomponent.getcurrentcontroller.getselection

    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
    ShowProp(oCur.TextTable)
      if oCur.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE then
        oCur.BreakType = com.sun.star.style.BreakType.NONE
    else
        oCur.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE
    end if

    Exit Sub
   
    ERRORHANDLER:
        msgbox ("Cannot change page break settings here:"+chr(13)+chr(13)+Error$,48,"D'oh!")
end sub

This macro switched a page break before on or off. Other BreakTypes are listed in the API Reference.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by fpe