summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx42
-rw-r--r--sw/source/core/doc/docbm.cxx14
-rw-r--r--sw/source/core/inc/bookmrk.hxx10
3 files changed, 62 insertions, 4 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 6643e77f03e9..f299436eeb61 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -238,6 +238,12 @@ namespace
io_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr);
};
+
+ auto InvalidatePosition(SwPosition const& rPos) -> void
+ {
+ SwUpdateAttr const hint(rPos.nContent.GetIndex(), rPos.nContent.GetIndex(), 0);
+ rPos.nNode.GetNode().GetTextNode()->NotifyClients(nullptr, &hint);
+ }
}
namespace sw::mark
@@ -336,6 +342,10 @@ namespace sw::mark
}
}
+ auto MarkBase::InvalidateFrames() -> void
+ {
+ }
+
NavigatorReminder::NavigatorReminder(const SwPaM& rPaM)
: MarkBase(rPaM, MarkBase::GenerateNewName("__NavigatorReminder__"))
{ }
@@ -392,6 +402,7 @@ namespace sw::mark
std::make_unique<SwUndoInsBookmark>(*this));
}
io_pDoc->getIDocumentState().SetModified();
+ InvalidateFrames();
}
void Bookmark::DeregisterFromDoc(SwDoc* const io_pDoc)
@@ -404,6 +415,35 @@ namespace sw::mark
std::make_unique<SwUndoDeleteBookmark>(*this));
}
io_pDoc->getIDocumentState().SetModified();
+ InvalidateFrames();
+ }
+
+ // invalidate text frames in case it's hidden or Formatting Marks enabled
+ auto Bookmark::InvalidateFrames() -> void
+ {
+ InvalidatePosition(GetMarkPos());
+ if (IsExpanded())
+ {
+ InvalidatePosition(GetOtherMarkPos());
+ }
+ }
+
+ void Bookmark::Hide(bool const isHide)
+ {
+ if (isHide != m_bHidden)
+ {
+ m_bHidden = isHide;
+ InvalidateFrames();
+ }
+ }
+
+ void Bookmark::SetHideCondition(OUString const& rHideCondition)
+ {
+ if (m_sHideCondition != rHideCondition)
+ {
+ m_sHideCondition = rHideCondition;
+ InvalidateFrames();
+ }
}
::sfx2::IXmlIdRegistry& Bookmark::GetRegistry()
@@ -512,6 +552,8 @@ namespace sw::mark
if (eMode == sw::mark::InsertMode::New)
{
lcl_SetFieldMarks(this, io_pDoc, 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
{
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 4144ad47a567..bff33b553eb9 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -561,6 +561,16 @@ namespace sw::mark
pPos2->nContent.GetIndex());
}
#endif
+ if ( (!rPaM.GetPoint()->nNode.GetNode().IsTextNode()
+ // huh, SwXTextRange puts one on table node?
+ && !rPaM.GetPoint()->nNode.GetNode().IsTableNode())
+ || (!rPaM.GetMark()->nNode.GetNode().IsTextNode()
+ && !rPaM.GetMark()->nNode.GetNode().IsTableNode()))
+ {
+ SAL_WARN("sw.core", "MarkManager::makeMark(..)"
+ " - refusing to create mark on non-textnode");
+ return nullptr;
+ }
// There should only be one CrossRefBookmark per Textnode per Type
if ((eType == MarkType::CROSSREF_NUMITEM_BOOKMARK || eType == MarkType::CROSSREF_HEADING_BOOKMARK)
&& (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.Start(), eType) != m_vBookmarks.end()))
@@ -809,6 +819,8 @@ namespace sw::mark
if (!pMarkBase)
return;
+ pMarkBase->InvalidateFrames();
+
pMarkBase->SetMarkPos(*(rPaM.GetPoint()));
if(rPaM.HasMark())
pMarkBase->SetOtherMarkPos(*(rPaM.GetMark()));
@@ -818,6 +830,8 @@ namespace sw::mark
if(pMarkBase->GetMarkPos() != pMarkBase->GetMarkStart())
pMarkBase->Swap();
+ pMarkBase->InvalidateFrames();
+
sortMarks();
}
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 3960ca4b3d8b..fe5bff942568 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -90,6 +90,8 @@ namespace sw {
virtual void ClearOtherMarkPos()
{ m_pPos2.reset(); }
+ virtual auto InvalidateFrames() -> void;
+
virtual OUString ToString( ) const override;
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
@@ -170,6 +172,8 @@ namespace sw {
virtual void DeregisterFromDoc(SwDoc* const io_pDoc) override;
+ virtual auto InvalidateFrames() -> void override;
+
virtual const OUString& GetShortName() const override
{ return m_sShortName; }
virtual const vcl::KeyCode& GetKeyCode() const override
@@ -182,10 +186,8 @@ namespace sw {
{ return m_bHidden; }
virtual const OUString& GetHideCondition() const override
{ return m_sHideCondition; }
- virtual void Hide(bool rHide) override
- { m_bHidden = rHide; }
- virtual void SetHideCondition(const OUString& rHideCondition) override
- { m_sHideCondition = rHideCondition; }
+ virtual void Hide(bool rHide) override;
+ virtual void SetHideCondition(const OUString& rHideCondition) override;
// ::sfx2::Metadatable
virtual ::sfx2::IXmlIdRegistry& GetRegistry() override;