summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/FormShellManager.cxx
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2004-07-13 13:50:00 +0000
committerRüdiger Timm <rt@openoffice.org>2004-07-13 13:50:00 +0000
commitf27df4b39c4df537d9d563341390cf8beb94afdf (patch)
tree78cef9054beb789d07edd83036cbd1532142af29 /sd/source/ui/view/FormShellManager.cxx
parent92cddae70e85fb995521ede268a6adf36c01d4be (diff)
INTEGRATION: CWS impress2 (1.2.8); FILE MERGED
2004/06/22 11:52:50 af 1.2.8.4: #i22705# Made mrBase member non-const. 2004/06/18 00:21:04 af 1.2.8.3: RESYNC: (1.2-1.3); FILE MERGED 2004/06/11 07:17:58 af 1.2.8.2: #i22705# Using GetActiveWindow() instead of pWindow or GetWindow(). 2004/06/04 07:02:54 af 1.2.8.1: #i22705# Modified registering at view shells.
Diffstat (limited to 'sd/source/ui/view/FormShellManager.cxx')
-rw-r--r--sd/source/ui/view/FormShellManager.cxx95
1 files changed, 79 insertions, 16 deletions
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
index c8d2c55bbe56..6e10a016dbc2 100644
--- a/sd/source/ui/view/FormShellManager.cxx
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FormShellManager.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2004-06-03 07:45:07 $
+ * last change: $Author: rt $ $Date: 2004-07-13 14:50:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,30 +62,36 @@
#include "FormShellManager.hxx"
#include "ViewShell.hxx"
+#include "PaneManager.hxx"
#include "ViewShellBase.hxx"
#include "ObjectBarManager.hxx"
+#include "Window.hxx"
#include <svx/fmshell.hxx>
namespace sd {
-FormShellManager::FormShellManager (const ViewShellBase& rBase)
+FormShellManager::FormShellManager (ViewShellBase& rBase)
: mrBase(rBase),
meStackPosition(SP_UNKNOWN)
{
- ViewShell* pShell = mrBase.GetSubShellManager().GetMainSubShell();
+ ViewShell* pShell = mrBase.GetMainViewShell();
if (pShell != NULL)
{
- // Register at the window of the center pane.
- mrBase.GetWindow()->AddEventListener(
+ RegisterAtCenterPane (pShell);
+
+ // Register at the PaneManager to be informed about changes in the
+ // center pane.
+ mrBase.GetPaneManager().AddEventListener (
LINK(
this,
FormShellManager,
- WindowEventHandler));
+ PaneManagerEventHandler));
// Register at the form shell.
- FmFormShell* pFormShell = pShell->GetObjectBarManager().GetFormShell();
+ FmFormShell* pFormShell = static_cast<FmFormShell*>(
+ pShell->GetObjectBarManager().GetObjectBar(RID_FORMLAYER_TOOLBOX));
if (pFormShell != NULL)
{
pFormShell->SetControlActivationHandler(
@@ -102,19 +108,23 @@ FormShellManager::FormShellManager (const ViewShellBase& rBase)
FormShellManager::~FormShellManager (void)
{
- ViewShell* pShell = mrBase.GetSubShellManager().GetMainSubShell();
+ ViewShell* pShell = mrBase.GetMainViewShell();
if (pShell != NULL)
{
- // Unregister at the window of the center pane.
- mrBase.GetWindow()->RemoveEventListener(
+ UnregisterAtCenterPane (pShell);
+
+ // Unregister at the PaneManager.
+ mrBase.GetPaneManager().RemoveEventListener (
LINK(
this,
FormShellManager,
- WindowEventHandler));
+ PaneManagerEventHandler));
+
// Unregister at the form shell.
- FmFormShell* pFormShell = pShell->GetObjectBarManager().GetFormShell();
+ FmFormShell* pFormShell = static_cast<FmFormShell*>(
+ pShell->GetObjectBarManager().GetObjectBar(RID_FORMLAYER_TOOLBOX));
if (pFormShell != NULL)
{
pFormShell->SetControlActivationHandler(Link());
@@ -125,12 +135,44 @@ FormShellManager::~FormShellManager (void)
+void FormShellManager::RegisterAtCenterPane (ViewShell* pShell)
+{
+ ::Window* pWindow = NULL;
+ if (pShell != NULL)
+ pWindow = pShell->GetActiveWindow();
+ if (pWindow != NULL)
+ pWindow->AddEventListener(
+ LINK(
+ this,
+ FormShellManager,
+ WindowEventHandler));
+}
+
+
+
+
+void FormShellManager::UnregisterAtCenterPane (ViewShell* pShell)
+{
+ ::Window* pWindow = NULL;
+ if (pShell != NULL)
+ pWindow = pShell->GetActiveWindow();
+ if (pWindow != NULL)
+ pWindow->RemoveEventListener(
+ LINK(
+ this,
+ FormShellManager,
+ WindowEventHandler));
+}
+
+
+
+
IMPL_LINK(FormShellManager, FormControlActivated, FmFormShell*, EMPTYARG)
{
// The form shell has been actived. To give it priority in reacting to
// slot calls the form shell is moved to the top of the object bar shell
// stack.
- ViewShell* pShell = mrBase.GetSubShellManager().GetMainSubShell();
+ ViewShell* pShell = mrBase.GetMainViewShell();
if (pShell!=NULL && meStackPosition!=SP_ABOVE_VIEW_SHELL)
{
pShell->GetObjectBarManager().MoveToTop (RID_FORMLAYER_TOOLBOX);
@@ -143,6 +185,28 @@ IMPL_LINK(FormShellManager, FormControlActivated, FmFormShell*, EMPTYARG)
+IMPL_LINK(FormShellManager, PaneManagerEventHandler, PaneManagerEvent*, pEvent)
+{
+ if (pEvent->mePane == PaneManager::PT_CENTER)
+ {
+ switch (pEvent->meEventId)
+ {
+ case PaneManagerEvent::EID_VIEW_SHELL_REMOVED:
+ UnregisterAtCenterPane (pEvent->mpShell);
+ break;
+
+ case PaneManagerEvent::EID_VIEW_SHELL_ADDED:
+ RegisterAtCenterPane (pEvent->mpShell);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
IMPL_LINK(FormShellManager, WindowEventHandler, VclWindowEvent*, pEvent)
{
if (pEvent != NULL)
@@ -157,8 +221,7 @@ IMPL_LINK(FormShellManager, WindowEventHandler, VclWindowEvent*, pEvent)
// The window of the center pane got the focus. Therefore
// the form shell is moved to the bottom of the object bar
// stack.
- ViewShell* pShell
- = mrBase.GetSubShellManager().GetMainSubShell();
+ ViewShell* pShell = mrBase.GetMainViewShell();
if (pShell!=NULL && meStackPosition!=SP_BELOW_VIEW_SHELL)
{
pShell->GetObjectBarManager().MoveBelowShell (