[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 2 commits - include/sfx2 include/svx sc/source sd/source sfx2/source svx/source
Andre Fischer
af at apache.org
Tue May 28 12:08:43 PDT 2013
include/sfx2/shell.hxx | 15 ++++
include/sfx2/sidebar/EnumContext.hxx | 1
include/svx/sidebar/SelectionAnalyzer.hxx | 16 +++-
include/svx/sidebar/SelectionChangeHandler.hxx | 4 -
sc/source/ui/drawfunc/drawsh2.cxx | 26 ++++++-
sc/source/ui/inc/drawsh.hxx | 4 -
sd/source/ui/inc/DrawViewShell.hxx | 5 -
sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 18 ++---
sd/source/ui/view/drviews1.cxx | 12 ---
sd/source/ui/view/drviewsa.cxx | 36 ++++++----
sd/source/ui/view/outlnvsh.cxx | 2
sd/source/ui/view/viewshel.cxx | 2
sfx2/source/control/shell.cxx | 25 ++++---
sfx2/source/sidebar/EnumContext.cxx | 8 ++
svx/source/sidebar/SelectionAnalyzer.cxx | 54 +++++++++-------
svx/source/sidebar/SelectionChangeHandler.cxx | 5 -
svx/source/sidebar/text/TextPropertyPanel.cxx | 37 ++++++++++
svx/source/sidebar/text/TextPropertyPanel.hxx | 9 ++
18 files changed, 191 insertions(+), 88 deletions(-)
New commits:
commit bf087c85aab791a9282bbda940344c8bf9925ef4
Author: Andre Fischer <af at apache.org>
Date: Mon May 27 12:55:37 2013 +0000
Resolves: #i122387# Use the right tool box for font color in text sidebar
(cherry picked from commit 08159967126946849906827ceadd802053d132c0)
Conflicts:
sfx2/inc/sfx2/sidebar/EnumContext.hxx
Change-Id: If40d3dee7c11e4ea6b01d40d713280e1dc19484d
Unname unused argument to prevent compiler warnings.
(cherry picked from commit f68dfc2cc8754d9cf72ae1b09f119e683ad44124)
Change-Id: I6450c6e46d5971abc871ed378d2ad6307e8f7a3e
(cherry picked from commit 21747cae6ad12ec6566e6dd9a06f3c268c72404d)
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index f45ecd9..b24a8b2 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -129,6 +129,7 @@ public:
Application GetApplication_DI (void) const;
const ::rtl::OUString& GetContextName (void) const;
+ Context GetContext (void) const;
bool operator == (const EnumContext aOther);
bool operator != (const EnumContext aOther);
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index d78d8cf..48a974e 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -136,6 +136,14 @@ const ::rtl::OUString& EnumContext::GetContextName (void) const
+EnumContext::Context EnumContext::GetContext (void) const
+{
+ return meContext;
+}
+
+
+
+
bool EnumContext::operator== (const EnumContext aOther)
{
return meApplication==aOther.meApplication
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 6547db6..258a730 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -147,9 +147,12 @@ TextPropertyPanel::TextPropertyPanel (
mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxFontColor(ControlFactory::CreateToolBox(
mpToolBoxFontColorBackground.get(),
- rContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants
- ? SVX_RES(TB_FONTCOLOR_SW)
- : SVX_RES(TB_FONTCOLOR),
+ SVX_RES(TB_FONTCOLOR),
+ rxFrame)),
+ mpToolBoxFontColorBackgroundSW(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxFontColorSW(ControlFactory::CreateToolBox(
+ mpToolBoxFontColorBackgroundSW.get(),
+ SVX_RES(TB_FONTCOLOR_SW),
rxFrame)),
mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxHighlight(ControlFactory::CreateToolBox(
@@ -186,6 +189,8 @@ TextPropertyPanel::TextPropertyPanel (
Initialize();
FreeResource();
+
+ UpdateFontColorToolbox(rContext);
}
@@ -200,6 +205,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDec.reset();
mpToolBoxFont.reset();
mpToolBoxFontColor.reset();
+ mpToolBoxFontColorSW.reset();
mpToolBoxScript.reset();
mpToolBoxScriptSw.reset();
mpToolBoxSpacing.reset();
@@ -209,6 +215,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDecBackground.reset();
mpToolBoxFontBackground.reset();
mpToolBoxFontColorBackground.reset();
+ mpToolBoxFontColorBackgroundSW.reset();
mpToolBoxScriptBackground.reset();
mpToolBoxScriptSwBackground.reset();
mpToolBoxSpacingBackground.reset();
@@ -284,6 +291,30 @@ void TextPropertyPanel::HandleContextChange (
default:
break;
}
+
+ UpdateFontColorToolbox(aContext);
+}
+
+
+
+
+void TextPropertyPanel::UpdateFontColorToolbox (
+ const ::sfx2::sidebar::EnumContext /* aContext */)
+{
+ bool bIsWriterFontColor (false);
+ if (maContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants)
+ if (maContext.GetContext() != sfx2::sidebar::EnumContext::Context_DrawText)
+ bIsWriterFontColor = true;
+ if (bIsWriterFontColor)
+ {
+ mpToolBoxFontColor->Hide();
+ mpToolBoxFontColorSW->Show();
+ }
+ else
+ {
+ mpToolBoxFontColor->Show();
+ mpToolBoxFontColorSW->Hide();
+ }
}
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index a7cc0dd..7f2f641 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -97,6 +97,8 @@ private:
::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
+ ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
@@ -173,6 +175,13 @@ private:
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
void UpdateItem (const sal_uInt16 nSlotId);
+
+ /** Depending on the given context make one of the toolboxes
+ mpToolBoxFontColor and mpToolBoxFontColorSW visible. Both
+ occupy the same space.
+ */
+ void UpdateFontColorToolbox (
+ const ::sfx2::sidebar::EnumContext aContext);
};
} } // end of namespace ::svx::sidebar
commit 17bbff0e686fb32e3062316c238c7bdded037b9a
Author: Andre Fischer <af at apache.org>
Date: Mon May 27 11:18:04 2013 +0000
Resolves: #i122332# Don't change sidebar context when switching...
to other application window
(cherry picked from commit 604502e2a4b53f35aedbf0205598a9b691c0d532)
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
(cherry picked from commit 0143805a565418d2a114c16b7eeba3b784176d9e)
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index cb5b149..ddeb677 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -238,7 +238,20 @@ public:
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
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
SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
diff --git a/include/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx
index 601a96e..1a36232 100644
--- a/include/svx/sidebar/SelectionAnalyzer.hxx
+++ b/include/svx/sidebar/SelectionAnalyzer.hxx
@@ -37,19 +37,25 @@ class SVX_DLLPUBLIC SelectionAnalyzer
public :
static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC (
const SdrMarkList& rMarkList);
+
+ enum ViewType
+ {
+ VT_Standard,
+ VT_Master,
+ VT_Handout,
+ VT_Notes,
+ VT_Outline
+ };
static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD (
const SdrMarkList& rMarkList,
- const bool bIsMasterPage,
- const bool bIsHandoutPage,
- const bool bIsNotesPage);
+ const ViewType eViewType);
private:
static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC (
const sal_uInt16 nObjectId);
static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD (
const sal_uInt16 nObjectId,
- const bool bIsHandoutPage,
- const bool bIsNotesPage);
+ const ViewType eViewType);
static sal_uInt32 GetInventorTypeFromMark (
const SdrMarkList& rMarkList);
static sal_uInt16 GetObjectTypeFromMark (
diff --git a/include/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx
index 29116e5..da1e4e7 100644
--- a/include/svx/sidebar/SelectionChangeHandler.hxx
+++ b/include/svx/sidebar/SelectionChangeHandler.hxx
@@ -53,7 +53,7 @@ class SVX_DLLPUBLIC SelectionChangeHandler
{
public:
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 sfx2::sidebar::EnumContext::Context eDefaultContext);
virtual ~SelectionChangeHandler (void);
@@ -71,7 +71,7 @@ public:
void Disconnect (void);
private:
- const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback;
+ const boost::function<rtl::OUString(void)> maSelectionChangeCallback;
cssu::Reference<css::frame::XController> mxController;
const sfx2::sidebar::EnumContext::Context meDefaultContext;
bool mbIsConnected;
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 47df366..94c6852 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -35,6 +35,7 @@
#include <svx/fontworkbar.hxx>
#include <svx/sidebar/SelectionChangeHandler.hxx>
#include <svx/sidebar/SelectionAnalyzer.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
#include "drawsh.hxx"
#include "drawview.hxx"
@@ -61,7 +62,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) :
SfxShell(pData->GetViewShell()),
pViewData( pData ),
mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
- ::boost::bind(&ScDrawShell::GetContextForSelection, this),
+ ::boost::bind(&ScDrawShell::GetSidebarContextName, this),
GetFrame()->GetFrame().GetController(),
sfx2::sidebar::EnumContext::Context_Cell))
{
@@ -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(
- GetDrawView()->GetMarkedObjectList());
+ return sfx2::sidebar::EnumContext::GetContextName(
+ ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
+ GetDrawView()->GetMarkedObjectList()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx
index d251eee..34050b1 100644
--- a/sc/source/ui/inc/drawsh.hxx
+++ b/sc/source/ui/inc/drawsh.hxx
@@ -23,7 +23,6 @@
#include <sfx2/shell.hxx>
#include "shellids.hxx"
#include <sfx2/module.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
#include <svx/svdmark.hxx>
#include <tools/link.hxx>
#include <rtl/ref.hxx>
@@ -45,6 +44,7 @@ class ScDrawShell : public SfxShell
void SetHlinkForObject( SdrObject* pObj, const OUString& rHlnk );
protected:
+ virtual void Activate(sal_Bool bMDI);
ScViewData* GetViewData() { return pViewData; }
public:
@@ -83,7 +83,7 @@ public:
sal_Bool AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark);
void GetDrawAttrStateForIFBX( SfxItemSet& rSet );
- ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void);
+ ::rtl::OUString GetSidebarContextName (void);
};
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 6d91b18..8dfdea6 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -24,7 +24,6 @@
#include "tools/AsynchronousCall.hxx"
#include <sfx2/viewfac.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
#include "TabControl.hxx"
#include "pres.hxx"
#include <svx/sidebar/SelectionChangeHandler.hxx>
@@ -362,6 +361,8 @@ public:
*/
virtual bool RelocateToParentWindow (::Window* pParentWindow);
+ ::rtl::OUString GetSidebarContextName (void) const;
+
protected:
DrawView* mpDrawView;
SdPage* mpActualPage;
@@ -487,8 +488,6 @@ private:
const sal_uInt16 nSnapLineIndex,
const Point& rMouseLocation);
- ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const;
-
using ViewShell::Notify;
::std::auto_ptr< AnnotationManager > mpAnnotationManager;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 43ff824..e9c627f 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -51,6 +51,7 @@
#include "SdUnoSlideView.hxx"
#include "ViewShellManager.hxx"
#include "Window.hxx"
+#include "drawview.hxx"
#include <sfx2/app.hxx>
#include <sfx2/msg.hxx>
#include <sfx2/objface.hxx>
@@ -62,6 +63,7 @@
#include <svx/svxids.hrc>
#include <sfx2/sidebar/EnumContext.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/ResourceId.hpp>
#include <cppuhelper/bootstrap.hxx>
@@ -563,23 +565,20 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
switch (eMainViewShellType)
{
case ViewShell::ST_IMPRESS:
+ case ViewShell::ST_SLIDE_SORTER:
+ case ViewShell::ST_NOTES:
eContext = EnumContext::Context_DrawPage;
if (pMainViewShell->ISA(DrawViewShell))
{
- DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell.get());
- if (pDrawViewShell && (pDrawViewShell->GetEditMode()== EM_MASTERPAGE))
- eContext = EnumContext::Context_MasterPage;
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
+ if (pDrawViewShell != NULL)
+ eContext = EnumContext::GetContextEnum(pDrawViewShell->GetSidebarContextName());
}
break;
- case ViewShell::ST_SLIDE_SORTER:
eContext = EnumContext::Context_SlidesorterPage;
break;
- case ViewShell::ST_NOTES:
- eContext = EnumContext::Context_NotesPage;
- break;
-
default:
break;
}
@@ -593,9 +592,6 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
void SlideSorterViewShell::Deactivate (sal_Bool /*bIsMDIActivate*/)
{
- ContextChangeEventMultiplexer::NotifyContextChange(
- &GetViewShellBase(),
- EnumContext::Context_Default);
}
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 876eab3..26ad764 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -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
@@ -459,13 +459,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
Invalidate( SID_NOTES_MASTERPAGE );
Invalidate( SID_HANDOUT_MASTERPAGE );
- if (meEditMode == EM_PAGE)
- 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));
+ SetContextName(GetSidebarContextName());
}
}
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2287258..1caab1a 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -125,7 +125,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
, mbIsLayerModeActive(false)
, mbIsInSwitchPage(false)
, mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
- ::boost::bind(&DrawViewShell::GetContextForSelection, this),
+ ::boost::bind(&DrawViewShell::GetSidebarContextName, this),
uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
sfx2::sidebar::EnumContext::Context_Default))
{
@@ -137,12 +137,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
mpSelectionChangeHandler->Connect();
- if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE)
- 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));
+ SetContextName(GetSidebarContextName());
doShow();
}
@@ -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(
- mpDrawView->GetMarkedObjectList(),
- meEditMode == EM_MASTERPAGE,
- mePageKind == PK_HANDOUT,
- mePageKind == PK_NOTES);
+ ::svx::sidebar::SelectionAnalyzer::ViewType eViewType (::svx::sidebar::SelectionAnalyzer::VT_Standard);
+ switch (mePageKind)
+ {
+ case PK_HANDOUT:
+ 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));
}
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 4941018..80f8b3d 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -363,6 +363,8 @@ void OutlineViewShell::Activate( sal_Bool bIsMDIActivate )
}
ViewShell::Activate( bIsMDIActivate );
+ SfxShell::BroadcastContextForActivation(true);
+
pOlView->SetLinks();
pOlView->ConnectToApplication();
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 6fe1ba2..19ab220 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -304,7 +304,7 @@ void ViewShell::Exit (void)
*/
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
exactly know from which window the focus is grabbed. Since Activate()
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 6822af7..bbbe3f5 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -638,17 +638,13 @@ void SfxShell::Activate
in order to give the Subclasses the opportunity to respond to the
to the enabling.
- The base implementation is empty and does not need to be called.
-
[Cross-reference]
StarView SystemWindow::Activate(sal_Bool)
*/
{
- SfxViewFrame* pViewFrame = GetFrame();
- if (pViewFrame != NULL)
- pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
+ BroadcastContextForActivation(true);
}
//--------------------------------------------------------------------
@@ -673,19 +669,16 @@ void SfxShell::Deactivate
Virtual method that is called when disabling the SfxShell instance,
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]
StarView SystemWindow::Dectivate(sal_Bool)
*/
{
- SfxViewFrame* pViewFrame = GetFrame();
- if (pViewFrame != NULL)
- pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
+ BroadcastContextForActivation(false);
}
+
void SfxShell::ParentActivate
(
)
@@ -1171,6 +1164,16 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* 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: */
diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx
index 5924c6f..6e0a419 100644
--- a/svx/source/sidebar/SelectionAnalyzer.cxx
+++ b/svx/source/sidebar/SelectionAnalyzer.cxx
@@ -93,9 +93,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMark
EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
const SdrMarkList& rMarkList,
- const bool bIsMasterPage,
- const bool bIsHandoutPage,
- const bool bIsNotesPage)
+ const ViewType eViewType)
{
EnumContext::Context eContext = EnumContext::Context_Unknown;
@@ -104,14 +102,24 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
switch (rMarkList.GetMarkCount())
{
case 0:
- if (bIsHandoutPage)
- eContext = EnumContext::Context_HandoutPage;
- else if (bIsNotesPage)
- eContext = EnumContext::Context_NotesPage;
- else if (bIsMasterPage)
- eContext = EnumContext::Context_MasterPage;
- else
- eContext = EnumContext::Context_DrawPage;
+ switch(eViewType)
+ {
+ case VT_Standard:
+ eContext = EnumContext::Context_DrawPage;
+ break;
+ case VT_Master:
+ eContext = EnumContext::Context_MasterPage;
+ 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;
case 1:
@@ -141,7 +149,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
if (nObjId == 0)
nObjId = OBJ_GRUP;
}
- eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage);
+ eContext = GetContextForObjectId_SD(nObjId, eViewType);
}
else if (nInv == E3dInventor)
{
@@ -165,7 +173,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
if (nObjId == 0)
eContext = EnumContext::Context_MultiObject;
else
- eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage);
+ eContext = GetContextForObjectId_SD(nObjId, eViewType);
break;
}
@@ -238,8 +246,7 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt
EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
const sal_uInt16 nObjectId,
- const bool bIsHandoutPage,
- const bool bIsNotesPage)
+ const ViewType eViewType)
{
switch (nObjectId)
{
@@ -281,12 +288,17 @@ EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
return EnumContext::Context_Table;
case OBJ_PAGE:
- if (bIsHandoutPage)
- return EnumContext::Context_HandoutPage;
- else if (bIsNotesPage)
- return EnumContext::Context_NotesPage;
- else
- return EnumContext::Context_Unknown;
+ switch (eViewType)
+ {
+ case VT_Handout:
+ return EnumContext::Context_HandoutPage;
+ case VT_Notes:
+ return EnumContext::Context_NotesPage;
+ case VT_Outline:
+ return EnumContext::Context_OutlineText;
+ default:
+ return EnumContext::Context_Unknown;
+ }
default:
return EnumContext::Context_Unknown;
diff --git a/svx/source/sidebar/SelectionChangeHandler.cxx b/svx/source/sidebar/SelectionChangeHandler.cxx
index 275812f..b6f6d9b 100644
--- a/svx/source/sidebar/SelectionChangeHandler.cxx
+++ b/svx/source/sidebar/SelectionChangeHandler.cxx
@@ -32,7 +32,7 @@ using namespace sfx2::sidebar;
namespace svx { namespace sidebar {
SelectionChangeHandler::SelectionChangeHandler (
- const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback,
+ const boost::function<rtl::OUString(void)>& rSelectionChangeCallback,
const Reference<frame::XController>& rxController,
const EnumContext::Context eDefaultContext)
: SelectionChangeHandlerInterfaceBase(m_aMutex),
@@ -58,7 +58,8 @@ void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&
{
if (maSelectionChangeCallback)
{
- const EnumContext::Context eContext (maSelectionChangeCallback());
+ const EnumContext::Context eContext (
+ EnumContext::GetContextEnum(maSelectionChangeCallback()));
ContextChangeEventMultiplexer::NotifyContextChange(
mxController,
eContext==EnumContext::Context_Unknown
More information about the Libreoffice-commits
mailing list