summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-06-05 15:40:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-09-20 16:35:29 +0100
commit50cbbc7f3afdd077e98f416f97390fe93428e8cf (patch)
treef1f0bdfa883202bd8fe382f8f99afda454c3e30e
parentd023339c2f85555212bdb9804854dcc2c403b50e (diff)
Resolves: #i122470# Fixed programmatic triggered switching of sidebar decks
(cherry picked from commit 7b26aba94e5544937f1e37e34915bcb276bc3c27) Conflicts: sd/sdi/sdraw.sdi sd/source/ui/framework/tools/FrameworkHelper.cxx sd/source/ui/inc/framework/FrameworkHelper.hxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drviews6.cxx sfx2/Package_inc.mk sfx2/inc/sfx2/sidebar/Sidebar.hxx Change-Id: Ic6b518e734fe59a7b713e85e934487347b847c5a
-rw-r--r--include/sfx2/sidebar/Sidebar.hxx (renamed from sfx2/source/sidebar/Sidebar.hxx)51
-rw-r--r--sd/inc/app.hrc2
-rw-r--r--sd/sdi/ViewShellBase.sdi5
-rw-r--r--sd/sdi/sdraw.sdi25
-rw-r--r--sd/source/ui/app/sdmod1.cxx15
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx48
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx19
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx11
-rw-r--r--sd/source/ui/table/tablefunction.cxx10
-rw-r--r--sd/source/ui/view/GraphicViewShellBase.cxx1
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx42
-rw-r--r--sd/source/ui/view/ViewShellImplementation.cxx25
-rw-r--r--sd/source/ui/view/drviews2.cxx22
-rw-r--r--sd/source/ui/view/drviews6.cxx1
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.cxx9
-rw-r--r--sfx2/source/sidebar/AsynchronousCall.hxx1
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx66
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx66
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx23
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.hxx1
-rw-r--r--sfx2/source/sidebar/TabBar.cxx12
22 files changed, 176 insertions, 280 deletions
diff --git a/sfx2/source/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx
index fee066294bfd..2ce7b31499e1 100644
--- a/sfx2/source/sidebar/Sidebar.hxx
+++ b/include/sfx2/sidebar/Sidebar.hxx
@@ -16,50 +16,43 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef SFX_SIDEBAR_HXX
-#define SFX_SIDEBAR_HXX
+
+#ifndef SFX_SIDEBAR_SIDEBAR_HXX
+#define SFX_SIDEBAR_SIDEBAR_HXX
#include "sfx2/dllapi.h"
-#include <vcl/window.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
-namespace sfx2 { namespace sidebar {
+namespace sfx2 { namespace sidebar {
-/** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
- module's configuration
+/** Accept requests for switching to certain panels or decks.
*/
class SFX2_DLLPUBLIC Sidebar
- : public Window
{
public:
- /** creates a new instance
- @param i_rParentWindow
- the parent window
- @param i_rDocumentFrame
- the frame to which the task pane belongs. Will be passed to any custom tool panels created
- via an XUIElementFactory. Also, it is used to determine the module which the task pane is
- responsible for, thus controlling which tool panels are actually available.
- */
- Sidebar(
- Window& rParentWindow,
- const cssu::Reference<css::frame::XFrame>& rxDocumentFrame);
-
-
- virtual ~Sidebar (void);
-
-protected:
- virtual void Resize (void);
- virtual void GetFocus (void);
-
-private:
+ /** Switch to the deck that contains the specified panel and make
+ sure that the panel is visible (expanded and scrolled into the
+ visible area.)
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested panel is visible.
+ */
+ static void ShowPanel (
+ const ::rtl::OUString& rsPanelId,
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+ /** Switch to the specified deck.
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested deck is visible.
+ */
+ static void ShowDeck (
+ const ::rtl::OUString& rsDeckId,
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
};
-
} } // end of namespace sfx2::sidebar
#endif
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index d421a9bd653e..f82d11e38fdf 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -437,7 +437,7 @@
#define SID_TP_USE_FOR_NEW_PRESENTATIONS (SID_SD_START+427)
#define SID_TP_SHOW_LARGE_PREVIEW (SID_SD_START+428)
#define SID_TP_SHOW_SMALL_PREVIEW (SID_SD_START+429)
-#define SID_SHOW_TOOL_PANEL (SID_SD_START+430)
+// SID_SD_START+430 is unused
#define SID_INSERT_MASTER_PAGE (SID_SD_START+431)
#define SID_DELETE_MASTER_PAGE (SID_SD_START+432)
#define SID_RENAME_MASTER_PAGE (SID_SD_START+433)
diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi
index 79275aab69dc..98da5f536d0d 100644
--- a/sd/sdi/ViewShellBase.sdi
+++ b/sd/sdi/ViewShellBase.sdi
@@ -77,11 +77,6 @@ interface ViewShellBaseView
ExecMethod = Execute;
StateMethod = GetState;
]
- SID_SHOW_TOOL_PANEL
- [
- ExecMethod = Execute;
- StateMethod = GetState;
- ]
SID_WIN_FULLSCREEN
[
ExecMethod = Execute;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 60c22fffeb8d..4fee33c88f4e 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -7228,31 +7228,6 @@ SfxBoolItem SlideSorterMultiPaneGUI SID_SLIDE_SORTER_MULTI_PANE_GUI
GroupId = GID_MODIFY;
]
-SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL (
- SfxBoolItem IsPanelVisible ID_VAL_ISVISIBLE,
- SfxUInt32Item PanelId ID_VAL_PANEL_INDEX)
-[
- /* flags: */
- AutoUpdate = TRUE,
- Cachable = Cachable,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = FALSE,
- Toggle = FALSE,
- Container = TRUE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- /* config: */
- AccelConfig = FALSE,
- MenuConfig = FALSE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = FALSE,
- GroupId = GID_VIEW;
-]
-//--------------------------------------------------------------------------
SfxVoidItem PhotoAlbumDialog SID_PHOTOALBUM
()
[
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 361124f3c590..ef5915997be5 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -538,7 +538,6 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
if ( pFrmItem )
xTargetFrame = pFrmItem->GetFrame();
- bool bMakeLayoutVisible = false;
SfxViewFrame* pViewFrame = NULL;
SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
@@ -562,7 +561,6 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
{
//create an empty document
pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame );
- bMakeLayoutVisible = true;
}
}
else
@@ -714,25 +712,12 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
// clear UNDO stack after autopilot
pDocShell->ClearUndoBuffer();
-
- bMakeLayoutVisible = true;
}
}
pOpt->SetStartWithTemplate(bStartWithTemplate);
}
}
}
-
- if (bMakeLayoutVisible && pViewFrame!=NULL)
- {
- // Make the layout menu visible in the tool pane.
- ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
- if (pBase != NULL)
- {
- FrameworkHelper::Instance(*pBase)->RequestSidebarPanel(
- FrameworkHelper::msLayoutTaskPanelURL);
- }
- }
}
return pFrame;
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 2b22a0f12ddd..f46f2aadf68a 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -599,54 +599,6 @@ Reference<XResourceId> FrameworkHelper::RequestView (
-Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
- const OUString& rsTaskPanelURL,
- const bool bEnsureTaskPaneIsVisible)
-{
- try
- {
- if (mxConfigurationController.is())
- {
- // Check the existence of the task pane.
- if ( ! bEnsureTaskPaneIsVisible)
- {
- Reference<XConfiguration> xConfiguration (
- mxConfigurationController->getCurrentConfiguration());
- if (xConfiguration.is())
- if ( ! xConfiguration->hasResource(
- CreateResourceId(msSidebarViewURL, msSidebarPaneURL)))
- {
- // Task pane is not active. Do not force it.
- return NULL;
- }
- }
-
- // Create the resource id from URLs for the sidebar pane
- // and view and the requested panel.
- mxConfigurationController->requestResourceActivation(
- CreateResourceId(msSidebarPaneURL),
- ResourceActivationMode_ADD);
- mxConfigurationController->requestResourceActivation(
- CreateResourceId(msSidebarViewURL, msSidebarPaneURL),
- ResourceActivationMode_REPLACE);
- Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
- mxConfigurationController->requestResourceActivation(
- xPanelId,
- ResourceActivationMode_REPLACE);
-
- return xPanelId;
- }
- }
- catch (lang::DisposedException&)
- {
- Dispose();
- }
- catch (RuntimeException&)
- {}
-
- return NULL;
-}
-
ViewShell::ShellType FrameworkHelper::GetViewId (const OUString& rsViewURL)
{
if (mpViewURLMap->empty())
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index 98f45ce3b606..33e88c94c616 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -221,25 +221,6 @@ public:
const OUString& rsResourceURL,
const OUString& rsAnchorURL);
- /** Request the activation of the specified panel in the
- sidebar.
- @param rsSidebarPanelURL
- The panel that is to be activated.
- @param bEnsurePaneIsVisible
- When this is <TRUE/> then the sidebar pane is activated when not
- yet active.
- When this flag is <FALSE/> then the requested panel
- is activated only when the task pane is already active. When it
- is not active then this call is silently ignored.
- @return
- The resource id of the requested sidebar panel is returned. With that
- the caller can, for example, call RunOnResourceActivation() to
- do some initialization after the requested view becomes active.
- */
- cssu::Reference<cssdf::XResourceId> RequestSidebarPanel (
- const OUString& rsSidebarPanelURL,
- const bool bEnsureTaskPaneIsVisible = true);
-
/** Process a slot call that requests a view shell change.
*/
void HandleModeChangeSlot (
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 87b4acbe9770..79c409ce4657 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -74,6 +74,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svx/svxids.hrc>
#include <sfx2/zoomitem.hxx>
#include <svx/svxdlg.hxx>
@@ -187,12 +188,10 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it)
- // in the tool pane.
- if (mrSlideSorter.GetViewShellBase() != NULL)
- framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
- ->RequestSidebarPanel(
- sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SlideTransitionPanel")),
+ pShell->GetViewFrame()->GetFrame().GetFrameInterface());
rRequest.Ignore ();
break;
}
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 634bb79a0701..7944ed96b8ef 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -49,6 +49,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svl/style.hxx>
#include "framework/FrameworkHelper.hxx"
@@ -195,10 +196,11 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
}
else
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msTableDesignPanelURL);
+ // Make the table design panel visible (expand it) in the
+ // sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImpressTableDesignPanel")),
+ GetViewFrame()->GetFrame().GetFrameInterface());
}
Cancel();
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
index 39c5ba2610ce..06e99bd0453a 100644
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -89,7 +89,6 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest)
case SID_OUTLINEMODE:
case SID_NOTESMODE:
case SID_HANDOUTMODE:
- case SID_SHOW_TOOL_PANEL:
// Prevent some Impress-only slots from being executed.
rRequest.Cancel();
break;
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index d683d4e3bb36..13f50b18afe0 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -182,7 +182,6 @@ public:
void GetSlotState (SfxItemSet& rSet);
void ProcessRestoreEditingViewSlot (void);
- void ProcessTaskPaneSlot (SfxRequest& rRequest);
private:
ViewShellBase& mrBase;
@@ -704,10 +703,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest)
// The full screen mode is not supported. Ignore the request.
break;
- case SID_SHOW_TOOL_PANEL:
- mpImpl->ProcessTaskPaneSlot(rRequest);
- break;
-
case SID_RESTORE_EDITING_VIEW:
mpImpl->ProcessRestoreEditingViewSlot();
break;
@@ -1472,43 +1467,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
-
-void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest)
-{
- // Set the visibility state of the toolpanel and one of its top
- // level panels.
- sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN);
- bool bPanelIdGiven = false;
-
- // Extract the given arguments.
- const SfxItemSet* pArgs = rRequest.GetArgs();
- if (pArgs)
- {
- if (pArgs->Count() == 2)
- {
- SFX_REQUEST_ARG (rRequest, pPanelId, SfxUInt32Item,
- ID_VAL_PANEL_INDEX, sal_False);
- if (pPanelId != NULL)
- {
- nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue());
- bPanelIdGiven = true;
- }
- }
- }
-
- // Ignore the request for some combinations of panels and view
- // shell types.
- if (bPanelIdGiven
- && ! (nPanelId==sidebar::PID_LAYOUT
- && mrBase.GetMainViewShell()!=0
- && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE))
- {
- framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel(
- framework::FrameworkHelper::msLayoutTaskPanelURL);
- }
-}
-
-
} // end of namespace sd
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index 574e3cd4362a..24f7e2b0a036 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -46,6 +46,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svl/aeitem.hxx>
#include <svx/imapdlg.hxx>
#include <vcl/msgbox.hxx>
@@ -125,27 +126,9 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
{
// Make the layout menu visible in the tool pane.
- SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True);
- SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT);
- SfxViewFrame* pFrame = mrViewShell.GetViewFrame();
- if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL)
- {
- pFrame->GetDispatcher()->Execute (
- SID_SHOW_TOOL_PANEL,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- &aMakeToolPaneVisible,
- &aPanelId,
- NULL);
- }
- else
- {
- DBG_ASSERT(pFrame!=NULL && pFrame->GetDispatcher()!=NULL,
- "ViewShell::Implementation::ProcessModifyPageSlot(): can not get dispatcher");
- }
-
- // We have activated a non-modal control in the task pane.
- // Because it does not return anything we can not do anything
- // more right now and have to exit here.
+ sfx2::sidebar::Sidebar::ShowPanel(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImpressLayoutsPanel")),
+ mrViewShell.GetViewFrame()->GetFrame().GetFrameInterface());
break;
}
else if (pArgs->Count() == 4)
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index d1d96b32dbeb..969a17b55245 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -165,6 +165,12 @@
#include "stlpool.hxx"
#include "undolayer.hxx"
#include "unmodpg.hxx"
+#include <sfx2/sidebar/Sidebar.hxx>
+
+namespace {
+ const char CustomAnimationPanelId[] = "CustomAnimationPanel";
+ const char SlideTransitionPanelId[] = "SlideTransitionPanel";
+}
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -2689,10 +2695,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_CUSTOM_ANIMATION_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msCustomAnimationTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ CustomAnimationPanelId,
+ GetViewFrame()->GetFrame().GetFrameInterface());
Cancel();
rReq.Done ();
@@ -2701,10 +2707,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
- framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
- framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ // Make the slide transition panel visible in the sidebar.
+ ::sfx2::sidebar::Sidebar::ShowPanel(
+ SlideTransitionPanelId,
+ GetViewFrame()->GetFrame().GetFrameInterface());
Cancel();
rReq.Done ();
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 97f0017542b5..6aa6238d3350 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -54,6 +54,7 @@
#include "sdabstdlg.hxx"
#include "framework/FrameworkHelper.hxx"
#include <svx/svdoashp.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
namespace sd {
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 46ed25d449e2..6f145ce10c05 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -234,6 +234,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/menu/virtmenu \
sfx2/source/notify/eventsupplier \
sfx2/source/notify/hintpost \
+ sfx2/source/sidebar/Sidebar \
sfx2/source/sidebar/SidebarChildWindow \
sfx2/source/sidebar/SidebarDockingWindow \
sfx2/source/sidebar/SidebarController \
diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx
index 9ccb20234b5e..2ce02dc81fff 100644
--- a/sfx2/source/sidebar/AsynchronousCall.cxx
+++ b/sfx2/source/sidebar/AsynchronousCall.cxx
@@ -23,6 +23,15 @@
namespace sfx2 { namespace sidebar {
+AsynchronousCall::AsynchronousCall (void)
+ : maAction(),
+ mnCallId(0)
+{
+}
+
+
+
+
AsynchronousCall::AsynchronousCall (const Action& rAction)
: maAction(rAction),
mnCallId(0)
diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/sfx2/source/sidebar/AsynchronousCall.hxx
index 7fad0c872954..440aca0f4dc3 100644
--- a/sfx2/source/sidebar/AsynchronousCall.hxx
+++ b/sfx2/source/sidebar/AsynchronousCall.hxx
@@ -32,6 +32,7 @@ class AsynchronousCall
public:
typedef ::boost::function<void(void)> Action;
+ AsynchronousCall (void);
AsynchronousCall (const Action& rAction);
~AsynchronousCall (void);
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index 27518b9c64ff..dd7efec0550a 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "precompiled_sfx2.hxx"
-#include "Sidebar.hxx"
+#include "sfx2/sidebar/Sidebar.hxx"
+#include "SidebarController.hxx"
#include "ResourceManager.hxx"
using namespace css;
@@ -26,55 +26,39 @@ using namespace cssu;
namespace sfx2 { namespace sidebar {
-Sidebar::Sidebar(
- Window& rParentWindow,
- const Reference<frame::XFrame>& rxDocumentFrame)
- : Window(&rParentWindow, WB_DIALOGCONTROL)
-{
- ContentPanelManager::Instance();
-}
-
-
-
-
-Sidebar::~Sidebar (void)
-{
-}
-
-
-
-void Sidebar::Resize (void)
+void Sidebar::ShowPanel (
+ const ::rtl::OUString& rsPanelId,
+ const Reference<frame::XFrame>& rxFrame)
{
- Window::Resize();
- // m_pImpl->OnResize();
-}
-
-
-
-
-void Sidebar::GetFocus (void)
-{
- Window::GetFocus();
- // m_pImpl->OnGetFocus();
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+ if (pController!=NULL && pPanelDescriptor != NULL)
+ {
+ // This should be a lot more sophisticated:
+ // - Make the deck switching asynchronous
+ // - Make sure that the panel is visible and expanded after
+ // the switch.
+ // - 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->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
+ }
}
-void Sidebar::DataChanged (const DataChangedEvent& rDataChangedEvent)
+void Sidebar::ShowDeck (
+ const ::rtl::OUString& rsDeckId,
+ const Reference<frame::XFrame>& rxFrame)
{
- if (rDataChangedEvent.GetType() == DATACHANGED_SETTINGS
- && (rDataChangedEvent.GetFlags() & SETTINGS_STYLE)!= 0)
- {
- Invalidate();
- }
- else
- Window::DataChanged(rDataChangedEvent);
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ if (pController != NULL)
+ pController->RequestSwitchToDeck(rsDeckId);
}
-
-
} } // 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 224295a4cce0..cdfa06cfd4af 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -75,6 +75,8 @@ namespace
namespace sfx2 { namespace sidebar {
+SidebarController::SidebarControllerContainer SidebarController::maSidebarControllerContainer;
+
namespace {
enum MenuId
{
@@ -111,6 +113,7 @@ SidebarController::SidebarController (
msCurrentDeckTitle(),
maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
+ maAsynchronousDeckSwitch(),
mbIsDeckRequestedOpen(),
mbIsDeckOpen(),
mbCanDeckBeOpened(true),
@@ -153,6 +156,12 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch->addStatusListener(this, aURL);
SwitchToDeck(A2S("default"));
+
+ WeakReference<SidebarController> xWeakController (this);
+ maSidebarControllerContainer.insert(
+ SidebarControllerContainer::value_type(
+ rxFrame,
+ xWeakController));
}
@@ -165,8 +174,29 @@ SidebarController::~SidebarController (void)
+SidebarController* SidebarController::GetSidebarControllerForFrame (
+ const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+ SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(rxFrame));
+ if (iEntry == maSidebarControllerContainer.end())
+ return NULL;
+
+ cssu::Reference<XInterface> xController (iEntry->second.get());
+ if ( ! xController.is())
+ return NULL;
+
+ return dynamic_cast<SidebarController*>(xController.get());
+}
+
+
+
+
void SAL_CALL SidebarController::disposing (void)
{
+ SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
+ if (iEntry != maSidebarControllerContainer.end())
+ maSidebarControllerContainer.erase(iEntry);
+
maFocusManager.Clear();
cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -204,6 +234,7 @@ void SAL_CALL SidebarController::disposing (void)
static_cast<css::beans::XPropertyChangeListener*>(this));
maContextChangeUpdate.CancelRequest();
+ maAsynchronousDeckSwitch.CancelRequest();
}
@@ -219,7 +250,10 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
rEvent.ApplicationName,
rEvent.ContextName);
if (maRequestedContext != maCurrentContext)
+ {
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
+ }
}
@@ -262,6 +296,7 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
if ( ! mbIsDocumentReadOnly)
msCurrentDeckId = gsDefaultDeckId;
mnRequestedForceFlags |= SwitchFlag_ForceSwitch;
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
}
}
@@ -440,16 +475,6 @@ void SidebarController::UpdateConfigurations (void)
SwitchToDeck(
*ResourceManager::Instance().GetDeckDescriptor(sNewDeckId),
maCurrentContext);
-
-#ifdef DEBUG
- // Show the context name in the deck title bar.
- if (mpCurrentDeck)
- {
- DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
- if (pTitleBar != NULL)
- pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
- }
-#endif
}
}
@@ -461,6 +486,18 @@ void SidebarController::OpenThenSwitchToDeck (
{
RequestOpenDeck();
SwitchToDeck(rsDeckId);
+ mpTabBar->Invalidate();
+}
+
+
+
+
+void SidebarController::RequestSwitchToDeck (
+ const ::rtl::OUString& rsDeckId)
+{
+ maContextChangeUpdate.CancelRequest();
+ maAsynchronousDeckSwitch.RequestCall(
+ ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, rsDeckId));
}
@@ -544,10 +581,18 @@ void SidebarController::SwitchToDeck (
mpParentWindow,
::boost::bind(&SidebarController::RequestCloseDeck, this)));
msCurrentDeckTitle = rDeckDescriptor.msTitle;
+
}
if ( ! mpCurrentDeck)
return;
+#ifdef DEBUG
+ // Show the context name in the deck title bar.
+ DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
+ if (pTitleBar != NULL)
+ pTitleBar->SetTitle(rDeckDescriptor.msTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
+#endif
+
// Update the panel list.
const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
SharedPanelContainer aNewPanels;
@@ -749,6 +794,7 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
UpdateTitleBarIcons();
mpParentWindow->Invalidate();
mnRequestedForceFlags |= SwitchFlag_ForceNewDeck | SwitchFlag_ForceNewPanels;
+ maAsynchronousDeckSwitch.CancelRequest();
maContextChangeUpdate.RequestCall();
break;
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 44fb76c74efa..365ec8b395ad 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -39,6 +39,9 @@
#include <boost/optional.hpp>
#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+
namespace css = ::com::sun::star;
namespace cssu = ::com::sun::star::uno;
@@ -77,6 +80,15 @@ public:
const cssu::Reference<css::frame::XFrame>& rxFrame);
virtual ~SidebarController (void);
+ /** Return the SidebarController object that is associated with
+ the given XFrame.
+ @return
+ When there is no SidebarController object for the given
+ XFrame then <NULL/> is returned.
+ */
+ static SidebarController* GetSidebarControllerForFrame (
+ const cssu::Reference<css::frame::XFrame>& rxFrame);
+
// ui::XContextChangeEventListener
virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
throw(cssu::RuntimeException);
@@ -110,7 +122,7 @@ public:
const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
- void SwitchToDeck (
+ void RequestSwitchToDeck (
const ::rtl::OUString& rsDeckId);
void OpenThenSwitchToDeck (
const ::rtl::OUString& rsDeckId);
@@ -126,6 +138,12 @@ public:
FocusManager& GetFocusManager (void);
private:
+ typedef ::std::map<
+ const cssu::Reference<css::frame::XFrame>,
+ cssu::WeakReference<SidebarController>
+ > SidebarControllerContainer;
+ static SidebarControllerContainer maSidebarControllerContainer;
+
::boost::scoped_ptr<Deck> mpCurrentDeck;
SidebarDockingWindow* mpParentWindow;
::boost::scoped_ptr<TabBar> mpTabBar;
@@ -138,6 +156,7 @@ private:
::rtl::OUString msCurrentDeckTitle;
AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate;
+ AsynchronousCall maAsynchronousDeckSwitch;
/** Two flags control whether the deck is displayed or if only the
tab bar remains visible.
@@ -185,6 +204,8 @@ private:
const bool bIsInitiallyExpanded,
const Context& rContext);
void SwitchToDeck (
+ const ::rtl::OUString& rsDeckId);
+ void SwitchToDeck (
const DeckDescriptor& rDeckDescriptor,
const Context& rContext);
void ShowPopupMenu (
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index f59576a521af..80939faa45ba 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -21,7 +21,6 @@
#include "sfx2/dockwin.hxx"
#include "sfx2/dockwin.hxx"
-#include "Sidebar.hxx"
#include <rtl/ref.hxx>
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 8c5a1a557290..12a8b1ced330 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -220,9 +220,15 @@ void TabBar::Layout (void)
void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
{
- Item* pItem = GetItemForId(rsDeckId);
- if (pItem != NULL)
- pItem->mpButton->Check();
+ for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
+ iItem!=iEnd;
+ ++iItem)
+ {
+ if (iItem->msDeckId.equals(rsDeckId))
+ iItem->mpButton->Check(sal_True);
+ else
+ iItem->mpButton->Check(sal_False);
+ }
}