Apache OpenOffice (AOO) Bugzilla – Issue 25408
api: sw.PageStyles::XStyle
Last modified: 2013-02-24 21:06:55 UTC
Trying to set a parent style on an own created style (and on an Office style) throws a RuntimeException. The following macro reproduces this (with an own created style): Sub Main xNameAccess = ThisComponent.getStyleFamilies() xStyleFamily = xNameAccess.getByName("PageStyles") xStyle = xStyleFamily.getByName("Default") myStyle = ThisComponent.CreateInstance("com.sun.star.style.PageStyle") xStyleFamily.insertByName("MyStyle", myStyle) myStyle.setParentStyle(xStyle.getName()) End Sub
.
SW: changed Prio
SW: changed target
Developer's Guide 7.4.1 says : Note that page and numbering styles are not hierarchical and cannot have parent styles. The method getParentStyle() always returns an empty string, and the method setParentStyle() throws a com.sun.star.uno.RuntimeException when called at a default style. Consequently I think this report should be Invalid.
RuntimeExceptions should "signal an error, which was not covered by the interface method specification". Since the behaviour of the interface is inside of the specification, it should throw an exception that makes more sense. The idl definition of XStyle::setParentStyle suggests a NoSuchElementException. So the Deveoper's Guide has to be updated, too. IMHO the bug is fully justified with this target and prio.