https://bugs.documentfoundation.org/show_bug.cgi?id=170386
Bug ID: 170386
Summary: Setting CharWeight of a textbox while controllers are
locked breaks saving that property in a macro
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Draw
Assignee: [email protected]
Reporter: [email protected]
Consider this macro:
sub test()
doc = StarDesktop.loadComponentFromURL("private:factory/sdraw", "_default",
0, array())
page = doc.getDrawPages().getByIndex(0)
doc.lockControllers()
shape = doc.createInstance("com.sun.star.drawing.TextShape")
page.add(shape)
shape.setString("Some Text")
point = new com.sun.star.awt.Point
point.X = 2000
point.Y = 600
shape.setPosition(point)
shape.setPropertyValue("CharWeight", 150)
doc.unlockControllers()
doc.storeAsURL(ConvertToURL("C:/Downloads/test.odg"), array())
end sub
It creates a new Draw document; locks its controllers; creates and inserts a
TextShape; sets its text, position, and weight; unlocks controllers and saves.
(NB: change the path inside ConvertToURL to a path suitable for you when
testing.)
The created document is displayed immediately as saved and unchanged; and the
text is shown bold, as expected. However, File->Reload changes the text to
normal.
Commenting out `doc.lockControllers()` and `doc.unlockControllers()` fixes the
issue (but of course, that's not a solution: lockControllers helps improve
performance, and should not create such a problem). The resulting document.xml
has a paragraph autostyle (setting bold) used in <text:p> of the
<draw:text-box>, unlike the case when controllers were locked (even though
another paragraph autostyle, also with bold, is set in draw:text-style-name in
<draw:frame>).
--
You are receiving this mail because:
You are the assignee for the bug.