diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-24 14:22:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-24 14:57:06 +0100 |
commit | 0a2abff1b0167ce2380e538562755da666c6753b (patch) | |
tree | 6bdf13069c87f9f46df7335a73177901a583e5d9 /sw | |
parent | 3de6d4d3c7b733fde0feef3d77aeb7c4c48724d0 (diff) |
return SwNode from SwContact::GetContentAnchor
part of the process of making SwFormatAnchor not use an SwPosition
(because SwFormatAnchor does weird does with the internals of an
SwPosition)
Change-Id: I662f977214b70fa7eb37e460e4535e14e8a3fe28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143222
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/anchoredobject.hxx | 2 | ||||
-rw-r--r-- | sw/inc/dcontact.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/docfly.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 16 |
5 files changed, 16 insertions, 15 deletions
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 35224efdc0b9..114380d6f04d 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -162,7 +162,7 @@ class SW_DLLPUBLIC SwAnchoredObject // object positioning friend bool sw_HideObj( const SwTextFrame& _rFrame, const RndStdIds _eAnchorType, - SwPosition const& rAnchorPos, + SwFormatAnchor const& rFormatAnchor, SwAnchoredObject* _pAnchoredObj ); protected: SwAnchoredObject(); diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 8bfdb6bdb50a..c10d83c6dec5 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -149,10 +149,11 @@ public: bool ObjAnchoredAtChar() const { return GetAnchorId() == RndStdIds::FLY_AT_CHAR; } bool ObjAnchoredAsChar() const { return GetAnchorId() == RndStdIds::FLY_AS_CHAR; } - const SwPosition& GetContentAnchor() const + const SwNode& GetAnchorNode() const { - assert( GetAnchorFormat().GetContentAnchor() ); - return *(GetAnchorFormat().GetContentAnchor()); + const SwNode* pNode = GetAnchorFormat().GetAnchorNode(); + assert( pNode ); + return *pNode; } /** get data collection of anchored objects, handled by with contact */ diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 0cf7ccc44a5a..685394b0fe19 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -771,7 +771,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, const RndStdIds eOldAnchorType = pContact->GetAnchorId(); if ( !_bSameOnly && eOldAnchorType == RndStdIds::FLY_AS_CHAR ) { - oOldAsCharAnchorPos.emplace(pContact->GetContentAnchor()); + oOldAsCharAnchorPos.emplace(*pContact->GetAnchorFormat().GetContentAnchor()); } if ( _bSameOnly ) diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index c4a5d5faac51..e4b517a0759f 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1489,8 +1489,8 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall()); if (pContact && !pContact->ObjAnchoredAtPage() ) { - const SwPosition& rPos = pContact->GetContentAnchor(); - bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rPos.GetNode() ); + const SwNode& rAnchorNode = pContact->GetAnchorNode(); + bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rAnchorNode ); if (IsHeaderFooterEdit() != bInHdrFtr) { bRet = false; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 4c483a82edf5..f0400c3cb91d 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1485,7 +1485,7 @@ void SwTextFrame::HideFootnotes(TextFrameIndex const nStart, TextFrameIndex cons */ bool sw_HideObj( const SwTextFrame& _rFrame, const RndStdIds _eAnchorType, - SwPosition const& rAnchorPos, + SwFormatAnchor const& rFormatAnchor, SwAnchoredObject* _pAnchoredObj ) { bool bRet( true ); @@ -1499,9 +1499,9 @@ bool sw_HideObj( const SwTextFrame& _rFrame, pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && _rFrame.IsInDocBody() && !_rFrame.FindNextCnt() ) { - SwTextNode const& rNode(*rAnchorPos.GetNode().GetTextNode()); + SwTextNode const& rNode(*rFormatAnchor.GetAnchorNode()->GetTextNode()); assert(FrameContainsNode(_rFrame, rNode.GetIndex())); - sal_Int32 const nObjAnchorPos(rAnchorPos.GetContentIndex()); + sal_Int32 const nObjAnchorPos(rFormatAnchor.GetContentAnchor()->GetContentIndex()); const sal_Unicode cAnchorChar = nObjAnchorPos < rNode.Len() ? rNode.GetText()[nObjAnchorPos] : 0; @@ -1560,7 +1560,7 @@ void SwTextFrame::HideAndShowObjects() // under certain conditions const RndStdIds eAnchorType( pContact->GetAnchorId() ); if ((eAnchorType != RndStdIds::FLY_AT_CHAR) || - sw_HideObj(*this, eAnchorType, pContact->GetContentAnchor(), + sw_HideObj(*this, eAnchorType, pContact->GetAnchorFormat(), i )) { pContact->MoveObjToInvisibleLayer( pObj ); @@ -1594,13 +1594,13 @@ void SwTextFrame::HideAndShowObjects() { sal_Int32 nHiddenStart; sal_Int32 nHiddenEnd; - const SwPosition& rAnchor = pContact->GetContentAnchor(); + const SwFormatAnchor& rAnchorFormat = pContact->GetAnchorFormat(); SwScriptInfo::GetBoundsOfHiddenRange( - *rAnchor.GetNode().GetTextNode(), - rAnchor.GetContentIndex(), nHiddenStart, nHiddenEnd); + *rAnchorFormat.GetAnchorNode()->GetTextNode(), + rAnchorFormat.GetContentAnchor()->GetContentIndex(), nHiddenStart, nHiddenEnd); // Under certain conditions if ( nHiddenStart != COMPLETE_STRING && bShouldBeHidden && - sw_HideObj(*this, eAnchorType, rAnchor, i)) + sw_HideObj(*this, eAnchorType, rAnchorFormat, i)) { pContact->MoveObjToInvisibleLayer( pObj ); } |