Resolves: tdf#128313 disambiguate flow-to search results
for a11y between find/replace where our result is a single thing, and find-all/replace-all where the result is potentially many things, which allows that searching in a selected calc column will flow-to the current cell, not the entire ~infinite set of cells in the column Change-Id: Ib3e56fceb90d869f157427f090cdffe986a5a588 Reviewed-on: https://gerrit.libreoffice.org/81396 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
enum AccessibilityFlowTo : sal_Int32
|
||||
{
|
||||
FORSPELLCHECKFLOWTO = 1,
|
||||
FORFINDREPLACEFLOWTO = 2
|
||||
FORFINDREPLACEFLOWTO_ITEM = 2,
|
||||
FORFINDREPLACEFLOWTO_RANGE = 3
|
||||
};
|
||||
|
||||
#endif // INCLUDED_COMPHELPER_ACCFLOWENUM_HXX
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <sfx2/basedlgs.hxx>
|
||||
#include <svl/poolitem.hxx>
|
||||
#include <svl/srchdefs.hxx>
|
||||
#include <svl/srchitem.hxx>
|
||||
#include <svx/svxdllapi.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -125,7 +126,7 @@ public:
|
||||
|
||||
TransliterationFlags GetTransliterationFlags() const;
|
||||
|
||||
void SetDocWin(vcl::Window* pDocWin);
|
||||
void SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand);
|
||||
void SetSrchFlag( bool bSuccess ) { mbSuccess = bSuccess; }
|
||||
bool GetSrchFlag() const { return mbSuccess; }
|
||||
void SetSaveToModule(bool b);
|
||||
|
||||
@@ -2352,18 +2352,22 @@ css::uno::Sequence< css::uno::Any >
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO)
|
||||
else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
|
||||
{
|
||||
bool bSuccess(false);
|
||||
rAny >>= bSuccess;
|
||||
if ( bSuccess )
|
||||
{
|
||||
uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
|
||||
if ( aSeq.hasElements() )
|
||||
if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
|
||||
{
|
||||
return aSeq;
|
||||
uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
|
||||
if ( aSeq.hasElements() )
|
||||
{
|
||||
return aSeq;
|
||||
}
|
||||
}
|
||||
else if( mpAccessibleSpreadsheet.is() )
|
||||
|
||||
if( mpAccessibleSpreadsheet.is() )
|
||||
{
|
||||
uno::Reference < XAccessible > xFindCellAcc = mpAccessibleSpreadsheet->GetActiveCell();
|
||||
// add xFindCellAcc to the return the Sequence
|
||||
|
||||
@@ -244,7 +244,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
|
||||
vcl::Window* pWin = pTabView->GetActiveWin();
|
||||
if( pWin )
|
||||
{
|
||||
pSearchDlg->SetDocWin( pWin );
|
||||
pSearchDlg->SetDocWin( pWin, pSearchItem->GetCommand() );
|
||||
pSearchDlg->SetSrchFlag( bSuccess );
|
||||
}
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
|
||||
vcl::Window* pWin = pTabView->GetActiveWin();
|
||||
if( pWin )
|
||||
{
|
||||
pSearchDlg->SetDocWin( pWin );
|
||||
pSearchDlg->SetDocWin( pWin, aSearchItem.GetCommand() );
|
||||
pSearchDlg->SetSrchFlag(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -784,7 +784,7 @@ css::uno::Sequence< css::uno::Any >
|
||||
goto Rt;
|
||||
}
|
||||
}
|
||||
else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO)
|
||||
else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
|
||||
{
|
||||
sal_Int32 nChildCount = getSelectedAccessibleChildCount();
|
||||
if ( nChildCount )
|
||||
|
||||
@@ -491,7 +491,7 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
|
||||
{
|
||||
SvxSearchDialog* pSearchDlg =
|
||||
static_cast<SvxSearchDialog*>(pChildWin->GetController().get());
|
||||
pSearchDlg->SetDocWin( pViewShell->GetActiveWindow() );
|
||||
pSearchDlg->SetDocWin( pViewShell->GetActiveWindow(), nCommand );
|
||||
pSearchDlg->SetSrchFlag(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2287,7 +2287,7 @@ void SvxSearchDialog::SaveToModule_Impl()
|
||||
rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs );
|
||||
}
|
||||
|
||||
void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
|
||||
void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand)
|
||||
{
|
||||
m_xDialog->clear_extra_accessible_relations();
|
||||
|
||||
@@ -2305,7 +2305,25 @@ void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
|
||||
return;
|
||||
}
|
||||
|
||||
uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()), AccessibilityFlowTo::FORFINDREPLACEFLOWTO);
|
||||
/* tdf#128313 FlowTo tries to set an a11y relation between the search dialog
|
||||
and its results. But for "find/replace" within a calc column we don't
|
||||
want to return the entire column as the result, we want the current cell.
|
||||
|
||||
But with search/all we do want the new multi-cellselection as the result.
|
||||
*/
|
||||
AccessibilityFlowTo eFlowTo(AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM);
|
||||
switch (eCommand)
|
||||
{
|
||||
case SvxSearchCmd::FIND:
|
||||
case SvxSearchCmd::REPLACE:
|
||||
eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM;
|
||||
break;
|
||||
case SvxSearchCmd::FIND_ALL:
|
||||
case SvxSearchCmd::REPLACE_ALL:
|
||||
eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE;
|
||||
break;
|
||||
}
|
||||
uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()), eFlowTo);
|
||||
|
||||
sal_Int32 nLen = aAnySeq.getLength();
|
||||
if (nLen)
|
||||
|
||||
@@ -734,7 +734,7 @@ css::uno::Sequence< css::uno::Any >
|
||||
return uno::Sequence< uno::Any >();
|
||||
}
|
||||
|
||||
if ( nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO )
|
||||
if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO)
|
||||
{
|
||||
uno::Reference< css::drawing::XShape > xShape;
|
||||
rAny >>= xShape;
|
||||
@@ -788,7 +788,7 @@ css::uno::Sequence< css::uno::Any >
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO )
|
||||
else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE)
|
||||
{
|
||||
SwCursorShell* pCursorShell = GetCursorShell();
|
||||
if ( pCursorShell )
|
||||
|
||||
@@ -236,7 +236,8 @@ void SwView::ExecSearch(SfxRequest& rReq)
|
||||
s_pSrchItem = static_cast<SvxSearchItem*>( pArgs->Get(SID_SEARCH_ITEM).Clone() );
|
||||
}
|
||||
}
|
||||
switch (s_pSrchItem->GetCommand())
|
||||
SvxSearchCmd eCommand = s_pSrchItem->GetCommand();
|
||||
switch (eCommand)
|
||||
{
|
||||
case SvxSearchCmd::FIND:
|
||||
{
|
||||
@@ -253,7 +254,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
|
||||
pSrchDlg = GetSearchDialog();
|
||||
if (pSrchDlg)
|
||||
{
|
||||
pSrchDlg->SetDocWin(m_pEditWin);
|
||||
pSrchDlg->SetDocWin(m_pEditWin, eCommand);
|
||||
pSrchDlg->SetSrchFlag(false);
|
||||
}
|
||||
}
|
||||
@@ -286,7 +287,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
|
||||
pSrchDlg = GetSearchDialog();
|
||||
if (pSrchDlg)
|
||||
{
|
||||
pSrchDlg->SetDocWin(m_pEditWin);
|
||||
pSrchDlg->SetDocWin(m_pEditWin, eCommand);
|
||||
pSrchDlg->SetSrchFlag(false);
|
||||
}
|
||||
}
|
||||
@@ -344,7 +345,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
|
||||
pSrchDlg = GetSearchDialog();
|
||||
if (pSrchDlg)
|
||||
{
|
||||
pSrchDlg->SetDocWin(m_pEditWin);
|
||||
pSrchDlg->SetDocWin(m_pEditWin, eCommand);
|
||||
pSrchDlg->SetSrchFlag(false);
|
||||
}
|
||||
}
|
||||
@@ -412,7 +413,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
|
||||
pSrchDlg = GetSearchDialog();
|
||||
if (pSrchDlg)
|
||||
{
|
||||
pSrchDlg->SetDocWin(m_pEditWin);
|
||||
pSrchDlg->SetDocWin(m_pEditWin, eCommand);
|
||||
pSrchDlg->SetSrchFlag(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user