LibreOffice Module dbaccess (master) 1
settingsimport.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/xml/sax/XAttributeList.hpp>
23
25#include <rtl/ref.hxx>
26#include <rtl/ustrbuf.hxx>
28
29namespace dbaccess
30{
31
32 // SettingsImport
39 {
40 public:
42
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
49 );
50 virtual void endElement();
51 void characters( std::u16string_view i_rCharacters );
52
53 protected:
54 virtual ~SettingsImport() override;
55
56 protected:
57 static void split( const OUString& i_rElementName, OUString& o_rNamespace, OUString& o_rLocalName );
58
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; }
63
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;
71 };
72
73 // IgnoringSettingsImport
75 {
76 public:
78 {
79 }
80
81 // SettingsImport overridables
82 virtual ::rtl::Reference< SettingsImport > nextState(
83 const OUString& i_rElementName
84 ) override;
85
86 private:
87 virtual ~IgnoringSettingsImport() override
88 {
89 }
90 };
91
92 // OfficeSettingsImport
94 {
95 public:
97
98 // SettingsImport overridables
99 virtual ::rtl::Reference< SettingsImport > nextState(
100 const OUString& i_rElementName
101 ) override;
102
103 protected:
104 virtual ~OfficeSettingsImport() override;
105
106 private:
107 // the settings collection to which |this| will contribute a single setting
109 };
110
111 // ConfigItemSetImport
113 {
114 public:
116
117 protected:
118 virtual ~ConfigItemImport() override;
119
120 public:
121 // SettingsImport overridables
122 virtual ::rtl::Reference< SettingsImport > nextState(
123 const OUString& i_rElementName
124 ) override;
125 virtual void endElement() override;
126
127 protected:
128 // own overridables
130 virtual void getItemValue( css::uno::Any& o_rValue ) const;
131
132 private:
133 // the settings collection to which |this| will contribute a single setting
135 };
136
137 // ConfigItemSetImport
139 {
140 public:
142
143 protected:
144 virtual ~ConfigItemSetImport() override;
145
146 public:
147 // SettingsImport overridables
148 virtual ::rtl::Reference< SettingsImport > nextState(
149 const OUString& i_rElementName
150 ) override;
151
152 protected:
153 // ConfigItemImport overridables
154 virtual void getItemValue( css::uno::Any& o_rValue ) const override;
155
156 private:
159 };
160
161} // namespace dbaccess
162
163/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ::rtl::Reference< SettingsImport > nextState(const OUString &i_rElementName) override
virtual ~ConfigItemImport() override
virtual void getItemValue(css::uno::Any &o_rValue) const
retrieves the value represented by the element
ConfigItemImport(::comphelper::NamedValueCollection &o_rSettings)
::comphelper::NamedValueCollection & m_rSettings
virtual void endElement() override
::comphelper::NamedValueCollection m_aChildSettings
the settings represented by our child elements
ConfigItemSetImport(::comphelper::NamedValueCollection &o_rSettings)
virtual ::rtl::Reference< SettingsImport > nextState(const OUString &i_rElementName) override
virtual void getItemValue(css::uno::Any &o_rValue) const override
retrieves the value represented by the element
virtual ~ConfigItemSetImport() override
virtual ~IgnoringSettingsImport() override
virtual ::rtl::Reference< SettingsImport > nextState(const OUString &i_rElementName) override
OfficeSettingsImport(::comphelper::NamedValueCollection &o_rSettings)
virtual ::rtl::Reference< SettingsImport > nextState(const OUString &i_rElementName) override
virtual ~OfficeSettingsImport() override
::comphelper::NamedValueCollection & m_rSettings
a simplified version of xmloff/DocumentSettingsContext
const OUStringBuffer & getAccumulatedCharacters() const
virtual ~SettingsImport() override
const OUString & getItemType() const
virtual ::rtl::Reference< SettingsImport > nextState(const OUString &i_rElementName)=0
void startElement(const css::uno::Reference< css::xml::sax::XAttributeList > &i_rAttributes)
OUStringBuffer m_aCharacters
static void split(const OUString &i_rElementName, OUString &o_rNamespace, OUString &o_rLocalName)
void characters(std::u16string_view i_rCharacters)
const OUString & getItemName() const