diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-20 15:11:30 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-07-28 17:51:56 +0200 |
commit | e32c12a444e5bd0c6735db8e8008340c29a7e25e (patch) | |
tree | 50262efd53047ee92f5f39f9a1fd6c9e00917fc7 /include/svx | |
parent | 1118e5b986e4df8a417edcd4ee23a40fb64a0a38 (diff) |
borderline: adaptions to primitives
Handling and paint of borderlines greatly adapted
to primitive usage. Solved the double paint mechanisn
to no longer use the sc-local special cases. The
svx tooling for borderline paint is now the only one
and was extended to also handle diagonal lines.
Big cleanups/removals of old paint to OutputDevice
and sc-specific rendering. All other app-usages
of borderline also adapted. Preparations for careful
line-start/end adaption prepared and possible due to
unified coordinate-system usages and basegfx class-usage
Change-Id: If9e4efcfc0fe25e14d4052907038ca5cf222a432
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/framelink.hxx | 267 | ||||
-rw-r--r-- | include/svx/framelinkarray.hxx | 28 |
2 files changed, 34 insertions, 261 deletions
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx index b907958a0789..b0c11e2b5f8c 100644 --- a/include/svx/framelink.hxx +++ b/include/svx/framelink.hxx @@ -32,6 +32,7 @@ class Point; namespace tools { class Rectangle; } class OutputDevice; +namespace svx { namespace frame { class Cell; }} namespace svx { namespace frame { @@ -157,6 +158,9 @@ public: /** Returns this style mirrored, if it is a double frame style, otherwise a simple copy. */ Style Mirror() const; + /** return the Cell using this style (if set) */ + const Cell* GetUsingCell() const { return mpUsingCell; } + private: Color maColorPrim; Color maColorSecn; @@ -168,6 +172,13 @@ private: double mfSecn; /// Width of secondary (right or bottom) line. double mfPatternScale; /// Scale used for line pattern spacing. SvxBorderLineStyle mnType; + + /// need information which cell this style info comes from due to needed + /// rotation info (which is in the cell). Rotation depends on the cell. + /// Encapsulated using a single static friend method that is the single + /// allowed instance to set/modify this value + friend void exclusiveSetUsigCellAtStyle(Style& rStyle, const Cell* pCell); + const Cell* mpUsingCell; }; bool operator==( const Style& rL, const Style& rR ); @@ -277,78 +288,6 @@ inline double GetVerDiagAngle( const tools::Rectangle& rRect ) */ SVX_DLLPUBLIC long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle ); -/** Returns an X coordinate for a diagonal frame border in the specified height. - - This function is for usage with the bottom-left end of a bottom-left to - top-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. - - Primary -->/ /<--- Secondary - / / - / / The function calculates the X position of i.e. - - - - - - - - - -/- - -X <----- this point (relative from X of reference point). - ^ +---/ /------------------------------------------------ - nVerOffs | / / <--- The diagonal frame border. - v | / | / - - - - - - - | --+-- <---- Reference point for horizontal and diagonal frame borders. - | | - | The horizontal frame border. - +---------------------------------------------------------- - - @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. - */ -long GetBLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle ); - -/** Returns an X coordinate for a diagonal frame border in the specified height. - - This function is for usage with the bottom-right end of a top-left to - bottom-right diagonal frame border, connected to the right end of a - horizontal frame border. - - @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 (left) angle between diagonal and horizontal frame border. - */ -long GetBRDiagOffset( long nDiagOffs, double fAngle ); - -/** Returns an X coordinate for a diagonal frame border in the specified height. - - This function is for usage with the top-right end of a bottom-left to - top-right diagonal frame border, connected to the right end of a horizontal - frame border. - - @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 (left) angle between diagonal and horizontal frame border. - */ -long GetTRDiagOffset( 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 @@ -431,8 +370,11 @@ SVX_DLLPUBLIC bool CheckFrameBorderConnectable( */ SVX_DLLPUBLIC void CreateBorderPrimitives( drawinglayer::primitive2d::Primitive2DContainer& rTarget, /// target for created primitives - const Point& rLPos, /// Reference point for left end of the processed frame border. - const Point& rRPos, /// Reference point for right end of the processed frame border. + + const basegfx::B2DPoint& rOrigin, /// start point of borderline + const basegfx::B2DVector& rX, /// X-Axis with length + const basegfx::B2DVector& rY, /// Y-Axis for perpendicular, normalized. Does *not* need to be perpendicular, but may express a rotation + const Style& rBorder, /// Style of the processed frame border. const DiagStyle& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder. @@ -447,15 +389,16 @@ SVX_DLLPUBLIC void CreateBorderPrimitives( 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 Color* pForceColor, /// If specified, overrides frame border color. - const long rRotationT = 9000, /// Angle of the top slanted frames in 100th of degree - const long rRotationB = 9000 /// Angle of the bottom slanted frames in 100th of degree + const Color* pForceColor /// If specified, overrides frame border color. ); SVX_DLLPUBLIC void CreateBorderPrimitives( drawinglayer::primitive2d::Primitive2DContainer& rTarget, /// target for created primitives - const Point& rLPos, /// Reference point for left end of the processed frame border. - const Point& rRPos, /// Reference point for right end of the processed frame border. + + const basegfx::B2DPoint& rOrigin, /// start point of borderline + const basegfx::B2DVector& rX, /// X-Axis with length + const basegfx::B2DVector& rY, /// Y-Axis for perpendicular, normalized. Does *not* need to be perpendicular, but may express a rotation + const Style& rBorder, /// Style of the processed frame border. const Style& rLFromT, /// Vertical frame border from top to left end of rBorder. @@ -466,9 +409,7 @@ SVX_DLLPUBLIC void CreateBorderPrimitives( 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 Color* pForceColor, /// If specified, overrides frame border color. - const long rRotationT = 9000, /// Angle of the top slanted frame in 100th of degrees - const long rRotationB = 9000 /// Angle of the bottom slanted frame in 100th of degrees + const Color* pForceColor /// If specified, overrides frame border color. ); /** Draws both diagonal frame borders, regards all connected frame styles. @@ -479,164 +420,11 @@ The function preserves all settings of the passed output device. */ SVX_DLLPUBLIC void CreateDiagFrameBorderPrimitives( drawinglayer::primitive2d::Primitive2DContainer& rTarget, /// target for created primitives - const basegfx::B2DRange& rRange, /// geometrical definition for both diagonal frame borders. - const Style& rTLBR, /// Style of the processed top-left to bottom-right diagonal frame border. - const Style& rBLTR, /// Style of the processed bottom-left to top-right diagonal frame border. - - const Style& rTLFromB, /// Vertical frame border from bottom to top-left end of rTLBR. - const Style& rTLFromR, /// Horizontal frame border from right to top-left end of rTLBR. - const Style& rBRFromT, /// Vertical frame border from top to bottom-right end of rTLBR. - const Style& rBRFromL, /// Horizontal frame border from left to bottom-right end of rTLBR. - - const Style& rBLFromT, /// Vertical frame border from top to bottom-left end of rBLTR. - const Style& rBLFromR, /// Horizontal frame border from right to bottom-left end of rBLTR. - const Style& rTRFromB, /// Vertical frame border from bottom to top-right end of rBLTR. - const Style& rTRFromL, /// Horizontal frame border from left to top-right end of rBLTR. - - const Color* pForceColor, /// If specified, overrides frame border color. - const long nRotationT = 9000, /// Angle of the top slanted frame in 100th of degrees - const long nRotationB = 9000 /// Angle of the bottom slanted frame in 100th of degrees -); - -/** Draws a horizontal frame border, regards all connected frame styles. - - The frame style to draw is passed as parameter rBorder. The function - calculates the adjustment in X direction for left and right end of primary - and secondary line of the frame border (the style may present a double - line). The line ends may differ according to the connected frame styles - coming from top, bottom, left, right, and/or diagonal. - - Thick frame styles are always drawn centered (in width) to the passed - reference points. The Y coordinates of both reference points must be equal - (the line cannot be drawn slanted). - - The function preserves all settings of the passed output device. - - All parameters starting with "rL" refer to the left end of the processed - frame border, all parameters starting with "rR" refer to the right end. - The following part of the parameter name starting with "From" specifies - where the frame border comes from. Example: "rLFromTR" means the frame - border coming from top-right, connected to the left end of rBorder (and - therefore a diagonal frame border). - - The follong picture shows the meaning of all passed parameters: - - rLFromT / \ rRFromT - | / \ | - | rLFromTR rRFromTL | - | / \ | - | / \ | - --- rLFromL --- ============== rBorder ============== --- rRFromR --- - | \ / | - | \ / | - | rLFromBR rRFromBL | - | \ / | - rLFromB \ / rRFromB - */ -SVX_DLLPUBLIC void DrawHorFrameBorder( - OutputDevice& rDev, /// The output device used to draw the frame border. - - const Point& rLPos, /// Reference point for left end of the processed frame border. - const Point& rRPos, /// Reference point for right end of the processed frame border. - 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& 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 DiagStyle& 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 Color* pForceColor = nullptr /// If specified, overrides frame border color. -); - - -/** Draws a vertical frame border, regards all connected frame styles. - - The frame style to draw is passed as parameter rBorder. The function - calculates the adjustment in Y direction for top and bottom end of primary - and secondary line of the frame border (the style may present a double - line). The line ends may differ according to the connected frame styles - coming from left, right, top, bottom, and/or diagonal. - - Thick frame styles are always drawn centered (in width) to the passed - reference points. The X coordinates of both reference points must be equal - (the line cannot be drawn slanted). - - The function preserves all settings of the passed output device. - - All parameters starting with "rT" refer to the top end of the processed - frame border, all parameters starting with "rB" refer to the bottom end. - The following part of the parameter name starting with "From" specifies - where the frame border comes from. Example: "rTFromBL" means the frame - border coming from bottom-left, connected to the top end of rBorder (and - therefore a diagonal frame border). - - The follong picture shows the meaning of all passed parameters: - - | - rTFromT - | - | - --- rTFromL --- --- rTFromR --- - / # \ - / # \ - rTFromBL # rTFromBR - / # \ - / # \ - # - rBorder - # - \ # / - \ # / - rBFromTL # rBFromTR - \ # / - \ # / - --- rBFromL --- --- rBFromR --- - | - | - rBFromB - | - */ -SVX_DLLPUBLIC void DrawVerFrameBorder( - OutputDevice& rDev, /// The output device used to draw the frame border. - - const Point& rTPos, /// Reference point for top end of the processed frame border. - const Point& rBPos, /// Reference point for bottom end of the processed frame border. - const Style& rBorder, /// Style of the processed frame border. - - const DiagStyle& rTFromBL, /// Diagonal frame border from bottom-right to top end of rBorder. - const Style& rTFromL, /// Horizontal frame border from left to top end of rBorder. - const Style& rTFromT, /// Vertical frame border from top to top end of rBorder. - const Style& rTFromR, /// Horizontal frame border from right to top end of rBorder. - const DiagStyle& rTFromBR, /// Diagonal frame border from bottom-right to top end of rBorder. - - const DiagStyle& rBFromTL, /// Diagonal frame border from top-left to bottom end of rBorder. - const Style& rBFromL, /// Horizontal frame border from left to bottom end of rBorder. - const Style& rBFromB, /// Vertical frame border from bottom to bottom end of rBorder. - const Style& rBFromR, /// Horizontal frame border from right to bottom end of rBorder. - const DiagStyle& rBFromTR, /// Diagonal frame border from top-right to bottom end of rBorder. - - const Color* pForceColor = nullptr /// If specified, overrides frame border color. -); - - -/** Draws both diagonal frame borders, regards all connected frame styles. - - One or both passed diagonal frame styles may be invisible. - - The function preserves all settings of the passed output device. - */ -SVX_DLLPUBLIC void DrawDiagFrameBorders( - OutputDevice& rDev, /// The output device used to draw the frame border. + const basegfx::B2DPoint& rOrigin, /// Origin of the coordinate system spawning the cell + const basegfx::B2DVector& rXAxis, /// X-Axis of the coordinate system spawning the cell + const basegfx::B2DVector& rYAxis, /// Y-Axis of the coordinate system spawning the cell - const tools::Rectangle& rRect, /// Rectangle for both diagonal frame borders. const Style& rTLBR, /// Style of the processed top-left to bottom-right diagonal frame border. const Style& rBLTR, /// Style of the processed bottom-left to top-right diagonal frame border. @@ -650,8 +438,7 @@ SVX_DLLPUBLIC void DrawDiagFrameBorders( const Style& rTRFromB, /// Vertical frame border from bottom to top-right end of rBLTR. const Style& rTRFromL, /// Horizontal frame border from left to top-right end of rBLTR. - const Color* pForceColor, /// If specified, overrides frame border color. - bool bDiagDblClip /// true = Use clipping for crossing double frame borders. + const Color* pForceColor /// If specified, overrides frame border color. ); diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx index 9208f67b46ae..15d8dcf1d9cf 100644 --- a/include/svx/framelinkarray.hxx +++ b/include/svx/framelinkarray.hxx @@ -23,6 +23,7 @@ #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <svx/framelink.hxx> #include <svx/svxdllapi.h> +#include <svx/rotmodit.hxx> #include <memory> #include <vector> @@ -119,6 +120,12 @@ public: /** Sets the bottom frame style of the specified row. Ignores merged ranges. */ void SetRowStyleBottom( size_t nRow, const Style& rStyle ); + /** Sets the rotation parameters of the cell (nCol,nRow). Ignores merged ranges. */ + void SetCellRotation(size_t nCol, size_t nRow, SvxRotateMode eRotMode, double fOrientation); + + /** Check if at least one cell is rotated */ + bool HasCellRotation() const; + /** Returns the left frame style of the cell (nCol,nRow). Returns thicker of own left style or right style of the cell to the left. Returns the style only if visible (i.e. at left border of a merged range). @@ -246,9 +253,6 @@ public: clipped too. This array can handle only one clip range at a time. */ void SetClipRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow ); - /** Returns the rectangle (output coordinates) of the current clipping range. */ - tools::Rectangle GetClipRangeRectangle() const; - // cell coordinates ------------------------------------------------------- /** Sets the X output coordinate of the left column. */ @@ -313,14 +317,6 @@ public: Returns the vertical angle of merged ranges. */ double GetVerDiagAngle( size_t nCol, size_t nRow ) const; - /** Specifies whether to use polygon clipping to draw diagonal frame borders. - @descr - If enabled, diagonal frame borders are drawn interrupted, if they are - crossed by a double frame border. Polygon clipping is very expensive - and should only be used for very small output devices (i.e. in the - Border tab page). Default after construction is OFF. */ - void SetUseDiagDoubleClipping( bool bSet ); - // mirroring -------------------------------------------------------------- /** Mirrors the entire array horizontally. */ @@ -336,16 +332,6 @@ public: size_t nLastCol, size_t nLastRow, const Color* pForceColor ) const; - /** Draws the part of the specified range, that is inside the clipping range. - @param pForceColor - If not NULL, only this color will be used to draw all frame borders. */ - void DrawRange( OutputDevice& rDev, - size_t nFirstCol, size_t nFirstRow, - size_t nLastCol, size_t nLastRow ) const; - - /** Draws the part of the array, that is inside the clipping range. */ - void DrawArray(OutputDevice& rDev) const; - /** Draws the part of the array, that is inside the clipping range. */ void DrawArray(drawinglayer::processor2d::BaseProcessor2D& rProcessor) const; |