summaryrefslogtreecommitdiff
path: root/accessibility/source/extended
diff options
context:
space:
mode:
Diffstat (limited to 'accessibility/source/extended')
-rw-r--r--accessibility/source/extended/AccessibleGridControl.cxx83
-rw-r--r--accessibility/source/extended/AccessibleGridControlBase.cxx9
-rw-r--r--accessibility/source/extended/AccessibleGridControlHeader.cxx16
-rw-r--r--accessibility/source/extended/AccessibleGridControlHeaderCell.cxx19
-rw-r--r--accessibility/source/extended/AccessibleGridControlTable.cxx61
-rw-r--r--accessibility/source/extended/AccessibleGridControlTableCell.cxx18
6 files changed, 195 insertions, 11 deletions
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
index a093318ffd3a..e8058eab628d 100644
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -29,6 +29,9 @@
#include "accessibility/extended/AccessibleGridControl.hxx"
#include "accessibility/extended/AccessibleGridControlTable.hxx"
#include "accessibility/extended/AccessibleGridControlHeader.hxx"
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
#include <svtools/accessibletable.hxx>
#include <comphelper/types.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -68,6 +71,12 @@ public:
Reference<
::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar;
AccessibleGridControlHeader* m_pColumnHeaderBar;
+
+ /** The table cell child. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xCell;
+ AccessibleGridControlTableCell* m_pCell;
+
};
AccessibleGridControl::AccessibleGridControl(
@@ -92,6 +101,7 @@ void SAL_CALL AccessibleGridControl::disposing()
m_pImpl->m_pTable = NULL;
m_pImpl->m_pColumnHeaderBar = NULL;
m_pImpl->m_pRowHeaderBar = NULL;
+ m_pImpl->m_pCell = NULL;
m_pImpl->m_aCreator = Reference< XAccessible >();
Reference< XAccessible > xTable = m_pImpl->m_xTable;
@@ -101,7 +111,16 @@ void SAL_CALL AccessibleGridControl::disposing()
{
xComp->dispose();
}
+ Reference< XAccessible > xCell = m_pImpl->m_xCell;
+
+ Reference< XComponent > xCellComp( m_pImpl->m_xCell, UNO_QUERY );
+ if ( xCellComp.is() )
+ {
+ xCellComp->dispose();
+ }
+ ::comphelper::disposeComponent(m_pImpl->m_xRowHeaderBar);
+ ::comphelper::disposeComponent(m_pImpl->m_xColumnHeaderBar);
AccessibleGridControlBase::disposing();
}
// -----------------------------------------------------------------------------
@@ -151,8 +170,12 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
}
else
{
+ if(!m_pImpl->m_xTable.is())
+ {
AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE);
m_pImpl->m_xTable = pTable;
+ m_pImpl->m_pTable = pTable;
+ }
xChild = m_pImpl->m_xTable;
}
}
@@ -311,6 +334,66 @@ AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable()
OSL_ENSURE( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" );
return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE );
}
+// -----------------------------------------------------------------------------
+void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue)
+{
+ sal_Int32 nChildCount = getAccessibleChildCount();
+ if(nChildCount != 0)
+ {
+ for(sal_Int32 i=0;i<nChildCount;i++)
+ {
+ Reference< XAccessible > xAccessible = getAccessibleChild(i);
+ com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext > xAccessibleChild = xAccessible->getAccessibleContext();
+ if(m_pImpl->m_xTable == xAccessible)
+ {
+ std::vector< AccessibleGridControlTableCell* > xCellCont = m_pImpl->m_pTable->getCellVector();
+ int nIndex = m_aTable.GetCurrentRow()*m_aTable.GetColumnCount()+m_aTable.GetCurrentColumn();
+ if(!xCellCont.empty() && xCellCont[nIndex])
+ {
+ m_pImpl->m_pCell = xCellCont[nIndex];
+ m_pImpl->m_pCell->commitEvent( _nEventId, _rNewValue, _rOldValue );
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( m_pImpl->m_xTable.is() )
+ m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
+ }
+}
+
+void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue)
+{
+ if ( m_pImpl->m_xTable.is() )
+ {
+ if(_nEventId == AccessibleEventId::ACTIVE_DESCENDANT_CHANGED)
+ {
+ Reference< XAccessible > xChild = m_pImpl->m_pTable->getAccessibleChild(m_aTable.GetCurrentRow()*m_aTable.GetColumnCount()+m_aTable.GetCurrentColumn());
+ m_pImpl->m_pTable->commitEvent(_nEventId, makeAny(xChild),_rOldValue);
+ }
+ else if(_nEventId == AccessibleEventId::TABLE_MODEL_CHANGED)
+ {
+ AccessibleTableModelChange aChange;
+ if(_rNewValue >>= aChange)
+ {
+ if(aChange.Type == AccessibleTableModelChangeType::DELETE)
+ {
+ std::vector< AccessibleGridControlTableCell* >::iterator m_pCell = m_pImpl->m_pTable->getCellVector().begin();
+ std::vector< Reference< XAccessible > >::iterator m_xAccessibleVector = m_pImpl->m_pTable->getAccessibleCellVector().begin();
+ int nColCount = m_aTable.GetColumnCount();
+ m_pImpl->m_pTable->getCellVector().erase(m_pCell+nColCount*aChange.FirstRow, m_pCell+nColCount*aChange.LastRow );
+ m_pImpl->m_pTable->getAccessibleCellVector().erase(m_xAccessibleVector+nColCount*aChange.FirstRow, m_xAccessibleVector+nColCount*aChange.LastRow);
+ m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
+ }
+ else
+ m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
+ }
+ }
+ else
+ m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
+ }
+}
// ============================================================================
// = AccessibleGridControlAccess
// ============================================================================
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
index c092e4872997..ecccf07c0041 100644
--- a/accessibility/source/extended/AccessibleGridControlBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -81,7 +81,16 @@ AccessibleGridControlBase::~AccessibleGridControlBase()
void SAL_CALL AccessibleGridControlBase::disposing()
{
::osl::MutexGuard aGuard( getOslMutex() );
+
+ if ( getClientId( ) )
+ {
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ }
+
m_xParent = NULL;
+ //m_aTable = NULL;
}
// XAccessibleContext ---------------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index 27dfb6084d18..609000d3d62a 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -235,12 +235,24 @@ Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
Rectangle AccessibleGridControlHeader::implGetBoundingBox()
{
- return m_aTable.calcHeaderRect(isColumnBar());
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
+ Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
+ if(isColumnBar())
+ return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
+ else
+ return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
+
}
Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
{
- return m_aTable.calcHeaderRect(isColumnBar());
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) );
+ Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
+ if(isColumnBar())
+ return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
+ else
+ return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
}
sal_Int32 AccessibleGridControlHeader::implGetRowCount() const
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
index e0fb0c10695d..8ad0a949ff6c 100644
--- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
@@ -145,13 +145,28 @@ OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName()
// -----------------------------------------------------------------------------
Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox()
{
- return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
+ sal_Int32 nIndex = getAccessibleIndexInParent();
+ Rectangle aCellRect;
+ if(m_eObjType == TCTYPE_COLUMNHEADERCELL)
+ aCellRect = m_aTable.calcHeaderCellRect(true, nIndex);
+ else
+ aCellRect = m_aTable.calcHeaderCellRect(false, nIndex);
+ return Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize());
}
// -----------------------------------------------------------------------------
Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen()
{
- return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) );
+ sal_Int32 nIndex = getAccessibleIndexInParent();
+ Rectangle aCellRect;
+ if(m_eObjType == TCTYPE_COLUMNHEADERCELL)
+ aCellRect = m_aTable.calcHeaderCellRect(true, nIndex);
+ else
+ aCellRect = m_aTable.calcHeaderCellRect(false, nIndex);
+ return Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize());
}
// -----------------------------------------------------------------------------
sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent()
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
index 55b204d05ebc..b0e2e4e6c02b 100644
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -51,6 +51,8 @@ AccessibleGridControlTable::AccessibleGridControlTable(
IAccessibleTable& rTable,
AccessibleTableControlObjType _eType) :
AccessibleGridControlTableBase( rxParent, rTable, _eType )
+ ,m_pCellVector( )
+ ,m_pAccessCellVector( )
{
}
@@ -68,7 +70,19 @@ AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex )
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidIndex( nChildIndex );
- return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL);
+ sal_Int32 nCount = getAccessibleChildCount();
+ if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount)
+ {
+ m_pAccessCellVector.resize(nCount);
+ m_pCellVector.resize(nCount);
+ }
+ if(!m_pAccessCellVector[nChildIndex].is())
+ {
+ AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL);
+ m_pCellVector[nChildIndex] = pCell;
+ m_pAccessCellVector[nChildIndex] = pCell;
+ }
+ return m_pAccessCellVector[nChildIndex];
}
sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
@@ -98,7 +112,6 @@ AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint )
sal_Int32 nColumnPos = 0;
if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL);
-
return xChild;
}
@@ -214,7 +227,20 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellA
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidAddress( nRow, nColumn );
- return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL);
+ sal_Int32 nCount = getAccessibleChildCount();
+ sal_Int32 nChildIndex = nRow*m_aTable.GetColumnCount() + nColumn;
+ if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount)
+ {
+ m_pAccessCellVector.resize(nCount);
+ m_pCellVector.resize(nCount);
+ }
+ if(!m_pAccessCellVector[nChildIndex].is())
+ {
+ AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL);
+ m_pCellVector[nChildIndex] = pCell;
+ m_pAccessCellVector[nChildIndex] = pCell;
+ }
+ return m_pAccessCellVector[nChildIndex];
}
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
@@ -332,12 +358,28 @@ OUString SAL_CALL AccessibleGridControlTable::getImplementationName()
Rectangle AccessibleGridControlTable::implGetBoundingBox()
{
- return m_aTable.calcTableRect();
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ));
+ Rectangle aTableRect( m_aTable.calcTableRect() );
+ long nX = aGridRect.Left() + aTableRect.Left();
+ long nY = aGridRect.Top() + aTableRect.Top();
+ long nWidth = aGridRect.GetSize().Width()-aTableRect.Left();
+ long nHeight = aGridRect.GetSize().Height()-aTableRect.Top();
+ Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight ));
+ return aTable;
}
Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
{
- return m_aTable.calcTableRect();
+ Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ));
+ Rectangle aTableRect( m_aTable.calcTableRect() );
+ long nX = aGridRect.Left() + aTableRect.Left();
+ long nY = aGridRect.Top() + aTableRect.Top();
+ long nWidth = aGridRect.GetSize().Width()-aTableRect.Left();
+ long nHeight = aGridRect.GetSize().Height()-aTableRect.Top();
+ Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight ));
+ return aTable;
}
// internal helper methods ----------------------------------------------------
Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
@@ -361,6 +403,15 @@ Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
}
+std::vector< AccessibleGridControlTableCell* >& AccessibleGridControlTable::getCellVector()
+{
+ return m_pCellVector;
+}
+
+std::vector< Reference< XAccessible > >& AccessibleGridControlTable::getAccessibleCellVector()
+{
+ return m_pAccessCellVector;
+}
// ============================================================================
} // namespace accessibility
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
index caef437f341f..f32eec0a1f1f 100644
--- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -355,12 +355,26 @@ namespace accessibility
Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
{
- return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
+ Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( pParent );
+ sal_Int32 nIndex = getAccessibleIndexInParent();
+ Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount());
+ long nX = aGridRect.Left() + aCellRect.Left();
+ long nY = aGridRect.Top() + aCellRect.Top();
+ Rectangle aCell( Point( nX, nY ), aCellRect.GetSize());
+ return aCell;
}
// -----------------------------------------------------------------------------
Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
{
- return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( NULL );
+ sal_Int32 nIndex = getAccessibleIndexInParent();
+ Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount());
+ long nX = aGridRect.Left() + aCellRect.Left();
+ long nY = aGridRect.Top() + aCellRect.Top();
+ Rectangle aCell( Point( nX, nY ), aCellRect.GetSize());
+ return aCell;
}
}