LibreOffice Module configmgr (master) 1
childaccess.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 <memory>
25#include <optional>
26#include <vector>
27
28#include <com/sun/star/container/XChild.hpp>
29#include <com/sun/star/uno/Reference.hxx>
30#include <com/sun/star/uno/Sequence.hxx>
31#include <rtl/ref.hxx>
32#include <sal/types.h>
33
34#include "access.hxx"
35
36namespace com::sun::star::uno {
37 class Any;
38 class Type;
39 class XInterface;
40}
41
42namespace configmgr {
43
44class Components;
45class Modifications;
46class Node;
47class RootAccess;
48
50 public Access, public css::container::XChild
51{
52public:
53
55 Components & components, rtl::Reference< RootAccess > const & root,
56 rtl::Reference< Access > const & parent, OUString name,
57 rtl::Reference< Node > const & node);
58
60 Components & components, rtl::Reference< RootAccess > const & root,
61 rtl::Reference< Node > const & node);
62
63 virtual std::vector<OUString> getAbsolutePath() override;
64 virtual std::vector<OUString> getRelativePath() override;
65
66 virtual OUString getRelativePathRepresentation() override;
67 virtual rtl::Reference< Node > getNode() override;
68
69 virtual bool isFinalized() override;
70
71 virtual const OUString & getNameInternal() override;
72
75
76 virtual void SAL_CALL acquire() noexcept override;
77 virtual void SAL_CALL release() noexcept override;
78
79 virtual css::uno::Reference< css::uno::XInterface >
80 SAL_CALL getParent() override;
81
82 virtual void SAL_CALL setParent(
83 css::uno::Reference< css::uno::XInterface > const &) override;
84
85 void bind(
87 rtl::Reference< Access > const & parent, OUString const & name)
88 noexcept;
89
90 void unbind() noexcept;
91
92 bool isInTransaction() const { return inTransaction_; }
93 void committed();
94 void setNode(rtl::Reference< Node > const & node);
95
96 void setProperty(
97 css::uno::Any const & value,
98 Modifications * localModifications);
99
100 css::uno::Any asValue();
101 static bool asSimpleValue(const rtl::Reference< Node > &rNode,
102 css::uno::Any &value,
103 Components &components);
104
105 void commitChanges(bool valid, Modifications * globalModifications);
106
107private:
108 virtual ~ChildAccess() override;
109
110 virtual void addTypes(
111 std::vector< css::uno::Type > * types) const override;
112
113 virtual void addSupportedServiceNames(
114 std::vector<OUString> * services) override;
115
116 virtual css::uno::Any SAL_CALL queryInterface(
117 css::uno::Type const & aType) override;
118
120 rtl::Reference< Access > parent_; // null if free node
121 OUString name_;
123 std::optional< css::uno::Any > changedValue_;
125 // to determine if a free node can be inserted underneath some root
126 std::shared_ptr<osl::Mutex> lock_;
127};
128
129}
130
131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual std::vector< OUString > getRelativePath() override
Definition: childaccess.cxx:87
void unbind() noexcept
void setProperty(css::uno::Any const &value, Modifications *localModifications)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
virtual void addTypes(std::vector< css::uno::Type > *types) const override
virtual void SAL_CALL setParent(css::uno::Reference< css::uno::XInterface > const &) override
rtl::Reference< Access > parent_
rtl::Reference< RootAccess > root_
virtual ~ChildAccess() override
virtual rtl::Reference< Node > getNode() override
void bind(rtl::Reference< RootAccess > const &root, rtl::Reference< Access > const &parent, OUString const &name) noexcept
virtual OUString getRelativePathRepresentation() override
Definition: childaccess.cxx:97
virtual rtl::Reference< RootAccess > getRootAccess() override
virtual std::vector< OUString > getAbsolutePath() override
Definition: childaccess.cxx:79
virtual void SAL_CALL release() noexcept override
void commitChanges(bool valid, Modifications *globalModifications)
css::uno::Any asValue()
std::shared_ptr< osl::Mutex > lock_
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &aType) override
ChildAccess(Components &components, rtl::Reference< RootAccess > const &root, rtl::Reference< Access > const &parent, OUString name, rtl::Reference< Node > const &node)
Definition: childaccess.cxx:59
virtual const OUString & getNameInternal() override
std::optional< css::uno::Any > changedValue_
virtual void addSupportedServiceNames(std::vector< OUString > *services) override
static bool asSimpleValue(const rtl::Reference< Node > &rNode, css::uno::Any &value, Components &components)
Can we quickly extract a simple value into value ? if so returns true.
bool isInTransaction() const
Definition: childaccess.hxx:92
virtual rtl::Reference< Access > getParentAccess() override
rtl::Reference< Node > node_
void setNode(rtl::Reference< Node > const &node)
virtual bool isFinalized() override
OUString name
Definition: components.cxx:85
std::vector< uno::Reference< sheet::XSpreadsheetDocument > > Components