Automatically section update with java

Toygun toygunozbek at
Mon Mar 5 12:46:27 PST 2012

Hi Michael,
thank you for your answer. But i didn't mean the right click 'update 
index / table'.

i try to explain again :-) Sorry for english.

document A has 2 inserted Sections,  Section1 and Section2.

Section1 is from document B and Section2 is from document C.

I change the contents in Section1 in Document B  or/and
Section2 in document C. (Sections contains text, images or table, with 
styles ... )

Now when i open the document A after changes, i get the popup window with
the Message :

"This document contains one or more links to external data.
Would you like to change the document, and update all links
to get the most recent data?"

This is the update what i mean.

I just want to implement this update behavior with some java code.
Maybe it is possible to do it by hand with ODFToolkit but i don't know what
i consider for this update / merge.

I thought that i find in this list any information from any developer,
because they know how this behavior implemented in the core code.

Maybe it can be helpfull to see how this action in core code implemented
and where?

I'll try the other mailing-lists. :-)


On 03/05/2012 11:08 AM, Michael Meeks wrote:
> Hi Toygun,
> On Mon, 2012-03-05 at 08:46 +0100, Toygun wrote:
>> I have a odt document where I inserted 2 sections from other documents.
>> Changing these sections requires an update in the enclosing document
>> when using Libre Office or OpenOffice (popup is asking me).
> 	OK; if you mean the right click 'update index / table' then I would
> grep for the UI string in the code, eg.
> 	git grep -i8 'pdate Index/Table'
> 	find the id:
> 	git grep -8  FN_UPDATE_CUR_TOX
> 	find what method is being called to do the update, presumably this
> code:
>          case FN_UPDATE_CUR_TOX:
>          {
>              const SwTOXBase* pBase = pWrtShell->GetCurTOX();
>              if(pBase)
>              {
>                  pWrtShell->StartAction();
>                  if(TOX_INDEX == pBase->GetType())
>                      pWrtShell->ApplyAutoMark();
>                  pWrtShell->UpdateTableOf( *pBase );
>                  pWrtShell->EndAction();
>              }
>          }
> 	Then grep for this UpdateTableOf method, to see if there is some UNO
> implementation that goes near there. From a quick grep, it looks like:
> void SAL_CALL SwXDocumentIndex::update() throw (uno::RuntimeException)
> {
>      SolarMutexGuard aGuard;
>      SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
>      SwTOXBaseSection *const pTOXBase = (pFmt) ?
>          static_cast<SwTOXBaseSection*>(pFmt->GetSection()) : 0;
>      if(!pTOXBase)
>      {
>          throw uno::RuntimeException();
>      }
>      pTOXBase->Update();
>      // page numbers
>      pTOXBase->UpdatePageNum();
> }
> 	Might be what you want.	
> 	Then again, your question was rather vague as to what you wanted to
> update - sections ? and really this list is for hacking on the core
> libreoffice code, not for questions around scripting it :-)
> 	HTH,
> 		Michael.

More information about the LibreOffice mailing list