update emoji autocorrect entries from po-files
[LibreOffice.git] / include / comphelper / accimplaccess.hxx
blobe8eb5e2897c4eabec4d1171b942975c8f1325874
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_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 namespace com { namespace sun { namespace star { namespace accessibility {
28 class XAccessible;
29 class XAccessibleContext;
30 }}}}
32 namespace comphelper
34 //= OAccessibleImplementationAccess
36 typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XUnoTunnel
37 > OAccImpl_Base;
38 struct OAccImpl_Impl;
40 /** This is a helper class which allows accessing several aspects of the implementation
41 of an AccessibleContext.
43 <p>For instance, when you want to implement a context which can be re-parented, you:
44 <ul><li>derive your class from OAccessibleImplementationAccess</li>
45 <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
46 </ul>
47 </p>
49 <p>Another aspect which can be controlled from the outside are states. If you have a class which
50 has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
51 For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
52 determine if the represented object is selected, but another component (say B) which uses A (and integrates
53 it into a tree of accessibility components) is.<br/>
54 In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
55 foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
57 <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
58 which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
59 class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
60 </p>
62 class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess : public OAccImpl_Base
64 private:
65 OAccImpl_Impl* m_pImpl;
67 protected:
68 /// retrieves the parent previously set via <method>setAccessibleParent</method>
69 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
70 implGetForeignControlledParent( ) const;
72 /** retrieves the set of currently set states which are controlled by a foreign instance
73 @return
74 a bit mask, where a set bit 2^n means that the AccessibleStateType n has been set
76 sal_Int64 implGetForeignControlledStates( ) const;
78 /// sets the accessible parent component
79 void setAccessibleParent(
80 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAccParent );
82 /// sets or resets a bit of the foreign controlled states
83 void setStateBit( const sal_Int16 _nState, const bool _bSet );
85 protected:
86 OAccessibleImplementationAccess( );
87 virtual ~OAccessibleImplementationAccess( );
89 // XUnoTunnel
90 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 public:
93 /** tries to access the implementation of an OAccessibleImplementationAccess derivee which is known as
94 interface only.
96 @param _rxComponent
97 is the component which should be examined.
98 @return
99 the pointer to the implementation, if successful. The only known error condition so far
100 is an invalid context (which means it is <NULL/>, or the implementation is not derived
101 from OAccessibleImplementationAccess, or retrieving the implementation failed).
103 static OAccessibleImplementationAccess* getImplementation(
104 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent
107 /** sets the parent for a derived implementation
109 @param _rxComponent
110 is the component which's new parent should be set
111 @param _rxNewParent
112 is the new parent of the component
113 @return
114 <TRUE/> in case of success, <FALSE/> otherwise. For error condition please look at
115 <method>getImplementation</method>.
117 static bool setAccessibleParent(
118 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent,
119 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewParent
122 private:
123 COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
126 } // namespace comphelper
128 #endif // INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */