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 #ifndef INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX
21 #define INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX
22 
23 #include <sal/config.h>
24 
25 #include <string_view>
26 
27 #include <xmloff/dllapi.h>
28 
29 #include <com/sun/star/uno/Reference.hxx>
30 
31 namespace com::sun::star::beans { struct PropertyValue; }
32 namespace com::sun::star::formula { struct SymbolDescriptor; }
33 namespace com::sun::star::util { class XStringSubstitution; }
34 
35 namespace com
36 {
37     namespace sun::star {
38         namespace container { class XNameAccess; class XIndexAccess; }
39         namespace util { struct DateTime; }
40     }
41 }
42 
43 namespace xmloff
44 {
45     class XMLSettingsExportContext;
46 }
47 
48 class XMLOFF_DLLPUBLIC XMLSettingsExportHelper
49 {
50     ::xmloff::XMLSettingsExportContext& m_rContext;
51 
52     css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution;
53 
54     void ManipulateSetting( css::uno::Any& rAny, std::u16string_view rName ) const;
55 
56     void CallTypeFunction(const css::uno::Any& rAny,
57                         const OUString& rName) const;
58 
59     void exportBool(const bool bValue, const OUString& rName) const;
60     static void exportByte();
61     void exportShort(const sal_Int16 nValue, const OUString& rName) const;
62     void exportInt(const sal_Int32 nValue, const OUString& rName) const;
63     void exportLong(const sal_Int64 nValue, const OUString& rName) const;
64     void exportDouble(const double fValue, const OUString& rName) const;
65     void exportString(const OUString& sValue, const OUString& rName) const;
66     void exportDateTime(const css::util::DateTime& aValue, const OUString& rName) const;
67     void exportSequencePropertyValue(
68         const css::uno::Sequence<css::beans::PropertyValue>& aProps,
69         const OUString& rName) const;
70     void exportbase64Binary(
71         const css::uno::Sequence<sal_Int8>& aProps,
72         const OUString& rName) const;
73     void exportMapEntry(const css::uno::Any& rAny,
74                         const OUString& rName,
75                         const bool bNameAccess) const;
76     void exportNameAccess(
77         const css::uno::Reference<css::container::XNameAccess>& rNamed,
78         const OUString& rName) const;
79     void exportIndexAccess(
80         const css::uno::Reference<css::container::XIndexAccess>& rIndexed,
81         const OUString& rName) const;
82 
83     void exportSymbolDescriptors(
84                     const css::uno::Sequence < css::formula::SymbolDescriptor > &rProps,
85                     const OUString& rName) const;
86     void exportForbiddenCharacters(
87                     const css::uno::Any &rAny,
88                     const OUString& rName) const;
89 
90 public:
91     XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext );
92     ~XMLSettingsExportHelper();
93 
94     void exportAllSettings(
95         const css::uno::Sequence<css::beans::PropertyValue>& aProps,
96         const OUString& rName) const;
97 };
98 
99 #endif
100 
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
102