For example I want to do it for 2 rectangles as from menu Shape ->
Merge/Subtract/Intersect
Macro twoRectangles put 2 rectangles to the Draw page and select them.
Sub twoRectangles 'put 2 rectangles to the Draw page and select them
dim oDrawDoc,oPage,oRect1,oRect2,oShapes,oSelect
oDrawDoc=thisComponent
oPage=oDrawDoc.getDrawPages().getByIndex(0)
rem put rectangle 1
oRect1=oDrawDoc.createInstance("com.sun.star.drawing.RectangleShape")
oRect1.setPosition(createPoint(1000, 1000))
oRect1.setSize(createSize(4000, 3000))
oPage.add(oRect1)
rem put rectangle2
oRect2=oDrawDoc.createInstance("com.sun.star.drawing.RectangleShape")
oRect2.setPosition(createPoint(2000, 1500))
oRect2.setSize(createSize(5000, 2000))
oRect2.fillColor=RGB(123,34,78) 'other color
oPage.add(oRect2)
rem shapes to collection
oShapes=createUnoService("com.sun.star.drawing.ShapeCollection")
oShapes.add(oRect1)
oShapes.add(oRect2)
rem shapes to selection
oDrawDoc.CurrentController.Select(oShapes)
oSelect=oDrawDoc.getCurrentController().getSelection()
rem now I can do manually: menu Shape -> Merge/Subtract/Intersect, but how
via macro???
End Sub
Function CreatePoint(ByVal x As Long,ByVal y As Long) As
com.sun.star.awt.Point
Dim oPoint
oPoint=createUnoStruct( "com.sun.star.awt.Point" )
oPoint.X=x : oPoint.Y=y
CreatePoint=oPoint
End Function
Function CreateSize(ByVal x As Long,ByVal y As Long) As
com.sun.star.awt.Size
Dim oSize
oSize=createUnoStruct( "com.sun.star.awt.Size" )
oSize.Width=x : oSize.Height=y
CreateSize=oSize
End Function