[Libreoffice-commits] core.git: sw/inc sw/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Mon Dec 12 11:39:18 UTC 2016


 sw/inc/frmfmt.hxx                 |   13 ++++++-------
 sw/source/core/draw/dcontact.cxx  |   25 +++++++++++++++----------
 sw/source/filter/ww8/wrtw8esh.cxx |   18 ++++++++++--------
 3 files changed, 31 insertions(+), 25 deletions(-)

New commits:
commit d505b5d884fd42e063c709125e0e28e0a56045c4
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Dec 11 15:06:02 2016 +0100

    add relative to tablecell as state
    
    Change-Id: I76e9d317dabeefcdf53468a89f3a6130279993f3
    Reviewed-on: https://gerrit.libreoffice.org/31865
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 6cf5619..562c4a7 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -278,22 +278,21 @@ namespace sw
         NO_CONV,
         CONV2PG,
         CONV2COL_OR_PARA,
-        CONV2CHAR_OR_LINE
+        CONV2CHAR_OR_LINE,
+        RELTOTABLECELL
     };
     struct WW8AnchorConvResult final
     {
-        bool m_bHoriRelToTableCell;
-        bool m_bVertRelToTableCell;
+        WW8AnchorConv m_eHoriConv;
+        WW8AnchorConv m_eVertConv;
         bool m_bConverted;
         Point m_aPos;
-        WW8AnchorConvResult() : m_bHoriRelToTableCell(false), m_bVertRelToTableCell(false), m_bConverted(false) {};
+        WW8AnchorConvResult(WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_eHoriConv(eHoriConv), m_eVertConv(eVertConv) {};
     };
     struct SW_DLLPUBLIC WW8AnchorConvHint final : SfxHint
     {
         WW8AnchorConvResult& m_rResult;
-        const WW8AnchorConv m_eHoriConv;
-        const WW8AnchorConv m_eVertConv;
-        WW8AnchorConvHint(WW8AnchorConvResult& rResult, WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_rResult(rResult), m_eHoriConv(eHoriConv), m_eVertConv(eVertConv) {};
+        WW8AnchorConvHint(WW8AnchorConvResult& rResult) : m_rResult(rResult) {};
         virtual ~WW8AnchorConvHint() override;
     };
 }
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index e6a448e..9c3d29c 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1366,12 +1366,18 @@ namespace
         }
         return pAnchorFormat;
     }
-    Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const sw::WW8AnchorConv eConv, const bool bFollowTextFlow, const bool bHori, bool& bRelToTableCell)
+    Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const bool bFollowTextFlow, const bool bHori, sw::WW8AnchorConv& reConv)
     {
-        switch(eConv)
+        switch(reConv)
         {
             case sw::WW8AnchorConv::CONV2PG:
-                return pAnchoredObj->GetRelPosToPageFrame(bFollowTextFlow, bRelToTableCell);
+            {
+                bool bRelToTableCell(false);
+                Point aPos(pAnchoredObj->GetRelPosToPageFrame(bFollowTextFlow, bRelToTableCell));
+                if(bRelToTableCell)
+                    reConv = sw::WW8AnchorConv::RELTOTABLECELL;
+                return aPos;
+            }
             case sw::WW8AnchorConv::CONV2COL_OR_PARA:
                 return pAnchoredObj->GetRelPosToAnchorFrame();
             case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
@@ -1554,21 +1560,20 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
         if(dynamic_cast<SwAnchoredDrawObject*>(pAnchoredObj) && !pAnchoredObj->GetAnchorFrame())
             return;
         const bool bFollowTextFlow = static_cast<const SwDrawFrameFormat&>(rMod).GetFollowTextFlow().GetValue();
+        sw::WW8AnchorConvResult& rResult(pWW8AnchorConvHint->m_rResult);
         // No distinction between layout directions, because of missing
         // information about WW8 in vertical layout.
-        pWW8AnchorConvHint->m_rResult.m_aPos.setX(lcl_GetWW8Pos(
+        rResult.m_aPos.setX(lcl_GetWW8Pos(
                 pAnchoredObj,
-                pWW8AnchorConvHint->m_eHoriConv,
                 bFollowTextFlow,
                 true,
-                pWW8AnchorConvHint->m_rResult.m_bHoriRelToTableCell).getX());
-        pWW8AnchorConvHint->m_rResult.m_aPos.setY(lcl_GetWW8Pos(
+                rResult.m_eHoriConv).getX());
+        rResult.m_aPos.setY(lcl_GetWW8Pos(
                 pAnchoredObj,
-                pWW8AnchorConvHint->m_eHoriConv,
                 bFollowTextFlow,
                 false,
-                pWW8AnchorConvHint->m_rResult.m_bVertRelToTableCell).getY());
-        pWW8AnchorConvHint->m_rResult.m_bConverted = true;
+                rResult.m_eHoriConv).getY());
+        rResult.m_bConverted = true;
     }
 }
 
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 92e83bc..a8b1ac2 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2648,17 +2648,18 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
     }
     if(eVertConv != sw::WW8AnchorConv::NO_CONV || eHoriConv != sw::WW8AnchorConv::NO_CONV)
     {
-        sw::WW8AnchorConvResult aResult;
-        _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult, eHoriConv, eVertConv));
+        sw::WW8AnchorConvResult aResult(eHoriConv, eVertConv);
+        _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
         if(!aResult.m_bConverted)
             return false;
         switch(eHoriConv)
         {
+            case sw::WW8AnchorConv::RELTOTABLECELL:
+                // #i33818#
+                _iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
+                break;
             case sw::WW8AnchorConv::CONV2PG:
                 _iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
-                // #i33818#
-                if(aResult.m_bHoriRelToTableCell)
-                    _iorHoriOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
                 break;
             case sw::WW8AnchorConv::CONV2COL_OR_PARA:
                 _iorHoriOri.SetRelationOrient(text::RelOrientation::FRAME);
@@ -2672,11 +2673,12 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
         _iorHoriOri.SetPos(aResult.m_aPos.X());
         switch(eVertConv)
         {
+            case sw::WW8AnchorConv::RELTOTABLECELL:
+                // #i33818#
+                _iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
+                break;
             case sw::WW8AnchorConv::CONV2PG:
                 _iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
-                // #i33818#
-                if(aResult.m_bVertRelToTableCell)
-                    _iorVertOri.SetRelationOrient(text::RelOrientation::PAGE_PRINT_AREA);
                 break;
             case sw::WW8AnchorConv::CONV2COL_OR_PARA:
                 _iorVertOri.SetRelationOrient(text::RelOrientation::FRAME);


More information about the Libreoffice-commits mailing list