26#include <com/sun/star/lang/DisposedException.hpp>
27#include <com/sun/star/lang/EventObject.hpp>
28#include <com/sun/star/uno/Any.hxx>
29#include <com/sun/star/uno/Reference.hxx>
30#include <com/sun/star/uno/RuntimeException.hpp>
31#include <com/sun/star/uno/Type.hxx>
32#include <com/sun/star/uno/XInterface.hpp>
33#include <com/sun/star/util/ChangesEvent.hpp>
34#include <com/sun/star/util/ChangesSet.hpp>
35#include <com/sun/star/util/ElementChange.hpp>
36#include <com/sun/star/util/XChangesBatch.hpp>
37#include <com/sun/star/util/XChangesListener.hpp>
38#include <com/sun/star/util/XChangesNotifier.hpp>
43#include <osl/mutex.hxx>
45#include <rtl/ustring.hxx>
58 Components & components, OUString pathRepresentation,
59 OUString locale,
bool update):
60 Access(components), pathRepresentation_(
std::move(pathRepresentation)),
63 update_(
update), finalized_(false), alive_(true)
75 assert(broadcaster !=
nullptr);
76 std::vector< css::util::ElementChange > changes;
86 css::uno::Reference< css::uno::XInterface > xBase( pSource, css::uno::UNO_QUERY );
89 css::util::ChangesEvent(
90 pSource, css::uno::Any( xBase ),
set),
path_.empty());
113 css::uno::Reference< css::util::XChangesListener >
const & aListener)
117 osl::MutexGuard g(*
lock_);
119 if (!aListener.is()) {
120 throw css::uno::RuntimeException(
121 "null listener", getXWeak());
129 aListener->disposing(
130 css::lang::EventObject(getXWeak()));
131 }
catch (css::lang::DisposedException &) {}
135 css::uno::Reference< css::util::XChangesListener >
const & aListener)
138 osl::MutexGuard g(*
lock_);
155 osl::MutexGuard g(*
lock_);
174 osl::MutexGuard g(*
lock_);
177 std::vector< css::util::ElementChange > changes;
179 return !changes.empty();
185 osl::MutexGuard g(*
lock_);
187 std::vector< css::util::ElementChange > changes;
194 osl::MutexGuard g(*
lock_);
200 return std::vector<OUString>();
214 throw css::uno::RuntimeException(
224 if (!
path_.empty()) {
251 assert(types !=
nullptr);
257 std::vector<OUString> * services)
259 assert(services !=
nullptr);
260 services->push_back(
"com.sun.star.configuration.AccessRootElement");
262 services->push_back(
"com.sun.star.configuration.UpdateRootElement");
267 assert(broadcaster !=
nullptr);
272 css::lang::EventObject(getXWeak()));
285 osl::MutexGuard g(*
lock_);
288 if (res.hasValue()) {
292 aType,
static_cast< css::util::XChangesNotifier *
>(
this));
293 if (res.hasValue()) {
296 if (!res.hasValue() &&
update_) {
298 aType,
static_cast< css::util::XChangesBatch *
>(
this));
306 osl::MutexGuard g(*
lock_);
308 return "configmgr.RootAccess";
void commitChildChanges(bool valid, Modifications *globalModifications)
Components & getComponents() const
virtual void clearListeners() noexcept
virtual void initDisposeBroadcaster(Broadcaster *broadcaster)
void initBroadcasterAndChanges(Modifications::Node const &modifications, Broadcaster *broadcaster, std::vector< css::util::ElementChange > *changes)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &aType) override
void checkLocalizedPropertyAccess()
void reportChildChanges(std::vector< css::util::ElementChange > *changes)
void addChangesNotification(css::uno::Reference< css::util::XChangesListener > const &listener, css::util::ChangesEvent const &event, bool bRootListener)
void addDisposeNotification(css::uno::Reference< css::lang::XEventListener > const &listener, css::lang::EventObject const &event)
void removeRootAccess(RootAccess *access)
void initGlobalBroadcaster(Modifications const &modifications, rtl::Reference< RootAccess > const &exclude, Broadcaster *broadcaster)
rtl::Reference< Node > resolvePathRepresentation(OUString const &pathRepresentation, OUString *canonicRepresentation, std::vector< OUString > *path, int *finalizedLayer) const
void writeModifications()
OUString pathRepresentation_
rtl::Reference< Node > node_
virtual void SAL_CALL commitChanges() override
OUString const & getAbsolutePathRepresentation()
virtual void SAL_CALL removeChangesListener(css::uno::Reference< css::util::XChangesListener > const &aListener) override
virtual ~RootAccess() override
virtual std::vector< OUString > getRelativePath() override
virtual const OUString & getNameInternal() override
std::vector< OUString > path_
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL addChangesListener(css::uno::Reference< css::util::XChangesListener > const &aListener) override
virtual rtl::Reference< Access > getParentAccess() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &aType) override
std::shared_ptr< osl::Mutex > lock_
virtual std::vector< OUString > getAbsolutePath() override
virtual void addSupportedServiceNames(std::vector< OUString > *services) override
virtual void clearListeners() noexcept override
virtual rtl::Reference< RootAccess > getRootAccess() override
virtual OUString getRelativePathRepresentation() override
virtual void addTypes(std::vector< css::uno::Type > *types) const override
virtual rtl::Reference< Node > getNode() override
virtual void initDisposeBroadcaster(Broadcaster *broadcaster) override
ChangesListeners changesListeners_
virtual bool isFinalized() override
virtual void initBroadcaster(Modifications::Node const &modifications, Broadcaster *broadcaster) override
virtual sal_Bool SAL_CALL hasPendingChanges() override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override
RootAccess(Components &components, OUString pathRepresentation, OUString locale, bool update)
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
std::shared_ptr< osl::Mutex > lock_
void set(css::uno::UnoInterfaceReference const &value)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::shared_ptr< osl::Mutex > const & lock()
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)