summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian K <sumuthu@novell.com>2010-08-25 23:38:54 +0200
committerJan Holesovsky <kendy@suse.cz>2010-08-26 13:08:40 +0200
commit09877bede0535bd8b6131e5276177f2c0e44078d (patch)
tree22ed9861914711e99b091e15d87e2328b9cd8ce7
parent5d7c99f0c7f5fcc147fe45f01efbc7b7607784e8 (diff)
desktop-infilter-option.diff: Force input filter during the batch conversion.OOO_BUILD_3_2_98_0
-rw-r--r--desktop/source/app/app.cxx1
-rw-r--r--desktop/source/app/cmdlineargs.cxx12
-rw-r--r--desktop/source/app/cmdlineargs.hxx2
-rw-r--r--desktop/source/app/cmdlinehelp.cxx3
-rw-r--r--desktop/source/app/dispatchwatcher.cxx21
-rw-r--r--desktop/source/app/dispatchwatcher.hxx1
-rw-r--r--desktop/source/app/officeipcthread.cxx1
-rw-r--r--desktop/source/app/officeipcthread.hxx1
8 files changed, 41 insertions, 1 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 6e8d53e1d0..b659de31c1 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 89348723a6..8c93f46dbc 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 f6c2845d57..f357dad523 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 cb96e6f3f0..0869565ce7 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 9bcba45eed..e2a6429a3b 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 62828a5a0f..cbcb90057c 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 56d02e4c28..b86d9452f2 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 4f442a988a..fe61c935f9 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
};