[ooo-build-commit] .: Branch 'ooo-build-3-2-1' - 3 commits - patches/dev300

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Jun 29 01:26:09 PDT 2010


 patches/dev300/apply                            |    7 
 patches/dev300/desktop-cmd-bulk-conversion.diff |  485 ++++++++++++++++--------
 patches/dev300/ooxml-sc-page-date.diff          |  276 +++++++++++++
 patches/dev300/ooxml-schema.diff                |   19 
 4 files changed, 639 insertions(+), 148 deletions(-)

New commits:
commit 4930e4d2500c20702134ac82dfce158518ef6e7e
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Jun 29 13:53:12 2010 +0530

    Incl. ooxml and moved batch-conv to OOXMLExportDevel
    
    * patches/dev300/apply

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 4b94a84..7379064 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3365,7 +3365,10 @@ pptx-autoplay-fix.diff, n#485645, thorsten
 
 [ OOXMLExportDevel ]
 ooxml-filters.diff, cbosdo
-ooxml-filters-calc.diff, muthu
+ooxml-filters-calc.diff, muthusuba
+ooxml-schema.diff, muthusuba
+ooxml-sc-page-date.diff, muthusuba
+desktop-cmd-bulk-conversion.diff, flr-muthusuba
 
 # depends on pptx-autoplay-fix.diff
 ooxml-autoplay-fix.diff, tml
@@ -3437,7 +3440,7 @@ oox-pptx-export-blip-luminance.diff, n#497570, rodo
 
 [ Experimental ]
 experimental_ooapi.diff, flr
-desktop-cmd-bulk-conversion.diff, flr
+# desktop-cmd-bulk-conversion.diff, flr
 
 [ CalcExperimental ]
 # It's empty but please don't remove this section.
commit 2819e5db7d7dd83d4c19ee3961f11bba308e3acf
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Jun 29 13:45:57 2010 +0530

    Master->branch (ooxml export changes)
    
    * patches/dev300/ooxml-sc-page-date.diff
    * patches/dev300/ooxml-schema.diff

diff --git a/patches/dev300/ooxml-sc-page-date.diff b/patches/dev300/ooxml-sc-page-date.diff
new file mode 100644
index 0000000..3c93970
--- /dev/null
+++ b/patches/dev300/ooxml-sc-page-date.diff
@@ -0,0 +1,276 @@
+--- sc/source/filter/excel/excrecds.cxx	2010-06-16 16:47:12.000000000 +0530
++++ sc/source/filter/excel/excrecds.cxx	2010-06-16 16:58:30.000000000 +0530
+@@ -360,6 +360,7 @@ Exc1904::Exc1904( ScDocument& rDoc )
+ {
+     Date* pDate = rDoc.GetFormatTable()->GetNullDate();
+     bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : FALSE;
++    bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : FALSE;
+ }
+ 
+ 
+@@ -371,9 +372,21 @@ UINT16 Exc1904::GetNum( void ) const
+ 
+ void Exc1904::SaveXml( XclExpXmlStream& rStrm )
+ {
+-    rStrm.WriteAttributes(
++    bool bISOIEC = ( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 );
++
++    if( bISOIEC )
++    {
++        rStrm.WriteAttributes( 
++            XML_dateCompatibility, XclXmlUtils::ToPsz( bDateCompatibility ),
++            FSEND );
++    }
++    
++    if( !bISOIEC || bDateCompatibility )
++    {
++        rStrm.WriteAttributes(
+             XML_date1904, XclXmlUtils::ToPsz( bVal ),
+             FSEND );
++    }
+ }
+ 
+ 
+diff -upr sc/source/filter/excel/xepage.cxx sc/source/filter/excel/xepage.cxx
+--- sc/source/filter/excel/xepage.cxx	2010-06-16 16:47:12.000000000 +0530
++++ sc/source/filter/excel/xepage.cxx	2010-06-16 17:01:37.000000000 +0530
+@@ -96,25 +96,37 @@ XclExpSetup::XclExpSetup( const XclPageD
+ 
+ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
+ {
+-    rStrm.GetCurrentStream()->singleElement( XML_pageSetup,
+-            XML_paperSize,          OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr(),
+-            XML_scale,              OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr(),
+-            XML_firstPageNumber,    OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr(),
+-            XML_fitToWidth,         OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr(),
+-            XML_fitToHeight,        OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr(),
+-            XML_pageOrder,          mrData.mbPrintInRows ? "overThenDown" : "downThenOver",
+-            XML_orientation,        mrData.mbPortrait ? "portrait" : "landscape",   // OOXTODO: "default"?
+-            XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ),
+-            XML_blackAndWhite,      XclXmlUtils::ToPsz( mrData.mbBlackWhite ),
+-            XML_draft,              XclXmlUtils::ToPsz( mrData.mbDraftQuality ),
+-            XML_cellComments,       mrData.mbPrintNotes ? "atEnd" : "none",         // OOXTODO: "asDisplayed"?
+-            XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ),
+-            // OOXTODO: XML_errors, // == displayed|blank|dash|NA
+-            XML_horizontalDpi,      OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr(),
+-            XML_verticalDpi,        OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr(),
+-            XML_copies,             OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr(),
+-            // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
+-            FSEND );
++    sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList();
++    if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 || 
++        mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
++    {
++        pAttrList->add( XML_paperSize,           OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr() );
++    }
++    else
++    {
++        pAttrList->add( XML_paperWidth,          OString::valueOf( (sal_Int32) mrData.mnPaperWidth ).getStr() );
++        pAttrList->add( XML_paperHeight,         OString::valueOf( (sal_Int32) mrData.mnPaperHeight ).getStr() );
++        pAttrList->add( XML_paperUnits,          "mm" );
++    }
++    pAttrList->add( XML_scale,              OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr() );
++    pAttrList->add( XML_firstPageNumber,    OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr() );
++    pAttrList->add( XML_fitToWidth,         OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr() );
++    pAttrList->add( XML_fitToHeight,        OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr() );
++    pAttrList->add( XML_pageOrder,          mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
++    pAttrList->add( XML_orientation,        mrData.mbPortrait ? "portrait" : "landscape" );   // OOXTODO: "default"?
++    pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
++    pAttrList->add( XML_blackAndWhite,      XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
++    pAttrList->add( XML_draft,              XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
++    pAttrList->add( XML_cellComments,       mrData.mbPrintNotes ? "atEnd" : "none" );         // OOXTODO: "asDisplayed"?
++    pAttrList->add( XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ) );
++    // OOXTODO: XML_errors, // == displayed|blank|dash|NA
++    pAttrList->add( XML_horizontalDpi,      OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr() );
++    pAttrList->add( XML_verticalDpi,        OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr() );
++    pAttrList->add( XML_copies,             OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr() );
++    // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
++
++    ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > aAttrs(pAttrList);
++    rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
+ }
+ 
+ void XclExpSetup::WriteBody( XclExpStream& rStrm )
+diff -upr sc/source/filter/excel/xlpage.cxx sc/source/filter/excel/xlpage.cxx
+--- sc/source/filter/excel/xlpage.cxx	2010-06-16 16:47:12.000000000 +0530
++++ sc/source/filter/excel/xlpage.cxx	2010-06-16 17:05:16.000000000 +0530
+@@ -36,6 +36,7 @@
+ #include <editeng/brshitem.hxx>
+ #include "global.hxx"
+ #include "xlconst.hxx"
++#include <oox/core/xmlfilterbase.hxx>
+ 
+ // Paper size =================================================================
+ 
+@@ -48,6 +49,8 @@ struct XclPaperSize
+ 
+ #define IN2TWIPS( v )      ((long)((v) * EXC_TWIPS_PER_INCH + 0.5))
+ #define MM2TWIPS( v )      ((long)((v) * EXC_TWIPS_PER_INCH / CM_PER_INCH / 10.0 + 0.5))
++#define TWIPS2MM( v )      ((long)((v - 0.5) / EXC_TWIPS_PER_INCH * CM_PER_INCH * 10.0))
++
+ 
+ static const XclPaperSize pPaperSizeTable[] =
+ {
+@@ -189,6 +192,8 @@ void XclPageData::SetDefaults()
+     mfHdrLeftMargin = mfHdrRightMargin = XclTools::GetInchFromHmm( EXC_MARGIN_DEFAULT_HLR );
+     mfFtrLeftMargin = mfFtrRightMargin = XclTools::GetInchFromHmm( EXC_MARGIN_DEFAULT_FLR );
+     mnPaperSize = EXC_PAPERSIZE_DEFAULT;
++    mnPaperWidth = 0;
++    mnPaperHeight = 0;
+     mnCopies = 1;
+     mnStartPage = 0;
+     mnScaling = 100;
+@@ -222,7 +227,7 @@ Size XclPageData::GetScPaperSize() const
+     return aSize;
+ }
+ 
+-void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait )
++void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait, bool bStrictSize )
+ {
+     mbPortrait = bPortrait;
+     mnPaperSize = 0;
+@@ -230,6 +235,20 @@ void XclPageData::SetScPaperSize( const
+     long nHeight = bPortrait ? rSize.Height() : rSize.Width();
+     long nMaxWDiff = 80;
+     long nMaxHDiff = 50;
++
++    mnPaperWidth = TWIPS2MM( nWidth );
++    mnPaperHeight = TWIPS2MM( nHeight );
++    if( bStrictSize )
++    {
++        nMaxWDiff = 5;
++        nMaxHDiff = 5;
++        mnStrictPaperSize = EXC_PAPERSIZE_USER;
++    }
++    else
++    {
++        mnPaperSize = 0;
++    }
++
+     for( const XclPaperSize* pEntry = pPaperSizeTable; pEntry != STATIC_TABLE_END( pPaperSizeTable ); ++pEntry )
+     {
+         long nWDiff = Abs( pEntry->mnWidth - nWidth );
+@@ -237,11 +256,18 @@ void XclPageData::SetScPaperSize( const
+         if( ((nWDiff <= nMaxWDiff) && (nHDiff < nMaxHDiff)) ||
+             ((nWDiff < nMaxWDiff) && (nHDiff <= nMaxHDiff)) )
+         {
+-            mnPaperSize = static_cast< sal_uInt16 >( pEntry - pPaperSizeTable );
++            sal_uInt16 nIndex = static_cast< sal_uInt16 >( pEntry - pPaperSizeTable );
++            if( !bStrictSize )
++                mnPaperSize = nIndex;
++            else
++                mnStrictPaperSize = mnPaperSize = nIndex;
++
+             nMaxWDiff = nWDiff;
+             nMaxHDiff = nHDiff;
+         }
+     }
++    if( !bStrictSize )
++        SetScPaperSize( rSize, bPortrait, sal_True );
+ }
+ 
+ // ============================================================================
+diff -upr sc/source/filter/inc/excrecds.hxx sc/source/filter/inc/excrecds.hxx
+--- sc/source/filter/inc/excrecds.hxx	2010-06-16 16:47:12.000000000 +0530
++++ sc/source/filter/inc/excrecds.hxx	2010-06-16 16:53:42.000000000 +0530
+@@ -286,6 +286,8 @@ public:
+     virtual UINT16			GetNum( void ) const;
+ 
+     virtual void            SaveXml( XclExpXmlStream& rStrm );
++private:
++    BOOL                    bDateCompatibility;
+ };
+ 
+ 
+diff -upr sc/source/filter/inc/xlpage.hxx sc/source/filter/inc/xlpage.hxx
+--- sc/source/filter/inc/xlpage.hxx	2010-06-16 16:47:12.000000000 +0530
++++ sc/source/filter/inc/xlpage.hxx	2010-06-16 16:52:20.000000000 +0530
+@@ -89,6 +89,7 @@ const sal_uInt16 EXC_SETUP_STARTPAGE
+ const sal_uInt16 EXC_SETUP_NOTES_END        = 0x0200;
+ 
+ const sal_uInt16 EXC_PAPERSIZE_DEFAULT      = 0;
++const sal_uInt16 EXC_PAPERSIZE_USER         = 0xFFFF;
+ 
+ // ============================================================================
+ 
+@@ -118,6 +119,9 @@ struct XclPageData : ScfNoCopy
+     double              mfFtrLeftMargin;    /// Left margin to footer.
+     double              mfFtrRightMargin;   /// Right margin to footer.
+     sal_uInt16          mnPaperSize;        /// Index into paper size table.
++    sal_uInt16          mnStrictPaperSize;  /// Same as papersize - but for ooxml (considering stricter dimensions)
++    sal_uInt16          mnPaperWidth;       /// Paper Width in mm
++    sal_uInt16          mnPaperHeight;      /// Paper Height in mm
+     sal_uInt16          mnCopies;           /// Number of copies.
+     sal_uInt16          mnStartPage;        /// Start page number.
+     sal_uInt16          mnScaling;          /// Scaling in percent.
+@@ -147,7 +151,7 @@ struct XclPageData : ScfNoCopy
+     /** Returns the real paper size (twips) from the paper size index and paper orientation. */
+     Size                GetScPaperSize() const;
+     /** Sets the Excel paper size index and paper orientation from Calc paper size (twips). */
+-    void                SetScPaperSize( const Size& rSize, bool bPortrait );
++    void                SetScPaperSize( const Size& rSize, bool bPortrait, bool bStrict = sal_False );
+ };
+ 
+ // ============================================================================
+--- oox/source/token/tokens.txt	2010-05-11 19:09:37.000000000 +0530
++++ oox/source/token/tokens.txt	2010-06-04 19:55:41.000000000 +0530
+@@ -478,6 +478,7 @@ alg
+ algIdExt
+ algIdExtSource
+ algn
++algorithmName
+ alias
+ aliases
+ aliceBlue
+@@ -1091,6 +1092,7 @@ char
+ charRg
+ charSpace
+ character
++characterSet
+ characterSpacingControl
+ characteristic
+ charset
+@@ -1270,6 +1272,7 @@ confettiGrays
+ confettiOutline
+ confettiStreamers
+ confettiWhite
++conformance
+ conn
+ connDist
+ connRout
+@@ -1576,6 +1579,7 @@ date
+ date1904
+ dateAx
+ dateBetween
++dateCompatibility
+ dateEqual
+ dateFormat
+ dateGroupItem
+@@ -2495,6 +2499,7 @@ harsh
+ hasCustomPrompt
+ hash
+ hashData
++hashValue
+ hdr
+ hdrShapeDefaults
+ hdrs
+@@ -3700,8 +3705,11 @@ panose
+ panose1
+ papayaWhip
+ paperClips
++paperHeight
+ paperSize
+ paperSrc
++paperUnits
++paperWidth
+ papyrus
+ par
+ parOf
+@@ -4277,6 +4285,7 @@ saka
+ salmon
+ salt
+ saltData
++saltValue
+ sameClick
+ sameDir
+ sampData
diff --git a/patches/dev300/ooxml-schema.diff b/patches/dev300/ooxml-schema.diff
new file mode 100644
index 0000000..b667c05
--- /dev/null
+++ b/patches/dev300/ooxml-schema.diff
@@ -0,0 +1,19 @@
+--- oox/source/core/xmlfilterbase.cxx	2010-05-11 19:14:26.000000000 +0530
++++ oox/source/core/xmlfilterbase.cxx	2010-06-15 12:49:44.000000000 +0530
+@@ -485,9 +489,13 @@ writeElement( FSHelperPtr pDoc, sal_Int3
+ static void
+ writeCoreProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProperties )
+ {
+-    rSelf.addRelation(
+-            CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" ),
+-            CREATE_OUSTRING( "docProps/core.xml" ) );
++    OUString sValue;
++    if( rSelf.getVersion() == oox::core::ISOIEC_29500_2008  )
++        sValue = CREATE_OUSTRING( "http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties" );
++    else
++        sValue = CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" );
++
++    rSelf.addRelation( sValue, CREATE_OUSTRING( "docProps/core.xml" ) );
+     FSHelperPtr pCoreProps = rSelf.openFragmentStreamWithSerializer(
+             CREATE_OUSTRING( "docProps/core.xml" ),
+             CREATE_OUSTRING( "application/vnd.openxmlformats-package.core-properties+xml" ) );
commit 548626beb0c9fbe75ff525ff394a3c535b82b943
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Jun 29 13:43:14 2010 +0530

    Master->branch update
    
    * patches/dev300/desktop-cmd-bulk-conversion.diff

diff --git a/patches/dev300/desktop-cmd-bulk-conversion.diff b/patches/dev300/desktop-cmd-bulk-conversion.diff
index c6dcf69..c572fe1 100644
--- a/patches/dev300/desktop-cmd-bulk-conversion.diff
+++ b/patches/dev300/desktop-cmd-bulk-conversion.diff
@@ -1,63 +1,68 @@
-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()
+diff -upr desktop/source/app/app.cxx desktop/source/app/app.cxx
+--- desktop/source/app/app.cxx	2010-05-11 19:13:49.000000000 +0530
++++ desktop/source/app/app.cxx	2010-05-11 12:08:29.000000000 +0530
+@@ -2546,6 +2546,9 @@ void Desktop::OpenClients()
          pArgs->GetPrinterName( aRequest.aPrinterName );
          pArgs->GetForceOpenList( aRequest.aForceOpenList );
          pArgs->GetForceNewList( aRequest.aForceNewList );
 +        pArgs->GetConversionList( aRequest.aConversionList );
 +        pArgs->GetConversionParams( aRequest.aConversionParams );
++        pArgs->GetConversionOut( aRequest.aConversionOut );
  
          if ( aRequest.aOpenList.getLength() > 0 ||
               aRequest.aViewList.getLength() > 0 ||
-@@ -2475,7 +2477,8 @@ void Desktop::OpenClients()
+@@ -2553,7 +2556,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 ))
++             ( aRequest.aConversionList.getLength() > 0 && aRequest.aConversionParams.getLength() > 0 ))
          {
              bLoaded = sal_True;
  
-@@ -2825,7 +2828,8 @@ void Desktop::OpenSplashScreen()
+@@ -2903,7 +2907,8 @@ void Desktop::OpenSplashScreen()
           !pCmdLine->IsNoLogo() &&
           !pCmdLine->IsTerminateAfterInit() &&
           !pCmdLine->GetPrintList( aTmpString ) &&
 -         !pCmdLine->GetPrintToList( aTmpString ) )
 +         !pCmdLine->GetPrintToList( aTmpString ) &&
-+	 !pCmdLine->GetConversionList( 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 )
+diff -upr desktop/source/app/cmdlineargs.cxx desktop/source/app/cmdlineargs.cxx
+--- desktop/source/app/cmdlineargs.cxx	2010-05-11 19:14:16.000000000 +0530
++++ desktop/source/app/cmdlineargs.cxx	2010-05-11 19:21:17.000000000 +0530
+@@ -151,6 +151,9 @@ void CommandLineArgs::ParseCommandLine_I
      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;
++    sal_Bool    bConversionParamsEvent= sal_False;
++    sal_Bool    bConversionOutEvent   = sal_False;
  
      m_eArgumentCount = NONE;
  
-@@ -286,6 +288,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
-                             bDisplaySpec	= sal_False;
+@@ -295,6 +298,17 @@ void CommandLineArgs::ParseCommandLine_I
+                         bDisplaySpec	= sal_False;
                      }
                      #endif
-+                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-bulk" ))
++                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-convert-to" ) )
 +                    {
-+		      bOpenEvent = sal_False;
-+		      bConversionEvent = sal_True;
-+		      bConversionParamsEvent = sal_True;
-+		    }
++                        bOpenEvent = sal_False;
++                        bConversionEvent = sal_True;
++                        bConversionParamsEvent = sal_True;
++                    }
++                    else if ( aArgStr.EqualsIgnoreCaseAscii( "-outdir" ) && 
++                              bConversionEvent )
++                    {
++                        bConversionOutEvent = sal_True;
++                    }
                  }
                  else
                  {
-@@ -295,6 +303,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+@@ -304,6 +318,17 @@ void CommandLineArgs::ParseCommandLine_I
                          AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
                          bPrinterName = sal_False;
                      }
@@ -67,22 +72,29 @@ index 88cb6bf..0d1f027 100644
 +                        AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONPARAMS, aArgStr );
 +                        bConversionParamsEvent = sal_False;
 +                    }
++                    else if ( bConversionEvent && bConversionOutEvent )
++                    {
++                        AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONOUT, aArgStr );
++                        bConversionOutEvent = sal_False;
++                    }
                      else
                      {
  						if( bOpenEvent || bViewEvent || bForceNewEvent || bForceOpenEvent )
-@@ -326,6 +340,10 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
+@@ -335,6 +360,12 @@ void CommandLineArgs::ParseCommandLine_I
                              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 ];
+@@ -891,6 +922,28 @@ sal_Bool CommandLineArgs::GetLanguage( :
+     return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ];
  }
  
 +sal_Bool CommandLineArgs::GetConversionList( ::rtl::OUString& rPara ) const
@@ -98,39 +110,130 @@ index 88cb6bf..0d1f027 100644
 +    rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
 +    return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
 +}
++sal_Bool CommandLineArgs::GetConversionOut( ::rtl::OUString& rPara ) const
++{
++    osl::MutexGuard  aMutexGuard( m_aMutex );
++    rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONOUT ];
++    return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONOUT ];
++}
 +
 +
 +
  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
+diff -upr desktop/source/app/cmdlineargs.hxx desktop/source/app/cmdlineargs.hxx
+--- desktop/source/app/cmdlineargs.hxx	2010-05-11 19:13:37.000000000 +0530
++++ desktop/source/app/cmdlineargs.hxx	2010-05-11 12:20:13.000000000 +0530
+@@ -90,6 +90,9 @@ class CommandLineArgs
              CMD_STRINGPARAM_VERSION,
              CMD_STRINGPARAM_PRINTTOLIST,
              CMD_STRINGPARAM_PRINTERNAME,
-+	    CMD_STRINGPARAM_CONVERSIONLIST,
-+	    CMD_STRINGPARAM_CONVERSIONPARAMS,	    
++            CMD_STRINGPARAM_CONVERSIONLIST,
++            CMD_STRINGPARAM_CONVERSIONPARAMS,
++            CMD_STRINGPARAM_CONVERSIONOUT,
              CMD_STRINGPARAM_DISPLAY,
+             CMD_STRINGPARAM_LANGUAGE,
              CMD_STRINGPARAM_COUNT			// must be last element!
-         };
-@@ -171,6 +173,8 @@ class CommandLineArgs
-         sal_Bool				GetPrintList( ::rtl::OUString& rPara) const;
+@@ -170,6 +173,9 @@ class CommandLineArgs
          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;
+         sal_Bool                GetLanguage( ::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;
  
          // 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 @@
+diff -upr desktop/source/app/dispatchwatcher.hxx desktop/source/app/dispatchwatcher.hxx
+--- desktop/source/app/dispatchwatcher.hxx	2010-05-11 19:11:24.000000000 +0530
++++ desktop/source/app/dispatchwatcher.hxx	2010-05-10 13:51:16.000000000 +0530
+@@ -75,7 +75,8 @@ class DispatchWatcher : public ::cppu::W
+             REQUEST_PRINT,
+             REQUEST_PRINTTO,
+             REQUEST_FORCEOPEN,
+-            REQUEST_FORCENEW
++            REQUEST_FORCENEW,
++            REQUEST_CONVERSION
+         };
+ 
+         struct DispatchRequest
+@@ -86,7 +87,7 @@ class DispatchWatcher : public ::cppu::W
+             RequestType		aRequestType;
+             rtl::OUString	aURL;
+             boost::optional< rtl::OUString > aCwdUrl;
+-            rtl::OUString	aPrinterName;
++            rtl::OUString   aPrinterName;  // also conversion params
+             rtl::OUString   aPreselectedFactory;
+         };
+ 
+--- sfx2/source/bastyp/fltfnc.cxx	2010-05-11 19:11:26.000000000 +0530
++++ sfx2/source/bastyp/fltfnc.cxx	2010-05-14 12:15:37.000000000 +0530
+@@ -374,8 +374,8 @@ const SfxFilter* SfxFilterMatcher::GetAn
+ sal_uInt32  SfxFilterMatcher::GuessFilterIgnoringContent(
+     SfxMedium& rMedium,
+     const SfxFilter**ppFilter,
+-    SfxFilterFlags /*nMust*/,
+-    SfxFilterFlags /*nDont*/ ) const
++    SfxFilterFlags nMust,
++    SfxFilterFlags nDont ) const
+ {
+     Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), UNO_QUERY );
+     ::rtl::OUString sTypeName;
+@@ -390,7 +390,7 @@ sal_uInt32  SfxFilterMatcher::GuessFilte
+ 
+     *ppFilter = NULL;
+     if ( sTypeName.getLength() )
+-        *ppFilter = GetFilter4EA( sTypeName );
++        *ppFilter = GetFilter4EA( sTypeName, nMust, nDont );
+ 
+     return *ppFilter ? ERRCODE_NONE : ERRCODE_ABORT;
+ }
+--- desktop/source/app/cmdlinehelp.cxx	2010-05-11 19:13:48.000000000 +0530
++++ desktop/source/app/cmdlinehelp.cxx	2010-05-17 16:44:48.000000000 +0530
+@@ -116,7 +116,12 @@ 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"\
+-        "Remaining arguments will be treated as filenames or URLs of documents to open.\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"\
++        "      Eg. -convert-to pdf *.doc\n"\
++        "          -convert-to pdf:writer_pdf_Export -outdir /home/user *.doc\n"\
++        "\nRemaining arguments will be treated as filenames or URLs of documents to open.\n";
+ 
+     void ReplaceStringHookProc( UniString& rStr );
+ 
+diff -upr desktop/source/app/officeipcthread.hxx desktop/source/app/officeipcthread.hxx
+--- desktop/source/app/officeipcthread.hxx    2010-05-11 19:11:24.000000000 +0530
++++ desktop/source/app/officeipcthread.hxx    2010-05-11 12:11:09.000000000 +0530
+@@ -66,6 +66,9 @@ 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;
++    ::rtl::OUString aConversionOut;
+     ::osl::Condition *pcProcessed;  // pointer condition to be set when the request has been processed
+ };
+
+--- desktop/source/app/dispatchwatcher.cxx	2010-05-11 19:11:24.000000000 +0530
++++ desktop/source/app/dispatchwatcher.cxx	2010-05-25 16:40:20.000000000 +0530
+@@ -28,6 +28,12 @@
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_desktop.hxx"
+ 
++#include <sfx2/docfile.hxx>
++#include <sfx2/docfilt.hxx>
++#include <sfx2/fcontnr.hxx>
++#include "osl/file.hxx"
++#include <svl/fstathelper.hxx>
++
+ #include "dispatchwatcher.hxx"
+ #include <rtl/ustring.hxx>
+ #include <tools/string.hxx>
+@@ -48,13 +54,14 @@
  #include <com/sun/star/util/XURLTransformer.hpp>
  #include <com/sun/star/document/MacroExecMode.hpp>
  #include <com/sun/star/document/UpdateDocMode.hpp>
@@ -138,103 +241,203 @@ index 891e756..cc87832 100644
  
  #include <tools/urlobj.hxx>
  #include <comphelper/mediadescriptor.hxx>
-@@ -122,7 +123,7 @@ DispatchWatcher* DispatchWatcher::GetDispatchWatcher()
  
+ #include <vector>
  
- 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"));
+-using namespace ::rtl;
++using ::rtl::OUString;
+ using namespace ::osl;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::util;
+@@ -80,6 +87,32 @@ struct DispatchHolder
+     Reference< XDispatch > xDispatch;
+ };
  
-+    printf("executeDispatchRequests(bNoTerminate=%i)\n", bNoTerminate);
-+    m_nRequestCount++;
++static String impl_GetFilterFromExt( OUString aUrl, SfxFilterFlags nFlags, 
++                                        String aAppl )
++{
++    String aFilter;
++    SfxMedium* pMedium = new SfxMedium( aUrl, 
++                                        STREAM_STD_READ, FALSE );
++    const SfxFilter *pSfxFilter = NULL;
++    SfxFilterMatcher aMatcher;
++    if( nFlags == SFX_FILTER_EXPORT )
++        aMatcher = SfxFilterMatcher( aAppl );
++    aMatcher.GuessFilterIgnoringContent( *pMedium, &pSfxFilter, nFlags, 0 );
++    if( pSfxFilter )
++        aFilter = ( nFlags == SFX_FILTER_EXPORT ) ? pSfxFilter->GetFilterName() : 
++                                                    pSfxFilter->GetServiceName();
++    
++    delete pMedium;    
++    return aFilter;
++}
++static OUString impl_GuessFilter( OUString aUrlIn, OUString aUrlOut )
++{
++    /* aAppl can also be set to Factory like scalc, swriter... */
++    String aAppl;
++    aAppl = impl_GetFilterFromExt( aUrlIn, SFX_FILTER_IMPORT, aAppl );
++    return  impl_GetFilterFromExt( aUrlOut, SFX_FILTER_EXPORT, aAppl );
++}
 +
-     for ( p = aDispatchRequestsList.begin(); p != aDispatchRequestsList.end(); p++ )
-     {
-         String					aPrinterName;
-         const DispatchRequest&	aDispatchRequest = *p;
+ Mutex* DispatchWatcher::pWatcherMutex = NULL;
  
-+	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
+ Mutex& DispatchWatcher::GetMutex()
+@@ -151,7 +188,8 @@ sal_Bool DispatchWatcher::executeDispatc
  
          // 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)
++             aDispatchRequest.aRequestType == REQUEST_CONVERSION)
              nCount++;
  
          Sequence < PropertyValue > aArgs( nCount );
-@@ -164,7 +171,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
+@@ -161,7 +199,8 @@ sal_Bool DispatchWatcher::executeDispatc
          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)
++             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
+@@ -196,7 +235,8 @@ sal_Bool DispatchWatcher::executeDispatc
          ::rtl::OUString aTarget( RTL_CONSTASCII_USTRINGPARAM("_default") );
  
          if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
 -             aDispatchRequest.aRequestType == REQUEST_PRINTTO )
 +             aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
-+	     aDispatchRequest.aRequestType == REQUEST_CONVERSION)
++             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
+@@ -214,7 +254,6 @@ sal_Bool DispatchWatcher::executeDispatc
+             // hidden documents should never be put into open tasks
+             aTarget = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") );
+         }
+-
+         // load the document ... if they are loadable!
+         // Otherwise try to dispatch it ...
+         Reference < XPrintable > xDoc;
+@@ -361,24 +400,87 @@ sal_Bool DispatchWatcher::executeDispatc
                  OfficeIPCThread::RequestsCompleted( 1 );
              }
              else if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
 -                      aDispatchRequest.aRequestType == REQUEST_PRINTTO )
 +                      aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
-+		      aDispatchRequest.aRequestType == REQUEST_CONVERSION )
++                      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);
+-                    if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+-                    {
+-                        // create the printer
++                    if ( aDispatchRequest.aRequestType == REQUEST_CONVERSION ) {
++                        Reference< XStorable > xStorable( xDoc, UNO_QUERY );
++                        if ( xStorable.is() ) {
++                            rtl::OUString aParam = aDispatchRequest.aPrinterName;
++                            sal_Int32 nPathIndex =  aParam.lastIndexOfAsciiL( ";", 1 );
++                            sal_Int32 nFilterIndex = aParam.lastIndexOfAsciiL( ":", 1 );
++                            rtl::OUString aFilterOut=aParam.copy( nPathIndex+1 );
++                            rtl::OUString aFilter;
++                            rtl::OUString aFilterExt;
++                            sal_Bool bGuess = sal_False;
 +
-+		      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)
++                            if( nFilterIndex >= 0 )
++                            {
++                                aFilter = aParam.copy( nFilterIndex+1, nPathIndex-nFilterIndex-1 );
++                                aFilterExt = aParam.copy( 0, nFilterIndex );
++                            }
++                            else
++                            {
++                                // Guess
++                                bGuess = sal_True;
++                                aFilterExt = aParam.copy( 0, nPathIndex );
++                            }
++                            INetURLObject aOutFilename( aObj );
++                            aOutFilename.SetExtension( aFilterExt );
++                            FileBase::getFileURLFromSystemPath( aFilterOut, aFilterOut );
++                            rtl::OUString aOutFile = aFilterOut+
++                                                     ::rtl::OUString::createFromAscii( "/" )+
++                                                     aOutFilename.getName();
++                            //FileBase::getFileURLFromSystemPath( aOutFile, aOutFile );
++
++                            if ( bGuess )
++                            {
++                                aFilter = impl_GuessFilter( aName, aOutFile );
++                            }
++
++                            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 <<= aFilter;
++
++                            rtl::OUString aTempName;
++                            FileBase::getSystemPathFromFileURL( aName, aTempName );
++                            rtl::OString aSource8 = ::rtl::OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
++                            FileBase::getSystemPathFromFileURL( aOutFile, aTempName );
++                            rtl::OString aTargetURL8 = ::rtl::OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
++                            printf("convert %s->%s using %s\n", aSource8.getStr(), aTargetURL8.getStr(), 
++                                                                ::rtl::OUStringToOString( aFilter, RTL_TEXTENCODING_UTF8 ).getStr());
++                            if( FStatHelper::IsDocument(aOutFile) )
++                                printf("Overwriting: %s\n",::rtl::OUStringToOString( aTempName, RTL_TEXTENCODING_UTF8 ).getStr() );
++                            try 
++                            {
++                                xStorable->storeToURL( aOutFile, conversionProperties );
++                            } 
++                            catch ( Exception& ) 
++                            {
++                                fprintf( stderr, "Error: Please reverify input parameters...\n" );
++                            }
++                        }
++                    } else {
++                        if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO )
++                        {
++                            // create the printer
++                            Sequence < PropertyValue > aPrinterArgs( 1 );
++                            aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
++                            aPrinterArgs[0].Value <<= ::rtl::OUString( aDispatchRequest.aPrinterName );
++                            xDoc->setPrinter( aPrinterArgs );
++                        }
++
++                        // print ( also without user interaction )
+                         Sequence < PropertyValue > aPrinterArgs( 1 );
+-                        aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
+-                        aPrinterArgs[0].Value <<= ::rtl::OUString( aDispatchRequest.aPrinterName );
+-                        xDoc->setPrinter( aPrinterArgs );
++                        aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Wait");
++                        aPrinterArgs[0].Value <<= ( sal_Bool ) sal_True;
++                        xDoc->print( aPrinterArgs );
+                     }
+-
+-                    // print ( also without user interaction )
+-                    Sequence < PropertyValue > aPrinterArgs( 1 );
+-                    aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Wait");
+-                    aPrinterArgs[0].Value <<= ( sal_Bool ) sal_True;
+-                    xDoc->print( aPrinterArgs );
+                 }
+                 else
+                 {
+@@ -442,9 +544,15 @@ sal_Bool DispatchWatcher::executeDispatc
+     // implementation via statusChanged!!
+     if ( bEmpty && !bNoTerminate /*m_aRequestContainer.empty()*/ )
+     {
++        // Delay give a chance for threads to complete work
++        sleep(2);
++
+         // We have to check if we have an open task otherwise we have to shutdown the office.
+         Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
+         aGuard.clear();
++        
++        // Delay give a chance for threads to complete work
++        sleep(1);
+ 
+         Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
+ 
+@@ -470,7 +578,7 @@ throw(::com::sun::star::uno::RuntimeExce
  void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException )
  {
      osl::ClearableMutexGuard aGuard( GetMutex() );
@@ -243,34 +446,17 @@ index 891e756..cc87832 100644
      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;
-         };
+--- desktop/source/app/officeipcthread.cxx	2010-05-11 19:11:24.000000000 +0530
++++ desktop/source/app/officeipcthread.cxx	2010-05-25 16:04:14.000000000 +0530
+@@ -51,6 +51,7 @@
+ #include "osl/file.hxx"
+ #include "rtl/process.h"
+ #include "tools/getprocessworkingdir.hxx"
++#include "osl/file.hxx"
  
-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(
+ using namespace vos;
+ using namespace rtl;
+@@ -945,6 +946,49 @@ static void AddToDispatchList(
      }
  }
  
@@ -279,9 +465,29 @@ index 9e158b7..73085f5 100644
 +    boost::optional< rtl::OUString > const & cwdUrl,
 +    const OUString& aRequestList,
 +    DispatchWatcher::RequestType nType,
-+    const OUString& aParam,
-+    const OUString& aFactory )
++    const OUString& aPara,
++    const OUString& aFactory,
++    const OUString& aParamOut )
 +{
++    OUString aOutDir( aParamOut.trim() );
++    OUString aParam( aPara );
++    ::rtl::OUString aPWD;
++    ::tools::getProcessWorkingDir( &aPWD );
++
++    if( !::osl::FileBase::getAbsoluteFileURL( aPWD, aParamOut, aOutDir ) )
++        ::osl::FileBase::getSystemPathFromFileURL( aOutDir, aOutDir );
++ 
++    if( aParamOut.trim().getLength() )
++    {
++        aParam += ::rtl::OUString::createFromAscii(";");
++        aParam += aOutDir;
++    }
++    else
++    {
++        ::osl::FileBase::getSystemPathFromFileURL( aPWD, aPWD );
++        aParam += ::rtl::OUString::createFromAscii( ";" ) + aPWD;
++    }
++
 +    if ( aRequestList.getLength() > 0 )
 +    {
 +        sal_Int32 nIndex = 0;
@@ -300,25 +506,12 @@ index 9e158b7..73085f5 100644
  sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest )
  {
      // protect the dispatch list
-@@ -964,7 +987,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ
+@@ -961,7 +1005,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLine
      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 );
++    AddConversionsToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aConversionList, DispatchWatcher::REQUEST_CONVERSION, aRequest.aConversionParams, aRequest.aModule, aRequest.aConversionOut );
      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