Return-Path: X-Original-To: apmail-openoffice-commits-archive@www.apache.org Delivered-To: apmail-openoffice-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A0FFE10EC5 for ; Wed, 27 Nov 2013 17:33:42 +0000 (UTC) Received: (qmail 59661 invoked by uid 500); 27 Nov 2013 17:28:21 -0000 Delivered-To: apmail-openoffice-commits-archive@openoffice.apache.org Received: (qmail 59431 invoked by uid 500); 27 Nov 2013 17:28:03 -0000 Mailing-List: contact commits-help@openoffice.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openoffice.apache.org Delivered-To: mailing list commits@openoffice.apache.org Received: (qmail 59231 invoked by uid 99); 27 Nov 2013 17:27:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 17:27:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 17:27:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 03DA32388C8A; Wed, 27 Nov 2013 17:26:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1546124 [19/33] - in /openoffice/branches/alg/aw080: ./ main/ main/accessibility/inc/accessibility/extended/ main/accessibility/inc/accessibility/helper/ main/accessibility/inc/accessibility/standard/ main/accessibility/source/extended/ ma... Date: Wed, 27 Nov 2013 17:25:54 -0000 To: commits@openoffice.apache.org From: alg@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131127172629.03DA32388C8A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.cxx Wed Nov 27 17:25:40 2013 @@ -50,6 +50,14 @@ #include +//IAccessibility2 Implementation 2009----- +#include +#include +#include +#include +#include "acctable.hxx" +//-----IAccessibility2 Implementation 2009 + using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::rtl::OUString; @@ -91,6 +99,10 @@ void SwAccessibleCell::GetStates( ::utl: DBG_ASSERT( pVSh, "no shell?" ); if( dynamic_cast< const SwCrsrShell* >(pVSh) ) rStateSet.AddState( AccessibleStateType::SELECTABLE ); + //IAccessibility2 Implementation 2009----- + //Solution:Add resizable state to table cell. + rStateSet.AddState( AccessibleStateType::RESIZABLE ); + //-----IAccessibility2 Implementation 2009 // SELECTED if( IsSelected() ) @@ -105,6 +117,7 @@ void SwAccessibleCell::GetStates( ::utl: SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap, const SwCellFrm *pCellFrm ) : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm ) + , aSelectionHelper( *this ) , bIsSelected( sal_False ) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -112,6 +125,13 @@ SwAccessibleCell::SwAccessibleCell( SwAc SetName( sBoxName ); bIsSelected = IsSelected(); + + //IAccessibility2 Implementation 2009----- + //Need not assign the pointer of accessible table object to m_pAccTable, + //for it already done in SwAccessibleCell::GetTable(); Former codes: + //m_pAccTable= GetTable(); + GetTable(); + //-----IAccessibility2 Implementation 2009 } sal_Bool SwAccessibleCell::_InvalidateMyCursorPos() @@ -132,9 +152,16 @@ sal_Bool SwAccessibleCell::_InvalidateMy } sal_Bool bChanged = bOld != bNew; + //IAccessibility2 Implementation 2009----- if( bChanged ) + { FireStateChangedEvent( AccessibleStateType::SELECTED, bNew ); - + if (m_pAccTable) + { + m_pAccTable->AddSelectionCell(this,bNew); + } + } + //-----IAccessibility2 Implementation 2009 return bChanged; } @@ -158,8 +185,10 @@ sal_Bool SwAccessibleCell::_InvalidateCh { ASSERT( xAccImpl->GetFrm()->IsCellFrm(), "table child is not a cell frame" ) - bChanged |= static_cast< SwAccessibleCell *>( + //IAccessibility2 Implementation 2009----- + bChanged = static_cast< SwAccessibleCell *>( xAccImpl.getBodyPtr() )->_InvalidateMyCursorPos(); + //-----IAccessibility2 Implementation 2009 } else bChanged = sal_True; // If the context is not know we @@ -180,6 +209,22 @@ sal_Bool SwAccessibleCell::_InvalidateCh void SwAccessibleCell::_InvalidateCursorPos() { + //IAccessibility2 Implementation 2009----- + if (IsSelected()) + { + const SwAccessibleChild aChild( GetChild( *(GetMap()), 0 ) ); + if( aChild.IsValid() && aChild.GetSwFrm() ) + { + ::vos::ORef < SwAccessibleContext > xChildImpl( GetMap()->GetContextImpl( aChild.GetSwFrm()) ); + if(xChildImpl.isValid()) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::STATE_CHANGED; + aEvent.NewValue<<=AccessibleStateType::FOCUSED; + xChildImpl->FireAccessibleEvent( aEvent ); + } + } + } const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() ); ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" ); @@ -189,6 +234,8 @@ void SwAccessibleCell::_InvalidateCursor while( pTabFrm ) { + _InvalidateChildrenCursorPos( pTabFrm ); +/* sal_Bool bChanged = _InvalidateChildrenCursorPos( pTabFrm ); if( bChanged ) { @@ -201,9 +248,14 @@ void SwAccessibleCell::_InvalidateCursor xAccImpl->FireAccessibleEvent( aEvent ); } } - +*/ pTabFrm = pTabFrm->GetFollow(); } + if (m_pAccTable) + { + m_pAccTable->FireSelectionEvent(); + } + //-----IAccessibility2 Implementation 2009 } sal_Bool SwAccessibleCell::HasCursor() @@ -274,6 +326,21 @@ void SwAccessibleCell::InvalidatePosOrSi uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType ) throw( uno::RuntimeException ) { + //IAccessibility2 Implementation 2009----- + if (rType == ::getCppuType((const uno::Reference*)0)) + { + uno::Any aR; + aR <<= uno::Reference(this); + return aR; + } + + if (rType == ::getCppuType((const uno::Reference*)0)) + { + uno::Any aR; + aR <<= uno::Reference(this); + return aR; + } + //-----IAccessibility2 Implementation 2009 if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) ) { uno::Reference xValue = this; @@ -327,7 +394,8 @@ SwFrmFmt* SwAccessibleCell::GetTblBoxFor return pCellFrm->GetTabBox()->GetFrmFmt(); } - +//IAccessibility2 Implementation 2009----- +//Implement TableCell currentValue uno::Any SwAccessibleCell::getCurrentValue( ) throw( uno::RuntimeException ) { @@ -335,9 +403,33 @@ uno::Any SwAccessibleCell::getCurrentVal CHECK_FOR_DEFUNC( XAccessibleValue ); uno::Any aAny; - aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue(); + + const SwCellFrm* pCellFrm = static_cast( GetFrm() ); + const SwStartNode *pSttNd = pCellFrm->GetTabBox()->GetSttNd(); + if( pSttNd ) + { + ::rtl::OUString strRet; + SwNodeIndex aCntntIdx( *pSttNd, 0 ); + SwCntntNode* pCNd=NULL; + for(int nIndex = 0 ; + 0 != ( pCNd = pSttNd->GetNodes().GoNext( &aCntntIdx ) ) && + aCntntIdx.GetIndex() < pSttNd->EndOfSectionIndex(); + ++nIndex ) + { + if(pCNd && pCNd->IsTxtNode()) + { + if (0 != nIndex) + { + strRet += ::rtl::OUString::createFromAscii(" "); + } + strRet +=((SwTxtNode*)pCNd)->GetTxt(); + } + } + aAny <<= strRet; + } return aAny; } +//-----IAccessibility2 Implementation 2009 sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber ) throw( uno::RuntimeException ) @@ -370,3 +462,133 @@ uno::Any SwAccessibleCell::getMinimumVal aAny <<= -DBL_MAX; return aAny; } + +//IAccessibility2 Implementation 2009----- +::rtl::OUString ReplaceOneChar(::rtl::OUString oldOUString, ::rtl::OUString replacedChar, ::rtl::OUString replaceStr) +{ + int iReplace = -1; + iReplace = oldOUString.lastIndexOf(replacedChar); + if (iReplace > -1) + { + for(;iReplace>-1;) + { + oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr); + iReplace=oldOUString.lastIndexOf(replacedChar,iReplace); + } + } + return oldOUString; +} +::rtl::OUString ReplaceFourChar(::rtl::OUString oldOUString) +{ + oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("\\"),OUString::createFromAscii("\\\\")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(";"),::rtl::OUString::createFromAscii("\\;")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("="),::rtl::OUString::createFromAscii("\\=")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(","),::rtl::OUString::createFromAscii("\\,")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(":"),::rtl::OUString::createFromAscii("\\:")); + return oldOUString; +} + +::com::sun::star::uno::Any SAL_CALL SwAccessibleCell::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any strRet; + SwFrmFmt *pFrmFmt = GetTblBoxFormat(); + DBG_ASSERT(pFrmFmt,"Must be Valid"); + + const SwTblBoxFormula& tbl_formula = pFrmFmt->GetTblBoxFormula(); + + ::rtl::OUString strFormula = ReplaceFourChar(tbl_formula.GetFormula()); + ::rtl::OUString strFor = ::rtl::OUString::createFromAscii("Formula:"); + strFor += strFormula; + strFor += ::rtl::OUString::createFromAscii(";") ; + strRet <<= strFor; + + return strRet; +} + +sal_Int32 SAL_CALL SwAccessibleCell::getBackground() + throw (::com::sun::star::uno::RuntimeException) +{ + const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground(); + sal_uInt32 crBack = rBack.GetColor().GetColor(); + + if (COL_AUTO == crBack) + { + uno::Reference xAccDoc = getAccessibleParent(); + if (xAccDoc.is()) + { + uno::Reference xCompoentDoc(xAccDoc, uno::UNO_QUERY); + if (xCompoentDoc.is()) + { + crBack = (sal_uInt32)xCompoentDoc->getBackground(); + } + } + } + return crBack; +} + +//===== XAccessibleSelection ============================================ +void SwAccessibleCell::selectAccessibleChild( + sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + aSelectionHelper.selectAccessibleChild(nChildIndex); +} + +sal_Bool SwAccessibleCell::isAccessibleChildSelected( + sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + return aSelectionHelper.isAccessibleChildSelected(nChildIndex); +} + +void SwAccessibleCell::clearAccessibleSelection( ) + throw ( uno::RuntimeException ) +{ + aSelectionHelper.clearAccessibleSelection(); +} + +void SwAccessibleCell::selectAllAccessibleChildren( ) + throw ( uno::RuntimeException ) +{ + aSelectionHelper.selectAllAccessibleChildren(); +} + +sal_Int32 SwAccessibleCell::getSelectedAccessibleChildCount( ) + throw ( uno::RuntimeException ) +{ + return aSelectionHelper.getSelectedAccessibleChildCount(); +} + +uno::Reference SwAccessibleCell::getSelectedAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex); +} + +void SwAccessibleCell::deselectAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + aSelectionHelper.deselectAccessibleChild(nSelectedChildIndex); +} + +SwAccessibleTable *SwAccessibleCell::GetTable() +{ + if (!m_pAccTable) + { + if (!xTableReference.is()) + { + xTableReference = getAccessibleParent(); + #ifdef OSL_DEBUG_LEVEL + uno::Reference xContextTable(xTableReference, uno::UNO_QUERY); + OSL_ASSERT(xContextTable.is() && xContextTable->getAccessibleRole() == AccessibleRole::TABLE); + #endif + //SwAccessibleTable aTable = *(static_cast(xTable.get())); + } + m_pAccTable = static_cast(xTableReference.get()); + } + return m_pAccTable; +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acccell.hxx Wed Nov 27 17:25:40 2013 @@ -26,13 +26,27 @@ #include "acccontext.hxx" #include +//IAccessibility2 Implementation 2009----- +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_ +#include +#endif + +#ifndef _ACCSELECTIONHELPER_HXX_ +#include +#endif +//-----IAccessibility2 Implementation 2009 + class SwCellFrm; +class SwAccessibleTable; class SwFrmFmt; class SwAccessibleCell : public SwAccessibleContext, - ::com::sun::star::accessibility::XAccessibleValue - + ::com::sun::star::accessibility::XAccessibleValue, + ::com::sun::star::accessibility::XAccessibleSelection, + public ::com::sun::star::accessibility::XAccessibleExtendedAttributes { + // Implementation for XAccessibleSelection interface + SwAccessibleSelectionHelper aSelectionHelper; sal_Bool bIsSelected; // protected by base class mutex sal_Bool IsSelected(); @@ -110,6 +124,11 @@ public: //===== XAccessibleValue ================================================ + //===== XAccessibleExtendedAttributes ================================================ + //IAccessibility2 Implementation 2009----- + ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + //-----IAccessibility2 Implementation 2009 private: SwFrmFmt* GetTblBoxFormat() const; @@ -126,6 +145,41 @@ public: virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); + //IAccessibility2 Implementation 2009----- + //===== XAccessibleComponent ============================================ + sal_Int32 SAL_CALL getBackground() + throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleSelection ============================================ + virtual void SAL_CALL selectAccessibleChild( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isAccessibleChildSelected( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL clearAccessibleSelection( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL selectAllAccessibleChildren( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL deselectAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + SwAccessibleTable *GetTable(); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTableReference; + SwAccessibleTable *m_pAccTable; + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.cxx Wed Nov 27 17:25:40 2013 @@ -60,6 +60,11 @@ #include #include #include +//IAccessibility2 Implementation 2009----- +#ifndef _ACCPARA_HXX +#include "accpara.hxx" +#endif +//-----IAccessibility2 Implementation 2009 #include using namespace sw::access; @@ -215,8 +220,11 @@ void SwAccessibleContext::ChildrenScroll " - always included child not considered!" ); const SwFrm* pLower( rLower.GetSwFrm() ); ::vos::ORef< SwAccessibleContext > xAccImpl = - GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction || - SCROLLED_IN == eAction ); + //IAccessibility2 Implementation 2009----- + //O is: GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction || + // SCROLLED_IN == eAction ); + GetMap()->GetContextImpl( pLower, sal_True ); + //-----IAccessibility2 Implementation 2009 if( xAccImpl.isValid() ) { switch( eAction ) @@ -247,10 +255,15 @@ void SwAccessibleContext::ChildrenScroll ASSERT( !rLower.AlwaysIncludeAsChild(), " - always included child not considered!" ); ::vos::ORef< ::accessibility::AccessibleShape > xAccImpl = + //IAccessibility2 Implementation 2009----- + //O is: GetMap()->GetContextImpl( rLower.GetSdrObject(), + // this, + // SCROLLED_OUT == eAction || + // SCROLLED_IN == eAction ); GetMap()->GetContextImpl( rLower.GetDrawObject(), this, - SCROLLED_OUT == eAction || - SCROLLED_IN == eAction ); + sal_True ); + //-----IAccessibility2 Implementation 2009 if( xAccImpl.isValid() ) { switch( eAction ) @@ -270,8 +283,11 @@ void SwAccessibleContext::ChildrenScroll xAccImpl->ViewForwarderChanged( ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA, GetMap() ); - DisposeShape( rLower.GetDrawObject(), - xAccImpl.getBodyPtr() ); + //IAccessibility2 Implementation 2009----- + //Remove + //DisposeShape( rLower.GetDrawObject(), + // xAccImpl.getBodyPtr() ); + //-----IAccessibility2 Implementation 2009 } break; case NONE: @@ -380,8 +396,11 @@ void SwAccessibleContext::ScrolledOut( c // the child event. In this case no listener will exist. FireStateChangedEvent( AccessibleStateType::SHOWING, sal_False ); + //IAccessibility2 Implementation 2009----- + //Remove Dispose When scrolledout // We now dispose the frame - Dispose( sal_True ); + // Dispose( sal_True ); + //-----IAccessibility2 Implementation 2009 } // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates> @@ -517,8 +536,14 @@ void SwAccessibleContext::GetStates( // EDITABLE if( bIsEditableState ) + //IAccessibility2 Implementation 2009----- + //Solution:Set editable state to graphic and other object when the document is editable + { rStateSet.AddState( AccessibleStateType::EDITABLE ); - + rStateSet.AddState( AccessibleStateType::RESIZABLE ); + rStateSet.AddState( AccessibleStateType::MOVEABLE ); + } + //-----IAccessibility2 Implementation 2009 // ENABLED rStateSet.AddState( AccessibleStateType::ENABLED ); @@ -554,6 +579,12 @@ SwAccessibleContext::SwAccessibleContext , nRole( nR ) , bDisposing( sal_False ) , bRegisteredAtAccessibleMap( true ) + //IAccessibility2 Implementation 2009----- + //Solution:Initialize the begin document load and IfAsynLoad to true + , bBeginDocumentLoad( sal_True ) + , isIfAsynLoad( sal_True ) + , bIsSeletedInDoc( sal_False) + //-----IAccessibility2 Implementation 2009 { InitStates(); DBG_MSG_CD( "constructed" ) @@ -581,6 +612,11 @@ sal_Int32 SAL_CALL SwAccessibleContext:: vos::OGuard aGuard(Application::GetSolarMutex()); CHECK_FOR_DEFUNC( XAccessibleContext ) + //IAccessibility2 Implementation 2009----- + //Solution:Notify the frame is a document + if( nRole == AccessibleRole::DOCUMENT ) + bIsAccDocUse = sal_True; + //-----IAccessibility2 Implementation 2009 return bDisposing ? 0 : GetChildCount( *(GetMap()) ); } @@ -593,6 +629,12 @@ uno::Reference< XAccessible> SAL_CALL CHECK_FOR_DEFUNC( XAccessibleContext ) + //IAccessibility2 Implementation 2009----- + //Solution:Notify the frame is a document + if( nRole == AccessibleRole::DOCUMENT ) + bIsAccDocUse = sal_True; + //-----IAccessibility2 Implementation 2009 + const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) ); if( !aChild.IsValid() ) { @@ -608,6 +650,26 @@ uno::Reference< XAccessible> SAL_CALL { ::vos::ORef < SwAccessibleContext > xChildImpl( GetMap()->GetContextImpl( aChild.GetSwFrm(), !bDisposing ) ); + //IAccessibility2 Implementation 2009----- + //Solution:Send out accessible event when begin load. + if( bBeginDocumentLoad && nRole == AccessibleRole::DOCUMENT ) + { + + FireStateChangedEvent( AccessibleStateType::FOCUSABLE,sal_True ); + FireStateChangedEvent( AccessibleStateType::BUSY,sal_True ); + if( !isIfAsynLoad ) + { + FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True ); + // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent + // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True ); + FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True ); + FireStateChangedEvent( AccessibleStateType::BUSY,sal_False ); + // MT: OFFSCREEN again? + // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False ); + } + bBeginDocumentLoad = sal_False; + } + //-----IAccessibility2 Implementation 2009 if( xChildImpl.isValid() ) { xChildImpl->SetParent( this ); @@ -717,6 +779,11 @@ uno::Reference SAL_ ::utl::AccessibleStateSetHelper *pStateSet = new ::utl::AccessibleStateSetHelper; + //IAccessibility2 Implementation 2009----- + if( bIsSeletedInDoc ) + pStateSet->AddState( AccessibleStateType::SELECTED ); + //-----IAccessibility2 Implementation 2009 + uno::Reference xStateSet( pStateSet ); GetStates( *pStateSet ); @@ -988,13 +1055,15 @@ uno::Any SAL_CALL SwAccessibleContext::g sal_Int32 SAL_CALL SwAccessibleContext::getForeground() throw (uno::RuntimeException) { - return 0; + //IAccessibility2 Implementation 2009----- + return COL_BLACK; + //-----IAccessibility2 Implementation 2009 } sal_Int32 SAL_CALL SwAccessibleContext::getBackground() throw (uno::RuntimeException) { - return 0xffffff; + return COL_WHITE; } @@ -1041,6 +1110,12 @@ void SwAccessibleContext::DisposeShape( void SwAccessibleContext::ScrolledInShape( const SdrObject* , ::accessibility::AccessibleShape *pAccImpl ) { + //IAccessibility2 Implementation 2009----- + if(NULL == pAccImpl) + { + return ; + } + //-----IAccessibility2 Implementation 2009 AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::CHILD; uno::Reference< XAccessible > xAcc( pAccImpl ); @@ -1184,7 +1259,10 @@ void SwAccessibleContext::InvalidatePosO SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() ) { // The frame is now invisible -> dispose it - Dispose( sal_True ); + //IAccessibility2 Implementation 2009----- + //Remove + //Dispose( sal_True ); + //-----IAccessibility2 Implementation 2009 } else { @@ -1585,3 +1663,15 @@ void lcl_SwAccessibleContext_DbgMsg( SwA aStrm.Flush(); } #endif +//IAccessibility2 Implementation 2009----- +sal_Bool SwAccessibleContext::SetSelectedState(sal_Bool bSeleted) +{ + if(bIsSeletedInDoc != bSeleted) + { + bIsSeletedInDoc = bSeleted; + FireStateChangedEvent( AccessibleStateType::SELECTED, bSeleted ); + return sal_True; + } + return sal_False; +}; +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acccontext.hxx Wed Nov 27 17:25:40 2013 @@ -98,6 +98,10 @@ private: // <-- void InitStates(); + //IAccessibility2 Implementation 2009----- + //Solution:Add a member to identify the firt time that document load + sal_Bool bBeginDocumentLoad; + //-----IAccessibility2 Implementation 2009 protected: void SetName( const ::rtl::OUString& rName ) { sName = rName; } @@ -105,7 +109,12 @@ protected: { return nRole; } - + //IAccessibility2 Implementation 2009----- + //Solution:Add a member to identify if the document is Asyn load. + sal_Bool isIfAsynLoad; + //This flag is used to mark the object's selected state. + sal_Bool bIsSeletedInDoc; + //-----IAccessibility2 Implementation 2009 void SetParent( SwAccessibleContext *pParent ); ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetWeakParent() const; @@ -172,6 +181,9 @@ protected: public: + //IAccessibility2 Implementation 2009----- + void SetMap(SwAccessibleMap *pM){pMap = pM;} + //-----IAccessibility2 Implementation 2009 void FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventObject& rEvent ); protected: @@ -415,12 +427,15 @@ public: { return Select( 0, pObj, bAdd ); } + //IAccessibility2 Implementation 2009----- + //This method is used to updated the selected state and fire the selected state changed event. + virtual sal_Bool SetSelectedState(sal_Bool bSeleted); + sal_Bool IsSeletedInDoc(){ return bIsSeletedInDoc; } + //-----IAccessibility2 Implementation 2009 static ::rtl::OUString GetResource( sal_uInt16 nResId, const ::rtl::OUString *pArg1 = 0, const ::rtl::OUString *pArg2 = 0 ); - - }; // some heaviliy used exception support Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.cxx Wed Nov 27 17:25:40 2013 @@ -45,6 +45,30 @@ #endif #include +//IAccessibility2 Implementation 2009----- +#include +#include +#include +#include "unostyle.hxx" +#include "viewsh.hxx" +#include "docsh.hxx" +#include +#include "fesh.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +//-----IAccessibility2 Implementation 2009 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView"; const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView"; @@ -178,8 +202,17 @@ sal_Int32 SAL_CALL SwAccessibleDocumentB for( sal_Int32 i=0; i < nCount; i++ ) { - if( xAcc->getAccessibleChild( i ) == xThis ) - return i; + //IAccessibility2 Implementation 2009----- + try + { + if( xAcc->getAccessibleChild( i ) == xThis ) + return i; + } + catch(::com::sun::star::lang::IndexOutOfBoundsException e) + { + return -1L; + } + //-----IAccessibility2 Implementation 2009 } return -1L; } @@ -190,20 +223,62 @@ OUString SAL_CALL SwAccessibleDocumentBa return GetResource( STR_ACCESS_DOC_DESC ); } -awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds() - throw (uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - - Window *pWin = GetWindow(); +//IAccessibility2 Implementation 2009----- +OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName (void) + throw (::com::sun::star::uno::RuntimeException) +{ + OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING ); + SwDoc *pDoc = GetShell()->GetDoc(); + if ( pDoc ) + { + OUString sFileName = pDoc->getDocAccTitle(); + if ( !sFileName.getLength() ) + { + SwDocShell* pDocSh = pDoc->GetDocShell(); + if ( pDocSh ) + { + sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME ); + } + } + OUString sReadOnly; + if(pDoc->getDocReadOnly()) + { + sReadOnly = GetResource( STR_ACCESS_DOC_WORDPROCESSING_READONLY ); + } - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if ( sFileName.getLength() ) + { + sAccName = sFileName + sReadOnly + OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sAccName; + } + } - Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) ); - awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(), - aPixBounds.GetWidth(), aPixBounds.GetHeight() ); + return sAccName; +} +//-----IAccessibility2 Implementation 2009 - return aBox; +awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds() + throw (uno::RuntimeException) +{ + //IAccessibility2 Implementation 2009----- + try + { + vos::OGuard aGuard(Application::GetSolarMutex()); + + Window *pWin = GetWindow(); + + CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + + Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) ); + awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(), + aPixBounds.GetWidth(), aPixBounds.GetHeight() ); + + return aBox; + } + catch(::com::sun::star::lang::IndexOutOfBoundsException e) + { + return awt::Rectangle(); + } + //-----IAccessibility2 Implementation 2009 } @@ -303,6 +378,9 @@ void SwAccessibleDocument::GetStates( // MULTISELECTABLE rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE ); + //IAccessibility2 Implementation 2009----- + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + //-----IAccessibility2 Implementation 2009 } @@ -424,6 +502,24 @@ uno::Any SwAccessibleDocument::queryInte uno::Reference aSelect = this; aRet <<= aSelect; } + //IAccessibility2 Implementation 2009----- + //Solution:Add XEventListener interface support. + else if ( (rType == ::getCppuType((uno::Reference *)NULL)) ) + { + uno::Reference aSelect = this; + aRet <<= aSelect; + } + else if ( rType == ::getCppuType((uno::Reference *)NULL) ) + { + uno::Reference aAttribute = this; + aRet <<= aAttribute; + } + else if(rType == ::getCppuType((uno::Reference *)NULL) ) + { + uno::Reference AccFlowTo = this; + aRet <<= AccFlowTo; + } + //-----IAccessibility2 Implementation 2009 else aRet = SwAccessibleContext::queryInterface( rType ); return aRet; @@ -436,11 +532,16 @@ uno::Sequence< uno::Type > SAL_CALL SwAc uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() ); sal_Int32 nIndex = aTypes.getLength(); - aTypes.realloc( nIndex + 1 ); + //IAccessibility2 Implementation 2009----- + //Solution:Reset types memory alloc + //aTypes.realloc( nIndex + 1 ); + aTypes.realloc( nIndex + 2 ); uno::Type* pTypes = aTypes.getArray(); pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ); - + //Solution:Add XEventListener interface support. + pTypes[nIndex + 1 ] = ::getCppuType( static_cast< uno::Reference< com::sun::star::document::XEventListener > * >( 0 ) ); + //-----IAccessibility2 Implementation 2009 return aTypes; } @@ -510,3 +611,418 @@ void SwAccessibleDocument::deselectAcces { maSelectionHelper.deselectAccessibleChild( nChildIndex ); } +//IAccessibility2 Implementation 2009----- +//Solution:Implement XEventListener interfaces +void SAL_CALL SwAccessibleDocument::notifyEvent( const ::com::sun::star::document::EventObject& Event ) + throw (::com::sun::star::uno::RuntimeException) +{ + if ( Event.EventName.equalsAscii( "FirstPageShows" ) ) + { + FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True ); + } + else if ( Event.EventName.equalsAscii( "LoadFinished" ) ) + { + // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent + // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True ); + // MT: LoadFinished => Why not SHOWING == TRUE? + FireStateChangedEvent( AccessibleStateType::SHOWING,sal_False ); + } + else if ( Event.EventName.equalsAscii( "FormatFinished" ) ) + { + FireStateChangedEvent( AccessibleStateType::BUSY,sal_False ); + // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False ); + FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True ); + } + else + { + isIfAsynLoad = sal_False; + } +} + +void SAL_CALL SwAccessibleDocument::disposing( const ::com::sun::star::lang::EventObject& ) + throw (::com::sun::star::uno::RuntimeException) +{ +} + +uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Any anyAtrribute; + SwDoc *pDoc = GetShell()->GetDoc(); + + if (!pDoc) + return anyAtrribute; + SwCrsrShell* pCrsrShell = GetCrsrShell(); + if( !pCrsrShell ) + return anyAtrribute; + + SwFEShell* pFEShell = dynamic_cast< SwFEShell* >(pCrsrShell); + rtl::OUString sAttrName; + rtl::OUString sValue; + sal_uInt16 nPage, nLogPage; + String sDisplay; + + if( pFEShell ) + { + pFEShell->GetPageNumber(-1,sal_True,nPage,nLogPage,sDisplay); + sAttrName = rtl::OUString::createFromAscii("page-name:"); + + + sValue = sAttrName + sDisplay ; + sAttrName = rtl::OUString::createFromAscii(";page-number:"); + sValue += sAttrName; + sValue += String::CreateFromInt32( nPage ) ; + sAttrName = rtl::OUString::createFromAscii(";total-pages:"); + sValue += sAttrName; + sValue += String::CreateFromInt32( pCrsrShell->GetPageCnt() ) ; + sValue += rtl::OUString::createFromAscii(";"); + + + sAttrName=rtl::OUString::createFromAscii("line-number:"); + + + + SwCntntFrm* pCurrFrm = pCrsrShell->GetCurrFrm(); + SwPageFrm* pCurrPage=((SwFrm*)pCurrFrm)->FindPageFrm(); + sal_uLong nLineNum = 0; + //IAccessibility2 Implementation 2009----- + SwTxtFrm* pTxtFrm = NULL; + SwTxtFrm* pCurrTxtFrm = NULL; + pTxtFrm = static_cast< SwTxtFrm* >(static_cast< SwPageFrm* > (pCurrPage)->ContainsCntnt()); + if (pCurrFrm->IsInFly())//such as, graphic,chart + { + SwFlyFrm *pFlyFrm = pCurrFrm->FindFlyFrm(); + const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor(); + RndStdIds eAnchorId = rAnchor.GetAnchorId(); + if(eAnchorId == FLY_AS_CHAR) + { + const SwFrm *pSwFrm = pFlyFrm->GetAnchorFrm(); + if(pSwFrm->IsTxtFrm()) + pCurrTxtFrm = ((SwTxtFrm*)(pSwFrm)); + } + } + else + pCurrTxtFrm = static_cast< SwTxtFrm* >(pCurrFrm); + //check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer + SwFrm* pFrm = pCurrTxtFrm; + while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) + pFrm = pFrm->GetUpper(); + if ( pFrm ) + pCurrTxtFrm = NULL; + //check shape + if(pCrsrShell->Imp()->GetDrawView()) + { + const SdrObjectVector aSdrObjectVector(pCrsrShell->Imp()->GetDrawView()->getSelectedSdrObjectVectorFromSdrMarkView()); + + for(sal_uInt32 i(0); i < aSdrObjectVector.size(); ++i ) + { + SdrObject* pObj = aSdrObjectVector[i]; + + // replace formally used 'GetUserCall()' by new notify/listener mechanism + const SwDrawContact* pContact = static_cast< const SwDrawContact* >(findConnectionToSdrObject(pObj)); + + const SwFrmFmt* pFmt = pContact->GetFmt(); + const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); + if( FLY_AS_CHAR != rAnchor.GetAnchorId() ) + pCurrTxtFrm = NULL; + } + } + //calculate line number + if (pCurrTxtFrm && pTxtFrm) + { + if (!(pCurrTxtFrm->IsInTab() || pCurrTxtFrm->IsInFtn())) + { + while( pTxtFrm != pCurrTxtFrm ) + { + //check header/footer + pFrm = pTxtFrm; + while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) + pFrm = pFrm->GetUpper(); + if ( pFrm ) + { + pTxtFrm = static_cast< SwTxtFrm*>(pTxtFrm->GetNextCntntFrm()); + continue; + } + if (!(pTxtFrm->IsInTab() || pTxtFrm->IsInFtn() || pTxtFrm->IsInFly())) + nLineNum += pTxtFrm->GetThisLines(); + pTxtFrm = static_cast< SwTxtFrm* >(pTxtFrm ->GetNextCntntFrm()); + } + SwPaM* pCaret = pCrsrShell->GetCrsr(); + if (!pCurrTxtFrm->IsEmpty() && pCaret) + { + sal_uInt16 nActPos = 0; + if (pCurrTxtFrm->IsTxtFrm()) + { + const SwPosition* pPoint = NULL; + if(pCurrTxtFrm->IsInFly()) + { + SwFlyFrm *pFlyFrm = pCurrTxtFrm->FindFlyFrm(); + const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor(); + pPoint= rAnchor.GetCntntAnchor(); + } + else + pPoint = pCaret->GetPoint(); + nActPos = pPoint->nContent.GetIndex(); + nLineNum += pCurrTxtFrm->GetLineCount( nActPos ); + } + else//graphic, form, shape, etc. + { + SwPosition* pPoint = pCaret->GetPoint(); + Point aPt = pCrsrShell->_GetCrsr()->GetPtPos(); + if( pCrsrShell->GetLayout()->GetCrsrOfst( pPoint, aPt/*,* &eTmpState*/ ) ) + { + nActPos = pPoint->nContent.GetIndex(); + nLineNum += pCurrTxtFrm->GetLineCount( nActPos ); + } + } + } + else + ++nLineNum; + } + } + //-----IAccessibility2 Implementation 2009 + + sValue += sAttrName; + sValue += String::CreateFromInt32( nLineNum ) ; + + sValue += rtl::OUString::createFromAscii(";"); + + + SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm(); + + sAttrName=rtl::OUString::createFromAscii("column-number:"); + sValue += sAttrName; + + sal_uInt16 nCurrCol = 1; + if(pCurrCol!=NULL) + { + //SwLayoutFrm* pParent = pCurrCol->GetUpper(); + SwFrm* pCurrPageCol=((SwFrm*)pCurrFrm)->FindColFrm(); + while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrm()) + { + pCurrPageCol = pCurrPageCol->GetUpper(); + } + + SwLayoutFrm* pParent = (SwLayoutFrm*)(pCurrPageCol->GetUpper()); + + if(pParent!=NULL) + { + SwFrm* pCol = pParent->Lower(); + while(pCol&&(pCol!=pCurrPageCol)) + { + pCol = pCol->GetNext(); + nCurrCol +=1; + } + } + } + sValue += String::CreateFromInt32( nCurrCol ) ; + sValue += rtl::OUString::createFromAscii(";"); + + sAttrName=rtl::OUString::createFromAscii("total-columns:"); + + const SwFmtCol &rFmtCol=pCurrPage->GetAttrSet()->GetCol(); + sal_uInt16 nColCount=rFmtCol.GetNumCols(); + nColCount = nColCount>0?nColCount:1; + sValue += sAttrName; + sValue += String::CreateFromInt32( nColCount ) ; + + sValue += rtl::OUString::createFromAscii(";"); + + if(pCurrFrm!=NULL) + { + SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm(); + if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL ) + { + sAttrName = rtl::OUString::createFromAscii("section-name:"); + + sValue += sAttrName; + String sectionName = pCurrSctFrm->GetSection()->GetSectionName(); + + sectionName.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" )); + sectionName.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) ); + sectionName.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) ); + sectionName.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) ); + sectionName.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) ); + + sValue += sectionName; + //sValue += pCurrSctFrm->GetSection()->GetName(); + + sValue += rtl::OUString::createFromAscii(";"); + + //section-columns-number + { + sAttrName=rtl::OUString::createFromAscii("section-columns-number:"); + + nCurrCol = 1; + + if(pCurrCol!=NULL) + { + SwLayoutFrm* pParent = pCurrCol->GetUpper(); + if(pParent!=NULL) + { + SwFrm* pCol = pParent->Lower(); + while(pCol&&(pCol!=pCurrCol)) + { + pCol = pCol->GetNext(); + nCurrCol +=1; + } + } + } + sValue += sAttrName; + sValue += String::CreateFromInt32( nCurrCol ) ; + sValue += rtl::OUString::createFromAscii(";"); + } + + //section-total-columns + { + sAttrName=rtl::OUString::createFromAscii("section-total-columns:"); + const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol(); + sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols(); + nSctColCount = nSctColCount>0?nSctColCount:1; + sValue += sAttrName; + sValue += String::CreateFromInt32( nSctColCount ) ; + + sValue += rtl::OUString::createFromAscii(";"); + } + } + } + anyAtrribute <<= sValue; + } + return anyAtrribute; +} + +sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() + throw (::com::sun::star::uno::RuntimeException) +{ + //IAccessibility2 Implementation 2009----- + vos::OGuard aGuard(Application::GetSolarMutex()); + return SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor; + //-----IAccessibility2 Implementation 2009 +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL SwAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ) +{ + const sal_Int32 FORSPELLCHECKFLOWTO = 1; + const sal_Int32 FORFINDREPLACEFLOWTO = 2; + SwAccessibleMap* pAccMap = GetMap(); + if ( !pAccMap ) + { + goto Rt; + } + + if ( nType == FORSPELLCHECKFLOWTO ) + { + uno::Reference< ::com::sun::star::drawing::XShape > xShape; + rAny >>= xShape; + if( xShape.is() ) + { + SdrObject* pObj = GetSdrObjectFromXShape(xShape); + if( pObj ) + { + uno::Reference xAcc = pAccMap->GetContext(pObj, this, sal_False); + uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); + if ( xAccSelection.is() ) + { + try + { + 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; + } + } + } + } + } + catch ( com::sun::star::lang::IndexOutOfBoundsException ) + { + //return empty sequence + goto Rt; + } + //end of try...catch + } + /*uno::Sequence< uno::Any > aRet(1); + aRet[0] = uno::makeAny( xAcc ); + return aRet;*/ + } + } + else + { + uno::Reference< XAccessible > xAcc = pAccMap->GetCursorContext(); + SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); + if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Sequence< uno::Any > aRet(1); + aRet[0] = uno::makeAny( xAcc ); + return aRet; + } + } + } + else if ( nType == FORFINDREPLACEFLOWTO ) + { + SwCrsrShell* pCrsrShell = GetCrsrShell(); + if ( pCrsrShell ) + { + SwPaM *_pStartCrsr = pCrsrShell->GetCrsr(), *__pStartCrsr = _pStartCrsr; + SwCntntNode* pPrevNode = NULL; + std::vector vFrmList; + do + { + if ( _pStartCrsr && _pStartCrsr->HasMark() ) + { + SwCntntNode* pCntntNode = _pStartCrsr->GetCntntNode(); + if ( pCntntNode == pPrevNode ) + { + continue; + } + SwFrm* pFrm = pCntntNode ? pCntntNode->getLayoutFrm( pCrsrShell->GetLayout() ) : NULL; + if ( pFrm ) + { + vFrmList.push_back( pFrm ); + } + + pPrevNode = pCntntNode; + } + } + + while( _pStartCrsr && ( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr) ); + + if ( vFrmList.size() ) + { + uno::Sequence< uno::Any > aRet(vFrmList.size()); + std::vector::iterator aIter = vFrmList.begin(); + for ( sal_Int32 nIndex = 0; aIter != vFrmList.end(); aIter++, nIndex++ ) + { + uno::Reference< XAccessible > xAcc = pAccMap->GetContext(*aIter, sal_False); + if ( xAcc.is() ) + { + SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); + if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + aRet[nIndex] = uno::makeAny( xAcc ); + } + } + } + + return aRet; + } + } + } + +Rt: + uno::Sequence< uno::Any > aEmpty; + return aEmpty; +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accdoc.hxx Wed Nov 27 17:25:40 2013 @@ -26,8 +26,19 @@ #include "acccontext.hxx" #endif #include +//IAccessibility2 Implementation 2009----- +#include #include +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_ +#include +#endif + +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_ +#include +#endif +//-----IAccessibility2 Implementation 2009 + class VclSimpleEvent; /** @@ -81,6 +92,9 @@ public: /// Return this object's description. virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException); + //IAccessibility2 Implementation 2009----- + virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException); + //-----IAccessibility2 Implementation 2009 //===== XAccessibleComponent ============================================== virtual sal_Bool SAL_CALL containsPoint( @@ -111,7 +125,12 @@ public: * access to an accessible Writer document */ class SwAccessibleDocument : public SwAccessibleDocumentBase, - public com::sun::star::accessibility::XAccessibleSelection + public com::sun::star::accessibility::XAccessibleSelection, + //IAccessibility2 Implementation 2009----- + public com::sun::star::document::XEventListener, + public com::sun::star::accessibility::XAccessibleExtendedAttributes, + //-----IAccessibility2 Implementation 2009 + public com::sun::star::accessibility::XAccessibleGetAccFlowTo { // Implementation for XAccessibleSelection interface SwAccessibleSelectionHelper maSelectionHelper; @@ -129,6 +148,13 @@ public: SwAccessibleDocument( SwAccessibleMap* pInitMap ); DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); + //IAccessibility2 Implementation 2009----- + //===== XEventListener==================================================== + virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event ) + throw (::com::sun::star::uno::RuntimeException); + //-----IAccessibility2 Implementation 2009 //===== XServiceInfo ==================================================== @@ -199,10 +225,23 @@ public: throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + //IAccessibility2 Implementation 2009----- + virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; //====== thread safe C++ interface ======================================== // The object is not visible an longer and should be destroyed virtual void Dispose( sal_Bool bRecursive = sal_False ); + + //===== XAccessibleComponent ============================================ + sal_Int32 SAL_CALL getBackground() + throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleGetAccFlowTo ============================================ + ::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 ); + //-----IAccessibility2 Implementation 2009 }; #endif Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.cxx Wed Nov 27 17:25:40 2013 @@ -31,6 +31,14 @@ #include #include #include "accembedded.hxx" +//IAccessibility2 Implementation 2009----- +#include "cntfrm.hxx" +#include "ndole.hxx" +#include +#include +#include <../../ui/inc/wrtsh.hxx> +#include <../../ui/inc/view.hxx> +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -51,6 +59,34 @@ SwAccessibleEmbeddedObject::~SwAccessibl { } +//IAccessibility2 Implementation 2009----- +//===== XInterface ========================================================== +com::sun::star::uno::Any SAL_CALL + SwAccessibleEmbeddedObject::queryInterface (const com::sun::star::uno::Type & rType) + throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType); + if ( ! aReturn.hasValue()) + aReturn = ::cppu::queryInterface (rType, + static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this) ); + return aReturn; +} + +void SAL_CALL + SwAccessibleEmbeddedObject::acquire (void) + throw () +{ + SwAccessibleNoTextFrame::acquire (); +} + +void SAL_CALL + SwAccessibleEmbeddedObject::release (void) + throw () +{ + SwAccessibleNoTextFrame::release (); +} +//-----IAccessibility2 Implementation 2009 + OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName() throw( uno::RuntimeException ) { @@ -91,3 +127,31 @@ uno::Sequence< sal_Int8 > SAL_CALL SwAcc } return aId; } +//IAccessibility2 Implementation 2009----- +//===== XAccessibleExtendedAttributes ======================================================== +::com::sun::star::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any strRet; + ::rtl::OUString style; + SwFlyFrm* pFFrm = getFlyFrm(); + + if( pFFrm ) + { + style = ::rtl::OUString::createFromAscii("style:"); + SwCntntFrm* pCFrm; + pCFrm = pFFrm->ContainsCntnt(); + if( pCFrm ) + { + SwCntntNode* pCNode = pCFrm->GetNode(); + if( pCNode ) + { + style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString(); + } + } + style += ::rtl::OUString::createFromAscii(";"); + } + strRet <<= style; + return strRet; +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accembedded.hxx Wed Nov 27 17:25:40 2013 @@ -24,7 +24,12 @@ #define _ACCEMBEDDED_HXX #include "accnotextframe.hxx" -class SwAccessibleEmbeddedObject : public SwAccessibleNoTextFrame +//IAccessibility2 Implementation 2009----- +#include +//-----IAccessibility2 Implementation 2009 +class SwAccessibleEmbeddedObject : public SwAccessibleNoTextFrame + , public ::com::sun::star::accessibility::XAccessibleExtendedAttributes + { protected: @@ -36,6 +41,21 @@ public: SwAccessibleEmbeddedObject( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm ); + //IAccessibility2 Implementation 2009----- + //===== 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 (); + //-----IAccessibility2 Implementation 2009 //===== XServiceInfo ==================================================== /** Returns an identifier for the implementation of this object. @@ -59,6 +79,12 @@ public: //===== XTypeProvider ==================================================== virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + //IAccessibility2 Implementation 2009----- + // ====== XAccessibleExtendedAttributes ===================================== + virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.cxx Wed Nov 27 17:25:40 2013 @@ -55,7 +55,6 @@ const sal_Char sImplementationNameEndnot SwAccessibleFootnote::SwAccessibleFootnote( SwAccessibleMap* pInitMap, sal_Bool bIsEndnote, - sal_Int32 nFootEndNote, const SwFtnFrm *pFtnFrm ) : SwAccessibleContext( pInitMap, bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE, @@ -65,7 +64,19 @@ SwAccessibleFootnote::SwAccessibleFootno sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME : STR_ACCESS_FOOTNOTE_NAME; - OUString sArg( OUString::valueOf( nFootEndNote ) ); + //IAccessibility2 Implementation 2009----- + //OUString sArg( OUString::valueOf( nFootEndNote ) ); + //old codes end + OUString sArg; + const SwTxtFtn *pTxtFtn = + static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr(); + if( pTxtFtn ) + { + const SwDoc *pDoc = GetShell()->GetDoc(); + sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc ); + } + //-----IAccessibility2 Implementation 2009 + SetName( GetResource( nResId, &sArg ) ); } Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfootnote.hxx Wed Nov 27 17:25:40 2013 @@ -41,7 +41,6 @@ public: SwAccessibleFootnote( SwAccessibleMap* pInitMap, sal_Bool bIsEndnote, - sal_Int32 nFootEndNote, const SwFtnFrm *pFtnFrm ); Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.cxx Wed Nov 27 17:25:40 2013 @@ -61,7 +61,9 @@ using namespace sw::access; { sal_Int32 nCount = 0; - const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap ); + // const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap ); + const SwAccessibleChildSList aVisList( pFrm->PaintArea(), *pFrm, rAccMap ); + SwAccessibleChildSList::const_iterator aIter( aVisList.begin() ); while( aIter != aVisList.end() ) { @@ -163,7 +165,10 @@ using namespace sw::access; if( SwAccessibleChildMap::IsSortingRequired( rFrm ) ) { // We need a sorted list here - const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); + //IAccessibility2 Implementation 2009----- + // const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); + const SwAccessibleChildMap aVisMap( rFrm.PaintArea(), rFrm, rAccMap ); + //-----IAccessibility2 Implementation 2009 SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() ); while( aIter != aVisMap.end() && !bFound ) { @@ -189,7 +194,12 @@ using namespace sw::access; { // The unsorted list is sorted enough, because it return lower // frames in the correct order. - const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap ); + + //IAccessibility2 Implementation 2009----- + // const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap ); + const SwAccessibleChildSList aVisList( rFrm.PaintArea(), rFrm, rAccMap ); + //-----IAccessibility2 Implementation 2009 + SwAccessibleChildSList::const_iterator aIter( aVisList.begin() ); while( aIter != aVisList.end() && !bFound ) { @@ -425,7 +435,8 @@ SwAccessibleFrame::SwAccessibleFrame( co sal_Bool bIsPagePreview ) : maVisArea( rVisArea ), mpFrm( pF ), - mbIsInPagePreview( bIsPagePreview ) + mbIsInPagePreview( bIsPagePreview ), + bIsAccDocUse( sal_False ) { } Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accframe.hxx Wed Nov 27 17:25:40 2013 @@ -52,8 +52,9 @@ protected: static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap, const SwRect& rVisArea, const SwFrm *pFrm, - sal_Bool bInPagePreview ); -private: + sal_Bool bInPagePreviewr ); + +// private: static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap, const SwRect& rVisArea, const SwFrm& rFrm, @@ -104,6 +105,12 @@ protected: const SwFrm *pFrm, sal_Bool bIsPagePreview ); virtual ~SwAccessibleFrame(); + + //IAccessibility2 Implementation 2009----- + // MT: Move to private area? + sal_Bool bIsAccDocUse; + //-----IAccessibility2 Implementation 2009 + public: // Return the SwFrm this context is attached to. Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.cxx Wed Nov 27 17:25:40 2013 @@ -42,6 +42,26 @@ #include "accmap.hxx" #include "accframebase.hxx" +//IAccessibility2 Implementation 2009----- +#ifndef _CRSRSH_HXX +#include +#endif +#ifndef _FESH_HXX +#include "fesh.hxx" +#endif +#ifndef _TXTFRM_HXX +#include +#endif +#ifndef _NDTXT_HXX +#include +#endif +#ifndef _DCONTACT_HXX +#include +#endif +#ifndef _FMTANCHR_HXX +#include +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::rtl::OUString; @@ -94,6 +114,10 @@ void SwAccessibleFrameBase::GetStates( if( pWin && pWin->HasFocus() ) rStateSet.AddState( AccessibleStateType::FOCUSED ); } + //IAccessibility2 Implementation 2009----- + if( GetSelectedState() ) + rStateSet.AddState( AccessibleStateType::SELECTED ); + //-----IAccessibility2 Implementation 2009 } @@ -167,20 +191,26 @@ void SwAccessibleFrameBase::_InvalidateC Window *pWin = GetWindow(); if( pWin && pWin->HasFocus() && bNewSelected ) FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected ); - FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected ); + //IAccessibility2 Implementation 2009----- + //FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected ); if( pWin && pWin->HasFocus() && !bNewSelected ) FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected ); - - uno::Reference< XAccessible > xParent( GetWeakParent() ); - if( xParent.is() ) + if(bNewSelected) { - SwAccessibleContext *pAcc = - static_cast ( xParent.get() ); - - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; - pAcc->FireAccessibleEvent( aEvent ); + uno::Reference< XAccessible > xParent( GetWeakParent() ); + if( xParent.is() ) + { + SwAccessibleContext *pAcc = + static_cast ( xParent.get() ); + + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; + uno::Reference< XAccessible > xChild(this); + aEvent.NewValue <<= xChild; + pAcc->FireAccessibleEvent( aEvent ); + } } + //-----IAccessibility2 Implementation 2009 } } @@ -248,13 +278,13 @@ void SwAccessibleFrameBase::Modify( cons break; case RES_OBJECTDYING: // mba: it seems that this class intentionally does not call code in base class SwClient - if( GetRegisteredIn() == - static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) + if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) ) GetRegisteredInNonConst()->Remove( this ); break; case RES_FMT_CHG: - if( static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() && + if( pOld && + static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() && static_cast< const SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() ) GetRegisteredInNonConst()->Remove( this ); break; @@ -274,3 +304,123 @@ void SwAccessibleFrameBase::Dispose( sal SwAccessibleContext::Dispose( bRecursive ); } +//IAccessibility2 Implementation 2009----- +//Get the selection cursor of the document. +SwPaM* SwAccessibleFrameBase::GetCrsr() +{ + // get the cursor shell; if we don't have any, we don't have a + // cursor/selection either + SwPaM* pCrsr = NULL; + SwCrsrShell* pCrsrShell = GetCrsrShell(); + if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() ) + { + SwFEShell *pFESh = dynamic_cast< SwFEShell* >(pCrsrShell); + if( !pFESh || + !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) ) + { + // get the selection, and test whether it affects our text node + pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ ); + } + } + + return pCrsr; +} +//Return the selected state of the object. +//when the object's anchor are in the selection cursor, we should return true. +sal_Bool SwAccessibleFrameBase::GetSelectedState( ) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + + //IAccessibility2 Implementation 2009----- + if(GetMap()->IsDocumentSelAll()) + { + return sal_True; + } + //-----IAccessibility2 Implementation 2009 + + // SELETED. + SwFlyFrm* pFlyFrm = getFlyFrm(); + const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt(); + const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor(); + const SwPosition *pPos = pAnchor.GetCntntAnchor(); + if( !pPos ) + return sal_False; + int pIndex = pPos->nContent.GetIndex(); + if( pPos->nNode.GetNode().GetTxtNode() ) + { + SwPaM* pCrsr = GetCrsr(); + if( pCrsr != NULL ) + { + const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode(); + sal_uLong nHere = pNode->GetIndex(); + + // iterate over ring + SwPaM* pRingStart = pCrsr; + do + { + // ignore, if no mark + if( pCrsr->HasMark() ) + { + // check whether nHere is 'inside' pCrsr + SwPosition* pStart = pCrsr->Start(); + sal_uLong nStartIndex = pStart->nNode.GetIndex(); + SwPosition* pEnd = pCrsr->End(); + sal_uLong nEndIndex = pEnd->nNode.GetIndex(); + if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex) ) + { + if( pAnchor.GetAnchorId() == FLY_AS_CHAR ) + { + //IAccessibility2 Implementation 2009----- + if( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) ) + if( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) ) + return sal_True; + //-----IAccessibility2 Implementation 2009 + } + else if( pAnchor.GetAnchorId() == FLY_AT_PARA ) + { + if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 ) + && (nHere < nEndIndex ) ) + return sal_True; + } + break; + } + // else: this PaM doesn't point to this paragraph + } + // else: this PaM is collapsed and doesn't select anything + + // next PaM in ring + pCrsr = static_cast( pCrsr->GetNext() ); + } + while( pCrsr != pRingStart ); + } + } + return sal_False; +} + +SwFlyFrm* SwAccessibleFrameBase::getFlyFrm() const +{ + SwFlyFrm* pFlyFrm = NULL; + + const SwFrm* pFrm = GetFrm(); + DBG_ASSERT( pFrm != NULL, "frame expected" ); + if( pFrm->IsFlyFrm() ) + { + pFlyFrm = static_cast( const_cast( pFrm ) ); + } + + return pFlyFrm; +} + +sal_Bool SwAccessibleFrameBase::SetSelectedState( sal_Bool ) +{ + sal_Bool bParaSeleted = GetSelectedState() || IsSelected(); + + if(bIsSeletedInDoc != bParaSeleted) + { + bIsSeletedInDoc = bParaSeleted; + FireStateChangedEvent( AccessibleStateType::SELECTED, bParaSeleted ); + return sal_True; + } + return sal_False; +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accframebase.hxx Wed Nov 27 17:25:40 2013 @@ -23,6 +23,12 @@ #ifndef _ACCFRAMEBASE_HXX #define _ACCFRAMEBASE_HXX +//IAccessibility2 Implementation 2009----- +#ifndef _PAM_HXX +#include +#endif +//-----IAccessibility2 Implementation 2009 + #include #include @@ -42,6 +48,11 @@ protected: // This drived class additionaly sets SELECTABLE(1), SELECTED(+), // FOCUSABLE(1) and FOCUSED(+) virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ); + //IAccessibility2 Implementation 2009----- + SwFlyFrm* getFlyFrm() const; + sal_Bool GetSelectedState( ); + SwPaM* GetCrsr(); + //-----IAccessibility2 Implementation 2009 virtual void _InvalidateCursorPos(); virtual void _InvalidateFocus(); @@ -61,6 +72,8 @@ public: // The object is not visible an longer and should be destroyed virtual void Dispose( sal_Bool bRecursive = sal_False ); + virtual sal_Bool SetSelectedState( sal_Bool bSeleted ); + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.cxx Wed Nov 27 17:25:40 2013 @@ -39,6 +39,10 @@ #include #include #include +//IAccessibility2 Implementation 2009----- +#include +//-----IAccessibility2 Implementation 2009 + #include #include @@ -172,6 +176,25 @@ bool SwAccessibleChild::IsBoundAsChar() return bRet; } +//IAccessibility2 Implementation 2009----- +sal_uInt32 SwAccessibleChild::GetAnchorPosition() const +{ + if( mpDrawObj ) + { + const SwFrmFmt *pFrmFmt = ::FindFrmFmt( mpDrawObj ); + if ( pFrmFmt ) + { + const SwPosition *pPos = pFrmFmt->GetAnchor().GetCntntAnchor(); + if ( pPos ) + { + return pPos->nContent.GetIndex(); + } + } + } + return 0; +} +//-----IAccessibility2 Implementation 2009 + SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r ) : mpFrm( r.mpFrm ) , mpDrawObj( r.mpDrawObj ) Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobj.hxx Wed Nov 27 17:25:40 2013 @@ -63,6 +63,10 @@ class SwAccessibleChild bool IsAccessible( sal_Bool bPagePreview ) const; bool IsBoundAsChar() const; + + //IAccessibility2 Implementation 2009----- + sal_uInt32 GetAnchorPosition() const; + //-----IAccessibility2 Implementation 2009 bool IsVisibleChildrenOnly() const; SwRect GetBox( const SwAccessibleMap& rAccMap ) const; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.cxx Wed Nov 27 17:25:40 2013 @@ -162,3 +162,97 @@ SwAccessibleChildMap::SwAccessibleChildM ( rFrm.IsTxtFrm() && rFrm.GetDrawObjs() ); } + +/* MT: The two insert methods had been introduced in the IA2 CWS (OOO310m11), but meanwhile we also have some in DEV300m80 (above) + Not sure if they have something which needs to be update in above methods. + Also, since there is no SwFrmOrObjMap CTOR anymore, the updated code in DEV300 might need some of the changes flagged with //IAccessibility2 Implementation 2009----- + +//IAccessibility2 Implementation 2009----- +::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert( + sal_uInt32 nOrd, Point nPos, const SwFrmOrObj& rLower ) +{ + SwFrmOrObjMapKey aKey( SwFrmOrObjMapKey::TEXT, nOrd, nPos ); + value_type aEntry( aKey, rLower ); + return _SwFrmOrObjMap::insert( aEntry ); +} + +::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert( + const SdrObject *pObj, const SwFrmOrObj& rLower, const SwDoc *pDoc , Point nPos) +{ + if( !bLayerIdsValid ) + { + nHellId = pDoc->GetHellId(); + nControlsId = pDoc->GetControlsId(); + bLayerIdsValid = sal_True; + } + + SdrLayerID nLayer = pObj->GetLayer(); + SwFrmOrObjMapKey::LayerId eLayerId = (nHellId == nLayer) + ? SwFrmOrObjMapKey::HELL + : ((nControlsId == nLayer) ? SwFrmOrObjMapKey::CONTROLS + : SwFrmOrObjMapKey::HEAVEN); + SwFrmOrObjMapKey aKey( eLayerId, pObj->GetOrdNum(), nPos ); + value_type aEntry( aKey, rLower ); + return _SwFrmOrObjMap::insert( aEntry ); +} +//-----IAccessibility2 Implementation 2009 + +SwFrmOrObjMap::SwFrmOrObjMap( + const SwRect& rVisArea, const SwFrm *pFrm ) : + bLayerIdsValid( sal_False ) +{ + SwFrmOrObj aFrm( pFrm ); + sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly(); + + sal_uInt32 nPos = 0; + SwFrmOrObj aLower( pFrm->GetLower() ); + while( aLower.GetSwFrm() ) + { + //IAccessibility2 Implementation 2009----- + if( !bVisibleOnly || aLower.GetBox().IsOver( rVisArea ) ) + insert( nPos++, aLower.GetBounds().Pos(), aLower ); + //-----IAccessibility2 Implementation 2009 + aLower = aLower.GetSwFrm()->GetNext(); + } + + if( pFrm->IsPageFrm() ) + { + ASSERT( bVisibleOnly, "page frame within tab frame???" ); + const SwPageFrm *pPgFrm = + static_cast< const SwPageFrm * >( pFrm ); + const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs(); + if( pObjs ) + { + const SwDoc *pDoc = pPgFrm->GetFmt()->GetDoc(); + for( sal_uInt16 i=0; iCount(); i++ ) + { + aLower = (*pObjs)[i]->GetDrawObj(); + //IAccessibility2 Implementation 2009----- + if( aLower.GetBox().IsOver( rVisArea ) ) + insert( aLower.GetSdrObject(), aLower, pDoc , aLower.GetBounds().Pos() ); + //-----IAccessibility2 Implementation 2009 + } + } + } + else if( pFrm->IsTxtFrm() ) + { + const SwDoc *pDoc = static_cast< const SwTxtFrm * >( pFrm )->GetNode() + ->GetDoc(); + const SwSortedObjs *pObjs = pFrm->GetDrawObjs(); + if( pObjs ) + { + for( sal_uInt16 i=0; iCount(); i++ ) + { + aLower = (*pObjs)[i]->GetDrawObj(); + //IAccessibility2 Implementation 2009----- + if( aLower.IsBoundAsChar() && + (!bVisibleOnly || aLower.GetBox().IsOver( rVisArea )) ) + insert( aLower.GetSdrObject(), aLower, pDoc , Point(aLower.GetAnchorPosition(),0) ); + //-----IAccessibility2 Implementation 2009 + } + } + } +} + +*/ + Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accfrmobjmap.hxx Wed Nov 27 17:25:40 2013 @@ -26,6 +26,7 @@ #include #include +#include #include @@ -43,25 +44,58 @@ public: inline SwAccessibleChildMapKey() : eLayerId( INVALID ) , nOrdNum( 0 ) + , nPosNum( 0, 0 ) {} inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd ) : eLayerId( eId ) , nOrdNum( nOrd ) + , nPosNum( 0, 0 ) {} +//IAccessibility2 Implementation 2009----- + inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos ) + : eLayerId( eId ) + , nOrdNum( nOrd ) + , nPosNum( nPos ) + {} +//-----IAccessibility2 Implementation 2009 + inline bool operator()( const SwAccessibleChildMapKey& r1, const SwAccessibleChildMapKey& r2 ) const { - return (r1.eLayerId == r2.eLayerId) - ? (r1.nOrdNum < r2.nOrdNum) - : (r1.eLayerId < r2.eLayerId); +//IAccessibility2 Implementation 2009----- +// return (r1.eLayerId == r2.eLayerId) +// ? (r1.nOrdNum < r2.nOrdNum) +// : (r1.eLayerId < r2.eLayerId); + return (r1.eLayerId == r2.eLayerId) ? + ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) : + (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() : + r1.nPosNum.getY() < r2.nPosNum.getY()) ) : + (r1.eLayerId < r2.eLayerId); +//-----IAccessibility2 Implementation 2009 } + + /* MT: Need to get this position parameter stuff in dev300 somehow... + //IAccessibility2 Implementation 2009----- + //This methods are used to insert an object to the map, adding a position parameter. + ::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos, + const SwFrmOrObj& rLower ); + ::std::pair< iterator, bool > insert( const SdrObject *pObj, + const SwFrmOrObj& rLower, + const SwDoc *pDoc, + Point nPos); + //-----IAccessibility2 Implementation 2009 + */ private: LayerId eLayerId; sal_uInt32 nOrdNum; + + //IAccessibility2 Implementation 2009----- + Point nPosNum; + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.cxx Wed Nov 27 17:25:40 2013 @@ -33,6 +33,11 @@ #include "accgraphic.hxx" using namespace ::com::sun::star; +//IAccessibility2 Implementation 2009----- +#ifndef _FMTURL_HXX //autogen +#include +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; @@ -91,3 +96,15 @@ Sequence< sal_Int8 > SAL_CALL SwAccessib } return aId; } +//IAccessibility2 Implementation 2009----- +// Return this object's role. +sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException) +{ + SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); + + if(aURL.GetMap() ) + return AccessibleRole::IMAGE_MAP ; + return AccessibleRole::GRAPHIC ; +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accgraphic.hxx Wed Nov 27 17:25:40 2013 @@ -59,6 +59,10 @@ public: //===== XTypeProvider ==================================================== virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + //IAccessibility2 Implementation 2009----- + /// Return this object's role. + virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException); + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.cxx Wed Nov 27 17:25:40 2013 @@ -139,3 +139,20 @@ Sequence< sal_Int8 > SAL_CALL SwAccessib } return aId; } + +//IAccessibility2 Implementation 2009----- +sal_Int32 SAL_CALL SwAccessibleHeaderFooter::getBackground() + throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XAccessible > xParent = getAccessibleParent(); + if (xParent.is()) + { + Reference< XAccessibleComponent > xAccContext (xParent,UNO_QUERY); + if(xAccContext.is()) + { + return xAccContext->getBackground(); + } + } + return SwAccessibleContext::getBackground(); +} +//-----IAccessibility2 Implementation 2009 Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accheaderfooter.hxx Wed Nov 27 17:25:40 2013 @@ -74,6 +74,11 @@ public: //===== XTypeProvider ==================================================== virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + //IAccessibility2 Implementation 2009----- + //===== XAccessibleComponent ============================================ + sal_Int32 SAL_CALL getBackground() + throw (::com::sun::star::uno::RuntimeException); + //-----IAccessibility2 Implementation 2009 }; Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acchyperlink.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acchyperlink.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acchyperlink.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acchyperlink.cxx Wed Nov 27 17:25:40 2013 @@ -32,9 +32,23 @@ #include #include +//IAccessibility2 Implementation 2009----- +#include +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_DOCUMENT_XLINKTARGETSUPPLIER_HPP_ +#include +#endif +//-----IAccessibility2 Implementation 2009 + using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::rtl::OUString; +using ::com::sun::star::lang::IndexOutOfBoundsException; SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos, SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) : @@ -78,8 +92,12 @@ sal_Bool SAL_CALL SwAccessibleHyperlink: sal_Bool bRet = sal_False; + //IAccessibility2 Implementation 2009----- + if(nIndex != 0) + throw new IndexOutOfBoundsException; const SwTxtAttr *pTxtAttr = GetTxtAttr(); - if( pTxtAttr && 0 == nIndex ) + if( pTxtAttr /*&& 0 == nIndex*/ ) + //-----IAccessibility2 Implementation 2009 { const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt(); if( rINetFmt.GetValue().Len() ) @@ -111,23 +129,28 @@ OUString SAL_CALL SwAccessibleHyperlink: { OUString sDesc; + //IAccessibility2 Implementation 2009----- + if(nIndex != 0) + throw new IndexOutOfBoundsException; const SwTxtAttr *pTxtAttr = GetTxtAttr(); - if( pTxtAttr && 0 == nIndex ) + if( pTxtAttr /*&& 0 == nIndex*/ ) { const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt(); sDesc = OUString( rINetFmt.GetValue() ); } - + //-----IAccessibility2 Implementation 2009 return sDesc; } uno::Reference< XAccessibleKeyBinding > SAL_CALL - SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) + SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { uno::Reference< XAccessibleKeyBinding > xKeyBinding; - if( isValid() && 0==nIndex ) + //IAccessibility2 Implementation 2009----- + if( isValid() /*&& 0 == nIndex*/ ) + //-----IAccessibility2 Implementation 2009 { ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); @@ -146,17 +169,40 @@ uno::Reference< XAccessibleKeyBinding > // XAccessibleHyperlink uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionAnchor( - sal_Int32 /*nIndex*/ ) + sal_Int32 nIndex) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - return uno::Any(); + uno::Any aRet; + //IAccessibility2 Implementation 2009----- + if(nIndex != 0) + throw new IndexOutOfBoundsException; + //End Added. + ::rtl::OUString text = OUString( xPara->GetString() ); + ::rtl::OUString retText = text.copy(nStartIdx, nEndIdx - nStartIdx); + aRet <<= retText; + //-----IAccessibility2 Implementation 2009 + return aRet; } uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionObject( - sal_Int32 /*nIndex*/ ) + sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - return uno::Any(); + //IAccessibility2 Implementation 2009----- + if(nIndex != 0) + throw new IndexOutOfBoundsException; + //End Added. + const SwTxtAttr *pTxtAttr = GetTxtAttr(); + ::rtl::OUString retText; + if( pTxtAttr /*&& 0 == nIndex*/ ) + { + const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt(); + retText = OUString( rINetFmt.GetValue() ); + } + uno::Any aRet; + aRet <<= retText; + return aRet; + //-----IAccessibility2 Implementation 2009 } sal_Int32 SAL_CALL SwAccessibleHyperlink::getStartIndex() @@ -175,7 +221,57 @@ sal_Bool SAL_CALL SwAccessibleHyperlink: throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - return xPara.isValid(); + //IAccessibility2 Implementation 2009----- + // return xPara.isValid(); + if (xPara.isValid()) + { + const SwTxtAttr *pTxtAttr = GetTxtAttr(); + ::rtl::OUString sText; + if( pTxtAttr ) + { + const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt(); + sText = OUString( rINetFmt.GetValue() ); + ::rtl::OUString sToken = ::rtl::OUString::createFromAscii("#"); + sal_Int32 nPos = sText.indexOf(sToken); + if (nPos==0)//document link + { + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + if( ! xFactory.is() ) + return sal_False; + uno::Reference< com::sun::star::frame::XDesktop > xDesktop( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), + uno::UNO_QUERY ); + if( !xDesktop.is() ) + return sal_False; + uno::Reference< lang::XComponent > xComp; + xComp = xDesktop->getCurrentComponent(); + if( !xComp.is() ) + return sal_False; + uno::Reference< com::sun::star::document::XLinkTargetSupplier > xLTS(xComp, uno::UNO_QUERY); + if ( !xLTS.is()) + return sal_False; + + uno::Reference< ::com::sun::star::container::XNameAccess > xLinks = xLTS->getLinks(); + uno::Reference< ::com::sun::star::container::XNameAccess > xSubLinks; + const uno::Sequence< OUString > aNames( xLinks->getElementNames() ); + const sal_uLong nLinks = aNames.getLength(); + const OUString* pNames = aNames.getConstArray(); + + for( sal_uLong i = 0; i < nLinks; i++ ) + { + uno::Any aAny; + OUString aLink( *pNames++ ); + aAny = xLinks->getByName( aLink ); + aAny >>= xSubLinks; + if (xSubLinks->hasByName(sText.copy(1)) ) + return sal_True; + } + } + else//internet + return sal_True; + } + }//xpara valid + return sal_False; + //-----IAccessibility2 Implementation 2009 } void SwAccessibleHyperlink::Invalidate()