Kaydet (Commit) 0143805a authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Caolán McNamara

Resolves: #i122332# Don't change sidebar context when switching...

to other application window

(cherry picked from commit 604502e2)

Conflicts:
	sd/source/ui/view/drviewsa.cxx
	sfx2/inc/sfx2/shell.hxx
	sfx2/source/control/shell.cxx
	svx/inc/svx/sidebar/SelectionAnalyzer.hxx
	svx/inc/svx/sidebar/SelectionChangeHandler.hxx

Change-Id: Id3c427e02714ef0d6686a78094e2f7f3b390a693
üst ec3fafa6
...@@ -238,7 +238,20 @@ public: ...@@ -238,7 +238,20 @@ public:
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
void SetContextName (const ::rtl::OUString& rsContextName); /** Set the name of the sidebar context that is broadcast on calls
to Activation().
*/
void SetContextName (const ::rtl::OUString& rsContextName);
/** Broadcast a sidebar context change.
This method is typically called from Activate() or
Deactivate().
@param bIsActivated
When <TRUE/> then broadcast the context name that was
defined with an earlier call to SetContextName().
When <FALSE/> then broadcast the 'default' context.
*/
void BroadcastContextForActivation (const bool bIsActivated);
#ifndef _SFXSH_HXX #ifndef _SFXSH_HXX
SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
......
...@@ -37,19 +37,25 @@ class SVX_DLLPUBLIC SelectionAnalyzer ...@@ -37,19 +37,25 @@ class SVX_DLLPUBLIC SelectionAnalyzer
public : public :
static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC ( static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC (
const SdrMarkList& rMarkList); const SdrMarkList& rMarkList);
enum ViewType
{
VT_Standard,
VT_Master,
VT_Handout,
VT_Notes,
VT_Outline
};
static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD ( static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD (
const SdrMarkList& rMarkList, const SdrMarkList& rMarkList,
const bool bIsMasterPage, const ViewType eViewType);
const bool bIsHandoutPage,
const bool bIsNotesPage);
private: private:
static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC ( static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC (
const sal_uInt16 nObjectId); const sal_uInt16 nObjectId);
static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD ( static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD (
const sal_uInt16 nObjectId, const sal_uInt16 nObjectId,
const bool bIsHandoutPage, const ViewType eViewType);
const bool bIsNotesPage);
static sal_uInt32 GetInventorTypeFromMark ( static sal_uInt32 GetInventorTypeFromMark (
const SdrMarkList& rMarkList); const SdrMarkList& rMarkList);
static sal_uInt16 GetObjectTypeFromMark ( static sal_uInt16 GetObjectTypeFromMark (
......
...@@ -53,7 +53,7 @@ class SVX_DLLPUBLIC SelectionChangeHandler ...@@ -53,7 +53,7 @@ class SVX_DLLPUBLIC SelectionChangeHandler
{ {
public: public:
SelectionChangeHandler ( SelectionChangeHandler (
const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, const boost::function<rtl::OUString(void)>& rSelectionChangeCallback,
const cssu::Reference<css::frame::XController>& rxController, const cssu::Reference<css::frame::XController>& rxController,
const sfx2::sidebar::EnumContext::Context eDefaultContext); const sfx2::sidebar::EnumContext::Context eDefaultContext);
virtual ~SelectionChangeHandler (void); virtual ~SelectionChangeHandler (void);
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
void Disconnect (void); void Disconnect (void);
private: private:
const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback; const boost::function<rtl::OUString(void)> maSelectionChangeCallback;
cssu::Reference<css::frame::XController> mxController; cssu::Reference<css::frame::XController> mxController;
const sfx2::sidebar::EnumContext::Context meDefaultContext; const sfx2::sidebar::EnumContext::Context meDefaultContext;
bool mbIsConnected; bool mbIsConnected;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <svx/fontworkbar.hxx> #include <svx/fontworkbar.hxx>
#include <svx/sidebar/SelectionChangeHandler.hxx> #include <svx/sidebar/SelectionChangeHandler.hxx>
#include <svx/sidebar/SelectionAnalyzer.hxx> #include <svx/sidebar/SelectionAnalyzer.hxx>
#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
#include "drawsh.hxx" #include "drawsh.hxx"
#include "drawview.hxx" #include "drawview.hxx"
...@@ -61,7 +62,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : ...@@ -61,7 +62,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) :
SfxShell(pData->GetViewShell()), SfxShell(pData->GetViewShell()),
pViewData( pData ), pViewData( pData ),
mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
::boost::bind(&ScDrawShell::GetContextForSelection, this), ::boost::bind(&ScDrawShell::GetSidebarContextName, this),
GetFrame()->GetFrame().GetController(), GetFrame()->GetFrame().GetController(),
sfx2::sidebar::EnumContext::Context_Cell)) sfx2::sidebar::EnumContext::Context_Cell))
{ {
...@@ -396,10 +397,27 @@ void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) ...@@ -396,10 +397,27 @@ void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
} }
} }
sfx2::sidebar::EnumContext::Context ScDrawShell::GetContextForSelection (void)
void ScDrawShell::Activate (const sal_Bool bMDI)
{
(void)bMDI;
ContextChangeEventMultiplexer::NotifyContextChange(
GetFrame()->GetFrame().GetController(),
::sfx2::sidebar::EnumContext::GetContextEnum(
GetSidebarContextName()));
}
::rtl::OUString ScDrawShell::GetSidebarContextName (void)
{ {
return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC( return sfx2::sidebar::EnumContext::GetContextName(
GetDrawView()->GetMarkedObjectList()); ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
GetDrawView()->GetMarkedObjectList()));
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <sfx2/shell.hxx> #include <sfx2/shell.hxx>
#include "shellids.hxx" #include "shellids.hxx"
#include <sfx2/module.hxx> #include <sfx2/module.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
#include <svx/svdmark.hxx> #include <svx/svdmark.hxx>
#include <tools/link.hxx> #include <tools/link.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
...@@ -45,6 +44,7 @@ class ScDrawShell : public SfxShell ...@@ -45,6 +44,7 @@ class ScDrawShell : public SfxShell
void SetHlinkForObject( SdrObject* pObj, const OUString& rHlnk ); void SetHlinkForObject( SdrObject* pObj, const OUString& rHlnk );
protected: protected:
virtual void Activate(sal_Bool bMDI);
ScViewData* GetViewData() { return pViewData; } ScViewData* GetViewData() { return pViewData; }
public: public:
...@@ -83,7 +83,7 @@ public: ...@@ -83,7 +83,7 @@ public:
sal_Bool AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark); sal_Bool AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark);
void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); void GetDrawAttrStateForIFBX( SfxItemSet& rSet );
::sfx2::sidebar::EnumContext::Context GetContextForSelection (void); ::rtl::OUString GetSidebarContextName (void);
}; };
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "tools/AsynchronousCall.hxx" #include "tools/AsynchronousCall.hxx"
#include <sfx2/viewfac.hxx> #include <sfx2/viewfac.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
#include "TabControl.hxx" #include "TabControl.hxx"
#include "pres.hxx" #include "pres.hxx"
#include <svx/sidebar/SelectionChangeHandler.hxx> #include <svx/sidebar/SelectionChangeHandler.hxx>
...@@ -362,6 +361,8 @@ public: ...@@ -362,6 +361,8 @@ public:
*/ */
virtual bool RelocateToParentWindow (::Window* pParentWindow); virtual bool RelocateToParentWindow (::Window* pParentWindow);
::rtl::OUString GetSidebarContextName (void) const;
protected: protected:
DrawView* mpDrawView; DrawView* mpDrawView;
SdPage* mpActualPage; SdPage* mpActualPage;
...@@ -487,8 +488,6 @@ private: ...@@ -487,8 +488,6 @@ private:
const sal_uInt16 nSnapLineIndex, const sal_uInt16 nSnapLineIndex,
const Point& rMouseLocation); const Point& rMouseLocation);
::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const;
using ViewShell::Notify; using ViewShell::Notify;
::std::auto_ptr< AnnotationManager > mpAnnotationManager; ::std::auto_ptr< AnnotationManager > mpAnnotationManager;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "SdUnoSlideView.hxx" #include "SdUnoSlideView.hxx"
#include "ViewShellManager.hxx" #include "ViewShellManager.hxx"
#include "Window.hxx" #include "Window.hxx"
#include "drawview.hxx"
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <sfx2/msg.hxx> #include <sfx2/msg.hxx>
#include <sfx2/objface.hxx> #include <sfx2/objface.hxx>
...@@ -62,6 +63,7 @@ ...@@ -62,6 +63,7 @@
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <sfx2/sidebar/EnumContext.hxx> #include <sfx2/sidebar/EnumContext.hxx>
#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
#include <svx/sidebar/SelectionAnalyzer.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/ResourceId.hpp> #include <com/sun/star/drawing/framework/ResourceId.hpp>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
...@@ -563,23 +565,20 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate) ...@@ -563,23 +565,20 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
switch (eMainViewShellType) switch (eMainViewShellType)
{ {
case ViewShell::ST_IMPRESS: case ViewShell::ST_IMPRESS:
case ViewShell::ST_SLIDE_SORTER:
case ViewShell::ST_NOTES:
eContext = EnumContext::Context_DrawPage; eContext = EnumContext::Context_DrawPage;
if (pMainViewShell->ISA(DrawViewShell)) if (pMainViewShell->ISA(DrawViewShell))
{ {
DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell.get()); DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
if (pDrawViewShell && (pDrawViewShell->GetEditMode()== EM_MASTERPAGE)) if (pDrawViewShell != NULL)
eContext = EnumContext::Context_MasterPage; eContext = EnumContext::GetContextEnum(pDrawViewShell->GetSidebarContextName());
} }
break; break;
case ViewShell::ST_SLIDE_SORTER:
eContext = EnumContext::Context_SlidesorterPage; eContext = EnumContext::Context_SlidesorterPage;
break; break;
case ViewShell::ST_NOTES:
eContext = EnumContext::Context_NotesPage;
break;
default: default:
break; break;
} }
...@@ -593,9 +592,6 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate) ...@@ -593,9 +592,6 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
void SlideSorterViewShell::Deactivate (sal_Bool /*bIsMDIActivate*/) void SlideSorterViewShell::Deactivate (sal_Bool /*bIsMDIActivate*/)
{ {
ContextChangeEventMultiplexer::NotifyContextChange(
&GetViewShellBase(),
EnumContext::Context_Default);
} }
......
...@@ -114,9 +114,9 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli ) ...@@ -114,9 +114,9 @@ void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
} }
void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate) void DrawViewShell::Deactivate(sal_Bool /*bIsMDIActivate*/)
{ {
ViewShell::Deactivate(bIsMDIActivate); // Do not forward to ViewShell::Deactivate() to prevent a context change.
} }
namespace namespace
...@@ -459,13 +459,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) ...@@ -459,13 +459,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
Invalidate( SID_NOTES_MASTERPAGE ); Invalidate( SID_NOTES_MASTERPAGE );
Invalidate( SID_HANDOUT_MASTERPAGE ); Invalidate( SID_HANDOUT_MASTERPAGE );
if (meEditMode == EM_PAGE) SetContextName(GetSidebarContextName());
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
else if (mePageKind == PK_HANDOUT)
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
else
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
} }
} }
......
...@@ -125,7 +125,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas ...@@ -125,7 +125,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
, mbIsLayerModeActive(false) , mbIsLayerModeActive(false)
, mbIsInSwitchPage(false) , mbIsInSwitchPage(false)
, mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
::boost::bind(&DrawViewShell::GetContextForSelection, this), ::boost::bind(&DrawViewShell::GetSidebarContextName, this),
uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()), uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
sfx2::sidebar::EnumContext::Context_Default)) sfx2::sidebar::EnumContext::Context_Default))
{ {
...@@ -137,12 +137,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas ...@@ -137,12 +137,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
mpSelectionChangeHandler->Connect(); mpSelectionChangeHandler->Connect();
if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE) SetContextName(GetSidebarContextName());
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
else if (mePageKind == PK_HANDOUT)
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
else
SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
doShow(); doShow();
} }
...@@ -833,13 +828,28 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) ...@@ -833,13 +828,28 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet )
EnumContext::Context DrawViewShell::GetContextForSelection (void) const ::rtl::OUString DrawViewShell::GetSidebarContextName (void) const
{ {
return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD( ::svx::sidebar::SelectionAnalyzer::ViewType eViewType (::svx::sidebar::SelectionAnalyzer::VT_Standard);
mpDrawView->GetMarkedObjectList(), switch (mePageKind)
meEditMode == EM_MASTERPAGE, {
mePageKind == PK_HANDOUT, case PK_HANDOUT:
mePageKind == PK_NOTES); eViewType = ::svx::sidebar::SelectionAnalyzer::VT_Handout;
break;
case PK_NOTES:
eViewType = ::svx::sidebar::SelectionAnalyzer::VT_Notes;
break;
case PK_STANDARD:
if (meEditMode == EM_MASTERPAGE)
eViewType = ::svx::sidebar::SelectionAnalyzer::VT_Master;
else
eViewType = ::svx::sidebar::SelectionAnalyzer::VT_Standard;
break;
}
return EnumContext::GetContextName(
::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD(
mpDrawView->GetMarkedObjectList(),
eViewType));
} }
......
...@@ -363,6 +363,8 @@ void OutlineViewShell::Activate( sal_Bool bIsMDIActivate ) ...@@ -363,6 +363,8 @@ void OutlineViewShell::Activate( sal_Bool bIsMDIActivate )
} }
ViewShell::Activate( bIsMDIActivate ); ViewShell::Activate( bIsMDIActivate );
SfxShell::BroadcastContextForActivation(true);
pOlView->SetLinks(); pOlView->SetLinks();
pOlView->ConnectToApplication(); pOlView->ConnectToApplication();
......
...@@ -304,7 +304,7 @@ void ViewShell::Exit (void) ...@@ -304,7 +304,7 @@ void ViewShell::Exit (void)
*/ */
void ViewShell::Activate(sal_Bool bIsMDIActivate) void ViewShell::Activate(sal_Bool bIsMDIActivate)
{ {
SfxShell::Activate(bIsMDIActivate); // Do not forward to SfxShell::Activate()
/* According to MI, nobody is allowed to call GrabFocus, who does not /* According to MI, nobody is allowed to call GrabFocus, who does not
exactly know from which window the focus is grabbed. Since Activate() exactly know from which window the focus is grabbed. Since Activate()
......
...@@ -638,17 +638,13 @@ void SfxShell::Activate ...@@ -638,17 +638,13 @@ void SfxShell::Activate
in order to give the Subclasses the opportunity to respond to the in order to give the Subclasses the opportunity to respond to the
to the enabling. to the enabling.
The base implementation is empty and does not need to be called.
[Cross-reference] [Cross-reference]
StarView SystemWindow::Activate(sal_Bool) StarView SystemWindow::Activate(sal_Bool)
*/ */
{ {
SfxViewFrame* pViewFrame = GetFrame(); BroadcastContextForActivation(true);
if (pViewFrame != NULL)
pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -673,19 +669,16 @@ void SfxShell::Deactivate ...@@ -673,19 +669,16 @@ void SfxShell::Deactivate
Virtual method that is called when disabling the SfxShell instance, Virtual method that is called when disabling the SfxShell instance,
to give the Subclasses the opportunity to respond to the disabling. to give the Subclasses the opportunity to respond to the disabling.
The base implementation is empty and does not need to be called.
[Cross-reference] [Cross-reference]
StarView SystemWindow::Dectivate(sal_Bool) StarView SystemWindow::Dectivate(sal_Bool)
*/ */
{ {
SfxViewFrame* pViewFrame = GetFrame(); BroadcastContextForActivation(false);
if (pViewFrame != NULL)
pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
} }
void SfxShell::ParentActivate void SfxShell::ParentActivate
( (
) )
...@@ -1171,6 +1164,16 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* pView ) ...@@ -1171,6 +1164,16 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* pView )
pImp->pViewSh = pView; pImp->pViewSh = pView;
} }
void SfxShell::BroadcastContextForActivation (const bool bIsActivated)
{
SfxViewFrame* pViewFrame = GetFrame();
if (pViewFrame != NULL)
{
if (bIsActivated)
pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
else
pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -93,9 +93,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMark ...@@ -93,9 +93,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMark
EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
const SdrMarkList& rMarkList, const SdrMarkList& rMarkList,
const bool bIsMasterPage, const ViewType eViewType)
const bool bIsHandoutPage,
const bool bIsNotesPage)
{ {
EnumContext::Context eContext = EnumContext::Context_Unknown; EnumContext::Context eContext = EnumContext::Context_Unknown;
...@@ -104,14 +102,24 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( ...@@ -104,14 +102,24 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
switch (rMarkList.GetMarkCount()) switch (rMarkList.GetMarkCount())
{ {
case 0: case 0:
if (bIsHandoutPage) switch(eViewType)
eContext = EnumContext::Context_HandoutPage; {
else if (bIsNotesPage) case VT_Standard:
eContext = EnumContext::Context_NotesPage; eContext = EnumContext::Context_DrawPage;
else if (bIsMasterPage) break;
eContext = EnumContext::Context_MasterPage; case VT_Master:
else eContext = EnumContext::Context_MasterPage;
eContext = EnumContext::Context_DrawPage; break;
case VT_Handout:
eContext = EnumContext::Context_HandoutPage;
break;
case VT_Notes:
eContext = EnumContext::Context_NotesPage;
break;
case VT_Outline:
eContext = EnumContext::Context_OutlineText;
break;
}
break; break;
case 1: case 1:
...@@ -141,7 +149,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( ...@@ -141,7 +149,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
if (nObjId == 0) if (nObjId == 0)
nObjId = OBJ_GRUP; nObjId = OBJ_GRUP;
} }
eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); eContext = GetContextForObjectId_SD(nObjId, eViewType);
} }
else if (nInv == E3dInventor) else if (nInv == E3dInventor)
{ {
...@@ -165,7 +173,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( ...@@ -165,7 +173,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
if (nObjId == 0) if (nObjId == 0)
eContext = EnumContext::Context_MultiObject; eContext = EnumContext::Context_MultiObject;
else else
eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); eContext = GetContextForObjectId_SD(nObjId, eViewType);
break; break;
} }
...@@ -238,8 +246,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt ...@@ -238,8 +246,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt
EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD ( EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
const sal_uInt16 nObjectId, const sal_uInt16 nObjectId,
const bool bIsHandoutPage, const ViewType eViewType)
const bool bIsNotesPage)
{ {
switch (nObjectId) switch (nObjectId)
{ {
...@@ -281,12 +288,17 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD ( ...@@ -281,12 +288,17 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
return EnumContext::Context_Table; return EnumContext::Context_Table;
case OBJ_PAGE: case OBJ_PAGE:
if (bIsHandoutPage) switch (eViewType)
return EnumContext::Context_HandoutPage; {
else if (bIsNotesPage) case VT_Handout:
return EnumContext::Context_NotesPage; return EnumContext::Context_HandoutPage;
else case VT_Notes:
return EnumContext::Context_Unknown; return EnumContext::Context_NotesPage;
case VT_Outline:
return EnumContext::Context_OutlineText;
default:
return EnumContext::Context_Unknown;
}
default: default:
return EnumContext::Context_Unknown; return EnumContext::Context_Unknown;
......
...@@ -32,7 +32,7 @@ using namespace sfx2::sidebar; ...@@ -32,7 +32,7 @@ using namespace sfx2::sidebar;
namespace svx { namespace sidebar { namespace svx { namespace sidebar {
SelectionChangeHandler::SelectionChangeHandler ( SelectionChangeHandler::SelectionChangeHandler (
const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, const boost::function<rtl::OUString(void)>& rSelectionChangeCallback,
const Reference<frame::XController>& rxController, const Reference<frame::XController>& rxController,
const EnumContext::Context eDefaultContext) const EnumContext::Context eDefaultContext)
: SelectionChangeHandlerInterfaceBase(m_aMutex), : SelectionChangeHandlerInterfaceBase(m_aMutex),
...@@ -58,7 +58,8 @@ void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject& ...@@ -58,7 +58,8 @@ void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&
{ {
if (maSelectionChangeCallback) if (maSelectionChangeCallback)
{ {
const EnumContext::Context eContext (maSelectionChangeCallback()); const EnumContext::Context eContext (
EnumContext::GetContextEnum(maSelectionChangeCallback()));
ContextChangeEventMultiplexer::NotifyContextChange( ContextChangeEventMultiplexer::NotifyContextChange(
mxController, mxController,
eContext==EnumContext::Context_Unknown eContext==EnumContext::Context_Unknown
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment