Author: steve_y
Date: Thu Jan 2 10:46:03 2014
New Revision: 1554783
URL: http://svn.apache.org/r1554783
Log:
Bug 119568 - [From Symphony] The page number of the TOC is not correct if open
the .docx via AOO
Modified:
openoffice/trunk/main/sw/source/core/unocore/unoidx.cxx
Modified: openoffice/trunk/main/sw/source/core/unocore/unoidx.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unoidx.cxx?rev=1554783&r1=1554782&r2=1554783&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unoidx.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unoidx.cxx Thu Jan 2 10:46:03
2014
@@ -67,6 +67,7 @@
#include <chpfld.hxx>
#include <SwStyleNameMapper.hxx>
#include <unoevtlstnr.hxx>
+#include <editsh.hxx>
using namespace ::com::sun::star;
@@ -583,6 +584,21 @@ throw (uno::RuntimeException)
/*-- 14.12.98 09:35:05---------------------------------------------------
-----------------------------------------------------------------------*/
+void lcl_CalcLayout(SwDoc *pDoc)
+{
+ ViewShell *pViewShell = 0;
+ SwEditShell* pEditShell = pDoc ? pDoc->GetEditShell(&pViewShell) : 0;
+ if (pEditShell)
+ {
+ pEditShell->CalcLayout();
+ }
+ else if (pViewShell)
+ {
+ pViewShell->CalcLayout();
+ }
+
+}
+
void SAL_CALL SwXDocumentIndex::update() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -595,6 +611,10 @@ void SAL_CALL SwXDocumentIndex::update()
throw uno::RuntimeException();
}
pTOXBase->Update();
+
+ // the insertion of TOC will affect the document layout
+ lcl_CalcLayout(m_pImpl->m_pDoc);
+
// page numbers
pTOXBase->UpdatePageNum();
}