[Libreoffice-commits] .: bf_sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 22 08:19:41 PDT 2012


 bf_sfx2/source/appl/sfx2_namecont.cxx   |   32 ++++++++++----------------------
 bf_sfx2/source/appl/sfx2_scriptcont.cxx |   17 ++++++-----------
 2 files changed, 16 insertions(+), 33 deletions(-)

New commits:
commit ab3e0975e1bf8d662e7d154de9313a491dc02b31
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 22 16:59:03 2012 +0200

    fdo#46808: Adapt to core css.xml.sax.Writer changes
    
    Change-Id: Ic1f0e96bbf8f3f9ea0d5ab9678f6efd0a929999f

diff --git a/bf_sfx2/source/appl/sfx2_namecont.cxx b/bf_sfx2/source/appl/sfx2_namecont.cxx
index ee5162c..312bd84 100644
--- a/bf_sfx2/source/appl/sfx2_namecont.cxx
+++ b/bf_sfx2/source/appl/sfx2_namecont.cxx
@@ -28,10 +28,12 @@
 #include <bf_svtools/ehdl.hxx>
 #include "bf_basic/basmgr.hxx"
 
+#include <com/sun/star/xml/sax/Writer.hpp>
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/uno/DeploymentException.hpp>
+#include <comphelper/processfactory.hxx>
 
 #include <legacysmgr/legacy_binfilters_smgr.hxx>
 
@@ -840,14 +842,8 @@ void SfxLibraryContainer_Impl::implStoreLibraryIndexFile( SfxLibrary_Impl* pLib,
     const ::xmlscript::LibDescriptor& rLib, SotStorageRef xStorage )
 {
     // Create sax writer
-    Reference< XExtendedDocumentHandler > xHandler(
-        mxMSF->createInstance(
-            OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
-    if( !xHandler.is() )
-    {
-        OSL_FAIL( "### couldn't create sax-writer component\n" );
-        return;
-    }
+    Reference< XWriter > xWriter(
+        Writer::create( comphelper::getComponentContext( mxMSF ) ) );
 
     sal_Bool bLink = pLib->mbLink;
     sal_Bool bStorage = xStorage.Is() && !bLink;
@@ -905,10 +901,9 @@ void SfxLibraryContainer_Impl::implStoreLibraryIndexFile( SfxLibrary_Impl* pLib,
         return;
     }
 
-    Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
-    xSource->setOutputStream( xOut );
+    xWriter->setOutputStream( xOut );
 
-    xmlscript::exportLibrary( xHandler, rLib );
+    xmlscript::exportLibrary( xWriter, rLib );
 
     if( xInfoStream.Is() )
         xInfoStream->Commit();
@@ -1157,14 +1152,8 @@ void SfxLibraryContainer_Impl::implStoreLibraryIndexFile( SfxLibrary_Impl* pLib,
 /*N*/
 /*N*/   // Write library container info
 /*N*/   // Create sax writer
-/*N*/   Reference< XExtendedDocumentHandler > xHandler(
-/*N*/       mxMSF->createInstance(
-/*N*/           OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
-/*N*/   if( !xHandler.is() )
-/*N*/   {
-/*N*/       OSL_FAIL( "### couldn't create sax-writer component\n" );
-/*N*/       return;
-/*N*/   }
+        Reference< XWriter > xWriter(
+            Writer::create( comphelper::getComponentContext( mxMSF ) ) );
 /*N*/
 /*N*/   // Write info file
 /*N*/   Reference< XOutputStream > xOut;
@@ -1222,10 +1211,9 @@ void SfxLibraryContainer_Impl::implStoreLibraryIndexFile( SfxLibrary_Impl* pLib,
 /*N*/       return;
 /*N*/   }
 /*N*/
-/*N*/   Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
-/*N*/   xSource->setOutputStream( xOut );
+/*N*/   xWriter->setOutputStream( xOut );
 /*N*/
-/*N*/   xmlscript::exportLibraryContainer( xHandler, pLibArray );
+/*N*/   xmlscript::exportLibraryContainer( xWriter, pLibArray );
 /*N*/   if( xInfoStream.Is() )
 /*?*/       xInfoStream->Commit();
 /*N*/   if( xLibrariesStor.Is() )
diff --git a/bf_sfx2/source/appl/sfx2_scriptcont.cxx b/bf_sfx2/source/appl/sfx2_scriptcont.cxx
index 6453a76..70a197b 100644
--- a/bf_sfx2/source/appl/sfx2_scriptcont.cxx
+++ b/bf_sfx2/source/appl/sfx2_scriptcont.cxx
@@ -17,9 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <com/sun/star/xml/sax/Writer.hpp>
 #include <com/sun/star/xml/sax/XParser.hpp>
 
 #include <com/sun/star/io/XActiveDataSource.hpp>
+#include <comphelper/processfactory.hxx>
 
 #include <bf_sfx2/sfxuno.hxx>
 
@@ -172,23 +174,16 @@ void SfxScriptLibraryContainer::setLibraryPassword(
 /*?*/   throw(Exception)
 /*?*/ {
         // Create sax writer
-        Reference< XExtendedDocumentHandler > xHandler(
-            mxMSF->createInstance(
-                OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
-        if( !xHandler.is() )
-        {
-            OSL_FAIL( "### couldn't create sax-writer component\n" );
-            return;
-        }
+        Reference< XWriter > xWriter(
+            Writer::create( comphelper::getComponentContext( mxMSF ) ) );
 
-        Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
-        xSource->setOutputStream( xOutput );
+        xWriter->setOutputStream( xOutput );
 
         xmlscript::ModuleDescriptor aMod;
         aMod.aName = aElementName;
         aMod.aLanguage = maScriptLanguage;
         aElement >>= aMod.aCode;
-        xmlscript::exportScriptModule( xHandler, aMod );
+        xmlscript::exportScriptModule( xWriter, aMod );
 /*?*/ }
 
 


More information about the Libreoffice-commits mailing list