[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 10 19:45:32 UTC 2020


 sd/source/ui/slidesorter/controller/SlsFocusManager.cxx      |    8 ++++--
 sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx |   13 ++++-------
 sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx  |    4 +--
 3 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 50d9dbedc475069e1bb0b2788f814b8103c165c3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Feb 10 16:46:22 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Feb 10 20:44:59 2020 +0100

    tdf#129346 only select first page fallback if seting to current page failed
    
    Change-Id: Iee4f9cef9659837e9ce131e3bfc8da3e8d87bf84
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88406
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index 66f6b65574f7..0169bff7fbdc 100644
--- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -141,13 +141,15 @@ model::SharedPageDescriptor FocusManager::GetFocusedPageDescriptor() const
     return mrSlideSorter.GetModel().GetPageDescriptor(mnPageIndex);
 }
 
-void FocusManager::SetFocusedPage (const model::SharedPageDescriptor& rpDescriptor)
+bool FocusManager::SetFocusedPage (const model::SharedPageDescriptor& rpDescriptor)
 {
     if (rpDescriptor.get() != nullptr)
     {
         FocusHider aFocusHider (*this);
         mnPageIndex = (rpDescriptor->GetPage()->GetPageNum()-1)/2;
+        return true;
     }
+    return false;
 }
 
 void FocusManager::SetFocusedPage (sal_Int32 nPageIndex)
@@ -156,9 +158,9 @@ void FocusManager::SetFocusedPage (sal_Int32 nPageIndex)
     mnPageIndex = nPageIndex;
 }
 
-void FocusManager::SetFocusedPageToCurrentPage()
+bool FocusManager::SetFocusedPageToCurrentPage()
 {
-    SetFocusedPage(mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+    return SetFocusedPage(mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
 }
 
 bool FocusManager::IsFocusShowing() const
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
index 84c055106b2f..381933c234a5 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
@@ -121,16 +121,13 @@ void SelectionObserver::EndObservation()
         }
         maInsertedPages.clear();
     }
-    else
-    {
-        // tdf#129346 nothing currently selected, select something, if possible
-        if (rSelector.GetPageCount())
-            rSelector.SelectPage(0);
-    }
 
     aUpdateLock.Release();
-    mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage();
-
+    bool bSuccess = mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage();
+    // tdf#129346 nothing currently selected, select something, if possible
+    // but (tdf#129346) only if setting focus to current page failed
+    if (!bSuccess && rSelector.GetPageCount())
+        rSelector.SelectPage(0);
 }
 
 } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
index 6a8dec636a7c..0455206ebfcc 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
@@ -115,7 +115,7 @@ public:
             One of the page descriptors that are currently managed by the
             SlideSorterModel.
     */
-    void SetFocusedPage (const model::SharedPageDescriptor& rDescriptor);
+    bool SetFocusedPage (const model::SharedPageDescriptor& rDescriptor);
 
     /** Set the focused page to the one described by the given page
         index.  The visibility of the focus indicator is not modified.
@@ -124,7 +124,7 @@ public:
     */
     void SetFocusedPage (sal_Int32 nPageIndex);
 
-    void SetFocusedPageToCurrentPage();
+    bool SetFocusedPageToCurrentPage();
 
     /** Return <TRUE/> when the focus indicator is currently shown.  A
         prerequisite is that the window managed by this focus manager has


More information about the Libreoffice-commits mailing list