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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
23 #include <com/sun/star/xml/sax/XAttributeList.hpp>
25 #include <comphelper/namedvaluecollection.hxx>
26 #include <rtl/ref.hxx>
27 #include <rtl/ustrbuf.hxx>
28 #include <salhelper/simplereferenceobject.hxx>
34 /** a simplified version of xmloff/DocumentSettingsContext
36 It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport
37 class, so we could re-use it here ...
39 class SettingsImport
: public salhelper::SimpleReferenceObject
45 virtual ::rtl::Reference
< SettingsImport
> nextState(
46 const OUString
& i_rElementName
49 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& i_rAttributes
51 virtual void endElement();
52 void characters( const OUString
& i_rCharacters
);
55 virtual ~SettingsImport();
58 static void split( const OUString
& i_rElementName
, OUString
& o_rNamespace
, OUString
& o_rLocalName
);
61 const OUString
& getItemName() const { return m_sItemName
; }
62 const OUString
& getItemType() const { return m_sItemType
; }
63 const OUStringBuffer
& getAccumulatedCharacters() const { return m_aCharacters
; }
66 // value of the config:name attribute, if any
68 // value of the config:type attribute, if any
70 // accumulated characters, if any
71 OUStringBuffer m_aCharacters
;
74 // IgnoringSettingsImport
75 class IgnoringSettingsImport
: public SettingsImport
78 IgnoringSettingsImport()
82 // SettingsImport overridables
83 virtual ::rtl::Reference
< SettingsImport
> nextState(
84 const OUString
& i_rElementName
88 virtual ~IgnoringSettingsImport()
93 // OfficeSettingsImport
94 class OfficeSettingsImport
: public SettingsImport
97 OfficeSettingsImport( ::comphelper::NamedValueCollection
& o_rSettings
);
99 // SettingsImport overridables
100 virtual ::rtl::Reference
< SettingsImport
> nextState(
101 const OUString
& i_rElementName
105 virtual ~OfficeSettingsImport();
108 // the settings collection to which |this| will contribute a single setting
109 ::comphelper::NamedValueCollection
& m_rSettings
;
112 // ConfigItemSetImport
113 class ConfigItemImport
: public SettingsImport
116 ConfigItemImport( ::comphelper::NamedValueCollection
& o_rSettings
);
119 virtual ~ConfigItemImport();
122 // SettingsImport overridables
123 virtual ::rtl::Reference
< SettingsImport
> nextState(
124 const OUString
& i_rElementName
126 virtual void endElement() SAL_OVERRIDE
;
130 /// retrieves the value represented by the element
131 virtual void getItemValue( ::com::sun::star::uno::Any
& o_rValue
) const;
134 // the settings collection to which |this| will contribute a single setting
135 ::comphelper::NamedValueCollection
& m_rSettings
;
138 // ConfigItemSetImport
139 class ConfigItemSetImport
: public ConfigItemImport
142 ConfigItemSetImport( ::comphelper::NamedValueCollection
& o_rSettings
);
145 virtual ~ConfigItemSetImport();
148 // SettingsImport overridables
149 virtual ::rtl::Reference
< SettingsImport
> nextState(
150 const OUString
& i_rElementName
154 // ConfigItemImport overridables
155 virtual void getItemValue( ::com::sun::star::uno::Any
& o_rValue
) const SAL_OVERRIDE
;
158 /// the settings represented by our child elements
159 ::comphelper::NamedValueCollection m_aChildSettings
;
162 } // namespace dbaccess
164 #endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */