Draw: How to Merge/Subtract/Intersect shapes via macro [SOLVED]

classic Classic list List threaded Threaded
10 messages Options
Kamil Landa Kamil Landa
Reply | Threaded
Open this post in threaded view
|

Draw: How to Merge/Subtract/Intersect shapes via macro [SOLVED]

This post was updated on .
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



--
Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Users-f1639498.html

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Regina Henschel Regina Henschel
Reply | Threaded
Open this post in threaded view
|

Re: Draw: How to Merge/Subtract/Intersect shapes via macro?

Hi Kamil,

Kamil Landa schrieb am 08-Jan-19 um 13:50:
> For example I want to do it for 2 rectangles as from menu Shape ->
> Merge/Subtract/Intersect

You can use the dispatcher for it. After the shapes are selected do
for example:
dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Merge", "", 0, Array())

Of cause you need to adapt the identifiers and omit already done
declarations.

Array() means, that this uno-command needs no arguments.

The SID in core is SID_POLY_MERGE. Looking in
https://opengrok.libreoffice.org/xref/core/svx/sdi/svx.sdi#5675
you see, that the argument brackets () are empty.

The others are accordingly .uno:Subtract and .uno:Intersect

Kind regards
Regina

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Kamil Landa Kamil Landa
Reply | Threaded
Open this post in threaded view
|

Re: Draw: How to Merge/Subtract/Intersect shapes via macro?

fudmer rieley fudmer rieley
Reply | Threaded
Open this post in threaded view
|

I have been using open office, libre office and open everything since 1985

In reply to this post by Kamil Landa


but I can tell you what has happened to libre office over the past two
years has turned me off..
nothing about it is stable.. it stinks.

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Peter Hillier-Brook Peter Hillier-Brook
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

On 11/01/2019 10:58, fudmier wrote:
>
>
> but I can tell you what has happened to libre office over the past two
> years has turned me off..
> nothing about it is stable.. it stinks.
>
Everyone apart from you is out of step??

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Rob Rob
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

User since LibreOffoce started, and before years of OpenOffice..
Never had stability problems whatsoever, but the latest release 6.1.4 made me wonder.

I went back from 6.1.4 to 6.0.7 because 6.1.4 made a mess of the screen anytime I scrolled fast (in calc), or, especially in the function wizard (which was really unusable).

No problems whatsoever in 6.0.7, though.

Environment MacBook Pro, MacOS Mojave 10.14.2

> Op 11 jan. 2019, om 16:53 heeft Peter Hillier-Brook <[hidden email]> het volgende geschreven:
>
> On 11/01/2019 10:58, fudmier wrote:
>>
>>
>> but I can tell you what has happened to libre office over the past two
>> years has turned me off..
>> nothing about it is stable.. it stinks.
>>
> Everyone apart from you is out of step??
>
> --
> To unsubscribe e-mail to: [hidden email]
> Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> Privacy Policy: https://www.documentfoundation.org/privacy


--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Wade Smart Wade Smart
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

In reply to this post by fudmer rieley
I use Libre everyday. Never had a stability issue. My spreadsheets are up and
used seven days a week around 60 tabs and under 900 rows per tab. No issues.

I would say its user and/or user machine issues.
--
Registered Linux User: #480675
Registered Linux Machine: #408606
Linux since June 2005

On Fri, Jan 11, 2019 at 5:01 AM fudmier <[hidden email]> wrote:

>
>
>
> but I can tell you what has happened to libre office over the past two
> years has turned me off..
> nothing about it is stable.. it stinks.
>
> --
> To unsubscribe e-mail to: [hidden email]
> Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> Privacy Policy: https://www.documentfoundation.org/privacy

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
aguador aguador
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

In reply to this post by Rob
El vie, 11-01-2019 a las 17:08 +0100, Rob escribió:

> User since LibreOffoce started, and before years of OpenOffice..
> Never had stability problems whatsoever, but the latest release 6.1.4
> made me wonder.
>
> I went back from 6.1.4 to 6.0.7 because 6.1.4 made a mess of the
> screen anytime I scrolled fast (in calc), or, especially in the
> function wizard (which was really unusable).
>
> No problems whatsoever in 6.0.7, though.
>
> Environment MacBook Pro, MacOS Mojave 10.14.2
>
> >
The original message is classic trolling, but Rob, have you asked here
or checked bug reports or filed them if not present? Like others I have
been using LO (fresh) on Linux for a few years now without any
stability issues. There is one bug report I filed recently over a GTK3
UI issue that seems to have been fixed. So, yes, we can always roll
back to a version that worked well for us, but we can also raise issues
here and file bug reports so that the software can continue developing
and bugs are not left to fester. The developers are very responsive,
just one more plus for LO.



--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Rob Rob
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

At the moment it happened I did install the new LO over the old one (since I never had any serious problems 😀), so I reversed the same way. At that moment in time I didn’t have the time to work it.
I will however re-install 6.1.4 side-by-side to see if it tase the same behavior as before. If so, I’ll certainly report it.

> Op 12 jan. 2019, om 16:02 heeft Roy <[hidden email]> het volgende geschreven:
>
> El vie, 11-01-2019 a las 17:08 +0100, Rob escribió:
>> User since LibreOffoce started, and before years of OpenOffice..
>> Never had stability problems whatsoever, but the latest release 6.1.4
>> made me wonder.
>>
>> I went back from 6.1.4 to 6.0.7 because 6.1.4 made a mess of the
>> screen anytime I scrolled fast (in calc), or, especially in the
>> function wizard (which was really unusable).
>>
>> No problems whatsoever in 6.0.7, though.
>>
>> Environment MacBook Pro, MacOS Mojave 10.14.2
>>
>>>
> The original message is classic trolling, but Rob, have you asked here
> or checked bug reports or filed them if not present? Like others I have
> been using LO (fresh) on Linux for a few years now without any
> stability issues. There is one bug report I filed recently over a GTK3
> UI issue that seems to have been fixed. So, yes, we can always roll
> back to a version that worked well for us, but we can also raise issues
> here and file bug reports so that the software can continue developing
> and bugs are not left to fester. The developers are very responsive,
> just one more plus for LO.
>
>
>
> --
> To unsubscribe e-mail to: [hidden email]
> Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> Privacy Policy: https://www.documentfoundation.org/privacy


--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
David B Teague sr David B Teague sr
Reply | Threaded
Open this post in threaded view
|

Re: I have been using open office, libre office and open everything since 1985

In reply to this post by fudmer rieley

I started using StarOffice a ways back, then OpenOffice.org, then
Libreoffice since Oracle bought Sun.
I do not now have, nor have I ever had, stability problems, except
_sometimes_ when I install a new release over the old one.  Now, I
_always_ remove the old version before installing a new version. Never a
problem since.

I note that I need to install a new version.

-- David

Version: 6.2.1.2 (x64)
Build ID: 7bcb35dc3024a62dea0caee87020152d1ee96e71
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win;
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded

On 1/11/2019 5:58 AM, fudmier wrote:
>
>
> but I can tell you what has happened to libre office over the past two
> years has turned me off..
> nothing about it is stable.. it stinks.
>

--
nil significat nisi oscillat
do wop, do wop, do wop! -- Duke Ellington



--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy