diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-17 13:53:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-22 10:28:40 +0200 |
commit | 2d1c78e5335dee23f2ace23c7a90b56be201cd3d (patch) | |
tree | 63f9c98fb8ffb588f93a97ba2ca37c471cb18685 | |
parent | 442f3b5d77a0b1dd0c8c31d82a205623f3850253 (diff) |
convert FILECTRL_ constants to scoped enum
Change-Id: I973265c13f43a7f073bdb53e854f25a84d341b68
-rw-r--r-- | include/svtools/filectrl.hxx | 12 | ||||
-rw-r--r-- | svtools/source/control/filectrl.cxx | 10 |
2 files changed, 14 insertions, 8 deletions
diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx index eb9872b1e65e..53486c0e4d35 100644 --- a/include/svtools/filectrl.hxx +++ b/include/svtools/filectrl.hxx @@ -40,9 +40,15 @@ namespace o3tl } // Flags for internal use of FileControl -typedef sal_uInt16 FileControlMode_Internal; -#define FILECTRL_INRESIZE ((sal_uInt16)0x0001) -#define FILECTRL_ORIGINALBUTTONTEXT ((sal_uInt16)0x0002) +enum class FileControlMode_Internal +{ + INRESIZE = 0x0001, + ORIGINALBUTTONTEXT = 0x0002, +}; +namespace o3tl +{ + template<> struct typed_flags<FileControlMode_Internal> : is_typed_flags<FileControlMode_Internal, 0x03> {}; +} class SVT_DLLPUBLIC FileControl : public vcl::Window diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index e99e6a9c8f5a..83eeb542f6ad 100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -40,7 +40,7 @@ FileControl::FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ), maButtonText( SVT_RESSTR(STR_FILECTRL_BUTTONTEXT) ), mnFlags( nFlags ), - mnInternalFlags( FILECTRL_ORIGINALBUTTONTEXT ) + mnInternalFlags( FileControlMode_Internal::ORIGINALBUTTONTEXT ) { maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) ); mbOpenDlg = true; @@ -150,13 +150,13 @@ void FileControl::Resize() { static long ButtonBorder = 10; - if( mnInternalFlags & FILECTRL_INRESIZE ) + if( mnInternalFlags & FileControlMode_Internal::INRESIZE ) return; - mnInternalFlags |= FILECTRL_INRESIZE;//InResize = sal_True + mnInternalFlags |= FileControlMode_Internal::INRESIZE;//InResize = sal_True Size aOutSz = GetOutputSizePixel(); long nButtonTextWidth = maButton.GetTextWidth( maButtonText ); - if ( ((mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT) == 0) || + if ( !(mnInternalFlags & FileControlMode_Internal::ORIGINALBUTTONTEXT) || ( nButtonTextWidth < aOutSz.Width()/3 && ( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN ? ( maEdit.GetTextWidth( maEdit.GetText() ) @@ -177,7 +177,7 @@ void FileControl::Resize() maEdit.setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() ); maButton.setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() ); - mnInternalFlags &= ~FILECTRL_INRESIZE; //InResize = sal_False + mnInternalFlags &= ~FileControlMode_Internal::INRESIZE; //InResize = sal_False } |