21#include <com/sun/star/table/XMergeableCell.hpp>
22#include <com/sun/star/accessibility/AccessibleEventId.hpp>
23#include <com/sun/star/accessibility/AccessibleStateType.hpp>
24#include <com/sun/star/accessibility/AccessibleRole.hpp>
25#include <com/sun/star/drawing/XShape.hpp>
26#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
37#include <unordered_map>
41#include <com/sun/star/view/XSelectionSupplier.hpp>
65 void init(
const Reference< XAccessible>& xAccessible,
const Reference< XTable >& xTable );
72 void getColumnAndRow( sal_Int64 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow );
75 virtual void SAL_CALL
modified(
const EventObject&
aEvent )
override;
94: mrShapeTreeInfo( rShapeTreeInfo )
108 Reference< XModifyListener > xListener(
this );
109 mxTable->addModifyListener( xListener );
111 Reference< css::view::XSelectionSupplier > xSelSupplier(xTable, UNO_QUERY);
112 Reference< css::view::XSelectionChangeListener > xSelListener( xAccessible, UNO_QUERY );
113 if (xSelSupplier.is())
114 xSelSupplier->addSelectionChangeListener(xSelListener);
128 rEntry.second->dispose();
131 Reference< XModifyListener > xListener(
this );
132 mxTable->removeModifyListener( xListener );
142 AccessibleCellMap::iterator iter(
maChildMap.find( xCell ) );
154 Reference< XCell > xCell(
mxTable->getCellByPosition( nColumn, nRow ) );
157 if( !xChild.is() &&
mxTable.is() )
159 sal_Int32 nChildIndex =
mxTable->getColumnCount() * nRow + nColumn;
160 CellRef xCellRef(
dynamic_cast< Cell*
>( xCell.get() ) );
164 xAccessibleCell->Init();
167 xChild = xAccessibleCell;
175 sal_Int32 nColumn = 0, nRow = 0;
178 Reference< XCell > xCell(
mxTable->getCellByPosition( nColumn, nRow ) );
179 AccessibleCellMap::iterator iter(
maChildMap.find( xCell ) );
183 Reference< XAccessible > xChild( (*iter).second );
188 CellRef xCellRef(
dynamic_cast< Cell*
>( xCell.get() ) );
192 xAccessibleCell->Init();
195 return xAccessibleCell;
204 const sal_Int32 nColumnCount =
mxTable->getColumnCount();
205 if (nColumnCount == 0)
206 throw IndexOutOfBoundsException();
208 rnColumn = nChildIndex % nColumnCount;
209 rnRow = nChildIndex / nColumnCount;
211 if( rnRow < mxTable->getRowCount() )
215 throw IndexOutOfBoundsException();
232 const sal_Int32 nRowCount =
mxTable->getRowCount();
233 const sal_Int32 nColCount =
mxTable->getColumnCount();
235 bool bRowOrColumnChanged =
false;
238 bRowOrColumnChanged =
true;
242 sal_Int32 nChildIndex = 0;
244 for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
246 for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
248 Reference< XCell > xCell(
mxTable->getCellByPosition( nCol, nRow ) );
249 AccessibleCellMap::iterator iter( aTempChildMap.find( xCell ) );
251 if( iter != aTempChildMap.end() )
254 xAccessibleCell->setIndexInParent( nChildIndex );
255 xAccessibleCell->UpdateChildren();
257 if (bRowOrColumnChanged)
262 Reference< XMergeableCell > xMergedCell(
mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY );
263 if (xMergedCell.is() && xMergedCell->isMerged())
265 xAccessibleCell->ResetState(AccessibleStateType::VISIBLE);
266 xAccessibleCell->ResetState(AccessibleStateType::ENABLED);
269 xAccessibleCell->ResetState(AccessibleStateType::SHOWING);
273 xAccessibleCell->SetState(AccessibleStateType::VISIBLE);
274 xAccessibleCell->SetState(AccessibleStateType::ENABLED);
277 xAccessibleCell->SetState(AccessibleStateType::SHOWING);
282 aTempChildMap.erase( iter );
286 CellRef xCellRef(
dynamic_cast< Cell*
>( xCell.get() ) );
290 xAccessibleCell->Init();
301 for(
auto& rEntry : aTempChildMap )
303 rEntry.second->dispose();
308 pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN,
Any(),
Any(), -1);
323, mnPreviousSelectionCount(0)
338 Reference< XPropertySet > xSet(
mxShape, UNO_QUERY_THROW );
339 Reference< XTable > xTable( xSet->getPropertyValue(
"Model"), UNO_QUERY_THROW );
341 mxImpl->init(
this, xTable );
348 AccessibleTableShape_Base::Init();
354 SdrView* pView = maShapeTreeInfo.GetSdrView ();
369 Reference<XAccessibleTableSelection> xThis(
this );
375 return AccessibleTableShape_Base::queryInterface( aType );
381 AccessibleTableShape_Base::acquire();
387 AccessibleTableShape_Base::release();
396 return "com.sun.star.comp.accessibility.AccessibleTableShape";
409 return mxImpl->mxTable.is() ?
static_cast<sal_Int64
>(
mxImpl->mxTable->getRowCount()) *
static_cast<sal_Int64
>(
mxImpl->mxTable->getColumnCount()) : 0;
418 return mxImpl->getAccessibleChild(
i );
424 return AccessibleRole::TABLE;
443 return mxImpl->mxTable.is() ?
mxImpl->mxTable->getRowCount() : 0;
450 return mxImpl->mxTable.is() ?
mxImpl->mxTable->getColumnCount() : 0;
473 if(
mxImpl->mxTable.is() )
475 Reference< XMergeableCell > xCell(
mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
477 return xCell->getRowSpan();
487 if(
mxImpl->mxTable.is() )
489 Reference< XMergeableCell > xCell(
mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
491 return xCell->getColumnSpan();
499 Reference< XAccessibleTable > xRet;
514 Reference< XAccessibleTable > xRet;
530 ::std::vector<bool> aSelected( nRow,
true );
532 for( sal_Int32
i = 0;
i < nRow;
i++ )
540 return Sequence< sal_Int32 >();
546 Sequence < sal_Int32 > aRet(
nCount );
547 sal_Int32 *pRet = aRet.getArray();
549 size_t nSize = aSelected.size();
566 ::std::vector<bool> aSelected( nColumn,
true );
567 sal_Int32
nCount = nColumn;
568 for( sal_Int32
i = 0;
i < nColumn;
i++ )
576 return Sequence< sal_Int32 >();
582 Sequence < sal_Int32 > aRet(
nCount );
583 sal_Int32 *pRet = aRet.getArray();
585 size_t nSize = aSelected.size();
630 sal_Int32 nChildIndex = 0;
631 if(
mxImpl->mxTable.is() )
632 nChildIndex =
mxImpl->mxTable->getColumnCount() * nRow + nColumn;
640 Reference< XAccessible > xRet;
647 Reference< XAccessible > xRet;
662 if( (aFirstPos.
mnRow <= nRow) && (aFirstPos.
mnCol <= nColumn) && (nRow <= aLastPos.
mnRow) && (nColumn <= aLastPos.
mnCol) )
674 return mxImpl->mxTable.is() ? (
static_cast<sal_Int64
>(nRow) *
static_cast<sal_Int64
>(
mxImpl->mxTable->getColumnCount()) + nColumn) : 0;
681 sal_Int32 nColumn = 0, nRow = 0;
682 mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
690 sal_Int32 nColumn = 0, nRow = 0;
691 mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
710 CellPos aFirstPos( aPos ), aLastPos( aPos );
715 aFirstPos.mnRow = std::min( aFirstPos.mnRow, aPos.
mnRow );
716 aFirstPos.mnCol = std::min( aFirstPos.mnCol, aPos.
mnCol );
729 throw IndexOutOfBoundsException();
769 const sal_Int32 nSelectedColumns = std::max( sal_Int32(0), aLastPos.
mnCol - aFirstPos.
mnCol ) + 1;
770 const sal_Int32 nSelectedRows = std::max( sal_Int32(0), aLastPos.
mnRow - aFirstPos.
mnRow ) + 1;
771 return static_cast<sal_Int64
>(nSelectedRows) *
static_cast<sal_Int64
>(nSelectedColumns);
782 if( nSelectedChildIndex < 0 )
783 throw IndexOutOfBoundsException();
787 if( nChildIndex < 0 )
788 throw IndexOutOfBoundsException();
792 throw IndexOutOfBoundsException();
864 sal_Int64 nSelectedChildIndex )
const
868 if( nSelectedChildIndex >= nChildren )
872 while(
n < nChildren )
876 if( 0 == nSelectedChildIndex )
879 --nSelectedChildIndex;
884 return n < nChildren ?
n : -1;
888 mxImpl->getColumnAndRow(nChildIndex, rnColumn, rnRow);
900 Reference< XCell > xCell(rEvent.Source, UNO_QUERY);
908 sal_Int64
nIndex = xAccCell->getAccessibleIndexInParent(),
913 xAccCell->SetState(AccessibleStateType::SELECTED);
914 xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED,
Any(),
Any(), -1);
918 xAccCell->SetState(AccessibleStateType::SELECTED);
919 xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,
Any(),
Any(), -1);
923 xAccCell->ResetState(AccessibleStateType::SELECTED);
924 xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,
Any(),
Any(), -1);
948 pAccCell = xAccCell.get();
950 catch ( IndexOutOfBoundsException& ) {}
960 if( aState == AccessibleStateType::FOCUSED )
963 if( pActiveAccessibleCell !=
nullptr )
964 return pActiveAccessibleCell->
SetState(aState);
973 if( aState == AccessibleStateType::FOCUSED )
976 if( pActiveAccessibleCell !=
nullptr )
977 return pActiveAccessibleCell->
ResetState(aState);
995 if( (nCol >= 0) && (nRow >= 0) &&
mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) )
998 throw IndexOutOfBoundsException();
1026 return mpTable->getAccessibleChild(
i );
1031 Reference< XAccessible > XParent;
1042 return mpTable->getAccessibleRole();
1047 return mpTable->getAccessibleDescription();
1052 return mpTable->getAccessibleName();
1057 return mpTable->getAccessibleStateSet();
1062 return mpTable->getAccessibleRelationSet();
1073 return mpTable->containsPoint( aPoint );
1078 return mpTable->getAccessibleAtPoint( aPoint );
1088 return mpTable->getLocation();
1093 return mpTable->getLocationOnScreen();
1103 return mpTable->getForeground();
1108 return mpTable->getBackground();
1123 return !
mbRow ? 1 :
mpTable->getAccessibleColumnCount();
1128 return mpTable->getAccessibleRowDescription( nRow );
1133 return mpTable->getAccessibleColumnDescription( nColumn );
1138 return mpTable->getAccessibleRowExtentAt( nRow, nColumn );
1143 return mpTable->getAccessibleColumnExtentAt( nRow, nColumn );
1148 Reference< XAccessibleTable > xRet;
1154 Reference< XAccessibleTable > xRet;
1161 ::std::vector<bool> aSelected( nRow,
true );
1163 for( sal_Int32
i = 0;
i < nRow;
i++ )
1171 return Sequence< sal_Int32 >();
1177 Sequence < sal_Int32 > aRet(
nCount );
1178 sal_Int32 *pRet = aRet.getArray();
1180 size_t nSize = aSelected.size();
1196 ::std::vector<bool> aSelected( nColumn,
true );
1197 sal_Int32
nCount = nColumn;
1198 for( sal_Int32
i = 0;
i < nColumn;
i++ )
1206 return Sequence< sal_Int32 >();
1212 Sequence < sal_Int32 > aRet(
nCount );
1213 sal_Int32 *pRet = aRet.getArray();
1215 size_t nSize = aSelected.size();
1230 return mpTable->isAccessibleRowSelected( nRow );
1235 return mpTable->isAccessibleColumnSelected( nColumn );
1240 return mpTable->getAccessibleCellAt( nRow, nColumn );
1245 return mpTable->getAccessibleCaption();
1250 return mpTable->getAccessibleSummary();
1255 return mpTable->isAccessibleSelected( nRow, nColumn );
1260 return mpTable->getAccessibleIndex( nRow, nColumn );
1265 return mpTable->getAccessibleRow( nChildIndex );
1270 return mpTable->getAccessibleColumn( nChildIndex );
1277 return mpTable->selectRow( row );
1280 mpTable->clearAccessibleSelection();
1290 return mpTable->selectColumn( column );
1293 mpTable->clearAccessibleSelection();
1294 sal_Int64
nIndex =
mpTable->getAccessibleIndex( 0, column );
1303 return mpTable->unselectRow( row );
1315 return mpTable->unselectColumn( column );
1318 sal_Int64
nIndex =
mpTable->getAccessibleIndex( 0, column );
const rtl::Reference< sdr::SelectionController > & getSelectionController() const
virtual bool SetState(sal_Int64 aState) override
virtual bool ResetState(sal_Int64 aState) override
virtual bool SetState(sal_Int64 aState)
virtual bool ResetState(sal_Int64 aState)
@descr This class is a container for the information specific for a single shape that is passed to th...
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
virtual bool ResetState(sal_Int64 aState) override
Reset the specified state.
virtual void SAL_CALL disposing() override
This method is called from the component helper base class while disposing.
virtual bool SetState(sal_Int64 aState) override
Set the specified state.
virtual void SAL_CALL disposing(const EventObject &Source) override
AccessibleShapeTreeInfo & mrShapeTreeInfo
virtual void SAL_CALL modified(const EventObject &aEvent) override
AccessibleTableShapeImpl(AccessibleShapeTreeInfo &rShapeTreeInfo)
void init(const Reference< XAccessible > &xAccessible, const Reference< XTable > &xTable)
rtl::Reference< AccessibleCell > getAccessibleCell(const Reference< XCell > &xCell)
Reference< XAccessible > mxAccessible
AccessibleCellMap maChildMap
Reference< XAccessible > getAccessibleChild(sal_Int64 i)
Reference< XTable > mxTable
void getColumnAndRow(sal_Int64 nChildIndex, sal_Int32 &rnColumn, sal_Int32 &rnRow)
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
virtual bool ResetState(sal_Int64 aState) override
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
AccessibleCell * GetActiveAccessibleCell()
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int64 nChildIndex) override
rtl::Reference< AccessibleTableShapeImpl > mxImpl
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
sdr::table::SvxTableController * getTableController()
sal_Int32 mnPreviousSelectionCount
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual void SAL_CALL clearAccessibleSelection() override
virtual OUString CreateAccessibleBaseName() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual sal_Int64 SAL_CALL getAccessibleIndex(sal_Int32 nRow, sal_Int32 nColumn) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary() override
virtual bool SetState(sal_Int64 aState) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
virtual sal_Int32 SAL_CALL getAccessibleRow(sal_Int64 nChildIndex) override
void getColumnAndRow(sal_Int64 nChildIndex, sal_Int32 &rnColumn, sal_Int32 &rnRow)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption() override
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &rEvent) override
friend class AccessibleTableHeaderShape
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
AccessibleTableShape(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo)
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
virtual sal_Bool SAL_CALL selectColumn(sal_Int32 column) override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
void checkCellPosition(sal_Int32 nCol, sal_Int32 nRow)
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual void SAL_CALL disposing() override
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
virtual void SAL_CALL release() noexcept override
virtual OUString SAL_CALL getImplementationName() override
sal_Int64 GetIndexOfSelectedChild(sal_Int64 nSelectedChildIndex) const
virtual sal_Int32 SAL_CALL getAccessibleColumnCount() override
virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nChildIndex) override
bool SetStateDirectly(sal_Int64 aState)
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual ~AccessibleTableShape() override
virtual sal_Int32 SAL_CALL getAccessibleRowCount() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual sal_Bool SAL_CALL unselectColumn(sal_Int32 column) override
virtual void SAL_CALL acquire() noexcept override
virtual void Init() override
bool ResetStateDirectly(sal_Int64 aState)
void getActiveCellPos(sdr::table::CellPos &rPos) const
const sdr::table::CellRef & getActiveCell() const
The active table has the focus or is currently edited.
bool deselectColumn(sal_Int32 column)
void getSelectedCells(CellPos &rFirstPos, CellPos &rLastPos) override
bool isColumnSelected(sal_Int32 nColumn)
sdr::table::SdrTableObj * GetTableObj()
bool deselectRow(sal_Int32 row)
bool selectColumn(sal_Int32 column)
virtual SVX_DLLPRIVATE bool hasSelectedCells() const override
This is a table object, and one or more of its cells are selected.
void setSelectedCells(const CellPos &rFirstPos, const CellPos &rLastPos)
bool isRowSelected(sal_Int32 nRow)
bool selectRow(sal_Int32 row)
#define TOOLS_WARN_EXCEPTION(area, stream)
::cppu::ImplInheritanceHelper< AccessibleShape, css::accessibility::XAccessibleTable, css::view::XSelectionChangeListener > AccessibleTableShape_Base
std::unordered_map< Reference< XCell >, rtl::Reference< AccessibleCell > > AccessibleCellMap
uno::Reference< drawing::XShape > const mxShape