1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/XAccessibleRelationSet.hpp>
26 #include <osl/mutex.hxx>
27 #include <cppuhelper/implbase.hxx>
30 //= XAccessibleRelationSet helper classes
32 //... namespace utl .......................................................
36 This base class provides an implementation of the
37 <code>AccessibleRelationSet</code> service.
39 class UNOTOOLS_DLLPUBLIC AccessibleRelationSetHelper final
40 : public cppu::WeakImplHelper
<css::accessibility::XAccessibleRelationSet
>
43 //===== internal ========================================================
44 AccessibleRelationSetHelper();
45 AccessibleRelationSetHelper(const AccessibleRelationSetHelper
& rHelper
);
48 virtual ~AccessibleRelationSetHelper() override
;
51 //===== XAccessibleRelationSet ==========================================
53 /** Returns the number of relations in this relation set.
56 Returns the number of relations or zero if there are none.
58 virtual sal_Int32 SAL_CALL
getRelationCount() override
;
60 /** Returns the relation of this relation set that is specified by
64 This index specifies the relatio to return.
67 For a valid index, i.e. inside the range 0 to the number of
68 relations minus one, the returned value is the requested
69 relation. If the index is invalid then the returned relation
73 virtual css::accessibility::AccessibleRelation SAL_CALL
getRelation(sal_Int32 nIndex
) override
;
75 /** Tests whether the relation set contains a relation matching the
79 The type of relation to look for in this set of relations. This
80 has to be one of the constants of
81 AccessibleRelationType.
84 Returns <TRUE/> if there is a (at least one) relation of the
85 given type and <FALSE/> if there is no such relation in the set.
87 virtual sal_Bool SAL_CALL
containsRelation(sal_Int16 aRelationType
) override
;
89 /** Retrieve and return the relation with the given relation type.
92 The type of the relation to return. This has to be one of the
93 constants of AccessibleRelationType.
96 If a relation with the given type could be found than (a copy
97 of) this relation is returned. Otherwise a relation with the
98 type INVALID is returned.
100 virtual css::accessibility::AccessibleRelation SAL_CALL
101 getRelationByType(sal_Int16 aRelationType
) override
;
103 /// @throws uno::RuntimeException
104 void AddRelation(const css::accessibility::AccessibleRelation
& rRelation
);
106 //===== XTypeProvider ===================================================
108 /** Returns a sequence of all supported interfaces.
110 virtual css::uno::Sequence
<css::uno::Type
> SAL_CALL
getTypes() override
;
112 /** Returns an implementation id.
114 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() override
;
117 /// Mutex guarding this object.
118 ::osl::Mutex maMutex
;
119 /// The implementation of this helper interface.
120 std::vector
<css::accessibility::AccessibleRelation
> maRelations
;
123 //... namespace utl .......................................................
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */