-------------------------------------------------------------------------------
THIS ANSWER HAS BEEN EDITED
-------------------------------------------------------------------------------
I found it!!!
Still don’t know what’s going on behind the scenes, but at least the panel is now visible.
In the build path of the extension, I changed the pointing of unoil.jar from the file included in the path of AOO installation ( [aoo_installation_path]\program\classes ) to the one in the installation path of LO ( [aoo_installation_path]\program\classes ).
This raised an error in AnalogClockPanel.java, which was asking for adding the unimplemented method getMinimalWidth(): I added it, generated the oxt file and… Voila!.. the extension now runs fine on LO 4.4 too.
-------------------------------------------------------------------------------
PROBLEMS MENTIONED BELOW HAVE BEEN SOLVED:
Got it!!!
More similar to a workaround than a real solution, at least it works: a gotoStart()
call was included in the original code (even if not in the snippets) and it didn’t work, but simply putting the code to change font and alignment as well as to add page breaks (see code snippets in my previous reply) at the beginning, before doing everything else, was the solution.
Now all kind of formatting, replacements and insertions are correctly put in the active document.
-------------------------------------------------------------------------------
Unfortunately, I have now two problems with my custom extension, which manipulates in several ways the active text document.
In details, I have two operations running fine in AOO 4.1.1 but having unexpected results in LO 4.4; here they are:
Code snippet 1 - expected behaviour: formatting the whole document with font Arial Black, size 14, justified; current behaviour: only the last paragraph is formatted
// active writer document
XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xCurrentComponent);
// creating text range and cursor
XText xText = xTextDocument.getText();
XTextRange xTextRange = xText.createTextCursor();
// going to the end of document
((XTextCursor)xTextRange).gotoEnd(true);
// getting properties
XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextRange);
// setting font size
xTextProps.setPropertyValue("CharHeight", new Float(14));
// justifying
xTextProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.BLOCK);
// setting font
xTextProps.setPropertyValue("CharFontName", "Arial Black");
Code snippet 2 - expected behaviour: inserting a page break just before each paragraph starting with the word “Chapter”; current behaviour: nothing happens
XTextCursor xTextCursor = xText.createTextCursor();
// using a search descriptor to perform insert operations
XSearchable xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class, xTextDocument);
XSearchDescriptor xSearchDescriptor = xSearchable.createSearchDescriptor();
xSearchDescriptor.setPropertyValue("SearchRegularExpression", new Boolean(true));
xSearchDescriptor.setPropertyValue("SearchCaseSensitive", new Boolean(true));
xSearchDescriptor.setSearchString("Chapter");
XInterface xInterface= (XInterface) xSearchable.findFirst(xSearchDescriptor);
while (xInterface != null){
XTextRange xStart = (com.sun.star.text.XTextRange) UnoRuntime.queryInterface(com.sun.star.text.XTextRange.class, xInterface);
xTextCursor.gotoRange(xStart, false);
XPropertySet cursorProperty = UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
cursorProperty.setPropertyValue("BreakType", BreakType.PAGE_BEFORE); //$NON-NLS-1$
xInterface = (XInterface) xSearchable.findNext(xInterface, xSearchDescriptor);
}
Any ideas about the reasons of the misbehaviour?
Thanks in advance and best regards