Author: af
Date: Mon May 27 11:18:04 2013
New Revision: 1486578

URL: http://svn.apache.org/r1486578
Log:
122332: Don't change sidebar context when switching to other application window.

Modified:
    openoffice/trunk/main/sc/source/ui/drawfunc/drawsh2.cxx
    openoffice/trunk/main/sc/source/ui/inc/drawsh.hxx
    openoffice/trunk/main/sd/source/ui/inc/DrawViewShell.hxx
    
openoffice/trunk/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
    openoffice/trunk/main/sd/source/ui/view/drviewsa.cxx
    openoffice/trunk/main/sd/source/ui/view/outlnvsh.cxx
    openoffice/trunk/main/sd/source/ui/view/viewshel.cxx
    openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx
    openoffice/trunk/main/sfx2/source/control/shell.cxx
    openoffice/trunk/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx
    openoffice/trunk/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx
    openoffice/trunk/main/svx/source/sidebar/SelectionAnalyzer.cxx
    openoffice/trunk/main/svx/source/sidebar/SelectionChangeHandler.cxx

Modified: openoffice/trunk/main/sc/source/ui/drawfunc/drawsh2.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/drawfunc/drawsh2.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/drawfunc/drawsh2.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/drawfunc/drawsh2.cxx Mon May 27 11:18:04 
2013
@@ -43,6 +43,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"
@@ -69,7 +70,7 @@ ScDrawShell::ScDrawShell( ScViewData* pD
        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))
 {
@@ -408,8 +409,25 @@ void ScDrawShell::GetDrawAttrStateForIFB
        }
 }
 
-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()));
 }

Modified: openoffice/trunk/main/sc/source/ui/inc/drawsh.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/inc/drawsh.hxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/inc/drawsh.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/inc/drawsh.hxx Mon May 27 11:18:04 2013
@@ -27,7 +27,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>
@@ -51,6 +50,7 @@ class ScDrawShell : public SfxShell
 #endif
 
 protected:
+       virtual void    Activate(sal_Bool bMDI);
        ScViewData*     GetViewData()   { return pViewData; }
 
 public:
@@ -89,7 +89,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);
 };
 
 

Modified: openoffice/trunk/main/sd/source/ui/inc/DrawViewShell.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/inc/DrawViewShell.hxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/inc/DrawViewShell.hxx (original)
+++ openoffice/trunk/main/sd/source/ui/inc/DrawViewShell.hxx Mon May 27 
11:18:04 2013
@@ -28,7 +28,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>
@@ -371,6 +370,8 @@ public:
     */
     virtual bool RelocateToParentWindow (::Window* pParentWindow);
 
+    ::rtl::OUString GetSidebarContextName (void) const;
+
 protected:
        DrawView*               mpDrawView;
        SdPage*                 mpActualPage;
@@ -495,8 +496,6 @@ private:
         const sal_uInt16 nSnapLineIndex,
         const Point& rMouseLocation);
 
-    ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const;
-    
        using ViewShell::Notify;
        
        ::std::auto_ptr< AnnotationManager > mpAnnotationManager;

Modified: 
openoffice/trunk/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- 
openoffice/trunk/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx 
(original)
+++ 
openoffice/trunk/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx 
Mon May 27 11:18:04 2013
@@ -56,6 +56,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>
@@ -67,6 +68,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
        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
 
 void SlideSorterViewShell::Deactivate (sal_Bool bIsMDIActivate)
 {
-    ContextChangeEventMultiplexer::NotifyContextChange(
-        &GetViewShellBase(),
-        EnumContext::Context_Default);
 }
 
 

Modified: openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews1.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews1.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews1.cxx Mon May 27 11:18:04 
2013
@@ -148,7 +148,7 @@ void DrawViewShell::UIDeactivated( SfxIn
 
 void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
 {
-    ViewShell::Deactivate(bIsMDIActivate);
+    // Do not forward to ViewShell::Deactivate() to prevent a context change.
 }
 
 namespace
@@ -517,13 +517,7 @@ void DrawViewShell::ChangeEditMode(EditM
                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());
        }
 }
 

Modified: openoffice/trunk/main/sd/source/ui/view/drviewsa.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviewsa.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviewsa.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviewsa.cxx Mon May 27 11:18:04 
2013
@@ -143,7 +143,7 @@ DrawViewShell::DrawViewShell( SfxViewFra
 , maTabControl(this, pParentWindow)
 , 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))
           
@@ -156,12 +156,7 @@ DrawViewShell::DrawViewShell( SfxViewFra
 
     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());
 }
 
 /*************************************************************************
@@ -875,13 +870,28 @@ void DrawViewShell::GetAnnotationState (
 
 
 
-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));
 }
 
 

Modified: openoffice/trunk/main/sd/source/ui/view/outlnvsh.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/outlnvsh.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/outlnvsh.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/outlnvsh.cxx Mon May 27 11:18:04 
2013
@@ -398,6 +398,8 @@ void OutlineViewShell::Activate( sal_Boo
     }
 
     ViewShell::Activate( bIsMDIActivate );
+    SfxShell::BroadcastContextForActivation(true);
+    
     pOlView->SetLinks();
     pOlView->ConnectToApplication();
 

Modified: openoffice/trunk/main/sd/source/ui/view/viewshel.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/viewshel.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/viewshel.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/viewshel.cxx Mon May 27 11:18:04 
2013
@@ -329,7 +329,7 @@ void ViewShell::Exit (void)
 
 void ViewShell::Activate(sal_Bool bIsMDIActivate)
 {
-    SfxShell::Activate(bIsMDIActivate);
+    // Do not forward to SfxShell::Activate()
 
        // Laut MI darf keiner GrabFocus rufen, der nicht genau weiss von
        // welchem Window der Focus gegrabt wird. Da Activate() vom SFX 
teilweise

Modified: openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/shell.hxx Mon May 27 11:18:04 2013
@@ -254,7 +254,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 );

Modified: openoffice/trunk/main/sfx2/source/control/shell.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/control/shell.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/control/shell.cxx (original)
+++ openoffice/trunk/main/sfx2/source/control/shell.cxx Mon May 27 11:18:04 2013
@@ -761,17 +761,12 @@ void SfxShell::Activate
        wird, um den Subclasses die Gelegenheit zu geben, auf das Aktivieren
        zu reagieren.
 
-       Die Basisimplementation ist leer und braucht nicht gerufen zu werden.
-
-
        [Querverweise]
        StarView SystemWindow::Activate(sal_Bool)
 */
 
 {
-    SfxViewFrame* pViewFrame = GetFrame();
-    if (pViewFrame != NULL)
-        
pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
+    BroadcastContextForActivation(true);
 }
 
 //--------------------------------------------------------------------
@@ -797,19 +792,15 @@ void SfxShell::Deactivate
        wird, um den Subclasses die Gelegenheit zu geben, auf das Deaktivieren
        zu reagieren.
 
-       Die Basisimplementation ist leer und braucht nicht gerufen zu werden.
-
-
        [Querverweise]
        StarView SystemWindow::Dectivate(sal_Bool)
 */
 
 {
-    SfxViewFrame* pViewFrame = GetFrame();
-    if (pViewFrame != NULL)
-        
pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
+    BroadcastContextForActivation(false);
 }
 
+
 void SfxShell::ParentActivate
 (
 )
@@ -1298,3 +1289,12 @@ void SfxShell::SetViewShell_Impl( SfxVie
 
 
 
+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());
+}

Modified: openoffice/trunk/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx Mon May 27 
11:18:04 2013
@@ -41,19 +41,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 (

Modified: openoffice/trunk/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx 
(original)
+++ openoffice/trunk/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx Mon 
May 27 11:18:04 2013
@@ -57,7 +57,7 @@ class SVX_DLLPUBLIC SelectionChangeHandl
 {
 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);
@@ -75,7 +75,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;

Modified: openoffice/trunk/main/svx/source/sidebar/SelectionAnalyzer.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/SelectionAnalyzer.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/SelectionAnalyzer.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/SelectionAnalyzer.cxx Mon May 27 
11:18:04 2013
@@ -98,9 +98,7 @@ EnumContext::Context SelectionAnalyzer::
 
 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;
 
@@ -109,14 +107,24 @@ EnumContext::Context SelectionAnalyzer::
     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:
@@ -146,7 +154,7 @@ EnumContext::Context SelectionAnalyzer::
                         if (nObjId == 0)
                             nObjId = OBJ_GRUP;
                     }
-                    eContext = GetContextForObjectId_SD(nObjId, 
bIsHandoutPage, bIsNotesPage);
+                    eContext = GetContextForObjectId_SD(nObjId, eViewType);
                 }
                 else if (nInv == E3dInventor)
                 {
@@ -170,7 +178,7 @@ EnumContext::Context SelectionAnalyzer::
                     if (nObjId == 0)
                         eContext = EnumContext::Context_MultiObject;
                     else
-                        eContext = GetContextForObjectId_SD(nObjId, 
bIsHandoutPage, bIsNotesPage);
+                        eContext = GetContextForObjectId_SD(nObjId, eViewType);
                     break;
                 }
                 
@@ -243,8 +251,7 @@ EnumContext::Context SelectionAnalyzer::
 
 EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
     const sal_uInt16 nObjectId,
-    const bool bIsHandoutPage,
-    const bool bIsNotesPage)
+    const ViewType eViewType)
 {
        switch (nObjectId)
        {
@@ -286,12 +293,17 @@ EnumContext::Context SelectionAnalyzer::
                        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;

Modified: openoffice/trunk/main/svx/source/sidebar/SelectionChangeHandler.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/SelectionChangeHandler.cxx?rev=1486578&r1=1486577&r2=1486578&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/SelectionChangeHandler.cxx 
(original)
+++ openoffice/trunk/main/svx/source/sidebar/SelectionChangeHandler.cxx Mon May 
27 11:18:04 2013
@@ -36,7 +36,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),
@@ -62,7 +62,8 @@ void SAL_CALL SelectionChangeHandler::se
 {
     if (maSelectionChangeCallback)
     {
-        const EnumContext::Context eContext (maSelectionChangeCallback());
+        const EnumContext::Context eContext (
+            EnumContext::GetContextEnum(maSelectionChangeCallback()));
         ContextChangeEventMultiplexer::NotifyContextChange(
             mxController,
             eContext==EnumContext::Context_Unknown


Reply via email to