tdf#161411 - UI: Add Better wording for ASCII-only characters
[LibreOffice.git] / include / unotools / accessiblerelationsethelper.hxx
blob23d1a5f1f35fb20f84977790dd7cda9507284e1c
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 #ifndef INCLUDED_UNOTOOLS_ACCESSIBLERELATIONSETHELPER_HXX
21 #define INCLUDED_UNOTOOLS_ACCESSIBLERELATIONSETHELPER_HXX
23 #include <unotools/unotoolsdllapi.h>
25 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
26 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <mutex>
29 #include <vector>
31 using css::accessibility::AccessibleRelationType;
33 //= XAccessibleRelationSet helper classes
35 //... namespace utl .......................................................
36 namespace utl
38 /** @descr
39 This base class provides an implementation of the
40 <code>AccessibleRelationSet</code> service.
42 class UNOTOOLS_DLLPUBLIC AccessibleRelationSetHelper final
43 : public cppu::WeakImplHelper<css::accessibility::XAccessibleRelationSet>
45 public:
46 //===== internal ========================================================
47 AccessibleRelationSetHelper();
49 css::uno::Reference<css::accessibility::XAccessibleRelationSet> Clone() const;
51 private:
52 AccessibleRelationSetHelper(const AccessibleRelationSetHelper& rHelper);
53 virtual ~AccessibleRelationSetHelper() override;
55 public:
56 //===== XAccessibleRelationSet ==========================================
58 /** Returns the number of relations in this relation set.
60 @return
61 Returns the number of relations or zero if there are none.
63 virtual sal_Int32 SAL_CALL getRelationCount() override;
65 /** Returns the relation of this relation set that is specified by
66 the given index.
68 @param nIndex
69 This index specifies the relatio to return.
71 @return
72 For a valid index, i.e. inside the range 0 to the number of
73 relations minus one, the returned value is the requested
74 relation. If the index is invalid then the returned relation
75 has the type INVALID.
78 virtual css::accessibility::AccessibleRelation SAL_CALL getRelation(sal_Int32 nIndex) override;
80 /** Tests whether the relation set contains a relation matching the
81 specified key.
83 @param eRelationType
84 The type of relation to look for in this set of relations.
86 @return
87 Returns <TRUE/> if there is a (at least one) relation of the
88 given type and <FALSE/> if there is no such relation in the set.
90 virtual sal_Bool SAL_CALL
91 containsRelation(css::accessibility::AccessibleRelationType eRelationType) override;
93 /** Retrieve and return the relation with the given relation type.
95 @param eRelationType
96 The type of the relation to return.
98 @return
99 If a relation with the given type could be found than (a copy
100 of) this relation is returned. Otherwise a relation with the
101 type INVALID is returned.
103 virtual css::accessibility::AccessibleRelation SAL_CALL
104 getRelationByType(AccessibleRelationType eRelationType) override;
106 /// @throws uno::RuntimeException
107 void AddRelation(const css::accessibility::AccessibleRelation& rRelation);
109 //===== XTypeProvider ===================================================
111 /** Returns a sequence of all supported interfaces.
113 virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
115 /** Returns an implementation id.
117 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
119 private:
120 /// Mutex guarding this object.
121 mutable std::mutex maMutex;
122 /// The implementation of this helper interface.
123 std::vector<css::accessibility::AccessibleRelation> maRelations;
126 //... namespace utl .......................................................
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */