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_ROOTACCESS_HXX
21 : #define INCLUDED_CONFIGMGR_SOURCE_ROOTACCESS_HXX
22 :
23 : #include <sal/config.h>
24 :
25 : #include <memory>
26 : #include <set>
27 : #include <vector>
28 :
29 : #include <com/sun/star/lang/WrappedTargetException.hpp>
30 : #include <com/sun/star/uno/RuntimeException.hpp>
31 : #include <com/sun/star/util/ChangesSet.hpp>
32 : #include <com/sun/star/util/XChangesBatch.hpp>
33 : #include <com/sun/star/util/XChangesNotifier.hpp>
34 : #include <rtl/ref.hxx>
35 : #include <rtl/ustring.hxx>
36 : #include <sal/types.h>
37 :
38 : #include "access.hxx"
39 : #include "modifications.hxx"
40 : #include "path.hxx"
41 :
42 : namespace com { namespace sun { namespace star {
43 : namespace uno {
44 : class Any;
45 : class Type;
46 : }
47 : namespace util { class XChangesListener; }
48 : } } }
49 :
50 : namespace configmgr {
51 :
52 : class Broadcaster;
53 : class Components;
54 : class Node;
55 :
56 : class RootAccess:
57 : public Access, public com::sun::star::util::XChangesNotifier,
58 : public com::sun::star::util::XChangesBatch
59 : {
60 : public:
61 : RootAccess(
62 : Components & components, OUString const & pathRepresenation,
63 : OUString const & locale, bool update);
64 :
65 : virtual Path getAbsolutePath() SAL_OVERRIDE;
66 :
67 : virtual void initBroadcaster(
68 : Modifications::Node const & modifications, Broadcaster * broadcaster) SAL_OVERRIDE;
69 :
70 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
71 :
72 : virtual void SAL_CALL release() throw () SAL_OVERRIDE;
73 :
74 : OUString getAbsolutePathRepresentation();
75 :
76 689483 : OUString getLocale() const { return locale_;}
77 :
78 27054180 : bool isUpdate() const { return update_;}
79 :
80 : void setAlive(bool b);
81 :
82 : virtual void SAL_CALL addChangesListener(
83 : com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
84 : const & aListener)
85 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : virtual void SAL_CALL removeChangesListener(
88 : com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
89 : const & aListener)
90 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : virtual void SAL_CALL commitChanges()
93 : throw (
94 : com::sun::star::lang::WrappedTargetException,
95 : com::sun::star::uno::RuntimeException,
96 : std::exception) SAL_OVERRIDE;
97 :
98 : virtual sal_Bool SAL_CALL hasPendingChanges()
99 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 :
101 : virtual com::sun::star::util::ChangesSet SAL_CALL getPendingChanges()
102 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 :
104 : private:
105 : virtual ~RootAccess();
106 :
107 : virtual Path getRelativePath() SAL_OVERRIDE;
108 :
109 : virtual OUString getRelativePathRepresentation() SAL_OVERRIDE;
110 :
111 : virtual rtl::Reference< Node > getNode() SAL_OVERRIDE;
112 :
113 : virtual bool isFinalized() SAL_OVERRIDE;
114 :
115 : virtual OUString getNameInternal() SAL_OVERRIDE;
116 :
117 : virtual rtl::Reference< RootAccess > getRootAccess() SAL_OVERRIDE;
118 :
119 : virtual rtl::Reference< Access > getParentAccess() SAL_OVERRIDE;
120 :
121 : virtual void addTypes(std::vector< com::sun::star::uno::Type > * types)
122 : const SAL_OVERRIDE;
123 :
124 : virtual void addSupportedServiceNames(
125 : std::vector< OUString > * services) SAL_OVERRIDE;
126 :
127 : virtual void initDisposeBroadcaster(Broadcaster * broadcaster) SAL_OVERRIDE;
128 :
129 : virtual void clearListeners() throw () 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 : virtual OUString SAL_CALL getImplementationName()
136 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 :
138 : typedef
139 : std::multiset<
140 : com::sun::star::uno::Reference<
141 : com::sun::star::util::XChangesListener > >
142 : ChangesListeners;
143 :
144 : OUString pathRepresentation_;
145 : OUString locale_;
146 : Path path_;
147 : rtl::Reference< Node > node_;
148 : OUString name_;
149 : ChangesListeners changesListeners_;
150 :
151 : std::shared_ptr<osl::Mutex> lock_;
152 :
153 : bool update_:1;
154 : bool finalized_:1;
155 : bool alive_:1;
156 : };
157 :
158 : }
159 :
160 : #endif
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|