LibreOffice Module configmgr (master)  1
rootaccess.hxx
Go to the documentation of this file.
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 uno {
38  class Any;
39  class Type;
40  }
41  namespace util { class XChangesListener; }
42 }
43 
44 namespace configmgr {
45 
46 class Broadcaster;
47 class Components;
48 class Node;
49 
50 class RootAccess:
51  public Access, public css::util::XChangesNotifier,
52  public css::util::XChangesBatch
53 {
54 public:
55  RootAccess(
56  Components & components, OUString const & pathRepresentation,
57  OUString const & locale, bool update);
58 
59  virtual std::vector<OUString> getAbsolutePath() override;
60 
61  virtual void initBroadcaster(
62  Modifications::Node const & modifications, Broadcaster * broadcaster) override;
63 
64  virtual void SAL_CALL acquire() noexcept override;
65 
66  virtual void SAL_CALL release() noexcept override;
67 
68  OUString const & getAbsolutePathRepresentation();
69 
70  const OUString& getLocale() const { return locale_;}
71 
72  bool isUpdate() const { return update_;}
73 
74  void setAlive(bool b);
75 
76  virtual void SAL_CALL addChangesListener(
77  css::uno::Reference< css::util::XChangesListener >
78  const & aListener) override;
79 
80  virtual void SAL_CALL removeChangesListener(
81  css::uno::Reference< css::util::XChangesListener >
82  const & aListener) override;
83 
84  virtual void SAL_CALL commitChanges() override;
85 
86  virtual sal_Bool SAL_CALL hasPendingChanges() override;
87 
88  virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override;
89 
90 private:
91  virtual ~RootAccess() override;
92 
93  virtual std::vector<OUString> getRelativePath() override;
94 
95  virtual OUString getRelativePathRepresentation() override;
96 
97  virtual rtl::Reference< Node > getNode() override;
98 
99  virtual bool isFinalized() override;
100 
101  virtual OUString getNameInternal() override;
102 
103  virtual rtl::Reference< RootAccess > getRootAccess() override;
104 
105  virtual rtl::Reference< Access > getParentAccess() override;
106 
107  virtual void addTypes(std::vector< css::uno::Type > * types)
108  const override;
109 
110  virtual void addSupportedServiceNames(
111  std::vector<OUString> * services) override;
112 
113  virtual void initDisposeBroadcaster(Broadcaster * broadcaster) override;
114 
115  virtual void clearListeners() noexcept override;
116 
117  virtual css::uno::Any SAL_CALL queryInterface(
118  css::uno::Type const & aType) override;
119 
120  virtual OUString SAL_CALL getImplementationName() override;
121 
122  typedef
123  std::multiset<
124  css::uno::Reference<
125  css::util::XChangesListener > >
127 
129  OUString locale_;
130  std::vector<OUString> path_;
131  rtl::Reference< Node > node_;
132  OUString name_;
134 
135  std::shared_ptr<osl::Mutex> lock_;
136 
137  bool update_:1;
138  bool finalized_:1;
139  bool alive_:1;
140 };
141 
142 }
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
virtual OUString SAL_CALL getImplementationName() override
Definition: rootaccess.cxx:302
std::vector< OUString > path_
Definition: rootaccess.hxx:130
bool update()
OUString pathRepresentation_
Definition: rootaccess.hxx:128
virtual rtl::Reference< Node > getNode() override
Definition: rootaccess.cxx:206
std::multiset< css::uno::Reference< css::util::XChangesListener > > ChangesListeners
Definition: rootaccess.hxx:126
virtual std::vector< OUString > getRelativePath() override
Definition: rootaccess.cxx:198
virtual ~RootAccess() override
Definition: rootaccess.cxx:191
virtual void SAL_CALL addChangesListener(css::uno::Reference< css::util::XChangesListener > const &aListener) override
Definition: rootaccess.cxx:111
virtual void SAL_CALL acquire() noexcept override
Definition: rootaccess.cxx:93
virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override
Definition: rootaccess.cxx:181
virtual void SAL_CALL release() noexcept override
Definition: rootaccess.cxx:97
virtual rtl::Reference< Access > getParentAccess() override
Definition: rootaccess.cxx:245
virtual std::vector< OUString > getAbsolutePath() override
Definition: rootaccess.cxx:66
virtual OUString getNameInternal() override
Definition: rootaccess.cxx:236
std::shared_ptr< osl::Mutex > lock_
Definition: rootaccess.hxx:135
virtual void initDisposeBroadcaster(Broadcaster *broadcaster) override
Definition: rootaccess.cxx:265
virtual bool isFinalized() override
Definition: rootaccess.cxx:231
rtl::Reference< Node > node_
Definition: rootaccess.hxx:131
unsigned char sal_Bool
void setAlive(bool b)
Definition: rootaccess.cxx:107
ChangesListeners changesListeners_
Definition: rootaccess.hxx:133
std::vector< uno::Reference< sheet::XSpreadsheetDocument > > Components
virtual OUString getRelativePathRepresentation() override
Definition: rootaccess.cxx:202
bool isUpdate() const
Definition: rootaccess.hxx:72
virtual void initBroadcaster(Modifications::Node const &modifications, Broadcaster *broadcaster) override
Definition: rootaccess.cxx:71
virtual void addTypes(std::vector< css::uno::Type > *types) const override
Definition: rootaccess.cxx:249
const OUString & getLocale() const
Definition: rootaccess.hxx:70
virtual void clearListeners() noexcept override
Definition: rootaccess.cxx:276
virtual sal_Bool SAL_CALL hasPendingChanges() override
Definition: rootaccess.cxx:171
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &aType) override
Definition: rootaccess.cxx:281
virtual void SAL_CALL removeChangesListener(css::uno::Reference< css::util::XChangesListener > const &aListener) override
Definition: rootaccess.cxx:133
virtual rtl::Reference< RootAccess > getRootAccess() override
Definition: rootaccess.cxx:241
virtual void SAL_CALL commitChanges() override
Definition: rootaccess.cxx:145
OUString const & getAbsolutePathRepresentation()
Definition: rootaccess.cxx:101
virtual void addSupportedServiceNames(std::vector< OUString > *services) override
Definition: rootaccess.cxx:255
RootAccess(Components &components, OUString const &pathRepresentation, OUString const &locale, bool update)
Definition: rootaccess.cxx:56