Kaydet (Commit) d6dc60ab authored tarafından Vincent Povirk's avatar Vincent Povirk Kaydeden (comit) Cédric Bosdonnat

sw: Fix cursor accessibility API (fdo#43390)

üst 9351f4c1
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <viewsh.hxx> #include <viewsh.hxx>
#include <crsrsh.hxx> #include <crsrsh.hxx>
#include <fesh.hxx> #include <fesh.hxx>
#include <wrtsh.hxx>
#include <txtfrm.hxx> #include <txtfrm.hxx>
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <pagefrm.hxx> #include <pagefrm.hxx>
...@@ -1359,6 +1360,10 @@ sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj, ...@@ -1359,6 +1360,10 @@ sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj,
if( pFEShell ) if( pFEShell )
pFEShell->FinishOLEObj(); pFEShell->FinishOLEObj();
SwWrtShell* pWrtShell = pCrsrShell->ISA( SwWrtShell )
? static_cast<SwWrtShell*>( pCrsrShell )
: 0;
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
if( pObj ) if( pObj )
{ {
...@@ -1383,7 +1388,17 @@ sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj, ...@@ -1383,7 +1388,17 @@ sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj,
bCallShowCrsr = sal_True; bCallShowCrsr = sal_True;
} }
pCrsrShell->KillPams(); pCrsrShell->KillPams();
if( pWrtShell && pPaM->HasMark() )
// We have to do this or SwWrtShell can't figure out that it needs
// to kill the selection later, when the user moves the cursor.
pWrtShell->SttSelect();
pCrsrShell->SetSelection( *pPaM ); pCrsrShell->SetSelection( *pPaM );
if( pPaM->HasMark() && *pPaM->GetPoint() == *pPaM->GetMark())
// Setting a "Selection" that starts and ends at the same spot
// should remove the selection rather than create an empty one, so
// that we get defined behavior if accessibility sets the cursor
// later.
pCrsrShell->ClearMark();
if( bCallShowCrsr ) if( bCallShowCrsr )
pCrsrShell->ShowCrsr(); pCrsrShell->ShowCrsr();
bRet = sal_True; bRet = sal_True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment