diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-14 08:39:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-15 08:35:10 +0000 |
commit | 8ccbc16b5e3f94b8db105232d7085a8553e6bc03 (patch) | |
tree | 85b8affc4e3916a21c6b303c90dc0f080d464bbf /include | |
parent | 7fafd1aea08ad036ef48f415db5df93df218bf6e (diff) |
convert SvxFrameDirection to scoped enum
Based on the casts in chart2/source/view/main/ChartView.cxx
and the similarity of naming of values, I conclude that this
enum was intended to abstract over css::text::WritingMode2.
Added a comment to that effect.
Change-Id: I3af8bbe8b6ac8c4a9375f6ccde145b98b9c69a57
Reviewed-on: https://gerrit.libreoffice.org/35164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/frmdir.hxx | 21 | ||||
-rw-r--r-- | include/editeng/frmdiritem.hxx | 15 | ||||
-rw-r--r-- | include/svx/pagectrl.hxx | 6 |
3 files changed, 22 insertions, 20 deletions
diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx index 4af2a077ee1a..85f60b30da2a 100644 --- a/include/editeng/frmdir.hxx +++ b/include/editeng/frmdir.hxx @@ -20,28 +20,35 @@ #ifndef INCLUDED_EDITENG_FRMDIR_HXX #define INCLUDED_EDITENG_FRMDIR_HXX +#include <com/sun/star/text/WritingMode2.hpp> -/** Defines possible text directions in frames. */ -enum SvxFrameDirection +/** + * Defines possible text directions in frames. + * A scoped enum over the constants in css::text:WritingMode2. + */ +enum class SvxFrameDirection { + /** used as an error return value in SW */ + Unknown = -1, + /** Horizontal, from left to right, from top to bottom (typical for western languages). */ - FRMDIR_HORI_LEFT_TOP, + Horizontal_LR_TB = css::text::WritingMode2::LR_TB, /** Horizontal, from right to left, from top to bottom (typical for arabic/hebrew languages). */ - FRMDIR_HORI_RIGHT_TOP, + Horizontal_RL_TB = css::text::WritingMode2::RL_TB, /** Vertical, from top to bottom, from right to left (typical for asian languages). */ - FRMDIR_VERT_TOP_RIGHT, + Vertical_RL_TB = css::text::WritingMode2::TB_RL, /** Vertical, from top to bottom, from left to right (typical for mongol language). */ - FRMDIR_VERT_TOP_LEFT, + Vertical_LR_TB = css::text::WritingMode2::TB_LR, /** Use the value from the environment, can only be used in frames. */ - FRMDIR_ENVIRONMENT + Environment = css::text::WritingMode2::CONTEXT }; diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx index 949b151d5a62..4e3018848722 100644 --- a/include/editeng/frmdiritem.hxx +++ b/include/editeng/frmdiritem.hxx @@ -23,11 +23,7 @@ #include <editeng/frmdir.hxx> #include <editeng/editengdllapi.h> -// class SvxFrameDirectionItem ---------------------------------------------- - -/* [Description] - - This item defines a frame direction, which place the content inside +/* This item defines a frame direction, which place the content inside a frame. It exist different kind of directions which are used to the layout text for Western, CJK and CTL languages. */ @@ -35,16 +31,15 @@ class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxEnumItem<SvxFrameDirection> { public: - SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/, - sal_uInt16 nWhich ); + SvxFrameDirectionItem( SvxFrameDirection nValue, sal_uInt16 nWhich ); virtual ~SvxFrameDirectionItem() override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool operator==( const SfxPoolItem& ) const override; - virtual bool GetPresentation( SfxItemPresentation ePres, + virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, @@ -55,7 +50,7 @@ public: virtual sal_uInt16 GetValueCount() const override { - return FRMDIR_ENVIRONMENT + 1; + return (sal_uInt16)SvxFrameDirection::Environment + 1; } SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem ) { diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx index 25b6bb54fe29..64123cf0be8a 100644 --- a/include/svx/pagectrl.hxx +++ b/include/svx/pagectrl.hxx @@ -25,6 +25,7 @@ class SvxBoxItem; enum class SvxPageUsage; +enum class SvxFrameDirection; class SVX_DLLPUBLIC SvxPageWindow : public vcl::Window { @@ -42,7 +43,7 @@ private: SvxBoxItem* pBorder; bool bResetBackground; bool bFrameDirection; - sal_Int32 nFrameDirection; + SvxFrameDirection nFrameDirection; long nHdLeft; long nHdRight; @@ -151,8 +152,7 @@ public: void SetVert( bool bNew ) { bVert = bNew; } void EnableFrameDirection(bool bEnable); - //uses enum SvxFrameDirection - void SetFrameDirection(sal_Int32 nDirection); + void SetFrameDirection(SvxFrameDirection nDirection); void ResetBackground(); |