Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
21 : #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
22 :
23 : #include <sal/config.h>
24 :
25 : #include <memory>
26 : #include <vector>
27 :
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>
36 :
37 : #include "access.hxx"
38 : #include "path.hxx"
39 :
40 : namespace com { namespace sun { namespace star { namespace uno {
41 : class Any;
42 : class Type;
43 : class XInterface;
44 : } } } }
45 :
46 : namespace configmgr {
47 :
48 : class Components;
49 : class Modifications;
50 : class Node;
51 : class RootAccess;
52 :
53 : class ChildAccess:
54 : public Access, public com::sun::star::container::XChild,
55 : public com::sun::star::lang::XUnoTunnel
56 : {
57 : public:
58 : static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId();
59 :
60 : ChildAccess(
61 : Components & components, rtl::Reference< RootAccess > const & root,
62 : rtl::Reference< Access > const & parent, OUString const & name,
63 : rtl::Reference< Node > const & node);
64 :
65 : ChildAccess(
66 : Components & components, rtl::Reference< RootAccess > const & root,
67 : rtl::Reference< Node > const & node);
68 :
69 : virtual Path getAbsolutePath() SAL_OVERRIDE;
70 : virtual Path getRelativePath() SAL_OVERRIDE;
71 :
72 : virtual OUString getRelativePathRepresentation() SAL_OVERRIDE;
73 : virtual rtl::Reference< Node > getNode() SAL_OVERRIDE;
74 :
75 : virtual bool isFinalized() SAL_OVERRIDE;
76 :
77 : virtual OUString getNameInternal() SAL_OVERRIDE;
78 :
79 : virtual rtl::Reference< RootAccess > getRootAccess() SAL_OVERRIDE;
80 : virtual rtl::Reference< Access > getParentAccess() SAL_OVERRIDE;
81 :
82 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
83 : virtual void SAL_CALL release() throw () SAL_OVERRIDE;
84 :
85 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
86 : SAL_CALL getParent()
87 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : virtual void SAL_CALL setParent(
90 : com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
91 : const &)
92 : throw (
93 : com::sun::star::lang::NoSupportException,
94 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 :
96 : virtual sal_Int64 SAL_CALL getSomething(
97 : com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier)
98 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : void bind(
101 : rtl::Reference< RootAccess > const & root,
102 : rtl::Reference< Access > const & parent, OUString const & name)
103 : throw ();
104 :
105 : void unbind() throw ();
106 :
107 3121 : bool isInTransaction() const { return inTransaction_; }
108 : void committed();
109 : void setNode(rtl::Reference< Node > const & node);
110 :
111 : void setProperty(
112 : com::sun::star::uno::Any const & value,
113 : Modifications * localModifications);
114 :
115 : css::uno::Any asValue();
116 : static bool asSimpleValue(const rtl::Reference< Node > &rNode,
117 : css::uno::Any &value,
118 : Components &components);
119 :
120 : void commitChanges(bool valid, Modifications * globalModifications);
121 :
122 : private:
123 : virtual ~ChildAccess();
124 :
125 : virtual void addTypes(
126 : std::vector< com::sun::star::uno::Type > * types) const SAL_OVERRIDE;
127 :
128 : virtual void addSupportedServiceNames(
129 : std::vector< OUString > * services) SAL_OVERRIDE;
130 :
131 : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
132 : com::sun::star::uno::Type const & aType)
133 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : rtl::Reference< RootAccess > root_;
136 : rtl::Reference< Access > parent_; // null if free node
137 : OUString name_;
138 : rtl::Reference< Node > node_;
139 : std::unique_ptr< com::sun::star::uno::Any > changedValue_;
140 : bool inTransaction_;
141 : // to determine if a free node can be inserted underneath some root
142 : std::shared_ptr<osl::Mutex> lock_;
143 : };
144 :
145 : }
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|