Ask Your Question

Draw: convert line to connector

asked 2019-04-24 08:54:53 +0200

--marc gravatar image

updated 2019-04-25 19:08:10 +0200

Question: Is it possible to convert a Line to a Connector either programmatically or through the user interface in LibreOffice 6? If yes, then what would be the process or approach?

Scenario: I'm exporting SVG from another program. The original drawings prior to SVG export have objects connected with lines similar to the LibreOffice Draw connector/gluepoint concept. So, the SVG line ends to be converted are geometrically close to the object connection point.

Findings: The closest information that I've found so far is the 2014 OpenOffice Forum "[Solved] Change a line to a connector programmatically" discussion. The OpenOffice approach was to replace the selected line with a connection; and, use some logic to find nearest candidate glue points.

Sub Line2Connector
   Dim oDoc As Object
   Dim oConnector As Object
   Dim oShapes(0) As Object, oShape As Object
   Dim oDP As Object
   Dim oSelection As Object, oLine As Object
   Dim i As Long, j As Long, k As Long, n As Long
   Dim oCoords, PolyPoints
   Dim EndPoints(1) As New
   Dim MinDistance As Double, MinShapeIndex(1) As Long, MinGlueIndex(1) As Long

REM ... just some of code shown

Could the current LibreOffice 6 API support some approach to replace a line with connector?

Some "convert line to connector" capability would be a useful feature or extension for LibreOffice Draw. (Key to help migrate some legacy documents into LibreOffice.) Does this type of functionality already exist for LibreOffice? If not, would the approach as mentioned for OpenOffice likely be implementable as a LibreOffice python macro?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-04-24 09:10:57 +0200

kompilainenn gravatar image

No, you can't change type of line between simple Line and any Connector. It's hard coded

edit flag offensive delete link more


With the understanding that Line and Connectors are distinct different types, might the approach discussed in the OpenOffice forum snippets to _replace a line with a connector_ have any chance of being implementable? For example, are the LibreOffice Draw objects (selected and not-selected) possibly accessible via the LibreOffice 6 API?

--marc gravatar image--marc ( 2019-04-24 20:47:07 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-04-24 08:54:53 +0200

Seen: 43 times

Last updated: Apr 25