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 .
19 #ifndef INCLUDED_UNOTOOLS_ACCESSIBLESTATESETHELPER_HXX
20 #define INCLUDED_UNOTOOLS_ACCESSIBLESTATESETHELPER_HXX
22 #include <unotools/unotoolsdllapi.h>
24 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
25 #include <osl/mutex.hxx>
26 #include <cppuhelper/implbase.hxx>
28 //= XAccessibleStateSet helper classes
30 //... namespace utl .......................................................
34 This base class provides an implementation of the
35 <code>AccessibleStateSet</code> service.
37 class UNOTOOLS_DLLPUBLIC AccessibleStateSetHelper final
38 : public cppu::WeakImplHelper
<css::accessibility::XAccessibleStateSet
>
41 //===== internal ========================================================
43 AccessibleStateSetHelper();
44 /** constructs an object with some states initially set
46 <p>This ctor is compatible with
47 <method scope="comphelper">OAccessibleImplementationAccess::implGetForeignControlledStates</method></p>
49 @param _nInitialStates
50 is a bit mask. Every bit 2^n means that the state number n (as got from the
51 AccessibleStateType constants) should be set initially.
53 AccessibleStateSetHelper(const sal_Int64 _nInitialStates
);
55 AccessibleStateSetHelper(const AccessibleStateSetHelper
& rHelper
);
58 virtual ~AccessibleStateSetHelper() override
;
61 //===== XAccessibleStateSet ==============================================
63 /** Checks whether the current state set is empty.
66 Returns <TRUE/> if there is no state in this state set and
67 <FALSE/> if there is at least one state set in it.
69 virtual sal_Bool SAL_CALL
isEmpty() override
;
71 /** Checks if the given state is a member of the state set of this
75 The state for which to check membership. This has to be one of
76 the constants of AccessibleStateType.
79 Returns <TRUE/> if the given state is a member of this object's
80 state set and <FALSE/> otherwise.
82 virtual sal_Bool SAL_CALL
contains(sal_Int16 aState
) override
;
84 /** Checks if all of the given states are in this object's state
88 This sequence of states is interpreted as set and every of its
89 members, duplicates are ignored, is checked for membership in
90 this object's state set. Each state has to be one of the
91 constants of AccessibleStateType.
94 Returns <TRUE/> if all states of the given state set are members
95 of this object's state set. <FALSE/> is returned if at least
96 one of the states in the given state is not a member of this
99 virtual sal_Bool SAL_CALL
containsAll(const css::uno::Sequence
<sal_Int16
>& rStateSet
) override
;
101 /** Returns a sequence of all states.
103 virtual css::uno::Sequence
<sal_Int16
> SAL_CALL
getStates() override
;
105 /** Adds a state to the set.
107 @throws css::uno::RuntimeException
109 void AddState(sal_Int16 aState
);
111 /** Removes a state from the set if the set contains the state, otherwise nothing is done.
113 @throws css::uno::RuntimeException
115 void RemoveState(sal_Int16 aState
);
117 //===== XTypeProvider ===================================================
119 /** Returns a sequence of all supported interfaces.
121 virtual css::uno::Sequence
<css::uno::Type
> SAL_CALL
getTypes() override
;
123 /** Returns an implementation id.
125 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() override
;
128 /// Mutex guarding this object.
129 ::osl::Mutex maMutex
;
130 /// The implementation of this helper interface.
134 //... namespace utl .......................................................
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */