Kaydet (Commit) e66e54fb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Further clean up of areas touched by previous commit.

üst e0424933
...@@ -190,7 +190,6 @@ class Desktop : public Application ...@@ -190,7 +190,6 @@ class Desktop : public Application
void DoFirstRunInitializations(); void DoFirstRunInitializations();
static sal_Bool SaveTasks(); static sal_Bool SaveTasks();
static sal_Bool _bTasksSaved;
static void retrieveCrashReporterState(); static void retrieveCrashReporterState();
static sal_Bool isUIOnSessionShutdownAllowed(); static sal_Bool isUIOnSessionShutdownAllowed();
......
...@@ -1346,8 +1346,6 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , ...@@ -1346,8 +1346,6 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave ,
* *
*/ */
sal_Bool Desktop::_bTasksSaved = sal_False;
sal_Bool Desktop::SaveTasks() sal_Bool Desktop::SaveTasks()
{ {
return impl_callRecoveryUI( return impl_callRecoveryUI(
...@@ -2990,138 +2988,139 @@ String GetURL_Impl( ...@@ -2990,138 +2988,139 @@ String GetURL_Impl(
void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) 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(); case ApplicationEvent::TYPE_ACCEPT:
// every time an accept parameter is used we create an acceptor
// find active task - the active task is always a visible task // with the corresponding accept-string
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > createAcceptor(rAppEvent.GetData());
xDesktop( xSMGR->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), break;
::com::sun::star::uno::UNO_QUERY ); case ApplicationEvent::TYPE_APPEAR:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame(); if ( !GetCommandLineArgs().IsInvisible() )
if ( !xTask.is() )
{ {
// get any task if there is no active one css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
::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;
}
if ( xTask.is() ) // find active task - the active task is always a visible task
{ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >
Reference< com::sun::star::awt::XTopWindow > xTop( xTask->getContainerWindow(), UNO_QUERY ); xDesktop( xSMGR->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
xTop->toFront(); ::com::sun::star::uno::UNO_QUERY );
} ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTask = xDesktop->getActiveFrame();
else if ( !xTask.is() )
{ {
// no visible task that could be activated found // get any task if there is no active one
Reference< XFrame > xBackingFrame; ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xList( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY );
Reference< ::com::sun::star::awt::XWindow > xContainerWindow; if ( xList->getCount()>0 )
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY ); xList->getByIndex(0) >>= xTask;
}
xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); if ( xTask.is() )
if (xBackingFrame.is()) {
xContainerWindow = xBackingFrame->getContainerWindow(); Reference< com::sun::star::awt::XTopWindow > xTop( xTask->getContainerWindow(), UNO_QUERY );
if (xContainerWindow.is()) xTop->toFront();
}
else
{ {
Sequence< Any > lArgs(1); // no visible task that could be activated found
lArgs[0] <<= xContainerWindow; Reference< XFrame > xBackingFrame;
Reference< XController > xBackingComp( Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
xSMGR->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xDesktopFrame( xDesktop, UNO_QUERY );
UNO_QUERY);
if (xBackingComp.is()) 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); Sequence< Any > lArgs(1);
// Attention: You MUST(!) call setComponent() before you call attachFrame(). lArgs[0] <<= xContainerWindow;
// Because the backing component set the property "IsBackingMode" of the frame Reference< XController > xBackingComp(
// to true inside attachFrame(). But setComponent() reset this state everytimes ... xSMGR->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
xBackingFrame->setComponent(xBackingWin, xBackingComp); UNO_QUERY);
xBackingComp->attachFrame(xBackingFrame); if (xBackingComp.is())
xContainerWindow->setVisible(sal_True); {
Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow()); // Attention: You MUST(!) call setComponent() before you call attachFrame().
if (pCompWindow) // Because the backing component set the property "IsBackingMode" of the frame
pCompWindow->Update(); // 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();
}
} }
} }
} }
} break;
else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUICKSTART")) && !GetCommandLineArgs().IsInvisible() ) case ApplicationEvent::TYPE_HELP:
{ #ifndef UNX
// If the office has been started the second time its command line arguments are sent through a pipe // in non unix version allow showing of cmdline help window
// connection to the first office. We want to reuse the quickstart option for the first office. displayCmdlineHelp();
// NOTICE: The quickstart service must be initialized inside the "main thread", so we use the #endif
// application events to do this (they are executed inside main thread)!!! break;
// Don't start quickstart service if the user specified "-invisible" on the command line! case ApplicationEvent::TYPE_OPEN:
sal_Bool bQuickstart( sal_True ); {
Sequence< Any > aSeq( 1 ); const CommandLineArgs& rCmdLine = GetCommandLineArgs();
aSeq[0] <<= bQuickstart; if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
{
ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest(
rCmdLine.getCwdUrl());
pDocsRequest->aOpenList = rAppEvent.GetData();
pDocsRequest->pcProcessed = NULL;
Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest );
DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" )), delete pDocsRequest;
UNO_QUERY ); }
if ( xQuickstart.is() ) }
xQuickstart->initialize( aSeq ); break;
} case ApplicationEvent::TYPE_OPENHELPURL:
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")) )
{
// start help for a specific URL // start help for a specific URL
Help *pHelp = Application::GetHelp(); Application::GetHelp()->Start(rAppEvent.GetData(), NULL);
pHelp->Start(rAppEvent.GetData(), NULL); break;
} case ApplicationEvent::TYPE_PRINT:
else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)) )
{
const CommandLineArgs& rCmdLine = GetCommandLineArgs();
if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
{ {
ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( const CommandLineArgs& rCmdLine = GetCommandLineArgs();
rCmdLine.getCwdUrl()); if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
pDocsRequest->aOpenList = rAppEvent.GetData(); {
pDocsRequest->pcProcessed = NULL; ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest(
rCmdLine.getCwdUrl());
pDocsRequest->aPrintList = rAppEvent.GetData();
pDocsRequest->pcProcessed = NULL;
OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest ); OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest );
delete pDocsRequest; delete pDocsRequest;
}
} }
} break;
else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)) ) case ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN:
{
const CommandLineArgs& rCmdLine = GetCommandLineArgs();
if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
{ {
ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest( Desktop* pD = dynamic_cast<Desktop*>(GetpApp());
rCmdLine.getCwdUrl()); OSL_ENSURE( pD, "no desktop ?!?" );
pDocsRequest->aPrintList = rAppEvent.GetData(); if( pD )
pDocsRequest->pcProcessed = NULL; 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 ); Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance(
delete pDocsRequest; DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" )),
UNO_QUERY );
if ( xQuickstart.is() )
xQuickstart->initialize( aSeq );
} }
} break;
#ifndef UNX case ApplicationEvent::TYPE_SHOWDIALOG:
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")) )
{
// ignore all errors here. It's clicking a menu entry only ... // ignore all errors here. It's clicking a menu entry only ...
// The user will try it again, in case nothing happens .-) // The user will try it again, in case nothing happens .-)
try try
...@@ -3153,13 +3152,14 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) ...@@ -3153,13 +3152,14 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
} }
catch(const css::uno::Exception&) catch(const css::uno::Exception&)
{} {}
} break;
else if( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVATE:DOSHUTDOWN")) ) case ApplicationEvent::TYPE_UNACCEPT:
{ // try to remove corresponding acceptor
Desktop* pD = dynamic_cast<Desktop*>(GetpApp()); destroyAcceptor(rAppEvent.GetData());
OSL_ENSURE( pD, "no desktop ?!?" ); break;
if( pD ) default:
pD->doShutdown(); OSL_FAIL("this cannot happen");
break;
} }
} }
......
...@@ -399,8 +399,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) ...@@ -399,8 +399,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ) void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam )
{ {
::rtl::OUStringBuffer aParamBuf(m_aStrParams[eParam]);
OSL_ASSERT( eParam >= 0 && eParam < CMD_STRINGPARAM_COUNT ); OSL_ASSERT( eParam >= 0 && eParam < CMD_STRINGPARAM_COUNT );
::rtl::OUStringBuffer aParamBuf(m_aStrParams[eParam]);
if ( aParamBuf.getLength() ) if ( aParamBuf.getLength() )
aParamBuf.append('\n'); aParamBuf.append('\n');
aParamBuf.append(aParam); aParamBuf.append(aParam);
......
...@@ -695,7 +695,6 @@ void SAL_CALL OfficeIPCThread::run() ...@@ -695,7 +695,6 @@ void SAL_CALL OfficeIPCThread::run()
// is this a termination message ? if so, terminate // is this a termination message ? if so, terminate
if(( aArguments.CompareTo( sc_aTerminationSequence, sc_nTSeqLength ) == COMPARE_EQUAL ) || if(( aArguments.CompareTo( sc_aTerminationSequence, sc_nTSeqLength ) == COMPARE_EQUAL ) ||
mbDowning ) return; mbDowning ) return;
String aEmpty;
std::auto_ptr< CommandLineArgs > aCmdLineArgs; std::auto_ptr< CommandLineArgs > aCmdLineArgs;
try try
{ {
...@@ -715,22 +714,22 @@ void SAL_CALL OfficeIPCThread::run() ...@@ -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!! // we have to use application event, because we have to start quickstart service in main thread!!
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent =
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUICKSTART"))); new ApplicationEvent(ApplicationEvent::TYPE_QUICKSTART);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
// handle request for acceptor // handle request for acceptor
OUString aAcceptString; OUString aAcceptString;
if ( aCmdLineArgs->GetAcceptString(aAcceptString) ) { if ( aCmdLineArgs->GetAcceptString(aAcceptString) ) {
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent = new ApplicationEvent(
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACCEPT")), aAcceptString); ApplicationEvent::TYPE_ACCEPT, aAcceptString);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
// handle acceptor removal // handle acceptor removal
OUString aUnAcceptString; OUString aUnAcceptString;
if ( aCmdLineArgs->GetUnAcceptString(aUnAcceptString) ) { if ( aCmdLineArgs->GetUnAcceptString(aUnAcceptString) ) {
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent = new ApplicationEvent(
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNACCEPT")), aUnAcceptString); ApplicationEvent::TYPE_UNACCEPT, aUnAcceptString);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
...@@ -739,7 +738,7 @@ void SAL_CALL OfficeIPCThread::run() ...@@ -739,7 +738,7 @@ void SAL_CALL OfficeIPCThread::run()
// in a running instance in order to display the command line help // in a running instance in order to display the command line help
if ( aCmdLineArgs->IsHelp() ) { if ( aCmdLineArgs->IsHelp() ) {
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent =
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HELP"))); new ApplicationEvent(ApplicationEvent::TYPE_HELP);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
#endif #endif
...@@ -837,8 +836,9 @@ void SAL_CALL OfficeIPCThread::run() ...@@ -837,8 +836,9 @@ void SAL_CALL OfficeIPCThread::run()
#elif defined WNT #elif defined WNT
aHelpURLBuffer.appendAscii("&System=WIN"); aHelpURLBuffer.appendAscii("&System=WIN");
#endif #endif
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent = new ApplicationEvent(
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPENHELPURL")), aHelpURLBuffer.makeStringAndClear()); ApplicationEvent::TYPE_OPENHELPURL,
aHelpURLBuffer.makeStringAndClear());
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
} }
...@@ -876,7 +876,7 @@ void SAL_CALL OfficeIPCThread::run() ...@@ -876,7 +876,7 @@ void SAL_CALL OfficeIPCThread::run()
{ {
// no document was sent, just bring Office to front // no document was sent, just bring Office to front
ApplicationEvent* pAppEvent = ApplicationEvent* pAppEvent =
new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("APPEAR"))); new ApplicationEvent(ApplicationEvent::TYPE_APPEAR);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
......
...@@ -245,7 +245,8 @@ SV_IMPL_PTRARR( SfxDdeDocTopics_Impl, SfxDdeDocTopic_Impl *) ...@@ -245,7 +245,8 @@ SV_IMPL_PTRARR( SfxDdeDocTopics_Impl, SfxDdeDocTopic_Impl *)
//======================================================================== //========================================================================
sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent,
const String &rCmd, const String &rEvent ) const String &rCmd, const String &rEvent,
ApplicationEvent::Type eType )
/* [Description] /* [Description]
...@@ -291,7 +292,7 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, ...@@ -291,7 +292,7 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent,
} }
} }
rAppEvent = ApplicationEvent(rEvent, aData.makeStringAndClear()); rAppEvent = ApplicationEvent(eType, aData.makeStringAndClear());
return sal_True; return sal_True;
} }
} }
...@@ -318,8 +319,8 @@ long SfxApplication::DdeExecute ...@@ -318,8 +319,8 @@ long SfxApplication::DdeExecute
{ {
// Print or Open-Event? // Print or Open-Event?
ApplicationEvent aAppEvent; ApplicationEvent aAppEvent;
if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print") ) || if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print"), ApplicationEvent::TYPE_PRINT ) ||
SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open") ) ) SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open"), ApplicationEvent::TYPE_OPEN ) )
GetpApp()->AppEvent( aAppEvent ); GetpApp()->AppEvent( aAppEvent );
else else
{ {
......
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
const rtl::OUString aFile( GetOUString( pFile ) ); const rtl::OUString aFile( GetOUString( pFile ) );
if( ! AquaSalInstance::isOnCommandLine( aFile ) ) 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 ); AquaSalInstance::aAppEventList.push_back( pAppEvent );
} }
return YES; return YES;
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
// we have no back channel here, we have to assume success, in which case // we have no back channel here, we have to assume success, in which case
// replyToOpenOrPrint does not need to be called according to documentation // replyToOpenOrPrint does not need to be called according to documentation
// [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; // [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 ); AquaSalInstance::aAppEventList.push_back( pAppEvent );
} }
} }
...@@ -353,7 +353,7 @@ ...@@ -353,7 +353,7 @@
{ {
(void)app; (void)app;
const rtl::OUString aFile( GetOUString( pFile ) ); 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 ); AquaSalInstance::aAppEventList.push_back( pAppEvent );
return YES; return YES;
} }
...@@ -374,7 +374,7 @@ ...@@ -374,7 +374,7 @@
aFileList.append('\n'); aFileList.append('\n');
aFileList.append( GetOUString( pFile ) ); 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 ); AquaSalInstance::aAppEventList.push_back( pAppEvent );
// we have no back channel here, we have to assume success // we have no back channel here, we have to assume success
// correct handling would be NSPrintingReplyLater and then send [app replyToOpenOrPrint] // correct handling would be NSPrintingReplyLater and then send [app replyToOpenOrPrint]
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
if( aReply == NSTerminateNow ) if( aReply == NSTerminateNow )
{ {
ApplicationEvent aEv(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVATE:DOSHUTDOWN"))); ApplicationEvent aEv(ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN);
GetpApp()->AppEvent( aEv ); GetpApp()->AppEvent( aEv );
ImplImageTreeSingletonRef()->shutDown(); ImplImageTreeSingletonRef()->shutDown();
// DeInitVCL should be called in ImplSVMain - unless someon _exits first which // DeInitVCL should be called in ImplSVMain - unless someon _exits first which
......
...@@ -75,7 +75,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; ...@@ -75,7 +75,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
else if( nDialog == SHOWDIALOG_ID_PREFERENCES ) else if( nDialog == SHOWDIALOG_ID_PREFERENCES )
aDialog = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PREFERENCES")); aDialog = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PREFERENCES"));
const ApplicationEvent* pAppEvent = new ApplicationEvent( const ApplicationEvent* pAppEvent = new ApplicationEvent(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHOWDIALOG")), aDialog); ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
AquaSalInstance::aAppEventList.push_back( pAppEvent ); AquaSalInstance::aAppEventList.push_back( pAppEvent );
} }
} }
......
...@@ -97,36 +97,27 @@ typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData ); ...@@ -97,36 +97,27 @@ typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC }; enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC };
#endif #endif
#define APPEVENT_OPEN_STRING "Open"
#define APPEVENT_PRINT_STRING "Print"
class VCL_DLLPUBLIC ApplicationEvent class VCL_DLLPUBLIC ApplicationEvent
{ {
rtl::OUString aEvent;
rtl::OUString aData;
std::vector<rtl::OUString> aParams;
ApplicationEvent();
public: 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()): const rtl::OUString& rData = rtl::OUString()):
aEvent(rEvent), aEvent(rEvent),
aData(rData) 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 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 class VCL_DLLPUBLIC PropertyHandler
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
// we have no back channel here, we have to assume success, in which case // we have no back channel here, we have to assume success, in which case
// replyToOpenOrPrint does not need to be called according to documentation // replyToOpenOrPrint does not need to be called according to documentation
// [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; // [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 ); IosSalInstance::aAppEventList.push_back( pAppEvent );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment