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

Proper handling of multiple --accept arguments

...and some further clean up of needlessly complex class CommandLineArgs.
üst fb68711f
...@@ -2970,7 +2970,7 @@ void Desktop::OpenSplashScreen() ...@@ -2970,7 +2970,7 @@ void Desktop::OpenSplashScreen()
// Which splash to use // Which splash to use
OUString aSplashService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.SplashScreen" )); OUString aSplashService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.SplashScreen" ));
if ( !rCmdLine.GetStringParam( CommandLineArgs::CMD_STRINGPARAM_SPLASHPIPE ).isEmpty() ) if ( !rCmdLine.GetSplashPipe().isEmpty() )
aSplashService = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.PipeSplashScreen")); aSplashService = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.PipeSplashScreen"));
bVisible = sal_True; bVisible = sal_True;
......
...@@ -217,30 +217,28 @@ void Desktop::RegisterServices( Reference< XMultiServiceFactory >& xSMgr ) ...@@ -217,30 +217,28 @@ void Desktop::RegisterServices( Reference< XMultiServiceFactory >& xSMgr )
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::registerServices" ); RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::registerServices" );
// read command line parameters // read command line parameters
::rtl::OUString conDcp;
::rtl::OUString aClientDisplay; ::rtl::OUString aClientDisplay;
::rtl::OUString aTmpString;
sal_Bool bHeadlessMode = sal_False; sal_Bool bHeadlessMode = sal_False;
// interpret command line arguments // interpret command line arguments
CommandLineArgs& rCmdLine = GetCommandLineArgs(); CommandLineArgs& rCmdLine = GetCommandLineArgs();
// read accept string from configuration
conDcp = SvtStartOptions().GetConnectionURL();
if ( rCmdLine.GetAcceptString( aTmpString ))
conDcp = aTmpString;
// Headless mode for FAT Office // Headless mode for FAT Office
bHeadlessMode = rCmdLine.IsHeadless(); bHeadlessMode = rCmdLine.IsHeadless();
if ( bHeadlessMode ) if ( bHeadlessMode )
Application::EnableHeadlessMode(false); Application::EnableHeadlessMode(false);
if ( !conDcp.isEmpty() ) // read accept string from configuration
rtl::OUString conDcpCfg(SvtStartOptions().GetConnectionURL());
if (!conDcpCfg.isEmpty()) {
createAcceptor(conDcpCfg);
}
std::vector< ::rtl::OUString > const & conDcp = rCmdLine.GetAccept();
for (std::vector< ::rtl::OUString >::const_iterator i(conDcp.begin());
i != conDcp.end(); ++i)
{ {
// accept incoming connections (scripting and one rvp) createAcceptor(*i);
RTL_LOGFILE_CONTEXT( aLog, "desktop (lo119109) desktop::Desktop::createAcceptor()" );
createAcceptor(conDcp);
} }
// improves parallel processing on Sun ONE Webtop // improves parallel processing on Sun ONE Webtop
...@@ -257,7 +255,7 @@ void Desktop::RegisterServices( Reference< XMultiServiceFactory >& xSMgr ) ...@@ -257,7 +255,7 @@ void Desktop::RegisterServices( Reference< XMultiServiceFactory >& xSMgr )
if ( !rEnum.is() ) if ( !rEnum.is() )
{ {
// Reset server parameter so it is ignored in the furthermore startup process // Reset server parameter so it is ignored in the furthermore startup process
rCmdLine.SetBoolParam( CommandLineArgs::CMD_BOOLPARAM_SERVER, sal_False ); rCmdLine.ClearServer();
} }
} }
} }
......
...@@ -44,7 +44,6 @@ class CommandLineArgs ...@@ -44,7 +44,6 @@ class CommandLineArgs
CMD_BOOLPARAM_MINIMIZED = 0, CMD_BOOLPARAM_MINIMIZED = 0,
CMD_BOOLPARAM_INVISIBLE, CMD_BOOLPARAM_INVISIBLE,
CMD_BOOLPARAM_NORESTORE, CMD_BOOLPARAM_NORESTORE,
CMD_BOOLPARAM_SERVER,
CMD_BOOLPARAM_HEADLESS, CMD_BOOLPARAM_HEADLESS,
CMD_BOOLPARAM_QUICKSTART, CMD_BOOLPARAM_QUICKSTART,
CMD_BOOLPARAM_NOQUICKSTART, CMD_BOOLPARAM_NOQUICKSTART,
...@@ -79,8 +78,6 @@ class CommandLineArgs ...@@ -79,8 +78,6 @@ class CommandLineArgs
{ {
CMD_STRINGPARAM_PORTAL = 0, CMD_STRINGPARAM_PORTAL = 0,
CMD_STRINGPARAM_SPLASHPIPE, CMD_STRINGPARAM_SPLASHPIPE,
CMD_STRINGPARAM_ACCEPT,
CMD_STRINGPARAM_UNACCEPT,
CMD_STRINGPARAM_USERDIR, CMD_STRINGPARAM_USERDIR,
CMD_STRINGPARAM_CLIENTDISPLAY, CMD_STRINGPARAM_CLIENTDISPLAY,
CMD_STRINGPARAM_OPENLIST, CMD_STRINGPARAM_OPENLIST,
...@@ -128,10 +125,7 @@ class CommandLineArgs ...@@ -128,10 +125,7 @@ class CommandLineArgs
boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; } boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; }
// generic methods to access parameter void ClearServer();
void SetBoolParam( BoolParam eParam, sal_Bool bNewValue );
const rtl::OUString& GetStringParam( StringParam eParam ) const;
// Access to bool parameters // Access to bool parameters
sal_Bool IsMinimized() const; sal_Bool IsMinimized() const;
...@@ -168,8 +162,9 @@ class CommandLineArgs ...@@ -168,8 +162,9 @@ class CommandLineArgs
// Access to string parameters // Access to string parameters
sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const; sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const;
sal_Bool GetAcceptString( ::rtl::OUString& rPara) const; rtl::OUString GetSplashPipe() const;
sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const; std::vector< rtl::OUString > const & GetAccept() const;
std::vector< rtl::OUString > const & GetUnaccept() const;
sal_Bool GetOpenList( ::rtl::OUString& rPara) const; sal_Bool GetOpenList( ::rtl::OUString& rPara) const;
sal_Bool GetViewList( ::rtl::OUString& rPara) const; sal_Bool GetViewList( ::rtl::OUString& rPara) const;
sal_Bool GetStartList( ::rtl::OUString& rPara) const; sal_Bool GetStartList( ::rtl::OUString& rPara) const;
...@@ -203,7 +198,7 @@ class CommandLineArgs ...@@ -203,7 +198,7 @@ class CommandLineArgs
sal_Bool InterpretCommandLineParameter( const ::rtl::OUString&, ::rtl::OUString& ); sal_Bool InterpretCommandLineParameter( const ::rtl::OUString&, ::rtl::OUString& );
void ParseCommandLine_Impl( Supplier& supplier ); void ParseCommandLine_Impl( Supplier& supplier );
void ResetParamValues(); void InitParamValues();
sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const; sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const;
void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ); void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam );
...@@ -215,7 +210,11 @@ class CommandLineArgs ...@@ -215,7 +210,11 @@ class CommandLineArgs
sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline
Count m_eArgumentCount; // Number of Args Count m_eArgumentCount; // Number of Args
bool m_bDocumentArgs; // A document creation/open/load arg is used bool m_bDocumentArgs; // A document creation/open/load arg is used
std::vector< rtl::OUString > m_accept;
std::vector< rtl::OUString > m_unaccept;
mutable ::osl::Mutex m_aMutex; mutable ::osl::Mutex m_aMutex;
bool m_server;
// static definition for groups where only one member can be true // static definition for groups where only one member can be true
static GroupDefinition m_pGroupDefinitions[ CMD_GRPID_COUNT ]; static GroupDefinition m_pGroupDefinitions[ CMD_GRPID_COUNT ];
......
...@@ -725,17 +725,24 @@ void OfficeIPCThread::execute() ...@@ -725,17 +725,24 @@ void OfficeIPCThread::execute()
} }
// handle request for acceptor // handle request for acceptor
OUString aAcceptString; std::vector< rtl::OUString > const & accept = aCmdLineArgs->
if ( aCmdLineArgs->GetAcceptString(aAcceptString) ) { GetAccept();
for (std::vector< rtl::OUString >::const_iterator i(accept.begin());
i != accept.end(); ++i)
{
ApplicationEvent* pAppEvent = new ApplicationEvent( ApplicationEvent* pAppEvent = new ApplicationEvent(
ApplicationEvent::TYPE_ACCEPT, aAcceptString); ApplicationEvent::TYPE_ACCEPT, *i);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( pAppEvent );
} }
// handle acceptor removal // handle acceptor removal
OUString aUnAcceptString; std::vector< rtl::OUString > const & unaccept = aCmdLineArgs->
if ( aCmdLineArgs->GetUnAcceptString(aUnAcceptString) ) { GetUnaccept();
for (std::vector< rtl::OUString >::const_iterator i(
unaccept.begin());
i != unaccept.end(); ++i)
{
ApplicationEvent* pAppEvent = new ApplicationEvent( ApplicationEvent* pAppEvent = new ApplicationEvent(
ApplicationEvent::TYPE_UNACCEPT, aUnAcceptString); ApplicationEvent::TYPE_UNACCEPT, *i);
ImplPostForeignAppEvent( pAppEvent ); ImplPostForeignAppEvent( 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