summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-11-05 23:12:55 +0100
committerSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-11-05 23:15:47 +0100
commitd59b9b4af36148e4d8df8f3e3492116d378642e2 (patch)
treee9ce25544fae1f962da815cad8c96be8d541249a
parentff1aae469f6521b67e51c9e77415ba847eed69e8 (diff)
fdo#67627 fdo#85791 Allow to show/hide sidebar decks with the same command
This also reintroduces the code to switch the decks asynchronously (removed unintentionally before) Change-Id: I825b4d7c5777097e9d3b3d82adbe1f646510dc9d
-rw-r--r--sfx2/sdi/sfx.sdi2
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.cxx7
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.hxx1
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx3
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx20
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx7
6 files changed, 36 insertions, 4 deletions
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 1d2e11cec405..2a64d6a9ac37 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -1343,7 +1343,7 @@ SfxUInt16Item DeleteStyle SID_STYLE_DELETE
]
-SfxBoolItem DesignerDialog SID_STYLE_DESIGNER
+SfxVoidItem DesignerDialog SID_STYLE_DESIGNER
[
/* flags: */
diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx
index 767e2e71bc4e..50f1a1cc982c 100644
--- a/sfx2/source/sidebar/AsynchronousCall.cxx
+++ b/sfx2/source/sidebar/AsynchronousCall.cxx
@@ -40,6 +40,13 @@ AsynchronousCall::~AsynchronousCall (void)
CancelRequest();
}
+void AsynchronousCall::RequestCall (const Action& rAction)
+{
+ CancelRequest();
+ maAction = rAction;
+ RequestCall();
+}
+
void AsynchronousCall::RequestCall (void)
{
if (mnCallId == 0)
diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/sfx2/source/sidebar/AsynchronousCall.hxx
index 665a35b9bf5c..d3ecd5dcf98c 100644
--- a/sfx2/source/sidebar/AsynchronousCall.hxx
+++ b/sfx2/source/sidebar/AsynchronousCall.hxx
@@ -38,6 +38,7 @@ public:
AsynchronousCall (const Action& rAction);
~AsynchronousCall (void);
+ void RequestCall (const Action& rAction);
void RequestCall (void);
void CancelRequest (void);
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index 245307c3328a..fe1bc5c3cf11 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -40,10 +40,11 @@ void Sidebar::ShowPanel (
// All that is not necessary for the current use cases so lets
// keep it simple for the time being.
- pController->OpenThenSwitchToDeck(pPanelDescriptor->msDeckId);
+ pController->RequestSwitchToDeck(pPanelDescriptor->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 6b6bd0d11aa0..db09eea970e8 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -504,14 +504,27 @@ void SidebarController::UpdateConfigurations (void)
}
-
+void SidebarController::RequestSwitchToDeck (
+ const ::rtl::OUString& rsDeckId)
+{
+ maContextChangeUpdate.CancelRequest();
+ maAsynchronousDeckSwitch.RequestCall(
+ ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, rsDeckId));
+}
void SidebarController::OpenThenSwitchToDeck (
const ::rtl::OUString& rsDeckId)
{
+ // fdo#67627 Clicking a second time on a Deck icon will close the Deck
+ if (IsDeckVisible(rsDeckId))
+ {
+ RequestCloseDeck();
+ return;
+ }
RequestOpenDeck();
SwitchToDeck(rsDeckId);
mpTabBar->Invalidate();
+ mpTabBar->HighlightDeck(rsDeckId);
}
void SidebarController::SwitchToDeck (
@@ -996,7 +1009,10 @@ void SidebarController::RequestOpenDeck (void)
UpdateDeckOpenState();
}
-
+bool SidebarController::IsDeckVisible(const OUString& rsDeckId)
+{
+ return mbIsDeckOpen && mbIsDeckOpen.get() && msCurrentDeckId == rsDeckId;
+}
void SidebarController::UpdateDeckOpenState (void)
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 33cfea65e15a..46511a553122 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -122,6 +122,9 @@ public:
const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
+
+ void RequestSwitchToDeck (
+ const ::rtl::OUString& rsDeckId);
void OpenThenSwitchToDeck (
const ::rtl::OUString& rsDeckId);
@@ -133,6 +136,10 @@ public:
*/
void RequestOpenDeck (void);
+ /** Returns true when the given deck is the currently visible deck
+ */
+ bool IsDeckVisible (const ::rtl::OUString& rsDeckId);
+
FocusManager& GetFocusManager (void) { return maFocusManager;}
private: