You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/03/18 18:14:07 UTC

svn commit: r1457873 [1/3] - in /openoffice/branches/sidebar/main: officecfg/registry/data/org/openoffice/Office/UI/ officecfg/registry/schema/org/openoffice/Office/UI/ sc/source/ui/drawfunc/ sc/source/ui/inc/ sc/source/ui/view/ sd/source/ui/func/ sd/s...

Author: af
Date: Mon Mar 18 17:14:04 2013
New Revision: 1457873

URL: http://svn.apache.org/r1457873
Log:
i121420: Improved the support for context changes.

Added:
    openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
    openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.hxx
    openoffice/branches/sidebar/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx
    openoffice/branches/sidebar/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/EmptyPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/EmptyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/SelectionAnalyzer.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/SelectionChangeHandler.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/ColorPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/ColorPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/ContextPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/ContextPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/NotYetImplementedPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/debug/NotYetImplementedPanel.hxx
Modified:
    openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
    openoffice/branches/sidebar/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/chartsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drawsh2.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drformsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drtxtob.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/graphsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/mediash.cxx
    openoffice/branches/sidebar/main/sc/source/ui/drawfunc/oleobjsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/inc/chartsh.hxx
    openoffice/branches/sidebar/main/sc/source/ui/inc/drawsh.hxx
    openoffice/branches/sidebar/main/sc/source/ui/inc/drformsh.hxx
    openoffice/branches/sidebar/main/sc/source/ui/inc/oleobjsh.hxx
    openoffice/branches/sidebar/main/sc/source/ui/view/auditsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/view/cellsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/view/editsh.cxx
    openoffice/branches/sidebar/main/sc/source/ui/view/pivotsh.cxx
    openoffice/branches/sidebar/main/sd/source/ui/func/futext.cxx
    openoffice/branches/sidebar/main/sd/source/ui/inc/DrawViewShell.hxx
    openoffice/branches/sidebar/main/sd/source/ui/inc/SlideSorterViewShell.hxx
    openoffice/branches/sidebar/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
    openoffice/branches/sidebar/main/sd/source/ui/table/tableobjectbar.cxx
    openoffice/branches/sidebar/main/sd/source/ui/view/ViewShellBase.cxx
    openoffice/branches/sidebar/main/sd/source/ui/view/drviewsa.cxx
    openoffice/branches/sidebar/main/sd/source/ui/view/outlnvsh.cxx
    openoffice/branches/sidebar/main/sd/source/ui/view/sdview.cxx
    openoffice/branches/sidebar/main/sfx2/Library_sfx.mk
    openoffice/branches/sidebar/main/sfx2/Package_inc.mk
    openoffice/branches/sidebar/main/sfx2/inc/sfx2/shell.hxx
    openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
    openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx
    openoffice/branches/sidebar/main/sfx2/source/control/shell.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/EnumContext.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/ResourceManager.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/ResourceManager.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx
    openoffice/branches/sidebar/main/svx/Library_svx.mk
    openoffice/branches/sidebar/main/svx/Package_inc.mk
    openoffice/branches/sidebar/main/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/area/AreaPropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx
    openoffice/branches/sidebar/main/sw/inc/cmdid.h
    openoffice/branches/sidebar/main/sw/sdi/_grfsh.sdi
    openoffice/branches/sidebar/main/sw/sdi/swriter.sdi
    openoffice/branches/sidebar/main/sw/source/core/doc/docdesc.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/annotsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/beziersh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/drawsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/drformsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/drwtxtsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/frmsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/grfsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/mediash.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/olesh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/tabsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/shells/textsh.cxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageColumnControl.cxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.hxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageSizeControl.cxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageSizeControl.hxx
    openoffice/branches/sidebar/main/sw/source/ui/uiview/view1.cxx

Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
Binary files - no diff available.

Modified: openoffice/branches/sidebar/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs (original)
+++ openoffice/branches/sidebar/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs Mon Mar 18 17:14:04 2013
@@ -34,34 +34,6 @@
     <desc>Specification of decks and content panels of the sidebar.</desc>
   </info>
   <templates>
-    <group oor:name="ContextMatcherType">
-      <info>
-        <desc>A context specifies the combination of one application name and one or more
-        context names (eg cursor in table, selection active, text editing active).</desc>
-      </info>
-      <prop oor:name="Application" oor:type="xs:string" oor:localized="false">
-        <info>
-          <desc>Name of the application.  Known values are:
-          any,
-          com.sun.star.text.TextDocument (Writer),
-          com.sun.star.sheet.SpreadsheetDocument (Calc),
-          com.sun.star.presentation.PresentationDocument (Impress),
-          com.sun.star.drawing.DrawingDocument (Draw)</desc>
-        </info>
-      </prop>
-      <prop oor:name="IsContextListNegated" oor:type="xs:boolean">
-        <info>
-          <desc>Use this to match the complement of the listed contexts.  The application match is not negated.
-          Defaults to false (ie match the contexts as listed).</desc>
-        </info>
-        <value>false</value>
-      </prop>
-      <prop oor:name="ContextList" oor:type="oor:string-list" oor:localized="false">
-        <info>
-          <desc>Names of application specific contexts.  The special name "any" matches any context name.</desc>
-        </info>
-      </prop>
-    </group>
     <group oor:name="Deck">
       <info>
         <desc>Specification of a sidebar deck which is a container of content panels.</desc>
@@ -98,11 +70,47 @@
         </info>
         <value></value>
       </prop>
-      <set oor:name="ContextMatchers" oor:node-type="ContextMatcherType">
-        <info>
-          <desc>One or more context matchers that define when to show the deck.</desc>
-        </info>
-      </set>
+      <prop oor:name="ContextList" oor:type="oor:string-list">
+        <info><desc>
+          List of context descriptors.  Each context descriptor is a string that contains four comma
+          separated values (note that values are case sensitive):
+          1  Application name. Valid values are
+                 com.sun.star.text.TextDocument or Writer
+                 com.sun.star.sheet.SpreadsheetDocument
+                 com.sun.star.presentation.PresentationDocument
+                 com.sun.star.drawing.DrawingDocument
+             
+             Recognized shortcuts:
+                 Writer
+                 Calc
+                 Impress
+                 Draw
+                 DrawImpress
+             The last one, DrawImpress, exists for convenience because most configuration descriptions for Impress
+             exist in identical form for Draw.
+             
+             Special values:
+                 any
+                 none
+
+          2  Context name
+              Know context names are 3DObject, Annotation, Auditing, Cell, Chart, Draw, DrawPage, DrawText,
+              EditCell, Form, Frame, Graphic, HandoutPage, MasterPage, Media, Multiobj, OLE, OutlineText,
+              Pivot, SlidesorterPage, Table, Text, TextObject,
+              Default
+
+             Special values:
+                 any
+
+          3  Panel state.  One of 
+             expanded  Panel is initially visible and expanded
+             collapsed Panel is initially collapsed, ie only its title bar is visible
+
+          4  (Optional, only used for panels) UNO command that overrides the DefaultMenuCommand.  Use 
+             the special value none to override the DefaultMenuCommand to the empty string and thereby
+             disable the showing of a) the menu button in the panel titlebar and b) the showing of a dialog.
+        </desc></info>
+      </prop>
       <prop oor:name="OrderIndex" oor:type="xs:int">
         <info>
           <desc>Index used for ordering decks in the tab bar.  Smaller values correspond to positions nearer to the top of the tab bar.</desc>
@@ -144,17 +152,18 @@
         </info>
         <value></value>
       </prop>
-      <set oor:name="ContextMatchers" oor:node-type="ContextMatcherType">
-        <info>
-          <desc>One or more context matchers that define when to show the panel.</desc>
-        </info>
-      </set>
-      <prop oor:name="AskPanelForContextMatcher" oor:type="xs:boolean">
+      <prop oor:name="DefaultMenuCommand" oor:type="xs:string">
+        <info><desc>
+          The default UNO command to execute when the user clicks on the menu button in the panel title bar.
+          Can be overriden in the ContextList to provide context dependent menu dialogs.
+          When empty then the menu icon is not shown in the panel title bar.
+        </desc></info>
+        <value></value>
+      </prop>
+      <prop oor:name="ContextList" oor:type="oor:string-list">
         <info>
-          <desc>Sometimes the context matcher in the registry is too simple.  In that case the panel can implement the XSidebarPanel interface and provide a more complex matcher in its isContextSupported() method.  That method is only called when the value of this AsPanel property is set to true.
-          Defaults to false.</desc>
+          <desc>For documentation, please see the Deck/ContextList.</desc>
         </info>
-        <value>false</value>
       </prop>
       <prop oor:name="ImplementationURL" oor:type="xs:string">
         <info>
@@ -162,24 +171,12 @@
         </info>
         <value></value>
       </prop>
-      <prop oor:name="IsExpandedByDefault" oor:type="xs:boolean">
-        <info>
-          <desc>When true then the panel is initialized in its expanded state.</desc>
-        </info>
-        <value>true</value>
-      </prop>
       <prop oor:name="OrderIndex" oor:type="xs:int">
         <info>
           <desc>Index used for ordering panels inside a deck.  Smaller values correspond to positions nearer to the top of the deck.</desc>
         </info>
         <value>10000</value>
       </prop>
-      <prop oor:name="HasMenu" oor:type="xs:boolean">
-        <info>
-          <desc>When true then the panel title bar displays a menu button. When clicked the ui::XSidebarPanel::showmenu() method is called.</desc>
-        </info>
-        <value>false</value>
-      </prop>
       <prop oor:name="WantsCanvas" oor:type="xs:boolean">
         <info>
           <desc>Experimental: Set to true when panel wants to paint its content via a XCanvas.</desc>

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/chartsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/chartsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/chartsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/chartsh.cxx Mon Mar 18 17:14:04 2013
@@ -49,6 +49,7 @@
 #include "drawview.hxx"
 #include "scresid.hxx"
 #include <svx/svdobj.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #define ScChartShell
 #include "scslots.hxx"
@@ -69,6 +70,7 @@ ScChartShell::ScChartShell(ScViewData* p
 {
 	SetHelpId(HID_SCSHELL_CHARTSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ChartObject")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Chart));
 }
 
 ScChartShell::~ScChartShell()
@@ -76,4 +78,8 @@ ScChartShell::~ScChartShell()
 }
 
 
-
+void ScChartShell::HandleSelectionChange (void)
+{
+    // Do not call the implementation in the base class.  Let
+    // Activate()/Deactivate() handle context switches.
+}

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drawsh2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drawsh2.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drawsh2.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drawsh2.cxx Mon Mar 18 17:14:04 2013
@@ -41,6 +41,8 @@
 #include <svx/svdouno.hxx>
 #include <svx/extrusionbar.hxx>
 #include <svx/fontworkbar.hxx>
+#include <svx/sidebar/SelectionChangeHandler.hxx>
+#include <svx/sidebar/SelectionAnalyzer.hxx>
 
 #include "drawsh.hxx"
 #include "drawview.hxx"
@@ -53,15 +55,23 @@
 #include <svx/svdoole2.hxx>
 #include <svx/svdocapt.hxx>
 
+#include <boost/bind.hpp>
+
+
 sal_uInt16 ScGetFontWorkId();		// in drtxtob
 
 using namespace com::sun::star;
 
+
 //------------------------------------------------------------------
 
 ScDrawShell::ScDrawShell( ScViewData* pData ) :
 	SfxShell(pData->GetViewShell()),
-	pViewData( pData )
+	pViewData( pData ),
+    mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
+            ::boost::bind(&ScDrawShell::GetContextForSelection, this),
+            GetFrame()->GetFrame().GetController(),
+            sfx2::sidebar::EnumContext::Context_Cell))
 {
 	SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() );
     ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
@@ -72,10 +82,13 @@ ScDrawShell::ScDrawShell( ScViewData* pD
     }
 	SetHelpId( HID_SCSHELL_DRAWSH );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Drawing")));
+
+    mpSelectionChangeHandler->Connect();
 }
 
 ScDrawShell::~ScDrawShell()
 {
+    mpSelectionChangeHandler->Disconnect();
 }
 
 void ScDrawShell::GetState( SfxItemSet& rSet )			// Zustaende / Toggles
@@ -405,3 +418,9 @@ void ScDrawShell::GetDrawAttrStateForIFB
   		rSet.Put(aNewAttr, sal_False);
   	}
 }
+
+sfx2::sidebar::EnumContext::Context ScDrawShell::GetContextForSelection (void)
+{
+    return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
+        GetDrawView()->GetMarkedObjectList());
+}

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drformsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drformsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drformsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drformsh.cxx Mon Mar 18 17:14:04 2013
@@ -50,6 +50,7 @@
 #include "drawview.hxx"
 #include "scresid.hxx"
 #include <svx/svdobj.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #define ScDrawFormShell
 #include "scslots.hxx"
@@ -69,11 +70,9 @@ ScDrawFormShell::ScDrawFormShell(ScViewD
 {
 	SetHelpId(HID_SCSHELL_DRAWFORMSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("DrawForm")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
 }
 
 ScDrawFormShell::~ScDrawFormShell()
 {
 }
-
-
-

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drtxtob.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drtxtob.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drtxtob.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/drtxtob.cxx Mon Mar 18 17:14:04 2013
@@ -68,6 +68,7 @@
 
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "sc.hrc"
 #include "globstr.hrc"
@@ -132,6 +133,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar
 
 	SetHelpId( HID_SCSHELL_DRTXTOB );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("DrawText")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText));
 }
 
 __EXPORT ScDrawTextObjectBar::~ScDrawTextObjectBar()
@@ -1088,4 +1090,3 @@ void ScDrawTextObjectBar::ExecuteTrans( 
 		}
 	}
 }
-

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/graphsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/graphsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/graphsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/graphsh.cxx Mon Mar 18 17:14:04 2013
@@ -35,6 +35,7 @@
 #include <svx/svdograf.hxx>
 #include <svx/grfflt.hxx>
 #include <svx/grafctrl.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "graphsh.hxx"
 #include "sc.hrc"
@@ -62,6 +63,7 @@ ScGraphicShell::ScGraphicShell(ScViewDat
 {
 	SetHelpId(HID_SCSHELL_GRAPHIC);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("GraphicObject")));
+        SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
 }
 
 ScGraphicShell::~ScGraphicShell()
@@ -141,4 +143,3 @@ void ScGraphicShell::ExecuteFilter( SfxR
 
 	Invalidate();
 }
-

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/mediash.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/mediash.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/mediash.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/mediash.cxx Mon Mar 18 17:14:04 2013
@@ -31,6 +31,7 @@
 #include <svl/whiter.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "mediash.hxx"
 #include "sc.hrc"
@@ -57,6 +58,7 @@ ScMediaShell::ScMediaShell(ScViewData* p
 {
 	SetHelpId(HID_SCSHELL_MEDIA);
 	SetName( String( ScResId( SCSTR_MEDIASHELL ) ) );
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
 }
 
 ScMediaShell::~ScMediaShell()

Modified: openoffice/branches/sidebar/main/sc/source/ui/drawfunc/oleobjsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/drawfunc/oleobjsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/drawfunc/oleobjsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/drawfunc/oleobjsh.cxx Mon Mar 18 17:14:04 2013
@@ -50,6 +50,7 @@
 #include "drawview.hxx"
 #include "scresid.hxx"
 #include <svx/svdobj.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #define ScOleObjectShell
 #include "scslots.hxx"
@@ -69,6 +70,7 @@ ScOleObjectShell::ScOleObjectShell(ScVie
 {
 	SetHelpId(HID_SCSHELL_OLEOBEJCTSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("OleObject")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE));
 }
 
 ScOleObjectShell::~ScOleObjectShell()
@@ -76,4 +78,8 @@ ScOleObjectShell::~ScOleObjectShell()
 }
 
 
-
+void ScOleObjectShell::HandleSelectionChange (void)
+{
+    // Do not call the implementation in the base class.  Let
+    // Activate()/Deactivate() handle context switches.
+}

Modified: openoffice/branches/sidebar/main/sc/source/ui/inc/chartsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/inc/chartsh.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/inc/chartsh.hxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/inc/chartsh.hxx Mon Mar 18 17:14:04 2013
@@ -42,7 +42,7 @@ public:
 
 				ScChartShell(ScViewData* pData);
 	virtual		~ScChartShell();
-
+    virtual void HandleSelectionChange (void);    
 };
 
 #endif

Modified: openoffice/branches/sidebar/main/sc/source/ui/inc/drawsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/inc/drawsh.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/inc/drawsh.hxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/inc/drawsh.hxx Mon Mar 18 17:14:04 2013
@@ -27,16 +27,22 @@
 #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>
 
 class AbstractSvxNameDialog; //CHINA001 class SvxNameDialog;
 class ScViewData;
 class ScDrawView;
+namespace svx { namespace sidebar {
+class SelectionChangeHandler;
+} }
 
 class ScDrawShell : public SfxShell
 {
 	ScViewData*	pViewData;
+    ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler;
 
     DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* );
 
@@ -83,6 +89,7 @@ public:
 	sal_Bool	AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark);
 
     void GetDrawAttrStateForIFBX( SfxItemSet& rSet );
+    ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void);
 };
 
 

Modified: openoffice/branches/sidebar/main/sc/source/ui/inc/drformsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/inc/drformsh.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/inc/drformsh.hxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/inc/drformsh.hxx Mon Mar 18 17:14:04 2013
@@ -43,9 +43,6 @@ public:
 
 				ScDrawFormShell(ScViewData* pData);
 	virtual		~ScDrawFormShell();
-
-//	void		Execute(SfxRequest &);
-//	void		GetState(SfxItemSet &);
 };
 
 #endif

Modified: openoffice/branches/sidebar/main/sc/source/ui/inc/oleobjsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/inc/oleobjsh.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/inc/oleobjsh.hxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/inc/oleobjsh.hxx Mon Mar 18 17:14:04 2013
@@ -43,6 +43,7 @@ public:
 				ScOleObjectShell(ScViewData* pData);
 	virtual		~ScOleObjectShell();
 
+    virtual void HandleSelectionChange (void);
 };
 
 #endif

Modified: openoffice/branches/sidebar/main/sc/source/ui/view/auditsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/view/auditsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/view/auditsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/view/auditsh.cxx Mon Mar 18 17:14:04 2013
@@ -34,6 +34,7 @@
 #include <sfx2/objface.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/request.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "auditsh.hxx"
 #include "tabvwsh.hxx"
@@ -72,6 +73,7 @@ ScAuditingShell::ScAuditingShell(ScViewD
     }
 	SetHelpId( HID_SCSHELL_AUDIT );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Auditing")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Auditing));
 }
 
 //------------------------------------------------------------------------
@@ -147,5 +149,3 @@ void ScAuditingShell::GetState( SfxItemS
 {
 	rSet.Put( SfxBoolItem( nFunction, sal_True ) );			// aktive Funktion markieren
 }
-
-

Modified: openoffice/branches/sidebar/main/sc/source/ui/view/cellsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/view/cellsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/view/cellsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/view/cellsh.cxx Mon Mar 18 17:14:04 2013
@@ -42,7 +42,9 @@
 #include <sfx2/objface.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/clipfmtitem.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <editeng/langitem.hxx>
 
 #include "cellsh.hxx"
@@ -85,6 +87,7 @@ ScCellShell::ScCellShell(ScViewData* pDa
 {
 	SetHelpId(HID_SCSHELL_CELLSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Cell")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Cell));
 }
 
 ScCellShell::~ScCellShell()

Modified: openoffice/branches/sidebar/main/sc/source/ui/view/editsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/view/editsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/view/editsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/view/editsh.cxx Mon Mar 18 17:14:04 2013
@@ -45,6 +45,7 @@
 #include <editeng/flditem.hxx>
 #include <editeng/fontitem.hxx>
 #include <svx/hlnkitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/scripttypeitem.hxx>
 #include <editeng/shdditem.hxx>
@@ -113,6 +114,7 @@ ScEditShell::ScEditShell(EditView* pView
 	SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
 	SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("EditCell")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_EditCell));
 }
 
 ScEditShell::~ScEditShell()
@@ -1202,4 +1204,3 @@ void ScEditShell::ExecuteTrans( SfxReque
 		pHdl->DataChanged();
 	}
 }
-

Modified: openoffice/branches/sidebar/main/sc/source/ui/view/pivotsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sc/source/ui/view/pivotsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sc/source/ui/view/pivotsh.cxx (original)
+++ openoffice/branches/sidebar/main/sc/source/ui/view/pivotsh.cxx Mon Mar 18 17:14:04 2013
@@ -36,6 +36,7 @@
 #include <sfx2/request.hxx>
 #include <svl/whiter.hxx>
 #include <vcl/msgbox.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "sc.hrc"
 #include "pivotsh.hxx"
@@ -80,6 +81,7 @@ ScPivotShell::ScPivotShell( ScTabViewShe
     }
 	SetHelpId( HID_SCSHELL_PIVOTSH );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Pivot")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Pivot));
 }
 
 //------------------------------------------------------------------------
@@ -197,4 +199,3 @@ ScDPObject* ScPivotShell::GetCurrDPObjec
     return rViewData.GetDocument()->GetDPAtCursor(
         rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
 }
-

Modified: openoffice/branches/sidebar/main/sd/source/ui/func/futext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/func/futext.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/func/futext.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/func/futext.cxx Mon Mar 18 17:14:04 2013
@@ -37,7 +37,6 @@
 #include <svl/intitem.hxx>
 #include <svx/svdotext.hxx>
 #include <svx/svdogrp.hxx>
-#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <editeng/flditem.hxx>
 #include <svl/style.hxx>
 #include <svx/svdpagv.hxx>
@@ -49,7 +48,6 @@
 #include <svx/svdoutl.hxx>
 #include <svx/svxids.hrc>
 #include <sfx2/docfile.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <editeng/outlobj.hxx>
 #include <svtools/langtab.hxx>

Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/DrawViewShell.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/DrawViewShell.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/DrawViewShell.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/DrawViewShell.hxx Mon Mar 18 17:14:04 2013
@@ -28,8 +28,10 @@
 #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>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/scanner/XScannerManager.hpp>
 
@@ -431,6 +433,10 @@ private:
     */
     bool mbIsInSwitchPage;
 
+    /** Listen for selection changes and broadcast context changes for the sidebar.
+    */
+    ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler;
+    
 	void Construct (DrawDocShell* pDocSh, PageKind ePageKind);
 
     /** Depending on the given request create a new page or duplicate an
@@ -484,6 +490,8 @@ 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/branches/sidebar/main/sd/source/ui/inc/SlideSorterViewShell.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/SlideSorterViewShell.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/SlideSorterViewShell.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/SlideSorterViewShell.hxx Mon Mar 18 17:14:04 2013
@@ -115,6 +115,7 @@ public:
     virtual void ArrangeGUIElements (void);
 
 	virtual void Activate (sal_Bool IsMDIActivate);
+	virtual void Deactivate (sal_Bool IsMDIActivate);
 
     //===== Drag and Drop =====================================================
 

Modified: openoffice/branches/sidebar/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx Mon Mar 18 17:14:04 2013
@@ -51,6 +51,7 @@
 #include "sdresid.hxx"
 #include "AccessibleSlideSorterView.hxx"
 #include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
 #include "FrameView.hxx"
 #include "SdUnoSlideView.hxx"
 #include "ViewShellManager.hxx"
@@ -62,7 +63,10 @@
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/request.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <svx/svxids.hrc>
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
 #include <com/sun/star/drawing/framework/ResourceId.hpp>
 #include <cppuhelper/bootstrap.hxx>
@@ -77,12 +81,14 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing::framework;
 
 using ::sd::framework::FrameworkHelper;
+using ::sfx2::sidebar::EnumContext;
 
 namespace sd { namespace slidesorter {
 
 
 SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell, SdResId(STR_SLIDESORTERVIEWSHELL))
 {
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 }
 
 
@@ -546,6 +552,50 @@ void SlideSorterViewShell::Activate (sal
     ViewShell::Activate(bIsMDIActivate);
     if (mbIsArrangeGUIElementsPending)
         ArrangeGUIElements();
+
+    // Determine and broadcast the context that belongs to the main view shell.
+    EnumContext::Context eContext = EnumContext::Context_Unknown;
+    ::boost::shared_ptr<ViewShell> pMainViewShell (GetViewShellBase().GetMainViewShell());
+	ViewShell::ShellType eMainViewShellType (
+        pMainViewShell
+            ? pMainViewShell->GetShellType()
+            : ViewShell::ST_NONE);
+	switch (eMainViewShellType)
+	{
+		case ViewShell::ST_IMPRESS:
+            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;
+            }
+			break;
+            
+		case ViewShell::ST_SLIDE_SORTER:
+			eContext = EnumContext::Context_SlidesorterPage;
+			break;
+            
+		case ViewShell::ST_NOTES:
+			eContext = EnumContext::Context_NotesPage;
+			break;
+            
+		default:
+			break;
+	}
+    ContextChangeEventMultiplexer::NotifyContextChange(
+        &GetViewShellBase(),
+        eContext);
+}
+
+
+
+
+void SlideSorterViewShell::Deactivate (sal_Bool bIsMDIActivate)
+{
+    ContextChangeEventMultiplexer::NotifyContextChange(
+        &GetViewShellBase(),
+        EnumContext::Context_Default);
 }
 
 

Modified: openoffice/branches/sidebar/main/sd/source/ui/table/tableobjectbar.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/table/tableobjectbar.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/table/tableobjectbar.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/table/tableobjectbar.cxx Mon Mar 18 17:14:04 2013
@@ -32,6 +32,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/msgpool.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <svl/itempool.hxx>
 #include <svx/svdomedia.hxx>
@@ -104,6 +105,7 @@ TableObjectBar::TableObjectBar( ViewShel
 	SetRepeatTarget( mpView );
 	SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR );
 	SetName( String( SdResId( RID_DRAW_TABLE_TOOLBOX ) ) );
+    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
 }
 
 // -----------------------------------------------------------------------------

Modified: openoffice/branches/sidebar/main/sd/source/ui/view/ViewShellBase.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/view/ViewShellBase.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/view/ViewShellBase.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/view/ViewShellBase.cxx Mon Mar 18 17:14:04 2013
@@ -41,7 +41,6 @@
 #include "glob.hrc"
 #include "unokywds.hxx"
 #include <svx/svxids.hrc>
-#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include "DrawDocShell.hxx"
 #include <sfx2/app.hxx>
 #include "PaneChildWindows.hxx"
@@ -85,7 +84,6 @@
 #include <sfx2/msg.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/viewfrm.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <comphelper/processfactory.hxx>
 #include <vcl/msgbox.hxx>
@@ -856,10 +854,6 @@ void ViewShellBase::Activate (sal_Bool b
             xConfigurationController->update();
     }
     GetToolBarManager()->RequestUpdate();
-
-    ContextChangeEventMultiplexer::NotifyContextChange(
-        GetController(),
-        ::sfx2::sidebar::EnumContext::Context_Default);
 }
 
 

Modified: openoffice/branches/sidebar/main/sd/source/ui/view/drviewsa.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/view/drviewsa.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/view/drviewsa.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/view/drviewsa.cxx Mon Mar 18 17:14:04 2013
@@ -57,6 +57,7 @@
 #include <sfx2/dispatch.hxx>
 #include <svtools/cliplistener.hxx>
 #include <svx/float3d.hxx>
+#include <svx/sidebar/SelectionAnalyzer.hxx>
 #include "helpids.h"
 
 #include "view/viewoverlaymanager.hxx"
@@ -80,9 +81,12 @@
 #include "ToolBarManager.hxx"
 #include "annotationmanager.hxx"
 
+#include <boost/bind.hpp>
+
 using namespace ::rtl;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
+using sfx2::sidebar::EnumContext;
 
 namespace {
 static const ::rtl::OUString MASTER_VIEW_TOOL_BAR_NAME(
@@ -137,13 +141,20 @@ void SAL_CALL ScannerEventListener::disp
 DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument )
 : ViewShell (pFrame, pParentWindow, rViewShellBase)
 , maTabControl(this, pParentWindow)
-, mbIsInSwitchPage(false)
+, mbIsInSwitchPage(false),
+  mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
+          ::boost::bind(&DrawViewShell::GetContextForSelection, this),
+          uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
+          sfx2::sidebar::EnumContext::Context_Default))
+          
 {
 	if (pFrameViewArgument != NULL)
 		mpFrameView = pFrameViewArgument;
 	else
         mpFrameView = new FrameView(GetDoc());
     Construct(GetDocSh(), ePageKind);
+
+    mpSelectionChangeHandler->Connect();
 }
 
 /*************************************************************************
@@ -154,6 +165,8 @@ DrawViewShell::DrawViewShell( SfxViewFra
 
 DrawViewShell::~DrawViewShell()
 {
+    mpSelectionChangeHandler->Disconnect();
+    
     mpAnnotationManager.reset();
     mpViewOverlayManager.reset();
    
@@ -853,4 +866,20 @@ void DrawViewShell::GetAnnotationState (
 }
 
 
+EnumContext::Context DrawViewShell::GetContextForSelection (void) const
+{
+    if (mpDrawView->GetMarkedObjectList().GetMarkCount() == 1)
+        if (mpDrawView->GetTextEditObject() != NULL)
+            if (mpDrawView->GetTextEditOutlinerView() != NULL)
+				return EnumContext::Context_DrawText;
+
+    // All other cases are handled by the SelectionAnalyzer.
+    return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD(
+        mpDrawView->GetMarkedObjectList(),
+        meEditMode == EM_MASTERPAGE,
+        mePageKind == PK_HANDOUT,
+        mePageKind == PK_NOTES);
+}
+
+
 } // end of namespace sd

Modified: openoffice/branches/sidebar/main/sd/source/ui/view/outlnvsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/view/outlnvsh.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/view/outlnvsh.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/view/outlnvsh.cxx Mon Mar 18 17:14:04 2013
@@ -53,6 +53,7 @@
 #include <svl/itempool.hxx>
 #include <sfx2/tplpitem.hxx>
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/svdorect.hxx>
 #include <sot/formats.hxx>
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
@@ -232,6 +233,8 @@ OutlineViewShell::OutlineViewShell (
 	mpFrameView->Connect();
 
 	Construct(GetDocSh());
+
+    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText));
 }
 
 /*************************************************************************

Modified: openoffice/branches/sidebar/main/sd/source/ui/view/sdview.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/view/sdview.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/view/sdview.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/view/sdview.cxx Mon Mar 18 17:14:04 2013
@@ -51,6 +51,7 @@
 
 #include <svx/dialogs.hrc>
 #include <sfx2/viewfrm.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/svdopage.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <svx/xlndsit.hxx>
@@ -777,8 +778,8 @@ sal_Bool View::SdrBeginTextEdit(
 		bOnlyOneView, bGrabFocus);
 
     ContextChangeEventMultiplexer::NotifyContextChange(
-        GetViewShell()->GetViewShellBase().GetController(),
-        ::sfx2::sidebar::EnumContext::Context_Text);
+        &GetViewShell()->GetViewShellBase(),
+        ::sfx2::sidebar::EnumContext::Context_DrawText);
 
 	if (bReturn)
 	{
@@ -843,13 +844,14 @@ SdrEndTextEditKind View::SdrEndTextEdit(
 	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
         sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT,
         (void*)xObj.get() );
-    ContextChangeEventMultiplexer::NotifyContextChange(
-        GetViewShell()->GetViewShellBase().GetController(),
-        ::sfx2::sidebar::EnumContext::Context_Default);
 
 	if( xObj.is() )
 	{
-		SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
+        ContextChangeEventMultiplexer::NotifyContextChange(
+            &GetViewShell()->GetViewShellBase(),
+            ::sfx2::sidebar::EnumContext::Context_Default);
+
+        SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
 		if( pPage )
 			pPage->onEndTextEdit( xObj.get() );
 	}

Modified: openoffice/branches/sidebar/main/sfx2/Library_sfx.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/Library_sfx.mk?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/Library_sfx.mk (original)
+++ openoffice/branches/sidebar/main/sfx2/Library_sfx.mk Mon Mar 18 17:14:04 2013
@@ -220,11 +220,11 @@ $(eval $(call gb_Library_add_exception_o
 	sfx2/source/sidebar/SidebarToolBox \
 	sfx2/source/sidebar/AsynchronousCall \
 	sfx2/source/sidebar/Context \
-	sfx2/source/sidebar/ContextMatcher \
+	sfx2/source/sidebar/ContextChangeBroadcaster \
+	sfx2/source/sidebar/ContextList \
 	sfx2/source/sidebar/ControlFactory \
 	sfx2/source/sidebar/ControllerItem \
 	sfx2/source/sidebar/Deck \
-	sfx2/source/sidebar/DeckConfiguration \
 	sfx2/source/sidebar/DeckDescriptor \
 	sfx2/source/sidebar/DeckLayouter \
 	sfx2/source/sidebar/DeckTitleBar \

Modified: openoffice/branches/sidebar/main/sfx2/Package_inc.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/Package_inc.mk?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/Package_inc.mk (original)
+++ openoffice/branches/sidebar/main/sfx2/Package_inc.mk Mon Mar 18 17:14:04 2013
@@ -139,4 +139,5 @@ $(eval $(call gb_Package_add_file,sfx2_i
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControlFactory.hxx,sfx2/sidebar/ControlFactory.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Theme.hxx,sfx2/sidebar/Theme.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ILayoutableWindow.hxx,sfx2/sidebar/ILayoutableWindow.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/IContextChangeReceiver.hxx,sfx2/sidebar/IContextChangeReceiver.hxx))
 

Modified: openoffice/branches/sidebar/main/sfx2/inc/sfx2/shell.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/inc/sfx2/shell.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/inc/sfx2/shell.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/inc/sfx2/shell.hxx Mon Mar 18 17:14:04 2013
@@ -254,6 +254,8 @@ public:
     virtual SfxItemSet*         CreateItemSet( sal_uInt16 nId );
     virtual void                ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
 
+    void                        SetContextName (const ::rtl::OUString& rsContextName);
+    
 #ifndef _SFXSH_HXX
     SAL_DLLPRIVATE bool     CanExecuteSlot_Impl( const SfxSlot &rSlot );
     SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);

Added: openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx?rev=1457873&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx (added)
+++ openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx Mon Mar 18 17:14:04 2013
@@ -0,0 +1,62 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX
+#define SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+
+/** This class is a helper for broadcasting context changes that are
+    tied to shells being activated or deactivated.
+*/
+class ContextChangeBroadcaster
+{
+public:
+    ContextChangeBroadcaster (void);
+    ~ContextChangeBroadcaster (void);
+
+    void Initialize (const ::rtl::OUString& rsContextName);
+
+    void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame);
+    void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+private:
+    rtl::OUString msContextName;
+    bool mbIsContextActive;
+
+    void BroadcastContextChange (
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        const ::rtl::OUString& rsModuleName,
+        const ::rtl::OUString& rsContextName);
+    ::rtl::OUString GetModuleName (
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif

Modified: openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx Mon Mar 18 17:14:04 2013
@@ -41,34 +41,46 @@ public:
         Application_Draw,
         Application_Impress,
 
+        // For your convenience to avoid duplicate code in the common
+        // case that Draw and Impress use identical context configurations.
+        Application_DrawImpress,
+
         // Used only by deck or panel descriptors.  Matches any
         // application.
         Application_Any,
 
-        Application_Unknown,
+        // Use this only in special circumstances.  One might be the
+        // wish to disable a deck or panel during debugging.
+        Application_None,
 
-        __LastApplicationEnum = Application_Unknown
+        __LastApplicationEnum = Application_None
     };
     enum Context
     {
+        Context_3DObject,
         Context_Annotation,
+        Context_Auditing,
         Context_Cell,
-        Context_EditCell,
+        Context_Chart,
         Context_Draw,
+        Context_DrawPage,
         Context_DrawText,
+        Context_EditCell,
+        Context_Form,
+        Context_Frame,
         Context_Graphic,
+        Context_HandoutPage,
+        Context_MasterPage,
+        Context_Media,
+        Context_MultiObject,
+        Context_NotesPage,
+        Context_OLE,
         Context_OutlineText,
         Context_Pivot,
+        Context_SlidesorterPage,
         Context_Table,
         Context_Text,
         Context_TextObject,
-        Context_OLE,
-        Context_Media,
-        Context_Frame,
-        Context_Form,
-        Context_Chart,
-        Context_Multiobj,
-        Context_3DObj,
 
         // Default context of an application.  Do we need this?
         Context_Default,
@@ -88,8 +100,19 @@ public:
     EnumContext (
         const ::rtl::OUString& rsApplicationName,
         const ::rtl::OUString& rsContextName);
-    
+
+    /** Return a number that encodes both the application and context
+        enums.
+        Use the CombinedEnumContext macro in switch() statements and comparisons.
+    */
     sal_Int32 GetCombinedContext(void) const;
+
+    /** This variant of the GetCombinedContext() method returns a
+        single value for both Draw and Impress application.
+        Use the Application_DrawImpress value in the CombinedEnumContext macro.
+    */
+    sal_Int32 GetCombinedContext_DI(void) const;
+
     const ::rtl::OUString& GetApplicationName (void) const;
     const ::rtl::OUString& GetContextName (void) const;
 

Added: openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx?rev=1457873&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx (added)
+++ openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx Mon Mar 18 17:14:04 2013
@@ -0,0 +1,40 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_CONTEXT_CHANGE_RECEIVER_INTERFACE_HXX
+#define SFX_SIDEBAR_CONTEXT_CHANGE_RECEIVER_INTERFACE_HXX
+
+#include "EnumContext.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+
+class SFX2_DLLPUBLIC IContextChangeReceiver
+{
+public:
+    virtual void HandleContextChange (
+        const EnumContext aContext) = 0;
+};
+
+} } // end of namespace ::sd::sidebar
+
+#endif

