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 _UTL_ACCESSIBLESTATESETHELPER_HXX_
20 #define _UTL_ACCESSIBLESTATESETHELPER_HXX_
22 #include "unotools/unotoolsdllapi.h"
24 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <cppuhelper/weak.hxx>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XTypeProvider.hpp>
29 #include <com/sun/star/lang/XServiceName.hpp>
30 #include <osl/mutex.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 #include <comphelper/servicehelper.hxx>
34 class AccessibleStateSetHelperImpl
;
36 //=========================================================================
37 //= XAccessibleStateSet helper classes
38 //=========================================================================
40 //... namespace utl .......................................................
43 //.........................................................................
46 This base class provides an implementation of the
47 <code>AccessibleStateSet</code> service.
49 class UNOTOOLS_DLLPUBLIC AccessibleStateSetHelper
50 : public cppu::WeakImplHelper1
<
51 ::com::sun::star::accessibility::XAccessibleStateSet
55 //===== internal ========================================================
57 AccessibleStateSetHelper ();
58 /** constructs an object with some states initially set
60 <p>This ctor is compatible with
61 <method scope="comphelper">OAccessibleImplementationAccess::implGetForeignControlledStates</method></p>
63 @param _nInitialStates
64 is a bit mask. Every bit 2^n means that the state number n (as got from the
65 AccessibleStateType constants) should be set initially.
67 AccessibleStateSetHelper ( const sal_Int64 _nInitialStates
);
69 AccessibleStateSetHelper ( const AccessibleStateSetHelper
& rHelper
);
71 virtual ~AccessibleStateSetHelper (void);
74 //===== XAccessibleStateSet ==============================================
76 /** Checks whether the current state set is empty.
79 Returns <TRUE/> if there is no state in this state set and
80 <FALSE/> if there is at least one state set in it.
82 virtual sal_Bool SAL_CALL
isEmpty ()
83 throw (::com::sun::star::uno::RuntimeException
);
85 /** Checks if the given state is a member of the state set of this
89 The state for which to check membership. This has to be one of
90 the constants of <type>AccessibleStateType</type>.
93 Returns <TRUE/> if the given state is a member of this object's
94 state set and <FALSE/> otherwise.
96 virtual sal_Bool SAL_CALL
contains (sal_Int16 aState
)
97 throw (::com::sun::star::uno::RuntimeException
);
99 /** Checks if all of the given states are in this object's state
103 This sequence of states is interpreted as set and every of its
104 members, duplicates are ignored, is checked for membership in
105 this object's state set. Each state has to be one of the
106 constants of <type>AccessibleStateType</type>.
109 Returns <TRUE/> if all states of the given state set are members
110 of this object's state set. <FALSE/> is returned if at least
111 one of the states in the given state is not a member of this
114 virtual sal_Bool SAL_CALL
containsAll (
115 const ::com::sun::star::uno::Sequence
<sal_Int16
>& rStateSet
)
116 throw (::com::sun::star::uno::RuntimeException
);
118 /** Returns a sequence of all states.
120 virtual com::sun::star::uno::Sequence
<sal_Int16
> SAL_CALL
getStates()
121 throw (::com::sun::star::uno::RuntimeException
);
123 /** Adds a state to the set.
125 void AddState(sal_Int16 aState
)
126 throw (::com::sun::star::uno::RuntimeException
);
128 /** Removes a state from the set if the set contains the state, otherwise nothing is done.
130 void RemoveState(sal_Int16 aState
)
131 throw (::com::sun::star::uno::RuntimeException
);
133 //===== XTypeProvider ===================================================
135 /** Returns a sequence of all supported interfaces.
137 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
139 throw (::com::sun::star::uno::RuntimeException
);
141 /** Returns a implementation id.
143 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
144 getImplementationId (void)
145 throw (::com::sun::star::uno::RuntimeException
);
148 /// Mutex guarding this object.
149 ::osl::Mutex maMutex
;
152 /// The implementation of this helper interface.
153 AccessibleStateSetHelperImpl
* mpHelperImpl
;
156 //.........................................................................
158 //... namespace utl .......................................................
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */