Dear all,
I have a problem with Libreoffice Impressfor which I didn't find any
solution in internet.
My problem:
I have a presentation with lots of equations and I want to change the
fonts in this presentation. For normal text this is easily done changing
the corresponding styles. However, so far I didn't find a way to change
the fonts of all equations (in an efficient way, without modifying each
equation manually).
I understand that I need a macro for doing this. In the Math
documentation
http://wiki.documentfoundation.org/images/3/37/MG40-MathGuide.pdf on
page 46 I found a macro which works nicely in Libreoffice Writer, but
not in Impress.
On page 47 it is said that in Impress some modifications are necessary.
I made these modifications (hopefully correctly, I am not sure), but the
macro does not work, giving me the error message
BASIC runtime error.
Property or method not found: EmbeddedObjects
My macro is this (essentially the one from the documentation):
Sub ChangeFormatFormuleImpress
oCurrentController = ThisComponent.getCurrentController()
oTextDocument = oCurrentController.Model
oEmbeddedObjects = oTextDocument.EmbeddedObjects
nEndIndex = oEmbeddedObjects.Count-1
for nIndex=0 to nEndIndex
oMathObject = oEmbeddedObjects.getByIndex(nIndex)
oModel = oMathObject.Model
if (not isNull(oModel)) then
if(not isEmpty(oModel)) then
if oShape.supportsService("com.sun.star.drawing.OLE2Shape") then
if oShape.CLSID = "078B7ABA-54FC-457F-8551-6147e776a997" then
oModelFormula = oShape.Model
oModelFormula.BaseFontHeight = 12
oModel.BaseFontHeight = 12
policeCommune= "Arial"
' Variables
oModel.FontNameVariables= policeCommune
oModel.FontVariablesIsItalic=false
oModel.FontVariablesIsBold=false
' Functions
oModel.FontNameFunctions = policeCommune
oModel.FontFunctionsIsItalic=false
oModel.FontFunctionsIsBold=false
' Numbers
oModel.FontNameNumbers= policeCommune
oModel.FontNumbersIsItalic=false
oModel.FontNumbersIsBold=false
' Text
oModel.FontNameText= policeCommune
oModel.FontTextIsItalic=false
oModel.FontTextIsBold=false
' Update
oXCOEO = oMathObject.ExtendedControlOverEmbeddedObject
oXCOEO.update()
endif
endif ' if formula
endif ' if not empty
endif ' if not null
next nIndex
ThisComponent.reformat() ' Met à jour tous les éléments du document
End Sub
Because I have never written a Libreoffice macro before, I am lost here
and any help would be appreciated.
My system: Libreoffice 4.1.1, Linux, 64 bit
Markus