diff options
-rw-r--r-- | desktop/inc/app.hxx | 1 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 248 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 2 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 9 | ||||
-rw-r--r-- | vcl/aqua/source/app/vclnsapp.mm | 10 | ||||
-rw-r--r-- | vcl/aqua/source/window/salmenu.cxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/svapp.hxx | 35 | ||||
-rw-r--r-- | vcl/ios/source/app/vcluiapp.mm | 2 |
9 files changed, 160 insertions, 169 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 87a774c5661b..f30ac4645e89 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -190,7 +190,6 @@ class Desktop : public Application void DoFirstRunInitializations(); static sal_Bool SaveTasks(); - static sal_Bool _bTasksSaved; static void retrieveCrashReporterState(); static sal_Bool isUIOnSessionShutdownAllowed(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 00850aae039c..1555510efab7 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1346,8 +1346,6 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , * */ -sal_Bool Desktop::_bTasksSaved = sal_False; - sal_Bool Desktop::SaveTasks() { return impl_callRecoveryUI( @@ -2990,138 +2988,139 @@ String GetURL_Impl( void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) { - if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("APPEAR")) && !GetCommandLineArgs().IsInvisible() ) + switch ( rAppEvent.GetEvent() ) { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - - // find active task - the active task is always a visible task - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > - xDesktop( xSMGR->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame(); - if ( !xTask.is() ) + case ApplicationEvent::TYPE_ACCEPT: + // every time an accept parameter is used we create an acceptor + // with the corresponding accept-string + createAcceptor(rAppEvent.GetData()); + break; + case ApplicationEvent::TYPE_APPEAR: + if ( !GetCommandLineArgs().IsInvisible() ) { - // get any task if there is no active one - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); - if ( xList->getCount()>0 ) - xList->getByIndex(0) >>= xTask; - } + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - if ( xTask.is() ) - { - Reference< com::sun::star::awt::XTopWindow > xTop( xTask->getContainerWindow(), UNO_QUERY ); - xTop->toFront(); - } - else - { - // no visible task that could be activated found - Reference< XFrame > xBackingFrame; - Reference< ::com::sun::star::awt::XWindow > xContainerWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY ); + // find active task - the active task is always a visible task + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > + xDesktop( xSMGR->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), + ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame(); + if ( !xTask.is() ) + { + // get any task if there is no active one + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); + if ( xList->getCount()>0 ) + xList->getByIndex(0) >>= xTask; + } - xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); - if (xBackingFrame.is()) - xContainerWindow = xBackingFrame->getContainerWindow(); - if (xContainerWindow.is()) + if ( xTask.is() ) + { + Reference< com::sun::star::awt::XTopWindow > xTop( xTask->getContainerWindow(), UNO_QUERY ); + xTop->toFront(); + } + else { - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - Reference< XController > xBackingComp( - xSMGR->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), - UNO_QUERY); - if (xBackingComp.is()) + // no visible task that could be activated found + Reference< XFrame > xBackingFrame; + Reference< ::com::sun::star::awt::XWindow > xContainerWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY ); + + xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); + if (xBackingFrame.is()) + xContainerWindow = xBackingFrame->getContainerWindow(); + if (xContainerWindow.is()) { - Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(xBackingWin, xBackingComp); - xBackingComp->attachFrame(xBackingFrame); - xContainerWindow->setVisible(sal_True); - - Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow()); - if (pCompWindow) - pCompWindow->Update(); + Sequence< Any > lArgs(1); + lArgs[0] <<= xContainerWindow; + Reference< XController > xBackingComp( + xSMGR->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), + UNO_QUERY); + if (xBackingComp.is()) + { + Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state everytimes ... + xBackingFrame->setComponent(xBackingWin, xBackingComp); + xBackingComp->attachFrame(xBackingFrame); + xContainerWindow->setVisible(sal_True); + + Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow()); + if (pCompWindow) + pCompWindow->Update(); + } } } } - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUICKSTART")) && !GetCommandLineArgs().IsInvisible() ) - { - // If the office has been started the second time its command line arguments are sent through a pipe - // connection to the first office. We want to reuse the quickstart option for the first office. - // NOTICE: The quickstart service must be initialized inside the "main thread", so we use the - // application events to do this (they are executed inside main thread)!!! - // Don't start quickstart service if the user specified "-invisible" on the command line! - sal_Bool bQuickstart( sal_True ); - Sequence< Any > aSeq( 1 ); - aSeq[0] <<= bQuickstart; + break; + case ApplicationEvent::TYPE_HELP: +#ifndef UNX + // in non unix version allow showing of cmdline help window + displayCmdlineHelp(); +#endif + break; + case ApplicationEvent::TYPE_OPEN: + { + const CommandLineArgs& rCmdLine = GetCommandLineArgs(); + if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) + { + ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( + rCmdLine.getCwdUrl()); + pDocsRequest->aOpenList = rAppEvent.GetData(); + pDocsRequest->pcProcessed = NULL; - Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" )), - UNO_QUERY ); - if ( xQuickstart.is() ) - xQuickstart->initialize( aSeq ); - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACCEPT")) ) - { - // every time an accept parameter is used we create an acceptor - // with the corresponding accept-string - createAcceptor(rAppEvent.GetData()); - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNACCEPT")) ) - { - // try to remove corresponding acceptor - destroyAcceptor(rAppEvent.GetData()); - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveDocuments")) ) - { - Desktop::_bTasksSaved = sal_False; - Desktop::_bTasksSaved = SaveTasks(); - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPENHELPURL")) ) - { + OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest ); + delete pDocsRequest; + } + } + break; + case ApplicationEvent::TYPE_OPENHELPURL: // start help for a specific URL - Help *pHelp = Application::GetHelp(); - pHelp->Start(rAppEvent.GetData(), NULL); - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)) ) - { - const CommandLineArgs& rCmdLine = GetCommandLineArgs(); - if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) + Application::GetHelp()->Start(rAppEvent.GetData(), NULL); + break; + case ApplicationEvent::TYPE_PRINT: { - ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( - rCmdLine.getCwdUrl()); - pDocsRequest->aOpenList = rAppEvent.GetData(); - pDocsRequest->pcProcessed = NULL; + const CommandLineArgs& rCmdLine = GetCommandLineArgs(); + if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) + { + ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( + rCmdLine.getCwdUrl()); + pDocsRequest->aPrintList = rAppEvent.GetData(); + pDocsRequest->pcProcessed = NULL; - OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest ); - delete pDocsRequest; + OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest ); + delete pDocsRequest; + } } - } - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)) ) - { - const CommandLineArgs& rCmdLine = GetCommandLineArgs(); - if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() ) + break; + case ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN: { - ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( - rCmdLine.getCwdUrl()); - pDocsRequest->aPrintList = rAppEvent.GetData(); - pDocsRequest->pcProcessed = NULL; + Desktop* pD = dynamic_cast<Desktop*>(GetpApp()); + OSL_ENSURE( pD, "no desktop ?!?" ); + if( pD ) + pD->doShutdown(); + } + break; + 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 + // connection to the first office. We want to reuse the quickstart option for the first office. + // NOTICE: The quickstart service must be initialized inside the "main thread", so we use the + // application events to do this (they are executed inside main thread)!!! + // Don't start quickstart service if the user specified "-invisible" on the command line! + sal_Bool bQuickstart( sal_True ); + Sequence< Any > aSeq( 1 ); + aSeq[0] <<= bQuickstart; - OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest ); - delete pDocsRequest; + Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" )), + UNO_QUERY ); + if ( xQuickstart.is() ) + xQuickstart->initialize( aSeq ); } - } -#ifndef UNX - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HELP")) ) - { - // in non unix version allow showing of cmdline help window - displayCmdlineHelp(); - } -#endif - else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHOWDIALOG")) ) - { + break; + 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 @@ -3153,13 +3152,14 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) } catch(const css::uno::Exception&) {} - } - else if( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVATE:DOSHUTDOWN")) ) - { - Desktop* pD = dynamic_cast<Desktop*>(GetpApp()); - OSL_ENSURE( pD, "no desktop ?!?" ); - if( pD ) - pD->doShutdown(); + break; + case ApplicationEvent::TYPE_UNACCEPT: + // try to remove corresponding acceptor + destroyAcceptor(rAppEvent.GetData()); + break; + default: + OSL_FAIL("this cannot happen"); + break; } } diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 78c6e719e8d7..4db23d92e93a 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -399,8 +399,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ) { - ::rtl::OUStringBuffer aParamBuf(m_aStrParams[eParam]); OSL_ASSERT( eParam >= 0 && eParam < CMD_STRINGPARAM_COUNT ); + ::rtl::OUStringBuffer aParamBuf(m_aStrParams[eParam]); if ( aParamBuf.getLength() ) aParamBuf.append('\n'); aParamBuf.append(aParam); diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index af30005d42d9..d9273c029eb3 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -695,7 +695,6 @@ void SAL_CALL OfficeIPCThread::run() // is this a termination message ? if so, terminate if(( aArguments.CompareTo( sc_aTerminationSequence, sc_nTSeqLength ) == COMPARE_EQUAL ) || mbDowning ) return; - String aEmpty; std::auto_ptr< CommandLineArgs > aCmdLineArgs; try { @@ -715,22 +714,22 @@ void SAL_CALL OfficeIPCThread::run() { // we have to use application event, because we have to start quickstart service in main thread!! ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUICKSTART"))); + new ApplicationEvent(ApplicationEvent::TYPE_QUICKSTART); ImplPostForeignAppEvent( pAppEvent ); } // handle request for acceptor OUString aAcceptString; if ( aCmdLineArgs->GetAcceptString(aAcceptString) ) { - ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACCEPT")), aAcceptString); + ApplicationEvent* pAppEvent = new ApplicationEvent( + ApplicationEvent::TYPE_ACCEPT, aAcceptString); ImplPostForeignAppEvent( pAppEvent ); } // handle acceptor removal OUString aUnAcceptString; if ( aCmdLineArgs->GetUnAcceptString(aUnAcceptString) ) { - ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNACCEPT")), aUnAcceptString); + ApplicationEvent* pAppEvent = new ApplicationEvent( + ApplicationEvent::TYPE_UNACCEPT, aUnAcceptString); ImplPostForeignAppEvent( pAppEvent ); } @@ -739,7 +738,7 @@ void SAL_CALL OfficeIPCThread::run() // in a running instance in order to display the command line help if ( aCmdLineArgs->IsHelp() ) { ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HELP"))); + new ApplicationEvent(ApplicationEvent::TYPE_HELP); ImplPostForeignAppEvent( pAppEvent ); } #endif @@ -837,8 +836,9 @@ void SAL_CALL OfficeIPCThread::run() #elif defined WNT aHelpURLBuffer.appendAscii("&System=WIN"); #endif - ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPENHELPURL")), aHelpURLBuffer.makeStringAndClear()); + ApplicationEvent* pAppEvent = new ApplicationEvent( + ApplicationEvent::TYPE_OPENHELPURL, + aHelpURLBuffer.makeStringAndClear()); ImplPostForeignAppEvent( pAppEvent ); } } @@ -876,7 +876,7 @@ void SAL_CALL OfficeIPCThread::run() { // no document was sent, just bring Office to front ApplicationEvent* pAppEvent = - new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("APPEAR"))); + new ApplicationEvent(ApplicationEvent::TYPE_APPEAR); ImplPostForeignAppEvent( pAppEvent ); } diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index f7d3c0e22d9c..08cfba20aab4 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -245,7 +245,8 @@ SV_IMPL_PTRARR( SfxDdeDocTopics_Impl, SfxDdeDocTopic_Impl *) //======================================================================== sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, - const String &rCmd, const String &rEvent ) + const String &rCmd, const String &rEvent, + ApplicationEvent::Type eType ) /* [Description] @@ -291,7 +292,7 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, } } - rAppEvent = ApplicationEvent(rEvent, aData.makeStringAndClear()); + rAppEvent = ApplicationEvent(eType, aData.makeStringAndClear()); return sal_True; } } @@ -318,8 +319,8 @@ long SfxApplication::DdeExecute { // Print or Open-Event? ApplicationEvent aAppEvent; - if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print") ) || - SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open") ) ) + if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print"), ApplicationEvent::TYPE_PRINT ) || + SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open"), ApplicationEvent::TYPE_OPEN ) ) GetpApp()->AppEvent( aAppEvent ); else { diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index e2da47c8bc5b..e2f500d396ba 100644 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -314,7 +314,7 @@ const rtl::OUString aFile( GetOUString( pFile ) ); if( ! AquaSalInstance::isOnCommandLine( aFile ) ) { - const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFile); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFile); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } return YES; @@ -344,7 +344,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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFileList.makeStringAndClear()); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFileList.makeStringAndClear()); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } } @@ -353,7 +353,7 @@ { (void)app; const rtl::OUString aFile( GetOUString( pFile ) ); - const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)), aFile); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_PRINT, aFile); AquaSalInstance::aAppEventList.push_back( pAppEvent ); return YES; } @@ -374,7 +374,7 @@ aFileList.append('\n'); aFileList.append( GetOUString( pFile ) ); } - const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)), aFileList.makeStringAndClear()); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_PRINT, aFileList.makeStringAndClear()); 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] @@ -398,7 +398,7 @@ if( aReply == NSTerminateNow ) { - ApplicationEvent aEv(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVATE:DOSHUTDOWN"))); + ApplicationEvent aEv(ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN); GetpApp()->AppEvent( aEv ); ImplImageTreeSingletonRef()->shutDown(); // DeInitVCL should be called in ImplSVMain - unless someon _exits first which diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 50aa9a673ed5..509ef731ab75 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -75,7 +75,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; else if( nDialog == SHOWDIALOG_ID_PREFERENCES ) aDialog = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PREFERENCES")); const ApplicationEvent* pAppEvent = new ApplicationEvent( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHOWDIALOG")), aDialog); + ApplicationEvent::TYPE_SHOWDIALOG, aDialog); AquaSalInstance::aAppEventList.push_back( pAppEvent ); } } diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index fb32a8ba245c..ccd232ca5997 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -97,36 +97,27 @@ typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData ); enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC }; #endif -#define APPEVENT_OPEN_STRING "Open" -#define APPEVENT_PRINT_STRING "Print" - class VCL_DLLPUBLIC ApplicationEvent { - rtl::OUString aEvent; - rtl::OUString aData; - std::vector<rtl::OUString> aParams; - - ApplicationEvent(); public: - ApplicationEvent(const rtl::OUString& rEvent, + enum Type { + TYPE_ACCEPT, TYPE_APPEAR, TYPE_HELP, TYPE_OPEN, TYPE_OPENHELPURL, + TYPE_PRINT, TYPE_PRIVATE_DOSHUTDOWN, TYPE_QUICKSTART, TYPE_SHOWDIALOG, + TYPE_UNACCEPT + }; + + ApplicationEvent(Type rEvent, const rtl::OUString& rData = rtl::OUString()): aEvent(rEvent), aData(rData) - { - sal_Int32 start = 0; - for(sal_Int32 i = 0; i < rData.getLength(); ++i) - { - if(rData[i] == '\n') - { - aParams.push_back(rData.copy(start, i - start)); - start = ++i; - } - } - } + {} - const rtl::OUString& GetEvent() const { return aEvent; } + Type GetEvent() const { return aEvent; } const rtl::OUString& GetData() const { return aData; } - const std::vector<rtl::OUString>& GetParams() const { return aParams; } + +private: + Type aEvent; + rtl::OUString aData; }; class VCL_DLLPUBLIC PropertyHandler diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm index c47669e69138..600cae8d2322 100644 --- a/vcl/ios/source/app/vcluiapp.mm +++ b/vcl/ios/source/app/vcluiapp.mm @@ -79,7 +79,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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFileList.makeStringAndClear()); + const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFileList.makeStringAndClear()); IosSalInstance::aAppEventList.push_back( pAppEvent ); } } |