fdo#84938: replace SYSTEMWINDOW_MODE constants with 'enum class'

Change-Id: I1c761482cb78efc26d3beda75381557268e1bc0d
This commit is contained in:
Noel Grandin
2015-01-08 14:57:27 +02:00
parent 078fd7446e
commit cd9e2ecba3
7 changed files with 29 additions and 22 deletions

View File

@@ -1207,8 +1207,8 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError)
// protect against recursive calls // protect against recursive calls
static bool bInException = false; static bool bInException = false;
sal_uInt16 nOldMode = Application::GetSystemWindowMode(); SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE ); Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
Application::SetDefDialogParent( NULL ); Application::SetDefDialogParent( NULL );
if ( bInException ) if ( bInException )
@@ -1576,7 +1576,7 @@ int Desktop::Main()
SetSplashScreenProgress(75); SetSplashScreenProgress(75);
// use system window dialogs // use system window dialogs
Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG ); Application::SetSystemWindowMode( SystemWindowFlags::DIALOG );
SetSplashScreenProgress(80); SetSplashScreenProgress(80);

View File

@@ -39,6 +39,7 @@
#include <vcl/vclevent.hxx> #include <vcl/vclevent.hxx>
#include <vcl/metric.hxx> #include <vcl/metric.hxx>
#include <unotools/localedatawrapper.hxx> #include <unotools/localedatawrapper.hxx>
#include <o3tl/typed_flags_set.hxx>
class BitmapEx; class BitmapEx;
class Link; class Link;
@@ -84,12 +85,18 @@ namespace awt {
VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType ); VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
#define SYSTEMWINDOW_MODE_NOAUTOMODE ((sal_uInt16)0x0001) enum class SystemWindowFlags {
#define SYSTEMWINDOW_MODE_DIALOG ((sal_uInt16)0x0002) NOAUTOMODE = 0x0001,
DIALOG = 0x0002
};
namespace o3tl
{
template<> struct typed_flags<SystemWindowFlags> : is_typed_flags<SystemWindowFlags, 0x03> {};
}
typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData ); 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 - TYPE_ACCEPT - listen for connection to the application (a connection
string is passed via the event) string is passed via the event)
- TYPE_UNACCEPT - stops listening for a connection to the app (determined by - 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. /** Make a dialog box a system window or not.
@param nMode Can be either: SYSTEMWINDOW_MODE_NOAUTOMODE (0x0001) or @param nMode Can be either: SystemWindowFlags::NOAUTOMODE (0x0001) or
SYSTEMWINDOW_MODE_DIALOG (0x0002) SystemWindowFlags::DIALOG (0x0002)
@see GetSystemWindowMode @see GetSystemWindowMode
*/ */
static void SetSystemWindowMode( sal_uInt16 nMode ); static void SetSystemWindowMode( SystemWindowFlags nMode );
/** Get the system window mode of dialogs. /** 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 @see SetSystemWindowMode
*/ */
static sal_uInt16 GetSystemWindowMode(); static SystemWindowFlags GetSystemWindowMode();
/** Set a dialog scaling factor. Used for localization. /** Set a dialog scaling factor. Used for localization.

View File

@@ -209,7 +209,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
{ {
SfxChildWindow *pChild=0; SfxChildWindow *pChild=0;
SfxChildWinFactory* pFact=0; SfxChildWinFactory* pFact=0;
sal_uInt16 nOldMode = Application::GetSystemWindowMode(); SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
// First search for ChildWindow in SDT; Overlay windows are realized // First search for ChildWindow in SDT; Overlay windows are realized
// by using ChildWindowContext // by using ChildWindowContext
@@ -227,7 +227,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
if ( pBindings ) if ( pBindings )
pBindings->ENTERREGISTRATIONS(); pBindings->ENTERREGISTRATIONS();
SfxChildWinInfo aInfo = rFactInfo; SfxChildWinInfo aInfo = rFactInfo;
Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_NOAUTOMODE ); Application::SetSystemWindowMode( SystemWindowFlags::NOAUTOMODE );
pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo ); pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo );
Application::SetSystemWindowMode( nOldMode ); Application::SetSystemWindowMode( nOldMode );
if ( pBindings ) if ( pBindings )
@@ -258,7 +258,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
if ( pBindings ) if ( pBindings )
pBindings->ENTERREGISTRATIONS(); pBindings->ENTERREGISTRATIONS();
SfxChildWinInfo aInfo = rFactInfo; SfxChildWinInfo aInfo = rFactInfo;
Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_NOAUTOMODE ); Application::SetSystemWindowMode( SystemWindowFlags::NOAUTOMODE );
pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo ); pChild = pFact->pCtor( pParent, nId, pBindings, &aInfo );
Application::SetSystemWindowMode( nOldMode ); Application::SetSystemWindowMode( nOldMode );
if ( pBindings ) if ( pBindings )

View File

@@ -129,7 +129,7 @@ struct ImplSVAppData
sal_uInt16 mnModalMode; // ModalMode Count sal_uInt16 mnModalMode; // ModalMode Count
sal_uInt16 mnModalDialog; // ModalDialog Count sal_uInt16 mnModalDialog; // ModalDialog Count
sal_uInt16 mnAccessCount; // AccessHdl 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 short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs
bool mbInAppMain; // is Application::Main() on stack bool mbInAppMain; // is Application::Main() on stack
bool mbInAppExecute; // is Application::Execute() on stack bool mbInAppExecute; // is Application::Execute() on stack

View File

@@ -1352,12 +1352,12 @@ bool Application::IsDialogCancelEnabled()
return ImplGetSVData()->maAppData.meDialogCancel != DIALOG_CANCEL_OFF; return ImplGetSVData()->maAppData.meDialogCancel != DIALOG_CANCEL_OFF;
} }
void Application::SetSystemWindowMode( sal_uInt16 nMode ) void Application::SetSystemWindowMode( SystemWindowFlags nMode )
{ {
ImplGetSVData()->maAppData.mnSysWinMode = nMode; ImplGetSVData()->maAppData.mnSysWinMode = nMode;
} }
sal_uInt16 Application::GetSystemWindowMode() SystemWindowFlags Application::GetSystemWindowMode()
{ {
return ImplGetSVData()->maAppData.mnSysWinMode; return ImplGetSVData()->maAppData.mnSysWinMode;
} }

View File

@@ -130,8 +130,8 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->mpApp ) if ( pSVData->mpApp )
{ {
sal_uInt16 nOldMode = Application::GetSystemWindowMode(); SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE ); Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
pSVData->mpApp->Exception( nVCLException ); pSVData->mpApp->Exception( nVCLException );
Application::SetSystemWindowMode( nOldMode ); Application::SetSystemWindowMode( nOldMode );
} }

View File

@@ -359,7 +359,7 @@ void Dialog::ImplInitDialogData()
void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle ) void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
sal_uInt16 nSysWinMode = Application::GetSystemWindowMode(); SystemWindowFlags nSysWinMode = Application::GetSystemWindowMode();
if ( !(nStyle & WB_NODIALOGCONTROL) ) if ( !(nStyle & WB_NODIALOGCONTROL) )
nStyle |= WB_DIALOGCONTROL; nStyle |= WB_DIALOGCONTROL;
@@ -401,8 +401,8 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
pParent = NULL; pParent = NULL;
if ( !pParent || (nStyle & WB_SYSTEMWINDOW) || if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
(pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SYSTEMWINDOW_MODE_NOAUTOMODE)) || (pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SystemWindowFlags::NOAUTOMODE)) ||
(nSysWinMode & SYSTEMWINDOW_MODE_DIALOG) ) (nSysWinMode & SystemWindowFlags::DIALOG) )
{ {
// create window with a small border ? // create window with a small border ?
if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER ) if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )