1*a2faadffSAndrew Rist /**************************************************************
2*a2faadffSAndrew Rist  *
3*a2faadffSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a2faadffSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a2faadffSAndrew Rist  * distributed with this work for additional information
6*a2faadffSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a2faadffSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a2faadffSAndrew Rist  * "License"); you may not use this file except in compliance
9*a2faadffSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a2faadffSAndrew Rist  *
11*a2faadffSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a2faadffSAndrew Rist  *
13*a2faadffSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a2faadffSAndrew Rist  * software distributed under the License is distributed on an
15*a2faadffSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a2faadffSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a2faadffSAndrew Rist  * specific language governing permissions and limitations
18*a2faadffSAndrew Rist  * under the License.
19*a2faadffSAndrew Rist  *
20*a2faadffSAndrew Rist  *************************************************************/
21*a2faadffSAndrew Rist 
22*a2faadffSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
25cdf0e10cSrcweir #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <memory>
30cdf0e10cSrcweir #include <vector>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "com/sun/star/container/XChild.hpp"
33cdf0e10cSrcweir #include "com/sun/star/lang/NoSupportException.hpp"
34cdf0e10cSrcweir #include "com/sun/star/lang/XUnoTunnel.hpp"
35cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
36cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
37cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
38cdf0e10cSrcweir #include "rtl/ref.hxx"
39cdf0e10cSrcweir #include "sal/types.h"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include "access.hxx"
42cdf0e10cSrcweir #include "path.hxx"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace uno {
45cdf0e10cSrcweir     class Any;
46cdf0e10cSrcweir     class Type;
47cdf0e10cSrcweir     class XInterface;
48cdf0e10cSrcweir } } } }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace configmgr {
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class Components;
53cdf0e10cSrcweir class Modifications;
54cdf0e10cSrcweir class Node;
55cdf0e10cSrcweir class RootAccess;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class ChildAccess:
58cdf0e10cSrcweir     public Access, public com::sun::star::container::XChild,
59cdf0e10cSrcweir     public com::sun::star::lang::XUnoTunnel
60cdf0e10cSrcweir {
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir     static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     ChildAccess(
65cdf0e10cSrcweir         Components & components, rtl::Reference< RootAccess > const & root,
66cdf0e10cSrcweir         rtl::Reference< Access > const & parent, rtl::OUString const & name,
67cdf0e10cSrcweir         rtl::Reference< Node > const & node);
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     ChildAccess(
70cdf0e10cSrcweir         Components & components, rtl::Reference< RootAccess > const & root,
71cdf0e10cSrcweir         rtl::Reference< Node > const & node);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     virtual Path getAbsolutePath();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     virtual Path getRelativePath();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     virtual rtl::OUString getRelativePathRepresentation();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual rtl::Reference< Node > getNode();
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     virtual bool isFinalized();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual rtl::OUString getNameInternal();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     virtual rtl::Reference< RootAccess > getRootAccess();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     virtual rtl::Reference< Access > getParentAccess();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     virtual void SAL_CALL acquire() throw ();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     virtual void SAL_CALL release() throw ();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
94cdf0e10cSrcweir     SAL_CALL getParent()
95cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual void SAL_CALL setParent(
98cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
99cdf0e10cSrcweir             const &)
100cdf0e10cSrcweir         throw (
101cdf0e10cSrcweir             com::sun::star::lang::NoSupportException,
102cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething(
105cdf0e10cSrcweir         com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier)
106cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     void bind(
109cdf0e10cSrcweir         rtl::Reference< RootAccess > const & root,
110cdf0e10cSrcweir         rtl::Reference< Access > const & parent, rtl::OUString const & name)
111cdf0e10cSrcweir         throw ();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     void unbind() throw ();
114cdf0e10cSrcweir 
isInTransaction() const115cdf0e10cSrcweir     bool isInTransaction() const { return inTransaction_; }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     void committed();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     void setNode(rtl::Reference< Node > const & node);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     void setProperty(
122cdf0e10cSrcweir         com::sun::star::uno::Any const & value,
123cdf0e10cSrcweir         Modifications * localModifications);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     com::sun::star::uno::Any asValue();
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     void commitChanges(bool valid, Modifications * globalModifications);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir private:
130cdf0e10cSrcweir     virtual ~ChildAccess();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     virtual void addTypes(
133cdf0e10cSrcweir         std::vector< com::sun::star::uno::Type > * types) const;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     virtual void addSupportedServiceNames(
136cdf0e10cSrcweir         std::vector< rtl::OUString > * services);
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     virtual com::sun::star::uno::Any SAL_CALL queryInterface(
139cdf0e10cSrcweir         com::sun::star::uno::Type const & aType)
140cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     rtl::Reference< RootAccess > root_;
143cdf0e10cSrcweir     rtl::Reference< Access > parent_; // null iff free node
144cdf0e10cSrcweir     rtl::OUString name_;
145cdf0e10cSrcweir     rtl::Reference< Node > node_;
146cdf0e10cSrcweir     std::auto_ptr< com::sun::star::uno::Any > changedValue_;
147cdf0e10cSrcweir     bool inTransaction_;
148cdf0e10cSrcweir         // to determine if a free node can be inserted underneath some root
149cdf0e10cSrcweir };
150cdf0e10cSrcweir 
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir #endif
154