sw/source/filter/ww8/ww8par2.cxx |    8 ++++----
 sw/source/filter/ww8/ww8par2.hxx |    4 ++--
 sw/source/filter/ww8/ww8par6.cxx |    8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 3d09becf194bf1702a389ee59a7d6df899a570dd
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 24 14:04:03 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 24 17:30:47 2021 +0100

    ofz#41250 use more SwUnoCursors
    
    Change-Id: I6bcfa71a140b048c74861cc9f344f456ed4a38f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125774
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7cf96ade0bc2..80ab5bf19716 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2448,7 +2448,7 @@ void WW8TabDesc::CreateSwTable()
     if (bInsNode)
         m_pIo->AppendTextNode(*pPoint);
 
-    m_xTmpPos.reset(new SwPosition(*m_pIo->m_pPaM->GetPoint()));
+    m_xTmpPos = m_pIo->m_rDoc.CreateUnoCursor(*m_pIo->m_pPaM->GetPoint());
 
     // Because SW cannot handle multi-page floating frames,
     // _any unnecessary_ floating tables have been converted to inline.
@@ -2483,7 +2483,7 @@ void WW8TabDesc::CreateSwTable()
     // rows of a band can be duplicated easy.
     m_pTable = m_pIo->m_rDoc.InsertTable(
             SwInsertTableOptions( SwInsertTableFlags::HeadlineNoBorder, 0 ),
-            *m_xTmpPos, m_nBands, m_nDefaultSwCols, m_eOri );
+            *m_xTmpPos->GetPoint(), m_nBands, m_nDefaultSwCols, m_eOri );
 
     OSL_ENSURE(m_pTable && m_pTable->GetFrameFormat(), "insert table failed");
     if (!m_pTable || !m_pTable->GetFrameFormat())
@@ -2501,7 +2501,7 @@ void WW8TabDesc::CreateSwTable()
     // contains a Pagedesc. If so that Pagedesc would be moved to the
     // row after the table, that would be wrong. So delete and
     // set later to the table format.
-    if (SwTextNode *const pNd = m_xTmpPos->nNode.GetNode().GetTextNode())
+    if (SwTextNode *const pNd = 
m_xTmpPos->GetPoint()->nNode.GetNode().GetTextNode())
     {
         if (const SfxItemSet* pSet = pNd->GetpSwAttrSet())
         {
@@ -2788,7 +2788,7 @@ void WW8TabDesc::MoveOutsideTable()
 {
     OSL_ENSURE(m_xTmpPos && m_pIo, "I've forgotten where the table is 
anchored");
     if (m_xTmpPos && m_pIo)
-        *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos;
+        *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos->GetPoint();
 }
 
 void WW8TabDesc::FinishSwTable()
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index cb5029c63277..709ca3447c0e 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -66,7 +66,7 @@ struct WW8SwFlyPara
 
                 // part 2: changes found during reading
     tools::Long nNewNetWidth;
-    std::unique_ptr<SwPosition> xMainTextPos;   // to return to main text 
after apo
+    std::shared_ptr<SwUnoCursor> xMainTextPos;   // to return to main text 
after apo
     sal_uInt16 nLineSpace;          // line space in tw for graf apos
     bool bAutoWidth;
     bool bTogglePos;
@@ -204,7 +204,7 @@ class WW8TabDesc
     WW8TabBandDesc* m_pFirstBand;
     WW8TabBandDesc* m_pActBand;
 
-    std::unique_ptr<SwPosition> m_xTmpPos;
+    std::shared_ptr<SwUnoCursor> m_xTmpPos;
 
     SwTableNode* m_pTableNd;          // table node
     const SwTableLines* m_pTabLines;  // row array of node
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 2074983ee90c..57f73675b17e 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2505,7 +2505,7 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults 
&rApo, const WW8_TablePos *p
         }
 
         // remember Pos in body text
-        m_xSFlyPara->xMainTextPos.reset(new SwPosition(*m_pPaM->GetPoint()));
+        m_xSFlyPara->xMainTextPos = 
m_rDoc.CreateUnoCursor(*m_pPaM->GetPoint());
 
         //remove fltanchors, otherwise they will be closed inside the
         //frame, which makes no sense, restore them after the frame is
@@ -2578,7 +2578,7 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool 
bStealAttr)
             {
                 // If an open apo pos is here, then clear it before
                 // JoinNext destroys it
-                SwNodeIndex aOpenApoPos(m_xSFlyPara->xMainTextPos->nNode);
+                SwNodeIndex 
aOpenApoPos(m_xSFlyPara->xMainTextPos->GetPoint()->nNode);
                 if (aOpenApoPos == aToBeJoined)
                     m_xSFlyPara->xMainTextPos.reset();
             }
@@ -2653,7 +2653,7 @@ void SwWW8ImplReader::StopApo()
         SwNodeIndex aPref(m_pPaM->GetPoint()->nNode, -1);
 
         SwTwips nNewWidth =
-            MoveOutsideFly(m_xSFlyPara->pFlyFormat, 
*m_xSFlyPara->xMainTextPos);
+            MoveOutsideFly(m_xSFlyPara->pFlyFormat, 
*m_xSFlyPara->xMainTextPos->GetPoint());
         if (nNewWidth)
             m_xSFlyPara->BoxUpWidth(nNewWidth);
 
@@ -2732,7 +2732,7 @@ void SwWW8ImplReader::StopApo()
 
             if (!m_bFuzzing)
             {
-                CalculateFlySize(aFlySet, m_xSFlyPara->xMainTextPos->nNode,
+                CalculateFlySize(aFlySet, 
m_xSFlyPara->xMainTextPos->GetPoint()->nNode,
                     m_xSFlyPara->nWidth);
             }
 

Reply via email to