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 <comphelper/accessibleselectionhelper.hxx>
24 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
25 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <tools/gen.hxx>
28 #include <rtl/ref.hxx>
35 class SvxShowCharSetAcc
;
37 class SvxShowCharSetItemAcc
;
39 // - SvxShowCharSetItem -
41 /** Simple struct to hold some information about the single items of the table.
43 struct SvxShowCharSetItem
45 SvxShowCharSet
& mrParent
;
48 tools::Rectangle maRect
;
49 rtl::Reference
<SvxShowCharSetItemAcc
> m_xItem
;
50 SvxShowCharSetAcc
* m_pParent
;
52 SvxShowCharSetItem( SvxShowCharSet
& rParent
, SvxShowCharSetAcc
* _pParent
, sal_uInt16 _nPos
);
53 ~SvxShowCharSetItem();
55 const rtl::Reference
< SvxShowCharSetItemAcc
> & GetAccessible();
59 // - SvxShowCharSetAcc -
61 /** The table implementation of the vcl control.
64 class SvxShowCharSetAcc final
: public cppu::ImplInheritanceHelper
<
65 ::comphelper::OAccessibleSelectionHelper
,
66 css::accessibility::XAccessible
,
67 css::accessibility::XAccessibleTable
>
69 ::std::vector
< rtl::Reference
< SvxShowCharSetItemAcc
> > m_aChildren
;
70 SvxShowCharSet
* m_pParent
; // the vcl control
71 virtual void SAL_CALL
disposing() override
;
73 SvxShowCharSetAcc(SvxShowCharSet
* pParent
);
75 // XAccessibleComponent
76 virtual void SAL_CALL
grabFocus( ) override
;
77 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
79 //OCommonAccessibleComponent
80 // XAccessibleContext - still waiting to be overwritten
81 virtual sal_Int64 SAL_CALL
getAccessibleChildCount() override
;
82 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int64 i
) override
;
83 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
84 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
85 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
86 virtual OUString SAL_CALL
getAccessibleName( ) override
;
87 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
88 virtual sal_Int64 SAL_CALL
getAccessibleStateSet( ) override
;
90 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
{ return this; }
91 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
92 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
95 virtual sal_Int32 SAL_CALL
getAccessibleRowCount( ) override
;
96 virtual sal_Int32 SAL_CALL
getAccessibleColumnCount( ) override
;
97 virtual OUString SAL_CALL
getAccessibleRowDescription( sal_Int32 nRow
) override
;
98 virtual OUString SAL_CALL
getAccessibleColumnDescription( sal_Int32 nColumn
) override
;
99 virtual sal_Int32 SAL_CALL
getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
100 virtual sal_Int32 SAL_CALL
getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
101 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
getAccessibleRowHeaders( ) override
;
102 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
getAccessibleColumnHeaders( ) override
;
103 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleRows( ) override
;
104 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleColumns( ) override
;
105 virtual sal_Bool SAL_CALL
isAccessibleRowSelected( sal_Int32 nRow
) override
;
106 virtual sal_Bool SAL_CALL
isAccessibleColumnSelected( sal_Int32 nColumn
) override
;
107 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
108 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleCaption( ) override
;
109 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleSummary( ) override
;
110 virtual sal_Bool SAL_CALL
isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
111 virtual sal_Int64 SAL_CALL
getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
112 virtual sal_Int32 SAL_CALL
getAccessibleRow( sal_Int64 nChildIndex
) override
;
113 virtual sal_Int32 SAL_CALL
getAccessibleColumn( sal_Int64 nChildIndex
) override
;
117 const sal_Int16 _nEventId
,
118 const css::uno::Any
& _rOldValue
,
119 const css::uno::Any
& _rNewValue
122 NotifyAccessibleEvent(_nEventId
,_rOldValue
,_rNewValue
);
125 void clearCharSetControl() { m_pParent
= nullptr; }
128 virtual ~SvxShowCharSetAcc() override
;
130 // OCommonAccessibleSelection
131 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
133 implIsSelected( sal_Int64 nAccessibleChildIndex
) override
;
135 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
137 implSelect( sal_Int64 nAccessibleChildIndex
, bool bSelect
) override
;
139 // OCommonAccessibleComponent
140 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
141 virtual css::awt::Rectangle
implGetBounds( ) override
;
145 // - SvxShowCharSetItemAcc -
147 /** The child implementation of the table.
149 class SvxShowCharSetItemAcc final
: public cppu::ImplInheritanceHelper
<
150 ::comphelper::OAccessibleComponentHelper
,
151 css::accessibility::XAccessible
,
152 css::accessibility::XAccessibleAction
>
155 SvxShowCharSetItem
* mpParent
;
157 virtual ~SvxShowCharSetItemAcc() override
;
159 // OCommonAccessibleComponent
160 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
161 virtual css::awt::Rectangle
implGetBounds( ) override
;
164 SvxShowCharSetItemAcc( SvxShowCharSetItem
* pParent
);
166 void ParentDestroyed();
168 // XAccessibleComponent
169 virtual void SAL_CALL
grabFocus( ) override
;
170 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
172 //OCommonAccessibleComponent
173 // XAccessibleContext - still waiting to be overwritten
174 virtual sal_Int64 SAL_CALL
getAccessibleChildCount( ) override
;
175 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int64 i
) override
;
176 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
177 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
178 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
179 virtual OUString SAL_CALL
getAccessibleName( ) override
;
180 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
181 virtual sal_Int64 SAL_CALL
getAccessibleStateSet( ) override
;
183 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
{ return this; }
185 virtual sal_Int32 SAL_CALL
getForeground( ) override
{ return mpParent
->m_pParent
->getForeground(); }
186 virtual sal_Int32 SAL_CALL
getBackground( ) override
{ return mpParent
->m_pParent
->getBackground(); }
189 virtual sal_Int32 SAL_CALL
getAccessibleActionCount( ) override
;
190 virtual sal_Bool SAL_CALL
doAccessibleAction ( sal_Int32 nIndex
) override
;
191 virtual OUString SAL_CALL
getAccessibleActionDescription ( sal_Int32 nIndex
) override
;
192 virtual css::uno::Reference
< css::accessibility::XAccessibleKeyBinding
> SAL_CALL
getAccessibleActionKeyBinding( sal_Int32 nIndex
) override
;
196 const sal_Int16 _nEventId
,
197 const css::uno::Any
& _rOldValue
,
198 const css::uno::Any
& _rNewValue
201 NotifyAccessibleEvent(_nEventId
,_rOldValue
,_rNewValue
);
207 #endif // INCLUDED_SVX_SOURCE_INC_CHARMAPACC_HXX
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */