[ooo-build-commit] patches/dev300

Florian Reuter flr at kemper.freedesktop.org
Tue Jun 30 03:14:55 PDT 2009


 patches/dev300/apply                            |    1 
 patches/dev300/desktop-cmd-bulk-conversion.diff |  324 ++++++++++++++++++++++++
 2 files changed, 325 insertions(+)

New commits:
commit 70a514c000a9880d3b43f23b5c35050e643d5b1d
Author: Florian Reuter <freuter at linux-cfjm.site>
Date:   Tue Jun 30 12:12:08 2009 +0200

    added -"bulk" command line switch for better testing
    
    * patches/dev300/apply:
    * patches/dev300/desktop-cmd-bulk-conversion.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index ad8d31b..1a78a33 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3275,3 +3275,4 @@ crosswin32-vcl-mingw.diff
 
 [ Experimental ]
 experimental_ooapi.diff, flr
+desktop-cmd-bulk-conversion.diff, flr
diff --git a/patches/dev300/desktop-cmd-bulk-conversion.diff b/patches/dev300/desktop-cmd-bulk-conversion.diff
new file mode 100644
index 0000000..c6dcf69
--- /dev/null
+++ b/patches/dev300/desktop-cmd-bulk-conversion.diff
@@ -0,0 +1,324 @@
+diff --git desktop/source/app/app.cxx desktop/source/app/app.cxx
+index dc7d7ef..1648da1 100644
+--- desktop/source/app/app.cxx
++++ desktop/source/app/app.cxx
+@@ -2468,6 +2468,8 @@ void Desktop::OpenClients()
+         pArgs->GetPrinterName( aRequest.aPrinterName );
+         pArgs->GetForceOpenList( aRequest.aForceOpenList );
+         pArgs->GetForceNewList( aRequest.aForceNewList );
++        pArgs->GetConversionList( aRequest.aConversionList );
++        pArgs->GetConversionParams( aRequest.aConversionParams );
+ 
+         if ( aRequest.aOpenList.getLength() > 0 ||
+              aRequest.aViewList.getLength() > 0 ||
+@@ -2475,7 +2477,8 @@ void Desktop::OpenClients()
+              aRequest.aPrintList.getLength() > 0 ||
+              aRequest.aForceOpenList.getLength() > 0 ||
+              aRequest.aForceNewList.getLength() > 0 ||
+-             ( aRequest.aPrintToList.getLength() > 0 && aRequest.aPrinterName.getLength() > 0 ))
++             ( aRequest.aPrintToList.getLength() > 0 && aRequest.aPrinterName.getLength() > 0 ) ||
++	     ( aRequest.aConversionList.getLength() > 0 && aRequest.aConversionParams.getLength() > 0 ))
+         {
+             bLoaded = sal_True;
+ 
+@@ -2825,7 +2828,8 @@ void Desktop::OpenSplashScreen()
+          !pCmdLine->IsNoLogo() &&
+          !pCmdLine->IsTerminateAfterInit() &&
+          !pCmdLine->GetPrintList( aTmpString ) &&
+-         !pCmdLine->GetPrintToList( aTmpString ) )
++         !pCmdLine->GetPrintToList( aTmpString ) &&
++	 !pCmdLine->GetConversionList( aTmpString ))
+     {
+         // Determine application name from command line parameters
+         OUString aAppName;
+diff --git desktop/source/app/cmdlineargs.cxx desktop/source/app/cmdlineargs.cxx
+index 88cb6bf..0d1f027 100644
+--- desktop/source/app/cmdlineargs.cxx
++++ desktop/source/app/cmdlineargs.cxx
+@@ -154,6 +154,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+     sal_Bool	bForceOpenEvent	= sal_False;
+     sal_Bool	bForceNewEvent	= sal_False;
+     sal_Bool 	bDisplaySpec	= sal_False;
++    sal_Bool    bConversionEvent= sal_False;
++    sal_Bool    bConversionParamsEvent=sal_False;
+ 
+     m_eArgumentCount = NONE;
+ 
+@@ -286,6 +288,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+                             bDisplaySpec	= sal_False;
+                     }
+                     #endif
++                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-bulk" ))
++                    {
++		      bOpenEvent = sal_False;
++		      bConversionEvent = sal_True;
++		      bConversionParamsEvent = sal_True;
++		    }
+                 }
+                 else
+                 {
+@@ -295,6 +303,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+                         AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
+                         bPrinterName = sal_False;
+                     }
++                    else if ( bConversionParamsEvent && bConversionEvent )
++                    {
++                        // first argument must be the the params
++                        AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONPARAMS, aArgStr );
++                        bConversionParamsEvent = sal_False;
++                    }
+                     else
+                     {
+ 						if( bOpenEvent || bViewEvent || bForceNewEvent || bForceOpenEvent )
+@@ -326,6 +340,10 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+                             bDisplaySpec = sal_False; // only one display, not a lsit
+                             bOpenEvent = sal_True;    // set back to standard
+                         }
++                        else if ( bConversionEvent )
++                            AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONLIST, aArgStr );
++                        else if ( bConversionParamsEvent )
++                            AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONPARAMS, aArgStr );
+                     }
+                 }
+             }
+@@ -870,6 +888,22 @@ sal_Bool CommandLineArgs::GetPrinterName( ::rtl::OUString& rPara ) const
+     return m_aStrSetParams[ CMD_STRINGPARAM_PRINTERNAME ];
+ }
+ 
++sal_Bool CommandLineArgs::GetConversionList( ::rtl::OUString& rPara ) const
++{
++    osl::MutexGuard  aMutexGuard( m_aMutex );
++    rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONLIST ];
++    return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONLIST ];
++}
++
++sal_Bool CommandLineArgs::GetConversionParams( ::rtl::OUString& rPara ) const
++{
++    osl::MutexGuard  aMutexGuard( m_aMutex );
++    rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
++    return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
++}
++
++
++
+ sal_Bool CommandLineArgs::IsEmpty() const
+ {
+     osl::MutexGuard  aMutexGuard( m_aMutex );
+diff --git desktop/source/app/cmdlineargs.hxx desktop/source/app/cmdlineargs.hxx
+index 9b5d046..f98becf 100644
+--- desktop/source/app/cmdlineargs.hxx
++++ desktop/source/app/cmdlineargs.hxx
+@@ -93,6 +93,8 @@ class CommandLineArgs
+             CMD_STRINGPARAM_VERSION,
+             CMD_STRINGPARAM_PRINTTOLIST,
+             CMD_STRINGPARAM_PRINTERNAME,
++	    CMD_STRINGPARAM_CONVERSIONLIST,
++	    CMD_STRINGPARAM_CONVERSIONPARAMS,	    
+             CMD_STRINGPARAM_DISPLAY,
+             CMD_STRINGPARAM_COUNT			// must be last element!
+         };
+@@ -171,6 +173,8 @@ class CommandLineArgs
+         sal_Bool				GetPrintList( ::rtl::OUString& rPara) const;
+         sal_Bool				GetPrintToList( ::rtl::OUString& rPara ) const;
+         sal_Bool				GetPrinterName( ::rtl::OUString& rPara ) const;
++        sal_Bool				GetConversionList( ::rtl::OUString& rPara ) const;
++        sal_Bool				GetConversionParams( ::rtl::OUString& rPara ) const;
+ 
+         // Special analyzed states (does not match directly to a command line parameter!)
+         sal_Bool                IsPrinting() const;
+diff --git desktop/source/app/dispatchwatcher.cxx desktop/source/app/dispatchwatcher.cxx
+index 891e756..cc87832 100644
+--- desktop/source/app/dispatchwatcher.cxx
++++ desktop/source/app/dispatchwatcher.cxx
+@@ -51,6 +51,7 @@
+ #include <com/sun/star/util/XURLTransformer.hpp>
+ #include <com/sun/star/document/MacroExecMode.hpp>
+ #include <com/sun/star/document/UpdateDocMode.hpp>
++#include <com/sun/star/frame/XStorable.hpp>
+ 
+ #include <tools/urlobj.hxx>
+ #include <comphelper/mediadescriptor.hxx>
+@@ -122,7 +123,7 @@ DispatchWatcher* DispatchWatcher::GetDispatchWatcher()
+ 
+ 
+ DispatchWatcher::DispatchWatcher()
+-    : m_nRequestCount(1)
++    : m_nRequestCount(0)
+ {
+ }
+ 
+@@ -142,11 +143,16 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+     std::vector< DispatchHolder >	aDispatches;
+     ::rtl::OUString					aAsTemplateArg( RTL_CONSTASCII_USTRINGPARAM( "AsTemplate"));
+ 
++    printf("executeDispatchRequests(bNoTerminate=%i)\n", bNoTerminate);
++    m_nRequestCount++;
++
+     for ( p = aDispatchRequestsList.begin(); p != aDispatchRequestsList.end(); p++ )
+     {
+         String					aPrinterName;
+         const DispatchRequest&	aDispatchRequest = *p;
+ 
++	printf("#aDispatchRequest\n");
++
+         // create parameter array
+         sal_Int32 nCount = 4;
+         if ( aDispatchRequest.aPreselectedFactory.getLength() )
+@@ -154,7 +160,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+ 
+         // we need more properties for a print/print to request
+         if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
+-             aDispatchRequest.aRequestType == REQUEST_PRINTTO  )
++             aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
++	     aDispatchRequest.aRequestType == REQUEST_CONVERSION)
+             nCount++;
+ 
+         Sequence < PropertyValue > aArgs( nCount );
+@@ -164,7 +171,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+         aArgs[0].Value <<= ::rtl::OUString::createFromAscii("private:OpenEvent");
+ 
+         if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
+-             aDispatchRequest.aRequestType == REQUEST_PRINTTO )
++             aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
++	     aDispatchRequest.aRequestType == REQUEST_CONVERSION)
+         {
+             aArgs[1].Name = ::rtl::OUString::createFromAscii("ReadOnly");
+             aArgs[2].Name = ::rtl::OUString::createFromAscii("OpenNewView");
+@@ -199,7 +207,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+         ::rtl::OUString aTarget( RTL_CONSTASCII_USTRINGPARAM("_default") );
+ 
+         if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
+-             aDispatchRequest.aRequestType == REQUEST_PRINTTO )
++             aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
++	     aDispatchRequest.aRequestType == REQUEST_CONVERSION)
+         {
+             // documents opened for printing are opened readonly because they must be opened as a new document and this
+             // document could be open already
+@@ -364,10 +373,38 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+                 OfficeIPCThread::RequestsCompleted( 1 );
+             }
+             else if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
+-                      aDispatchRequest.aRequestType == REQUEST_PRINTTO )
++                      aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
++		      aDispatchRequest.aRequestType == REQUEST_CONVERSION )
+             {
+                 if ( xDoc.is() )
+                 {
++		  if (aDispatchRequest.aRequestType == REQUEST_CONVERSION) {
++		    Reference< XStorable > xStorable( xDoc, UNO_QUERY );
++		    if (xStorable.is()) {		  
++		      rtl::OString aSource8 = ::rtl::OUStringToOString (aObj.GetFull(), RTL_TEXTENCODING_UTF8);
++		      INetURLObject aParam( aDispatchRequest.aPrinterName, INetURLObject::FSYS_DETECT);
++		      rtl::OUString aParamName=aParam.GetName(INetURLObject::DECODE_WITH_CHARSET);
++
++		      rtl::OUString aParamExt=aParam.GetExtension(INetURLObject::DECODE_WITH_CHARSET);
++		      rtl::OUString aFilterName(aParamName, aParamName.getLength()-aParamExt.getLength()-1);
++		      rtl::OString aFilterName8 = ::rtl::OUStringToOString (aFilterName, RTL_TEXTENCODING_UTF8);		      
++		      
++		      Sequence<PropertyValue> conversionProperties(2);
++		      conversionProperties[0].Name = ::rtl::OUString::createFromAscii("Overwrite");
++		      conversionProperties[0].Value <<= sal_True;
++		      
++		      conversionProperties[1].Name = ::rtl::OUString::createFromAscii("FilterName");
++		    conversionProperties[1].Value <<= aFilterName;
++		    
++		    INetURLObject aTargetURL(aParam);
++		    aTargetURL.SetName(aObj.GetName());
++		    aTargetURL.SetExtension(aParam.GetExtension());
++		    rtl::OString aTargetURL8 = ::rtl::OUStringToOString (aTargetURL.GetFull(), RTL_TEXTENCODING_UTF8);
++		    
++		    printf("convert %s->%s using %s\n", aSource8.getStr(), aTargetURL8.getStr(), aFilterName8.getStr());
++		    xStorable->storeToURL( aTargetURL.GetMainURL(INetURLObject::NO_DECODE), conversionProperties);
++		    }
++		  } else {
+                     if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+                     {
+                         // create the printer
+@@ -473,7 +510,7 @@ throw(::com::sun::star::uno::RuntimeException)
+ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException )
+ {
+     osl::ClearableMutexGuard aGuard( GetMutex() );
+-    sal_Int16 nCount = --m_nRequestCount;
++    sal_Int16 nCount = m_nRequestCount;
+     aGuard.clear();
+     OfficeIPCThread::RequestsCompleted( 1 );
+ /*
+diff --git desktop/source/app/dispatchwatcher.hxx desktop/source/app/dispatchwatcher.hxx
+index ef62dc2..3d3a619 100644
+--- desktop/source/app/dispatchwatcher.hxx
++++ desktop/source/app/dispatchwatcher.hxx
+@@ -78,7 +78,8 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
+             REQUEST_PRINT,
+             REQUEST_PRINTTO,
+             REQUEST_FORCEOPEN,
+-            REQUEST_FORCENEW
++            REQUEST_FORCENEW,
++	    REQUEST_CONVERSION
+         };
+ 
+         struct DispatchRequest
+@@ -89,7 +90,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
+             RequestType		aRequestType;
+             rtl::OUString	aURL;
+             boost::optional< rtl::OUString > aCwdUrl;
+-            rtl::OUString	aPrinterName;
++            rtl::OUString	aPrinterName;  // also conversion params
+             rtl::OUString   aPreselectedFactory;
+         };
+ 
+diff --git desktop/source/app/officeipcthread.cxx desktop/source/app/officeipcthread.cxx
+index 9e158b7..73085f5 100644
+--- desktop/source/app/officeipcthread.cxx
++++ desktop/source/app/officeipcthread.cxx
+@@ -948,6 +948,29 @@ static void AddToDispatchList(
+     }
+ }
+ 
++static void AddConversionsToDispatchList(
++    DispatchWatcher::DispatchList& rDispatchList,
++    boost::optional< rtl::OUString > const & cwdUrl,
++    const OUString& aRequestList,
++    DispatchWatcher::RequestType nType,
++    const OUString& aParam,
++    const OUString& aFactory )
++{
++    if ( aRequestList.getLength() > 0 )
++    {
++        sal_Int32 nIndex = 0;
++        do
++        {
++            OUString aToken = aRequestList.getToken( 0, APPEVENT_PARAM_DELIMITER, nIndex );
++            if ( aToken.getLength() > 0 )
++                rDispatchList.push_back(
++                    DispatchWatcher::DispatchRequest( nType, aToken, cwdUrl, aParam, aFactory ));
++        }
++        while ( nIndex >= 0 );
++    }
++}
++
++
+ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest )
+ {
+     // protect the dispatch list
+@@ -964,7 +987,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ
+     AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aPrintToList, DispatchWatcher::REQUEST_PRINTTO, aRequest.aPrinterName, aRequest.aModule );
+     AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceOpenList, DispatchWatcher::REQUEST_FORCEOPEN, aEmpty, aRequest.aModule );
+     AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceNewList, DispatchWatcher::REQUEST_FORCENEW, aEmpty, aRequest.aModule );
+-
++    AddConversionsToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aConversionList, DispatchWatcher::REQUEST_CONVERSION, aRequest.aConversionParams, aRequest.aModule );
+     sal_Bool bShutdown( sal_False );
+ 
+     if ( pGlobalOfficeIPCThread )
+diff --git desktop/source/app/officeipcthread.hxx desktop/source/app/officeipcthread.hxx
+index a2949b9..75d5485 100644
+--- desktop/source/app/officeipcthread.hxx
++++ desktop/source/app/officeipcthread.hxx
+@@ -69,6 +69,8 @@ struct ProcessDocumentsRequest
+     ::rtl::OUString aForceNewList;	// Documents that should be forced to create a new document
+     ::rtl::OUString aPrinterName;	// The printer name that should be used for printing
+     ::rtl::OUString aPrintToList;	// Documents that should be printed on the given printer
++    ::rtl::OUString aConversionList;
++    ::rtl::OUString aConversionParams;
+     ::osl::Condition *pcProcessed;  // pointer condition to be set when the request has been processed
+ };
+ 


More information about the ooo-build-commit mailing list