Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / comphelper / accimplaccess.hxx
blob6d5322548e1360c04d3f32a0bbd945f607b7a4a2
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>
26 #include <memory>
28 namespace com { namespace sun { namespace star { namespace accessibility {
29 class XAccessible;
30 class XAccessibleContext;
31 }}}}
33 namespace comphelper
35 //= OAccessibleImplementationAccess
37 typedef ::cppu::ImplHelper1 < css::lang::XUnoTunnel
38 > OAccImpl_Base;
39 struct OAccImpl_Impl;
41 /** This is a helper class which allows accessing several aspects of the implementation
42 of an AccessibleContext.
44 <p>For instance, when you want to implement a context which can be re-parented, you:
45 <ul><li>derive your class from OAccessibleImplementationAccess</li>
46 <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
47 </ul>
48 </p>
50 <p>Another aspect which can be controlled from the outside are states. If you have a class which
51 has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
52 For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
53 determine if the represented object is selected, but another component (say B) which uses A (and integrates
54 it into a tree of accessibility components) is.<br/>
55 In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
56 foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
58 <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
59 which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
60 class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
61 </p>
63 class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess : public OAccImpl_Base
65 private:
66 std::unique_ptr<OAccImpl_Impl> m_pImpl;
68 protected:
69 /// retrieves the parent previously set via <method>setAccessibleParent</method>
70 const css::uno::Reference< css::accessibility::XAccessible >&
71 implGetForeignControlledParent( ) const;
73 /** retrieves the set of currently set states which are controlled by a foreign instance
74 @return
75 a bit mask, where a set bit 2^n means that the AccessibleStateType n has been set
77 sal_Int64 implGetForeignControlledStates( ) const;
79 protected:
80 OAccessibleImplementationAccess( );
81 virtual ~OAccessibleImplementationAccess( );
83 // XUnoTunnel
84 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
86 public:
88 private:
89 COMPHELPER_DLLPRIVATE static const css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
92 } // namespace comphelper
94 #endif // INCLUDED_COMPHELPER_ACCIMPLACCESS_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */