diff options
-rw-r--r-- | svx/source/accessibility/AccessibleTextHelper.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/accessiblecell.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/accessibletableshape.cxx | 34 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 10 | ||||
-rw-r--r-- | svx/source/table/cell.hxx | 1 |
5 files changed, 48 insertions, 1 deletions
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 03570b0fdf38..f8a724a69cf3 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -502,7 +502,7 @@ namespace accessibility { sdr::table::CellRef xCell = pAccessibleCell->getCellRef(); if ( xCell.is() ) - return xCell->IsTextEditActive(); + return xCell->IsActiveCell(); } } if( pViewForwarder->IsValid() ) diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index af68170477a2..8059d978093c 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -85,6 +85,8 @@ void AccessibleCell::Init() // non-empty text -> use full-fledged edit source right away mpText = new AccessibleTextHelper( o3tl::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow) ); + if( mxCell.is() && mxCell.get()->IsActiveCell() ) + mpText->SetFocus(); mpText->SetEventSource(this); } diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 66b01f0a8e92..1c7676598885 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -85,6 +85,7 @@ public: sal_Int32 mRowCount, mColCount; //get the cached AccessibleCell from XCell Reference< AccessibleCell > getAccessibleCell (Reference< XCell > xCell); + Reference< AccessibleCell > getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn) throw (IndexOutOfBoundsException, RuntimeException); }; @@ -150,6 +151,27 @@ Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (Referen return Reference< AccessibleCell >(); } +Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn) + throw (IndexOutOfBoundsException, RuntimeException) +{ + Reference< XCell > xCell( mxTable->getCellByPosition( nColumn, nRow ) ); + Reference< AccessibleCell > xChild = getAccessibleCell( xCell ); + + if( !xChild.is() && mxTable.is() ) + { + sal_Int32 nChildIndex = mxTable->getColumnCount() * nRow + nColumn; + CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) ); + + rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) ); + + xAccessibleCell->Init(); + maChildMap[xCell] = xAccessibleCell; + + xChild = Reference< AccessibleCell >( xAccessibleCell.get() ); + } + return xChild; +} + Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild(sal_Int32 nChildIndex) throw (IndexOutOfBoundsException, RuntimeException) @@ -979,6 +1001,18 @@ AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell() if (xAccCell.is()) pAccCell = xAccCell.get(); } + else + { + try + { + CellPos rPos; + pTableObj->getActiveCellPos( rPos ); + xAccCell = mxImpl->getAccessibleCell( rPos.mnRow, rPos.mnCol ); + if ( xAccCell.is() ) + pAccCell = xAccCell.get(); + } + catch ( IndexOutOfBoundsException& ) {} + } } } } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index b2d1604a0bdc..1946a8179bfb 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -565,6 +565,16 @@ void Cell::notifyModified() // SdrTextShape proxy +bool Cell::IsActiveCell() +{ + bool isActive = false; + SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() ); + if( rTableObj.getActiveCell().get() == this ) + isActive = true; + + return isActive; +} + bool Cell::IsTextEditActive() { bool isActive = false; diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx index e2a28a0467f3..38ebe42ad80f 100644 --- a/svx/source/table/cell.hxx +++ b/svx/source/table/cell.hxx @@ -64,6 +64,7 @@ public: SVX_DLLPRIVATE void dispose(); // SdrTextShape proxy + bool IsActiveCell(); bool IsTextEditActive(); SVX_DLLPRIVATE bool hasText() const; |