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 #include <com/sun/star/accessibility/AccessibleRole.hpp>
21 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
22 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
23 #include <com/sun/star/lang/DisposedException.hpp>
24 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
25 #include <com/sun/star/awt/XWindow.hpp>
26 #include <unotools/accessiblestatesethelper.hxx>
27 #include <cppuhelper/supportsservice.hxx>
28 #include <cppuhelper/typeprovider.hxx>
29 #include <toolkit/helper/vclunohelper.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/settings.hxx>
32 #include <osl/mutex.hxx>
33 #include <tools/gen.hxx>
34 #include <svl/smplhint.hxx>
35 #include <toolkit/helper/convert.hxx>
36 #include <svtools/colorcfg.hxx>
37 #include <comphelper/accessibleeventnotifier.hxx>
38 #include <svx/sdrpaintwindow.hxx>
40 //===== local includes ========================================================
41 #include <svx/ShapeTypeHandler.hxx>
42 #include <svx/AccessibleShapeInfo.hxx>
43 #include "GraphCtlAccessibleContext.hxx"
44 #include <svx/graphctl.hxx>
45 #include <svx/dialogs.hrc>
46 #include "accessibility.hrc"
47 #include <svx/svdpage.hxx>
48 #include <svx/unomod.hxx>
49 #include <svx/dialmgr.hxx>
50 #include <svx/svdetc.hxx>
51 #include <svx/sdrhittesthelper.hxx>
53 //===== namespaces ===========================================================
55 using namespace ::cppu
;
56 using namespace ::osl
;
57 using namespace ::accessibility
;
58 using namespace ::com::sun::star
;
59 using namespace ::com::sun::star::uno
;
60 using namespace ::com::sun::star::drawing
;
61 using namespace ::com::sun::star::lang
;
62 using namespace ::com::sun::star::accessibility
;
65 //===== internal ============================================================
67 /** initialize this component and set default values */
68 SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
69 const Reference
< XAccessible
>& rxParent
,
71 const OUString
* pName
,
72 const OUString
* pDesc
) :
74 SvxGraphCtrlAccessibleContext_Base( m_aMutex
),
83 if (mpControl
!= NULL
)
85 mpModel
= mpControl
->GetSdrModel();
87 mpPage
= (SdrPage
*)mpModel
->GetPage( 0 );
88 mpView
= mpControl
->GetSdrView();
90 if( mpModel
== NULL
|| mpPage
== NULL
|| mpView
== NULL
)
93 // Set all the pointers to NULL just in case they are used as
107 ::SolarMutexGuard aSolarGuard
;
108 msName
= SVX_RESSTR( RID_SVXSTR_GRAPHCTRL_ACC_NAME
);
113 msDescription
= *pDesc
;
117 ::SolarMutexGuard aSolarGuard
;
118 msDescription
= SVX_RESSTR( RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION
);
121 maTreeInfo
.SetSdrView( mpView
);
122 maTreeInfo
.SetWindow( mpControl
);
123 maTreeInfo
.SetViewForwarder( const_cast<SvxGraphCtrlAccessibleContext
*>(this) );
128 /** on destruction, this component is disposed and all dispose listeners
129 are called, except if this component was already disposed */
130 SvxGraphCtrlAccessibleContext::~SvxGraphCtrlAccessibleContext()
137 /** returns the XAccessible interface for a given SdrObject.
138 Multiple calls for the same SdrObject return the same XAccessible.
140 Reference
< XAccessible
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessible( const SdrObject
* pObj
)
142 Reference
<XAccessible
> xAccessibleShape
;
146 // see if we already created an XAccessible for the given SdrObject
147 ShapesMapType::iterator iter
= mxShapes
.find( pObj
);
149 if( iter
!= mxShapes
.end() )
151 // if we already have one, return it
152 xAccessibleShape
= (*iter
).second
;
156 // create a new one and remember in our internal map
157 Reference
< XShape
> xShape( Reference
< XShape
>::query( (const_cast<SdrObject
*>(pObj
))->getUnoShape() ) );
159 AccessibleShapeInfo
aShapeInfo (xShape
,mxParent
);
160 // Create accessible object that corresponds to the descriptor's shape.
161 AccessibleShape
* pAcc
= ShapeTypeHandler::Instance().CreateAccessibleObject(
162 aShapeInfo
, maTreeInfo
);
163 xAccessibleShape
= pAcc
;
167 // Now that we acquired the new accessible shape we can
168 // safely call its Init() method.
171 mxShapes
[pObj
] = pAcc
;
173 // Create event and inform listeners of the object creation.
174 CommitChange( AccessibleEventId::CHILD
, makeAny( xAccessibleShape
), makeAny( Reference
<XAccessible
>() ) );
178 return xAccessibleShape
;
181 //===== XAccessible =========================================================
183 Reference
< XAccessibleContext
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleContext( void ) throw( RuntimeException
, std::exception
)
188 //===== XAccessibleComponent ================================================
190 sal_Bool SAL_CALL
SvxGraphCtrlAccessibleContext::containsPoint( const awt::Point
& rPoint
) throw( RuntimeException
, std::exception
)
192 // no guard -> done in getSize()
193 awt::Size
aSize (getSize());
194 return (rPoint
.X
>= 0)
195 && (rPoint
.X
< aSize
.Width
)
197 && (rPoint
.Y
< aSize
.Height
);
202 Reference
< XAccessible
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleAtPoint( const awt::Point
& rPoint
) throw( RuntimeException
, std::exception
)
204 ::osl::MutexGuard
aGuard( m_aMutex
);
206 Reference
< XAccessible
> xAccessible
;
210 Point
aPnt( rPoint
.X
, rPoint
.Y
);
211 mpControl
->PixelToLogic( aPnt
);
215 if(mpView
&& mpView
->GetSdrPageView())
217 pObj
= SdrObjListPrimitiveHit(*mpPage
, aPnt
, 1, *mpView
->GetSdrPageView(), 0, false);
221 xAccessible
= getAccessible( pObj
);
225 throw DisposedException();
233 awt::Rectangle SAL_CALL
SvxGraphCtrlAccessibleContext::getBounds() throw( RuntimeException
, std::exception
)
235 // no guard -> done in GetBoundingBox()
236 Rectangle
aCoreBounds( GetBoundingBox() );
237 awt::Rectangle aBounds
;
238 aBounds
.X
= aCoreBounds
.getX();
239 aBounds
.Y
= aCoreBounds
.getY();
240 aBounds
.Width
= aCoreBounds
.getWidth();
241 aBounds
.Height
= aCoreBounds
.getHeight();
247 awt::Point SAL_CALL
SvxGraphCtrlAccessibleContext::getLocation() throw( RuntimeException
, std::exception
)
249 // no guard -> done in GetBoundingBox()
250 Rectangle
aRect( GetBoundingBox() );
251 return awt::Point( aRect
.getX(), aRect
.getY() );
256 awt::Point SAL_CALL
SvxGraphCtrlAccessibleContext::getLocationOnScreen() throw( RuntimeException
, std::exception
)
258 // no guard -> done in GetBoundingBoxOnScreen()
259 Rectangle
aRect( GetBoundingBoxOnScreen() );
260 return awt::Point( aRect
.getX(), aRect
.getY() );
265 awt::Size SAL_CALL
SvxGraphCtrlAccessibleContext::getSize() throw( RuntimeException
, std::exception
)
267 // no guard -> done in GetBoundingBox()
268 Rectangle
aRect( GetBoundingBox() );
269 return awt::Size( aRect
.getWidth(), aRect
.getHeight() );
273 //===== XAccessibleContext ==================================================
275 sal_Int32 SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException
, std::exception
)
277 ::SolarMutexGuard aGuard
;
280 throw DisposedException();
282 return mpPage
->GetObjCount();
287 /** returns the SdrObject at index nIndex from the model of this graph */
288 SdrObject
* SvxGraphCtrlAccessibleContext::getSdrObject( sal_Int32 nIndex
)
289 throw( RuntimeException
, lang::IndexOutOfBoundsException
)
291 ::SolarMutexGuard aGuard
;
294 throw DisposedException();
296 if( (nIndex
< 0) || ( static_cast<sal_uInt32
>(nIndex
) >= mpPage
->GetObjCount() ) )
297 throw lang::IndexOutOfBoundsException();
299 return mpPage
->GetObj( nIndex
);
304 /** sends an AccessibleEventObject to all added XAccessibleEventListeners */
305 void SvxGraphCtrlAccessibleContext::CommitChange (
307 const uno::Any
& rNewValue
,
308 const uno::Any
& rOldValue
)
310 AccessibleEventObject
aEvent (
311 static_cast<uno::XWeak
*>(this),
319 /** sends an AccessibleEventObject to all added XAccessibleEventListeners */
320 void SvxGraphCtrlAccessibleContext::FireEvent (const AccessibleEventObject
& aEvent
)
323 comphelper::AccessibleEventNotifier::addEvent( mnClientId
, aEvent
);
328 Reference
< XAccessible
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleChild( sal_Int32 nIndex
)
329 throw( RuntimeException
, lang::IndexOutOfBoundsException
, std::exception
)
331 ::SolarMutexGuard aGuard
;
333 return getAccessible( getSdrObject( nIndex
) );
338 Reference
< XAccessible
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleParent( void ) throw( RuntimeException
, std::exception
)
345 sal_Int32 SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException
, std::exception
)
347 ::SolarMutexGuard aGuard
;
348 // Use a simple but slow solution for now. Optimize later.
350 // Iterate over all the parent's children and search for this object.
353 Reference
< XAccessibleContext
> xParentContext( mxParent
->getAccessibleContext() );
354 if( xParentContext
.is() )
356 sal_Int32 nChildCount
= xParentContext
->getAccessibleChildCount();
357 for( sal_Int32 i
= 0 ; i
< nChildCount
; ++i
)
359 Reference
< XAccessible
> xChild( xParentContext
->getAccessibleChild( i
) );
362 Reference
< XAccessibleContext
> xChildContext
= xChild
->getAccessibleContext();
363 if( xChildContext
== ( XAccessibleContext
* ) this )
370 // Return -1 to indicate that this object's parent does not know about the
377 sal_Int16 SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException
, std::exception
)
379 return AccessibleRole::PANEL
;
384 OUString SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException
, std::exception
)
386 ::SolarMutexGuard aGuard
;
387 return msDescription
;
392 OUString SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleName( void ) throw( RuntimeException
, std::exception
)
394 ::SolarMutexGuard aGuard
;
400 /** Return empty reference to indicate that the relation set is not
403 Reference
< XAccessibleRelationSet
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException
, std::exception
)
405 return Reference
< XAccessibleRelationSet
>();
410 Reference
< XAccessibleStateSet
> SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException
, std::exception
)
412 ::SolarMutexGuard aGuard
;
414 utl::AccessibleStateSetHelper
* pStateSetHelper
= new utl::AccessibleStateSetHelper
;
416 if ( rBHelper
.bDisposed
|| mbDisposed
)
418 pStateSetHelper
->AddState( AccessibleStateType::DEFUNC
);
422 pStateSetHelper
->AddState( AccessibleStateType::FOCUSABLE
);
423 if( mpControl
->HasFocus() )
424 pStateSetHelper
->AddState( AccessibleStateType::FOCUSED
);
425 pStateSetHelper
->AddState( AccessibleStateType::OPAQUE
);
426 pStateSetHelper
->AddState( AccessibleStateType::SHOWING
);
427 pStateSetHelper
->AddState( AccessibleStateType::VISIBLE
);
430 return pStateSetHelper
;
435 lang::Locale SAL_CALL
SvxGraphCtrlAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException
, RuntimeException
, std::exception
)
437 ::SolarMutexGuard aGuard
;
441 Reference
< XAccessibleContext
> xParentContext( mxParent
->getAccessibleContext() );
442 if( xParentContext
.is() )
443 return xParentContext
->getLocale();
446 // No parent. Therefore throw exception to indicate this cluelessness.
447 throw IllegalAccessibleComponentStateException();
450 //===== XAccessibleEventListener ============================================
452 void SAL_CALL
SvxGraphCtrlAccessibleContext::addAccessibleEventListener( const Reference
< XAccessibleEventListener
>& xListener
)
453 throw( RuntimeException
, std::exception
)
457 ::SolarMutexGuard aGuard
;
459 mnClientId
= comphelper::AccessibleEventNotifier::registerClient( );
460 comphelper::AccessibleEventNotifier::addEventListener( mnClientId
, xListener
);
466 void SAL_CALL
SvxGraphCtrlAccessibleContext::removeAccessibleEventListener( const Reference
< XAccessibleEventListener
>& xListener
)
467 throw( RuntimeException
, std::exception
)
471 ::SolarMutexGuard aGuard
;
473 sal_Int32 nListenerCount
= comphelper::AccessibleEventNotifier::removeEventListener( mnClientId
, xListener
);
474 if ( !nListenerCount
)
476 // no listeners anymore
477 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
478 // and at least to us not firing any events anymore, in case somebody calls
479 // NotifyAccessibleEvent, again
480 comphelper::AccessibleEventNotifier::revokeClient( mnClientId
);
488 void SAL_CALL
SvxGraphCtrlAccessibleContext::addFocusListener( const Reference
< awt::XFocusListener
>& xListener
)
489 throw( RuntimeException
)
491 ::SolarMutexGuard aGuard
;
495 Reference
< ::com::sun::star::awt::XWindow
> xWindow( VCLUnoHelper::GetInterface( mpControl
) );
497 xWindow
->addFocusListener( xListener
);
503 void SAL_CALL
SvxGraphCtrlAccessibleContext::removeFocusListener( const Reference
< awt::XFocusListener
>& xListener
)
504 throw (RuntimeException
)
506 ::SolarMutexGuard aGuard
;
510 Reference
< ::com::sun::star::awt::XWindow
> xWindow
= VCLUnoHelper::GetInterface( mpControl
);
512 xWindow
->removeFocusListener( xListener
);
518 void SAL_CALL
SvxGraphCtrlAccessibleContext::grabFocus() throw( RuntimeException
, std::exception
)
520 ::SolarMutexGuard aGuard
;
522 if( NULL
== mpControl
)
523 throw DisposedException();
525 mpControl
->GrabFocus();
530 Any SAL_CALL
SvxGraphCtrlAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException
)
532 // here is no implementation, because here are no KeyBindings for every object
540 sal_Int32 SAL_CALL
SvxGraphCtrlAccessibleContext::getForeground (void)
541 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
543 svtools::ColorConfig aColorConfig
;
544 sal_uInt32 nColor
= aColorConfig
.GetColorValue( svtools::FONTCOLOR
).nColor
;
545 return static_cast<sal_Int32
>(nColor
);
551 sal_Int32 SAL_CALL
SvxGraphCtrlAccessibleContext::getBackground (void)
552 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
554 sal_uInt32 nColor
= Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
555 return static_cast<sal_Int32
>(nColor
);
559 //===== XServiceInfo ========================================================
560 OUString SAL_CALL
SvxGraphCtrlAccessibleContext::getImplementationName( void ) throw( RuntimeException
, std::exception
)
562 return OUString( "com.sun.star.comp.ui.SvxGraphCtrlAccessibleContext" );
565 sal_Bool SAL_CALL
SvxGraphCtrlAccessibleContext::supportsService( const OUString
& sServiceName
) throw( RuntimeException
, std::exception
)
567 return cppu::supportsService(this, sServiceName
);
570 Sequence
< OUString
> SAL_CALL
SvxGraphCtrlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException
, std::exception
)
572 Sequence
< OUString
> aSNs( 3 );
574 aSNs
[0] = "com.sun.star.accessibility.Accessible";
575 aSNs
[1] = "com.sun.star.accessibility.AccessibleContext";
576 aSNs
[2] = "com.sun.star.drawing.AccessibleGraphControl";
581 //===== XTypeProvider =======================================================
582 Sequence
<sal_Int8
> SAL_CALL
SvxGraphCtrlAccessibleContext::getImplementationId( void ) throw( RuntimeException
, std::exception
)
584 return css::uno::Sequence
<sal_Int8
>();
587 //===== XServiceName ========================================================
589 OUString
SvxGraphCtrlAccessibleContext::getServiceName( void ) throw( RuntimeException
, std::exception
)
591 return OUString( "com.sun.star.accessibility.AccessibleContext" );
594 //===== XAccessibleSelection =============================================
596 void SAL_CALL
SvxGraphCtrlAccessibleContext::selectAccessibleChild( sal_Int32 nIndex
) throw( lang::IndexOutOfBoundsException
, RuntimeException
, std::exception
)
598 ::SolarMutexGuard aGuard
;
601 throw DisposedException();
603 SdrObject
* pObj
= getSdrObject( nIndex
);
606 mpView
->MarkObj( pObj
, mpView
->GetSdrPageView());
611 sal_Bool SAL_CALL
SvxGraphCtrlAccessibleContext::isAccessibleChildSelected( sal_Int32 nIndex
) throw( lang::IndexOutOfBoundsException
, RuntimeException
, std::exception
)
613 ::SolarMutexGuard aGuard
;
616 throw DisposedException();
618 return mpView
->IsObjMarked( getSdrObject( nIndex
) );
623 void SAL_CALL
SvxGraphCtrlAccessibleContext::clearAccessibleSelection() throw( RuntimeException
, std::exception
)
625 ::SolarMutexGuard aGuard
;
628 throw DisposedException();
630 mpView
->UnmarkAllObj();
635 void SAL_CALL
SvxGraphCtrlAccessibleContext::selectAllAccessibleChildren() throw( RuntimeException
, std::exception
)
637 ::SolarMutexGuard aGuard
;
640 throw DisposedException();
642 mpView
->MarkAllObj();
647 sal_Int32 SAL_CALL
SvxGraphCtrlAccessibleContext::getSelectedAccessibleChildCount() throw( RuntimeException
, std::exception
)
649 ::SolarMutexGuard aGuard
;
652 throw DisposedException();
654 const SdrMarkList
& rList
= mpView
->GetMarkedObjectList();
655 return rList
.GetMarkCount();
660 Reference
< XAccessible
> SAL_CALL
SvxGraphCtrlAccessibleContext::getSelectedAccessibleChild( sal_Int32 nIndex
)
661 throw( lang::IndexOutOfBoundsException
, RuntimeException
, std::exception
)
663 ::SolarMutexGuard aGuard
;
665 checkChildIndexOnSelection( nIndex
);
667 Reference
< XAccessible
> xAccessible
;
669 const SdrMarkList
& rList
= mpView
->GetMarkedObjectList();
670 SdrObject
* pObj
= rList
.GetMark(nIndex
)->GetMarkedSdrObj();
672 xAccessible
= getAccessible( pObj
);
679 void SAL_CALL
SvxGraphCtrlAccessibleContext::deselectAccessibleChild( sal_Int32 nIndex
) throw( lang::IndexOutOfBoundsException
, RuntimeException
, std::exception
)
681 ::SolarMutexGuard aGuard
;
683 checkChildIndexOnSelection( nIndex
);
687 const SdrMarkList
& rList
= mpView
->GetMarkedObjectList();
689 SdrObject
* pObj
= getSdrObject( nIndex
);
692 SdrMarkList
aRefList( rList
);
694 SdrPageView
* pPV
= mpView
->GetSdrPageView();
695 mpView
->UnmarkAllObj( pPV
);
697 sal_uInt32 nCount
= aRefList
.GetMarkCount();
699 for( nMark
= 0; nMark
< nCount
; nMark
++ )
701 if( aRefList
.GetMark(nMark
)->GetMarkedSdrObj() != pObj
)
702 mpView
->MarkObj( aRefList
.GetMark(nMark
)->GetMarkedSdrObj(), pPV
);
708 //===== internals ========================================================
710 void SvxGraphCtrlAccessibleContext::checkChildIndexOnSelection( long nIndex
) throw( lang::IndexOutOfBoundsException
)
712 if( nIndex
< 0 || nIndex
>= getSelectedAccessibleChildCount() )
713 throw lang::IndexOutOfBoundsException();
718 /** Replace the model, page, and view pointers by the ones provided
719 (explicitly and implicitly).
721 void SvxGraphCtrlAccessibleContext::setModelAndView (
725 ::SolarMutexGuard aGuard
;
729 mpPage
= (SdrPage
*)mpModel
->GetPage( 0 );
732 if (mpModel
== NULL
|| mpPage
== NULL
|| mpView
== NULL
)
736 // Set all the pointers to NULL just in case they are used as
743 maTreeInfo
.SetSdrView (mpView
);
750 void SAL_CALL
SvxGraphCtrlAccessibleContext::disposing()
752 ::SolarMutexGuard aGuard
;
759 mpControl
= NULL
; // object dies with representation
764 ShapesMapType::iterator I
;
766 for (I
=mxShapes
.begin(); I
!=mxShapes
.end(); ++I
)
768 XAccessible
* pAcc
= (*I
).second
;
769 Reference
< XComponent
> xComp( pAcc
, UNO_QUERY
);
773 (*I
).second
->release();
779 // Send a disposing to all listeners.
782 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId
, *this );
789 Rectangle
SvxGraphCtrlAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException
)
791 ::SolarMutexGuard aGuard
;
793 if( NULL
== mpControl
)
794 throw DisposedException();
797 mpControl
->GetAccessibleParentWindow()->OutputToAbsoluteScreenPixel(
798 mpControl
->GetPosPixel() ),
799 mpControl
->GetSizePixel() );
804 /** Calculate the relative coordinates of the bounding box as difference
805 between the absolute coordinates of the bounding boxes of this control
806 and its parent in the accessibility tree.
808 Rectangle
SvxGraphCtrlAccessibleContext::GetBoundingBox( void ) throw( RuntimeException
)
810 ::SolarMutexGuard aGuard
;
812 Rectangle
aBounds ( 0, 0, 0, 0 );
814 Window
* pWindow
= mpControl
;
817 aBounds
= pWindow
->GetWindowExtentsRelative (NULL
);
818 Window
* pParent
= pWindow
->GetAccessibleParentWindow();
821 Rectangle aParentRect
= pParent
->GetWindowExtentsRelative (NULL
);
822 aBounds
-= aParentRect
.TopLeft();
826 throw DisposedException();
831 void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster
& /*rBC*/, const SfxHint
& rHint
)
833 const SdrHint
* pSdrHint
= PTR_CAST( SdrHint
, &rHint
);
837 switch( pSdrHint
->GetKind() )
841 ShapesMapType::iterator iter
= mxShapes
.find( pSdrHint
->GetObject() );
843 if( iter
!= mxShapes
.end() )
845 // if we already have one, return it
846 AccessibleShape
* pShape
= (*iter
).second
;
849 pShape
->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED
, uno::Any(), uno::Any() );
854 case HINT_OBJINSERTED
:
855 CommitChange( AccessibleEventId::CHILD
, makeAny( getAccessible( pSdrHint
->GetObject() ) ) , uno::Any());
857 case HINT_OBJREMOVED
:
858 CommitChange( AccessibleEventId::CHILD
, uno::Any(), makeAny( getAccessible( pSdrHint
->GetObject() ) ) );
860 case HINT_MODELCLEARED
:
869 const SfxSimpleHint
* pSfxHint
= PTR_CAST(SfxSimpleHint
, &rHint
);
871 // Has our SdDrawDocument just died?
872 if(pSfxHint
&& pSfxHint
->GetId() == SFX_HINT_DYING
)
879 //===== IAccessibleViewforwarder ========================================
881 bool SvxGraphCtrlAccessibleContext::IsValid (void) const
888 Rectangle
SvxGraphCtrlAccessibleContext::GetVisibleArea (void) const
892 if( mpView
&& mpView
->PaintWindowCount())
894 SdrPaintWindow
* pPaintWindow
= mpView
->GetPaintWindow(0L);
895 aVisArea
= pPaintWindow
->GetVisibleArea();
903 Point
SvxGraphCtrlAccessibleContext::LogicToPixel (const Point
& rPoint
) const
907 Rectangle
aBBox(mpControl
->GetWindowExtentsRelative(NULL
));
908 return mpControl
->LogicToPixel (rPoint
) + aBBox
.TopLeft();
918 Size
SvxGraphCtrlAccessibleContext::LogicToPixel (const Size
& rSize
) const
921 return mpControl
->LogicToPixel (rSize
);
928 Point
SvxGraphCtrlAccessibleContext::PixelToLogic (const Point
& rPoint
) const
931 return mpControl
->PixelToLogic (rPoint
);
938 Size
SvxGraphCtrlAccessibleContext::PixelToLogic (const Size
& rSize
) const
941 return mpControl
->PixelToLogic (rSize
);
946 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */