I am trying to write an OOo Basic macro enabling the automatic resize of the Math formulas embedded as objects in a Writer document. The behavior I would like to implement is:
1. if there is no selection, then operate on the whole document;
2. else operate only on the objects in the selection.
The logic to solve the problem 1 is:
- Code: Select all Expand viewCollapse view
for i = 0 to ThisComponent.getEmbeddedObjects().count - 1
obj = objs(i).getEmbeddedObject()
if (not IsNull(obj)) and obj.supportsService("com.sun.star.formula.FormulaProperties") then
obj.BaseFontHeight = newFontSize ' set somehow
end if
next i
but I am not able to obtain the collection of the objects in the current selection, given the fact that, for example:
- Code: Select all Expand viewCollapse view
objs_in_sel = doc.getCurrentSelection().getByIndex(0).getEmbeddedObjects()
does not work.
I would really appreciate an help.
Luca