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_COMPHELPER_ACCIMPLACCESS_HXX
21 #define INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
23 #include <cppuhelper/implbase1.hxx>
24 #include <com/sun/star/lang/XUnoTunnel.hpp>
25 #include <comphelper/comphelperdllapi.h>
27 // forward declaration
28 namespace com
{ namespace sun
{ namespace star
{ namespace accessibility
{
30 class XAccessibleContext
;
33 //.........................................................................
36 //.........................................................................
38 //=====================================================================
39 //= OAccessibleImplementationAccess
40 //=====================================================================
41 typedef ::cppu::ImplHelper1
< ::com::sun::star::lang::XUnoTunnel
45 /** This is a helper class which allows accessing several aspects of the implementation
46 of an AccessibleContext.
48 <p>For instance, when you want to implement a context which can be re-parented, you:
49 <ul><li>derive your class from OAccessibleImplementationAccess</li>
50 <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
54 <p>Another aspect which can be controlled from the outside are states. If you have a class which
55 has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
56 For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
57 determine if the represented object is selected, but another component (say B) which uses A (and integrates
58 it into a tree of accessibility components) is.<br/>
59 In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
60 foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
62 <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
63 which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
64 class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
67 class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess
: public OAccImpl_Base
70 OAccImpl_Impl
* m_pImpl
;
73 /// retrieves the parent previously set via <method>setAccessibleParent</method>
74 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
75 implGetForeignControlledParent( ) const;
77 /** retrieves the set of currently set states which are controlled by a foreign instance
79 a bit mask, where a set bit 2^n means that the AccessibleStateType n has been set
81 sal_Int64
implGetForeignControlledStates( ) const;
83 /// sets the accessible parent component
84 virtual void setAccessibleParent(
85 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& _rxAccParent
);
87 /// sets or resets a bit of the foreign controlled states
88 virtual void setStateBit( const sal_Int16 _nState
, const sal_Bool _bSet
);
91 OAccessibleImplementationAccess( );
92 virtual ~OAccessibleImplementationAccess( );
95 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& _rIdentifier
) throw (::com::sun::star::uno::RuntimeException
);
98 /** tries to access the implementation of an OAccessibleImplementationAccess derivee which is known as
102 is the component which should be examined.
104 the pointer to the implementation, if successful. The only known error condition so far
105 is an invalid context (which means it is <NULL/>, or the implementation is not derived
106 from OAccessibleImplementationAccess, or retrieving the implementation failed).
108 static OAccessibleImplementationAccess
* getImplementation(
109 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
>& _rxComponent
113 /** sets the parent for a derived implementation
116 is the component which's new parent should be set
118 is the new parent of the component
120 <TRUE/> in case of success, <FALSE/> otherwise. For error condition please look at
121 <method>getImplementation</method>.
123 static sal_Bool
setAccessibleParent(
124 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
>& _rxComponent
,
125 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& _rxNewParent
130 COMPHELPER_DLLPRIVATE
static const ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
133 //.........................................................................
134 } // namespace comphelper
135 //.........................................................................
138 #endif // INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */