[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source

Caolán McNamara caolanm at redhat.com
Fri Jan 27 16:34:54 UTC 2017


 sc/source/ui/dbgui/PivotLayoutDialog.cxx        |   17 +++++++++++++----
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |   23 -----------------------
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx |    7 ++++---
 sc/source/ui/inc/PivotLayoutDialog.hxx          |    5 ++---
 sc/source/ui/inc/PivotLayoutTreeListBase.hxx    |    3 ---
 5 files changed, 19 insertions(+), 36 deletions(-)

New commits:
commit 839d9fa764921258abd48336142a1383f95f5808
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 26 09:12:24 2017 +0000

    Resolves: tdf#104153 crash on drag and drop pivot table field
    
    This is a combination of 2 commits.
    
    Resolves: tdf#104153 crash on drag and drop pivot table field
    
    now though sometimes it doesn't get removed at all, so a band aid
    for the moment
    
    (cherry picked from commit 068edb65b1dce375223d8642a01b07db3948ac03)
    
    Resolves: tdf#104153 lookup what listbox an entry is dragged from
    
    so we can find where its been dragged from in order to remove it from that
    source, rather than relying that it comes from the previously focused listbox
    
    Reviewed-on: https://gerrit.libreoffice.org/33575
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 011bae55cdd24a1d3e42f0aa2fcfd98d3ddc9b14)
    
    e6aa1a311b46e5e9ee96cab05e0705b794b5eb0b
    
    Change-Id: I6ccbbe51fe9250af0f85c30a9d253269a18df457
    Reviewed-on: https://gerrit.libreoffice.org/33630
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 312fdd3..5503c5e 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -70,8 +70,6 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
                             ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable) :
     ScAnyRefDlg           (pSfxBindings, pChildWindow, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"),
     maPivotTableObject    (*pPivotTableObject),
-    mpPreviouslyFocusedListBox(nullptr),
-    mpCurrentlyFocusedListBox(nullptr),
     mpViewData            (pViewData),
     mpDocument            (pViewData->GetDocument()),
     mbNewPivotTable       (bNewPivotTable),
@@ -189,8 +187,6 @@ ScPivotLayoutDialog::~ScPivotLayoutDialog()
 
 void ScPivotLayoutDialog::dispose()
 {
-    mpPreviouslyFocusedListBox.clear();
-    mpCurrentlyFocusedListBox.clear();
     mpListBoxField.clear();
     mpListBoxPage.clear();
     mpListBoxColumn.clear();
@@ -736,4 +732,17 @@ void ScPivotLayoutDialog::ToggleDestination()
     mpDestinationEdit->Enable(bSelection);
 }
 
+ScPivotLayoutTreeListBase* ScPivotLayoutDialog::FindListBoxFor(SvTreeListEntry *pEntry)
+{
+    if (mpListBoxPage->HasEntry(pEntry))
+        return mpListBoxPage.get();
+    if (mpListBoxColumn->HasEntry(pEntry))
+        return mpListBoxColumn.get();
+    if (mpListBoxRow->HasEntry(pEntry))
+        return mpListBoxRow.get();
+    if (mpListBoxData->HasEntry(pEntry))
+        return mpListBoxData.get();
+    return nullptr;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 7b72f7b..1fd79e9 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -119,27 +119,4 @@ void ScPivotLayoutTreeListBase::RemoveEntryForItem(ScItemValue* pItemValue)
     }
 }
 
-void ScPivotLayoutTreeListBase::GetFocus()
-{
-    SvTreeListBox::GetFocus();
-
-    if( GetGetFocusFlags() & GetFocusFlags::Mnemonic )
-    {
-        SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
-        if (pEntry)
-            InsertEntryForSourceTarget(pEntry, nullptr);
-
-        if (mpParent->mpPreviouslyFocusedListBox != nullptr)
-            mpParent->mpPreviouslyFocusedListBox->GrabFocus();
-    }
-
-    mpParent->mpCurrentlyFocusedListBox = this;
-}
-
-void ScPivotLayoutTreeListBase::LoseFocus()
-{
-    SvTreeListBox::LoseFocus();
-    if (mpParent)
-        mpParent->mpPreviouslyFocusedListBox = this;
-}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 3795601..9073faa 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -57,10 +57,11 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
     }
 }
 
-void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
+void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* /*pTarget*/)
 {
-    if(mpParent->mpPreviouslyFocusedListBox.get() != this)
-        mpParent->mpPreviouslyFocusedListBox->RemoveSelection();
+    ScPivotLayoutTreeListBase *pSourceTree = mpParent->FindListBoxFor(pSource);
+    if (pSourceTree)
+        pSourceTree->RemoveSelection();
 }
 
 bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn)
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index 870cc8b..0c0267c 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -42,9 +42,6 @@ class ScPivotLayoutDialog : public ScAnyRefDlg
 public:
     ScDPObject maPivotTableObject;
 
-    VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox;
-    VclPtr<ScPivotLayoutTreeListBase> mpCurrentlyFocusedListBox;
-
 private:
     ScViewData* mpViewData;
     ScDocument* mpDocument;
@@ -132,6 +129,8 @@ public:
     ScDPLabelData& GetLabelData(SCCOL nColumn);
     ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
     void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
+
+    ScPivotLayoutTreeListBase* FindListBoxFor(SvTreeListEntry *pEntry);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
index e5d9da1..43c8cec 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -53,9 +53,6 @@ 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(ScItemValue* pItemValue);


More information about the Libreoffice-commits mailing list