sc/source/ui/dbgui/PivotLayoutDialog.cxx | 2 ++ sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 22 ++++++++++++++++++++++ sc/source/ui/inc/PivotLayoutDialog.hxx | 2 ++ sc/source/ui/inc/PivotLayoutTreeListBase.hxx | 3 +++ 4 files changed, 29 insertions(+)
New commits: commit 489fb7f5e2297b9451f7084bcb5cf9da823adc26 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jun 6 12:17:59 2018 +0100 tdf#116552 restore copy on focus and jump focus to source This is surely an utter abuse of focus and an a11y disaster, but it used to work this way. Change-Id: I265a2bafbc2cdd17ff4a5b7c2805def63c510d5c Reviewed-on: https://gerrit.libreoffice.org/55374 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 129969c926f3..70f436c0396e 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -71,6 +71,7 @@ ScPivotLayoutDialog::ScPivotLayoutDialog( ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable) : ScAnyRefDlg (pSfxBindings, pChildWindow, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"), maPivotTableObject (*pPivotTableObject), + mpPreviouslyFocusedListBox(nullptr), mpViewData (pViewData), mpDocument (pViewData->GetDocument()), mbNewPivotTable (bNewPivotTable), @@ -188,6 +189,7 @@ ScPivotLayoutDialog::~ScPivotLayoutDialog() void ScPivotLayoutDialog::dispose() { + mpPreviouslyFocusedListBox.clear(); mpListBoxField.clear(); mpListBoxPage.clear(); mpListBoxColumn.clear(); diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx index f1b02c8fef0e..85c8db0ce17a 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -114,4 +114,26 @@ void ScPivotLayoutTreeListBase::RemoveEntryForItem(const ScItemValue* pItemValue } } +void ScPivotLayoutTreeListBase::GetFocus() +{ + SvTreeListBox::GetFocus(); + + if (!mpParent || !mpParent->mpPreviouslyFocusedListBox) + return; + + if (GetGetFocusFlags() & GetFocusFlags::Mnemonic) + { + SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry(); + if (pEntry) + InsertEntryForSourceTarget(pEntry, nullptr); + mpParent->mpPreviouslyFocusedListBox->GrabFocus(); + } +} + +void ScPivotLayoutTreeListBase::LoseFocus() +{ + SvTreeListBox::LoseFocus(); + if (mpParent) + mpParent->mpPreviouslyFocusedListBox = this; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx index 25f12db90e5d..96d6218adb3d 100644 --- a/sc/source/ui/inc/PivotLayoutDialog.hxx +++ b/sc/source/ui/inc/PivotLayoutDialog.hxx @@ -42,6 +42,8 @@ class ScPivotLayoutDialog : public ScAnyRefDlg public: ScDPObject maPivotTableObject; + VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox; + private: ScViewData* mpViewData; ScDocument* mpDocument; diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx index c3361a888d46..25ebec3f33bb 100644 --- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx @@ -53,6 +53,9 @@ public: SvTreeListEntry* pEntry) override; virtual void DragFinished(sal_Int8 nDropAction) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + void PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector); void RemoveEntryForItem(const ScItemValue* pItemValue); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits