Hi all,

I have written a macro (see below), which uses ExtendedControlOverEmbeddedObject.update(). The macro works for me. But I'm worried because the interface XEmbeddedObject is labeled as 'unpublished' in http://api.openoffice.org/docs/common/ref/com/sun/star/embed/XEmbeddedObject.html. Is it right to use this method? And if not, how should I do it right?

If this is not the right mailing list to ask, please point me to the correct one.

kind regards
Regina

sub InheritFormelFontSizeFromCharacter
rem Changes all Math formulas in the document in the way, that the base font size
rem is set to the font size of the character the formula is anchored as.
dim oCurrentController as variant: oCurrentController = ThisComponent.getCurrentController() if not(oCurrentController.supportsService("com.sun.star.text.TextDocumentView")) then
        msgbox("only for text documents")
        exit sub
end if
dim oModelTextDocument as variant: oModelTextDocument = oCurrentController.Model dim oEmbeddedObjects as variant: oEmbeddedObjects = oModelTextDocument.EmbeddedObjects
dim nIndex as long
dim nEndIndex as long: nEndIndex = oEmbeddedObjects.Count-1
dim oEmbeddedObject as variant: rem like green handle status
dim oModel as variant: rem like edit status
dim oAnchor as variant: rem for access to the character properties
dim fCharHeight as single
dim oXCOEO as variant: rem oExtendedControlOverEmbeddedObject
for nIndex=0 to nEndIndex
        oEmbeddedObject = oEmbeddedObjects.getByIndex(nIndex)
        oModel = oEmbeddedObject.Model: rem might be empty
        if Not(isEmpty(oModel)) then
                if 
oModel.supportsService("com.sun.star.formula.FormulaProperties") then
                        oAnchor = oEmbeddedObject.Anchor
                        if 
oAnchor.supportsService("com.sun.star.style.CharacterProperties") then
                                fCharHeight = oAnchor.CharHeight
                                rem round down for to not break line height
                                oModel.BaseFontHeight = Int(fCharHeight)
                                oXCOEO = 
oEmbeddedObject.ExtendedControlOverEmbeddedObject
                                oXCOEO.update()
                        end if
                end if  
        end if
next nIndex
end sub



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to