summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-17 13:07:12 +0200
committerNoel Grandin <noel@peralex.com>2015-04-22 10:28:39 +0200
commit442f3b5d77a0b1dd0c8c31d82a205623f3850253 (patch)
treee67db8a6966aa6c4160068112bc6a0eeab203d8e
parented54799117078181eed664c478671f7566871fe5 (diff)
convert FILECTRL_ constant to scoped enum
Change-Id: I171dc1702cc1851962b22072ea62d73ac142504e
-rw-r--r--include/svtools/filectrl.hxx14
-rw-r--r--svtools/source/control/filectrl.cxx4
2 files changed, 12 insertions, 6 deletions
diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx
index 04e6e0a2819c..eb9872b1e65e 100644
--- a/include/svtools/filectrl.hxx
+++ b/include/svtools/filectrl.hxx
@@ -29,9 +29,15 @@
#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
// Flags for FileControl
-typedef sal_uInt16 FileControlMode;
-#define FILECTRL_RESIZEBUTTONBYPATHLEN ((sal_uInt16)0x0001)//if this is set, the button will become small as soon as the Text in the Edit Field is to long to be shown completely
-
+enum class FileControlMode
+{
+ NONE = 0x00,
+ RESIZEBUTTONBYPATHLEN = 0x01, //if this is set, the button will become small as soon as the Text in the Edit Field is to long to be shown completely
+};
+namespace o3tl
+{
+ template<> struct typed_flags<FileControlMode> : is_typed_flags<FileControlMode, 0x01> {};
+}
// Flags for internal use of FileControl
typedef sal_uInt16 FileControlMode_Internal;
@@ -64,7 +70,7 @@ protected:
DECL_DLLPRIVATE_LINK( ButtonHdl, void* );
public:
- FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = 0 );
+ FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = FileControlMode::NONE );
virtual ~FileControl();
Edit& GetEdit() { return maEdit; }
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index 5f938cb002b2..e99e6a9c8f5a 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -93,7 +93,7 @@ FileControl::~FileControl()
void FileControl::SetText( const OUString& rStr )
{
maEdit.SetText( rStr );
- if ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN )
+ if ( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN )
Resize();
}
@@ -158,7 +158,7 @@ void FileControl::Resize()
long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
if ( ((mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT) == 0) ||
( nButtonTextWidth < aOutSz.Width()/3 &&
- ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN
+ ( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN
? ( maEdit.GetTextWidth( maEdit.GetText() )
<= aOutSz.Width() - nButtonTextWidth - ButtonBorder )
: sal_True ) )