LibreOffice Module comphelper (master)  1
accessibleselectionhelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
21 #define INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
22 
23 #include <config_options.h>
24 #include <comphelper/uno3.hxx>
26 #include <cppuhelper/implbase1.hxx>
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29 
30 #define ACCESSIBLE_SELECTION_CHILD_ALL (sal_Int32(-1))
31 #define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
32 
33 
34 namespace comphelper
35 {
36 
37 
38  //= OCommonAccessibleSelection
39 
44  {
45  protected:
46 
48 
50 
51  protected:
52 
53  // access to context - still waiting to be overwritten
55  virtual css::uno::Reference< css::accessibility::XAccessibleContext >
56  implGetAccessibleContext() = 0;
57 
58  // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
60  virtual bool
61  implIsSelected( sal_Int32 nAccessibleChildIndex ) = 0;
62 
63  // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
65  virtual void
66  implSelect( sal_Int32 nAccessibleChildIndex, bool bSelect ) = 0;
67 
68  protected:
69 
75  void selectAccessibleChild( sal_Int32 nChildIndex );
78  bool isAccessibleChildSelected( sal_Int32 nChildIndex );
80  void clearAccessibleSelection( );
82  void selectAllAccessibleChildren( );
84  sal_Int32 getSelectedAccessibleChildCount( );
87  css::uno::Reference< css::accessibility::XAccessible > getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex );
90  void deselectAccessibleChild( sal_Int32 nSelectedChildIndex );
91  };
92 
93 
94  //= OAccessibleSelectionHelper
95 
96 
97  typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
98 
102  class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OAccessibleSelectionHelper : public OAccessibleComponentHelper,
104  public OAccessibleSelectionHelper_Base
105  {
106  protected:
107 
108  OAccessibleSelectionHelper();
109 
110  // return ourself here by default
111  virtual css::uno::Reference< css::accessibility::XAccessibleContext > implGetAccessibleContext() override;
112 
113  public:
114 
115  // XInterface
118 
119  // XAccessibleSelection - default implementations
120  virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
121  virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
122  virtual void SAL_CALL clearAccessibleSelection( ) override;
123  virtual void SAL_CALL selectAllAccessibleChildren( ) override;
124  virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
125  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
126  virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
127  };
128 
129 
130 } // namespace comphelper
131 
132 
133 #endif // INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
134 
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base
base class encapsulating common functionality for the helper classes implementing the XAccessibleSele...
a helper class for implementing an AccessibleContext which at the same time supports an XAccessibleCo...
#define DECLARE_XTYPEPROVIDER()
Definition: uno3.hxx:126
unsigned char sal_Bool
#define COMPHELPER_DLLPUBLIC
#define DECLARE_XINTERFACE()
Definition: uno3.hxx:90