/src/libreoffice/package/source/manifest/ManifestWriter.cxx
Line | Count | Source |
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" |
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> |
28 | | |
29 | | #include <sal/log.hxx> |
30 | | |
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::packages; |
37 | | using namespace ::com::sun::star::xml::sax; |
38 | | |
39 | | ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext ) |
40 | 0 | : m_xContext ( xContext ) |
41 | 0 | { |
42 | 0 | } |
43 | | ManifestWriter::~ManifestWriter() |
44 | 0 | { |
45 | 0 | } |
46 | | |
47 | | // XManifestWriter methods |
48 | | void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence ) |
49 | 0 | { |
50 | 0 | Reference < XWriter > xSource = Writer::create( m_xContext ); |
51 | 0 | xSource->setOutputStream ( rStream ); |
52 | 0 | try { |
53 | 0 | ManifestExport( xSource, rSequence); |
54 | 0 | } |
55 | 0 | catch( SAXException& ) |
56 | 0 | { |
57 | 0 | css::uno::Any anyEx = cppu::getCaughtException(); |
58 | 0 | throw css::lang::WrappedTargetRuntimeException( u""_ustr, nullptr, anyEx ); |
59 | 0 | } |
60 | 0 | } |
61 | | |
62 | | OUString ManifestWriter::getImplementationName() |
63 | 0 | { |
64 | 0 | return u"com.sun.star.packages.manifest.comp.ManifestWriter"_ustr; |
65 | 0 | } |
66 | | |
67 | | sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName) |
68 | 0 | { |
69 | 0 | return cppu::supportsService(this, rServiceName); |
70 | 0 | } |
71 | | Sequence < OUString > ManifestWriter::getSupportedServiceNames() |
72 | 0 | { |
73 | 0 | return { u"com.sun.star.packages.manifest.ManifestWriter"_ustr }; |
74 | 0 | } |
75 | | |
76 | | |
77 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
78 | | package_ManifestWriter_get_implementation( |
79 | | css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) |
80 | 0 | { |
81 | 0 | return cppu::acquire(new ManifestWriter(context)); |
82 | 0 | } |
83 | | |
84 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |