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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Mon Dec 12 11:42:10 UTC 2016


 sw/inc/frmfmt.hxx                 |    3 ++-
 sw/source/core/draw/dcontact.cxx  |   20 +++++++-------------
 sw/source/filter/ww8/wrtw8esh.cxx |   19 +++++++++++--------
 3 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 01afbf12788b070b90eb306d86ea2870857a1328
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Dec 11 16:15:58 2016 +0100

    reintroduce CONV2CHAR/CONV2LINE split
    
    Change-Id: I02a3a46d2222b8bfe955eb17ca655d36d9155b48
    Reviewed-on: https://gerrit.libreoffice.org/31867
    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 562c4a7..029eea1 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -278,7 +278,8 @@ namespace sw
         NO_CONV,
         CONV2PG,
         CONV2COL_OR_PARA,
-        CONV2CHAR_OR_LINE,
+        CONV2CHAR,
+        CONV2LINE,
         RELTOTABLECELL
     };
     struct WW8AnchorConvResult final
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 9c3d29c..2ef6e6d 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1366,7 +1366,7 @@ namespace
         }
         return pAnchorFormat;
     }
-    Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const bool bFollowTextFlow, const bool bHori, sw::WW8AnchorConv& reConv)
+    Point lcl_GetWW8Pos(SwAnchoredObject* pAnchoredObj, const bool bFollowTextFlow, sw::WW8AnchorConv& reConv)
     {
         switch(reConv)
         {
@@ -1380,8 +1380,10 @@ namespace
             }
             case sw::WW8AnchorConv::CONV2COL_OR_PARA:
                 return pAnchoredObj->GetRelPosToAnchorFrame();
-            case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
-                return bHori ? pAnchoredObj->GetRelPosToChar() : pAnchoredObj->GetRelPosToLine();
+            case sw::WW8AnchorConv::CONV2CHAR:
+                return pAnchoredObj->GetRelPosToChar();
+            case sw::WW8AnchorConv::CONV2LINE:
+                return pAnchoredObj->GetRelPosToLine();
             default: ;
         }
         assert(false);
@@ -1563,16 +1565,8 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
         sw::WW8AnchorConvResult& rResult(pWW8AnchorConvHint->m_rResult);
         // No distinction between layout directions, because of missing
         // information about WW8 in vertical layout.
-        rResult.m_aPos.setX(lcl_GetWW8Pos(
-                pAnchoredObj,
-                bFollowTextFlow,
-                true,
-                rResult.m_eHoriConv).getX());
-        rResult.m_aPos.setY(lcl_GetWW8Pos(
-                pAnchoredObj,
-                bFollowTextFlow,
-                false,
-                rResult.m_eHoriConv).getY());
+        rResult.m_aPos.setX(lcl_GetWW8Pos(pAnchoredObj, bFollowTextFlow, rResult.m_eHoriConv).getX());
+        rResult.m_aPos.setY(lcl_GetWW8Pos(pAnchoredObj, bFollowTextFlow, 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 71f83fd..6382e88 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2449,7 +2449,7 @@ void SwEscherEx::FinishEscher()
 namespace
 {
     template<typename OrientType>
-    void lcl_SetRelationOrient(OrientType& rOrient, const sw::WW8AnchorConv eConv, const bool bHori, std::function<void()> fDefault)
+    void lcl_SetRelationOrient(OrientType& rOrient, const sw::WW8AnchorConv eConv, std::function<void()> fDefault)
     {
         switch(eConv)
         {
@@ -2463,11 +2463,14 @@ namespace
             case sw::WW8AnchorConv::CONV2COL_OR_PARA:
                 rOrient.SetRelationOrient(text::RelOrientation::FRAME);
                 break;
-            case sw::WW8AnchorConv::CONV2CHAR_OR_LINE:
-                rOrient.SetRelationOrient(bHori ? text::RelOrientation::CHAR : text::RelOrientation::TEXT_LINE);
+            case sw::WW8AnchorConv::CONV2CHAR:
+                rOrient.SetRelationOrient(text::RelOrientation::CHAR);
+                break;
+            case sw::WW8AnchorConv::CONV2LINE:
+                rOrient.SetRelationOrient(text::RelOrientation::TEXT_LINE);
                 break;
             default:
-                fDefault();//rOrient.SetHoriOrient(text::HoriOrientation::NONE);
+                fDefault();
         }
     }
 }
@@ -2590,7 +2593,7 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
                 case text::RelOrientation::CHAR:
                 {
                     if ( bConvDueToOrientation )
-                        eHoriConv = sw::WW8AnchorConv::CONV2CHAR_OR_LINE;
+                        eHoriConv = sw::WW8AnchorConv::CONV2CHAR;
                 }
                 break;
                 default:
@@ -2658,7 +2661,7 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
                     if ( bConvDueToOrientation ||
                          _iorVertOri.GetVertOrient() == text::VertOrientation::NONE )
                     {
-                        eVertConv = sw::WW8AnchorConv::CONV2CHAR_OR_LINE;
+                        eVertConv = sw::WW8AnchorConv::CONV2LINE;
                     }
                 }
                 break;
@@ -2678,9 +2681,9 @@ bool WinwordAnchoring::ConvertPosition( SwFormatHoriOrient& _iorHoriOri,
         _rFrameFormat.CallSwClientNotify(sw::WW8AnchorConvHint(aResult));
         if(!aResult.m_bConverted)
             return false;
-        lcl_SetRelationOrient(_iorHoriOri, eHoriConv, true, [&_iorHoriOri]() {_iorHoriOri.SetHoriOrient(text::HoriOrientation::NONE);} );
+        lcl_SetRelationOrient(_iorHoriOri, eHoriConv, [&_iorHoriOri]() {_iorHoriOri.SetHoriOrient(text::HoriOrientation::NONE);} );
         _iorHoriOri.SetPos(aResult.m_aPos.X());
-        lcl_SetRelationOrient(_iorVertOri, eVertConv, false, [&_iorVertOri]() {_iorVertOri.SetVertOrient(text::VertOrientation::NONE);} );
+        lcl_SetRelationOrient(_iorVertOri, eVertConv, [&_iorVertOri]() {_iorVertOri.SetVertOrient(text::VertOrientation::NONE);} );
         _iorVertOri.SetPos(aResult.m_aPos.Y());
         return true;
     }


More information about the Libreoffice-commits mailing list