summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-03 11:06:22 +0100
committerAndras Timar <andras.timar@collabora.com>2016-07-13 21:15:01 +0200
commit6adddbfb6b0fd9e0348546114f9dd2d035c1be3f (patch)
tree761ae0149fb3552c57980fcf7b4fa0c3617c1775 /sfx2
parent1a90ab3feb9cf3c92e9b142778d4c88acbad1f21 (diff)
Resolves: tdf#88396 switching to sidebar panel will toggle it *off*...
if its already visible. This solves tdf#88396, but I did this fix originally for.... on switching to slide layouts panel move into slide layout context i.e. exit current textbox edit and shape selection (cherry picked from commit 05aaef55252bc9f90cbbcc1967c38ab9a5a6c798) OpenThenSwitchToDeck actually *toggles* deck visibility so rename it to that and add a OpenThenSwitchToDeck that actually does that, using the Toggle varient as the callback from the sidebar button which toggles the current deck on/off which retains the features of // tdf#67627 Clicking a second time on a Deck icon will close the Deck // tdf#88241 Summoning an undocked sidebar a second time should close sidebar but means that calls to OpenThenSwitchToDeck from e.g. slide layout don't auto close it if that deck is already open (cherry picked from commit b81daea4a78083def286fa2d5360b152b7a703fd) 3e3724626b93447a7ab6bc7032e9c6839dabcf55 Change-Id: I16a2fca158cb4caab7b6bd001742df698735dd2b Reviewed-on: https://gerrit.libreoffice.org/27071 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit e1e61bf5e5f368fc1ea579f8ae5eec9faafbd599)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx23
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx19
-rw-r--r--sfx2/source/view/viewfrm.cxx4
3 files changed, 41 insertions, 5 deletions
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index c4e9c805f6dd..02a17f43b8be 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -45,6 +45,29 @@ void Sidebar::ShowPanel (
}
}
+void Sidebar::TogglePanel (
+ const ::rtl::OUString& rsPanelId,
+ const css::uno::Reference<frame::XFrame>& rxFrame)
+{
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+
+ if (!pController)
+ return;
+
+ std::shared_ptr<PanelDescriptor> xPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId);
+
+ if (!xPanelDescriptor)
+ return;
+
+ // This should be a lot more sophisticated:
+ // - Make the deck switching asynchronous
+ // - Make sure to use a context that really shows the panel
+
+ // All that is not necessary for the current use cases so lets
+ // keep it simple for the time being.
+ pController->OpenThenToggleDeck(xPanelDescriptor->msDeckId);
+}
+
} } // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 74973d11b1cc..fe73d2c6842e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -94,7 +94,7 @@ SidebarController::SidebarController (
mpTabBar(VclPtr<TabBar>::Create(
mpParentWindow,
rxFrame,
- [this](const ::rtl::OUString& rsDeckId) { return this->OpenThenSwitchToDeck(rsDeckId); },
+ [this](const ::rtl::OUString& rsDeckId) { return this->OpenThenToggleDeck(rsDeckId); },
[this](const Rectangle& rButtonBox,const ::std::vector<TabBar::DeckMenuData>& rMenuData) { return this->ShowPopupMenu(rButtonBox,rMenuData); },
this)),
mxFrame(rxFrame),
@@ -500,8 +500,8 @@ void SidebarController::UpdateConfigurations()
}
}
-void SidebarController::OpenThenSwitchToDeck (
- const ::rtl::OUString& rsDeckId)
+void SidebarController::OpenThenToggleDeck (
+ const OUString& rsDeckId)
{
SfxSplitWindow* pSplitWindow = GetSplitWindow();
if ( pSplitWindow && !pSplitWindow->IsFadeIn() )
@@ -523,6 +523,19 @@ void SidebarController::OpenThenSwitchToDeck (
mpTabBar->HighlightDeck(rsDeckId);
}
+void SidebarController::OpenThenSwitchToDeck (
+ const OUString& rsDeckId)
+{
+ SfxSplitWindow* pSplitWindow = GetSplitWindow();
+ if ( pSplitWindow && !pSplitWindow->IsFadeIn() )
+ // tdf#83546 Collapsed sidebar should expand first
+ pSplitWindow->FadeIn();
+ RequestOpenDeck();
+ SwitchToDeck(rsDeckId);
+ mpTabBar->Invalidate();
+ mpTabBar->HighlightDeck(rsDeckId);
+}
+
void SidebarController::SwitchToDefaultDeck()
{
SwitchToDeck(gsDefaultDeckId);
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index c6e57266f181..9904eaab94c8 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3056,8 +3056,8 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq )
// First make sure that the sidebar is visible
ShowChildWindow(SID_SIDEBAR);
- ::sfx2::sidebar::Sidebar::ShowPanel("StyleListPanel",
- GetFrame().GetFrameInterface());
+ ::sfx2::sidebar::Sidebar::TogglePanel("StyleListPanel",
+ GetFrame().GetFrameInterface());
rReq.Done();
return;
}