basctl/source/basicide/moduldl2.cxx                       |    8 -
 desktop/source/deployment/registry/package/dp_package.cxx |    8 -
 offapi/UnoApi_offapi.mk                                   |    1 
 offapi/com/sun/star/packages/manifest/ManifestWriter.idl  |   33 +++++++
 package/source/zippackage/ZipPackage.cxx                  |   65 +++++---------
 sot/source/sdstor/ucbstorage.cxx                          |    7 -
 6 files changed, 69 insertions(+), 53 deletions(-)

New commits:
commit 8aa5946afeac9d86f84239bd7ef101493059c3f5
Author: Noel Grandin <n...@peralex.com>
Date:   Mon Oct 15 09:59:33 2012 +0200

    fdo#46808, Adapt packages::manifest::ManifestWriter UNO service to new style
    
    The service already existed, it just did not have an IDL file
    
    Change-Id: I04c617a97262e9cc96af17fcae9cc084245c0149

diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index baef479..2d980fe 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -56,7 +56,7 @@
 #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
 #include "com/sun/star/ucb/XCommandEnvironment.hpp"
 #include <com/sun/star/ucb/NameClash.hpp>
-#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
+#include "com/sun/star/packages/manifest/ManifestWriter.hpp"
 #include <unotools/pathoptions.hxx>
 #include <comphelper/processfactory.hxx>
 
@@ -1355,9 +1355,8 @@ void LibPage::ExportAsPackage( const String& aLibName )
         manifest.push_back( attribs );
 
         // write into pipe:
-        Reference<packages::manifest::XManifestWriter> xManifestWriter( 
xMSF->createInstance
-            ( 
DEFINE_CONST_UNICODE("com.sun.star.packages.manifest.ManifestWriter") ), 
UNO_QUERY );
-        Reference<io::XOutputStream> xPipe( 
io::Pipe::create(comphelper::getComponentContext(xMSF)), UNO_QUERY_THROW );
+        Reference<packages::manifest::XManifestWriter> xManifestWriter = 
packages::manifest::ManifestWriter::create( xContext );
+        Reference<io::XOutputStream> xPipe( io::Pipe::create( xContext ), 
UNO_QUERY_THROW );
         xManifestWriter->writeManifestSequence(
             xPipe, Sequence< Sequence<beans::PropertyValue> >(
                 &manifest[ 0 ], manifest.size() ) );
@@ -1384,7 +1383,6 @@ void LibPage::ExportAsPackage( const String& aLibName )
 void LibPage::ExportAsBasic( const String& aLibName )
 {
     // Folder picker
-    Reference< lang::XMultiServiceFactory > xMSF( 
::comphelper::getProcessServiceFactory() );
     Reference< uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
     Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
     Reference< task::XInteractionHandler2 > xHandler( 
task::InteractionHandler::createWithParent(xContext, 0) );
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx 
b/desktop/source/deployment/registry/package/dp_package.cxx
index 9430297..d41ed12 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -62,7 +62,7 @@
 #include "com/sun/star/sdbc/XResultSet.hpp"
 #include "com/sun/star/sdbc/XRow.hpp"
 #include "com/sun/star/packages/manifest/ManifestReader.hpp"
-#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
+#include "com/sun/star/packages/manifest/ManifestWriter.hpp"
 #include "com/sun/star/deployment/DependencyException.hpp"
 #include "com/sun/star/deployment/LicenseException.hpp"
 #include "com/sun/star/deployment/PlatformException.hpp"
@@ -1185,10 +1185,8 @@ void BackendImpl::PackageImpl::exportTo(
         // write into pipe:
         Reference<XComponentContext> xContext(
             getMyBackend()->getComponentContext() );
-        Reference<packages::manifest::XManifestWriter> xManifestWriter(
-            xContext->getServiceManager()->createInstanceWithContext(
-                OUSTR("com.sun.star.packages.manifest.ManifestWriter"),
-                xContext ), UNO_QUERY_THROW );
+        Reference<packages::manifest::XManifestWriter> xManifestWriter =
+            packages::manifest::ManifestWriter::create( xContext );
         Reference<io::XOutputStream> xPipe( io::Pipe::create(xContext), 
UNO_QUERY_THROW );
         xManifestWriter->writeManifestSequence(
             xPipe, comphelper::containerToSequence(manifest) );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 18ad252..7b99858 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -179,6 +179,7 @@ $(eval $(call 
gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/mozilla,\
 ))
 $(eval $(call 
gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/packages/manifest,\
        ManifestReader \
+       ManifestWriter \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/plugin,\
        PluginManager \
diff --git a/offapi/com/sun/star/packages/manifest/ManifestWriter.idl 
b/offapi/com/sun/star/packages/manifest/ManifestWriter.idl
new file mode 100644
index 0000000..d61e652
--- /dev/null
+++ b/offapi/com/sun/star/packages/manifest/ManifestWriter.idl
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_packages_manifest_ManifestWriter_idl__
+#define __com_sun_star_packages_manifest_ManifestWriter_idl__
+
+#include <com/sun/star/packages/manifest/XManifestWriter.idl>
+
+module com { module sun { module star { module packages { module manifest {
+
+published service ManifestWriter : XManifestWriter;
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zippackage/ZipPackage.cxx 
b/package/source/zippackage/ZipPackage.cxx
index dd2cf38..35484bc 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -30,7 +30,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/packages/zip/ZipConstants.hpp>
 #include <com/sun/star/packages/manifest/ManifestReader.hpp>
-#include <com/sun/star/packages/manifest/XManifestWriter.hpp>
+#include <com/sun/star/packages/manifest/ManifestWriter.hpp>
 #include <com/sun/star/io/TempFile.hpp>
 #include <com/sun/star/io/XStream.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -1012,48 +1012,35 @@ void ZipPackage::WriteMimetypeMagicFile( 
ZipOutputStream& aZipOut )
 void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< 
uno::Sequence < PropertyValue > >& aManList )
 {
     // Write the manifest
-    uno::Reference < XOutputStream > xManOutStream;
-    uno::Reference < XManifestWriter > xWriter ( 
m_xFactory->createInstance("com.sun.star.packages.manifest.ManifestWriter"), 
UNO_QUERY );
-    if ( xWriter.is() )
-    {
-        ZipEntry * pEntry = new ZipEntry;
-        ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
-        xManOutStream = uno::Reference < XOutputStream > ( *pBuffer, UNO_QUERY 
);
-
-        pEntry->sPath = "META-INF/manifest.xml";
-        pEntry->nMethod = DEFLATED;
-        pEntry->nCrc = -1;
-        pEntry->nSize = pEntry->nCompressedSize = -1;
-        pEntry->nTime = ZipOutputStream::getCurrentDosTime();
-
-        // Convert vector into a uno::Sequence
-        uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence ( 
aManList.size() );
-        sal_Int32 nInd = 0;
-        for ( vector < uno::Sequence < PropertyValue > >::const_iterator aIter 
= aManList.begin(), aEnd = aManList.end();
-             aIter != aEnd;
-             ++aIter, ++nInd )
-        {
-            aManifestSequence[nInd] = ( *aIter );
-        }
-        xWriter->writeManifestSequence ( xManOutStream,  aManifestSequence );
+    uno::Reference < XManifestWriter > xWriter = ManifestWriter::create( 
comphelper::getComponentContext(m_xFactory) );
+    ZipEntry * pEntry = new ZipEntry;
+    ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
+    uno::Reference < XOutputStream > xManOutStream( *pBuffer, UNO_QUERY );
 
-        sal_Int32 nBufferLength = static_cast < sal_Int32 > ( 
pBuffer->getPosition() );
-        pBuffer->realloc( nBufferLength );
+    pEntry->sPath = "META-INF/manifest.xml";
+    pEntry->nMethod = DEFLATED;
+    pEntry->nCrc = -1;
+    pEntry->nSize = pEntry->nCompressedSize = -1;
+    pEntry->nTime = ZipOutputStream::getCurrentDosTime();
 
-        // the manifest.xml is never encrypted - so pass an empty reference
-        aZipOut.putNextEntry( *pEntry, NULL );
-        aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
-        aZipOut.closeEntry();
-    }
-    else
+    // Convert vector into a uno::Sequence
+    uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence ( 
aManList.size() );
+    sal_Int32 nInd = 0;
+    for ( vector < uno::Sequence < PropertyValue > >::const_iterator aIter = 
aManList.begin(), aEnd = aManList.end();
+         aIter != aEnd;
+         ++aIter, ++nInd )
     {
-                OSL_FAIL( "Couldn't get a ManifestWriter!" );
-        IOException aException;
-        throw WrappedTargetException(
-                OSL_LOG_PREFIX "Couldn't get a ManifestWriter!",
-                static_cast < OWeakObject * > ( this ),
-                makeAny( aException ) );
+        aManifestSequence[nInd] = ( *aIter );
     }
+    xWriter->writeManifestSequence ( xManOutStream,  aManifestSequence );
+
+    sal_Int32 nBufferLength = static_cast < sal_Int32 > ( 
pBuffer->getPosition() );
+    pBuffer->realloc( nBufferLength );
+
+    // the manifest.xml is never encrypted - so pass an empty reference
+    aZipOut.putNextEntry( *pEntry, NULL );
+    aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
+    aZipOut.closeEntry();
 }
 
 //--------------------------------------------------------
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index d314aae..c3158c5 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -39,7 +39,7 @@
 #include <com/sun/star/ucb/ContentInfo.hpp>
 #include <com/sun/star/ucb/ContentInfoAttribute.hpp>
 #include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/packages/manifest/XManifestWriter.hpp>
+#include <com/sun/star/packages/manifest/ManifestWriter.hpp>
 #include <com/sun/star/packages/manifest/ManifestReader.hpp>
 #include <com/sun/star/ucb/InteractiveIOException.hpp>
 
@@ -2366,9 +2366,8 @@ sal_Int16 UCBStorage_Impl::Commit()
 
                             // create a manifest writer object that will fill 
the stream
                             Reference < 
::com::sun::star::packages::manifest::XManifestWriter > xWriter =
-                                Reference< 
::com::sun::star::packages::manifest::XManifestWriter >
-                                    ( 
::comphelper::getProcessServiceFactory()->createInstance(
-                                        
::rtl::OUString("com.sun.star.packages.manifest.ManifestWriter")), UNO_QUERY) ;
+                                
::com::sun::star::packages::manifest::ManifestWriter::create(
+                                    ::comphelper::getProcessComponentContext() 
);
                             sal_Int32 nCount = GetObjectCount() + 1;
                             Sequence < Sequence < PropertyValue > > aProps( 
nCount );
                             sal_Int32 nProps = 0;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to