Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / configmgr / source / rootaccess.hxx
blob042c2afeaaf41ba54cd824603b658677b50a3d93
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_ROOTACCESS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_ROOTACCESS_HXX
23 #include <sal/config.h>
25 #include <memory>
26 #include <set>
27 #include <vector>
29 #include <com/sun/star/util/XChangesBatch.hpp>
30 #include <com/sun/star/util/XChangesNotifier.hpp>
31 #include <rtl/ref.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
35 #include "access.hxx"
36 #include "modifications.hxx"
38 namespace com { namespace sun { namespace star {
39 namespace uno {
40 class Any;
41 class Type;
43 namespace util { class XChangesListener; }
44 } } }
46 namespace configmgr {
48 class Broadcaster;
49 class Components;
50 class Node;
52 class RootAccess:
53 public Access, public css::util::XChangesNotifier,
54 public css::util::XChangesBatch
56 public:
57 RootAccess(
58 Components & components, OUString const & pathRepresentation,
59 OUString const & locale, bool update);
61 virtual std::vector<OUString> getAbsolutePath() override;
63 virtual void initBroadcaster(
64 Modifications::Node const & modifications, Broadcaster * broadcaster) override;
66 virtual void SAL_CALL acquire() throw () override;
68 virtual void SAL_CALL release() throw () override;
70 OUString const & getAbsolutePathRepresentation();
72 const OUString& getLocale() const { return locale_;}
74 bool isUpdate() const { return update_;}
76 void setAlive(bool b);
78 virtual void SAL_CALL addChangesListener(
79 css::uno::Reference< css::util::XChangesListener >
80 const & aListener) override;
82 virtual void SAL_CALL removeChangesListener(
83 css::uno::Reference< css::util::XChangesListener >
84 const & aListener) override;
86 virtual void SAL_CALL commitChanges() override;
88 virtual sal_Bool SAL_CALL hasPendingChanges() override;
90 virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override;
92 private:
93 virtual ~RootAccess() override;
95 virtual std::vector<OUString> getRelativePath() override;
97 virtual OUString getRelativePathRepresentation() override;
99 virtual rtl::Reference< Node > getNode() override;
101 virtual bool isFinalized() override;
103 virtual OUString getNameInternal() override;
105 virtual rtl::Reference< RootAccess > getRootAccess() override;
107 virtual rtl::Reference< Access > getParentAccess() override;
109 virtual void addTypes(std::vector< css::uno::Type > * types)
110 const override;
112 virtual void addSupportedServiceNames(
113 std::vector<OUString> * services) override;
115 virtual void initDisposeBroadcaster(Broadcaster * broadcaster) override;
117 virtual void clearListeners() throw () override;
119 virtual css::uno::Any SAL_CALL queryInterface(
120 css::uno::Type const & aType) override;
122 virtual OUString SAL_CALL getImplementationName() override;
124 typedef
125 std::multiset<
126 css::uno::Reference<
127 css::util::XChangesListener > >
128 ChangesListeners;
130 OUString pathRepresentation_;
131 OUString locale_;
132 std::vector<OUString> path_;
133 rtl::Reference< Node > node_;
134 OUString name_;
135 ChangesListeners changesListeners_;
137 std::shared_ptr<osl::Mutex> lock_;
139 bool update_:1;
140 bool finalized_:1;
141 bool alive_:1;
146 #endif
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */