I see where you go to the end of the document, but I don't see you placing the 
cursor at the start.

I expect you to first go to the start with no selection and then Juno to the 
end with selection.

I suspect that you are simply setting  paragraph properties on the last  
paragraph.

That said, it is difficult for me to read the code on my phone....

You may need  to enumerate the content (paragraphs) and set each paragraph or 
supported text content areas especially of your content is complex; for 
example, containing tables or frames.

On Feb 10, 2015 8:52 AM, fma <fma3...@gmail.com> wrote:
>
> 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. 
> 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 
>
>
>
> -- 
> View this message in context: 
> http://nabble.documentfoundation.org/Java-sidebar-extensions-and-LibreOffice-tp4139084p4139618.html
>  
> Sent from the Dev mailing list archive at Nabble.com. 
> _______________________________________________ 
> LibreOffice mailing list 
> LibreOffice@lists.freedesktop.org 
> http://lists.freedesktop.org/mailman/listinfo/libreoffice 
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to