15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir #include "AccessibleDrawDocumentView.hxx" 27cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp> 28cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 29cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> 30cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 31cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 33cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 34cdf0e10cSrcweir #include <com/sun/star/document/XEventBroadcaster.hpp> 35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 36cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 37cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 38cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 39cdf0e10cSrcweir #include <rtl/ustring.h> 40cdf0e10cSrcweir #include<sfx2/viewfrm.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <svx/AccessibleShape.hxx> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <svx/svdobj.hxx> 45cdf0e10cSrcweir #include <svx/svdmodel.hxx> 46cdf0e10cSrcweir #include <svx/unoapi.hxx> 47cdf0e10cSrcweir #include <svx/unoshcol.hxx> 48cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 49cdf0e10cSrcweir #include "Window.hxx" 50cdf0e10cSrcweir #include <vcl/svapp.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include "ViewShell.hxx" 54cdf0e10cSrcweir #include "View.hxx" 55*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 56*0deba7fbSSteve Yin #include "DrawDocShell.hxx" 57*0deba7fbSSteve Yin #include <drawdoc.hxx> 58*0deba7fbSSteve Yin #include <algorithm> 59*0deba7fbSSteve Yin #include "sdpage.hxx" 60*0deba7fbSSteve Yin #include "slideshow.hxx" 61*0deba7fbSSteve Yin #include "anminfo.hxx" 62*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 63cdf0e10cSrcweir #include <memory> 64cdf0e10cSrcweir 65cdf0e10cSrcweir #include "accessibility.hrc" 66cdf0e10cSrcweir #include "sdresid.hxx" 67cdf0e10cSrcweir #include <vos/mutex.hxx> 68cdf0e10cSrcweir 69cdf0e10cSrcweir using ::rtl::OUString; 70cdf0e10cSrcweir using namespace ::com::sun::star; 71cdf0e10cSrcweir using namespace ::com::sun::star::uno; 72cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 73cdf0e10cSrcweir 74cdf0e10cSrcweir class SfxViewFrame; 75cdf0e10cSrcweir 76cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 77cdf0e10cSrcweir 78cdf0e10cSrcweir namespace accessibility { 79cdf0e10cSrcweir 80cdf0e10cSrcweir 81*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 82*0deba7fbSSteve Yin struct XShapePosCompareHelper 83*0deba7fbSSteve Yin { 84*0deba7fbSSteve Yin bool operator() ( const uno::Reference<drawing::XShape>& xshape1, 85*0deba7fbSSteve Yin const uno::Reference<drawing::XShape>& xshape2 ) const 86*0deba7fbSSteve Yin { 87*0deba7fbSSteve Yin // modify the compare method to return the Z-Order, not layout order 88*0deba7fbSSteve Yin SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1); 89*0deba7fbSSteve Yin SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2); 90*0deba7fbSSteve Yin if(pObj1 && pObj2) 91*0deba7fbSSteve Yin return pObj1->GetOrdNum() < pObj2->GetOrdNum(); 92*0deba7fbSSteve Yin else 93*0deba7fbSSteve Yin return 0; 94*0deba7fbSSteve Yin } 95*0deba7fbSSteve Yin }; 96*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 97cdf0e10cSrcweir //===== internal ============================================================ 98cdf0e10cSrcweir 99cdf0e10cSrcweir AccessibleDrawDocumentView::AccessibleDrawDocumentView ( 100cdf0e10cSrcweir ::sd::Window* pSdWindow, 101cdf0e10cSrcweir ::sd::ViewShell* pViewShell, 102cdf0e10cSrcweir const uno::Reference<frame::XController>& rxController, 103cdf0e10cSrcweir const uno::Reference<XAccessible>& rxParent) 104cdf0e10cSrcweir : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent), 105*0deba7fbSSteve Yin mpSdViewSh( pViewShell ), 106cdf0e10cSrcweir mpChildrenManager (NULL) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir OSL_TRACE ("AccessibleDrawDocumentView"); 109cdf0e10cSrcweir UpdateAccessibleName(); 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir AccessibleDrawDocumentView::~AccessibleDrawDocumentView (void) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir OSL_TRACE ("~AccessibleDrawDocumentView"); 118cdf0e10cSrcweir DBG_ASSERT (rBHelper.bDisposed || rBHelper.bInDispose, 119cdf0e10cSrcweir "~AccessibleDrawDocumentView: object has not been disposed"); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir 124cdf0e10cSrcweir 125cdf0e10cSrcweir void AccessibleDrawDocumentView::Init (void) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir AccessibleDocumentViewBase::Init (); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // Determine the list of shapes on the current page. 130cdf0e10cSrcweir uno::Reference<drawing::XShapes> xShapeList; 131cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 132cdf0e10cSrcweir if (xView.is()) 133cdf0e10cSrcweir xShapeList = uno::Reference<drawing::XShapes> ( 134cdf0e10cSrcweir xView->getCurrentPage(), uno::UNO_QUERY); 135cdf0e10cSrcweir 136cdf0e10cSrcweir // Create the children manager. 137cdf0e10cSrcweir mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this); 138cdf0e10cSrcweir if (mpChildrenManager != NULL) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir // Create the page shape and initialize it. The shape is acquired 141cdf0e10cSrcweir // before initialization and released after transferring ownership 142cdf0e10cSrcweir // to the children manager to prevent premature disposing of the 143cdf0e10cSrcweir // shape. 144cdf0e10cSrcweir AccessiblePageShape* pPage = CreateDrawPageShape(); 145cdf0e10cSrcweir if (pPage != NULL) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir pPage->acquire(); 148cdf0e10cSrcweir pPage->Init(); 149cdf0e10cSrcweir mpChildrenManager->AddAccessibleShape ( 150cdf0e10cSrcweir std::auto_ptr<AccessibleShape>(pPage)); 151cdf0e10cSrcweir pPage->release(); 152cdf0e10cSrcweir mpChildrenManager->Update (); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir mpChildrenManager->UpdateSelection (); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir } 157cdf0e10cSrcweir 158cdf0e10cSrcweir 159cdf0e10cSrcweir 160cdf0e10cSrcweir 161cdf0e10cSrcweir void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType, 162cdf0e10cSrcweir const IAccessibleViewForwarder* pViewForwarder) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir AccessibleDocumentViewBase::ViewForwarderChanged (aChangeType, pViewForwarder); 165cdf0e10cSrcweir if (mpChildrenManager != NULL) 166cdf0e10cSrcweir mpChildrenManager->ViewForwarderChanged (aChangeType, pViewForwarder); 167cdf0e10cSrcweir } 168cdf0e10cSrcweir 169cdf0e10cSrcweir 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir /** The page shape is created on every call at the moment (provided that 173cdf0e10cSrcweir every thing goes well). 174cdf0e10cSrcweir */ 175cdf0e10cSrcweir AccessiblePageShape* AccessibleDrawDocumentView::CreateDrawPageShape (void) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir AccessiblePageShape* pShape = NULL; 178cdf0e10cSrcweir 179cdf0e10cSrcweir // Create a shape that represents the actual draw page. 180cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 181cdf0e10cSrcweir if (xView.is()) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xSet ( 184cdf0e10cSrcweir uno::Reference<beans::XPropertySet> (xView->getCurrentPage(), uno::UNO_QUERY)); 185cdf0e10cSrcweir if (xSet.is()) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir // Create a rectangle shape that will represent the draw page. 188cdf0e10cSrcweir uno::Reference<lang::XMultiServiceFactory> xFactory (mxModel, uno::UNO_QUERY); 189cdf0e10cSrcweir uno::Reference<drawing::XShape> xRectangle; 190cdf0e10cSrcweir if (xFactory.is()) 191cdf0e10cSrcweir xRectangle = uno::Reference<drawing::XShape>(xFactory->createInstance ( 192cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape"))), 193cdf0e10cSrcweir uno::UNO_QUERY); 194cdf0e10cSrcweir 195cdf0e10cSrcweir // Set the shape's size and position. 196cdf0e10cSrcweir if (xRectangle.is()) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir uno::Any aValue; 199cdf0e10cSrcweir awt::Point aPosition; 200cdf0e10cSrcweir awt::Size aSize; 201cdf0e10cSrcweir 202cdf0e10cSrcweir // Set size and position of the shape to those of the draw 203cdf0e10cSrcweir // page. 204cdf0e10cSrcweir aValue = xSet->getPropertyValue ( 205cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft"))); 206cdf0e10cSrcweir aValue >>= aPosition.X; 207cdf0e10cSrcweir aValue = xSet->getPropertyValue ( 208cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop"))); 209cdf0e10cSrcweir aValue >>= aPosition.Y; 210cdf0e10cSrcweir xRectangle->setPosition (aPosition); 211cdf0e10cSrcweir 212cdf0e10cSrcweir aValue = xSet->getPropertyValue ( 213cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("Width"))); 214cdf0e10cSrcweir aValue >>= aSize.Width; 215cdf0e10cSrcweir aValue = xSet->getPropertyValue ( 216cdf0e10cSrcweir OUString (RTL_CONSTASCII_USTRINGPARAM("Height"))); 217cdf0e10cSrcweir aValue >>= aSize.Height; 218cdf0e10cSrcweir xRectangle->setSize (aSize); 219cdf0e10cSrcweir 220cdf0e10cSrcweir // Create the accessible object for the shape and 221cdf0e10cSrcweir // initialize it. 222cdf0e10cSrcweir pShape = new AccessiblePageShape ( 223cdf0e10cSrcweir xView->getCurrentPage(), this, maShapeTreeInfo); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir return pShape; 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir 231cdf0e10cSrcweir 232cdf0e10cSrcweir 233cdf0e10cSrcweir //===== XAccessibleContext ================================================== 234cdf0e10cSrcweir 235cdf0e10cSrcweir sal_Int32 SAL_CALL 236cdf0e10cSrcweir AccessibleDrawDocumentView::getAccessibleChildCount (void) 237cdf0e10cSrcweir throw (uno::RuntimeException) 238cdf0e10cSrcweir { 239cdf0e10cSrcweir ThrowIfDisposed (); 240cdf0e10cSrcweir 241cdf0e10cSrcweir long mpChildCount = AccessibleDocumentViewBase::getAccessibleChildCount(); 242cdf0e10cSrcweir 243cdf0e10cSrcweir // Forward request to children manager. 244cdf0e10cSrcweir if (mpChildrenManager != NULL) 245cdf0e10cSrcweir mpChildCount += mpChildrenManager->GetChildCount (); 246cdf0e10cSrcweir 247cdf0e10cSrcweir return mpChildCount; 248cdf0e10cSrcweir } 249cdf0e10cSrcweir 250cdf0e10cSrcweir 251cdf0e10cSrcweir 252cdf0e10cSrcweir 253cdf0e10cSrcweir uno::Reference<XAccessible> SAL_CALL 254cdf0e10cSrcweir AccessibleDrawDocumentView::getAccessibleChild (sal_Int32 nIndex) 255cdf0e10cSrcweir throw (uno::RuntimeException, lang::IndexOutOfBoundsException) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir ThrowIfDisposed (); 258cdf0e10cSrcweir 259cdf0e10cSrcweir ::osl::ClearableMutexGuard aGuard (maMutex); 260cdf0e10cSrcweir 261cdf0e10cSrcweir // Take care of children of the base class. 262cdf0e10cSrcweir sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount(); 263cdf0e10cSrcweir if (nCount > 0) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir if (nIndex < nCount) 266cdf0e10cSrcweir return AccessibleDocumentViewBase::getAccessibleChild(nIndex); 267cdf0e10cSrcweir else 268cdf0e10cSrcweir nIndex -= nCount; 269cdf0e10cSrcweir } 270cdf0e10cSrcweir 271cdf0e10cSrcweir // Create a copy of the pointer to the children manager and release the 272cdf0e10cSrcweir // mutex before calling any of its methods. 273cdf0e10cSrcweir ChildrenManager* pChildrenManager = mpChildrenManager; 274cdf0e10cSrcweir aGuard.clear(); 275cdf0e10cSrcweir 276cdf0e10cSrcweir // Forward request to children manager. 277cdf0e10cSrcweir if (pChildrenManager != NULL) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir return pChildrenManager->GetChild (nIndex); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir else 282cdf0e10cSrcweir throw lang::IndexOutOfBoundsException ( 283cdf0e10cSrcweir ::rtl::OUString::createFromAscii ("no accessible child with index ") 284cdf0e10cSrcweir + rtl::OUString::valueOf(nIndex), 285cdf0e10cSrcweir static_cast<uno::XWeak*>(this)); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 289*0deba7fbSSteve Yin OUString SAL_CALL 290*0deba7fbSSteve Yin AccessibleDrawDocumentView::getAccessibleName(void) 291*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException) 292*0deba7fbSSteve Yin { 293*0deba7fbSSteve Yin OUString sName = String( SdResId(SID_SD_A11Y_D_PRESENTATION) ); 294*0deba7fbSSteve Yin ::sd::View* pSdView = static_cast< ::sd::View* >( maShapeTreeInfo.GetSdrView() ); 295*0deba7fbSSteve Yin if ( pSdView ) 296*0deba7fbSSteve Yin { 297*0deba7fbSSteve Yin SdDrawDocument* pDoc = pSdView->GetDoc(); 298*0deba7fbSSteve Yin if ( pDoc ) 299*0deba7fbSSteve Yin { 300*0deba7fbSSteve Yin rtl::OUString sFileName = pDoc->getDocAccTitle(); 301*0deba7fbSSteve Yin if ( !sFileName.getLength() ) 302*0deba7fbSSteve Yin { 303*0deba7fbSSteve Yin ::sd::DrawDocShell* pDocSh = pSdView->GetDocSh(); 304*0deba7fbSSteve Yin if ( pDocSh ) 305*0deba7fbSSteve Yin { 306*0deba7fbSSteve Yin sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME ); 307*0deba7fbSSteve Yin } 308*0deba7fbSSteve Yin } 309cdf0e10cSrcweir 310*0deba7fbSSteve Yin OUString sReadOnly; 311*0deba7fbSSteve Yin if(pDoc->getDocReadOnly()) 312*0deba7fbSSteve Yin { 313*0deba7fbSSteve Yin sReadOnly = String(SdResId(SID_SD_A11Y_D_PRESENTATION_READONLY)); 314*0deba7fbSSteve Yin } 315cdf0e10cSrcweir 316*0deba7fbSSteve Yin if ( sFileName.getLength() ) 317*0deba7fbSSteve Yin { 318*0deba7fbSSteve Yin sName = sFileName + sReadOnly + OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName; 319*0deba7fbSSteve Yin } 320*0deba7fbSSteve Yin } 321*0deba7fbSSteve Yin } 322cdf0e10cSrcweir 323*0deba7fbSSteve Yin return sName; 324*0deba7fbSSteve Yin } 325*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 326cdf0e10cSrcweir //===== XEventListener ====================================================== 327cdf0e10cSrcweir 328cdf0e10cSrcweir void SAL_CALL 329cdf0e10cSrcweir AccessibleDrawDocumentView::disposing (const lang::EventObject& rEventObject) 330cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir ThrowIfDisposed (); 333cdf0e10cSrcweir 334cdf0e10cSrcweir AccessibleDocumentViewBase::disposing (rEventObject); 335cdf0e10cSrcweir if (rEventObject.Source == mxModel) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex> aGuard (::osl::Mutex::getGlobalMutex()); 338cdf0e10cSrcweir // maShapeTreeInfo has been modified in base class. 339cdf0e10cSrcweir if (mpChildrenManager != NULL) 340cdf0e10cSrcweir mpChildrenManager->SetInfo (maShapeTreeInfo); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir 345cdf0e10cSrcweir 346cdf0e10cSrcweir 347cdf0e10cSrcweir //===== XPropertyChangeListener ============================================= 348cdf0e10cSrcweir 349cdf0e10cSrcweir void SAL_CALL 350cdf0e10cSrcweir AccessibleDrawDocumentView::propertyChange (const beans::PropertyChangeEvent& rEventObject) 351cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir ThrowIfDisposed (); 354cdf0e10cSrcweir 355cdf0e10cSrcweir AccessibleDocumentViewBase::propertyChange (rEventObject); 356cdf0e10cSrcweir 357cdf0e10cSrcweir OSL_TRACE ("AccessibleDrawDocumentView::propertyChange"); 358*0deba7fbSSteve Yin // add page switch event for slide show mode 359*0deba7fbSSteve Yin if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")) || 360*0deba7fbSSteve Yin rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("PageChange")) ) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir OSL_TRACE (" current page changed"); 363cdf0e10cSrcweir 364cdf0e10cSrcweir // Update the accessible name to reflect the current slide. 365cdf0e10cSrcweir UpdateAccessibleName(); 366cdf0e10cSrcweir 367cdf0e10cSrcweir // The current page changed. Update the children manager accordingly. 368cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 369cdf0e10cSrcweir if (xView.is() && mpChildrenManager!=NULL) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir // Inform the children manager to forget all children and give 372cdf0e10cSrcweir // him the new ones. 373cdf0e10cSrcweir mpChildrenManager->ClearAccessibleShapeList (); 374cdf0e10cSrcweir mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> ( 375cdf0e10cSrcweir xView->getCurrentPage(), uno::UNO_QUERY)); 376cdf0e10cSrcweir 377cdf0e10cSrcweir // Create the page shape and initialize it. The shape is 378cdf0e10cSrcweir // acquired before initialization and released after 379cdf0e10cSrcweir // transferring ownership to the children manager to prevent 380cdf0e10cSrcweir // premature disposing of the shape. 381cdf0e10cSrcweir AccessiblePageShape* pPage = CreateDrawPageShape (); 382cdf0e10cSrcweir if (pPage != NULL) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir pPage->acquire(); 385cdf0e10cSrcweir pPage->Init(); 386cdf0e10cSrcweir mpChildrenManager->AddAccessibleShape ( 387cdf0e10cSrcweir std::auto_ptr<AccessibleShape>(pPage)); 388cdf0e10cSrcweir mpChildrenManager->Update (false); 389cdf0e10cSrcweir pPage->release(); 390cdf0e10cSrcweir } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir else 393cdf0e10cSrcweir OSL_TRACE ("View invalid"); 394*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 395*0deba7fbSSteve Yin CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); 396*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 397cdf0e10cSrcweir } 398cdf0e10cSrcweir else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("VisibleArea"))) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir OSL_TRACE (" visible area changed"); 401cdf0e10cSrcweir if (mpChildrenManager != NULL) 402cdf0e10cSrcweir mpChildrenManager->ViewForwarderChanged ( 403cdf0e10cSrcweir IAccessibleViewForwarderListener::VISIBLE_AREA, 404cdf0e10cSrcweir &maViewForwarder); 405cdf0e10cSrcweir } 406*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 407*0deba7fbSSteve Yin else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("ActiveLayer"))) 408*0deba7fbSSteve Yin { 409*0deba7fbSSteve Yin CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); 410*0deba7fbSSteve Yin } 411*0deba7fbSSteve Yin else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("UpdateAcc"))) 412*0deba7fbSSteve Yin { 413*0deba7fbSSteve Yin OSL_TRACE (" acc on current page should be updated"); 414*0deba7fbSSteve Yin 415*0deba7fbSSteve Yin // The current page changed. Update the children manager accordingly. 416*0deba7fbSSteve Yin uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 417*0deba7fbSSteve Yin if (xView.is() && mpChildrenManager!=NULL) 418*0deba7fbSSteve Yin { 419*0deba7fbSSteve Yin // Inform the children manager to forget all children and give 420*0deba7fbSSteve Yin // him the new ones. 421*0deba7fbSSteve Yin mpChildrenManager->ClearAccessibleShapeList (); 422*0deba7fbSSteve Yin // update the slide show page's accessible info 423*0deba7fbSSteve Yin //mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> ( 424*0deba7fbSSteve Yin // xView->getCurrentPage(), uno::UNO_QUERY)); 425*0deba7fbSSteve Yin rtl::Reference< sd::SlideShow > xSlideshow( sd::SlideShow::GetSlideShow( mpSdViewSh->GetViewShellBase() ) ); 426*0deba7fbSSteve Yin if( xSlideshow.is() && xSlideshow->isRunning() && xSlideshow->isFullScreen() ) 427*0deba7fbSSteve Yin { 428*0deba7fbSSteve Yin ::com::sun::star::uno::Reference< drawing::XDrawPage > xSlide; 429*0deba7fbSSteve Yin // MT IA2: Not used... 430*0deba7fbSSteve Yin // sal_Int32 currentPageIndex = xSlideshow->getCurrentPageIndex(); 431*0deba7fbSSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > mpSlideController = xSlideshow->getController(); 432*0deba7fbSSteve Yin if( mpSlideController.is() ) 433*0deba7fbSSteve Yin { 434*0deba7fbSSteve Yin xSlide = mpSlideController->getCurrentSlide(); 435*0deba7fbSSteve Yin if (xSlide.is()) 436*0deba7fbSSteve Yin { 437*0deba7fbSSteve Yin mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> ( 438*0deba7fbSSteve Yin xSlide, uno::UNO_QUERY)); 439*0deba7fbSSteve Yin } 440*0deba7fbSSteve Yin } 441*0deba7fbSSteve Yin } 442*0deba7fbSSteve Yin // Create the page shape and initialize it. The shape is 443*0deba7fbSSteve Yin // acquired before initialization and released after 444*0deba7fbSSteve Yin // transferring ownership to the children manager to prevent 445*0deba7fbSSteve Yin // premature disposing of the shape. 446*0deba7fbSSteve Yin AccessiblePageShape* pPage = CreateDrawPageShape (); 447*0deba7fbSSteve Yin if (pPage != NULL) 448*0deba7fbSSteve Yin { 449*0deba7fbSSteve Yin pPage->acquire(); 450*0deba7fbSSteve Yin pPage->Init(); 451*0deba7fbSSteve Yin mpChildrenManager->AddAccessibleShape ( 452*0deba7fbSSteve Yin std::auto_ptr<AccessibleShape>(pPage)); 453*0deba7fbSSteve Yin mpChildrenManager->Update (false); 454*0deba7fbSSteve Yin pPage->release(); 455*0deba7fbSSteve Yin } 456*0deba7fbSSteve Yin } 457*0deba7fbSSteve Yin } 458*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 459cdf0e10cSrcweir else 460cdf0e10cSrcweir { 461cdf0e10cSrcweir OSL_TRACE (" unhandled"); 462cdf0e10cSrcweir } 463cdf0e10cSrcweir OSL_TRACE (" done"); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir 466cdf0e10cSrcweir 467cdf0e10cSrcweir 468cdf0e10cSrcweir //===== XServiceInfo ======================================================== 469cdf0e10cSrcweir 470cdf0e10cSrcweir ::rtl::OUString SAL_CALL 471cdf0e10cSrcweir AccessibleDrawDocumentView::getImplementationName (void) 472cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( 475cdf0e10cSrcweir "AccessibleDrawDocumentView")); 476cdf0e10cSrcweir } 477cdf0e10cSrcweir 478cdf0e10cSrcweir 479cdf0e10cSrcweir 480cdf0e10cSrcweir 481cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 482cdf0e10cSrcweir AccessibleDrawDocumentView::getSupportedServiceNames (void) 483cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir ThrowIfDisposed(); 486cdf0e10cSrcweir // Get list of supported service names from base class... 487cdf0e10cSrcweir uno::Sequence<OUString> aServiceNames = 488cdf0e10cSrcweir AccessibleDocumentViewBase::getSupportedServiceNames(); 489cdf0e10cSrcweir sal_Int32 nCount (aServiceNames.getLength()); 490cdf0e10cSrcweir 491cdf0e10cSrcweir // ...and add additional names. 492cdf0e10cSrcweir aServiceNames.realloc (nCount + 1); 493cdf0e10cSrcweir static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM( 494cdf0e10cSrcweir "com.sun.star.drawing.AccessibleDrawDocumentView")); 495cdf0e10cSrcweir aServiceNames[nCount] = sAdditionalServiceName; 496cdf0e10cSrcweir 497cdf0e10cSrcweir return aServiceNames; 498cdf0e10cSrcweir } 499cdf0e10cSrcweir 500*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 501*0deba7fbSSteve Yin //===== XInterface ========================================================== 502cdf0e10cSrcweir 503*0deba7fbSSteve Yin uno::Any SAL_CALL 504*0deba7fbSSteve Yin AccessibleDrawDocumentView::queryInterface (const uno::Type & rType) 505*0deba7fbSSteve Yin throw (uno::RuntimeException) 506*0deba7fbSSteve Yin { 507*0deba7fbSSteve Yin uno::Any aReturn = AccessibleDocumentViewBase::queryInterface (rType); 508*0deba7fbSSteve Yin if ( ! aReturn.hasValue()) 509*0deba7fbSSteve Yin aReturn = ::cppu::queryInterface (rType, 510*0deba7fbSSteve Yin static_cast<XAccessibleGroupPosition*>(this) 511*0deba7fbSSteve Yin ); 512*0deba7fbSSteve Yin return aReturn; 513*0deba7fbSSteve Yin } 514cdf0e10cSrcweir 515*0deba7fbSSteve Yin void SAL_CALL 516*0deba7fbSSteve Yin AccessibleDrawDocumentView::acquire (void) 517*0deba7fbSSteve Yin throw () 518*0deba7fbSSteve Yin { 519*0deba7fbSSteve Yin AccessibleDocumentViewBase::acquire (); 520*0deba7fbSSteve Yin } 521*0deba7fbSSteve Yin void SAL_CALL 522*0deba7fbSSteve Yin AccessibleDrawDocumentView::release (void) 523*0deba7fbSSteve Yin throw () 524*0deba7fbSSteve Yin { 525*0deba7fbSSteve Yin AccessibleDocumentViewBase::release (); 526*0deba7fbSSteve Yin } 527*0deba7fbSSteve Yin //===== XAccessibleGroupPosition ========================================= 528*0deba7fbSSteve Yin uno::Sequence< sal_Int32 > SAL_CALL 529*0deba7fbSSteve Yin AccessibleDrawDocumentView::getGroupPosition( const uno::Any& rAny ) 530*0deba7fbSSteve Yin throw (uno::RuntimeException) 531*0deba7fbSSteve Yin { 532*0deba7fbSSteve Yin // we will return the: 533*0deba7fbSSteve Yin // [0] group level(always be 0 now) 534*0deba7fbSSteve Yin // [1] similar items counts in the group 535*0deba7fbSSteve Yin // [2] the position of the object in the group 536*0deba7fbSSteve Yin uno::Sequence< sal_Int32 > aRet( 3 ); 537*0deba7fbSSteve Yin //get the xShape of the current selected drawing object 538*0deba7fbSSteve Yin uno::Reference<XAccessibleContext> xAccContent; 539*0deba7fbSSteve Yin rAny >>= xAccContent; 540*0deba7fbSSteve Yin if ( !xAccContent.is() ) 541*0deba7fbSSteve Yin { 542*0deba7fbSSteve Yin return aRet; 543*0deba7fbSSteve Yin } 544*0deba7fbSSteve Yin AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent ); 545*0deba7fbSSteve Yin if ( !pAcc ) 546*0deba7fbSSteve Yin { 547*0deba7fbSSteve Yin return aRet; 548*0deba7fbSSteve Yin } 549*0deba7fbSSteve Yin uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape(); 550*0deba7fbSSteve Yin if ( !xCurShape.is() ) 551*0deba7fbSSteve Yin { 552*0deba7fbSSteve Yin return aRet; 553*0deba7fbSSteve Yin } 554*0deba7fbSSteve Yin //find all the child in the page, insert them into a vector and sort 555*0deba7fbSSteve Yin if ( mpChildrenManager == NULL ) 556*0deba7fbSSteve Yin { 557*0deba7fbSSteve Yin return aRet; 558*0deba7fbSSteve Yin } 559*0deba7fbSSteve Yin std::vector< uno::Reference<drawing::XShape> > vXShapes; 560*0deba7fbSSteve Yin sal_Int32 nCount = mpChildrenManager->GetChildCount(); 561*0deba7fbSSteve Yin //get pointer of SdView & SdrPageView for further use. 562*0deba7fbSSteve Yin SdrPageView* pPV = NULL; 563*0deba7fbSSteve Yin ::sd::View* pSdView = NULL; 564*0deba7fbSSteve Yin if ( mpSdViewSh ) 565*0deba7fbSSteve Yin { 566*0deba7fbSSteve Yin pSdView = mpSdViewSh->GetView(); 567*0deba7fbSSteve Yin pPV = pSdView->GetSdrPageView(); 568*0deba7fbSSteve Yin } 569*0deba7fbSSteve Yin for ( sal_Int32 i = 0; i < nCount; i++ ) 570*0deba7fbSSteve Yin { 571*0deba7fbSSteve Yin uno::Reference< drawing::XShape > xShape = mpChildrenManager->GetChildShape(i); 572*0deba7fbSSteve Yin if ( xShape.is() ) 573*0deba7fbSSteve Yin { 574*0deba7fbSSteve Yin //if the object is visable in the page, we add it into the group list. 575*0deba7fbSSteve Yin SdrObject* pObj = GetSdrObjectFromXShape(xShape); 576*0deba7fbSSteve Yin if ( pObj && pPV && pSdView && pSdView->IsObjMarkable( pObj, pPV ) ) 577*0deba7fbSSteve Yin { 578*0deba7fbSSteve Yin vXShapes.push_back( xShape ); 579*0deba7fbSSteve Yin } 580*0deba7fbSSteve Yin } 581*0deba7fbSSteve Yin } 582*0deba7fbSSteve Yin std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() ); 583*0deba7fbSSteve Yin //get the the index of the selected object in the group 584*0deba7fbSSteve Yin std::vector< uno::Reference<drawing::XShape> >::iterator aIter; 585*0deba7fbSSteve Yin //we start counting position from 1 586*0deba7fbSSteve Yin sal_Int32 nPos = 1; 587*0deba7fbSSteve Yin for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ ) 588*0deba7fbSSteve Yin { 589*0deba7fbSSteve Yin if ( (*aIter).get() == xCurShape.get() ) 590*0deba7fbSSteve Yin { 591*0deba7fbSSteve Yin sal_Int32* pArray = aRet.getArray(); 592*0deba7fbSSteve Yin pArray[0] = 1; //it should be 1 based, not 0 based. 593*0deba7fbSSteve Yin pArray[1] = vXShapes.size(); 594*0deba7fbSSteve Yin pArray[2] = nPos; 595*0deba7fbSSteve Yin break; 596*0deba7fbSSteve Yin } 597*0deba7fbSSteve Yin } 598*0deba7fbSSteve Yin return aRet; 599*0deba7fbSSteve Yin } 600*0deba7fbSSteve Yin ::rtl::OUString AccessibleDrawDocumentView::getObjectLink( const uno::Any& rAny ) 601*0deba7fbSSteve Yin throw (uno::RuntimeException) 602*0deba7fbSSteve Yin { 603*0deba7fbSSteve Yin ::rtl::OUString aRet; 604*0deba7fbSSteve Yin //get the xShape of the current selected drawing object 605*0deba7fbSSteve Yin uno::Reference<XAccessibleContext> xAccContent; 606*0deba7fbSSteve Yin rAny >>= xAccContent; 607*0deba7fbSSteve Yin if ( !xAccContent.is() ) 608*0deba7fbSSteve Yin { 609*0deba7fbSSteve Yin return aRet; 610*0deba7fbSSteve Yin } 611*0deba7fbSSteve Yin AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent ); 612*0deba7fbSSteve Yin if ( !pAcc ) 613*0deba7fbSSteve Yin { 614*0deba7fbSSteve Yin return aRet; 615*0deba7fbSSteve Yin } 616*0deba7fbSSteve Yin uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape(); 617*0deba7fbSSteve Yin if ( !xCurShape.is() ) 618*0deba7fbSSteve Yin { 619*0deba7fbSSteve Yin return aRet; 620*0deba7fbSSteve Yin } 621*0deba7fbSSteve Yin SdrObject* pObj = GetSdrObjectFromXShape(xCurShape); 622*0deba7fbSSteve Yin if (pObj) 623*0deba7fbSSteve Yin { 624*0deba7fbSSteve Yin SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj); 625*0deba7fbSSteve Yin if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) ) 626*0deba7fbSSteve Yin aRet = (::rtl::OUString)pInfo->GetBookmark(); 627*0deba7fbSSteve Yin } 628*0deba7fbSSteve Yin return aRet; 629*0deba7fbSSteve Yin } 630*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 631cdf0e10cSrcweir /// Create a name for this view. 632cdf0e10cSrcweir ::rtl::OUString 633cdf0e10cSrcweir AccessibleDrawDocumentView::CreateAccessibleName (void) 634cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir rtl::OUString sName; 637cdf0e10cSrcweir 638cdf0e10cSrcweir uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY); 639cdf0e10cSrcweir if (xInfo.is()) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() ); 642cdf0e10cSrcweir OUString sFirstService = aServices[0]; 643cdf0e10cSrcweir if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView"))) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir if( aServices.getLength() >= 2 && 646cdf0e10cSrcweir aServices[1] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationView"))) 647cdf0e10cSrcweir { 648cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 649cdf0e10cSrcweir 650cdf0e10cSrcweir sName = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_N) ); 651cdf0e10cSrcweir } 652cdf0e10cSrcweir else 653cdf0e10cSrcweir { 654cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 655cdf0e10cSrcweir 656cdf0e10cSrcweir sName = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_N) ); 657cdf0e10cSrcweir } 658cdf0e10cSrcweir } 659cdf0e10cSrcweir else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesView"))) 660cdf0e10cSrcweir { 661cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 662cdf0e10cSrcweir 663cdf0e10cSrcweir sName = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_N) ); 664cdf0e10cSrcweir } 665cdf0e10cSrcweir else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutView"))) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 668cdf0e10cSrcweir 669cdf0e10cSrcweir sName = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_N) ); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir else 672cdf0e10cSrcweir { 673cdf0e10cSrcweir sName = sFirstService; 674cdf0e10cSrcweir } 675cdf0e10cSrcweir } 676cdf0e10cSrcweir else 677cdf0e10cSrcweir { 678cdf0e10cSrcweir sName = OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDrawDocumentView")); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir return sName; 681cdf0e10cSrcweir } 682cdf0e10cSrcweir 683cdf0e10cSrcweir 684cdf0e10cSrcweir 685cdf0e10cSrcweir 686cdf0e10cSrcweir /** Create a description for this view. Use the model's description or URL 687cdf0e10cSrcweir if a description is not available. 688cdf0e10cSrcweir */ 689cdf0e10cSrcweir ::rtl::OUString 690cdf0e10cSrcweir AccessibleDrawDocumentView::CreateAccessibleDescription (void) 691cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir rtl::OUString sDescription; 694cdf0e10cSrcweir 695cdf0e10cSrcweir uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY); 696cdf0e10cSrcweir if (xInfo.is()) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() ); 699cdf0e10cSrcweir OUString sFirstService = aServices[0]; 700cdf0e10cSrcweir if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView"))) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir if( aServices.getLength() >= 2 && 703cdf0e10cSrcweir aServices[1] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationView"))) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 706cdf0e10cSrcweir 707cdf0e10cSrcweir sDescription = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_D) ); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir else 710cdf0e10cSrcweir { 711cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 712cdf0e10cSrcweir 713cdf0e10cSrcweir sDescription = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_D) ); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir } 716cdf0e10cSrcweir else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesView"))) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 719cdf0e10cSrcweir 720cdf0e10cSrcweir sDescription = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_D) ); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir else if (sFirstService == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutView"))) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 725cdf0e10cSrcweir 726cdf0e10cSrcweir sDescription = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_D) ); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir else 729cdf0e10cSrcweir { 730cdf0e10cSrcweir sDescription = sFirstService; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir } 733cdf0e10cSrcweir else 734cdf0e10cSrcweir { 735cdf0e10cSrcweir sDescription = OUString(RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document")); 736cdf0e10cSrcweir } 737cdf0e10cSrcweir return sDescription; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir 741cdf0e10cSrcweir 742cdf0e10cSrcweir 743cdf0e10cSrcweir /** Return selection state of specified child 744cdf0e10cSrcweir */ 745cdf0e10cSrcweir sal_Bool 746cdf0e10cSrcweir AccessibleDrawDocumentView::implIsSelected( sal_Int32 nAccessibleChildIndex ) 747cdf0e10cSrcweir throw (uno::RuntimeException) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 750cdf0e10cSrcweir uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY ); 751cdf0e10cSrcweir sal_Bool bRet = sal_False; 752cdf0e10cSrcweir 753cdf0e10cSrcweir OSL_ENSURE( 0 <= nAccessibleChildIndex, "AccessibleDrawDocumentView::implIsSelected: invalid index!" ); 754cdf0e10cSrcweir 755cdf0e10cSrcweir if( xSel.is() && ( 0 <= nAccessibleChildIndex ) ) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir uno::Any aAny( xSel->getSelection() ); 758cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes; 759cdf0e10cSrcweir 760cdf0e10cSrcweir aAny >>= xShapes; 761cdf0e10cSrcweir 762cdf0e10cSrcweir if( xShapes.is() ) 763cdf0e10cSrcweir { 764cdf0e10cSrcweir AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( nAccessibleChildIndex ) ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir if( pAcc ) 767cdf0e10cSrcweir { 768cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() ); 769cdf0e10cSrcweir 770cdf0e10cSrcweir if( xShape.is() ) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir for( sal_Int32 i = 0, nCount = xShapes->getCount(); ( i < nCount ) && !bRet; ++i ) 773cdf0e10cSrcweir if( xShapes->getByIndex( i ) == xShape ) 774cdf0e10cSrcweir bRet = sal_True; 775cdf0e10cSrcweir } 776cdf0e10cSrcweir } 777cdf0e10cSrcweir } 778cdf0e10cSrcweir } 779cdf0e10cSrcweir 780cdf0e10cSrcweir return( bRet ); 781cdf0e10cSrcweir } 782cdf0e10cSrcweir 783cdf0e10cSrcweir 784cdf0e10cSrcweir 785cdf0e10cSrcweir 786cdf0e10cSrcweir /** Select or delselect the specified shapes. The corresponding accessible 787cdf0e10cSrcweir shapes are notified over the selection change listeners registered with 788cdf0e10cSrcweir the XSelectionSupplier of the controller. 789cdf0e10cSrcweir */ 790cdf0e10cSrcweir void 791cdf0e10cSrcweir AccessibleDrawDocumentView::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) 792cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 795cdf0e10cSrcweir uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY ); 796cdf0e10cSrcweir AccessibleShape* pAccessibleChild; 797cdf0e10cSrcweir 798cdf0e10cSrcweir if( xSel.is() ) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir uno::Any aAny; 801cdf0e10cSrcweir 802cdf0e10cSrcweir if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir // Select or deselect all children. 805cdf0e10cSrcweir 806cdf0e10cSrcweir if( !bSelect ) 807cdf0e10cSrcweir xSel->select( aAny ); 808cdf0e10cSrcweir else 809cdf0e10cSrcweir { 810cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes( new SvxShapeCollection() ); 811cdf0e10cSrcweir 812cdf0e10cSrcweir for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) 813cdf0e10cSrcweir { 814cdf0e10cSrcweir AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) ); 815cdf0e10cSrcweir 816cdf0e10cSrcweir if( pAcc && pAcc->GetXShape().is() ) 817cdf0e10cSrcweir { 818cdf0e10cSrcweir xShapes->add( pAcc->GetXShape() ); 819cdf0e10cSrcweir pAccessibleChild = pAcc; 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir if( xShapes->getCount() ) 824cdf0e10cSrcweir { 825cdf0e10cSrcweir aAny <<= xShapes; 826cdf0e10cSrcweir xSel->select( aAny ); 827cdf0e10cSrcweir } 828cdf0e10cSrcweir } 829cdf0e10cSrcweir } 830cdf0e10cSrcweir else if( nAccessibleChildIndex >= 0 ) 831cdf0e10cSrcweir { 832cdf0e10cSrcweir // Select or deselect only the child with index 833cdf0e10cSrcweir // nAccessibleChildIndex. 834cdf0e10cSrcweir 835cdf0e10cSrcweir AccessibleShape* pAcc = AccessibleShape::getImplementation( 836cdf0e10cSrcweir getAccessibleChild( nAccessibleChildIndex )); 837cdf0e10cSrcweir pAccessibleChild = pAcc; 838cdf0e10cSrcweir 839cdf0e10cSrcweir // Add or remove the shape that is made accessible from the 840cdf0e10cSrcweir // selection of the controller. 841cdf0e10cSrcweir if( pAcc ) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() ); 844cdf0e10cSrcweir 845cdf0e10cSrcweir if( xShape.is() ) 846cdf0e10cSrcweir { 847cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes; 848cdf0e10cSrcweir sal_Bool bFound = sal_False; 849cdf0e10cSrcweir 850cdf0e10cSrcweir aAny = xSel->getSelection(); 851cdf0e10cSrcweir aAny >>= xShapes; 852cdf0e10cSrcweir 853cdf0e10cSrcweir // Search shape to be selected in current selection. 854cdf0e10cSrcweir if (xShapes.is()) 855cdf0e10cSrcweir { 856cdf0e10cSrcweir sal_Int32 nCount = xShapes->getCount(); 857cdf0e10cSrcweir for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i ) 858cdf0e10cSrcweir if( xShapes->getByIndex( i ) == xShape ) 859cdf0e10cSrcweir bFound = sal_True; 860cdf0e10cSrcweir } 861cdf0e10cSrcweir else 862cdf0e10cSrcweir // Create an empty selection to add the shape to. 863cdf0e10cSrcweir xShapes = new SvxShapeCollection(); 864cdf0e10cSrcweir 865cdf0e10cSrcweir // Update the selection. 866cdf0e10cSrcweir if( !bFound && bSelect ) 867cdf0e10cSrcweir xShapes->add( xShape ); 868cdf0e10cSrcweir else if( bFound && !bSelect ) 869cdf0e10cSrcweir xShapes->remove( xShape ); 870cdf0e10cSrcweir 871cdf0e10cSrcweir aAny <<= xShapes; 872cdf0e10cSrcweir xSel->select( aAny ); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir } 876cdf0e10cSrcweir } 877cdf0e10cSrcweir } 878cdf0e10cSrcweir 879cdf0e10cSrcweir 880cdf0e10cSrcweir 881cdf0e10cSrcweir 882cdf0e10cSrcweir void AccessibleDrawDocumentView::Activated (void) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir if (mpChildrenManager != NULL) 885cdf0e10cSrcweir { 886*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 887*0deba7fbSSteve Yin //mpChildrenManager->UpdateSelection(); 888*0deba7fbSSteve Yin sal_Bool bChange = sal_False; 889*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 890cdf0e10cSrcweir // When none of the children has the focus then claim it for the 891cdf0e10cSrcweir // view. 892cdf0e10cSrcweir if ( ! mpChildrenManager->HasFocus()) 893*0deba7fbSSteve Yin { 894cdf0e10cSrcweir SetState (AccessibleStateType::FOCUSED); 895*0deba7fbSSteve Yin bChange = sal_True; 896*0deba7fbSSteve Yin } 897cdf0e10cSrcweir else 898cdf0e10cSrcweir ResetState (AccessibleStateType::FOCUSED); 899*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 900*0deba7fbSSteve Yin mpChildrenManager->UpdateSelection(); 901*0deba7fbSSteve Yin // if the child gets focus in UpdateSelection(), needs to reset the focus on document. 902*0deba7fbSSteve Yin if (mpChildrenManager->HasFocus() && bChange) 903*0deba7fbSSteve Yin ResetState (AccessibleStateType::FOCUSED); 904*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 905cdf0e10cSrcweir } 906cdf0e10cSrcweir } 907cdf0e10cSrcweir 908cdf0e10cSrcweir 909cdf0e10cSrcweir 910cdf0e10cSrcweir 911cdf0e10cSrcweir void AccessibleDrawDocumentView::Deactivated (void) 912cdf0e10cSrcweir { 913cdf0e10cSrcweir if (mpChildrenManager != NULL) 914cdf0e10cSrcweir mpChildrenManager->RemoveFocus(); 915cdf0e10cSrcweir ResetState (AccessibleStateType::FOCUSED); 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir 919cdf0e10cSrcweir 920cdf0e10cSrcweir 921cdf0e10cSrcweir void AccessibleDrawDocumentView::impl_dispose (void) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir if (mpChildrenManager != NULL) 924cdf0e10cSrcweir { 925cdf0e10cSrcweir delete mpChildrenManager; 926cdf0e10cSrcweir mpChildrenManager = NULL; 927cdf0e10cSrcweir } 928cdf0e10cSrcweir 929cdf0e10cSrcweir AccessibleDocumentViewBase::impl_dispose(); 930cdf0e10cSrcweir } 931cdf0e10cSrcweir 932cdf0e10cSrcweir 933cdf0e10cSrcweir 934cdf0e10cSrcweir /** This method is called from the component helper base class while 935cdf0e10cSrcweir disposing. 936cdf0e10cSrcweir */ 937cdf0e10cSrcweir void SAL_CALL AccessibleDrawDocumentView::disposing (void) 938cdf0e10cSrcweir { 939cdf0e10cSrcweir 940cdf0e10cSrcweir // Release resources. 941cdf0e10cSrcweir if (mpChildrenManager != NULL) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir delete mpChildrenManager; 944cdf0e10cSrcweir mpChildrenManager = NULL; 945cdf0e10cSrcweir } 946cdf0e10cSrcweir 947cdf0e10cSrcweir // Forward call to base classes. 948cdf0e10cSrcweir AccessibleDocumentViewBase::disposing (); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir 951*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 952*0deba7fbSSteve Yin ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 953*0deba7fbSSteve Yin SAL_CALL AccessibleDrawDocumentView::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) 954*0deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException ) 955*0deba7fbSSteve Yin { 956*0deba7fbSSteve Yin const sal_Int32 SPELLCHECKFLOWTO = 1; 957*0deba7fbSSteve Yin const sal_Int32 FINDREPLACEFLOWTO = 2; 958*0deba7fbSSteve Yin if ( nType == SPELLCHECKFLOWTO ) 959*0deba7fbSSteve Yin { 960*0deba7fbSSteve Yin uno::Reference< ::com::sun::star::drawing::XShape > xShape; 961*0deba7fbSSteve Yin rAny >>= xShape; 962*0deba7fbSSteve Yin if ( mpChildrenManager && xShape.is() ) 963*0deba7fbSSteve Yin { 964*0deba7fbSSteve Yin uno::Reference < XAccessible > xAcc = mpChildrenManager->GetChild(xShape); 965*0deba7fbSSteve Yin uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); 966*0deba7fbSSteve Yin if ( xAccSelection.is() ) 967*0deba7fbSSteve Yin { 968*0deba7fbSSteve Yin if ( xAccSelection->getSelectedAccessibleChildCount() ) 969*0deba7fbSSteve Yin { 970*0deba7fbSSteve Yin uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); 971*0deba7fbSSteve Yin if ( xSel.is() ) 972*0deba7fbSSteve Yin { 973*0deba7fbSSteve Yin uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); 974*0deba7fbSSteve Yin if ( xSelContext.is() ) 975*0deba7fbSSteve Yin { 976*0deba7fbSSteve Yin //if in sw we find the selected paragraph here 977*0deba7fbSSteve Yin if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) 978*0deba7fbSSteve Yin { 979*0deba7fbSSteve Yin uno::Sequence<uno::Any> aRet( 1 ); 980*0deba7fbSSteve Yin aRet[0] = uno::makeAny( xSel ); 981*0deba7fbSSteve Yin return aRet; 982*0deba7fbSSteve Yin } 983*0deba7fbSSteve Yin } 984*0deba7fbSSteve Yin } 985*0deba7fbSSteve Yin } 986*0deba7fbSSteve Yin } 987*0deba7fbSSteve Yin uno::Reference<XAccessible> xPara = GetSelAccContextInTable(); 988*0deba7fbSSteve Yin if ( xPara.is() ) 989*0deba7fbSSteve Yin { 990*0deba7fbSSteve Yin uno::Sequence<uno::Any> aRet( 1 ); 991*0deba7fbSSteve Yin aRet[0] = uno::makeAny( xPara ); 992*0deba7fbSSteve Yin return aRet; 993*0deba7fbSSteve Yin } 994*0deba7fbSSteve Yin } 995*0deba7fbSSteve Yin else 996*0deba7fbSSteve Yin { 997*0deba7fbSSteve Yin goto Rt; 998*0deba7fbSSteve Yin } 999*0deba7fbSSteve Yin } 1000*0deba7fbSSteve Yin else if ( nType == FINDREPLACEFLOWTO ) 1001*0deba7fbSSteve Yin { 1002*0deba7fbSSteve Yin sal_Int32 nChildCount = getSelectedAccessibleChildCount(); 1003*0deba7fbSSteve Yin if ( nChildCount ) 1004*0deba7fbSSteve Yin { 1005*0deba7fbSSteve Yin uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 ); 1006*0deba7fbSSteve Yin if ( xSel.is() ) 1007*0deba7fbSSteve Yin { 1008*0deba7fbSSteve Yin uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY ); 1009*0deba7fbSSteve Yin if ( xAccChildSelection.is() ) 1010*0deba7fbSSteve Yin { 1011*0deba7fbSSteve Yin if ( xAccChildSelection->getSelectedAccessibleChildCount() ) 1012*0deba7fbSSteve Yin { 1013*0deba7fbSSteve Yin uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 ); 1014*0deba7fbSSteve Yin if ( xChildSel.is() ) 1015*0deba7fbSSteve Yin { 1016*0deba7fbSSteve Yin uno::Reference < XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() ); 1017*0deba7fbSSteve Yin if ( xChildSelContext.is() && 1018*0deba7fbSSteve Yin xChildSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) 1019*0deba7fbSSteve Yin { 1020*0deba7fbSSteve Yin uno::Sequence<uno::Any> aRet( 1 ); 1021*0deba7fbSSteve Yin aRet[0] = uno::makeAny( xChildSel ); 1022*0deba7fbSSteve Yin return aRet; 1023*0deba7fbSSteve Yin } 1024*0deba7fbSSteve Yin } 1025*0deba7fbSSteve Yin } 1026*0deba7fbSSteve Yin } 1027*0deba7fbSSteve Yin } 1028*0deba7fbSSteve Yin } 1029*0deba7fbSSteve Yin else 1030*0deba7fbSSteve Yin { 1031*0deba7fbSSteve Yin uno::Reference<XAccessible> xPara = GetSelAccContextInTable(); 1032*0deba7fbSSteve Yin if ( xPara.is() ) 1033*0deba7fbSSteve Yin { 1034*0deba7fbSSteve Yin uno::Sequence<uno::Any> aRet( 1 ); 1035*0deba7fbSSteve Yin aRet[0] = uno::makeAny( xPara ); 1036*0deba7fbSSteve Yin return aRet; 1037*0deba7fbSSteve Yin } 1038*0deba7fbSSteve Yin } 1039*0deba7fbSSteve Yin } 1040cdf0e10cSrcweir 1041*0deba7fbSSteve Yin Rt: 1042*0deba7fbSSteve Yin ::com::sun::star::uno::Sequence< uno::Any> aRet; 1043*0deba7fbSSteve Yin return aRet; 1044*0deba7fbSSteve Yin } 1045*0deba7fbSSteve Yin uno::Reference<XAccessible> AccessibleDrawDocumentView::GetSelAccContextInTable() 1046*0deba7fbSSteve Yin { 1047*0deba7fbSSteve Yin uno::Reference<XAccessible> xRet; 1048*0deba7fbSSteve Yin sal_Int32 nCount = mpChildrenManager ? mpChildrenManager->GetChildCount() : 0; 1049*0deba7fbSSteve Yin if ( nCount ) 1050*0deba7fbSSteve Yin { 1051*0deba7fbSSteve Yin for ( sal_Int32 i = 0; i < nCount; i++ ) 1052*0deba7fbSSteve Yin { 1053*0deba7fbSSteve Yin try 1054*0deba7fbSSteve Yin { 1055*0deba7fbSSteve Yin uno::Reference<XAccessible> xObj = mpChildrenManager->GetChild(i); 1056*0deba7fbSSteve Yin if ( xObj.is() ) 1057*0deba7fbSSteve Yin { 1058*0deba7fbSSteve Yin uno::Reference<XAccessibleContext> xObjContext( xObj, uno::UNO_QUERY ); 1059*0deba7fbSSteve Yin if ( xObjContext.is() && xObjContext->getAccessibleRole() == AccessibleRole::TABLE ) 1060*0deba7fbSSteve Yin { 1061*0deba7fbSSteve Yin uno::Reference<XAccessibleSelection> xObjSelection( xObj, uno::UNO_QUERY ); 1062*0deba7fbSSteve Yin if ( xObjSelection.is() && xObjSelection->getSelectedAccessibleChildCount() ) 1063*0deba7fbSSteve Yin { 1064*0deba7fbSSteve Yin uno::Reference<XAccessible> xCell = xObjSelection->getSelectedAccessibleChild(0); 1065*0deba7fbSSteve Yin if ( xCell.is() ) 1066*0deba7fbSSteve Yin { 1067*0deba7fbSSteve Yin uno::Reference<XAccessibleSelection> xCellSel( xCell, uno::UNO_QUERY ); 1068*0deba7fbSSteve Yin if ( xCellSel.is() && xCellSel->getSelectedAccessibleChildCount() ) 1069*0deba7fbSSteve Yin { 1070*0deba7fbSSteve Yin uno::Reference<XAccessible> xPara = xCellSel->getSelectedAccessibleChild( 0 ); 1071*0deba7fbSSteve Yin if ( xPara.is() ) 1072*0deba7fbSSteve Yin { 1073*0deba7fbSSteve Yin uno::Reference<XAccessibleContext> xParaContext( xPara, uno::UNO_QUERY ); 1074*0deba7fbSSteve Yin if ( xParaContext.is() && 1075*0deba7fbSSteve Yin xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) 1076*0deba7fbSSteve Yin { 1077*0deba7fbSSteve Yin xRet = xPara; 1078*0deba7fbSSteve Yin return xRet; 1079*0deba7fbSSteve Yin } 1080*0deba7fbSSteve Yin } 1081*0deba7fbSSteve Yin } 1082*0deba7fbSSteve Yin } 1083*0deba7fbSSteve Yin } 1084*0deba7fbSSteve Yin } 1085*0deba7fbSSteve Yin } 1086*0deba7fbSSteve Yin } 1087*0deba7fbSSteve Yin catch ( lang::IndexOutOfBoundsException ) 1088*0deba7fbSSteve Yin { 1089*0deba7fbSSteve Yin uno::Reference<XAccessible> xEmpty; 1090*0deba7fbSSteve Yin return xEmpty; 1091*0deba7fbSSteve Yin } 1092*0deba7fbSSteve Yin catch ( uno::RuntimeException ) 1093*0deba7fbSSteve Yin { 1094*0deba7fbSSteve Yin uno::Reference<XAccessible> xEmpty; 1095*0deba7fbSSteve Yin return xEmpty; 1096*0deba7fbSSteve Yin } 1097*0deba7fbSSteve Yin } 1098*0deba7fbSSteve Yin } 1099cdf0e10cSrcweir 1100*0deba7fbSSteve Yin return xRet; 1101*0deba7fbSSteve Yin } 1102*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir void AccessibleDrawDocumentView::UpdateAccessibleName (void) 1105cdf0e10cSrcweir { 1106cdf0e10cSrcweir OUString sNewName (CreateAccessibleName()); 1107cdf0e10cSrcweir sNewName += A2S(": "); 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir // Add the number of the current slide. 1110cdf0e10cSrcweir uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY); 1111cdf0e10cSrcweir if (xView.is()) 1112cdf0e10cSrcweir { 1113cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xProperties (xView->getCurrentPage(), UNO_QUERY); 1114cdf0e10cSrcweir if (xProperties.is()) 1115cdf0e10cSrcweir try 1116cdf0e10cSrcweir { 1117cdf0e10cSrcweir sal_Int16 nPageNumber (0); 1118cdf0e10cSrcweir if (xProperties->getPropertyValue(A2S("Number")) >>= nPageNumber) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir sNewName += OUString::valueOf(sal_Int32(nPageNumber)); 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir catch (beans::UnknownPropertyException&) 1124cdf0e10cSrcweir { 1125cdf0e10cSrcweir } 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir // Add the number of pages/slides. 1129cdf0e10cSrcweir Reference<drawing::XDrawPagesSupplier> xPagesSupplier (mxModel, UNO_QUERY); 1130cdf0e10cSrcweir if (xPagesSupplier.is()) 1131cdf0e10cSrcweir { 1132cdf0e10cSrcweir Reference<container::XIndexAccess> xPages (xPagesSupplier->getDrawPages(), UNO_QUERY); 1133cdf0e10cSrcweir if (xPages.is()) 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir sNewName += A2S(" / "); 1136cdf0e10cSrcweir sNewName += OUString::valueOf(xPages->getCount()); 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir } 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir SetAccessibleName (sNewName, AutomaticallyCreated); 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir } // end of namespace accessibility 1147