xref: /AOO41X/main/configmgr/source/node.hxx (revision 6edfcaa19960b54f10b3588a21f3523f7d2df0c0)
1a2faadffSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3a2faadffSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4a2faadffSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5a2faadffSAndrew Rist  * distributed with this work for additional information
6a2faadffSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7a2faadffSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8a2faadffSAndrew Rist  * "License"); you may not use this file except in compliance
9a2faadffSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11a2faadffSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13a2faadffSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14a2faadffSAndrew Rist  * software distributed under the License is distributed on an
15a2faadffSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16a2faadffSAndrew Rist  * KIND, either express or implied.  See the License for the
17a2faadffSAndrew Rist  * specific language governing permissions and limitations
18a2faadffSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20a2faadffSAndrew Rist  *************************************************************/
21a2faadffSAndrew Rist 
22a2faadffSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CONFIGMGR_SOURCE_NODE_HXX
25cdf0e10cSrcweir #define INCLUDED_CONFIGMGR_SOURCE_NODE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "rtl/ref.hxx"
30cdf0e10cSrcweir #include "salhelper/simplereferenceobject.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "nodemap.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace rtl { class OUString; }
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace configmgr {
37cdf0e10cSrcweir 
38*6edfcaa1SArrigo Marchiori /**
39*6edfcaa1SArrigo Marchiori  * Configuration element.
40*6edfcaa1SArrigo Marchiori  *
41*6edfcaa1SArrigo Marchiori  * This class represent either a "node" or a "property" in the words of the
42*6edfcaa1SArrigo Marchiori  * OpenOffice.org Registry Format (OOR).
43*6edfcaa1SArrigo Marchiori  */
44cdf0e10cSrcweir class Node: public salhelper::SimpleReferenceObject {
45cdf0e10cSrcweir public:
46*6edfcaa1SArrigo Marchiori     /// Identifies the type of configuration element.
47cdf0e10cSrcweir     enum Kind {
48*6edfcaa1SArrigo Marchiori         /** Property (<prop> element)
49*6edfcaa1SArrigo Marchiori          *
50*6edfcaa1SArrigo Marchiori          * Identifies instances of PropertyNode.
51*6edfcaa1SArrigo Marchiori          */
52*6edfcaa1SArrigo Marchiori         KIND_PROPERTY,
53*6edfcaa1SArrigo Marchiori         /** Localized property (<prop> element)
54*6edfcaa1SArrigo Marchiori          *
55*6edfcaa1SArrigo Marchiori          * Identifies instances of LocalizedPropertyNode.
56*6edfcaa1SArrigo Marchiori          */
57*6edfcaa1SArrigo Marchiori         KIND_LOCALIZED_PROPERTY,
58*6edfcaa1SArrigo Marchiori         /**
59*6edfcaa1SArrigo Marchiori          * Value of a property (<value> element)
60*6edfcaa1SArrigo Marchiori          *
61*6edfcaa1SArrigo Marchiori          * Identifies instances of LocalizedValueNode.
62*6edfcaa1SArrigo Marchiori          */
63*6edfcaa1SArrigo Marchiori         KIND_LOCALIZED_VALUE,
64*6edfcaa1SArrigo Marchiori         /** Group node (<node> element)
65*6edfcaa1SArrigo Marchiori          *
66*6edfcaa1SArrigo Marchiori          * Identifies instances of GroupNode.
67*6edfcaa1SArrigo Marchiori          */
68*6edfcaa1SArrigo Marchiori         KIND_GROUP,
69*6edfcaa1SArrigo Marchiori         /** Set node (<node> element)
70*6edfcaa1SArrigo Marchiori          *
71*6edfcaa1SArrigo Marchiori          * Identifies instances of SetNode.
72*6edfcaa1SArrigo Marchiori          */
73*6edfcaa1SArrigo Marchiori         KIND_SET,
74*6edfcaa1SArrigo Marchiori         /** Node to be deleted.
75*6edfcaa1SArrigo Marchiori          *
76*6edfcaa1SArrigo Marchiori          * This type of element is not present in the OOR. It is used as a
77*6edfcaa1SArrigo Marchiori          * placeholder for a node that is about to disappear.
78*6edfcaa1SArrigo Marchiori          *
79*6edfcaa1SArrigo Marchiori          * Identifies instances of WipedNode.
80*6edfcaa1SArrigo Marchiori          */
81*6edfcaa1SArrigo Marchiori         KIND_WIPED };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual Kind kind() const = 0;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     virtual rtl::Reference< Node > clone(bool keepTemplateName) const = 0;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     virtual NodeMap & getMembers();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     virtual rtl::OUString getTemplateName() const;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     virtual void setMandatory(int layer);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     virtual int getMandatory() const;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     void setLayer(int layer);
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     int getLayer() const;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     void setFinalized(int layer);
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     int getFinalized() const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     rtl::Reference< Node > getMember(rtl::OUString const & name);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir protected:
106cdf0e10cSrcweir     explicit Node(int layer);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     Node(const Node & other);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     virtual ~Node();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     virtual void clear();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     int layer_;
115cdf0e10cSrcweir     int finalized_;
116cdf0e10cSrcweir };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #endif
121