diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-30 20:40:32 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-09-15 12:58:03 +0200 |
commit | a9c59cbfb9e16469b389db0b4d6befe196d0e2a0 (patch) | |
tree | a031682ae21ec46bb9c6e1e30b0110213e8e3dac /include | |
parent | fe14ddf25003c0f79f9f8a249bc22d45f57a0068 (diff) |
borderline: Preparing further to use CellCoordinateSystem
Multiple cleanups, made svx::frame::Style a std::shared_ptr class,
preparing basing all border stuff on transformations, so it will
need a CellCoordinateSystem. Added stuff to get this Coordinate
System from the svx::frame::Cell using the Frame and knowledge
about ownerships
Change-Id: Ic2cb59cc92e648ac2fef72f22f8913479769d3e2
Diffstat (limited to 'include')
-rw-r--r-- | include/basegfx/matrix/b2dhommatrixtools.hxx | 9 | ||||
-rw-r--r-- | include/svx/framelink.hxx | 88 | ||||
-rw-r--r-- | include/svx/framelinkarray.hxx | 3 |
3 files changed, 68 insertions, 32 deletions
diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx index 5dcd1b47936d..aa3c047a20c5 100644 --- a/include/basegfx/matrix/b2dhommatrixtools.hxx +++ b/include/basegfx/matrix/b2dhommatrixtools.hxx @@ -131,6 +131,15 @@ namespace basegfx const B2DRange& rSourceRange, const B2DRange& rTargetRange); + /// create based on given CoordinateSystem which is defined by origin and x/yaxis + BASEGFX_DLLPUBLIC B2DHomMatrix createCoordinateSystemTransform( + const B2DPoint& rOrigin, + const B2DVector& rX, + const B2DVector& rY); + + /// get column vector from B2dHomMatrix, e.g. to extract coordinate system origin and x/yaxis + BASEGFX_DLLPUBLIC B2DTuple getColumn(const B2DHomMatrix& rMatrix, sal_uInt16 nCol); + } // end of namespace tools } // end of namespace basegfx diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx index 973c401f5aec..d0fb165eef79 100644 --- a/include/svx/framelink.hxx +++ b/include/svx/framelink.hxx @@ -107,6 +107,43 @@ enum class RefMode */ class SAL_WARN_UNUSED SVX_DLLPUBLIC Style { +private: + class implStyle + { + private: + friend class Style; + + Color maColorPrim; + Color maColorSecn; + Color maColorGap; + bool mbUseGapColor; + RefMode meRefMode; /// Reference point handling for this frame border. + double mfPrim; /// Width of primary (single, left, or top) line. + double mfDist; /// Distance between primary and secondary line. + double mfSecn; /// Width of secondary (right or bottom) line. + double mfPatternScale; /// Scale used for line pattern spacing. + SvxBorderLineStyle mnType; + const Cell* mpUsingCell; + + public: + /** Constructs an invisible frame style. */ + explicit implStyle() : + maColorPrim(), + maColorSecn(), + maColorGap(), + mbUseGapColor(false), + meRefMode(RefMode::Centered), + mfPrim(0.0), + mfDist(0.0), + mfSecn(0.0), + mfPatternScale(1.0), + mnType(SvxBorderLineStyle::SOLID), + mpUsingCell(nullptr) + {} + }; + + std::shared_ptr< implStyle > maImplStyle; + public: /** Constructs an invisible frame style. */ explicit Style(); @@ -118,20 +155,20 @@ public: /** Constructs a frame style from the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */ explicit Style( const editeng::SvxBorderLine* pBorder, double fScale = 1.0 ); - RefMode GetRefMode() const { return meRefMode; } - const Color& GetColorPrim() const { return maColorPrim; } - const Color& GetColorSecn() const { return maColorSecn; } - const Color& GetColorGap() const { return maColorGap; } - bool UseGapColor() const { return mbUseGapColor; } - double Prim() const { return mfPrim; } - double Dist() const { return mfDist; } - double Secn() const { return mfSecn; } - double PatternScale() const { return mfPatternScale;} - void SetPatternScale( double fScale ); - SvxBorderLineStyle Type() const { return mnType; } + RefMode GetRefMode() const { return maImplStyle->meRefMode; } + const Color& GetColorPrim() const { return maImplStyle->maColorPrim; } + const Color& GetColorSecn() const { return maImplStyle->maColorSecn; } + const Color& GetColorGap() const { return maImplStyle->maColorGap; } + bool UseGapColor() const { return maImplStyle->mbUseGapColor; } + double Prim() const { return maImplStyle->mfPrim; } + double Dist() const { return maImplStyle->mfDist; } + double Secn() const { return maImplStyle->mfSecn; } + double PatternScale() const { return maImplStyle->mfPatternScale;} + void SetPatternScale( double fScale ) { maImplStyle->mfPatternScale = fScale; } + SvxBorderLineStyle Type() const { return maImplStyle->mnType; } /** Returns the total width of this frame style. */ - double GetWidth() const { return mfPrim + mfDist + mfSecn; } + double GetWidth() const; /** Sets the frame style to invisible state. */ void Clear(); @@ -146,37 +183,24 @@ public: void Set( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ); /** Sets a new reference point handling mode, does not modify other settings. */ - void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; } + void SetRefMode( RefMode eRefMode ) { maImplStyle->meRefMode = eRefMode; } /** Sets a new color, does not modify other settings. */ - void SetColorPrim( const Color& rColor ) { maColorPrim = rColor; } - void SetColorSecn( const Color& rColor ) { maColorSecn = rColor; } + void SetColorPrim( const Color& rColor ) { maImplStyle->maColorPrim = rColor; } + void SetColorSecn( const Color& rColor ) { maImplStyle->maColorSecn = rColor; } /** Sets whether to use dotted style for single hair lines. */ - void SetType( SvxBorderLineStyle nType ) { mnType = nType; } + void SetType( SvxBorderLineStyle nType ) { maImplStyle->mnType = nType; } /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */ Style& MirrorSelf(); /** return the Cell using this style (if set) */ - const Cell* GetUsingCell() const { return mpUsingCell; } + const Cell* GetUsingCell() const; private: - Color maColorPrim; - Color maColorSecn; - Color maColorGap; - bool mbUseGapColor; - RefMode meRefMode; /// Reference point handling for this frame border. - double mfPrim; /// Width of primary (single, left, or top) line. - double mfDist; /// Distance between primary and secondary line. - 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; + friend class Cell; + void SetUsingCell(const Cell* pCell); }; bool operator==( const Style& rL, const Style& rR ); diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx index 4801db277147..78b95c8d0ab0 100644 --- a/include/svx/framelinkarray.hxx +++ b/include/svx/framelinkarray.hxx @@ -292,6 +292,7 @@ public: /** 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; + basegfx::B2DRange GetCellRange( size_t nCellIndex ) const; // mirroring -------------------------------------------------------------- @@ -311,6 +312,8 @@ public: /** Draws the part of the array, that is inside the clipping range. */ void DrawArray(drawinglayer::processor2d::BaseProcessor2D& rProcessor) const; + // fill the Cell::maCellIndex entries to allow referencing back from Cell to Array Col/Row coordinates + void AddCellIndices() const; private: std::unique_ptr<ArrayImpl> mxImpl; |