summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/inc/ViewShellManager.hxx4
-rw-r--r--sd/source/ui/view/ViewShellManager.cxx24
-rw-r--r--sd/source/ui/view/drviews1.cxx9
-rw-r--r--sd/source/ui/view/outlview.cxx11
4 files changed, 42 insertions, 6 deletions
diff --git a/sd/source/ui/inc/ViewShellManager.hxx b/sd/source/ui/inc/ViewShellManager.hxx
index 18ac6ebfbfd6..926dbf880363 100644
--- a/sd/source/ui/inc/ViewShellManager.hxx
+++ b/sd/source/ui/inc/ViewShellManager.hxx
@@ -165,6 +165,10 @@ public:
*/
SfxShell* GetTopShell (void) const;
+ /** Return the top-most active view shell on the internal shell stack.
+ */
+ SfxShell* GetTopViewShell (void) const;
+
/** Use this class to safely lock updates of the view shell stack.
*/
class UpdateLock
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index bfb8ef893439..21c5aa5e417e 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -126,6 +126,7 @@ public:
void MoveToTop (const SfxShell& rParentShell);
SfxShell* GetShell (ShellId nId) const;
SfxShell* GetTopShell (void) const;
+ SfxShell* GetTopViewShell (void) const;
void Shutdown (void);
void InvalidateAllSubShells (const SfxShell* pParentShell);
@@ -203,6 +204,8 @@ private:
bool mbFormShellAboveParent;
SfxShell* mpTopShell;
+ SfxShell* mpTopViewShell;
+
void GatherActiveShells (ShellStack& rShellList);
@@ -386,8 +389,13 @@ SfxShell* ViewShellManager::GetTopShell (void) const
return NULL;
}
-
-
+SfxShell* ViewShellManager::GetTopViewShell (void) const
+{
+ if (mbValid)
+ return mpImpl->GetTopViewShell();
+ else
+ return NULL;
+}
void ViewShellManager::Shutdown (void)
{
@@ -431,7 +439,8 @@ ViewShellManager::Implementation::Implementation (
mpFormShell(NULL),
mpFormShellParent(NULL),
mbFormShellAboveParent(true),
- mpTopShell(NULL)
+ mpTopShell(NULL),
+ mpTopViewShell(NULL)
{
(void)rManager;
}
@@ -815,8 +824,10 @@ SfxShell* ViewShellManager::Implementation::GetTopShell (void) const
return mpTopShell;
}
-
-
+SfxShell* ViewShellManager::Implementation::GetTopViewShell (void) const
+{
+ return mpTopViewShell;
+}
void ViewShellManager::Implementation::LockUpdate (void)
{
@@ -867,6 +878,9 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
// 1. Create the missing shells.
CreateShells();
+ // Update the pointer to the top-most active view shell.
+ mpTopViewShell = maActiveViewShells.begin()->mpShell;
+
// 2. Create the internal target stack.
ShellStack aTargetStack;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index bffde5d6f88e..2c949bfcea57 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -91,6 +91,15 @@ namespace sd {
void DrawViewShell::Activate(sal_Bool bIsMDIActivate)
{
ViewShell::Activate(bIsMDIActivate);
+
+ // When the mode is switched to normal the main view shell grabs focus.
+ // This is done for getting cut/copy/paste commands on slides in the left
+ // pane (slide sorter view shell) to work properly.
+ SfxShell* pTopViewShell = this->GetViewShellBase().GetViewShellManager()->GetTopViewShell();
+ if (pTopViewShell && pTopViewShell == this)
+ {
+ this->GetActiveWindow()->GrabFocus();
+ }
}
void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index cd78739dfaac..f8f97bffc26c 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -65,6 +65,7 @@
#include "strings.hrc"
#include "EventMultiplexer.hxx"
#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
#include "undo/undoobjects.hxx"
#include "undo/undomanager.hxx"
#include "stlsheet.hxx"
@@ -208,7 +209,15 @@ OutlineView::~OutlineView()
void OutlineView::ConnectToApplication (void)
{
- mrOutlineViewShell.GetActiveWindow()->GrabFocus();
+ // When the mode is switched to outline the main view shell grabs focus.
+ // This is done for getting cut/copy/paste commands on slides in the left
+ // pane (slide sorter view shell) to work properly.
+ SfxShell* pTopViewShell = mrOutlineViewShell.GetViewShellBase().GetViewShellManager()->GetTopViewShell();
+ if (pTopViewShell && pTopViewShell == &mrOutlineViewShell)
+ {
+ mrOutlineViewShell.GetActiveWindow()->GrabFocus();
+ }
+
Application::AddEventListener(LINK(this, OutlineView, AppEventListenerHdl));
}