update dev300-m58
[ooovba.git] / configmgr / source / treemgr / valuemembernode.hxx
blob7fac04642569e1dd10b83c6f869c64c930ec6e26
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: valuemembernode.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_VALUEMEMBERNODE_HXX_
32 #define CONFIGMGR_VALUEMEMBERNODE_HXX_
34 #include "nodeimpl.hxx"
36 namespace configmgr
38 namespace configuration
40 //-----------------------------------------------------------------------------
41 /// handle class for values that are not nodes themselves, but members of a group
42 class ValueMemberNode
44 public:
45 class DeferredImpl;
46 private:
47 sharable::ValueNode * m_node;
48 rtl::Reference<DeferredImpl> m_xDeferredOperation;
49 private:
50 friend class GroupNodeImpl;
51 friend class DeferredGroupNodeImpl;
52 friend class ValueMemberUpdate;
54 /// create a ValueMemberNode for a given node
55 explicit ValueMemberNode(sharable::ValueNode * node);
56 /// create a deferred ValueMemberNode (xOriginal must not be empty)
57 ValueMemberNode(rtl::Reference<DeferredImpl> const& _xDeferred);
58 public:
59 ValueMemberNode(ValueMemberNode const& rOriginal);
60 ValueMemberNode& operator=(ValueMemberNode const& rOriginal);
61 ~ValueMemberNode();
63 /// does this wrap a valid value ?
64 bool isValid() const;
66 /// does this wrap a change
67 bool hasChange() const;
69 /// retrieve the name of the underlying node
70 rtl::OUString getNodeName() const;
71 /// retrieve the attributes
72 node::Attributes getAttributes() const;
74 /// Does this node assume its default value
75 bool isDefault() const;
76 /// is the default value of this node available
77 bool canGetDefaultValue() const;
78 /// retrieve the current value of this node
79 com::sun::star::uno::Any getValue() const;
80 /// retrieve the default value of this node
81 com::sun::star::uno::Any getDefaultValue() const;
83 com::sun::star::uno::Type getValueType() const;
86 //-------------------------------------------------------------------------
88 /// handle class for updating values that are members of a group
89 class ValueMemberUpdate
91 ValueMemberNode m_aMemberNode;
92 view::ViewStrategy * m_pStrategy;
93 private:
94 friend class view::ViewStrategy;
96 ValueMemberUpdate(ValueMemberNode const& rOriginal, view::ViewStrategy& _rStrategy)
97 : m_aMemberNode(rOriginal), m_pStrategy(&_rStrategy) {}
99 public:
100 /// does this wrap a valid value ?
101 bool isValid() const { return m_aMemberNode.isValid(); }
103 /// get access to the wrapped data
104 ValueMemberNode getNode() const { return m_aMemberNode; }
106 /// Set this node to a new value
107 void setValue(com::sun::star::uno::Any const& aNewValue);
109 /// Set this node to assume its default value
110 void setDefault();
113 //-----------------------------------------------------------------------------
117 #endif // CONFIGMGR_GROUPNODEBEHAVIOR_HXX_