summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-09 16:04:17 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-14 18:42:15 +0100
commit2fb5eb5b83220ba28b965ae699a376138442fc33 (patch)
tree6d4e01c9df5c3343ca83d3878aef0f9d4e456d86
parent978d10d28e12748e4328ada16ee6f563dd659cec (diff)
sw_redlinehide_3: update fields on redline ops
Can't tell which chapter/reference fields will be affected by a redline, so we have to either update all of them, or rely on the IDocumentSettingAccess::getFieldUpdateFlags() which lets the SwIdle update the fields, at some later time... Change-Id: I3b9cfd17bd227a18f64dac193f0cc912768810c1
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 0d4448a79079..a5b60561abdf 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -22,6 +22,7 @@
#include <txtfrm.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentFieldsAccess.hxx>
#include <IDocumentState.hxx>
#include <redline.hxx>
#include <UndoRedline.hxx>
@@ -29,6 +30,7 @@
#include <ndtxt.hxx>
#include <unocrsr.hxx>
#include <ftnidx.hxx>
+#include <authfld.hxx>
#include <strings.hrc>
#include <swmodule.hxx>
#include <editsh.hxx>
@@ -119,6 +121,20 @@ using namespace com::sun::star;
namespace sw {
+static void UpdateFieldsForRedline(IDocumentFieldsAccess & rIDFA)
+{
+ auto const pAuthType(static_cast<SwAuthorityFieldType*>(rIDFA.GetFieldType(
+ SwFieldIds::TableOfAuthorities, OUString(), false)));
+ if (pAuthType) // created on demand...
+ {
+ pAuthType->DelSequenceArray();
+ }
+ rIDFA.GetFieldType(SwFieldIds::RefPageGet, OUString(), false)->UpdateFields();
+ rIDFA.GetSysFieldType(SwFieldIds::Chapter)->UpdateFields();
+ rIDFA.UpdateExpFields(nullptr, false);
+ rIDFA.UpdateRefFields();
+}
+
void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{
// no need to call UpdateFootnoteNums for FTNNUM_PAGE:
@@ -148,6 +164,8 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
// node of the merged frame, there could be another redline nearby
sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, *pStartNode, nullptr);
}
+ // fields last - SwGetRefField::UpdateField requires up-to-date frames
+ UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes
}
void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
@@ -205,6 +223,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
AppendAllObjs(rDoc.GetSpzFrameFormats(), pLayout);
}
}
+ // fields last - SwGetRefField::UpdateField requires up-to-date frames
+ UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes
}
} // namespace sw