[Libreoffice-commits] core.git: Branch 'feature/borderline3' - drawinglayer/source include/svx svx/source sw/source

Armin Le Grand Armin.Le.Grand at cib.de
Wed Sep 13 08:31:05 UTC 2017


 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx |   27 ++++++++++----
 include/svx/framelinkarray.hxx                            |    5 ++
 svx/source/table/viewcontactoftableobj.cxx                |   12 +++---
 sw/source/core/layout/paintfrm.cxx                        |   16 ++++++--
 4 files changed, 45 insertions(+), 15 deletions(-)

New commits:
commit ae9941f6515dd1a655dd88a5219f27409a5bb064
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Wed Sep 13 10:29:29 2017 +0200

    borderline: Added merge BorderLinePrimitive2D
    
    Added BorderLinePrimitive2D merges for Writer and fixes,
    also clang fixes for clang build
    
    Change-Id: Ia4172a5db085569f899a4c5ad3faca57823e7b52

diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 5fc3b57fbbda..eba1f7f0d996 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -439,7 +439,15 @@ namespace drawinglayer
                     return Primitive2DReference();
                 }
 
-                if(!rBT.isGap())
+                if(rBT.isGap())
+                {
+                    // when gap, width has to be equal
+                    if(!rtl::math::approxEqual(rBT.getLineAttribute().getWidth(), rBC.getLineAttribute().getWidth()))
+                    {
+                        return Primitive2DReference();
+                    }
+                }
+                else
                 {
                     // when not gap, the line extends have at least reach to the center ( > 0.0),
                     // else there is a extend usage. When > 0.0 they just overlap, no problem
@@ -465,11 +473,18 @@ namespace drawinglayer
                 const BorderLine& rBT(pCandidateA->getBorderLines()[a]);
                 const BorderLine& rBC(pCandidateB->getBorderLines()[a]);
 
-                aMergedBorderLines.push_back(
-                    BorderLine(
-                        rBT.getLineAttribute(),
-                        rBT.getStartLeft(), rBT.getStartRight(),
-                        rBC.getEndLeft(), rBC.getEndRight()));
+                if(rBT.isGap())
+                {
+                    aMergedBorderLines.push_back(rBT);
+                }
+                else
+                {
+                    aMergedBorderLines.push_back(
+                        BorderLine(
+                            rBT.getLineAttribute(),
+                            rBT.getStartLeft(), rBT.getStartRight(),
+                            rBC.getEndLeft(), rBC.getEndRight()));
+                }
             }
 
             return Primitive2DReference(
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 83b6c28d2524..2b06d29a41b2 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -319,6 +319,11 @@ private:
     std::unique_ptr<ArrayImpl>        mxImpl;
 };
 
+// helper to merge B2DPrimitive(s) in rSource and add to rTarget
+void SVX_DLLPUBLIC HelperMergeInB2DPrimitiveArray(
+    const drawinglayer::primitive2d::Primitive2DContainer& rSource,
+    drawinglayer::primitive2d::Primitive2DContainer& rTarget);
+
 }
 }
 
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 52d6ce42b943..90d143665140 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -208,14 +208,14 @@ namespace sdr
             const basegfx::B2DVector aY(basegfx::getNormalizedPerpendicular(rX));
 
             /// Fill top-left Style Table
-            if(rLeftA.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftA, -aY, bHor ? true : false));
-            if(rLeftB.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftB, -rX, bHor ? true : true));
-            if(rLeftC.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftC, aY, bHor ? false : true));
+            if(rLeftA.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftA, -aY, bHor)); // bHor ? true : false));
+            if(rLeftB.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftB, -rX, true)); // bHor ? true : true));
+            if(rLeftC.IsUsed()) aStart.push_back(svx::frame::StyleVectorCombination(rLeftC, aY, !bHor)); // bHor ? false : true));
 
             /// Fill bottom-right Style Table
-            if(rRightA.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightA, -aY, bHor ? true : false));
-            if(rRightB.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightB, rX, bHor ? false : false));
-            if(rRightC.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightC, aY, bHor ? false : true));
+            if(rRightA.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightA, -aY, bHor)); // bHor ? true : false));
+            if(rRightB.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightB, rX, false)); // bHor ? false : false));
+            if(rRightC.IsUsed()) aEnd.push_back(svx::frame::StyleVectorCombination(rRightC, aY, !bHor)); // bHor ? false : true));
 
             CreateBorderPrimitives(
                 rContainer,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 888db6527e77..15f7ffcdedf3 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -88,6 +88,7 @@
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
 #include <svx/unoapi.hxx>
+#include <svx/framelinkarray.hxx>
 #include <comphelper/sequence.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/color/bcolortools.hxx>
@@ -2431,7 +2432,8 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
     aUpper.Pos() += pUpper->Frame().Pos();
     SwRect aUpperAligned( aUpper );
     ::SwAlignRect( aUpperAligned, gProp.pSGlobalShell, &rDev );
-    drawinglayer::primitive2d::Primitive2DContainer aSequence;
+    drawinglayer::primitive2d::Primitive2DContainer aHorizontalSequence;
+    drawinglayer::primitive2d::Primitive2DContainer aVerticalSequence;
 
     while ( true )
     {
@@ -2559,7 +2561,7 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
                         if(aStyles[ 6 ].IsUsed()) aEndTable.push_back(svx::frame::StyleVectorCombination(aStyles[ 6 ], aY, false)); // aRFromB
 
                         CreateBorderPrimitives(
-                            aSequence,
+                            aHorizontalSequence,
                             aOrigin,
                             aX,
                             aStyles[ 0 ],
@@ -2589,7 +2591,7 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
                         if(aStyles[ 4 ].IsUsed()) aEndTable.push_back(svx::frame::StyleVectorCombination(aStyles[ 4 ], aY, true)); // aBFromL
 
                         CreateBorderPrimitives(
-                            aSequence,
+                            aVerticalSequence,
                             aOrigin,
                             aX,
                             aStyles[ 0 ],
@@ -2604,6 +2606,14 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
         ++aIter;
     }
 
+    // to stay compatible, create order as it was formally. Also try to
+    // merge primitives as far as possible
+    drawinglayer::primitive2d::Primitive2DContainer aSequence;
+
+    svx::frame::HelperMergeInB2DPrimitiveArray(aHorizontalSequence, aSequence);
+    svx::frame::HelperMergeInB2DPrimitiveArray(aVerticalSequence, aSequence);
+
+    // paint
     mrTabFrame.ProcessPrimitives(aSequence);
 
     // restore output device:


More information about the Libreoffice-commits mailing list