Issue 120369 - oDrawDoc.Drawpages(0).Add(oShape) in OSX version causes error
Summary: oDrawDoc.Drawpages(0).Add(oShape) in OSX version causes error
Status: CLOSED DUPLICATE of issue 119337
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: Mac Mac OS X 10.6
: P3 Critical
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-25 20:41 UTC by lucalcin
Modified: 2017-05-20 09:32 UTC (History)
4 users (show)

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


Attachments
example macro causing crash (8.87 KB, application/vnd.oasis.opendocument.graphics)
2012-07-25 20:41 UTC, lucalcin
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description lucalcin 2012-07-25 20:41:16 UTC
Created attachment 78729 [details]
example macro causing crash

When I try to add a new shape to a Draw document with the command 

oDrawDoc.Drawpages(0).Add(oShape) 

it returns the error:

Type: com.sun.star.beans.UnknownPropertyException
Message: .

The same command works perfectly with AOO 3.4.0 Win version, LibreOffice 3.5.5.3 Mac version and NeoOffice 3.2.1 patch 0 Mac.
The same issue happens in a MacOSX 10.5 with fresh AOO 3.4.0 installed.
Please note tat the shape I wish to insert is a formula, I don't try with other shapes kind.

Attached a sample Basic Macro useful to verify the problem. Running the only macro present in the Draw document you will get the error.
The example macro is:


REM  *****  BASIC  *****
Sub InsertFormula()
	Dim oDrawDoc As Object
	Dim oShape As Object
	Dim p As new com.sun.star.awt.Point
	Dim s As new com.sun.star.awt.Size
	
	p.X = 500
	p.Y = 500
	s.Width = 10000
	s.Height = 5000
	
	ODrawDoc = ThisComponent
	
	oShape = ThisComponent.createInstance("com.sun.star.drawing.OLE2Shape")
	oShape.CLSID = "078B7ABA-54FC-457F-8551-6147e776a997"
	oDrawDoc.Drawpages(0).Add(oShape)
	oShape.Model.Formula = "size 20 e^{i%pi} + 1 = 0"
    oShape.MoveProtect = False
    oShape.SizeProtect = False
    oShape.setPosition(p)
    oShape.setSize(s)
    
End Sub
Comment 1 Ariel Constenla-Haile 2012-07-25 20:54:56 UTC
(In reply to comment #0)
> The same command works perfectly with AOO 3.4.0 Win version, LibreOffice
> 3.5.5.3 Mac version and NeoOffice 3.2.1 patch 0 Mac.

It also works on Linux x86-64 (Fedora 17)
Comment 2 Ariel Constenla-Haile 2012-07-25 20:57:32 UTC
(In reply to comment #0)
> Created attachment 78729 [details]
> example macro causing crash
> 
> When I try to add a new shape to a Draw document with the command 
> 
> oDrawDoc.Drawpages(0).Add(oShape) 
> 
> it returns the error:
> 
> Type: com.sun.star.beans.UnknownPropertyException
> Message: .

Can you try splitting that instruction, in order to detect if the error is in add(oShape)?

oPage = oDrawDoc.Drawpages(0)
oPage.add(oShape)
Comment 3 lucalcin 2012-07-25 21:15:05 UTC
I tried:

msgbox oDrawDoc.Drawpages(0).name 

and it works, so I'm sure the problem is in the .add(oShape)
Comment 4 lucalcin 2012-07-25 21:17:41 UTC
Verified: 

oPage = oDrawDoc.Drawpages(0)
oPage.add(oShape)

The error is now in oPage.add(oShape)
Comment 5 lucalcin 2012-07-25 21:35:07 UTC
Update: tested with OOo 3.3.0 and it works
Comment 6 jsc 2012-07-26 09:54:21 UTC
I can't reproduce it in a dev snapshot of AOO 3.4.1

You can try a snapshot build under https://cwiki.apache.org/confluence/display/OOOUSERS/Development+Snapshot+Builds
Comment 7 hdu@apache.org 2012-07-26 11:20:00 UTC
This is probably a duplicate to bug 119337, which got fixed for AOO 3.4.1

*** This issue has been marked as a duplicate of issue 119337 ***