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