Apache OpenOffice (AOO) Bugzilla – Issue 97880
Crashing on accessing Style in StarBasic API
Last modified: 2009-04-21 07:19:24 UTC
This is a difficult one to explain: Symptom: 1) OO.org 3.0 crashes on attempting to Xray a style using StarBasic 2) OO.org cannot inspect using the "watch" utility in the Openoffice.org Basic environment as it crashes as well. it appears that programmatically accessing the style is not working. More on the error follows: Using the StyleFamily "graphics" exports the following interfaces: com.sun.star.container.XElementAccess com.sun.star.container.XIndexAccess com.sun.star.container.XNameAccess com.sun.star.container.XNameContainer com.sun.star.container.XNamed com.sun.star.container.XNameReplace However, XNameReplace, XNameContainer methods which attempt to add, modify etc. just DO NOT WORK. One can access the Style using methods: getByName getByIndex but the following methods are not found at runtime: replaceByName( [in] string aName, [in] any aElement ) insertByName( [in] string aName, [in] any aElement ) Here is some sample code which should cause some headaches: oDoc = thisComponent ' open a draw document and run this as a sub oStyleFamilies = oDoc.styleFamilies oShapeStyles = oStyleFamilies.getByName("graphics") oStyle = oShapeStyles.getByIndex(0) '<- larger is fine if you have it ' Xray OStyle '<-- will definitely crash. 'oStyle = oShapeStyles.getByName("cg") '<- use the API to make style cg ' put a stop on the code 2 lines up and watch oStyle. Inspect it... it crashes ' the following code does not work as per section 9.6.1 in Developers Guide says it should and it has apparently worked in the past: oStyle = oDoc.createInstance( "com.sun.star.style.Style" ) '<- does not work Document factor does not have a registered service or something like this. I don't know if this is related but basically it's not working the way it is supposed to as far as I can see and there appears to be no way of accessing, modifying or removing the graphics styles in a Draw Document.
Reassigned. Please handle.
cn->swingkyd: - Can you tell me something about Xray? I don't know this tool. - for com.sun.star.style.Style problem please see http://www.openoffice.org/issues/show_bug.cgi?id=87695 You can vote for it.
"Can you tell me something about Xray? I don't know this tool." Xray tool inspects any object and reports it into a very nice dialog. No worry, just inspect it using the watch window in OpenOffice.org and it will crash for you.
Xray only reveals the bug. You don't need Xray to replicate the crash. The property EndPosition of any Draw style crashes OpenOffice. Run the macro in next attachment. Please correct this, it still exists on DEV310m2.
Created attachment 60532 [details] Simple macro crashes OpenOffice
this is a duplicate issue *** This issue has been marked as a duplicate of 98480 ***
closing
Hi swingkyd, of course your issue was the better explained one and also technically I would had to keep your issue as it was submitted first. But since issue 98480 was already assigned to myself and I already had a fix for both issue it was just easier for me to close this one. I hope that in the end it only matters that the issue is solved :-)