Modified: openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx Mon Mar 18 17:14:04 2013
@@ -64,13 +64,6 @@ class SFX2_DLLPUBLIC SidebarPanelBase
       public SidebarPanelBaseInterfaceBase
 {
 public:
-    class ContextChangeReceiverInterface
-    {
-      public:
-        virtual void HandleContextChange (
-            const EnumContext aContext) = 0;
-    };
-    
     static cssu::Reference<css::ui::XUIElement> Create (
         const ::rtl::OUString& rsResourceURL,
         const cssu::Reference<css::frame::XFrame>& rxFrame,

Modified: openoffice/branches/sidebar/main/sfx2/source/control/shell.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/control/shell.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/control/shell.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/control/shell.cxx Mon Mar 18 17:14:04 2013
@@ -51,6 +51,7 @@
 #include <sfx2/mnumgr.hxx>
 #include "statcach.hxx"
 #include <sfx2/msgpool.hxx>
+#include <sfx2/sidebar/ContextChangeBroadcaster.hxx>
 
 //====================================================================
 
@@ -86,6 +87,8 @@ struct SfxShell_Impl: public SfxBroadcas
     svtools::AsynchronLink*     pUpdater;
     SfxVerbSlotArr_Impl         aSlotArr;
     com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbList;
+    ::sfx2::sidebar::ContextChangeBroadcaster maContextChangeBroadcaster;
+
 	SfxShell_Impl()  : pExecuter( 0 ), pUpdater( 0 ) {}
 	~SfxShell_Impl() { delete pExecuter; delete pUpdater;}
 };
@@ -189,6 +192,8 @@ SfxShell::~SfxShell()
 
 {
 	DBG_DTOR(SfxShell, 0);
+
+    
 	delete pImp;
 }
 
@@ -764,6 +769,9 @@ void SfxShell::Activate
 */
 
 {
+    SfxViewFrame* pViewFrame = GetFrame();
+    if (pViewFrame != NULL)
+        pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
 }
 
 //--------------------------------------------------------------------
@@ -797,6 +805,9 @@ void SfxShell::Deactivate
 */
 
 {
+    SfxViewFrame* pViewFrame = GetFrame();
+    if (pViewFrame != NULL)
+        pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
 }
 
 void SfxShell::ParentActivate
@@ -1275,6 +1286,11 @@ void SfxShell::ApplyItemSet( sal_uInt16,
 {
 }
 
+void SfxShell::SetContextName (const ::rtl::OUString& rsContextName)
+{
+    pImp->maContextChangeBroadcaster.Initialize(rsContextName);
+}
+
 void SfxShell::SetViewShell_Impl( SfxViewShell* pView )
 {
     pImp->pViewSh = pView;

Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx?rev=1457873&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx Mon Mar 18 17:14:04 2013
@@ -0,0 +1,137 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "sfx2/sidebar/ContextChangeBroadcaster.hxx"
+#include "sfx2/sidebar/EnumContext.hxx"
+#include <com/sun/star/ui/ContextChangeEventObject.hpp>
+#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+
+
+using ::rtl::OUString;
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+
+ContextChangeBroadcaster::ContextChangeBroadcaster (void)
+    : msContextName(),
+      mbIsContextActive(false)
+{
+}
+
+
+
+ContextChangeBroadcaster::~ContextChangeBroadcaster (void)
+{
+}
+
+
+
+
+void ContextChangeBroadcaster::Initialize (const ::rtl::OUString& rsContextName)
+{
+    OSL_ASSERT( ! mbIsContextActive);
+    
+    msContextName = rsContextName;
+}
+
+
+
+
+void ContextChangeBroadcaster::Activate (const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    if (msContextName.getLength() > 0)
+        BroadcastContextChange(rxFrame, GetModuleName(rxFrame), msContextName);
+}
+
+
+
+
+void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    if (msContextName.getLength() > 0)
+    {
+        BroadcastContextChange(
+            rxFrame,
+            GetModuleName(rxFrame),
+            EnumContext::GetContextName(EnumContext::Context_Default));
+    }
+}
+
+
+
+
+void ContextChangeBroadcaster::BroadcastContextChange (
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    const ::rtl::OUString& rsModuleName,
+    const ::rtl::OUString& rsContextName)
+{
+    if (rsContextName.getLength() == 0)
+        return;
+    
+    if ( ! rxFrame.is())
+    {
+        OSL_ENSURE(false, "Activate called with invalid frame");
+        return;
+    }
+    
+    const css::ui::ContextChangeEventObject aEvent(
+        rxFrame->getController(),
+        rsModuleName,
+        rsContextName);
+    
+    cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+        css::ui::ContextChangeEventMultiplexer::get(
+            ::comphelper::getProcessComponentContext()));
+    if (xMultiplexer.is())
+        xMultiplexer->broadcastContextChangeEvent(aEvent, rxFrame->getController());
+}
+
+
+
+
+OUString ContextChangeBroadcaster::GetModuleName (const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    OUString sModuleName;
+    try
+    {
+        const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+        const Reference<frame::XModuleManager> xModuleManager (
+            aContext.createComponent("com.sun.star.frame.ModuleManager" ),
+            UNO_QUERY_THROW );
+        return xModuleManager->identify(rxFrame);
+    }
+    catch (const Exception&)
+    {
+        OSL_ENSURE(false, "can not determine module name");
+    }
+    return OUString();
+}
+
+
+
+} } // end of namespace ::sd::sidebar

Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.cxx?rev=1457873&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.cxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.cxx Mon Mar 18 17:14:04 2013
@@ -0,0 +1,111 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "ContextList.hxx"
+#include "Context.hxx"
+
+using ::rtl::OUString;
+
+namespace sfx2 { namespace sidebar {
+
+namespace {
+    static const sal_Char* gsAny = "any";
+}
+
+
+
+ContextList::ContextList (void)
+    : maEntries()
+{
+}
+
+
+
+
+ContextList::~ContextList (void)
+{
+}
+
+
+
+
+const ContextList::Entry* ContextList::GetMatch (const Context& rContext) const
+{
+    const ::std::vector<Entry>::const_iterator iEntry = FindBestMatch(rContext);
+    if (iEntry != maEntries.end())
+        return &*iEntry;
+    else
+        return NULL;
+}
+
+
+
+
+::std::vector<ContextList::Entry>::const_iterator ContextList::FindBestMatch (const Context& rContext) const
+{
+    sal_Int32 nBestMatch (Context::NoMatch);
+    ::std::vector<Entry>::const_iterator iBestMatch (maEntries.end());
+    
+    for (::std::vector<Entry>::const_iterator
+             iEntry(maEntries.begin()),
+             iEnd(maEntries.end());
+         iEntry!=iEnd;
+         ++iEntry)
+    {
+        const sal_Int32 nMatch (rContext.EvaluateMatch(iEntry->maContext));
+        if (nMatch < nBestMatch)
+        {
+            nBestMatch = nMatch;
+            iBestMatch = iEntry;
+        }
+        if (nBestMatch == Context::OptimalMatch)
+            return iEntry;
+    }
+
+    return iBestMatch;
+}
+
+
+
+
+void ContextList::AddContextDescription (
+    const Context& rContext,
+    const bool bIsInitiallyVisible,
+    const OUString& rsMenuCommand)
+{
+    maEntries.push_back(Entry());
+    maEntries.back().maContext = rContext;
+    maEntries.back().mbIsInitiallyVisible = bIsInitiallyVisible;
+    maEntries.back().msMenuCommand = rsMenuCommand;
+}
+
+
+
+
+bool ContextList::IsEmpty (void)
+{
+    return maEntries.empty();
+}
+
+
+} } // end of namespace sfx2::sidebar

Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.hxx?rev=1457873&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.hxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ContextList.hxx Mon Mar 18 17:14:04 2013
@@ -0,0 +1,73 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_CONTEXT_LIST_HXX
+#define SFX_SIDEBAR_CONTEXT_LIST_HXX
+
+#include "Context.hxx"
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+
+namespace sfx2 { namespace sidebar {
+
+
+class ContextList
+{
+public:
+    ContextList (void);
+    ~ContextList (void);
+
+    class Entry
+    {
+    public:
+        Context maContext;
+        bool mbIsInitiallyVisible;
+        ::rtl::OUString msMenuCommand;
+    };
+
+    /** Return <TRUE/> when the given context matches any of the stored contexts.
+    */
+    const Entry* GetMatch (
+        const Context& rContext) const;
+
+    void AddContextDescription (
+        const Context& rContext,
+        const bool bIsInitiallyVisible,
+        const ::rtl::OUString& rsMenuCommand);
+
+    /** Returns <TRUE/> when no call to AddContextDescription() was made before.
+    */
+    bool IsEmpty (void);
+    
+    
+private:
+    ::std::vector<Entry> maEntries;
+
+    ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.cxx Mon Mar 18 17:14:04 2013
@@ -91,6 +91,11 @@ Deck::~Deck (void)
 {
     OSL_TRACE("destroying Deck at %x", this);
     Dispose();
+
+    // We have to explicitly trigger the destruction of panels.
+    // Otherwise that is done by one of our base class destructors
+    // without updating maPanels.  
+    maPanels.clear();
 }
 
 
@@ -98,16 +103,21 @@ Deck::~Deck (void)
 
 void Deck::Dispose (void)
 {
-    PanelContainer aPanels;
+    SharedPanelContainer aPanels;
     aPanels.swap(maPanels);
-    for (PanelContainer::const_iterator
+    for (SharedPanelContainer::iterator
              iPanel(aPanels.begin()),
              iEnd(aPanels.end());
          iPanel!=iEnd;
          ++iPanel)
     {
-		if (*iPanel != NULL)
+		if (*iPanel)
+        {
 			(*iPanel)->Dispose();
+            OSL_ASSERT(iPanel->unique());
+            OSL_TRACE("panel has %d references", iPanel->use_count());
+            iPanel->reset();
+        }
     }
 
     mpTitleBar.reset();
@@ -211,16 +221,9 @@ void Deck::DataChanged (const DataChange
 
 
 
-void Deck::SetPanels (const ::std::vector<Panel*>& rPanels)
+void Deck::SetPanels (const SharedPanelContainer& rPanels)
 {
-    maPanels.clear();
-    maPanels.reserve(rPanels.size());
-    for (::std::vector<Panel*>::const_iterator iPanel(rPanels.begin()),iEnd(rPanels.end());
-         iPanel!=iEnd;
-         ++iPanel)
-    {
-        maPanels.push_back(*iPanel);
-    }
+    maPanels = rPanels;
 
     RequestLayout();
 }
@@ -228,6 +231,14 @@ void Deck::SetPanels (const ::std::vecto
 
 
 
+const SharedPanelContainer& Deck::GetPanels (void) const
+{
+    return maPanels;
+}
+
+
+
+
 void Deck::RequestLayout (void)
 {
     PrintWindowTree();

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Deck.hxx Mon Mar 18 17:14:04 2013
@@ -22,8 +22,10 @@
 #ifndef SFX_SIDEBAR_DECK_HXX
 #define SFX_SIDEBAR_DECK_HXX
 
-#include "vcl/window.hxx"
-#include "vcl/image.hxx"
+#include "Panel.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/image.hxx>
 #include <com/sun/star/ui/LayoutSize.hpp>
 
 #include <boost/function.hpp>
@@ -36,7 +38,6 @@ namespace css = ::com::sun::star;
 namespace sfx2 { namespace sidebar {
 
 class DeckDescriptor;
-class Panel;
 class DeckTitleBar;
 
 
@@ -59,7 +60,8 @@ public:
     DeckTitleBar* GetTitleBar (void) const;
     Rectangle GetContentArea (void) const;
     ::rtl::OUString GetIconURL (const bool bIsHighContrastModeActive) const;
-    void SetPanels (const ::std::vector<Panel*>& rPanels);
+    void SetPanels (const SharedPanelContainer& rPanels);
+    const SharedPanelContainer& GetPanels (void) const;
     void RequestLayout (void);
     ::Window* GetPanelParentWindow (void);
     
@@ -87,8 +89,7 @@ private:
     Image maIcon;
     const ::rtl::OUString msIconURL;
     const ::rtl::OUString msHighContrastIconURL;
-    typedef ::std::vector<Panel*> PanelContainer;
-    PanelContainer maPanels;
+    SharedPanelContainer maPanels;
     ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
     ::boost::scoped_ptr<Window> mpScrollClipWindow;
     ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.cxx Mon Mar 18 17:14:04 2013
@@ -32,7 +32,7 @@ DeckDescriptor::DeckDescriptor (void)
       msHighContrastIconURL(),
       msHelpURL(),
       msHelpText(),
-      maContextMatcher(),
+      maContextList(),
       mnOrderIndex(10000) // Default value as defined in Sidebar.xcs
 {
 }
@@ -47,7 +47,7 @@ DeckDescriptor::DeckDescriptor (const De
       msHighContrastIconURL(rOther.msHighContrastIconURL),
       msHelpURL(rOther.msHelpURL),
       msHelpText(rOther.msHelpText),
-      maContextMatcher(rOther.maContextMatcher),
+      maContextList(rOther.maContextList),
       mnOrderIndex(rOther.mnOrderIndex)
 {
 }

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckDescriptor.hxx Mon Mar 18 17:14:04 2013
@@ -23,7 +23,7 @@
 #define SFX_SIDEBAR_DECK_DESCRIPTOR_HXX
 
 #include "sfx2/sidebar/EnumContext.hxx"
-#include "ContextMatcher.hxx"
+#include "ContextList.hxx"
 #include <boost/shared_ptr.hpp>
 
 
@@ -38,7 +38,7 @@ public:
     ::rtl::OUString msHighContrastIconURL;
     ::rtl::OUString msHelpURL;
     ::rtl::OUString msHelpText;
-    ContextMatcher maContextMatcher;
+    ContextList maContextList;
     bool mbIsEnabled;
     sal_Int32 mnOrderIndex;
     

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.cxx Mon Mar 18 17:14:04 2013
@@ -52,7 +52,7 @@ namespace {
 
 void DeckLayouter::LayoutDeck (
     const Rectangle aContentArea,
-    ::std::vector<Panel*>& rPanels,
+    SharedPanelContainer& rPanels,
     Window& rDeckTitleBar,
     Window& rScrollClipWindow,
     Window& rScrollContainer,

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/DeckLayouter.hxx Mon Mar 18 17:14:04 2013
@@ -22,6 +22,8 @@
 #ifndef SFX_SIDEBAR_DECK_LAYOUTER_HXX
 #define SFX_SIDEBAR_DECK_LAYOUTER_HXX
 
+#include "Panel.hxx"
+
 #include <tools/gen.hxx>
 
 #include <com/sun/star/ui/LayoutSize.hpp>
@@ -46,7 +48,7 @@ class DeckLayouter
 public:
     static void LayoutDeck (
         const Rectangle aContentArea,
-        ::std::vector<Panel*>& rPanels,
+        SharedPanelContainer& rPanels,
         Window& pDeckTitleBar,
         Window& pScrollClipWindow,
         Window& pScrollContainer,
@@ -67,13 +69,13 @@ private:
     class LayoutItem
     {
     public:
-        Panel* mpPanel;
+        SharedPanel mpPanel;
         css::ui::LayoutSize maLayoutSize;
         sal_Int32 mnDistributedHeight;
         sal_Int32 mnWeight;
         sal_Int32 mnPanelIndex;
         
-        LayoutItem (void) : mpPanel(NULL),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mnPanelIndex(0) {}
+        LayoutItem (void) : mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mnPanelIndex(0) {}
     };
     static Rectangle LayoutPanels (
         const Rectangle aContentArea,

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/EnumContext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/EnumContext.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/EnumContext.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/EnumContext.cxx Mon Mar 18 17:14:04 2013
@@ -48,7 +48,7 @@ const sal_Int32 EnumContext::OptimalMatc
 
 
 EnumContext::EnumContext (void)
-    : meApplication(Application_Unknown),
+    : meApplication(Application_None),
       meContext(Context_Unknown)
 {
 }
@@ -78,7 +78,7 @@ EnumContext::EnumContext (
 
 
 
-sal_Int32 EnumContext::GetCombinedContext(void) const
+sal_Int32 EnumContext::GetCombinedContext (void) const
 {
     return CombinedEnumContext(meApplication, meContext);
 }
@@ -86,6 +86,22 @@ sal_Int32 EnumContext::GetCombinedContex
 
 
 
+sal_Int32 EnumContext::GetCombinedContext_DI (void) const
+{
+    switch (meApplication)
+    {
+        case Application_Draw:
+        case Application_Impress:
+            return CombinedEnumContext(Application_DrawImpress, meContext);
+            
+        default:
+            return CombinedEnumContext(meApplication, meContext);
+    }
+}
+
+
+
+
 const ::rtl::OUString& EnumContext::GetApplicationName (void) const
 {
     return EnumContext::GetApplicationName(meApplication);
@@ -141,8 +157,9 @@ void EnumContext::ProvideApplicationCont
         AddEntry(A2S("com.sun.star.sheet.SpreadsheetDocument"), EnumContext::Application_Calc);
         AddEntry(A2S("com.sun.star.drawing.DrawingDocument"), EnumContext::Application_Draw);
         AddEntry(A2S("com.sun.star.presentation.PresentationDocument"), EnumContext::Application_Impress);
+
         AddEntry(A2S("any"), EnumContext::Application_Any);
-        AddEntry(A2S("unknown"), EnumContext::Application_Unknown);
+        AddEntry(A2S("none"), EnumContext::Application_None);
     }
 }
 
@@ -158,7 +175,7 @@ EnumContext::Application EnumContext::Ge
     if (iApplication != maApplicationMap.end())
         return iApplication->second;
     else
-        return EnumContext::Application_Unknown;
+        return EnumContext::Application_None;
 }
 
 
@@ -170,7 +187,7 @@ const ::rtl::OUString& EnumContext::GetA
 
     const sal_Int32 nIndex (eApplication);
     if (nIndex<0 || nIndex>= __LastApplicationEnum)
-        return maApplicationVector[Application_Unknown];
+        return maApplicationVector[Application_None];
     else
         return maApplicationVector[nIndex];
 }
@@ -184,7 +201,7 @@ void EnumContext::AddEntry (const ::rtl:
     OSL_ASSERT(eApplication<=__LastContextEnum);
     if (maContextVector.size() <= size_t(eApplication))
         maContextVector.resize(eApplication+1);
-    maContextVector[eApplication]=rsName;
+    maContextVector[eApplication] = rsName;
 }
 
 
@@ -195,9 +212,35 @@ void EnumContext::ProvideContextContaine
     if (maContextMap.empty())
     {
         maContextVector.resize(static_cast<size_t>(__LastContextEnum)+1);
-        AddEntry(A2S("text"), Context_Text);
         AddEntry(A2S("any"), Context_Any);
         AddEntry(A2S("default"), Context_Default);
+#define AddContext(context) AddEntry(A2S(#context), Context_##context);
+        AddContext(3DObject);
+        AddContext(Annotation);
+        AddContext(Auditing);
+        AddContext(Cell);
+        AddContext(Chart);
+        AddContext(Chart);
+        AddContext(Draw);
+        AddContext(DrawPage);
+        AddContext(DrawText);
+        AddContext(EditCell);
+        AddContext(Form);
+        AddContext(Frame);
+        AddContext(Graphic);
+        AddContext(HandoutPage);
+        AddContext(MasterPage);
+        AddContext(Media);
+        AddContext(MultiObject);
+        AddContext(NotesPage);
+        AddContext(OLE);
+        AddContext(OutlineText);
+        AddContext(Pivot);
+        AddContext(SlidesorterPage);
+        AddContext(Table);
+        AddContext(Text);
+        AddContext(TextObject);
+#undef AddContext
     }
 }
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.cxx Mon Mar 18 17:14:04 2013
@@ -45,9 +45,6 @@
 using namespace css;
 using namespace cssu;
 
-namespace {
-    static const char* VerticalStackLayouterName("vertical-stack");
-}
 
 
 namespace sfx2 { namespace sidebar {
@@ -55,16 +52,15 @@ namespace sfx2 { namespace sidebar {
 Panel::Panel (
     const PanelDescriptor& rPanelDescriptor,
     Window* pParentWindow,
-    const ::boost::function<void(void)>& rDeckLayoutTrigger)
+    const ::boost::function<void(void)>& rDeckLayoutTrigger,
+    const ::boost::function<void(void)>& rShowMenuFunctor)
     : Window(pParentWindow),
       msPanelId(rPanelDescriptor.msId),
       mpTitleBar(new PanelTitleBar(
               rPanelDescriptor.msTitle,
               pParentWindow,
               this,
-              rPanelDescriptor.mbHasMenu
-                  ? ::boost::bind(&Panel::ShowMenu, this)
-                  : ::boost::function<void(void)>())),
+              rShowMenuFunctor)),
       mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional),
       mxElement(),
       mxPanelComponent(),
@@ -251,6 +247,7 @@ void Panel::ShowMenu (void)
 
 
 
+
 void Panel::PrintWindowTree (void)
 {
 #ifdef DEBUG

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Panel.hxx Mon Mar 18 17:14:04 2013
@@ -29,6 +29,8 @@
 
 #include <boost/function.hpp>
 #include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <vector>
 
 namespace css = ::com::sun::star;
 namespace cssu = ::com::sun::star::uno;
@@ -46,7 +48,8 @@ public:
     Panel (
         const PanelDescriptor& rPanelDescriptor,
         Window* pParentWindow,
-        const ::boost::function<void(void)>& rDeckLayoutTrigger);
+        const ::boost::function<void(void)>& rDeckLayoutTrigger,
+        const ::boost::function<void(void)>& rShowMenuFunctor);
     virtual ~Panel (void);
 
     void Dispose (void);
@@ -80,7 +83,8 @@ private:
     void ShowMenu (void);
     cssu::Reference<css::awt::XWindow> GetElementWindow (void);
 };
-
+typedef ::boost::shared_ptr<Panel> SharedPanel;
+typedef ::std::vector<SharedPanel> SharedPanelContainer;
     
 
 } } // end of namespace sfx2::sidebar

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.cxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.cxx Mon Mar 18 17:14:04 2013
@@ -32,10 +32,9 @@ PanelDescriptor::PanelDescriptor (void)
       msId(),
       msDeckId(),
       msHelpURL(),
-      maContextMatcher(),
+      maContextList(),
       msImplementationURL(),
       mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
-      mbHasMenu(false),
       mbWantsCanvas(false)
 {
 }
@@ -49,10 +48,9 @@ PanelDescriptor::PanelDescriptor (const 
       msId(rOther.msId),
       msDeckId(rOther.msDeckId),
       msHelpURL(rOther.msHelpURL),
-      maContextMatcher(rOther.maContextMatcher),
+      maContextList(rOther.maContextList),
       msImplementationURL(rOther.msImplementationURL),
       mnOrderIndex(rOther.mnOrderIndex),
-      mbHasMenu(rOther.mbHasMenu),
       mbWantsCanvas(rOther.mbWantsCanvas)
 {
 }

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.hxx?rev=1457873&r1=1457872&r2=1457873&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/PanelDescriptor.hxx Mon Mar 18 17:14:04 2013
@@ -23,7 +23,7 @@
 #define SFX_SIDEBAR_PANEL_DESCRIPTOR_HXX
 
 #include "sfx2/sidebar/EnumContext.hxx"
-#include "ContextMatcher.hxx"
+#include "ContextList.hxx"
 #include <boost/shared_ptr.hpp>
 
 
@@ -37,10 +37,9 @@ public:
     ::rtl::OUString msId;
     ::rtl::OUString msDeckId;
     ::rtl::OUString msHelpURL;
-    ContextMatcher maContextMatcher;
+    ContextList maContextList;
     ::rtl::OUString msImplementationURL;
     sal_Int32 mnOrderIndex;
-    bool mbHasMenu;
     bool mbWantsCanvas;
     
     PanelDescriptor (void);