/src/libreoffice/configmgr/source/rootaccess.hxx
Line | Count | Source |
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 <set> |
25 | | #include <vector> |
26 | | |
27 | | #include <com/sun/star/util/XChangesBatch.hpp> |
28 | | #include <com/sun/star/util/XChangesNotifier.hpp> |
29 | | #include <rtl/ref.hxx> |
30 | | #include <rtl/ustring.hxx> |
31 | | #include <sal/types.h> |
32 | | |
33 | | #include "access.hxx" |
34 | | #include "modifications.hxx" |
35 | | |
36 | | namespace com::sun::star { |
37 | | namespace util { class XChangesListener; } |
38 | | } |
39 | | |
40 | | namespace configmgr { |
41 | | |
42 | | class Components; |
43 | | class Node; |
44 | | |
45 | | class RootAccess: |
46 | | public Access, public css::util::XChangesNotifier, |
47 | | public css::util::XChangesBatch |
48 | | { |
49 | | public: |
50 | | RootAccess( |
51 | | Components & components, OUString pathRepresentation, |
52 | | OUString locale, bool update); |
53 | | |
54 | | virtual std::vector<OUString> getAbsolutePath() override; |
55 | | |
56 | | virtual void initBroadcaster( |
57 | | Modifications::Node const & modifications, Broadcaster * broadcaster) override; |
58 | | |
59 | | virtual void SAL_CALL acquire() noexcept override; |
60 | | |
61 | | virtual void SAL_CALL release() noexcept override; |
62 | | |
63 | | OUString const & getAbsolutePathRepresentation(); |
64 | | |
65 | 0 | const OUString& getLocale() const { return locale_;} |
66 | | |
67 | 0 | bool isUpdate() const { return update_;} |
68 | | |
69 | | void setAlive(bool b); |
70 | | |
71 | | virtual void SAL_CALL addChangesListener( |
72 | | css::uno::Reference< css::util::XChangesListener > |
73 | | const & aListener) override; |
74 | | |
75 | | virtual void SAL_CALL removeChangesListener( |
76 | | css::uno::Reference< css::util::XChangesListener > |
77 | | const & aListener) override; |
78 | | |
79 | | virtual void SAL_CALL commitChanges() override; |
80 | | |
81 | | virtual sal_Bool SAL_CALL hasPendingChanges() override; |
82 | | |
83 | | virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override; |
84 | | |
85 | | private: |
86 | | virtual ~RootAccess() override; |
87 | | |
88 | | virtual std::vector<OUString> getRelativePath() override; |
89 | | |
90 | | virtual OUString getRelativePathRepresentation() override; |
91 | | |
92 | | virtual const rtl::Reference< Node > & getNode() override; |
93 | | |
94 | | virtual bool isFinalized() override; |
95 | | |
96 | | virtual const OUString & getNameInternal() override; |
97 | | |
98 | | virtual rtl::Reference< RootAccess > getRootAccess() override; |
99 | | |
100 | | virtual rtl::Reference< Access > getParentAccess() override; |
101 | | |
102 | | virtual void addTypes(std::vector< css::uno::Type > * types) |
103 | | const override; |
104 | | |
105 | | virtual void addSupportedServiceNames( |
106 | | std::vector<OUString> * services) override; |
107 | | |
108 | | virtual void initDisposeBroadcaster(Broadcaster * broadcaster) override; |
109 | | |
110 | | virtual void clearListeners() noexcept override; |
111 | | |
112 | | virtual css::uno::Any SAL_CALL queryInterface( |
113 | | css::uno::Type const & aType) override; |
114 | | |
115 | | virtual OUString SAL_CALL getImplementationName() override; |
116 | | |
117 | | typedef |
118 | | std::multiset< |
119 | | css::uno::Reference< |
120 | | css::util::XChangesListener > > |
121 | | ChangesListeners; |
122 | | |
123 | | OUString pathRepresentation_; |
124 | | OUString locale_; |
125 | | std::vector<OUString> path_; |
126 | | rtl::Reference< Node > node_; |
127 | | OUString name_; |
128 | | ChangesListeners changesListeners_; |
129 | | |
130 | | std::shared_ptr<osl::Mutex> lock_; |
131 | | |
132 | | bool update_:1; |
133 | | bool finalized_:1; |
134 | | bool alive_:1; |
135 | | }; |
136 | | |
137 | | } |
138 | | |
139 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |