borderline: Abstraction of BorderLinePrimitive
As preparation for more detailed definition of BorderLine
primitives I have adapted the BorderLine definition to
work with motre possibilities to define the LineStartEnd
definitions in a BorderLineExtend class. That one is
flexible to hold all kinds of definitions - from none to
all four possible extends (Start/End, Left/Right of vector)
Cleanup of DiagStyle and others: DiagStyle is not needed
anymore due to no longer using angles calculated, but
being based on vectors defining the geometry. Also cleaned
up quite a bit of no longer needed calculation stuff for
the control.
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx
index 326c5de..a070f9c 100644
--- a/drawinglayer/qa/unit/border.cxx
+++ b/drawinglayer/qa/unit/border.cxx
@@ -65,9 +65,21 @@ void DrawinglayerBorderTest::testDoubleDecompositionSolid()
new drawinglayer::primitive2d::BorderLinePrimitive2D(
aStart,
aEnd,
drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd),
drawinglayer::primitive2d::BorderLine(fDistance, aColorGap),
drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd),
drawinglayer::primitive2d::BorderLine(
fLeftWidth,
aColorLeft,
drawinglayer::primitive2d::BorderLineExtend(
fExtendLeftStart,
fExtendLeftEnd)),
drawinglayer::primitive2d::BorderLine(
fDistance,
aColorGap),
drawinglayer::primitive2d::BorderLine(
fRightWidth,
aColorRight,
drawinglayer::primitive2d::BorderLineExtend(
fExtendRightStart,
fExtendRightEnd)),
bHasGapColor,
nStyle));
@@ -121,9 +133,21 @@ void DrawinglayerBorderTest::testDoublePixelProcessing()
new drawinglayer::primitive2d::BorderLinePrimitive2D(
aStart,
aEnd,
drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd),
drawinglayer::primitive2d::BorderLine(fDistance, aColorGap),
drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd),
drawinglayer::primitive2d::BorderLine(
fLeftWidth,
aColorLeft,
drawinglayer::primitive2d::BorderLineExtend(
fExtendLeftStart,
fExtendLeftEnd)),
drawinglayer::primitive2d::BorderLine(
fDistance,
aColorGap),
drawinglayer::primitive2d::BorderLine(
fRightWidth,
aColorRight,
drawinglayer::primitive2d::BorderLineExtend(
fExtendRightStart,
fExtendRightEnd)),
bHasGapColor,
nStyle));
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index bdb96f9..581f0c4 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -367,7 +367,6 @@ namespace drawinglayer
case PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D: return OUString("PATTERNFILL");
case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D: return OUString("OBJECTINFO");
case PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D: return OUString("POLYPOLYGONSELECTION");
case PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D: return OUString("CLIPPEDBORDERLINE");
default: return OUString::number((nId >> 16) & 0xFF) + "|" + OUString::number(nId & 0xFF);
}
}
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index dae52a2..47da04a 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -37,15 +37,128 @@ namespace drawinglayer
{
namespace primitive2d
{
BorderLineExtend::BorderLineExtend()
: mfExtends()
{
}
BorderLineExtend::BorderLineExtend(
double fStart,
double fEnd)
: mfExtends(2)
{
mfExtends[0] = fStart;
mfExtends[1] = fEnd;
}
BorderLineExtend::BorderLineExtend(
double fStartLeft,
double fStartRight,
double fEndLeft,
double fEndRight)
: mfExtends(4)
{
mfExtends[0] = fStartLeft;
mfExtends[1] = fStartRight;
mfExtends[2] = fEndLeft;
mfExtends[3] = fEndRight;
}
BorderLineExtend::~BorderLineExtend()
{
}
bool BorderLineExtend::equalStart() const
{
if (mfExtends.empty()|| 2 == mfExtends.size())
return true;
return mfExtends[0] == mfExtends[1];
}
bool BorderLineExtend::equalEnd() const
{
if (mfExtends.empty() || 2 == mfExtends.size())
return true;
return mfExtends[2] == mfExtends[3];
}
double BorderLineExtend::getStartLeft() const
{
if (mfExtends.empty())
return 0.0;
return mfExtends[0];
}
double BorderLineExtend::getStartRight() const
{
if (mfExtends.empty())
return 0.0;
if (2 == mfExtends.size())
return mfExtends[0];
return mfExtends[1];
}
double BorderLineExtend::getEndLeft() const
{
if (mfExtends.empty())
return 0.0;
if (2 == mfExtends.size())
return mfExtends[1];
return mfExtends[2];
}
double BorderLineExtend::getEndRight() const {
if (mfExtends.empty())
return 0.0;
if (2 == mfExtends.size())
return mfExtends[1];
return mfExtends[3];
}
double BorderLineExtend::getStartAverage() const
{
if (mfExtends.empty())
return 0.0;
if (2 == mfExtends.size())
return mfExtends[0];
return (mfExtends[0] + mfExtends[1]) * 0.5;
}
double BorderLineExtend::getEndAverage() const
{
if (mfExtends.empty())
return 0.0;
if (2 == mfExtends.size())
return mfExtends[1];
return (mfExtends[2] + mfExtends[3]) * 0.5;
}
bool BorderLineExtend::operator==(const BorderLineExtend& rBorderLineExtend) const
{
if (mfExtends.size() == rBorderLineExtend.mfExtends.size())
{
return mfExtends == rBorderLineExtend.mfExtends;
}
return false;
}
BorderLine::BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor,
double fExtendStart,
double fExtendEnd)
: mfWidth(fWidth),
const BorderLineExtend& rBorderLineExtend)
: mfWidth(fWidth),
maRGBColor(rRGBColor),
mfExtendStart(fExtendStart),
mfExtendEnd(fExtendEnd)
maBorderLineExtend(rBorderLineExtend)
{
}
BorderLine::BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor)
: mfWidth(fWidth),
maRGBColor(rRGBColor),
maBorderLineExtend()
{
}
@@ -57,8 +170,7 @@ namespace drawinglayer
{
return getWidth() == rBorderLine.getWidth()
&& getRGBColor() == rBorderLine.getRGBColor()
&& getExtendStart() == rBorderLine.getExtendStart()
&& getExtendEnd() == rBorderLine.getExtendEnd();
&& getBorderLineExtend() == rBorderLine.getBorderLineExtend();
}
// helper to add a centered, maybe stroked line primitive to rContainer
@@ -117,8 +229,8 @@ namespace drawinglayer
// inside line (left of vector). Create stroke primitive centered on left line width
const double fDeltaY((rLeft.getWidth() - fFullWidth) * 0.5);
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rLeft.getExtendStart()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rLeft.getExtendEnd()) + aDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rLeft.getBorderLineExtend().getStartAverage()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rLeft.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rLeft.getRGBColor(), rLeft.getWidth());
addPolygonStrokePrimitive2D(
@@ -135,8 +247,8 @@ namespace drawinglayer
// Create stroke primitive on vector with given color centered on gap position
const double fDeltaY(((fFullWidth - mfDiscreteGapDistance) * 0.5) - rRight.getWidth());
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rGap.getExtendStart()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rGap.getExtendEnd()) + aDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rGap.getBorderLineExtend().getStartAverage()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rGap.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rGap.getRGBColor(), mfDiscreteGapDistance);
addPolygonStrokePrimitive2D(
@@ -151,8 +263,8 @@ namespace drawinglayer
// outside line (right of vector). Create stroke primitive centered on right line width
const double fDeltaY((fFullWidth - rRight.getWidth()) * 0.5);
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rRight.getExtendStart()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rRight.getExtendEnd()) + aDeltaY);
const basegfx::B2DPoint aStart(getStart() - (aVector * rRight.getBorderLineExtend().getStartAverage()) + aDeltaY);
const basegfx::B2DPoint aEnd(getEnd() + (aVector * rRight.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rRight.getRGBColor(), rRight.getWidth());
addPolygonStrokePrimitive2D(
@@ -171,8 +283,8 @@ namespace drawinglayer
addPolygonStrokePrimitive2D(
rContainer,
getStart() - (aVector * rBorderLine.getExtendStart()),
getEnd() + (aVector * rBorderLine.getExtendEnd()),
getStart() - (aVector * rBorderLine.getBorderLineExtend().getStartAverage()),
getEnd() + (aVector * rBorderLine.getBorderLineExtend().getEndAverage()),
aLineAttribute,
aStrokeAttribute);
}
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index 19c0282..fb7cc52 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -34,7 +34,6 @@ namespace drawinglayer { namespace primitive2d {
class PolyPolygonColorPrimitive2D;
class PolygonHairlinePrimitive2D;
class PolygonStrokePrimitive2D;
class BorderLinePrimitive2D;
}}
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 2eba13f..ad28a5e 100644
--- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -33,8 +33,44 @@ namespace drawinglayer
{
namespace primitive2d
{
/** BorderLineExtend class
*/
class DRAWINGLAYER_DLLPUBLIC BorderLineExtend
{
private:
std::vector<double> mfExtends;
public:
BorderLineExtend();
BorderLineExtend(
double fStart,
double fEnd);
BorderLineExtend(
double fStartLeft,
double fStartRight,
double fEndLeft,
double fEndRight);
~BorderLineExtend();
bool equalStart() const;
bool equalEnd() const;
double getStartLeft() const;
double getStartRight() const;
double getEndLeft() const;
double getEndRight() const;
double getStartAverage() const;
double getEndAverage() const;
/// compare operator
bool operator==(const BorderLineExtend& rBorderLineExtend) const;
};
/** BorderLine class
Helper class holding the style definition for a single part of a full BNorderLine definition
Helper class holding the style definition for a single part of a full NorderLine definition.
Line extends are for start/end and for Left/Right, seen in vector direction. If
Left != Right that means the line has a diagonal start/end
*/
class DRAWINGLAYER_DLLPUBLIC BorderLine
{
@@ -46,21 +82,21 @@ namespace drawinglayer
basegfx::BColor maRGBColor;
// line extends
double mfExtendStart;
double mfExtendEnd;
BorderLineExtend maBorderLineExtend;
public:
BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor,
double fExtendStart = 0.0,
double fExtendEnd = 0.0);
const BorderLineExtend& rBorderLineExtend);
BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor);
~BorderLine();
double getWidth() const { return mfWidth; }
const basegfx::BColor& getRGBColor() const { return maRGBColor; }
double getExtendStart() const { return mfExtendStart; }
double getExtendEnd() const { return mfExtendEnd; }
const BorderLineExtend& getBorderLineExtend() const { return maBorderLineExtend; }
/// compare operator
bool operator==(const BorderLine& rBorderLine) const;
@@ -71,8 +107,8 @@ namespace drawinglayer
This is the basic primitive to build frames around objects, e.g. tables.
It defines a single or double line from Start to End using the LeftWidth,
Distance and RightWidth definitions.
The LineStart/End overlap is defined by the Extend(Left|Right)(Start|End)
definitions.
The LineStart/End overlap is defined in the BorderLines definitions (see
class BorderLine above).
*/
class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
{
diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 9e78c8c..7dcc245 100644
--- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -102,7 +102,6 @@
#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
#define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69)
#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70)
// When you add a new primitive, please update the drawinglayer::primitive2d::idToString() function
// in drawinglayer/source/primitive2d/baseprimitive2d.cxx.
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index c53f429..973c401 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -184,72 +184,8 @@ SVX_DLLPUBLIC bool operator<( const Style& rL, const Style& rR );
inline bool operator>( const Style& rL, const Style& rR ) { return rR < rL; }
/** Extends the Style struct with an angle for diagonal frame borders.
The angle is specified in radian (a full circle is equivalent to 2*PI).
It is dependent on the context, how the value is interpreted, i.e. it may
specify the angle to a horizontal or vertical frame border.
*/
class SAL_WARN_UNUSED DiagStyle : public Style
{
public:
/** Constructs an invisible diagonal frame style. */
explicit DiagStyle() {}
/** Constructs a diagonal frame style passed style and angle. */
explicit DiagStyle( const Style& rStyle, double /*fAngle*/ ) :
Style( rStyle ) {}
};
// Various helper functions
/** Returns the angle between horizontal border of a rectangle and its diagonal.
The returned values represents the inner angle between the diagonals and
horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
passed sizes may be negative, calculation is done with absolute values.
*/
SVX_DLLPUBLIC double GetHorDiagAngle( long nWidth, long nHeight );
/** Returns an X coordinate for a diagonal frame border in the specified height.
This function is for usage with the top-left end of a top-left to
bottom-right diagonal frame border, connected to the left end of a
horizontal frame border.
The function returns the relative X position (i.e. for a polygon) of the
diagonal frame border according to the specified relative Y position. The
mentioned positions are relative to the reference point of both frame
borders.
+----------------------------------------------------------
| The horizontal frame border.
| |
- - - - - - | --+-- <---- Reference point for horizontal and diagonal frame borders.
^ | \ | \
nVerOffs | \ \ <--- The diagonal frame border.
v +---\ \------------------------------------------------
- - - - - - - - -\- - -X <----- The function calculates the X position of i.e.
\ \ this point (relative from X of reference point).
\ \
Primary -->\ \<-- Secondary
@param nVerOffs
The vertical position of the point to be calculated, relative to the Y
coordinate of the reference point.
@param nDiagOffs
The width offset across the diagonal frame border (0 = middle),
regardless of the gradient of the diagonal frame border (always
vertical to the direction of the diagonal frame border). This value is
not related in any way to the reference point. For details about
relative width offsets, see description of class Style.
@param fAngle
Inner (right) angle between diagonal and horizontal frame border.
*/
SVX_DLLPUBLIC long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
/** Checks whether two horizontal frame borders are "connectable".
Two borders are "connectable" in terms of this function, if both can be
@@ -339,17 +275,17 @@ SVX_DLLPUBLIC void CreateBorderPrimitives(
const Style& rBorder, /// Style of the processed frame border.
const DiagStyle& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
const Style& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
const DiagStyle& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
const Style& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
const DiagStyle& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
const Style& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
const DiagStyle& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
const Style& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
const Color* pForceColor /// If specified, overrides frame border color.
);
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index d272170..4801db2 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -289,27 +289,9 @@ public:
/** Returns the output height of the entire array. */
long GetHeight() const;
/** Returns the top-left output position of the cell (nCol,nRow).
Returns output position of top-left corner of merged ranges. */
Point GetCellPosition( size_t nCol, size_t nRow ) const;
/** Returns the output size of the cell (nCol,nRow).
Returns total output size of merged ranges. */
Size GetCellSize( size_t nCol, size_t nRow ) const;
/** Returns the output rectangle of the cell (nCol,nRow).
Returns total output rectangle of merged ranges. */
tools::Rectangle GetCellRect( size_t nCol, size_t nRow ) const;
// diagonal frame borders -------------------------------------------------
/** Returns the angle between horizontal and diagonal border of the cell (nCol,nRow).
Returns the horizontal angle of merged ranges. */
double GetHorDiagAngle( size_t nCol, size_t nRow ) const;
/** Returns the angle between vertical and diagonal border of the cell (nCol,nRow).
Returns the vertical angle of merged ranges. */
double GetVerDiagAngle( size_t nCol, size_t nRow ) const;
/** Returns the output range of the cell (nCol,nRow).
Returns total output range of merged ranges. */
basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow ) const;
// mirroring --------------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 01d71d2..40b8da7 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -250,8 +250,8 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
Size aStrSize;
sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
tools::Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
Point aPos = cellRect.TopLeft();
const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow ));
Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
sal_uInt16 nRightX = 0;
bool bJustify = pCurData->GetIncludeJustify();
SvxCellHorJustify eJustification;
@@ -271,7 +271,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
theMaxStrSize = cellRect.GetSize();
theMaxStrSize = Size(basegfx::fround(cellRange.getWidth()), basegfx::fround(cellRange.getHeight()));
theMaxStrSize.Width() -= FRAME_OFFSET;
theMaxStrSize.Height() -= FRAME_OFFSET;
@@ -304,7 +304,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
aStrSize = aScriptedText.GetTextSize();
}
nRightX = sal_uInt16(cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET);
nRightX = sal_uInt16(basegfx::fround(cellRange.getWidth()) - aStrSize.Width() - FRAME_OFFSET);
// vertical (always center):
@@ -314,7 +314,8 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
if (eJustification != SvxCellHorJustify::Standard)
{
sal_uInt16 nHorPos = sal_uInt16((cellRect.GetWidth()-aStrSize.Width()) / 2);
sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
//sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
switch (eJustification)
{
@@ -372,7 +373,13 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
rRenderContext.SetLineColor();
rRenderContext.SetFillColor( pItem->GetColor() );
rRenderContext.DrawRect( maArray.GetCellRect( nCol, nRow ) );
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
rRenderContext.DrawRect(
tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
rRenderContext.Pop();
}
}
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 1b858c0..e5523fe 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -44,12 +44,6 @@ namespace frame {
namespace {
/** Rounds and casts a double value to a long value. */
inline long lclD2L( double fValue )
{
return static_cast< long >( (fValue < 0.0) ? (fValue - 0.5) : (fValue + 0.5) );
}
/** Converts a width in twips to a width in another map unit (specified by fScale). */
double lclScaleValue( double nValue, double fScale, sal_uInt16 nMaxWidth )
{
@@ -236,18 +230,6 @@ bool operator<( const Style& rL, const Style& rR )
#undef SCALEVALUE
// Various helper functions
double GetHorDiagAngle( long nWidth, long nHeight )
{
return atan2( static_cast< double >( std::abs( nHeight ) ), static_cast< double >( std::abs( nWidth ) ) );
}
long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
{
return lclD2L( nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
}
bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
const Style& rTFromTL, const Style& rTFromT, const Style& rTFromTR,
const Style& rBFromBL, const Style& rBFromB, const Style& rBFromBR )
@@ -506,16 +488,16 @@ void CreateBorderPrimitives(
const basegfx::B2DVector& rX,
const basegfx::B2DVector& rY,
const Style& rBorder,
const DiagStyle& /*rLFromTR*/,
const Style& /*rLFromTR*/,
const Style& rLFromT,
const Style& /*rLFromL*/,
const Style& rLFromB,
const DiagStyle& /*rLFromBR*/,
const DiagStyle& /*rRFromTL*/,
const Style& /*rLFromBR*/,
const Style& /*rRFromTL*/,
const Style& rRFromT,
const Style& /*rRFromR*/,
const Style& rRFromB,
const DiagStyle& /*rRFromBL*/,
const Style& /*rRFromBL*/,
const Color* pForceColor)
{
if (rBorder.Prim())
@@ -572,8 +554,9 @@ void CreateBorderPrimitives(
drawinglayer::primitive2d::BorderLine(
rBorder.Prim(),
(pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(),
mfExtendStart,
mfExtendEnd),
drawinglayer::primitive2d::BorderLineExtend(
mfExtendStart,
mfExtendEnd)),
rBorder.Type(),
rBorder.PatternScale())));
}
@@ -605,6 +588,13 @@ void CreateBorderPrimitives(
// cut exists. Else use upper and take maximum when cut exists
mfExtendRightEnd = getComplexExtendedLineValues(rOrigin, rX, rY, aPerpendX, myOffsets[1], rRFromB, rRFromT, false, fLength);
// needs to be determined in detail later, for now use the max prolongation
// from left/right, but do not less than half (0.0). This works decently,
// but not perfect (see Writer, use three-color-style, look at upper/lower#
// connections)
const double fGapLeft(std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)));
const double fGapRight(std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd)));
rTarget.append(
drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
@@ -613,22 +603,21 @@ void CreateBorderPrimitives(
drawinglayer::primitive2d::BorderLine(
rBorder.Prim(),
(pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(),
mfExtendLeftStart,
mfExtendLeftEnd),
drawinglayer::primitive2d::BorderLineExtend(
mfExtendLeftStart,
mfExtendLeftEnd)),
drawinglayer::primitive2d::BorderLine(
rBorder.Dist(),
(pForceColor ? *pForceColor : rBorder.GetColorGap()).getBColor(),
// 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::BorderLineExtend(
fGapLeft,
fGapRight)),
drawinglayer::primitive2d::BorderLine(
rBorder.Secn(),
(pForceColor ? *pForceColor : rBorder.GetColorSecn()).getBColor(),
mfExtendRightStart,
mfExtendRightEnd),
drawinglayer::primitive2d::BorderLineExtend(
mfExtendRightStart,
mfExtendRightEnd)),
rBorder.UseGapColor(),
rBorder.Type(),
rBorder.PatternScale())));
@@ -658,16 +647,16 @@ void CreateBorderPrimitives(
rX,
rY,
rBorder,
DiagStyle(),
Style(),
rLFromT,
rLFromL,
rLFromB,
DiagStyle(),
DiagStyle(),
Style(),
Style(),
rRFromT,
rRFromR,
rRFromB,
DiagStyle(),
Style(),
pForceColor);
}
}
@@ -701,7 +690,9 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin,
rOrigin + rXAxis + rYAxis,
drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Prim(),
(pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
rTLBR.Type(),
rTLBR.PatternScale()));
}
@@ -711,9 +702,15 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin,
rOrigin + rXAxis + rYAxis,
drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Prim(),
(pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Dist(),
(pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Secn(),
(pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
rTLBR.UseGapColor(),
rTLBR.Type(),
rTLBR.PatternScale()));
@@ -729,7 +726,9 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin + rYAxis,
rOrigin + rXAxis,
drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Prim(),
(pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
rBLTR.Type(),
rBLTR.PatternScale()));
}
@@ -739,9 +738,15 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin + rYAxis,
rOrigin + rXAxis,
drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Prim(),
(pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Dist(),
(pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
drawinglayer::primitive2d::BorderLine(
rTLBR.Secn(),
(pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
rBLTR.UseGapColor(),
rBLTR.Type(),
rBLTR.PatternScale()));
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index c5d0d9f..ef6c410 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -183,9 +183,6 @@ struct ArrayImpl
long GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
double GetHorDiagAngle( size_t nCol, size_t nRow ) const;
double GetVerDiagAngle( size_t nCol, size_t nRow ) const;
bool HasCellRotation() const;
};
@@ -319,35 +316,6 @@ long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
}
double ArrayImpl::GetHorDiagAngle( size_t nCol, size_t nRow ) const
{
double fAngle = 0.0;
if( IsValidPos( nCol, nRow ) )
{
if( !GetCell( nCol, nRow ).IsMerged() )
{
fAngle = frame::GetHorDiagAngle( maWidths[ nCol ] + 1, maHeights[ nRow ] + 1 );
}
else
{
// return correct angle for each cell in the merged range
size_t nFirstCol = GetMergedFirstCol( nCol, nRow );
size_t nFirstRow = GetMergedFirstRow( nCol, nRow );
const Cell& rCell = GetCell( nFirstCol, nFirstRow );
long nWidth = GetColWidth( nFirstCol, GetMergedLastCol( nCol, nRow ) ) + rCell.mnAddLeft + rCell.mnAddRight;
long nHeight = GetRowHeight( nFirstRow, GetMergedLastRow( nCol, nRow ) ) + rCell.mnAddTop + rCell.mnAddBottom;
fAngle = frame::GetHorDiagAngle( nWidth + 1, nHeight + 1 );
}
}
return fAngle;
}
double ArrayImpl::GetVerDiagAngle( size_t nCol, size_t nRow ) const
{
double fAngle = GetHorDiagAngle( nCol, nRow );
return (fAngle > 0.0) ? (F_PI2 - fAngle) : 0.0;
}
bool ArrayImpl::HasCellRotation() const
{
// check cell array
@@ -840,25 +808,15 @@ long Array::GetHeight() const
return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 );
}
Point Array::GetCellPosition( size_t nCol, size_t nRow ) const
basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow ) const
{
size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
return Point( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
}
Size Array::GetCellSize( size_t nCol, size_t nRow ) const
{
size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
return Size( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
}
tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const
{
tools::Rectangle aRect( GetCellPosition( nCol, nRow ), GetCellSize( nCol, nRow ) );
const Point aPoint( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
const Size aSize( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
tools::Rectangle aRect(aPoint, aSize);
// adjust rectangle for partly visible merged cells
const Cell& rCell = CELL( nCol, nRow );
@@ -869,20 +827,7 @@ tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const
aRect.Top() -= rCell.mnAddTop;
aRect.Bottom() += rCell.mnAddBottom;
}
return aRect;
}
// diagonal frame borders
double Array::GetHorDiagAngle( size_t nCol, size_t nRow ) const
{
DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetHorDiagAngle" );
return mxImpl->GetHorDiagAngle( nCol, nRow );
}
double Array::GetVerDiagAngle( size_t nCol, size_t nRow ) const
{
DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetVerDiagAngle" );
return mxImpl->GetVerDiagAngle( nCol, nRow );
return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
}
// mirroring
@@ -983,9 +928,9 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
if ((!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) || (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow))
{
const tools::Rectangle aRect(GetCellRect(nCol, nRow));
const basegfx::B2DRange aRange(GetCellRange(nCol, nRow));
if ((aRect.GetWidth() > 1) && (aRect.GetHeight() > 1))
if (!aRange.isEmpty())
{
size_t _nFirstCol = mxImpl->GetMergedFirstCol(nCol, nRow);
size_t _nFirstRow = mxImpl->GetMergedFirstRow(nCol, nRow);
@@ -997,7 +942,6 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
if (rTLBR.GetWidth() || rBLTR.GetWidth())
{
drawinglayer::primitive2d::Primitive2DContainer aSequence;
const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
basegfx::B2DPoint aOrigin;
basegfx::B2DVector aX;
basegfx::B2DVector aY;
@@ -1031,43 +975,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
// *** horizontal frame borders ***
for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow )
{
double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow );
double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 );
// *Start*** variables store the data of the left end of the cached frame border
basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) );
const Style* pStart = &GetCellStyleTop( nFirstCol, nRow );
DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle );
Style aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ));
const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 );
const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow );
const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow );
DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle );
Style aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ));
// *End*** variables store the data of the right end of the cached frame border
DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle );
Style aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ));
const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 );
const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow );
const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow );
DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle );
Style aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ));
for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol )
{
fAngle = mxImpl->GetHorDiagAngle( nCol, nRow );
fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 );
const Style& rCurr = *pEndRFromR;
DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle );
Style aLFromTR( GetCellStyleBL( nCol, nRow - 1 ));
const Style& rLFromT = *pEndRFromT;
const Style& rLFromL = *pStart;
const Style& rLFromB = *pEndRFromB;
DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
Style aLFromBR( GetCellStyleTL( nCol, nRow ));
DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle );
Style aRFromTL( GetCellStyleBR( nCol, nRow - 1 ));
const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 );
const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow );
const Style& rRFromB = GetCellStyleRight( nCol, nRow );
DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle );
Style aRFromBL( GetCellStyleTR( nCol, nRow ));
// check if current frame border can be connected to cached frame border
if( !CheckFrameBorderConnectable( *pStart, rCurr, aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) )
@@ -1090,8 +1028,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
// we need to take care if the borderline is at top or bottom, so use pointer
// compare here to find out
const bool bUpper(&pCell->GetStyleTop() == pStart);
const tools::Rectangle aRect(GetCellRect(nCol - 1, bUpper ? nRow : nRow - 1));
const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
const basegfx::B2DRange aRange(GetCellRange(nCol - 1, bUpper ? nRow : nRow - 1));
// adapt to cell coordinate system, including shear
CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY);
@@ -1161,8 +1098,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
if (pCell && pCell->IsRotated())
{
const bool bUpper(&pCell->GetStyleTop() == pStart);
const tools::Rectangle aRect(GetCellRect(nCol - 1, bUpper ? nRow : nRow - 1));
const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
const basegfx::B2DRange aRange(GetCellRange(nCol - 1, bUpper ? nRow : nRow - 1));
CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY);
@@ -1199,43 +1135,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
// *** vertical frame borders ***
for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol )
{
double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow );
double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow );
// *Start*** variables store the data of the top end of the cached frame border
basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) );
const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow );
DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle );
Style aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ));
const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow );
const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 );
const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow );
DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle );
Style aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ));
// *End*** variables store the data of the bottom end of the cached frame border
DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle );
Style aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ));
const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow );
const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 );
const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow );
DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle );
Style aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ));
for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow )
{
fAngle = mxImpl->GetVerDiagAngle( nCol, nRow );
fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow );
const Style& rCurr = *pEndBFromB;
DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle );
Style aTFromBL( GetCellStyleTR( nCol - 1, nRow ));
const Style& rTFromL = *pEndBFromL;
const Style& rTFromT = *pStart;
const Style& rTFromR = *pEndBFromR;
DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
Style aTFromBR( GetCellStyleTL( nCol, nRow ));
DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle );
Style aBFromTL( GetCellStyleBR( nCol - 1, nRow ));
const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow );
const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 );
const Style& rBFromR = GetCellStyleBottom( nCol, nRow );
DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle );
Style aBFromTR( GetCellStyleBL( nCol, nRow ));
// check if current frame border can be connected to cached frame border
if( !CheckFrameBorderConnectable( *pStart, rCurr,
@@ -1255,8 +1185,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
if (pCell && pCell->IsRotated())
{
const bool bLeft(&pCell->GetStyleLeft() == pStart);
const tools::Rectangle aRect(GetCellRect(bLeft ? nCol : nCol - 1, nRow - 1));
const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
const basegfx::B2DRange aRange(GetCellRange(bLeft ? nCol : nCol - 1, nRow - 1));
CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY);
@@ -1335,8 +1264,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
if (pCell && pCell->IsRotated())
{
const bool bLeft(&pCell->GetStyleLeft() == pStart);
const tools::Rectangle aRect(GetCellRect(bLeft ? nCol : nCol - 1, nRow - 1));
const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
const basegfx::B2DRange aRange(GetCellRange(bLeft ? nCol : nCol - 1, nRow - 1));
CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY);
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index f89b160..c3b58e0 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -360,8 +360,9 @@ void FrameSelectorImpl::InitGlobalGeometry()
/* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */
long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1;
/* The final size of the usable area. */
/* The final size of the usable area. At least do not get negative */
mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
mnCtrlSize = std::max(mnCtrlSize, static_cast<long>(0));
mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
/* Center the virtual device in the control. */
@@ -409,9 +410,14 @@ void FrameSelectorImpl::InitBorderGeometry()
{
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
long nDiagFocusOffsX = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetHorDiagAngle( nCol, nRow ) );
long nDiagFocusOffsY = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetVerDiagAngle( nCol, nRow ) );
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
const double fHorDiagAngle(atan2(fabs(aCellRange.getHeight()), fabs(aCellRange.getWidth())));
const double fVerDiagAngle(fHorDiagAngle > 0.0 ? F_PI2 - fHorDiagAngle : 0.0);
const long nDiagFocusOffsX(basegfx::fround(-mnFocusOffs / tan(fHorDiagAngle) + mnFocusOffs / sin(fHorDiagAngle)));
const long nDiagFocusOffsY(basegfx::fround(-mnFocusOffs / tan(fVerDiagAngle) + mnFocusOffs / sin(fVerDiagAngle)));
std::vector< Point > aFocusVec;
aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY );
@@ -463,11 +469,10 @@ void FrameSelectorImpl::InitBorderGeometry()
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
// the usable area between horizonal/vertical frame borders of current quadrant
tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
aRect.Left() += nClV + 1;
aRect.Right() -= nClV + 1;
aRect.Top() += nClH + 1;
aRect.Bottom() -= nClH + 1;
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
const tools::Rectangle aRect(
basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1,
basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1);
/* Both diagonal frame borders enabled. */
if( mbTLBR && mbBLTR )
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 5ec9b6c..0ee9574 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -293,8 +293,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
const double fExtendIS(getExtend(getTopLine(), maTopFromLLine));
const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine));
const double fExtendIS(getExtend(getTopLine(), maTopFromLLine) * fTwipsToMM);
const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine) * fTwipsToMM);
if (basegfx::fTools::equalZero(getLeftLine().GetInWidth()))
{
@@ -302,21 +302,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(
getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/),
getLeftLine().GetColorOut().getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
getLeftLine().GetBorderLineStyle()));
}
else
{
const double fExtendOS(getExtend(maTopFromLLine, getTopLine()));
const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()));
const double fExtendOS(getExtend(maTopFromLLine, getTopLine()) * fTwipsToMM);
const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/), getLeftLine().GetColorGap().getBColor()),
BorderLine(getChangedValue(getLeftLine().GetInWidth(), true/*InTwips*/), getLeftLine().GetColorIn().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(
getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/),
getLeftLine().GetColorOut().getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
BorderLine(
getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/),
getLeftLine().GetColorGap().getBColor()),
BorderLine(getChangedValue(
getLeftLine().GetInWidth(), true/*InTwips*/),
getLeftLine().GetColorIn().getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
getLeftLine().HasGapColor(),
getLeftLine().GetBorderLineStyle()));
}
@@ -331,8 +348,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine ));
const double fExtendIE(getExtend(getRightLine(), maRightFromBLine));
const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine) * fTwipsToMM);
const double fExtendIE(getExtend(getRightLine(), maRightFromBLine) * fTwipsToMM);
if (basegfx::fTools::equalZero(getBottomLine().GetInWidth()))
{
@@ -340,21 +357,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(
getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/),
getBottomLine().GetColorOut(false).getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
getBottomLine().GetBorderLineStyle()));
}
else
{
const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()));
const double fExtendOE(getExtend(maRightFromBLine, getRightLine()));
const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()) * fTwipsToMM);
const double fExtendOE(getExtend(maRightFromBLine, getRightLine()) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/), getBottomLine().GetColorGap().getBColor()),
BorderLine(getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/), getBottomLine().GetColorIn(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(
getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/),
getBottomLine().GetColorOut(false).getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
BorderLine(
getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/),
getBottomLine().GetColorGap().getBColor()),
BorderLine(
getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/),
getBottomLine().GetColorIn(false).getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
getBottomLine().HasGapColor(),
getBottomLine().GetBorderLineStyle()));
}
@@ -369,8 +403,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
const double fExtendOS(getExtend(maTopFromRLine, getTopLine()));
const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()));
const double fExtendOS(getExtend(maTopFromRLine, getTopLine()) * fTwipsToMM);
const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()) * fTwipsToMM);
if (basegfx::fTools::equalZero(getRightLine().GetInWidth()))
{
@@ -378,21 +412,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(
getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/),
getRightLine().GetColorOut().getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
getRightLine().GetBorderLineStyle()));
}
else
{
const double fExtendIS(getExtend(getTopLine(), maTopFromRLine));
const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine));
const double fExtendIS(getExtend(getTopLine(), maTopFromRLine) * fTwipsToMM);
const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(getChangedValue(getRightLine().GetDistance(), true/*InTwips*/), getRightLine().GetColorGap().getBColor()),
BorderLine(getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/), getRightLine().GetColorIn().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(
getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/),
getRightLine().GetColorOut().getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
BorderLine(
getChangedValue(getRightLine().GetDistance(), true/*InTwips*/),
getRightLine().GetColorGap().getBColor()),
BorderLine(
getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/),
getRightLine().GetColorIn().getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
getRightLine().HasGapColor(),
getRightLine().GetBorderLineStyle()));
}
@@ -412,8 +463,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()));
const double fExtendOE(getExtend(maRightFromTLine, getRightLine()));
const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()) * fTwipsToMM);
const double fExtendOE(getExtend(maRightFromTLine, getRightLine()) * fTwipsToMM);
if (basegfx::fTools::equalZero(getTopLine().GetInWidth()))
{
@@ -421,21 +472,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(
getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/),
getTopLine().GetColorOut(false).getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
getTopLine().GetBorderLineStyle()));
}
else
{
const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine));
const double fExtendIE(getExtend(getRightLine(), maRightFromTLine));
const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine) * fTwipsToMM);
const double fExtendIE(getExtend(getRightLine(), maRightFromTLine) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
BorderLine(getChangedValue(getTopLine().GetDistance(), true/*InTwips*/), getTopLine().GetColorGap().getBColor()),
BorderLine(getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/), getTopLine().GetColorIn(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
BorderLine(
getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/),
getTopLine().GetColorOut(false).getBColor(),
BorderLineExtend(
fExtendOS,
fExtendOE)),
BorderLine(
getChangedValue(getTopLine().GetDistance(), true/*InTwips*/),
getTopLine().GetColorGap().getBColor()),
BorderLine(
getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/),
getTopLine().GetColorIn(false).getBColor(),
BorderLineExtend(
fExtendIS,
fExtendIE)),
getTopLine().HasGapColor(),
getTopLine().GetBorderLineStyle()));
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 13813cc..0edb051 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -111,6 +111,7 @@ using namespace ::editeng;
using namespace ::com::sun::star;
using ::drawinglayer::primitive2d::BorderLinePrimitive2D;
using ::drawinglayer::primitive2d::BorderLine;
using ::drawinglayer::primitive2d::BorderLineExtend;
using std::pair;
using std::make_pair;
@@ -526,7 +527,14 @@ lcl_MergeBorderLines(
return new BorderLinePrimitive2D(
rStart,
rEnd,
BorderLine(rLineLeft.getWidth(), rLineLeft.getRGBColor(), rLineLeft.getExtendStart(), rOtherLeft.getExtendEnd()),
BorderLine(
rLineLeft.getWidth(),
rLineLeft.getRGBColor(),
BorderLineExtend(
rLineLeft.getBorderLineExtend().getStartLeft(),
rLineLeft.getBorderLineExtend().getStartRight(),
rOtherLeft.getBorderLineExtend().getEndLeft(),
rOtherLeft.getBorderLineExtend().getEndRight())),
rLine.getStyle());
}
else
@@ -539,9 +547,25 @@ lcl_MergeBorderLines(
return new BorderLinePrimitive2D(
rStart,
rEnd,
BorderLine(rLineLeft.getWidth(), rLineLeft.getRGBColor(), rLineLeft.getExtendStart(), rOtherLeft.getExtendEnd()),
BorderLine(rLineGap.getWidth(), rLineGap.getRGBColor()),
BorderLine(rLineRight.getWidth(), rLineRight.getRGBColor(), rLineRight.getExtendStart(), rOtherRight.getExtendEnd()),
BorderLine(
rLineLeft.getWidth(),
rLineLeft.getRGBColor(),
BorderLineExtend(
rLineLeft.getBorderLineExtend().getStartLeft(),
rLineLeft.getBorderLineExtend().getStartRight(),
rOtherLeft.getBorderLineExtend().getEndLeft(),
rOtherLeft.getBorderLineExtend().getEndRight())),
BorderLine(
rLineGap.getWidth(),
rLineGap.getRGBColor()),
BorderLine(
rLineRight.getWidth(),
rLineRight.getRGBColor(),
BorderLineExtend(
rLineRight.getBorderLineExtend().getStartLeft(),
rLineRight.getBorderLineExtend().getStartRight(),
rOtherRight.getBorderLineExtend().getEndLeft(),
rOtherRight.getBorderLineExtend().getEndRight())),
rLine.hasGapColor(),
rLine.getStyle());
}
@@ -4862,7 +4886,12 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
xLine = new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(nLeftWidth, aLeftColor.getBColor(), nExtentLeftStart, nExtentLeftEnd),
BorderLine(
nLeftWidth,
aLeftColor.getBColor(),
BorderLineExtend(
nExtentLeftStart,
nExtentLeftEnd)),
rBorder.GetBorderLineStyle());
}
else
@@ -4870,9 +4899,21 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
xLine = new BorderLinePrimitive2D(
aStart,
aEnd,
BorderLine(nLeftWidth, aLeftColor.getBColor(), nExtentLeftStart, nExtentLeftEnd),
BorderLine(rBorder.GetDistance(), rBorder.GetColorGap().getBColor()),
BorderLine(nRightWidth, aRightColor.getBColor(), nExtentRightStart, nExtentRightEnd),
BorderLine(
nLeftWidth,
aLeftColor.getBColor(),
BorderLineExtend(
nExtentLeftStart,
nExtentLeftEnd)),
BorderLine(
rBorder.GetDistance(),
rBorder.GetColorGap().getBColor()),
BorderLine(
nRightWidth,
aRightColor.getBColor(),
BorderLineExtend(
nExtentRightStart,
nExtentRightEnd)),
rBorder.HasGapColor(),
rBorder.GetBorderLineStyle());
}
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 0793190..ab2650d 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -709,7 +709,10 @@ MAKENUMSTR:
SvtScriptedTextHelper aScriptedText(rRenderContext);
Size aStrSize;
sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
tools::Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
const tools::Rectangle cellRect(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
Point aPos = cellRect.TopLeft();
long nRightX = 0;
@@ -801,7 +804,11 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aBrushItem.GetColor());
rRenderContext.DrawRect(maArray.GetCellRect(nCol, nRow));
const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
rRenderContext.DrawRect(
tools::Rectangle(
basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
rRenderContext.Pop();
}
}