diff options
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutDialog.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutDialog.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeListBase.hxx | 3 |
4 files changed, 29 insertions, 0 deletions
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); |