diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-27 16:03:48 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-28 18:09:10 +0200 |
commit | f62c65459100bd45bfc274e2b2587d5c6804feb2 (patch) | |
tree | dabc17be4da16b5427aea3b95cdd244c852218ed /svx | |
parent | 7202cfa0d3bae430f8fcb8508ed389583a14539b (diff) |
borderline: corrections for calc and writer
Made corrections/finetuning for Calc and Writer.
Had to remove some former code which tried to do
corrections.
Change-Id: Id9fc687b9a709d250faaad76c37ecfda8d8feb9b
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/framelink.cxx | 100 | ||||
-rw-r--r-- | svx/source/dialog/framelinkarray.cxx | 10 | ||||
-rw-r--r-- | svx/source/dialog/frmsel.cxx | 3 |
3 files changed, 32 insertions, 81 deletions
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index c746e881679c..9bb3830b421d 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -278,73 +278,6 @@ bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder, // Drawing functions -// get offset to center of line in question -double lcl_getCenterOfLineOffset(const Style& rBorder, bool bLeftEdge) -{ - const bool bPrimUsed(!basegfx::fTools::equalZero(rBorder.Prim())); // left - const bool bDistUsed(!basegfx::fTools::equalZero(rBorder.Dist())); // distance - const bool bSecnUsed(!basegfx::fTools::equalZero(rBorder.Secn())); // right - - if (bDistUsed || bSecnUsed) - { - // double line, get center by adding half distance and half line width. - // bLeftEdge defines which line to use - return (rBorder.Dist() + (bLeftEdge ? rBorder.Prim() : rBorder.Secn())) * 0.5; - } - else if (bPrimUsed) - { - // single line, get center - return rBorder.Prim() * 0.5; - } - - // no line width at all, stay on unit vector - return 0.0; -} - -double lcl_GetExtent( - const Style& rBorder, const Style& rSide, const Style& rOpposite, - long nAngleSide, long nAngleOpposite, - bool bLeftEdge, // left or right of rBorder - bool bOtherLeft ) // left or right of rSide/rOpposite -{ - Style aOtherBorder = rSide; - long nOtherAngle = nAngleSide; - if ( rSide.GetWidth() == 0 && rOpposite.GetWidth() > 0 ) - { - nOtherAngle = nAngleOpposite; - aOtherBorder = rOpposite; - } - else if ( rSide.GetWidth() == 0 && rOpposite.GetWidth() == 0 ) - { - if ( ( nAngleOpposite % 18000 ) == 0 ) - nOtherAngle = nAngleSide; - else if ( ( nAngleSide % 18000 ) == 0 ) - nOtherAngle = nAngleOpposite; - } - - // Let's assume the border we are drawing is horizontal and compute all the angles / distances from this - basegfx::B2DVector aBaseVector( 1.0, 0.0 ); - // added support to get the distances to the centers of the line, *not* the outre edge - basegfx::B2DPoint aBasePoint(0.0, lcl_getCenterOfLineOffset(rBorder, bLeftEdge)); - - basegfx::B2DHomMatrix aRotation; - aRotation.rotate( double( nOtherAngle ) * M_PI / 18000.0 ); - - basegfx::B2DVector aOtherVector = aRotation * aBaseVector; - // Compute a line shifted by half the width of the other border - basegfx::B2DVector aPerpendicular = basegfx::getNormalizedPerpendicular( aOtherVector ); - // added support to get the distances to the centers of the line, *not* the outre edge - basegfx::B2DPoint aOtherPoint = basegfx::B2DPoint() + aPerpendicular * lcl_getCenterOfLineOffset(aOtherBorder, bOtherLeft); - - // Find the cut between the two lines - double nCut = 0.0; - basegfx::tools::findCut( - aBasePoint, aBaseVector, aOtherPoint, aOtherVector, - CutFlagValue::ALL, &nCut ); - - return nCut; -} - struct OffsetPair { double mfLeft; @@ -523,7 +456,14 @@ double getSimpleExtendedLineValues( if (pResult) { - return (pResult->mfLeftRight + pResult->mfRightRight) * 0.5 * (bEdgeStart ? -fLength : fLength); + if (bEdgeStart) + { + return (pResult->mfLeftRight + pResult->mfRightRight) * -0.5 * fLength; + } + else + { + return (pResult->mfLeftLeft + pResult->mfRightLeft) * 0.5 * fLength; + } } return 0.0; @@ -552,8 +492,17 @@ double getComplexExtendedLineValues( if (pResult) { - return (pResult->mfLeftRight + pResult->mfRightRight) * 0.5 * (bEdgeStart ? -fLength : fLength); + if (bEdgeStart) + { + return (pResult->mfLeftRight + pResult->mfRightRight) * 0.5 * -fLength; + } + else + { + return (pResult->mfLeftLeft + pResult->mfRightLeft) * 0.5 * fLength; + } } + + return 0.0; } void CreateBorderPrimitives( @@ -636,7 +585,10 @@ void CreateBorderPrimitives( else if (2 == myOffsets.size()) { // we are a double edge, calculate cuts with edges coming from above/below - // for both edges to detect the line start/end extensions + // for both edges to detect the line start/end extensions. In the furure this + // needs to be extended to use two values per extension, getComplexExtendedLineValues + // internally prepares these already. drawinglayer::primitive2d::BorderLine will + // then need to take these double entries (maybe a pair) and use them internally. double mfExtendLeftStart(0.0); double mfExtendLeftEnd(0.0); double mfExtendRightStart(0.0); @@ -671,8 +623,12 @@ void CreateBorderPrimitives( drawinglayer::primitive2d::BorderLine( rBorder.Dist(), (pForceColor ? *pForceColor : rBorder.GetColorGap()).getBColor(), - (mfExtendLeftStart + mfExtendRightStart) * 0.5, - (mfExtendLeftEnd + mfExtendRightEnd) * 0.5), + // needs to be determined in detail later, for now use the max prolongation + // from left/right, butz do not less than half (0.0). This works decently, + // but not perfect (see Writer, use three-color-style, look at upper/lower# + // connections) + std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)), + std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd))), drawinglayer::primitive2d::BorderLine( rBorder.Secn(), (pForceColor ? *pForceColor : rBorder.GetColorSecn()).getBColor(), diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index 839e9bef5d77..04d0d2ac2b6d 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -132,8 +132,6 @@ void lclSetMergedRange( CellVec& rCells, size_t nWidth, size_t nFirstCol, size_t static const Style OBJ_STYLE_NONE; static const Cell OBJ_CELL_NONE; -const bool DIAG_DBL_CLIP_DEFAULT = false; - struct ArrayImpl { CellVec maCells; @@ -1122,7 +1120,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, aY.normalize(); } - drawinglayer::primitive2d::Primitive2DContainer aSequence(1); + drawinglayer::primitive2d::Primitive2DContainer aSequence; CreateBorderPrimitives( aSequence, aOrigin, @@ -1188,7 +1186,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, aY.normalize(); } - drawinglayer::primitive2d::Primitive2DContainer aSequence(1); + drawinglayer::primitive2d::Primitive2DContainer aSequence; CreateBorderPrimitives( aSequence, aOrigin, @@ -1288,7 +1286,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, aY = -aY; } - drawinglayer::primitive2d::Primitive2DContainer aSequence(1); + drawinglayer::primitive2d::Primitive2DContainer aSequence; CreateBorderPrimitives( // This replaces DrawVerFrameBorder which went from top to bottom. To be able to use // the same method as for horizontal (CreateBorderPrimitives), the given borders @@ -1367,7 +1365,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, aY = -aY; } - drawinglayer::primitive2d::Primitive2DContainer aSequence(1); + drawinglayer::primitive2d::Primitive2DContainer aSequence; CreateBorderPrimitives( // also reordered, see call to CreateBorderPrimitives above aSequence, diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 93567852d1a9..e3ccf03eebc0 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -667,9 +667,6 @@ void FrameSelectorImpl::DrawAllFrameBorders() for( size_t nRow = 0; nRow < maArray.GetRowCount(); ++nRow ) maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() ); - // Let the helper array draw itself - static bool bUsePrimitives(true); - // This is used in the dialog/control for 'Border' attributes. When using // the original paint below instead of primitives, the advantage currently // is the correct visualization of diagonal line(s) including overlaying, |