include/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 226 ++++++------- solenv/clang-format/blacklist | 1 2 files changed, 113 insertions(+), 114 deletions(-)
New commits: commit 83235c56c4d3988312529c0842dbb0eddf2c4ff9 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Feb 3 19:35:53 2020 +0100 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Feb 4 08:37:35 2020 +0100 clean-up namespaces in borderlineprimitive2d.hxx Change-Id: If05757ee32027793f57e10f94b836c1a11bfc773 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87940 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index e38503cf6b4e..1a3bfa2b1b9b 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -27,9 +27,7 @@ enum class SvxBorderLineStyle : sal_Int16; -namespace drawinglayer -{ -namespace primitive2d +namespace drawinglayer::primitive2d { /** BorderLine class Helper class holding the style definition for a single part of a full BorderLine definition. @@ -142,7 +140,7 @@ public: /// provide unique ID virtual sal_uInt32 getPrimitive2DID() const override; }; -} // end of namespace primitive2d -} // end of namespace drawinglayer + +} // end of namespace drawinglayer::primitive2d /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 5ff0f83a3b5a323469bb410959b030de12b42505 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Feb 3 19:34:12 2020 +0100 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Feb 4 08:37:15 2020 +0100 remove borderlineprimitive2d.hxx from clang-format blacklist Change-Id: I9e8efbf2a947688fe3ec74fa1b2175a089b91a9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87939 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 3699310ef787..e38503cf6b4e 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -29,118 +29,120 @@ enum class SvxBorderLineStyle : sal_Int16; namespace drawinglayer { - namespace primitive2d +namespace primitive2d +{ +/** BorderLine class + Helper class holding the style definition for a single part of a full BorderLine 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. + Think about it similar to a trapezoid, but not aligned to X-Axis and using the + perpendicular vector to the given one in a right-handed coordinate system. +*/ +class DRAWINGLAYER_DLLPUBLIC BorderLine +{ +private: + // line attribute containing Width, Color and others + drawinglayer::attribute::LineAttribute maLineAttribute; + + // line extends + double mfStartLeft; + double mfStartRight; + double mfEndLeft; + double mfEndRight; + + // if this is a gap, this is set to true + bool mbIsGap; + +public: + // Constructor for visible BorderLine segments + BorderLine(const drawinglayer::attribute::LineAttribute& rLineAttribute, + double fStartLeft = 0.0, double fStartRight = 0.0, double fEndLeft = 0.0, + double fEndRight = 0.0); + + // Constructor for gap BorderLine segments + BorderLine(double fWidth); + + ~BorderLine(); + + BorderLine(BorderLine const&) = default; + BorderLine(BorderLine&&) = default; + BorderLine& operator=(BorderLine const&) = default; + BorderLine& operator=(BorderLine&&) = default; + + const drawinglayer::attribute::LineAttribute& getLineAttribute() const + { + return maLineAttribute; + } + double getStartLeft() const { return mfStartLeft; } + double getStartRight() const { return mfStartRight; } + double getEndLeft() const { return mfEndLeft; } + double getEndRight() const { return mfEndRight; } + bool isGap() const { return mbIsGap; } + + /// compare operator + bool operator==(const BorderLine& rBorderLine) const; +}; + +/// helper to try to merge two instances of BorderLinePrimitive2D. If it was possible, +/// a merged version is in the returned Primitive2DReference. Lots of preconditions +/// have to be met to allow that, see implementation (and maybe even expand) +Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D( + const Primitive2DReference& rCandidateA, const Primitive2DReference& rCandidateB); + +/** BorderLinePrimitive2D class + + 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 in the BorderLines definitions (see + class BorderLine above). +*/ +class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D final : public BufferedDecompositionPrimitive2D +{ +private: + /// the line definition + basegfx::B2DPoint maStart; + basegfx::B2DPoint maEnd; + + /// the single BorderLine style definition(s), one or three mostly used + std::vector<BorderLine> maBorderLines; + + /// common style definitions + const drawinglayer::attribute::StrokeAttribute maStrokeAttribute; + + /// create local decomposition + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + + /// helper to get the full width from maBorderLines + double getFullWidth() const; + +public: + /// simplified constructor for BorderLine with single edge + BorderLinePrimitive2D(const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, + const std::vector<BorderLine>& rBorderLines, + const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute); + + /// data read access + const basegfx::B2DPoint& getStart() const { return maStart; } + const basegfx::B2DPoint& getEnd() const { return maEnd; } + const std::vector<BorderLine>& getBorderLines() const { return maBorderLines; } + const drawinglayer::attribute::StrokeAttribute& getStrokeAttribute() const { - /** BorderLine class - Helper class holding the style definition for a single part of a full BorderLine 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. - Think about it similar to a trapezoid, but not aligned to X-Axis and using the - perpendicular vector to the given one in a right-handed coordinate system. - */ - class DRAWINGLAYER_DLLPUBLIC BorderLine - { - private: - // line attribute containing Width, Color and others - drawinglayer::attribute::LineAttribute maLineAttribute; - - // line extends - double mfStartLeft; - double mfStartRight; - double mfEndLeft; - double mfEndRight; - - // if this is a gap, this is set to true - bool mbIsGap; - - public: - // Constructor for visible BorderLine segments - BorderLine( - const drawinglayer::attribute::LineAttribute& rLineAttribute, - double fStartLeft = 0.0, - double fStartRight = 0.0, - double fEndLeft = 0.0, - double fEndRight = 0.0); - - // Constructor for gap BorderLine segments - BorderLine(double fWidth); - - ~BorderLine(); - - BorderLine(BorderLine const &) = default; - BorderLine(BorderLine &&) = default; - BorderLine & operator =(BorderLine const &) = default; - BorderLine & operator =(BorderLine &&) = default; - - const drawinglayer::attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } - double getStartLeft() const { return mfStartLeft; } - double getStartRight() const { return mfStartRight; } - double getEndLeft() const { return mfEndLeft; } - double getEndRight() const { return mfEndRight; } - bool isGap() const { return mbIsGap; } - - /// compare operator - bool operator==(const BorderLine& rBorderLine) const; - }; - - /// helper to try to merge two instances of BorderLinePrimitive2D. If it was possible, - /// a merged version is in the returned Primitive2DReference. Lots of preconditions - /// have to be met to allow that, see implementation (and maybe even expand) - Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D( - const Primitive2DReference& rCandidateA, - const Primitive2DReference& rCandidateB); - - /** BorderLinePrimitive2D class - - 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 in the BorderLines definitions (see - class BorderLine above). - */ - class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D final : public BufferedDecompositionPrimitive2D - { - private: - /// the line definition - basegfx::B2DPoint maStart; - basegfx::B2DPoint maEnd; - - /// the single BorderLine style definition(s), one or three mostly used - std::vector< BorderLine > maBorderLines; - - /// common style definitions - const drawinglayer::attribute::StrokeAttribute maStrokeAttribute; - - /// create local decomposition - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; - - /// helper to get the full width from maBorderLines - double getFullWidth() const; - - public: - /// simplified constructor for BorderLine with single edge - BorderLinePrimitive2D( - const basegfx::B2DPoint& rStart, - const basegfx::B2DPoint& rEnd, - const std::vector< BorderLine >& rBorderLines, - const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute); - - /// data read access - const basegfx::B2DPoint& getStart() const { return maStart; } - const basegfx::B2DPoint& getEnd() const { return maEnd; } - const std::vector< BorderLine >& getBorderLines() const { return maBorderLines; } - const drawinglayer::attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } - - /// helper to decide if AntiAliasing should be used - bool isHorizontalOrVertical(const geometry::ViewInformation2D& rViewInformation) const; - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; - }; - } // end of namespace primitive2d + return maStrokeAttribute; + } + + /// helper to decide if AntiAliasing should be used + bool isHorizontalOrVertical(const geometry::ViewInformation2D& rViewInformation) const; + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; +} // end of namespace primitive2d } // end of namespace drawinglayer /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index b94ad4e56d9d..b95748716f84 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -6049,7 +6049,6 @@ include/drawinglayer/attribute/strokeattribute.hxx include/drawinglayer/drawinglayerdllapi.h include/drawinglayer/geometry/viewinformation2d.hxx include/drawinglayer/geometry/viewinformation3d.hxx -include/drawinglayer/primitive2d/borderlineprimitive2d.hxx include/drawinglayer/primitive2d/controlprimitive2d.hxx include/drawinglayer/primitive2d/cropprimitive2d.hxx include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
