Impress has layers same as Draw. Only the UI was removed (for good reasons) from OpenOffice.org 1.1.5 to OpenOffice.org 2.0. You still can use layers but you need some manual editing and macros.
First step: Add a suitable layer to the file markup:
- Open the file
styles.xml
in the file package in an editor. I use application 7Zip to enter the .odp file. For 7Zip it is not needed to change the file extension to .zip. I have customized 7Zip so, that short cut F3 opens the sub file in Notepad++.
- Find the element
<draw:layer-set>
.
- Extend it with the element
<draw:layer draw:name="Labels" draw:display="screen"/>
. So you will have
<draw:layer-set>
<draw:layer draw:name="layout" />
<draw:layer draw:name="background" />
<draw:layer draw:name="backgroundobjects" />
<draw:layer draw:name="controls" />
<draw:layer draw:name="measurelines" />
<draw:layer draw:name="Labels" draw:display="screen" />
</draw:layer-set>
Notice, that the part draw:display="screen"
is the reason, that the objects on this layer are not printed and not visible in the pdf.
- Save the changes and update the package.
Adding such layer using a Basic macro does not work well.
Second step: Add the Basic macros below to your Installation, e.g. into a new module in the Standard library.
sub MoveShapeToNotPrintableLayer
dim oDocument as variant: oDocument = ThisComponent
dim oLayerManager as object: oLayerManager = oDocument.LayerManager
dim oNotPrintableLayer as object
if not oLayerManager.hasByName(“Labels”) then
msgbox (“You need to extend the layer set.”)
'The needed element is <draw:layer draw:name=“Labels” draw:display=“screen”/>
exit sub
end if
oNotPrintableLayer = oLayerManager.getByName(“Labels”)
dim oShape as variant: getSelectedShape_inImpress(oShape)
if isEmpty(oShape) then
msgbox (“You need to select a single object.”)
exit sub
end if
oLayerManager.attachShapeToLayer(oShape, oNotPrintableLayer)
end sub
sub MoveShapeToDefaultLayer
dim oDocument as variant: oDocument = ThisComponent
dim oLayerManager as object: oLayerManager = oDocument.LayerManager
dim oShape as variant: getSelectedShape_inImpress(oShape)
if isEmpty(oShape) then
msgbox (“You need to select a single object.”)
exit sub
end if
dim oDefaultLayer as object
oDefaultLayer = oLayerManager.getByName(“layout”): 'case sensitive
oLayerManager.attachShapeToLayer(oShape, oDefaultLayer)
end sub
Rem Tools
sub getSelectedShape_inImpress(oShape as variant)
rem returns a single, selected shape, might be empty
dim oDocument as variant: oDocument = ThisComponent
dim oCurrentController as variant: oCurrentController = oDocument.getCurrentController()
dim oShapeCollection as variant: oShapeCollection = oCurrentController.Selection
if isEmpty(oShapeCollection) then exit sub
if oShapeCollection.Count <> 1 then exit sub
oShape = oShapeCollection.getByIndex(0)
end sub
Using the macros: Now it is very easy to exclude a text box or any other object from printing and pdf export. Select the object, press Alt+F11 and find the macro MoveShapeToNotPrintableLayer
and Run
the macro. For the other way round, making an object printable again, use the macro MoveShapeToDefaultLayer
.
I have used the layer name Labels
here. Of cause you can use a different name. You only need to make sure that the name in file markup is the same as in the macro.