1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <com/sun/star/xml/sax/XAttributeList.hpp>
24 #include <comphelper/namedvaluecollection.hxx>
25 #include <rtl/ref.hxx>
26 #include <rtl/ustrbuf.hxx>
27 #include <salhelper/simplereferenceobject.hxx>
33 /** a simplified version of xmloff/DocumentSettingsContext
35 It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport
36 class, so we could re-use it here ...
38 class SettingsImport
: public salhelper::SimpleReferenceObject
44 virtual ::rtl::Reference
< SettingsImport
> nextState(
45 const OUString
& i_rElementName
48 const css::uno::Reference
< css::xml::sax::XAttributeList
>& i_rAttributes
50 virtual void endElement();
51 void characters( std::u16string_view i_rCharacters
);
54 virtual ~SettingsImport() override
;
57 static void split( const OUString
& i_rElementName
, OUString
& o_rNamespace
, OUString
& o_rLocalName
);
60 const OUString
& getItemName() const { return m_sItemName
; }
61 const OUString
& getItemType() const { return m_sItemType
; }
62 const OUStringBuffer
& getAccumulatedCharacters() const { return m_aCharacters
; }
65 // value of the config:name attribute, if any
67 // value of the config:type attribute, if any
69 // accumulated characters, if any
70 OUStringBuffer m_aCharacters
;
73 // IgnoringSettingsImport
74 class IgnoringSettingsImport
: public SettingsImport
77 IgnoringSettingsImport()
81 // SettingsImport overridables
82 virtual ::rtl::Reference
< SettingsImport
> nextState(
83 const OUString
& i_rElementName
87 virtual ~IgnoringSettingsImport() override
92 // OfficeSettingsImport
93 class OfficeSettingsImport
: public SettingsImport
96 explicit OfficeSettingsImport( ::comphelper::NamedValueCollection
& o_rSettings
);
98 // SettingsImport overridables
99 virtual ::rtl::Reference
< SettingsImport
> nextState(
100 const OUString
& i_rElementName
104 virtual ~OfficeSettingsImport() override
;
107 // the settings collection to which |this| will contribute a single setting
108 ::comphelper::NamedValueCollection
& m_rSettings
;
111 // ConfigItemSetImport
112 class ConfigItemImport
: public SettingsImport
115 explicit ConfigItemImport( ::comphelper::NamedValueCollection
& o_rSettings
);
118 virtual ~ConfigItemImport() override
;
121 // SettingsImport overridables
122 virtual ::rtl::Reference
< SettingsImport
> nextState(
123 const OUString
& i_rElementName
125 virtual void endElement() override
;
129 /// retrieves the value represented by the element
130 virtual void getItemValue( css::uno::Any
& o_rValue
) const;
133 // the settings collection to which |this| will contribute a single setting
134 ::comphelper::NamedValueCollection
& m_rSettings
;
137 // ConfigItemSetImport
138 class ConfigItemSetImport
: public ConfigItemImport
141 explicit ConfigItemSetImport( ::comphelper::NamedValueCollection
& o_rSettings
);
144 virtual ~ConfigItemSetImport() override
;
147 // SettingsImport overridables
148 virtual ::rtl::Reference
< SettingsImport
> nextState(
149 const OUString
& i_rElementName
153 // ConfigItemImport overridables
154 virtual void getItemValue( css::uno::Any
& o_rValue
) const override
;
157 /// the settings represented by our child elements
158 ::comphelper::NamedValueCollection m_aChildSettings
;
161 } // namespace dbaccess
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */