summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-01-08 14:57:27 +0200
committerNoel Grandin <noel@peralex.com>2015-01-09 10:05:29 +0200
commitcd9e2ecba38c31eb30e05d3ee2c9f4629dd89d40 (patch)
treee52ccc812e8b8bdef327b660a0157ec645069567
parent078fd7446e1681b671b58d7fcbbce8d2a9b05132 (diff)
fdo#84938: replace SYSTEMWINDOW_MODE constants with 'enum class'
Change-Id: I1c761482cb78efc26d3beda75381557268e1bc0d
-rw-r--r--desktop/source/app/app.cxx6
-rw-r--r--include/vcl/svapp.hxx23
-rw-r--r--sfx2/source/appl/childwin.cxx6
-rw-r--r--vcl/inc/svdata.hxx2
-rw-r--r--vcl/source/app/svapp.cxx4
-rw-r--r--vcl/source/app/svmain.cxx4
-rw-r--r--vcl/source/window/dialog.cxx6
7 files changed, 29 insertions, 22 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index d861111bfd58..2118fccf1bb6 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1207,8 +1207,8 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError)
// protect against recursive calls
static bool bInException = false;
- sal_uInt16 nOldMode = Application::GetSystemWindowMode();
- Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
+ SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
Application::SetDefDialogParent( NULL );
if ( bInException )
@@ -1576,7 +1576,7 @@ int Desktop::Main()
SetSplashScreenProgress(75);
// use system window dialogs
- Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
+ Application::SetSystemWindowMode( SystemWindowFlags::DIALOG );
SetSplashScreenProgress(80);
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 105f0caf2b44..8ef0812a433d 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -39,6 +39,7 @@
#include <vcl/vclevent.hxx>
#include <vcl/metric.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <o3tl/typed_flags_set.hxx>
class BitmapEx;
class Link;
@@ -84,12 +85,18 @@ namespace awt {
VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
-#define SYSTEMWINDOW_MODE_NOAUTOMODE ((sal_uInt16)0x0001)
-#define SYSTEMWINDOW_MODE_DIALOG ((sal_uInt16)0x0002)
+enum class SystemWindowFlags {
+ NOAUTOMODE = 0x0001,
+ DIALOG = 0x0002
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SystemWindowFlags> : is_typed_flags<SystemWindowFlags, 0x03> {};
+}
typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
-/** An application can be notified of a number of different events:
+ /** An application can be notified of a number of different events:
- TYPE_ACCEPT - listen for connection to the application (a connection
string is passed via the event)
- TYPE_UNACCEPT - stops listening for a connection to the app (determined by
@@ -1287,20 +1294,20 @@ public:
/** Make a dialog box a system window or not.
- @param nMode Can be either: SYSTEMWINDOW_MODE_NOAUTOMODE (0x0001) or
- SYSTEMWINDOW_MODE_DIALOG (0x0002)
+ @param nMode Can be either: SystemWindowFlags::NOAUTOMODE (0x0001) or
+ SystemWindowFlags::DIALOG (0x0002)
@see GetSystemWindowMode
*/
- static void SetSystemWindowMode( sal_uInt16 nMode );
+ static void SetSystemWindowMode( SystemWindowFlags nMode );
/** Get the system window mode of dialogs.
- @returns SYSTEMWINDOW_MODE_NOAUTOMODE (0x0001) or SYSTEMWINDOW_MODE_DIALOG (0x0002)
+ @returns SystemWindowFlags::NOAUTOMODE (0x0001) or SystemWindowFlags::DIALOG (0x0002)
@see SetSystemWindowMode
*/
- static sal_uInt16 GetSystemWindowMode();
+ static SystemWindowFlags GetSystemWindowMode();
/** Set a dialog scaling factor. Used for localization.
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index ea502805cd58..1e870c8a571b 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -209,7 +209,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
{
SfxChildWindow *pChild=0;
SfxChildWinFactory* pFact=0;
- sal_uInt16 nOldMode = Application::GetSystemWindowMode();
+ SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
// First search for ChildWindow in SDT; Overlay windows are realized
// by using ChildWindowContext
@@ -227,7 +227,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
if ( pBindings )
pBindings->ENTERREGISTRATIONS();
SfxChildWinInfo aInfo = rFactInfo;
- Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_NOAUTOMODE );
+ Application::SetSystemWindowMode( SystemWindowFlags::NOAUTOMODE );
pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo );
Application::SetSystemWindowMode( nOldMode );
if ( pBindings )
@@ -258,7 +258,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
if ( pBindings )
pBindings->ENTERREGISTRATIONS();
SfxChildWinInfo aInfo = rFactInfo;
- Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_NOAUTOMODE );
+ Application::SetSystemWindowMode( SystemWindowFlags::NOAUTOMODE );
pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo );
Application::SetSystemWindowMode( nOldMode );
if ( pBindings )
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index ddac1042a3a0..dd76b8578e95 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -129,7 +129,7 @@ struct ImplSVAppData
sal_uInt16 mnModalMode; // ModalMode Count
sal_uInt16 mnModalDialog; // ModalDialog Count
sal_uInt16 mnAccessCount; // AccessHdl Count
- sal_uInt16 mnSysWinMode; // Mode, when SystemWindows should be created
+ SystemWindowFlags mnSysWinMode; // Mode, when SystemWindows should be created
short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs
bool mbInAppMain; // is Application::Main() on stack
bool mbInAppExecute; // is Application::Execute() on stack
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 0d27e76887cd..e67b0c6356e6 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1352,12 +1352,12 @@ bool Application::IsDialogCancelEnabled()
return ImplGetSVData()->maAppData.meDialogCancel != DIALOG_CANCEL_OFF;
}
-void Application::SetSystemWindowMode( sal_uInt16 nMode )
+void Application::SetSystemWindowMode( SystemWindowFlags nMode )
{
ImplGetSVData()->maAppData.mnSysWinMode = nMode;
}
-sal_uInt16 Application::GetSystemWindowMode()
+SystemWindowFlags Application::GetSystemWindowMode()
{
return ImplGetSVData()->maAppData.mnSysWinMode;
}
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 7636738abbc6..8ae359276b23 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -130,8 +130,8 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->mpApp )
{
- sal_uInt16 nOldMode = Application::GetSystemWindowMode();
- Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
+ SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
pSVData->mpApp->Exception( nVCLException );
Application::SetSystemWindowMode( nOldMode );
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 6848c298dc16..33cdbf65efb5 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -359,7 +359,7 @@ void Dialog::ImplInitDialogData()
void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
- sal_uInt16 nSysWinMode = Application::GetSystemWindowMode();
+ SystemWindowFlags nSysWinMode = Application::GetSystemWindowMode();
if ( !(nStyle & WB_NODIALOGCONTROL) )
nStyle |= WB_DIALOGCONTROL;
@@ -401,8 +401,8 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
pParent = NULL;
if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
- (pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SYSTEMWINDOW_MODE_NOAUTOMODE)) ||
- (nSysWinMode & SYSTEMWINDOW_MODE_DIALOG) )
+ (pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SystemWindowFlags::NOAUTOMODE)) ||
+ (nSysWinMode & SystemWindowFlags::DIALOG) )
{
// create window with a small border ?
if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )