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