summaryrefslogtreecommitdiff
path: root/sw/source/core/access
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/access')
-rw-r--r--sw/source/core/access/acccell.cxx232
-rw-r--r--sw/source/core/access/acccell.hxx58
-rw-r--r--sw/source/core/access/acccontext.cxx112
-rw-r--r--sw/source/core/access/acccontext.hxx21
-rw-r--r--sw/source/core/access/accdoc.cxx538
-rw-r--r--sw/source/core/access/accdoc.hxx41
-rw-r--r--sw/source/core/access/accembedded.cxx64
-rw-r--r--sw/source/core/access/accembedded.hxx26
-rw-r--r--sw/source/core/access/accfield.cxx348
-rw-r--r--sw/source/core/access/accfield.hxx213
-rw-r--r--sw/source/core/access/accfootnote.cxx15
-rw-r--r--sw/source/core/access/accfootnote.hxx1
-rw-r--r--sw/source/core/access/accframe.cxx19
-rw-r--r--sw/source/core/access/accframe.hxx11
-rw-r--r--sw/source/core/access/accframebase.cxx174
-rw-r--r--sw/source/core/access/accframebase.hxx13
-rw-r--r--sw/source/core/access/accfrmobj.cxx23
-rw-r--r--sw/source/core/access/accfrmobj.hxx4
-rw-r--r--sw/source/core/access/accfrmobjmap.cxx94
-rw-r--r--sw/source/core/access/accfrmobjmap.hxx40
-rw-r--r--sw/source/core/access/accgraphic.cxx17
-rw-r--r--sw/source/core/access/accgraphic.hxx4
-rw-r--r--sw/source/core/access/accheaderfooter.cxx17
-rw-r--r--sw/source/core/access/accheaderfooter.hxx5
-rw-r--r--sw/source/core/access/acchyperlink.cxx116
-rw-r--r--sw/source/core/access/accmap.cxx1089
-rw-r--r--sw/source/core/access/accnotextframe.cxx167
-rw-r--r--sw/source/core/access/accnotextframe.hxx64
-rw-r--r--sw/source/core/access/accnotexthyperlink.cxx232
-rw-r--r--sw/source/core/access/accnotexthyperlink.hxx93
-rw-r--r--sw/source/core/access/accpara.cxx1793
-rw-r--r--sw/source/core/access/accpara.hxx69
-rw-r--r--sw/source/core/access/accportions.cxx126
-rw-r--r--sw/source/core/access/accportions.hxx19
-rw-r--r--sw/source/core/access/accpreview.cxx27
-rw-r--r--sw/source/core/access/accpreview.hxx6
-rw-r--r--sw/source/core/access/accselectionhelper.cxx105
-rw-r--r--sw/source/core/access/acctable.cxx340
-rw-r--r--sw/source/core/access/acctable.hxx33
-rw-r--r--sw/source/core/access/acctextframe.cxx140
-rw-r--r--sw/source/core/access/acctextframe.hxx44
41 files changed, 6388 insertions, 165 deletions
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index c70a5146e3b0..28a8bc1e2065 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -50,6 +50,14 @@
#include <limits.h>
+//IAccessibility2 Implementation 2009-----
+#include <ndtxt.hxx>
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#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::AccessibleStateSetHelper& rStateSet )
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::AccessibleStateSetHelper& rStateSet )
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( SwAccessibleMap *pInitMap,
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::_InvalidateMyCursorPos()
}
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::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
{
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::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
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::_InvalidateCursorPos()
while( pTabFrm )
{
+ _InvalidateChildrenCursorPos( pTabFrm );
+/*
sal_Bool bChanged = _InvalidateChildrenCursorPos( pTabFrm );
if( bChanged )
{
@@ -201,9 +248,14 @@ void SwAccessibleCell::_InvalidateCursorPos()
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::InvalidatePosOrSize( const SwRect& rOldBox )
uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType )
throw( uno::RuntimeException )
{
+ //IAccessibility2 Implementation 2009-----
+ if (rType == ::getCppuType((const uno::Reference<XAccessibleExtendedAttributes>*)0))
+ {
+ uno::Any aR;
+ aR <<= uno::Reference<XAccessibleExtendedAttributes>(this);
+ return aR;
+ }
+
+ if (rType == ::getCppuType((const uno::Reference<XAccessibleSelection>*)0))
+ {
+ uno::Any aR;
+ aR <<= uno::Reference<XAccessibleSelection>(this);
+ return aR;
+ }
+ //-----IAccessibility2 Implementation 2009
if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) )
{
uno::Reference<XAccessibleValue> xValue = this;
@@ -327,7 +394,8 @@ SwFrmFmt* SwAccessibleCell::GetTblBoxFormat() const
return pCellFrm->GetTabBox()->GetFrmFmt();
}
-
+//IAccessibility2 Implementation 2009-----
+//Implement TableCell currentValue
uno::Any SwAccessibleCell::getCurrentValue( )
throw( uno::RuntimeException )
{
@@ -335,9 +403,33 @@ uno::Any SwAccessibleCell::getCurrentValue( )
CHECK_FOR_DEFUNC( XAccessibleValue );
uno::Any aAny;
- aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue();
+
+ const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>( 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::getMinimumValue( )
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<XAccessible> xAccDoc = getAccessibleParent();
+ if (xAccDoc.is())
+ {
+ uno::Reference<XAccessibleComponent> 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<XAccessible> 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<XAccessibleContext> xContextTable(xTableReference, uno::UNO_QUERY);
+ OSL_ASSERT(xContextTable.is() && xContextTable->getAccessibleRole() == AccessibleRole::TABLE);
+ #endif
+ //SwAccessibleTable aTable = *(static_cast<SwAccessibleTable *>(xTable.get()));
+ }
+ m_pAccTable = static_cast<SwAccessibleTable *>(xTableReference.get());
+ }
+ return m_pAccTable;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx
index 130ae7c432d9..bc16a660a5a4 100644
--- a/sw/source/core/access/acccell.hxx
+++ b/sw/source/core/access/acccell.hxx
@@ -26,13 +26,27 @@
#include "acccontext.hxx"
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+
+#ifndef _ACCSELECTIONHELPER_HXX_
+#include <accselectionhelper.hxx>
+#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
};
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index a4a0399747f7..df207e989350 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -60,6 +60,11 @@
#include <acccontext.hxx>
#include <svx/AccessibleShape.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _ACCPARA_HXX
+#include "accpara.hxx"
+#endif
+//-----IAccessibility2 Implementation 2009
#include <PostItMgr.hxx>
using namespace sw::access;
@@ -215,8 +220,11 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
"<SwAccessibleContext::ChildrenScrolled(..)> - 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::ChildrenScrolled( const SwFrm *pFrm,
ASSERT( !rLower.AlwaysIncludeAsChild(),
"<SwAccessibleContext::ChildrenScrolled(..)> - 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::ChildrenScrolled( const SwFrm *pFrm,
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( const SwRect& rOldVisArea )
// 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( SwAccessibleMap *pM,
, 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::getAccessibleChildCount( void )
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<XAccessibleStateSet> SAL_CALL
::utl::AccessibleStateSetHelper *pStateSet =
new ::utl::AccessibleStateSetHelper;
+ //IAccessibility2 Implementation 2009-----
+ if( bIsSeletedInDoc )
+ pStateSet->AddState( AccessibleStateType::SELECTED );
+ //-----IAccessibility2 Implementation 2009
+
uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
GetStates( *pStateSet );
@@ -988,13 +1055,15 @@ uno::Any SAL_CALL SwAccessibleContext::getAccessibleKeyBinding()
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( const SdrObject *pObj,
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::InvalidatePosOrSize( const SwRect& )
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( SwAccessibleContext *pThisAcc,
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
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index e712973b7190..915a46e12627 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -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
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 83db96973a2d..fce090d5c4ac 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -45,6 +45,30 @@
#endif
#include <pagefrm.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include "unostyle.hxx"
+#include "viewsh.hxx"
+#include "docsh.hxx"
+#include <crsrsh.hxx>
+#include "fesh.hxx"
+#include <fmtclds.hxx>
+#include <flyfrm.hxx>
+#include <colfrm.hxx>
+#include <txtfrm.hxx>
+#include <sectfrm.hxx>
+#include <section.hxx>
+#include <svx/unoapi.hxx>
+#include <swmodule.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include <fmtanchr.hxx>
+#include <viewimp.hxx>
+#include <dview.hxx>
+#include <dcontact.hxx>
+//-----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 SwAccessibleDocumentBase::getAccessibleIndexInParent (void)
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 SwAccessibleDocumentBase::getAccessibleDescription (void)
return GetResource( STR_ACCESS_DOC_DESC );
}
+//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 );
+ }
+
+ if ( sFileName.getLength() )
+ {
+ sAccName = sFileName + sReadOnly + OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sAccName;
+ }
+ }
+
+ return sAccName;
+}
+//-----IAccessibility2 Implementation 2009
+
awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
throw (uno::RuntimeException)
{
- vos::OGuard aGuard(Application::GetSolarMutex());
+ //IAccessibility2 Implementation 2009-----
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
- Window *pWin = GetWindow();
+ Window *pWin = GetWindow();
- CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
- Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
- awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
- aPixBounds.GetWidth(), aPixBounds.GetHeight() );
+ Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
+ awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
+ aPixBounds.GetWidth(), aPixBounds.GetHeight() );
- return aBox;
+ 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::queryInterface(
uno::Reference<XAccessibleSelection> aSelect = this;
aRet <<= aSelect;
}
+ //IAccessibility2 Implementation 2009-----
+ //Solution:Add XEventListener interface support.
+ else if ( (rType == ::getCppuType((uno::Reference<com::sun::star::document::XEventListener> *)NULL)) )
+ {
+ uno::Reference<com::sun::star::document::XEventListener> aSelect = this;
+ aRet <<= aSelect;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+ {
+ uno::Reference<XAccessibleExtendedAttributes> aAttribute = this;
+ aRet <<= aAttribute;
+ }
+ else if(rType == ::getCppuType((uno::Reference<XAccessibleGetAccFlowTo> *)NULL) )
+ {
+ uno::Reference<XAccessibleGetAccFlowTo> AccFlowTo = this;
+ aRet <<= AccFlowTo;
+ }
+ //-----IAccessibility2 Implementation 2009
else
aRet = SwAccessibleContext::queryInterface( rType );
return aRet;
@@ -436,11 +532,16 @@ uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
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::deselectAccessibleChild(
{
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<XAccessible> 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<uno::Any> 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<SwFrm*> 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<SwFrm*>::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
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index a8ae434256bf..24a0e75f7203 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -26,8 +26,19 @@
#include "acccontext.hxx"
#endif
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/document/XEventListener.hpp>
#include <accselectionhelper.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
+#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
diff --git a/sw/source/core/access/accembedded.cxx b/sw/source/core/access/accembedded.cxx
index a3efadcd726a..48a123f1bcf7 100644
--- a/sw/source/core/access/accembedded.cxx
+++ b/sw/source/core/access/accembedded.cxx
@@ -31,6 +31,14 @@
#include <rtl/uuid.h>
#include <flyfrm.hxx>
#include "accembedded.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "cntfrm.hxx"
+#include "ndole.hxx"
+#include <doc.hxx>
+#include <docsh.hxx>
+#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::~SwAccessibleEmbeddedObject()
{
}
+//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 SwAccessibleEmbeddedObject::getImplementation
}
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
diff --git a/sw/source/core/access/accembedded.hxx b/sw/source/core/access/accembedded.hxx
index f18ef2e1ec35..9347b16e1a58 100644
--- a/sw/source/core/access/accembedded.hxx
+++ b/sw/source/core/access/accembedded.hxx
@@ -24,7 +24,12 @@
#define _ACCEMBEDDED_HXX
#include "accnotextframe.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+//-----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
};
diff --git a/sw/source/core/access/accfield.cxx b/sw/source/core/access/accfield.cxx
new file mode 100644
index 000000000000..8aa79f29c497
--- /dev/null
+++ b/sw/source/core/access/accfield.cxx
@@ -0,0 +1,348 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifndef COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#endif
+#ifndef _SWURL_HXX //autogen
+#include <swurl.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_ //autogen
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _TXTINET_HXX
+#include <txtinet.hxx>
+#endif
+
+#ifndef _ACCPARA_HXX
+#include <accpara.hxx>
+#endif
+#ifndef _ACCFIELD_HXX
+#include <accfield.hxx>
+#endif
+
+#include <comphelper/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
+#include <com/sun/star/frame/XDesktop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XLINKTARGETSUPPLIER_HPP_
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#endif
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#include <comphelper/accessibleeventnotifier.hxx>
+#endif
+
+//Add end
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+// using namespace ::rtl;
+
+SwAccessibleField::SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16 nRole) :
+ m_xPara( p ),m_pSwField(pSwFld),m_nRole(nRole)
+{
+ m_nClientId=0;
+}
+
+uno::Reference< XAccessibleContext > SAL_CALL
+ SwAccessibleField::getAccessibleContext( void )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference < XAccessibleContext > xRet( this );
+ return xRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleChildCount( void )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return 0;
+}
+
+uno::Reference< XAccessible> SAL_CALL
+ SwAccessibleField::getAccessibleChild( long )
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return uno::Reference< XAccessible >();
+}
+
+uno::Reference< XAccessible> SAL_CALL SwAccessibleField::getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< XAccessible > xParent(static_cast<XAccessible*>(m_xPara.getBodyPtr()),UNO_QUERY);
+ return xParent;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return 0;
+}
+
+sal_Int16 SAL_CALL SwAccessibleField::getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nRole;
+}
+
+rtl::OUString SAL_CALL SwAccessibleField::getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ASSERT( !this, "description needs to be overloaded" );
+ //THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overloaded)" );
+ return rtl::OUString();
+}
+
+rtl::OUString SAL_CALL SwAccessibleField::getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return rtl::OUString();
+}
+
+uno::Reference< XAccessibleRelationSet> SAL_CALL
+ SwAccessibleField::getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ SwAccessibleField::getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return uno::Reference<XAccessibleStateSet>();
+}
+
+com::sun::star::lang::Locale SAL_CALL SwAccessibleField::getLocale (void)
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ com::sun::star::lang::Locale aLoc( Application::GetSettings().GetLocale() );
+ return aLoc;
+}
+
+static sal_Bool lcl_PointInRectangle(const awt::Point & aPoint,
+ const awt::Rectangle & aRect)
+{
+ long nDiffX = aPoint.X - aRect.X;
+ long nDiffY = aPoint.Y - aRect.Y;
+
+ return
+ nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
+ nDiffY < aRect.Height;
+
+}
+
+sal_Bool SAL_CALL SwAccessibleField::containsPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ awt::Rectangle aPixBounds = getBoundsImpl(sal_True);
+ aPixBounds.X = 0;
+ aPixBounds.Y = 0;
+
+ return lcl_PointInRectangle(aPoint, aPixBounds);
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleField::getAccessibleAtPoint(
+ const awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< XAccessible > xAcc;
+ awt::Rectangle rc = getBounds();
+ if(aPoint.X >= rc.X && aPoint.X <= rc.X + rc.Width &&
+ aPoint.Y >= rc.Y && aPoint.Y <= rc.Y + rc.Height )
+ {
+ xAcc =this;
+ }
+ return xAcc;
+}
+
+
+/**
+ Get bounding box.
+
+ There are two modes.
+
+ - realative
+
+ Return bounding box relative to parent if parent is no root
+ frame. Otherwise return the absolute bounding box.
+
+ - absolute
+
+ Return the absolute bounding box.
+
+ @param bRelative
+ true: Use relative mode.
+ false: Use absolute mode.
+*/
+awt::Rectangle SAL_CALL SwAccessibleField::getBoundsImpl( sal_Bool )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return awt::Rectangle();
+}
+
+awt::Rectangle SAL_CALL SwAccessibleField::getBounds()
+ throw (RuntimeException)
+{
+ return getBoundsImpl(sal_True);
+}
+
+awt::Point SAL_CALL SwAccessibleField::getLocation()
+ throw (RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_True);
+ awt::Point aPoint(aRect.X, aRect.Y);
+
+ return aPoint;
+}
+
+
+awt::Point SAL_CALL SwAccessibleField::getLocationOnScreen()
+ throw (RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_False);
+ //Point aPixPos = m_xPara->getLocationOnScreen();
+ return awt::Point( aRect.X,aRect.Y);//aPixPos.X() + aRect.nLeft , aPixPos.Y() + + aRect.nRight );
+}
+
+
+awt::Size SAL_CALL SwAccessibleField::getSize()
+ throw (RuntimeException)
+{
+ awt::Rectangle aRect = getBoundsImpl(sal_False);
+ awt::Size aSize( aRect.Width, aRect.Height );
+
+ return aSize;
+}
+
+void SAL_CALL SwAccessibleField::grabFocus()
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return;
+}
+
+
+sal_Int32 SAL_CALL SwAccessibleField::getForeground()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getBackground()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0xffffff;
+}
+::com::sun::star::uno::Any SAL_CALL SwAccessibleField::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Any aRet;
+ if ( rType == ::getCppuType((uno::Reference<XAccessibleContext> *)0) )
+ {
+ Reference<XAccessibleContext> aAccContext = (XAccessibleContext *) this; // resolve ambiguity
+ aRet <<= aAccContext;
+ }
+ else if ( rType == ::getCppuType((Reference<XAccessibleComponent> *)0) )
+ {
+ Reference<XAccessibleComponent> aAccEditComponent = this;
+ aRet <<= aAccEditComponent;
+ }
+ if (rType == ::getCppuType((Reference<XAccessibleEventBroadcaster> *)0))
+ {
+ Reference<XAccessibleEventBroadcaster> aAccBroadcaster= this;
+ aRet <<= aAccBroadcaster;
+ }
+ return aRet;
+}
+
+void SAL_CALL SwAccessibleField::acquire( ) throw ()
+{
+}
+void SAL_CALL SwAccessibleField::release( ) throw ()
+{
+}
+
+void SAL_CALL SwAccessibleField::addEventListener(
+ const Reference< XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ //DBG_MSG( "accessible event listener added" )
+
+ if (xListener.is())
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (!m_nClientId)
+ m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+ }
+}
+
+void SAL_CALL SwAccessibleField::removeEventListener(
+ const Reference< XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ //DBG_MSG( "accessible event listener removed" )
+
+ if (xListener.is())
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( m_nClientId );
+ m_nClientId = 0;
+ }
+ }
+}
diff --git a/sw/source/core/access/accfield.hxx b/sw/source/core/access/accfield.hxx
new file mode 100644
index 000000000000..a206866ab23c
--- /dev/null
+++ b/sw/source/core/access/accfield.hxx
@@ -0,0 +1,213 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _ACCFIELD_HXX
+#define _ACCFIELD_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HDL_
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERLINK_HPP_
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
+#include <com/sun/star/uno/RuntimeException.hpp>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+#ifndef _FMTINFMT_HXX //autogen
+#include <fmtinfmt.hxx>
+#endif
+
+class SwAccessibleParagraph;
+class SwField;
+class SwAccessibleField :
+ public ::cppu::WeakImplHelper4<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ >
+{
+ friend class SwAccessibleParagraph;
+ friend class SwAccessibleHyperTextData;
+
+protected:
+// sal_uInt16 nHintPos;
+ ::vos::ORef< SwAccessibleParagraph > m_xPara;
+ SwField *m_pSwField;
+
+ sal_uInt32 m_nClientId; // client id in the AccessibleEventNotifier queue
+ sal_Int16 m_nRole; // immutable outside constructor
+// sal_Int32 nStartIdx;
+// sal_Int32 nEndIdx;
+public:
+ SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16);
+
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+// const SwTxtAttr *GetTxtAttr() const;
+// void Invalidate();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire( ) throw () ;
+ virtual void SAL_CALL release( ) throw () ;
+
+public:
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void) throw (com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or NULL if index is invalid.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /// Return a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+ virtual sal_Bool SAL_CALL containsPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL grabFocus()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ 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 ::com::sun::star::awt::Rectangle SAL_CALL
+ getBoundsImpl(sal_Bool bRelative)
+ throw (::com::sun::star::uno::RuntimeException) ;
+
+
+};
+
+#endif
+
diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx
index 588bbb1c8161..95c2c09d9d75 100644
--- a/sw/source/core/access/accfootnote.cxx
+++ b/sw/source/core/access/accfootnote.cxx
@@ -55,7 +55,6 @@ const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccess
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::SwAccessibleFootnote(
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 ) );
}
diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx
index 9cec3b47ff2d..dadc3bcc7f05 100644
--- a/sw/source/core/access/accfootnote.hxx
+++ b/sw/source/core/access/accfootnote.hxx
@@ -41,7 +41,6 @@ public:
SwAccessibleFootnote( SwAccessibleMap* pInitMap,
sal_Bool bIsEndnote,
- sal_Int32 nFootEndNote,
const SwFtnFrm *pFtnFrm );
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 0099a63e9416..b9916a63d7fd 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -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( const SwRect& rVisArea,
sal_Bool bIsPagePreview ) :
maVisArea( rVisArea ),
mpFrm( pF ),
- mbIsInPagePreview( bIsPagePreview )
+ mbIsInPagePreview( bIsPagePreview ),
+ bIsAccDocUse( sal_False )
{
}
diff --git a/sw/source/core/access/accframe.hxx b/sw/source/core/access/accframe.hxx
index 129caa2768c1..06ab5302d059 100644
--- a/sw/source/core/access/accframe.hxx
+++ b/sw/source/core/access/accframe.hxx
@@ -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,
@@ -105,6 +106,12 @@ protected:
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.
const SwFrm* GetFrm() const { return mpFrm; };
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index e2ce6ad6e89b..53b2b6600a58 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -42,6 +42,26 @@
#include "accmap.hxx"
#include "accframebase.hxx"
+//IAccessibility2 Implementation 2009-----
+#ifndef _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _FESH_HXX
+#include "fesh.hxx"
+#endif
+#ifndef _TXTFRM_HXX
+#include <txtfrm.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _DCONTACT_HXX
+#include <dcontact.hxx>
+#endif
+#ifndef _FMTANCHR_HXX
+#include <fmtanchr.hxx>
+#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::_InvalidateCursorPos()
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 <SwAccessibleContext *>( xParent.get() );
+ uno::Reference< XAccessible > xParent( GetWeakParent() );
+ if( xParent.is() )
+ {
+ SwAccessibleContext *pAcc =
+ static_cast <SwAccessibleContext *>( xParent.get() );
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
- pAcc->FireAccessibleEvent( aEvent );
+ 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( const SfxPoolItem* pOld, const SfxPoolItem *
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_Bool bRecursive )
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<SwPaM*>( 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<SwFlyFrm*>( const_cast<SwFrm*>( 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
diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx
index 14ae334065b2..6e2fd6f1bcef 100644
--- a/sw/source/core/access/accframebase.hxx
+++ b/sw/source/core/access/accframebase.hxx
@@ -23,6 +23,12 @@
#ifndef _ACCFRAMEBASE_HXX
#define _ACCFRAMEBASE_HXX
+//IAccessibility2 Implementation 2009-----
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
+
#include <acccontext.hxx>
#include <calbck.hxx>
@@ -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
};
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index 53ca64a50c7b..913e6206093d 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -39,6 +39,10 @@
#include <frmfmt.hxx>
#include <fmtanchr.hxx>
#include <dcontact.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <pam.hxx>
+//-----IAccessibility2 Implementation 2009
+
#include <vcl/window.hxx>
#include <svx/svdlegacy.hxx>
@@ -172,6 +176,25 @@ bool SwAccessibleChild::IsBoundAsChar() const
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 )
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
index 60d41b3eb2d9..ff6012aa9c06 100644
--- a/sw/source/core/access/accfrmobj.hxx
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -64,6 +64,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;
SwRect GetBounds( const SwAccessibleMap& rAccMap ) const;
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index 4fc284ae9fb2..c76df1453d1f 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -162,3 +162,97 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
( 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; i<pObjs->Count(); 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; i<pObjs->Count(); 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
+ }
+ }
+ }
+}
+
+*/
+
diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx
index d9df578277a7..fb05f9c8e117 100644
--- a/sw/source/core/access/accfrmobjmap.hxx
+++ b/sw/source/core/access/accfrmobjmap.hxx
@@ -26,6 +26,7 @@
#include <accfrmobj.hxx>
#include <svx/svdtypes.hxx>
+#include <tools/gen.hxx>
#include <map>
@@ -43,26 +44,59 @@ 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
+
};
typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
diff --git a/sw/source/core/access/accgraphic.cxx b/sw/source/core/access/accgraphic.cxx
index 5b1e0f66857d..6b94077d4d75 100644
--- a/sw/source/core/access/accgraphic.cxx
+++ b/sw/source/core/access/accgraphic.cxx
@@ -33,6 +33,11 @@
#include "accgraphic.hxx"
using namespace ::com::sun::star;
+//IAccessibility2 Implementation 2009-----
+#ifndef _FMTURL_HXX //autogen
+#include <fmturl.hxx>
+#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 SwAccessibleGraphic::getImplementationId()
}
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
diff --git a/sw/source/core/access/accgraphic.hxx b/sw/source/core/access/accgraphic.hxx
index 379a95c274ee..af6391baa6f6 100644
--- a/sw/source/core/access/accgraphic.hxx
+++ b/sw/source/core/access/accgraphic.hxx
@@ -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
};
diff --git a/sw/source/core/access/accheaderfooter.cxx b/sw/source/core/access/accheaderfooter.cxx
index c8a65f8d8bd0..5d6238f8a3e4 100644
--- a/sw/source/core/access/accheaderfooter.cxx
+++ b/sw/source/core/access/accheaderfooter.cxx
@@ -139,3 +139,20 @@ Sequence< sal_Int8 > SAL_CALL SwAccessibleHeaderFooter::getImplementationId()
}
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
diff --git a/sw/source/core/access/accheaderfooter.hxx b/sw/source/core/access/accheaderfooter.hxx
index 286639ca6474..e674bfd8ac8c 100644
--- a/sw/source/core/access/accheaderfooter.hxx
+++ b/sw/source/core/access/accheaderfooter.hxx
@@ -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
};
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 872d73e4f9bc..7c6c3d3cea51 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -32,9 +32,23 @@
#include <accpara.hxx>
#include <acchyperlink.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <comphelper/processfactory.hxx>
+#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
+#include <com/sun/star/frame/XDesktop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XLINKTARGETSUPPLIER_HPP_
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#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::doAccessibleAction( sal_Int32 nIndex )
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::getAccessibleActionDescription(
{
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 > SAL_CALL
// 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::isValid( )
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()
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 8be7f772f90d..8918bb598c59 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -34,6 +34,7 @@
#include <map>
#include <list>
+#include <vector>
#include <accmap.hxx>
#include <acccontext.hxx>
#include <accdoc.hxx>
@@ -60,11 +61,25 @@
#include <IDocumentDrawModelAccess.hxx>
#include <svx/ShapeTypeHandler.hxx>
#include <vcl/svapp.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+#include <svx/ShapeTypeHandler.hxx>
+#endif
+#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+#include <svx/SvxShapeTypes.hxx>
+#endif
+#ifndef _SVDPAGE_HXX
+#include <svx/svdpage.hxx>
+#endif
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <cppuhelper/implbase1.hxx>
#include <pagepreviewlayout.hxx>
+#include <dcontact.hxx>
+#include <svx/unoapi.hxx>
+#include <doc.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <dflyobj.hxx>
@@ -280,7 +295,9 @@ SwAccessibleObjShape_Impl
{
const SdrObject *pObj = (*aIter).first;
uno::Reference < XAccessible > xAcc( (*aIter).second );
- if( nSelShapes && pFESh->IsObjSelected( *pObj ) )
+ //IAccessibility2 Implementation 2009-----
+ if( nSelShapes && pFESh &&pFESh->IsObjSelected( *pObj ) )
+ //-----IAccessibility2 Implementation 2009
{
// selected objects are inserted from the back
--pSelShape;
@@ -336,20 +353,31 @@ private:
SwAccessibleEvent_Impl& operator==( const SwAccessibleEvent_Impl& );
public:
+ //IAccessibility2 Implementation 2009-----
+ const SwFrm* mpParentFrm; // The object that fires the event
+ sal_Bool IsNoXaccParentFrm() const
+ {
+ return CHILD_POS_CHANGED == meType && mpParentFrm != 0;
+ }
+ uno::WeakReference < XAccessible > GetxAcc() const { return mxAcc;}
+ //-----IAccessibility2 Implementation 2009
+public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
const SwAccessibleChild& rFrmOrObj )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{}
SwAccessibleEvent_Impl( EventType eT,
const SwAccessibleChild& rFrmOrObj )
: maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
ASSERT( SwAccessibleEvent_Impl::DISPOSE == meType,
"wrong event constructor, DISPOSE only" );
@@ -357,7 +385,8 @@ public:
SwAccessibleEvent_Impl( EventType eT )
: meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
ASSERT( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType,
"wrong event constructor, SHAPE_SELECTION only" );
@@ -371,7 +400,8 @@ public:
mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( 0 )
+ mnStates( 0 ),
+ mpParentFrm( 0 )
{
ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
SwAccessibleEvent_Impl::POS_CHANGED == meType,
@@ -386,12 +416,28 @@ public:
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
- mnStates( _nStates )
+ mnStates( _nStates ),
+ mpParentFrm( 0 )
{
ASSERT( SwAccessibleEvent_Impl::CARET_OR_STATES == meType,
"wrong event constructor, CARET_OR_STATES only" );
}
+ //IAccessibility2 Implementation 2009-----
+ SwAccessibleEvent_Impl( EventType eT,
+ const SwFrm *pParentFrm,
+ const SwAccessibleChild& rFrmOrObj,
+ const SwRect& rR ) :
+ maOldBox( rR ),
+ maFrmOrObj( rFrmOrObj ),
+ meType( eT ),
+ mnStates( 0 ),
+ mpParentFrm( pParentFrm )
+ {
+ OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType,
+ "wrong event constructor, CHILD_POS_CHANGED only" );
+ }
+ //-----IAccessibility2 Implementation 2009
// <SetType(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
inline void SetType( EventType eT )
{
@@ -495,8 +541,47 @@ public:
{
return mbFiring;
}
+ //IAccessibility2 Implementation 2009-----
+ struct XAccisNULL
+ {
+ bool operator()(const SwAccessibleEvent_Impl& e)
+ {
+ return e.IsNoXaccParentFrm();
+ }
+ };
+ void MoveInvalidXAccToEnd();
+ //-----IAccessibility2 Implementation 2009
};
+//IAccessibility2 Implementation 2009-----
+void SwAccessibleEventList_Impl::MoveInvalidXAccToEnd()
+{
+ int nSize = size();
+ if (nSize < 2 )
+ {
+ return;
+ }
+ SwAccessibleEventList_Impl lstEvent;
+ iterator li = begin();
+ for ( ;li != end();)
+ {
+ SwAccessibleEvent_Impl e = *li;
+ if (e.IsNoXaccParentFrm())
+ {
+ iterator liNext = li;
+ ++liNext;
+ erase(li);
+ li = liNext;
+ lstEvent.insert(lstEvent.end(),e);
+ }
+ else
+ ++li;
+ }
+ OSL_ENSURE(size() + lstEvent.size() == nSize ,"");
+ insert(end(),lstEvent.begin(),lstEvent.end());
+ OSL_ENSURE(size() == nSize ,"");
+}
+//-----IAccessibility2 Implementation 2009
//------------------------------------------------------------------------------
// The shape list is filled if an accessible shape is destroyed. It
// simply keeps a reference to the accessible shape's XShape. These
@@ -827,6 +912,25 @@ static sal_Bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent )
{
::vos::ORef < SwAccessibleContext > xAccImpl( rEvent.GetContext() );
+ //IAccessibility2 Implementation 2009-----
+ if (!xAccImpl.isValid() && rEvent.mpParentFrm != 0 )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( rEvent.mpParentFrm );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if (xAcc.is())
+ {
+ uno::Reference < XAccessibleContext > xContext(xAcc,uno::UNO_QUERY);
+ if (xContext.is() && xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+ }
+ }
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
if( SwAccessibleEvent_Impl::SHAPE_SELECTION == rEvent.GetType() )
{
DoInvalidateShapeSelection();
@@ -1044,8 +1148,323 @@ void SwAccessibleMap::InvalidateShapeSelection()
DoInvalidateShapeSelection();
}
}
+//IAccessibility2 Implementation 2009-----
+//This method should implement the following functions:
+//1.find the shape objects and set the selected state.
+//2.find the Swframe objects and set the selected state.
+//3.find the paragraph objects and set the selected state.
+void SwAccessibleMap::InvalidateShapeInParaSelection()
+{
+ SwAccessibleObjShape_Impl *pShapes = 0;
+ SwAccessibleObjShape_Impl *pSelShape = 0;
+ size_t nShapes = 0;
+
+ const ViewShell *pVSh = GetShell();
+ const SwFEShell *pFESh = dynamic_cast< const SwFEShell* >(pVSh);
+ SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( sal_False /* ??? */ ) : NULL;//IAccessibility2 Implementation 2009
+
+ //sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
-void SwAccessibleMap::DoInvalidateShapeSelection()
+ {
+ vos::OGuard aGuard( maMutex );
+ if( mpShapeMap )
+ pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
+ }
+
+ sal_Bool bIsSelAll =IsDocumentSelAll();
+
+ if( mpShapeMap )
+ {
+ //Checked for shapes.
+ _SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+ _SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+
+ if( bIsSelAll)
+ {
+ while( aIter != aEndIter )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+
+ ++aIter;
+ }
+ }
+ else
+ {
+ while( aIter != aEndIter )
+ {
+ sal_Bool bChanged = sal_False;
+ sal_Bool bMarked = sal_False;
+ SwAccessibleChild pFrm( (*aIter).first );
+
+ const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : 0;
+ if( !pFrmFmt ) { ++aIter; continue; }
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ const SwPosition *pPos = pAnchor.GetCntntAnchor();
+
+ if(pAnchor.GetAnchorId() == FLY_AT_PAGE)
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+
+ ++aIter; continue;
+ }
+
+ if( !pPos ) { ++aIter; continue; }
+ if( pPos->nNode.GetNode().GetTxtNode() )
+ {
+ int pIndex = pPos->nContent.GetIndex();
+ SwPaM* pTmpCrsr = pCrsr;
+ if( pTmpCrsr != NULL )
+ {
+ const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
+ sal_uLong nHere = pNode->GetIndex();
+
+ do
+ {
+ // ignore, if no mark
+ if( pTmpCrsr->HasMark() )
+ {
+ bMarked = sal_True;
+ // check whether nHere is 'inside' pCrsr
+ SwPosition* pStart = pTmpCrsr->Start();
+ sal_uLong nStartIndex = pStart->nNode.GetIndex();
+ SwPosition* pEnd = pTmpCrsr->End();
+ sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+ if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex) )
+ {
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+ {
+ if( ( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) )
+ &&( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) ) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+ }
+ else
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ }
+ else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
+ {
+ if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
+ && (nHere < nEndIndex ) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if( xAcc.is() )
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+ }
+ else
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ }
+ }
+ }
+ // next PaM in ring
+ pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+ }
+ while( pTmpCrsr != pCrsr );
+ }
+ if( !bMarked )
+ {
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ size_t nNumShapes = nShapes;
+ while( nNumShapes )
+ {
+ if( pShape < pSelShape && (pShape->first==(*aIter).first) )
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ if(xAcc.is())
+ bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+ }
+ --nNumShapes;
+ ++pShape;
+ }
+ }
+ }
+ ++aIter;
+ }//while( aIter != aEndIter )
+ }//else
+ }
+
+ //Checked for FlyFrm
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+ while( aIter != mpFrmMap->end() )
+ {
+ const SwFrm *pFrm = (*aIter).first;
+ if(pFrm->IsFlyFrm())
+ {
+ sal_Bool bFrmChanged = sal_False;
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+
+ if(xAcc.is())
+ {
+ SwAccessibleFrameBase *pAccFrame = (static_cast< SwAccessibleFrameBase * >(xAcc.get()));
+ bFrmChanged = pAccFrame->SetSelectedState( sal_True );
+ if (bFrmChanged)
+ {
+ const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( pFrm );
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ if (pFrmFmt)
+ {
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+ {
+ uno::Reference< XAccessible > xAccParent = pAccFrame->getAccessibleParent();
+ if (xAccParent.is())
+ {
+ uno::Reference< XAccessibleContext > xAccContext = xAccParent->getAccessibleContext();
+ if(xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xAccContext.get());
+ if(pAccFrame->IsSeletedInDoc())
+ {
+ m_setParaAdd.insert(pAccPara);
+ }
+ else if(m_setParaAdd.count(pAccPara) == 0)
+ {
+ m_setParaRemove.insert(pAccPara);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ++aIter;
+ }
+ typedef std::vector< SwAccessibleContext* > VEC_PARA;
+ VEC_PARA vecAdd;
+ VEC_PARA vecRemove;
+ //Checked for Paras.
+ SwPaM* pTmpCrsr = pCrsr;
+ sal_Bool bMarkChanged = sal_False;
+ SwAccessibleContextMap_Impl mapTemp;
+ if( pTmpCrsr != NULL )
+ {
+ do
+ {
+ if( pTmpCrsr->HasMark() )
+ {
+ SwNodeIndex nStartIndex( pTmpCrsr->Start()->nNode );
+ SwNodeIndex nEndIndex( pTmpCrsr->End()->nNode );
+ while(nStartIndex <= nEndIndex)
+ {
+ SwFrm *pFrm = NULL;
+ if(nStartIndex.GetNode().IsCntntNode())
+ {
+ SwCntntNode* pCNd = (SwCntntNode*)&(nStartIndex.GetNode());
+ SwClientIter aClientIter( *pCNd );
+ pFrm = dynamic_cast< SwFrm* >(aClientIter.SwClientIter_First());
+ }
+ else if( nStartIndex.GetNode().IsTableNode() )
+ {
+ SwTableNode * pTable= (SwTableNode *)&(nStartIndex.GetNode());
+ SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(pTable->GetTable().GetFrmFmt());
+ SwClientIter aClientIter( *pFmt );
+ pFrm = dynamic_cast< SwFrm* >(aClientIter.SwClientIter_First());
+ }
+
+ if( pFrm && mpFrmMap)
+ {
+ aIter = mpFrmMap->find( pFrm );
+ if( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+ sal_Bool isChanged = sal_False;
+ if( xAcc.is() )
+ {
+ isChanged = (static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_True );
+ }
+ if(!isChanged)
+ {
+ SwAccessibleContextMap_Impl::iterator aEraseIter = mpSeletedFrmMap->find( pFrm );
+ if(aEraseIter != mpSeletedFrmMap->end())
+ mpSeletedFrmMap->erase(aEraseIter);
+ }
+ else
+ {
+ bMarkChanged = sal_True;
+ vecAdd.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+ }
+
+ mapTemp.insert( SwAccessibleContextMap_Impl::value_type( pFrm, xAcc ) );
+ }
+ }
+ nStartIndex++;
+ }
+ }
+ pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+ }
+ while( pTmpCrsr != pCrsr );
+ }
+ if( !mpSeletedFrmMap )
+ mpSeletedFrmMap = new SwAccessibleContextMap_Impl;
+ if( !mpSeletedFrmMap->empty() )
+ {
+ aIter = mpSeletedFrmMap->begin();
+ while( aIter != mpSeletedFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xAcc = (*aIter).second;
+ if(xAcc.is())
+ (static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_False );
+ ++aIter;
+ vecRemove.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+ }
+ bMarkChanged = sal_True;
+ mpSeletedFrmMap->clear();
+ }
+
+ if( !mapTemp.empty() )
+ {
+ aIter = mapTemp.begin();
+ while( aIter != mapTemp.end() )
+ {
+ mpSeletedFrmMap->insert( SwAccessibleContextMap_Impl::value_type( (*aIter).first, (*aIter).second ) );
+ ++aIter;
+ }
+ mapTemp.clear();
+ }
+ if( bMarkChanged && mpFrmMap)
+ {
+ VEC_PARA::iterator vi = vecAdd.begin();
+ for (; vi != vecAdd.end() ; ++vi)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ SwAccessibleContext* pAccPara = *vi;
+ if (pAccPara)
+ {
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ vi = vecRemove.begin();
+ for (; vi != vecRemove.end() ; ++vi)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+ SwAccessibleContext* pAccPara = *vi;
+ if (pAccPara)
+ {
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+}
+
+//Marge with DoInvalidateShapeFocus
+void SwAccessibleMap::DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode /*=sal_False*/)
{
SwAccessibleObjShape_Impl *pShapes = 0;
SwAccessibleObjShape_Impl *pSelShape = 0;
@@ -1055,6 +1474,13 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
const SwFEShell *pFESh = dynamic_cast< const SwFEShell * >( pVSh );
sal_uInt32 nSelShapes = pFESh ? pFESh->GetNumberOfSelectedObjects() : 0;
+
+ //when InvalidateFocus Call this function ,and the current selected shape count is not 1 ,
+ //return
+ if (bInvalidateFocusMode && nSelShapes != 1)
+ {
+ return;
+ }
{
vos::OGuard aGuard( maMutex );
if( mpShapeMap )
@@ -1063,24 +1489,71 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
if( pShapes )
{
- ::std::list< const SwFrm * > aParents;
+ typedef std::vector< ::vos::ORef < ::accessibility::AccessibleShape > > VEC_SHAPE;
+ VEC_SHAPE vecxShapeAdd;
+ VEC_SHAPE vecxShapeRemove;
+ int nCountSelectedShape=0;
+
Window *pWin = GetShell()->GetWin();
sal_Bool bFocused = pWin && pWin->HasFocus();
SwAccessibleObjShape_Impl *pShape = pShapes;
+ int nShapeCount = nShapes;
+ while( nShapeCount )
+ {
+ //if( pShape->second.isValid() )
+ if (pShape->second.isValid() && IsInSameLevel(pShape->first, pFESh))
+ {
+ if( pShape < pSelShape )
+ {
+ if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
+ {
+ vecxShapeRemove.push_back(pShape->second);
+ }
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ }
+ }
+ --nShapeCount;
+ ++pShape;
+ }
+
+ VEC_SHAPE::iterator vi =vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+ if (pAccShape)
+ {
+ pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
+ }
+ }
+
+ pShape = pShapes;
while( nShapes )
{
- if( pShape->second.isValid() )
+ //if( pShape->second.isValid() )
+ if (pShape->second.isValid() && IsInSameLevel(pShape->first, pFESh))
{
- sal_Bool bChanged;
+ // IA2 - why?
+ // sal_Bool bChanged;
if( pShape >= pSelShape )
{
- bChanged =
- pShape->second->SetState( AccessibleStateType::SELECTED );
+ // IA2: first fire focus event
+ // bChanged = pShape->second->SetState( AccessibleStateType::SELECTED );
+
+ //first fire focus event
if( bFocused && 1 == nSelShapes )
pShape->second->SetState( AccessibleStateType::FOCUSED );
else
pShape->second->ResetState( AccessibleStateType::FOCUSED );
+
+ // IA2 CWS:
+ if(pShape->second->SetState( AccessibleStateType::SELECTED ))
+ {
+ vecxShapeAdd.push_back(pShape->second);
+ }
+ ++nCountSelectedShape;
}
+ /* MT: This still was in DEV300m80, but was removed in IA2 CWS.
+ Someone needs to check what should happen here, see original diff CWS oo31ia2 vs. OOO310M11
else
{
bChanged =
@@ -1094,47 +1567,97 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
GetShell()->IsPreView() );
aParents.push_back( pParent );
}
+ */
}
--nShapes;
++pShape;
}
- if( aParents.size() > 0 )
+
+ const int SELECTION_WITH_NUM =10;
+ if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
{
- ::std::list< const SwFrm * >::const_iterator aIter = aParents.begin();
- ::std::list< const SwFrm * >::const_iterator aEndIter = aParents.end();
- while( aIter != aEndIter )
+ uno::Reference< XAccessible > xDoc = GetDocumentView( );
+ SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
+ if (pCont)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+ pCont->FireAccessibleEvent(aEvent);
+ }
+ }
+ else
+ {
+ short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
+ if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
+ {
+ nEventID = AccessibleEventId::SELECTION_CHANGED;
+ }
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
{
- ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+ if (pAccShape)
{
- vos::OGuard aGuard( maMutex );
- if( mpFrmMap )
+ pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
+ }
+ }
+ }
+
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+ if (pAccShape)
+ {
+ SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape());
+ SwFrmFmt *pFrmFmt = pObj ? FindFrmFmt( pObj ) : NULL;
+ if (pFrmFmt)
+ {
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
{
- SwAccessibleContextMap_Impl::const_iterator aMapIter =
- mpFrmMap->find( *aIter );
- if( aMapIter != mpFrmMap->end() )
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ if (xPara.is())
{
- uno::Reference < XAccessible > xAcc( (*aMapIter).second );
- xParentAccImpl =
- static_cast< SwAccessibleContext *>( xAcc.get() );
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ {
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (pAccPara)
+ {
+ m_setParaAdd.insert(pAccPara);
+ }
+ }
}
}
}
- if( xParentAccImpl.isValid() )
+ }
+ }
+ vi = vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+ if (pAccShape)
+ {
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
{
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
- xParentAccImpl->FireAccessibleEvent( aEvent );
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (m_setParaAdd.count(pAccPara) == 0 )
+ {
+ m_setParaRemove.insert(pAccPara);
+ }
}
-
- ++aIter;
}
}
-
delete[] pShapes;
}
}
+//Marge with DoInvalidateShapeSelection
+/*
void SwAccessibleMap::DoInvalidateShapeFocus()
{
const ViewShell *pVSh = GetShell();
@@ -1177,7 +1700,8 @@ void SwAccessibleMap::DoInvalidateShapeFocus()
delete[] pShapes;
}
}
-
+*/
+//-----IAccessibility2 Implementation 2009
SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) :
mpFrmMap( 0 ),
@@ -1193,7 +1717,8 @@ SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) :
mnPara( 1 ),
mnFootnote( 1 ),
mnEndnote( 1 ),
- mbShapeSelected( sal_False )
+ mbShapeSelected( sal_False ),
+ mpSeletedFrmMap(NULL)//IAccessibility2 Implementation 2009
{
pSh->GetLayout()->AddAccessibleShell();
}
@@ -1214,10 +1739,28 @@ SwAccessibleMap::~SwAccessibleMap()
}
}
+ //IAccessibility2 Implementation 2009-----
+ if(xAcc.is())
+ {
SwAccessibleDocument *pAcc =
static_cast< SwAccessibleDocument * >( xAcc.get() );
pAcc->Dispose( sal_True );
-
+ }
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+ while( aIter != mpFrmMap->end() )
+ {
+ uno::Reference < XAccessible > xTmp = (*aIter).second;
+ if( xTmp.is() )
+ {
+ SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() );
+ pTmp->SetMap(NULL);
+ }
+ ++aIter;
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
{
vos::OGuard aGuard( maMutex );
#ifdef DBG_UTIL
@@ -1298,6 +1841,7 @@ SwAccessibleMap::~SwAccessibleMap()
mpEvents = 0;
}
mpVSh->GetLayout()->RemoveAccessibleShell();
+ delete mpSeletedFrmMap;//IAccessibility2 Implementation 2009
}
uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
@@ -1429,7 +1973,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm,
sal_Bool bIsEndnote =
SwAccessibleFootnote::IsEndnote( pFtnFrm );
pAcc = new SwAccessibleFootnote( this, bIsEndnote,
- (bIsEndnote ? mnEndnote++ : mnFootnote++),
+ /*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/
pFtnFrm );
}
break;
@@ -1584,6 +2128,10 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
}
// TODO: focus!!!
}
+ //IAccessibility2 Implementation 2009-----
+ if (xAcc.is())
+ AddGroupContext(pObj, xAcc);
+ //-----IAccessibility2 Implementation 2009
}
}
}
@@ -1594,6 +2142,105 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext(
return xAcc;
}
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleMap::IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh)
+{
+ if (pFESh && pObj)
+ return pFESh->IsObjSameLevelWithMarked(*pObj);
+ return sal_False;
+}
+void SwAccessibleMap::AddShapeContext(const SdrObject *pObj, uno::Reference < XAccessible > xAccShape)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::value_type aEntry( pObj, xAccShape );
+ mpShapeMap->insert( aEntry );
+ }
+
+}
+
+//Added by yanjun for sym2_6407
+void SwAccessibleMap::RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent)
+{
+ vos::OGuard aGuard( maMutex );
+ if (mpShapeMap && pParentObj && pParentObj->getChildrenOfSdrObject() && xAccParent.is())
+ {
+ uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+ if (xContext.is())
+ {
+ for (sal_Int32 i = 0; i < xContext->getAccessibleChildCount(); ++i)
+ {
+ uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+ if (xChild.is())
+ {
+ uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if (xChildContext.is())
+ {
+ if (xChildContext->getAccessibleRole() == AccessibleRole::SHAPE)
+ {
+ ::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+ uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+ if (xShape.is())
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+ if (pObj)
+ RemoveContext(pObj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+//End
+
+
+void SwAccessibleMap::AddGroupContext(const SdrObject *pParentObj, uno::Reference < XAccessible > xAccParent)
+{
+ vos::OGuard aGuard( maMutex );
+ if( mpShapeMap )
+ {
+ //here get all the sub list.
+ if (pParentObj->getChildrenOfSdrObject())
+ {
+ if (xAccParent.is())
+ {
+ uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+ if (xContext.is())
+ {
+ sal_Int32 nChildren = xContext->getAccessibleChildCount();
+ for(sal_Int32 i = 0; i<nChildren; i++)
+ {
+ uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+ if (xChild.is())
+ {
+ uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if (xChildContext.is())
+ {
+ short nRole = xChildContext->getAccessibleRole();
+ if (nRole == AccessibleRole::SHAPE)
+ {
+ ::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+ uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+ if (xShape.is())
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+ AddShapeContext(pObj, xChild);
+ AddGroupContext(pObj,xChild);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+//-----IAccessibility2 Implementation 2009
::vos::ORef < ::accessibility::AccessibleShape > SwAccessibleMap::GetContextImpl(
const SdrObject *pObj,
@@ -1656,13 +2303,16 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
mpShapeMap->find( pObj );
if( aIter != mpShapeMap->end() )
{
+ //IAccessible2 Implementation 2009 ----
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
mpShapeMap->erase( aIter );
-
+ RemoveGroupContext(pObj, xAcc);
// The shape selection flag is not cleared, but one might do
// so but has to make sure that the removed context is the one
// that is selected.
- if( mpShapeMap->empty() )
+ if( mpShapeMap && mpShapeMap->empty() )
+ //---- IAccessible2 Implementation 2009
{
delete mpShapeMap;
mpShapeMap = 0;
@@ -1809,6 +2459,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
{
::vos::ORef< SwAccessibleContext > xAccImpl;
::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ const SwFrm *pParent =NULL; //IAccessibility2 Implementation 2009
{
vos::OGuard aGuard( maMutex );
@@ -1831,7 +2482,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
{
// Otherwise we look if the parent is accessible.
// If not, there is nothing to do.
- const SwFrm *pParent =
+ pParent = //IAccessibility2 Implementation 2009
SwAccessibleFrame::GetParent( aFrmOrObj,
GetShell()->IsPreView());
@@ -1881,7 +2532,54 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
rOldBox );
}
}
+ //IAccessibility2 Implementation 2009-----
+ else if(pParent)
+ {
+/*
+For child graphic and it's parent paragraph,if split 2 graphic to 2 paragraph,
+will delete one graphic swfrm and new create 1 graphic swfrm ,
+then the new paragraph and the new graphic SwFrm will add .
+but when add graphic SwFrm ,the accessible of the new Paragraph is not created yet.
+so the new graphic accessible 'parent is NULL,
+so run here: save the parent's SwFrm not the accessible object parent,
+*/
+ sal_Bool bIsValidFrm = sal_False;
+ sal_Bool bIsTxtParent = sal_False;
+ if (aFrmOrObj.GetSwFrm())
+ {
+ int nType = pFrm->GetType();
+ if ( FRM_FLY == nType )
+ {
+ bIsValidFrm =sal_True;
+ }
+ }
+ else if(pObj)
+ {
+ int nType = pParent->GetType();
+ if (FRM_TXT == nType)
+ {
+ bIsTxtParent =sal_True;
+ }
+ }
+// sal_Bool bIsVisibleChildrenOnly =aFrmOrObj.IsVisibleChildrenOnly() ;
+// sal_Bool bIsBoundAsChar =aFrmOrObj.IsBoundAsChar() ;//bIsVisibleChildrenOnly && bIsBoundAsChar &&
+ if((bIsValidFrm || bIsTxtParent) )
+ {
+ if( GetShell()->ActionPend() )
+ {
+ SwAccessibleEvent_Impl aEvent(
+ SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+ pParent, aFrmOrObj, rOldBox );
+ AppendEvent( aEvent );
+ }
+ else
+ {
+ OSL_ENSURE(false,"");
+ }
+ }
+ }
}
+ //-----IAccessibility2 Implementation 2009
}
void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
@@ -2020,6 +2718,29 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
mpFrmMap->find( aFrmOrObj.GetSwFrm() );
if( aIter != mpFrmMap->end() )
xAcc = (*aIter).second;
+ //IAccessibility2 Implementation 2009-----
+ else
+ {
+ SwRect rcEmpty;
+ const SwTabFrm* pTabFrm = aFrmOrObj.GetSwFrm()->FindTabFrm();
+ if (pTabFrm)
+ {
+ InvalidatePosOrSize(pTabFrm,0,0,rcEmpty);
+ }
+ else
+ {
+ InvalidatePosOrSize(aFrmOrObj.GetSwFrm(),0,0,rcEmpty);
+ }
+
+
+ aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
// For cells, some extra thoughts are necessary,
// because invalidating the cursor for one cell
@@ -2048,18 +2769,204 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
xAcc = GetContext( aFrmOrObj.GetSwFrm(), sal_True );
}
}
+ //IAccessibility2 Implementation 2009-----
+ else if (bShapeSelected)
+ {
+ const SwFEShell *pFESh = pVSh ? static_cast< const SwFEShell * >( pVSh ) : NULL ;
+ if(pFESh)
+ {
+ SdrObject* pObj = pFESh->getSingleSelected();
+
+ if(pObj)
+ {
+ ::vos::ORef < ::accessibility::AccessibleShape > pAccShapeImpl = GetContextImpl(pObj,NULL,sal_False);
+
+ if (!pAccShapeImpl.isValid())
+ {
+ while(pObj && pObj->GetParentSdrObject())
+ {
+ pObj = pObj->GetParentSdrObject();
+ }
+
+ if (pObj != NULL)
+ {
+ const SwFrm *pParent = SwAccessibleFrame::GetParent( SwAccessibleChild(pObj), GetShell()->IsPreView() );
+ if( pParent )
+ {
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl = GetContextImpl(pParent,sal_False);
+ if (!xParentAccImpl.isValid())
+ {
+ const SwTabFrm* pTabFrm = pParent->FindTabFrm();
+ if (pTabFrm)
+ {
+ //The Table should not add in acc.because the "pParent" is not add to acc .
+ uno::Reference< XAccessible> xAccParentTab = GetContext(pTabFrm,sal_True);//Should Create.
+
+ const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pTabFrm), GetShell()->IsPreView() );
+ if (pParentRoot)
+ {
+ ::vos::ORef< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+ if(xParentAccImplRoot.isValid())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccParentTab;
+ xParentAccImplRoot->FireAccessibleEvent( aEvent );
+ }
+ }
+
+ //Get "pParent" acc again.
+ xParentAccImpl = GetContextImpl(pParent,sal_False);
+ }
+ else
+ {
+ //directly create this acc para .
+ xParentAccImpl = GetContextImpl(pParent,sal_True);//Should Create.
+
+ const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pParent), GetShell()->IsPreView() );
+
+ ::vos::ORef< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+ if(xParentAccImplRoot.isValid())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= uno::Reference< XAccessible>(xParentAccImpl.getBodyPtr());
+ xParentAccImplRoot->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ if (xParentAccImpl.isValid())
+ {
+ uno::Reference< XAccessible> xAccShape =
+ GetContext(pObj,xParentAccImpl.getBodyPtr(),sal_True);
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccShape;
+ xParentAccImpl->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
+ m_setParaAdd.clear();
+ m_setParaRemove.clear();
if( xOldAcc.is() && xOldAcc != xAcc )
InvalidateCursorPosition( xOldAcc );
if( bOldShapeSelected || bShapeSelected )
InvalidateShapeSelection();
if( xAcc.is() )
InvalidateCursorPosition( xAcc );
+
+ InvalidateShapeInParaSelection();
+
+ SET_PARA::iterator si = m_setParaRemove.begin();
+ for (; si != m_setParaRemove.end() ; ++si)
+ {
+ SwAccessibleParagraph* pAccPara = *si;
+ if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0)
+ {
+ if(pAccPara->SetSelectedState(sal_False))
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ }
+ si = m_setParaAdd.begin();
+ for (; si != m_setParaAdd.end() ; ++si)
+ {
+ SwAccessibleParagraph* pAccPara = *si;
+ if(pAccPara && pAccPara->SetSelectedState(sal_True))
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ pAccPara->FireAccessibleEvent( aEvent );
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
+}
+
+//IAccessibility2 Implementation 2009-----
+//Notify the page change event to bridge.
+void SwAccessibleMap::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
+ aEvent.OldValue <<= nOldPage;
+ aEvent.NewValue <<= nNewPage;
+ pAcc->FireAccessibleEvent( aEvent );
+ }
+ }
+}
+
+void SwAccessibleMap::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SECTION_CHANGED;
+ aEvent.OldValue <<= nOldSection;
+ aEvent.NewValue <<= nNewSection;
+ pAcc->FireAccessibleEvent( aEvent );
+
+ }
+ }
}
+void SwAccessibleMap::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+ uno::Reference<XAccessible> xAcc = GetDocumentView( );
+ if ( xAcc.is() )
+ {
+ SwAccessibleDocumentBase *pAcc =
+ static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+ if (pAcc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::COLUMN_CHANGED;
+ aEvent.OldValue <<= nOldColumn;
+ aEvent.NewValue <<= nNewColumn;
+ pAcc->FireAccessibleEvent( aEvent );
+
+ }
+ }
+}
+//-----IAccessibility2 Implementation 2009
void SwAccessibleMap::InvalidateFocus()
{
+ //IAccessibility2 Implementation 2009-----
+ if(GetShell()->IsPreView())
+ {
+ uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
+ if (xAcc.get())
+ {
+ SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview *>(xAcc.get());
+ if (pAccPreview)
+ {
+ pAccPreview->InvalidateFocus();
+ return ;
+ }
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
uno::Reference < XAccessible > xAcc;
sal_Bool bShapeSelected;
{
@@ -2075,10 +2982,12 @@ void SwAccessibleMap::InvalidateFocus()
static_cast< SwAccessibleContext *>( xAcc.get() );
pAccImpl->InvalidateFocus();
}
- else if( bShapeSelected )
+ //IAccessibility2 Implementation 2009-----
+ else
{
- DoInvalidateShapeFocus();
+ DoInvalidateShapeSelection(sal_True);
}
+ //-----IAccessibility2 Implementation 2009
}
void SwAccessibleMap::SetCursorContext(
@@ -2361,6 +3270,9 @@ void SwAccessibleMap::FireEvents()
if( mpEvents )
{
mpEvents->SetFiring();
+ //IAccessibility2 Implementation 2009-----
+ mpEvents->MoveInvalidXAccToEnd();
+ //-----IAccessibility2 Implementation 2009
SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin();
while( aIter != mpEvents->end() )
{
@@ -2551,6 +3463,94 @@ sal_Bool SwAccessibleMap::ReplaceChild (
return sal_True;
}
+//IAccessibility2 Implementation 2009-----
+//Get the accessible control shape from the model object, here model object is with XPropertySet type
+::accessibility::AccessibleControlShape * SwAccessibleMap::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( mpShapeMap )
+ {
+ SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+ SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+ while( aIter != aEndIter)
+ {
+ uno::Reference < XAccessible > xAcc( (*aIter).second );
+ ::accessibility::AccessibleShape *pAccShape =
+ static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
+ if(pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
+ {
+ ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+ if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+ return pCtlAccShape;
+ }
+ ++aIter;
+ }
+ }
+ return NULL;
+}
+
+::com::sun::star::uno::Reference< XAccessible >
+ SwAccessibleMap::GetAccessibleCaption (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SdrObject* captionedObject = GetSdrObjectFromXShape(xShape);
+
+ // replace formally used 'GetUserCall()' by new notify/listener mechanism
+ const SwDrawContact* pContact = static_cast< const SwDrawContact* >(findConnectionToSdrObject(captionedObject));
+
+ ASSERT( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
+ "fail" );
+ if( !pContact )
+ return 0;
+
+ SwDrawFrmFmt *pCaptionedFmt = (SwDrawFrmFmt *)pContact->GetFmt();
+ if( !pCaptionedFmt )
+ return 0;
+
+ SwFlyFrm* pFrm = NULL;
+ if (pCaptionedFmt->HasCaption())
+ {
+ const SwFrmFmt *pCaptionFrmFmt = pCaptionedFmt->GetCaptionFmt();
+ SwClientIter aIter (*(SwModify*)pCaptionFrmFmt);
+ pFrm = dynamic_cast< SwFlyFrm* >(aIter.SwClientIter_First());
+ }
+ if (!pFrm)
+ return 0;
+ //SwFrmFmt* pFrm = pCaptionedFmt->GetCaptionFmt();
+ uno::Reference < XAccessible > xAcc( GetContext((SwFrm*)pFrm,sal_True) );
+ //Reference < XAccessibleShape > xAccShape( xAcc, UNO_QUERY );
+
+ uno::Reference< XAccessibleContext > xAccContext = xAcc->getAccessibleContext();
+ if( xAccContext.is() )
+ { //get the parent of caption frame, which is paragaph
+ uno::Reference< XAccessible > xAccParent = xAccContext->getAccessibleParent();
+ if(xAccParent.is())
+ {
+ //get the great parent of caption frame which is text frame.
+ uno::Reference< XAccessibleContext > xAccParentContext = xAccParent->getAccessibleContext();
+ uno::Reference< XAccessible > xAccGreatParent = xAccParentContext->getAccessibleParent();
+ if(xAccGreatParent.is())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAccParent;
+ ( static_cast< SwAccessibleContext * >(xAccGreatParent.get()) )->FireAccessibleEvent( aEvent );
+
+ }
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAcc;
+ ( static_cast< SwAccessibleContext * >(xAccParent.get()) )->FireAccessibleEvent( aEvent );
+ }
+ }
+
+ if(xAcc.get())
+ return xAcc;
+ else
+ return NULL;
+
+}
+//-----IAccessibility2 Implementation 2009
Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
{
Point aPoint;
@@ -2876,3 +3876,10 @@ const SwRect& SwAccessibleMap::GetVisArea() const
: GetShell()->VisArea();
}
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleMap::IsDocumentSelAll()
+{
+ return GetShell()->GetDoc()->IsPrepareSelAll();
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index f33498e9e06d..3c330dd17b0b 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -39,10 +39,20 @@
#include <hints.hxx>
// <--
#include "accnotextframe.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <fmturl.hxx>
+#include <accnotexthyperlink.hxx>
+#include <svtools/imap.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <doc.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
+using utl::AccessibleRelationSetHelper;
+//-----IAccessibility2 Implementation 2009
const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
{
@@ -52,7 +62,13 @@ const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
{
const SwCntntFrm *pCntFrm =
static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
- pNd = pCntFrm->GetNode()->GetNoTxtNode();
+ //IAccessibility2 Implementation 2009-----
+ const SwCntntNode* pSwCntntNode = pCntFrm->GetNode();
+ if(pSwCntntNode != NULL)
+ {
+ pNd = pSwCntntNode->GetNoTxtNode();
+ }
+ //-----IAccessibility2 Implementation 2009
}
return pNd;
@@ -203,6 +219,12 @@ OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleContext )
+ //IAccessibility2 Implementation 2009-----
+ // OUString longDesc;
+ // const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
+ // longDesc = OUString( pFlyFmt->GetLongDescription() );
+ // return longDesc; MT: Do not return longDesc, which still is empty - why was the line above commented out?
+ //-----IAccessibility2 Implementation 2009
return msDesc;
}
@@ -224,6 +246,15 @@ uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aTyp
aAny <<= xImage;
return aAny;
}
+ //IAccessibility2 Implementation 2009-----
+ else if ( aType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
+ {
+ uno::Reference<XAccessibleHypertext> aAccHypertext = this;
+ uno::Any aAny;
+ aAny <<= aAccHypertext;
+ return aAny;
+ }
+ //-----IAccessibility2 Implementation 2009
else
return SwAccessibleContext::queryInterface( aType );
}
@@ -269,3 +300,137 @@ sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageWidth( )
{
return getSize().Width;
}
+//IAccessibility2 Implementation 2009-----
+//===== XAccesibleText ==================================================
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+sal_Unicode SAL_CALL SwAccessibleNoTextFrame::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SwAccessibleNoTextFrame::getCharacterAttributes( sal_Int32 , const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence<beans::PropertyValue> aValues(0);
+ return aValues;
+}
+::com::sun::star::awt::Rectangle SAL_CALL SwAccessibleNoTextFrame::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
+}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setSelection( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getTextRange( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextAtIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::accessibility::TextSegment aResult;
+ return aResult;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+
+
+//
+// XAccessibleHyperText
+//
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ sal_Int32 nCount = 0;
+ SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+ if(aURL.GetMap() || aURL.GetURL().Len())
+ nCount = 1;
+
+ return nCount;
+}
+
+uno::Reference< XAccessibleHyperlink > SAL_CALL
+ SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ uno::Reference< XAccessibleHyperlink > xRet;
+
+ SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+ if( nLinkIndex > 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ if( aURL.GetMap() || aURL.GetURL().Len() )
+ {
+ if ( !alink.is() )
+ {
+ alink = new SwAccessibleNoTextHyperlink( this, GetFrm() );
+ }
+
+ return alink;
+ }
+
+ return NULL;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkIndex( sal_Int32 )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+ sal_Int32 nRet = 0;
+
+ return nRet;
+}
+
+AccessibleRelation SwAccessibleNoTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
+{
+ uno::Sequence<uno::Reference<XInterface> > aSequence(1);
+ aSequence[0] = GetMap()->GetContext( pFrm );
+ return AccessibleRelation( nType, aSequence );
+}
+
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleNoTextFrame::getAccessibleRelationSet( )
+ throw ( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC( XAccessibleContext );
+
+ // get the caption frame, and insert label relations into helper
+
+ AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
+
+ SwFlyFrm* pFlyFrm = getFlyFrm();
+ DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
+
+ SwFlyFrm* pCaptionFrm = NULL;
+ const SwFrmFmt* pFrm = pFlyFrm ->GetFmt()->GetCaptionFmt();
+ if (pFrm)
+ {
+ SwClientIter aIter (*(SwModify*)pFrm);
+ pCaptionFrm = dynamic_cast< SwFlyFrm* >(aIter.SwClientIter_First());
+ }
+ if(pCaptionFrm!=NULL)
+ {
+ pHelper->AddRelation( makeRelation( AccessibleRelationType::DESCRIBED_BY, pCaptionFrm ) );
+ }
+
+ return pHelper;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx
index ebcb9c282245..6c7725c00af9 100644
--- a/sw/source/core/access/accnotextframe.hxx
+++ b/sw/source/core/access/accnotextframe.hxx
@@ -24,13 +24,30 @@
#define _ACCNOTEXTFRAME_HXX
#include "accframebase.hxx"
#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#endif
+
+namespace utl { class AccessibleRelationSetHelper; }
+namespace com { namespace star {
+ namespace accessibility { struct AccessibleRelation; }
+} }
class SwFlyFrm;
class SwNoTxtNode;
+class SwAccessibleNoTextHyperlink;
+//-----IAccessibility2 Implementation 2009
class SwAccessibleNoTextFrame : public SwAccessibleFrameBase,
- public ::com::sun::star::accessibility::XAccessibleImage
+ public ::com::sun::star::accessibility::XAccessibleImage,
+ public ::com::sun::star::accessibility::XAccessibleHypertext//Added by yangzhh for HyperLink
{
+ //IAccessibility2 Implementation 2009-----
+ friend class SwAccessibleNoTextHyperlink;
+ //HyperLinksMap alinksMap;
+ com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > alink;
+ //-----IAccessibility2 Implementation 2009
SwDepend aDepend;
// --> OD 2009-07-14 #i73249#
::rtl::OUString msTitle;
@@ -100,6 +117,51 @@ public:
// The object is not visible an longer and should be destroyed
virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+ //IAccessibility2 Implementation 2009-----
+ virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);//Shen Zhen Jie changed sal_Unicode to sal_uInt32
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleHypertext ============================================
+ virtual sal_Int32 SAL_CALL getHyperLinkCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+ SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ SwAccessibleMap *GetAccessibleMap(){ return GetMap();}
+
+private:
+ com::sun::star::accessibility::AccessibleRelation makeRelation(
+ sal_Int16 nType, const SwFlyFrm* pFrm );
+
+public:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ //-----IAccessibility2 Implementation 2009
};
diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx
new file mode 100644
index 000000000000..4101ea51adc6
--- /dev/null
+++ b/sw/source/core/access/accnotexthyperlink.cxx
@@ -0,0 +1,232 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <swurl.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <ndtxt.hxx>
+#include <txtinet.hxx>
+#include <frmfmt.hxx>
+
+#include <accnotexthyperlink.hxx>
+
+#include <fmturl.hxx>
+
+#include <svtools/imap.hxx>
+#include <svtools/imapobj.hxx>
+
+#include <accmap.hxx>
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+//using namespace ::rtl;
+
+SwAccessibleNoTextHyperlink::SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm *aFrm, sal_uInt16 nIndex) :
+ xFrame( p ),
+ mpFrm( aFrm ),
+ mnIndex(nIndex)
+{
+}
+
+// XAccessibleAction
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionCount()
+ throw (RuntimeException)
+{
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ return pMap->GetIMapObjectCount();
+ }else if( aURL.GetURL().Len() )
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::doAccessibleAction( sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw new IndexOutOfBoundsException;
+
+ sal_Bool bRet = sal_False;
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if(pMapObj->GetURL().Len())
+ {
+ ViewShell *pVSh = xFrame->GetShell();
+ if( pVSh )
+ {
+ LoadURL( pMapObj->GetURL(), pVSh, URLLOAD_NOFILTER,
+ &pMapObj->GetTarget() );
+ bRet = sal_True;
+ }
+ }
+ }
+ else if( aURL.GetURL().Len() )
+ {
+ ViewShell *pVSh = xFrame->GetShell();
+ if( pVSh )
+ {
+ LoadURL( aURL.GetURL(), pVSh, URLLOAD_NOFILTER,
+ &aURL.GetTargetFrameName() );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+rtl::OUString SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ rtl::OUString sDesc;
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw new IndexOutOfBoundsException;
+
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if(pMapObj->GetDesc().Len())
+ sDesc = rtl::OUString( pMapObj->GetDesc() );
+ else if(pMapObj->GetURL().Len())
+ sDesc = rtl::OUString( pMapObj->GetURL() );
+ }
+ else if( aURL.GetURL().Len() )
+ sDesc = rtl::OUString( aURL.GetName() );
+ //sDesc = rtl::OUString( aURL.GetName() );
+
+ return sDesc;
+}
+
+Reference< XAccessibleKeyBinding > SAL_CALL
+ SwAccessibleNoTextHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessibleKeyBinding > xKeyBinding;
+
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw new IndexOutOfBoundsException;
+
+ bool bIsValid = sal_False;
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if(pMapObj->GetURL().Len())
+ bIsValid = sal_True;
+ }else if( aURL.GetURL().Len() )
+ bIsValid = sal_True;
+
+ if(bIsValid)
+ {
+ ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+ new ::comphelper::OAccessibleKeyBindingHelper();
+ xKeyBinding = pKeyBindingHelper;
+
+ ::com::sun::star::awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ aKeyStroke.KeyCode = KEY_RETURN;
+ aKeyStroke.KeyChar = 0;
+ aKeyStroke.KeyFunc = 0;
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+
+ return xKeyBinding;
+}
+
+// XAccessibleHyperlink
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionAnchor(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw new IndexOutOfBoundsException;
+
+ Any aRet;
+ //SwFrm* pAnchor = ((SwFlyFrm*)mpFrm)->GetAnchor();
+ Reference< XAccessible > xAnchor = xFrame->GetAccessibleMap()->GetContext(mpFrm, sal_True);
+ //SwAccessibleNoTextFrame* pFrame = xFrame.get();
+ //Reference< XAccessible > xAnchor = (XAccessible*)pFrame;
+ aRet <<= xAnchor;
+ return aRet;
+}
+
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionObject(
+ sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw new IndexOutOfBoundsException;
+
+ SwFmtURL aURL( GetFmt()->GetURL() );
+ ::rtl::OUString retText;
+ ImageMap* pMap = aURL.GetMap();
+ if( pMap != NULL )
+ {
+ IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+ if(pMapObj->GetURL().Len())
+ retText = rtl::OUString( pMapObj->GetURL() );
+ }else if( aURL.GetURL().Len() )
+ retText = rtl::OUString( aURL.GetURL() );
+
+ Any aRet;
+ aRet <<= retText;
+ return aRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getStartIndex()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getEndIndex()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::isValid( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SwFmtURL aURL( GetFmt()->GetURL() );
+
+ if( aURL.GetMap() || aURL.GetURL().Len() )
+ return sal_True;
+ return sal_False;
+}
diff --git a/sw/source/core/access/accnotexthyperlink.hxx b/sw/source/core/access/accnotexthyperlink.hxx
new file mode 100644
index 000000000000..29de85d79462
--- /dev/null
+++ b/sw/source/core/access/accnotexthyperlink.hxx
@@ -0,0 +1,93 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _ACCNOTEXTHYPERLINK_HXX
+#define _ACCNOTEXTHYPERLINK_HXX
+
+
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <vos/ref.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <fmtinfmt.hxx>
+#include <frame.hxx>
+#include <layfrm.hxx>
+
+#include "accnotextframe.hxx"
+/*
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::rtl;
+*/
+class SwAccessibleNoTextHyperlink :
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleHyperlink >
+{
+ friend class SwAccessibleNoTextFrame;
+
+ ::vos::ORef< SwAccessibleNoTextFrame > xFrame;
+ const SwFrm *mpFrm;
+ sal_uInt16 mnIndex;
+
+ SwFrmFmt *GetFmt()
+ {
+ return ((SwLayoutFrm*)mpFrm)->GetFmt();
+ }
+public:
+
+ SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm* aFrm, sal_uInt16 nIndex = 0xFFFF );
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+ getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleHyperlink
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject(
+ sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getStartIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEndIndex()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index e5c0c8b68099..8c84b6578265 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -56,6 +56,15 @@
#include <sfx2/dispatch.hxx> // for ExecuteAtViewShell(...)
#include <unotools/charclass.hxx> // for GetWordBoundary
// for get/setCharacterAttribute(...)
+
+#include <reffld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <flddat.hxx>
+#include <fldui.hrc>
+#include "../../ui/inc/fldmgr.hxx"
+#include "fldbas.hxx" // SwField
+#include <svl/svstdarr.hxx>
#include <unocrsr.hxx>
//#include <unoobj.hxx>
#include <unoport.hxx>
@@ -66,7 +75,31 @@
#include <acchypertextdata.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <section.hxx>
+#include <doctxm.hxx>
#include <comphelper/accessibletexthelper.hxx>
+#include <algorithm>
+#include <docufld.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <modcfg.hxx>
+//#include "accnote.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "swmodule.hxx"
+#include "redline.hxx"
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <wrong.hxx>
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include <unosett.hxx>
+#include <paratr.hxx>
+#include <com/sun/star/container/XIndexReplace.hpp>
+//-----IAccessibility2 Implementation 2009
+// --> OD 2006-07-12 #i63870#
#include <unomap.hxx>
#include <unoprnms.hxx>
#include <com/sun/star/text/WritingMode2.hpp>
@@ -86,6 +119,8 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::container;
+using ::rtl::OUString;
using beans::PropertyValue;
using beans::XMultiPropertySet;
@@ -148,6 +183,19 @@ sal_Int32 SwAccessibleParagraph::GetCaretPos()
// same node? Then check whether it's also within 'our' part
// of the paragraph
sal_uInt16 nIndex = pPoint->nContent.GetIndex();
+ //IAccessibility2 Implementation 2009-----
+ if(!GetPortionData().IsValidCorePosition( nIndex ) ||
+ ( GetPortionData().IsZeroCorePositionData() && nIndex== 0) )
+ {
+ const SwTxtFrm *pTxtFrm = dynamic_cast< const SwTxtFrm* >(GetFrm());
+ bool bFormat = (pTxtFrm && pTxtFrm->HasPara());
+ if(bFormat)
+ {
+ ClearPortionData();
+ UpdatePortionData();
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
if( GetPortionData().IsValidCorePosition( nIndex ) )
{
// Yes, it's us!
@@ -391,6 +439,20 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
aEvent.OldValue, aEvent.NewValue );
FireAccessibleEvent( aEvent );
+ //IAccessibility2 Implementation 2009-----
+ uno::Reference< XAccessible > xparent = getAccessibleParent();
+ uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
+ if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+ {
+ SwAccessibleContext* pPara = static_cast< SwAccessibleContext* >(xparent.get());
+ if(pPara)
+ {
+ AccessibleEventObject aParaEvent;
+ aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+ pPara->FireAccessibleEvent(aParaEvent);
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
}
else if( !bVisibleDataFired )
{
@@ -398,6 +460,10 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
}
sal_Bool bNewIsHeading = IsHeading();
+ //IAccessibility2 Implementation 2009-----
+ //Get the real heading level, Heading1 ~ Heading10
+ nHeadingLevel = GetRealHeadingLevel();
+ //-----IAccessibility2 Implementation 2009
sal_Bool bOldIsHeading;
{
vos::OGuard aGuard( aMutex );
@@ -466,6 +532,20 @@ void SwAccessibleParagraph::_InvalidateCursorPos()
if( pWin && pWin->HasFocus() && -1 == nNew )
FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_False );
+ //IAccessibility2 Implementation 2009-----
+ //To send TEXT_SELECTION_CHANGED event
+ sal_Int32 nStart=0;
+ sal_Int32 nEnd =0;
+ sal_Bool bCurSelection=GetSelection(nStart,nEnd);
+ if(m_bLastHasSelection || bCurSelection )
+ {
+ aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
+ aEvent.OldValue <<= uno::Any();
+ aEvent.NewValue <<= uno::Any();
+ FireAccessibleEvent(aEvent);
+ }
+ m_bLastHasSelection =bCurSelection;
+ //-----IAccessibility2 Implementation 2009
}
}
@@ -498,20 +578,35 @@ SwAccessibleParagraph::SwAccessibleParagraph(
, pHyperTextData( NULL )
, nOldCaretPos( -1 )
, bIsHeading( sal_False )
+ //IAccessibility2 Implementation 2009-----
+ //Get the real heading level, Heading1 ~ Heading10
+ , nHeadingLevel (-1)
+ //-----IAccessibility2 Implementation 2009
, aSelectionHelper( *this )
// --> OD 2010-02-19 #i108125#
, mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) )
// <--
+ //IAccessibility2 Implementation 2009-----
+ , m_bLastHasSelection(false) //To add TEXT_SELECTION_CHANGED event
+ //-----IAccessibility2 Implementation 2009
{
vos::OGuard aGuard(Application::GetSolarMutex());
bIsHeading = IsHeading();
+ //IAccessibility2 Implementation 2009-----
+ //Get the real heading level, Heading1 ~ Heading10
+ nHeadingLevel = GetRealHeadingLevel();
+ //-----IAccessibility2 Implementation 2009
// --> OD 2004-09-27 #117970# - set an empty accessibility name for paragraphs
SetName( ::rtl::OUString() );
// <--
// If this object has the focus, then it is remembered by the map itself.
- nOldCaretPos = GetCaretPos();
+ //IAccessibility2 Implementation 2009-----
+ // not necessary to remember this pos here. Generally, the pos will be updated in invalidateXXX method, which may fire the
+ //Focus event based on the difference of new & old caret pos.
+ //nOldCaretPos = GetCaretPos();
+ //-----IAccessibility2 Implementation 2009
}
SwAccessibleParagraph::~SwAccessibleParagraph()
@@ -635,7 +730,76 @@ sal_Bool SwAccessibleParagraph::IsValidRange(
{
return IsValidPosition(nBegin, nLength) && IsValidPosition(nEnd, nLength);
}
+//IAccessibility2 Implementation 2009-----
+SwTOXSortTabBase* SwAccessibleParagraph::GetTOXSortTabBase()
+{
+ const SwTxtNode* pTxtNd = GetTxtNode();
+ if( pTxtNd )
+ {
+ const SwSectionNode * pSectNd = pTxtNd->FindSectionNode();
+ if( pSectNd )
+ {
+ const SwSection * pSect = &pSectNd->GetSection();
+ SwTOXBaseSection *pTOXBaseSect = (SwTOXBaseSection *)pSect;
+ if( pSect->GetType() == TOX_CONTENT_SECTION )
+ {
+ SwTOXSortTabBase* pSortBase = 0;
+ int nSize = pTOXBaseSect->GetTOXSortTabBases()->Count();
+
+ for(int nIndex = 0; nIndex<nSize; nIndex++ )
+ {
+ pSortBase = (*(pTOXBaseSect->GetTOXSortTabBases()))[nIndex];
+ if( pSortBase->pTOXNd == pTxtNd )
+ break;
+ }
+
+ if (pSortBase)
+ {
+ return pSortBase;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+short SwAccessibleParagraph::GetTOCLevel()
+{
+ SwTOXSortTabBase* pToxBase = GetTOXSortTabBase();
+ if( pToxBase )
+ {
+ const SwCntntNode* pNd = pToxBase->aTOXSources[0].pNd;
+ if( pNd )
+ return pToxBase->GetLevel();
+ else
+ return -1;
+ }
+ else
+ return -1;
+}
+//the function is to check whether the position is in a redline range.
+const SwRedline* SwAccessibleParagraph::GetRedlineAtIndex( sal_Int32 )
+{
+ const SwRedline* pRedline = NULL;
+ SwPaM* pCrSr = GetCursor( true );
+ if ( pCrSr )
+ {
+ SwPosition* pStart = pCrSr->Start();
+ const SwTxtNode* pNode = GetTxtNode();
+ if ( pNode )
+ {
+ const SwDoc* pDoc = pNode->GetDoc();
+ if ( pDoc )
+ {
+ pRedline = pDoc->GetRedline( *pStart, NULL );
+ }
+ }
+ }
+
+ return pRedline;
+}
+//-----IAccessibility2 Implementation 2009
//
// text boundaries
@@ -647,6 +811,11 @@ sal_Bool SwAccessibleParagraph::GetCharBoundary(
const ::rtl::OUString&,
sal_Int32 nPos )
{
+ //IAccessibility2 Implementation 2009-----
+ if( GetPortionData().FillBoundaryIFDateField( rBound, nPos) )
+ return sal_True;
+ //-----IAccessibility2 Implementation 2009
+
rBound.startPos = nPos;
rBound.endPos = nPos+1;
return sal_True;
@@ -673,6 +842,46 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
// (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
const sal_uInt16 nWordType = i18n::WordType::ANY_WORD;
+/*
+ // get word boundary, as the Break-Iterator sees fit.
+ sal_Unicode SpaceChar(' ');
+ if (rText.getCodePointAt(nPos) == SpaceChar)
+ {
+ int nStartPos = nPos;
+ int nEndPos = nPos+1;
+ while (nStartPos >= 0 && rText.getCodePointAt(nStartPos) == SpaceChar)
+ --nStartPos;
+ while (nEndPos < rText.getLength() && rText.getCodePointAt(nEndPos) == SpaceChar)
+ ++nEndPos;
+ //Get the previous word boundary + the followed space characters
+ if (nStartPos >= 0)
+ {
+ rBound = pBreakIt->xBreak->getWordBoundary( rText, nStartPos, aLocale, nWordType, sal_True );
+ rBound.endPos += (nEndPos-nStartPos - 1);
+ }
+ //When the frontal characters are whitespace, return the all space characters directly.
+ else
+ {
+ rBound.startPos = 0;
+ rBound.endPos = nEndPos;
+ }
+ }
+ // add the " " into the word boundry
+ else
+ {
+ rBound = pBreakIt->xBreak->getWordBoundary(rText, nPos, aLocale, nWordType, sal_True );
+ sal_Int32 nEndPos = rBound.endPos, nLength = rText.getLength();
+ while ( nEndPos < nLength && rText.getCodePointAt(nEndPos) == SpaceChar )
+ nEndPos++;
+ rBound.endPos = nEndPos;
+ }
+ //IAccessibility2 Implementation 2009-----
+ tabCharInWord( nPos, rBound);
+ if( GetPortionData().FillBoundaryIFDateField( rBound, rBound.startPos) )
+ return sal_True;
+ //-----IAccessibility2 Implementation 2009
+ return sal_True; // MT: So why do we need the return TRUE above???
+*/
// get word boundary, as the Break-Iterator sees fit.
rBound = pBreakIt->GetBreakIter()->getWordBoundary(
rText, nPos, aLocale, nWordType, sal_True );
@@ -693,9 +902,17 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
i18n::Boundary& rBound,
- const ::rtl::OUString&,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
+ //IAccessibility2 Implementation 2009-----
+ const sal_Unicode* pStr = rText.getStr();
+ if (pStr)
+ {
+ while( pStr[nPos] == sal_Unicode(' ') && nPos < rText.getLength())
+ nPos++;
+ }
+ //-----IAccessibility2 Implementation 2009
GetPortionData().GetSentenceBoundary( rBound, nPos );
return sal_True;
}
@@ -809,11 +1026,80 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
break;
case AccessibleTextType::LINE:
- bRet = GetLineBoundary( rBound, rText, nPos );
+ //IAccessibility2 Implementation 2009-----
+ //Solve the problem of returning wrong LINE and PARAGRAPH
+ if((nPos == rText.getLength()) && nPos > 0)
+ bRet = GetLineBoundary( rBound, rText, nPos - 1);
+ else
+ bRet = GetLineBoundary( rBound, rText, nPos );
+ //-----IAccessibility2 Implementation 2009
break;
case AccessibleTextType::ATTRIBUTE_RUN:
bRet = GetAttributeBoundary( rBound, rText, nPos );
+ //IAccessibility2 Implementation 2009-----
+ if(bRet)
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ SwTxtNode* pTxtNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ if(pTxtNode)
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ xub_StrLen nBegin = nPos;
+ xub_StrLen nLen = 1;
+ const xub_StrLen nNext = pWrongList->NextWrong(nBegin);
+ xub_StrLen nLast;
+ xub_StrLen nWrongPos = pWrongList->GetWrongPos( nBegin );
+ if ( nWrongPos >= pWrongList->Count() ||
+ ( nLast = pWrongList->Pos( nWrongPos ) ) >= nBegin )
+ {
+ nLast = nWrongPos
+ ? pWrongList->Pos( --nWrongPos )
+ : STRING_LEN;
+ }
+ if ( nBegin > pWrongList->GetBeginInv() &&
+ ( nLast == STRING_LEN || nLast < pWrongList->GetEndInv() ) )
+ {
+ nLast = nBegin > pWrongList->GetEndInv()
+ ? pWrongList->GetEndInv()
+ : nBegin;
+ }
+ else if ( nLast < STRING_LEN )
+ {
+ nLast += pWrongList->Len( nWrongPos );
+ }
+ //
+ sal_Bool bIn = pWrongList->InWrongWord(nBegin,nLen); // && !pTxtNode->IsSymbol(nBegin) )
+ if(bIn)
+ {
+ rBound.startPos = max(nNext,(xub_StrLen)rBound.startPos);
+ rBound.endPos = min(xub_StrLen(nNext + nLen),(xub_StrLen)rBound.endPos);
+ }
+ else
+ {
+ if (STRING_LEN == nLast)//first
+ {
+ rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ }
+ else if(STRING_LEN == nNext)
+ {
+ rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+ }
+ else
+ {
+ rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+ rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+ }
+ }
+ }
+ }
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
break;
case AccessibleTextType::GLYPH:
@@ -1032,6 +1318,76 @@ uno::Sequence< ::rtl::OUString > SAL_CALL SwAccessibleParagraph::getSupportedSer
return aRet;
}
+//IAccessibility2 Implementation 2009-----
+uno::Sequence< ::rtl::OUString > getAttributeNames()
+{
+ static uno::Sequence< ::rtl::OUString >* pNames = NULL;
+
+ if( pNames == NULL )
+ {
+ // Add the font name to attribute list
+ uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 13 );
+
+ ::rtl::OUString* pStrings = pSeq->getArray();
+
+ // sorted list of strings
+ sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)
+ STR( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_CONTOURED ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_EMPHASIS ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_FONT_NAME ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_HEIGHT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_POSTURE ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_SHADOWED ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_STRIKEOUT ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName );
+ STR( GetPropName( UNO_NAME_CHAR_WEIGHT ).pName );
+#undef STR
+ DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+ if( i != pSeq->getLength() )
+ pSeq->realloc( i );
+ pNames = pSeq;
+ }
+ return *pNames;
+}
+
+uno::Sequence< ::rtl::OUString > getSupplementalAttributeNames()
+{
+ static uno::Sequence< ::rtl::OUString >* pNames = NULL;
+
+ if( pNames == NULL )
+ {
+ uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 9 );
+
+ ::rtl::OUString* pStrings = pSeq->getArray();
+
+ // sorted list of strings
+ sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)
+ STR( GetPropName( UNO_NAME_NUMBERING_LEVEL ).pName );
+ STR( GetPropName( UNO_NAME_NUMBERING_RULES ).pName );
+ STR( GetPropName( UNO_NAME_PARA_ADJUST ).pName );
+ STR( GetPropName( UNO_NAME_PARA_BOTTOM_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_PARA_FIRST_LINE_INDENT ).pName );
+ STR( GetPropName( UNO_NAME_PARA_LEFT_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_PARA_LINE_SPACING ).pName );
+ STR( GetPropName( UNO_NAME_PARA_RIGHT_MARGIN ).pName );
+ STR( GetPropName( UNO_NAME_TABSTOPS ).pName );
+#undef STR
+ DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+ if( i != pSeq->getLength() )
+ pSeq->realloc( i );
+ pNames = pSeq;
+ }
+ return *pNames;
+}
+//-----IAccessibility2 Implementation 2009
//
//===== XInterface =======================================================
//
@@ -1082,6 +1438,19 @@ uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
aRet <<= aAccMultiLineText;
}
// <--
+ //IAccessibility2 Implementation 2009-----
+ //MSAA Extension Implementation in app module
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTextSelection> *)NULL) )
+ {
+ uno::Reference< com::sun::star::accessibility::XAccessibleTextSelection > aTextExtension = this;
+ aRet <<= aTextExtension;
+ }
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+ {
+ uno::Reference<XAccessibleExtendedAttributes> xAttr = this;
+ aRet <<= xAttr;
+ }
+ //-----IAccessibility2 Implementation 2009
else
{
aRet = SwAccessibleContext::queryInterface(rType);
@@ -1206,6 +1575,270 @@ sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
throw lang::IndexOutOfBoundsException();
}
+//IAccessibility2 Implementation 2009-----
+com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwAccessibleParagraph::GetCurrentTabStop( sal_Int32 nIndex )
+{
+vos::OGuard aGuard(Application::GetSolarMutex());
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+
+
+ /* #i12332# The position after the string needs special treatment.
+ IsValidChar -> IsValidPosition
+ */
+ if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ /* #i12332# */
+ sal_Bool bBehindText = sal_False;
+ if ( nIndex == GetString().getLength() )
+ bBehindText = sal_True;
+
+ // get model position & prepare GetCharRect() arguments
+ SwCrsrMoveState aMoveState;
+ aMoveState.bRealHeight = sal_True;
+ aMoveState.bRealWidth = sal_True;
+ SwSpecialPos aSpecialPos;
+ SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+
+ sal_uInt16 nPos = 0;
+
+ /* #i12332# FillSpecialPos does not accept nIndex ==
+ GetString().getLength(). In that case nPos is set to the
+ length of the string in the core. This way GetCharRect
+ returns the rectangle for a cursor at the end of the
+ paragraph. */
+ if (bBehindText)
+ {
+ nPos = pNode->GetTxt().Len();
+ }
+ else
+ nPos = GetPortionData().FillSpecialPos
+ (nIndex, aSpecialPos, aMoveState.pSpecialPos );
+
+ // call GetCharRect
+ SwRect aCoreRect;
+ SwIndex aIndex( pNode, nPos );
+ SwPosition aPosition( *pNode, aIndex );
+ GetFrm()->GetCharRect( aCoreRect, aPosition, &aMoveState );
+
+ // already get the caret postion
+
+ //IAccessibility2 Implementation 2009-----
+ /*SwFrm* pTFrm = const_cast<SwFrm*>(GetFrm());
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs =
+ pTFrm->GetTabStopInfo(aCoreRect.Left());*/
+
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs;
+ const xub_StrLen nStrLen = GetTxtNode()->GetTxt().Len();
+ if( nStrLen > 0 )
+ {
+ SwFrm* pTFrm = const_cast<SwFrm*>(GetFrm());
+ tabs = pTFrm->GetTabStopInfo(aCoreRect.Left());
+ }
+ //-----IAccessibility2 Implementation 2009
+
+ if( tabs.hasElements() )
+ {
+ // translate core coordinates into accessibility coordinates
+ Window *pWin = GetWindow();
+ CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+
+ SwRect aTmpRect(0, 0, tabs[0].Position, 0);
+
+ Rectangle aScreenRect( GetMap()->CoreToPixel( aTmpRect.SVRect() ));
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
+
+ Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
+ aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
+
+ tabs[0].Position = aScreenRect.GetWidth();
+ }
+
+ return tabs;
+}
+
+struct IndexCompare
+{
+ const PropertyValue* pValues;
+ IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+ bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+ {
+ return (pValues[a].Name < pValues[b].Name) ? true : false;
+ }
+};
+//-----IAccessibility2 Implementation 2009
+
+String SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
+{
+ String strTypeName;
+ SwFldMgr aMgr;
+ SwTxtFld* pTxtFld = NULL;
+ SwTxtNode* pTxtNd = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwIndex fldIndex( pTxtNd, nIndex );
+ sal_Int32 nFldIndex = GetPortionData().GetFieldIndex(nIndex);
+ if (nFldIndex >= 0)
+ {
+ const SwpHints* pSwpHints = GetTxtNode()->GetpSwpHints();
+ if (pSwpHints)
+ {
+ const sal_uInt16 nSize = pSwpHints ? pSwpHints->Count() : 0;
+ for( sal_uInt16 i = 0; i < nSize; ++i )
+ {
+ const SwTxtAttr* pHt = (*pSwpHints)[i];
+ if (pHt->Which() == RES_TXTATR_FIELD && (nFldIndex-- == 0))
+ {
+ pTxtFld = (SwTxtFld *)pHt;
+ break;
+ }
+ else if (pHt->Which() == RES_TXTATR_REFMARK && (nFldIndex-- == 0))
+ strTypeName = String(OUString(RTL_CONSTASCII_USTRINGPARAM("set reference")));
+ }
+ }
+ }
+ if (pTxtFld)
+ {
+ const SwField* pField = (pTxtFld->GetFmtFld()).GetField();
+ if (pField)
+ {
+ strTypeName = pField->GetTyp()->GetTypeStr(pField->GetTypeId());
+ sal_uInt16 nWhich = pField->GetTyp()->Which();
+ rtl::OUString sEntry;
+ sal_Int32 subType = 0;
+ switch (nWhich)
+ {
+ case RES_DOCSTATFLD:
+ subType = ((SwDocStatField*)pField)->GetSubType();
+ break;
+ case RES_GETREFFLD:
+ {
+ sal_uInt16 nSub = pField->GetSubType();
+ switch( nSub )
+ {
+ case REF_BOOKMARK:
+ {
+ const SwGetRefField* pRefFld = dynamic_cast<const SwGetRefField*>(pField);
+ if ( pRefFld && pRefFld->IsRefToHeadingCrossRefBookmark() )
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Headings"));
+ else if ( pRefFld && pRefFld->IsRefToNumItemCrossRefBookmark() )
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Numbered Paragraphs"));
+ else
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Bookmarks"));
+ }
+ break;
+ case REF_FOOTNOTE:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Footnotes"));
+ break;
+ case REF_ENDNOTE:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Endnotes"));
+ break;
+ case REF_SETREFATTR:
+ sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Insert Reference"));
+ break;
+ case REF_SEQUENCEFLD:
+ sEntry = ((SwGetRefField*)pField)->GetSetRefName();
+ break;
+ }
+ //Get format string
+ strTypeName = sEntry;
+ // <pField->GetFormat() >= 0> is always true as <pField->GetFormat()> is unsigned
+// if (pField->GetFormat() >= 0)
+ {
+ sEntry = aMgr.GetFormatStr( pField->GetTypeId(), pField->GetFormat() );
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName.AppendAscii("-");
+ strTypeName += String(sEntry);
+ }
+ }
+ }
+ break;
+ case RES_DATETIMEFLD:
+ subType = ((SwDateTimeField*)pField)->GetSubType();
+ break;
+ case RES_JUMPEDITFLD:
+ {
+ sal_uInt16 nFormat= pField->GetFormat();
+ sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+ if (nFormat < nSize)
+ {
+ sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nFormat);
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName.AppendAscii("-");
+ strTypeName += String(sEntry);
+ }
+ }
+ }
+ break;
+ case RES_EXTUSERFLD:
+ subType = ((SwExtUserField*)pField)->GetSubType();
+ break;
+ case RES_HIDDENTXTFLD:
+ case RES_SETEXPFLD:
+ {
+ sEntry = pField->GetTyp()->GetName();
+ if (sEntry.getLength() > 0)
+ {
+ strTypeName.AppendAscii("-");
+ strTypeName += String(sEntry);
+ }
+ }
+ break;
+ case RES_DOCINFOFLD:
+ subType = pField->GetSubType();
+ subType &= 0x00ff;
+ break;
+ case RES_REFPAGESETFLD:
+ {
+ SwRefPageSetField* pRPld = (SwRefPageSetField*)pField;
+ sal_Bool bOn = pRPld->IsOn();
+ strTypeName.AppendAscii("-");
+ if (bOn)
+ strTypeName += String(OUString(RTL_CONSTASCII_USTRINGPARAM("on")));
+ else
+ strTypeName += String(OUString(RTL_CONSTASCII_USTRINGPARAM("off")));
+ }
+ break;
+ case RES_AUTHORFLD:
+ {
+ strTypeName.AppendAscii("-");
+ strTypeName += aMgr.GetFormatStr(pField->GetTypeId(), pField->GetFormat() & 0xff);
+ }
+ break;
+ }
+ if (subType > 0 || (subType == 0 && (nWhich == RES_DOCINFOFLD || nWhich == RES_EXTUSERFLD || nWhich == RES_DOCSTATFLD)))
+ {
+ SvStringsDtor aLst;
+ aMgr.GetSubTypes(pField->GetTypeId(), aLst);
+ if (subType < aLst.Count())
+ sEntry = *aLst[subType];
+ if (sEntry.getLength() > 0)
+ {
+ if (nWhich == RES_DOCINFOFLD)
+ {
+ strTypeName = String(sEntry);
+ sal_uInt32 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+ sal_uInt16 nExSub = pField->GetSubType() & 0xff00;
+ if (nSize > 0 && nExSub > 0)
+ {
+ //Get extra subtype string
+ strTypeName.AppendAscii("-");
+ sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nExSub/0x0100-1);
+ strTypeName += String(sEntry);
+ }
+ }
+ else
+ {
+ strTypeName.AppendAscii("-");
+ strTypeName += String(sEntry);
+ }
+ }
+ }
+ }
+ }
+ return strTypeName;
+}
// --> OD 2006-07-20 #i63870#
// re-implement method on behalf of methods <_getDefaultAttributesImpl(..)> and
// <_getRunAttributesImpl(..)>
@@ -1220,16 +1853,24 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
const ::rtl::OUString& rText = GetString();
- if( ! IsValidChar( nIndex, rText.getLength() ) )
+ if( ! IsValidChar( nIndex, rText.getLength()+1 ) )//IAccessibility2 Implementation 2009
throw lang::IndexOutOfBoundsException();
+ //IAccessibility2 Implementation 2009-----
+ bool bSupplementalMode = false;
+ uno::Sequence< ::rtl::OUString > aNames = aRequestedAttributes;
+ if (aNames.getLength() == 0)
+ {
+ bSupplementalMode = true;
+ aNames = getAttributeNames();
+ }
// retrieve default character attributes
tAccParaPropValMap aDefAttrSeq;
- _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq, true );
+ _getDefaultAttributesImpl( aNames, aDefAttrSeq, true );
// retrieved run character attributes
tAccParaPropValMap aRunAttrSeq;
- _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
+ _getRunAttributesImpl( nIndex, aNames, aRunAttrSeq );
// merge default and run attributes
uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
@@ -1251,6 +1892,70 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
}
++i;
}
+ if( bSupplementalMode )
+ {
+ uno::Sequence< ::rtl::OUString > aSupplementalNames = aRequestedAttributes;
+ if (aSupplementalNames.getLength() == 0)
+ aSupplementalNames = getSupplementalAttributeNames();
+
+ tAccParaPropValMap aSupplementalAttrSeq;
+ _getSupplementalAttributesImpl( nIndex, aSupplementalNames, aSupplementalAttrSeq );
+
+ aValues.realloc( aValues.getLength() + aSupplementalAttrSeq.size() );
+ pValues = aValues.getArray();
+
+ for ( tAccParaPropValMap::const_iterator aSupplementalIter = aSupplementalAttrSeq.begin();
+ aSupplementalIter != aSupplementalAttrSeq.end();
+ ++aSupplementalIter )
+ {
+ pValues[i] = aSupplementalIter->second;
+ ++i;
+ }
+
+ _correctValues( nIndex, aValues );
+
+ aValues.realloc( aValues.getLength() + 1 );
+
+ pValues = aValues.getArray();
+
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ PropertyValue& rValue = pValues[aValues.getLength() - 1 ];
+ rValue.Name = OUString::createFromAscii("NumberingPrefix");
+ OUString sNumBullet = pTxtNode->GetNumString();
+ rValue.Value <<= sNumBullet;
+ rValue.Handle = -1;
+ rValue.State = PropertyState_DIRECT_VALUE;
+
+ String strTypeName = GetFieldTypeNameAtIndex(nIndex);
+ if (strTypeName.Len() > 0)
+ {
+ aValues.realloc( aValues.getLength() + 1 );
+ pValues = aValues.getArray();
+ rValue = pValues[aValues.getLength() - 1];
+ rValue.Name = OUString::createFromAscii("FieldType");
+ rValue.Value <<= rtl::OUString(strTypeName.ToLowerAscii());
+ rValue.Handle = -1;
+ rValue.State = PropertyState_DIRECT_VALUE;
+ }
+
+ //sort property values
+ // build sorted index array
+ sal_Int32 nLength = aValues.getLength();
+ const PropertyValue* pPairs = aValues.getConstArray();
+ sal_Int32* pIndices = new sal_Int32[nLength];
+ for( i = 0; i < nLength; i++ )
+ pIndices[i] = i;
+ sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+ // create sorted sequences accoring to index array
+ uno::Sequence<PropertyValue> aNewValues( nLength );
+ PropertyValue* pNewValues = aNewValues.getArray();
+ for( i = 0; i < nLength; i++ )
+ {
+ pNewValues[i] = pPairs[pIndices[i]];
+ }
+ delete[] pIndices;
+ return aNewValues;
+ }
// // create a (dummy) text portion for the sole purpose of calling
// // getPropertyValues on it
@@ -1669,6 +2374,308 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
return aValues;
}
// <--
+// IAccessibility2 Implementation 2009----
+void SwAccessibleParagraph::_getSupplementalAttributesImpl(
+ const sal_Int32,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rSupplementalAttrSeq )
+{
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+ ::boost::scoped_ptr<SfxItemSet> pSet;
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
+ RES_PARATR_LINESPACING, RES_PARATR_LINESPACING,
+ RES_UL_SPACE, RES_UL_SPACE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ 0 ) );
+
+ if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+ {
+ pSet->Put( pTxtNode->GetAttr(RES_PARATR_LIST_LEVEL, RES_PARATR_LIST_LEVEL) );
+ }
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_UL_SPACE) );
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_LR_SPACE) );
+ pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_PARATR_ADJUST) );
+
+ tAccParaPropValMap aSupplementalAttrSeq;
+ {
+// const SfxItemPropertySet& rPropSet =
+// aSwMapProvider.GetPropertyMap( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE );
+// const SfxItemPropertyMap* pPropMap( rPropSet.getPropertyMap() );
+ const SfxItemPropertyMapEntry* pPropMap(
+ aSwMapProvider.GetPropertyMapEntries( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE ) );
+ while ( pPropMap->pName )
+ {
+ const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
+ if ( pItem )
+ {
+ uno::Any aVal;
+ pItem->QueryValue( aVal, pPropMap->nMemberId );
+
+ PropertyValue rPropVal;
+ rPropVal.Name = OUString::createFromAscii( pPropMap->pName );
+ rPropVal.Value = aVal;
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+
+ aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
+ }
+
+ ++pPropMap;
+ }
+ }
+
+ const OUString* pSupplementalAttrs = aRequestedAttributes.getConstArray();
+ const sal_Int32 nSupplementalLength = aRequestedAttributes.getLength();
+
+ for( sal_Int32 index = 0; index < nSupplementalLength; ++index )
+ {
+ tAccParaPropValMap::const_iterator const aIter = aSupplementalAttrSeq.find( pSupplementalAttrs[index] );
+ if ( aIter != aSupplementalAttrSeq.end() )
+ {
+ rSupplementalAttrSeq[ aIter->first ] = aIter->second;
+ }
+ }
+}
+
+void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
+ uno::Sequence< PropertyValue >& rValues)
+{
+ PropertyValue ChangeAttr, ChangeAttrColor;
+
+ const SwRedline* pRedline = GetRedlineAtIndex( nIndex );
+ if ( pRedline )
+ {
+
+ const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
+ AuthorCharAttr aChangeAttr;
+ if ( pOpt )
+ {
+ switch( pRedline->GetType())
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ aChangeAttr = pOpt->GetInsertAuthorAttr();
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ aChangeAttr = pOpt->GetDeletedAuthorAttr();
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ aChangeAttr = pOpt->GetFormatAuthorAttr();
+ break;
+ }
+ }
+ switch( aChangeAttr.nItemId )
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_WEIGHT).pName );
+ ChangeAttr.Value <<= awt::FontWeight::BOLD;
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_POSTURE).pName );
+ ChangeAttr.Value <<= awt::FontSlant_ITALIC; //char posture
+ break;
+ case SID_ATTR_CHAR_STRIKEOUT:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_STRIKEOUT).pName );
+ ChangeAttr.Value <<= awt::FontStrikeout::SINGLE; //char strikeout
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE).pName );
+ ChangeAttr.Value <<= aChangeAttr.nAttr; //underline line
+ break;
+ }
+ if( aChangeAttr.nColor != COL_NONE )
+ {
+ if( aChangeAttr.nItemId == SID_ATTR_BRUSH )
+ {
+ ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR).pName );
+ if( aChangeAttr.nColor == COL_TRANSPARENT )//char backcolor
+ ChangeAttrColor.Value <<= COL_BLUE;
+ else
+ ChangeAttrColor.Value <<= aChangeAttr.nColor;
+ }
+ else
+ {
+ ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+ if( aChangeAttr.nColor == COL_TRANSPARENT )//char color
+ ChangeAttrColor.Value <<= COL_BLUE;
+ else
+ ChangeAttrColor.Value <<= aChangeAttr.nColor;
+ }
+ }
+ }
+
+ PropertyValue* pValues = rValues.getArray();
+
+ const SwTxtNode* pTxtNode( GetTxtNode() );
+
+ sal_Int32 nValues = rValues.getLength();
+ for (sal_Int32 i = 0; i < nValues; ++i)
+ {
+ PropertyValue& rValue = pValues[i];
+
+ if (rValue.Name.compareTo( ChangeAttr.Name )==0)
+ {
+ rValue.Value = ChangeAttr.Value;
+ continue;
+ }
+
+ if (rValue.Name.compareTo( ChangeAttrColor.Name )==0)
+ {
+ rValue.Value = ChangeAttr.Value;
+ continue;
+ }
+
+ //back color
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName ) )==0)
+ {
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crBack = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ if (COL_AUTO == crBack)
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ crBack = (sal_uInt32)xComponent->getBackground();
+ }
+ rValue.Value <<= crBack;
+ }
+ continue;
+ }
+
+ //char color
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName ) )==0)
+ {
+ if( GetPortionData().IsInGrayPortion( nIndex ) )
+ rValue.Value <<= SwViewOption::GetFieldShadingsColor().GetColor();
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+
+ if( COL_AUTO == crChar )
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ Color cr(xComponent->getBackground());
+ crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ rValue.Value <<= crChar;
+ }
+ }
+ continue;
+ }
+
+ // UnderLine
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName ) )==0)
+ {
+ //misspelled word
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ xub_StrLen nBegin = nIndex;
+ xub_StrLen nLen = 1;
+ if( pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+ {
+ rValue.Value <<= (sal_uInt16)UNDERLINE_WAVE;
+ }
+ }
+ }
+ continue;
+ }
+
+ // UnderLineColor
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName ) )==0)
+ {
+ //misspelled word
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+ {
+ const SwWrongList* pWrongList = pTxtNode->GetWrong();
+ if( NULL != pWrongList )
+ {
+ xub_StrLen nBegin = nIndex;
+ xub_StrLen nLen = 1;
+ if( pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+ {
+ rValue.Value <<= (sal_Int32)0x00ff0000;
+ continue;
+ }
+ }
+ }
+
+ uno::Any &anyChar = rValue.Value;
+ sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ if ( COL_AUTO == crUnderline )
+ {
+ uno::Reference<XAccessibleComponent> xComponent(this);
+ if (xComponent.is())
+ {
+ Color cr(xComponent->getBackground());
+ crUnderline = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ rValue.Value <<= crUnderline;
+ }
+ }
+
+ continue;
+ }
+
+ //tab stop
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_TABSTOPS ).pName ) )==0)
+ {
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs = GetCurrentTabStop( nIndex );
+ if( !tabs.hasElements() )
+ {
+ tabs.realloc(1);
+ ::com::sun::star::style::TabStop ts;
+ com::sun::star::awt::Rectangle rc0 = getCharacterBounds(0);
+ com::sun::star::awt::Rectangle rc1 = getCharacterBounds(nIndex);
+ if( rc1.X - rc0.X >= 48 )
+ ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
+ else
+ ts.Position = 48;
+ ts.DecimalChar = ' ';
+ ts.FillChar = ' ';
+ ts.Alignment = ::com::sun::star::style::TabAlign_LEFT;
+ tabs[0] = ts;
+ }
+ rValue.Value <<= tabs;
+ continue;
+ }
+
+ //number bullet
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_NUMBERING_RULES ).pName ) )==0)
+ {
+ if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+ {
+ uno::Any aVal;
+ SwNumRule* pNumRule = pTxtNode->GetNumRule();
+ if (pNumRule)
+ {
+ uno::Reference< container::XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
+ aVal.setValue(&xNum, ::getCppuType((const uno::Reference< container::XIndexReplace >*)0));
+ }
+ rValue.Value <<= aVal;
+ }
+ continue;
+ }
+
+ //footnote & endnote
+ if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName ) )==0)
+ {
+ if ( GetPortionData().IsIndexInFootnode(nIndex) )
+ {
+ const OUString sEscapmentName = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+ rValue.Value <<= (sal_Int32)101;
+ }
+ continue;
+ }
+ }
+}
+//-----IAccessibility2 Implementation 2009
awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
sal_Int32 nIndex )
@@ -1971,6 +2978,12 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
+ //IAccessibility2 Implementation 2009-----
+ //If nIndex = 0, then nobefore text so return -1 directly.
+ if( nIndex == 0 )
+ return aResult;
+ //Tab will be return when call WORDTYPE
+ //-----IAccessibility2 Implementation 2009
// get starting pos
i18n::Boundary aBound;
@@ -1985,22 +2998,47 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
}
// now skip to previous word
- sal_Bool bWord = sal_False;
- while( !bWord )
+ //IAccessibility2 Implementation 2009-----
+ if (nTextType==2 || nTextType == 3)
{
- nIndex = min( nIndex, aBound.startPos ) - 1;
- if( nIndex >= 0 )
- bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
- else
- break; // exit if beginning of string is reached
+ i18n::Boundary preBound = aBound;
+ while(preBound.startPos==aBound.startPos && nIndex > 0)
+ {
+ nIndex = min( nIndex, preBound.startPos ) - 1;
+ if( nIndex < 0 ) break;
+ GetTextBoundary( preBound, rText, nIndex, nTextType );
+ }
+ //if (nIndex>0)
+ if (nIndex>=0)
+ //Tab will be return when call WORDTYPE
+ {
+ aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
+ aResult.SegmentStart = preBound.startPos;
+ aResult.SegmentEnd = preBound.endPos;
+ }
}
-
- if ( bWord )
+ else
{
- aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
- aResult.SegmentStart = aBound.startPos;
- aResult.SegmentEnd = aBound.endPos;
- };
+ sal_Bool bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = min( nIndex, aBound.startPos ) - 1;
+ if( nIndex >= 0 )
+ {
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ }
+ else
+ break; // exit if beginning of string is reached
+ }
+
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
return aResult;
}
@@ -2041,6 +3079,66 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
aResult.SegmentStart = aBound.startPos;
aResult.SegmentEnd = aBound.endPos;
}
+
+/*
+ //IAccessibility2 Implementation 2009-----
+ sal_Bool bWord = sal_False;
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+
+ if (nTextType==2)
+ {
+ Boundary nexBound=aBound;
+
+ // real current word
+ if( nIndex <= aBound.endPos && nIndex >= aBound.startPos )
+ {
+ while(nexBound.endPos==aBound.endPos&&nIndex<rText.getLength())
+ {
+ // nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) + 1;
+ nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) ;
+ const sal_Unicode* pStr = rText.getStr();
+ if (pStr)
+ {
+ if( pStr[nIndex] == sal_Unicode(' ') )
+ nIndex++;
+ }
+ if( nIndex < rText.getLength() )
+ {
+ bWord = GetTextBoundary( nexBound, rText, nIndex, nTextType );
+ }
+ }
+ }
+
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( nexBound.startPos, nexBound.endPos - nexBound.startPos );
+ aResult.SegmentStart = nexBound.startPos;
+ aResult.SegmentEnd = nexBound.endPos;
+ }
+
+ }
+ else
+ {
+ bWord = sal_False;
+ while( !bWord )
+ {
+ nIndex = max( (sal_Int32)(nIndex+1), aBound.endPos );
+ if( nIndex < rText.getLength() )
+ {
+ bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+ }
+ else
+ break; // exit if end of string is reached
+ }
+ if (bWord && nIndex<rText.getLength())
+ {
+ aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+ aResult.SegmentStart = aBound.startPos;
+ aResult.SegmentEnd = aBound.endPos;
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
+*/
return aResult;
}
@@ -2153,16 +3251,6 @@ sal_Bool SwAccessibleParagraph::replaceText(
throw lang::IndexOutOfBoundsException();
}
-struct IndexCompare
-{
- const PropertyValue* pValues;
- IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
- bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
- {
- return (pValues[a].Name < pValues[b].Name) ? true : false;
- }
-};
-
sal_Bool SwAccessibleParagraph::setAttributes(
sal_Int32 nStartIndex,
@@ -2368,6 +3456,16 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
nCount++;
}
+ //IAccessibility2 Implementation 2009-----
+ /* Can't fin the function "GetTOCFirstWordEndIndex" declaration in sym2.0 (Added by yanjun)
+ if( GetTOXSortTabBase() )
+ {
+ SwTxtNode* pNode = const_cast<SwTxtNode*>(GetTxtNode());
+ if(pNode && pNode->GetTOCFirstWordEndIndex() > 0)
+ nCount++;
+ }
+ */
+ //-----IAccessibility2 Implementation 2009
return nCount;
}
@@ -2382,8 +3480,163 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
// --> OD 2007-06-27 #i77108# - provide hyperlinks also in editable documents.
// if( !IsEditableState() )
- // <--
+ const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+ SwHyperlinkIter_Impl aHIter( pTxtFrm );
+ //SwAccessibleAutoRecognizerHelper_Impl aARHelper( pTxtFrm );
+ sal_Int32 nARCount = 0;
+ sal_Int32 nARIndex = 0;
+ sal_Int32 nTIndex = -1;
+ sal_Int32 nTOCEndIndex = -1;
+ SwTxtNode* pNode = NULL;
+ SwTOXSortTabBase* pTBase = GetTOXSortTabBase();
+ if( pTBase )
+ {
+ pNode = const_cast<SwTxtNode*>(GetTxtNode());
+ }
+ nTOCEndIndex = -1;
+ //if(pNode)
+ // nTOCEndIndex = pNode->GetTOCFirstWordEndIndex();
+ SwTxtAttr* pHt = (SwTxtAttr*)(aHIter.next());
+ while( (nLinkIndex < getHyperLinkCount()) && nTIndex < nLinkIndex)
{
+ // no candidates, exit
+ //if( (!pHt) && (nARIndex >= nARCount) && nTOCEndIndex <= 0)
+ // break;
+
+ sal_Int32 nHStt = -1;
+ sal_Int32 nAStt = -1;
+ sal_Bool bH = sal_False;
+ sal_Bool bA = sal_False;
+
+
+ if( pHt )
+ nHStt = *pHt->GetStart();
+ if( nARIndex < nARCount )
+ {
+ /*
+ sal_Int32 nAEnd;
+ aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+ */
+ }
+ sal_Bool bTOC = sal_False;
+ // Inside TOC & get the first link
+ if( pTBase && nTIndex == -1 )
+ {
+ nTIndex++;
+ bTOC = sal_True;
+ }
+ else
+ {
+ if( nHStt >=0 && nAStt >=0 )
+ { // both hyperlink and smart tag available
+ nTIndex++;
+ if( nHStt <= nAStt )
+ bH = sal_True;
+ else
+ bA = sal_True;
+ }
+ else if( nHStt >= 0 )
+ { // only hyperlink available
+ nTIndex++;
+ bH = sal_True;
+ }
+ else if( nAStt >= 0 )
+ { // only smart tag available
+ nTIndex++;
+ bA = sal_True;
+ }
+ }
+
+ if( nTIndex == nLinkIndex )
+ { // found
+ if( bH )
+ { // it's a hyperlink
+ if( pHt )
+ {
+// const SwField* pFFld = pHt->GetFld().GetFld();
+ {
+ if( !pHyperTextData )
+ pHyperTextData = new SwAccessibleHyperTextData;
+ SwAccessibleHyperTextData::iterator aIter =
+ pHyperTextData ->find( pHt );
+ if( aIter != pHyperTextData->end() )
+ {
+ xRet = (*aIter).second;
+ }
+ if( !xRet.is() )
+ {
+ {
+ const sal_Int32 nTmpHStt= GetPortionData().GetAccessiblePosition(
+ max( aHIter.startIdx(), *pHt->GetStart() ) );
+ const sal_Int32 nTmpHEnd= GetPortionData().GetAccessiblePosition(
+ min( aHIter.endIdx(), *pHt->GetAnyEnd() ) );
+ xRet = new SwAccessibleHyperlink( aHIter.getCurrHintPos(),
+ this, nTmpHStt, nTmpHEnd );
+ }
+ if( aIter != pHyperTextData->end() )
+ {
+ (*aIter).second = xRet;
+ }
+ else
+ {
+ SwAccessibleHyperTextData::value_type aEntry( pHt, xRet );
+ pHyperTextData->insert( aEntry );
+ }
+ }
+ }
+ }
+ }
+ else if( bTOC )
+ {
+ //xRet = new SwAccessibleTOCLink( this );
+ }
+ else if( bA )
+ {
+ /*
+ // it's a smart tag
+ if( !pAutoRecognizerData )
+ pAutoRecognizerData = new SwAccessibleAutoRecognizerData;
+ SwAccessibleAutoRecognizerData::iterator aIter =
+ pAutoRecognizerData ->find( nARIndex );
+ if( aIter != pAutoRecognizerData->end() )
+ {
+ xRet = (*aIter).second;
+ }
+ if( !xRet.is() )
+ {
+ sal_Int32 nAStt = 0;
+ sal_Int32 nAEnd = 0;
+ //aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+ xRet = new SwAccessibleAutoRecognizer( this, nAStt, nAEnd );
+ if( aIter != pAutoRecognizerData->end() )
+ {
+ (*aIter).second = xRet;
+ }
+ else
+ {
+ SwAccessibleAutoRecognizerData::value_type aEntry( nARIndex, xRet );
+ pAutoRecognizerData->insert( aEntry );
+ }
+ }
+ */
+ }
+ break;
+ }
+
+ // iterate next
+ if( bH )
+ // iterate next hyperlink
+ pHt = (SwTxtAttr*)(aHIter.next());
+ else if( bA )
+ // iterate next smart tag
+ nARIndex++;
+ else if(bTOC)
+ continue;
+ else
+ // no candidate, exit
+ break;
+ }
+ /*
const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
SwHyperlinkIter_Impl aHIter( pTxtFrm );
while( nLinkIndex-- )
@@ -2420,7 +3673,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
}
}
}
-
+ */
if( !xRet.is() )
throw lang::IndexOutOfBoundsException();
@@ -2459,10 +3712,23 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
if( pHt )
nRet = nPos;
-
}
+ //IAccessibility2 Implementation 2009-----
+ /* Added by yanjun for acc miagration
+ if( nRet == -1 && GetTOXSortTabBase() )
+ {
+ SwTxtNode* pNode = const_cast<SwTxtNode*>(GetTxtNode());
+ if( nCharIndex >= 0 && nCharIndex < pNode->GetTOCFirstWordEndIndex())
+ nRet = 0;
+ }
+ */
- return nRet;
+ if (nRet == -1)
+ throw lang::IndexOutOfBoundsException();
+ else
+ return nRet;
+ //return nRet;
+ //-----IAccessibility2 Implementation 2009
}
// --> OD 2008-05-26 #i71360#
@@ -2491,6 +3757,203 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMar
return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
}
+//IAccessibility2 Implementation 2009-----
+//MSAA Extension Implementation in app module
+sal_Bool SAL_CALL SwAccessibleParagraph::scrollToPosition( const ::com::sun::star::awt::Point&, sal_Bool )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nSeleted = 0;
+ SwPaM* pCrsr = GetCursor( true );
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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 ) )
+ {
+ nSeleted++;
+ }
+ // 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<SwPaM*>( pCrsr->GetNext() );
+ }
+ while( pCrsr != pRingStart );
+ }
+ return nSeleted;
+
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+ return nStart;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ sal_Int32 nStart, nEnd;
+ /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+ return nEnd;
+}
+
+sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ if(selectionIndex < 0) return sal_False;
+
+ sal_Bool bRet = sal_False;
+ sal_Int32 nSelected = selectionIndex;
+
+ // get the selection, and test whether it affects our text node
+ SwPaM* pCrsr = GetCursor( true );
+// SwPaM* pFirst = pCrsr;
+ SwPaM* pPrev = pCrsr;
+
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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( nSelected == 0 )
+ {
+ pCrsr->MoveTo((Ring*)0);
+ delete pCrsr;
+ bRet = sal_True;
+ }
+ else
+ {
+ nSelected--;
+ }
+ }
+ }
+ // else: this PaM is collapsed and doesn't select anything
+ pPrev = pCrsr;
+ pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+ }
+ while( !bRet && (pCrsr != pRingStart) );
+ }
+ return sal_True;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::addSelection( sal_Int32, sal_Int32 startOffset, sal_Int32 endOffset)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+ // parameter checking
+ sal_Int32 nLength = GetString().getLength();
+ if ( ! IsValidRange( startOffset, endOffset, nLength ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 nSelectedCount = getSelectedPortionCount();
+ for ( sal_Int32 i = nSelectedCount ; i >= 0 ; i--)
+ {
+ sal_Int32 nStart, nEnd;
+ sal_Bool bSelected = GetSelectionAtIndex(i, nStart, nEnd );
+ if(bSelected)
+ {
+ if(nStart <= nEnd )
+ {
+ if (( startOffset>=nStart && startOffset <=nEnd ) || //startOffset in a selection
+ ( endOffset>=nStart && endOffset <=nEnd ) || //endOffset in a selection
+ ( startOffset <= nStart && endOffset >=nEnd) || //start and end include the old selection
+ ( startOffset >= nStart && endOffset <=nEnd) )
+ {
+ removeSelection(i);
+ }
+
+ }
+ else
+ {
+ if (( startOffset>=nEnd && startOffset <=nStart ) || //startOffset in a selection
+ ( endOffset>=nEnd && endOffset <=nStart ) || //endOffset in a selection
+ ( startOffset <= nStart && endOffset >=nEnd) || //start and end include the old selection
+ ( startOffset >= nStart && endOffset <=nEnd) )
+
+ {
+ removeSelection(i);
+ }
+ }
+ }
+
+ }
+
+ sal_Bool bRet = sal_False;
+
+ // get cursor shell
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ // create pam for selection
+ pCrsrShell->StartAction();
+// SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+ SwPaM* aPaM = pCrsrShell->CreateCrsr();
+ aPaM->SetMark();
+ aPaM->GetPoint()->nContent = GetPortionData().GetModelPosition(startOffset);
+ aPaM->GetMark()->nContent = GetPortionData().GetModelPosition(endOffset);
+ //pCrsrShell->ShowCrsr();
+ pCrsrShell->EndAction();
+ // set PaM at cursor shell
+ //bRet = Select( aPaM );
+ }
+
+ return bRet;
+}
+//-----IAccessibility2 Implementation 2009
/*accessibility::*/TextSegment SAL_CALL
SwAccessibleParagraph::getTextMarkup( sal_Int32 nTextMarkupIndex,
@@ -2672,3 +4135,267 @@ void SwAccessibleParagraph::Modify( const SfxPoolItem* pOld, const SfxPoolItem*
CheckRegistration( pOld, pNew );
}
// <--
+
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleParagraph::GetSelectionAtIndex(
+ sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd)
+{
+ if(nIndex < 0) return sal_False;
+
+
+ sal_Bool bRet = sal_False;
+ nStart = -1;
+ nEnd = -1;
+ sal_Int32 nSelected = nIndex;
+
+ // get the selection, and test whether it affects our text node
+ SwPaM* pCrsr = GetCursor( true );
+ if( pCrsr != NULL )
+ {
+ // get SwPosition for my node
+ const SwTxtNode* pNode = 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( nSelected == 0 )
+ {
+ // translate start and end positions
+
+ // start position
+ sal_Int32 nLocalStart = -1;
+ if( nHere > nStartIndex )
+ {
+ // selection starts in previous node:
+ // then our local selection starts with the paragraph
+ nLocalStart = 0;
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nStartIndex,
+ "miscalculated index" );
+
+ // selection starts in this node:
+ // then check whether it's before or inside our part of
+ // the paragraph, and if so, get the proper position
+ sal_uInt16 nCoreStart = pStart->nContent.GetIndex();
+ if( nCoreStart <
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ nLocalStart = 0;
+ }
+ else if( nCoreStart <=
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreStart ),
+ "problem determining valid core position" );
+
+ nLocalStart =
+ GetPortionData().GetAccessiblePosition(
+ nCoreStart );
+ }
+ }
+
+ // end position
+ sal_Int32 nLocalEnd = -1;
+ if( nHere < nEndIndex )
+ {
+ // selection ends in following node:
+ // then our local selection extends to the end
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else
+ {
+ DBG_ASSERT( nHere == nStartIndex,
+ "miscalculated index" );
+
+ // selection ends in this node: then select everything
+ // before our part of the node
+ sal_uInt16 nCoreEnd = pEnd->nContent.GetIndex();
+ if( nCoreEnd >
+ GetPortionData().GetLastValidCorePosition() )
+ {
+ // selection extends beyond out part of this para
+ nLocalEnd = GetPortionData().GetAccessibleString().
+ getLength();
+ }
+ else if( nCoreEnd >=
+ GetPortionData().GetFirstValidCorePosition() )
+ {
+ // selection is inside our part of this para
+ DBG_ASSERT(
+ GetPortionData().IsValidCorePosition(
+ nCoreEnd ),
+ "problem determining valid core position" );
+
+ nLocalEnd = GetPortionData().GetAccessiblePosition(
+ nCoreEnd );
+ }
+ }
+
+ if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
+ {
+ nStart = nLocalStart;
+ nEnd = nLocalEnd;
+ bRet = sal_True;
+ }
+ } // if hit the index
+ else
+ {
+ nSelected--;
+ }
+ }
+ // 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<SwPaM*>( pCrsr->GetNext() );
+ }
+ while( !bRet && (pCrsr != pRingStart) );
+ }
+ // else: nocursor -> no selection
+
+ if( bRet )
+ {
+ sal_Int32 nCaretPos = GetCaretPos();
+ if( nStart == nCaretPos )
+ {
+ sal_Int32 tmp = nStart;
+ nStart = nEnd;
+ nEnd = tmp;
+ }
+ }
+ return bRet;
+}
+
+sal_Int16 SAL_CALL SwAccessibleParagraph::getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ //Get the real heading level, Heading1 ~ Heading10
+ if (nHeadingLevel > 0)
+ {
+ return AccessibleRole::HEADING;
+ }
+ else
+ {
+ return AccessibleRole::PARAGRAPH;
+ }
+}
+
+// End Add
+
+
+/* This funcion is already defined in accpara.cxx(Added by yanjun)
+sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+// Test Code
+// Sequence<OUString> seNames(1);
+// OUString* pStrings = seNames.getArray();
+// pStrings[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor"));
+//
+// Sequence<Any> aAnys(1);
+// Reference<XMultiPropertySet> xPortion = CreateUnoPortion( 0, 0 );
+// aAnys = xPortion->getPropertyValues( seNames );
+// const Any* pAnys = aAnys.getConstArray();
+//
+// sal_uInt32 crColorT=0;
+// pAnys[0] >>= crColorT;
+// End Test Code
+
+ const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+ sal_uInt32 crBack = rBack.GetColor().GetColor();
+
+ if (COL_AUTO == crBack)
+ {
+ Reference<XAccessible> xAccDoc = getAccessibleParent();
+ if (xAccDoc.is())
+ {
+ Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,UNO_QUERY);
+ if (xCompoentDoc.is())
+ {
+ crBack = (sal_uInt32)xCompoentDoc->getBackground();
+ }
+ }
+ }
+ return crBack;
+}
+*/
+
+//Get the real heading level, Heading1 ~ Heading10
+sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel()
+{
+ uno::Reference< ::com::sun::star::beans::XPropertySet > xPortion = CreateUnoPortion( 0, 0 );
+ ::rtl::OUString pString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"));
+ uno::Any styleAny = xPortion->getPropertyValue( pString );
+ ::rtl::OUString sValue;
+ if (styleAny >>= sValue)
+ {
+ //Modified by yanjun for acc migration
+ sal_Int32 length = sValue.getLength/*GetCharCount*/();
+ if (length == 9 || length == 10)
+ {
+ ::rtl::OUString headStr = sValue.copy(0, 7);
+ if (headStr.equals(::rtl::OUString::createFromAscii("Heading")))
+ {
+ ::rtl::OUString intStr = sValue.copy(8);
+ sal_Int32 headingLevel = intStr.toInt32(10);
+ return headingLevel;
+ }
+ }
+ }
+ return -1;
+}
+
+uno::Any SAL_CALL SwAccessibleParagraph::getExtendedAttributes()
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Any Ret;
+ ::rtl::OUString strHeading(::rtl::OUString::createFromAscii("heading-level:"));
+ if( nHeadingLevel >= 0 )
+ strHeading += OUString::valueOf(nHeadingLevel, 10);
+ strHeading += OUString::createFromAscii(";");
+
+ Ret <<= strHeading;
+
+ return Ret;
+}
+
+//Tab will be return when call WORDTYPE
+sal_Bool SwAccessibleParagraph::tabCharInWord( sal_Int32 nIndex, i18n::Boundary& aBound)
+{
+ sal_Bool bFind = sal_False;
+ if( aBound.startPos != nIndex)
+ {
+ OUString tabStr;
+ if(aBound.startPos>nIndex)
+ tabStr = GetString().copy(nIndex,(aBound.startPos - nIndex) );
+
+ sal_Unicode tabChar('\t');
+ sal_Int32 tabIndex = tabStr.indexOf(tabChar);
+ if( tabIndex > -1 )
+ {
+ aBound.startPos = nIndex + tabIndex ;
+ aBound.endPos = aBound.startPos + 1;
+ bFind = sal_True;
+ }
+ }
+ return bFind;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index 782ecfbefe5a..1de219d9e2bf 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -29,6 +29,11 @@
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
+#include <txmsrt.hxx>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+//-----IAccessibility2 Implementation 2009
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <hash_map>
#include <accselectionhelper.hxx>
@@ -36,11 +41,13 @@
#include <calbck.hxx>
// <--
+class SwField;
class SwTxtFrm;
class SwTxtNode;
class SwPaM;
class SwAccessiblePortionData;
class SwAccessibleHyperTextData;
+class SwRedline; //IAccessibility2 Implementation 2009
class SwXTextPortion;
// --> OD 2010-02-19 #i108125#
class SwParaChangeTrackingInfo;
@@ -50,6 +57,7 @@ namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
namespace i18n { struct Boundary; }
namespace accessibility { class XAccessibleHyperlink; }
+ namespace style { class TabStop; }
} } }
typedef ::std::hash_map< ::rtl::OUString,
@@ -67,7 +75,11 @@ class SwAccessibleParagraph :
public com::sun::star::accessibility::XAccessibleHypertext,
public com::sun::star::accessibility::XAccessibleTextMarkup,
public com::sun::star::accessibility::XAccessibleMultiLineText,
- public ::com::sun::star::accessibility::XAccessibleTextAttributes
+ public ::com::sun::star::accessibility::XAccessibleTextAttributes,
+ //IAccessibility2 Implementation 2009-----
+ public com::sun::star::accessibility::XAccessibleTextSelection,
+ public com::sun::star::accessibility::XAccessibleExtendedAttributes
+ //-----IAccessibility2 Implementation 2009
{
friend class SwAccessibleHyperlink;
@@ -86,6 +98,9 @@ class SwAccessibleParagraph :
// mutex)
sal_Bool bIsHeading; // protected by base classes mutex
+ //IAccessibility2 Implementation 2009-----
+ sal_Int32 nHeadingLevel;
+ //-----IAccessibility2 Implementation 2009
// implementation for XAccessibleSelection
SwAccessibleSelectionHelper aSelectionHelper;
@@ -144,6 +159,10 @@ class SwAccessibleParagraph :
}
}
+ //IAccessibility2 Implementation 2009-----
+ const SwRedline* GetRedlineAtIndex( sal_Int32 nPos );
+ String GetFieldTypeNameAtIndex(sal_Int32 nIndex);
+ //-----IAccessibility2 Implementation 2009
// --> OD 2006-07-13 #i63870#
void _getDefaultAttributesImpl(
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
@@ -154,9 +173,22 @@ class SwAccessibleParagraph :
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
tAccParaPropValMap& rRunAttrSeq );
// <--
+ // IAccessibility2 Implementation 2009----
+ void _getSupplementalAttributesImpl(
+ const sal_Int32 nIndex,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+ tAccParaPropValMap& rSupplementalAttrSeq );
-public:
+ void _correctValues(
+ const sal_Int32 nIndex,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues );
+ // ----IAccessibility2 Implementation 2009
+public:
+ //IAccessibility2 Implementation 2009-----
+ SwTOXSortTabBase* GetTOXSortTabBase();
+ short GetTOCLevel();
+ //-----IAccessibility2 Implementation 2009
sal_Bool IsHeading() const;
protected:
@@ -241,6 +273,15 @@ public:
virtual sal_Bool HasCursor(); // required by map to remember that object
+ //IAccessibility2 Implementation 2009-----
+ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStop( sal_Int32 nIndex );
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+ //-----IAccessibility2 Implementation 2009
+ // --> OD 2010-02-19 #i108125#
+ // MT: Solved merge conflict - seems this was removed between 101 and 103?
+ // virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew);
+ // <--
+
//===== XAccessibleContext ==============================================
/// Return this object's description.
@@ -406,7 +447,29 @@ public:
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
// <--
-
+ //IAccessibility2 Implementation 2009-----
+ //====== XAccessibleTextSelection ======================================
+ virtual sal_Bool SAL_CALL scrollToPosition( const ::com::sun::star::awt::Point& aPoint, sal_Bool isLeftTop )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedPortionCount( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL removeSelection( sal_Int32 selectionIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL addSelection( sal_Int32 selectionIndex, sal_Int32 startOffset, sal_Int32 endOffset)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ //===== XAccessibleExtendedAttributes ==============================================
+ virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ sal_Bool GetSelectionAtIndex(sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd);
+ sal_Int32 GetRealHeadingLevel();
+ //===== XAccessibleComponent ============================================
+ sal_Bool m_bLastHasSelection;
+ sal_Bool tabCharInWord(sal_Int32 nIndex, com::sun::star::i18n::Boundary& aBound);
+ //-----IAccessibility2 Implementation 2009
// --> OD 2008-05-29 #i89175#
//===== XAccessibleMultiLineText ========================================
virtual sal_Int32 SAL_CALL getLineNumberAtIndex( sal_Int32 nIndex )
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 2d50e6f0d08a..64d6daba5cae 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -64,6 +64,10 @@
using namespace ::com::sun::star;
+//IAccessibility2 Implementation 2009-----
+//#include "accnote.hxx"
+//-----IAccessibility2 Implementation 2009
+
using rtl::OUString;
using rtl::OUStringBuffer;
using i18n::Boundary;
@@ -140,6 +144,13 @@ void SwAccessiblePortionData::Text(sal_uInt16 nLength, sal_uInt16 nType)
bLastIsSpecial = sal_False;
}
+//IAccessibility2 Implementation 2009-----
+void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFldType )
+{
+ aAttrFieldType.push_back(nAttrFldType);
+ return;
+}
+//-----IAccessibility2 Implementation 2009
void SwAccessiblePortionData::Special(
sal_uInt16 nLength, const String& rText, sal_uInt16 nType)
@@ -156,11 +167,46 @@ void SwAccessiblePortionData::Special(
switch( nType )
{
case POR_POSTITS:
- case POR_FLYCNT:
- case POR_GRFNUM:
+ //IAccessibility2 Implementation 2009-----
sDisplay = String(sal_Unicode(0xfffc));
break;
+ case POR_FLYCNT:
+ sDisplay = String(sal_Unicode(0xfffc));
+ break;
+ case POR_GRFNUM:
+ case POR_BULLET:
+ break;
+ case POR_FLD:
+ //Added by yanjun for 6854
+ case POR_HIDDEN:
+ case POR_COMBINED:
+ case POR_ISOREF:
+ //End
+ {
+ //When the filed content is empty, input a special character.
+ if (rText.Len() == 0)
+ sDisplay = String(sal_Unicode(0xfffc));
+ else
+ sDisplay = rText;
+ aFieldPosition.push_back(aBuffer.getLength());
+ aFieldPosition.push_back(aBuffer.getLength() + rText.Len());
+ break;
+ }
+ case POR_FTNNUM:
+ {
+ break;
+ }
+ case POR_FTN:
+ {
+ sDisplay = rText;
+ sal_Int32 nStart=aBuffer.getLength();
+ sal_Int32 nEnd=nStart + rText.Len();
+ m_vecPairPos.push_back(std::make_pair(nStart,nEnd));
+ break;
+ }
+ //-----IAccessibility2 Implementation 2009
+ break;
case POR_NUMBER:
{
OUStringBuffer aTmpBuffer( rText.Len() + 1 );
@@ -280,6 +326,7 @@ sal_Bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const
case POR_NUMBER:
case POR_FLD:
case POR_URL:
+ case POR_INPUTFLD:
case POR_ISOTOX:
case POR_TOX:
case POR_HIDDEN:
@@ -675,6 +722,37 @@ sal_uInt16 SwAccessiblePortionData::FillSpecialPos(
return static_cast<sal_uInt16>( nModelPos );
}
+//IAccessibility2 Implementation 2009-----
+sal_uInt16 SwAccessiblePortionData::GetAttrFldType( sal_Int32 nPos )
+{
+ if( aFieldPosition.size() < 2 ) return sal_False;
+ sal_Int32 nFieldIndex = 0;
+ for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ return aAttrFieldType[nFieldIndex];
+ }
+ nFieldIndex++ ;
+ }
+ return 0;
+}
+
+sal_Bool SwAccessiblePortionData::FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos )
+{
+ if( aFieldPosition.size() < 2 ) return sal_False;
+ for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ rBound.startPos = aFieldPosition[i];
+ rBound.endPos = aFieldPosition[i + 1];
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
void SwAccessiblePortionData::AdjustAndCheck(
sal_Int32 nPos,
size_t& nPortionNo,
@@ -738,6 +816,50 @@ sal_Bool SwAccessiblePortionData::IsValidCorePosition( sal_uInt16 nPos ) const
( nPos <= aModelPositions[ aModelPositions.size()-1 ] );
}
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessiblePortionData::IsZeroCorePositionData()
+{
+ if( aModelPositions.size() < 1 ) return sal_True;
+ return aModelPositions[0] == 0 && aModelPositions[aModelPositions.size()-1] == 0;
+}
+
+sal_Bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex)
+{
+ VEC_PAIR_POS::iterator vi =m_vecPairPos.begin();
+ for (;vi != m_vecPairPos.end() ; ++vi)
+ {
+ const PAIR_POS &pairPos = *vi;
+ if(nIndex >= pairPos.first && nIndex < pairPos.second )
+ {
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool SwAccessiblePortionData::IsInGrayPortion( sal_Int32 nPos )
+{
+// return IsGrayPortion( FindBreak( aAccessiblePositions, nPos ) );
+ return IsPortionAttrSet( FindBreak( aAccessiblePositions, nPos ),
+ PORATTR_GRAY );
+}
+
+sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos)
+{
+ sal_Int32 nIndex = -1;
+ if( aFieldPosition.size() >= 2 )
+ {
+ for( sal_Int32 i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ {
+ if( nPos <= aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] )
+ {
+ nIndex = i/2;
+ break;
+ }
+ }
+ }
+ return nIndex;
+}
sal_uInt16 SwAccessiblePortionData::GetFirstValidCorePosition() const
{
return static_cast<sal_uInt16>( aModelPositions[0] );
diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx
index 1ecab653f3e2..a068f27458b4 100644
--- a/sw/source/core/access/accportions.hxx
+++ b/sw/source/core/access/accportions.hxx
@@ -61,6 +61,10 @@ class SwAccessiblePortionData : public SwPortionHandler
Positions_t aLineBreaks; /// position of line breaks
Positions_t aModelPositions; /// position of portion breaks in the model
Positions_t aAccessiblePositions; /// portion breaks in sAccessibleString
+ //IAccessibility2 Implementation 2009-----
+ Positions_t aFieldPosition;
+ //-----IAccessibility2 Implementation 2009
+ Positions_t aAttrFieldType;
typedef std::vector<sal_uInt8> PortionAttrs_t;
PortionAttrs_t aPortionAttrs; /// additional portion attributes
@@ -104,7 +108,15 @@ public:
virtual void Skip(sal_uInt16 nLength);
virtual void Finish();
+ //IAccessibility2 Implementation 2009-----
+ virtual void SetAttrFieldType( sal_uInt16 nAttrFldType );
+ sal_Bool FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos );
+ sal_Bool IsIndexInFootnode(sal_Int32 nIndex);
+ sal_Bool IsInGrayPortion( sal_Int32 nPos );
+ sal_Int32 GetFieldIndex(sal_Int32 nPos);
+ //-----IAccessibility2 Implementation 2009
+ sal_Bool IsZeroCorePositionData();
// access to the portion data
/// get the text string, as presented by the layout
@@ -149,6 +161,7 @@ public:
void GetAttributeBoundary( com::sun::star::i18n::Boundary& rBound,
sal_Int32 nPos ) const;
+ sal_uInt16 GetAttrFldType( sal_Int32 nPos );
/// Convert start and end positions into core positions.
/// @returns true if 'special' portions are included either completely
/// or not at all. This can be used to test whether editing
@@ -164,6 +177,12 @@ public:
sal_Bool IsValidCorePosition( sal_uInt16 nPos ) const;
sal_uInt16 GetFirstValidCorePosition() const;
sal_uInt16 GetLastValidCorePosition() const;
+ //IAccessibility2 Implementation 2009-----
+private:
+ typedef std::pair<sal_Int32,sal_Int32> PAIR_POS;
+ typedef std::vector<PAIR_POS> VEC_PAIR_POS;
+ VEC_PAIR_POS m_vecPairPos;
+ //-----IAccessibility2 Implementation 2009
};
diff --git a/sw/source/core/access/accpreview.cxx b/sw/source/core/access/accpreview.cxx
index f67165600906..da9dab6dd725 100644
--- a/sw/source/core/access/accpreview.cxx
+++ b/sw/source/core/access/accpreview.cxx
@@ -32,6 +32,11 @@
#endif
#include <accpreview.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView";
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView";
@@ -54,7 +59,9 @@ using ::rtl::OUString;
SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
SwAccessibleDocumentBase( pMp )
{
- SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+ //IAccessibility2 Implementation 2009-----
+ SetName( GetResource( STR_ACCESS_PREVIEW_DOC_NAME ) );
+ //-----IAccessibility2 Implementation 2009
}
SwAccessiblePreview::~SwAccessiblePreview()
@@ -98,3 +105,21 @@ Sequence< sal_Int8 > SAL_CALL SwAccessiblePreview::getImplementationId()
}
return aId;
}
+//IAccessibility2 Implementation 2009-----
+OUString SAL_CALL SwAccessiblePreview::getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException)
+{
+ return GetResource( STR_ACCESS_PREVIEW_DOC_NAME );
+}
+
+OUString SAL_CALL SwAccessiblePreview::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString sName = SwAccessibleDocumentBase::getAccessibleName();
+ sName += OUString::createFromAscii(" ");
+ sName += GetResource( STR_ACCESS_PREVIEW_DOC_SUFFIX );
+ return sName;
+}
+void SwAccessiblePreview::_InvalidateFocus()
+{
+ FireStateChangedEvent( ::com::sun::star::accessibility::AccessibleStateType::FOCUSED, sal_True );
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/sw/source/core/access/accpreview.hxx b/sw/source/core/access/accpreview.hxx
index 215db22f653d..4907240c8d6a 100644
--- a/sw/source/core/access/accpreview.hxx
+++ b/sw/source/core/access/accpreview.hxx
@@ -66,6 +66,12 @@ public:
//====== XTypeProvider ====================================================
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //IAccessibility2 Implementation 2009-----
+ ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual void _InvalidateFocus();
+ //-----IAccessibility2 Implementation 2009
};
#endif
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
index 0a651f3b5d42..9be9421fffd6 100644
--- a/sw/source/core/access/accselectionhelper.cxx
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -38,6 +38,14 @@
#include <flyfrm.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <fmtanchr.hxx>
+//-----IAccessibility2 Implementation 2009
+
+using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -111,6 +119,43 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
// return bRet;
}
+//IAccessibility2 Implementation 2009-----
+//When the selected state of the SwFrmOrObj is setted, return true.
+static sal_Bool lcl_getSelectedState(const SwAccessibleChild& aChild,
+ SwAccessibleContext* pContext,
+ SwAccessibleMap* pMap)
+{
+ Reference< XAccessible > xAcc;
+ if ( aChild.GetSwFrm() )
+ {
+ xAcc = pMap->GetContext( aChild.GetSwFrm(), sal_False );
+ }
+ else if ( aChild.GetDrawObject() )
+ {
+ xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, sal_False );
+ }
+
+ if( xAcc.is() )
+ {
+ Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext();
+ if(!pRContext.is())
+ return sal_False;
+ Reference<XAccessibleStateSet> pRStateSet = pRContext->getAccessibleStateSet();
+ if( pRStateSet.is() )
+ {
+ Sequence<short> pStates = pRStateSet->getStates();
+ long count = pStates.getLength();
+ for( int i = 0; i < count; i++ )
+ {
+ if( pStates[i] == AccessibleStateType::SELECTED)
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
+
sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException,
@@ -137,6 +182,14 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
{
bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
}
+ //IAccessibility2 Implementation 2009-----
+ //If the SwFrmOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor.
+ if( !bRet )
+ {
+ if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) == sal_True)
+ bRet = sal_True;
+ }
+ //-----IAccessibility2 Implementation 2009
}
return bRet;
@@ -194,11 +247,11 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
- {
+ //IAccessibility2 Implementation 2009-----
+ //if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+ // rContext.GetFrm() )
nCount = 1;
- }
+ //-----IAccessibility2 Implementation 2009
}
else
{
@@ -226,6 +279,26 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
}
}
}
+ //IAccessibility2 Implementation 2009-----
+ //If the SwFrmOrObj is not selected directly in the UI,
+ //we should check whether it is selected in the selection cursor.
+ if( nCount == 0 )
+ {
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
+ ::std::list< SwAccessibleChild >::const_iterator aIter =
+ aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter =
+ aChildren.end();
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& aChild = *aIter;
+ if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) )
+ nCount++;
+ ++aIter;
+ }
+ }
+ //-----IAccessibility2 Implementation 2009
}
return nCount;
}
@@ -249,12 +322,28 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( 0 == nSelectedChildIndex &&
- rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
+ //IAccessibility2 Implementation 2009-----
+ if( 0 == nSelectedChildIndex )
{
- aChild = pFlyFrm;
+ if(rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == rContext.GetFrm() )
+ {
+ aChild = pFlyFrm;
+ }
+ else
+ {
+ const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+ if (pFrmFmt)
+ {
+ const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+ if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+ {
+ const SwFrm *pParaFrm = rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview() );
+ aChild = pParaFrm;
+ }
+ }
+ }
}
+ //-----IAccessibility2 Implementation 2009
}
else
{
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 60567153326f..3da5bec89c29 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -49,9 +49,14 @@
#include <accmap.hxx>
#include <access.hrc>
#include <acctable.hxx>
-
+#include <rowfrm.hxx>
+#include <layfrm.hxx>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
@@ -67,6 +72,8 @@ typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl;
typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
+const int SELECTION_WITH_NUM =10;
+
class SwAccTableSelHander_Impl
{
public:
@@ -88,6 +95,10 @@ class SwAccessibleTableData_Impl
bool mbOnlyTableColumnHeader;
void CollectData( const SwFrm *pFrm );
+ //IAccessibility2 Implementation 2009-----
+ void CollectColumnHeaderData( const SwFrm *pFrm );
+ void CollectRowHeaderData( const SwFrm *pFrm );
+ //-----IAccessibility2 Implementation 2009
void CollectExtents( const SwFrm *pFrm );
sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
@@ -182,6 +193,99 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
}
}
+//IAccessibility2 Implementation 2009-----
+void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsRowFrm() )
+ {
+
+ const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // Headerline?
+ //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+ //return ;
+
+ maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+
+ CollectRowHeaderData( pLower );
+
+
+ }
+ else if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ //Added by yanjun. Can't find the "GetRowHeaderFlag" function(Need vefiry).
+ //if(((SwCellFrm*)pLower)->GetRowHeaderFlag())
+ // maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+ }
+ else
+ {
+ CollectRowHeaderData( pLower );
+ }
+ }
+ ++aIter;
+ }
+}
+//-----IAccessibility2 Implementation 2009
+
+void SwAccessibleTableData_Impl::CollectColumnHeaderData( const SwFrm *pFrm )
+{
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+ while( aIter != aEndIter )
+ {
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm *pLower = rLower.GetSwFrm();
+ if( pLower )
+ {
+ if( pLower->IsRowFrm() )
+ {
+
+ const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+ while( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+
+ // Headerline?
+ //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+ //return ;
+
+ //if the current line is now header line, then return ;
+ sal_Int16 iCurrentRowIndex = mpTabFrm->GetTable()->GetTabLines().GetPos( pLine);
+ if(iCurrentRowIndex >= mpTabFrm->GetTable()->_GetRowsToRepeat())
+ return ;
+
+ maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+
+ CollectColumnHeaderData( pLower );
+
+
+ }
+ else if( pLower->IsCellFrm() &&
+ rLower.IsAccessible( mbIsInPagePreview ) )
+ {
+ maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+ }
+ else
+ {
+ CollectColumnHeaderData( pLower );
+ }
+ }
+ ++aIter;
+ }
+}
+//-----IAccessibility2 Implementation 2009
void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
{
const SwAccessibleChildSList aList( *pFrm, mrAccMap );
@@ -396,7 +500,11 @@ const SwFrm *SwAccessibleTableData_Impl::GetCellAtPos(
inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
{
- return static_cast< sal_Int32 >( maRows.size() );
+ //IAccessibility2 Implementation 2009-----
+ sal_Int32 count = static_cast< sal_Int32 >( maRows.size() ) ;
+ count = (count <=0)? 1:count;
+ //-----IAccessibility2 Implementation 2009
+ return count;
}
inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
@@ -696,8 +804,12 @@ void SwAccessibleTable::GetStates(
::utl::AccessibleStateSetHelper& rStateSet )
{
SwAccessibleContext::GetStates( rStateSet );
-
+ //IAccessibility2 Implementation 2009-----
+ //Solution:Add resizable state to table
+ rStateSet.AddState( AccessibleStateType::RESIZABLE );
// MULTISELECTABLE
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+ //-----IAccessibility2 Implementation 2009
SwCrsrShell* pCrsrShell = GetCrsrShell();
if( pCrsrShell )
rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
@@ -727,6 +839,9 @@ SwAccessibleTable::SwAccessibleTable(
OUString sArg2( GetFormattedPageNumber() );
sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+ //IAccessibility2 Implementation 2009-----
+ UpdateTableData();
+ //-----IAccessibility2 Implementation 2009
}
SwAccessibleTable::~SwAccessibleTable()
@@ -784,8 +899,7 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
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;
@@ -809,6 +923,13 @@ uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType )
uno::Reference<XAccessibleSelection> xSelection( this );
aRet <<= xSelection;
}
+ //IAccessibility2 Implementation 2009-----
+ else if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) )
+ {
+ uno::Reference<XAccessibleTableSelection> xTableExtent( this );
+ aRet <<= xTableExtent;
+ }
+ //-----IAccessibility2 Implementation 2009
else
{
aRet = SwAccessibleContext::queryInterface(rType);
@@ -981,6 +1102,9 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
CHECK_FOR_DEFUNC( XAccessibleTable )
+ //IAccessibility2 Implementation 2009-----
+ UpdateTableData();
+ //-----IAccessibility2 Implementation 2009
GetTableData().CheckRowAndCol( nRow, nColumn, this );
Int32Set_Impl::const_iterator aSttCol(
@@ -1011,6 +1135,9 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleTable )
+ //IAccessibility2 Implementation 2009-----
+ UpdateTableData();
+ //-----IAccessibility2 Implementation 2009
GetTableData().CheckRowAndCol( nRow, nColumn, this );
@@ -1045,6 +1172,25 @@ uno::Reference< XAccessibleTable > SAL_CALL
SwAccessibleTable::getAccessibleColumnHeaders( )
throw (uno::RuntimeException)
{
+// MT IA2: Which one should win nowadys???
+/*
+ // IA2 version:
+ uno::Reference< XAccessibleTable > xRet;
+ SwTabFrm* pTabFrm =( SwTabFrm*)( GetFrm() );
+ if (pTabFrm)
+ {
+ if(pTabFrm->GetTable()->_GetRowsToRepeat() > 0)
+ {
+ //for errata table header
+ SwAccessibleTableData_Impl *mpHeadTableData = new SwAccessibleTableData_Impl( pTabFrm, sal_False, sal_True);
+ //for errata table header
+ SwAccessibleTable *pHeadAccessibleTable = new SwAccessibleTable(GetMap(),pTabFrm);
+ pHeadAccessibleTable->SetTableData(mpHeadTableData);
+ xRet = pHeadAccessibleTable;
+ }
+ }
+ return xRet;
+*/
// --> OD 2010-03-10 #i87532#
// assure that return accesible object is empty, if no column header exists.
SwAccessibleTableColHeaders* pTableColHeaders =
@@ -1346,6 +1492,15 @@ void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox )
{
vos::OGuard aGuard(Application::GetSolarMutex());
+ //IAccessibility2 Implementation 2009-----
+ //need to update children
+ SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData();
+ if( !pNewTableData->CompareExtents( GetTableData() ) )
+ {
+ delete mpTableData;
+ mpTableData = pNewTableData;
+ FireTableChangeEvent(*mpTableData);
+ }
if( HasTableData() )
GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
@@ -1402,6 +1557,34 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChil
// <--
if( !pNewTableData->CompareExtents( GetTableData() ) )
{
+ //IAccessibility2 Implementation 2009-----
+ if(pNewTableData->GetRowCount()!= mpTableData->GetRowCount())
+ {
+ Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) );
+ Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) );
+ const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow, sal_False );
+ Int32Set_Impl::const_iterator aSttCol2( pNewTableData->GetColumnIter( 0 ) );
+ Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) );
+ const SwFrm *pCellFrm2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2, sal_False );
+
+ if(pCellFrm == pCellFrm2)
+ {
+ AccessibleTableModelChange aModelChange;
+ aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
+ aModelChange.FirstRow = 0;
+ aModelChange.LastRow = mpTableData->GetRowCount() - 1;
+ aModelChange.FirstColumn = 0;
+ aModelChange.LastColumn = mpTableData->GetColumnCount() - 1;
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED;
+ aEvent.NewValue <<= aModelChange;
+
+ FireAccessibleEvent( aEvent );
+ }
+ }
+ else
+ //-----IAccessibility2 Implementation 2009
FireTableChangeEvent( GetTableData() );
ClearTableData();
mpTableData = pNewTableData;
@@ -1674,6 +1857,153 @@ void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
pCrsrShell->EndAction();
}
+//IAccessibility2 Implementation 2009-----
+void SwAccessibleTable::SetTableData(SwAccessibleTableData_Impl* mpNewTableData)
+{
+ mpTableData = mpNewTableData;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::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<XAccessible> xAccDoc = getAccessibleParent();
+ if (xAccDoc.is())
+ {
+ uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,uno::UNO_QUERY);
+ if (xCompoentDoc.is())
+ {
+ crBack = (sal_uInt32)xCompoentDoc->getBackground();
+ }
+ }
+ }
+ return crBack;
+}
+
+void SwAccessibleTable::FireSelectionEvent( )
+{
+ AccessibleEventObject aEvent;
+
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+
+// int nRemove = m_vecCellRemove.size();
+// int nAdd = m_vecCellAdd.size();
+
+ VEC_CELL::iterator vi = m_vecCellRemove.begin();
+ for (; vi != m_vecCellRemove.end() ; ++vi)
+ {
+ SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+ OSL_ASSERT(pAccCell != NULL );
+ pAccCell->FireAccessibleEvent(aEvent);
+ }
+
+ if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
+ {
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+ vi = m_vecCellAdd.begin();
+ for (; vi != m_vecCellAdd.end() ; ++vi)
+ {
+ SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+ OSL_ASSERT(pAccCell != NULL );
+ pAccCell->FireAccessibleEvent(aEvent);
+ }
+ return ;
+ }
+ else
+ {
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+ FireAccessibleEvent(aEvent);
+ }
+}
+
+void SwAccessibleTable::ClearSelectionCellCache()
+{
+ m_vecCellAdd.clear();
+ m_vecCellRemove.clear();
+}
+
+void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove)
+{
+ if (bAddOrRemove)
+ {
+ m_vecCellAdd.push_back(pAccCell);
+ }
+ else
+ {
+ m_vecCellRemove.push_back(pAccCell);
+ }
+}
+
+//===== XAccessibleTableSelection ============================================
+sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleColumnSelected( row ) )
+ return sal_True;
+
+ long lCol, lColumnCount, lChildIndex;
+ lColumnCount = getAccessibleColumnCount();
+ for(lCol = 0; lCol < lColumnCount; lCol ++)
+ {
+ lChildIndex = getAccessibleIndex(row, lCol);
+ selectAccessibleChild(lChildIndex);
+ }
+
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleColumnSelected( column ) )
+ return sal_True;
+
+ long lRow, lRowCount, lChildIndex;
+ lRowCount = getAccessibleRowCount();
+
+ for(lRow = 0; lRow < lRowCount; lRow ++)
+ {
+ lChildIndex = getAccessibleIndex(lRow, column);
+ selectAccessibleChild(lChildIndex);
+ }
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleSelected( row , 0 ) && isAccessibleSelected( row , getAccessibleColumnCount()-1 ) )
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ pCrsrShell->StartAction();
+ pCrsrShell->ClearMark();
+ pCrsrShell->EndAction();
+ return sal_True;
+ }
+ }
+ return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if( isAccessibleSelected( 0 , column ) && isAccessibleSelected( getAccessibleRowCount()-1,column))
+ {
+ SwCrsrShell* pCrsrShell = GetCrsrShell();
+ if( pCrsrShell != NULL )
+ {
+ pCrsrShell->StartAction();
+ pCrsrShell->ClearMark();
+ pCrsrShell->EndAction();
+ return sal_True;
+ }
+ }
+ return sal_True;
+}
+//-----IAccessibility2 Implementation 2009
// --> OD 2007-06-28 #i77106#
// implementation of class <SwAccessibleTableColHeaders>
SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx
index 3c68ac1868f0..908908b7b789 100644
--- a/sw/source/core/access/acctable.hxx
+++ b/sw/source/core/access/acctable.hxx
@@ -23,6 +23,12 @@
#ifndef _ACCTABLE_HXX
#define _ACCTABLE_HXX
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleTableSelection_HPP_
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#endif
+#include <vector>
+//-----IAccessibility2 Implementation 2009
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <acccontext.hxx>
@@ -40,6 +46,7 @@ class SwAccessibleTable :
public SwAccessibleContext,
public ::com::sun::star::accessibility::XAccessibleTable,
public ::com::sun::star::accessibility::XAccessibleSelection,
+ public ::com::sun::star::accessibility::XAccessibleTableSelection,
public SwClient
{
SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex
@@ -85,6 +92,9 @@ protected:
// Is table data evailable?
sal_Bool HasTableData() const { return (mpTableData != 0); }
+ //IAccessibility2 Implementation 2009-----
+ void SetTableData(SwAccessibleTableData_Impl* mpNewTableData) ;
+ //-----IAccessibility2 Implementation 2009
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
public:
@@ -187,7 +197,17 @@ public:
virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException);
-
+ //IAccessibility2 Implementation 2009-----
+ //===== XAccessibleTableSelection ============================================
+ virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+ //-----IAccessibility2 Implementation 2009
//===== XServiceInfo ====================================================
/** Returns an identifier for the implementation of this object.
@@ -254,6 +274,17 @@ public:
throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException );
+ //IAccessibility2 Implementation 2009-----
+ //===== XAccessibleComponent ============================================
+ sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+ typedef std::vector<const SwAccessibleContext*> VEC_CELL;
+ VEC_CELL m_vecCellAdd;
+ VEC_CELL m_vecCellRemove;
+ void FireSelectionEvent( );
+ void ClearSelectionCellCache();
+ void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove);
+ //-----IAccessibility2 Implementation 2009
};
inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index 893a45a8b4d0..0fedef797a63 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -44,6 +44,11 @@
// <--
#include "acctextframe.hxx"
+//IAccessibility2 Implementation 2009-----
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
@@ -152,6 +157,125 @@ void SwAccessibleTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *
}
}
+//IAccessibility2 Implementation 2009-----
+//===== XInterface ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+ SwAccessibleTextFrame::queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = SwAccessibleContext::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this)
+ );
+ return aReturn;
+}
+
+
+
+
+void SAL_CALL
+ SwAccessibleTextFrame::acquire (void)
+ throw ()
+{
+ SwAccessibleContext::acquire ();
+}
+
+void SAL_CALL
+ SwAccessibleTextFrame::release (void)
+ throw ()
+{
+ SwAccessibleContext::release ();
+}
+
+//
+//===== XAccessibleSelection ============================================
+//
+
+//--------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------------
+sal_Bool SAL_CALL SwAccessibleTextFrame::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
+ uno::Reference<XAccessibleContext> xContext;
+ if( xAcc.is() )
+ xContext = xAcc->getAccessibleContext();
+
+ if( xContext.is() )
+ {
+ if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
+ xText(xAcc, uno::UNO_QUERY);
+ if( xText.is() )
+ {
+ if( xText->getSelectionStart() >= 0 ) return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+}
+
+//---------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::clearAccessibleSelection( )
+ throw ( uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::clearAccessibleSelection( )> - missing implementation" );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAllAccessibleChildren( )
+ throw ( uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ sal_Int32 nCount = 0;
+ sal_Int32 TotalCount = getAccessibleChildCount();
+ for( sal_Int32 i = 0; i < TotalCount; i++ )
+ if( isAccessibleChildSelected(i) ) nCount++;
+
+ return nCount;
+}
+
+//--------------------------------------------------------------------------------------
+uno::Reference<XAccessible> SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+ sal_Int32 i1, i2;
+ for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
+ if( isAccessibleChildSelected(i1) )
+ {
+ if( i2 == nSelectedChildIndex )
+ return getAccessibleChild( i1 );
+ i2++;
+ }
+ return uno::Reference<XAccessible>();
+}
+
+//----------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::deselectAccessibleChild( sal_Int32 )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( sal_Int32 )> - missing implementation" );
+}
+//-----IAccessibility2 Implementation 2009
+
// --> OD 2009-07-14 #i73249#
OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
throw (uno::RuntimeException)
@@ -168,15 +292,29 @@ OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
return SwAccessibleFrameBase::getAccessibleName();
}
// <--
+
OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleContext )
+ /* MT: I guess msDesc is correct noadays?
+ //IAccessibility2 Implementation 2009-----
+ OUString longDesc;
+ const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
+ if( pFlyFmt )
+ {
+ longDesc = OUString( pFlyFmt->GetDescription() );
+ }
+ if( longDesc.getLength() > 0 )
+ return GetName() + OUString(' ') + longDesc;
+ else
+ return GetName();
+ //-----IAccessibility2 Implementation 2009
+ */
return msDesc;
-
}
OUString SAL_CALL SwAccessibleTextFrame::getImplementationName()
diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx
index 0af8b806da89..0f51f82c5a26 100644
--- a/sw/source/core/access/acctextframe.hxx
+++ b/sw/source/core/access/acctextframe.hxx
@@ -24,13 +24,18 @@
#define _ACCTEXTFRAME_HXX
#include "accframebase.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+//-----IAccessibility2 Implementation 2009
+
class SwFlyFrm;
namespace utl { class AccessibleRelationSetHelper; }
namespace com { namespace star {
namespace accessibility { struct AccessibleRelation; }
} }
-class SwAccessibleTextFrame : public SwAccessibleFrameBase
+class SwAccessibleTextFrame : public SwAccessibleFrameBase,
+ public ::com::sun::star::accessibility::XAccessibleSelection
{
private:
// --> OD 2009-07-14 #i73249#
@@ -48,6 +53,43 @@ public:
SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm );
+ //IAccessibility2 Implementation 2009-----
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ ::com::sun::star::uno::Type const & rType )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ //===== 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 );
+ //-----IAccessibility2 Implementation 2009
+
//===== XAccessibleContext ==============================================
// --> OD 2009-07-14 #i73249#