tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / configmgr / source / childaccess.hxx
blobf3948a08ab50adcc34b64c67c8ad956d9b05b30e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <memory>
25 #include <optional>
26 #include <vector>
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>
34 #include "access.hxx"
36 namespace com::sun::star::uno {
37 class Any;
38 class Type;
39 class XInterface;
42 namespace configmgr {
44 class Components;
45 class Modifications;
46 class Node;
47 class RootAccess;
49 class ChildAccess:
50 public Access, public css::container::XChild
52 public:
54 ChildAccess(
55 Components & components, rtl::Reference< RootAccess > const & root,
56 rtl::Reference< Access > const & parent, OUString name,
57 rtl::Reference< Node > const & node);
59 ChildAccess(
60 Components & components, rtl::Reference< RootAccess > const & root,
61 rtl::Reference< Node > const & node);
63 virtual std::vector<OUString> getAbsolutePath() override;
64 virtual std::vector<OUString> getRelativePath() override;
66 virtual OUString getRelativePathRepresentation() override;
67 virtual const rtl::Reference< Node > & getNode() override;
69 virtual bool isFinalized() override;
71 virtual const OUString & getNameInternal() override;
73 virtual rtl::Reference< RootAccess > getRootAccess() override;
74 virtual rtl::Reference< Access > getParentAccess() override;
76 virtual void SAL_CALL acquire() noexcept override;
77 virtual void SAL_CALL release() noexcept override;
79 virtual css::uno::Reference< css::uno::XInterface >
80 SAL_CALL getParent() override;
82 virtual void SAL_CALL setParent(
83 css::uno::Reference< css::uno::XInterface > const &) override;
85 void bind(
86 rtl::Reference< RootAccess > const & root,
87 rtl::Reference< Access > const & parent, OUString const & name)
88 noexcept;
90 void unbind() noexcept;
92 bool isInTransaction() const { return inTransaction_; }
93 void committed();
94 void setNode(rtl::Reference< Node > const & node);
96 void setProperty(
97 css::uno::Any const & value,
98 Modifications * localModifications);
100 css::uno::Any asValue();
101 static bool asSimpleValue(const rtl::Reference< Node > &rNode,
102 css::uno::Any &value,
103 Components &components);
105 void commitChanges(bool valid, Modifications * globalModifications);
107 private:
108 virtual ~ChildAccess() override;
110 virtual void addTypes(
111 std::vector< css::uno::Type > * types) const override;
113 virtual void addSupportedServiceNames(
114 std::vector<OUString> * services) override;
116 virtual css::uno::Any SAL_CALL queryInterface(
117 css::uno::Type const & aType) override;
119 rtl::Reference< RootAccess > root_;
120 rtl::Reference< Access > parent_; // null if free node
121 OUString name_;
122 rtl::Reference< Node > node_;
123 std::optional< css::uno::Any > changedValue_;
124 bool inTransaction_;
125 // to determine if a free node can be inserted underneath some root
126 std::shared_ptr<osl::Mutex> lock_;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */