Automatically section update with java

Michael Meeks michael.meeks at suse.com
Mon Mar 5 02:08:35 PST 2012


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.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list