Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / package / source / manifest / ManifestWriter.cxx
blob5515cc26df07f09bde4ff9f95adb7c5d7a0f1a36
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "ManifestWriter.hxx"
21 #include "ManifestExport.hxx"
22 #include <cppuhelper/exc_hlp.hxx>
23 #include <cppuhelper/factory.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <com/sun/star/xml/sax/Writer.hpp>
26 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
27 #include <com/sun/star/xml/sax/SAXException.hpp>
29 #include <sal/log.hxx>
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::beans;
34 using namespace ::com::sun::star::io;
35 using namespace ::com::sun::star::lang;
36 using namespace ::com::sun::star::registry;
37 using namespace ::com::sun::star::packages;
38 using namespace ::com::sun::star::xml::sax;
40 #if OSL_DEBUG_LEVEL > 0
41 #define THROW_WHERE SAL_WHERE
42 #else
43 #define THROW_WHERE ""
44 #endif
46 ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext )
47 : m_xContext ( xContext )
50 ManifestWriter::~ManifestWriter()
54 // XManifestWriter methods
55 void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence )
57 Reference < XWriter > xSource = Writer::create( m_xContext );
58 xSource->setOutputStream ( rStream );
59 try {
60 ManifestExport( xSource, rSequence);
62 catch( SAXException& )
64 css::uno::Any anyEx = cppu::getCaughtException();
65 throw css::lang::WrappedTargetRuntimeException( THROW_WHERE,
66 nullptr, anyEx );
70 OUString ManifestWriter::getImplementationName()
72 return "com.sun.star.packages.manifest.comp.ManifestWriter";
75 sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName)
77 return cppu::supportsService(this, rServiceName);
79 Sequence < OUString > ManifestWriter::getSupportedServiceNames()
81 return { "com.sun.star.packages.manifest.ManifestWriter" };
85 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
86 package_ManifestWriter_get_implementation(
87 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
89 return cppu::acquire(new ManifestWriter(context));
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */