cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / include / comphelper / ofopxmlhelper.hxx
blobfe778bf1e6cafbb348a01f3e493cdd3436b17550
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 #ifndef INCLUDED_COMPHELPER_OFOPXMLHELPER_HXX
21 #define INCLUDED_COMPHELPER_OFOPXMLHELPER_HXX
23 #include <sal/config.h>
25 #include <string_view>
27 #include <com/sun/star/uno/Sequence.h>
29 #include <comphelper/comphelperdllapi.h>
31 namespace com::sun::star::beans { struct StringPair; }
32 namespace com::sun::star::io { class XInputStream; }
33 namespace com::sun::star::io { class XOutputStream; }
34 namespace com::sun::star::uno { class XComponentContext; }
35 namespace com::sun::star::uno { template <class interface_type> class Reference; }
37 namespace comphelper::OFOPXMLHelper {
39 // returns sequence of elements, where each element is described by sequence of tags,
40 // where each tag is described by StringPair ( First - name, Second - value )
41 // the first tag of each element sequence must be "Id"
42 /// @throws css::uno::Exception
43 COMPHELPER_DLLPUBLIC
44 css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >
45 ReadRelationsInfoSequence(
46 const css::uno::Reference< css::io::XInputStream >& xInStream,
47 std::u16string_view aStreamName,
48 const css::uno::Reference< css::uno::XComponentContext >& rContext );
50 // returns sequence containing two entries of type sequence<StringPair>
51 // the first sequence describes "Default" elements, where each element is described
52 // by StringPair object ( First - Extension, Second - ContentType )
53 // the second sequence describes "Override" elements, where each element is described
54 // by StringPair object ( First - PartName, Second - ContentType )
55 /// @throws css::uno::Exception
56 COMPHELPER_DLLPUBLIC
57 css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >
58 ReadContentTypeSequence(
59 const css::uno::Reference< css::io::XInputStream >& xInStream,
60 const css::uno::Reference< css::uno::XComponentContext >& rContext );
62 // returns the ContentType for the given name, or empty when not found.
63 // rContentTypes is a sequence containing two entries of type sequence<StringPair>
64 // the first sequence describes "Default" elements, where each element is described
65 // by StringPair object ( First - Extension, Second - ContentType )
66 // the second sequence describes "Override" elements, where each element is described
67 // by StringPair object ( First - PartName, Second - ContentType )
68 // The "Override" sequence is searched first before falling back on "Default".
69 COMPHELPER_DLLPUBLIC
70 OUString
71 GetContentTypeByName(const css::uno::Sequence<css::uno::Sequence<css::beans::StringPair>>& rContentTypes,
72 const OUString& rFilename);
74 // writes sequence of elements, where each element is described by sequence of tags,
75 // where each tag is described by StringPair ( First - name, Second - value )
76 // the first tag of each element sequence must be "Id"
77 /// @throws css::uno::Exception
78 COMPHELPER_DLLPUBLIC
79 void WriteRelationsInfoSequence(
80 const css::uno::Reference< css::io::XOutputStream >& xOutStream,
81 const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >& aSequence,
82 const css::uno::Reference< css::uno::XComponentContext >& rContext );
84 // writes two entries of type sequence<StringPair>
85 // the first sequence describes "Default" elements, where each element is described
86 // by StringPair object ( First - Extension, Second - ContentType )
87 // the second sequence describes "Override" elements, where each element is described
88 // by StringPair object ( First - PartName, Second - ContentType )
89 /// @throws css::uno::Exception
90 COMPHELPER_DLLPUBLIC
91 void WriteContentSequence(
92 const css::uno::Reference< css::io::XOutputStream >& xOutStream,
93 const css::uno::Sequence< css::beans::StringPair >& aDefaultsSequence,
94 const css::uno::Sequence< css::beans::StringPair >& aOverridesSequence,
95 const css::uno::Reference< css::uno::XComponentContext >& rContext );
97 } // namespace comphelper::OFOPXMLHelper
99 #endif
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */