xref: /aoo41x/main/configmgr/source/groupnode.cxx (revision cdf0e10c)
1 /*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27 
28 #include "precompiled_configmgr.hxx"
29 #include "sal/config.h"
30 
31 #include "rtl/ref.hxx"
32 #include "rtl/ustring.hxx"
33 
34 #include "data.hxx"
35 #include "groupnode.hxx"
36 #include "node.hxx"
37 #include "nodemap.hxx"
38 
39 namespace configmgr {
40 
41 GroupNode::GroupNode(
42     int layer, bool extensible, rtl::OUString const & templateName):
43     Node(layer), extensible_(extensible), templateName_(templateName),
44     mandatory_(Data::NO_LAYER)
45 {}
46 
47 rtl::Reference< Node > GroupNode::clone(bool keepTemplateName) const {
48     return new GroupNode(*this, keepTemplateName);
49 }
50 
51 NodeMap & GroupNode::getMembers() {
52     return members_;
53 }
54 
55 rtl::OUString GroupNode::getTemplateName() const {
56     return templateName_;
57 }
58 
59 void GroupNode::setMandatory(int layer) {
60     mandatory_ = layer;
61 }
62 
63 int GroupNode::getMandatory() const {
64     return mandatory_;
65 }
66 
67 bool GroupNode::isExtensible() const {
68     return extensible_;
69 }
70 
71 GroupNode::GroupNode(GroupNode const & other, bool keepTemplateName):
72     Node(other), extensible_(other.extensible_), mandatory_(other.mandatory_)
73 {
74     cloneNodeMap(other.members_, &members_);
75     if (keepTemplateName) {
76         templateName_ = other.templateName_;
77     }
78 }
79 
80 GroupNode::~GroupNode() {}
81 
82 Node::Kind GroupNode::kind() const {
83     return KIND_GROUP;
84 }
85 
86 void GroupNode::clear() {
87     members_.clear();
88 }
89 
90 }
91