diff options
author | Muthu Subramanian K <sumuthu@novell.com> | 2010-08-25 23:38:54 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-08-26 13:08:40 +0200 |
commit | 27828d6293f0840d563b45f1eda0b730c72ea58f (patch) | |
tree | 4f5ae7c676c12de6720a6321d160d2c12ebcc421 | |
parent | 6a96c05eca4d313795978297ba963f4aeb41ce53 (diff) |
desktop-infilter-option.diff: Force input filter during the batch conversion.
Notes
Notes:
split repo tag: libs-core_OOO_BUILD_3_2_98_0
-rw-r--r-- | desktop/source/app/app.cxx | 1 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 12 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/cmdlinehelp.cxx | 3 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 21 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 1 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 1 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.hxx | 1 |
8 files changed, 41 insertions, 1 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 816254e2896b..a3fe89549164 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2567,6 +2567,7 @@ void Desktop::OpenClients() pArgs->GetConversionList( aRequest.aConversionList ); pArgs->GetConversionParams( aRequest.aConversionParams ); pArgs->GetConversionOut( aRequest.aConversionOut ); + pArgs->GetInFilter( aRequest.aInFilter ); if ( aRequest.aOpenList.getLength() > 0 || aRequest.aViewList.getLength() > 0 || diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 422c4be5994e..a564ccb824c0 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -539,6 +539,11 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& return sal_True; } #endif + else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-infilter=" )) + { + AddStringListParam_Impl( CMD_STRINGPARAM_INFILTER, aArgStr.Copy( 10 ) ); + return sal_True; + } else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" )) { AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) ); @@ -936,6 +941,13 @@ sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ]; } +sal_Bool CommandLineArgs::GetInFilter( ::rtl::OUString& rPara ) const +{ + osl::MutexGuard aMutexGuard( m_aMutex ); + rPara = m_aStrParams[ CMD_STRINGPARAM_INFILTER ]; + return m_aStrSetParams[ CMD_STRINGPARAM_INFILTER ]; +} + sal_Bool CommandLineArgs::GetConversionList( ::rtl::OUString& rPara ) const { osl::MutexGuard aMutexGuard( m_aMutex ); diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 2886236fe43e..fecd38302639 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -93,6 +93,7 @@ class CommandLineArgs CMD_STRINGPARAM_CONVERSIONLIST, CMD_STRINGPARAM_CONVERSIONPARAMS, CMD_STRINGPARAM_CONVERSIONOUT, + CMD_STRINGPARAM_INFILTER, CMD_STRINGPARAM_DISPLAY, CMD_STRINGPARAM_LANGUAGE, CMD_STRINGPARAM_COUNT // must be last element! @@ -172,6 +173,7 @@ class CommandLineArgs sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; + sal_Bool GetInFilter( ::rtl::OUString& rPara ) const; sal_Bool GetConversionList( ::rtl::OUString& rPara ) const; sal_Bool GetConversionParams( ::rtl::OUString& rPara ) const; sal_Bool GetConversionOut( ::rtl::OUString& rPara ) const; diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 6218c1146e6e..98de60fb658e 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -116,6 +116,9 @@ namespace desktop "-unaccept=<accept-string>\n"\ " Close an acceptor that was created with -accept=<accept-string>\n"\ " Use -unnaccept=all to close all open acceptors\n"\ + "-infilter=<filter>\n"\ + " Force an input filter type if possible\n"\ + " Eg. -infilter=\"Calc Office Open XML\"\n"\ "-convert-to output_file_extension[:output_filter_name] [-outdir ouput_dir] files\n"\ " Batch convert files.\n"\ " If -outdir is not specified then current working dir is used as output_dir.\n"\ diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 0f8dfb4888b2..01be477e637a 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -182,6 +182,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch DispatchList::const_iterator p; std::vector< DispatchHolder > aDispatches; ::rtl::OUString aAsTemplateArg( RTL_CONSTASCII_USTRINGPARAM( "AsTemplate")); + sal_Bool bSetInputFilter = sal_False; + ::rtl::OUString aForcedInputFilter; for ( p = aDispatchRequestsList.begin(); p != aDispatchRequestsList.end(); p++ ) { @@ -192,6 +194,15 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch if ( aDispatchRequest.aPreselectedFactory.getLength() ) nCount++; + // Set Input Filter + if ( aDispatchRequest.aRequestType == REQUEST_INFILTER ) + { + bSetInputFilter = sal_True; + aForcedInputFilter = aDispatchRequest.aURL; + OfficeIPCThread::RequestsCompleted( 1 ); + continue; + } + // we need more properties for a print/print to request if ( aDispatchRequest.aRequestType == REQUEST_PRINT || aDispatchRequest.aRequestType == REQUEST_PRINTTO || @@ -378,8 +389,16 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch aArgs[nIndex].Value <<= sal_True; } - // This is a synchron loading of a component so we don't have to deal with our statusChanged listener mechanism. + // Force input filter, if possible + if( bSetInputFilter ) + { + sal_Int32 nIndex = aArgs.getLength(); + aArgs.realloc(nIndex+1); + aArgs[nIndex].Name=OUString::createFromAscii("FilterName"); + aArgs[nIndex].Value <<= aForcedInputFilter; + } + // This is a synchron loading of a component so we don't have to deal with our statusChanged listener mechanism. try { xDoc = Reference < XPrintable >( ::comphelper::SynchronousDispatch::dispatch( xDesktop, aName, aTarget, 0, aArgs ), UNO_QUERY ); diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 5a5c028c9f76..8cdbc520ab85 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -77,6 +77,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame: REQUEST_FORCEOPEN, REQUEST_FORCENEW, REQUEST_CONVERSION, + REQUEST_INFILTER, REQUEST_BATCHPRINT }; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 69f2c01ba3cc..e140432d1618 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -1011,6 +1011,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ rtl::OUString aEmpty; // Create dispatch list for dispatch watcher + AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aInFilter, DispatchWatcher::REQUEST_INFILTER, aEmpty, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aOpenList, DispatchWatcher::REQUEST_OPEN, aEmpty, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aViewList, DispatchWatcher::REQUEST_VIEW, aEmpty, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aStartList, DispatchWatcher::REQUEST_START, aEmpty, aRequest.aModule ); diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index 5c01a8ac0e21..a5e1c9059454 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -69,6 +69,7 @@ struct ProcessDocumentsRequest ::rtl::OUString aConversionList; ::rtl::OUString aConversionParams; ::rtl::OUString aConversionOut; + ::rtl::OUString aInFilter; ::osl::Condition *pcProcessed; // pointer condition to be set when the request has been processed }; |