Branch data Line data Source code
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 <accessibledialogcontrolshape.hxx>
21 : : #include <baside3.hxx>
22 : : #include <dlgeddef.hxx>
23 : : #include <dlgedview.hxx>
24 : : #include <dlgedobj.hxx>
25 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
26 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
27 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
28 : : #include <unotools/accessiblestatesethelper.hxx>
29 : : #include <unotools/accessiblerelationsethelper.hxx>
30 : : #include <toolkit/awt/vclxfont.hxx>
31 : : #include <toolkit/helper/externallock.hxx>
32 : : #include <toolkit/helper/convert.hxx>
33 : : #include <toolkit/helper/vclunohelper.hxx>
34 : : #include <vcl/svapp.hxx>
35 : :
36 : : using namespace ::com::sun::star;
37 : : using namespace ::com::sun::star::uno;
38 : : using namespace ::com::sun::star::lang;
39 : : using namespace ::com::sun::star::beans;
40 : : using namespace ::com::sun::star::accessibility;
41 : : using namespace ::comphelper;
42 : :
43 : :
44 : : // -----------------------------------------------------------------------------
45 : : // class AccessibleDialogControlShape
46 : : // -----------------------------------------------------------------------------
47 : :
48 : 0 : AccessibleDialogControlShape::AccessibleDialogControlShape (basctl::DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj)
49 : 0 : :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
50 : : ,m_pDialogWindow( pDialogWindow )
51 : 0 : ,m_pDlgEdObj( pDlgEdObj )
52 : : {
53 : 0 : m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
54 : :
55 : 0 : if ( m_pDlgEdObj )
56 : 0 : m_xControlModel = Reference< XPropertySet >( m_pDlgEdObj->GetUnoControlModel(), UNO_QUERY );
57 : :
58 : 0 : if ( m_xControlModel.is() )
59 : 0 : m_xControlModel->addPropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) );
60 : :
61 : 0 : m_bFocused = IsFocused();
62 : 0 : m_bSelected = IsSelected();
63 : 0 : m_aBounds = GetBounds();
64 : 0 : }
65 : :
66 : : // -----------------------------------------------------------------------------
67 : :
68 : 0 : AccessibleDialogControlShape::~AccessibleDialogControlShape()
69 : : {
70 : 0 : if ( m_xControlModel.is() )
71 : 0 : m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) );
72 : :
73 : 0 : delete m_pExternalLock;
74 : 0 : m_pExternalLock = NULL;
75 : 0 : }
76 : :
77 : : // -----------------------------------------------------------------------------
78 : :
79 : 0 : bool AccessibleDialogControlShape::IsFocused()
80 : : {
81 : 0 : bool bFocused = false;
82 : 0 : if ( m_pDialogWindow )
83 : : {
84 : 0 : SdrView* pSdrView = m_pDialogWindow->GetView();
85 : 0 : if ( pSdrView && pSdrView->IsObjMarked( m_pDlgEdObj ) && pSdrView->GetMarkedObjectList().GetMarkCount() == 1 )
86 : 0 : bFocused = true;
87 : : }
88 : :
89 : 0 : return bFocused;
90 : : }
91 : :
92 : : // -----------------------------------------------------------------------------
93 : :
94 : 0 : bool AccessibleDialogControlShape::IsSelected()
95 : : {
96 : 0 : bool bSelected = false;
97 : 0 : if ( m_pDialogWindow )
98 : : {
99 : 0 : SdrView* pSdrView = m_pDialogWindow->GetView();
100 : 0 : if ( pSdrView )
101 : 0 : bSelected = pSdrView->IsObjMarked( m_pDlgEdObj );
102 : : }
103 : :
104 : 0 : return bSelected;
105 : : }
106 : :
107 : : // -----------------------------------------------------------------------------
108 : :
109 : 0 : void AccessibleDialogControlShape::SetFocused( bool bFocused )
110 : : {
111 : 0 : if ( m_bFocused != bFocused )
112 : : {
113 : 0 : Any aOldValue, aNewValue;
114 : 0 : if ( m_bFocused )
115 : 0 : aOldValue <<= AccessibleStateType::FOCUSED;
116 : : else
117 : 0 : aNewValue <<= AccessibleStateType::FOCUSED;
118 : 0 : m_bFocused = bFocused;
119 : 0 : NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
120 : : }
121 : 0 : }
122 : :
123 : : // -----------------------------------------------------------------------------
124 : :
125 : 0 : void AccessibleDialogControlShape::SetSelected( bool bSelected )
126 : : {
127 : 0 : if ( m_bSelected != bSelected )
128 : : {
129 : 0 : Any aOldValue, aNewValue;
130 : 0 : if ( m_bSelected )
131 : 0 : aOldValue <<= AccessibleStateType::SELECTED;
132 : : else
133 : 0 : aNewValue <<= AccessibleStateType::SELECTED;
134 : 0 : m_bSelected = bSelected;
135 : 0 : NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
136 : : }
137 : 0 : }
138 : :
139 : : // -----------------------------------------------------------------------------
140 : :
141 : 0 : awt::Rectangle AccessibleDialogControlShape::GetBounds()
142 : : {
143 : 0 : awt::Rectangle aBounds( 0, 0, 0, 0 );
144 : 0 : if ( m_pDlgEdObj )
145 : : {
146 : : // get the bounding box of the shape in logic units
147 : 0 : Rectangle aRect = m_pDlgEdObj->GetSnapRect();
148 : :
149 : 0 : if ( m_pDialogWindow )
150 : : {
151 : : // transform coordinates relative to the parent
152 : 0 : MapMode aMap = m_pDialogWindow->GetMapMode();
153 : 0 : Point aOrg = aMap.GetOrigin();
154 : 0 : aRect.Move( aOrg.X(), aOrg.Y() );
155 : :
156 : : // convert logic units to pixel
157 : 0 : aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) );
158 : :
159 : : // clip the shape's bounding box with the bounding box of its parent
160 : 0 : Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() );
161 : 0 : aRect = aRect.GetIntersection( aParentRect );
162 : 0 : aBounds = AWTRectangle( aRect );
163 : : }
164 : : }
165 : :
166 : 0 : return aBounds;
167 : : }
168 : :
169 : : // -----------------------------------------------------------------------------
170 : :
171 : 0 : void AccessibleDialogControlShape::SetBounds( const awt::Rectangle& aBounds )
172 : : {
173 : 0 : if ( m_aBounds.X != aBounds.X || m_aBounds.Y != aBounds.Y || m_aBounds.Width != aBounds.Width || m_aBounds.Height != aBounds.Height )
174 : : {
175 : 0 : m_aBounds = aBounds;
176 : 0 : NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() );
177 : : }
178 : 0 : }
179 : :
180 : : // -----------------------------------------------------------------------------
181 : :
182 : 0 : Window* AccessibleDialogControlShape::GetWindow() const
183 : : {
184 : 0 : Window* pWindow = NULL;
185 : 0 : if ( m_pDlgEdObj )
186 : : {
187 : 0 : Reference< awt::XControl > xControl( m_pDlgEdObj->GetControl(), UNO_QUERY );
188 : 0 : if ( xControl.is() )
189 : 0 : pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() );
190 : : }
191 : :
192 : 0 : return pWindow;
193 : : }
194 : :
195 : : // -----------------------------------------------------------------------------
196 : :
197 : 0 : ::rtl::OUString AccessibleDialogControlShape::GetModelStringProperty( const sal_Char* pPropertyName )
198 : : {
199 : 0 : ::rtl::OUString sReturn;
200 : :
201 : : try
202 : : {
203 : 0 : if ( m_xControlModel.is() )
204 : : {
205 : 0 : ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( pPropertyName ) );
206 : 0 : Reference< XPropertySetInfo > xInfo = m_xControlModel->getPropertySetInfo();
207 : 0 : if ( xInfo.is() && xInfo->hasPropertyByName( sPropertyName ) )
208 : 0 : m_xControlModel->getPropertyValue( sPropertyName ) >>= sReturn;
209 : : }
210 : : }
211 : 0 : catch ( const Exception& )
212 : : {
213 : : OSL_FAIL( "AccessibleDialogControlShape::GetModelStringProperty: caught an exception!" );
214 : : }
215 : :
216 : 0 : return sReturn;
217 : : }
218 : :
219 : : // -----------------------------------------------------------------------------
220 : :
221 : 0 : void AccessibleDialogControlShape::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
222 : : {
223 : 0 : rStateSet.AddState( AccessibleStateType::ENABLED );
224 : :
225 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
226 : :
227 : 0 : rStateSet.AddState( AccessibleStateType::SHOWING );
228 : :
229 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSABLE );
230 : :
231 : 0 : if ( IsFocused() )
232 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSED );
233 : :
234 : 0 : rStateSet.AddState( AccessibleStateType::SELECTABLE );
235 : :
236 : 0 : if ( IsSelected() )
237 : 0 : rStateSet.AddState( AccessibleStateType::SELECTED );
238 : :
239 : 0 : rStateSet.AddState( AccessibleStateType::RESIZABLE );
240 : 0 : }
241 : :
242 : : // -----------------------------------------------------------------------------
243 : : // OCommonAccessibleComponent
244 : : // -----------------------------------------------------------------------------
245 : :
246 : 0 : awt::Rectangle AccessibleDialogControlShape::implGetBounds() throw (RuntimeException)
247 : : {
248 : 0 : return GetBounds();
249 : : }
250 : :
251 : : // -----------------------------------------------------------------------------
252 : : // XInterface
253 : : // -----------------------------------------------------------------------------
254 : :
255 : 0 : IMPLEMENT_FORWARD_XINTERFACE2( AccessibleDialogControlShape, AccessibleExtendedComponentHelper_BASE, AccessibleDialogControlShape_BASE )
256 : :
257 : : // -----------------------------------------------------------------------------
258 : : // XTypeProvider
259 : : // -----------------------------------------------------------------------------
260 : :
261 : 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleDialogControlShape, AccessibleExtendedComponentHelper_BASE, AccessibleDialogControlShape_BASE )
262 : :
263 : : // -----------------------------------------------------------------------------
264 : : // XComponent
265 : : // -----------------------------------------------------------------------------
266 : :
267 : 0 : void AccessibleDialogControlShape::disposing()
268 : : {
269 : 0 : AccessibleExtendedComponentHelper_BASE::disposing();
270 : :
271 : 0 : m_pDialogWindow = NULL;
272 : 0 : m_pDlgEdObj = NULL;
273 : :
274 : 0 : if ( m_xControlModel.is() )
275 : 0 : m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) );
276 : 0 : m_xControlModel.clear();
277 : 0 : }
278 : :
279 : : // -----------------------------------------------------------------------------
280 : : // XEventListener
281 : : // -----------------------------------------------------------------------------
282 : :
283 : 0 : void AccessibleDialogControlShape::disposing( const lang::EventObject& ) throw (RuntimeException)
284 : : {
285 : 0 : if ( m_xControlModel.is() )
286 : 0 : m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) );
287 : 0 : m_xControlModel.clear();
288 : 0 : }
289 : :
290 : : // -----------------------------------------------------------------------------
291 : : // XPropertyChangeListener
292 : : // -----------------------------------------------------------------------------
293 : :
294 : 0 : void AccessibleDialogControlShape::propertyChange( const beans::PropertyChangeEvent& rEvent ) throw (RuntimeException)
295 : : {
296 : 0 : if ( rEvent.PropertyName == DLGED_PROP_NAME )
297 : : {
298 : 0 : NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, rEvent.OldValue, rEvent.NewValue );
299 : : }
300 : 0 : else if ( rEvent.PropertyName == DLGED_PROP_POSITIONX ||
301 : 0 : rEvent.PropertyName == DLGED_PROP_POSITIONY ||
302 : 0 : rEvent.PropertyName == DLGED_PROP_WIDTH ||
303 : 0 : rEvent.PropertyName == DLGED_PROP_HEIGHT )
304 : : {
305 : 0 : SetBounds( GetBounds() );
306 : : }
307 : 0 : else if ( rEvent.PropertyName == DLGED_PROP_BACKGROUNDCOLOR ||
308 : 0 : rEvent.PropertyName == DLGED_PROP_TEXTCOLOR ||
309 : 0 : rEvent.PropertyName == DLGED_PROP_TEXTLINECOLOR )
310 : : {
311 : 0 : NotifyAccessibleEvent( AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any() );
312 : : }
313 : 0 : }
314 : :
315 : : // -----------------------------------------------------------------------------
316 : : // XServiceInfo
317 : : // -----------------------------------------------------------------------------
318 : :
319 : 0 : ::rtl::OUString AccessibleDialogControlShape::getImplementationName() throw (RuntimeException)
320 : : {
321 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basctl.AccessibleShape" ));
322 : : }
323 : :
324 : : // -----------------------------------------------------------------------------
325 : :
326 : 0 : sal_Bool AccessibleDialogControlShape::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
327 : : {
328 : 0 : Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
329 : 0 : const ::rtl::OUString* pNames = aNames.getConstArray();
330 : 0 : const ::rtl::OUString* pEnd = pNames + aNames.getLength();
331 : 0 : for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
332 : : ;
333 : :
334 : 0 : return pNames != pEnd;
335 : : }
336 : :
337 : : // -----------------------------------------------------------------------------
338 : :
339 : 0 : Sequence< ::rtl::OUString > AccessibleDialogControlShape::getSupportedServiceNames() throw (RuntimeException)
340 : : {
341 : 0 : Sequence< ::rtl::OUString > aNames(1);
342 : 0 : aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AccessibleShape" ));
343 : 0 : return aNames;
344 : : }
345 : :
346 : : // -----------------------------------------------------------------------------
347 : : // XAccessible
348 : : // -----------------------------------------------------------------------------
349 : :
350 : 0 : Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleContext( ) throw (RuntimeException)
351 : : {
352 : 0 : OExternalLockGuard aGuard( this );
353 : :
354 : 0 : return this;
355 : : }
356 : :
357 : : // -----------------------------------------------------------------------------
358 : : // XAccessibleContext
359 : : // -----------------------------------------------------------------------------
360 : :
361 : 0 : sal_Int32 AccessibleDialogControlShape::getAccessibleChildCount() throw (RuntimeException)
362 : : {
363 : 0 : OExternalLockGuard aGuard( this );
364 : :
365 : 0 : return 0;
366 : : }
367 : :
368 : : // -----------------------------------------------------------------------------
369 : :
370 : 0 : Reference< XAccessible > AccessibleDialogControlShape::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
371 : : {
372 : 0 : OExternalLockGuard aGuard( this );
373 : :
374 : 0 : if ( i < 0 || i >= getAccessibleChildCount() )
375 : 0 : throw IndexOutOfBoundsException();
376 : :
377 : 0 : return Reference< XAccessible >();
378 : : }
379 : :
380 : : // -----------------------------------------------------------------------------
381 : :
382 : 0 : Reference< XAccessible > AccessibleDialogControlShape::getAccessibleParent( ) throw (RuntimeException)
383 : : {
384 : 0 : OExternalLockGuard aGuard( this );
385 : :
386 : 0 : Reference< XAccessible > xParent;
387 : 0 : if ( m_pDialogWindow )
388 : 0 : xParent = m_pDialogWindow->GetAccessible();
389 : :
390 : 0 : return xParent;
391 : : }
392 : :
393 : : // -----------------------------------------------------------------------------
394 : :
395 : 0 : sal_Int32 AccessibleDialogControlShape::getAccessibleIndexInParent( ) throw (RuntimeException)
396 : : {
397 : 0 : OExternalLockGuard aGuard( this );
398 : :
399 : 0 : sal_Int32 nIndexInParent = -1;
400 : 0 : Reference< XAccessible > xParent( getAccessibleParent() );
401 : 0 : if ( xParent.is() )
402 : : {
403 : 0 : Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
404 : 0 : if ( xParentContext.is() )
405 : : {
406 : 0 : for ( sal_Int32 i = 0, nCount = xParentContext->getAccessibleChildCount(); i < nCount; ++i )
407 : : {
408 : 0 : Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) );
409 : 0 : if ( xChild.is() )
410 : : {
411 : 0 : Reference< XAccessibleContext > xChildContext = xChild->getAccessibleContext();
412 : 0 : if ( xChildContext == (XAccessibleContext*)this )
413 : : {
414 : 0 : nIndexInParent = i;
415 : : break;
416 : 0 : }
417 : : }
418 : 0 : }
419 : 0 : }
420 : : }
421 : :
422 : 0 : return nIndexInParent;
423 : : }
424 : :
425 : : // -----------------------------------------------------------------------------
426 : :
427 : 0 : sal_Int16 AccessibleDialogControlShape::getAccessibleRole( ) throw (RuntimeException)
428 : : {
429 : 0 : OExternalLockGuard aGuard( this );
430 : :
431 : 0 : return AccessibleRole::SHAPE;
432 : : }
433 : :
434 : : // -----------------------------------------------------------------------------
435 : :
436 : 0 : ::rtl::OUString AccessibleDialogControlShape::getAccessibleDescription( ) throw (RuntimeException)
437 : : {
438 : 0 : OExternalLockGuard aGuard( this );
439 : :
440 : 0 : return GetModelStringProperty( "HelpText" );
441 : : }
442 : :
443 : : // -----------------------------------------------------------------------------
444 : :
445 : 0 : ::rtl::OUString AccessibleDialogControlShape::getAccessibleName( ) throw (RuntimeException)
446 : : {
447 : 0 : OExternalLockGuard aGuard( this );
448 : :
449 : 0 : return GetModelStringProperty( "Name" );
450 : : }
451 : :
452 : : // -----------------------------------------------------------------------------
453 : :
454 : 0 : Reference< XAccessibleRelationSet > AccessibleDialogControlShape::getAccessibleRelationSet( ) throw (RuntimeException)
455 : : {
456 : 0 : OExternalLockGuard aGuard( this );
457 : :
458 : 0 : utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
459 : 0 : Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
460 : 0 : return xSet;
461 : : }
462 : :
463 : : // -----------------------------------------------------------------------------
464 : :
465 : 0 : Reference< XAccessibleStateSet > AccessibleDialogControlShape::getAccessibleStateSet( ) throw (RuntimeException)
466 : : {
467 : 0 : OExternalLockGuard aGuard( this );
468 : :
469 : 0 : utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
470 : 0 : Reference< XAccessibleStateSet > xSet = pStateSetHelper;
471 : :
472 : 0 : if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
473 : : {
474 : 0 : FillAccessibleStateSet( *pStateSetHelper );
475 : : }
476 : : else
477 : : {
478 : 0 : pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
479 : : }
480 : :
481 : 0 : return xSet;
482 : : }
483 : :
484 : : // -----------------------------------------------------------------------------
485 : :
486 : 0 : Locale AccessibleDialogControlShape::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
487 : : {
488 : 0 : OExternalLockGuard aGuard( this );
489 : :
490 : 0 : return Application::GetSettings().GetLocale();
491 : : }
492 : :
493 : : // -----------------------------------------------------------------------------
494 : : // XAccessibleComponent
495 : : // -----------------------------------------------------------------------------
496 : :
497 : 0 : Reference< XAccessible > AccessibleDialogControlShape::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
498 : : {
499 : 0 : OExternalLockGuard aGuard( this );
500 : :
501 : 0 : return Reference< XAccessible >();
502 : : }
503 : :
504 : : // -----------------------------------------------------------------------------
505 : :
506 : 0 : void AccessibleDialogControlShape::grabFocus( ) throw (RuntimeException)
507 : : {
508 : : // no focus for shapes
509 : 0 : }
510 : :
511 : : // -----------------------------------------------------------------------------
512 : :
513 : 0 : sal_Int32 AccessibleDialogControlShape::getForeground( ) throw (RuntimeException)
514 : : {
515 : 0 : OExternalLockGuard aGuard( this );
516 : :
517 : 0 : sal_Int32 nColor = 0;
518 : 0 : Window* pWindow = GetWindow();
519 : 0 : if ( pWindow )
520 : : {
521 : 0 : if ( pWindow->IsControlForeground() )
522 : 0 : nColor = pWindow->GetControlForeground().GetColor();
523 : : else
524 : : {
525 : 0 : Font aFont;
526 : 0 : if ( pWindow->IsControlFont() )
527 : 0 : aFont = pWindow->GetControlFont();
528 : : else
529 : 0 : aFont = pWindow->GetFont();
530 : 0 : nColor = aFont.GetColor().GetColor();
531 : : }
532 : : }
533 : :
534 : 0 : return nColor;
535 : : }
536 : :
537 : : // -----------------------------------------------------------------------------
538 : :
539 : 0 : sal_Int32 AccessibleDialogControlShape::getBackground( ) throw (RuntimeException)
540 : : {
541 : 0 : OExternalLockGuard aGuard( this );
542 : :
543 : 0 : sal_Int32 nColor = 0;
544 : 0 : Window* pWindow = GetWindow();
545 : 0 : if ( pWindow )
546 : : {
547 : 0 : if ( pWindow->IsControlBackground() )
548 : 0 : nColor = pWindow->GetControlBackground().GetColor();
549 : : else
550 : 0 : nColor = pWindow->GetBackground().GetColor().GetColor();
551 : : }
552 : :
553 : 0 : return nColor;
554 : : }
555 : :
556 : : // -----------------------------------------------------------------------------
557 : : // XAccessibleExtendedComponent
558 : : // -----------------------------------------------------------------------------
559 : :
560 : 0 : Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) throw (RuntimeException)
561 : : {
562 : 0 : OExternalLockGuard aGuard( this );
563 : :
564 : 0 : Reference< awt::XFont > xFont;
565 : 0 : Window* pWindow = GetWindow();
566 : 0 : if ( pWindow )
567 : : {
568 : 0 : Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY );
569 : 0 : if ( xDev.is() )
570 : : {
571 : 0 : Font aFont;
572 : 0 : if ( pWindow->IsControlFont() )
573 : 0 : aFont = pWindow->GetControlFont();
574 : : else
575 : 0 : aFont = pWindow->GetFont();
576 : 0 : VCLXFont* pVCLXFont = new VCLXFont;
577 : 0 : pVCLXFont->Init( *xDev.get(), aFont );
578 : 0 : xFont = pVCLXFont;
579 : 0 : }
580 : : }
581 : :
582 : 0 : return xFont;
583 : : }
584 : :
585 : : // -----------------------------------------------------------------------------
586 : :
587 : 0 : ::rtl::OUString AccessibleDialogControlShape::getTitledBorderText( ) throw (RuntimeException)
588 : : {
589 : 0 : OExternalLockGuard aGuard( this );
590 : :
591 : 0 : return ::rtl::OUString();
592 : : }
593 : :
594 : : // -----------------------------------------------------------------------------
595 : :
596 : 0 : ::rtl::OUString AccessibleDialogControlShape::getToolTipText( ) throw (RuntimeException)
597 : : {
598 : 0 : OExternalLockGuard aGuard( this );
599 : :
600 : 0 : ::rtl::OUString sText;
601 : 0 : Window* pWindow = GetWindow();
602 : 0 : if ( pWindow )
603 : 0 : sText = pWindow->GetQuickHelpText();
604 : :
605 : 0 : return sText;
606 : : }
607 : :
608 : : // -----------------------------------------------------------------------------
609 : :
610 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|