summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-11-17 21:55:01 -0500
committerKohei Yoshida <libreoffice@kohei.us>2016-11-18 13:53:36 +0000
commit0bc023d55afcf373a3b6644545ce4bae1bb5ca47 (patch)
tree7d8c23f67a7a166e08f96247d2176d24cdd20f63
parent7295ca03ece7b850b669fb275ebf78c3db3ac25f (diff)
fdo#71409: Prevent the a11y code from creating an edit view instance.
GetEditView() now creates one if one does not exist. Clearly that's not the behavior the original a11y code was expecting. This at least removes the duplicated focus events with F2 press on sheet cell, though I still see a fair amount of duplicated events firing in other places... Change-Id: Ib5310ce5c67ab862b3a8a7a6c912d164475d62fa Reviewed-on: https://gerrit.libreoffice.org/30946 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx14
-rw-r--r--sc/source/ui/app/inputwin.cxx10
-rw-r--r--sc/source/ui/inc/inputwin.hxx5
3 files changed, 22 insertions, 7 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index d8387a755ec0..63ca5b087b66 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1040,7 +1040,7 @@ ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData()
delete mpEditEngine;
mpEditEngine = nullptr; // don't access in ScAccessibleEditObjectTextData dtor!
}
- else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine())
+ else if (pTxtWnd && pTxtWnd->HasEditView() && pTxtWnd->GetEditView()->GetEditEngine())
{
// the NotifyHdl also has to be removed from the ScTextWnd's EditEngine
// (it's set in ScAccessibleEditLineTextData::GetTextForwarder, and mpEditEngine
@@ -1074,9 +1074,10 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder()
if (pTxtWnd)
{
- mpEditView = pTxtWnd->GetEditView();
- if (mpEditView)
+ if (pTxtWnd->HasEditView())
{
+ mpEditView = pTxtWnd->GetEditView();
+
if (mbEditEngineCreated && mpEditEngine)
ResetEditMode();
mbEditEngineCreated = false;
@@ -1087,6 +1088,8 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder()
}
else
{
+ mpEditView = nullptr;
+
if (mpEditEngine && !mbEditEngineCreated)
ResetEditMode();
if (!mpEditEngine)
@@ -1120,8 +1123,7 @@ SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( bool b
if (pTxtWnd)
{
- mpEditView = pTxtWnd->GetEditView();
- if (!mpEditView && bCreate)
+ if (!pTxtWnd->HasEditView() && bCreate)
{
if ( !pTxtWnd->IsInputActive() )
{
@@ -1142,7 +1144,7 @@ void ScAccessibleEditLineTextData::ResetEditMode()
if (mbEditEngineCreated && mpEditEngine)
delete mpEditEngine;
- else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine())
+ else if (pTxtWnd && pTxtWnd->HasEditView() && pTxtWnd->GetEditView()->GetEditEngine())
pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link<EENotify&,void>());
mpEditEngine = nullptr;
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 024df03a0ad2..d290deb6357c 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -878,6 +878,11 @@ EditView* ScInputBarGroup::GetEditView()
return maTextWnd->GetEditView();
}
+bool ScInputBarGroup::HasEditView() const
+{
+ return maTextWnd->HasEditView();
+}
+
bool ScInputBarGroup::IsInputActive()
{
return maTextWnd->IsInputActive();
@@ -1012,6 +1017,11 @@ EditView* ScTextWnd::GetEditView()
return mpEditView.get();
}
+bool ScTextWnd::HasEditView() const
+{
+ return mpEditView.get() != nullptr;
+}
+
long ScTextWnd::GetPixelHeightForLines(long nLines)
{
// add padding ( for the borders of the window )
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index ba9f0a108b86..4b7ec0c8a0c6 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -53,6 +53,7 @@ public:
virtual void StartEditEngine() = 0;
virtual void StopEditEngine( bool bAll ) = 0;
virtual EditView* GetEditView() = 0;
+ virtual bool HasEditView() const = 0;
virtual void MakeDialogEditView() = 0;
virtual void SetFormulaMode( bool bSet ) = 0;
virtual bool IsInputActive() = 0;
@@ -71,6 +72,7 @@ public:
bool IsInputActive() override;
virtual EditView* GetEditView() override;
+ virtual bool HasEditView() const override;
// for function autopilots
virtual void MakeDialogEditView() override;
@@ -192,7 +194,8 @@ public:
virtual void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) override;
void SetTextString( const OUString& rString ) override;
void StartEditEngine() override;
- EditView* GetEditView() override;
+ virtual EditView* GetEditView() override;
+ virtual bool HasEditView() const override;
virtual void Resize() override;
virtual const OUString& GetTextString() const override;
virtual void StopEditEngine( bool bAll ) override;