From cc5518ca61b209408a9d5262bbdcc39efccdd72d Mon Sep 17 00:00:00 2001 From: Steve Yin Date: Thu, 28 Nov 2013 12:09:19 +0000 Subject: Integrate branch of IAccessible2 Change-Id: Ibf3be46e8619c2dce9636e8a90a6703f3e28ba33 --- sd/inc/drawdoc.hxx | 11 + sd/inc/glob.hxx | 1 + sd/source/core/drawdoc.cxx | 1 + sd/source/core/drawdoc2.cxx | 12 +- .../accessibility/AccessibleDocumentViewBase.cxx | 159 ++++++++- .../accessibility/AccessibleDrawDocumentView.cxx | 396 ++++++++++++++++++++- .../accessibility/AccessibleOutlineEditSource.cxx | 10 +- .../ui/accessibility/AccessibleOutlineView.cxx | 35 +- .../AccessiblePresentationGraphicShape.cxx | 5 + .../AccessiblePresentationOLEShape.cxx | 7 + .../accessibility/AccessiblePresentationShape.cxx | 97 +++-- .../accessibility/AccessibleSlideSorterObject.cxx | 4 +- .../ui/accessibility/AccessibleSlideSorterView.cxx | 37 +- sd/source/ui/accessibility/accessibility.hrc | 38 ++ sd/source/ui/accessibility/accessibility.src | 190 ++++++++++ sd/source/ui/dlg/navigatr.cxx | 33 +- sd/source/ui/dlg/sdtreelb.cxx | 321 ++++++++++++++++- sd/source/ui/docshell/docshel4.cxx | 285 +++++++++++++++ sd/source/ui/func/fudraw.cxx | 12 +- sd/source/ui/func/fuediglu.cxx | 100 +++++- sd/source/ui/func/fusel.cxx | 92 ++++- sd/source/ui/inc/AccessibleDocumentViewBase.hxx | 27 +- sd/source/ui/inc/AccessibleDrawDocumentView.hxx | 35 ++ sd/source/ui/inc/AccessibleOutlineView.hxx | 4 +- .../ui/inc/AccessiblePresentationGraphicShape.hxx | 3 + .../ui/inc/AccessiblePresentationOLEShape.hxx | 3 + sd/source/ui/inc/AccessiblePresentationShape.hxx | 1 + sd/source/ui/inc/AccessibleSlideSorterView.hxx | 2 +- sd/source/ui/inc/DrawController.hxx | 9 + sd/source/ui/inc/DrawDocShell.hxx | 11 +- sd/source/ui/inc/DrawViewShell.hxx | 17 +- sd/source/ui/inc/OutlineViewShell.hxx | 2 + sd/source/ui/inc/SdUnoDrawView.hxx | 4 +- sd/source/ui/inc/SlideSorterViewShell.hxx | 2 + sd/source/ui/inc/TabControl.hxx | 2 + sd/source/ui/inc/ViewShell.hxx | 5 + sd/source/ui/inc/Window.hxx | 1 + sd/source/ui/inc/fuediglu.hxx | 6 + sd/source/ui/inc/fusel.hxx | 8 + sd/source/ui/inc/navigatr.hxx | 5 + sd/source/ui/inc/sdtreelb.hxx | 29 +- sd/source/ui/slideshow/showwin.cxx | 22 ++ sd/source/ui/slideshow/showwindow.hxx | 4 + sd/source/ui/slideshow/slideshow.cxx | 11 + sd/source/ui/slideshow/slideshowimpl.cxx | 10 +- .../ui/slidesorter/controller/SlsFocusManager.cxx | 3 + .../ui/slidesorter/shell/SlideSorterViewShell.cxx | 17 +- sd/source/ui/unoidl/DrawController.cxx | 46 +++ sd/source/ui/view/Outliner.cxx | 11 + sd/source/ui/view/drviews4.cxx | 38 ++ sd/source/ui/view/drviews5.cxx | 6 + sd/source/ui/view/outlnvsh.cxx | 8 + sd/source/ui/view/sdwindow.cxx | 29 +- sd/source/ui/view/tabcontr.cxx | 5 + sd/source/ui/view/viewshel.cxx | 35 ++ 55 files changed, 2198 insertions(+), 69 deletions(-) diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index d8e2de742f37..695cf6bbee11 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -140,6 +140,16 @@ namespace sd class SdDrawDocument : public FmFormModel { +private: + OUString msDocAccTitle; +public: + virtual void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; } + virtual const OUString getDocAccTitle() const { return msDocAccTitle; } +private: + sal_Bool bReadOnly; +public: + virtual void setDocReadOnly( sal_Bool b){ bReadOnly = b; } + virtual sal_Bool getDocReadOnly() const { return bReadOnly; } private: ::sd::Outliner* mpOutliner; ///< local outliner for outline mode ::sd::Outliner* mpInternalOutliner; ///< internal outliner for creation of text objects @@ -654,6 +664,7 @@ private: virtual void PageListChanged(); virtual void MasterPageListChanged(); + virtual ImageMap* GetImageMapForObject(SdrObject* pObj); }; namespace sd diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx index f5e1565f9086..42617744e33e 100644 --- a/sd/inc/glob.hxx +++ b/sd/inc/glob.hxx @@ -30,6 +30,7 @@ #define SD_IF_SDDRAWDOCSHELL SFX_INTERFACE_SD_START + 1 #define SD_IF_SDVIEWSHELL SFX_INTERFACE_SD_START + 2 #define SD_IF_SDDRAWVIEWSHELL SFX_INTERFACE_SD_START + 3 +#define SD_IF_SDSLIDEVIEWSHELL SFX_INTERFACE_SD_START + 4 #define SD_IF_SDOUTLINEVIEWSHELL SFX_INTERFACE_SD_START + 5 #define SD_IF_SDDRAWSTDOBJECTBAR SFX_INTERFACE_SD_START + 6 #define SD_IF_SDDRAWTEXTOBJECTBAR SFX_INTERFACE_SD_START + 7 diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index f0c14c6df739..21b8ae91d1f3 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -147,6 +147,7 @@ PresentationSettings::PresentationSettings( const PresentationSettings& r ) SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) : FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh ) +, bReadOnly(sal_False) , mpOutliner(NULL) , mpInternalOutliner(NULL) , mpWorkStartupTimer(NULL) diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index c02da25b60ca..6b29aa00346d 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -1037,14 +1037,22 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj, return pIMapObj; } +ImageMap* SdDrawDocument::GetImageMapForObject(SdrObject* pObj) +{ + SdIMapInfo* pIMapInfo = GetIMapInfo( pObj ); + if ( pIMapInfo ) + { + return const_cast( &(pIMapInfo->GetImageMap()) ); + } + return NULL; +} + /** this method enforces that the masterpages are in the currect order, that is at position 1 is a PK_STANDARD masterpage followed by a PK_NOTES masterpage and so on. # */ void SdDrawDocument::CheckMasterPages() { -// RemoveMasterPage(2); // code to test the creation of notes pages - sal_uInt16 nMaxPages = GetMasterPageCount(); // we need at least a handout master and one master page diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index 42758e1fd5e7..cd41a1e50b7b 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -31,7 +31,8 @@ #include #include #include - +#include +#include #include #include @@ -40,8 +41,12 @@ #include #include "Window.hxx" #include +#include "OutlineViewShell.hxx" - +#include +#include +#include "LayerTabBar.hxx" +#include #include "ViewShell.hxx" #include "View.hxx" #include @@ -79,6 +84,7 @@ AccessibleDocumentViewBase::AccessibleDocumentViewBase ( maShapeTreeInfo.SetViewForwarder (&maViewForwarder); mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow); + mpViewShell = pViewShell; } @@ -150,6 +156,9 @@ void AccessibleDocumentViewBase::Init (void) } } } + SfxObjectShell* pObjShell = mpViewShell->GetViewFrame()->GetObjectShell(); + if(!pObjShell->IsReadOnly()) + SetState(AccessibleStateType::EDITABLE); } @@ -422,6 +431,8 @@ uno::Any SAL_CALL static_cast(this), static_cast(this), static_cast(this) + ,static_cast(this) + ,static_cast(this) ); return aReturn; } @@ -818,6 +829,150 @@ void { } +uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Any anyAtrribute; + OUString sValue; + if (mpViewShell && mpViewShell->ISA(::sd::DrawViewShell)) + { + ::sd::DrawViewShell* pDrViewSh = (::sd::DrawViewShell*) mpViewShell; + OUString sDisplay; + OUString sName = "page-name:"; + // MT IA2: Not used... + // SdPage* pCurrPge = pDrViewSh->getCurrentPage(); + SdDrawDocument* pDoc = pDrViewSh->GetDoc(); + sDisplay = pDrViewSh->getCurrentPage()->GetName(); + sDisplay = sDisplay.replaceFirst( "\\", "\\\\" ); + sDisplay = sDisplay.replaceFirst( "=", "\\=" ); + sDisplay = sDisplay.replaceFirst( ";", "\\;" ); + sDisplay = sDisplay.replaceFirst( ",", "\\," ); + sDisplay = sDisplay.replaceFirst( ":", "\\:" ); + sValue = sName + sDisplay ; + sName = ";page-number:"; + sValue += sName; + sValue += OUString::number((sal_Int16)((sal_uInt16)((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ; + sName = ";total-pages:"; + sValue += sName; + sValue += OUString::number(pDrViewSh->GetPageTabControl()->GetPageCount()) ; + sValue += ";"; + if(pDrViewSh->IsLayerModeActive() ) + { + sName = "page-name:"; + sValue = sName; + sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId()); + if( pDoc ) + { + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); + SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sDisplay, sal_False); + if( aSdrLayer ) + { + OUString layerAltText = aSdrLayer->GetTitle(); + if (!layerAltText.isEmpty()) + { + sName = " "; + sDisplay = sDisplay + sName; + sDisplay += layerAltText; + } + } + } + sDisplay = sDisplay.replaceFirst( "\\", "\\\\" ); + sDisplay = sDisplay.replaceFirst( "=", "\\=" ); + sDisplay = sDisplay.replaceFirst( ";", "\\;" ); + sDisplay = sDisplay.replaceFirst( ",", "\\," ); + sDisplay = sDisplay.replaceFirst( ":", "\\:" ); + sValue += sDisplay; + sName = ";page-number:"; + sValue += sName; + sValue += OUString::number(pDrViewSh->GetActiveTabLayerIndex()+1) ; + sName = ";total-pages:"; + sValue += sName; + sValue += OUString::number(pDrViewSh->GetLayerTabControl()->GetPageCount()) ; + sValue += ";"; + } + } + if (mpViewShell && mpViewShell->ISA(::sd::PresentationViewShell)) + { + ::sd::PresentationViewShell* pPresViewSh = (::sd::PresentationViewShell*) mpViewShell; + SdPage* pCurrPge = pPresViewSh->getCurrentPage(); + SdDrawDocument* pDoc = pPresViewSh->GetDoc(); + SdPage* pNotesPge = (SdPage*)pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PK_NOTES); + if (pNotesPge) + { + SdrObject* pNotesObj = pNotesPge->GetPresObj(PRESOBJ_NOTES); + if (pNotesObj) + { + OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject(); + if (pPara) + { + sValue += "note:"; + const EditTextObject& rEdit = pPara->GetTextObject(); + for (sal_uInt16 i=0;iISA(::sd::OutlineViewShell) ) + { + OUString sName; + OUString sDisplay; + SdPage* pCurrPge = mpViewShell->GetActualPage(); + SdDrawDocument* pDoc = mpViewShell->GetDoc(); + if(pCurrPge && pDoc) + { + sName = "page-name:"; + sDisplay = pCurrPge->GetName(); + sDisplay = sDisplay.replaceFirst( "=", "\\=" ); + sDisplay = sDisplay.replaceFirst( ";", "\\;" ); + sDisplay = sDisplay.replaceFirst( ",", "\\," ); + sDisplay = sDisplay.replaceFirst( ":", "\\:" ); + sValue = sName + sDisplay ; + sName = ";page-number:"; + sValue += sName; + sValue += OUString::number((sal_Int16)((sal_uInt16)((pCurrPge->GetPageNum()-1)>>1) + 1)) ; + sName = ";total-pages:"; + sValue += sName; + sValue += OUString::number(pDoc->GetSdPageCount(PK_STANDARD)) ; + sValue += ";"; + } + } + if (sValue.getLength()) + anyAtrribute <<= sValue; + return anyAtrribute; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL AccessibleDocumentViewBase::get_AccFlowTo(const ::com::sun::star::uno::Any&, sal_Int32 ) + throw ( ::com::sun::star::uno::RuntimeException ) +{ + ::com::sun::star::uno::Sequence< uno::Any> aRet; + + return aRet; +} + +sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( ) + throw (uno::RuntimeException) +{ + return COL_BLACK; +} + +sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( ) + throw (uno::RuntimeException) +{ + ThrowIfDisposed (); + ::osl::MutexGuard aGuard (maMutex); + return mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor; +} } // end of namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 7e9d9eedb76a..5dd336d79227 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -46,6 +46,12 @@ #include "ViewShell.hxx" #include "View.hxx" +#include "DrawDocShell.hxx" +#include +#include +#include "sdpage.hxx" +#include "slideshow.hxx" +#include "anminfo.hxx" #include #include "accessibility.hrc" @@ -59,6 +65,20 @@ using namespace ::com::sun::star::accessibility; namespace accessibility { +struct XShapePosCompareHelper +{ + bool operator() ( const uno::Reference& xshape1, + const uno::Reference& xshape2 ) const + { + // modify the compare method to return the Z-Order, not layout order + SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1); + SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2); + if(pObj1 && pObj2) + return pObj1->GetOrdNum() < pObj2->GetOrdNum(); + else + return 0; + } +}; //===== internal ============================================================ AccessibleDrawDocumentView::AccessibleDrawDocumentView ( @@ -67,6 +87,7 @@ AccessibleDrawDocumentView::AccessibleDrawDocumentView ( const uno::Reference& rxController, const uno::Reference& rxParent) : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent), + mpSdViewSh( pViewShell ), mpChildrenManager (NULL) { OSL_TRACE ("AccessibleDrawDocumentView"); @@ -245,8 +266,39 @@ uno::Reference SAL_CALL static_cast(this)); } +OUString SAL_CALL + AccessibleDrawDocumentView::getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException) +{ + OUString sName = SdResId(SID_SD_A11Y_D_PRESENTATION); + ::sd::View* pSdView = static_cast< ::sd::View* >( maShapeTreeInfo.GetSdrView() ); + if ( pSdView ) + { + SdDrawDocument& rDoc = pSdView->GetDoc(); + OUString sFileName = rDoc.getDocAccTitle(); + if ( !sFileName.getLength() ) + { + ::sd::DrawDocShell* pDocSh = pSdView->GetDocSh(); + if ( pDocSh ) + { + sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME ); + } + } + OUString sReadOnly; + if(rDoc.getDocReadOnly()) + { + sReadOnly = SdResId(SID_SD_A11Y_D_PRESENTATION_READONLY); + } + if ( sFileName.getLength() ) + { + sName = sFileName + sReadOnly + " - " + sName; + } + } + + return sName; +} //===== XEventListener ====================================================== @@ -280,7 +332,9 @@ void SAL_CALL AccessibleDocumentViewBase::propertyChange (rEventObject); OSL_TRACE ("AccessibleDrawDocumentView::propertyChange"); - if ( rEventObject.PropertyName == "CurrentPage" ) + // add page switch event for slide show mode + if (rEventObject.PropertyName == "CurrentPage" || + rEventObject.PropertyName == "PageChange") { OSL_TRACE (" current page changed"); @@ -316,6 +370,7 @@ void SAL_CALL } else OSL_TRACE ("View invalid"); + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); } else if ( rEventObject.PropertyName == "VisibleArea" ) { @@ -325,6 +380,57 @@ void SAL_CALL IAccessibleViewForwarderListener::VISIBLE_AREA, &maViewForwarder); } + else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("ActiveLayer"))) + { + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue); + } + else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("UpdateAcc"))) + { + OSL_TRACE (" acc on current page should be updated"); + + // The current page changed. Update the children manager accordingly. + uno::Reference xView (mxController, uno::UNO_QUERY); + if (xView.is() && mpChildrenManager!=NULL) + { + // Inform the children manager to forget all children and give + // him the new ones. + mpChildrenManager->ClearAccessibleShapeList (); + // update the slide show page's accessible info + //mpChildrenManager->SetShapeList (uno::Reference ( + // xView->getCurrentPage(), uno::UNO_QUERY)); + rtl::Reference< sd::SlideShow > xSlideshow( sd::SlideShow::GetSlideShow( mpSdViewSh->GetViewShellBase() ) ); + if( xSlideshow.is() && xSlideshow->isRunning() && xSlideshow->isFullScreen() ) + { + ::com::sun::star::uno::Reference< drawing::XDrawPage > xSlide; + // MT IA2: Not used... + // sal_Int32 currentPageIndex = xSlideshow->getCurrentPageIndex(); + ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > mpSlideController = xSlideshow->getController(); + if( mpSlideController.is() ) + { + xSlide = mpSlideController->getCurrentSlide(); + if (xSlide.is()) + { + mpChildrenManager->SetShapeList (uno::Reference ( + xSlide, uno::UNO_QUERY)); + } + } + } + // Create the page shape and initialize it. The shape is + // acquired before initialization and released after + // transferring ownership to the children manager to prevent + // premature disposing of the shape. + AccessiblePageShape* pPage = CreateDrawPageShape (); + if (pPage != NULL) + { + pPage->acquire(); + pPage->Init(); + mpChildrenManager->AddAccessibleShape ( + std::auto_ptr(pPage)); + mpChildrenManager->Update (false); + pPage->release(); + } + } + } else { OSL_TRACE (" unhandled"); @@ -364,12 +470,139 @@ OUString SAL_CALL return aServiceNames; } +//===== XInterface ========================================================== +uno::Any SAL_CALL + AccessibleDrawDocumentView::queryInterface (const uno::Type & rType) + throw (uno::RuntimeException) +{ + uno::Any aReturn = AccessibleDocumentViewBase::queryInterface (rType); + if ( ! aReturn.hasValue()) + aReturn = ::cppu::queryInterface (rType, + static_cast(this) + ); + return aReturn; +} +void SAL_CALL + AccessibleDrawDocumentView::acquire (void) + throw () +{ + AccessibleDocumentViewBase::acquire (); +} +void SAL_CALL + AccessibleDrawDocumentView::release (void) + throw () +{ + AccessibleDocumentViewBase::release (); +} +//===== XAccessibleGroupPosition ========================================= +uno::Sequence< sal_Int32 > SAL_CALL + AccessibleDrawDocumentView::getGroupPosition( const uno::Any& rAny ) + throw (uno::RuntimeException) +{ + // we will return the: + // [0] group level(always be 0 now) + // [1] similar items counts in the group + // [2] the position of the object in the group + uno::Sequence< sal_Int32 > aRet( 3 ); + //get the xShape of the current selected drawing object + uno::Reference xAccContent; + rAny >>= xAccContent; + if ( !xAccContent.is() ) + { + return aRet; + } + AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent ); + if ( !pAcc ) + { + return aRet; + } + uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape(); + if ( !xCurShape.is() ) + { + return aRet; + } + //find all the child in the page, insert them into a vector and sort + if ( mpChildrenManager == NULL ) + { + return aRet; + } + std::vector< uno::Reference > vXShapes; + sal_Int32 nCount = mpChildrenManager->GetChildCount(); + //get pointer of SdView & SdrPageView for further use. + SdrPageView* pPV = NULL; + ::sd::View* pSdView = NULL; + if ( mpSdViewSh ) + { + pSdView = mpSdViewSh->GetView(); + pPV = pSdView->GetSdrPageView(); + } + for ( sal_Int32 i = 0; i < nCount; i++ ) + { + uno::Reference< drawing::XShape > xShape = mpChildrenManager->GetChildShape(i); + if ( xShape.is() ) + { + //if the object is visable in the page, we add it into the group list. + SdrObject* pObj = GetSdrObjectFromXShape(xShape); + if ( pObj && pPV && pSdView && pSdView->IsObjMarkable( pObj, pPV ) ) + { + vXShapes.push_back( xShape ); + } + } + } + std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() ); + //get the the index of the selected object in the group + std::vector< uno::Reference >::iterator aIter; + //we start counting position from 1 + sal_Int32 nPos = 1; + for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ ) + { + if ( (*aIter).get() == xCurShape.get() ) + { + sal_Int32* pArray = aRet.getArray(); + pArray[0] = 1; //it should be 1 based, not 0 based. + pArray[1] = vXShapes.size(); + pArray[2] = nPos; + break; + } + } + return aRet; +} + +OUString AccessibleDrawDocumentView::getObjectLink( const uno::Any& rAny ) + throw (uno::RuntimeException) +{ + OUString aRet; + //get the xShape of the current selected drawing object + uno::Reference xAccContent; + rAny >>= xAccContent; + if ( !xAccContent.is() ) + { + return aRet; + } + AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent ); + if ( !pAcc ) + { + return aRet; + } + uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape(); + if ( !xCurShape.is() ) + { + return aRet; + } + SdrObject* pObj = GetSdrObjectFromXShape(xCurShape); + if (pObj) + { + SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj); + if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) ) + aRet = pInfo->GetBookmark(); + } + return aRet; +} /// Create a name for this view. -OUString - AccessibleDrawDocumentView::CreateAccessibleName (void) +OUString AccessibleDrawDocumentView::CreateAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) { OUString sName; @@ -615,13 +848,20 @@ void AccessibleDrawDocumentView::Activated (void) { if (mpChildrenManager != NULL) { - mpChildrenManager->UpdateSelection(); + sal_Bool bChange = sal_False; // When none of the children has the focus then claim it for the // view. if ( ! mpChildrenManager->HasFocus()) + { SetState (AccessibleStateType::FOCUSED); + bChange = sal_True; + } else ResetState (AccessibleStateType::FOCUSED); + mpChildrenManager->UpdateSelection(); + // if the child gets focus in UpdateSelection(), needs to reset the focus on document. + if (mpChildrenManager->HasFocus() && bChange) + ResetState (AccessibleStateType::FOCUSED); } } @@ -668,8 +908,156 @@ void SAL_CALL AccessibleDrawDocumentView::disposing (void) AccessibleDocumentViewBase::disposing (); } +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL AccessibleDrawDocumentView::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ) +{ + const sal_Int32 SPELLCHECKFLOWTO = 1; + const sal_Int32 FINDREPLACEFLOWTO = 2; + if ( nType == SPELLCHECKFLOWTO ) + { + uno::Reference< ::com::sun::star::drawing::XShape > xShape; + rAny >>= xShape; + if ( mpChildrenManager && xShape.is() ) + { + uno::Reference < XAccessible > xAcc = mpChildrenManager->GetChild(xShape); + uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); + if ( xAccSelection.is() ) + { + if ( xAccSelection->getSelectedAccessibleChildCount() ) + { + uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); + if ( xSel.is() ) + { + uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); + if ( xSelContext.is() ) + { + //if in sw we find the selected paragraph here + if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Sequence aRet( 1 ); + aRet[0] = uno::makeAny( xSel ); + return aRet; + } + } + } + } + } + uno::Reference xPara = GetSelAccContextInTable(); + if ( xPara.is() ) + { + uno::Sequence aRet( 1 ); + aRet[0] = uno::makeAny( xPara ); + return aRet; + } + } + else + { + goto Rt; + } + } + else if ( nType == FINDREPLACEFLOWTO ) + { + sal_Int32 nChildCount = getSelectedAccessibleChildCount(); + if ( nChildCount ) + { + uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 ); + if ( xSel.is() ) + { + uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY ); + if ( xAccChildSelection.is() ) + { + if ( xAccChildSelection->getSelectedAccessibleChildCount() ) + { + uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 ); + if ( xChildSel.is() ) + { + uno::Reference < XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() ); + if ( xChildSelContext.is() && + xChildSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Sequence aRet( 1 ); + aRet[0] = uno::makeAny( xChildSel ); + return aRet; + } + } + } + } + } + } + else + { + uno::Reference xPara = GetSelAccContextInTable(); + if ( xPara.is() ) + { + uno::Sequence aRet( 1 ); + aRet[0] = uno::makeAny( xPara ); + return aRet; + } + } + } +Rt: + ::com::sun::star::uno::Sequence< uno::Any> aRet; + return aRet; +} +uno::Reference AccessibleDrawDocumentView::GetSelAccContextInTable() +{ + uno::Reference xRet; + sal_Int32 nCount = mpChildrenManager ? mpChildrenManager->GetChildCount() : 0; + if ( nCount ) + { + for ( sal_Int32 i = 0; i < nCount; i++ ) + { + try + { + uno::Reference xObj = mpChildrenManager->GetChild(i); + if ( xObj.is() ) + { + uno::Reference xObjContext( xObj, uno::UNO_QUERY ); + if ( xObjContext.is() && xObjContext->getAccessibleRole() == AccessibleRole::TABLE ) + { + uno::Reference xObjSelection( xObj, uno::UNO_QUERY ); + if ( xObjSelection.is() && xObjSelection->getSelectedAccessibleChildCount() ) + { + uno::Reference xCell = xObjSelection->getSelectedAccessibleChild(0); + if ( xCell.is() ) + { + uno::Reference xCellSel( xCell, uno::UNO_QUERY ); + if ( xCellSel.is() && xCellSel->getSelectedAccessibleChildCount() ) + { + uno::Reference xPara = xCellSel->getSelectedAccessibleChild( 0 ); + if ( xPara.is() ) + { + uno::Reference xParaContext( xPara, uno::UNO_QUERY ); + if ( xParaContext.is() && + xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + xRet = xPara; + return xRet; + } + } + } + } + } + } + } + } + catch ( lang::IndexOutOfBoundsException ) + { + uno::Reference xEmpty; + return xEmpty; + } + catch ( uno::RuntimeException ) + { + uno::Reference xEmpty; + return xEmpty; + } + } + } + return xRet; +} void AccessibleDrawDocumentView::UpdateAccessibleName (void) { diff --git a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx index bb1bcffff12d..981ee3b53c55 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx @@ -40,7 +40,8 @@ namespace accessibility mViewForwarder( rOutlView ) { // register as listener - need to broadcast state change messages - rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) ); + // Moved to ::GetTextForwarder() + //rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) ); StartListening(rOutliner); } @@ -53,14 +54,19 @@ namespace accessibility SvxEditSource* AccessibleOutlineEditSource::Clone() const { - return NULL; + return new AccessibleOutlineEditSource(*mpOutliner, mrView, *mpOutlinerView, mrWindow); } SvxTextForwarder* AccessibleOutlineEditSource::GetTextForwarder() { // TODO: maybe suboptimal if( IsValid() ) + { + // Moved here to make sure that + // the NotifyHandler was set on the current object. + mpOutliner->SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) ); return &mTextForwarder; + } else return NULL; } diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx index 724c4d9d3e6c..981f03c6fdf2 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx @@ -140,6 +140,34 @@ uno::Reference SAL_CALL return maTextHelper.GetChild(nIndex); } +#include + +OUString SAL_CALL + AccessibleOutlineView::getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException) +{ + OUString sName = SdResId(SID_SD_A11Y_D_PRESENTATION); + ::sd::View* pSdView = static_cast< ::sd::View* >( maShapeTreeInfo.GetSdrView() ); + if ( pSdView ) + { + SdDrawDocument& rDoc = pSdView->GetDoc(); + rtl::OUString sFileName = rDoc.getDocAccTitle(); + if (sFileName.isEmpty()) + { + ::sd::DrawDocShell* pDocSh = pSdView->GetDocSh(); + if ( pDocSh ) + { + sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME ); + } + } + if (!sFileName.isEmpty()) + { + sName = sFileName + " - " + sName; + } + } + return sName; +} + //===== XAccessibleEventBroadcaster ======================================== void SAL_CALL AccessibleOutlineView::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) @@ -147,6 +175,7 @@ void SAL_CALL AccessibleOutlineView::addAccessibleEventListener( const uno::Refe // delegate listener handling to children manager. if ( ! IsDisposed()) maTextHelper.AddEventListener(xListener); + AccessibleContextBase::addEventListener(xListener); } void SAL_CALL AccessibleOutlineView::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) @@ -154,6 +183,7 @@ void SAL_CALL AccessibleOutlineView::removeAccessibleEventListener( const uno::R // forward if ( ! IsDisposed()) maTextHelper.RemoveEventListener(xListener); + AccessibleContextBase::removeEventListener(xListener); } //===== XServiceInfo ======================================================== @@ -218,12 +248,15 @@ void SAL_CALL AccessibleDocumentViewBase::propertyChange (rEventObject); OSL_TRACE ("AccessibleOutlineView::propertyChange"); - if ( rEventObject.PropertyName == "CurrentPage" ) + //add page switch event for slide show mode + if (rEventObject.PropertyName == "CurrentPage" || + rEventObject.PropertyName == "PageChange") { OSL_TRACE (" current page changed"); // The current page changed. Update the children accordingly. UpdateChildren(); + CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue, rEventObject.OldValue); } else if ( rEventObject.PropertyName == "VisibleArea" ) { diff --git a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx index 220792dc0c2e..d8600b0b1c0d 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx @@ -112,6 +112,11 @@ OUString return aDG(); } +sal_Int16 SAL_CALL AccessiblePresentationGraphicShape::getAccessibleRole () + throw (::com::sun::star::uno::RuntimeException) +{ + return AccessibleRole::GRAPHIC ; +} } // end of namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx index 64e14d9e8ce4..c3f2be9a5df0 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx @@ -118,6 +118,13 @@ OUString return aDG(); } +// Return this object's role. +sal_Int16 SAL_CALL AccessiblePresentationOLEShape::getAccessibleRole () + throw (::com::sun::star::uno::RuntimeException) +{ + return AccessibleRole::EMBEDDED_OBJECT ; +} + } // end of namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx index 2b48c2b436cf..c4ff85328aec 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx @@ -21,6 +21,9 @@ #include "SdShapeTypes.hxx" +#include "accessibility.hrc" +#include "sdresid.hxx" +#include #include #include @@ -62,8 +65,7 @@ OUString SAL_CALL /// Set this object's name if is different to the current name. -OUString - AccessiblePresentationShape::CreateAccessibleBaseName (void) +OUString AccessiblePresentationShape::CreateAccessibleBaseName (void) throw (::com::sun::star::uno::RuntimeException) { OUString sName; @@ -72,37 +74,37 @@ OUString switch (nShapeType) { case PRESENTATION_TITLE: - sName = "ImpressTitle"; + sName = SdResId(SID_SD_A11Y_P_TITLE_N); break; case PRESENTATION_OUTLINER: - sName = "ImpressOutliner"; + sName = SdResId(SID_SD_A11Y_P_OUTLINER_N); break; case PRESENTATION_SUBTITLE: - sName = "ImpressSubtitle"; + sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N); break; case PRESENTATION_PAGE: - sName = "ImpressPage"; + sName = SdResId(SID_SD_A11Y_P_PAGE_N); break; case PRESENTATION_NOTES: - sName = "ImpressNotes"; + sName = SdResId(SID_SD_A11Y_P_NOTES_N); break; case PRESENTATION_HANDOUT: - sName = "ImpressHandout"; + sName = SdResId(SID_SD_A11Y_P_HANDOUT_N); break; case PRESENTATION_HEADER: - sName = "ImpressHeader"; + sName = SdResId(SID_SD_A11Y_P_HEADER_N); break; case PRESENTATION_FOOTER: - sName = "ImpressFooter"; + sName = SdResId(SID_SD_A11Y_P_FOOTER_N); break; case PRESENTATION_DATETIME: - sName = "ImpressDateAndTime"; + sName = SdResId(SID_SD_A11Y_P_DATE_N); break; case PRESENTATION_PAGENUMBER: - sName = "ImpressPageNumber"; + sName = SdResId(SID_SD_A11Y_P_NUMBER_N); break; default: - sName = "UnknownAccessibleImpressShape"; + sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N); uno::Reference xDescriptor (mxShape, uno::UNO_QUERY); if (xDescriptor.is()) sName += ": " + xDescriptor->getShapeType(); @@ -124,37 +126,37 @@ OUString switch (nShapeType) { case PRESENTATION_TITLE: - aDG.Initialize ("PresentationTitleShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_TITLE_D)); break; case PRESENTATION_OUTLINER: - aDG.Initialize ("PresentationOutlinerShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_OUTLINER_D)); break; case PRESENTATION_SUBTITLE: - aDG.Initialize ("PresentationSubtitleShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_SUBTITLE_D)); break; case PRESENTATION_PAGE: - aDG.Initialize ("PresentationPageShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_PAGE_D)); break; case PRESENTATION_NOTES: - aDG.Initialize ("PresentationNotesShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_NOTES_D)); break; case PRESENTATION_HANDOUT: - aDG.Initialize ("PresentationHandoutShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_HANDOUT_D)); break; case PRESENTATION_HEADER: - aDG.Initialize ("PresentationHeaderShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_HEADER_D)); break; case PRESENTATION_FOOTER: - aDG.Initialize ("PresentationFooterShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_FOOTER_D)); break; case PRESENTATION_DATETIME: - aDG.Initialize ("PresentationDateAndTimeShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_DATE_D)); break; case PRESENTATION_PAGENUMBER: - aDG.Initialize ("PresentationPageNumberShape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_NUMBER_D)); break; default: - aDG.Initialize ("Unknown accessible presentation shape"); + aDG.Initialize (SdResId(SID_SD_A11Y_P_UNKNOWN_D)); uno::Reference xDescriptor (mxShape, uno::UNO_QUERY); if (xDescriptor.is()) { @@ -166,6 +168,53 @@ OUString return aDG(); } +OUString AccessiblePresentationShape::GetStyle() +{ + OUString sName; + + ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); + switch (nShapeType) + { + case PRESENTATION_TITLE: + sName = SdResId(SID_SD_A11Y_P_TITLE_N_STYLE); + break; + case PRESENTATION_OUTLINER: + sName = SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE); + break; + case PRESENTATION_SUBTITLE: + sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE); + break; + case PRESENTATION_PAGE: + sName = SdResId(SID_SD_A11Y_P_PAGE_N_STYLE); + break; + case PRESENTATION_NOTES: + sName = SdResId(SID_SD_A11Y_P_NOTES_N_STYLE); + break; + case PRESENTATION_HANDOUT: + sName = SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE); + break; + case PRESENTATION_FOOTER: + sName = SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE); + break; + case PRESENTATION_HEADER: + sName = SdResId(SID_SD_A11Y_P_HEADER_N_STYLE); + break; + case PRESENTATION_DATETIME: + sName = SdResId(SID_SD_A11Y_P_DATE_N_STYLE); + break; + case PRESENTATION_PAGENUMBER: + sName = SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE); + break; + default: + sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE); + uno::Reference xDescriptor (mxShape, uno::UNO_QUERY); + if (xDescriptor.is()) + sName += ": " + xDescriptor->getShapeType(); + } + + return sName; + +} } // end of namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index c5177c1807f0..f15771189a63 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -192,7 +192,9 @@ sal_Int16 SAL_CALL AccessibleSlideSorterObject::getAccessibleRole (void) throw (uno::RuntimeException) { ThrowIfDisposed(); - static sal_Int16 nRole = AccessibleRole::LIST_ITEM; + //set Role = Shape + //static sal_Int16 nRole = AccessibleRole::LIST_ITEM; + static sal_Int16 nRole = AccessibleRole::SHAPE; return nRole; } diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index e682668bb46a..f9ba34e2d138 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -86,6 +86,7 @@ public: DECL_LINK(VisibilityChangeListener, void*); DECL_LINK(UpdateChildrenCallback, void*); + void Activated(void); private: AccessibleSlideSorterView& mrAccessibleSlideSorter; ::sd::slidesorter::SlideSorter& mrSlideSorter; @@ -833,6 +834,11 @@ void AccessibleSlideSorterView::Implementation::RequestUpdateChildren (void) void AccessibleSlideSorterView::Implementation::UpdateChildren (void) { + //By default, all children should be accessable. So here workaround is to make all children visible. + // MT: THis was in UpdateVisibility, which has some similarity, and hg merge automatically has put it here. Correct?! + // In the IA2 CWS, also setting mnFirst/LastVisibleChild was commented out! + mnLastVisibleChild = maPageObjects.size(); + if (mbModelChangeLocked) { // Do nothing right now. When the flag is reset, this method is @@ -1028,6 +1034,22 @@ void AccessibleSlideSorterView::Implementation::Notify ( } +void AccessibleSlideSorterView::SwitchViewActivated (void) +{ + // Firstly, set focus to view + this->FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, + Any(), + Any(AccessibleStateType::FOCUSED)); + + mpImpl->Activated(); +} + +void AccessibleSlideSorterView::Implementation::Activated() +{ + mrSlideSorter.GetController().GetFocusManager().ShowFocus(); + +} + IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent) @@ -1084,27 +1106,40 @@ IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, FocusChangeListener) sal_Int32 nNewFocusedIndex ( mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex()); + sal_Bool bHasFocus = mrSlideSorter.GetController().GetFocusManager().IsFocusShowing(); + if (!bHasFocus) + nNewFocusedIndex = -1; + + // add a checker whether the focus event is sent out. Only after sent, the mnFocusedIndex should be updated. + sal_Bool bSentFocus = sal_False; if (nNewFocusedIndex != mnFocusedIndex) { if (mnFocusedIndex >= 0) { AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex); if (pObject != NULL) + { pObject->FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(AccessibleStateType::FOCUSED), Any()); + bSentFocus = sal_True; + } } if (nNewFocusedIndex >= 0) { AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex); if (pObject != NULL) + { pObject->FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any(AccessibleStateType::FOCUSED)); + bSentFocus = sal_True; + } } - mnFocusedIndex = nNewFocusedIndex; + if (bSentFocus == sal_True) + mnFocusedIndex = nNewFocusedIndex; } return 1; } diff --git a/sd/source/ui/accessibility/accessibility.hrc b/sd/source/ui/accessibility/accessibility.hrc index 4e58278d61aa..b3145f0d2899 100644 --- a/sd/source/ui/accessibility/accessibility.hrc +++ b/sd/source/ui/accessibility/accessibility.hrc @@ -38,7 +38,45 @@ #define SID_SD_A11Y_I_HANDOUTVIEW_N (SID_SD_A11Y_START + 10) #define SID_SD_A11Y_I_HANDOUTVIEW_D (SID_SD_A11Y_START + 11) +#define SID_SD_A11Y_P_TITLE_N (SID_SD_A11Y_START + 12) +#define SID_SD_A11Y_P_TITLE_D (SID_SD_A11Y_START + 13) +#define SID_SD_A11Y_P_OUTLINER_N (SID_SD_A11Y_START + 14) +#define SID_SD_A11Y_P_OUTLINER_D (SID_SD_A11Y_START + 15) +#define SID_SD_A11Y_P_SUBTITLE_N (SID_SD_A11Y_START + 16) +#define SID_SD_A11Y_P_SUBTITLE_D (SID_SD_A11Y_START + 17) +#define SID_SD_A11Y_P_PAGE_N (SID_SD_A11Y_START + 18) +#define SID_SD_A11Y_P_PAGE_D (SID_SD_A11Y_START + 19) +#define SID_SD_A11Y_P_NOTES_N (SID_SD_A11Y_START + 20) +#define SID_SD_A11Y_P_NOTES_D (SID_SD_A11Y_START + 21) +#define SID_SD_A11Y_P_HANDOUT_N (SID_SD_A11Y_START + 22) +#define SID_SD_A11Y_P_HANDOUT_D (SID_SD_A11Y_START + 23) +#define SID_SD_A11Y_P_UNKNOWN_N (SID_SD_A11Y_START + 24) +#define SID_SD_A11Y_P_UNKNOWN_D (SID_SD_A11Y_START + 25) +#define SID_SD_A11Y_P_FOOTER_N (SID_SD_A11Y_START + 26) +#define SID_SD_A11Y_P_FOOTER_D (SID_SD_A11Y_START + 27) +#define SID_SD_A11Y_P_HEADER_N (SID_SD_A11Y_START + 28) +#define SID_SD_A11Y_P_HEADER_D (SID_SD_A11Y_START + 29) +#define SID_SD_A11Y_P_DATE_N (SID_SD_A11Y_START + 30) +#define SID_SD_A11Y_P_DATE_D (SID_SD_A11Y_START + 31) +#define SID_SD_A11Y_P_NUMBER_N (SID_SD_A11Y_START + 32) +#define SID_SD_A11Y_P_NUMBER_D (SID_SD_A11Y_START + 33) +#define SID_SD_A11Y_D_PRESENTATION (SID_SD_A11Y_START + 34) +#define SID_SD_A11Y_P_TITLE_N_STYLE (SID_SD_A11Y_START + 35) +#define SID_SD_A11Y_P_OUTLINER_N_STYLE (SID_SD_A11Y_START + 36) +#define SID_SD_A11Y_P_SUBTITLE_N_STYLE (SID_SD_A11Y_START + 37) +#define SID_SD_A11Y_P_PAGE_N_STYLE (SID_SD_A11Y_START + 38) +#define SID_SD_A11Y_P_NOTES_N_STYLE (SID_SD_A11Y_START + 39) +#define SID_SD_A11Y_P_HANDOUT_N_STYLE (SID_SD_A11Y_START + 40) +#define SID_SD_A11Y_P_UNKNOWN_N_STYLE (SID_SD_A11Y_START + 41) +#define SID_SD_A11Y_P_FOOTER_N_STYLE (SID_SD_A11Y_START + 42) +#define SID_SD_A11Y_P_HEADER_N_STYLE (SID_SD_A11Y_START + 43) +#define SID_SD_A11Y_P_DATE_N_STYLE (SID_SD_A11Y_START + 44) +#define SID_SD_A11Y_P_NUMBER_N_STYLE (SID_SD_A11Y_START + 45) +#define SID_SD_A11Y_I_PREVIEW_N (SID_SD_A11Y_START + 46) +#define SID_SD_A11Y_I_PREVIEW_D (SID_SD_A11Y_START + 47) +#define SID_SD_A11Y_I_PREVIEW_SUFFIX (SID_SD_A11Y_START + 48) +#define SID_SD_A11Y_D_PRESENTATION_READONLY (SID_SD_A11Y_START + 49) #endif /* _SD_ACCESSIBILITY_HRC */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/accessibility/accessibility.src b/sd/source/ui/accessibility/accessibility.src index 76598e2bde63..0d22039c278d 100644 --- a/sd/source/ui/accessibility/accessibility.src +++ b/sd/source/ui/accessibility/accessibility.src @@ -83,4 +83,194 @@ String SID_SD_A11Y_I_HANDOUTVIEW_D Text [ en-US ] = "This is where you decide on the layout for handouts."; }; +String SID_SD_A11Y_P_TITLE_N +{ + Text [ en-US ] = "PresentationTitle"; +}; + +String SID_SD_A11Y_P_OUTLINER_N +{ + Text [ en-US ] = "PresentationOutliner"; +}; + +String SID_SD_A11Y_P_SUBTITLE_N +{ + Text [ en-US ] = "PresentationSubtitle"; +}; + +String SID_SD_A11Y_P_PAGE_N +{ + Text [ en-US ] = "PresentationPage"; +}; + +String SID_SD_A11Y_P_NOTES_N +{ + Text [ en-US ] = "PresentationNotes"; +}; + +String SID_SD_A11Y_P_HANDOUT_N +{ + Text [ en-US ] = "Handout"; +}; + +String SID_SD_A11Y_P_UNKNOWN_N +{ + Text [ en-US ] = "UnknownAccessiblePresentationShape"; +}; + +String SID_SD_A11Y_P_TITLE_D +{ + Text [ en-US ] = "PresentationTitleShape"; +}; + +String SID_SD_A11Y_P_OUTLINER_D +{ + Text [ en-US ] = "PresentationOutlinerShape"; +}; + +String SID_SD_A11Y_P_SUBTITLE_D +{ + Text [ en-US ] = "PresentationSubtitleShape"; +}; + +String SID_SD_A11Y_P_PAGE_D +{ + Text [ en-US ] = "PresentationPageShape"; +}; + +String SID_SD_A11Y_P_NOTES_D +{ + Text [ en-US ] = "PresentationNotesShape"; +}; + +String SID_SD_A11Y_P_HANDOUT_D +{ + Text [ en-US ] = "PresentationHandoutShape"; +}; + +String SID_SD_A11Y_P_UNKNOWN_D +{ + Text [ en-US ] = "Unknown accessible presentation shape"; +}; + +String SID_SD_A11Y_P_FOOTER_N +{ + Text [ en-US ] = "PresentationFooter"; +}; + +String SID_SD_A11Y_P_FOOTER_D +{ + Text [ en-US ] = "PresentationFooterShape"; +}; + +String SID_SD_A11Y_P_HEADER_N +{ + Text [ en-US ] = "PresentationHeader"; +}; + +String SID_SD_A11Y_P_HEADER_D +{ + Text [ en-US ] = "PresentationHeaderShape"; +}; + +String SID_SD_A11Y_P_DATE_N +{ + Text [ en-US ] = "PresentationDateAndTime"; +}; + +String SID_SD_A11Y_P_DATE_D +{ + Text [ en-US ] = "PresentationDateAndTimeShape"; +}; + +String SID_SD_A11Y_P_NUMBER_N +{ + Text [ en-US ] = "PresentationPageNumber"; +}; + +String SID_SD_A11Y_P_NUMBER_D +{ + Text [ en-US ] = "PresentationPageNumberShape"; +}; + +String SID_SD_A11Y_D_PRESENTATION +{ + Text [ en-US ] = "%PRODUCTNAME Presentation"; +}; + +String SID_SD_A11Y_P_TITLE_N_STYLE +{ + Text [ en-US ] = "Title"; +}; + +String SID_SD_A11Y_P_OUTLINER_N_STYLE +{ + Text [ en-US ] = "Outliner"; +}; + +String SID_SD_A11Y_P_SUBTITLE_N_STYLE +{ + Text [ en-US ] = "Sub Title"; +}; + +String SID_SD_A11Y_P_PAGE_N_STYLE +{ + Text [ en-US ] = "Page"; +}; + +String SID_SD_A11Y_P_NOTES_N_STYLE +{ + Text [ en-US ] = "Notes"; +}; + +String SID_SD_A11Y_P_HANDOUT_N_STYLE +{ + Text [ en-US ] = "Handout"; +}; + +String SID_SD_A11Y_P_UNKNOWN_N_STYLE +{ + Text [ en-US ] = "Unknown Accessible Presentation Shape"; +}; + +String SID_SD_A11Y_P_FOOTER_N_STYLE +{ + Text [ en-US ] = "Footer"; +}; + +String SID_SD_A11Y_P_HEADER_N_STYLE +{ + Text [ en-US ] = "Header"; +}; + +String SID_SD_A11Y_P_DATE_N_STYLE +{ + Text [ en-US ] = "Date"; +}; + +String SID_SD_A11Y_P_NUMBER_N_STYLE +{ + Text [ en-US ] = "Number"; +}; + +String SID_SD_A11Y_I_PREVIEW_N +{ + Text [ en-US ] = "Preview View"; +}; + +String SID_SD_A11Y_I_PREVIEW_D +{ + Text [ en-US ] = "This is where you print preview pages."; +}; + +String SID_SD_A11Y_I_PREVIEW_SUFFIX +{ + Text [ en-US ] = "(Preview mode)"; +}; + +String SID_SD_A11Y_D_PRESENTATION_READONLY +{ + Text [ en-US ] = "(read-only)"; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index eb7fbd784ec5..a5cb425f9df5 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -108,6 +108,7 @@ SdNavigatorWin::SdNavigatorWin( // set focus to listbox, otherwise it is in the toolbox which is only useful // for keyboard navigation maTlbObjects.GrabFocus(); + maTlbObjects.SetSdNavigatorWinFlag(sal_True); // DragTypeListBox maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); @@ -157,6 +158,26 @@ SdNavigatorWin::~SdNavigatorWin() // ----------------------------------------------------------------------- +//when object is marked , fresh the corresponding entry tree . +void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc ) +{ + SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... + sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); + OUString aDocShName( pDocShell->GetName() ); + OUString aDocName = pDocShell->GetMedium()->GetName(); + maTlbObjects.SetSaveTreeItemStateFlag(sal_True); //Added by yanjun for sym2_6385 + maTlbObjects.Clear(); + maTlbObjects.Fill( pDoc, sal_False, aDocName ); // Nur normale Seiten + maTlbObjects.SetSaveTreeItemStateFlag(sal_False); //Added by yanjun for sym2_6385 + RefreshDocumentLB(); + maLbDocs.SelectEntry( aDocShName ); +} + +void SdNavigatorWin::FreshEntry( ) +{ + maTlbObjects.FreshCurEntry(); +} + void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) { SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... @@ -222,8 +243,14 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType() return( eDT ); } -// ----------------------------------------------------------------------- - +//Get SdDrawDocShell +sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc ) +{ + if( !pDoc ) + return NULL; // const as const can... + sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); + return pDocShell; +} IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl) { @@ -379,6 +406,8 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) SfxStringItem aItem( SID_NAVIGATOR_OBJECT, aStr ); mpBindings->GetDispatcher()->Execute( SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L ); + //set sign variable + maTlbObjects.MarkCurEntry(aStr); // moved here from SetGetFocusHdl. Reset the // focus only if something has been selected in the diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 311d17846bca..da8f0149afb9 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -50,7 +50,8 @@ #include #include #include -#include "svtools/treelistentry.hxx" +#include +#include #include #include #include @@ -222,6 +223,7 @@ sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void) SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) : SvTreeListBox ( pParentWin, rSdResId ) +, bisInSdNavigatorWin ( sal_False ) , mpParent ( pParentWin ) , mpDoc ( NULL ) , mpBookmarkDoc ( NULL ) @@ -233,7 +235,6 @@ SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) , mpDropNavWin ( NULL ) , mbShowAllShapes ( false ) , mbShowAllPages ( false ) - { // add lines to Tree-ListBox SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | @@ -288,6 +289,146 @@ SdPageObjsTLB::~SdPageObjsTLB() delete mpMedium; } +// helper function for GetEntryAltText and GetEntryLongDescription +OUString SdPageObjsTLB::getAltLongDescText(SvTreeListEntry* pEntry , sal_Bool isAltText) const +{ + sal_uInt16 maxPages = mpDoc->GetPageCount(); + sal_uInt16 pageNo; + SdrObject* pObj = NULL; + SdPage* pPage = NULL; + + + OUString ParentName = GetEntryText( GetRootLevelParent( pEntry ) ); + + for( pageNo = 0; pageNo < maxPages; pageNo++ ) + { + pPage = (SdPage*) mpDoc->GetPage( pageNo ); + if( pPage->GetPageKind() != PK_STANDARD ) continue; + if( pPage->GetName() != ParentName ) continue; + SdrObjListIter aIter( *pPage, IM_FLAT ); + while( aIter.IsMore() ) + { + pObj = aIter.Next(); + if( GetEntryText(pEntry) == GetObjectName( pObj ) ) + { + if( isAltText ) + return pObj->GetTitle(); + else + return pObj->GetDescription(); + } + } + } + return OUString(); + +} + +OUString SdPageObjsTLB::GetEntryAltText( SvTreeListEntry* pEntry ) const +{ + return getAltLongDescText( pEntry, sal_True ); +} + +OUString SdPageObjsTLB::GetEntryLongDescription( SvTreeListEntry* pEntry ) const +{ + return getAltLongDescText( pEntry, sal_False); +} + +void SdPageObjsTLB::MarkCurEntry( const OUString& rName ) +{ + + if (!rName.isEmpty()) + { + SvTreeListEntry* pCurEntry =GetCurEntry(); + SvTreeListEntry* pEntry =NULL; + OUString aTmp1; + OUString aTmp2; + + if( GetParent(pCurEntry)==NULL ) + { + aTmp1 = GetEntryText( pCurEntry ); + for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) ) + { + if(GetParent( pEntry )==NULL) + continue; + aTmp2 = GetEntryText( GetParent( pEntry )); + if( aTmp1 != aTmp2) + { + // IA2 CWS. MT: Removed in SvTreeListEntry for now - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this + pEntry->SetMarked(sal_False); + } + } + } + else + { + for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) ) + { + aTmp2 = GetEntryText( pEntry ); + if( aTmp2 == rName) + { + pEntry->SetMarked(sal_True); + } + else + { + pEntry->SetMarked(sal_False); + } + } + } + } + Invalidate(); +} + +void SdPageObjsTLB:: FreshCurEntry() +{ + SvTreeListEntry* pEntry =NULL; + for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) ) + { + pEntry->SetMarked(sal_False); + } + Invalidate(); +} + +void SdPageObjsTLB::InitEntry(SvTreeListEntry* pEntry, + const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind) +{ + sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" + SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); + SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); + SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() ); + pEntry->ReplaceItem( pStr, nColToHilite ); +} + +void SdPageObjsTLB::SaveExpandedTreeItemState(SvTreeListEntry* pEntry, vector& vectTreeItem) +{ + if (pEntry) + { + SvTreeListEntry* pListEntry = pEntry; + while (pListEntry) + { + if (pListEntry->HasChildren()) + { + if (IsExpanded(pListEntry)) + vectTreeItem.push_back(GetEntryText(pListEntry)); + SvTreeListEntry* pChildEntry = FirstChild(pListEntry); + SaveExpandedTreeItemState(pChildEntry, vectTreeItem); + } + pListEntry = NextSibling(pListEntry); + } + } +} +void SdPageObjsTLB::Clear() +{ + //Save the expanded tree item + if (mbSaveTreeItemState) + { + maSelectionEntryText = OUString(); + maTreeItem.clear(); + if (GetCurEntry()) + maSelectionEntryText = GetSelectEntry(); + SvTreeListEntry* pEntry = FirstChild(NULL); + SaveExpandedTreeItemState(pEntry, maTreeItem); + } + return SvTreeListBox::Clear(); +} + OUString SdPageObjsTLB::GetObjectName( const SdrObject* pObject, const bool bCreate) const @@ -426,6 +567,10 @@ void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages, } if( !aSelection.isEmpty() ) SelectEntry( aSelection ); + else if (mbSaveTreeItemState && !maSelectionEntryText.isEmpty()) + { + SelectEntry(maSelectionEntryText); + } } /** @@ -485,6 +630,28 @@ void SdPageObjsTLB::AddShapeList ( IM_FLAT, sal_False /*not reverse*/); + sal_Bool bMarked=sal_False; + if(bisInSdNavigatorWin) + { + Window* pWindow=NULL; + SdNavigatorWin* pSdNavigatorWin=NULL; + sd::DrawDocShell* pSdDrawDocShell = NULL; + if(pEntry) + pWindow=(Window*)GetParent(pEntry); + if(pWindow) + pSdNavigatorWin = (SdNavigatorWin*)pWindow; + if( pSdNavigatorWin ) + pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if(pSdDrawDocShell) + bMarked=pSdDrawDocShell->IsMarked(pShape); + if(pEntry) + { + if(bMarked) + pEntry->SetMarked(sal_True); + else + pEntry->SetMarked( sal_False ); + } + } while( aIter.IsMore() ) { SdrObject* pObj = aIter.Next(); @@ -497,7 +664,7 @@ void SdPageObjsTLB::AddShapeList ( { if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 ) { - InsertEntry( + SvTreeListEntry *pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, @@ -506,10 +673,32 @@ void SdPageObjsTLB::AddShapeList ( LIST_APPEND, pObj ); + + if(bisInSdNavigatorWin) + { + Window* pWindow=NULL; + SdNavigatorWin* pSdNavigatorWin=NULL; + sd::DrawDocShell* pSdDrawDocShell = NULL; + if(pNewEntry) + pWindow=(Window*)GetParent(pNewEntry); + if(pWindow) + pSdNavigatorWin = (SdNavigatorWin*)pWindow; + if( pSdNavigatorWin ) + pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if(pSdDrawDocShell) + bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj); + if(pNewEntry) + { + if(bMarked) + pNewEntry->SetMarked(sal_True); + else + pNewEntry->SetMarked( sal_False ); + } + } } else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF ) { - InsertEntry( + SvTreeListEntry *pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, @@ -518,6 +707,32 @@ void SdPageObjsTLB::AddShapeList ( LIST_APPEND, pObj ); + + if(bisInSdNavigatorWin) + { + Window* pWindow=NULL; + SdNavigatorWin* pSdNavigatorWin=NULL; + sd::DrawDocShell* pSdDrawDocShell = NULL; + if(pNewEntry) + pWindow=(Window*)GetParent(pNewEntry); + if(pWindow) + pSdNavigatorWin = (SdNavigatorWin*)pWindow; + if( pSdNavigatorWin ) + pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if(pSdDrawDocShell) + bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj); + if(pNewEntry) + { + if(bMarked) + { + pNewEntry->SetMarked(sal_True); + } + else + { + pNewEntry->SetMarked( sal_False ); + } + } + } } else if (pObj->IsGroupObject()) { @@ -532,7 +747,7 @@ void SdPageObjsTLB::AddShapeList ( } else { - InsertEntry( + SvTreeListEntry *pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, @@ -541,6 +756,32 @@ void SdPageObjsTLB::AddShapeList ( LIST_APPEND, pObj ); + + if(bisInSdNavigatorWin) + { + Window* pWindow=NULL; + SdNavigatorWin* pSdNavigatorWin=NULL; + sd::DrawDocShell* pSdDrawDocShell = NULL; + if(pNewEntry) + pWindow=(Window*)GetParent(pNewEntry); + if(pWindow) + pSdNavigatorWin = (SdNavigatorWin*)pWindow; + if( pSdNavigatorWin ) + pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if(pSdDrawDocShell) + bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj); + if(pNewEntry) + { + if(bMarked) + { + pNewEntry->SetMarked(sal_True); + } + else + { + pNewEntry->SetMarked( sal_False ); + } + } + } } } } @@ -553,6 +794,22 @@ void SdPageObjsTLB::AddShapeList ( SetCollapsedEntryBmp( pEntry, bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs); + if (mbSaveTreeItemState) + { + vector::iterator iteStart = maTreeItem.begin(); + while (iteStart != maTreeItem.end()) + { + OUString strEntry = GetEntryText(pEntry); + if (*iteStart == strEntry) + { + Expand( pEntry ); + break; + } + ++iteStart; + } + } + else + Expand( pEntry ); } } @@ -876,6 +1133,60 @@ void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) DoubleClickHdl(); } + else if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE) + { + if(bisInSdNavigatorWin) + { + sal_Bool bMarked=sal_False; + SvTreeListEntry* pNewEntry = GetCurEntry(); + if( GetParent(pNewEntry) == NULL ) + return; + OUString aStr=GetSelectEntry(); + Window* pWindow=NULL; + SdNavigatorWin* pSdNavigatorWin=NULL; + sd::DrawDocShell* pSdDrawDocShell = NULL; + if(pNewEntry) + pWindow=(Window*)GetParent(pNewEntry); + if(pWindow) + pSdNavigatorWin = (SdNavigatorWin*)pWindow; + if( pSdNavigatorWin ) + pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if(pSdDrawDocShell) + { + pSdDrawDocShell->GotoTreeBookmark(aStr); + bMarked=pSdDrawDocShell->GetObjectIsmarked(aStr); + } + //Removed by yanjun for sym2_6385 + //The symphony2.0 can support morn than one level tree list, also support to select tow or more items in different level. + /* + SvTreeListEntry* pBeginEntry = First(); + if( pBeginEntry ) + { + if( GetParent(pBeginEntry) != GetParent(pNewEntry) ) + pBeginEntry->SetMarked( sal_False ); + SvTreeListEntry* pNextEntry = Next( pBeginEntry ); + while( pNextEntry ) + { + if( GetParent(pNextEntry) != GetParent(pNewEntry) ) + pNextEntry->SetMarked( sal_False ); + pNextEntry = Next( pNextEntry ); + } + } + End*/ + if(pNewEntry) + { + if(bMarked) + { + pNewEntry->SetMarked(sal_True); + } + else + { + pNewEntry->SetMarked( sal_False ); + } + } + Invalidate(); + } + } else SvTreeListBox::KeyInput( rKEvt ); } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 514d8fce88f5..b9a5a5c37dd8 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -75,6 +75,9 @@ #include "sdhtmlfilter.hxx" #include "framework/FrameworkHelper.hxx" +#include +#include "SdUnoDrawView.hxx" + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using ::sd::framework::FrameworkHelper; @@ -519,6 +522,20 @@ sal_Bool DrawDocShell::Save() */ sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium ) { + mpDoc->setDocAccTitle(OUString()); + SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this ); + if (pFrame1) + { + ::Window* pWindow = &pFrame1->GetWindow(); + if ( pWindow ) + { + ::Window* pSysWin = pWindow->GetSystemWindow(); + if ( pSysWin ) + { + pSysWin->SetAccessibleName(OUString()); + } + } + } mpDoc->StopWorkStartupDelay(); //TODO/LATER: why this?! @@ -829,6 +846,238 @@ sal_Bool DrawDocShell::GotoBookmark(const OUString& rBookmark) return (bFound); } +//If object is marked , return true , else return false . +sal_Bool DrawDocShell::IsMarked( SdrObject* pObject ) +{ + sal_Bool bisMarked =sal_False; + + if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + { + DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; + if (pObject ) + { + bisMarked = pDrViewSh->GetView()->IsObjMarked(pObject); + } + } + return bisMarked; +} +//If object is marked , return true , else return false . +sal_Bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark) +{ + OSL_TRACE("GotoBookmark %s", + OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); + sal_Bool bUnMark = sal_False; + + if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + { + DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; + + OUString aBookmark( rBookmark ); + + if( !rBookmark.isEmpty() && rBookmark[0] == sal_Unicode('#') ) + aBookmark = rBookmark.copy( 1 ); + + // Ist das Bookmark eine Seite? + sal_Bool bIsMasterPage; + sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); + SdrObject* pObj = NULL; + + if (nPgNum == SDRPAGE_NOTFOUND) + { + // Ist das Bookmark ein Objekt? + pObj = mpDoc->GetObj(aBookmark); + + if (pObj) + { + nPgNum = pObj->GetPage()->GetPageNum(); + } + } + + if (nPgNum != SDRPAGE_NOTFOUND) + { + /********************************************************** + * Zur Seite springen + **********************************************************/ + + SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum); + + PageKind eNewPageKind = pPage->GetPageKind(); + + if (eNewPageKind != pDrViewSh->GetPageKind()) + { + // Arbeitsbereich wechseln + GetFrameView()->SetPageKind(eNewPageKind); + ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? + mpViewShell->GetViewFrame() : SfxViewFrame::Current() )-> + GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); + + // Die aktuelle ViewShell hat sich geaendert! + pDrViewSh = (DrawViewShell*) mpViewShell; + } + + EditMode eNewEditMode = EM_PAGE; + + if( bIsMasterPage ) + { + eNewEditMode = EM_MASTERPAGE; + } + + if (eNewEditMode != pDrViewSh->GetEditMode()) + { + // EditMode setzen + pDrViewSh->ChangeEditMode(eNewEditMode, sal_False); + } + + // Jump to the page. This is done by using the API because this + // takes care of all the little things to be done. Especially + // writing the view data to the frame view (see bug #107803#). + sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; + SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( + *pDrViewSh, + *pDrViewSh->GetView()); + if (pUnoDrawView != NULL) + { + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage> xDrawPage ( + pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); + pUnoDrawView->setCurrentPage (xDrawPage); + } + else + { + // As a fall back switch to the page via the core. + DBG_ASSERT (pUnoDrawView!=NULL, + "SdDrawDocShell::GotoBookmark: can't switch page via API"); + pDrViewSh->SwitchPage(nSdPgNum); + } + delete pUnoDrawView; + + + if (pObj) + { + // Objekt einblenden und selektieren + pDrViewSh->MakeVisible(pObj->GetLogicRect(), + *pDrViewSh->GetActiveWindow()); + + bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj); + + + } + } + } + + return ( bUnMark); +} +//realize multi-selection of objects +sal_Bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark) +{ + OSL_TRACE("GotoBookmark %s", + OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); + sal_Bool bFound = sal_False; + + if (mpViewShell && mpViewShell->ISA(DrawViewShell)) + { + DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; + + OUString aBookmark( rBookmark ); + + if( !rBookmark.isEmpty() && rBookmark[0] == sal_Unicode('#') ) + aBookmark = rBookmark.copy( 1 ); + + // Ist das Bookmark eine Seite? + sal_Bool bIsMasterPage; + sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); + SdrObject* pObj = NULL; + + if (nPgNum == SDRPAGE_NOTFOUND) + { + // Ist das Bookmark ein Objekt? + pObj = mpDoc->GetObj(aBookmark); + + if (pObj) + { + nPgNum = pObj->GetPage()->GetPageNum(); + } + } + + if (nPgNum != SDRPAGE_NOTFOUND) + { + /********************************************************** + * Zur Seite springen + **********************************************************/ + bFound = sal_True; + SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum); + + PageKind eNewPageKind = pPage->GetPageKind(); + + if (eNewPageKind != pDrViewSh->GetPageKind()) + { + // Arbeitsbereich wechseln + GetFrameView()->SetPageKind(eNewPageKind); + ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? + mpViewShell->GetViewFrame() : SfxViewFrame::Current() )-> + GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); + + // Die aktuelle ViewShell hat sich geaendert! + pDrViewSh = (DrawViewShell*) mpViewShell; + } + + EditMode eNewEditMode = EM_PAGE; + + if( bIsMasterPage ) + { + eNewEditMode = EM_MASTERPAGE; + } + + if (eNewEditMode != pDrViewSh->GetEditMode()) + { + // EditMode setzen + pDrViewSh->ChangeEditMode(eNewEditMode, sal_False); + } + + // Jump to the page. This is done by using the API because this + // takes care of all the little things to be done. Especially + // writing the view data to the frame view (see bug #107803#). + sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; + SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( + *pDrViewSh, + *pDrViewSh->GetView()); + if (pUnoDrawView != NULL) + { + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage> xDrawPage ( + pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); + pUnoDrawView->setCurrentPage (xDrawPage); + } + else + { + // As a fall back switch to the page via the core. + DBG_ASSERT (pUnoDrawView!=NULL, + "SdDrawDocShell::GotoBookmark: can't switch page via API"); + pDrViewSh->SwitchPage(nSdPgNum); + } + delete pUnoDrawView; + + + if (pObj) + { + // Objekt einblenden und selektieren + pDrViewSh->MakeVisible(pObj->GetLogicRect(), + *pDrViewSh->GetActiveWindow()); + sal_Bool bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj); + pDrViewSh->GetView()->MarkObj(pObj, pDrViewSh->GetView()->GetSdrPageView(), bUnMark); + } + } + + SfxBindings& rBindings = ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? + mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings(); + + rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False); + rBindings.Invalidate(SID_NAVIGATOR_PAGENAME); + } + + return (bFound); +} + /** * If it should become a document template. */ @@ -955,6 +1204,42 @@ SfxDocumentInfoDialog* DrawDocShell::CreateDocumentInfoDialog( ::Window *pParent return pDlg; } +void DrawDocShell::setDocAccTitle( const OUString& rTitle ) +{ + if (mpDoc ) + { + mpDoc->setDocAccTitle( rTitle ); + } +} + +const OUString DrawDocShell::getDocAccTitle() const +{ + OUString sRet; + if (mpDoc) + { + sRet = mpDoc->getDocAccTitle(); + } + + return sRet; +} + +void DrawDocShell::setDocReadOnly( sal_Bool bReadOnly) +{ + if (mpDoc ) + { + mpDoc->setDocReadOnly( bReadOnly ); + } +} + +sal_Bool DrawDocShell::getDocReadOnly() const +{ + if (mpDoc) + { + return mpDoc->getDocReadOnly(); + } + + return sal_False; +} } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 0acb1ec4c03e..d19f9f87f750 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -426,10 +426,14 @@ sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt) // changeover to the next object if(!mpView->MarkNextObj( !aCode.IsShift() )) { - // No next object: go over open end and - // get first from the other side - mpView->UnmarkAllObj(); - mpView->MarkNextObj(!aCode.IsShift()); + //If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). + if ( mpView->GetMarkableObjCount() > 1 && mpView->AreObjectsMarked() ) + { + // No next object: go over open end and get first from + // the other side + mpView->UnmarkAllObj(); + mpView->MarkNextObj(!aCode.IsShift()); + } } if(mpView->AreObjectsMarked()) diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx index d00e190a07fe..690f59bd7baa 100644 --- a/sd/source/ui/func/fuediglu.cxx +++ b/sd/source/ui/func/fuediglu.cxx @@ -48,6 +48,10 @@ FuEditGluePoints::FuEditGluePoints ( SdDrawDocument* pDoc, SfxRequest& rReq) : FuDraw(pViewSh, pWin, pView, pDoc, rReq) + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the postion and draw the new insert point + ,bBeginInsertPoint(sal_False), + oldPoint(0,0) { } @@ -265,11 +269,105 @@ sal_Bool FuEditGluePoints::KeyInput(const KeyEvent& rKEvt) { mpView->SetActualWin( mpWindow ); - sal_Bool bReturn = FuDraw::KeyInput(rKEvt); + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the postion and draw the new insert point + + sal_Bool bReturn = sal_False; + + switch (rKEvt.GetKeyCode().GetCode()) + { + case KEY_UP: + case KEY_DOWN: + case KEY_LEFT: + case KEY_RIGHT: + { + if(rKEvt.GetKeyCode().IsShift()&& mpView->IsInsGluePointMode() ){ + long nX = 0; + long nY = 0; + sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + if (nCode == KEY_UP) + { + // Scroll nach oben + nX = 0; + nY =-1; + } + else if (nCode == KEY_DOWN) + { + // Scroll nach unten + nX = 0; + nY = 1; + } + else if (nCode == KEY_LEFT) + { + // Scroll nach links + nX =-1; + nY = 0; + } + else if (nCode == KEY_RIGHT) + { + // Scroll nach rechts + nX = 1; + nY = 0; + } + Point centerPoint; + Rectangle rect = mpView->GetMarkedObjRect(); + centerPoint = mpWindow->LogicToPixel(rect.Center()); + Point aPoint = bBeginInsertPoint? oldPoint:centerPoint; + Point ePoint = aPoint + Point(nX,nY); + mpWindow->SetPointerPosPixel(ePoint); + //simulate mouse move action + MouseEvent eMevt(ePoint,1,2,MOUSE_LEFT, 0); + MouseMove(eMevt); + Point aPix(eMevt.GetPosPixel()); + oldPoint = ePoint; + bBeginInsertPoint = sal_True; + bReturn = sal_True; + } + } + break; + case KEY_RETURN: + if(rKEvt.GetKeyCode().IsShift() && mpView->IsInsGluePointMode() ) + { + if(bBeginInsertPoint) + { + mpWindow->SetPointerPosPixel(oldPoint); + //simulate mouse button down action + MouseEvent aMevt(oldPoint,1,3,MOUSE_LEFT,KEY_SHIFT); + // MT IA2: Not used? + // sal_uInt16 ubuttons = aMevt.GetButtons(); + // sal_uInt16 uMod = aMevt.GetModifier(); + MouseButtonDown(aMevt); + mpWindow->CaptureMouse(); + //simulate mouse button up action + MouseEvent rMEvt(oldPoint+Point(0,0),1,17, MOUSE_LEFT, KEY_SHIFT); + MouseButtonUp(rMEvt); + bReturn= sal_True; + } + } + break; + } + + if(!bReturn) + bReturn = FuDraw::KeyInput(rKEvt); return bReturn; } +//Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, and +//SHIFT+ENTER key to decide the postion and draw the new insert point +void FuEditGluePoints::ForcePointer(const MouseEvent* pMEvt) +{ + if(bBeginInsertPoint && pMEvt) + { + MouseEvent aMEvt(pMEvt->GetPosPixel(), pMEvt->GetClicks(), + pMEvt->GetMode(), pMEvt->GetButtons(), pMEvt->GetModifier() & ~KEY_SHIFT); + FuDraw::ForcePointer(&aMEvt); + } + else + { + FuDraw::ForcePointer(pMEvt); + } +} sal_Bool FuEditGluePoints::Command(const CommandEvent& rCEvt) { diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 7e95f38b816f..b1cfce36733a 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -91,6 +91,11 @@ FuSelection::FuSelection ( bMirrorSide0(sal_False), nEditMode(SID_BEZIER_MOVE), pWaterCanCandidate(NULL) + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the postion and draw the new insert point + ,bBeginInsertPoint(sal_False), + oldPoint(0,0) + ,bMovedToCenterPoint(sal_False) { } @@ -907,8 +912,78 @@ sal_Bool FuSelection::KeyInput(const KeyEvent& rKEvt) bReturn = FuSelection::cancel(); } break; - } + //add keyboard operation for insert points in drawing curve + case KEY_UP: + case KEY_DOWN: + case KEY_LEFT: + case KEY_RIGHT: + { + if(rKEvt.GetKeyCode().IsShift()&&(nEditMode == SID_BEZIER_INSERT)){ + long nX = 0; + long nY = 0; + sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + if (nCode == KEY_UP) + { + // Scroll nach oben + nX = 0; + nY =-1; + } + else if (nCode == KEY_DOWN) + { + // Scroll nach unten + nX = 0; + nY = 1; + } + else if (nCode == KEY_LEFT) + { + // Scroll nach links + nX =-1; + nY = 0; + } + else if (nCode == KEY_RIGHT) + { + // Scroll nach rechts + nX = 1; + nY = 0; + } + Point centerPoint; + Rectangle rect = mpView->GetMarkedObjRect(); + centerPoint = mpWindow->LogicToPixel(rect.Center()); + Point aPoint = bMovedToCenterPoint? oldPoint:centerPoint; + Point ePoint = aPoint + Point(nX,nY); + mpWindow->SetPointerPosPixel(ePoint); + //simulate mouse move action + MouseEvent eMevt(ePoint,1,2, MOUSE_LEFT, 0); + MouseMove(eMevt); + oldPoint = ePoint; + bMovedToCenterPoint = sal_True; + bReturn = sal_True; + } + } + break; + case KEY_RETURN: + if(rKEvt.GetKeyCode().IsShift()&&(nEditMode == SID_BEZIER_INSERT)) + { + if(!bBeginInsertPoint) + { + //simulate mouse button down action + MouseEvent aMevt(oldPoint,1,3, MOUSE_LEFT, KEY_SHIFT); + MouseButtonDown(aMevt); + mpWindow->CaptureMouse(); + bBeginInsertPoint = sal_True; + } + else + { + //simulate mouse button up action + MouseEvent rMEvt(oldPoint,1,17, MOUSE_LEFT, KEY_SHIFT); + MouseButtonUp(rMEvt); + bBeginInsertPoint = sal_False; + } + bReturn= sal_True; + } + break; + } if (!bReturn) { bReturn = FuDraw::KeyInput(rKEvt); @@ -1425,6 +1500,21 @@ SdrObject* FuSelection::pickObject (const Point& rTestPoint) mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SDRSEARCH_PICKMARKABLE); return pObject; } + +void FuSelection::ForcePointer(const MouseEvent* pMEvt) +{ + if(bMovedToCenterPoint && !bBeginInsertPoint && pMEvt) + { + MouseEvent aMEvt(pMEvt->GetPosPixel(), pMEvt->GetClicks(), + pMEvt->GetMode(), pMEvt->GetButtons(), pMEvt->GetModifier() & ~KEY_SHIFT); + FuDraw::ForcePointer(&aMEvt); + } + else + { + FuDraw::ForcePointer(pMEvt); + } +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx index 602b5b47fe99..2ffee94af8c8 100644 --- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx +++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx @@ -34,6 +34,15 @@ #include #include +#include +#include "DrawViewShell.hxx" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "FrameView.hxx" +#include "PresentationViewShell.hxx" +#include +#include +class SdViewShell; namespace sd { class ViewShell; class Window; @@ -82,6 +91,8 @@ class AccessibleDocumentViewBase public ::com::sun::star::beans::XPropertyChangeListener, public ::com::sun::star::awt::XWindowListener, public ::com::sun::star::awt::XFocusListener + ,public ::com::sun::star::accessibility::XAccessibleExtendedAttributes + ,public com::sun::star::accessibility::XAccessibleGetAccFlowTo { public: //===== internal ======================================================== @@ -246,7 +257,10 @@ public: throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL focusLost (const ::com::sun::star::awt::FocusEvent& e) throw (::com::sun::star::uno::RuntimeException); - + //----------------------------xAttribute---------------------------- + virtual com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + ::sd::ViewShell* mpViewShell; private: // return the member maMutex; @@ -355,7 +369,18 @@ protected: virtual void SetAccessibleOLEObject ( const ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible>& xOLEObject); + //===== XAccessibleGetAccFromXShape ============================================ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ); + +public: + virtual void SwitchViewActivated (void) { Activated(); } + virtual sal_Int32 SAL_CALL getForeground( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) + throw (::com::sun::star::uno::RuntimeException); virtual void impl_dispose (void); }; diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx index 440f3ff4a639..e82275c252bc 100644 --- a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx +++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx @@ -22,6 +22,8 @@ #include "AccessibleDocumentViewBase.hxx" +#include + namespace accessibility { @@ -35,6 +37,7 @@ namespace accessibility { */ class AccessibleDrawDocumentView : public AccessibleDocumentViewBase + ,public ::com::sun::star::accessibility::XAccessibleGroupPosition { public: //===== internal ======================================================== @@ -69,6 +72,9 @@ public: throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); + virtual OUString SAL_CALL + getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException); //===== lang::XEventListener ============================================ @@ -82,6 +88,26 @@ public: virtual void SAL_CALL propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject) throw (::com::sun::star::uno::RuntimeException); + //===== XInterface ====================================================== + + virtual com::sun::star::uno::Any SAL_CALL + queryInterface (const com::sun::star::uno::Type & rType) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL + acquire (void) + throw (); + + virtual void SAL_CALL + release (void) + throw (); + + //===== XAccessibleGroupPosition ========================================= + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getGroupPosition( const ::com::sun::star::uno::Any& rAny ) + throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject ) + throw (::com::sun::star::uno::RuntimeException); protected: @@ -116,6 +142,8 @@ protected: virtual void implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +private: + ::sd::ViewShell* mpSdViewSh; protected: /** This object manages the shapes of the represented draw page. It is @@ -156,6 +184,13 @@ protected: virtual void impl_dispose (void); + //===== XAccessibleGetAccFromXShape ============================================ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetSelAccContextInTable(); + private: void UpdateAccessibleName (void); }; diff --git a/sd/source/ui/inc/AccessibleOutlineView.hxx b/sd/source/ui/inc/AccessibleOutlineView.hxx index 732ff4ba9b5f..237b32656d7b 100644 --- a/sd/source/ui/inc/AccessibleOutlineView.hxx +++ b/sd/source/ui/inc/AccessibleOutlineView.hxx @@ -71,7 +71,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException); - + virtual OUString SAL_CALL + getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException); //===== XAccessibleEventBroadcaster ======================================== virtual void SAL_CALL diff --git a/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx index dc935a71694d..b3b987dbb934 100644 --- a/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx +++ b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx @@ -23,6 +23,7 @@ #include +#include namespace accessibility { /** This class makes Impress shapes accessible. @@ -56,6 +57,8 @@ public: virtual OUString CreateAccessibleDescription () throw (::com::sun::star::uno::RuntimeException); + /// Return this object's role. + virtual sal_Int16 SAL_CALL getAccessibleRole () throw (::com::sun::star::uno::RuntimeException); }; } // end of namespace accessibility diff --git a/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx index ba5ccec2e9a6..df639a0f5dfa 100644 --- a/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx +++ b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx @@ -23,6 +23,7 @@ #include +#include namespace accessibility { /** This class makes Impress shapes accessible. @@ -56,6 +57,8 @@ public: virtual OUString CreateAccessibleDescription () throw (::com::sun::star::uno::RuntimeException); + /// Return this object's role. + virtual sal_Int16 SAL_CALL getAccessibleRole () throw (::com::sun::star::uno::RuntimeException); }; } // end of namespace accessibility diff --git a/sd/source/ui/inc/AccessiblePresentationShape.hxx b/sd/source/ui/inc/AccessiblePresentationShape.hxx index 4f651a47b4fc..860be7a44299 100644 --- a/sd/source/ui/inc/AccessiblePresentationShape.hxx +++ b/sd/source/ui/inc/AccessiblePresentationShape.hxx @@ -55,6 +55,7 @@ public: virtual OUString CreateAccessibleDescription () throw (::com::sun::star::uno::RuntimeException); + OUString GetStyle(); private: /** Don't use the default constructor. Use the public constructor that diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx index 6b539fd9a6db..3a231f045563 100644 --- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx +++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx @@ -290,7 +290,7 @@ public: getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); - + virtual void SwitchViewActivated (void); private: class Implementation; ::std::auto_ptr mpImpl; diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx index 4a839b0ba7ed..680684734dba 100644 --- a/sd/source/ui/inc/DrawController.hxx +++ b/sd/source/ui/inc/DrawController.hxx @@ -40,6 +40,7 @@ #include #include #include +#include namespace sd { @@ -92,6 +93,8 @@ public: PROPERTY_ZOOMVALUE = 7, PROPERTY_VIEWOFFSET = 8, PROPERTY_DRAWVIEWMODE = 9 + ,PROPERTY_UPDATEACC = 10 + ,PROPERTY_PAGE_CHANGE = 11 }; /** Create a new DrawController object for the given ViewShellBase. @@ -137,6 +140,12 @@ public: switch. */ void BroadcastContextChange (void) const; + void NotifyAccUpdate(); + void fireChangeLayer( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* pCurrentLayer ) throw(); + // change the parameter to int + //void fireSwitchCurrentPage( String pageName) throw(); + void fireSwitchCurrentPage( sal_Int32 pageIndex) throw(); + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* mpCurrentLayer; /** Return a pointer to the ViewShellBase object that the DrawController is connected to. diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index e4c7ee62fac4..5278fc6ec1ee 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -127,8 +127,12 @@ public: void Disconnect(sd::ViewShell* pViewSh); void UpdateTablePointers(); - sal_Bool GotoBookmark(const OUString& rBookmark); + sal_Bool GotoBookmark(const OUString& rBookmark); + //realize multi-selection of objects + sal_Bool GotoTreeBookmark(const OUString& rBookmark); + sal_Bool IsMarked( SdrObject* pObject ); + sal_Bool GetObjectIsmarked(const OUString& rBookmark); Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel); /** checks, if the given name is a valid new name for a slide @@ -218,6 +222,11 @@ protected: bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor void Construct(bool bClipboard); virtual void InPlaceActivate( sal_Bool bActive ); +public: + virtual void setDocAccTitle( const OUString& rTitle ); + virtual const OUString getDocAccTitle() const; + virtual void setDocReadOnly( sal_Bool bReadOnly); + virtual sal_Bool getDocReadOnly() const; }; #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 40a8702ec6ce..373a1d055687 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -243,10 +243,15 @@ public: void ResetActualPage(); void ResetActualLayer(); - sal_Bool SwitchPage(sal_uInt16 nPage); - sal_Bool IsSwitchPageAllowed() const; - - sal_Bool GotoBookmark(const OUString& rBookmark); + sal_Bool SwitchPage(sal_uInt16 nPage); + sal_Bool IsSwitchPageAllowed() const; + + sal_Bool GotoBookmark(const OUString& rBookmark); + //Realize multi-selection of objects, If object is marked, the + //corresponding entry is set true, else the corresponding entry is set + //false. + void FreshNavigatrEntry(); + void FreshNavigatrTree(); void MakeVisible(const Rectangle& rRect, ::Window& rWin); virtual void ReadFrameViewData(FrameView* pView); @@ -361,8 +366,10 @@ public: */ virtual bool RelocateToParentWindow (::Window* pParentWindow); - ::rtl::OUString GetSidebarContextName (void) const; + OUString GetSidebarContextName (void) const; + //move this method to ViewShell. + //void NotifyAccUpdate(); protected: DrawView* mpDrawView; SdPage* mpActualPage; diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx index c373a60d93d1..f3a02602dc1b 100644 --- a/sd/source/ui/inc/OutlineViewShell.hxx +++ b/sd/source/ui/inc/OutlineViewShell.hxx @@ -133,6 +133,8 @@ public: ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView (::sd::Window* pWindow); + OUString m_StrOldPageName; + /** Update the preview to show the specified page. */ virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False); diff --git a/sd/source/ui/inc/SdUnoDrawView.hxx b/sd/source/ui/inc/SdUnoDrawView.hxx index 4d10206b9369..71a018a0fcbc 100644 --- a/sd/source/ui/inc/SdUnoDrawView.hxx +++ b/sd/source/ui/inc/SdUnoDrawView.hxx @@ -102,14 +102,14 @@ protected: void setMasterPageMode(sal_Bool MasterPageMode_) throw(); sal_Bool getLayerMode(void) const throw(); void setLayerMode(sal_Bool LayerMode_) throw(); - +public: /** Return a reference to the active layer object. @return The returned value may be empty when the internal state of this view is not valid (like during destruction.) */ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> getActiveLayer (void) throw (); - +protected: /** Make the specified object the active layer. @param rxLayer The new layer object. diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index 7a802c59d1f8..dd0684241087 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -170,6 +170,8 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView (::sd::Window* pWindow); + // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase + virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ); SlideSorter& GetSlideSorter (void) const; diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx index 4f45c09f5348..da35355fde29 100644 --- a/sd/source/ui/inc/TabControl.hxx +++ b/sd/source/ui/inc/TabControl.hxx @@ -36,6 +36,8 @@ class TabControl public DragSourceHelper, public DropTargetHelper { + //declare bIsMarked variable + sal_uInt16 RrePageID; public: TabControl (DrawViewShell* pDrViewSh, ::Window* pParent); virtual ~TabControl (void); diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index b6103585f25e..33d956cfe135 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -301,6 +301,11 @@ public: ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView (::sd::Window* pWindow); + virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ); + virtual void SwitchActiveViewFireFocus( ); + // Move these two methods from DrawViewShell to enable slide show view + void NotifyAccUpdate(); + void fireSwitchCurrentPage(sal_Int32 pageIndex); void SetWinViewPos(const Point& rWinPos, bool bUpdate); Point GetWinViewPos() const; Point GetViewOrigin() const; diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index befd040e4126..4aa5fddc49b3 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -191,6 +191,7 @@ protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessible (void); + virtual void SwitchView(); OUString GetSurroundingText() const; Selection GetSurroundingTextSelection() const; diff --git a/sd/source/ui/inc/fuediglu.hxx b/sd/source/ui/inc/fuediglu.hxx index e30664132091..5eddb0bfba44 100644 --- a/sd/source/ui/inc/fuediglu.hxx +++ b/sd/source/ui/inc/fuediglu.hxx @@ -44,6 +44,12 @@ public: virtual void Activate(); virtual void Deactivate(); + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the postion and draw the new insert point + virtual void ForcePointer(const MouseEvent* pMEvt = NULL); +private: + sal_Bool bBeginInsertPoint; + Point oldPoint; protected: FuEditGluePoints ( ViewShell* pViewSh, diff --git a/sd/source/ui/inc/fusel.hxx b/sd/source/ui/inc/fusel.hxx index 658e751a237f..8334fc8341cc 100644 --- a/sd/source/ui/inc/fusel.hxx +++ b/sd/source/ui/inc/fusel.hxx @@ -63,6 +63,8 @@ public: */ virtual bool cancel(); + //let mouse cursor move + virtual void ForcePointer(const MouseEvent* pMEvt = NULL); protected: FuSelection (ViewShell* pViewSh, ::sd::Window* pWin, @@ -95,6 +97,12 @@ private: position then NULL is returned. */ SdrObject* pickObject (const Point& rTestPoint); + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the postion and draw the new insert point + sal_Bool bBeginInsertPoint; + Point oldPoint; + //let mouse cursor move + sal_Bool bMovedToCenterPoint; }; } // end of namespace sd diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index 1a0e59331c70..68d6bc95c283 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -156,6 +156,11 @@ private: virtual void DataChanged( const DataChangedEvent& rDCEvt ); void SetDragImage(); void ApplyImageList(); +public: + //when object is marked , fresh the corresponding entry tree . + sd::DrawDocShell* GetDrawDocShell(const SdDrawDocument*); + void FreshTree ( const SdDrawDocument* pDoc ); + void FreshEntry( ); }; diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 252a40384144..4200282d9aca 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -29,6 +29,8 @@ #include #include #include "sdxfer.hxx" +#include +using namespace std; #include #include @@ -60,6 +62,8 @@ private: static sal_Bool SAL_DLLPRIVATE bIsInDrag; ///< static, in the case the navigator is deleted in ExecuteDrag + // set contenttree in SdNavigatorWin + sal_Bool bisInSdNavigatorWin; public: // nested class to implement the TransferableHelper @@ -132,6 +136,9 @@ protected: ::sd::DrawDocShell* mpDropDocSh; SdNavigatorWin* mpDropNavWin; SfxViewFrame* mpFrame; + vector maTreeItem; + sal_Bool mbSaveTreeItemState; + OUString maSelectionEntryText; // DragSourceHelper virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); @@ -176,6 +183,7 @@ protected: using Window::GetDropTarget; virtual SvTreeListEntry* GetDropTarget (const Point& rLocation); + virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&,SvLBoxButtonKind); public: @@ -183,6 +191,10 @@ public: SdPageObjsTLB( Window* pParent, WinBits nStyle ); ~SdPageObjsTLB(); + // helper function for GetEntryAltText and GetEntryLongDescription + OUString getAltLongDescText( SvTreeListEntry* pEntry , sal_Bool isAltText) const; + OUString GetEntryAltText( SvTreeListEntry* pEntry ) const; + OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const; virtual void SelectHdl(); virtual void KeyInput( const KeyEvent& rKEvt ); @@ -193,11 +205,20 @@ public: void Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName ); void SetShowAllShapes (const bool bShowAllShapes, const bool bFill); bool GetShowAllShapes (void) const; - sal_Bool IsEqualToDoc( const SdDrawDocument* pInDoc = NULL ); - sal_Bool HasSelectedChildren( const OUString& rName ); - sal_Bool SelectEntry( const OUString& rName ); + sal_Bool IsEqualToDoc( const SdDrawDocument* pInDoc = NULL ); + sal_Bool HasSelectedChildren( const OUString& rName ); + sal_Bool SelectEntry( const OUString& rName ); OUString GetSelectEntry(); + //Mark Current Entry + void MarkCurEntry( const OUString& rName ); + void SetSdNavigatorWinFlag(sal_Bool isInSdNavigatorWin){bisInSdNavigatorWin =isInSdNavigatorWin;}; + void FreshCurEntry(); + + void Clear(); + void SetSaveTreeItemStateFlag(sal_Bool bState){mbSaveTreeItemState = bState;} + void SaveExpandedTreeItemState(SvTreeListEntry* pEntry, vector& vectTreeItem); + /** return selected entries nDepth == 0 -> pages nDepth == 1 -> objects */ @@ -205,7 +226,7 @@ public: std::vector GetSelectEntryList (const sal_uInt16 nDepth) const; SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = NULL); - ::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); } + ::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); } sal_Bool IsLinkableSelected() const { return mbLinkableSelected; } diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index 4fece11c240c..4138c19c7c8b 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -669,6 +669,28 @@ void ShowWindow::AddWindowToPaintView() GetChild( nChild )->Show( sal_True ); } +// Overload the sd::Window's CreateAccessible to create a different accessible object +::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + ShowWindow::CreateAccessible (void) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible(sal_False); + if (xAcc.get()) + { + return xAcc; + } + if (mpViewShell != NULL) + { + xAcc = mpViewShell->CreateAccessibleDocumentView (this); + SetAccessible(xAcc); + return xAcc; + } + else + { + OSL_TRACE ("::sd::Window::CreateAccessible: no view shell"); + return ::Window::CreateAccessible (); + } +} } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx index 5cf5f7ac2746..41c0c31506b0 100644 --- a/sd/source/ui/slideshow/showwindow.hxx +++ b/sd/source/ui/slideshow/showwindow.hxx @@ -78,6 +78,10 @@ public: virtual void MouseButtonDown(const MouseEvent& rMEvt); virtual void Paint(const Rectangle& rRect); virtual long Notify(NotifyEvent& rNEvt); + //Overload the sd::Window's CreateAccessible to create a different accessible object + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + CreateAccessible (void); void TerminateShow(); void RestartShow(); diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index b71cad6ab113..537711410b6f 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -811,6 +811,10 @@ void SAL_CALL SlideShow::end() throw(RuntimeException) } } } + //Fire the acc focus event when focus is switched back. The above method mpCurrentViewShellBase->GetWindow()->GrabFocus() will + //set focus to WorkWindow instead of the sd::window, so here call Shell's method to fire the focus event + if (pViewShell) + pViewShell->SwitchActiveViewFireFocus(); } mpCurrentViewShellBase = 0; } @@ -1038,6 +1042,8 @@ void SlideShow::activate( ViewShellBase& rBase ) if( mxController->startShow(mxCurrentSettings.get()) ) { pShell->Resize(); + // Defer the sd::ShowWindow's GrabFocus to here. so that the accessible event can be fired correctly. + pShell->GetActiveWindow()->GrabFocus(); } else { @@ -1213,6 +1219,11 @@ void SlideShow::StartInPlacePresentation() if( !bSuccess ) end(); + else + { + if(mpCurrentViewShellBase) + mpCurrentViewShellBase->GetWindow()->GrabFocus(); + } } } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 2630ef33a72d..7fcdd175c4b9 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1049,7 +1049,8 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) pBindings->Invalidate( SID_REHEARSE_TIMINGS ); } - mpShowWindow->GrabFocus(); + // Defer the sd::ShowWindow's GrabFocus to SlideShow::activate. so that the accessible event can be fired correctly. + //mpShowWindow->GrabFocus(); std::vector aProperties; aProperties.reserve( 4 ); @@ -1416,6 +1417,13 @@ void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects) pBindings->Invalidate( SID_NAVIGATOR_PAGENAME ); } } + // send out page change event and notity to update all acc info for current page + if (mpViewShell) + { + sal_Int32 currentPageIndex = getCurrentSlideIndex(); + mpViewShell->fireSwitchCurrentPage(currentPageIndex); + mpViewShell->NotifyAccUpdate(); + } } // --------------------------------------------------------- diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx index c4343f2614ef..e1eaa4b1feb5 100644 --- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx @@ -259,6 +259,9 @@ void FocusManager::HideFocusIndicator (const model::SharedPageDescriptor& rpDesc if (rpDescriptor.get() != NULL) { mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, false); + + // Hide focus should also fire the focus event, Currently, only accessibility add the focus listener + NotifyFocusChangeListeners(); } } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 319371bc97d7..1d7854166d2a 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -210,6 +210,10 @@ void SlideSorterViewShell::Init (bool bIsMainViewShell) { ViewShell::Init(bIsMainViewShell); + // since the updatePageList will show focus, the window.show() must be called ahead. This show is deferred from Init() + ::sd::Window* pActiveWindow = GetActiveWindow(); + if (pActiveWindow) + pActiveWindow->Show(); mpSlideSorter->GetModel().UpdatePageList(); if (mpContentWindow.get() != NULL) @@ -296,8 +300,17 @@ Reference SlideSorterViewShell::CreateSubController return xRet; } - - +void SlideSorterViewShell::SwitchViewFireFocus(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ) +{ + if (xAcc.get()) + { + ::accessibility::AccessibleSlideSorterView* pBase = static_cast< ::accessibility::AccessibleSlideSorterView* >(xAcc.get()); + if (pBase) + { + pBase->SwitchViewActivated(); + } + } +} SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const { diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index e71a0fa4ff39..8e68baf05ded 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -526,8 +526,43 @@ void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw() } } +void DrawController::NotifyAccUpdate() +{ + sal_Int32 nHandle = PROPERTY_UPDATEACC; + Any aNewValue, aOldValue; + fire (&nHandle, &aNewValue, &aOldValue, 1, sal_False); +} + +void DrawController::fireChangeLayer( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* pCurrentLayer ) throw() +{ + if( pCurrentLayer != mpCurrentLayer ) + { + sal_Int32 nHandle = PROPERTY_ACTIVE_LAYER; + + Any aNewValue (makeAny( *pCurrentLayer) ); + Any aOldValue ; + fire (&nHandle, &aNewValue, &aOldValue, 1, sal_False); + + mpCurrentLayer = pCurrentLayer; + } +} + +// This method is only called in slide show and outline view +//void DrawController::fireSwitchCurrentPage(String pageName ) throw() +void DrawController::fireSwitchCurrentPage(sal_Int32 pageIndex ) throw() +{ + Any aNewValue; + Any aOldValue; + //OUString aPageName( pageName ); + //aNewValue <<= aPageName ; + aNewValue <<= pageIndex; + + // Use new property to handle page change event + sal_Int32 nHandles = PROPERTY_PAGE_CHANGE; + fire( &nHandles, &aNewValue, &aOldValue, 1, sal_False ); +} void DrawController::FirePropertyChange ( sal_Int32 nHandle, @@ -729,6 +764,17 @@ void DrawController::FillPropertyTable ( PROPERTY_DRAWVIEWMODE, ::getCppuType((const ::com::sun::star::awt::Point*)0), beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID )); + // add new property to update current page's acc information + rProperties.push_back( + beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("UpdateAcc") ), + PROPERTY_UPDATEACC, + ::getCppuType((const sal_Int16*)0), + beans::PropertyAttribute::BOUND )); + rProperties.push_back( + beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("PageChange") ), + PROPERTY_PAGE_CHANGE, + ::getCppuType((const sal_Int16*)0), + beans::PropertyAttribute::BOUND )); } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 3701a1e2a7b1..d68bb7800ae0 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -515,6 +515,17 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) RestoreStartPosition (); mnStartPageIndex = (sal_uInt16)-1; } + + SfxChildWindow *pChildWin = + SfxViewFrame::Current()->GetChildWindow( + SvxSearchDialogWrapper::GetChildWindowId()); + if (pChildWin) + { + SvxSearchDialog* pSearchDlg = + ((SvxSearchDialog*)(pChildWin->GetWindow())); + pSearchDlg->SetDocWin( pViewShell->GetActiveWindow() ); + pSearchDlg->SetSrchFlag(); + } } else mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False ); diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index a0d0dc019ee2..eff3e14d70f7 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -64,6 +64,7 @@ #include +#include namespace sd { #define PIPETTE_RANGE 0 @@ -189,6 +190,12 @@ sal_Bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin) else { bRet = ViewShell::KeyInput(rKEvt, pWin); + //If object is marked , the corresponding entry is set true , else + //the corresponding entry is set false . + if(KEY_TAB == rKEvt.GetKeyCode().GetCode()) + { + FreshNavigatrTree(); + } } } @@ -231,6 +238,31 @@ void DrawViewShell::StartRulerDrag ( } } +//If object is marked , the corresponding entry is set true , +//else the corresponding entry is set false . +void DrawViewShell::FreshNavigatrEntry() +{ + sal_uInt16 nId = SID_NAVIGATOR; + SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId ); + if( pWindow ) + { + SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) ); + if( pNavWin ) + pNavWin->FreshEntry(); + } +} + +void DrawViewShell::FreshNavigatrTree() +{ + sal_uInt16 nId = SID_NAVIGATOR; + SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId ); + if( pWindow ) + { + SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) ); + if( pNavWin ) + pNavWin->FreshTree( GetDoc() ); + } +} void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) @@ -251,6 +283,9 @@ void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt, { ViewShell::MouseButtonDown(rMEvt, pWin); + //If object is marked , the corresponding entry is set true , + //else the corresponding entry is set false . + FreshNavigatrTree(); if ( mbPipette ) ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked(); } @@ -402,6 +437,9 @@ void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) } else ViewShell::MouseButtonUp(rMEvt, pWin); + //If object is marked , the corresponding entry is set true , + //else the corresponding entry is set false . + FreshNavigatrTree(); } } diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 674485591401..dbefd03303af 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -606,6 +606,12 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex) // Tell the draw view and the tab control of the new active layer. mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex))); pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex)); + SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( + *this, + *GetView()); + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer(); + GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer ); + delete pUnoDrawView; } } } diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index f7878572fd54..94a5d040347a 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -214,6 +214,8 @@ OutlineViewShell::OutlineViewShell ( SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText)); + m_StrOldPageName = OUString(); + doShow(); } @@ -1385,6 +1387,12 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) sal_Int32 nIndex = aLayoutStr.indexOf(SD_LT_SEPARATOR); if (nIndex != -1) aLayoutStr = aLayoutStr.copy(0, nIndex); + //Now, CurrentPage property change is already sent for DrawView and OutlineView, so it is not necessary to send again here + if(m_StrOldPageName!=aPageStr) + { + GetViewShellBase().GetDrawController().fireSwitchCurrentPage(nPos); + m_StrOldPageName = aPageStr; + } } rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) ); rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) ); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index fdcd2b125796..a8ddedf67c83 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -39,6 +39,8 @@ #include "AccessibleDrawDocumentView.hxx" #include "WindowUpdater.hxx" +#include + namespace sd { #define SCROLL_LINE_FACT 0.05 ///< factor for line scrolling @@ -1031,8 +1033,22 @@ void Window::DropScroll(const Point& rMousePos) ::com::sun::star::accessibility::XAccessible> Window::CreateAccessible (void) { + // If current viewshell is PresentationViewShell, just return empty because the correct ShowWin will be created later. + if (mpViewShell && mpViewShell->ISA(PresentationViewShell)) + { + return ::Window::CreateAccessible (); + } + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible(sal_False); + if (xAcc.get()) + { + return xAcc; + } if (mpViewShell != NULL) - return mpViewShell->CreateAccessibleDocumentView (this); + { + xAcc = mpViewShell->CreateAccessibleDocumentView (this); + SetAccessible(xAcc); + return xAcc; + } else { OSL_TRACE ("::sd::Window::CreateAccessible: no view shell"); @@ -1040,6 +1056,17 @@ void Window::DropScroll(const Point& rMousePos) } } +// MT: Removed Windows::SwitchView() introduced with IA2 CWS. +// There are other notifications for this when the active view has chnaged, so +// please update the code to use that event mechanism +void Window::SwitchView() +{ + if (mpViewShell) + { + mpViewShell->SwitchViewFireFocus(GetAccessible(sal_False)); + } +} + OUString Window::GetSurroundingText() const { if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 0dec8d62bf2a..84f170e862f3 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -79,6 +79,7 @@ TabControl::TabControl(DrawViewShell* pViewSh, Window* pParent) : TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE | WB_DRAG) ), DragSourceHelper( this ), DropTargetHelper( this ), + RrePageID(1), pDrViewSh(pViewSh), bInternalMove(sal_False) { @@ -110,6 +111,10 @@ void TabControl::MouseButtonDown(const MouseEvent& rMEvt) Point aPos = PixelToLogic( rMEvt.GetPosPixel() ); sal_uInt16 aPageId = GetPageId(aPos); + //initialize + if(RrePageID!=aPageId) + pDrViewSh->FreshNavigatrEntry(); + RrePageID=aPageId; if (aPageId == 0) { SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index d19b099ffcfe..cb0924591b5c 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -79,6 +79,7 @@ #include #include #include +#include "AccessibleDocumentViewBase.hxx" namespace sd { namespace ui { namespace table { extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView ); @@ -435,6 +436,7 @@ sal_Bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) bReturn = (sal_Bool)GetViewShell()->KeyInput(rKEvt); } + sal_Int32 OriCount = GetView()->GetMarkedObjectList().GetMarkCount(); if(!bReturn) { rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); @@ -464,6 +466,12 @@ sal_Bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) } } } + sal_Int32 EndCount = GetView()->GetMarkedObjectList().GetMarkCount(); + // Here, oriCount or endCount must have one value=0, another value > 0, then to switch focus between Document and shape objects + if(bReturn && (OriCount + EndCount > 0) && (OriCount * EndCount == 0)) + { + SwitchActiveViewFireFocus(); + } if(!bReturn && GetActiveWindow()) { @@ -1527,6 +1535,33 @@ bool ViewShell::RelocateToParentWindow (::Window* pParentWindow) return true; } +void ViewShell::SwitchViewFireFocus(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ) +{ + if (xAcc.get()) + { + ::accessibility::AccessibleDocumentViewBase* pBase = static_cast< ::accessibility::AccessibleDocumentViewBase* >(xAcc.get()); + if (pBase) + { + pBase->SwitchViewActivated(); + } + } +} +void ViewShell::SwitchActiveViewFireFocus() +{ + if (mpContentWindow) + { + SwitchViewFireFocus(mpContentWindow->GetAccessible(sal_False)); + } +} +// move these two methods from DrawViewShell. +void ViewShell::fireSwitchCurrentPage(sal_Int32 pageIndex) +{ + GetViewShellBase().GetDrawController().fireSwitchCurrentPage(pageIndex); +} +void ViewShell::NotifyAccUpdate( ) +{ + GetViewShellBase().GetDrawController().NotifyAccUpdate(); +} } // end of namespace sd -- cgit v1.2.3