[Libreoffice-commits] core.git: Branch 'feature/borderline2' - svx/source
arminl
arminl at KRANIX
Fri Jul 28 09:28:53 UTC 2017
svx/source/dialog/framelink.cxx | 67 ----------------------------------------
1 file changed, 67 deletions(-)
New commits:
commit 669f0d12c49964eea98e4023c5a7752ca6d127f0
Author: arminl <arminl at KRANIX>
Date: Thu Jul 27 16:03:48 2017 +0200
borderline: corrections for calc and writer
Made corrections/finetuning for Calc and Writer.
Had to remove some former code which tried to do
corrections
Added some finetuning for UnitTests and warnings
Change-Id: Ia7669c9eb7f3338d250cd350bfa5c2bc8e61763b
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 987b84610f4c..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;
More information about the Libreoffice-commits
mailing list