Rebased ref, commits from common ancestor: commit 4ec1de91f8a525c414172918b5f77fd94752a87a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 21:07:40 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:27 2020 +0900
remove linestartendattribute.hxx from clang-format excludelist Change-Id: I2d6cef1d3dff33c6cb2695c645d4f30e899c4616 diff --git a/include/drawinglayer/attribute/linestartendattribute.hxx b/include/drawinglayer/attribute/linestartendattribute.hxx index ea2bf22235fd..f894a335da4c 100644 --- a/include/drawinglayer/attribute/linestartendattribute.hxx +++ b/include/drawinglayer/attribute/linestartendattribute.hxx @@ -22,48 +22,47 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> -namespace basegfx { - class B2DPolyPolygon; +namespace basegfx +{ +class B2DPolyPolygon; } -namespace drawinglayer::attribute { - class ImpLineStartEndAttribute; +namespace drawinglayer::attribute +{ +class ImpLineStartEndAttribute; } - namespace drawinglayer::attribute - { - class DRAWINGLAYER_DLLPUBLIC LineStartEndAttribute - { - public: - typedef o3tl::cow_wrapper< ImpLineStartEndAttribute > ImplType; +{ +class DRAWINGLAYER_DLLPUBLIC LineStartEndAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpLineStartEndAttribute> ImplType; - private: - ImplType mpLineStartEndAttribute; +private: + ImplType mpLineStartEndAttribute; - public: - /// constructors/assignmentoperator/destructor - LineStartEndAttribute( - double fWidth, - const basegfx::B2DPolyPolygon& rPolyPolygon, - bool bCentered); - LineStartEndAttribute(); - LineStartEndAttribute(const LineStartEndAttribute&); - LineStartEndAttribute& operator=(const LineStartEndAttribute&); - ~LineStartEndAttribute(); +public: + /// constructors/assignmentoperator/destructor + LineStartEndAttribute(double fWidth, const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered); + LineStartEndAttribute(); + LineStartEndAttribute(const LineStartEndAttribute&); + LineStartEndAttribute& operator=(const LineStartEndAttribute&); + ~LineStartEndAttribute(); - // checks if the incarnation is default constructed - bool isDefault() const; + // checks if the incarnation is default constructed + bool isDefault() const; - // compare operator - bool operator==(const LineStartEndAttribute& rCandidate) const; + // compare operator + bool operator==(const LineStartEndAttribute& rCandidate) const; - // data read access - double getWidth() const; - const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const; - bool isCentered() const; - bool isActive() const; - }; + // data read access + double getWidth() const; + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const; + bool isCentered() const; + bool isActive() const; +}; } // end of namespace drawinglayer::attribute diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 3aba6d8f82ed..fc5da46bc758 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5230,7 +5230,6 @@ include/dbaccess/genericcontroller.hxx include/desktop/crashreport.hxx include/drawinglayer/XShapeDumper.hxx include/drawinglayer/animation/animationtiming.hxx -include/drawinglayer/attribute/linestartendattribute.hxx include/drawinglayer/attribute/materialattribute3d.hxx include/drawinglayer/attribute/sdrallattribute3d.hxx include/drawinglayer/attribute/sdrfillattribute.hxx commit fc3993eecea1d78179004a98c2bfe88415cbdc43 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 21:05:51 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:26 2020 +0900 pragma once for linestartendattribute.hxx Change-Id: Ic5fbc26d35c17159667dbf3a0e579789d14677f0 diff --git a/include/drawinglayer/attribute/linestartendattribute.hxx b/include/drawinglayer/attribute/linestartendattribute.hxx index bceeb378eec4..ea2bf22235fd 100644 --- a/include/drawinglayer/attribute/linestartendattribute.hxx +++ b/include/drawinglayer/attribute/linestartendattribute.hxx @@ -17,15 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX +#pragma once #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> - -// predefines - namespace basegfx { class B2DPolyPolygon; } @@ -71,7 +67,4 @@ namespace drawinglayer::attribute } // end of namespace drawinglayer::attribute - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 2640280bffa0cc33201cf0cb9f5c184f2503e64b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 21:01:43 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:26 2020 +0900 cleanup namespaces for fill*attribute.hxx Change-Id: I2aee131512e0eb194843f207de63e63af7ed219a diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx index 7b07d7022855..f9d9e2245d9a 100644 --- a/include/drawinglayer/attribute/fillgradientattribute.hxx +++ b/include/drawinglayer/attribute/fillgradientattribute.hxx @@ -30,10 +30,7 @@ class BColor; namespace drawinglayer::attribute { class ImpFillGradientAttribute; -} -namespace drawinglayer::attribute -{ enum class GradientStyle { Linear, @@ -44,10 +41,6 @@ enum class GradientStyle Rect }; -} // end of namespace drawinglayer::attribute - -namespace drawinglayer::attribute -{ class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute { public: diff --git a/include/drawinglayer/attribute/fillgraphicattribute.hxx b/include/drawinglayer/attribute/fillgraphicattribute.hxx index 1649d1b38881..976d7bd37586 100644 --- a/include/drawinglayer/attribute/fillgraphicattribute.hxx +++ b/include/drawinglayer/attribute/fillgraphicattribute.hxx @@ -32,10 +32,7 @@ class B2DRange; namespace drawinglayer::attribute { class ImpFillGraphicAttribute; -} -namespace drawinglayer::attribute -{ class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute { public: diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx index 5d97fbc17026..a929b5715906 100644 --- a/include/drawinglayer/attribute/fillhatchattribute.hxx +++ b/include/drawinglayer/attribute/fillhatchattribute.hxx @@ -30,10 +30,7 @@ class BColor; namespace drawinglayer::attribute { class ImpFillHatchAttribute; -} -namespace drawinglayer::attribute -{ enum class HatchStyle { Single, @@ -41,10 +38,6 @@ enum class HatchStyle Triple }; -} // end of namespace drawinglayer::attribute - -namespace drawinglayer::attribute -{ class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute { public: commit 15a5c3ff528ae74b3209cd335842466c8f2205ce Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 20:59:32 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:25 2020 +0900 pragma once for fill*attribute.hxx Change-Id: I588b0214bcd75b77c9c72b4c6f320a6dd8a82e01 diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx index cc2fab0518dc..7b07d7022855 100644 --- a/include/drawinglayer/attribute/fillgradientattribute.hxx +++ b/include/drawinglayer/attribute/fillgradientattribute.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX +#pragma once #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> @@ -88,6 +87,4 @@ public: } // end of namespace drawinglayer::attribute -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/fillgraphicattribute.hxx b/include/drawinglayer/attribute/fillgraphicattribute.hxx index 4ee0ab3f3ed5..1649d1b38881 100644 --- a/include/drawinglayer/attribute/fillgraphicattribute.hxx +++ b/include/drawinglayer/attribute/fillgraphicattribute.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX + +#pragma once #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> @@ -68,6 +68,4 @@ public: } // end of namespace drawinglayer::attribute -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx index f13e46bf903b..5d97fbc17026 100644 --- a/include/drawinglayer/attribute/fillhatchattribute.hxx +++ b/include/drawinglayer/attribute/fillhatchattribute.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX +#pragma once #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> @@ -95,6 +94,4 @@ public: } // end of namespace drawinglayer::attribute -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit bcc7aa25237e47361b236f56debf7a11cc4bd64a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 20:55:54 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:25 2020 +0900 remove fill*attribute.hxx from clang-format excludelist Change-Id: Idc70c350b1ed6015d56fd785acf5afbc394056fe diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx index 7363eb4bad89..cc2fab0518dc 100644 --- a/include/drawinglayer/attribute/fillgradientattribute.hxx +++ b/include/drawinglayer/attribute/fillgradientattribute.hxx @@ -23,81 +23,71 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> - -// predefines - -namespace basegfx { - class BColor; +namespace basegfx +{ +class BColor; } -namespace drawinglayer::attribute { - class ImpFillGradientAttribute; +namespace drawinglayer::attribute +{ +class ImpFillGradientAttribute; } - namespace drawinglayer::attribute - { - enum class GradientStyle - { - Linear, - Axial, - Radial, - Elliptical, - Square, - Rect - }; +{ +enum class GradientStyle +{ + Linear, + Axial, + Radial, + Elliptical, + Square, + Rect +}; } // end of namespace drawinglayer::attribute - namespace drawinglayer::attribute - { - class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute - { - public: - typedef o3tl::cow_wrapper< ImpFillGradientAttribute > ImplType; - - private: - ImplType mpFillGradientAttribute; - - public: - /// constructors/assignmentoperator/destructor - FillGradientAttribute( - GradientStyle eStyle, - double fBorder, - double fOffsetX, - double fOffsetY, - double fAngle, - const basegfx::BColor& rStartColor, - const basegfx::BColor& rEndColor, - sal_uInt16 nSteps); - FillGradientAttribute(); - FillGradientAttribute(const FillGradientAttribute&); - FillGradientAttribute(FillGradientAttribute&&); - FillGradientAttribute& operator=(const FillGradientAttribute&); - FillGradientAttribute& operator=(FillGradientAttribute&&); - ~FillGradientAttribute(); - - // checks if the incarnation is default constructed - bool isDefault() const; - - // compare operator - bool operator==(const FillGradientAttribute& rCandidate) const; - - // data read access - GradientStyle getStyle() const; - double getBorder() const; - double getOffsetX() const; - double getOffsetY() const; - double getAngle() const; - const basegfx::BColor& getStartColor() const; - const basegfx::BColor& getEndColor() const; - sal_uInt16 getSteps() const; - }; +{ +class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpFillGradientAttribute> ImplType; + +private: + ImplType mpFillGradientAttribute; + +public: + /// constructors/assignmentoperator/destructor + FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, + double fAngle, const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, sal_uInt16 nSteps); + FillGradientAttribute(); + FillGradientAttribute(const FillGradientAttribute&); + FillGradientAttribute(FillGradientAttribute&&); + FillGradientAttribute& operator=(const FillGradientAttribute&); + FillGradientAttribute& operator=(FillGradientAttribute&&); + ~FillGradientAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGradientAttribute& rCandidate) const; + + // data read access + GradientStyle getStyle() const; + double getBorder() const; + double getOffsetX() const; + double getOffsetY() const; + double getAngle() const; + const basegfx::BColor& getStartColor() const; + const basegfx::BColor& getEndColor() const; + sal_uInt16 getSteps() const; +}; } // end of namespace drawinglayer::attribute - #endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/fillgraphicattribute.hxx b/include/drawinglayer/attribute/fillgraphicattribute.hxx index 380ae0742c3c..4ee0ab3f3ed5 100644 --- a/include/drawinglayer/attribute/fillgraphicattribute.hxx +++ b/include/drawinglayer/attribute/fillgraphicattribute.hxx @@ -22,59 +22,52 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> - -// predefines - class Graphic; -namespace basegfx { - class B2DRange; +namespace basegfx +{ +class B2DRange; } -namespace drawinglayer::attribute { - class ImpFillGraphicAttribute; +namespace drawinglayer::attribute +{ +class ImpFillGraphicAttribute; } - namespace drawinglayer::attribute - { - class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute - { - public: - typedef o3tl::cow_wrapper< ImpFillGraphicAttribute > ImplType; - - private: - ImplType mpFillGraphicAttribute; - - public: - /// constructors/assignmentoperator/destructor - FillGraphicAttribute( - const Graphic& rGraphic, - const basegfx::B2DRange& rGraphicRange, - bool bTiling, - double fOffsetX = 0.0, - double fOffsetY = 0.0); - FillGraphicAttribute(const FillGraphicAttribute&); - FillGraphicAttribute& operator=(const FillGraphicAttribute&); - ~FillGraphicAttribute(); - - // checks if the incarnation is default constructed - bool isDefault() const; - - // compare operator - bool operator==(const FillGraphicAttribute& rCandidate) const; - - // data read access - const Graphic& getGraphic() const; - const basegfx::B2DRange& getGraphicRange() const; - bool getTiling() const; - double getOffsetX() const; - double getOffsetY() const; - }; +{ +class DRAWINGLAYER_DLLPUBLIC FillGraphicAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpFillGraphicAttribute> ImplType; + +private: + ImplType mpFillGraphicAttribute; + +public: + /// constructors/assignmentoperator/destructor + FillGraphicAttribute(const Graphic& rGraphic, const basegfx::B2DRange& rGraphicRange, + bool bTiling, double fOffsetX = 0.0, double fOffsetY = 0.0); + FillGraphicAttribute(const FillGraphicAttribute&); + FillGraphicAttribute& operator=(const FillGraphicAttribute&); + ~FillGraphicAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGraphicAttribute& rCandidate) const; + + // data read access + const Graphic& getGraphic() const; + const basegfx::B2DRange& getGraphicRange() const; + bool getTiling() const; + double getOffsetX() const; + double getOffsetY() const; +}; } // end of namespace drawinglayer::attribute - #endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRAPHICATTRIBUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx index e3c4c278929e..f13e46bf903b 100644 --- a/include/drawinglayer/attribute/fillhatchattribute.hxx +++ b/include/drawinglayer/attribute/fillhatchattribute.hxx @@ -23,86 +23,78 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <o3tl/cow_wrapper.hxx> - -// predefines - -namespace basegfx { - class BColor; +namespace basegfx +{ +class BColor; } -namespace drawinglayer::attribute { - class ImpFillHatchAttribute; +namespace drawinglayer::attribute +{ +class ImpFillHatchAttribute; } - namespace drawinglayer::attribute - { - enum class HatchStyle - { - Single, - Double, - Triple - }; +{ +enum class HatchStyle +{ + Single, + Double, + Triple +}; } // end of namespace drawinglayer::attribute - namespace drawinglayer::attribute - { - class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute - { - public: - typedef o3tl::cow_wrapper< ImpFillHatchAttribute > ImplType; - - private: - ImplType mpFillHatchAttribute; - - public: - /// constructors/assignmentoperator/destructor - FillHatchAttribute( - HatchStyle eStyle, - double fDistance, - double fAngle, - const basegfx::BColor& rColor, - sal_uInt32 nMinimalDiscreteDistance, - bool bFillBackground); - FillHatchAttribute(); - FillHatchAttribute(const FillHatchAttribute&); - FillHatchAttribute(FillHatchAttribute&&); - FillHatchAttribute& operator=(const FillHatchAttribute&); - FillHatchAttribute& operator=(FillHatchAttribute&&); - ~FillHatchAttribute(); - - // checks if the incarnation is default constructed - bool isDefault() const; - - // compare operator - bool operator==(const FillHatchAttribute& rCandidate) const; - - // data read access - HatchStyle getStyle() const; - double getDistance() const; - double getAngle() const; - const basegfx::BColor& getColor() const; - - // #i120230# If a minimal discrete distance is wanted (VCL used 3, - // this is the default for the global instance, too), set this - // unequal to zero. Zero means not to use it. If set bigger zero - // (should be at least two, one leads to a full plane filled with - // lines when Distance in discrete views is smaller than one) this - // will be used when the discrete value is less than the given one. - // This is used to 'emulate' old VCL behaviour which makes hatches - // look better by not making distances as small as needed, but - // keeping them on a minimal discrete value for more appealing - // visualisation. - sal_uInt32 getMinimalDiscreteDistance() const; - - bool isFillBackground() const; - }; +{ +class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute +{ +public: + typedef o3tl::cow_wrapper<ImpFillHatchAttribute> ImplType; + +private: + ImplType mpFillHatchAttribute; + +public: + /// constructors/assignmentoperator/destructor + FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, + const basegfx::BColor& rColor, sal_uInt32 nMinimalDiscreteDistance, + bool bFillBackground); + FillHatchAttribute(); + FillHatchAttribute(const FillHatchAttribute&); + FillHatchAttribute(FillHatchAttribute&&); + FillHatchAttribute& operator=(const FillHatchAttribute&); + FillHatchAttribute& operator=(FillHatchAttribute&&); + ~FillHatchAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillHatchAttribute& rCandidate) const; + + // data read access + HatchStyle getStyle() const; + double getDistance() const; + double getAngle() const; + const basegfx::BColor& getColor() const; + + // #i120230# If a minimal discrete distance is wanted (VCL used 3, + // this is the default for the global instance, too), set this + // unequal to zero. Zero means not to use it. If set bigger zero + // (should be at least two, one leads to a full plane filled with + // lines when Distance in discrete views is smaller than one) this + // will be used when the discrete value is less than the given one. + // This is used to 'emulate' old VCL behaviour which makes hatches + // look better by not making distances as small as needed, but + // keeping them on a minimal discrete value for more appealing + // visualisation. + sal_uInt32 getMinimalDiscreteDistance() const; + + bool isFillBackground() const; +}; } // end of namespace drawinglayer::attribute - #endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 94049a048a89..3aba6d8f82ed 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5230,9 +5230,6 @@ include/dbaccess/genericcontroller.hxx include/desktop/crashreport.hxx include/drawinglayer/XShapeDumper.hxx include/drawinglayer/animation/animationtiming.hxx -include/drawinglayer/attribute/fillgradientattribute.hxx -include/drawinglayer/attribute/fillgraphicattribute.hxx -include/drawinglayer/attribute/fillhatchattribute.hxx include/drawinglayer/attribute/linestartendattribute.hxx include/drawinglayer/attribute/materialattribute3d.hxx include/drawinglayer/attribute/sdrallattribute3d.hxx commit 326e49708ecd6bd9e31346f8a12761d087904968 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 20:51:51 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:24 2020 +0900 remove fontattribute.cxx from clang-format excludelist Change-Id: I3720692af45920a4d084fe6ca4dd08bc0598ac13 diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx index 33903003f8c7..e423b8367f1c 100644 --- a/drawinglayer/source/attribute/fontattribute.cxx +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -21,182 +21,131 @@ #include <rtl/instance.hxx> #include <rtl/ustring.hxx> - namespace drawinglayer::attribute { - class ImpFontAttribute - { - public: - /// core data - OUString maFamilyName; // Font Family Name - OUString maStyleName; // Font Style Name - sal_uInt16 mnWeight; // Font weight - - bool mbSymbol : 1; // Symbol Font Flag - bool mbVertical : 1; // Vertical Text Flag - bool mbItalic : 1; // Italic Flag - bool mbOutline : 1; // Outline Flag - bool mbRTL : 1; // RTL Flag - bool mbBiDiStrong : 1; // BiDi Flag - bool mbMonospaced : 1; - - ImpFontAttribute( - const OUString& rFamilyName, - const OUString& rStyleName, - sal_uInt16 nWeight, - bool bSymbol, - bool bVertical, - bool bItalic, - bool bMonospaced, - bool bOutline, - bool bRTL, - bool bBiDiStrong) - : maFamilyName(rFamilyName), - maStyleName(rStyleName), - mnWeight(nWeight), - mbSymbol(bSymbol), - mbVertical(bVertical), - mbItalic(bItalic), - mbOutline(bOutline), - mbRTL(bRTL), - mbBiDiStrong(bBiDiStrong), - mbMonospaced(bMonospaced) - { - } - - ImpFontAttribute() - : maFamilyName(), - maStyleName(), - mnWeight(0), - mbSymbol(false), - mbVertical(false), - mbItalic(false), - mbOutline(false), - mbRTL(false), - mbBiDiStrong(false), - mbMonospaced(false) - { - } - - // data read access - const OUString& getFamilyName() const { return maFamilyName; } - const OUString& getStyleName() const { return maStyleName; } - sal_uInt16 getWeight() const { return mnWeight; } - bool getSymbol() const { return mbSymbol; } - bool getVertical() const { return mbVertical; } - bool getItalic() const { return mbItalic; } - bool getOutline() const { return mbOutline; } - bool getRTL() const { return mbRTL; } - bool getBiDiStrong() const { return mbBiDiStrong; } - bool getMonospaced() const { return mbMonospaced; } - - bool operator==(const ImpFontAttribute& rCompare) const - { - return (getFamilyName() == rCompare.getFamilyName() - && getStyleName() == rCompare.getStyleName() - && getWeight() == rCompare.getWeight() - && getSymbol() == rCompare.getSymbol() - && getVertical() == rCompare.getVertical() - && getItalic() == rCompare.getItalic() - && getOutline() == rCompare.getOutline() - && getRTL() == rCompare.getRTL() - && getBiDiStrong() == rCompare.getBiDiStrong() - && getMonospaced() == rCompare.getMonospaced()); - } - }; - - namespace - { - struct theGlobalDefault : - public rtl::Static< FontAttribute::ImplType, theGlobalDefault > {}; - } - - FontAttribute::FontAttribute( - const OUString& rFamilyName, - const OUString& rStyleName, - sal_uInt16 nWeight, - bool bSymbol, - bool bVertical, - bool bItalic, - bool bMonospaced, - bool bOutline, - bool bRTL, - bool bBiDiStrong) - : mpFontAttribute(ImpFontAttribute( - rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bMonospaced, bOutline, bRTL, bBiDiStrong)) - { - } - - FontAttribute::FontAttribute() - : mpFontAttribute(theGlobalDefault::get()) - { - } - - FontAttribute::FontAttribute(const FontAttribute&) = default; - - FontAttribute::FontAttribute(FontAttribute&&) = default; - - FontAttribute::~FontAttribute() = default; - - FontAttribute& FontAttribute::operator=(const FontAttribute&) = default; - - FontAttribute& FontAttribute::operator=(FontAttribute&&) = default; - - bool FontAttribute::operator==(const FontAttribute& rCandidate) const - { - return rCandidate.mpFontAttribute == mpFontAttribute; - } - - const OUString& FontAttribute::getFamilyName() const - { - return mpFontAttribute->getFamilyName(); - } - - const OUString& FontAttribute::getStyleName() const - { - return mpFontAttribute->getStyleName(); - } - - sal_uInt16 FontAttribute::getWeight() const - { - return mpFontAttribute->getWeight(); - } - - bool FontAttribute::getSymbol() const - { - return mpFontAttribute->getSymbol(); - } - - bool FontAttribute::getVertical() const - { - return mpFontAttribute->getVertical(); - } - - bool FontAttribute::getItalic() const - { - return mpFontAttribute->getItalic(); - } - - bool FontAttribute::getOutline() const - { - return mpFontAttribute->getOutline(); - } - - bool FontAttribute::getRTL() const - { - return mpFontAttribute->getRTL(); - } - - bool FontAttribute::getBiDiStrong() const - { - return mpFontAttribute->getBiDiStrong(); - } - - bool FontAttribute::getMonospaced() const - { - return mpFontAttribute->getMonospaced(); - } +class ImpFontAttribute +{ +public: + /// core data + OUString maFamilyName; // Font Family Name + OUString maStyleName; // Font Style Name + sal_uInt16 mnWeight; // Font weight + + bool mbSymbol : 1; // Symbol Font Flag + bool mbVertical : 1; // Vertical Text Flag + bool mbItalic : 1; // Italic Flag + bool mbOutline : 1; // Outline Flag + bool mbRTL : 1; // RTL Flag + bool mbBiDiStrong : 1; // BiDi Flag + bool mbMonospaced : 1; + + ImpFontAttribute(const OUString& rFamilyName, const OUString& rStyleName, sal_uInt16 nWeight, + bool bSymbol, bool bVertical, bool bItalic, bool bMonospaced, bool bOutline, + bool bRTL, bool bBiDiStrong) + : maFamilyName(rFamilyName) + , maStyleName(rStyleName) + , mnWeight(nWeight) + , mbSymbol(bSymbol) + , mbVertical(bVertical) + , mbItalic(bItalic) + , mbOutline(bOutline) + , mbRTL(bRTL) + , mbBiDiStrong(bBiDiStrong) + , mbMonospaced(bMonospaced) + { + } + + ImpFontAttribute() + : maFamilyName() + , maStyleName() + , mnWeight(0) + , mbSymbol(false) + , mbVertical(false) + , mbItalic(false) + , mbOutline(false) + , mbRTL(false) + , mbBiDiStrong(false) + , mbMonospaced(false) + { + } + + // data read access + const OUString& getFamilyName() const { return maFamilyName; } + const OUString& getStyleName() const { return maStyleName; } + sal_uInt16 getWeight() const { return mnWeight; } + bool getSymbol() const { return mbSymbol; } + bool getVertical() const { return mbVertical; } + bool getItalic() const { return mbItalic; } + bool getOutline() const { return mbOutline; } + bool getRTL() const { return mbRTL; } + bool getBiDiStrong() const { return mbBiDiStrong; } + bool getMonospaced() const { return mbMonospaced; } + + bool operator==(const ImpFontAttribute& rCompare) const + { + return (getFamilyName() == rCompare.getFamilyName() + && getStyleName() == rCompare.getStyleName() && getWeight() == rCompare.getWeight() + && getSymbol() == rCompare.getSymbol() && getVertical() == rCompare.getVertical() + && getItalic() == rCompare.getItalic() && getOutline() == rCompare.getOutline() + && getRTL() == rCompare.getRTL() && getBiDiStrong() == rCompare.getBiDiStrong() + && getMonospaced() == rCompare.getMonospaced()); + } +}; + +namespace +{ +struct theGlobalDefault : public rtl::Static<FontAttribute::ImplType, theGlobalDefault> +{ +}; +} + +FontAttribute::FontAttribute(const OUString& rFamilyName, const OUString& rStyleName, + sal_uInt16 nWeight, bool bSymbol, bool bVertical, bool bItalic, + bool bMonospaced, bool bOutline, bool bRTL, bool bBiDiStrong) + : mpFontAttribute(ImpFontAttribute(rFamilyName, rStyleName, nWeight, bSymbol, bVertical, + bItalic, bMonospaced, bOutline, bRTL, bBiDiStrong)) +{ +} + +FontAttribute::FontAttribute() + : mpFontAttribute(theGlobalDefault::get()) +{ +} + +FontAttribute::FontAttribute(const FontAttribute&) = default; + +FontAttribute::FontAttribute(FontAttribute&&) = default; + +FontAttribute::~FontAttribute() = default; + +FontAttribute& FontAttribute::operator=(const FontAttribute&) = default; + +FontAttribute& FontAttribute::operator=(FontAttribute&&) = default; + +bool FontAttribute::operator==(const FontAttribute& rCandidate) const +{ + return rCandidate.mpFontAttribute == mpFontAttribute; +} + +const OUString& FontAttribute::getFamilyName() const { return mpFontAttribute->getFamilyName(); } + +const OUString& FontAttribute::getStyleName() const { return mpFontAttribute->getStyleName(); } + +sal_uInt16 FontAttribute::getWeight() const { return mpFontAttribute->getWeight(); } + +bool FontAttribute::getSymbol() const { return mpFontAttribute->getSymbol(); } + +bool FontAttribute::getVertical() const { return mpFontAttribute->getVertical(); } + +bool FontAttribute::getItalic() const { return mpFontAttribute->getItalic(); } + +bool FontAttribute::getOutline() const { return mpFontAttribute->getOutline(); } + +bool FontAttribute::getRTL() const { return mpFontAttribute->getRTL(); } + +bool FontAttribute::getBiDiStrong() const { return mpFontAttribute->getBiDiStrong(); } +bool FontAttribute::getMonospaced() const { return mpFontAttribute->getMonospaced(); } } // end of namespace diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 13d44b60a2d7..94049a048a89 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3334,7 +3334,6 @@ drawinglayer/source/animation/animationtiming.cxx drawinglayer/source/attribute/fillgradientattribute.cxx drawinglayer/source/attribute/fillgraphicattribute.cxx drawinglayer/source/attribute/fillhatchattribute.cxx -drawinglayer/source/attribute/fontattribute.cxx drawinglayer/source/attribute/lineattribute.cxx drawinglayer/source/attribute/linestartendattribute.cxx drawinglayer/source/attribute/materialattribute3d.cxx commit ae3839fa29e1aac46b4d6743035d8d9827576104 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Oct 21 20:39:46 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:24 2020 +0900 move the anonymous namespace into drawinglayer::primitive2d Change-Id: I66f7e5602c7a47baeadccfe913b9be984f0a5177 diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 1cd145c33839..3e4aabff75b1 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -27,6 +27,8 @@ using namespace com::sun::star; +namespace drawinglayer::primitive2d +{ namespace { // adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted @@ -78,8 +80,6 @@ basegfx::B2DVector getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale) } } // end of anonymous namespace -namespace drawinglayer::primitive2d -{ void TextSimplePortionPrimitive2D::getTextOutlinesAndTransformation( basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const { commit 4b0fe1007f21f27597a06bbf95bdaf241115dc7b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Oct 18 21:59:15 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:23 2020 +0900 simplify namespaces and clean-up for TextLayouterDevice Move anonymous namespace into drawinglayer::primitive2d and convert static function into anonymous functions. Change-Id: Id8ff161a5ec69154f053fadd1178265fa2675139 diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index c842517b3e72..933476b2045a 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -36,12 +36,14 @@ #include <i18nlangtag/languagetag.hxx> #include <vcl/svapp.hxx> -// VDev RevDevice provider - +namespace drawinglayer::primitive2d +{ namespace { class ImpTimedRefDev; +// VDev RevDevice provider + //the scoped_timed_RefDev owns an ImpTimeRefDev and releases it on dtor //or disposing of the default XComponentContext which causes the underlying //OutputDevice to get released @@ -130,14 +132,8 @@ void ImpTimedRefDev::releaseVirtualDevice() Start(); } } -} // end of anonymous namespace - -// access to one global ImpTimedRefDev incarnation in namespace drawinglayer::primitive -namespace drawinglayer::primitive2d -{ -// static methods here -static VirtualDevice& acquireGlobalVirtualDevice() +VirtualDevice& acquireGlobalVirtualDevice() { scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); @@ -147,7 +143,7 @@ static VirtualDevice& acquireGlobalVirtualDevice() return rStdRefDevice->acquireVirtualDevice(); } -static void releaseGlobalVirtualDevice() +void releaseGlobalVirtualDevice() { scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); @@ -156,6 +152,8 @@ static void releaseGlobalVirtualDevice() rStdRefDevice->releaseVirtualDevice(); } +} // end of anonymous namespace + TextLayouterDevice::TextLayouterDevice() : maSolarGuard() , mrDevice(acquireGlobalVirtualDevice()) commit a03485aaea626d25b5a7c6572974b8943a58697d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Oct 18 21:55:51 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:57:19 2020 +0900 remove textlayoutdevice.{hxx,cxx} from clang-format excludelist Change-Id: Ia80a0331246b4e25cdc3387c50bd97c6befc4ea4 diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 43afce5d0f1e..c842517b3e72 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -36,473 +36,423 @@ #include <i18nlangtag/languagetag.hxx> #include <vcl/svapp.hxx> - // VDev RevDevice provider namespace { - class ImpTimedRefDev; +class ImpTimedRefDev; - //the scoped_timed_RefDev owns an ImpTimeRefDev and releases it on dtor - //or disposing of the default XComponentContext which causes the underlying - //OutputDevice to get released +//the scoped_timed_RefDev owns an ImpTimeRefDev and releases it on dtor +//or disposing of the default XComponentContext which causes the underlying +//OutputDevice to get released - //The ImpTimerRefDev itself, if the timeout ever gets hit, will call - //reset on the scoped_timed_RefDev to release the ImpTimerRefDev early - //if it's unused for a few minutes - class scoped_timed_RefDev : public comphelper::unique_disposing_ptr<ImpTimedRefDev> +//The ImpTimerRefDev itself, if the timeout ever gets hit, will call +//reset on the scoped_timed_RefDev to release the ImpTimerRefDev early +//if it's unused for a few minutes +class scoped_timed_RefDev : public comphelper::unique_disposing_ptr<ImpTimedRefDev> +{ +public: + scoped_timed_RefDev() + : comphelper::unique_disposing_ptr<ImpTimedRefDev>( + (css::uno::Reference<css::lang::XComponent>( + ::comphelper::getProcessComponentContext(), css::uno::UNO_QUERY_THROW))) { - public: - scoped_timed_RefDev() : comphelper::unique_disposing_ptr<ImpTimedRefDev>((css::uno::Reference<css::lang::XComponent>(::comphelper::getProcessComponentContext(), css::uno::UNO_QUERY_THROW))) - { - } - }; + } +}; - class the_scoped_timed_RefDev : public rtl::Static<scoped_timed_RefDev, the_scoped_timed_RefDev> {}; +class the_scoped_timed_RefDev : public rtl::Static<scoped_timed_RefDev, the_scoped_timed_RefDev> +{ +}; - class ImpTimedRefDev : public Timer - { - scoped_timed_RefDev& mrOwnerOfMe; - VclPtr<VirtualDevice> mpVirDev; - sal_uInt32 mnUseCount; - - public: - explicit ImpTimedRefDev(scoped_timed_RefDev& rOwnerofMe); - virtual ~ImpTimedRefDev() override; - virtual void Invoke() override; - - VirtualDevice& acquireVirtualDevice(); - void releaseVirtualDevice(); - }; - - ImpTimedRefDev::ImpTimedRefDev(scoped_timed_RefDev& rOwnerOfMe) - : Timer( "drawinglayer ImpTimedRefDev destroy mpVirDev" ), - mrOwnerOfMe(rOwnerOfMe), - mpVirDev(nullptr), - mnUseCount(0) - { - SetTimeout(3L * 60L * 1000L); // three minutes - Start(); - } +class ImpTimedRefDev : public Timer +{ + scoped_timed_RefDev& mrOwnerOfMe; + VclPtr<VirtualDevice> mpVirDev; + sal_uInt32 mnUseCount; + +public: + explicit ImpTimedRefDev(scoped_timed_RefDev& rOwnerofMe); + virtual ~ImpTimedRefDev() override; + virtual void Invoke() override; + + VirtualDevice& acquireVirtualDevice(); + void releaseVirtualDevice(); +}; + +ImpTimedRefDev::ImpTimedRefDev(scoped_timed_RefDev& rOwnerOfMe) + : Timer("drawinglayer ImpTimedRefDev destroy mpVirDev") + , mrOwnerOfMe(rOwnerOfMe) + , mpVirDev(nullptr) + , mnUseCount(0) +{ + SetTimeout(3L * 60L * 1000L); // three minutes + Start(); +} - ImpTimedRefDev::~ImpTimedRefDev() - { - OSL_ENSURE(0 == mnUseCount, "destruction of a still used ImpTimedRefDev (!)"); - const SolarMutexGuard aSolarGuard; - mpVirDev.disposeAndClear(); - } +ImpTimedRefDev::~ImpTimedRefDev() +{ + OSL_ENSURE(0 == mnUseCount, "destruction of a still used ImpTimedRefDev (!)"); + const SolarMutexGuard aSolarGuard; + mpVirDev.disposeAndClear(); +} + +void ImpTimedRefDev::Invoke() +{ + // for obvious reasons, do not call anything after this + mrOwnerOfMe.reset(); +} - void ImpTimedRefDev::Invoke() +VirtualDevice& ImpTimedRefDev::acquireVirtualDevice() +{ + if (!mpVirDev) { - // for obvious reasons, do not call anything after this - mrOwnerOfMe.reset(); + mpVirDev = VclPtr<VirtualDevice>::Create(); + mpVirDev->SetReferenceDevice(VirtualDevice::RefDevMode::MSO1); } - VirtualDevice& ImpTimedRefDev::acquireVirtualDevice() + if (!mnUseCount) { - if(!mpVirDev) - { - mpVirDev = VclPtr<VirtualDevice>::Create(); - mpVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 ); - } + Stop(); + } - if(!mnUseCount) - { - Stop(); - } + mnUseCount++; - mnUseCount++; + return *mpVirDev; +} - return *mpVirDev; - } +void ImpTimedRefDev::releaseVirtualDevice() +{ + OSL_ENSURE(mnUseCount, "mismatch call number to releaseVirtualDevice() (!)"); + mnUseCount--; - void ImpTimedRefDev::releaseVirtualDevice() + if (!mnUseCount) { - OSL_ENSURE(mnUseCount, "mismatch call number to releaseVirtualDevice() (!)"); - mnUseCount--; - - if(!mnUseCount) - { - Start(); - } + Start(); } +} } // end of anonymous namespace - // access to one global ImpTimedRefDev incarnation in namespace drawinglayer::primitive namespace drawinglayer::primitive2d { - // static methods here - static VirtualDevice& acquireGlobalVirtualDevice() - { - scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); +// static methods here +static VirtualDevice& acquireGlobalVirtualDevice() +{ + scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); - if(!rStdRefDevice) - rStdRefDevice.reset(new ImpTimedRefDev(rStdRefDevice)); + if (!rStdRefDevice) + rStdRefDevice.reset(new ImpTimedRefDev(rStdRefDevice)); - return rStdRefDevice->acquireVirtualDevice(); - } + return rStdRefDevice->acquireVirtualDevice(); +} - static void releaseGlobalVirtualDevice() - { - scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); +static void releaseGlobalVirtualDevice() +{ + scoped_timed_RefDev& rStdRefDevice = the_scoped_timed_RefDev::get(); - OSL_ENSURE(rStdRefDevice, "releaseGlobalVirtualDevice() without prior acquireGlobalVirtualDevice() call(!)"); - rStdRefDevice->releaseVirtualDevice(); - } + OSL_ENSURE(rStdRefDevice, + "releaseGlobalVirtualDevice() without prior acquireGlobalVirtualDevice() call(!)"); + rStdRefDevice->releaseVirtualDevice(); +} - TextLayouterDevice::TextLayouterDevice() - : maSolarGuard(), - mrDevice(acquireGlobalVirtualDevice()) - { - } +TextLayouterDevice::TextLayouterDevice() + : maSolarGuard() + , mrDevice(acquireGlobalVirtualDevice()) +{ +} - TextLayouterDevice::~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE - { - releaseGlobalVirtualDevice(); - } +TextLayouterDevice::~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE { releaseGlobalVirtualDevice(); } - void TextLayouterDevice::setFont(const vcl::Font& rFont) - { - mrDevice.SetFont( rFont ); - } +void TextLayouterDevice::setFont(const vcl::Font& rFont) { mrDevice.SetFont(rFont); } - void TextLayouterDevice::setFontAttribute( - const attribute::FontAttribute& rFontAttribute, - double fFontScaleX, - double fFontScaleY, - const css::lang::Locale& rLocale) - { - setFont(getVclFontFromFontAttribute( - rFontAttribute, - fFontScaleX, - fFontScaleY, - 0.0, - rLocale)); - } +void TextLayouterDevice::setFontAttribute(const attribute::FontAttribute& rFontAttribute, + double fFontScaleX, double fFontScaleY, + const css::lang::Locale& rLocale) +{ + setFont(getVclFontFromFontAttribute(rFontAttribute, fFontScaleX, fFontScaleY, 0.0, rLocale)); +} - double TextLayouterDevice::getOverlineOffset() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = (rMetric.GetInternalLeading() / 2.0) - rMetric.GetAscent(); - return fRet; - } +double TextLayouterDevice::getOverlineOffset() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + double fRet = (rMetric.GetInternalLeading() / 2.0) - rMetric.GetAscent(); + return fRet; +} - double TextLayouterDevice::getUnderlineOffset() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = rMetric.GetDescent() / 2.0; - return fRet; - } +double TextLayouterDevice::getUnderlineOffset() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + double fRet = rMetric.GetDescent() / 2.0; + return fRet; +} - double TextLayouterDevice::getStrikeoutOffset() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = (rMetric.GetAscent() - rMetric.GetInternalLeading()) / 3.0; - return fRet; - } +double TextLayouterDevice::getStrikeoutOffset() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + double fRet = (rMetric.GetAscent() - rMetric.GetInternalLeading()) / 3.0; + return fRet; +} - double TextLayouterDevice::getOverlineHeight() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = rMetric.GetInternalLeading() / 2.5; - return fRet; - } +double TextLayouterDevice::getOverlineHeight() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + double fRet = rMetric.GetInternalLeading() / 2.5; + return fRet; +} - double TextLayouterDevice::getUnderlineHeight() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - double fRet = rMetric.GetDescent() / 4.0; - return fRet; - } +double TextLayouterDevice::getUnderlineHeight() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + double fRet = rMetric.GetDescent() / 4.0; + return fRet; +} - double TextLayouterDevice::getTextHeight() const - { - return mrDevice.GetTextHeight(); - } +double TextLayouterDevice::getTextHeight() const { return mrDevice.GetTextHeight(); } - double TextLayouterDevice::getTextWidth( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const - { - return mrDevice.GetTextWidth(rText, nIndex, nLength); - } +double TextLayouterDevice::getTextWidth(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const +{ + return mrDevice.GetTextWidth(rText, nIndex, nLength); +} - void TextLayouterDevice::getTextOutlines( - basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength, - const std::vector< double >& rDXArray) const - { - const sal_uInt32 nDXArrayCount(rDXArray.size()); - sal_uInt32 nTextLength(nLength); - const sal_uInt32 nStringLength(rText.getLength()); - - if(nTextLength + nIndex > nStringLength) - { - nTextLength = nStringLength - nIndex; - } - - if(nDXArrayCount) - { - OSL_ENSURE(nDXArrayCount == nTextLength, "DXArray size does not correspond to text portion size (!)"); - std::vector< tools::Long > aIntegerDXArray(nDXArrayCount); - - for(sal_uInt32 a(0); a < nDXArrayCount; a++) - { - aIntegerDXArray[a] = basegfx::fround(rDXArray[a]); - } - - mrDevice.GetTextOutlines( - rB2DPolyPolyVector, - rText, - nIndex, - nIndex, - nLength, - 0, - aIntegerDXArray.data()); - } - else - { - mrDevice.GetTextOutlines( - rB2DPolyPolyVector, - rText, - nIndex, - nIndex, - nLength); - } - } +void TextLayouterDevice::getTextOutlines(basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, + const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength, + const std::vector<double>& rDXArray) const +{ + const sal_uInt32 nDXArrayCount(rDXArray.size()); + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.getLength()); - basegfx::B2DRange TextLayouterDevice::getTextBoundRect( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const - { - sal_uInt32 nTextLength(nLength); - const sal_uInt32 nStringLength(rText.getLength()); - - if(nTextLength + nIndex > nStringLength) - { - nTextLength = nStringLength - nIndex; - } - - if(nTextLength) - { - ::tools::Rectangle aRect; - - mrDevice.GetTextBoundRect( - aRect, - rText, - nIndex, - nIndex, - nLength); - - // #i104432#, #i102556# take empty results into account - if(!aRect.IsEmpty()) - { - return vcl::unotools::b2DRectangleFromRectangle(aRect); - } - } - - return basegfx::B2DRange(); - } + if (nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } - double TextLayouterDevice::getFontAscent() const - { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - return rMetric.GetAscent(); - } + if (nDXArrayCount) + { + OSL_ENSURE(nDXArrayCount == nTextLength, + "DXArray size does not correspond to text portion size (!)"); + std::vector<tools::Long> aIntegerDXArray(nDXArrayCount); - double TextLayouterDevice::getFontDescent() const + for (sal_uInt32 a(0); a < nDXArrayCount; a++) { - const ::FontMetric& rMetric = mrDevice.GetFontMetric(); - return rMetric.GetDescent(); + aIntegerDXArray[a] = basegfx::fround(rDXArray[a]); } - void TextLayouterDevice::addTextRectActions( - const ::tools::Rectangle& rRectangle, - const OUString& rText, - DrawTextFlags nStyle, - GDIMetaFile& rGDIMetaFile) const - { - mrDevice.AddTextRectActions( - rRectangle, rText, nStyle, rGDIMetaFile); - } + mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, 0, + aIntegerDXArray.data()); + } + else + { + mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength); + } +} - std::vector< double > TextLayouterDevice::getTextArray( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const - { - std::vector< double > aRetval; - sal_uInt32 nTextLength(nLength); - const sal_uInt32 nStringLength(rText.getLength()); - - if(nTextLength + nIndex > nStringLength) - { - nTextLength = nStringLength - nIndex; - } - - if(nTextLength) - { - aRetval.reserve(nTextLength); - std::vector<tools::Long> aArray(nTextLength); - mrDevice.GetTextArray(rText, aArray.data(), nIndex, nLength); - aRetval.assign(aArray.begin(), aArray.end()); - } - - return aRetval; - } +basegfx::B2DRange TextLayouterDevice::getTextBoundRect(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const +{ + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.getLength()); + + if (nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if (nTextLength) + { + ::tools::Rectangle aRect; - std::vector< double > TextLayouterDevice::getCaretPositions( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const + mrDevice.GetTextBoundRect(aRect, rText, nIndex, nIndex, nLength); + + // #i104432#, #i102556# take empty results into account + if (!aRect.IsEmpty()) { - std::vector< double > aRetval; - sal_uInt32 nTextLength(nLength); - const sal_uInt32 nStringLength(rText.getLength()); - - if(nTextLength + nIndex > nStringLength) - { - nTextLength = nStringLength - nIndex; - } - - if(nTextLength) - { - aRetval.reserve(2 * nTextLength); - std::vector<tools::Long> aArray(2 * nTextLength); - mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nLength); - aRetval.assign(aArray.begin(), aArray.end()); - } - - return aRetval; + return vcl::unotools::b2DRectangleFromRectangle(aRect); } + } + + return basegfx::B2DRange(); +} + +double TextLayouterDevice::getFontAscent() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + return rMetric.GetAscent(); +} + +double TextLayouterDevice::getFontDescent() const +{ + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + return rMetric.GetDescent(); +} + +void TextLayouterDevice::addTextRectActions(const ::tools::Rectangle& rRectangle, + const OUString& rText, DrawTextFlags nStyle, + GDIMetaFile& rGDIMetaFile) const +{ + mrDevice.AddTextRectActions(rRectangle, rText, nStyle, rGDIMetaFile); +} + +std::vector<double> TextLayouterDevice::getTextArray(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const +{ + std::vector<double> aRetval; + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.getLength()); + + if (nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + if (nTextLength) + { + aRetval.reserve(nTextLength); + std::vector<tools::Long> aArray(nTextLength); + mrDevice.GetTextArray(rText, aArray.data(), nIndex, nLength); + aRetval.assign(aArray.begin(), aArray.end()); + } + + return aRetval; +} + +std::vector<double> TextLayouterDevice::getCaretPositions(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const +{ + std::vector<double> aRetval; + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.getLength()); + + if (nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if (nTextLength) + { + aRetval.reserve(2 * nTextLength); + std::vector<tools::Long> aArray(2 * nTextLength); + mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nLength); + aRetval.assign(aArray.begin(), aArray.end()); + } + + return aRetval; +} // helper methods for vcl font handling - vcl::Font getVclFontFromFontAttribute( - const attribute::FontAttribute& rFontAttribute, - double fFontScaleX, - double fFontScaleY, - double fFontRotation, - const css::lang::Locale& rLocale) - { - // detect FontScaling - const sal_uInt32 nHeight(basegfx::fround(fabs(fFontScaleY))); - const sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX))); - const bool bFontIsScaled(nHeight != nWidth); +vcl::Font getVclFontFromFontAttribute(const attribute::FontAttribute& rFontAttribute, + double fFontScaleX, double fFontScaleY, double fFontRotation, + const css::lang::Locale& rLocale) +{ + // detect FontScaling + const sal_uInt32 nHeight(basegfx::fround(fabs(fFontScaleY))); + const sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX))); + const bool bFontIsScaled(nHeight != nWidth); #ifdef _WIN32 - // for WIN32 systems, start with creating an unscaled font. If FontScaling - // is wanted, that width needs to be adapted using FontMetric again to get a - // width of the unscaled font - vcl::Font aRetval( - rFontAttribute.getFamilyName(), - rFontAttribute.getStyleName(), - Size(0, nHeight)); + // for WIN32 systems, start with creating an unscaled font. If FontScaling + // is wanted, that width needs to be adapted using FontMetric again to get a + // width of the unscaled font + vcl::Font aRetval(rFontAttribute.getFamilyName(), rFontAttribute.getStyleName(), + Size(0, nHeight)); #else - // for non-WIN32 systems things are easier since these accept a Font creation - // with initially nWidth != nHeight for FontScaling. Despite that, use zero for - // FontWidth when no scaling is used to explicitly have that zero when e.g. the - // Font would be recorded in a MetaFile (The MetaFile FontAction WILL record a - // set FontWidth; import that in a WIN32 system, and trouble is there) - vcl::Font aRetval( - rFontAttribute.getFamilyName(), - rFontAttribute.getStyleName(), - Size(bFontIsScaled ? std::max<sal_uInt32>(nWidth, 1) : 0, nHeight)); + // for non-WIN32 systems things are easier since these accept a Font creation + // with initially nWidth != nHeight for FontScaling. Despite that, use zero for + // FontWidth when no scaling is used to explicitly have that zero when e.g. the + // Font would be recorded in a MetaFile (The MetaFile FontAction WILL record a + // set FontWidth; import that in a WIN32 system, and trouble is there) + vcl::Font aRetval(rFontAttribute.getFamilyName(), rFontAttribute.getStyleName(), + Size(bFontIsScaled ? std::max<sal_uInt32>(nWidth, 1) : 0, nHeight)); #endif - // define various other FontAttribute - aRetval.SetAlignment(ALIGN_BASELINE); - aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE); - aRetval.SetVertical(rFontAttribute.getVertical()); - aRetval.SetWeight(static_cast<FontWeight>(rFontAttribute.getWeight())); - aRetval.SetItalic(rFontAttribute.getItalic() ? ITALIC_NORMAL : ITALIC_NONE); - aRetval.SetOutline(rFontAttribute.getOutline()); - aRetval.SetPitch(rFontAttribute.getMonospaced() ? PITCH_FIXED : PITCH_VARIABLE); - aRetval.SetLanguage(LanguageTag::convertToLanguageType( rLocale, false)); + // define various other FontAttribute + aRetval.SetAlignment(ALIGN_BASELINE); + aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL + : RTL_TEXTENCODING_UNICODE); + aRetval.SetVertical(rFontAttribute.getVertical()); + aRetval.SetWeight(static_cast<FontWeight>(rFontAttribute.getWeight())); + aRetval.SetItalic(rFontAttribute.getItalic() ? ITALIC_NORMAL : ITALIC_NONE); + aRetval.SetOutline(rFontAttribute.getOutline()); + aRetval.SetPitch(rFontAttribute.getMonospaced() ? PITCH_FIXED : PITCH_VARIABLE); + aRetval.SetLanguage(LanguageTag::convertToLanguageType(rLocale, false)); #ifdef _WIN32 - // for WIN32 systems, correct the FontWidth if FontScaling is used - if(bFontIsScaled && nHeight > 0) - { - const FontMetric aUnscaledFontMetric(Application::GetDefaultDevice()->GetFontMetric(aRetval)); - - if(aUnscaledFontMetric.GetAverageFontWidth() > 0) - { - const double fScaleFactor(static_cast<double>(nWidth) / static_cast<double>(nHeight)); - const sal_uInt32 nScaledWidth(basegfx::fround(static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth()) * fScaleFactor)); - aRetval.SetAverageFontWidth(nScaledWidth); - } - } -#endif - // handle FontRotation (if defined) - if(!basegfx::fTools::equalZero(fFontRotation)) - { - sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0/F_PI))); - aRetval.SetOrientation(Degree10(aRotate10th % 3600)); - } - - return aRetval; - } + // for WIN32 systems, correct the FontWidth if FontScaling is used + if (bFontIsScaled && nHeight > 0) + { + const FontMetric aUnscaledFontMetric( + Application::GetDefaultDevice()->GetFontMetric(aRetval)); - attribute::FontAttribute getFontAttributeFromVclFont( - basegfx::B2DVector& o_rSize, - const vcl::Font& rFont, - bool bRTL, - bool bBiDiStrong) + if (aUnscaledFontMetric.GetAverageFontWidth() > 0) { - const attribute::FontAttribute aRetval( - rFont.GetFamilyName(), - rFont.GetStyleName(), - static_cast<sal_uInt16>(rFont.GetWeight()), - RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet(), - rFont.IsVertical(), - ITALIC_NONE != rFont.GetItalic(), - PITCH_FIXED == rFont.GetPitch(), - rFont.IsOutline(), - bRTL, - bBiDiStrong); - // TODO: eKerning - - // set FontHeight and init to no FontScaling - o_rSize.setY(std::max<tools::Long>(rFont.GetFontSize().getHeight(), 0)); - o_rSize.setX(o_rSize.getY()); + const double fScaleFactor(static_cast<double>(nWidth) / static_cast<double>(nHeight)); + const sal_uInt32 nScaledWidth(basegfx::fround( + static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth()) * fScaleFactor)); + aRetval.SetAverageFontWidth(nScaledWidth); + } + } +#endif + // handle FontRotation (if defined) + if (!basegfx::fTools::equalZero(fFontRotation)) + { + sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0 / F_PI))); + aRetval.SetOrientation(Degree10(aRotate10th % 3600)); + } + + return aRetval; +} + +attribute::FontAttribute getFontAttributeFromVclFont(basegfx::B2DVector& o_rSize, + const vcl::Font& rFont, bool bRTL, + bool bBiDiStrong) +{ + const attribute::FontAttribute aRetval( + rFont.GetFamilyName(), rFont.GetStyleName(), static_cast<sal_uInt16>(rFont.GetWeight()), + RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet(), rFont.IsVertical(), + ITALIC_NONE != rFont.GetItalic(), PITCH_FIXED == rFont.GetPitch(), rFont.IsOutline(), bRTL, + bBiDiStrong); + // TODO: eKerning + + // set FontHeight and init to no FontScaling + o_rSize.setY(std::max<tools::Long>(rFont.GetFontSize().getHeight(), 0)); + o_rSize.setX(o_rSize.getY()); #ifdef _WIN32 - // for WIN32 systems, the FontScaling at the Font is detected by - // checking that FontWidth != 0. When FontScaling is used, WIN32 - // needs to do extra stuff to detect the correct width (since it's - // zero and not equal the font height) and its relationship to - // the height - if(rFont.GetFontSize().getWidth() > 0) - { - vcl::Font aUnscaledFont(rFont); - aUnscaledFont.SetAverageFontWidth(0); - const FontMetric aUnscaledFontMetric(Application::GetDefaultDevice()->GetFontMetric(aUnscaledFont)); - - if(aUnscaledFontMetric.GetAverageFontWidth() > 0) - { - const double fScaleFactor(static_cast<double>(rFont.GetFontSize().getWidth()) / static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth())); - o_rSize.setX(fScaleFactor * o_rSize.getY()); - } - } + // for WIN32 systems, the FontScaling at the Font is detected by + // checking that FontWidth != 0. When FontScaling is used, WIN32 + // needs to do extra stuff to detect the correct width (since it's + // zero and not equal the font height) and its relationship to + // the height + if (rFont.GetFontSize().getWidth() > 0) + { + vcl::Font aUnscaledFont(rFont); + aUnscaledFont.SetAverageFontWidth(0); + const FontMetric aUnscaledFontMetric( + Application::GetDefaultDevice()->GetFontMetric(aUnscaledFont)); + + if (aUnscaledFontMetric.GetAverageFontWidth() > 0) + { + const double fScaleFactor( + static_cast<double>(rFont.GetFontSize().getWidth()) + / static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth())); + o_rSize.setX(fScaleFactor * o_rSize.getY()); + } + } #else - // For non-WIN32 systems the detection is the same, but the value - // is easier achieved since width == height is interpreted as no - // scaling. Ergo, Width == 0 means width == height, and width != 0 - // means the scaling is in the direct relation of width to height - if(rFont.GetFontSize().getWidth() > 0) - { - o_rSize.setX(static_cast<double>(rFont.GetFontSize().getWidth())); - } + // For non-WIN32 systems the detection is the same, but the value + // is easier achieved since width == height is interpreted as no + // scaling. Ergo, Width == 0 means width == height, and width != 0 + // means the scaling is in the direct relation of width to height + if (rFont.GetFontSize().getWidth() > 0) + { + o_rSize.setX(static_cast<double>(rFont.GetFontSize().getWidth())); + } #endif - return aRetval; - } + return aRetval; +} } // end of namespace diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx b/include/drawinglayer/primitive2d/textlayoutdevice.hxx index 10f0fc0b23c1..93587769c449 100644 --- a/include/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -28,115 +28,99 @@ // predefines class VirtualDevice; -namespace vcl { class Font; } class GDIMetaFile; -namespace tools { class Rectangle; } enum class DrawTextFlags; -namespace drawinglayer::attribute { - class FontAttribute; +namespace vcl +{ +class Font; +} +namespace tools +{ +class Rectangle; +} +namespace drawinglayer::attribute +{ +class FontAttribute; +} +namespace com::sun::star::lang +{ +struct Locale; } - -namespace com::sun::star::lang { struct Locale; } // access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive namespace drawinglayer::primitive2d { - /** TextLayouterDevice class +/** TextLayouterDevice class - This helper class exists to isolate all accesses to VCL - text formatting/handling functionality for primitive implementations. - When in the future FontHandling may move to an own library independent - from VCL, primitives will be prepared. - */ - class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice - { - /// internally used VirtualDevice - SolarMutexGuard maSolarGuard; - VirtualDevice& mrDevice; - - public: - /// constructor/destructor - TextLayouterDevice(); - ~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE; - - /// tooling methods - void setFont(const vcl::Font& rFont); - void setFontAttribute( - const attribute::FontAttribute& rFontAttribute, - double fFontScaleX, - double fFontScaleY, - const css::lang::Locale & rLocale); - - double getTextHeight() const; - double getOverlineHeight() const; - double getOverlineOffset() const; - double getUnderlineHeight() const; - double getUnderlineOffset() const; - double getStrikeoutOffset() const; - - double getTextWidth( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const; - - void getTextOutlines( - basegfx::B2DPolyPolygonVector&, - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength, - const ::std::vector< double >& rDXArray) const; - - basegfx::B2DRange getTextBoundRect( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const; - - double getFontAscent() const; - double getFontDescent() const; - - void addTextRectActions( - const tools::Rectangle& rRectangle, - const OUString& rText, - DrawTextFlags nStyle, - GDIMetaFile& rGDIMetaFile) const; - - ::std::vector< double > getTextArray( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const; - - ::std::vector< double > getCaretPositions( - const OUString& rText, - sal_uInt32 nIndex, - sal_uInt32 nLength) const; - }; - - // helper methods for vcl font handling - - /** Create a VCL-Font based on the definitions in FontAttribute + This helper class exists to isolate all accesses to VCL + text formatting/handling functionality for primitive implementations. + When in the future FontHandling may move to an own library independent + from VCL, primitives will be prepared. + */ +class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice +{ + /// internally used VirtualDevice + SolarMutexGuard maSolarGuard; + VirtualDevice& mrDevice; + +public: + /// constructor/destructor + TextLayouterDevice(); + ~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE; + + /// tooling methods + void setFont(const vcl::Font& rFont); + void setFontAttribute(const attribute::FontAttribute& rFontAttribute, double fFontScaleX, + double fFontScaleY, const css::lang::Locale& rLocale); + + double getTextHeight() const; + double getOverlineHeight() const; + double getOverlineOffset() const; + double getUnderlineHeight() const; + double getUnderlineOffset() const; + double getStrikeoutOffset() const; + + double getTextWidth(const OUString& rText, sal_uInt32 nIndex, sal_uInt32 nLength) const; + + void getTextOutlines(basegfx::B2DPolyPolygonVector&, const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength, const ::std::vector<double>& rDXArray) const; + + basegfx::B2DRange getTextBoundRect(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const; + + double getFontAscent() const; + double getFontDescent() const; + + void addTextRectActions(const tools::Rectangle& rRectangle, const OUString& rText, + DrawTextFlags nStyle, GDIMetaFile& rGDIMetaFile) const; + + ::std::vector<double> getTextArray(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const; + + ::std::vector<double> getCaretPositions(const OUString& rText, sal_uInt32 nIndex, + sal_uInt32 nLength) const; +}; + +// helper methods for vcl font handling + +/** Create a VCL-Font based on the definitions in FontAttribute and the given FontScaling. The FontScaling defines the FontHeight (fFontScaleY) and the FontWidth (fFontScaleX). The combination of both defines FontStretching, where no stretching happens at fFontScaleY == fFontScaleX */ - vcl::Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute( - const attribute::FontAttribute& rFontAttribute, - double fFontScaleX, - double fFontScaleY, - double fFontRotation, - const css::lang::Locale & rLocale); - - /** Generate FontAttribute DataSet derived from the given VCL-Font. +vcl::Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute( + const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, + double fFontRotation, const css::lang::Locale& rLocale); + +/** Generate FontAttribute DataSet derived from the given VCL-Font. The FontScaling with fFontScaleY, fFontScaleX relationship (see above) will be set in return parameter o_rSize to allow further processing */ - attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont( - basegfx::B2DVector& o_rSize, - const vcl::Font& rFont, - bool bRTL, - bool bBiDiStrong); +attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont( + basegfx::B2DVector& o_rSize, const vcl::Font& rFont, bool bRTL, bool bBiDiStrong); } // end of namespace drawinglayer::primitive2d diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index fe0f19376b32..13d44b60a2d7 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3392,7 +3392,6 @@ drawinglayer/source/primitive2d/textbreakuphelper.cxx drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx drawinglayer/source/primitive2d/textenumsprimitive2d.cxx drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx -drawinglayer/source/primitive2d/textlayoutdevice.cxx drawinglayer/source/primitive2d/textlineprimitive2d.cxx drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx drawinglayer/source/primitive2d/transformprimitive2d.cxx @@ -5281,7 +5280,6 @@ include/drawinglayer/primitive2d/textbreakuphelper.hxx include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx include/drawinglayer/primitive2d/textenumsprimitive2d.hxx include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx -include/drawinglayer/primitive2d/textlayoutdevice.hxx include/drawinglayer/primitive2d/transformprimitive2d.hxx include/drawinglayer/primitive2d/transparenceprimitive2d.hxx include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx commit c9829544cf29b07dc2d86262c4d4775368764898 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Oct 17 21:56:16 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:28 2020 +0900 remove left-over printf Change-Id: I2327cfbd8e291820453b4784badfdbc0a6314355 diff --git a/svgio/source/svgreader/svgvisitor.cxx b/svgio/source/svgreader/svgvisitor.cxx index 1f2ea975c4ca..14d645ecc5d9 100644 --- a/svgio/source/svgreader/svgvisitor.cxx +++ b/svgio/source/svgreader/svgvisitor.cxx @@ -46,10 +46,6 @@ void SvgDrawVisitor::visit(svgio::svgreader::SvgNode const& rNode) if (rGNode.getTransform() != nullptr) { basegfx::B2DHomMatrix rMatrix = *rGNode.getTransform(); - - printf("G [%f %f %f - %f %f %f - %f %f %f]\n", rMatrix.get(0, 0), rMatrix.get(0, 1), - rMatrix.get(0, 2), rMatrix.get(1, 0), rMatrix.get(1, 1), rMatrix.get(1, 2), - rMatrix.get(2, 0), rMatrix.get(2, 1), rMatrix.get(2, 2)); } } break; commit b80ef3c2c29e14ac8b29d0ccf4a6fbebaf8da631 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Oct 17 21:55:12 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:27 2020 +0900 remove unneeded namespace re-declarations Change-Id: I4c90a1548f56cbc5fdeb2824a5eb47bb669c4b4f diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 419a887cc55f..457039e1ba82 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -143,11 +143,6 @@ namespace svgio::svgreader } } -} // end of namespace svgio::svgreader - - -namespace svgio::svgreader -{ namespace { class localTextBreakupHelper : public drawinglayer::primitive2d::TextBreakupHelper @@ -188,11 +183,6 @@ namespace svgio::svgreader return true; } -} // end of namespace svgio::svgreader - - -namespace svgio::svgreader -{ SvgCharacterNode::SvgCharacterNode( SvgDocument& rDocument, SvgNode* pParent, @@ -567,11 +557,7 @@ namespace svgio::svgreader } } -} // end of namespace svgio::svgreader - -namespace svgio::svgreader -{ SvgTextPosition::SvgTextPosition( SvgTextPosition* pParent, const InfoProvider& rInfoProvider, commit f66cc134af1b81d43b4b9507d1761569f68ba5f9 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Oct 17 19:46:55 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:27 2020 +0900 pragma once for svdobj.hxx Change-Id: Iceb1c2f0c2e1c488e4bef4fed395dd61a40da8ca diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 32afa65a2994..2c9ce6813fba 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVX_SVDOBJ_HXX -#define INCLUDED_SVX_SVDOBJ_HXX +#pragma once #include <memory> #include <com/sun/star/uno/Any.hxx> @@ -1047,6 +1046,4 @@ template< typename T > T* SdrObject::CloneHelper(SdrModel& rTargetModel) const return pObj; } -#endif // INCLUDED_SVX_SVDOBJ_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 87c19ba0f7f4fa5ed43cdf7cf86d932626825b9b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Oct 17 18:31:47 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:26 2020 +0900 svx: organize forward declarations in svdobj.hxx Change-Id: I256212175f66b5d0599df990675e7344505b7841 diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index bd528c9fe4cb..32afa65a2994 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -76,6 +76,7 @@ class SdrLayerIDSet; class Fraction; enum class PointerStyle; class Graphic; +class SvxShape; namespace basegfx { @@ -84,31 +85,13 @@ namespace basegfx class B2DHomMatrix; } -namespace sdr -{ - namespace properties - { - class BaseProperties; - } +namespace sdr { class ObjectUser; } +namespace sdr::properties { class BaseProperties; } +namespace sdr::contact { class ViewContact; } - class ObjectUser; -} +namespace svx { class PropertyChangeNotifier; } -namespace sdr -{ - namespace contact - { - class ViewContact; - } // end of namespace contact -} - -namespace svx -{ - class PropertyChangeNotifier; -} -class SvxShape; -class SdrObject; struct SVXCORE_DLLPUBLIC SdrObjectFreeOp; // helper for constructing std::unique_ptr for SdrObjects where a commit b12cb6303d1e2b70e8a6f1c482c6af3373912caa Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jul 17 15:09:49 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:26 2020 +0900 Revert "hack for gradients split into adjacent polygons (tdf#133016)" This reverts commit 777ac5456a1f24fea29931ede983b5b8ad9a063d. diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 7c9eb8441306..9b9d258046cc 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -30,7 +30,7 @@ #include <drawinglayer/geometry/viewinformation2d.hxx> #include <sal/log.hxx> #include <cmath> -#include <vcl/skia/SkiaHelper.hxx> + using namespace com::sun::star; @@ -868,12 +868,6 @@ namespace drawinglayer::primitive2d // use color distance and discrete lengths to calculate step count const sal_uInt32 nSteps(calculateStepsForSvgGradient(getColorA(), getColorB(), fDelta, fDiscreteUnit)); - // HACK: Splitting a gradient into adjacent polygons with gradually changing color is silly. - // If antialiasing is used to draw them, the AA-ed adjacent edges won't line up perfectly - // because of the AA (see SkiaSalGraphicsImpl::mergePolyPolygonToPrevious()). - // Make the polygons a bit wider, so they the partial overlap "fixes" this. - const double fixup = SkiaHelper::isVCLSkiaEnabled() ? fDiscreteUnit / 2 : 0; - // tdf#117949 Use a small amount of discrete overlap at the edges. Usually this // should be exactly 0.0 and 1.0, but there were cases when this gets clipped // against the mask polygon which got numerically problematic. @@ -887,7 +881,7 @@ namespace drawinglayer::primitive2d basegfx::B2DRange( getOffsetA() - fDiscreteUnit, -0.0001, // TTTT -> should be 0.0, see comment above - getOffsetA() + (fDelta / nSteps) + fDiscreteUnit + fixup, + getOffsetA() + (fDelta / nSteps) + fDiscreteUnit, 1.0001))); // TTTT -> should be 1.0, see comment above // prepare loop (inside to outside, [0.0 .. 1.0[) commit 4e472b7b9b97afc64eceb44b0ab8a33a735cbf46 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 15 19:39:35 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:25 2020 +0900 vcl: add a Bitmap interface to basegfx, BitmapEx implementing it Change-Id: I758f421d545191883e615f5016e9fc643459556e diff --git a/include/basegfx/bitmap/Bitmap.hxx b/include/basegfx/bitmap/Bitmap.hxx new file mode 100644 index 000000000000..b91b702aa212 --- /dev/null +++ b/include/basegfx/bitmap/Bitmap.hxx @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <basegfx/basegfxdllapi.h> + +namespace basegfx +{ +class BASEGFX_DLLPUBLIC IBitmap +{ +}; + +} // end of namespace basegfx + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index dc9f8a837502..cb7d8c2df583 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -26,6 +26,8 @@ #include <tools/color.hxx> #include <tools/degree.hxx> +#include <basegfx/bitmap/Bitmap.hxx> + #include <sal/types.h> namespace com::sun::star::rendering { @@ -41,7 +43,7 @@ enum class TransparentType Bitmap }; -class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx +class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx : basegfx::IBitmap { public: commit f856ac2abd055a673164dd2608a75c92dc6dc6d9 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed May 27 12:49:05 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:25 2020 +0900 add o3tl version of hash_combine to not depend on boost for this Change-Id: I081f8d116ef811baa8aa5de35a6cb51fa4de7d56 diff --git a/include/o3tl/hash_combine.hxx b/include/o3tl/hash_combine.hxx new file mode 100644 index 000000000000..17419b3e2c0f --- /dev/null +++ b/include/o3tl/hash_combine.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +namespace o3tl +{ +template <typename T, typename N, std::enable_if_t<(sizeof(N) == 4), bool> = false> +inline void hash_combine(N& nSeed, T const& nValue) +{ + static_assert(sizeof(nSeed) == 4); + nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2); +} + +template <typename T, typename N, std::enable_if_t<(sizeof(N) == 8), bool> = false> +inline void hash_combine(N& nSeed, T const& nValue) +{ + static_assert(sizeof(nSeed) == 8); + nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx index ba9ee71835ce..ef46f44d17b9 100644 --- a/o3tl/qa/test-lru_map.cxx +++ b/o3tl/qa/test-lru_map.cxx @@ -15,7 +15,7 @@ #include <o3tl/lru_map.hxx> -#include <boost/functional/hash.hpp> +#include <o3tl/hash_combine.hxx> using namespace ::o3tl; @@ -202,8 +202,8 @@ struct TestClassKeyHashFunction std::size_t operator()(TestClassKey const& aKey) const { std::size_t seed = 0; - boost::hash_combine(seed, aKey.mA); - boost::hash_combine(seed, aKey.mB); + o3tl::hash_combine(seed, aKey.mA); + o3tl::hash_combine(seed, aKey.mB); return seed; } }; commit 5951210483f07ab1d2a2bad3355c7cc192e53ae7 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue May 26 15:57:38 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:24 2020 +0900 GraphicAttributes: put const. and op. '=' into the header file Change-Id: I1bc38f89457c3593673b445e7571a4fd82d5960b diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx index 559e3f9fc36c..df937b898d3d 100644 --- a/include/vcl/GraphicAttributes.hxx +++ b/include/vcl/GraphicAttributes.hxx @@ -52,9 +52,37 @@ private: GraphicDrawMode meDrawMode; public: - GraphicAttr(); + GraphicAttr() + : mfGamma(1.0) + , mnMirrFlags(basegfx::MirrorDirectionFlags::NONE) + , mnLeftCrop(0) + , mnTopCrop(0) + , mnRightCrop(0) + , mnBottomCrop(0) + , mnRotate10(0) + , mnContPercent(0) + , mnLumPercent(0) + , mnRPercent(0) + , mnGPercent(0) + , mnBPercent(0) + , mbInvert(false) + , mcTransparency(0) + , meDrawMode(GraphicDrawMode::Standard) + { + } + + bool operator==(const GraphicAttr& rAttr) const + { + return mfGamma == rAttr.mfGamma && mnMirrFlags == rAttr.mnMirrFlags + && mnLeftCrop == rAttr.mnLeftCrop && mnTopCrop == rAttr.mnTopCrop + && mnRightCrop == rAttr.mnRightCrop && mnBottomCrop == rAttr.mnBottomCrop + && mnRotate10 == rAttr.mnRotate10 && mnContPercent == rAttr.mnContPercent + && mnLumPercent == rAttr.mnLumPercent && mnRPercent == rAttr.mnRPercent + && mnGPercent == rAttr.mnGPercent && mnBPercent == rAttr.mnBPercent + && mbInvert == rAttr.mbInvert && mcTransparency == rAttr.mcTransparency + && meDrawMode == rAttr.meDrawMode; + } - bool operator==(const GraphicAttr& rAttr) const; bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); } void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; } diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 6b7ef7cd9a2f..bb44d3a1c3c0 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -329,7 +329,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/graphic/GraphicObject \ vcl/source/graphic/GraphicObject2 \ vcl/source/graphic/GraphicReader \ - vcl/source/graphic/grfattr \ vcl/source/graphic/Manager \ vcl/source/graphic/UnoGraphic \ vcl/source/graphic/UnoGraphicMapper \ diff --git a/vcl/source/graphic/grfattr.cxx b/vcl/source/graphic/grfattr.cxx deleted file mode 100644 index 36e8605b77de..000000000000 --- a/vcl/source/graphic/grfattr.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vcl/GraphicAttributes.hxx> - -GraphicAttr::GraphicAttr() : - mfGamma ( 1.0 ), - mnMirrFlags ( basegfx::MirrorDirectionFlags::NONE ), - mnLeftCrop ( 0 ), - mnTopCrop ( 0 ), - mnRightCrop ( 0 ), - mnBottomCrop ( 0 ), - mnRotate10 ( 0 ), - mnContPercent ( 0 ), - mnLumPercent ( 0 ), - mnRPercent ( 0 ), - mnGPercent ( 0 ), - mnBPercent ( 0 ), - mbInvert ( false ), - mcTransparency ( 0 ), - meDrawMode ( GraphicDrawMode::Standard ) -{ -} - -bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const -{ - return( ( mfGamma == rAttr.mfGamma ) && - ( mnMirrFlags == rAttr.mnMirrFlags ) && - ( mnLeftCrop == rAttr.mnLeftCrop ) && - ( mnTopCrop == rAttr.mnTopCrop ) && - ( mnRightCrop == rAttr.mnRightCrop ) && - ( mnBottomCrop == rAttr.mnBottomCrop ) && - ( mnRotate10 == rAttr.mnRotate10 ) && - ( mnContPercent == rAttr.mnContPercent ) && - ( mnLumPercent == rAttr.mnLumPercent ) && - ( mnRPercent == rAttr.mnRPercent ) && - ( mnGPercent == rAttr.mnGPercent ) && - ( mnBPercent == rAttr.mnBPercent ) && - ( mbInvert == rAttr.mbInvert ) && - ( mcTransparency == rAttr.mcTransparency ) && - ( meDrawMode == rAttr.meDrawMode ) ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 944a0bbb2d519d4bbe940a1e150e7e9e63b5afbb Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue May 26 13:39:45 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Nov 23 10:53:23 2020 +0900 basegfx::MirrorDirectionFlags as replacement for BmpMirrorFlags BmpMirrorFlags in Bitmap is an attribute for bitmap manipulation (mirroring). This change creates a copy of the flags in basegfx as MirrorDirectionFlags, which will be used in the fututre as a general repalcement for the BmpMirrorFlags, that will be changed step by step. For now we only use the flags in GraphicAttr to make it independent form vcl, and cast to/from BmpMirrorFLags and MirrorDirectionFlags where needed. Change-Id: I01a69a4d241caa22cff61bdbf87944af57684749 diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 9de4b8a80e64..8f801700ccf4 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -49,8 +49,10 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, if (getGraphicAttr().IsMirrored()) { // content needs mirroring - const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Horizontal); - const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Vertical); + const bool bHMirr(getGraphicAttr().GetMirrorFlags() + & basegfx::MirrorDirectionFlags::Horizontal); + const bool bVMirr(getGraphicAttr().GetMirrorFlags() + & basegfx::MirrorDirectionFlags::Vertical); // mirror by applying negative scale to the unit primitive and // applying the object transformation on it. @@ -69,7 +71,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); aSuppressGraphicAttr.SetRotation(Degree10(0)); - aSuppressGraphicAttr.SetMirrorFlags(BmpMirrorFlags::NONE); + aSuppressGraphicAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags::NONE); aSuppressGraphicAttr.SetTransparency(0); const GraphicObject& rGraphicObject = getGraphicObject(); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 505e43d91fc1..d5a5b63dc83e 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1674,7 +1674,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans if(bMirrored) { - pGraphicAttr->SetMirrorFlags(BmpMirrorFlags::Horizontal); + pGraphicAttr->SetMirrorFlags(basegfx::MirrorDirectionFlags::Horizontal); } if(nTransparency) diff --git a/include/basegfx/bitmap/BitmapAttributes.hxx b/include/basegfx/bitmap/BitmapAttributes.hxx new file mode 100644 index 000000000000..d918d55faa99 --- /dev/null +++ b/include/basegfx/bitmap/BitmapAttributes.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <basegfx/basegfxdllapi.h> +#include <o3tl/typed_flags_set.hxx> + +namespace basegfx +{ +enum class MirrorDirectionFlags +{ + NONE = 0x00, + Horizontal = 0x01, + Vertical = 0x02, +}; + +} // end of namespace basegfx + +namespace o3tl +{ +template <> +struct typed_flags<basegfx::MirrorDirectionFlags> + : is_typed_flags<basegfx::MirrorDirectionFlags, 0x03> +{ +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits