borderline: Added merge BorderLinePrimitive2D
Added BorderLinePrimitive2D merges for Writer and fixes.
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 5fc3b57..eba1f7f 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 83b6c28..2b06d29 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/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 2d81cae..db54294 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -249,9 +249,6 @@ struct ArrayImpl
long GetColPosition( size_t nCol ) const;
long GetRowPosition( size_t nRow ) const;
long GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
bool HasCellRotation() const;
};
@@ -375,16 +372,6 @@ long ArrayImpl::GetRowPosition( size_t nRow ) const
return maYCoords[ nRow ];
}
long ArrayImpl::GetColWidth( size_t nFirstCol, size_t nLastCol ) const
{
return GetColPosition( nLastCol + 1 ) - GetColPosition( nFirstCol );
}
long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
{
return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
}
bool ArrayImpl::HasCellRotation() const
{
// check cell array
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 52d6ce4..90d1436 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 4ba2fc1..89c4351 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: