xref: /AOO41X/main/configmgr/source/childaccess.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "precompiled_configmgr.hxx"
29*cdf0e10cSrcweir #include "sal/config.h"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vector>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "com/sun/star/container/XChild.hpp"
34*cdf0e10cSrcweir #include "com/sun/star/lang/NoSupportException.hpp"
35*cdf0e10cSrcweir #include "com/sun/star/lang/XUnoTunnel.hpp"
36*cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx"
37*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
38*cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
39*cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
40*cdf0e10cSrcweir #include "com/sun/star/uno/Type.hxx"
41*cdf0e10cSrcweir #include "com/sun/star/uno/XInterface.hpp"
42*cdf0e10cSrcweir #include "cppu/unotype.hxx"
43*cdf0e10cSrcweir #include "cppuhelper/queryinterface.hxx"
44*cdf0e10cSrcweir #include "cppuhelper/weak.hxx"
45*cdf0e10cSrcweir #include "osl/diagnose.h"
46*cdf0e10cSrcweir #include "osl/mutex.hxx"
47*cdf0e10cSrcweir #include "rtl/ref.hxx"
48*cdf0e10cSrcweir #include "rtl/string.h"
49*cdf0e10cSrcweir #include "rtl/ustrbuf.hxx"
50*cdf0e10cSrcweir #include "rtl/ustring.h"
51*cdf0e10cSrcweir #include "rtl/ustring.hxx"
52*cdf0e10cSrcweir #include "rtl/uuid.h"
53*cdf0e10cSrcweir #include "sal/types.h"
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #include "access.hxx"
56*cdf0e10cSrcweir #include "childaccess.hxx"
57*cdf0e10cSrcweir #include "components.hxx"
58*cdf0e10cSrcweir #include "data.hxx"
59*cdf0e10cSrcweir #include "groupnode.hxx"
60*cdf0e10cSrcweir #include "localizedpropertynode.hxx"
61*cdf0e10cSrcweir #include "localizedvaluenode.hxx"
62*cdf0e10cSrcweir #include "lock.hxx"
63*cdf0e10cSrcweir #include "modifications.hxx"
64*cdf0e10cSrcweir #include "node.hxx"
65*cdf0e10cSrcweir #include "path.hxx"
66*cdf0e10cSrcweir #include "propertynode.hxx"
67*cdf0e10cSrcweir #include "rootaccess.hxx"
68*cdf0e10cSrcweir #include "setnode.hxx"
69*cdf0e10cSrcweir #include "type.hxx"
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir namespace configmgr {
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir namespace {
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir namespace css = com::sun::star;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir css::uno::Sequence< sal_Int8 > ChildAccess::getTunnelId() {
80*cdf0e10cSrcweir     static css::uno::Sequence< sal_Int8 > id;
81*cdf0e10cSrcweir     if (id.getLength() == 0) {
82*cdf0e10cSrcweir         css::uno::Sequence< sal_Int8 > uuid(16);
83*cdf0e10cSrcweir         rtl_createUuid(
84*cdf0e10cSrcweir             reinterpret_cast< sal_uInt8 * >(uuid.getArray()), 0, false);
85*cdf0e10cSrcweir         id = uuid;
86*cdf0e10cSrcweir     }
87*cdf0e10cSrcweir     return id;
88*cdf0e10cSrcweir }
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir ChildAccess::ChildAccess(
91*cdf0e10cSrcweir     Components & components, rtl::Reference< RootAccess > const & root,
92*cdf0e10cSrcweir     rtl::Reference< Access > const & parent, rtl::OUString const & name,
93*cdf0e10cSrcweir     rtl::Reference< Node > const & node):
94*cdf0e10cSrcweir     Access(components), root_(root), parent_(parent), name_(name), node_(node),
95*cdf0e10cSrcweir     inTransaction_(false)
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir     OSL_ASSERT(root.is() && parent.is() && node.is());
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir ChildAccess::ChildAccess(
101*cdf0e10cSrcweir     Components & components, rtl::Reference< RootAccess > const & root,
102*cdf0e10cSrcweir     rtl::Reference< Node > const & node):
103*cdf0e10cSrcweir     Access(components), root_(root), node_(node), inTransaction_(false)
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir     OSL_ASSERT(root.is() && node.is());
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir Path ChildAccess::getAbsolutePath() {
109*cdf0e10cSrcweir     OSL_ASSERT(getParentAccess().is());
110*cdf0e10cSrcweir     Path path(getParentAccess()->getAbsolutePath());
111*cdf0e10cSrcweir     path.push_back(name_);
112*cdf0e10cSrcweir     return path;
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir Path ChildAccess::getRelativePath() {
116*cdf0e10cSrcweir     Path path;
117*cdf0e10cSrcweir     rtl::Reference< Access > parent(getParentAccess());
118*cdf0e10cSrcweir     if (parent.is()) {
119*cdf0e10cSrcweir         path = parent->getRelativePath();
120*cdf0e10cSrcweir     }
121*cdf0e10cSrcweir     path.push_back(name_);
122*cdf0e10cSrcweir     return path;
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir rtl::OUString ChildAccess::getRelativePathRepresentation() {
126*cdf0e10cSrcweir     rtl::OUStringBuffer path;
127*cdf0e10cSrcweir     rtl::Reference< Access > parent(getParentAccess());
128*cdf0e10cSrcweir     if (parent.is()) {
129*cdf0e10cSrcweir         path.append(parent->getRelativePathRepresentation());
130*cdf0e10cSrcweir         if (path.getLength() != 0) {
131*cdf0e10cSrcweir             path.append(sal_Unicode('/'));
132*cdf0e10cSrcweir         }
133*cdf0e10cSrcweir     }
134*cdf0e10cSrcweir     path.append(Data::createSegment(node_->getTemplateName(), name_));
135*cdf0e10cSrcweir     return path.makeStringAndClear();
136*cdf0e10cSrcweir }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir rtl::Reference< Node > ChildAccess::getNode() {
139*cdf0e10cSrcweir     return node_;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir bool ChildAccess::isFinalized() {
143*cdf0e10cSrcweir     return node_->getFinalized() != Data::NO_LAYER ||
144*cdf0e10cSrcweir         (parent_.is() && parent_->isFinalized());
145*cdf0e10cSrcweir }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir rtl::OUString ChildAccess::getNameInternal() {
148*cdf0e10cSrcweir     return name_;
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir rtl::Reference< RootAccess > ChildAccess::getRootAccess() {
152*cdf0e10cSrcweir     return root_;
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir rtl::Reference< Access > ChildAccess::getParentAccess() {
156*cdf0e10cSrcweir     return parent_;
157*cdf0e10cSrcweir }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir void ChildAccess::acquire() throw () {
160*cdf0e10cSrcweir     Access::acquire();
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir void ChildAccess::release() throw () {
164*cdf0e10cSrcweir     Access::release();
165*cdf0e10cSrcweir }
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > ChildAccess::getParent()
168*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir     OSL_ASSERT(thisIs(IS_ANY));
171*cdf0e10cSrcweir     osl::MutexGuard g(lock);
172*cdf0e10cSrcweir     checkLocalizedPropertyAccess();
173*cdf0e10cSrcweir     return static_cast< cppu::OWeakObject * >(parent_.get());
174*cdf0e10cSrcweir }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &)
177*cdf0e10cSrcweir     throw (css::lang::NoSupportException, css::uno::RuntimeException)
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir     OSL_ASSERT(thisIs(IS_ANY));
180*cdf0e10cSrcweir     osl::MutexGuard g(lock);
181*cdf0e10cSrcweir     checkLocalizedPropertyAccess();
182*cdf0e10cSrcweir     throw css::lang::NoSupportException(
183*cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setParent")),
184*cdf0e10cSrcweir         static_cast< cppu::OWeakObject * >(this));
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir sal_Int64 ChildAccess::getSomething(
188*cdf0e10cSrcweir     css::uno::Sequence< sal_Int8 > const & aIdentifier)
189*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir     OSL_ASSERT(thisIs(IS_ANY));
192*cdf0e10cSrcweir     osl::MutexGuard g(lock);
193*cdf0e10cSrcweir     checkLocalizedPropertyAccess();
194*cdf0e10cSrcweir     return aIdentifier == getTunnelId()
195*cdf0e10cSrcweir         ? reinterpret_cast< sal_Int64 >(this) : 0;
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir void ChildAccess::bind(
199*cdf0e10cSrcweir     rtl::Reference< RootAccess > const & root,
200*cdf0e10cSrcweir     rtl::Reference< Access > const & parent, rtl::OUString const & name)
201*cdf0e10cSrcweir     throw ()
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir     OSL_ASSERT(
204*cdf0e10cSrcweir         !parent_.is() && root.is() && parent.is() && name.getLength() != 0);
205*cdf0e10cSrcweir     root_ = root;
206*cdf0e10cSrcweir     parent_ = parent;
207*cdf0e10cSrcweir     name_ = name;
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir void ChildAccess::unbind() throw () {
211*cdf0e10cSrcweir     OSL_ASSERT(parent_.is());
212*cdf0e10cSrcweir     parent_->releaseChild(name_);
213*cdf0e10cSrcweir     parent_.clear();
214*cdf0e10cSrcweir     inTransaction_ = true;
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir void ChildAccess::committed() {
218*cdf0e10cSrcweir     inTransaction_ = false;
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir void ChildAccess::setNode(rtl::Reference< Node > const & node) {
222*cdf0e10cSrcweir     node_ = node;
223*cdf0e10cSrcweir }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir void ChildAccess::setProperty(
226*cdf0e10cSrcweir     css::uno::Any const & value, Modifications * localModifications)
227*cdf0e10cSrcweir {
228*cdf0e10cSrcweir     OSL_ASSERT(localModifications != 0);
229*cdf0e10cSrcweir     Type type = TYPE_ERROR;
230*cdf0e10cSrcweir     bool nillable = false;
231*cdf0e10cSrcweir     switch (node_->kind()) {
232*cdf0e10cSrcweir     case Node::KIND_PROPERTY:
233*cdf0e10cSrcweir         {
234*cdf0e10cSrcweir             PropertyNode * prop = dynamic_cast< PropertyNode * >(node_.get());
235*cdf0e10cSrcweir             type = prop->getStaticType();
236*cdf0e10cSrcweir             nillable = prop->isNillable();
237*cdf0e10cSrcweir         }
238*cdf0e10cSrcweir         break;
239*cdf0e10cSrcweir     case Node::KIND_LOCALIZED_PROPERTY:
240*cdf0e10cSrcweir         {
241*cdf0e10cSrcweir             rtl::OUString locale(getRootAccess()->getLocale());
242*cdf0e10cSrcweir             if (!Components::allLocales(locale)) {
243*cdf0e10cSrcweir                 rtl::Reference< ChildAccess > child(getChild(locale));
244*cdf0e10cSrcweir                 if (child.is()) {
245*cdf0e10cSrcweir                     child->setProperty(value, localModifications);
246*cdf0e10cSrcweir                 } else {
247*cdf0e10cSrcweir                     insertLocalizedValueChild(
248*cdf0e10cSrcweir                         locale, value, localModifications);
249*cdf0e10cSrcweir                 }
250*cdf0e10cSrcweir                 return;
251*cdf0e10cSrcweir             }
252*cdf0e10cSrcweir         }
253*cdf0e10cSrcweir         break;
254*cdf0e10cSrcweir     case Node::KIND_LOCALIZED_VALUE:
255*cdf0e10cSrcweir         {
256*cdf0e10cSrcweir             LocalizedPropertyNode * locprop =
257*cdf0e10cSrcweir                 dynamic_cast< LocalizedPropertyNode * >(getParentNode().get());
258*cdf0e10cSrcweir             type = locprop->getStaticType();
259*cdf0e10cSrcweir             nillable = locprop->isNillable();
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir         break;
262*cdf0e10cSrcweir     default:
263*cdf0e10cSrcweir         break;
264*cdf0e10cSrcweir     }
265*cdf0e10cSrcweir     checkValue(value, type, nillable);
266*cdf0e10cSrcweir     getParentAccess()->markChildAsModified(this);
267*cdf0e10cSrcweir     changedValue_.reset(new css::uno::Any(value));
268*cdf0e10cSrcweir     localModifications->add(getRelativePath());
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir css::uno::Any ChildAccess::asValue() {
272*cdf0e10cSrcweir     if (changedValue_.get() != 0) {
273*cdf0e10cSrcweir         return *changedValue_;
274*cdf0e10cSrcweir     }
275*cdf0e10cSrcweir     switch (node_->kind()) {
276*cdf0e10cSrcweir     case Node::KIND_PROPERTY:
277*cdf0e10cSrcweir         return dynamic_cast< PropertyNode * >(node_.get())->getValue(
278*cdf0e10cSrcweir             getComponents());
279*cdf0e10cSrcweir     case Node::KIND_LOCALIZED_PROPERTY:
280*cdf0e10cSrcweir         {
281*cdf0e10cSrcweir             rtl::OUString locale(getRootAccess()->getLocale());
282*cdf0e10cSrcweir             if (!Components::allLocales(locale)) {
283*cdf0e10cSrcweir                 // Find best match using an adaption of RFC 4647 lookup matching
284*cdf0e10cSrcweir                 // rules, removing "-" or "_" delimited segments from the end;
285*cdf0e10cSrcweir                 // defaults are the "en-US" locale, the "en" locale, the empty
286*cdf0e10cSrcweir                 // string locale, the first child (if any), or a nil value (even
287*cdf0e10cSrcweir                 // though it may be illegal for the given property), in that
288*cdf0e10cSrcweir                 // order:
289*cdf0e10cSrcweir                 rtl::Reference< ChildAccess > child;
290*cdf0e10cSrcweir                 for (;;) {
291*cdf0e10cSrcweir                     child = getChild(locale);
292*cdf0e10cSrcweir                     if (child.is() || locale.getLength() == 0) {
293*cdf0e10cSrcweir                         break;
294*cdf0e10cSrcweir                     }
295*cdf0e10cSrcweir                     sal_Int32 i = locale.getLength() - 1;
296*cdf0e10cSrcweir                     while (i > 0 && locale[i] != '-' && locale[i] != '_') {
297*cdf0e10cSrcweir                         --i;
298*cdf0e10cSrcweir                     }
299*cdf0e10cSrcweir                     if (i == 0) {
300*cdf0e10cSrcweir                         break;
301*cdf0e10cSrcweir                     }
302*cdf0e10cSrcweir                     locale = locale.copy(0, i);
303*cdf0e10cSrcweir                 }
304*cdf0e10cSrcweir                 if (!child.is()) {
305*cdf0e10cSrcweir                     child = getChild(
306*cdf0e10cSrcweir                         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")));
307*cdf0e10cSrcweir                     if (!child.is()) {
308*cdf0e10cSrcweir                         child = getChild(
309*cdf0e10cSrcweir                             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")));
310*cdf0e10cSrcweir                         if (!child.is()) {
311*cdf0e10cSrcweir                             child = getChild(rtl::OUString());
312*cdf0e10cSrcweir                             if (!child.is()) {
313*cdf0e10cSrcweir                                 std::vector< rtl::Reference< ChildAccess > >
314*cdf0e10cSrcweir                                     all(getAllChildren());
315*cdf0e10cSrcweir                                 if (!all.empty()) {
316*cdf0e10cSrcweir                                     child = all.front();
317*cdf0e10cSrcweir                                 }
318*cdf0e10cSrcweir                             }
319*cdf0e10cSrcweir                         }
320*cdf0e10cSrcweir                     }
321*cdf0e10cSrcweir                 }
322*cdf0e10cSrcweir                 return child.is() ? child->asValue() : css::uno::Any();
323*cdf0e10cSrcweir             }
324*cdf0e10cSrcweir         }
325*cdf0e10cSrcweir         break;
326*cdf0e10cSrcweir     case Node::KIND_LOCALIZED_VALUE:
327*cdf0e10cSrcweir         return dynamic_cast< LocalizedValueNode * >(node_.get())->getValue();
328*cdf0e10cSrcweir     default:
329*cdf0e10cSrcweir         break;
330*cdf0e10cSrcweir     }
331*cdf0e10cSrcweir     return css::uno::makeAny(
332*cdf0e10cSrcweir         css::uno::Reference< css::uno::XInterface >(
333*cdf0e10cSrcweir             static_cast< cppu::OWeakObject * >(this)));
334*cdf0e10cSrcweir }
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
337*cdf0e10cSrcweir {
338*cdf0e10cSrcweir     OSL_ASSERT(globalModifications != 0);
339*cdf0e10cSrcweir     commitChildChanges(valid, globalModifications);
340*cdf0e10cSrcweir     if (valid && changedValue_.get() != 0) {
341*cdf0e10cSrcweir         Path path(getAbsolutePath());
342*cdf0e10cSrcweir         getComponents().addModification(path);
343*cdf0e10cSrcweir         globalModifications->add(path);
344*cdf0e10cSrcweir         switch (node_->kind()) {
345*cdf0e10cSrcweir         case Node::KIND_PROPERTY:
346*cdf0e10cSrcweir             dynamic_cast< PropertyNode * >(node_.get())->setValue(
347*cdf0e10cSrcweir                 Data::NO_LAYER, *changedValue_);
348*cdf0e10cSrcweir             break;
349*cdf0e10cSrcweir         case Node::KIND_LOCALIZED_VALUE:
350*cdf0e10cSrcweir             dynamic_cast< LocalizedValueNode * >(node_.get())->setValue(
351*cdf0e10cSrcweir                 Data::NO_LAYER, *changedValue_);
352*cdf0e10cSrcweir             break;
353*cdf0e10cSrcweir         default:
354*cdf0e10cSrcweir             OSL_ASSERT(false); // this cannot happen
355*cdf0e10cSrcweir             break;
356*cdf0e10cSrcweir         }
357*cdf0e10cSrcweir     }
358*cdf0e10cSrcweir     changedValue_.reset();
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir ChildAccess::~ChildAccess() {
362*cdf0e10cSrcweir     osl::MutexGuard g(lock);
363*cdf0e10cSrcweir     if (parent_.is()) {
364*cdf0e10cSrcweir         parent_->releaseChild(name_);
365*cdf0e10cSrcweir     }
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const {
369*cdf0e10cSrcweir     OSL_ASSERT(types != 0);
370*cdf0e10cSrcweir     types->push_back(cppu::UnoType< css::container::XChild >::get());
371*cdf0e10cSrcweir     types->push_back(cppu::UnoType< css::lang::XUnoTunnel >::get());
372*cdf0e10cSrcweir }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir void ChildAccess::addSupportedServiceNames(
375*cdf0e10cSrcweir     std::vector< rtl::OUString > * services)
376*cdf0e10cSrcweir {
377*cdf0e10cSrcweir     OSL_ASSERT(services != 0);
378*cdf0e10cSrcweir     services->push_back(
379*cdf0e10cSrcweir         getParentNode()->kind() == Node::KIND_GROUP
380*cdf0e10cSrcweir         ? rtl::OUString(
381*cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
382*cdf0e10cSrcweir                 "com.sun.star.configuration.GroupElement"))
383*cdf0e10cSrcweir         : rtl::OUString(
384*cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM(
385*cdf0e10cSrcweir                 "com.sun.star.configuration.SetElement")));
386*cdf0e10cSrcweir }
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType)
389*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
390*cdf0e10cSrcweir {
391*cdf0e10cSrcweir     OSL_ASSERT(thisIs(IS_ANY));
392*cdf0e10cSrcweir     osl::MutexGuard g(lock);
393*cdf0e10cSrcweir     checkLocalizedPropertyAccess();
394*cdf0e10cSrcweir     css::uno::Any res(Access::queryInterface(aType));
395*cdf0e10cSrcweir     return res.hasValue()
396*cdf0e10cSrcweir         ? res
397*cdf0e10cSrcweir         : cppu::queryInterface(
398*cdf0e10cSrcweir             aType, static_cast< css::container::XChild * >(this),
399*cdf0e10cSrcweir             static_cast< css::lang::XUnoTunnel * >(this));
400*cdf0e10cSrcweir }
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir }
403