1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir #include "AccessibleDocumentViewBase.hxx" 31*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/document/XEventBroadcaster.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 42*cdf0e10cSrcweir #include <rtl/ustring.h> 43*cdf0e10cSrcweir #include<sfx2/viewfrm.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include <svx/AccessibleShape.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <svx/svdobj.hxx> 48*cdf0e10cSrcweir #include <svx/svdmodel.hxx> 49*cdf0e10cSrcweir #include <svx/unoapi.hxx> 50*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 51*cdf0e10cSrcweir #include "Window.hxx" 52*cdf0e10cSrcweir #include <vcl/svapp.hxx> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #include "ViewShell.hxx" 56*cdf0e10cSrcweir #include "View.hxx" 57*cdf0e10cSrcweir #include <memory> 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir using ::rtl::OUString; 60*cdf0e10cSrcweir using namespace ::com::sun::star; 61*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 62*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class SfxViewFrame; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir namespace accessibility { 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir //===== internal ============================================================ 69*cdf0e10cSrcweir AccessibleDocumentViewBase::AccessibleDocumentViewBase ( 70*cdf0e10cSrcweir ::sd::Window* pSdWindow, 71*cdf0e10cSrcweir ::sd::ViewShell* pViewShell, 72*cdf0e10cSrcweir const uno::Reference<frame::XController>& rxController, 73*cdf0e10cSrcweir const uno::Reference<XAccessible>& rxParent) 74*cdf0e10cSrcweir : AccessibleContextBase (rxParent, AccessibleRole::DOCUMENT), 75*cdf0e10cSrcweir mpWindow (pSdWindow), 76*cdf0e10cSrcweir mxController (rxController), 77*cdf0e10cSrcweir mxModel (NULL), 78*cdf0e10cSrcweir maViewForwarder ( 79*cdf0e10cSrcweir static_cast<SdrPaintView*>(pViewShell->GetView()), 80*cdf0e10cSrcweir *static_cast<OutputDevice*>(pSdWindow)) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir if (mxController.is()) 83*cdf0e10cSrcweir mxModel = mxController->getModel(); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // Fill the shape tree info. 86*cdf0e10cSrcweir maShapeTreeInfo.SetModelBroadcaster ( 87*cdf0e10cSrcweir uno::Reference<document::XEventBroadcaster>( 88*cdf0e10cSrcweir mxModel, uno::UNO_QUERY)); 89*cdf0e10cSrcweir maShapeTreeInfo.SetController (mxController); 90*cdf0e10cSrcweir maShapeTreeInfo.SetSdrView (pViewShell->GetView()); 91*cdf0e10cSrcweir maShapeTreeInfo.SetWindow (pSdWindow); 92*cdf0e10cSrcweir maShapeTreeInfo.SetViewForwarder (&maViewForwarder); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow); 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir AccessibleDocumentViewBase::~AccessibleDocumentViewBase (void) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir // At this place we should be disposed. You may want to add a 103*cdf0e10cSrcweir // corresponding assertion into the destructor of a derived class. 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir void AccessibleDocumentViewBase::Init (void) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir // Finish the initialization of the shape tree info container. 112*cdf0e10cSrcweir maShapeTreeInfo.SetDocumentWindow (this); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir // Register as window listener to stay up to date with its size and 115*cdf0e10cSrcweir // position. 116*cdf0e10cSrcweir mxWindow->addWindowListener (this); 117*cdf0e10cSrcweir // Register as focus listener to 118*cdf0e10cSrcweir mxWindow->addFocusListener (this); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // Determine the list of shapes on the current page. 121*cdf0e10cSrcweir uno::Reference<drawing::XShapes> xShapeList; 122*cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 123*cdf0e10cSrcweir if (xView.is()) 124*cdf0e10cSrcweir xShapeList = uno::Reference<drawing::XShapes> ( 125*cdf0e10cSrcweir xView->getCurrentPage(), uno::UNO_QUERY); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // Register this object as dispose event listener at the model. 128*cdf0e10cSrcweir if (mxModel.is()) 129*cdf0e10cSrcweir mxModel->addEventListener ( 130*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir // Register as property change listener at the controller. 133*cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY); 134*cdf0e10cSrcweir if (xSet.is()) 135*cdf0e10cSrcweir xSet->addPropertyChangeListener ( 136*cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("")), 137*cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this)); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // Register this object as dispose event listener at the controller. 140*cdf0e10cSrcweir if (mxController.is()) 141*cdf0e10cSrcweir mxController->addEventListener ( 142*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir // Register at VCL Window to be informed of activated and deactivated 145*cdf0e10cSrcweir // OLE objects. 146*cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow(); 147*cdf0e10cSrcweir if (pWindow != NULL) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir maWindowLink = LINK( 150*cdf0e10cSrcweir this, AccessibleDocumentViewBase, WindowChildEventListener); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir pWindow->AddChildEventListener (maWindowLink); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_uInt16 nCount = pWindow->GetChildCount(); 155*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir Window* pChildWindow = pWindow->GetChild (i); 158*cdf0e10cSrcweir if (pChildWindow && 159*cdf0e10cSrcweir (AccessibleRole::EMBEDDED_OBJECT 160*cdf0e10cSrcweir ==pChildWindow->GetAccessibleRole())) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir SetAccessibleOLEObject (pChildWindow->GetAccessible()); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener, 172*cdf0e10cSrcweir VclSimpleEvent*, pEvent) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir OSL_ASSERT(pEvent!=NULL && pEvent->ISA(VclWindowEvent)); 175*cdf0e10cSrcweir if (pEvent!=NULL && pEvent->ISA(VclWindowEvent)) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); 178*cdf0e10cSrcweir // DBG_ASSERT( pVclEvent->GetWindow(), "Window???" ); 179*cdf0e10cSrcweir switch (pWindowEvent->GetId()) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir case VCLEVENT_OBJECT_DYING: 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir // Window is dying. Unregister from VCL Window. 184*cdf0e10cSrcweir // This is also attempted in the disposing() method. 185*cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow(); 186*cdf0e10cSrcweir Window* pDyingWindow = static_cast<Window*>( 187*cdf0e10cSrcweir pWindowEvent->GetWindow()); 188*cdf0e10cSrcweir if (pWindow==pDyingWindow && pWindow!=NULL && maWindowLink.IsSet()) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir pWindow->RemoveChildEventListener (maWindowLink); 191*cdf0e10cSrcweir maWindowLink = Link(); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir break; 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir case VCLEVENT_WINDOW_SHOW: 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir // A new window has been created. Is it an OLE object? 199*cdf0e10cSrcweir Window* pChildWindow = static_cast<Window*>( 200*cdf0e10cSrcweir pWindowEvent->GetData()); 201*cdf0e10cSrcweir if (pChildWindow!=NULL 202*cdf0e10cSrcweir && (pChildWindow->GetAccessibleRole() 203*cdf0e10cSrcweir == AccessibleRole::EMBEDDED_OBJECT)) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir SetAccessibleOLEObject (pChildWindow->GetAccessible()); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir break; 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir case VCLEVENT_WINDOW_HIDE: 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir // A window has been destroyed. Has that been an OLE 213*cdf0e10cSrcweir // object? 214*cdf0e10cSrcweir Window* pChildWindow = static_cast<Window*>( 215*cdf0e10cSrcweir pWindowEvent->GetData()); 216*cdf0e10cSrcweir if (pChildWindow!=NULL 217*cdf0e10cSrcweir && (pChildWindow->GetAccessibleRole() 218*cdf0e10cSrcweir == AccessibleRole::EMBEDDED_OBJECT)) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir SetAccessibleOLEObject (NULL); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir break; 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir return 0; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir //===== IAccessibleViewForwarderListener ==================================== 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir void AccessibleDocumentViewBase::ViewForwarderChanged(ChangeType, const IAccessibleViewForwarder* ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir // Empty 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir //===== XAccessibleContext ================================================== 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir Reference<XAccessible> SAL_CALL 246*cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleParent (void) 247*cdf0e10cSrcweir throw (uno::RuntimeException) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir ThrowIfDisposed (); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir return AccessibleContextBase::getAccessibleParent(); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir sal_Int32 SAL_CALL 257*cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleChildCount (void) 258*cdf0e10cSrcweir throw (uno::RuntimeException) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir ThrowIfDisposed (); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir if (mxAccessibleOLEObject.is()) 263*cdf0e10cSrcweir return 1; 264*cdf0e10cSrcweir else 265*cdf0e10cSrcweir return 0; 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir Reference<XAccessible> SAL_CALL 272*cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleChild (sal_Int32 nIndex) 273*cdf0e10cSrcweir throw (uno::RuntimeException, lang::IndexOutOfBoundsException) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir ThrowIfDisposed (); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex); 278*cdf0e10cSrcweir if (mxAccessibleOLEObject.is()) 279*cdf0e10cSrcweir if (nIndex == 0) 280*cdf0e10cSrcweir return mxAccessibleOLEObject; 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException ( 283*cdf0e10cSrcweir ::rtl::OUString::createFromAscii ("no child with index ") 284*cdf0e10cSrcweir + rtl::OUString::valueOf(nIndex), 285*cdf0e10cSrcweir NULL); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir //===== XAccessibleComponent ================================================ 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir /** Iterate over all children and test whether the specified point lies 294*cdf0e10cSrcweir within one of their bounding boxes. Return the first child for which 295*cdf0e10cSrcweir this is true. 296*cdf0e10cSrcweir */ 297*cdf0e10cSrcweir uno::Reference<XAccessible > SAL_CALL 298*cdf0e10cSrcweir AccessibleDocumentViewBase::getAccessibleAtPoint ( 299*cdf0e10cSrcweir const awt::Point& aPoint) 300*cdf0e10cSrcweir throw (uno::RuntimeException) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir ThrowIfDisposed (); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex); 305*cdf0e10cSrcweir uno::Reference<XAccessible> xChildAtPosition; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir sal_Int32 nChildCount = getAccessibleChildCount (); 308*cdf0e10cSrcweir for (sal_Int32 i=nChildCount-1; i>=0; --i) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir Reference<XAccessible> xChild (getAccessibleChild (i)); 311*cdf0e10cSrcweir if (xChild.is()) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir Reference<XAccessibleComponent> xChildComponent ( 314*cdf0e10cSrcweir xChild->getAccessibleContext(), uno::UNO_QUERY); 315*cdf0e10cSrcweir if (xChildComponent.is()) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir awt::Rectangle aBBox (xChildComponent->getBounds()); 318*cdf0e10cSrcweir if ( (aPoint.X >= aBBox.X) 319*cdf0e10cSrcweir && (aPoint.Y >= aBBox.Y) 320*cdf0e10cSrcweir && (aPoint.X < aBBox.X+aBBox.Width) 321*cdf0e10cSrcweir && (aPoint.Y < aBBox.Y+aBBox.Height) ) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir xChildAtPosition = xChild; 324*cdf0e10cSrcweir break; 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir // Have not found a child under the given point. Returning empty 331*cdf0e10cSrcweir // reference to indicate this. 332*cdf0e10cSrcweir return xChildAtPosition; 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir awt::Rectangle SAL_CALL 339*cdf0e10cSrcweir AccessibleDocumentViewBase::getBounds (void) 340*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir ThrowIfDisposed (); 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir // Transform visible area into screen coordinates. 345*cdf0e10cSrcweir ::Rectangle aVisibleArea ( 346*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->GetVisibleArea()); 347*cdf0e10cSrcweir ::Point aPixelTopLeft ( 348*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( 349*cdf0e10cSrcweir aVisibleArea.TopLeft())); 350*cdf0e10cSrcweir ::Point aPixelSize ( 351*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( 352*cdf0e10cSrcweir aVisibleArea.BottomRight()) 353*cdf0e10cSrcweir - aPixelTopLeft); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir // Prepare to subtract the parent position to transform into relative 356*cdf0e10cSrcweir // coordinates. 357*cdf0e10cSrcweir awt::Point aParentPosition; 358*cdf0e10cSrcweir Reference<XAccessible> xParent = getAccessibleParent (); 359*cdf0e10cSrcweir if (xParent.is()) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir Reference<XAccessibleComponent> xParentComponent ( 362*cdf0e10cSrcweir xParent->getAccessibleContext(), uno::UNO_QUERY); 363*cdf0e10cSrcweir if (xParentComponent.is()) 364*cdf0e10cSrcweir aParentPosition = xParentComponent->getLocationOnScreen(); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir return awt::Rectangle ( 368*cdf0e10cSrcweir aPixelTopLeft.X() - aParentPosition.X, 369*cdf0e10cSrcweir aPixelTopLeft.Y() - aParentPosition.Y, 370*cdf0e10cSrcweir aPixelSize.X(), 371*cdf0e10cSrcweir aPixelSize.Y()); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir awt::Point SAL_CALL 378*cdf0e10cSrcweir AccessibleDocumentViewBase::getLocation (void) 379*cdf0e10cSrcweir throw (uno::RuntimeException) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir ThrowIfDisposed (); 382*cdf0e10cSrcweir awt::Rectangle aBoundingBox (getBounds()); 383*cdf0e10cSrcweir return awt::Point (aBoundingBox.X, aBoundingBox.Y); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir awt::Point SAL_CALL 390*cdf0e10cSrcweir AccessibleDocumentViewBase::getLocationOnScreen (void) 391*cdf0e10cSrcweir throw (uno::RuntimeException) 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir ThrowIfDisposed (); 394*cdf0e10cSrcweir ::Point aLogicalPoint (maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft()); 395*cdf0e10cSrcweir ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel (aLogicalPoint)); 396*cdf0e10cSrcweir return awt::Point (aPixelPoint.X(), aPixelPoint.Y()); 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir awt::Size SAL_CALL 403*cdf0e10cSrcweir AccessibleDocumentViewBase::getSize (void) 404*cdf0e10cSrcweir throw (uno::RuntimeException) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir ThrowIfDisposed (); 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir // Transform visible area into screen coordinates. 409*cdf0e10cSrcweir ::Rectangle aVisibleArea ( 410*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->GetVisibleArea()); 411*cdf0e10cSrcweir ::Point aPixelTopLeft ( 412*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( 413*cdf0e10cSrcweir aVisibleArea.TopLeft())); 414*cdf0e10cSrcweir ::Point aPixelSize ( 415*cdf0e10cSrcweir maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( 416*cdf0e10cSrcweir aVisibleArea.BottomRight()) 417*cdf0e10cSrcweir - aPixelTopLeft); 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir return awt::Size (aPixelSize.X(), aPixelSize.Y()); 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir //===== XInterface ========================================================== 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir uno::Any SAL_CALL 428*cdf0e10cSrcweir AccessibleDocumentViewBase::queryInterface (const uno::Type & rType) 429*cdf0e10cSrcweir throw (uno::RuntimeException) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir uno::Any aReturn = AccessibleContextBase::queryInterface (rType); 432*cdf0e10cSrcweir if ( ! aReturn.hasValue()) 433*cdf0e10cSrcweir aReturn = ::cppu::queryInterface (rType, 434*cdf0e10cSrcweir static_cast<XAccessibleComponent*>(this), 435*cdf0e10cSrcweir static_cast<XAccessibleSelection*>(this), 436*cdf0e10cSrcweir static_cast<lang::XEventListener*>( 437*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)), 438*cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this), 439*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this), 440*cdf0e10cSrcweir static_cast<awt::XFocusListener*>(this) 441*cdf0e10cSrcweir ); 442*cdf0e10cSrcweir return aReturn; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir void SAL_CALL 449*cdf0e10cSrcweir AccessibleDocumentViewBase::acquire (void) 450*cdf0e10cSrcweir throw () 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir AccessibleContextBase::acquire (); 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir void SAL_CALL 459*cdf0e10cSrcweir AccessibleDocumentViewBase::release (void) 460*cdf0e10cSrcweir throw () 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir AccessibleContextBase::release (); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir //===== XServiceInfo ======================================================== 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir ::rtl::OUString SAL_CALL 471*cdf0e10cSrcweir AccessibleDocumentViewBase::getImplementationName (void) 472*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase")); 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 481*cdf0e10cSrcweir AccessibleDocumentViewBase::getSupportedServiceNames (void) 482*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir ThrowIfDisposed (); 485*cdf0e10cSrcweir return AccessibleContextBase::getSupportedServiceNames (); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir //===== XTypeProvider ======================================================= 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL 495*cdf0e10cSrcweir AccessibleDocumentViewBase::getTypes (void) 496*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir ThrowIfDisposed (); 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir // Get list of types from the context base implementation, ... 501*cdf0e10cSrcweir uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes()); 502*cdf0e10cSrcweir // ... get list of types from component base implementation, ... 503*cdf0e10cSrcweir uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes()); 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir // ...and add the additional type for the component, ... 507*cdf0e10cSrcweir const uno::Type aLangEventListenerType = 508*cdf0e10cSrcweir ::getCppuType((const uno::Reference<lang::XEventListener>*)0); 509*cdf0e10cSrcweir const uno::Type aPropertyChangeListenerType = 510*cdf0e10cSrcweir ::getCppuType((const uno::Reference<beans::XPropertyChangeListener>*)0); 511*cdf0e10cSrcweir const uno::Type aWindowListenerType = 512*cdf0e10cSrcweir ::getCppuType((const uno::Reference<awt::XWindowListener>*)0); 513*cdf0e10cSrcweir const uno::Type aFocusListenerType = 514*cdf0e10cSrcweir ::getCppuType((const uno::Reference<awt::XFocusListener>*)0); 515*cdf0e10cSrcweir const uno::Type aEventBroadcaster = 516*cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleEventBroadcaster>*)0); 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // ... and merge them all into one list. 519*cdf0e10cSrcweir sal_Int32 nTypeCount (aTypeList.getLength()), 520*cdf0e10cSrcweir nComponentTypeCount (aComponentTypeList.getLength()), 521*cdf0e10cSrcweir i; 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir aTypeList.realloc (nTypeCount + nComponentTypeCount + 5); 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir for (i=0; i<nComponentTypeCount; i++) 526*cdf0e10cSrcweir aTypeList[nTypeCount + i] = aComponentTypeList[i]; 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir aTypeList[nTypeCount + i++ ] = aLangEventListenerType; 529*cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aPropertyChangeListenerType; 530*cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aWindowListenerType; 531*cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aFocusListenerType; 532*cdf0e10cSrcweir aTypeList[nTypeCount + i++] = aEventBroadcaster; 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir return aTypeList; 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir void AccessibleDocumentViewBase::impl_dispose() 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir // Unregister from VCL Window. 543*cdf0e10cSrcweir Window* pWindow = maShapeTreeInfo.GetWindow(); 544*cdf0e10cSrcweir if (maWindowLink.IsSet()) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir if (pWindow) 547*cdf0e10cSrcweir pWindow->RemoveChildEventListener (maWindowLink); 548*cdf0e10cSrcweir maWindowLink = Link(); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir else 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir DBG_ASSERT (pWindow, "AccessibleDocumentViewBase::disposing"); 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir // Unregister from window. 556*cdf0e10cSrcweir if (mxWindow.is()) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir mxWindow->removeWindowListener (this); 559*cdf0e10cSrcweir mxWindow->removeFocusListener (this); 560*cdf0e10cSrcweir mxWindow = NULL; 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir // Unregister form the model. 564*cdf0e10cSrcweir if (mxModel.is()) 565*cdf0e10cSrcweir mxModel->removeEventListener ( 566*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir // Unregister from the controller. 569*cdf0e10cSrcweir if (mxController.is()) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xSet (mxController, uno::UNO_QUERY); 572*cdf0e10cSrcweir if (xSet.is()) 573*cdf0e10cSrcweir xSet->removePropertyChangeListener ( 574*cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("")), 575*cdf0e10cSrcweir static_cast<beans::XPropertyChangeListener*>(this)); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir mxController->removeEventListener ( 578*cdf0e10cSrcweir static_cast<awt::XWindowListener*>(this)); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir // Propagate change of controller down the shape tree. 582*cdf0e10cSrcweir maShapeTreeInfo.SetControllerBroadcaster (NULL); 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir // Reset the model reference. 585*cdf0e10cSrcweir mxModel = NULL; 586*cdf0e10cSrcweir // Reset the model reference. 587*cdf0e10cSrcweir mxController = NULL; 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir maShapeTreeInfo.SetDocumentWindow (NULL); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir //===== XEventListener ====================================================== 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir void SAL_CALL 598*cdf0e10cSrcweir AccessibleDocumentViewBase::disposing (const lang::EventObject& rEventObject) 599*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir ThrowIfDisposed (); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // Register this object as dispose event and document::XEventListener 604*cdf0e10cSrcweir // listener at the model. 605*cdf0e10cSrcweir 606*cdf0e10cSrcweir if ( ! rEventObject.Source.is()) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir // Paranoia. Can this really happen? 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir else if (rEventObject.Source == mxModel || rEventObject.Source == mxController) 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir impl_dispose(); 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir } 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir //===== XPropertyChangeListener ============================================= 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir void SAL_CALL AccessibleDocumentViewBase::propertyChange (const beans::PropertyChangeEvent& ) 619*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir // Empty 622*cdf0e10cSrcweir } 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir //===== XWindowListener ===================================================== 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir void SAL_CALL 630*cdf0e10cSrcweir AccessibleDocumentViewBase::windowResized (const ::com::sun::star::awt::WindowEvent& ) 631*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir if( IsDisposed() ) 634*cdf0e10cSrcweir return; 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir ViewForwarderChanged ( 637*cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA, 638*cdf0e10cSrcweir &maViewForwarder); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir void SAL_CALL 645*cdf0e10cSrcweir AccessibleDocumentViewBase::windowMoved (const ::com::sun::star::awt::WindowEvent& ) 646*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir if( IsDisposed() ) 649*cdf0e10cSrcweir return; 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir ViewForwarderChanged ( 652*cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA, 653*cdf0e10cSrcweir &maViewForwarder); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir void SAL_CALL 660*cdf0e10cSrcweir AccessibleDocumentViewBase::windowShown (const ::com::sun::star::lang::EventObject& ) 661*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir if( IsDisposed() ) 664*cdf0e10cSrcweir return; 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir ViewForwarderChanged ( 667*cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA, 668*cdf0e10cSrcweir &maViewForwarder); 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir void SAL_CALL 675*cdf0e10cSrcweir AccessibleDocumentViewBase::windowHidden (const ::com::sun::star::lang::EventObject& ) 676*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir if( IsDisposed() ) 679*cdf0e10cSrcweir return; 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir ViewForwarderChanged ( 682*cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA, 683*cdf0e10cSrcweir &maViewForwarder); 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir //===== XFocusListener ================================================== 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir void AccessibleDocumentViewBase::focusGained (const ::com::sun::star::awt::FocusEvent& e) 692*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir ThrowIfDisposed (); 695*cdf0e10cSrcweir if (e.Source == mxWindow) 696*cdf0e10cSrcweir Activated (); 697*cdf0e10cSrcweir } 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir void AccessibleDocumentViewBase::focusLost (const ::com::sun::star::awt::FocusEvent& e) 700*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir ThrowIfDisposed (); 703*cdf0e10cSrcweir if (e.Source == mxWindow) 704*cdf0e10cSrcweir Deactivated (); 705*cdf0e10cSrcweir } 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir //===== protected internal ================================================== 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir // This method is called from the component helper base class while disposing. 713*cdf0e10cSrcweir void SAL_CALL AccessibleDocumentViewBase::disposing (void) 714*cdf0e10cSrcweir { 715*cdf0e10cSrcweir impl_dispose(); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir AccessibleContextBase::disposing (); 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir /// Create a name for this view. 724*cdf0e10cSrcweir ::rtl::OUString 725*cdf0e10cSrcweir AccessibleDocumentViewBase::CreateAccessibleName (void) 726*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir return ::rtl::OUString ( 729*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("AccessibleDocumentViewBase")); 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir /** Create a description for this view. Use the model's description or URL 736*cdf0e10cSrcweir if a description is not available. 737*cdf0e10cSrcweir */ 738*cdf0e10cSrcweir ::rtl::OUString 739*cdf0e10cSrcweir AccessibleDocumentViewBase::CreateAccessibleDescription (void) 740*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir rtl::OUString sDescription; 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY); 745*cdf0e10cSrcweir if (xInfo.is()) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir OUString sFirstService = xInfo->getSupportedServiceNames()[0]; 748*cdf0e10cSrcweir if (sFirstService == OUString ( 749*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView"))) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir sDescription = OUString (RTL_CONSTASCII_USTRINGPARAM("Draw Document")); 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir else 754*cdf0e10cSrcweir sDescription = sFirstService; 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir else 757*cdf0e10cSrcweir sDescription = OUString ( 758*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document")); 759*cdf0e10cSrcweir return sDescription; 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir void AccessibleDocumentViewBase::Activated (void) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir // Empty. Overwrite to do something usefull. 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir void AccessibleDocumentViewBase::Deactivated (void) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir // Empty. Overwrite to do something usefull. 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir void AccessibleDocumentViewBase::SetAccessibleOLEObject ( 782*cdf0e10cSrcweir const Reference <XAccessible>& xOLEObject) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir // Send child event about removed accessible OLE object if necessary. 785*cdf0e10cSrcweir if (mxAccessibleOLEObject != xOLEObject) 786*cdf0e10cSrcweir if (mxAccessibleOLEObject.is()) 787*cdf0e10cSrcweir CommitChange ( 788*cdf0e10cSrcweir AccessibleEventId::CHILD, 789*cdf0e10cSrcweir uno::Any(), 790*cdf0e10cSrcweir uno::makeAny (mxAccessibleOLEObject)); 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir // Assume that the accessible OLE Object disposes itself correctly. 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir ::osl::MutexGuard aGuard (maMutex); 796*cdf0e10cSrcweir mxAccessibleOLEObject = xOLEObject; 797*cdf0e10cSrcweir } 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir // Send child event about new accessible OLE object if necessary. 800*cdf0e10cSrcweir if (mxAccessibleOLEObject.is()) 801*cdf0e10cSrcweir CommitChange ( 802*cdf0e10cSrcweir AccessibleEventId::CHILD, 803*cdf0e10cSrcweir uno::makeAny (mxAccessibleOLEObject), 804*cdf0e10cSrcweir uno::Any()); 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir //===== methods from AccessibleSelectionBase ================================================== 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir // return the member maMutex; 813*cdf0e10cSrcweir ::osl::Mutex& 814*cdf0e10cSrcweir AccessibleDocumentViewBase::implGetMutex() 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir return( maMutex ); 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir // return ourself as context in default case 820*cdf0e10cSrcweir uno::Reference< XAccessibleContext > 821*cdf0e10cSrcweir AccessibleDocumentViewBase::implGetAccessibleContext() 822*cdf0e10cSrcweir throw (uno::RuntimeException) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir return( this ); 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir // return sal_False in default case 828*cdf0e10cSrcweir sal_Bool 829*cdf0e10cSrcweir AccessibleDocumentViewBase::implIsSelected( sal_Int32 ) 830*cdf0e10cSrcweir throw (uno::RuntimeException) 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir return( sal_False ); 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir // return nothing in default case 836*cdf0e10cSrcweir void 837*cdf0e10cSrcweir AccessibleDocumentViewBase::implSelect( sal_Int32, sal_Bool ) 838*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 839*cdf0e10cSrcweir { 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir } // end of namespace accessibility 843