Bug 40288 - Can't past a circle from draw to writer
Summary: Can't past a circle from draw to writer
Status: RESOLVED DUPLICATE of bug 40267
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.3 RC1
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-22 06:31 UTC by Dorange-Pattoret Didier
Modified: 2011-08-23 00:06 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
The circle inside this drawing document. (8.58 KB, application/vnd.oasis.opendocument.graphics)
2011-08-22 06:31 UTC, Dorange-Pattoret Didier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dorange-Pattoret Didier 2011-08-22 06:31:05 UTC
Created attachment 50453 [details]
The circle inside this drawing document.

When I copy the circle from the draw document and I try to past it in a writer document I get a crash.
Comment 1 Jeffrey 2011-08-22 06:36:20 UTC
Eerily this bug was reported after bug 40267, which I believe are very similar. For now, mark as duplicate.

*** This bug has been marked as a duplicate of bug 40267 ***
Comment 2 Dorange-Pattoret Didier 2011-08-23 00:06:22 UTC
Hello,

It seems there is a problem with the LineWidth property.


Please, try the below code.
If the line leCercle.LineWidth =50 is not commented, I get a crash.


Sub InsereUnCercle 
	oDocument = ThisComponent
	Dim mFileProperties(1) As New com.sun.star.beans.PropertyValue
	Dim leCercle as Object
	Dim dimensionsForme As New com.sun.star.awt.Size
	Dim positionForme As New com.sun.star.awt.Point

	mFileProperties(0).Name = "Hidden"
	mFileProperties(0).Value = False
	mFileProperties(1).Name="MacroExecutionMode"
	mFileProperties(1).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
	oDesktop = createUnoService("com.sun.star.frame.Desktop")
	sUrl = "private:factory/sdraw"
	oDocumentF = oDesktop.LoadComponentFromURL(sUrl,"_blank",0,mFileProperties())

	oPageF = oDocumentF.Drawpages(0)
	leCercle = oDocumentF.createInstance("com.sun.star.drawing.EllipseShape")
		
	dimensionsForme.Width = 5000
	dimensionsForme.Height = 3000
	positionForme.x =3000
	positionForme.y = 5000	
	leCercle.Size = dimensionsForme
	leCercle.Position = positionForme
	leCercle.FillStyle = 0
	Rem uncomment this following line	
	leCercle.LineWidth =50
	oPageF.add(leCercle)
	oDocumentF.CurrentController.Select(leCercle)
	ClipboardCopy(oDocumentF)
	ClipboardPaste(oDocument)
	ToucheEchap (oDocument)
End Sub



Sub ClipboardPaste( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, ".uno:Paste" )
End Sub

Sub ClipboardCopy( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, ".uno:Copy" )
End Sub
	
Sub ToucheEchap ( oDocumentFrame )
	DocumentDispatch( oDocumentFrame, ".uno:Escape" )
End Sub 



Sub DocumentDispatch( ByVal oDocumentFrame As Object,_
                  ByVal cURL As String,_
                  Optional cTargetFrameName,_
                  Optional nSearchFlags,_
                  Optional aDispatchArgs )

   dim oDispatchHelper 
 
   If Not HasUnoInterfaces( oDocumentFrame, "com.sun.star.frame.XFrame" ) Then
      oDocumentFrame = GetDocumentFrame( oDocumentFrame )
   EndIf
   
   If IsMissing( cTargetFrameName ) Then
      cTargetFrameName = ""
   EndIf
   If IsMissing( nSearchFlags ) Then
      nSearchFlags = 0
   EndIf
   If IsMissing( aDispatchArgs ) Then
      aDispatchArgs = Array()
   EndIf
   
   oDispatchHelper = createUnoService( "com.sun.star.frame.DispatchHelper" )
   oDispatchHelper.executeDispatch( oDocumentFrame, cURL, cTargetFrameName, nSearchFlags, aDispatchArgs )
End Sub


Function GetDocumentFrame( oDoc As Object ) As Object
   Dim oFrame As Object
   Dim oCtrl As Object
  
   If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then
       oCtrl = oDoc.getCurrentController()
       oFrame = oCtrl.getFrame()
    ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then
      oCtrl = oDoc
      oFrame = oCtrl.getFrame()

   ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then

      oFrame = oDoc
   Else
      MsgBox( "GetDocumentFrame called with incorrect parameter." )
   EndIf 
   GetDocumentFrame() = oFrame
End Function