Association between ToC index object and its paragraph content

Michael Stahl mstahl at redhat.com
Tue Dec 12 14:53:41 UTC 2017


On 12.12.2017 14:22, Jens Tröger wrote:
> Michael, I the case you describe would I not see the same UNO object address for the same paragraph in the document? But iterating over the ToC’s paragraphs as described previously in this thread, I get for the index view:
> 
>     pyuno object (com.sun.star.text.XTextContent)0x7feddb8d2638{implementationName=SwXParagraph, … }
> 
> and then for the global document view:
> 
>     pyuno object (com.sun.star.text.XTextContent)0x7fedd9f5f598{implementationName=SwXParagraph, … }
> 
> for the same first entry paragraph in the ToC. In fact, if I instantiate the ToC’s text range three times, then I get three different objects for the first paragraph:
> 
>     pyuno object (com.sun.star.text.XTextContent)0x7fc6b1d41188
>     pyuno object (com.sun.star.text.XTextContent)0x7fc6b1e66968
>     pyuno object (com.sun.star.text.XTextContent)0x7fc6b430e288
> 
> Do paragraphs have another unique identifier that associates these different instances as objects representing the same document paragraph?

do you retain a reference to the paragraphs somewhere?  Writer itself
doesn't keep the SwXParagraph alive, so if your extension drops the last
reference to it then it will be deleted and a new one created the next time.


More information about the LibreOffice mailing list