Since writer shape styles are not implemented using regular styles method it is not a quick and simple task to set some pre-set paramaters for some shapes. The mentioned question/post indicates that it takes time to go into properties and manually change varying properties of a shape.
Once I have an appropriately edited shape such as a line (eg, appropriate width, any arrows, colour, size, etc) I tend to copy and paste this shape in the event that it is needed again. However, some undesirable options such as angle are copied as well.
So I want to create a macro which I can bind to a keyboard sequence to set the angle of a line/arrow/shape object to 0 after I have pasted it but not sure how.
Have found the following code which is for OpenOffice and meant to generate lines in writer. However, in
LibreOffice it generates some lines it in LO Draw rather than resetting the selected writer shape angle to zero.
Whilst this is not exactly what I am looking for, it is a starting point. Miserably terrible at macros and programming so wondering if anybody has an idea how to programmatically set currently selected line or shape angle to zero. Additionally, if there is any guidance on other properties which can be implemented / edited programmatically individual macros can be set up as a kind of “style”. (because apparently workable styles for shapes are not available in LO at this point).
EXAMPLE MACRO DrawLinesInWriteDocument, page 323 of Andrew Pitonyak’s OpenOffice.org Macros Explained - V4: (section text below):
13.9.3 Writer,
"Each Writer document contains a single draw page for the entire document. In Writer, the page is like a transparent layer containing drawing data on top of the standard document data.
Writer documents do not support the XDrawPagesSupplier interface, because they only contain a single draw page. They do, however, support the XDrawPageSupplier interface, which defines the single object method getDrawPage().
The macro in Listing 290 uses optional draw page properties — namely height and width. The draw page from a Writer document does not contain these properties. The draw page in a Writer document has other peculiarities, however. For example, adding lines to the draw page — as done in Listing 290 — adds them as characters at the cursor position rather than interpreting the positions as specific locations in the document. The macro in Listing 292 draws lines to demonstrate this behavior (also see Figure 85)"
Sub DrawLinesInWriteDocument
Dim oDoc 'Newly created Writer document
Dim oDrawPage 'The draw page that will contain the graphics image
Dim oShape 'Shape to insert
REM Create a new Writer document!
oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter",_
"_default", 0, Array())
oDrawPage = oDoc.getDrawPage()
Dim i As Long
Dim oSize as new com.sun.star.awt.Size
Dim dStepSize As Double
dStepSize = 800
For i = 0 To 10
oShape = oDoc.createInstance("com.sun.star.drawing.LineShape")
oShape.LineColor = rgb(255, 255 - 20 * i, 20 * i)
oShape.LineWidth = 50
oSize.width = dStepSize - CLng(CDbl(i) * dStepSize / 10)/2
oSize.width = CLng(dStepSize/5 * i - dStepSize)
oSize.height= dStepSize
oShape.setSize(oSize)
oDrawPage.add(oShape)
Next
End Sub