Hallo zusammen,

ich möchte mit einem Makro in einem Textdokument die Schriftgröße der Math-Formeln an die Schriftgröße der Stelle anpassen, an der die Formel steht. Mein Makro dazu steht unten in der Mail.

Wenn ich das Makro ausführe, werden Formeln, die ich irgendwann mal mit Doppelklick angefasst habe, problemlos aktualisiert. Wenn man nun das Textdokument speichert und dann neu lädt, funktioniert das Aktualisieren nicht mehr. Ich muss erst wieder die Formel mit Doppelklick aktivieren, damit die Schriftgröße angepasst wird.

Das Problem ist also, dass das Makro die Schriftgröße zwar korrekt ändert, aber die Änderung nicht automatisch sichtbar wird.

Ich habe dazu die Issues 67283 und 85282 gefunden. Ich benutze DEV300m67 und OOo3.1.1 auf WinXP. Wenn ich den Text der Issues richtig verstanden habe, sollten Aktualisierungprobleme ab OOo3.0 behoben sein. Also wird das Problem wohl in meinem Makro liegen.

Ich habe schon ohne Erfolg probiert:
oModule.setModified(true)
oDoc.reformat()

Irgendwelche Ideen?

mfG
Regina

(Falsche Zeilenumbrüche kommen vom Mailprogramm)

sub InheritFormelFontSizeFromCharacter
rem Author: Regina Henschel; contact: reg...@openoffice.org
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 oDoc as variant: oDoc = ThisComponent
dim oCurrentController as variant: oCurrentController = oDoc.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
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)
                        end if
                end if  
        end if
next nIndex
end sub


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@de.openoffice.org
For additional commands, e-mail: users-h...@de.openoffice.org

Antwort per Email an