To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=76084
                 Issue #|76084
                 Summary|Remove a shape from macro crashes OOo drawing document
                        |.
               Component|Drawing
                 Version|OOo 2.2
                Platform|All
                     URL|
              OS/Version|All
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|code
             Assigned to|wg
             Reported by|pitonyak





------- Additional comments from [EMAIL PROTECTED] Wed Apr  4 13:43:57 +0000 
2007 -------
I was asked how to remove a shape from a drawing document. The following macro,
attempts to remove the selected shape, but it crashes instead. 

Using a drawing, select a single shape and run this macro.


Sub Main

   Dim oShapeName as String
   Dim oDoc As Object

   oDoc = ThisComponent

   oDocCtrl = oDoc.getCurrentController()

   ' See what is currently selected.
   oSelection = oDocCtrl.getSelection()
   If IsEmpty( oSelection ) Then
       MsgBox( "Zum Löschen muss eine Grafik makiert sein" )
       Exit Sub
   EndIf
   If oSelection.getCount() > 1 Then
       MsgBox( "Bitte nur eine Grafik zum löschen auswählen" )
       Exit Sub
   EndIf

   oOrigShape = oSelection.getByIndex( 0 )
   oShapeName = oOrigShape.getName()

   'print oShapeName

   REM I expected that either of these next two statements
   REM would remove the shape from the document.
   oOrigShape.Dispose()  REM Crash
   oOrigShape.getParent().Remove(oOrigShape)  REM CRASH
End Sub

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to