diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-18 13:36:39 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-20 09:52:08 +0200 |
commit | 25a47c5cd54c73e754de988bde8ec8a202d27717 (patch) | |
tree | 479c07ba52f718f03770fba60121d2a0ef3a3b08 /include | |
parent | 7a0af37989d1f1b508a61f28e785c5b1f27d58af (diff) |
convert TEXT_DRAW constants to scoped enum
Change-Id: Ic0f7f8fa236bb478b3598ae3fd3c1b30ebbf1a01
Diffstat (limited to 'include')
-rw-r--r-- | include/drawinglayer/primitive2d/textlayoutdevice.hxx | 4 | ||||
-rw-r--r-- | include/vcl/button.hxx | 6 | ||||
-rw-r--r-- | include/vcl/ctrl.hxx | 2 | ||||
-rw-r--r-- | include/vcl/fixed.hxx | 2 | ||||
-rw-r--r-- | include/vcl/metaact.hxx | 9 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 67 | ||||
-rw-r--r-- | include/vcl/pdfwriter.hxx | 19 |
7 files changed, 59 insertions, 50 deletions
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx b/include/drawinglayer/primitive2d/textlayoutdevice.hxx index 024e7b45d950..de23883b8494 100644 --- a/include/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -36,7 +36,7 @@ namespace rtl { }; class OutputDevice; class GDIMetaFile; - +enum class DrawTextFlags; namespace drawinglayer { namespace attribute { class FontAttribute; }} @@ -102,7 +102,7 @@ namespace drawinglayer void addTextRectActions( const Rectangle& rRectangle, const rtl::OUString& rText, - sal_uInt16 nStyle, + DrawTextFlags nStyle, GDIMetaFile& rGDIMetaFile) const; ::std::vector< double > getTextArray( diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index f8bfddfecc7f..6c79094ee6ef 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -49,10 +49,10 @@ private: public: SAL_DLLPRIVATE DrawButtonFlags ImplGetButtonState() const; SAL_DLLPRIVATE DrawButtonFlags& ImplGetButtonState(); - SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags ); + SAL_DLLPRIVATE DrawTextFlags ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags ); SAL_DLLPRIVATE void ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, Size& rSize, bool bLayout, sal_uLong nImageSep, sal_uLong nDrawFlags, - sal_uInt16 nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); + DrawTextFlags nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect ); SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const; SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); @@ -130,7 +130,7 @@ protected: const Rectangle& rRect, bool bLayout, bool bMenuBtnSep); SAL_DLLPRIVATE void ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLayout = false); using Button::ImplGetTextStyle; - SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( sal_uLong nDrawFlags ) const; + SAL_DLLPRIVATE DrawTextFlags ImplGetTextStyle( sal_uLong nDrawFlags ) const; SAL_DLLPRIVATE bool IsSymbol() const { return ( (meSymbol != SymbolType::DONTKNOW) && (meSymbol != SymbolType::IMAGE) ); } SAL_DLLPRIVATE bool IsImage() const { return Button::HasImage(); } diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx index ee5b8845efc6..6741a229dd4d 100644 --- a/include/vcl/ctrl.hxx +++ b/include/vcl/ctrl.hxx @@ -88,7 +88,7 @@ protected: directly at the target device, or taking the reference device into account) when returning. */ void DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, - const OUString& _rStr, sal_uInt16 _nStyle, + const OUString& _rStr, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const; virtual const vcl::Font& diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 3f9e13485028..15e838bdd4f7 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -48,7 +48,7 @@ private: SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; public: - SAL_DLLPRIVATE static sal_uInt16 ImplGetTextStyle( WinBits nWinBits ); + SAL_DLLPRIVATE static DrawTextFlags ImplGetTextStyle( WinBits nWinBits ); protected: virtual void FillLayoutData() const SAL_OVERRIDE; virtual const vcl::Font& diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 9885498c3075..18e73033b7b3 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -38,6 +38,7 @@ #include <vcl/outdevstate.hxx> class SvStream; +enum class DrawTextFlags; struct ImplMetaReadData { @@ -546,7 +547,7 @@ private: Rectangle maRect; OUString maStr; - sal_uInt16 mnStyle; + DrawTextFlags mnStyle; virtual bool Compare( const MetaAction& ) const SAL_OVERRIDE; @@ -561,14 +562,14 @@ public: virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ) SAL_OVERRIDE; MetaTextRectAction( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle ); + const OUString& rStr, DrawTextFlags nStyle ); virtual void Move( long nHorzMove, long nVertMove ) SAL_OVERRIDE; virtual void Scale( double fScaleX, double fScaleY ) SAL_OVERRIDE; const Rectangle& GetRect() const { return maRect; } - const OUString& GetText() const { return maStr; } - sal_uInt16 GetStyle() const { return mnStyle; } + const OUString& GetText() const { return maStr; } + DrawTextFlags GetStyle() const { return mnStyle; } }; class VCL_DLLPUBLIC MetaTextLineAction : public MetaAction diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index da18ee8993f9..728ce4278ee5 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -158,26 +158,33 @@ typedef std::vector< Rectangle > MetricVector; // OutputDevice-Types // Flags for DrawText() -#define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001) -#define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002) -#define TEXT_DRAW_MONO ((sal_uInt16)0x0004) -#define TEXT_DRAW_CLIP ((sal_uInt16)0x0008) -#define TEXT_DRAW_LEFT ((sal_uInt16)0x0010) -#define TEXT_DRAW_CENTER ((sal_uInt16)0x0020) -#define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040) -#define TEXT_DRAW_TOP ((sal_uInt16)0x0080) -#define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100) -#define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200) -#define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400) -#define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800) -#define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000) -#define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000) -#define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000) -// in the long run we should make text style flags longer -// but at the moment we can get away with this 2 bit field for ellipsis style -#define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS) - -#define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK) +enum class DrawTextFlags +{ + NONE = 0x0000, + Disable = 0x0001, + Mnemonic = 0x0002, + Mono = 0x0004, + Clip = 0x0008, + Left = 0x0010, + Center = 0x0020, + Right = 0x0040, + Top = 0x0080, + VCenter = 0x0100, + Bottom = 0x0200, + EndEllipsis = 0x0400, + PathEllipsis = 0x0800, + MultiLine = 0x1000, + WordBreak = 0x2000, + NewsEllipsis = 0x4000, + // in the long run we should make text style flags longer + // but at the moment we can get away with this 2 bit field for ellipsis style + CenterEllipsis = EndEllipsis | PathEllipsis, + WordBreakHyphenation = 0x8000 | WordBreak, +}; +namespace o3tl +{ + template<> struct typed_flags<DrawTextFlags> : is_typed_flags<DrawTextFlags, 0xffff> {}; +} // Flags for CopyArea() #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001) @@ -945,12 +952,12 @@ public: MetricVector* pVector = NULL, OUString* pDisplayText = NULL ); void DrawText( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle = 0, + const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::NONE, MetricVector* pVector = NULL, OUString* pDisplayText = NULL, vcl::ITextLayout* _pTextLayout = NULL ); static void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, - const OUString& rOrigStr, sal_uInt16 nStyle, + const OUString& rOrigStr, DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout ); void ImplDrawText( SalLayout& ); @@ -959,7 +966,7 @@ public: void DrawCtrlText( const Point& rPos, const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1, - sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL ); + DrawTextFlags nStyle = DrawTextFlags::Mnemonic, MetricVector* pVector = NULL, OUString* pDisplayText = NULL ); void DrawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, @@ -979,7 +986,7 @@ public: bool ImplDrawRotateText( SalLayout& ); Rectangle GetTextRect( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK, + const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak, TextRectInfo* pInfo = NULL, const vcl::ITextLayout* _pTextLayout = NULL ) const; @@ -1055,11 +1062,11 @@ public: OUString GetEllipsisString( const OUString& rStr, long nMaxWidth, - sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const; + DrawTextFlags nStyle = DrawTextFlags::EndEllipsis ) const; long GetCtrlTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1, - sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const; + DrawTextFlags nStyle = DrawTextFlags::Mnemonic ) const; static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos ); @@ -1075,8 +1082,8 @@ public: DrawText(). */ void AddTextRectActions( const Rectangle& rRect, - const OUString& rOrigStr, - sal_uInt16 nStyle, + const OUString& rOrigStr, + DrawTextFlags nStyle, GDIMetaFile& rMtf ); void SetTextColor( const Color& rColor ); @@ -1164,7 +1171,7 @@ private: SAL_DLLPRIVATE static bool ImplIsUnderlineAbove( const vcl::Font& ); static - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const vcl::ITextLayout& _rLayout ); + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ); ///@} @@ -1265,7 +1272,7 @@ private: static SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr, - long nMaxWidth, sal_uInt16 nStyle, const vcl::ITextLayout& _rLayout ); + long nMaxWidth, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const tools::PolyPolygon& rPolyPoly, bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& ); diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index d8c64c483963..05679575d125 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -29,6 +29,7 @@ #include <vcl/font.hxx> #include <vcl/graphictools.hxx> #include <vcl/outdevstate.hxx> +#include <vcl/outdev.hxx> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> @@ -225,10 +226,10 @@ public: protected: WidgetType Type; // primitive RTTI public: - OUString Name; // a distinct name to identify the control - OUString Description;// descriptive text for the contro (e.g. for tool tip) - OUString Text; // user text to appear on the control - sal_uInt16 TextStyle; // style flags + OUString Name; // a distinct name to identify the control + OUString Description;// descriptive text for the contro (e.g. for tool tip) + OUString Text; // user text to appear on the control + DrawTextFlags TextStyle; // style flags bool ReadOnly; Rectangle Location; // describes the area filled by the control bool Border; // true: widget should have a border, false: no border @@ -242,9 +243,9 @@ public: /* style flags for text are those for OutputDevice::DrawText allowed values are: - TEXT_DRAW_LEFT, TEXT_DRAW_CENTER, TEXT_DRAW_RIGHT, TEXT_DRAW_TOP, - TEXT_DRAW_VCENTER, TEXT_DRAW_BOTTOM, - TEXT_DRAW_MULTILINE, TEXT_DRAW_WORDBREAK + DrawTextFlags::Left, DrawTextFlags::Center, DrawTextFlags::Right, DrawTextFlags::Top, + DrawTextFlags::VCenter, DrawTextFlags::Bottom, + DrawTextFlags::MultiLine, DrawTextFlags::WordBreak if TextStyle is 0, then each control will fill in default values */ @@ -257,7 +258,7 @@ public: AnyWidget( WidgetType eType ) : Type( eType ), - TextStyle( 0 ), + TextStyle( DrawTextFlags::NONE ), ReadOnly( false ), Border( false ), BorderColor( COL_TRANSPARENT ), @@ -779,7 +780,7 @@ The following structure describes the permissions used in PDF security const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen ); void DrawText( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle = 0 ); + const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::NONE ); void DrawPixel( const Point& rPt, const Color& rColor ); void DrawPixel( const Point& rPt ) |