Kaydet (Commit) d7db9dcb authored tarafından Michael Stahl's avatar Michael Stahl

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
üst c7d42c03
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <txtfrm.hxx> #include <txtfrm.hxx>
#include <doc.hxx> #include <doc.hxx>
#include <IDocumentUndoRedo.hxx> #include <IDocumentUndoRedo.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentState.hxx> #include <IDocumentState.hxx>
#include <redline.hxx> #include <redline.hxx>
#include <UndoRedline.hxx> #include <UndoRedline.hxx>
...@@ -29,6 +30,7 @@ ...@@ -29,6 +30,7 @@
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <unocrsr.hxx> #include <unocrsr.hxx>
#include <ftnidx.hxx> #include <ftnidx.hxx>
#include <authfld.hxx>
#include <strings.hrc> #include <strings.hrc>
#include <swmodule.hxx> #include <swmodule.hxx>
#include <editsh.hxx> #include <editsh.hxx>
...@@ -119,6 +121,20 @@ using namespace com::sun::star; ...@@ -119,6 +121,20 @@ using namespace com::sun::star;
namespace sw { 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) void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{ {
// no need to call UpdateFootnoteNums for FTNNUM_PAGE: // no need to call UpdateFootnoteNums for FTNNUM_PAGE:
...@@ -148,6 +164,8 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) ...@@ -148,6 +164,8 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
// node of the merged frame, there could be another redline nearby // node of the merged frame, there could be another redline nearby
sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, *pStartNode, nullptr); 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) void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
...@@ -205,6 +223,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) ...@@ -205,6 +223,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
AppendAllObjs(rDoc.GetSpzFrameFormats(), pLayout); AppendAllObjs(rDoc.GetSpzFrameFormats(), pLayout);
} }
} }
// fields last - SwGetRefField::UpdateField requires up-to-date frames
UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes
} }
} // namespace sw } // namespace sw
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment