summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-01-16 08:12:47 +0300
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2016-02-08 15:32:54 +0000
commit1fda8bf08123b521d9ad77eb542d7d1a3c63f54a (patch)
tree30acd893a7f1730f27479d0e959718c858d5e785 /svx
parent255ac8fc28ef9717be69363927bd071c9a90d75d (diff)
tdf#96685 - set focus of accessible table cells
Newly created accessible cells were not inheriting the focus setting of their peer. Also, IsTextEditActive was way too strict to determine whether a table cell was active or not. Typed text with the cursor in the cell was not enough to mark the cell as active for example. Finally, accessible nodes were not being created as additional cells gained focus for the first time. Change-Id: I5be4b1d660f01fc4de7281a319895a2c73e74c48 Reviewed-on: https://gerrit.libreoffice.org/21121 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx2
-rw-r--r--svx/source/table/accessiblecell.cxx2
-rw-r--r--svx/source/table/accessibletableshape.cxx34
-rw-r--r--svx/source/table/cell.cxx10
-rw-r--r--svx/source/table/cell.hxx1
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;