summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/crsr/bookmrk.cxx9
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx20
-rw-r--r--sw/source/core/doc/docbm.cxx15
3 files changed, 37 insertions, 7 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index bcfbaca715a0..89352072ac70 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -40,6 +40,7 @@
#include <DropDownFormFieldButton.hxx>
#include <DocumentContentOperationsManager.hxx>
#include <comphelper/lok.hxx>
+#include <txtfrm.hxx>
#include <view.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <wrtsh.hxx>
@@ -556,8 +557,6 @@ namespace sw::mark
if (eMode == sw::mark::InsertMode::New)
{
lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
- // no need to invalidate text frames here, the insertion of the
- // CH_TXT_ATR already invalidates
}
else
{
@@ -574,6 +573,9 @@ namespace sw::mark
}
::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ // notify layouts to unhide - for the entire fieldmark, as in InitDoc()
+ SwPaM const tmp(GetMarkPos(), GetOtherMarkPos());
+ sw::UpdateFramesForRemoveDeleteRedline(rDoc, tmp);
}
NonTextFieldmark::NonTextFieldmark(const SwPaM& rPaM)
@@ -806,6 +808,9 @@ namespace sw::mark
}
::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ // notify layouts to unhide - for the entire fieldmark, as in InitDoc()
+ SwPaM const tmp(GetMarkPos(), GetOtherMarkPos());
+ sw::UpdateFramesForRemoveDeleteRedline(rDoc, tmp);
}
void DateFieldmark::ShowButton(SwEditWin* pEditWin)
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 17419eda39ba..466ffa0464a0 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -137,6 +137,10 @@ static void UpdateFieldsForRedline(IDocumentFieldsAccess & rIDFA)
void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{
+ if (rDoc.IsClipBoard())
+ {
+ return;
+ }
// no need to call UpdateFootnoteNums for FTNNUM_PAGE:
// the AppendFootnote/RemoveFootnote will do it by itself!
rDoc.GetFootnoteIdxs().UpdateFootnote(rPam.Start()->nNode);
@@ -144,6 +148,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
SwTextNode * pStartNode(rPam.Start()->nNode.GetNode().GetTextNode());
while (!pStartNode)
{
+ // note: branch only taken for redlines, not fieldmarks
SwStartNode *const pTableOrSectionNode(
currentStart.nNode.GetNode().IsTableNode()
? static_cast<SwStartNode*>(currentStart.nNode.GetNode().GetTableNode())
@@ -155,7 +160,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
}
for (SwRootFrame const*const pLayout : rDoc.GetAllLayouts())
{
- if (pLayout->IsHideRedlines())
+ if (pLayout->HasMergedParas())
{
if (pTableOrSectionNode->IsTableNode())
{
@@ -180,7 +185,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pNode);
for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
{
- if (pFrame->getRootFrame()->IsHideRedlines())
+ if (pFrame->getRootFrame()->HasMergedParas())
{
frames.push_back(pFrame);
}
@@ -233,12 +238,17 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{
+ if (rDoc.IsClipBoard())
+ {
+ return;
+ }
bool isAppendObjsCalled(false);
rDoc.GetFootnoteIdxs().UpdateFootnote(rPam.Start()->nNode);
SwPosition currentStart(*rPam.Start());
SwTextNode * pStartNode(rPam.Start()->nNode.GetNode().GetTextNode());
while (!pStartNode)
{
+ // note: branch only taken for redlines, not fieldmarks
SwStartNode const*const pTableOrSectionNode(
currentStart.nNode.GetNode().IsTableNode()
? static_cast<SwStartNode*>(currentStart.nNode.GetNode().GetTableNode())
@@ -248,7 +258,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{
pTableOrSectionNode->GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::None);
}
- if (rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines())
+ if (rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->HasMergedParas())
{
// note: this will also create frames for all currently hidden flys
// because it calls AppendAllObjs
@@ -269,7 +279,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pNode);
for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
{
- if (pFrame->getRootFrame()->IsHideRedlines())
+ if (pFrame->getRootFrame()->HasMergedParas())
{
frames.push_back(pFrame);
}
@@ -329,7 +339,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{ // recreate flys in the one node the hard way...
for (auto const& pLayout : rDoc.GetAllLayouts())
{
- if (pLayout->IsHideRedlines())
+ if (pLayout->HasMergedParas())
{
AppendAllObjs(rDoc.GetSpzFrameFormats(), pLayout);
break;
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index c2af85f1cd0a..406685c58691 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -42,6 +42,7 @@
#include <sal/log.hxx>
#include <UndoBookmark.hxx>
#include <tools/datetimeutils.hxx>
+#include <txtfrm.hxx>
#include <view.hxx>
#include <libxml/xmlstring.h>
@@ -687,6 +688,20 @@ namespace sw::mark
// no special array for these
break;
}
+ if (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK
+ || eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK)
+ {
+ // due to SwInsText notifications everything is visible now - tell
+ // layout to hide as appropriate
+ // note: we don't know how many layouts there are and which
+ // parts they hide, so just notify the entire fieldmark, it
+ // should give the right result if not in the most efficient way
+ // note2: can't be done in InitDoc() because it requires the mark
+ // to be inserted in the vectors.
+ SwPaM const tmp(pMark->GetMarkPos(), pMark->GetOtherMarkPos());
+ sw::UpdateFramesForAddDeleteRedline(m_rDoc, tmp);
+ }
+
SAL_INFO("sw.core", "--- makeType ---");
SAL_INFO("sw.core", "Marks");
lcl_DebugMarks(m_vAllMarks);