sw/inc/fesh.hxx                      |    2 +-
 sw/qa/core/frmedt/frmedt.cxx         |    8 ++++----
 sw/source/core/frmedt/fews.cxx       |    8 ++++----
 sw/source/ui/frmdlg/frmpage.cxx      |    2 +-
 sw/source/uibase/docvw/edtwin.cxx    |   12 ++++++------
 sw/source/uibase/frmdlg/frmmgr.cxx   |    2 +-
 sw/source/uibase/inc/frmmgr.hxx      |    2 +-
 sw/source/uibase/inc/frmpage.hxx     |    2 +-
 sw/source/uibase/shells/drwbassh.cxx |    6 +++---
 9 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 493a714d4a62f78a4726d09d3258c425939c94c3
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Nov 24 15:21:24 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 24 18:55:43 2022 +0100

    pass SwFormatAnchor to SwFEShell::CalcBoundRect
    
    part of the process of making SwFormatAnchor not use an SwPosition
    (because SwFormatAnchor does weird does with the internals of an
    SwPosition)
    
    Change-Id: I1694ae83070082f10699aa7b3bd2a043c518d0c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143227
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 8a94960d3e29..63dc89afbc74 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -333,7 +333,7 @@ public:
                         const RndStdIds _nAnchorId,
                         const sal_Int16 _eHoriRelOrient = 
css::text::RelOrientation::FRAME,
                         const sal_Int16 _eVertRelOrient = 
css::text::RelOrientation::FRAME,
-                        const SwPosition* _pToCharContentPos = nullptr,
+                        const SwFormatAnchor* _pToCharContentPos = nullptr,
                         const bool _bFollowTextFlow = false,
                         bool _bMirror = false,
                         Point* _opRef = nullptr,
diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx
index 473dd414c293..6d6c3735724a 100644
--- a/sw/qa/core/frmedt/frmedt.cxx
+++ b/sw/qa/core/frmedt/frmedt.cxx
@@ -54,9 +54,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor)
     SwFrameFormat* pTextFrameFormat = FindFrameFormat(pTextFrameObj);
     CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), pTextFrameFormat->GetName());
     SwFrameFormat* pDrawShapeFormat = FindFrameFormat(pDrawShape);
-    SwNodeOffset nOldAnchor = 
pDrawShapeFormat->GetAnchor().GetContentAnchor()->GetNodeIndex();
+    SwNodeOffset nOldAnchor = 
pDrawShapeFormat->GetAnchor().GetAnchorNode()->GetIndex();
     pShell->FindAnchorPos(pTextFrameObj->GetLastBoundRect().Center(), true);
-    SwNodeOffset nNewAnchor = 
pDrawShapeFormat->GetAnchor().GetContentAnchor()->GetNodeIndex();
+    SwNodeOffset nNewAnchor = 
pDrawShapeFormat->GetAnchor().GetAnchorNode()->GetIndex();
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected: 6
     // - Actual  : 9
@@ -94,13 +94,13 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testVertPosFromBottomBoundingBox)
     RndStdIds eAnchorType = RndStdIds::FLY_AT_CHAR;
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
     const auto& rFrameFormats = *pDoc->GetFrameFormats();
-    const SwPosition* pContentPos = 
rFrameFormats[0]->GetAnchor().GetContentAnchor();
+    const SwFormatAnchor* pFormatAhchor = &rFrameFormats[0]->GetAnchor();
     sal_Int16 eHoriRelOrient = text::RelOrientation::PAGE_FRAME;
     sal_Int16 eVertRelOrient = text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
     bool bFollowTextFlow = false;
     bool bMirror = false;
     Size aPercentSize;
-    pWrtShell->CalcBoundRect(aBoundRect, eAnchorType, eHoriRelOrient, 
eVertRelOrient, pContentPos,
+    pWrtShell->CalcBoundRect(aBoundRect, eAnchorType, eHoriRelOrient, 
eVertRelOrient, pFormatAhchor,
                              bFollowTextFlow, bMirror, nullptr, &aPercentSize);
 
     // Without the accompanying fix in place, this test would have failed with:
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 034adb425ca1..c89e26cf6a2c 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -691,7 +691,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
                                const RndStdIds _nAnchorId,
                                const sal_Int16 _eHoriRelOrient,
                                const sal_Int16 _eVertRelOrient,
-                               const SwPosition* _pToCharContentPos,
+                               const SwFormatAnchor* _pToCharContentPos,
                                const bool _bFollowTextFlow,
                                bool _bMirror,
                                Point* _opRef,
@@ -993,7 +993,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
                     SwRect aChRect;
                     if ( _pToCharContentPos )
                     {
-                        pTextFrame->GetAutoPos( aChRect, *_pToCharContentPos );
+                        pTextFrame->GetAutoPos( aChRect, 
*_pToCharContentPos->GetContentAnchor() );
                     }
                     else
                     {
@@ -1007,7 +1007,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
                 {
                     if ( _pToCharContentPos )
                     {
-                        pTextFrame->GetTopOfLine( nTop, *_pToCharContentPos );
+                        pTextFrame->GetTopOfLine( nTop, 
*_pToCharContentPos->GetContentAnchor() );
                     }
                     else
                     {
@@ -1037,7 +1037,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
                 SwRect aChRect;
                 if ( _pToCharContentPos )
                 {
-                    pTextFrame->GetAutoPos( aChRect, *_pToCharContentPos );
+                    pTextFrame->GetAutoPos( aChRect, 
*_pToCharContentPos->GetContentAnchor() );
                 }
                 else
                 {
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 8b3d517df6a0..5e86c11d6c90 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -971,7 +971,7 @@ void SwFramePage::Reset( const SfxItemSet *rSet )
 
     // i#22341 - determine content position of character
     // Note: content position can be NULL
-    mpToCharContentPos = rAnchor.GetContentAnchor();
+    mpToCharContentPos = rAnchor.GetContentAnchor() ? &rAnchor : nullptr;
 
     // i#18732 - init checkbox value
     {
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 75b489ec59ea..5aa8bb75fe51 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1084,10 +1084,10 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
         const SwFormatVertOrient& aVert( aSet.Get(RES_VERT_ORIENT) );
         const bool bFollowTextFlow =
                 aSet.Get(RES_FOLLOW_TEXT_FLOW).GetValue();
-        const SwPosition* pToCharContentPos = 
aSet.Get(RES_ANCHOR).GetContentAnchor();
+        const SwFormatAnchor& rFormatAnchor = aSet.Get(RES_ANCHOR);
         rSh.CalcBoundRect( aBoundRect, eAnchorId,
                            text::RelOrientation::FRAME, 
aVert.GetRelationOrient(),
-                           pToCharContentPos, bFollowTextFlow,
+                           &rFormatAnchor, bFollowTextFlow,
                            false, &aRefPoint );
     }
     tools::Long nLeft = std::min( aTmp.Left() - aBoundRect.Left(), 
aSnap.Width() );
@@ -6569,11 +6569,11 @@ bool SwEditWin::IsOverHeaderFooterFly( const Point& 
rDocPos, FrameControlType& r
         SwFrameFormat* pFlyFormat = pStartFly->GetFlyFormat( );
         if ( pFlyFormat )
         {
-            const SwPosition* pAnchor = pFlyFormat->GetAnchor( 
).GetContentAnchor( );
-            if ( pAnchor )
+            const SwNode* pAnchorNode = pFlyFormat->GetAnchor( 
).GetAnchorNode( );
+            if ( pAnchorNode )
             {
-                bool bInHeader = pAnchor->GetNode( ).FindHeaderStartNode( ) != 
nullptr;
-                bool bInFooter = pAnchor->GetNode( ).FindFooterStartNode( ) != 
nullptr;
+                bool bInHeader = pAnchorNode->FindHeaderStartNode( ) != 
nullptr;
+                bool bInFooter = pAnchorNode->FindFooterStartNode( ) != 
nullptr;
 
                 bRet = bInHeader || bInFooter;
                 if ( bInHeader )
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx 
b/sw/source/uibase/frmdlg/frmmgr.cxx
index e6d788f0e6c9..d135f5f2d24b 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -261,7 +261,7 @@ void SwFlyFrameAttrMgr::SetAbsPos( const Point& rPoint )
 
 // check metrics for correctness
 void SwFlyFrameAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
-        const SwPosition* pToCharContentPos,
+        const SwFormatAnchor* pToCharContentPos,
         bool bOnlyPercentRefValue )
 {
     if (!bOnlyPercentRefValue)
diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx
index 9368766e43a3..c5ac8eba3edd 100644
--- a/sw/source/uibase/inc/frmmgr.hxx
+++ b/sw/source/uibase/inc/frmmgr.hxx
@@ -115,7 +115,7 @@ public:
 
     // check and change metrics
     void                ValidateMetrics(SvxSwFrameValidation& rVal,
-                            const SwPosition* pToCharContentPos,
+                            const SwFormatAnchor* pToCharContentPos,
                             bool bOnlyPercentRefValue = false);
 
     void                DelAttr(sal_uInt16 nId);
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index f6da2b115c89..2f816348332c 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -57,7 +57,7 @@ class SwFramePage final : public SfxTabPage
 
     // OD 12.11.2003 #i22341# - keep content position of character for
     // to character anchored objects.
-    const SwPosition* mpToCharContentPos;
+    const SwFormatAnchor* mpToCharContentPos;
 
     // old alignment
     sal_Int16 m_nOldH;
diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index 71c66a046e7d..9606f9c0551c 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -1052,20 +1052,20 @@ IMPL_LINK(SwDrawBaseShell, ValidatePosition, 
SvxSwFrameValidation&, rValidation,
     // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
     //      aligned to page for fly frame anchored to paragraph or to 
character.
     const RndStdIds eAnchorType = rValidation.nAnchorType;
-    const SwPosition* pContentPos = nullptr;
+    const SwFormatAnchor* pAnchor = nullptr;
     SdrView*  pSdrView = pSh->GetDrawView();
     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     if( rMarkList.GetMarkCount() == 1 )
     {
         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
         SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
-        pContentPos = pFrameFormat->GetAnchor().GetContentAnchor();
+        pAnchor = &pFrameFormat->GetAnchor();
     }
 
     pSh->CalcBoundRect( aBoundRect, eAnchorType,
                            rValidation.nHRelOrient,
                            rValidation.nVRelOrient,
-                           pContentPos,
+                           pAnchor,
                            rValidation.bFollowTextFlow,
                            rValidation.bMirror, nullptr, 
&rValidation.aPercentSize);
 

Reply via email to