summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2014-01-02 10:46:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-01-02 16:18:40 +0000
commitf65568118fc1ac71c22a3084e0a1bdd315a91006 (patch)
treeb0cd0b36600e79f940fefe83ea40f4f45ca7dfd5
parent4261ccb307e38a96f52e2ed0dd8e7c372bc97556 (diff)
Resolves: #i119568# The page number of the docx in the TOC is not correct
(cherry picked from commit 875f8fb79613875296139a6cbdbae265a92d7a32) Conflicts: sw/source/core/unocore/unoidx.cxx Change-Id: Ie5c66c8226284413419a5b4c105e9529cf8cadf7
-rw-r--r--sw/source/core/unocore/unoidx.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 6dd8bb943e70..3ecbe75492ea 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -55,6 +55,7 @@
#include <ndtxt.hxx>
#include <docsh.hxx>
#include <chpfld.hxx>
+#include <editsh.hxx>
#include <SwStyleNameMapper.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/string.hxx>
@@ -1230,6 +1231,20 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
OSL_FAIL("SwXDocumentIndex::removeVetoableChangeListener(): not implemented");
}
+void lcl_CalcLayout(SwDoc *pDoc)
+{
+ SwViewShell *pViewShell = 0;
+ SwEditShell* pEditShell = pDoc ? pDoc->GetEditShell(&pViewShell) : 0;
+ if (pEditShell)
+ {
+ pEditShell->CalcLayout();
+ }
+ else if (pViewShell)
+ {
+ pViewShell->CalcLayout();
+ }
+}
+
// XRefreshable
void SAL_CALL SwXDocumentIndex::refresh() throw (uno::RuntimeException)
{
@@ -1246,6 +1261,10 @@ void SAL_CALL SwXDocumentIndex::refresh() throw (uno::RuntimeException)
static_cast< ::cppu::OWeakObject*>(this));
}
pTOXBase->Update();
+
+ // the insertion of TOC will affect the document layout
+ lcl_CalcLayout(m_pImpl->m_pDoc);
+
// page numbers
pTOXBase->UpdatePageNum();
}