[Libreoffice-commits] .: 3 commits - desktop/inc desktop/source sal/inc sal/qa sfx2/source vcl/aqua vcl/inc vcl/ios
Stephan Bergmann
sbergmann at kemper.freedesktop.org
Fri Nov 4 00:24:10 PDT 2011
desktop/inc/app.hxx | 1
desktop/source/app/app.cxx | 259 +++++------
desktop/source/app/cmdlineargs.cxx | 8
desktop/source/app/officeipcthread.cxx | 36 -
sal/inc/rtl/ustrbuf.hxx | 18
sal/qa/rtl/oustringbuffer/makefile.mk | 1
sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx | 63 ++
sfx2/source/appl/appdde.cxx | 43 +
vcl/aqua/source/app/vclnsapp.mm | 18
vcl/aqua/source/window/salmenu.cxx | 12
vcl/inc/vcl/svapp.hxx | 107 ----
vcl/ios/source/app/vcluiapp.mm | 3
12 files changed, 285 insertions(+), 284 deletions(-)
New commits:
commit e66e54fb00bf74d13b7059bd32b6207a029afa5e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Nov 3 17:45:47 2011 +0100
Further clean up of areas touched by previous commit.
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 87a774c..f30ac46 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 00850aa..1555510 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 78c6e71..4db23d9 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 af30005..d9273c0 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 f7d3c0e..08cfba2 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 e2da47c..e2f500d 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 50aa9a6..509ef73 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 fb32a8b..ccd232c 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 c47669e..600cae8 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 );
}
}
commit e04249337551653f63ba9b2a2302578961e38562
Author: August Sodora <augsod at gmail.com>
Date: Thu Nov 3 16:50:24 2011 +0100
String->OUString, remove unused code
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index be33fac..00850aa 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2990,7 +2990,7 @@ String GetURL_Impl(
void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
{
- if ( rAppEvent.GetEvent() == "APPEAR" && !GetCommandLineArgs().IsInvisible() )
+ if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("APPEAR")) && !GetCommandLineArgs().IsInvisible() )
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
@@ -3046,7 +3046,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
}
}
}
- else if ( rAppEvent.GetEvent() == "QUICKSTART" && !GetCommandLineArgs().IsInvisible() )
+ 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.
@@ -3063,57 +3063,50 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
if ( xQuickstart.is() )
xQuickstart->initialize( aSeq );
}
- else if ( rAppEvent.GetEvent() == "ACCEPT" )
+ 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
- OUString aAcceptString(rAppEvent.GetData().GetBuffer());
- createAcceptor(aAcceptString);
+ createAcceptor(rAppEvent.GetData());
}
- else if ( rAppEvent.GetEvent() == "UNACCEPT" )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNACCEPT")) )
{
// try to remove corresponding acceptor
- OUString aUnAcceptString(rAppEvent.GetData().GetBuffer());
- destroyAcceptor(aUnAcceptString);
+ destroyAcceptor(rAppEvent.GetData());
}
- else if ( rAppEvent.GetEvent() == "SaveDocuments" )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveDocuments")) )
{
Desktop::_bTasksSaved = sal_False;
Desktop::_bTasksSaved = SaveTasks();
}
- else if ( rAppEvent.GetEvent() == "OPENHELPURL" )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPENHELPURL")) )
{
// start help for a specific URL
- OUString aHelpURL(rAppEvent.GetData().GetBuffer());
Help *pHelp = Application::GetHelp();
- pHelp->Start(aHelpURL, NULL);
+ pHelp->Start(rAppEvent.GetData(), NULL);
}
- else if ( rAppEvent.GetEvent() == APPEVENT_OPEN_STRING )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)) )
{
- OUString aOpenURL(rAppEvent.GetData().GetBuffer());
-
const CommandLineArgs& rCmdLine = GetCommandLineArgs();
if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
{
ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest(
rCmdLine.getCwdUrl());
- pDocsRequest->aOpenList = aOpenURL;
+ pDocsRequest->aOpenList = rAppEvent.GetData();
pDocsRequest->pcProcessed = NULL;
OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest );
delete pDocsRequest;
}
}
- else if ( rAppEvent.GetEvent() == APPEVENT_PRINT_STRING )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)) )
{
- OUString aPrintURL(rAppEvent.GetData().GetBuffer());
-
const CommandLineArgs& rCmdLine = GetCommandLineArgs();
if ( !rCmdLine.IsInvisible() && !rCmdLine.IsTerminateAfterInit() )
{
ProcessDocumentsRequest* pDocsRequest = new ProcessDocumentsRequest(
rCmdLine.getCwdUrl());
- pDocsRequest->aPrintList = aPrintURL;
+ pDocsRequest->aPrintList = rAppEvent.GetData();
pDocsRequest->pcProcessed = NULL;
OfficeIPCThread::ExecuteCmdLineRequests( *pDocsRequest );
@@ -3121,13 +3114,13 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
}
}
#ifndef UNX
- else if ( rAppEvent.GetEvent() == "HELP" )
+ 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() == "SHOWDIALOG" )
+ else if ( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHOWDIALOG")) )
{
// ignore all errors here. It's clicking a menu entry only ...
// The user will try it again, in case nothing happens .-)
@@ -3145,9 +3138,9 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), css::uno::UNO_QUERY_THROW);
css::util::URL aCommand;
- if( rAppEvent.GetData().EqualsAscii( "PREFERENCES" ) )
+ if( rAppEvent.GetData() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PREFERENCES")) )
aCommand.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:OptionsTreeDialog" ) );
- else if( rAppEvent.GetData().EqualsAscii( "ABOUT" ) )
+ else if( rAppEvent.GetData() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABOUT")) )
aCommand.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:About" ) );
if( aCommand.Complete.getLength() )
{
@@ -3161,7 +3154,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
catch(const css::uno::Exception&)
{}
}
- else if( rAppEvent.GetEvent() == "PRIVATE:DOSHUTDOWN" )
+ else if( rAppEvent.GetEvent() == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVATE:DOSHUTDOWN")) )
{
Desktop* pD = dynamic_cast<Desktop*>(GetpApp());
OSL_ENSURE( pD, "no desktop ?!?" );
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index f255562..78c6e71 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -399,10 +399,12 @@ 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 );
- if ( m_aStrParams[eParam].getLength() )
- m_aStrParams[eParam] += ::rtl::OUString::valueOf( (sal_Unicode)APPEVENT_PARAM_DELIMITER );
- m_aStrParams[eParam] += aParam;
+ if ( aParamBuf.getLength() )
+ aParamBuf.append('\n');
+ aParamBuf.append(aParam);
+ m_aStrParams[eParam] = aParamBuf.makeStringAndClear();
m_aStrSetParams[eParam] = sal_True;
}
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 9d1ea0f..af30005 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -634,9 +634,11 @@ OfficeIPCThread::~OfficeIPCThread()
static void AddURLToStringList( const rtl::OUString& aURL, rtl::OUString& aStringList )
{
- if ( aStringList.getLength() )
- aStringList += ::rtl::OUString::valueOf( (sal_Unicode)APPEVENT_PARAM_DELIMITER );
- aStringList += aURL;
+ ::rtl::OUStringBuffer aStringListBuf(aStringList);
+ if ( aStringListBuf.getLength() )
+ aStringListBuf.append('\n');
+ aStringListBuf.append(aURL);
+ aStringList = aStringListBuf.makeStringAndClear();
}
void OfficeIPCThread::SetReady(OfficeIPCThread* pThread)
@@ -713,8 +715,7 @@ 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( aEmpty, aEmpty,
- "QUICKSTART", aEmpty );
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUICKSTART")));
ImplPostForeignAppEvent( pAppEvent );
}
@@ -722,16 +723,14 @@ void SAL_CALL OfficeIPCThread::run()
OUString aAcceptString;
if ( aCmdLineArgs->GetAcceptString(aAcceptString) ) {
ApplicationEvent* pAppEvent =
- new ApplicationEvent( aEmpty, aEmpty,
- "ACCEPT", aAcceptString );
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACCEPT")), aAcceptString);
ImplPostForeignAppEvent( pAppEvent );
}
// handle acceptor removal
OUString aUnAcceptString;
if ( aCmdLineArgs->GetUnAcceptString(aUnAcceptString) ) {
ApplicationEvent* pAppEvent =
- new ApplicationEvent( aEmpty, aEmpty,
- "UNACCEPT", aUnAcceptString );
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNACCEPT")), aUnAcceptString);
ImplPostForeignAppEvent( pAppEvent );
}
@@ -740,7 +739,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( aEmpty, aEmpty, "HELP", aEmpty );
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HELP")));
ImplPostForeignAppEvent( pAppEvent );
}
#endif
@@ -839,8 +838,7 @@ void SAL_CALL OfficeIPCThread::run()
aHelpURLBuffer.appendAscii("&System=WIN");
#endif
ApplicationEvent* pAppEvent =
- new ApplicationEvent( aEmpty, aEmpty,
- "OPENHELPURL", aHelpURLBuffer.makeStringAndClear());
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPENHELPURL")), aHelpURLBuffer.makeStringAndClear());
ImplPostForeignAppEvent( pAppEvent );
}
}
@@ -878,7 +876,7 @@ void SAL_CALL OfficeIPCThread::run()
{
// no document was sent, just bring Office to front
ApplicationEvent* pAppEvent =
- new ApplicationEvent( aEmpty, aEmpty, "APPEAR", aEmpty );
+ new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("APPEAR")));
ImplPostForeignAppEvent( pAppEvent );
}
@@ -919,7 +917,7 @@ static void AddToDispatchList(
sal_Int32 nIndex = 0;
do
{
- OUString aToken = aRequestList.getToken( 0, APPEVENT_PARAM_DELIMITER, nIndex );
+ OUString aToken = aRequestList.getToken( 0, '\n', nIndex );
if ( aToken.getLength() > 0 )
rDispatchList.push_back(
DispatchWatcher::DispatchRequest( nType, aToken, cwdUrl, aParam, aFactory ));
@@ -974,7 +972,7 @@ static void AddConversionsToDispatchList(
sal_Int32 nIndex = 0;
do
{
- OUString aToken = rRequestList.getToken( 0, APPEVENT_PARAM_DELIMITER, nIndex );
+ OUString aToken = rRequestList.getToken( 0, '\n', nIndex );
if ( aToken.getLength() > 0 )
rDispatchList.push_back(
DispatchWatcher::DispatchRequest( nType, aToken, cwdUrl, aParam, rFactory ));
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index 5dbbdd0..f7d3c0e 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -265,23 +265,33 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent,
aEvent += '(';
if ( rCmd.CompareIgnoreCaseToAscii( aEvent, aEvent.Len() ) == COMPARE_EQUAL )
{
- String aData( rCmd );
- aData.Erase( 0, aEvent.Len() );
- if ( aData.Len() > 2 )
+ ::rtl::OUStringBuffer aData( rCmd );
+ aData.remove( 0, aEvent.Len() );
+ if ( aData.getLength() > 2 )
{
// Transform into the ApplicationEvent Format
- aData.Erase( aData.Len()-1, 1 );
- for ( sal_uInt16 n = 0; n < aData.Len(); ++n )
+ aData.remove( aData.getLength() - 1, 1 );
+ for ( sal_Int32 n = 0; n < aData.getLength(); )
{
- if ( aData.GetChar(n) == 0x0022 ) // " = 22h
- for ( ; aData.GetChar(++n) != 0x0022 ; )
- /* empty loop */ ;
- else if ( aData.GetChar(n) == 0x0020 ) // SPACE = 20h
- aData.SetChar(n, '\n');
+ switch ( aData[n] == '"' )
+ {
+ case '"':
+ aData.remove( n, 1 );
+ while ( n < aData.getLength() && aData[n] != '"' )
+ ++n;
+ if ( n < aData.getLength() )
+ aData.remove( n, 1 );
+ break;
+ case ' ':
+ aData[n++] = '\n';
+ break;
+ default:
+ ++n;
+ break;
+ }
}
- aData.EraseAllChars( 0x0022 );
- ApplicationAddress aAddr;
- rAppEvent = ApplicationEvent( String(), aAddr, U2S(rEvent), aData );
+
+ rAppEvent = ApplicationEvent(rEvent, aData.makeStringAndClear());
return sal_True;
}
}
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm
index 612aca6..e2da47c 100644
--- a/vcl/aqua/source/app/vclnsapp.mm
+++ b/vcl/aqua/source/app/vclnsapp.mm
@@ -314,8 +314,7 @@
const rtl::OUString aFile( GetOUString( pFile ) );
if( ! AquaSalInstance::isOnCommandLine( aFile ) )
{
- const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
- APPEVENT_OPEN_STRING, aFile );
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFile);
AquaSalInstance::aAppEventList.push_back( pAppEvent );
}
return YES;
@@ -335,7 +334,7 @@
if( ! AquaSalInstance::isOnCommandLine( aFile ) )
{
if( aFileList.getLength() > 0 )
- aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
+ aFileList.append('\n');
aFileList.append( aFile );
}
}
@@ -345,8 +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( String(), ApplicationAddress(),
- APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() );
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFileList.makeStringAndClear());
AquaSalInstance::aAppEventList.push_back( pAppEvent );
}
}
@@ -355,8 +353,7 @@
{
(void)app;
const rtl::OUString aFile( GetOUString( pFile ) );
- const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
- APPEVENT_PRINT_STRING, aFile );
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)), aFile);
AquaSalInstance::aAppEventList.push_back( pAppEvent );
return YES;
}
@@ -374,11 +371,10 @@
while( (pFile = [it nextObject]) != nil )
{
if( aFileList.getLength() > 0 )
- aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
+ aFileList.append('\n');
aFileList.append( GetOUString( pFile ) );
}
- const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
- APPEVENT_PRINT_STRING, aFileList.makeStringAndClear() );
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_PRINT_STRING)), 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]
@@ -402,7 +398,7 @@
if( aReply == NSTerminateNow )
{
- ApplicationEvent aEv( String(), ApplicationAddress(), ByteString( "PRIVATE:DOSHUTDOWN" ), String() );
+ ApplicationEvent aEv(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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 d719ec5..50aa9a6 100644
--- a/vcl/aqua/source/window/salmenu.cxx
+++ b/vcl/aqua/source/window/salmenu.cxx
@@ -69,15 +69,13 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
}
else
{
- String aDialog;
+ rtl::OUString aDialog;
if( nDialog == SHOWDIALOG_ID_ABOUT )
- aDialog = String( RTL_CONSTASCII_USTRINGPARAM( "ABOUT" ) );
+ aDialog = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABOUT"));
else if( nDialog == SHOWDIALOG_ID_PREFERENCES )
- aDialog = String( RTL_CONSTASCII_USTRINGPARAM( "PREFERENCES" ) );
- const ApplicationEvent* pAppEvent = new ApplicationEvent( String(),
- ApplicationAddress(),
- ByteString( "SHOWDIALOG" ),
- aDialog );
+ aDialog = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PREFERENCES"));
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHOWDIALOG")), aDialog);
AquaSalInstance::aAppEventList.push_back( pAppEvent );
}
}
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index 1cc0a40..fb32a8b 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -97,105 +97,37 @@ typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC };
#endif
-class VCL_DLLPUBLIC ApplicationAddress
-{
-friend class Application;
-protected:
- UniString aHostName;
- UniString aDisplayName;
- UniString aDomainName;
- int nPID;
-
-public:
- ApplicationAddress();
- ApplicationAddress( const UniString& rDomain );
- ApplicationAddress( const UniString& rHost,
- const UniString& rDisp,
- const UniString& rDomain );
- ApplicationAddress( const UniString& rHost, int nPID );
-
- const UniString& GetHost() const { return aHostName; }
- const UniString& GetDisplay() const { return aDisplayName; }
- const UniString& GetDomain() const { return aDomainName; }
- int GetPID() const { return nPID; }
-
- sal_Bool IsConnectToSame( const ApplicationAddress& rAdr ) const;
-};
-
-inline ApplicationAddress::ApplicationAddress()
-{
- nPID = 0;
-}
-
-inline ApplicationAddress::ApplicationAddress( const UniString& rDomain )
-{
- aDomainName = rDomain;
- nPID = 0;
-}
-
-inline ApplicationAddress::ApplicationAddress( const UniString& rHost,
- const UniString& rDisp,
- const UniString& rDomain )
-{
- aHostName = rHost;
- aDisplayName = rDisp;
- aDomainName = rDomain;
- nPID = 0;
-}
-
-inline ApplicationAddress::ApplicationAddress( const UniString& rHost, int nPIDPar )
-{
- aHostName = rHost;
- nPID = nPIDPar;
-}
-
-inline sal_Bool ApplicationAddress::IsConnectToSame( const ApplicationAddress& rAdr ) const
-{
- if ( nPID && ((nPID == rAdr.nPID) && (aHostName.Equals( rAdr.aHostName))) )
- return sal_True;
- else
- return sal_False;
-}
-
-#define APPEVENT_PARAM_DELIMITER '\n'
-
#define APPEVENT_OPEN_STRING "Open"
#define APPEVENT_PRINT_STRING "Print"
class VCL_DLLPUBLIC ApplicationEvent
{
-private:
- UniString aSenderAppName; // Absender Applikationsname
- rtl::OString m_aEvent; // Event
- UniString aData; // Uebertragene Daten
- ApplicationAddress aAppAddr; // Absender Addresse
+ rtl::OUString aEvent;
+ rtl::OUString aData;
+ std::vector<rtl::OUString> aParams;
+ ApplicationEvent();
public:
- ApplicationEvent() {}
- ApplicationEvent( const UniString& rSenderAppName,
- const ApplicationAddress& rAppAddr,
- const rtl::OString& rEvent,
- const UniString& rData );
-
- const UniString& GetSenderAppName() const { return aSenderAppName; }
- const rtl::OString& GetEvent() const { return m_aEvent; }
- const UniString& GetData() const { return aData; }
- const ApplicationAddress& GetAppAddress() const { return aAppAddr; }
-
- sal_uInt16 GetParamCount() const { return aData.GetTokenCount( APPEVENT_PARAM_DELIMITER ); }
- UniString GetParam( sal_uInt16 nParam ) const { return aData.GetToken( nParam, APPEVENT_PARAM_DELIMITER ); }
-};
+ ApplicationEvent(const rtl::OUString& 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;
+ }
+ }
+ }
-inline ApplicationEvent::ApplicationEvent( const UniString& rSenderAppName,
- const ApplicationAddress& rAppAddr,
- const rtl::OString& rEvent,
- const UniString& rData ) :
- aSenderAppName( rSenderAppName ),
- m_aEvent( rEvent ),
- aData( rData ),
- aAppAddr( rAppAddr )
-{
-}
+ const rtl::OUString& GetEvent() const { return aEvent; }
+ const rtl::OUString& GetData() const { return aData; }
+ const std::vector<rtl::OUString>& GetParams() const { return aParams; }
+};
class VCL_DLLPUBLIC PropertyHandler
{
diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm
index c7461d9..c47669e 100644
--- a/vcl/ios/source/app/vcluiapp.mm
+++ b/vcl/ios/source/app/vcluiapp.mm
@@ -79,8 +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( String(), ApplicationAddress(),
- APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() );
+ const ApplicationEvent* pAppEvent = new ApplicationEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(APPEVENT_OPEN_STRING)), aFileList.makeStringAndClear());
IosSalInstance::aAppEventList.push_back( pAppEvent );
}
}
commit fb17dce09e29c4518129587d347cc3787f74c396
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Nov 3 16:08:53 2011 +0100
Added OUStringBuffer::append(char) so that b.append(' ') does what one expects.
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 47569e5..60bb750 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -421,6 +421,24 @@ public:
}
/**
+ Appends the string representation of the ASCII <code>char</code>
+ argument to this string buffer.
+
+ The argument is appended to the contents of this string buffer.
+ The length of this string buffer increases by <code>1</code>.
+
+ @param ch an ASCII <code>char</code>.
+ @return this string buffer.
+
+ @since LibreOffice 3.5
+ */
+ OUStringBuffer & append(char c)
+ {
+ OSL_ASSERT(static_cast< unsigned char >(c) <= 0x7F);
+ return append(sal_Unicode(c));
+ }
+
+ /**
Appends the string representation of the <code>char</code>
argument to this string buffer.
diff --git a/sal/qa/rtl/oustringbuffer/makefile.mk b/sal/qa/rtl/oustringbuffer/makefile.mk
index 80cff08..5e72969 100644
--- a/sal/qa/rtl/oustringbuffer/makefile.mk
+++ b/sal/qa/rtl/oustringbuffer/makefile.mk
@@ -46,6 +46,7 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS)
SHL1TARGET := $(TARGET)
SHL1OBJS := \
+ $(SLO)$/test_oustringbuffer_appendchar.obj \
$(SLO)$/test_oustringbuffer_utf32.obj \
$(SLO)$/test_oustringbuffer_tostring.obj \
$(SLO)$/test_oustringbuffer_noadditional.obj
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
new file mode 100644
index 0000000..f936aec
--- /dev/null
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Stephan Bergmann, Red Hat <sbergman at redhat.com> (initial
+ * developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "precompiled_sal.hxx"
+#include "sal/config.h"
+#include "sal/precppunit.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestAssert.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "rtl/ustrbuf.hxx"
+
+namespace test { namespace oustringbuffer {
+
+class AppendChar: public CppUnit::TestFixture {
+private:
+ void testAppendChar();
+
+ CPPUNIT_TEST_SUITE(AppendChar);
+ CPPUNIT_TEST(testAppendChar);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void AppendChar::testAppendChar() {
+ // Check that append('a') does not unexpectedly pick
+ // append(sal_Int32 i, sal_Int16 radix = 10):
+ rtl::OUStringBuffer s;
+ s.append('a');
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(sal_Unicode('a'), s[0]);
+}
+
+} }
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::AppendChar);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list