Issue 97880 - Crashing on accessing Style in StarBasic API
Summary: Crashing on accessing Style in StarBasic API
Status: CLOSED DUPLICATE of issue 98480
Alias: None
Product: Draw
Classification: Application
Component: programming (show other issues)
Version: OOo 3.0
Hardware: All All
: P2 Trivial (vote)
Target Milestone: ---
Assignee: chne
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-08 21:52 UTC by swingkyd
Modified: 2009-04-21 07:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Simple macro crashes OpenOffice (11.65 KB, application/vnd.oasis.opendocument.graphics)
2009-02-27 07:39 UTC, bmarcelly
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description swingkyd 2009-01-08 21:52:53 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.
Comment 1 wolframgarten 2009-01-09 08:04:58 UTC
Reassigned. Please handle.
Comment 2 chne 2009-01-09 13:19:34 UTC
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.
Comment 3 swingkyd 2009-01-09 16:04:39 UTC
"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.
Comment 4 bmarcelly 2009-02-27 07:37:24 UTC
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.
Comment 5 bmarcelly 2009-02-27 07:39:21 UTC
Created attachment 60532 [details]
Simple macro crashes OpenOffice
Comment 6 clippka 2009-04-20 16:31:21 UTC
this is a duplicate issue

*** This issue has been marked as a duplicate of 98480 ***
Comment 7 clippka 2009-04-20 16:33:56 UTC
closing
Comment 8 clippka 2009-04-21 07:19:23 UTC
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 :-)