summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-09-13 10:29:29 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-09-14 16:58:30 +0200
commit2a6d9e4a344711174692a82738fefc46182cc8e7 (patch)
tree550f71d1734b87c0004473a571897444c2124eb1
parent5b1e06b34c1602d616c0eb5bd80818d226268d9e (diff)
borderline: Added merge BorderLinePrimitive2D
Added BorderLinePrimitive2D merges for Writer and fixes, also clang fixes for clang build Change-Id: Ia4172a5db085569f899a4c5ad3faca57823e7b52
-rw-r--r--drawinglayer/source/primitive2d/borderlineprimitive2d.cxx27
-rw-r--r--include/svx/framelinkarray.hxx5
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx12
-rw-r--r--sw/source/core/layout/paintfrm.cxx16
4 files changed, 45 insertions, 15 deletions
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 4ba2fc11ec57..89c4351957a8 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: