Bug Summary

File:home/maarten/src/libreoffice/core/svx/source/accessibility/charmapacc.cxx
Warning:line 370, column 9
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name charmapacc.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SVX_DLLIMPLEMENTATION -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/svx/inc -I /home/maarten/src/libreoffice/core/svx/source/inc -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/svx/source/accessibility/charmapacc.cxx
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 <unotools/accessiblestatesethelper.hxx>
21#include <vcl/settings.hxx>
22#include <vcl/svapp.hxx>
23#include <stdio.h>
24#include <svx/charmap.hxx>
25#include <charmapacc.hxx>
26#include <com/sun/star/accessibility/AccessibleRole.hpp>
27#include <com/sun/star/accessibility/AccessibleStateType.hpp>
28#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29#include <osl/interlck.h>
30#include <svx/dialmgr.hxx>
31#include <svx/strings.hrc>
32#include <comphelper/types.hxx>
33
34namespace svx
35{
36 using namespace comphelper;
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::lang;
40 using namespace ::com::sun::star::accessibility;
41
42SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos ) :
43 mrParent( rParent )
44 ,mnId( _nPos )
45 ,m_pParent(_pParent)
46{
47}
48
49SvxShowCharSetItem::~SvxShowCharSetItem()
50{
51 if ( m_xItem.is() )
52 {
53 m_xItem->ParentDestroyed();
54 m_xItem.clear();
55 }
56}
57
58uno::Reference< css::accessibility::XAccessible > SvxShowCharSetItem::GetAccessible()
59{
60 if( !m_xItem.is() )
4
Taking true branch
61 {
62 m_xItem = new SvxShowCharSetItemAcc( this );
5
Calling constructor for 'SvxShowCharSetItemAcc'
63 }
64
65 return m_xItem.get();
66}
67
68SvxShowCharSetAcc::SvxShowCharSetAcc(SvxShowCharSet* pParent)
69 : m_pParent(pParent)
70{
71 osl_atomic_increment(&m_refCount)__sync_add_and_fetch((&m_refCount), 1);
72 {
73 lateInit(this);
74 }
75 osl_atomic_decrement(&m_refCount)__sync_sub_and_fetch((&m_refCount), 1);
76}
77
78SvxShowCharSetAcc::~SvxShowCharSetAcc()
79{
80 ensureDisposed();
81}
82
83void SAL_CALL SvxShowCharSetAcc::disposing()
84{
85 OAccessibleSelectionHelper::disposing();
86 for (auto& rChild : m_aChildren)
87 ::comphelper::disposeComponent(rChild);
88
89 m_aChildren.clear();
90 m_pParent = nullptr;
91}
92
93
94IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )void SvxShowCharSetAcc::acquire() throw() { OAccessibleSelectionHelper
::acquire(); } void SvxShowCharSetAcc::release() throw() { OAccessibleSelectionHelper
::release(); } css::uno::Any SvxShowCharSetAcc::queryInterface
( const css::uno::Type& _rType ) { css::uno::Any aReturn =
OAccessibleSelectionHelper::queryInterface( _rType ); if ( !
aReturn.hasValue() ) aReturn = OAccessibleHelper_Base::queryInterface
( _rType ); return aReturn; }
95IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )css::uno::Sequence< css::uno::Type > SvxShowCharSetAcc::
getTypes( ) { return ::comphelper::concatSequences( OAccessibleSelectionHelper
::getTypes(), OAccessibleHelper_Base::getTypes() ); } css::uno
::Sequence< sal_Int8 > SvxShowCharSetAcc::getImplementationId
( ) { return css::uno::Sequence<sal_Int8>(); }
96
97bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex )
98{
99 return m_pParent && m_pParent->IsSelected(
100 sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex));
101}
102
103 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
104void SvxShowCharSetAcc::implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect)
105{
106 if ( m_pParent )
107 {
108 if ( bSelect )
109 m_pParent->SelectIndex(nAccessibleChildIndex, true);
110 else
111 m_pParent->DeSelect();
112 }
113}
114
115css::awt::Rectangle SvxShowCharSetAcc::implGetBounds()
116{
117 awt::Rectangle aRet;
118
119 if (m_pParent)
120 {
121 const Point aOutPos;//( m_pParent->GetPosPixel() );
122 Size aOutSize( m_pParent->GetOutputSizePixel());
123
124 aRet.X = aOutPos.X();
125 aRet.Y = aOutPos.Y();
126 aRet.Width = aOutSize.Width();
127 aRet.Height = aOutSize.Height();
128 }
129
130 return aRet;
131}
132
133sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount()
134{
135 OExternalLockGuard aGuard( this );
136
137 return m_pParent->getMaxCharCount();
138}
139
140uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i )
141{
142 OExternalLockGuard aGuard( this );
143
144 uno::Reference< css::accessibility::XAccessible > xRet;
145 SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( static_cast< sal_uInt16 >( i ) );
146
147 if( !pItem )
148 throw lang::IndexOutOfBoundsException();
149
150 pItem->m_pParent = this;
151 xRet = pItem->GetAccessible();
152 m_aChildren.push_back(xRet);
153
154 return xRet;
155}
156
157uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleParent()
158{
159 OExternalLockGuard aGuard( this );
160
161 if (m_pParent)
162 return m_pParent->getAccessibleParent();
163 return uno::Reference<css::accessibility::XAccessible>();
164}
165
166sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole()
167{
168 return css::accessibility::AccessibleRole::TABLE;
169}
170
171OUString SAL_CALL SvxShowCharSetAcc::getAccessibleDescription()
172{
173 OExternalLockGuard aGuard( this );
174 return SvxResId( RID_SVXSTR_CHARACTER_SELECTIONreinterpret_cast<char const *>("RID_SVXSTR_CHARACTER_SELECTION"
"\004" u8"Special character selection")
);
175}
176
177
178OUString SAL_CALL SvxShowCharSetAcc::getAccessibleName()
179{
180 OExternalLockGuard aGuard( this );
181
182 return SvxResId( RID_SVXSTR_CHAR_SEL_DESCreinterpret_cast<char const *>("RID_SVXSTR_CHAR_SEL_DESC"
"\004" u8"Select special characters in this area.")
);
183}
184
185
186uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetAcc::getAccessibleRelationSet()
187{
188 return uno::Reference< css::accessibility::XAccessibleRelationSet >();
189}
190
191
192uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetAcc::getAccessibleStateSet()
193{
194 OExternalLockGuard aGuard( this );
195
196 ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
197
198 if (m_pParent)
199 {
200 // SELECTABLE
201 pStateSet->AddState( AccessibleStateType::FOCUSABLE );
202 if (m_pParent->HasFocus())
203 {
204 pStateSet->AddState( AccessibleStateType::FOCUSED );
205 pStateSet->AddState( AccessibleStateType::ACTIVE );
206 }
207 if (m_pParent->IsEnabled())
208 {
209 pStateSet->AddState( AccessibleStateType::ENABLED );
210 pStateSet->AddState( AccessibleStateType::SENSITIVE );
211 }
212 if (m_pParent->IsVisible())
213 pStateSet->AddState( AccessibleStateType::VISIBLE );
214
215 pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
216 }
217
218 return pStateSet;
219}
220
221
222uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
223{
224 OExternalLockGuard aGuard( this );
225
226 uno::Reference< css::accessibility::XAccessible > xRet;
227 const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(
228 m_pParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
229
230 if( sal_uInt16(-1) != nItemId )
231 {
232 SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( nItemId );
233 xRet = pItem->GetAccessible();
234 }
235 return xRet;
236}
237
238void SAL_CALL SvxShowCharSetAcc::grabFocus()
239{
240 OExternalLockGuard aGuard( this );
241
242 m_pParent->GrabFocus();
243}
244
245sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowCount( )
246{
247 return ((getAccessibleChildCount()-1) / COLUMN_COUNT16) + 1;
248}
249
250sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnCount( )
251{
252 return COLUMN_COUNT16;
253}
254
255OUString SAL_CALL SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32 /*nRow*/ )
256{
257 return OUString();
258}
259
260OUString SAL_CALL SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32 /*nColumn*/ )
261{
262 return OUString();
263}
264
265sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
266{
267 return 1;
268}
269
270sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
271{
272 return 1;
273}
274
275Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleRowHeaders( )
276{
277 return Reference< XAccessibleTable >();
278}
279
280Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleColumnHeaders( )
281{
282 return Reference< XAccessibleTable >();
283}
284
285Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( )
286{
287 OExternalLockGuard aGuard( this );
288
289 Sequence< sal_Int32 > aSel(1);
290 aSel[0] = SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId());
291 return aSel;
292}
293
294Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns( )
295{
296 OExternalLockGuard aGuard( this );
297
298 Sequence< sal_Int32 > aSel(1);
299 aSel[0] = SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId());
300 return aSel;
301}
302
303sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow )
304{
305 OExternalLockGuard aGuard( this );
306
307 return SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId()) == nRow;
308}
309
310sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn )
311{
312 OExternalLockGuard aGuard( this );
313 ensureAlive();
314 return SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId()) == nColumn;
315}
316
317Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
318{
319 OExternalLockGuard aGuard( this );
320
321 svx::SvxShowCharSetItem* pItem = m_pParent->ImplGetItem(
322 sal::static_int_cast<sal_uInt16>(getAccessibleIndex(nRow,nColumn) ));
323 if ( !pItem )
1
Assuming 'pItem' is non-null
2
Taking false branch
324 throw IndexOutOfBoundsException();
325 return pItem->GetAccessible();
3
Calling 'SvxShowCharSetItem::GetAccessible'
326}
327
328Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCaption( )
329{
330 return Reference< XAccessible >();
331}
332
333Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleSummary( )
334{
335 return Reference< XAccessible >();
336}
337
338sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
339{
340 OExternalLockGuard aGuard( this );
341
342 return m_pParent->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn);
343}
344
345sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
346{
347 return (nRow*COLUMN_COUNT16) + nColumn;
348}
349
350sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRow( sal_Int32 nChildIndex )
351{
352 OExternalLockGuard aGuard( this );
353
354 return SvxShowCharSet::GetRowPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
355}
356
357sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumn( sal_Int32 nChildIndex )
358{
359 OExternalLockGuard aGuard( this );
360
361 return SvxShowCharSet::GetColumnPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
362}
363
364
365SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ) : mpParent( pParent )
366{
367 OSL_ENSURE(pParent,"NO parent supplied!")do { if (true && (!(pParent))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/svx/source/accessibility/charmapacc.cxx"
":" "367" ": "), "%s", "NO parent supplied!"); } } while (false
)
;
6
Taking false branch
7
Loop condition is false. Exiting loop
368 osl_atomic_increment(&m_refCount)__sync_add_and_fetch((&m_refCount), 1);
369 { // #b6211265 #
370 lateInit(this);
8
Called C++ object pointer is null
371 }
372 osl_atomic_decrement(&m_refCount)__sync_sub_and_fetch((&m_refCount), 1);
373}
374
375
376SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
377{
378 ensureDisposed();
379}
380
381IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )void SvxShowCharSetItemAcc::acquire() throw() { OAccessibleComponentHelper
::acquire(); } void SvxShowCharSetItemAcc::release() throw() {
OAccessibleComponentHelper::release(); } css::uno::Any SvxShowCharSetItemAcc
::queryInterface( const css::uno::Type& _rType ) { css::uno
::Any aReturn = OAccessibleComponentHelper::queryInterface( _rType
); if ( !aReturn.hasValue() ) aReturn = OAccessibleHelper_Base_3
::queryInterface( _rType ); return aReturn; }
382IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )css::uno::Sequence< css::uno::Type > SvxShowCharSetItemAcc
::getTypes( ) { return ::comphelper::concatSequences( OAccessibleComponentHelper
::getTypes(), OAccessibleHelper_Base_3::getTypes() ); } css::
uno::Sequence< sal_Int8 > SvxShowCharSetItemAcc::getImplementationId
( ) { return css::uno::Sequence<sal_Int8>(); }
383
384void SvxShowCharSetItemAcc::ParentDestroyed()
385{
386 const ::osl::MutexGuard aGuard( GetMutex() );
387 mpParent = nullptr;
388}
389
390sal_Int32 SAL_CALL SvxShowCharSetItemAcc::getAccessibleChildCount()
391{
392 return 0;
393}
394
395
396uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleChild( sal_Int32 /*i*/ )
397{
398 throw lang::IndexOutOfBoundsException();
399}
400
401
402uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleParent()
403{
404 OExternalLockGuard aGuard( this );
405
406 return mpParent->m_pParent;
407}
408
409
410sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole()
411{
412 return css::accessibility::AccessibleRole::TABLE_CELL;
413}
414
415
416OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleDescription()
417{
418 OExternalLockGuard aGuard( this );
419
420 OUString sDescription;
421
422 const OUString aCharStr( mpParent->maText);
423 sal_Int32 nStrIndex = 0;
424 const sal_UCS4 c = aCharStr.iterateCodePoints( &nStrIndex );
425 const int tmp_len = (c < 0x10000) ? 4 : 6;
426 char buf[16] = "0x0000";
427 sal_UCS4 c_Shifted = c;
428 for( int i = 0; i < tmp_len; ++i )
429 {
430 char h = static_cast<char>(c_Shifted & 0x0F);
431 buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
432 c_Shifted >>= 4;
433 }
434 if( c < 256 )
435 snprintf( buf+6, 10, " (%" SAL_PRIuUINT32"u" ")", c );
436
437 sDescription = SvxResId( RID_SVXSTR_CHARACTER_CODEreinterpret_cast<char const *>("RID_SVXSTR_CHARACTER_CODE"
"\004" u8"Character code ")
)
438 + " "
439 + OUString(buf, strlen(buf), RTL_TEXTENCODING_ASCII_US(((rtl_TextEncoding) 11)));
440
441 return sDescription;
442}
443
444
445OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleName()
446{
447 OExternalLockGuard aGuard( this );
448
449 OUString aRet;
450
451 if( mpParent )
452 {
453 aRet = mpParent->maText;
454
455 if (aRet.isEmpty())
456 aRet = getAccessibleDescription();
457 }
458
459 return aRet;
460}
461
462
463uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleRelationSet()
464{
465 return uno::Reference< css::accessibility::XAccessibleRelationSet >();
466}
467
468
469uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleStateSet()
470{
471 OExternalLockGuard aGuard( this );
472
473 ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
474
475 if( mpParent )
476 {
477 if (mpParent->mrParent.IsEnabled())
478 {
479 pStateSet->AddState( css::accessibility::AccessibleStateType::ENABLED );
480 // SELECTABLE
481 pStateSet->AddState( css::accessibility::AccessibleStateType::SELECTABLE );
482 pStateSet->AddState( css::accessibility::AccessibleStateType::FOCUSABLE );
483 }
484
485 // SELECTED
486 if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId )
487 {
488 pStateSet->AddState( css::accessibility::AccessibleStateType::SELECTED );
489 pStateSet->AddState( css::accessibility::AccessibleStateType::FOCUSED );
490 }
491 if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() )
492 {
493 pStateSet->AddState( AccessibleStateType::VISIBLE );
494 pStateSet->AddState( AccessibleStateType::SHOWING );
495 }
496 pStateSet->AddState( AccessibleStateType::TRANSIENT );
497 }
498
499 return pStateSet;
500}
501
502
503sal_Int32 SvxShowCharSetItemAcc::getAccessibleActionCount()
504{
505 return 1;
506}
507
508
509sal_Bool SvxShowCharSetItemAcc::doAccessibleAction ( sal_Int32 nIndex )
510{
511 OExternalLockGuard aGuard( this );
512
513 if( nIndex == 0 )
514 {
515 mpParent->mrParent.OutputIndex( mpParent->mnId );
516 return true;
517 }
518 throw IndexOutOfBoundsException();
519}
520
521
522OUString SvxShowCharSetItemAcc::getAccessibleActionDescription ( sal_Int32 nIndex )
523{
524 if( nIndex == 0 )
525 return "press";
526 throw IndexOutOfBoundsException();
527}
528
529
530Reference< css::accessibility::XAccessibleKeyBinding > SvxShowCharSetItemAcc::getAccessibleActionKeyBinding( sal_Int32 nIndex )
531{
532 if( nIndex == 0 )
533 return Reference< css::accessibility::XAccessibleKeyBinding >();
534 throw IndexOutOfBoundsException();
535}
536
537
538void SAL_CALL SvxShowCharSetItemAcc::grabFocus()
539{
540 // nothing to do
541}
542
543awt::Rectangle SvxShowCharSetItemAcc::implGetBounds( )
544{
545 awt::Rectangle aRet;
546
547 if( mpParent )
548 {
549 tools::Rectangle aRect( mpParent->maRect );
550 tools::Rectangle aParentRect(Point(), mpParent->mrParent.GetOutputSizePixel());
551
552 aRect.Intersection( aParentRect );
553
554 aRet.X = aRect.Left();
555 aRet.Y = aRect.Top();
556 aRet.Width = aRect.GetWidth();
557 aRet.Height = aRect.GetHeight();
558 }
559
560 return aRet;
561}
562
563uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point& /*aPoint*/ )
564{
565 return uno::Reference< css::accessibility::XAccessible >();
566}
567
568sal_Int32 SAL_CALL SvxShowCharSetAcc::getForeground( )
569{
570 OExternalLockGuard aGuard( this );
571
572 //see SvxShowCharSet::InitSettings
573 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
574 return static_cast<sal_Int32>(rStyleSettings.GetDialogTextColor());
575}
576
577sal_Int32 SAL_CALL SvxShowCharSetAcc::getBackground( )
578{
579 OExternalLockGuard aGuard( this );
580
581 //see SvxShowCharSet::InitSettings
582 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
583 return static_cast<sal_Int32>(rStyleSettings.GetWindowColor());
584}
585
586}
587
588/* vim:set shiftwidth=4 softtabstop=4 expandtab: */