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_SVX_SOURCE_INC_CHARMAPACC_HXX
21 #define INCLUDED_SVX_SOURCE_INC_CHARMAPACC_HXX
23 #include <vcl/image.hxx>
24 #include <comphelper/accessibleselectionhelper.hxx>
25 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
26 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
33 typedef ::cppu::ImplHelper1
< css::accessibility::XAccessible
34 > OAccessibleHelper_Base_2
;
36 class SvxShowCharSetAcc
;
38 class SvxShowCharSetItemAcc
;
40 // - SvxShowCharSetItem -
42 /** Simple struct to hold some information about the single items of the table.
44 struct SvxShowCharSetItem
46 SvxShowCharSet
& mrParent
;
47 sal_uInt16
const mnId
;
49 tools::Rectangle maRect
;
50 rtl::Reference
<SvxShowCharSetItemAcc
> m_xItem
;
51 SvxShowCharSetAcc
* m_pParent
;
53 SvxShowCharSetItem( SvxShowCharSet
& rParent
, SvxShowCharSetAcc
* _pParent
, sal_uInt16 _nPos
);
54 ~SvxShowCharSetItem();
56 css::uno::Reference
< css::accessibility::XAccessible
> GetAccessible();
60 typedef ::cppu::ImplHelper2
< css::accessibility::XAccessible
,
61 css::accessibility::XAccessibleTable
62 > OAccessibleHelper_Base
;
64 // - SvxShowCharSetAcc -
66 /** The table implementation of the vcl control.
69 class SvxShowCharSetAcc
: public ::comphelper::OAccessibleSelectionHelper
,
70 public OAccessibleHelper_Base
72 ::std::vector
< css::uno::Reference
< css::accessibility::XAccessible
> > m_aChildren
;
73 SvxShowCharSet
* m_pParent
; // the vcl control
75 virtual void SAL_CALL
disposing() override
;
77 SvxShowCharSetAcc(SvxShowCharSet
* pParent
);
80 DECLARE_XTYPEPROVIDER( )
82 // XAccessibleComponent
83 virtual void SAL_CALL
grabFocus( ) override
;
84 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
86 //OAccessibleContextHelper
87 // XAccessibleContext - still waiting to be overwritten
88 virtual sal_Int32 SAL_CALL
getAccessibleChildCount() override
;
89 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int32 i
) override
;
90 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
91 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
92 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
93 virtual OUString SAL_CALL
getAccessibleName( ) override
;
94 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
95 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) override
;
97 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
{ return this; }
98 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
99 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
102 virtual sal_Int32 SAL_CALL
getAccessibleRowCount( ) override
;
103 virtual sal_Int32 SAL_CALL
getAccessibleColumnCount( ) override
;
104 virtual OUString SAL_CALL
getAccessibleRowDescription( sal_Int32 nRow
) override
;
105 virtual OUString SAL_CALL
getAccessibleColumnDescription( sal_Int32 nColumn
) override
;
106 virtual sal_Int32 SAL_CALL
getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
107 virtual sal_Int32 SAL_CALL
getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
108 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
getAccessibleRowHeaders( ) override
;
109 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
getAccessibleColumnHeaders( ) override
;
110 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleRows( ) override
;
111 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleColumns( ) override
;
112 virtual sal_Bool SAL_CALL
isAccessibleRowSelected( sal_Int32 nRow
) override
;
113 virtual sal_Bool SAL_CALL
isAccessibleColumnSelected( sal_Int32 nColumn
) override
;
114 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
115 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleCaption( ) override
;
116 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleSummary( ) override
;
117 virtual sal_Bool SAL_CALL
isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
118 virtual sal_Int32 SAL_CALL
getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
119 virtual sal_Int32 SAL_CALL
getAccessibleRow( sal_Int32 nChildIndex
) override
;
120 virtual sal_Int32 SAL_CALL
getAccessibleColumn( sal_Int32 nChildIndex
) override
;
124 const sal_Int16 _nEventId
,
125 const css::uno::Any
& _rOldValue
,
126 const css::uno::Any
& _rNewValue
129 NotifyAccessibleEvent(_nEventId
,_rOldValue
,_rNewValue
);
132 void clearCharSetControl() { m_pParent
= nullptr; }
135 virtual ~SvxShowCharSetAcc() override
;
137 // OCommonAccessibleSelection
138 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
140 implIsSelected( sal_Int32 nAccessibleChildIndex
) override
;
142 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
144 implSelect( sal_Int32 nAccessibleChildIndex
, bool bSelect
) override
;
146 // OCommonAccessibleComponent
147 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
148 virtual css::awt::Rectangle
implGetBounds( ) override
;
152 // - SvxShowCharSetItemAcc -
154 typedef ::cppu::ImplHelper2
< css::accessibility::XAccessible
,
155 css::accessibility::XAccessibleAction
156 > OAccessibleHelper_Base_3
;
158 /** The child implementation of the table.
160 class SvxShowCharSetItemAcc
: public ::comphelper::OAccessibleComponentHelper
,
161 public OAccessibleHelper_Base_3
164 SvxShowCharSetItem
* mpParent
;
166 virtual ~SvxShowCharSetItemAcc() override
;
168 // OCommonAccessibleComponent
169 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
170 virtual css::awt::Rectangle
implGetBounds( ) override
;
174 DECLARE_XINTERFACE( )
175 DECLARE_XTYPEPROVIDER( )
177 SvxShowCharSetItemAcc( SvxShowCharSetItem
* pParent
);
179 void ParentDestroyed();
181 // XAccessibleComponent
182 virtual void SAL_CALL
grabFocus( ) override
;
183 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
185 //OAccessibleContextHelper
186 // XAccessibleContext - still waiting to be overwritten
187 virtual sal_Int32 SAL_CALL
getAccessibleChildCount( ) override
;
188 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int32 i
) override
;
189 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
190 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
191 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
192 virtual OUString SAL_CALL
getAccessibleName( ) override
;
193 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
194 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) override
;
196 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
{ return this; }
198 virtual sal_Int32 SAL_CALL
getForeground( ) override
{ return mpParent
->m_pParent
->getForeground(); }
199 virtual sal_Int32 SAL_CALL
getBackground( ) override
{ return mpParent
->m_pParent
->getBackground(); }
202 virtual sal_Int32 SAL_CALL
getAccessibleActionCount( ) override
;
203 virtual sal_Bool SAL_CALL
doAccessibleAction ( sal_Int32 nIndex
) override
;
204 virtual OUString SAL_CALL
getAccessibleActionDescription ( sal_Int32 nIndex
) override
;
205 virtual css::uno::Reference
< css::accessibility::XAccessibleKeyBinding
> SAL_CALL
getAccessibleActionKeyBinding( sal_Int32 nIndex
) override
;
209 const sal_Int16 _nEventId
,
210 const css::uno::Any
& _rOldValue
,
211 const css::uno::Any
& _rNewValue
214 NotifyAccessibleEvent(_nEventId
,_rOldValue
,_rNewValue
);
220 #endif // INCLUDED_SVX_SOURCE_INC_CHARMAPACC_HXX
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */