summaryrefslogtreecommitdiffstats
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-10 16:46:22 +0000
committerMichael Stahl <michael.stahl@cib.de>2020-02-11 11:02:54 +0100
commitf12e4ecd595625f67865887824643c6608688ccc (patch)
tree76e0cd42ee5a7edc5839c0eb477bb07c3db01ca5 /sd
parenttdf#130148 Gallery drop-down list in Impress B&N dialog shows only start... (diff)
downloadcore-f12e4ecd595625f67865887824643c6608688ccc.tar.gz
core-f12e4ecd595625f67865887824643c6608688ccc.zip
tdf#130440 only select first page fallback if seting to current page failed
Change-Id: Iee4f9cef9659837e9ce131e3bfc8da3e8d87bf84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88389 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/slidesorter/controller/SlsFocusManager.cxx8
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx13
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx4
3 files changed, 12 insertions, 13 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index ba8273d7628a..b8d400c2bea2 100644
--- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -143,13 +143,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)
@@ -158,9 +160,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 29bc46c71789..e146ee0a960c 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
@@ -125,16 +125,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 0269690f1451..7d5b96afde86 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 inidcator is currently shown. A
prerequisite is that the window managed by this focus manager has