/src/libreoffice/svx/source/accessibility/charmapacc.cxx
Line | Count | Source |
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 | | #include <tools/color.hxx> |
21 | | #include <vcl/settings.hxx> |
22 | | #include <vcl/svapp.hxx> |
23 | | #include <vcl/vclenum.hxx> |
24 | | #include <stdio.h> |
25 | | #include <svx/charmap.hxx> |
26 | | #include <charmapacc.hxx> |
27 | | #include <com/sun/star/accessibility/AccessibleRole.hpp> |
28 | | #include <com/sun/star/accessibility/AccessibleStateType.hpp> |
29 | | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> |
30 | | #include <o3tl/temporary.hxx> |
31 | | #include <osl/interlck.h> |
32 | | #include <svx/dialmgr.hxx> |
33 | | #include <svx/strings.hrc> |
34 | | #include <comphelper/accessiblecontexthelper.hxx> |
35 | | |
36 | | namespace svx |
37 | | { |
38 | | using namespace comphelper; |
39 | | using namespace ::com::sun::star; |
40 | | using namespace ::com::sun::star::uno; |
41 | | using namespace ::com::sun::star::lang; |
42 | | using namespace ::com::sun::star::accessibility; |
43 | | |
44 | | SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos ) : |
45 | 0 | mrParent( rParent ) |
46 | 0 | ,mnId( _nPos ) |
47 | 0 | ,m_pParent(_pParent) |
48 | 0 | { |
49 | 0 | } |
50 | | |
51 | | SvxShowCharSetItem::~SvxShowCharSetItem() |
52 | 0 | { |
53 | 0 | if ( m_xItem.is() ) |
54 | 0 | { |
55 | 0 | m_xItem->ParentDestroyed(); |
56 | 0 | m_xItem->dispose(); |
57 | 0 | m_xItem.clear(); |
58 | 0 | } |
59 | 0 | } |
60 | | |
61 | | const rtl::Reference<SvxShowCharSetItemAcc> & SvxShowCharSetItem::GetAccessible() |
62 | 0 | { |
63 | 0 | if( !m_xItem.is() ) |
64 | 0 | { |
65 | 0 | m_xItem = new SvxShowCharSetItemAcc( this ); |
66 | 0 | } |
67 | |
|
68 | 0 | return m_xItem; |
69 | 0 | } |
70 | | |
71 | | SvxShowCharSetAcc::SvxShowCharSetAcc(SvxShowCharSet* pParent) |
72 | 0 | : m_pParent(pParent) |
73 | 0 | { |
74 | 0 | } |
75 | | |
76 | | SvxShowCharSetAcc::~SvxShowCharSetAcc() |
77 | 0 | { |
78 | 0 | ensureDisposed(); |
79 | 0 | } |
80 | | |
81 | | void SAL_CALL SvxShowCharSetAcc::disposing() |
82 | 0 | { |
83 | 0 | OAccessibleSelectionHelper::disposing(); |
84 | 0 | for (auto& rxChild : m_aChildren) |
85 | 0 | rxChild->dispose(); |
86 | |
|
87 | 0 | m_aChildren.clear(); |
88 | 0 | m_pParent = nullptr; |
89 | 0 | } |
90 | | |
91 | | bool SvxShowCharSetAcc::implIsSelected( sal_Int64 nAccessibleChildIndex ) |
92 | 0 | { |
93 | 0 | if (!m_pParent) |
94 | 0 | return false; |
95 | | |
96 | 0 | if (nAccessibleChildIndex < 0 || nAccessibleChildIndex >= getAccessibleChildCount()) |
97 | 0 | throw IndexOutOfBoundsException(); |
98 | | |
99 | 0 | return m_pParent->IsSelected(sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex)); |
100 | 0 | } |
101 | | |
102 | | // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) |
103 | | void SvxShowCharSetAcc::implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) |
104 | 0 | { |
105 | 0 | if (!m_pParent) |
106 | 0 | return; |
107 | | |
108 | 0 | if (nAccessibleChildIndex < 0 || nAccessibleChildIndex >= getAccessibleChildCount()) |
109 | 0 | throw IndexOutOfBoundsException(); |
110 | | |
111 | 0 | if (bSelect) |
112 | 0 | m_pParent->SelectIndex(nAccessibleChildIndex, true); |
113 | 0 | else |
114 | 0 | m_pParent->DeSelect(); |
115 | 0 | } |
116 | | |
117 | | css::awt::Rectangle SvxShowCharSetAcc::implGetBounds() |
118 | 0 | { |
119 | 0 | awt::Rectangle aRet; |
120 | |
|
121 | 0 | if (m_pParent) |
122 | 0 | { |
123 | 0 | const Point aOutPos;//( m_pParent->GetPosPixel() ); |
124 | 0 | Size aOutSize( m_pParent->GetOutputSizePixel()); |
125 | |
|
126 | 0 | aRet.X = aOutPos.X(); |
127 | 0 | aRet.Y = aOutPos.Y(); |
128 | 0 | aRet.Width = aOutSize.Width(); |
129 | 0 | aRet.Height = aOutSize.Height(); |
130 | 0 | } |
131 | |
|
132 | 0 | return aRet; |
133 | 0 | } |
134 | | |
135 | | sal_Int64 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount() |
136 | 0 | { |
137 | 0 | OExternalLockGuard aGuard( this ); |
138 | |
|
139 | 0 | return m_pParent->getMaxCharCount(); |
140 | 0 | } |
141 | | |
142 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int64 i ) |
143 | 0 | { |
144 | 0 | OExternalLockGuard aGuard( this ); |
145 | |
|
146 | 0 | rtl::Reference< SvxShowCharSetItemAcc > xRet; |
147 | 0 | SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( static_cast< sal_uInt16 >( i ) ); |
148 | |
|
149 | 0 | if( !pItem ) |
150 | 0 | throw lang::IndexOutOfBoundsException(); |
151 | | |
152 | 0 | pItem->m_pParent = this; |
153 | 0 | xRet = pItem->GetAccessible(); |
154 | 0 | m_aChildren.push_back(xRet); |
155 | |
|
156 | 0 | return xRet; |
157 | 0 | } |
158 | | |
159 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleParent() |
160 | 0 | { |
161 | 0 | OExternalLockGuard aGuard( this ); |
162 | |
|
163 | 0 | if (m_pParent) |
164 | 0 | return m_pParent->getAccessibleParent(); |
165 | 0 | return uno::Reference<css::accessibility::XAccessible>(); |
166 | 0 | } |
167 | | |
168 | | sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole() |
169 | 0 | { |
170 | 0 | return css::accessibility::AccessibleRole::TABLE; |
171 | 0 | } |
172 | | |
173 | | OUString SAL_CALL SvxShowCharSetAcc::getAccessibleDescription() |
174 | 0 | { |
175 | 0 | OExternalLockGuard aGuard( this ); |
176 | 0 | return SvxResId( RID_SVXSTR_CHARACTER_SELECTION ); |
177 | 0 | } |
178 | | |
179 | | |
180 | | OUString SAL_CALL SvxShowCharSetAcc::getAccessibleName() |
181 | 0 | { |
182 | 0 | OExternalLockGuard aGuard( this ); |
183 | |
|
184 | 0 | return SvxResId( RID_SVXSTR_CHAR_SEL_DESC ); |
185 | 0 | } |
186 | | |
187 | | |
188 | | uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetAcc::getAccessibleRelationSet() |
189 | 0 | { |
190 | 0 | return uno::Reference< css::accessibility::XAccessibleRelationSet >(); |
191 | 0 | } |
192 | | |
193 | | |
194 | | sal_Int64 SAL_CALL SvxShowCharSetAcc::getAccessibleStateSet() |
195 | 0 | { |
196 | 0 | OExternalLockGuard aGuard( this ); |
197 | |
|
198 | 0 | sal_Int64 nStateSet = 0; |
199 | |
|
200 | 0 | if (m_pParent) |
201 | 0 | { |
202 | | // SELECTABLE |
203 | 0 | nStateSet |= AccessibleStateType::FOCUSABLE; |
204 | 0 | if (m_pParent->HasFocus()) |
205 | 0 | { |
206 | 0 | nStateSet |= AccessibleStateType::FOCUSED; |
207 | 0 | nStateSet |= AccessibleStateType::ACTIVE; |
208 | 0 | } |
209 | 0 | if (m_pParent->IsEnabled()) |
210 | 0 | { |
211 | 0 | nStateSet |= AccessibleStateType::ENABLED; |
212 | 0 | nStateSet |= AccessibleStateType::SENSITIVE; |
213 | 0 | } |
214 | 0 | if (m_pParent->IsVisible()) |
215 | 0 | nStateSet |= AccessibleStateType::VISIBLE; |
216 | |
|
217 | 0 | nStateSet |= AccessibleStateType::MANAGES_DESCENDANTS; |
218 | 0 | } |
219 | |
|
220 | 0 | return nStateSet; |
221 | 0 | } |
222 | | |
223 | | |
224 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point& aPoint ) |
225 | 0 | { |
226 | 0 | OExternalLockGuard aGuard( this ); |
227 | |
|
228 | 0 | const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>( |
229 | 0 | m_pParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) )); |
230 | |
|
231 | 0 | if( sal_uInt16(-1) == nItemId ) |
232 | 0 | return nullptr; |
233 | 0 | SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( nItemId ); |
234 | 0 | return pItem->GetAccessible(); |
235 | 0 | } |
236 | | |
237 | | void SAL_CALL SvxShowCharSetAcc::grabFocus() |
238 | 0 | { |
239 | 0 | OExternalLockGuard aGuard( this ); |
240 | |
|
241 | 0 | m_pParent->GrabFocus(); |
242 | 0 | } |
243 | | |
244 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowCount( ) |
245 | 0 | { |
246 | 0 | return ((getAccessibleChildCount()-1) / COLUMN_COUNT) + 1; |
247 | 0 | } |
248 | | |
249 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnCount( ) |
250 | 0 | { |
251 | 0 | return COLUMN_COUNT; |
252 | 0 | } |
253 | | |
254 | | OUString SAL_CALL SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32 /*nRow*/ ) |
255 | 0 | { |
256 | 0 | return OUString(); |
257 | 0 | } |
258 | | |
259 | | OUString SAL_CALL SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32 /*nColumn*/ ) |
260 | 0 | { |
261 | 0 | return OUString(); |
262 | 0 | } |
263 | | |
264 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) |
265 | 0 | { |
266 | 0 | return 1; |
267 | 0 | } |
268 | | |
269 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) |
270 | 0 | { |
271 | 0 | return 1; |
272 | 0 | } |
273 | | |
274 | | Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleRowHeaders( ) |
275 | 0 | { |
276 | 0 | return Reference< XAccessibleTable >(); |
277 | 0 | } |
278 | | |
279 | | Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleColumnHeaders( ) |
280 | 0 | { |
281 | 0 | return Reference< XAccessibleTable >(); |
282 | 0 | } |
283 | | |
284 | | Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( ) |
285 | 0 | { |
286 | 0 | OExternalLockGuard aGuard( this ); |
287 | |
|
288 | 0 | return { SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId()) }; |
289 | 0 | } |
290 | | |
291 | | Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns( ) |
292 | 0 | { |
293 | 0 | OExternalLockGuard aGuard( this ); |
294 | |
|
295 | 0 | return { SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId()) }; |
296 | 0 | } |
297 | | |
298 | | sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow ) |
299 | 0 | { |
300 | 0 | OExternalLockGuard aGuard( this ); |
301 | |
|
302 | 0 | return SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId()) == nRow; |
303 | 0 | } |
304 | | |
305 | | sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn ) |
306 | 0 | { |
307 | 0 | OExternalLockGuard aGuard( this ); |
308 | 0 | ensureAlive(); |
309 | 0 | return SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId()) == nColumn; |
310 | 0 | } |
311 | | |
312 | | Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) |
313 | 0 | { |
314 | 0 | OExternalLockGuard aGuard( this ); |
315 | |
|
316 | 0 | svx::SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( |
317 | 0 | sal::static_int_cast<sal_uInt16>(getAccessibleIndex(nRow,nColumn) )); |
318 | 0 | if ( !pItem ) |
319 | 0 | throw IndexOutOfBoundsException(); |
320 | 0 | return pItem->GetAccessible(); |
321 | 0 | } |
322 | | |
323 | | Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCaption( ) |
324 | 0 | { |
325 | 0 | return Reference< XAccessible >(); |
326 | 0 | } |
327 | | |
328 | | Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleSummary( ) |
329 | 0 | { |
330 | 0 | return Reference< XAccessible >(); |
331 | 0 | } |
332 | | |
333 | | sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) |
334 | 0 | { |
335 | 0 | OExternalLockGuard aGuard( this ); |
336 | |
|
337 | 0 | return m_pParent->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn); |
338 | 0 | } |
339 | | |
340 | | sal_Int64 SAL_CALL SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) |
341 | 0 | { |
342 | 0 | return (static_cast<sal_Int64>(nRow) * COLUMN_COUNT) + nColumn; |
343 | 0 | } |
344 | | |
345 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRow( sal_Int64 nChildIndex ) |
346 | 0 | { |
347 | 0 | OExternalLockGuard aGuard( this ); |
348 | |
|
349 | 0 | return SvxShowCharSet::GetRowPos(sal::static_int_cast<sal_uInt16>(nChildIndex)); |
350 | 0 | } |
351 | | |
352 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumn( sal_Int64 nChildIndex ) |
353 | 0 | { |
354 | 0 | OExternalLockGuard aGuard( this ); |
355 | |
|
356 | 0 | return SvxShowCharSet::GetColumnPos(sal::static_int_cast<sal_uInt16>(nChildIndex)); |
357 | 0 | } |
358 | | |
359 | | |
360 | 0 | SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ) : mpParent( pParent ) |
361 | 0 | { |
362 | 0 | OSL_ENSURE(pParent,"NO parent supplied!"); |
363 | 0 | } |
364 | | |
365 | | |
366 | | SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc() |
367 | 0 | { |
368 | 0 | ensureDisposed(); |
369 | 0 | } |
370 | | |
371 | | void SvxShowCharSetItemAcc::ParentDestroyed() |
372 | 0 | { |
373 | 0 | const ::osl::MutexGuard aGuard( GetMutex() ); |
374 | 0 | mpParent = nullptr; |
375 | 0 | } |
376 | | |
377 | | sal_Int64 SAL_CALL SvxShowCharSetItemAcc::getAccessibleChildCount() |
378 | 0 | { |
379 | 0 | return 0; |
380 | 0 | } |
381 | | |
382 | | |
383 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleChild( sal_Int64 /*i*/ ) |
384 | 0 | { |
385 | 0 | throw lang::IndexOutOfBoundsException(); |
386 | 0 | } |
387 | | |
388 | | |
389 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleParent() |
390 | 0 | { |
391 | 0 | OExternalLockGuard aGuard( this ); |
392 | |
|
393 | 0 | return mpParent->m_pParent; |
394 | 0 | } |
395 | | |
396 | | |
397 | | sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole() |
398 | 0 | { |
399 | 0 | return css::accessibility::AccessibleRole::TABLE_CELL; |
400 | 0 | } |
401 | | |
402 | | |
403 | | OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleDescription() |
404 | 0 | { |
405 | 0 | OExternalLockGuard aGuard( this ); |
406 | |
|
407 | 0 | OUString sDescription; |
408 | |
|
409 | 0 | const OUString aCharStr( mpParent->maText); |
410 | 0 | const sal_UCS4 c = aCharStr.iterateCodePoints( &o3tl::temporary(sal_Int32(0)) ); |
411 | 0 | const int tmp_len = (c < 0x10000) ? 4 : 6; |
412 | 0 | char buf[16] = "0x0000"; |
413 | 0 | sal_UCS4 c_Shifted = c; |
414 | 0 | for( int i = 0; i < tmp_len; ++i ) |
415 | 0 | { |
416 | 0 | char h = static_cast<char>(c_Shifted & 0x0F); |
417 | 0 | buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0'); |
418 | 0 | c_Shifted >>= 4; |
419 | 0 | } |
420 | 0 | if( c < 256 ) |
421 | 0 | snprintf( buf+6, 10, " (%" SAL_PRIuUINT32 ")", c ); |
422 | |
|
423 | 0 | sDescription = SvxResId( RID_SVXSTR_CHARACTER_CODE ) |
424 | 0 | + " " |
425 | 0 | + OUString(buf, strlen(buf), RTL_TEXTENCODING_ASCII_US); |
426 | |
|
427 | 0 | return sDescription; |
428 | 0 | } |
429 | | |
430 | | |
431 | | OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleName() |
432 | 0 | { |
433 | 0 | OExternalLockGuard aGuard( this ); |
434 | |
|
435 | 0 | OUString aRet; |
436 | |
|
437 | 0 | if( mpParent ) |
438 | 0 | { |
439 | 0 | aRet = mpParent->maText; |
440 | |
|
441 | 0 | if (aRet.isEmpty()) |
442 | 0 | aRet = getAccessibleDescription(); |
443 | 0 | } |
444 | |
|
445 | 0 | return aRet; |
446 | 0 | } |
447 | | |
448 | | |
449 | | uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleRelationSet() |
450 | 0 | { |
451 | 0 | return uno::Reference< css::accessibility::XAccessibleRelationSet >(); |
452 | 0 | } |
453 | | |
454 | | |
455 | | sal_Int64 SAL_CALL SvxShowCharSetItemAcc::getAccessibleStateSet() |
456 | 0 | { |
457 | 0 | OExternalLockGuard aGuard( this ); |
458 | |
|
459 | 0 | sal_Int64 nStateSet = 0; |
460 | |
|
461 | 0 | if( mpParent ) |
462 | 0 | { |
463 | 0 | if (mpParent->mrParent.IsEnabled()) |
464 | 0 | { |
465 | 0 | nStateSet |= css::accessibility::AccessibleStateType::ENABLED; |
466 | | // SELECTABLE |
467 | 0 | nStateSet |= css::accessibility::AccessibleStateType::SELECTABLE; |
468 | 0 | nStateSet |= css::accessibility::AccessibleStateType::FOCUSABLE; |
469 | 0 | } |
470 | | |
471 | | // SELECTED |
472 | 0 | if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId ) |
473 | 0 | { |
474 | 0 | nStateSet |= css::accessibility::AccessibleStateType::SELECTED; |
475 | 0 | if (mpParent->mrParent.HasChildFocus()) |
476 | 0 | nStateSet |= css::accessibility::AccessibleStateType::FOCUSED; |
477 | 0 | } |
478 | 0 | if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() ) |
479 | 0 | { |
480 | 0 | nStateSet |= AccessibleStateType::VISIBLE; |
481 | 0 | nStateSet |= AccessibleStateType::SHOWING; |
482 | 0 | } |
483 | 0 | nStateSet |= AccessibleStateType::TRANSIENT; |
484 | 0 | } |
485 | |
|
486 | 0 | return nStateSet; |
487 | 0 | } |
488 | | |
489 | | |
490 | | sal_Int32 SvxShowCharSetItemAcc::getAccessibleActionCount() |
491 | 0 | { |
492 | 0 | return 1; |
493 | 0 | } |
494 | | |
495 | | |
496 | | sal_Bool SvxShowCharSetItemAcc::doAccessibleAction ( sal_Int32 nIndex ) |
497 | 0 | { |
498 | 0 | OExternalLockGuard aGuard( this ); |
499 | |
|
500 | 0 | if( nIndex == 0 ) |
501 | 0 | { |
502 | 0 | mpParent->mrParent.OutputIndex( mpParent->mnId ); |
503 | 0 | return true; |
504 | 0 | } |
505 | 0 | throw IndexOutOfBoundsException(); |
506 | 0 | } |
507 | | |
508 | | |
509 | | OUString SvxShowCharSetItemAcc::getAccessibleActionDescription ( sal_Int32 nIndex ) |
510 | 0 | { |
511 | 0 | if( nIndex == 0 ) |
512 | 0 | return u"press"_ustr; |
513 | 0 | throw IndexOutOfBoundsException(); |
514 | 0 | } |
515 | | |
516 | | |
517 | | Reference< css::accessibility::XAccessibleKeyBinding > SvxShowCharSetItemAcc::getAccessibleActionKeyBinding( sal_Int32 nIndex ) |
518 | 0 | { |
519 | 0 | if( nIndex == 0 ) |
520 | 0 | return Reference< css::accessibility::XAccessibleKeyBinding >(); |
521 | 0 | throw IndexOutOfBoundsException(); |
522 | 0 | } |
523 | | |
524 | | |
525 | | void SAL_CALL SvxShowCharSetItemAcc::grabFocus() |
526 | 0 | { |
527 | | // nothing to do |
528 | 0 | } |
529 | | |
530 | | awt::Rectangle SvxShowCharSetItemAcc::implGetBounds( ) |
531 | 0 | { |
532 | 0 | awt::Rectangle aRet; |
533 | |
|
534 | 0 | if( mpParent ) |
535 | 0 | { |
536 | 0 | tools::Rectangle aRect( mpParent->maRect ); |
537 | 0 | tools::Rectangle aParentRect(Point(), mpParent->mrParent.GetOutputSizePixel()); |
538 | |
|
539 | 0 | aRect.Intersection( aParentRect ); |
540 | |
|
541 | 0 | aRet.X = aRect.Left(); |
542 | 0 | aRet.Y = aRect.Top(); |
543 | 0 | aRet.Width = aRect.GetWidth(); |
544 | 0 | aRet.Height = aRect.GetHeight(); |
545 | 0 | } |
546 | |
|
547 | 0 | return aRet; |
548 | 0 | } |
549 | | |
550 | | uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) |
551 | 0 | { |
552 | 0 | return uno::Reference< css::accessibility::XAccessible >(); |
553 | 0 | } |
554 | | |
555 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getForeground( ) |
556 | 0 | { |
557 | 0 | OExternalLockGuard aGuard( this ); |
558 | | |
559 | | //see SvxShowCharSet::InitSettings |
560 | 0 | const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); |
561 | 0 | return static_cast<sal_Int32>(rStyleSettings.GetDialogTextColor()); |
562 | 0 | } |
563 | | |
564 | | sal_Int32 SAL_CALL SvxShowCharSetAcc::getBackground( ) |
565 | 0 | { |
566 | 0 | OExternalLockGuard aGuard( this ); |
567 | | |
568 | | //see SvxShowCharSet::InitSettings |
569 | 0 | const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); |
570 | 0 | return static_cast<sal_Int32>(rStyleSettings.GetWindowColor()); |
571 | 0 | } |
572 | | |
573 | | } |
574 | | |
575 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |