build fix
[LibreOffice.git] / configmgr / source / childaccess.hxx
blobdd81b251bb8b253ea99084fdef325fd4e8732f75
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
23 #include <sal/config.h>
25 #include <memory>
26 #include <vector>
28 #include <com/sun/star/container/XChild.hpp>
29 #include <com/sun/star/lang/NoSupportException.hpp>
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <com/sun/star/uno/RuntimeException.hpp>
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <rtl/ref.hxx>
35 #include <sal/types.h>
37 #include "access.hxx"
39 namespace com { namespace sun { namespace star { namespace uno {
40 class Any;
41 class Type;
42 class XInterface;
43 } } } }
45 namespace configmgr {
47 class Components;
48 class Modifications;
49 class Node;
50 class RootAccess;
52 class ChildAccess:
53 public Access, public css::container::XChild,
54 public css::lang::XUnoTunnel
56 public:
57 static css::uno::Sequence< sal_Int8 > getTunnelId();
59 ChildAccess(
60 Components & components, rtl::Reference< RootAccess > const & root,
61 rtl::Reference< Access > const & parent, OUString const & name,
62 rtl::Reference< Node > const & node);
64 ChildAccess(
65 Components & components, rtl::Reference< RootAccess > const & root,
66 rtl::Reference< Node > const & node);
68 virtual std::vector<OUString> getAbsolutePath() override;
69 virtual std::vector<OUString> getRelativePath() override;
71 virtual OUString getRelativePathRepresentation() override;
72 virtual rtl::Reference< Node > getNode() override;
74 virtual bool isFinalized() override;
76 virtual OUString getNameInternal() override;
78 virtual rtl::Reference< RootAccess > getRootAccess() override;
79 virtual rtl::Reference< Access > getParentAccess() override;
81 virtual void SAL_CALL acquire() throw () override;
82 virtual void SAL_CALL release() throw () override;
84 virtual css::uno::Reference< css::uno::XInterface >
85 SAL_CALL getParent()
86 throw (css::uno::RuntimeException, std::exception) override;
88 virtual void SAL_CALL setParent(
89 css::uno::Reference< css::uno::XInterface > const &)
90 throw (
91 css::lang::NoSupportException,
92 css::uno::RuntimeException, std::exception) override;
94 virtual sal_Int64 SAL_CALL getSomething(
95 css::uno::Sequence< sal_Int8 > const & aIdentifier)
96 throw (css::uno::RuntimeException, std::exception) override;
98 void bind(
99 rtl::Reference< RootAccess > const & root,
100 rtl::Reference< Access > const & parent, OUString const & name)
101 throw ();
103 void unbind() throw ();
105 bool isInTransaction() const { return inTransaction_; }
106 void committed();
107 void setNode(rtl::Reference< Node > const & node);
109 void setProperty(
110 css::uno::Any const & value,
111 Modifications * localModifications);
113 css::uno::Any asValue();
114 static bool asSimpleValue(const rtl::Reference< Node > &rNode,
115 css::uno::Any &value,
116 Components &components);
118 void commitChanges(bool valid, Modifications * globalModifications);
120 private:
121 virtual ~ChildAccess() override;
123 virtual void addTypes(
124 std::vector< css::uno::Type > * types) const override;
126 virtual void addSupportedServiceNames(
127 std::vector<OUString> * services) override;
129 virtual css::uno::Any SAL_CALL queryInterface(
130 css::uno::Type const & aType)
131 throw (css::uno::RuntimeException, std::exception) override;
133 rtl::Reference< RootAccess > root_;
134 rtl::Reference< Access > parent_; // null if free node
135 OUString name_;
136 rtl::Reference< Node > node_;
137 std::unique_ptr< css::uno::Any > changedValue_;
138 bool inTransaction_;
139 // to determine if a free node can be inserted underneath some root
140 std::shared_ptr<osl::Mutex> lock_;
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */