diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-20 07:27:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-21 08:13:05 +0200 |
commit | 0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch) | |
tree | 908983b02f466e0a49599edc70aaa1baaa240371 /include | |
parent | b84afd2188d6993c91081885dc24664bd3f1cc73 (diff) |
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase,
but also to make it obvious which units are being used
for angle values.
Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/charrotateitem.hxx | 16 | ||||
-rw-r--r-- | include/editeng/editeng.hxx | 5 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 2 | ||||
-rw-r--r-- | include/o3tl/strong_int.hxx | 5 | ||||
-rw-r--r-- | include/svl/imageitm.hxx | 15 | ||||
-rw-r--r-- | include/svx/xgrad.hxx | 9 | ||||
-rw-r--r-- | include/svx/xhatch.hxx | 9 | ||||
-rw-r--r-- | include/tools/degree.hxx | 18 | ||||
-rw-r--r-- | include/tools/gen.hxx | 5 | ||||
-rw-r--r-- | include/tools/poly.hxx | 5 | ||||
-rw-r--r-- | include/vcl/GraphicAttributes.hxx | 9 | ||||
-rw-r--r-- | include/vcl/GraphicNativeMetadata.hxx | 7 | ||||
-rw-r--r-- | include/vcl/GraphicNativeTransform.hxx | 9 | ||||
-rw-r--r-- | include/vcl/bitmap.hxx | 3 | ||||
-rw-r--r-- | include/vcl/bitmapex.hxx | 3 | ||||
-rw-r--r-- | include/vcl/cursor.hxx | 4 | ||||
-rw-r--r-- | include/vcl/font.hxx | 5 | ||||
-rw-r--r-- | include/vcl/gdimtf.hxx | 2 | ||||
-rw-r--r-- | include/vcl/gradient.hxx | 5 | ||||
-rw-r--r-- | include/vcl/hatch.hxx | 9 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 6 | ||||
-rw-r--r-- | include/vcl/toolbox.hxx | 5 | ||||
-rw-r--r-- | include/vcl/vcllayout.hxx | 5 |
23 files changed, 104 insertions, 57 deletions
diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx index 0ce60bb1a05b..093c84224fe5 100644 --- a/include/editeng/charrotateitem.hxx +++ b/include/editeng/charrotateitem.hxx @@ -20,6 +20,7 @@ #define INCLUDED_EDITENG_CHARROTATEITEM_HXX #include <svl/intitem.hxx> +#include <tools/degree.hxx> #include <editeng/editengdllapi.h> // class SvxTextRotateItem ---------------------------------------------- @@ -34,7 +35,7 @@ class EDITENG_DLLPUBLIC SvxTextRotateItem : public SfxUInt16Item { public: - SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nId); + SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nId); virtual SvxTextRotateItem* Clone(SfxItemPool *pPool = nullptr) const override; @@ -47,11 +48,14 @@ public: virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + Degree10 GetValue() const { return Degree10(SfxUInt16Item::GetValue()); } + void SetValue(Degree10 val) { SfxUInt16Item::SetValue(val.get()); } + // our currently only degree values - void SetTopToBottom() { SetValue(2700); } - void SetBottomToTop() { SetValue(900); } - bool IsTopToBottom() const { return 2700 == GetValue(); } - bool IsBottomToTop() const { return 900 == GetValue(); } + void SetTopToBottom() { SetValue(Degree10(2700)); } + void SetBottomToTop() { SetValue(Degree10(900)); } + bool IsTopToBottom() const { return Degree10(2700) == GetValue(); } + bool IsBottomToTop() const { return Degree10(900) == GetValue(); } bool IsVertical() const { return IsTopToBottom() || IsBottomToTop(); } void dumpAsXml(xmlTextWriterPtr pWriter) const override; @@ -75,7 +79,7 @@ class EDITENG_DLLPUBLIC SvxCharRotateItem final : public SvxTextRotateItem public: static SfxPoolItem* CreateDefault(); - SvxCharRotateItem( sal_uInt16 nValue /*= 0*/, + SvxCharRotateItem( Degree10 nValue /*= 0*/, bool bFitIntoLine /*= false*/, const sal_uInt16 nId ); diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 3f896f09a23c..871acf2f43b5 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -37,6 +37,7 @@ #include <i18nlangtag/lang.h> #include <tools/lineend.hxx> +#include <tools/degree.hxx> #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> @@ -373,7 +374,7 @@ public: void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect ); void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos ); void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); - void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); + void Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation = Degree10(0) ); ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); void Write( SvStream& rOutput, EETextFormat ); @@ -480,7 +481,7 @@ public: void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); - virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ); virtual void ParagraphInserted( sal_Int32 nNewParagraph ); virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ); virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 083cee135e99..3ea2fd9b2631 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -635,7 +635,7 @@ protected: void InvalidateBullet(sal_Int32 nPara); void PaintBullet( sal_Int32 nPara, const Point& rStartPos, - const Point& rOrigin, short nOrientation, + const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ); // used by OutlinerEditEng. Allows Outliner objects to provide diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index 006a36c8900f..3db958212229 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -112,6 +112,11 @@ public: strong_int operator--(int) { UNDERLYING_TYPE nOldValue = m_value; --m_value; return strong_int(nOldValue); } strong_int& operator+=(strong_int const & other) { m_value += other.m_value; return *this; } strong_int& operator-=(strong_int const & other) { m_value -= other.m_value; return *this; } + strong_int& operator%=(strong_int const & other) { m_value %= other.m_value; return *this; } + [[nodiscard]] + strong_int operator%(strong_int const & other) const { return strong_int(m_value % other.m_value); } + [[nodiscard]] + strong_int operator-() const { return strong_int(-m_value); } bool anyOf(strong_int v) const { return *this == v; diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx index c135216cc482..2340230fb4a4 100644 --- a/include/svl/imageitm.hxx +++ b/include/svl/imageitm.hxx @@ -23,11 +23,11 @@ #include <svl/svldllapi.h> #include <svl/intitem.hxx> #include <memory> +#include <tools/degree.hxx> struct SfxImageItem_Impl; class SVL_DLLPUBLIC SfxImageItem final : public SfxInt16Item { - std::unique_ptr<SfxImageItem_Impl> pImpl; public: static SfxPoolItem* CreateDefault(); SfxImageItem( sal_uInt16 nWhich = 0 ); @@ -39,10 +39,15 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - void SetRotation( tools::Long nValue ); - tools::Long GetRotation() const; - void SetMirrored( bool bSet ); - bool IsMirrored() const; + void SetRotation( Degree10 nValue ) { mnAngle = nValue; } + Degree10 GetRotation() const { return mnAngle; } + void SetMirrored( bool bSet ) { mbMirrored = bSet; } + bool IsMirrored() const { return mbMirrored; } + +private: + OUString maURL; + Degree10 mnAngle; + bool mbMirrored; }; #endif // _SFX_IMAGEITM_HXX diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx index f8ef9dbe9f98..6e372ec2dbfb 100644 --- a/include/svx/xgrad.hxx +++ b/include/svx/xgrad.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_XGRAD_HXX #include <tools/color.hxx> +#include <tools/degree.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/awt/GradientStyle.hpp> #include <boost/property_tree/ptree_fwd.hpp> @@ -32,7 +33,7 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC XGradient final css::awt::GradientStyle eStyle; Color aStartColor; Color aEndColor; - long nAngle; + Degree10 nAngle; sal_uInt16 nBorder; sal_uInt16 nOfsX; sal_uInt16 nOfsY; @@ -45,7 +46,7 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC XGradient final public: XGradient(); XGradient( const Color& rStart, const Color& rEnd, - css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, long nAngle = 0, + css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, Degree10 nAngle = Degree10(0), sal_uInt16 nXOfs = 50, sal_uInt16 nYOfs = 50, sal_uInt16 nBorder = 0, sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100, sal_uInt16 nSteps = 0 ); @@ -55,7 +56,7 @@ public: void SetGradientStyle(css::awt::GradientStyle eNewStyle) { eStyle = eNewStyle; } void SetStartColor(const Color& rColor) { aStartColor = rColor; } void SetEndColor(const Color& rColor) { aEndColor = rColor; } - void SetAngle(long nNewAngle) { nAngle = nNewAngle; } + void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; } void SetBorder(sal_uInt16 nNewBorder) { nBorder = nNewBorder; } void SetXOffset(sal_uInt16 nNewOffset) { nOfsX = nNewOffset; } void SetYOffset(sal_uInt16 nNewOffset) { nOfsY = nNewOffset; } @@ -66,7 +67,7 @@ public: css::awt::GradientStyle GetGradientStyle() const { return eStyle; } const Color& GetStartColor() const { return aStartColor; } const Color& GetEndColor() const { return aEndColor; } - long GetAngle() const { return nAngle; } + Degree10 GetAngle() const { return nAngle; } sal_uInt16 GetBorder() const { return nBorder; } sal_uInt16 GetXOffset() const { return nOfsX; } sal_uInt16 GetYOffset() const { return nOfsY; } diff --git a/include/svx/xhatch.hxx b/include/svx/xhatch.hxx index 79b5f624e338..0ef791c64caf 100644 --- a/include/svx/xhatch.hxx +++ b/include/svx/xhatch.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_XHATCH_HXX #include <tools/color.hxx> +#include <tools/degree.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/drawing/HatchStyle.hpp> @@ -32,24 +33,24 @@ class SVXCORE_DLLPUBLIC XHatch final css::drawing::HatchStyle eStyle; Color aColor; long nDistance; - long nAngle; + Degree10 nAngle; public: XHatch() : eStyle(css::drawing::HatchStyle_SINGLE), nDistance(0), nAngle(0) {} XHatch(const Color& rCol, css::drawing::HatchStyle eStyle = css::drawing::HatchStyle_SINGLE, - long nDistance = 20, long nAngle = 0); + long nDistance = 20, Degree10 nAngle = Degree10(0)); bool operator==(const XHatch& rHatch) const; void SetHatchStyle(css::drawing::HatchStyle eNewStyle) { eStyle = eNewStyle; } void SetColor(const Color& rColor) { aColor = rColor; } void SetDistance(long nNewDistance) { nDistance = nNewDistance; } - void SetAngle(long nNewAngle) { nAngle = nNewAngle; } + void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; } css::drawing::HatchStyle GetHatchStyle() const { return eStyle; } const Color& GetColor() const { return aColor; } long GetDistance() const { return nDistance; } - long GetAngle() const { return nAngle; } + Degree10 GetAngle() const { return nAngle; } }; #endif diff --git a/include/tools/degree.hxx b/include/tools/degree.hxx new file mode 100644 index 000000000000..7151abccb228 --- /dev/null +++ b/include/tools/degree.hxx @@ -0,0 +1,18 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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 <sal/types.h> +#include <o3tl/strong_int.hxx> + +/** tenths of a Degree, normally rotation */ + +typedef o3tl::strong_int<sal_Int16, struct Degree10Tag> Degree10; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index b357d2198de1..1198b8dbaab4 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -22,6 +22,7 @@ #include <tools/toolsdllapi.h> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <limits.h> #include <algorithm> #include <ostream> @@ -83,8 +84,8 @@ public: tools::Long AdjustX( tools::Long nHorzMove ) { nA += nHorzMove; return nA; } tools::Long AdjustY( tools::Long nVertMove ) { nB += nVertMove; return nB; } - void RotateAround( tools::Long& rX, tools::Long& rY, short nOrientation ) const; - void RotateAround( Point&, short nOrientation ) const; + void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const; + void RotateAround( Point&, Degree10 nOrientation ) const; Point& operator += ( const Point& rPoint ); Point& operator -= ( const Point& rPoint ); diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index d9f39fb080f4..de03619eaf31 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -21,6 +21,7 @@ #include <tools/toolsdllapi.h> #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/cow_wrapper.hxx> @@ -145,7 +146,7 @@ public: void Translate( const Point& rTrans ); void Scale( double fScaleX, double fScaleY ); void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); + void Rotate( const Point& rCenter, Degree10 nAngle10 ); void Insert( sal_uInt16 nPos, const Point& rPt ); void Insert( sal_uInt16 nPos, const tools::Polygon& rPoly ); @@ -236,7 +237,7 @@ public: void Translate( const Point& rTrans ); void Scale( double fScaleX, double fScaleY ); void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); + void Rotate( const Point& rCenter, Degree10 nAngle10 ); const tools::Polygon& operator[]( sal_uInt16 nPos ) const { return GetObject( nPos ); } tools::Polygon& operator[]( sal_uInt16 nPos ); diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx index a26f59edc890..5216d2934166 100644 --- a/include/vcl/GraphicAttributes.hxx +++ b/include/vcl/GraphicAttributes.hxx @@ -19,6 +19,7 @@ #pragma once +#include <tools/degree.hxx> #include <vcl/dllapi.h> #include <vcl/bitmap.hxx> @@ -39,7 +40,7 @@ private: tools::Long mnTopCrop; tools::Long mnRightCrop; tools::Long mnBottomCrop; - sal_uInt16 mnRotate10; + Degree10 mnRotate10; short mnContPercent; short mnLumPercent; short mnRPercent; @@ -74,8 +75,8 @@ public: tools::Long GetRightCrop() const { return mnRightCrop; } tools::Long GetBottomCrop() const { return mnBottomCrop; } - void SetRotation(sal_uInt16 nRotate10) { mnRotate10 = nRotate10; } - sal_uInt16 GetRotation() const { return mnRotate10; } + void SetRotation(Degree10 nRotate10) { mnRotate10 = nRotate10; } + Degree10 GetRotation() const { return mnRotate10; } void SetLuminance(short nLuminancePercent) { mnLumPercent = nLuminancePercent; } short GetLuminance() const { return mnLumPercent; } @@ -107,7 +108,7 @@ public: { return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0); } - bool IsRotated() const { return ((mnRotate10 % 3600) != 0); } + bool IsRotated() const { return ((mnRotate10 % Degree10(3600)) != Degree10(0)); } bool IsTransparent() const { return (mcTransparency > 0); } bool IsAdjusted() const { diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx index 3dbd7ff8a7d2..7cc8b663f18a 100644 --- a/include/vcl/GraphicNativeMetadata.hxx +++ b/include/vcl/GraphicNativeMetadata.hxx @@ -21,10 +21,11 @@ #include <vcl/graph.hxx> #include <tools/stream.hxx> +#include <tools/degree.hxx> class VCL_DLLPUBLIC GraphicNativeMetadata final { - sal_uInt16 mRotation; + Degree10 mRotation; public: GraphicNativeMetadata(); @@ -33,8 +34,8 @@ public: bool read(Graphic const& rGraphic); bool read(SvStream& rStream); - // counter-clock-wise rotation in permille - sal_uInt16 getRotation() const { return mRotation; } + // counter-clock-wise rotation 10ths of a degree + Degree10 getRotation() const { return mRotation; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx index b4d71f2d53d0..3b05ac323232 100644 --- a/include/vcl/GraphicNativeTransform.hxx +++ b/include/vcl/GraphicNativeTransform.hxx @@ -20,6 +20,7 @@ #pragma once #include <rtl/ustring.hxx> +#include <tools/degree.hxx> #include <sal/types.h> #include <vcl/dllapi.h> @@ -29,15 +30,15 @@ class VCL_DLLPUBLIC GraphicNativeTransform final { Graphic& mrGraphic; - bool rotateBitmapOnly(sal_uInt16 aRotation); - void rotateJPEG(sal_uInt16 aRotation); - bool rotateGeneric(sal_uInt16 aRotation, const OUString& aType); + bool rotateBitmapOnly(Degree10 aRotation); + void rotateJPEG(Degree10 aRotation); + bool rotateGeneric(Degree10 aRotation, const OUString& aType); public: GraphicNativeTransform(Graphic& rGraphic); ~GraphicNativeTransform(); - void rotate(sal_uInt16 aRotation); + void rotate(Degree10 aRotation); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 932bab285784..74d3a2e11724 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_BITMAP_HXX #include <tools/solar.h> +#include <tools/degree.hxx> #include <vcl/checksum.hxx> #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> @@ -349,7 +350,7 @@ public: @return true, if the operation was completed successfully. */ - bool Rotate( tools::Long nAngle10, const Color& rFillColor ); + bool Rotate( Degree10 nAngle10, const Color& rFillColor ); /** Create on-off mask from bitmap diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 7c9eb69383c1..dc9f8a837502 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -24,6 +24,7 @@ #include <vcl/alpha.hxx> #include <vcl/Scanline.hxx> #include <tools/color.hxx> +#include <tools/degree.hxx> #include <sal/types.h> @@ -233,7 +234,7 @@ public: @return true, if the operation was completed successfully. */ bool Rotate( - tools::Long nAngle10, + Degree10 nAngle10, const Color& rFillColor ); /** Replace all pixel having the search color with the specified color diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx index 3937c0e48c4e..ff66326d90b9 100644 --- a/include/vcl/cursor.hxx +++ b/include/vcl/cursor.hxx @@ -50,7 +50,7 @@ private: VclPtr<vcl::Window> mpWindow; // only for shadow cursor Size maSize; Point maPos; - short mnOrientation; + Degree10 mnOrientation; sal_uInt16 mnStyle; bool mbVisible; CursorDirection mnDirection; @@ -87,7 +87,7 @@ public: tools::Long GetWidth() const { return maSize.Width(); } tools::Long GetHeight() const { return maSize.Height(); } - void SetOrientation( short nOrientation = 0 ); + void SetOrientation( Degree10 nOrientation = Degree10(0) ); void SetDirection( CursorDirection nDirection = CursorDirection::NONE ); diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 02f4a6d3f264..2d437c5b3da0 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -26,6 +26,7 @@ #include <tools/color.hxx> #include <tools/fontenum.hxx> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <i18nlangtag/lang.h> #include <vcl/fntstyle.hxx> #include <o3tl/cow_wrapper.hxx> @@ -122,8 +123,8 @@ public: void SetCJKContextLanguage( LanguageType ); LanguageType GetCJKContextLanguage() const; - void SetOrientation( short nLineOrientation ); - short GetOrientation() const; + void SetOrientation( Degree10 nLineOrientation ); + Degree10 GetOrientation() const; void SetVertical( bool bVertical ); bool IsVertical() const; void SetKerning( FontKerning nKerning ); diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index bb20b618719a..202480faa818 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -116,7 +116,7 @@ public: void Move( tools::Long nX, tools::Long nY, tools::Long nDPIX, tools::Long nDPIY ); void Scale( double fScaleX, double fScaleY ); void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); - void Rotate( tools::Long nAngle10 ); + void Rotate( Degree10 nAngle10 ); void Clip( const tools::Rectangle& ); bool HasTransparentActions() const; diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx index aee89e06b50e..f2336d797703 100644 --- a/include/vcl/gradient.hxx +++ b/include/vcl/gradient.hxx @@ -23,6 +23,7 @@ #include <sal/types.h> #include <vcl/dllapi.h> #include <tools/color.hxx> +#include <tools/degree.hxx> #include <vcl/vclenum.hxx> #include <o3tl/cow_wrapper.hxx> @@ -56,8 +57,8 @@ public: void SetEndColor( const Color& rColor ); const Color& GetEndColor() const; - void SetAngle( sal_uInt16 nAngle ); - sal_uInt16 GetAngle() const; + void SetAngle( Degree10 nAngle ); + Degree10 GetAngle() const; void SetBorder( sal_uInt16 nBorder ); sal_uInt16 GetBorder() const; diff --git a/include/vcl/hatch.hxx b/include/vcl/hatch.hxx index 92afd57b6126..713f22b95dd1 100644 --- a/include/vcl/hatch.hxx +++ b/include/vcl/hatch.hxx @@ -22,6 +22,7 @@ #include <tools/color.hxx> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <vcl/dllapi.h> #include <vcl/vclenum.hxx> @@ -35,7 +36,7 @@ struct ImplHatch Color maColor; HatchStyle meStyle; tools::Long mnDistance; - sal_uInt16 mnAngle; + Degree10 mnAngle; ImplHatch(); @@ -48,7 +49,7 @@ public: Hatch(); Hatch( const Hatch& rHatch ); - Hatch( HatchStyle eStyle, const Color& rHatchColor, tools::Long nDistance, sal_uInt16 nAngle10 ); + Hatch( HatchStyle eStyle, const Color& rHatchColor, tools::Long nDistance, Degree10 nAngle10 ); ~Hatch(); Hatch& operator=( const Hatch& rHatch ); @@ -63,8 +64,8 @@ public: void SetDistance( tools::Long nDistance ); tools::Long GetDistance() const { return mpImplHatch->mnDistance; } - void SetAngle( sal_uInt16 nAngle10 ); - sal_uInt16 GetAngle() const { return mpImplHatch->mnAngle; } + void SetAngle( Degree10 nAngle10 ); + Degree10 GetAngle() const { return mpImplHatch->mnAngle; } friend SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch ); friend SvStream& WriteHatch( SvStream& rOStm, const Hatch& rHatch ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e1f6b17c47a0..60664ce3de02 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -959,7 +959,7 @@ public: private: - SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ); + SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ); SAL_DLLPRIVATE void DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf ); ///@} @@ -1207,9 +1207,9 @@ private: SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ); - SAL_DLLPRIVATE static void ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev, + SAL_DLLPRIVATE static void ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, Degree10 nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev, bool bDrawPixAsRect, tools::Long nPixWidth, tools::Long nPixHeight ); - SAL_DLLPRIVATE void ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nStartX, tools::Long nStartY, tools::Long nWidth, tools::Long nHeight, tools::Long nLineWidth, short nOrientation, const Color& rColor ); + SAL_DLLPRIVATE void ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nStartX, tools::Long nStartY, tools::Long nWidth, tools::Long nHeight, tools::Long nLineWidth, Degree10 nOrientation, const Color& rColor ); SAL_DLLPRIVATE void ImplDrawWaveTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); SAL_DLLPRIVATE void ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); SAL_DLLPRIVATE void ImplDrawStrikeoutLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontStrikeout eStrikeout, Color aColor ); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 8a5b9d2f502b..8546e3870418 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -26,6 +26,7 @@ #include <vcl/image.hxx> #include <vcl/keycod.hxx> #include <o3tl/typed_flags_set.hxx> +#include <tools/degree.hxx> #include <limits> #include <memory> @@ -114,7 +115,7 @@ private: tools::Long mnBottomBorder; tools::Long mnLastResizeDY; tools::Long mnActivateCount; - tools::Long mnImagesRotationAngle; + Degree10 mnImagesRotationAngle; sal_uInt16 mnLastFocusItemId; sal_uInt16 mnOutStyle; sal_uInt16 mnHighItemId; @@ -369,7 +370,7 @@ public: void* GetItemData( sal_uInt16 nItemId ) const; void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; - void SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 ); + void SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 ); void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ); void SetItemText( sal_uInt16 nItemId, const OUString& rText ); const OUString& GetItemText( sal_uInt16 nItemId ) const; diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index ea8da12b7a9d..7d53d12bd40b 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -22,6 +22,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <vcl/devicecoordinate.hxx> #include <vcl/dllapi.h> @@ -78,7 +79,7 @@ public: virtual void DrawText( SalGraphics& ) const = 0; int GetUnitsPerPixel() const { return mnUnitsPerPixel; } - int GetOrientation() const { return mnOrientation; } + Degree10 GetOrientation() const { return mnOrientation; } // methods using string indexing virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0; @@ -108,7 +109,7 @@ protected: int mnEndCharPos; int mnUnitsPerPixel; - int mnOrientation; + Degree10 mnOrientation; mutable Point maDrawOffset; Point maDrawBase; |