/src/libreoffice/configmgr/source/childaccess.hxx
Line | Count | Source (jump to first uncovered line) |
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 | | #pragma once |
21 | | |
22 | | #include <sal/config.h> |
23 | | |
24 | | #include <memory> |
25 | | #include <optional> |
26 | | #include <vector> |
27 | | |
28 | | #include <com/sun/star/container/XChild.hpp> |
29 | | #include <com/sun/star/uno/Reference.hxx> |
30 | | #include <com/sun/star/uno/Sequence.hxx> |
31 | | #include <rtl/ref.hxx> |
32 | | #include <sal/types.h> |
33 | | |
34 | | #include "access.hxx" |
35 | | |
36 | | namespace configmgr { |
37 | | |
38 | | class Components; |
39 | | class Modifications; |
40 | | class Node; |
41 | | class RootAccess; |
42 | | |
43 | | class ChildAccess: |
44 | | public Access, public css::container::XChild |
45 | | { |
46 | | public: |
47 | | |
48 | | ChildAccess( |
49 | | Components & components, rtl::Reference< RootAccess > const & root, |
50 | | rtl::Reference< Access > const & parent, OUString name, |
51 | | rtl::Reference< Node > const & node); |
52 | | |
53 | | ChildAccess( |
54 | | Components & components, rtl::Reference< RootAccess > const & root, |
55 | | rtl::Reference< Node > const & node); |
56 | | |
57 | | virtual std::vector<OUString> getAbsolutePath() override; |
58 | | virtual std::vector<OUString> getRelativePath() override; |
59 | | |
60 | | virtual OUString getRelativePathRepresentation() override; |
61 | | virtual const rtl::Reference< Node > & getNode() override; |
62 | | |
63 | | virtual bool isFinalized() override; |
64 | | |
65 | | virtual const OUString & getNameInternal() override; |
66 | | |
67 | | virtual rtl::Reference< RootAccess > getRootAccess() override; |
68 | | virtual rtl::Reference< Access > getParentAccess() override; |
69 | | |
70 | | virtual void SAL_CALL acquire() noexcept override; |
71 | | virtual void SAL_CALL release() noexcept override; |
72 | | |
73 | | virtual css::uno::Reference< css::uno::XInterface > |
74 | | SAL_CALL getParent() override; |
75 | | |
76 | | virtual void SAL_CALL setParent( |
77 | | css::uno::Reference< css::uno::XInterface > const &) override; |
78 | | |
79 | | void bind( |
80 | | rtl::Reference< RootAccess > const & root, |
81 | | rtl::Reference< Access > const & parent, OUString const & name) |
82 | | noexcept; |
83 | | |
84 | | void unbind() noexcept; |
85 | | |
86 | 0 | bool isInTransaction() const { return inTransaction_; } |
87 | | void committed(); |
88 | | void setNode(rtl::Reference< Node > const & node); |
89 | | |
90 | | void setProperty( |
91 | | css::uno::Any const & value, |
92 | | Modifications * localModifications); |
93 | | |
94 | | css::uno::Any asValue(); |
95 | | static bool asSimpleValue(const rtl::Reference< Node > &rNode, |
96 | | css::uno::Any &value, |
97 | | Components &components); |
98 | | |
99 | | void commitChanges(bool valid, Modifications * globalModifications); |
100 | | |
101 | | private: |
102 | | virtual ~ChildAccess() override; |
103 | | |
104 | | virtual void addTypes( |
105 | | std::vector< css::uno::Type > * types) const override; |
106 | | |
107 | | virtual void addSupportedServiceNames( |
108 | | std::vector<OUString> * services) override; |
109 | | |
110 | | virtual css::uno::Any SAL_CALL queryInterface( |
111 | | css::uno::Type const & aType) override; |
112 | | |
113 | | rtl::Reference< RootAccess > root_; |
114 | | rtl::Reference< Access > parent_; // null if free node |
115 | | OUString name_; |
116 | | rtl::Reference< Node > node_; |
117 | | std::optional< css::uno::Any > changedValue_; |
118 | | bool inTransaction_; |
119 | | // to determine if a free node can be inserted underneath some root |
120 | | std::shared_ptr<osl::Mutex> lock_; |
121 | | }; |
122 | | |
123 | | } |
124 | | |
125 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |