Simplified Libreoffice API

Mindaugas mindauga at freemail.lt
Sat Mar 16 09:16:02 PDT 2013


In my opinion at first we must decide what goals we  seek and what problems
we try to solve and after think how do that.
I think scripting API must be simple, logical and should be used without
significant training and long-term UNO structure studies. 
 
I personally would like the next changes:

- all object properties must be accessed directly from object, not matter
from which area (model, frame or   controller) they are, for example:
object.value="aaa"
object.height=111
object.X=1111
object.Y=11111
object.setActive()

instead cumbersome current structures:

Dim Point As New com.sun.star.awt.Point
Dim Size As New com.sun.star.awt.Size
Point.x = 1000
Point.y = 1000
Size.Width = 10000
Size.Height = 10000
LineShape.Size = Size
LineShape.Position = Point

or more complicated structure for form controls (as example in my first
post)


-add drawings, forms, controls directly to Calc or Writer document without
DrawPages 

-simplify creating of new object:

objects.new() or objects.create() 
or
new(object) or create(object) 

instead current:

Circle =Doc.createInstance("com.sun.star.drawing.EllipseShape")
Page.add(Circle)



-simplify long constants names ( à la
com.sun.star.table.CellContentType.TEXT to CellContentType.TEXT or simply
TEXT)

-remove inconsistency in methods, properties and their names, for example,
if we have ListBox control in dialog property, in form ListBox this property
must be the same with the sames arguments in the same order. Other example -
we must access table cell an get all roprties  by the same method or
property in Calc an Writer. 

-make properties and methods smarter:

-- instead getByName, getByIndex, getCellByPosition, getCellByName use
Cell("a1") and Cell(0,0) or Sheet("sheet 1") and Sheet(0)
-- instead cell.string, cell.value, cell.formula use cell.value("1"),
cell.value(1), cell.value("=A1+A2")
--instead StarDesktop.loadComponentFromURL(Url) use
loadComponent("file:///C:/test.odt") or loadComponent("C:\test.odt")
--instead insertByName,insertByIndex - method insert() or new()
--instead removeByName,removeByIndex - method remove() or delete()
--instead getCellRangeByName, CellAddress, CellRangeAddress use
Range("A1:B1") or Range(0,0,1,1)
etc



Best regards

Mindaugas




--
View this message in context: http://nabble.documentfoundation.org/Simplified-Libreoffice-API-tp4043112p4044203.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list