tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / core / recovery / settingsimport.hxx
blobbc29bd727b8f8a930f112c451c27f57c1c57e684
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 #pragma once
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>
29 namespace dbaccess
32 // SettingsImport
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
40 public:
41 SettingsImport();
43 // own overridables
44 virtual ::rtl::Reference< SettingsImport > nextState(
45 const OUString& i_rElementName
46 ) = 0;
47 void startElement(
48 const css::uno::Reference< css::xml::sax::XAttributeList >& i_rAttributes
50 virtual void endElement();
51 void characters( std::u16string_view i_rCharacters );
53 protected:
54 virtual ~SettingsImport() override;
56 protected:
57 static void split( const OUString& i_rElementName, OUString& o_rNamespace, OUString& o_rLocalName );
59 protected:
60 const OUString& getItemName() const { return m_sItemName; }
61 const OUString& getItemType() const { return m_sItemType; }
62 const OUStringBuffer& getAccumulatedCharacters() const { return m_aCharacters; }
64 private:
65 // value of the config:name attribute, if any
66 OUString m_sItemName;
67 // value of the config:type attribute, if any
68 OUString m_sItemType;
69 // accumulated characters, if any
70 OUStringBuffer m_aCharacters;
73 // IgnoringSettingsImport
74 class IgnoringSettingsImport : public SettingsImport
76 public:
77 IgnoringSettingsImport()
81 // SettingsImport overridables
82 virtual ::rtl::Reference< SettingsImport > nextState(
83 const OUString& i_rElementName
84 ) override;
86 private:
87 virtual ~IgnoringSettingsImport() override
92 // OfficeSettingsImport
93 class OfficeSettingsImport : public SettingsImport
95 public:
96 explicit OfficeSettingsImport( ::comphelper::NamedValueCollection& o_rSettings );
98 // SettingsImport overridables
99 virtual ::rtl::Reference< SettingsImport > nextState(
100 const OUString& i_rElementName
101 ) override;
103 protected:
104 virtual ~OfficeSettingsImport() override;
106 private:
107 // the settings collection to which |this| will contribute a single setting
108 ::comphelper::NamedValueCollection& m_rSettings;
111 // ConfigItemSetImport
112 class ConfigItemImport : public SettingsImport
114 public:
115 explicit ConfigItemImport( ::comphelper::NamedValueCollection& o_rSettings );
117 protected:
118 virtual ~ConfigItemImport() override;
120 public:
121 // SettingsImport overridables
122 virtual ::rtl::Reference< SettingsImport > nextState(
123 const OUString& i_rElementName
124 ) override;
125 virtual void endElement() override;
127 protected:
128 // own overridables
129 /// retrieves the value represented by the element
130 virtual void getItemValue( css::uno::Any& o_rValue ) const;
132 private:
133 // the settings collection to which |this| will contribute a single setting
134 ::comphelper::NamedValueCollection& m_rSettings;
137 // ConfigItemSetImport
138 class ConfigItemSetImport : public ConfigItemImport
140 public:
141 explicit ConfigItemSetImport( ::comphelper::NamedValueCollection& o_rSettings );
143 protected:
144 virtual ~ConfigItemSetImport() override;
146 public:
147 // SettingsImport overridables
148 virtual ::rtl::Reference< SettingsImport > nextState(
149 const OUString& i_rElementName
150 ) override;
152 protected:
153 // ConfigItemImport overridables
154 virtual void getItemValue( css::uno::Any& o_rValue ) const override;
156 private:
157 /// the settings represented by our child elements
158 ::comphelper::NamedValueCollection m_aChildSettings;
161 } // namespace dbaccess
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */