LibreOffice Module package (master) 1
ManifestWriter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "ManifestWriter.hxx"
21#include "ManifestExport.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>
28
29#include <sal/log.hxx>
30
31using namespace ::com::sun::star;
32using namespace ::com::sun::star::uno;
33using namespace ::com::sun::star::beans;
34using namespace ::com::sun::star::io;
35using namespace ::com::sun::star::lang;
36using namespace ::com::sun::star::registry;
37using namespace ::com::sun::star::packages;
38using namespace ::com::sun::star::xml::sax;
39
40#if OSL_DEBUG_LEVEL > 0
41#define THROW_WHERE SAL_WHERE
42#else
43#define THROW_WHERE ""
44#endif
45
46ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext )
47: m_xContext ( xContext )
48{
49}
51{
52}
53
54// XManifestWriter methods
55void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence )
56{
57 Reference < XWriter > xSource = Writer::create( m_xContext );
58 xSource->setOutputStream ( rStream );
59 try {
60 ManifestExport( xSource, rSequence);
61 }
62 catch( SAXException& )
63 {
64 css::uno::Any anyEx = cppu::getCaughtException();
65 throw css::lang::WrappedTargetRuntimeException( THROW_WHERE,
66 nullptr, anyEx );
67 }
68}
69
71{
72 return "com.sun.star.packages.manifest.comp.ManifestWriter";
73}
74
75sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName)
76{
77 return cppu::supportsService(this, rServiceName);
78}
80{
81 return { "com.sun.star.packages.manifest.ManifestWriter" };
82}
83
84
85extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
87 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
88{
89 return cppu::acquire(new ManifestWriter(context));
90}
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define THROW_WHERE
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * package_ManifestWriter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Reference< XComponentContext > m_xContext
virtual OUString SAL_CALL getImplementationName() override
virtual ~ManifestWriter() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL writeManifestSequence(const css::uno::Reference< css::io::XOutputStream > &rStream, const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &rSequence) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
ManifestWriter(const css::uno::Reference< css::uno::XComponentContext > &xContext)
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
unsigned char sal_Bool