diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-05-29 13:25:05 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-30 06:41:15 +0000 |
commit | 8ac4240efe975e9689e8dfc23dc3c1b88eee6dcf (patch) | |
tree | 0ec90ad5e02bd191e7e36c3f862d10a7ff4c559a | |
parent | 12aafb69fab3c7f91aa727ace19c1df7c53edd64 (diff) |
Convert ApplicationEvent::Type to scoped enum
Change-Id: Ie65951d5fd1e155e3d3b36d4725792fb95fb9a52
Reviewed-on: https://gerrit.libreoffice.org/25608
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | desktop/source/app/app.cxx | 22 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 14 | ||||
-rw-r--r-- | include/vcl/svapp.hxx | 78 | ||||
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 4 | ||||
-rw-r--r-- | vcl/osx/salmenu.cxx | 2 | ||||
-rw-r--r-- | vcl/osx/vclnsapp.mm | 10 |
6 files changed, 65 insertions, 65 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 90254147089d..38101efaf6b1 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2285,12 +2285,12 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) { switch ( rAppEvent.GetEvent() ) { - case ApplicationEvent::TYPE_ACCEPT: + case ApplicationEvent::Type::Accept: // every time an accept parameter is used we create an acceptor // with the corresponding accept-string createAcceptor(rAppEvent.GetStringData()); break; - case ApplicationEvent::TYPE_APPEAR: + case ApplicationEvent::Type::Appear: if ( !GetCommandLineArgs().IsInvisible() ) { Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); @@ -2336,13 +2336,13 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) } } break; - case ApplicationEvent::TYPE_HELP: + case ApplicationEvent::Type::Help: displayCmdlineHelp(rAppEvent.GetStringData()); break; - case ApplicationEvent::TYPE_VERSION: + case ApplicationEvent::Type::Version: displayVersion(); break; - case ApplicationEvent::TYPE_OPEN: + case ApplicationEvent::Type::Open: { const CommandLineArgs& rCmdLine = GetCommandLineArgs(); if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) @@ -2355,11 +2355,11 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) } } break; - case ApplicationEvent::TYPE_OPENHELPURL: + case ApplicationEvent::Type::OpenHelpUrl: // start help for a specific URL Application::GetHelp()->Start(rAppEvent.GetStringData(), nullptr); break; - case ApplicationEvent::TYPE_PRINT: + case ApplicationEvent::Type::Print: { const CommandLineArgs& rCmdLine = GetCommandLineArgs(); if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) @@ -2372,7 +2372,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) } } break; - case ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN: + case ApplicationEvent::Type::PrivateDoShutdown: { Desktop* pD = dynamic_cast<Desktop*>(GetpApp()); OSL_ENSURE( pD, "no desktop ?!?" ); @@ -2380,7 +2380,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) pD->doShutdown(); } break; - case ApplicationEvent::TYPE_QUICKSTART: + case ApplicationEvent::Type::QuickStart: if ( !GetCommandLineArgs().IsInvisible() ) { // If the office has been started the second time its command line arguments are sent through a pipe @@ -2392,7 +2392,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) css::office::Quickstart::createStart(xContext, true/*Quickstart*/); } break; - case ApplicationEvent::TYPE_SHOWDIALOG: + case ApplicationEvent::Type::ShowDialog: // ignore all errors here. It's clicking a menu entry only ... // The user will try it again, in case nothing happens .-) try @@ -2419,7 +2419,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) catch(const css::uno::Exception&) {} break; - case ApplicationEvent::TYPE_UNACCEPT: + case ApplicationEvent::Type::Unaccept: // try to remove corresponding acceptor destroyAcceptor(rAppEvent.GetStringData()); break; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index c067a92555b9..31635e85cd74 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -959,13 +959,13 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { if ( !aUnknown.isEmpty() || aCmdLineArgs->IsHelp() ) { ApplicationEvent* pAppEvent = - new ApplicationEvent(ApplicationEvent::TYPE_HELP, aUnknown); + new ApplicationEvent(ApplicationEvent::Type::Help, aUnknown); ImplPostForeignAppEvent( pAppEvent ); } else if ( aCmdLineArgs->IsVersion() ) { ApplicationEvent* pAppEvent = - new ApplicationEvent(ApplicationEvent::TYPE_VERSION); + new ApplicationEvent(ApplicationEvent::Type::Version); ImplPostForeignAppEvent( pAppEvent ); } else @@ -976,7 +976,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { { // we have to use application event, because we have to start quickstart service in main thread!! ApplicationEvent* pAppEvent = - new ApplicationEvent(ApplicationEvent::TYPE_QUICKSTART); + new ApplicationEvent(ApplicationEvent::Type::QuickStart); ImplPostForeignAppEvent( pAppEvent ); } @@ -986,7 +986,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { i != accept.end(); ++i) { ApplicationEvent* pAppEvent = new ApplicationEvent( - ApplicationEvent::TYPE_ACCEPT, *i); + ApplicationEvent::Type::Accept, *i); ImplPostForeignAppEvent( pAppEvent ); } // handle acceptor removal @@ -995,7 +995,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { i != unaccept.end(); ++i) { ApplicationEvent* pAppEvent = new ApplicationEvent( - ApplicationEvent::TYPE_UNACCEPT, *i); + ApplicationEvent::Type::Unaccept, *i); ImplPostForeignAppEvent( pAppEvent ); } @@ -1096,7 +1096,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { aHelpURLBuffer.appendAscii("&System=WIN"); #endif ApplicationEvent* pAppEvent = new ApplicationEvent( - ApplicationEvent::TYPE_OPENHELPURL, + ApplicationEvent::Type::OpenHelpUrl, aHelpURLBuffer.makeStringAndClear()); ImplPostForeignAppEvent( pAppEvent ); } @@ -1133,7 +1133,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { { // no document was sent, just bring Office to front ApplicationEvent* pAppEvent = - new ApplicationEvent(ApplicationEvent::TYPE_APPEAR); + new ApplicationEvent(ApplicationEvent::Type::Appear); ImplPostForeignAppEvent( pAppEvent ); } } diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index ae1141862526..4367890e15b1 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -98,79 +98,79 @@ namespace o3tl typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData ); /** 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) - - TYPE_UNACCEPT - stops listening for a connection to the app (determined by + - Type::Unaccept - stops listening for a connection to the app (determined by a connection string passed via the event) - - TYPE_APPEAR - brings the app to the front (i.e. makes it "appear") - - TYPE_VERSION - display the app version - - TYPE_HELP - opens a help topic (help topic passed as string) - - TYPE_OPENHELP_URL - opens a help URL (URL passed as a string) - - TYPE_SHOWDIALOG - shows a dialog (dialog passed as a string) - - TYPE_OPEN - opens a document or group of documents (documents passed + - Type::Appear - brings the app to the front (i.e. makes it "appear") + - Type::Version - display the app version + - Type::Help - opens a help topic (help topic passed as string) + - Type::OpenHELP_URL - opens a help URL (URL passed as a string) + - Type::ShowDialog - shows a dialog (dialog passed as a string) + - Type::Open - opens a document or group of documents (documents passed as an array of strings) - - TYPE_PRINT - print a document or group of documents (documents passed + - Type::Print - print a document or group of documents (documents passed as an array of strings - - TYPE_PRIVATE_DOSHUTDOWN - shutdown the app + - Type::PrivateDoShutdown - shutdown the app */ class VCL_DLLPUBLIC ApplicationEvent { public: - enum Type { - TYPE_ACCEPT, ///< Listen for connections - TYPE_APPEAR, ///< Make application appear - TYPE_HELP, ///< Bring up help options (command-line help) - TYPE_VERSION, ///< Display product version - TYPE_OPEN, ///< Open a document - TYPE_OPENHELPURL, ///< Open a help URL - TYPE_PRINT, ///< Print document - TYPE_PRIVATE_DOSHUTDOWN, ///< Shutdown application - TYPE_QUICKSTART, ///< Start QuickStart - TYPE_SHOWDIALOG, ///< Show a dialog - TYPE_UNACCEPT ///< Stop listening for connections + enum class Type { + Accept, ///< Listen for connections + Appear, ///< Make application appear + Help, ///< Bring up help options (command-line help) + Version, ///< Display product version + Open, ///< Open a document + OpenHelpUrl, ///< Open a help URL + Print, ///< Print document + PrivateDoShutdown, ///< Shutdown application + QuickStart, ///< Start QuickStart + ShowDialog, ///< Show a dialog + Unaccept ///< Stop listening for connections }; /** Explicit constructor for ApplicationEvent. - @attention TYPE_APPEAR, TYPE_VERSION, TYPE_PRIVATE_DOSHUTDOWN and - TYPE_QUICKSTART are the \em only events that don't need to include + @attention Type::Appear, Type::Version, Type::PrivateDoShutdown and + Type::QuickStart are the \em only events that don't need to include a data string with the event. No other events should use this constructor! */ explicit ApplicationEvent(Type type): aEvent(type) { assert( - type == TYPE_APPEAR || type == TYPE_VERSION - || type == TYPE_PRIVATE_DOSHUTDOWN || type == TYPE_QUICKSTART); + type == Type::Appear || type == Type::Version + || type == Type::PrivateDoShutdown || type == Type::QuickStart); } /** Constructor for ApplicationEvent, accepts a string for the data associated with the event. - @attention TYPE_ACCEPT, TYPE_HELP, TYPE_OPENHELPURL, TYPE_SHOWDIALOG - and TYPE_UNACCEPT are the \em only events that accept a single + @attention Type::Accept, Type::Help, Type::OpenHelpUrl, Type::ShowDialog + and Type::Unaccept are the \em only events that accept a single string as event data. No other events should use this constructor! */ ApplicationEvent(Type type, OUString const & data): aEvent(type) { assert( - type == TYPE_ACCEPT || type == TYPE_HELP || type == TYPE_OPENHELPURL - || type == TYPE_SHOWDIALOG || type == TYPE_UNACCEPT); + type == Type::Accept || type == Type::Help || type == Type::OpenHelpUrl + || type == Type::ShowDialog || type == Type::Unaccept); aData.push_back(data); } /** Constructor for ApplicationEvent, accepts an array of strings for the data associated with the event. - @attention TYPE_OPEN and TYPE_PRINT can apply to multiple documents, + @attention Type::Open and Type::Print can apply to multiple documents, and are the \em only events that accept an array of strings. No other events should use this constructor. */ ApplicationEvent(Type type, std::vector<OUString> const & data): aEvent(type), aData(data) { - assert(type == TYPE_OPEN || type == TYPE_PRINT); + assert(type == Type::Open || type == Type::Print); } /** Get the type of event. @@ -184,17 +184,17 @@ public: /** Gets the application event's data string. - @attention The \em only events that need a single string TYPE_ACCEPT, - TYPE_HELP, TYPE_OPENHELPURL, TYPE_SHOWDIALOG and TYPE_UNACCEPT + @attention The \em only events that need a single string Type::Accept, + Type::Help, Type::OpenHelpUrl, Type::ShowDialog and Type::Unaccept @returns The event's data string. */ OUString GetStringData() const { assert( - aEvent == TYPE_ACCEPT || aEvent == TYPE_HELP - || aEvent == TYPE_OPENHELPURL || aEvent == TYPE_SHOWDIALOG - || aEvent == TYPE_UNACCEPT); + aEvent == Type::Accept || aEvent == Type::Help + || aEvent == Type::OpenHelpUrl || aEvent == Type::ShowDialog + || aEvent == Type::Unaccept); assert(aData.size() == 1); return aData[0]; } @@ -202,11 +202,11 @@ public: /** Gets the event's array of strings. @attention The \em only events that need an array of strings - are TYPE_OPEN and TYPE_PRINT. + are Type::Open and Type::Print. */ std::vector<OUString> const & GetStringsData() const { - assert(aEvent == TYPE_OPEN || aEvent == TYPE_PRINT); + assert(aEvent == Type::Open || aEvent == Type::Print); return aData; } diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 4685749f473e..5d22e171a068 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -320,8 +320,8 @@ sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent, long SfxApplication::DdeExecute( const OUString& rCmd ) // Expressed in our BASIC-Syntax { // Print or Open-Event? - if ( !( SfxAppEvent_Impl( rCmd, "Print", ApplicationEvent::TYPE_PRINT ) || - SfxAppEvent_Impl( rCmd, "Open", ApplicationEvent::TYPE_OPEN ) ) ) + if ( !( SfxAppEvent_Impl( rCmd, "Print", ApplicationEvent::Type::Print ) || + SfxAppEvent_Impl( rCmd, "Open", ApplicationEvent::Type::Open ) ) ) { // all others are BASIC StarBASIC* pBasic = GetBasic(); diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index 36569a5750a1..b5f3badb6bd4 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -86,7 +86,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = nullptr; else if( nDialog == ShowDialogId::Preferences ) aDialog = "PREFERENCES"; const ApplicationEvent* pAppEvent = new ApplicationEvent( - ApplicationEvent::TYPE_SHOWDIALOG, aDialog); + ApplicationEvent::Type::ShowDialog, aDialog); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } } diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm index 14ce7ec3417f..a8a26a00e122 100644 --- a/vcl/osx/vclnsapp.mm +++ b/vcl/osx/vclnsapp.mm @@ -323,7 +323,7 @@ aFile.push_back( GetOUString( pFile ) ); if( ! AquaSalInstance::isOnCommandLine( aFile[0] ) ) { - const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFile); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::Type::Open, aFile); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } return YES; @@ -351,7 +351,7 @@ // we have no back channel here, we have to assume success, in which case // replyToOpenOrPrint does not need to be called according to documentation // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; - const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFileList); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::Type::Open, aFileList); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } } @@ -361,7 +361,7 @@ (void)app; std::vector<OUString> aFile; aFile.push_back( GetOUString( pFile ) ); - const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_PRINT, aFile); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::Type::Print, aFile); AquaSalInstance::aAppEventList.push_back( pAppEvent ); return YES; } @@ -380,7 +380,7 @@ { aFileList.push_back( GetOUString( pFile ) ); } - const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_PRINT, aFileList); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::Type::Print, aFileList); AquaSalInstance::aAppEventList.push_back( pAppEvent ); // we have no back channel here, we have to assume success // correct handling would be NSPrintingReplyLater and then send [app replyToOpenOrPrint] @@ -410,7 +410,7 @@ if( aReply == NSTerminateNow ) { - ApplicationEvent aEv(ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN); + ApplicationEvent aEv(ApplicationEvent::Type::PrivateDoShutdown); GetpApp()->AppEvent( aEv ); ImplImageTree::get().shutDown(); // DeInitVCL should be called in ImplSVMain - unless someon _exits first which |