Date: prev next · Thread: first prev next last
2019 Archives by date, by thread · List index


Hello everybody,
                It is my first post on this mailing-list and probably not the last one, so I will 
introduce myself.
I'm Vincent LORENZO and I'm developing with my colleagues an UML modeler, called Papyrus and based 
on Eclipse (https://www.eclipse.org/papyrus/ ).
We are developing a new feature to generate a text document from a UML model and we use the 
LibreOffice API.
We found many examples to start a document creation and now we have a good prototype. Each relevant 
element of the UML model is transformed into title, section, paragraph, image, ... in an odt file.
At this step, we want to store additional datas for each LibreOffice elements, in order to identify 
the UML element used to create a title, a paragraph, ... to be able to reverse future text changes 
into the initial UML model.

We want these additional data not to be directly visible to the user.
We want a start and end tag around each information coming from the uml model. (so inside a title, 
text, cell, ...)


Question 1:
Currently we are studying the possibility to use the Bookmark field's name to store these datas. We 
want to use the Bookmark with start and end tag, to get something like that.
<text:bookmark-start text:name="UML_element_qualified_name_and_others_useful_informations" />
              Some text
       <text:bookmark-end text:name=" UML_element_qualified_name_and_others_useful_informations " />

In reality, I would prefer to be able to use a more structured datas, extending the Bookmark object 
(or using another solution ? ) to get that, something like that:

       <text:bookmark-start text:name="Bookmark1" umlElementQualifiedName="Package1::Class1" 
umlElementKind="Class" umlElementfeature="name" id="xxx"/>
                           Some text
       <text:bookmark-end text:name="Bookmark1" />

but I have no idea if it is possible and how to do that. Please, does someone have an idea to 
structure my datas ?
Of course, if you have a better solution than Bookmark, fell free to propose it.



Question 2:
Today, I succeed to create a such Bookmark, using the example: 
https://api.libreoffice.org/examples/java/Text/BookmarkInsertion.java.
I have this code:



     //document is already created, I'm creating a title

1.                  xTextCursor.setString(text);

2.                  xTextCursor.gotoEnd(false);

3.                  XInterface xSearchInterface = FindFirst(odtEditor.getXTextDocument(), text);  
//(copy of the method provided by the example)

4.                  XTextRange xSearchTextRange = 
UnoRuntime.queryInterface(com.sun.star.text.XTextRange.class, xSearchInterface);

5.                  InsertBookmark(odtEditor.getXTextDocument(), xSearchTextRange, "niceBookMark"); 
//(copy of the method provided by the example)


So, in this example, I write text, I look for it, then I create a XTextRange and at the end, I can 
create the Bookmark. I'm not very have happy with this solution. I would prefer a solution without 
the search step, but I don't know how to get a valid XTextRange (I admit I don't yet well 
understand  the behavior of the API).
Please, do you have some pointer or code example ?


I thank you to read me until here.
Have a nice day.

Regards,
--
Vincent LORENZO
01-69-08-17-24
CEA Saclay Nano-INNOV
Institut CARNOT CEA LIST
Point Courrier n° 174
91 191 Gif sur Yvette CEDEX


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.