rebase on current trunk

git-svn-id: https://svn.apache.org/repos/asf/openoffice/branches/sidebar@1466052 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.gitignore b/.gitignore
index 1121d3e..afde4a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,3 +70,9 @@
 /*/*/unxso???.pro
 /*/*/unxmac??
 /*/*/unxmac??.pro
+

+ext_sources/*

+main/external/*

+main/postprocess/rebase/no_rebase.txt

+main/postprocess/rebase/no_rebase.txt

+main/solar.sh

diff --git a/main/chart2/source/controller/dialogs/dlg_View3D.cxx b/main/chart2/source/controller/dialogs/dlg_View3D.cxx
index 86bc25e..be1471d 100644
--- a/main/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/main/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -55,7 +55,7 @@
 
 sal_uInt16 View3DDialog::m_nLastPageId = 0;
 
-View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
+View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorList* pColorTable )
     : TabDialog(pParent,SchResId(DLG_3D_VIEW))
     , m_aTabControl(this,SchResId(TABCTRL))
     , m_aBtnOK(this,SchResId(BTN_OK))
diff --git a/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 4b7edce..cde1a3d 100644
--- a/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -284,7 +284,7 @@
 ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWindow
                 , const uno::Reference< beans::XPropertySet > & xSceneProperties
                 , const uno::Reference< frame::XModel >& xChartModel
-                , XColorTable* pColorTable )
+                , XColorList* pColorTable )
                 : TabPage 	        ( pWindow, SchResId( TP_3D_SCENEILLUMINATION ) )
                 , m_aFT_LightSource( this, SchResId( FT_LIGHTSOURCE ) )
                 , m_aBtn_Light1( this, SchResId( BTN_LIGHT_1 ), 1 )
diff --git a/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
index 091a96d..0deb6aa 100644
--- a/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/main/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -79,7 +79,7 @@
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::beans::XPropertySet > & xSceneProperties,
         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
-        XColorTable* pColorTable=0 );
+        XColorList* pColorTable=0 );
 	virtual ~ThreeD_SceneIllumination_TabPage();
 
     // has to be called in case the dialog was closed with OK
diff --git a/main/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/main/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index b68ef62..3c61a1a 100644
--- a/main/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/main/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -340,10 +340,10 @@
 SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
 {
     SfxItemSet aFullSet( GetModel()->GetItemPool(),
-                    SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE,
-                    SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT,
-                    SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS,
-                    SID_ATTR_METRIC,SID_ATTR_METRIC,
+                    SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE,
+                    SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT,
+                    SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS,
+                    SID_ATTR_METRIC, SID_ATTR_METRIC,
                     0);
     SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() );
     aFullSet.Put( aGeoSet );
diff --git a/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index c81ad47..ca724da 100644
--- a/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -89,7 +89,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
-XColorTable*   ViewElementListProvider::GetColorTable() const
+XColorList*   ViewElementListProvider::GetColorTable() const
 {
     if(m_pDrawModelWrapper)
         return m_pDrawModelWrapper->GetColorTable();
diff --git a/main/chart2/source/controller/inc/ViewElementListProvider.hxx b/main/chart2/source/controller/inc/ViewElementListProvider.hxx
index cab4855..a456254 100644
--- a/main/chart2/source/controller/inc/ViewElementListProvider.hxx
+++ b/main/chart2/source/controller/inc/ViewElementListProvider.hxx
@@ -41,7 +41,7 @@
     ViewElementListProvider( DrawModelWrapper* pDrawModelWrapper );
     virtual ~ViewElementListProvider();
 
-    XColorTable*    GetColorTable() const;
+    XColorList*    GetColorTable() const;
     XDashList*      GetDashList() const;
     XLineEndList*   GetLineEndList() const;
     XGradientList*  GetGradientList() const;
diff --git a/main/chart2/source/controller/inc/dlg_View3D.hxx b/main/chart2/source/controller/inc/dlg_View3D.hxx
index 956a219..92b789f 100644
--- a/main/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/main/chart2/source/controller/inc/dlg_View3D.hxx
@@ -34,7 +34,7 @@
 #ifndef _SV_BUTTON_HXX
 #include <vcl/button.hxx>
 #endif
-// header for class XColorTable
+// header for class XColorList
 #include <svx/xtable.hxx>
 
 #include "ControllerLockGuard.hxx"
@@ -52,7 +52,7 @@
 public:
     View3DDialog( Window* pWindow,
                   const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
-                  XColorTable* pColorTable=0 );
+                  XColorList* pColorTable=0 );
 	~View3DDialog();
 
     // from Dialog (base of TabDialog)
diff --git a/main/chart2/source/controller/main/ShapeController.cxx b/main/chart2/source/controller/main/ShapeController.cxx
index f12f5ef..b39e4b7 100644
--- a/main/chart2/source/controller/main/ShapeController.cxx
+++ b/main/chart2/source/controller/main/ShapeController.cxx
@@ -323,7 +323,7 @@
                     SfxItemPool& rItemPool = pDrawViewWrapper->GetModel()->GetItemPool();
                     SfxItemSet aSet( rItemPool, rItemPool.GetFirstWhich(), rItemPool.GetLastWhich() );
                     const SvxColorTableItem* pColorItem = static_cast< const SvxColorTableItem* >( aSet.GetItem( SID_COLOR_TABLE ) );
-                    if ( pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable() )
+                    if ( pColorItem && pColorItem->GetColorTable() == XColorList::GetStdColorList() )
                     {
                         pDlg->DontDeleteColorTable();
                     }
diff --git a/main/chart2/source/inc/chartview/DrawModelWrapper.hxx b/main/chart2/source/inc/chartview/DrawModelWrapper.hxx
index 7fcc842..7ebe93b 100644
--- a/main/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/main/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -91,7 +91,7 @@
 		getUnoModel();
     SdrModel& getSdrModel();
 
-    XColorTable*    GetColorTable() const;
+    XColorList*    GetColorTable() const;
     XDashList*      GetDashList() const;
     XLineEndList*   GetLineEndList() const;
     XGradientList*  GetGradientList() const;
diff --git a/main/chart2/source/view/main/DrawModelWrapper.cxx b/main/chart2/source/view/main/DrawModelWrapper.cxx
index 62d0f2f..536077b 100644
--- a/main/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/main/chart2/source/view/main/DrawModelWrapper.cxx
@@ -334,7 +334,7 @@
 {
     return this->SdrModel::GetItemPool();
 }
-XColorTable* DrawModelWrapper::GetColorTable() const
+XColorList* DrawModelWrapper::GetColorTable() const
 {
     return this->SdrModel::GetColorTable();
 }
diff --git a/main/cui/source/inc/border.hxx b/main/cui/source/inc/border.hxx
index 5b6184c..7947442 100644
--- a/main/cui/source/inc/border.hxx
+++ b/main/cui/source/inc/border.hxx
@@ -37,7 +37,6 @@
 // forward ---------------------------------------------------------------
 
 class SvxBorderLine;
-class XColorTable;
 
 #include <svx/flagsdef.hxx>
 
diff --git a/main/cui/source/inc/cuitabarea.hxx b/main/cui/source/inc/cuitabarea.hxx
index 3985d5c..7d67833 100644
--- a/main/cui/source/inc/cuitabarea.hxx
+++ b/main/cui/source/inc/cuitabarea.hxx
@@ -39,8 +39,8 @@
 	SdrModel*           mpDrawModel;
 //	const SdrView*		mpView;
 
-	XColorTable*        mpColorTab;
-	XColorTable*        mpNewColorTab;
+	XColorList*        mpColorTab;
+	XColorList*        mpNewColorTab;
 	XGradientList*      mpGradientList;
 	XGradientList*      mpNewGradientList;
 	XHatchList*         mpHatchingList;
@@ -76,10 +76,10 @@
 					  const SdrView* pSdrView = NULL );
 	~SvxAreaTabDialog();
 
-	void            	 SetNewColorTable( XColorTable* pColTab )
+	void            	 SetNewColorTable( XColorList* pColTab )
 							{ mpNewColorTab = pColTab; }
-	XColorTable*    	 GetNewColorTable() const { return mpNewColorTab; }
-	const XColorTable*	 GetColorTable() const { return mpColorTab; }
+	XColorList*    	 GetNewColorTable() const { return mpNewColorTab; }
+	const XColorList*	 GetColorTable() const { return mpColorTab; }
 
 	void            	 SetNewGradientList( XGradientList* pGrdLst)
 							{ mpNewGradientList = pGrdLst; }
@@ -243,7 +243,7 @@
 	const SfxItemSet&   rOutAttrs;
 	RECT_POINT          eRP;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	XGradientList*      pGradientList;
 	XHatchList*         pHatchingList;
 	XBitmapList*        pBitmapList;
@@ -302,7 +302,7 @@
 	virtual int  DeactivatePage( SfxItemSet* pSet );
 	virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
 	
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 	void    SetGradientList( XGradientList* pGrdLst)
 				{ pGradientList = pGrdLst; }
 	void    SetHatchingList( XHatchList* pHtchLst)
@@ -350,7 +350,7 @@
 	const SfxItemSet&   rOutAttrs;
 	RECT_POINT          eRP;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	ChangeType*         pnColorTableState;
 	sal_uInt16				nPageType;	//add CHINA001 
 	sal_uInt16				nDlgType;	//add CHINA001 
@@ -382,7 +382,7 @@
 	virtual int  DeactivatePage( SfxItemSet* pSet );
 	virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 //CHINA001	void    SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
 //CHINA001	void    SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; }
 	void    SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } //add CHINA001 
@@ -432,7 +432,7 @@
 
 	const SfxItemSet&   rOutAttrs;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	XGradientList*      pGradientList;
 
 	ChangeType*         pnGradientListState;
@@ -473,7 +473,7 @@
 	virtual void ActivatePage( const SfxItemSet& rSet );
 	virtual int  DeactivatePage( SfxItemSet* pSet );
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 	void    SetGradientList( XGradientList* pGrdLst)
 				{ pGradientList = pGrdLst; }
 
@@ -519,7 +519,7 @@
 	const SfxItemSet&   rOutAttrs;
 	RECT_POINT          eRP;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	XHatchList*         pHatchingList;
 
 	ChangeType*         pnHatchingListState;
@@ -563,7 +563,7 @@
 
 	virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 	void    SetHatchingList( XHatchList* pHtchLst)
 				{ pHatchingList = pHtchLst; }
 
@@ -611,7 +611,7 @@
 
 	const SfxItemSet&   rOutAttrs;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	XBitmapList*        pBitmapList;
 
 	ChangeType*         pnBitmapListState;
@@ -657,7 +657,7 @@
 
 	virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 	void    SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; }
 
 	void    SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
@@ -723,7 +723,7 @@
 
 	const SfxItemSet&   rOutAttrs;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 
 	ChangeType*         pnColorTableState;
 	sal_uInt16*             pPageType;
@@ -779,7 +779,7 @@
 	virtual void ActivatePage( const SfxItemSet& rSet );
 	virtual int  DeactivatePage( SfxItemSet* pSet );
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 
 	void    SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
 	void    SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; }
diff --git a/main/cui/source/inc/cuitabline.hxx b/main/cui/source/inc/cuitabline.hxx
index 71375a8..7287594 100644
--- a/main/cui/source/inc/cuitabline.hxx
+++ b/main/cui/source/inc/cuitabline.hxx
@@ -39,8 +39,8 @@
 
 	const SfxItemSet&   rOutAttrs;
 
-	XColorTable*        pColorTab;
-	XColorTable*        mpNewColorTab;
+	XColorList*        pColorTab;
+	XColorList*        mpNewColorTab;
 	XDashList*          pDashList;
 	XDashList*          pNewDashList;
 	XLineEndList*       pLineEndList;
@@ -84,9 +84,9 @@
 	XLineEndList*       GetNewLineEndList() const { return pNewLineEndList; }
 	const XLineEndList* GetLineEndList() const { return pLineEndList; }
 
-	void				SetNewColorTable( XColorTable* pColTab ) { mpNewColorTab = pColTab; }
-	XColorTable*        GetNewColorTable() const { return mpNewColorTab; }
-	const XColorTable*  GetColorTable() const { return pColorTab; }
+	void				SetNewColorTable( XColorList* pColTab ) { mpNewColorTab = pColTab; }
+	XColorList*        GetNewColorTable() const { return mpNewColorTab; }
+	const XColorList*  GetColorTable() const { return pColorTab; }
 };
 
 /*************************************************************************
@@ -166,7 +166,7 @@
 	XLineAttrSetItem    aXLineAttr;
 	SfxItemSet&         rXLSet;
 
-	XColorTable*        pColorTab;
+	XColorList*        pColorTab;
 	XDashList*          pDashList;
 	XLineEndList*       pLineEndList;
 
@@ -231,7 +231,7 @@
 
 	virtual void FillUserData();
 
-	void    SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; }
+	void    SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; }
 	void    SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; }
 	void    SetLineEndList( XLineEndList* pLneEndLst) { pLineEndList = pLneEndLst; }
 	void    SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; }
diff --git a/main/cui/source/inc/sdrcelldlg.hxx b/main/cui/source/inc/sdrcelldlg.hxx
index 2dc0b31..36e0df3 100644
--- a/main/cui/source/inc/sdrcelldlg.hxx
+++ b/main/cui/source/inc/sdrcelldlg.hxx
@@ -27,7 +27,7 @@
 
 #include <sfx2/tabdlg.hxx>
 
-class XColorTable;
+class XColorList;
 class XGradientList;
 class XHatchList;
 class XBitmapList;
@@ -38,7 +38,7 @@
 private:
 	const SfxItemSet&	mrOutAttrs;
 
-	XColorTable*        mpColorTab;
+	XColorList*        mpColorTab;
 	XGradientList*      mpGradientList;
 	XHatchList*         mpHatchingList;
 	XBitmapList*        mpBitmapList;
diff --git a/main/cui/source/inc/treeopt.hxx b/main/cui/source/inc/treeopt.hxx
index e49106d..a2c6e6f 100644
--- a/main/cui/source/inc/treeopt.hxx
+++ b/main/cui/source/inc/treeopt.hxx
@@ -43,7 +43,7 @@
 class SfxModule;
 class SfxShell;
 class SfxItemSet;
-class XColorTable;
+class XColorList;
 class OfaOptionsTreeListBox : public SvTreeListBox
 {
 	using  SvListView::Collapse;
@@ -197,7 +197,7 @@
 
 	// for the ColorTabPage
 	SfxItemSet*		pColorPageItemSet;
-	XColorTable*	pColorTab;
+	XColorList*	pColorTab;
 	sal_uInt16			nChangeType;
 	sal_uInt16 			nUnknownType;
 	sal_uInt16			nUnknownPos;
@@ -269,7 +269,7 @@
     void                ApplyItemSets();
 
     sal_uInt16              GetColorChanged() const { return nChangeType; }
-    XColorTable*        GetColorTable() { return pColorTab; }
+    XColorList*        GetColorTable() { return pColorTab; }
 
 	// helper functions to call the language settings TabPage from the SpellDialog
     static void         ApplyLanguageOptions(const SfxItemSet& rSet);
diff --git a/main/cui/source/options/optchart.cxx b/main/cui/source/options/optchart.cxx
index 74a5cba..851019b 100644
--- a/main/cui/source/options/optchart.cxx
+++ b/main/cui/source/options/optchart.cxx
@@ -73,7 +73,7 @@
 	aValSetColorBox.Show();
 
 	pChartOptions = new SvxChartOptions;
-	pColorTab = new XColorTable( SvtPathOptions().GetPalettePath() );
+	pColorTab = new XColorList( SvtPathOptions().GetPalettePath() );
 
 	const SfxPoolItem* pItem = NULL;
 	if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, sal_False, &pItem ) == SFX_ITEM_SET )
@@ -159,7 +159,7 @@
 		{
 			pColorEntry = pColorTab->GetColor( i );
 			if( pColorEntry && pColorEntry->GetColor() == rCol )
-				return SAL_STATIC_CAST( XPropertyTable*, pColorTab )->Get( pColorEntry->GetName() );
+				return SAL_STATIC_CAST( XPropertyList*, pColorTab )->Get( pColorEntry->GetName() );
 		}
 	}
 	return -1L;
diff --git a/main/cui/source/options/optchart.hxx b/main/cui/source/options/optchart.hxx
index c520d62..0c7fa4d 100644
--- a/main/cui/source/options/optchart.hxx
+++ b/main/cui/source/options/optchart.hxx
@@ -35,7 +35,7 @@
 #ifndef _SV_BUTTON_HXX
 #include <vcl/button.hxx>
 #endif
-// header for XColorTable
+// header for XColorList
 #include <svx/xtable.hxx>
 
 #include "cfgchart.hxx"
@@ -61,7 +61,7 @@
 
 	SvxChartOptions*		pChartOptions;
 	SvxChartColorTableItem*	pColorConfig;
-	XColorTable*			pColorTab;
+	XColorList*			pColorTab;
 
 	DECL_LINK( ResetToDefaults, void * );
 	DECL_LINK( ListClickedHdl, ChartColorLB * );
diff --git a/main/cui/source/options/optcolor.cxx b/main/cui/source/options/optcolor.cxx
index 5482012..74b9ce4 100644
--- a/main/cui/source/options/optcolor.cxx
+++ b/main/cui/source/options/optcolor.cxx
@@ -945,7 +945,7 @@
         }
     }
 
-    XColorTable aColorTable( SvtPathOptions().GetPalettePath() );
+    XColorList aColorTable( SvtPathOptions().GetPalettePath() );
     aColorBoxes[0]->InsertAutomaticEntry();
     for( sal_Int32 i = 0; i < aColorTable.Count(); i++ )
 	{
diff --git a/main/cui/source/options/treeopt.cxx b/main/cui/source/options/treeopt.cxx
index 14fcdd6c..b483f64 100644
--- a/main/cui/source/options/treeopt.cxx
+++ b/main/cui/source/options/treeopt.cxx
@@ -1205,7 +1205,7 @@
 				if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
 					pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->
 						GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
-				pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : XColorTable::GetStdColorTable();
+				pColorTab = pPtr ? (XColorList*)pPtr->GetValue() : XColorList::GetStdColorList();
 
 				rColPage.SetColorTable( pColorTab );
 				rColPage.SetPageType( &nUnknownType );
@@ -2640,7 +2640,7 @@
 				const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
 				if( pPtr )
 				{
-                    XColorTable* _pColorTab = (XColorTable*)pPtr->GetValue();
+                    XColorList* _pColorTab = (XColorList*)pPtr->GetValue();
 
                     if( _pColorTab &&
                         _pColorTab->GetPath() == GetColorTable()->GetPath() &&
diff --git a/main/cui/source/tabpages/backgrnd.cxx b/main/cui/source/tabpages/backgrnd.cxx
index f145ff1..ca7fd99 100644
--- a/main/cui/source/tabpages/backgrnd.cxx
+++ b/main/cui/source/tabpages/backgrnd.cxx
@@ -1194,7 +1194,7 @@
 {
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	const SfxPoolItem* pItem = NULL;
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	const Size aSize15x15 = Size( 15, 15 );
 	FASTBOOL bOwn = sal_False;
 
@@ -1204,7 +1204,7 @@
 	if ( !pColorTable )
 	{
 		bOwn = sal_True;
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 	}
 
 	if ( pColorTable )
diff --git a/main/cui/source/tabpages/border.cxx b/main/cui/source/tabpages/border.cxx
index 59aa239..cb89621 100644
--- a/main/cui/source/tabpages/border.cxx
+++ b/main/cui/source/tabpages/border.cxx
@@ -38,7 +38,7 @@
 
 #define LINESTYLE_HTML_MAX 5
 
-#include <svx/xtable.hxx>				// XColorTable
+#include <svx/xtable.hxx>				// XColorList
 #include <svx/drawitem.hxx>
 #include <editeng/boxitem.hxx>
 #include <editeng/shaditem.hxx>
@@ -335,10 +335,10 @@
     FillValueSets();
 	FillLineListBox_Impl();
 
-	// ColorBox aus der XColorTable fuellen.
+	// ColorBox aus der XColorList fuellen.
 	SfxObjectShell*		pDocSh		= SfxObjectShell::Current();
 	const SfxPoolItem*	pItem 		= NULL;
-	XColorTable*		pColorTable = NULL;
+	XColorList*		pColorTable = NULL;
 
 	DBG_ASSERT( pDocSh, "DocShell not found!" );
 
diff --git a/main/cui/source/tabpages/chardlg.cxx b/main/cui/source/tabpages/chardlg.cxx
index e7d4636..dfc278c 100644
--- a/main/cui/source/tabpages/chardlg.cxx
+++ b/main/cui/source/tabpages/chardlg.cxx
@@ -46,7 +46,7 @@
 #include <cuires.hrc>
 #include "chardlg.hrc"
 
-#include <svx/xtable.hxx>		// XColorTable
+#include <svx/xtable.hxx>		// XColorList
 #include "chardlg.hxx"
 #include "editeng/fontitem.hxx"
 #include <editeng/postitem.hxx>
@@ -715,7 +715,7 @@
 	// fill the color box
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	//DBG_ASSERT( pDocSh, "DocShell not found!" );
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	FASTBOOL bKillTable = sal_False;
 	const SfxPoolItem* pItem = NULL;
 
@@ -728,7 +728,7 @@
 
 	if ( !pColorTable )
 	{
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 		bKillTable = sal_True;
 	}
 
@@ -1787,7 +1787,7 @@
 	// fill the color box
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	DBG_ASSERT( pDocSh, "DocShell not found!" );
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	FASTBOOL bKillTable = sal_False;
 
 	if ( pDocSh )
@@ -1799,7 +1799,7 @@
 
 	if ( !pColorTable )
 	{
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 		bKillTable = sal_True;
 	}
 
diff --git a/main/cui/source/tabpages/numpages.cxx b/main/cui/source/tabpages/numpages.cxx
index 6e75012..5cce262 100644
--- a/main/cui/source/tabpages/numpages.cxx
+++ b/main/cui/source/tabpages/numpages.cxx
@@ -1609,7 +1609,7 @@
 	{
 		SfxObjectShell* pDocSh = SfxObjectShell::Current();
 		DBG_ASSERT( pDocSh, "DocShell not found!" );
-		XColorTable* pColorTable = NULL;
+		XColorList* pColorTable = NULL;
 		FASTBOOL bKillTable = sal_False;
 		if ( pDocSh )
         {
@@ -1620,7 +1620,7 @@
 
 		if ( !pColorTable )
 		{
-			pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+			pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 			bKillTable = sal_True;
 		}
 
diff --git a/main/cui/source/tabpages/tpbitmap.cxx b/main/cui/source/tabpages/tpbitmap.cxx
index 4da07e5..7933adf 100644
--- a/main/cui/source/tabpages/tpbitmap.cxx
+++ b/main/cui/source/tabpages/tpbitmap.cxx
@@ -593,8 +593,8 @@
 		if( pEntry )
 		{
 			pBitmapList->Insert( pEntry );
-
-			aLbBitmaps.Append( pEntry );
+            const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight());
+			aLbBitmaps.Append(aUiSize, *pEntry );
 			aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 );
 
 #ifdef WNT
@@ -701,7 +701,8 @@
 				XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName );
 				pBitmapList->Insert( pEntry );
 
-				aLbBitmaps.Append( pEntry );
+                const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight());
+				aLbBitmaps.Append(aUiSize, *pEntry );
 				aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 );
 
 #ifdef WNT
@@ -756,6 +757,7 @@
 		long nCount = pBitmapList->Count();
 		sal_Bool bDifferent = sal_False;
 		sal_Bool bLoop = sal_True;
+        const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight());
 
 		while( bLoop && pDlg->Execute() == RET_OK )
 		{
@@ -780,7 +782,7 @@
 
 				pEntry->SetGraphicObject(Graphic(aBitmapEx));
 
-				aLbBitmaps.Modify( pEntry, nPos );
+				aLbBitmaps.Modify( aUiSize, *pEntry, nPos );
 				aLbBitmaps.SelectEntryPos( nPos );
 
 				// Flag fuer modifiziert setzen
diff --git a/main/cui/source/tabpages/tpcolor.cxx b/main/cui/source/tabpages/tpcolor.cxx
index ccada0d..79c6246 100644
--- a/main/cui/source/tabpages/tpcolor.cxx
+++ b/main/cui/source/tabpages/tpcolor.cxx
@@ -524,7 +524,7 @@
 			ConvertColorValues (aAktuellColor, CM_RGB);
 		pEntry = new XColorEntry( aAktuellColor, aName );
 
-		pColorTab->Insert( pColorTab->Count(), pEntry );
+		pColorTab->Insert( pEntry, pColorTab->Count() );
 
 		aLbColor.Append( pEntry );
 		aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1,
@@ -643,7 +643,7 @@
 		ConvertColorValues (aTmpColor, CM_RGB);
 
 	pColorDlg->SetColor (aTmpColor);
-    pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY );

+    pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY );
 
 	if( pColorDlg->Execute() == RET_OK )
 	{
@@ -698,7 +698,7 @@
 			{
 				pEntry = pColorTab->Remove( i + 1 );
 				DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (2) !" );
-				pColorTab->Insert( i, pEntry );
+				pColorTab->Insert( pEntry, i );
 			}
 
 			// Listbox und ValueSet aktualisieren
@@ -765,14 +765,14 @@
 			aPathURL.removeFinalSlash();
 
 			// Tabelle speichern
-			XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
+			XColorList* pColTab = new XColorList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
 			pColTab->SetName( aURL.getName() ); // XXX
 			if( pColTab->Load() )
 			{
 				if( pColTab )
 				{
 					// Pruefen, ob Tabelle geloescht werden darf:
-					const XColorTable *pTempTable = 0;
+					const XColorList *pTempTable = 0;
 					SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN );
 					SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN );
 					if( pArea )
diff --git a/main/cui/source/tabpages/tpline.cxx b/main/cui/source/tabpages/tpline.cxx
index 430ab2d..f3fe9f7 100644
--- a/main/cui/source/tabpages/tpline.cxx
+++ b/main/cui/source/tabpages/tpline.cxx
@@ -301,7 +301,7 @@
 {
 	// Linienstile
 	sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos();
-	aLbLineStyle.FillStyles();
+	// aLbLineStyle.FillStyles();
 	aLbLineStyle.Fill( pDashList );
 	aLbLineStyle.SelectEntryPos( nOldSelect );
 
@@ -728,22 +728,22 @@
 		{
 			case 0: // Rounded, default
 			{
-				pNew = new XLineJointItem(XLINEJOINT_ROUND);
+				pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND);
 				break;
 			}
 			case 1: // - none -
 			{
-				pNew = new XLineJointItem(XLINEJOINT_NONE);
+				pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE);
 				break;
 			}
 			case 2: // Miter
 			{
-				pNew = new XLineJointItem(XLINEJOINT_MITER);
+				pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER);
 				break;
 			}
 			case 3: // Bevel
 			{
-				pNew = new XLineJointItem(XLINEJOINT_BEVEL);
+				pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL);
 				break;
 			}
 		}
@@ -895,22 +895,22 @@
 		{
 			case 0: // Rounded, default
 			{
-				rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
+				rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND));
 				break;
 			}
 			case 1: // - none -
 			{
-				rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
+				rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE));
 				break;
 			}
 			case 2: // Miter
 			{
-				rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
+				rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER));
 				break;
 			}
 			case 3: // Bevel
 			{
-				rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
+				rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL));
 				break;
 			}
 		}
@@ -1344,15 +1344,15 @@
 	}
 	else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
 	{
-		XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
+		const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
 
 		switch(eLineJoint)
 		{
-			case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
-			case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
-			case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
-			case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
-            case XLINEJOINT_MIDDLE : break;
+            case com::sun::star::drawing::LineJoint_MIDDLE : // fallback to round, unused value
+			case com::sun::star::drawing::LineJoint_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
+			case com::sun::star::drawing::LineJoint_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
+			case com::sun::star::drawing::LineJoint_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
+			case com::sun::star::drawing::LineJoint_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
 		}
 	}
 	else
diff --git a/main/cui/source/tabpages/tplnedef.cxx b/main/cui/source/tabpages/tplnedef.cxx
index e586cea..ad1192d 100644
--- a/main/cui/source/tabpages/tplnedef.cxx
+++ b/main/cui/source/tabpages/tplnedef.cxx
@@ -626,8 +626,8 @@
 
             long nDashCount = pDashList->Count();
             pDashList->Insert( pEntry, nDashCount );
-            Bitmap* pBitmap = pDashList->GetBitmap( nDashCount );
-			aLbLineStyles.Append( pEntry, pBitmap );
+            const Bitmap aBitmap = pDashList->GetUiBitmap( nDashCount );
+			aLbLineStyles.Append( pEntry, &aBitmap );
 
 			aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 );
 
@@ -707,8 +707,8 @@
 				XDashEntry* pEntry = new XDashEntry( aDash, aName );
 
 				delete pDashList->Replace( pEntry, nPos );
-				Bitmap* pBitmap = pDashList->GetBitmap( nPos );
-				aLbLineStyles.Modify( pEntry, nPos, pBitmap );
+				const Bitmap aBitmap = pDashList->GetUiBitmap( nPos );
+				aLbLineStyles.Modify( pEntry, nPos, &aBitmap );
 
 				aLbLineStyles.SelectEntryPos( nPos );
 
diff --git a/main/cui/source/tabpages/tplneend.cxx b/main/cui/source/tabpages/tplneend.cxx
index cbabd86..1cec590 100644
--- a/main/cui/source/tabpages/tplneend.cxx
+++ b/main/cui/source/tabpages/tplneend.cxx
@@ -399,24 +399,25 @@
 			delete( pDlg );
 		}
 
-		// Wenn nicht vorhanden, wird Eintrag aufgenommen
-		if( bDifferent )
-		{
+        // Wenn nicht vorhanden, wird Eintrag aufgenommen
+        if( bDifferent )
+        {
             XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
 
-			pEntry->SetName( aName );
-			aEdtName.SetText( aName );
+            pEntry->SetName( aName );
+            aEdtName.SetText( aName );
 
-			aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) );
-			aLbLineEnds.SelectEntryPos( nPos );
+            const Bitmap aUiBitmap( pLineEndList->GetUiBitmap( nPos ) );
+            aLbLineEnds.Modify( pEntry, nPos, &aUiBitmap );
+            aLbLineEnds.SelectEntryPos( nPos );
 
-			// Flag fuer modifiziert setzen
-			*pnLineEndListState |= CT_MODIFIED;
+            // Flag fuer modifiziert setzen
+            *pnLineEndListState |= CT_MODIFIED;
 
-			*pPageType = 3;
-		}
-	}
-	return( 0L );
+            *pPageType = 3;
+        }
+    }
+    return( 0L );
 }
 
 //------------------------------------------------------------------------
@@ -505,10 +506,10 @@
 
                 long nLineEndCount = pLineEndList->Count();
                 pLineEndList->Insert( pEntry, nLineEndCount );
-                Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount );
+                const Bitmap aBitmap = pLineEndList->GetUiBitmap( nLineEndCount );
 
 				// Zur ListBox hinzufuegen
-				aLbLineEnds.Append( pEntry, pBitmap );
+				aLbLineEnds.Append( pEntry, &aBitmap );
 				aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 );
 
 				// Flag fuer modifiziert setzen
diff --git a/main/default_images/res/soliline.png b/main/default_images/res/soliline.png
deleted file mode 100644
index 9ac96cd..0000000
--- a/main/default_images/res/soliline.png
+++ /dev/null
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/123.png b/main/default_images/sc/res/sidebar/123.png
new file mode 100755
index 0000000..0d0a6ef
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/123.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/ABC.png b/main/default_images/sc/res/sidebar/ABC.png
new file mode 100755
index 0000000..fb7e5c8
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/ABC.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder.png b/main/default_images/sc/res/sidebar/CellBorder.png
new file mode 100755
index 0000000..f4e8e00
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_005.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_005.png
new file mode 100755
index 0000000..6116ee2
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_005.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_005_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_005_h.png
new file mode 100755
index 0000000..444d514
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_005_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_110.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_110.png
new file mode 100755
index 0000000..ddca641
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_110.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_110_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_110_h.png
new file mode 100755
index 0000000..1144a49
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_110_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_250.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_250.png
new file mode 100755
index 0000000..93014bf
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_250.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_250_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_250_h.png
new file mode 100755
index 0000000..8a6cc3c
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_250_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_260.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_260.png
new file mode 100755
index 0000000..4fdc28a
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_260.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_260_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_260_h.png
new file mode 100755
index 0000000..769a03c
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_260_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_400.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_400.png
new file mode 100755
index 0000000..38cda1b
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_400.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_400_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_400_h.png
new file mode 100755
index 0000000..cd8503a
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_400_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_450.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_450.png
new file mode 100755
index 0000000..245594f
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_450.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_450_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_450_h.png
new file mode 100755
index 0000000..17fa6fc
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_450_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_500.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_500.png
new file mode 100755
index 0000000..9a6457d
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_500.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_500_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_500_h.png
new file mode 100755
index 0000000..90d8d69
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_500_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_505.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_505.png
new file mode 100755
index 0000000..78865c0
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_505.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_505_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_505_h.png
new file mode 100755
index 0000000..94846c3
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_505_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_750.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_750.png
new file mode 100755
index 0000000..71088c1
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_750.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorderLineStyle_750_h.png b/main/default_images/sc/res/sidebar/CellBorderLineStyle_750_h.png
new file mode 100755
index 0000000..40bafef
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorderLineStyle_750_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_All_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_All_18x18.png
new file mode 100755
index 0000000..68f9d45
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_All_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_All_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_All_18x18_h.png
new file mode 100755
index 0000000..2f7909d
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_All_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18.png
new file mode 100755
index 0000000..20d34e2
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18_h.png
new file mode 100755
index 0000000..7e3ba68
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png
new file mode 100755
index 0000000..3bf6450
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18_h.png
new file mode 100755
index 0000000..6093c97
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Double_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png
new file mode 100755
index 0000000..ecf2afa
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18_h.png
new file mode 100755
index 0000000..a824ac0
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Bottom_Thick_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18.png
new file mode 100755
index 0000000..a5f3dd4
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18_h.png
new file mode 100755
index 0000000..f62769b
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Empty_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18.png
new file mode 100755
index 0000000..54a42b5
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18_h.png
new file mode 100755
index 0000000..7b35193
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png
new file mode 100755
index 0000000..a54c4f5
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18_h.png
new file mode 100755
index 0000000..a62c201
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png
new file mode 100755
index 0000000..39e9b0f
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18_h.png
new file mode 100755
index 0000000..62ffc82
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_LeftAndRight_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png
new file mode 100755
index 0000000..4e58fee
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18_h.png
new file mode 100755
index 0000000..6408157
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_LeftDiagonal_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Left_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Left_18x18.png
new file mode 100755
index 0000000..9873891
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Left_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Left_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Left_18x18_h.png
new file mode 100755
index 0000000..7349f5b
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Left_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png
new file mode 100755
index 0000000..3325d03
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18_h.png
new file mode 100755
index 0000000..ccebd4b
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_RightDiagonal_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Right_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Right_18x18.png
new file mode 100755
index 0000000..a33eca2
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Right_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Right_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Right_18x18_h.png
new file mode 100755
index 0000000..d84d917
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Right_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png
new file mode 100755
index 0000000..4249bf6
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18_h.png
new file mode 100755
index 0000000..3bd0b73
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopAndBottom_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png
new file mode 100755
index 0000000..793a984
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18_h.png
new file mode 100755
index 0000000..bdc6241
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png
new file mode 100755
index 0000000..e7c8d05
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18_h.png
new file mode 100755
index 0000000..758af77
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Top_18x18.png b/main/default_images/sc/res/sidebar/CellBorder_Top_18x18.png
new file mode 100755
index 0000000..1dda1c1
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Top_18x18.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/CellBorder_Top_18x18_h.png b/main/default_images/sc/res/sidebar/CellBorder_Top_18x18_h.png
new file mode 100755
index 0000000..dfa9c53
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/CellBorder_Top_18x18_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/Line_color.png b/main/default_images/sc/res/sidebar/Line_color.png
new file mode 100755
index 0000000..a9522b9
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/Line_color.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/canlendar.png b/main/default_images/sc/res/sidebar/canlendar.png
new file mode 100755
index 0000000..b40421e
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/canlendar.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/fill_color.png b/main/default_images/sc/res/sidebar/fill_color.png
new file mode 100755
index 0000000..1d5d23f
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/fill_color.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/fill_color_h.png b/main/default_images/sc/res/sidebar/fill_color_h.png
new file mode 100755
index 0000000..47e7ea1
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/fill_color_h.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/money.png b/main/default_images/sc/res/sidebar/money.png
new file mode 100755
index 0000000..15b6ff2
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/money.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/morebutton.bmp b/main/default_images/sc/res/sidebar/morebutton.bmp
new file mode 100755
index 0000000..c665b3e
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/morebutton.bmp
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/morebutton_h.bmp b/main/default_images/sc/res/sidebar/morebutton_h.bmp
new file mode 100755
index 0000000..c665b3e
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/morebutton_h.bmp
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/percent.png b/main/default_images/sc/res/sidebar/percent.png
new file mode 100755
index 0000000..83f3751
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/percent.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_alignbottom.png b/main/default_images/sc/res/sidebar/sc_alignbottom.png
new file mode 100755
index 0000000..de22c24
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_alignbottom.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_aligncenter.png b/main/default_images/sc/res/sidebar/sc_aligncenter.png
new file mode 100755
index 0000000..441e677
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_aligncenter.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_aligncenter_v.png b/main/default_images/sc/res/sidebar/sc_aligncenter_v.png
new file mode 100755
index 0000000..919edab
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_aligncenter_v.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_alignjust.png b/main/default_images/sc/res/sidebar/sc_alignjust.png
new file mode 100755
index 0000000..1d57b1c
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_alignjust.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_alignleft.png b/main/default_images/sc/res/sidebar/sc_alignleft.png
new file mode 100755
index 0000000..a258013
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_alignleft.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_alignright.png b/main/default_images/sc/res/sidebar/sc_alignright.png
new file mode 100755
index 0000000..cbf816b
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_alignright.png
Binary files differ
diff --git a/main/default_images/sc/res/sidebar/sc_aligntop.png b/main/default_images/sc/res/sidebar/sc_aligntop.png
new file mode 100755
index 0000000..275133c
--- /dev/null
+++ b/main/default_images/sc/res/sidebar/sc_aligntop.png
Binary files differ
diff --git a/main/default_images/sfx2/res/grip.png b/main/default_images/sfx2/res/grip.png
new file mode 100755
index 0000000..6969983
--- /dev/null
+++ b/main/default_images/sfx2/res/grip.png
Binary files differ
diff --git a/main/default_images/sfx2/res/grip_hc.png b/main/default_images/sfx2/res/grip_hc.png
new file mode 100755
index 0000000..04e370d
--- /dev/null
+++ b/main/default_images/sfx2/res/grip_hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/menu.png b/main/default_images/sfx2/res/menu.png
new file mode 100755
index 0000000..e65517b
--- /dev/null
+++ b/main/default_images/sfx2/res/menu.png
Binary files differ
diff --git a/main/default_images/sfx2/res/menu_hc.png b/main/default_images/sfx2/res/menu_hc.png
new file mode 100755
index 0000000..bebd1d6
--- /dev/null
+++ b/main/default_images/sfx2/res/menu_hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/minus_hc.png b/main/default_images/sfx2/res/minus_hc.png
new file mode 100644
index 0000000..9ee2e43
--- /dev/null
+++ b/main/default_images/sfx2/res/minus_hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/plus_hc.png b/main/default_images/sfx2/res/plus_hc.png
new file mode 100644
index 0000000..a0b80ad
--- /dev/null
+++ b/main/default_images/sfx2/res/plus_hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/separator.png b/main/default_images/sfx2/res/separator.png
new file mode 100755
index 0000000..d518aef
--- /dev/null
+++ b/main/default_images/sfx2/res/separator.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/morebutton.png b/main/default_images/sfx2/res/symphony/morebutton.png
new file mode 100755
index 0000000..5cffa97
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/morebutton.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/morebutton_h.png b/main/default_images/sfx2/res/symphony/morebutton_h.png
new file mode 100755
index 0000000..5cffa97
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/morebutton_h.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/open_more.png b/main/default_images/sfx2/res/symphony/open_more.png
new file mode 100755
index 0000000..c981abf
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/open_more.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-3d-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-3d-large-hc.png
new file mode 100755
index 0000000..7bc1160
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-3d-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-3d-large.png b/main/default_images/sfx2/res/symphony/sidebar-3d-large.png
new file mode 100755
index 0000000..7bc1160
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-3d-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-3d-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-3d-small-hc.png
new file mode 100755
index 0000000..a4cdda9
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-3d-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-3d-small.png b/main/default_images/sfx2/res/symphony/sidebar-3d-small.png
new file mode 100755
index 0000000..a4cdda9
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-3d-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-animation-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-animation-large-hc.png
new file mode 100755
index 0000000..0be7962
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-animation-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-animation-large.png b/main/default_images/sfx2/res/symphony/sidebar-animation-large.png
new file mode 100755
index 0000000..0be7962
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-animation-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-animation-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-animation-small-hc.png
new file mode 100755
index 0000000..c494dfa
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-animation-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-animation-small.png b/main/default_images/sfx2/res/symphony/sidebar-animation-small.png
new file mode 100755
index 0000000..c494dfa
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-animation-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-colors-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-colors-large-hc.png
new file mode 100755
index 0000000..39ecdc1
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-colors-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-colors-large.png b/main/default_images/sfx2/res/symphony/sidebar-colors-large.png
new file mode 100755
index 0000000..39ecdc1
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-colors-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-colors-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-colors-small-hc.png
new file mode 100755
index 0000000..049514b
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-colors-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-colors-small.png b/main/default_images/sfx2/res/symphony/sidebar-colors-small.png
new file mode 100755
index 0000000..049514b
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-colors-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large-hc.png
new file mode 100755
index 0000000..be99b1f
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large.png b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large.png
new file mode 100755
index 0000000..be99b1f
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small-hc.png
new file mode 100755
index 0000000..55e182a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small.png b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small.png
new file mode 100755
index 0000000..55e182a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-eyedropper-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-functions-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-functions-large-hc.png
new file mode 100644
index 0000000..1991850
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-functions-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-functions-large.png b/main/default_images/sfx2/res/symphony/sidebar-functions-large.png
new file mode 100644
index 0000000..1991850
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-functions-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-functions-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-functions-small-hc.png
new file mode 100644
index 0000000..615bd0b
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-functions-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-functions-small.png b/main/default_images/sfx2/res/symphony/sidebar-functions-small.png
new file mode 100644
index 0000000..615bd0b
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-functions-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-gallery-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-gallery-large-hc.png
new file mode 100755
index 0000000..9effe08
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-gallery-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-gallery-large.png b/main/default_images/sfx2/res/symphony/sidebar-gallery-large.png
new file mode 100755
index 0000000..9effe08
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-gallery-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-gallery-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-gallery-small-hc.png
new file mode 100755
index 0000000..29b3c25
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-gallery-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-gallery-small.png b/main/default_images/sfx2/res/symphony/sidebar-gallery-small.png
new file mode 100755
index 0000000..29b3c25
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-gallery-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-imganim-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-imganim-large-hc.png
new file mode 100755
index 0000000..778e499
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-imganim-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-imganim-large.png b/main/default_images/sfx2/res/symphony/sidebar-imganim-large.png
new file mode 100755
index 0000000..778e499
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-imganim-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-imganim-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-imganim-small-hc.png
new file mode 100755
index 0000000..50a065a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-imganim-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-imganim-small.png b/main/default_images/sfx2/res/symphony/sidebar-imganim-small.png
new file mode 100755
index 0000000..50a065a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-imganim-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-navigator-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-navigator-large-hc.png
new file mode 100755
index 0000000..a078b0a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-navigator-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-navigator-large.png b/main/default_images/sfx2/res/symphony/sidebar-navigator-large.png
new file mode 100755
index 0000000..a078b0a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-navigator-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-navigator-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-navigator-small-hc.png
new file mode 100755
index 0000000..00bd1ca
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-navigator-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-navigator-small.png b/main/default_images/sfx2/res/symphony/sidebar-navigator-small.png
new file mode 100755
index 0000000..00bd1ca
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-navigator-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-property-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-property-large-hc.png
new file mode 100755
index 0000000..fb0c159
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-property-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-property-large.png b/main/default_images/sfx2/res/symphony/sidebar-property-large.png
new file mode 100755
index 0000000..fb0c159
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-property-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-property-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-property-small-hc.png
new file mode 100755
index 0000000..4147aa1
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-property-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-property-small.png b/main/default_images/sfx2/res/symphony/sidebar-property-small.png
new file mode 100755
index 0000000..4147aa1
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-property-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-style-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-style-large-hc.png
new file mode 100755
index 0000000..0d59a2d
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-style-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-style-large.png b/main/default_images/sfx2/res/symphony/sidebar-style-large.png
new file mode 100755
index 0000000..0d59a2d
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-style-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-style-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-style-small-hc.png
new file mode 100755
index 0000000..d570ffa
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-style-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-style-small.png b/main/default_images/sfx2/res/symphony/sidebar-style-small.png
new file mode 100755
index 0000000..d570ffa
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-style-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-template-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-template-large-hc.png
new file mode 100755
index 0000000..f4beddc
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-template-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-template-large.png b/main/default_images/sfx2/res/symphony/sidebar-template-large.png
new file mode 100755
index 0000000..f4beddc
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-template-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-template-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-template-small-hc.png
new file mode 100755
index 0000000..65bff0c
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-template-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-template-small.png b/main/default_images/sfx2/res/symphony/sidebar-template-small.png
new file mode 100755
index 0000000..65bff0c
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-template-small.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-transition-large-hc.png b/main/default_images/sfx2/res/symphony/sidebar-transition-large-hc.png
new file mode 100755
index 0000000..f0c3198
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-transition-large-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-transition-large.png b/main/default_images/sfx2/res/symphony/sidebar-transition-large.png
new file mode 100755
index 0000000..f0c3198
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-transition-large.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-transition-small-hc.png b/main/default_images/sfx2/res/symphony/sidebar-transition-small-hc.png
new file mode 100755
index 0000000..6cdc89a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-transition-small-hc.png
Binary files differ
diff --git a/main/default_images/sfx2/res/symphony/sidebar-transition-small.png b/main/default_images/sfx2/res/symphony/sidebar-transition-small.png
new file mode 100755
index 0000000..6cdc89a
--- /dev/null
+++ b/main/default_images/sfx2/res/symphony/sidebar-transition-small.png
Binary files differ
diff --git a/main/default_images/svx/res/rotation.png b/main/default_images/svx/res/rotation.png
new file mode 100755
index 0000000..57f75b9
--- /dev/null
+++ b/main/default_images/svx/res/rotation.png
Binary files differ
diff --git a/main/default_images/svx/res/rotation_h.png b/main/default_images/svx/res/rotation_h.png
new file mode 100755
index 0000000..e8adbfc
--- /dev/null
+++ b/main/default_images/svx/res/rotation_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/  b/main/default_images/svx/res/symphony/ 
new file mode 100755
index 0000000..263af5d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ 
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AdjustColorBlue_16x16.png b/main/default_images/svx/res/symphony/AdjustColorBlue_16x16.png
new file mode 100755
index 0000000..0e4e0b3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AdjustColorBlue_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AdjustColorGamma_16x16.png b/main/default_images/svx/res/symphony/AdjustColorGamma_16x16.png
new file mode 100755
index 0000000..bc593f7
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AdjustColorGamma_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AdjustColorGreen_16x16.png b/main/default_images/svx/res/symphony/AdjustColorGreen_16x16.png
new file mode 100755
index 0000000..05f99dc
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AdjustColorGreen_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AdjustColorRed_16x16.png b/main/default_images/svx/res/symphony/AdjustColorRed_16x16.png
new file mode 100755
index 0000000..86ed800
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AdjustColorRed_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AlignTextCenter_16x16.png b/main/default_images/svx/res/symphony/AlignTextCenter_16x16.png
new file mode 100755
index 0000000..441e677
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AlignTextCenter_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AlignTextJustified_16x16.png b/main/default_images/svx/res/symphony/AlignTextJustified_16x16.png
new file mode 100755
index 0000000..1d57b1c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AlignTextJustified_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AlignTextLeft_16x16.png b/main/default_images/svx/res/symphony/AlignTextLeft_16x16.png
new file mode 100755
index 0000000..a258013
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AlignTextLeft_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/AlignTextRight_16x16.png b/main/default_images/svx/res/symphony/AlignTextRight_16x16.png
new file mode 100755
index 0000000..cbf816b
--- /dev/null
+++ b/main/default_images/svx/res/symphony/AlignTextRight_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ColorModeBlackWhite_16x16.png b/main/default_images/svx/res/symphony/ColorModeBlackWhite_16x16.png
new file mode 100755
index 0000000..c6d333c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ColorModeBlackWhite_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ColorModeGrey_16x16.png b/main/default_images/svx/res/symphony/ColorModeGrey_16x16.png
new file mode 100755
index 0000000..5bda54f
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ColorModeGrey_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ColorModeNormal_16x16.png b/main/default_images/svx/res/symphony/ColorModeNormal_16x16.png
new file mode 100755
index 0000000..a618abd
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ColorModeNormal_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ColorModeWaterMark_16x16.png b/main/default_images/svx/res/symphony/ColorModeWaterMark_16x16.png
new file mode 100755
index 0000000..1606498
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ColorModeWaterMark_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/DecreaseSpace_16x16.png b/main/default_images/svx/res/symphony/DecreaseSpace_16x16.png
new file mode 100755
index 0000000..3f97e69
--- /dev/null
+++ b/main/default_images/svx/res/symphony/DecreaseSpace_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/FlipHorizontally_16x16.png b/main/default_images/svx/res/symphony/FlipHorizontally_16x16.png
new file mode 100755
index 0000000..281ee46
--- /dev/null
+++ b/main/default_images/svx/res/symphony/FlipHorizontally_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/FlipVertically_16x16.png b/main/default_images/svx/res/symphony/FlipVertically_16x16.png
new file mode 100755
index 0000000..7c9c4c4
--- /dev/null
+++ b/main/default_images/svx/res/symphony/FlipVertically_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Highlight.png b/main/default_images/svx/res/symphony/Highlight.png
new file mode 100755
index 0000000..8640d2e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Highlight.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/IncreaseSpace_16x16.png b/main/default_images/svx/res/symphony/IncreaseSpace_16x16.png
new file mode 100755
index 0000000..f27f369
--- /dev/null
+++ b/main/default_images/svx/res/symphony/IncreaseSpace_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Indent2.png b/main/default_images/svx/res/symphony/Indent2.png
new file mode 100755
index 0000000..9cb8663
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Indent2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Indent3.png b/main/default_images/svx/res/symphony/Indent3.png
new file mode 100755
index 0000000..c57f2b2
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Indent3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Indent4.png b/main/default_images/svx/res/symphony/Indent4.png
new file mode 100755
index 0000000..0cba2f0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Indent4.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Indent_16x16.png b/main/default_images/svx/res/symphony/Indent_16x16.png
new file mode 100755
index 0000000..9313737
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Indent_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Indent_Hanging.png b/main/default_images/svx/res/symphony/Indent_Hanging.png
new file mode 100755
index 0000000..4acb5b5
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Indent_Hanging.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Line_color.png b/main/default_images/svx/res/symphony/Line_color.png
new file mode 100755
index 0000000..a9522b9
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Line_color.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Outdent_16x16.png b/main/default_images/svx/res/symphony/Outdent_16x16.png
new file mode 100755
index 0000000..7461944
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Outdent_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Quadratic.png b/main/default_images/svx/res/symphony/Quadratic.png
new file mode 100755
index 0000000..ad579c8
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Quadratic.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Quadratic_h.png b/main/default_images/svx/res/symphony/Quadratic_h.png
new file mode 100644
index 0000000..12d6448
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Quadratic_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Square.png b/main/default_images/svx/res/symphony/Square.png
new file mode 100755
index 0000000..1027f8a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Square.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/Square_h.png b/main/default_images/svx/res/symphony/Square_h.png
new file mode 100755
index 0000000..8d0ccea
--- /dev/null
+++ b/main/default_images/svx/res/symphony/Square_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/__morebutton.bmp b/main/default_images/svx/res/symphony/__morebutton.bmp
new file mode 100755
index 0000000..c665b3e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/__morebutton.bmp
Binary files differ
diff --git a/main/default_images/svx/res/symphony/__morebutton_h.bmp b/main/default_images/svx/res/symphony/__morebutton_h.bmp
new file mode 100755
index 0000000..c665b3e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/__morebutton_h.bmp
Binary files differ
diff --git a/main/default_images/svx/res/symphony/axial.png b/main/default_images/svx/res/symphony/axial.png
new file mode 100755
index 0000000..8b398be
--- /dev/null
+++ b/main/default_images/svx/res/symphony/axial.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/axial_h.png b/main/default_images/svx/res/symphony/axial_h.png
new file mode 100755
index 0000000..5771323
--- /dev/null
+++ b/main/default_images/svx/res/symphony/axial_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/blank.png b/main/default_images/svx/res/symphony/blank.png
new file mode 100755
index 0000000..d38ff9d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/blank.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/decrease font.png b/main/default_images/svx/res/symphony/decrease font.png
new file mode 100755
index 0000000..183e009
--- /dev/null
+++ b/main/default_images/svx/res/symphony/decrease font.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ellipsoid.png b/main/default_images/svx/res/symphony/ellipsoid.png
new file mode 100755
index 0000000..babaf75
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ellipsoid.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/ellipsoid_h.png b/main/default_images/svx/res/symphony/ellipsoid_h.png
new file mode 100755
index 0000000..2a38b32
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ellipsoid_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/enlarge font.png b/main/default_images/svx/res/symphony/enlarge font.png
new file mode 100755
index 0000000..86c6e5d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/enlarge font.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/fill_color.png b/main/default_images/svx/res/symphony/fill_color.png
new file mode 100755
index 0000000..1d88375
--- /dev/null
+++ b/main/default_images/svx/res/symphony/fill_color.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/fill_color_h.png b/main/default_images/svx/res/symphony/fill_color_h.png
new file mode 100755
index 0000000..7cbafa5
--- /dev/null
+++ b/main/default_images/svx/res/symphony/fill_color_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/icon_normal.png b/main/default_images/svx/res/symphony/icon_normal.png
new file mode 100755
index 0000000..f69ec05
--- /dev/null
+++ b/main/default_images/svx/res/symphony/icon_normal.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/last_custom_common.png b/main/default_images/svx/res/symphony/last_custom_common.png
new file mode 100755
index 0000000..bbbe325
--- /dev/null
+++ b/main/default_images/svx/res/symphony/last_custom_common.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/last_custom_common_grey.png b/main/default_images/svx/res/symphony/last_custom_common_grey.png
new file mode 100755
index 0000000..c95062e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/last_custom_common_grey.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line1.png b/main/default_images/svx/res/symphony/line1.png
new file mode 100755
index 0000000..7b667d5
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line10.png b/main/default_images/svx/res/symphony/line10.png
new file mode 100755
index 0000000..956c4f0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line10.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line10_h.png b/main/default_images/svx/res/symphony/line10_h.png
new file mode 100755
index 0000000..6c81727
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line10_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line1_h.png b/main/default_images/svx/res/symphony/line1_h.png
new file mode 100755
index 0000000..8e5dd3a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line1_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line2.png b/main/default_images/svx/res/symphony/line2.png
new file mode 100755
index 0000000..d7c2cae
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line2_h.png b/main/default_images/svx/res/symphony/line2_h.png
new file mode 100755
index 0000000..ad3c78b
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line2_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line3.png b/main/default_images/svx/res/symphony/line3.png
new file mode 100755
index 0000000..0c74e41
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line3_h.png b/main/default_images/svx/res/symphony/line3_h.png
new file mode 100755
index 0000000..2d91489
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line3_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line4.png b/main/default_images/svx/res/symphony/line4.png
new file mode 100755
index 0000000..5dc8938
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line4.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line4_h.png b/main/default_images/svx/res/symphony/line4_h.png
new file mode 100755
index 0000000..f62c84d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line4_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line5.png b/main/default_images/svx/res/symphony/line5.png
new file mode 100755
index 0000000..2f90aed
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line5_h.png b/main/default_images/svx/res/symphony/line5_h.png
new file mode 100755
index 0000000..74d7fad
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line5_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line6.png b/main/default_images/svx/res/symphony/line6.png
new file mode 100755
index 0000000..10a7ced
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line6.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line6_h.png b/main/default_images/svx/res/symphony/line6_h.png
new file mode 100755
index 0000000..52d4a9a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line6_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line7.png b/main/default_images/svx/res/symphony/line7.png
new file mode 100755
index 0000000..ff1df90
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line7.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line7_h.png b/main/default_images/svx/res/symphony/line7_h.png
new file mode 100755
index 0000000..7592f02
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line7_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line8.png b/main/default_images/svx/res/symphony/line8.png
new file mode 100755
index 0000000..5355d76
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line8.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line8_h.png b/main/default_images/svx/res/symphony/line8_h.png
new file mode 100755
index 0000000..57b3e49
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line8_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line9.png b/main/default_images/svx/res/symphony/line9.png
new file mode 100755
index 0000000..ba822a7
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line9.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/line9_h.png b/main/default_images/svx/res/symphony/line9_h.png
new file mode 100755
index 0000000..700a2b0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/line9_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/linear.png b/main/default_images/svx/res/symphony/linear.png
new file mode 100755
index 0000000..a9c3191
--- /dev/null
+++ b/main/default_images/svx/res/symphony/linear.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/linear_h.png b/main/default_images/svx/res/symphony/linear_h.png
new file mode 100755
index 0000000..23b7a18
--- /dev/null
+++ b/main/default_images/svx/res/symphony/linear_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/list.txt b/main/default_images/svx/res/symphony/list.txt
new file mode 100644
index 0000000..afcef80
--- /dev/null
+++ b/main/default_images/svx/res/symphony/list.txt
@@ -0,0 +1,70 @@
+mv bla/"axial.png" .
+mv bla/"axial_h.png" .
+mv bla/"decrease font.png" .
+mv bla/"ellipsoid.png" .
+mv bla/"ellipsoid_h.png" .
+mv bla/"enlarge font.png" .
+mv bla/"fill_color.png" .
+mv bla/"fill_color_h.png" .
+mv bla/"Highlight.png" .
+mv bla/"icon_normal.png" .
+mv bla/"last_custom_common.png" .
+mv bla/"last_custom_common_grey.png" .
+mv bla/"line1.png" .
+mv bla/"line1_h.png" .
+mv bla/"line10.png" .
+mv bla/"line10_h.png" .
+mv bla/"line2.png" .
+mv bla/"line2_h.png" .
+mv bla/"line3.png" .
+mv bla/"line3_h.png" .
+mv bla/"line4.png" .
+mv bla/"line4_h.png" .
+mv bla/"line5.png" .
+mv bla/"line5_h.png" .
+mv bla/"line6.png" .
+mv bla/"line6_h.png" .
+mv bla/"line7.png" .
+mv bla/"line7_h.png" .
+mv bla/"line8.png" .
+mv bla/"line8_h.png" .
+mv bla/"line9.png" .
+mv bla/"line9_h.png" .
+mv bla/"linear.png" .
+mv bla/"linear_h.png" .
+mv bla/"Quadratic.png" .
+mv bla/"Quadratic_h.png" .
+mv bla/"radial.png" .
+mv bla/"radial_h.png" .
+mv bla/"rotate_left.png" .
+mv bla/"rotate_right.png" .
+mv bla/"sc_bold.png" .
+mv bla/"sc_color.png" .
+mv bla/"sc_italic.png" .
+mv bla/"sc_shadowed.png" .
+mv bla/"sc_strikeout.png" .
+mv bla/"sc_subscript.png" .
+mv bla/"sc_superscript.png" .
+mv bla/"sc_underline.png" .
+mv bla/"selected-line1.png" .
+mv bla/"selected-line10.png" .
+mv bla/"selected-line2.png" .
+mv bla/"selected-line3.png" .
+mv bla/"selected-line4.png" .
+mv bla/"selected-line5.png" .
+mv bla/"selected-line6.png" .
+mv bla/"selected-line7.png" .
+mv bla/"selected-line8.png" .
+mv bla/"selected-line9.png" .
+mv bla/"spacing_loose.png" .
+mv bla/"spacing_loose_s.png" .
+mv bla/"spacing_normal.png" .
+mv bla/"spacing_normal_s.png" .
+mv bla/"spacing_tight.png" .
+mv bla/"spacing_tight_s.png" .
+mv bla/"spacing_very loose.png" .
+mv bla/"spacing_very loose_s.png" .
+mv bla/"spacing_very tight.png" .
+mv bla/"spacing_very tight_s.png" .
+mv bla/"Square.png" .
+mv bla/"Square_h.png" .
diff --git a/main/default_images/svx/res/symphony/lpselected-spacing-1.png b/main/default_images/svx/res/symphony/lpselected-spacing-1.png
new file mode 100755
index 0000000..0986365
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpselected-spacing-1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpselected-spacing-1_15.png b/main/default_images/svx/res/symphony/lpselected-spacing-1_15.png
new file mode 100755
index 0000000..97337b0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpselected-spacing-1_15.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpselected-spacing-1_5.png b/main/default_images/svx/res/symphony/lpselected-spacing-1_5.png
new file mode 100755
index 0000000..90b2532
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpselected-spacing-1_5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpselected-spacing-2.png b/main/default_images/svx/res/symphony/lpselected-spacing-2.png
new file mode 100755
index 0000000..4549b90
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpselected-spacing-2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpsmall-spacing-1.png b/main/default_images/svx/res/symphony/lpsmall-spacing-1.png
new file mode 100755
index 0000000..b6afc43
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpsmall-spacing-1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpspacing-1.png b/main/default_images/svx/res/symphony/lpspacing-1.png
new file mode 100755
index 0000000..6aefacf
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpspacing-1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpspacing-1_15.png b/main/default_images/svx/res/symphony/lpspacing-1_15.png
new file mode 100755
index 0000000..01c861d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpspacing-1_15.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpspacing-1_5.png b/main/default_images/svx/res/symphony/lpspacing-1_5.png
new file mode 100755
index 0000000..27708ca
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpspacing-1_5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/lpspacing-2.png b/main/default_images/svx/res/symphony/lpspacing-2.png
new file mode 100755
index 0000000..12f0fcd
--- /dev/null
+++ b/main/default_images/svx/res/symphony/lpspacing-2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/no color.png b/main/default_images/svx/res/symphony/no color.png
new file mode 100755
index 0000000..7442b74
--- /dev/null
+++ b/main/default_images/svx/res/symphony/no color.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbullet01.png b/main/default_images/svx/res/symphony/para_numbullet01.png
new file mode 100755
index 0000000..8cb0cc7
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbullet01.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbullet02.png b/main/default_images/svx/res/symphony/para_numbullet02.png
new file mode 100755
index 0000000..f283c8a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbullet02.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbullet_rtl01.png b/main/default_images/svx/res/symphony/para_numbullet_rtl01.png
new file mode 100755
index 0000000..cae4193
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbullet_rtl01.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbullet_rtl02.png b/main/default_images/svx/res/symphony/para_numbullet_rtl02.png
new file mode 100755
index 0000000..c5ecb4b
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbullet_rtl02.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbulleth01.png b/main/default_images/svx/res/symphony/para_numbulleth01.png
new file mode 100755
index 0000000..6bf74ad
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbulleth01.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_numbulleth02.png b/main/default_images/svx/res/symphony/para_numbulleth02.png
new file mode 100755
index 0000000..8405c70
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_numbulleth02.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_vert01.png b/main/default_images/svx/res/symphony/para_vert01.png
new file mode 100755
index 0000000..275133c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_vert01.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_vert02.png b/main/default_images/svx/res/symphony/para_vert02.png
new file mode 100755
index 0000000..919edab
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_vert02.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_vert03.png b/main/default_images/svx/res/symphony/para_vert03.png
new file mode 100755
index 0000000..de22c24
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_vert03.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_verth01.png b/main/default_images/svx/res/symphony/para_verth01.png
new file mode 100755
index 0000000..9493fba
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_verth01.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_verth02.png b/main/default_images/svx/res/symphony/para_verth02.png
new file mode 100755
index 0000000..66470c7
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_verth02.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/para_verth03.png b/main/default_images/svx/res/symphony/para_verth03.png
new file mode 100755
index 0000000..bf889ac
--- /dev/null
+++ b/main/default_images/svx/res/symphony/para_verth03.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/radial.png b/main/default_images/svx/res/symphony/radial.png
new file mode 100755
index 0000000..bb44a0c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/radial.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/radial_h.png b/main/default_images/svx/res/symphony/radial_h.png
new file mode 100755
index 0000000..1971f58
--- /dev/null
+++ b/main/default_images/svx/res/symphony/radial_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rotate_left.png b/main/default_images/svx/res/symphony/rotate_left.png
new file mode 100755
index 0000000..b537b6b
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rotate_left.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rotate_right.png b/main/default_images/svx/res/symphony/rotate_right.png
new file mode 100755
index 0000000..217cf91
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rotate_right.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rotation.png b/main/default_images/svx/res/symphony/rotation.png
new file mode 100755
index 0000000..3d197de
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rotation.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rotation_h.png b/main/default_images/svx/res/symphony/rotation_h.png
new file mode 100755
index 0000000..874fb82
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rotation_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rte_Indent_16x16.png b/main/default_images/svx/res/symphony/rte_Indent_16x16.png
new file mode 100755
index 0000000..28c90a3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rte_Indent_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/rte_Outdent_16x16.png b/main/default_images/svx/res/symphony/rte_Outdent_16x16.png
new file mode 100755
index 0000000..ceae7d3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/rte_Outdent_16x16.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_backgroundcolor.png b/main/default_images/svx/res/symphony/sc_backgroundcolor.png
new file mode 100755
index 0000000..7f926b6
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_backgroundcolor.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_bold.png b/main/default_images/svx/res/symphony/sc_bold.png
new file mode 100755
index 0000000..2f610b2
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_bold.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_color.png b/main/default_images/svx/res/symphony/sc_color.png
new file mode 100755
index 0000000..f11f218
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_color.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_italic.png b/main/default_images/svx/res/symphony/sc_italic.png
new file mode 100755
index 0000000..0ccd22e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_italic.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_shadowed.png b/main/default_images/svx/res/symphony/sc_shadowed.png
new file mode 100755
index 0000000..7d3a699
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_shadowed.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_strikeout.png b/main/default_images/svx/res/symphony/sc_strikeout.png
new file mode 100755
index 0000000..58d2794
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_strikeout.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_subscript.png b/main/default_images/svx/res/symphony/sc_subscript.png
new file mode 100755
index 0000000..682e6f1
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_subscript.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_superscript.png b/main/default_images/svx/res/symphony/sc_superscript.png
new file mode 100755
index 0000000..33fd1ec
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_superscript.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sc_underline.png b/main/default_images/svx/res/symphony/sc_underline.png
new file mode 100755
index 0000000..b2071c5
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sc_underline.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/sch_backgroundcolor.png b/main/default_images/svx/res/symphony/sch_backgroundcolor.png
new file mode 100755
index 0000000..a2e234f
--- /dev/null
+++ b/main/default_images/svx/res/symphony/sch_backgroundcolor.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line1.png b/main/default_images/svx/res/symphony/selected-line1.png
new file mode 100755
index 0000000..99921b3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line10.png b/main/default_images/svx/res/symphony/selected-line10.png
new file mode 100755
index 0000000..cca4848
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line10.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line2.png b/main/default_images/svx/res/symphony/selected-line2.png
new file mode 100755
index 0000000..4e68e6b
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line3.png b/main/default_images/svx/res/symphony/selected-line3.png
new file mode 100755
index 0000000..425869e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line4.png b/main/default_images/svx/res/symphony/selected-line4.png
new file mode 100755
index 0000000..7fa3f7e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line4.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line5.png b/main/default_images/svx/res/symphony/selected-line5.png
new file mode 100755
index 0000000..60e266c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line6.png b/main/default_images/svx/res/symphony/selected-line6.png
new file mode 100755
index 0000000..e89d199
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line6.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line7.png b/main/default_images/svx/res/symphony/selected-line7.png
new file mode 100755
index 0000000..c53fd70
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line7.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line8.png b/main/default_images/svx/res/symphony/selected-line8.png
new file mode 100755
index 0000000..b24ab55
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line8.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/selected-line9.png b/main/default_images/svx/res/symphony/selected-line9.png
new file mode 100755
index 0000000..c6e266e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/selected-line9.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing1.png b/main/default_images/svx/res/symphony/spacing1.png
new file mode 100755
index 0000000..9e1f483
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing2.png b/main/default_images/svx/res/symphony/spacing2.png
new file mode 100755
index 0000000..f4ae81a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing3.png b/main/default_images/svx/res/symphony/spacing3.png
new file mode 100755
index 0000000..106e0ed
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_loose.png b/main/default_images/svx/res/symphony/spacing_loose.png
new file mode 100755
index 0000000..5ab9f3e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_loose.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_loose_s.png b/main/default_images/svx/res/symphony/spacing_loose_s.png
new file mode 100755
index 0000000..46e2f24
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_loose_s.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_normal.png b/main/default_images/svx/res/symphony/spacing_normal.png
new file mode 100755
index 0000000..bf7d547
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_normal.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_normal_s.png b/main/default_images/svx/res/symphony/spacing_normal_s.png
new file mode 100755
index 0000000..76097b3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_normal_s.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_tight.png b/main/default_images/svx/res/symphony/spacing_tight.png
new file mode 100755
index 0000000..ac469db
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_tight.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_tight_s.png b/main/default_images/svx/res/symphony/spacing_tight_s.png
new file mode 100755
index 0000000..dbb969c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_tight_s.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_very loose.png b/main/default_images/svx/res/symphony/spacing_very loose.png
new file mode 100755
index 0000000..04f3969
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_very loose.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_very loose_s.png b/main/default_images/svx/res/symphony/spacing_very loose_s.png
new file mode 100755
index 0000000..21f5784
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_very loose_s.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_very tight.png b/main/default_images/svx/res/symphony/spacing_very tight.png
new file mode 100755
index 0000000..84845c3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_very tight.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/spacing_very tight_s.png b/main/default_images/svx/res/symphony/spacing_very tight_s.png
new file mode 100755
index 0000000..19b4856
--- /dev/null
+++ b/main/default_images/svx/res/symphony/spacing_very tight_s.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line1.png b/main/default_images/svx/res/symphony/style_line1.png
new file mode 100755
index 0000000..6403c06
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line10.png b/main/default_images/svx/res/symphony/style_line10.png
new file mode 100755
index 0000000..f7d1e34
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line10.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line10_h.png b/main/default_images/svx/res/symphony/style_line10_h.png
new file mode 100755
index 0000000..d5925aa
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line10_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line10_hh.png b/main/default_images/svx/res/symphony/style_line10_hh.png
new file mode 100755
index 0000000..60c1e36
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line10_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line11.png b/main/default_images/svx/res/symphony/style_line11.png
new file mode 100755
index 0000000..4400dd3
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line11.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line11_h.png b/main/default_images/svx/res/symphony/style_line11_h.png
new file mode 100755
index 0000000..1e6be19
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line11_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line11_hh.png b/main/default_images/svx/res/symphony/style_line11_hh.png
new file mode 100755
index 0000000..31fec10
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line11_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line1_h.png b/main/default_images/svx/res/symphony/style_line1_h.png
new file mode 100755
index 0000000..eadd40e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line1_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line1_hh.png b/main/default_images/svx/res/symphony/style_line1_hh.png
new file mode 100755
index 0000000..c91010a
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line1_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line2.png b/main/default_images/svx/res/symphony/style_line2.png
new file mode 100755
index 0000000..4269c7d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line2_h.png b/main/default_images/svx/res/symphony/style_line2_h.png
new file mode 100755
index 0000000..3658e18
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line2_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line2_hh.png b/main/default_images/svx/res/symphony/style_line2_hh.png
new file mode 100755
index 0000000..4bae815
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line2_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line3.png b/main/default_images/svx/res/symphony/style_line3.png
new file mode 100755
index 0000000..3e03ad0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line3_h.png b/main/default_images/svx/res/symphony/style_line3_h.png
new file mode 100755
index 0000000..1636e05
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line3_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line3_hh.png b/main/default_images/svx/res/symphony/style_line3_hh.png
new file mode 100755
index 0000000..1ab133f
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line3_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line4.png b/main/default_images/svx/res/symphony/style_line4.png
new file mode 100755
index 0000000..21c1115
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line4.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line4_h.png b/main/default_images/svx/res/symphony/style_line4_h.png
new file mode 100755
index 0000000..3574140
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line4_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line4_hh.png b/main/default_images/svx/res/symphony/style_line4_hh.png
new file mode 100755
index 0000000..d7b17f4
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line4_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line5.png b/main/default_images/svx/res/symphony/style_line5.png
new file mode 100755
index 0000000..8648065
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line5_h.png b/main/default_images/svx/res/symphony/style_line5_h.png
new file mode 100755
index 0000000..5d387d4
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line5_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line5_hh.png b/main/default_images/svx/res/symphony/style_line5_hh.png
new file mode 100755
index 0000000..c6436ac
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line5_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line6.png b/main/default_images/svx/res/symphony/style_line6.png
new file mode 100755
index 0000000..b0b8d7c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line6.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line6_h.png b/main/default_images/svx/res/symphony/style_line6_h.png
new file mode 100755
index 0000000..4a34861
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line6_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line6_hh.png b/main/default_images/svx/res/symphony/style_line6_hh.png
new file mode 100755
index 0000000..8868076
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line6_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line7.png b/main/default_images/svx/res/symphony/style_line7.png
new file mode 100755
index 0000000..e30fc03
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line7.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line7_h.png b/main/default_images/svx/res/symphony/style_line7_h.png
new file mode 100755
index 0000000..8718ef0
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line7_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line7_hh.png b/main/default_images/svx/res/symphony/style_line7_hh.png
new file mode 100755
index 0000000..76d0afa
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line7_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line8.png b/main/default_images/svx/res/symphony/style_line8.png
new file mode 100755
index 0000000..5c3ed31
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line8.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line8_h.png b/main/default_images/svx/res/symphony/style_line8_h.png
new file mode 100755
index 0000000..db769a4
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line8_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line8_hh.png b/main/default_images/svx/res/symphony/style_line8_hh.png
new file mode 100755
index 0000000..a1ca0e8
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line8_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line9.png b/main/default_images/svx/res/symphony/style_line9.png
new file mode 100755
index 0000000..10035ba
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line9.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line9_h.png b/main/default_images/svx/res/symphony/style_line9_h.png
new file mode 100755
index 0000000..91062da
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line9_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/style_line9_hh.png b/main/default_images/svx/res/symphony/style_line9_hh.png
new file mode 100755
index 0000000..4726c7c
--- /dev/null
+++ b/main/default_images/svx/res/symphony/style_line9_hh.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width1.png b/main/default_images/svx/res/symphony/width1.png
new file mode 100755
index 0000000..8faeb43
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width1.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width1_h.png b/main/default_images/svx/res/symphony/width1_h.png
new file mode 100755
index 0000000..1f14d89
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width1_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width2.png b/main/default_images/svx/res/symphony/width2.png
new file mode 100755
index 0000000..e657468
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width2.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width2_h.png b/main/default_images/svx/res/symphony/width2_h.png
new file mode 100755
index 0000000..9a30e3f
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width2_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width3.png b/main/default_images/svx/res/symphony/width3.png
new file mode 100755
index 0000000..dfe3216
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width3.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width3_h.png b/main/default_images/svx/res/symphony/width3_h.png
new file mode 100755
index 0000000..80e2e22
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width3_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width4.png b/main/default_images/svx/res/symphony/width4.png
new file mode 100755
index 0000000..d19ac86
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width4.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width4_h.png b/main/default_images/svx/res/symphony/width4_h.png
new file mode 100755
index 0000000..142768e
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width4_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width5.png b/main/default_images/svx/res/symphony/width5.png
new file mode 100755
index 0000000..de6fb7f
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width5.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width5_h.png b/main/default_images/svx/res/symphony/width5_h.png
new file mode 100755
index 0000000..93100fa
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width5_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width6.png b/main/default_images/svx/res/symphony/width6.png
new file mode 100755
index 0000000..27e3cad
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width6.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width6_h.png b/main/default_images/svx/res/symphony/width6_h.png
new file mode 100755
index 0000000..30a9e32
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width6_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width7.png b/main/default_images/svx/res/symphony/width7.png
new file mode 100755
index 0000000..5bd3cfe
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width7.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width7_h.png b/main/default_images/svx/res/symphony/width7_h.png
new file mode 100755
index 0000000..6a51fda
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width7_h.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width8.png b/main/default_images/svx/res/symphony/width8.png
new file mode 100755
index 0000000..1cbb7eb
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width8.png
Binary files differ
diff --git a/main/default_images/svx/res/symphony/width8_h.png b/main/default_images/svx/res/symphony/width8_h.png
new file mode 100755
index 0000000..6021968
--- /dev/null
+++ b/main/default_images/svx/res/symphony/width8_h.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png
new file mode 100755
index 0000000..ce13721
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column1_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column1_24x24.png
new file mode 100755
index 0000000..48f4a8b
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column1_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column2_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column2_24x24.png
new file mode 100755
index 0000000..d8a2de4
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column2_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column3_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column3_24x24.png
new file mode 100755
index 0000000..5869559
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column3_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_1_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_1_24x24.png
new file mode 100755
index 0000000..bac5e3f
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_1_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_2_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_2_24x24.png
new file mode 100755
index 0000000..146b666
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_2_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_3_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_3_24x24.png
new file mode 100755
index 0000000..11ee375
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_3_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png
new file mode 100755
index 0000000..747ac4d
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_left_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_left_24x24.png
new file mode 100755
index 0000000..c6a9f0c
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_left_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/column_L_right_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/column_L_right_24x24.png
new file mode 100755
index 0000000..ccdecfe
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/column_L_right_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/columncopy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/columncopy_24x24.png
new file mode 100755
index 0000000..983da8b
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/columncopy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/columnleft_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/columnleft_24x24.png
new file mode 100755
index 0000000..c61c76a
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/columnleft_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/columnright_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/columnright_24x24.png
new file mode 100755
index 0000000..9421fab
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/columnright_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png
new file mode 100755
index 0000000..e950728
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png
new file mode 100755
index 0000000..3039746
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png
new file mode 100755
index 0000000..2e73f5d
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png
new file mode 100755
index 0000000..8456ef4
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png
new file mode 100755
index 0000000..21b3746
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png
new file mode 100755
index 0000000..91501da
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png
new file mode 100755
index 0000000..a32119d
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png
new file mode 100755
index 0000000..5cd5f8e
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png
new file mode 100755
index 0000000..cc4d2cb
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png
new file mode 100755
index 0000000..e1d1bcf
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png
new file mode 100755
index 0000000..0e76272
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png
new file mode 100755
index 0000000..2c880f8
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png
new file mode 100755
index 0000000..608d5a5
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png
new file mode 100755
index 0000000..ce13c36
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png
new file mode 100755
index 0000000..747ac4d
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png
new file mode 100755
index 0000000..aa93fbc
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png
new file mode 100755
index 0000000..e6d2579
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png
new file mode 100755
index 0000000..840ca80
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png
new file mode 100755
index 0000000..a47c1ca
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/formatcopy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/formatcopy_24x24.png
new file mode 100755
index 0000000..983da8b
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/formatcopy_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/formatmirror_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/formatmirror_24x24.png
new file mode 100755
index 0000000..696ca11
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/formatmirror_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png
new file mode 100755
index 0000000..2f4b0e4
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/formatnormal_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/formatnormal_24x24.png
new file mode 100755
index 0000000..83fea86
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/formatnormal_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/formatwide_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/formatwide_24x24.png
new file mode 100755
index 0000000..b260b07
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/formatwide_24x24.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common.png b/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common.png
new file mode 100755
index 0000000..bbbe325
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common_grey.png b/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common_grey.png
new file mode 100755
index 0000000..c95062e
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/last_custom_common_grey.png
Binary files differ
diff --git a/main/default_images/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png b/main/default_images/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png
new file mode 100755
index 0000000..e39324a
--- /dev/null
+++ b/main/default_images/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png
Binary files differ
diff --git a/main/editeng/inc/editeng/itemtype.hxx b/main/editeng/inc/editeng/itemtype.hxx
index bf101b5..126f10d 100644
--- a/main/editeng/inc/editeng/itemtype.hxx
+++ b/main/editeng/inc/editeng/itemtype.hxx
@@ -37,7 +37,6 @@
 #include "editeng/editengdllapi.h"
 
 class Color;
-class XColorTable;
 class IntlWrapper;
 // static and prototypes -------------------------------------------------
 
diff --git a/main/editeng/inc/editeng/outliner.hxx b/main/editeng/inc/editeng/outliner.hxx
index 6cd8502..feb1ea3 100644
--- a/main/editeng/inc/editeng/outliner.hxx
+++ b/main/editeng/inc/editeng/outliner.hxx
@@ -37,7 +37,7 @@
 #include <tools/link.hxx>
 #include <rsc/rscsfx.hxx>
 #include "editeng/editengdllapi.h"
-
+#include <editeng/numitem.hxx>
 #include <svtools/grfmgr.hxx>
 
 #include <tools/rtti.hxx>	// wegen typedef TypeId
@@ -372,7 +372,8 @@
 		or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
 	*/
 	void        ToggleBullets();
-
+	sal_Bool	ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false);
+	sal_Bool        ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL);
 	/** enables numbering for the selected paragraphs that are not enabled and ignore all selected
 		paragraphs that already have numbering enabled.
 	*/
@@ -1049,6 +1050,8 @@
 
     virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
     virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+
+    sal_Int16 GetBulletsNumberingStatus();
 };
 
 #endif
diff --git a/main/editeng/source/items/textitem.cxx b/main/editeng/source/items/textitem.cxx
index 00be4ab..58514d2 100644
--- a/main/editeng/source/items/textitem.cxx
+++ b/main/editeng/source/items/textitem.cxx
@@ -3785,6 +3785,16 @@
 		rAsian = SID_ATTR_CHAR_CJK_LANGUAGE;
 		rComplex = SID_ATTR_CHAR_CTL_LANGUAGE;
 		break;
+    case SID_ATTR_CHAR_SHADOWED:
+		rLatin = SID_ATTR_CHAR_SHADOWED;
+		rAsian = SID_ATTR_CHAR_SHADOWED;
+		rComplex = SID_ATTR_CHAR_SHADOWED;
+		break;
+	case SID_ATTR_CHAR_STRIKEOUT:
+		rLatin = SID_ATTR_CHAR_STRIKEOUT;
+		rAsian = SID_ATTR_CHAR_STRIKEOUT;
+		rComplex = SID_ATTR_CHAR_STRIKEOUT;
+		break;
 	}
 }
 
diff --git a/main/editeng/source/outliner/outliner.cxx b/main/editeng/source/outliner/outliner.cxx
index 25447da..3f683af 100644
--- a/main/editeng/source/outliner/outliner.cxx
+++ b/main/editeng/source/outliner/outliner.cxx
@@ -370,6 +370,53 @@
     }
 }
 
+sal_Int16 Outliner::GetBulletsNumberingStatus()
+{
+	sal_Bool bHasBulletsNumbering = FALSE;
+	sal_uInt16 nParaCount = (sal_uInt16)(pParaList->GetParagraphCount());
+	for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+	{
+		if ((bHasBulletsNumbering = ImplHasBullet(nPara)))
+		{
+			break;
+		}
+	}
+	sal_uInt16 nBulletsCount = 0;
+	sal_uInt16 nNumberingCount = 0;
+	if (bHasBulletsNumbering)
+	{
+		// At least have one paragraph that having bullets or numbering.
+		for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+		{
+			Paragraph* pPara = pParaList->GetParagraph(nPara);
+			const SfxItemSet& rAttrs = GetParaAttribs(nPara);
+			if (!pPara)
+			{
+				continue;
+			}
+			const SvxNumberFormat* pFmt = GetNumberFormat(nPara);
+			if (!pFmt)
+			{
+				// At least, exists one paragraph that has no Bullets/Numbering.
+				break;
+			}
+			else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL))
+			{
+				// Having Bullets in this paragraph.
+				nBulletsCount++;
+			}
+			else
+			{
+				// Having Numbering in this paragraph.
+				nNumberingCount++;
+			}
+		}
+	}
+	sal_Int16 nValue = (nBulletsCount == nParaCount) ? 0 : 2;
+	nValue = (nNumberingCount == nParaCount) ? 1 : nValue;
+	return nValue;
+}
+
 OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const
 {
 	DBG_CHKTHIS(Outliner,0);
diff --git a/main/editeng/source/outliner/outlvw.cxx b/main/editeng/source/outliner/outlvw.cxx
index cdb83f3..a9fc4af 100644
--- a/main/editeng/source/outliner/outlvw.cxx
+++ b/main/editeng/source/outliner/outlvw.cxx
@@ -50,6 +50,7 @@
 #include <editeng/numitem.hxx>
 #include <vcl/window.hxx>
 #include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
 #include <editeng/editstat.hxx>
 
 
@@ -1232,6 +1233,205 @@
 	pOwner->UndoActionEnd( OLUNDO_DEPTH );
 }
 
+sal_Bool	OutlinerView::ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff)
+{
+	pOwner->UndoActionStart( OLUNDO_DEPTH );
+
+	ESelection aSel( pEditView->GetSelection() );
+	aSel.Adjust();
+
+	const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
+	pOwner->pEditEngine->SetUpdateMode( sal_False );
+
+	sal_Int16 nDepth = -2;
+	sal_Bool bRet = sal_False;
+
+	//Modified by xuezhiy for bullet enhancement
+	bool bBulletOn = sal_True;
+
+	if( bBulletOnOff )
+	{
+		bool bHasBullet = sal_False;
+		for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+		{
+			bHasBullet = pOwner->ImplHasBullet(nPara);
+			if(bHasBullet)
+				break;
+		}
+
+		if( bHasBullet )
+		{			
+			bBulletOn = sal_False;
+
+			for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+			{
+				Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
+				DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
+
+				const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
+				if( pPara )
+				{					
+					const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
+					
+					if( !pFmt )
+					{
+						// Has no Bullet paragraph
+						bBulletOn = sal_True;
+						break;
+					}
+					else if( ( pFmt->GetNumberingType() == SVX_NUM_BITMAP ) || ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL ) )
+					{
+						// Normal ==>> Numbering
+						if( !bNormalBullet )
+						{
+							bBulletOn = sal_True;
+							break;
+						}
+					}
+					else
+					{		
+						// Numbering ==>> Normal
+						if( bNormalBullet )
+						{
+							bBulletOn = sal_True;
+							break;
+						}
+					}
+				}
+			}
+		}
+
+	}
+	if (bForceBulletOnOff) {
+		bBulletOn = bBulletOnOff;
+	}
+	for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+	{
+		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
+		DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
+
+		if( pPara )	
+		{			
+			bRet = sal_True;
+
+			nDepth = pOwner->GetDepth(nPara);			
+
+			if( bBulletOn && nDepth == -1 )
+			{
+				// Off ==>> On
+				nDepth = 0;
+			}
+			else if( !bBulletOn && nDepth == 0 )
+			{
+				// On ==>> Off
+				nDepth = -1;
+			}
+			pOwner->SetDepth( pPara, nDepth );
+
+			const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
+//			bool bBulletState = ((const SfxBoolItem&) rAttrs.Get( EE_PARA_BULLETSTATE ) ).GetValue();
+
+			SfxItemSet aAttrs(rAttrs);
+			aAttrs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, bBulletOn ) );
+			
+			// Change bullet types
+			if( bBulletOn && pNumRule)
+			{
+				bool bSetBulletType = false;
+				if( !bBulletOnOff )
+				{
+					// Not bullet on/off button	
+					bSetBulletType = true;
+				}
+				else
+				{
+					const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);				
+
+					if( !pFmt )
+					{
+						// Has no bullet
+						bSetBulletType = true;
+					}
+					else
+					{
+						sal_Int16 nNumType = pFmt->GetNumberingType();
+						if( bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL )
+						{
+							// Set to Normal bullet, old bullet type is Numbering bullet
+							bSetBulletType = true;
+						}
+						else if( !bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL) )
+						{
+							// Set to Numbering bullet, old bullet type is Normal bullet
+							bSetBulletType = true;
+						}
+					}
+				}
+
+				// Get old bullet space
+				SvxNumRule aNewRule( *pNumRule );
+
+				const SfxPoolItem* pPoolItem=NULL;
+				SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
+				if (eState != SFX_ITEM_SET)
+				{
+					// Use default value when has not contain bullet item
+					ESelection aSelection(nPara, 0);
+					SfxItemSet aTmpSet( pOwner->pEditEngine->GetAttribs( aSelection ) );
+					pPoolItem = aTmpSet.GetItem( EE_PARA_NUMBULLET );
+				}
+
+				const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >( pPoolItem );
+				//const SvxNumBulletItem& rNumBullet = (const SvxNumBulletItem&) rAttrs.Get( EE_PARA_NUMBULLET );
+				if( pNumBulletItem )
+				{
+					sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
+					nLevelCnt = Min( nLevelCnt, pNumRule->GetLevelCount() );
+
+					for( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
+					{
+						const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get( nLevel );
+						const SvxNumberFormat* pNewFmt = pNumRule->Get( nLevel );
+
+						if( pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() 
+							|| pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace() ) )
+						{						
+							SvxNumberFormat* pNewFmtClone = new SvxNumberFormat( *pNewFmt );
+							pNewFmtClone->SetFirstLineOffset( pOldFmt->GetFirstLineOffset() );
+							pNewFmtClone->SetAbsLSpace( pOldFmt->GetAbsLSpace() );
+
+							aNewRule.SetLevel( nLevel, pNewFmtClone );
+							delete pNewFmtClone;
+						}
+					}
+				}
+
+				// Don't set bullet attribute to paragraph in Master view 
+				// Because it will be set into style sheet
+				if( bSetBulletType && !bMasterView )
+					aAttrs.Put(SvxNumBulletItem( aNewRule ), EE_PARA_NUMBULLET);
+			}
+
+			pOwner->SetParaAttribs( nPara, aAttrs );
+			
+		}
+	}
+
+    // --> OD 2009-03-10 #i100014#
+    // It is not a good idea to substract 1 from a count and cast the result
+    // to sal_uInt16 without check, if the count is 0.
+    sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
+    // <--
+    pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
+    pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
+
+	pOwner->pEditEngine->SetUpdateMode( bUpdate );
+
+	pOwner->UndoActionEnd( OLUNDO_DEPTH );
+
+	return bRet;
+}
+
 void OutlinerView::EnableBullets()
 {
 	pOwner->UndoActionStart( OLUNDO_DEPTH );
@@ -1266,6 +1466,126 @@
 	pOwner->UndoActionEnd( OLUNDO_DEPTH );
 }
 
+sal_Bool OutlinerView::ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule)
+{
+	if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
+	{
+		return sal_False;
+	}
+
+	sal_Bool bReturn = sal_False;
+	pOwner->UndoActionStart(OLUNDO_DEPTH);
+	const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
+	pOwner->pEditEngine->SetUpdateMode(sal_False);
+
+	sal_Int16 nDepth = -2;
+	sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount());
+	for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+	{
+		Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+		DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?");
+
+		if (pPara)
+		{
+			bReturn = sal_True;
+			nDepth = pOwner->GetDepth(nPara);
+			if (bToggleOn && nDepth == -1)
+			{
+				// Off ==>> On
+				nDepth = 0;
+			}
+			else if (!bToggleOn && nDepth == 0)
+			{
+				// On ==>> Off
+				nDepth = -1;
+			}
+			pOwner->SetDepth(pPara, nDepth);
+
+			const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
+			SfxItemSet aAttrs(rAttrs);
+			aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn));
+
+			// Change bullet types.
+			if (bToggleOn && pNumRule)
+			{
+				sal_Bool bSetBulletType = sal_False;
+				if (!bBulletOnOffMode)
+				{
+					// Not bullet on/off button.
+					bSetBulletType = sal_True;
+				}
+				else
+				{
+					const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
+					if (!pFmt)
+					{
+						// Has no bullet.
+						bSetBulletType = sal_True;
+					}
+					else
+					{
+						sal_Int16 nNumType = pFmt->GetNumberingType();
+						if (bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
+						{
+							// Set to Normal bullet, old bullet type is Numbering bullet.
+							bSetBulletType = sal_True;
+						}
+						else if (!bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
+						{
+							// Set to Numbering bullet, old bullet type is Normal bullet.
+							bSetBulletType = sal_True;
+						}
+					}
+				}
+
+				// Get old bullet space.
+				SvxNumRule aNewRule(*pNumRule);
+				const SfxPoolItem* pPoolItem=NULL;
+				SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
+				ESelection aSelection(nPara, 0);
+				SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
+				if (eState != SFX_ITEM_SET)
+				{
+					// Use default value when has not contain bullet item.
+					pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
+				}
+
+				const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
+				if (pNumBulletItem)
+				{
+					sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
+					nLevelCnt = Min(nLevelCnt, pNumRule->GetLevelCount());
+
+					for (sal_uInt16 nLevel = 0; nLevel < nLevelCnt; nLevel++)
+					{
+						const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
+						const SvxNumberFormat* pNewFmt = pNumRule->Get(nLevel);
+						if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
+						{
+							SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
+							pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
+							pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
+							aNewRule.SetLevel(nLevel, pNewFmtClone);
+							delete pNewFmtClone;
+						}
+					}
+				}
+
+				// Don't set bullet attribute to paragraph in Master view, because it will be set into style sheet.
+				if (bSetBulletType && !bMasterView)
+					aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
+			}
+			pOwner->SetParaAttribs(nPara, aAttrs);
+		}
+	}
+
+	pOwner->ImplCheckParagraphs(0, nParaCount);
+	pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0));
+	pOwner->pEditEngine->SetUpdateMode(bUpdate);
+	pOwner->UndoActionEnd(OLUNDO_DEPTH);
+
+	return bReturn;
+}
 
 void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
 {
diff --git a/main/extensions/source/propctrlr/standardcontrol.cxx b/main/extensions/source/propctrlr/standardcontrol.cxx
index f383ef3..e02e3c1 100644
--- a/main/extensions/source/propctrlr/standardcontrol.cxx
+++ b/main/extensions/source/propctrlr/standardcontrol.cxx
@@ -682,7 +682,7 @@
         :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle )
 	{
 		// initialize the color listbox
-        XColorTable* pColorTable = NULL;
+        XColorList* pColorTable = NULL;
         SfxObjectShell* pDocSh = SfxObjectShell::Current();
         const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : NULL;
         if ( pItem )
@@ -693,7 +693,7 @@
 
         if ( !pColorTable )
 	    {
-		    pColorTable = XColorTable::GetStdColorTable();
+		    pColorTable = XColorList::GetStdColorList();
 	    }
 
 		
diff --git a/main/filter/source/msfilter/msdffimp.cxx b/main/filter/source/msfilter/msdffimp.cxx
index eb2f8bc..21224ed 100644
--- a/main/filter/source/msfilter/msdffimp.cxx
+++ b/main/filter/source/msfilter/msdffimp.cxx
@@ -1024,11 +1024,11 @@
 		if ( eShapeType == mso_sptMin )
 			eLineJointDefault = mso_lineJoinRound;
 		MSO_LineJoin eLineJoint = (MSO_LineJoin)GetPropertyValue( DFF_Prop_lineJoinStyle, eLineJointDefault );
-		XLineJoint eXLineJoint( XLINEJOINT_MITER );
+		com::sun::star::drawing::LineJoint eXLineJoint( com::sun::star::drawing::LineJoint_MITER );
 		if ( eLineJoint == mso_lineJoinBevel )
-			eXLineJoint = XLINEJOINT_BEVEL;
+			eXLineJoint = com::sun::star::drawing::LineJoint_BEVEL;
 		else if ( eLineJoint == mso_lineJoinRound )
-			eXLineJoint = XLINEJOINT_ROUND;
+			eXLineJoint = com::sun::star::drawing::LineJoint_ROUND;
 		rSet.Put( XLineJointItem( eXLineJoint ) );
 
 		if ( nLineFlags & 0x10 )
diff --git a/main/framework/Library_fwk.mk b/main/framework/Library_fwk.mk
index 63c72c5..dd18808 100644
--- a/main/framework/Library_fwk.mk
+++ b/main/framework/Library_fwk.mk
@@ -116,6 +116,7 @@
 	framework/source/services/backingcomp \
 	framework/source/services/backingwindow \
 	framework/source/services/desktop \
+	framework/source/services/ContextChangeEventMultiplexer \
 	framework/source/services/frame \
 	framework/source/services/modelwinservice \
 	framework/source/services/modulemanager \
diff --git a/main/framework/inc/macros/registration.hxx b/main/framework/inc/macros/registration.hxx
index 34efc70..61fab60 100644
--- a/main/framework/inc/macros/registration.hxx
+++ b/main/framework/inc/macros/registration.hxx
@@ -102,7 +102,7 @@
 		{																																\
 			LOG_REGISTRATION_GETFACTORY( "\t\tpImplementationName and pServiceManager are valid ...\n" )								\
 			/* Define variables which are used in following macros. */																	\
-			::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >	xFactory			;					\
+			::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >	xFactory			;					\
 			::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >	xServiceManager		;					\
 			xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager )	;					\
 			/* These parameter will expand to      */																					\
diff --git a/main/framework/inc/services/ContextChangeEventMultiplexer.hxx b/main/framework/inc/services/ContextChangeEventMultiplexer.hxx
new file mode 100644
index 0000000..77c50ae
--- /dev/null
+++ b/main/framework/inc/services/ContextChangeEventMultiplexer.hxx
@@ -0,0 +1,144 @@
+/**************************************************************
+ * 
+ * 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 __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
+#define __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
+
+#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "macros/xserviceinfo.hxx"
+
+#include <map>
+#include <boost/noncopyable.hpp>
+
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper4 <
+        css::ui::XContextChangeEventMultiplexer,
+        css::lang::XSingleComponentFactory,
+        css::lang::XServiceInfo,
+        css::lang::XEventListener
+        > ContextChangeEventMultiplexerInterfaceBase;
+}
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssl = ::com::sun::star::lang;
+
+namespace framework {
+
+class ContextChangeEventMultiplexer
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public ContextChangeEventMultiplexerInterfaceBase
+{
+public:
+    ContextChangeEventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext);
+    virtual ~ContextChangeEventMultiplexer (void);
+
+    virtual void SAL_CALL disposing (void);
+
+    // XContextChangeEventMultiplexer
+    virtual void SAL_CALL addContextChangeEventListener (
+        const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL removeContextChangeEventListener (
+        const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL removeAllContextChangeEventListeners (
+        const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL broadcastContextChangeEvent (
+        const css::ui::ContextChangeEventObject& rContextChangeEventObject,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException);
+
+    // XSingleComponentFactory
+    virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext (
+        const cssu::Reference<cssu::XComponentContext>& rxContext)
+        throw (cssu::Exception, cssu::RuntimeException);
+    virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext (
+        const cssu::Sequence<cssu::Any>& rArguments,
+        const cssu::Reference<cssu::XComponentContext>& rxContext)
+        throw (cssu::Exception, cssu::RuntimeException);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+        throw (cssu::RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService  (
+        const ::rtl::OUString& rsServiceName)
+        throw (cssu::RuntimeException);
+    virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void)
+        throw (cssu::RuntimeException);
+
+    // XEventListener
+    virtual void SAL_CALL disposing (
+        const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+    
+    static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory (
+        const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager);
+
+private:
+    typedef ::std::vector<cssu::Reference<css::ui::XContextChangeEventListener> > ListenerContainer;
+    class FocusDescriptor
+    {
+    public:
+        ListenerContainer maListeners;
+        ::rtl::OUString msCurrentApplicationName;
+        ::rtl::OUString msCurrentContextName;
+    };
+    typedef ::std::map<cssu::Reference<cssu::XInterface>, FocusDescriptor> ListenerMap;
+    ListenerMap maListeners;
+
+    /** Notify all listeners in the container that is associated with
+        the given event focus.
+
+        Typically called twice from broadcastEvent(), once for the
+        given event focus and onece for NULL.
+    */
+    void BroadcastEventToSingleContainer (
+        const css::ui::ContextChangeEventObject& rEventObject,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus);
+    FocusDescriptor* GetFocusDescriptor (
+        const cssu::Reference<cssu::XInterface>& rxEventFocus,
+        const bool bCreateWhenMissing);
+    
+    static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance (
+        const cssu::Reference<cssu::XComponentContext>& rxComponentContext)
+        throw (cssu::Exception);
+};
+
+} // end of namespace framework
+
+#endif
+
diff --git a/main/framework/inc/services/EventMultiplexer.hxx b/main/framework/inc/services/EventMultiplexer.hxx
new file mode 100644
index 0000000..55990cf
--- /dev/null
+++ b/main/framework/inc/services/EventMultiplexer.hxx
@@ -0,0 +1,122 @@
+/**************************************************************
+ * 
+ * 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 __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_
+#define __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_
+
+#include <com/sun/star/util/XEventMultiplexer.hpp>
+
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "macros/xserviceinfo.hxx"
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper3 <
+        css::util::XEventMultiplexer,
+        css::lang::XSingleComponentFactory,
+        css::lang::XServiceInfo
+        > EventMultiplexerInterfaceBase;
+}
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssl = ::com::sun::star::lang;
+
+namespace framework {
+
+class EventMultiplexer
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public EventMultiplexerInterfaceBase
+{
+public:
+    EventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext);
+    virtual ~EventMultiplexer (void);
+    
+    // XEventMultiplexer
+    virtual void SAL_CALL addEventListener (
+        const cssu::Reference<css::util::XEventListener>& rxListener,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL removeEventListener (
+        const cssu::Reference<css::util::XEventListener>& rxListener,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL removeAllEventListeners (
+        const cssu::Reference<css::util::XEventListener>& rxListener)
+        throw(cssu::RuntimeException, cssl::IllegalArgumentException);
+    virtual void SAL_CALL broadcastEvent (
+        const cssl::EventObject& rEventObject,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus)
+        throw(cssu::RuntimeException);
+
+    // XSingleComponentFactory
+    virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext (
+        const cssu::Reference<cssu::XComponentContext>& rxContext)
+        throw (cssu::Exception, cssu::RuntimeException);
+    virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext (
+        const cssu::Sequence<cssu::Any>& rArguments,
+        const cssu::Reference<cssu::XComponentContext>& rxContext)
+        throw (cssu::Exception, cssu::RuntimeException);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+        throw (cssu::RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService  (
+        const ::rtl::OUString& rsServiceName)
+        throw (cssu::RuntimeException);
+    virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void)
+        throw (cssu::RuntimeException);
+
+    static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory (
+        const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager);
+
+private:
+    typedef ::std::vector<cssu::Reference<css::util::XEventListener> > ListenerContainer;
+    typedef ::std::map<cssu::Reference<cssu::XInterface>, ListenerContainer> ListenerMap;
+    ListenerMap maListeners;
+
+    /** Notify all listeners in the container that is associated with
+        the given event focus.
+
+        Typically called twice from broadcastEvent(), once for the
+        given event focus and onece for NULL.
+    */
+    void BroadcastEventToSingleContainer (
+        const cssl::EventObject& rEventObject,
+        const cssu::Reference<cssu::XInterface>& rxEventFocus);
+
+    static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance (
+        const cssu::Reference<cssu::XComponentContext>& rxComponentContext)
+        throw (cssu::Exception);
+};
+
+} // end of namespace framework
+
+#endif
+
diff --git a/main/framework/source/register/registerservices.cxx b/main/framework/source/register/registerservices.cxx
index 394a529..97e95e1 100644
--- a/main/framework/source/register/registerservices.cxx
+++ b/main/framework/source/register/registerservices.cxx
@@ -53,26 +53,14 @@
 #include <services/tabwindowservice.hxx>
 #include <services/frame.hxx>
 #include <services/modulemanager.hxx>
-//#include <dispatch/oxt_handler.hxx>
 #include <jobs/jobexecutor.hxx>
-//#include <recording/dispatchrecordersupplier.hxx>
-//#include <recording/dispatchrecorder.hxx>
-//#include <dispatch/mailtodispatcher.hxx>
-//#include <dispatch/servicehandler.hxx>
 #include <jobs/jobdispatch.hxx>
 #include <services/backingcomp.hxx>
-//#include <services/dispatchhelper.hxx>
 #include <services/layoutmanager.hxx>
-//#include <services/license.hxx>
 #include <uifactory/uielementfactorymanager.hxx>
 #include <uifactory/popupmenucontrollerfactory.hxx>
-//#include <uielement/fontmenucontroller.hxx>
-//#include <uielement/fontsizemenucontroller.hxx>
 #include <uielement/objectmenucontroller.hxx>
-//#include <uielement/headermenucontroller.hxx>
-//#include <uielement/footermenucontroller.hxx>
 #include <uielement/controlmenucontroller.hxx>
-//#include <uielement/macrosmenucontroller.hxx>
 #include <uielement/uicommanddescription.hxx>
 #include <uiconfiguration/uiconfigurationmanager.hxx>
 #include <uiconfiguration/moduleuicfgsupplier.hxx>
@@ -84,7 +72,6 @@
 #include <uifactory/toolboxfactory.hxx>
 #include <uifactory/addonstoolboxfactory.hxx>
 #include "uiconfiguration/windowstateconfiguration.hxx"
-//#include <uielement/toolbarsmenucontroller.hxx>
 #include "uifactory/toolbarcontrollerfactory.hxx"
 #include "uifactory/statusbarcontrollerfactory.hxx"
 #include <services/autorecovery.hxx>
@@ -93,42 +80,27 @@
 #include <uifactory/statusbarfactory.hxx>
 #include <uiconfiguration/uicategorydescription.hxx>
 #include <services/sessionlistener.hxx>
-//#include <uielement/newmenucontroller.hxx>
 #include <services/taskcreatorsrv.hxx>
-//#include <services/uriabbreviation.hxx>
-
 #include <uielement/langselectionstatusbarcontroller.hxx>
-//#include <uielement/langselectionmenucontroller.hxx>
 #include <uiconfiguration/imagemanager.hxx>
 #include <uifactory/windowcontentfactorymanager.hxx>
 #include <services/substitutepathvars.hxx>
 #include <services/pathsettings.hxx>
+#include <services/ContextChangeEventMultiplexer.hxx>
 
 COMPONENTGETIMPLEMENTATIONENVIRONMENT
 
 COMPONENTGETFACTORY	(	IFFACTORY( ::framework::URLTransformer					        )	else
 						IFFACTORY( ::framework::Desktop							        )	else
                         IFFACTORY( ::framework::Frame                                   )   else
-                        //IFFACTORY( ::framework::Oxt_Handler                             )   else
                         IFFACTORY( ::framework::JobExecutor                             )   else
-                        //IFFACTORY( ::framework::DispatchRecorderSupplier                )   else
-                        //IFFACTORY( ::framework::DispatchRecorder                        )   else
-                        //IFFACTORY( ::framework::MailToDispatcher                        )   else
-                        //IFFACTORY( ::framework::ServiceHandler                          )   else
                         IFFACTORY( ::framework::JobDispatch                             )   else
                         IFFACTORY( ::framework::BackingComp                             )	else
-                        //IFFACTORY( ::framework::DispatchHelper                          )   else
 						IFFACTORY( ::framework::LayoutManager                           )   else
-                        //IFFACTORY( ::framework::License                                 )   else
                         IFFACTORY( ::framework::UIElementFactoryManager                 )   else
 						IFFACTORY( ::framework::PopupMenuControllerFactory              )   else
-                        //IFFACTORY( ::framework::FontMenuController                      )   else
-                        //IFFACTORY( ::framework::FontSizeMenuController                  )   else
                         IFFACTORY( ::framework::ObjectMenuController                    )   else
-                        //IFFACTORY( ::framework::HeaderMenuController                    )   else
-                        //IFFACTORY( ::framework::FooterMenuController                    )   else
                         IFFACTORY( ::framework::ControlMenuController                   )   else
-                        //IFFACTORY( ::framework::MacrosMenuController                    )   else
                         IFFACTORY( ::framework::UICommandDescription                    )   else
                         IFFACTORY( ::framework::ModuleManager                           )   else
                         IFFACTORY( ::framework::UIConfigurationManager                  )   else
@@ -142,7 +114,6 @@
                         IFFACTORY( ::framework::AddonsToolBoxFactory                    )   else
                         IFFACTORY( ::framework::WindowStateConfiguration                )   else
                         IFFACTORY( ::framework::ToolbarControllerFactory                )   else
-                        //IFFACTORY( ::framework::ToolbarsMenuController                  )	else
                         IFFACTORY( ::framework::AutoRecovery                            )   else
                         IFFACTORY( ::framework::StatusIndicatorFactory                  )	else
                         IFFACTORY( ::framework::RecentFilesMenuController               )   else
@@ -152,15 +123,12 @@
 						IFFACTORY( ::framework::StatusbarControllerFactory              )   else
                         IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::TaskCreatorService	                    )   else
-						//IFFACTORY( ::framework::NewMenuController                       )   else
-                        //IFFACTORY( ::framework::UriAbbreviation                         )   else
-                        //IFFACTORY( ::framework::PopupMenuDispatcher                     )   else
                         IFFACTORY( ::framework::ImageManager                            )   else
                         IFFACTORY( ::framework::LangSelectionStatusbarController        )   else
-                        //IFFACTORY( ::framework::LanguageSelectionMenuController         )   else
                         IFFACTORY( ::framework::WindowContentFactoryManager             )   else
                         IFFACTORY( ::framework::TabWindowService                        )   else
                         IFFACTORY( ::framework::SubstitutePathVariables			        )	else
-						IFFACTORY( ::framework::PathSettings					        )
+						IFFACTORY( ::framework::PathSettings					        )   else
+						IFFACTORY( ::framework::ContextChangeEventMultiplexer			)
 			)
 
diff --git a/main/framework/source/services/ContextChangeEventMultiplexer.cxx b/main/framework/source/services/ContextChangeEventMultiplexer.cxx
new file mode 100644
index 0000000..f7c2a77
--- /dev/null
+++ b/main/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -0,0 +1,389 @@
+/**************************************************************
+ * 
+ * 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_framework.hxx"
+
+#include "services/ContextChangeEventMultiplexer.hxx"
+#include "services.h"
+
+using ::rtl::OUString;
+
+#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+using namespace css;
+using namespace cssu;
+
+namespace framework {
+
+#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer"
+#define SERVICE_NAME "com.sun.star.ui.ContextChangeEventMultiplexer"
+#define SINGLETON_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexerSigleton"
+
+
+ContextChangeEventMultiplexer::ContextChangeEventMultiplexer (
+    const cssu::Reference<cssu::XComponentContext>& rxContext)
+    : ContextChangeEventMultiplexerInterfaceBase(m_aMutex),
+      maListeners()
+{
+    (void)rxContext;
+}
+
+
+
+
+ContextChangeEventMultiplexer::~ContextChangeEventMultiplexer (void)
+{
+}
+
+
+
+
+void SAL_CALL ContextChangeEventMultiplexer::disposing (void)
+{
+    ListenerMap aListeners;
+    aListeners.swap(maListeners);
+
+    cssu::Reference<cssu::XInterface> xThis (static_cast<XWeak*>(this));
+    css::lang::EventObject aEvent (xThis);
+    for (ListenerMap::const_iterator iContainer(aListeners.begin()), iEnd(aListeners.end());
+         iContainer!=iEnd;
+         ++iContainer)
+    {
+        // Unregister from the focus object.
+        Reference<lang::XComponent> xComponent (iContainer->first, UNO_QUERY);
+        if (xComponent.is())
+            xComponent->removeEventListener(this);
+
+        // Tell all listeners that we are being disposed.
+        const FocusDescriptor& rFocusDescriptor (iContainer->second);
+        for (ListenerContainer::const_iterator
+                 iListener(rFocusDescriptor.maListeners.begin()),
+                 iContainerEnd(rFocusDescriptor.maListeners.end());
+             iListener!=iContainerEnd;
+             ++iListener)
+        {
+            (*iListener)->disposing(aEvent);
+        }
+    }
+}
+
+
+
+
+// XContextChangeEventMultiplexer
+
+void SAL_CALL ContextChangeEventMultiplexer::addContextChangeEventListener (
+    const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw css::lang::IllegalArgumentException(
+            A2S("can not add an empty reference"),
+            static_cast<XWeak*>(this),
+            0);
+
+    FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, true);
+    if (pFocusDescriptor != NULL)
+    {
+        ListenerContainer& rContainer (pFocusDescriptor->maListeners);
+        if (::std::find(rContainer.begin(), rContainer.end(), rxListener) == rContainer.end())
+            rContainer.push_back(rxListener);
+        else
+        {
+            // The listener was added for the same event focus
+            // previously.  That is an error.
+            throw cssl::IllegalArgumentException(A2S("listener added twice"), static_cast<XWeak*>(this), 0);
+        }
+    }
+
+    // Send out an initial event that informs the new listener about
+    // the current context.
+    if (rxEventFocus.is() && pFocusDescriptor!=NULL)
+    {
+        css::ui::ContextChangeEventObject aEvent (
+            NULL,
+            pFocusDescriptor->msCurrentApplicationName,
+            pFocusDescriptor->msCurrentContextName);
+        rxListener->notifyContextChangeEvent(aEvent);
+    }
+}
+
+
+
+
+void SAL_CALL ContextChangeEventMultiplexer::removeContextChangeEventListener (
+    const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw cssl::IllegalArgumentException(
+            A2S("can not remove an empty reference"),
+            static_cast<XWeak*>(this), 0);
+
+    FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, false);
+    if (pFocusDescriptor != NULL)
+    {
+        ListenerContainer& rContainer (pFocusDescriptor->maListeners);
+        const ListenerContainer::iterator iListener (
+            ::std::find(rContainer.begin(), rContainer.end(), rxListener));
+        if (iListener != rContainer.end())
+        {
+            rContainer.erase(iListener);
+
+            // We hold on to the focus descriptor even when the last listener has been removed.
+            // This allows us to keep track of the current context and send it to new listeners.
+        }
+    }
+ 
+}
+
+
+
+
+void SAL_CALL ContextChangeEventMultiplexer::removeAllContextChangeEventListeners (
+    const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw cssl::IllegalArgumentException(
+            A2S("can not remove an empty reference"),
+            static_cast<XWeak*>(this), 0);
+
+    for (ListenerMap::iterator
+             iContainer(maListeners.begin()),
+             iEnd(maListeners.end());
+         iContainer!=iEnd;
+         ++iContainer)
+    {
+        const ListenerContainer::iterator iListener (
+            ::std::find(iContainer->second.maListeners.begin(), iContainer->second.maListeners.end(), rxListener));
+        if (iListener != iContainer->second.maListeners.end())
+        {
+            iContainer->second.maListeners.erase(iListener);
+
+            // We hold on to the focus descriptor even when the last listener has been removed.
+            // This allows us to keep track of the current context and send it to new listeners.
+        }
+    }
+}
+
+
+
+
+void SAL_CALL ContextChangeEventMultiplexer::broadcastContextChangeEvent (
+    const css::ui::ContextChangeEventObject& rEventObject,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException)
+{
+    // Remember the current context.
+    if (rxEventFocus.is())
+    {
+        FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, true);
+        if (pFocusDescriptor != NULL)
+        {
+            pFocusDescriptor->msCurrentApplicationName = rEventObject.ApplicationName;
+            pFocusDescriptor->msCurrentContextName = rEventObject.ContextName;
+        }
+    }
+
+    BroadcastEventToSingleContainer(rEventObject, rxEventFocus);
+    if (rxEventFocus.is())
+        BroadcastEventToSingleContainer(rEventObject, NULL);
+}
+
+
+
+
+void ContextChangeEventMultiplexer::BroadcastEventToSingleContainer (
+    const css::ui::ContextChangeEventObject& rEventObject,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+{
+    FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, false);
+    if (pFocusDescriptor != NULL)
+    {
+        // Create a copy of the listener container to avoid problems
+        // when one of the called listeners calls add... or remove...
+        ListenerContainer aContainer (pFocusDescriptor->maListeners);
+        for (ListenerContainer::const_iterator
+                 iListener(aContainer.begin()),
+                 iEnd(aContainer.end());
+             iListener!=iEnd;
+             ++iListener)
+        {
+            (*iListener)->notifyContextChangeEvent(rEventObject);
+        }
+    }
+}
+
+
+
+
+ContextChangeEventMultiplexer::FocusDescriptor* ContextChangeEventMultiplexer::GetFocusDescriptor (
+    const cssu::Reference<cssu::XInterface>& rxEventFocus,
+    const bool bCreateWhenMissing)
+{
+    ListenerMap::iterator iDescriptor (maListeners.find(rxEventFocus));
+    if (iDescriptor == maListeners.end() && bCreateWhenMissing)
+    {
+        // Listen for the focus being disposed.
+        Reference<lang::XComponent> xComponent (rxEventFocus, UNO_QUERY);
+        if (xComponent.is())
+            xComponent->addEventListener(this);
+
+        // Create a new listener container for the event focus.
+        iDescriptor = maListeners.insert(
+            ListenerMap::value_type(
+                rxEventFocus,
+                FocusDescriptor())).first;
+    }
+    if (iDescriptor != maListeners.end())
+        return &iDescriptor->second;
+    else
+        return NULL;
+}
+
+
+
+
+// XSingleComponentFactory
+
+cssu::Reference<cssu::XInterface> SAL_CALL ContextChangeEventMultiplexer::createInstanceWithContext (
+    const cssu::Reference<cssu::XComponentContext>& rxContext)
+    throw (cssu::Exception, cssu::RuntimeException)
+{
+    (void)rxContext;
+    return cssu::Reference<cssu::XInterface>();
+}
+
+
+
+
+cssu::Reference<cssu::XInterface > SAL_CALL ContextChangeEventMultiplexer::createInstanceWithArgumentsAndContext (
+    const cssu::Sequence<cssu::Any>& rArguments,
+    const cssu::Reference<cssu::XComponentContext>& rxContext)
+    throw (cssu::Exception, cssu::RuntimeException)
+{
+    (void)rArguments;
+    (void)rxContext;
+    return cssu::Reference<cssu::XInterface>();
+}
+
+
+
+
+// XServiceInfo
+
+::rtl::OUString SAL_CALL ContextChangeEventMultiplexer::getImplementationName (void)
+    throw(cssu::RuntimeException)
+{
+    return impl_getStaticImplementationName();
+}
+
+
+
+
+
+sal_Bool SAL_CALL ContextChangeEventMultiplexer::supportsService (
+    const ::rtl::OUString& rsServiceName)
+    throw (cssu::RuntimeException)
+{
+    return ::comphelper::findValue(static_GetSupportedServiceNames(), rsServiceName, sal_True).getLength() != 0;
+}
+
+
+
+
+cssu::Sequence<OUString> SAL_CALL ContextChangeEventMultiplexer::getSupportedServiceNames (void)
+    throw (cssu::RuntimeException)
+{
+    return static_GetSupportedServiceNames();
+}
+
+
+
+
+void SAL_CALL ContextChangeEventMultiplexer::disposing (
+    const css::lang::EventObject& rEvent)
+    throw (cssu::RuntimeException)
+{
+    ListenerMap::iterator iDescriptor (maListeners.find(rEvent.Source));
+
+    if (iDescriptor == maListeners.end())
+    {
+        OSL_ASSERT(iDescriptor != maListeners.end());
+        return;
+    }
+
+    // Should we notify the remaining listeners?
+
+    maListeners.erase(iDescriptor);
+}
+
+
+
+
+// Local and static methods.
+
+OUString SAL_CALL ContextChangeEventMultiplexer::impl_getStaticImplementationName (void)
+{
+    return A2S(IMPLEMENTATION_NAME);
+}
+
+
+
+
+cssu::Sequence<OUString> SAL_CALL ContextChangeEventMultiplexer::static_GetSupportedServiceNames (void)
+{
+    cssu::Sequence<OUString> aServiceNames (2);
+    aServiceNames[0] = A2S(SERVICE_NAME);
+    aServiceNames[1] = A2S(SINGLETON_NAME);
+    return aServiceNames;
+}
+
+
+
+
+cssu::Reference<cssu::XInterface> ContextChangeEventMultiplexer::impl_createFactory (
+    const cssu::Reference<cssl::XMultiServiceFactory>& rxServiceManager)
+{
+    (void)rxServiceManager;
+    return cppu::createSingleComponentFactory(
+        ContextChangeEventMultiplexer::static_CreateInstance,
+        ContextChangeEventMultiplexer::impl_getStaticImplementationName(),
+        ContextChangeEventMultiplexer::static_GetSupportedServiceNames()
+        );
+}
+
+
+
+
+cssu::Reference<cssu::XInterface> SAL_CALL ContextChangeEventMultiplexer::static_CreateInstance (
+    const cssu::Reference<cssu::XComponentContext>& rxComponentContext)
+    throw (cssu::Exception)
+{
+    ContextChangeEventMultiplexer* pObject = new ContextChangeEventMultiplexer(rxComponentContext);
+    cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pObject), cssu::UNO_QUERY);
+    return xService;
+}
+
+}  // end of namespace framework
diff --git a/main/framework/source/services/EventMultiplexer.cxx b/main/framework/source/services/EventMultiplexer.cxx
new file mode 100644
index 0000000..b8add59
--- /dev/null
+++ b/main/framework/source/services/EventMultiplexer.cxx
@@ -0,0 +1,270 @@
+/**************************************************************
+ * 
+ * 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_framework.hxx"
+
+#include "services/EventMultiplexer.hxx"
+#include "services.h"
+
+using ::rtl::OUString;
+
+#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+namespace framework {
+
+#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.framework.EventMultiplexer"
+#define SERVICE_NAME "com.sun.star.ui.ContextChangeEventMultiplexer"
+#define SINGLETON_NAME "org.apache.openoffice.comp.framework.EventMultiplexer"
+
+
+EventMultiplexer::EventMultiplexer (const cssu::Reference<css::uno::XComponentContext>& rxContext)
+    : EventMultiplexerInterfaceBase(m_aMutex),
+      maListeners()
+{
+    (void)rxContext;
+}
+
+
+
+
+EventMultiplexer::~EventMultiplexer (void)
+{
+    maListeners.clear();
+}
+
+
+
+
+// XEventMultiplexer
+
+void SAL_CALL EventMultiplexer::addEventListener (
+    const cssu::Reference<css::util::XEventListener>& rxListener,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw css::lang::IllegalArgumentException(A2S("can not add an empty reference"), static_cast<XWeak*>(this), 0);
+
+    ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus));
+    if (iListenerContainer == maListeners.end())
+    {
+        // Create a new listener container for the event focus.
+        iListenerContainer = maListeners.insert(
+            ListenerMap::value_type(
+                rxEventFocus,
+                ListenerContainer())).first;
+    }
+    if (iListenerContainer != maListeners.end())
+    {
+        ListenerContainer& rContainer (iListenerContainer->second);
+        if (::std::find(rContainer.begin(), rContainer.end(), rxListener) == rContainer.end())
+            rContainer.push_back(rxListener);
+        else
+        {
+            // The listener was added for the same event focus
+            // previously.  That is an error.
+            throw cssl::IllegalArgumentException(A2S("listener added twice"), static_cast<XWeak*>(this), 0);
+        }
+    }
+}
+
+
+
+
+void SAL_CALL EventMultiplexer::removeEventListener (
+    const cssu::Reference<css::util::XEventListener>& rxListener,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw cssl::IllegalArgumentException(A2S("can not remove an empty reference"), static_cast<XWeak*>(this), 0);
+
+    ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus));
+    if (iListenerContainer != maListeners.end())
+    {
+        ListenerContainer& rContainer (iListenerContainer->second);
+        const ListenerContainer::iterator iListener (::std::find(rContainer.begin(), rContainer.end(), rxListener));
+        if (iListener != rContainer.end())
+            rContainer.erase(iListener);
+    }
+ 
+}
+
+
+
+
+void SAL_CALL EventMultiplexer::removeAllEventListeners (
+    const cssu::Reference<css::util::XEventListener>& rxListener)
+    throw(cssu::RuntimeException,cssl::IllegalArgumentException)
+{
+    if ( ! rxListener.is())
+        throw cssl::IllegalArgumentException(A2S("can not remove an empty reference"), static_cast<XWeak*>(this), 0);
+
+    for (ListenerMap::iterator
+             iContainer(maListeners.begin()),
+             iEnd(maListeners.end());
+         iContainer!=iEnd;
+         ++iContainer)
+    {
+        const ListenerContainer::iterator iListener (::std::find(iContainer->second.begin(), iContainer->second.end(), rxListener));
+        if (iListener != iContainer->second.end())
+            iContainer->second.erase(iListener);
+    }
+}
+
+
+
+
+
+void SAL_CALL EventMultiplexer::broadcastEvent (
+    const cssl::EventObject& rEventObject,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+    throw(cssu::RuntimeException)
+{
+    BroadcastEventToSingleContainer(rEventObject, rxEventFocus);
+    if (rxEventFocus.is())
+        BroadcastEventToSingleContainer(rEventObject, NULL);
+}
+
+
+
+
+void EventMultiplexer::BroadcastEventToSingleContainer (
+    const cssl::EventObject& rEventObject,
+    const cssu::Reference<cssu::XInterface>& rxEventFocus)
+{
+    ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus));
+    if (iListenerContainer != maListeners.end())
+    {
+        // Create a copy of the listener container to avoid problems
+        // when one of the called listeners calls add... or remove...
+        ListenerContainer aContainer (iListenerContainer->second);
+        for (ListenerContainer::const_iterator
+                 iListener(aContainer.begin()),
+                 iEnd(aContainer.end());
+             iListener!=iEnd;
+             ++iListener)
+        {
+            (*iListener)->notifyEvent(rEventObject);
+        }
+    }
+}
+
+
+
+
+// XSingleComponentFactory
+cssu::Reference<cssu::XInterface> SAL_CALL EventMultiplexer::createInstanceWithContext (
+    const cssu::Reference<cssu::XComponentContext>& rxContext)
+    throw (cssu::Exception, cssu::RuntimeException)
+{
+    return cssu::Reference<cssu::XInterface>();
+}
+
+
+
+
+cssu::Reference<cssu::XInterface > SAL_CALL EventMultiplexer::createInstanceWithArgumentsAndContext (
+    const cssu::Sequence<cssu::Any>& rArguments,
+    const cssu::Reference<cssu::XComponentContext>& rxContext)
+    throw (cssu::Exception, cssu::RuntimeException)
+{
+    return cssu::Reference<cssu::XInterface>();
+}
+
+
+
+
+// XServiceInfo
+
+::rtl::OUString SAL_CALL EventMultiplexer::getImplementationName (void)
+    throw(cssu::RuntimeException)
+{
+    return impl_getStaticImplementationName();
+}
+
+
+
+
+
+sal_Bool SAL_CALL EventMultiplexer::supportsService (
+    const ::rtl::OUString& rsServiceName)
+    throw (cssu::RuntimeException)
+{
+    return ::comphelper::findValue(static_GetSupportedServiceNames(), rsServiceName, sal_True).getLength() != 0;
+}
+
+
+
+
+cssu::Sequence<OUString> SAL_CALL EventMultiplexer::getSupportedServiceNames (void)
+    throw (cssu::RuntimeException)
+{
+    return static_GetSupportedServiceNames();
+}
+
+
+
+
+// Local and static methods.
+
+OUString SAL_CALL EventMultiplexer::impl_getStaticImplementationName (void)
+{
+    return A2S(IMPLEMENTATION_NAME);
+}
+
+
+
+
+cssu::Sequence<OUString> SAL_CALL EventMultiplexer::static_GetSupportedServiceNames (void)
+{
+    cssu::Sequence<OUString> aServiceNames (2);
+    aServiceNames[0] = A2S(SERVICE_NAME);
+    aServiceNames[1] = A2S(SINGLETON_NAME);
+    return aServiceNames;
+}
+
+
+
+
+cssu::Reference<cssu::XInterface> EventMultiplexer::impl_createFactory (
+    const cssu::Reference<cssl::XMultiServiceFactory>& rxServiceManager)
+{
+    return cppu::createSingleComponentFactory(
+        EventMultiplexer::static_CreateInstance,
+        EventMultiplexer::impl_getStaticImplementationName(),
+        EventMultiplexer::static_GetSupportedServiceNames()
+        );
+}
+
+
+
+
+cssu::Reference<cssu::XInterface> SAL_CALL EventMultiplexer::static_CreateInstance (
+    const cssu::Reference<cssu::XComponentContext>& rxComponentContext)
+    throw (cssu::Exception)
+{
+    EventMultiplexer* pObject = new EventMultiplexer(rxComponentContext);
+    cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pObject), cssu::UNO_QUERY);
+    return xService;
+}
+
+}  // end of namespace framework
diff --git a/main/framework/util/fwk.component b/main/framework/util/fwk.component
index 606bcb9..adc6071 100644
--- a/main/framework/util/fwk.component
+++ b/main/framework/util/fwk.component
@@ -45,6 +45,10 @@
   <implementation name="com.sun.star.comp.framework.DocumentAcceleratorConfiguration">
     <service name="com.sun.star.ui.DocumentAcceleratorConfiguration"/>
   </implementation>
+  <implementation name="org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer">
+    <service name="com.sun.star.ui.ContextChangeEventMultiplexer"/>
+    <singleton name="com.sun.star.ui.ContextChangeEventMultiplexer"/>
+  </implementation>
   <implementation name="com.sun.star.comp.framework.Frame">
     <service name="com.sun.star.frame.Frame"/>
   </implementation>
diff --git a/main/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl b/main/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl
new file mode 100644
index 0000000..a18bc1c
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl
@@ -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 __com_sun_star_ui_ContextChangeEventMultiplexer_idl__
+#define __com_sun_star_ui_ContextChangeEventMultiplexer_idl__
+
+#ifndef __com_sun_star_ui_XContextChangeEventMultiplexer_idl__
+#include <com/sun/star/ui/XContextChangeEventMultiplexer.idl>
+#endif
+
+module com {  module sun {  module star {  module ui {
+
+/** Multiplex events for context changes.
+
+    A typical listener for context changes is the sidebar.
+*/
+singleton ContextChangeEventMultiplexer : com::sun::star::ui::XContextChangeEventMultiplexer;
+
+}; }; }; }; // com.sun.star.ui
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/ContextChangeEventObject.idl b/main/offapi/com/sun/star/ui/ContextChangeEventObject.idl
new file mode 100644
index 0000000..01316a4
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/ContextChangeEventObject.idl
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_ContextChangeEventObject_idl__
+#define __com_sun_star_ui_ContextChangeEventObject_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_lang_EventObject_idl__
+#include <com/sun/star/lang/EventObject.idl>
+#endif
+
+
+module com { module sun { module star { module ui {
+
+struct ContextChangeEventObject : com::sun::star::lang::EventObject
+{
+    /** Return the name of the application.
+    */
+    string ApplicationName;
+    
+    /** Return the application specific context name.
+    */
+    string ContextName;
+};
+
+}; }; }; };
+
+//=============================================================================
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/LayoutSize.idl b/main/offapi/com/sun/star/ui/LayoutSize.idl
new file mode 100644
index 0000000..4b4584f
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/LayoutSize.idl
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_LayoutSize_idl__
+#define __com_sun_star_ui_LayoutSize_idl__
+
+module com { module sun { module star { module ui { 
+
+/** Size used for layouting windows.
+    It specifies a range of valid values and a preferred value.
+    The values must not violate the relation 0 <= Minimum <= Preferred <= Maximum.
+
+    @param Minimum
+        Zero or positive.  The value itself is included in the valid
+        range.
+    @param Maximum
+        A value larger than or equal to Minimum.
+        The special value -1 means that there is no upper bound.  Every value larger than or
+        equal to Minimum is valid.
+    @param Preferred
+        The preferred size inside the valid range.
+*/
+struct LayoutSize
+{
+    long Minimum;
+    long Maximum;
+    long Preferred;
+};
+
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/XContextChangeEventListener.idl b/main/offapi/com/sun/star/ui/XContextChangeEventListener.idl
new file mode 100644
index 0000000..1f95278
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/XContextChangeEventListener.idl
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_XContextChangeEventListener_idl__
+#define __com_sun_star_ui_XContextChangeEventListener_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_lang_XEventListener_idl__
+#include <com/sun/star/lang/XEventListener.idl>
+#endif
+
+#ifndef __com_sun_star_ui_ContextChangeEventObject_idl__
+#include <com/sun/star/ui/ContextChangeEventObject.idl>
+#endif
+
+module com { module sun { module star { module ui {
+
+interface XContextChangeEventListener : ::com::sun::star::lang::XEventListener 
+{
+    [oneway] void notifyContextChangeEvent (
+        [in] com::sun::star::ui::ContextChangeEventObject event);
+} ;
+
+} ; } ; } ; } ;
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl b/main/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl
new file mode 100644
index 0000000..828b8e8
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl
@@ -0,0 +1,131 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_XContextChangeEventMultiplexer_idl__
+#define __com_sun_star_ui_XContextChangeEventMultiplexer_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_ui_XContextChangeEventListener_idl__
+#include <com/sun/star/ui/XContextChangeEventListener.idl>
+#endif
+
+#ifndef __com_sun_star_ui_ContextChangeEventObject_idl__
+#include <com/sun/star/ui/ContextChangeEventObject.idl>
+#endif
+
+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+#endif
+
+
+module com { module sun { module star { module ui {
+
+/** Provide a central access point for a group of events.
+
+    Listeners can be added with a simple restriction on the event source.
+    They are only called for events that originate at the specified source.
+
+    Event providers can broadcast an event to all interested listeners.
+
+    The XEventMultiplexer interface is typically implemented as a singleton
+*/
+interface XContextChangeEventMultiplexer : ::com::sun::star::uno::XInterface 
+{
+    /** Add an event listener that is called only when events are broadcast for the specified
+        event focus.
+
+        @param xListener
+            An empty reference results in an InvalidArgumentException.
+
+            One listener may be added more than once for different
+            event foci.  Adding a listener a second time for the same
+            event focus results in an InvalidArgumentException.
+            
+        @param xEventFocus
+            An empty reference is a valid value.  In this case the
+            registered listener will be called for every event
+            broadcast, regardless of its event focus.
+
+            The event focus may or may not be the source of the event.
+              
+            A typical example for an event focus is the XController of
+            a view.  Using an XController restricts events passed to
+            a listener to events that belong to one view.
+
+        @throws com::sun::star::lang::IllegalArgumentException
+            
+    */
+    void addContextChangeEventListener (
+        [in] com::sun::star::ui::XContextChangeEventListener xListener,
+        [in] com::sun::star::uno::XInterface xEventFocus)
+        raises (com::sun::star::lang::IllegalArgumentException);
+
+    /** Remove an event listener for the specified event focus.
+
+        When the same listener was added for other event foci then
+        these associations remain unmodified.
+
+        @param xListener
+            An empty reference results in an InvalidArgumentException.
+
+            When the listener is not registered for the given event
+            focus then an InvalidArgumentException is thrown.
+            
+        @param xEventFocus
+            The listener is only removed for this event focus.
+            An empty reference is a valid value.
+
+        @throws com::sun::star::lang::IllegalArgumentException
+    */
+    void removeContextChangeEventListener (
+        [in] com::sun::star::ui::XContextChangeEventListener xListener,
+        [in] com::sun::star::uno::XInterface xEventFocus)
+        raises (com::sun::star::lang::IllegalArgumentException);
+
+    /** Remove an event listener for all event foci.
+
+        @param xListener
+            An empty reference results in an InvalidArgumentException.
+
+            It is not an error when the listener is not registered for any event focus.
+
+        @throws com::sun::star::lang::IllegalArgumentException
+    */
+    void removeAllContextChangeEventListeners (
+        [in] com::sun::star::ui::XContextChangeEventListener xListener)
+        raises (com::sun::star::lang::IllegalArgumentException);
+
+
+    /** Call all event listeners that where added for the specified event focus.
+    */
+    [oneway] void broadcastContextChangeEvent (
+        [in] com::sun::star::ui::ContextChangeEventObject aEvent,
+        [in] com::sun::star::uno::XInterface xEventFocus);    
+} ;
+
+} ; } ; } ; } ;
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/XContextChangeListener.idl b/main/offapi/com/sun/star/ui/XContextChangeListener.idl
new file mode 100644
index 0000000..3c8cab0
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/XContextChangeListener.idl
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_util_XEventListener_idl__
+#define __com_sun_star_util_XEventListener_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_lang_XEventListener_idl__
+#include <com/sun/star/lang/XEventListener.idl>
+#endif
+
+#ifndef __com_sun_star_lang_EventObject_idl__
+#include <com/sun/star/lang/EventObject.idl>
+#endif
+
+module com { module sun { module star { module util {
+
+/** Generic event listener.
+*/
+interface XEventListener : ::com::sun::star::lang::XEventListener 
+{
+    [oneway] void notifyEvent (
+        [in] com::sun::star::lang::EventObject event);
+} ;
+
+} ; } ; } ; } ;
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/XSidebar.idl b/main/offapi/com/sun/star/ui/XSidebar.idl
new file mode 100644
index 0000000..761ea5c
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/XSidebar.idl
@@ -0,0 +1,46 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_XSidebar_idl__
+#define __com_sun_star_ui_XSidebar_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+module com { module sun { module star { module ui {
+
+/** Interface of the sidebar that allows its elements like panels to eg request layouts.
+*/
+interface XSidebar
+{
+    /** Request layout of the sidebar.
+        Call this method when one of the panels wants to change its size due to
+        late initilization or different content after a context change.
+    */
+    void requestLayout ();
+} ;
+
+} ; } ; } ; } ;
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/XSidebarPanel.idl b/main/offapi/com/sun/star/ui/XSidebarPanel.idl
new file mode 100644
index 0000000..88819ac
--- /dev/null
+++ b/main/offapi/com/sun/star/ui/XSidebarPanel.idl
@@ -0,0 +1,64 @@
+/**************************************************************
+ * 
+ * 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 __com_sun_star_ui_XSidebarPanel_idl__
+#define __com_sun_star_ui_XSidebarPanel_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_rendering_XCanvas_idl__
+#include <com/sun/star/rendering/XCanvas.idl>
+#endif
+
+#ifndef __com_sun_star_awt_Point_idl__
+#include <com/sun/star/awt/Point.idl>
+#endif
+
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+#ifndef __com_sun_star_ui_LayoutSize_idl__
+#include <com/sun/star/ui/LayoutSize.idl>
+#endif
+
+module com { module sun { module star { module ui {
+
+/** Optional interface of sidebar panels.
+*/
+interface XSidebarPanel
+{
+    /** For a given width of the container the layouter asks every ui element for its
+        optimal height.
+
+        The height to which a ui element is set may differ from the returned value.
+
+        The height is set via the XWindow interface.
+    */
+    LayoutSize getHeightForWidth ( [in] long nWidth);
+} ;
+
+} ; } ; } ; } ;
+
+#endif
diff --git a/main/offapi/com/sun/star/ui/makefile.mk b/main/offapi/com/sun/star/ui/makefile.mk
index a93e6d0..ad1bd3f 100644
--- a/main/offapi/com/sun/star/ui/makefile.mk
+++ b/main/offapi/com/sun/star/ui/makefile.mk
@@ -40,6 +40,8 @@
     ActionTriggerSeparatorType.idl              \
     ConfigurableUIElement.idl                   \
     ConfigurationEvent.idl                      \
+	ContextChangeEventMultiplexer.idl			\
+	ContextChangeEventObject.idl				\
     ContextMenuExecuteEvent.idl                 \
     ContextMenuInterceptorAction.idl            \
     DockingArea.idl                             \
@@ -48,6 +50,7 @@
     ItemDescriptor.idl                          \
     ItemStyle.idl                               \
     ItemType.idl                                \
+	LayoutSize.idl								\
     ModuleUICategoryDescription.idl             \
     ModuleUICommandDescription.idl              \
     ModuleUIConfigurationManager.idl            \
@@ -66,10 +69,14 @@
     XAcceleratorConfiguration.idl               \
     XContextMenuInterception.idl                \
     XContextMenuInterceptor.idl                 \
+	XContextChangeEventListener.idl				\
+	XContextChangeEventMultiplexer.idl			\
     XDockingAreaAcceptor.idl                    \
     XImageManager.idl                           \
     XModuleUIConfigurationManager.idl           \
     XModuleUIConfigurationManagerSupplier.idl   \
+	XSidebar.idl								\
+	XSidebarPanel.idl							\
     XStatusbarItem.idl                          \
     XUIConfiguration.idl                        \
     XUIConfigurationListener.idl                \
diff --git a/main/offapi/com/sun/star/util/EventMultiplexer.idl b/main/offapi/com/sun/star/util/EventMultiplexer.idl
new file mode 100644
index 0000000..94c6623
--- /dev/null
+++ b/main/offapi/com/sun/star/util/EventMultiplexer.idl
@@ -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 __com_sun_star_util_EventMultiplexer_idl__
+#define __com_sun_star_util_EventMultiplexer_idl__
+
+#ifndef __com_sun_star_util_XEventMultiplexer_idl__
+#include <com/sun/star/util/XEventMultiplexer.idl>
+#endif
+
+module com {  module sun {  module star {  module util {
+
+/** Multiplex generic events.
+*/
+service EventMultiplexer : com::sun::star::util::XEventMultiplexer 
+{
+};
+
+}; }; }; }; // com.sun.star.util
+
+#endif
diff --git a/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu
index be3c3a5..c4462b3 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu
+++ b/main/officecfg/registry/data/org/openoffice/Office/Impress.xcu
@@ -46,11 +46,6 @@
                 <value>private:resource/pane/LeftDrawPane</value>
               </prop>
             </node>
-            <node oor:name="R3" oor:op="replace">
-              <prop oor:name="URL">
-                <value>private:resource/pane/RightPane</value>
-              </prop>
-            </node>
           </node>
         </node>
         <node oor:name="F1" oor:op="replace">
@@ -90,11 +85,6 @@
             </node>
             <node oor:name="R6" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/view/TaskPane</value>
-              </prop>
-            </node>
-            <node oor:name="R7" oor:op="replace">
-              <prop oor:name="URL">
                 <value>private:resource/view/PresentationView</value>
               </prop>
             </node>
@@ -114,43 +104,53 @@
         </node>
         <node oor:name="F3" oor:op="replace">
           <prop oor:name="ServiceName">
-            <value>com.sun.star.drawing.framework.TaskPanelFactory</value>
+            <value>com.sun.star.comp.Draw.framework.TaskPanelFactory</value>
           </prop>
           <node oor:name="ResourceList">
-            <node oor:name="R0" oor:op="replace">
+            <node oor:name="R0a" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/toolpanel/DrawingFramework/MasterPages</value>
+                <value>private:resource/toolpanel/AllMasterPages</value>
+              </prop>
+            </node>
+            <node oor:name="R0b" oor:op="replace">
+              <prop oor:name="URL">
+                <value>private:resource/toolpanel/RecentMasterPages</value>
+              </prop>
+            </node>
+            <node oor:name="R0c" oor:op="replace">
+              <prop oor:name="URL">
+                <value>private:resource/toolpanel/UsedMasterPages</value>
               </prop>
             </node>
             <node oor:name="R1" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/toolpanel/DrawingFramework/Layouts</value>
+                <value>private:resource/toolpanel/Layouts</value>
               </prop>
             </node>
             <node oor:name="R2" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/toolpanel/DrawingFramework/TableDesign</value>
+                <value>private:resource/toolpanel/TableDesign</value>
               </prop>
             </node>
             <node oor:name="R3" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/toolpanel/DrawingFramework/CustomAnimations</value>
+                <value>private:resource/toolpanel/CustomAnimations</value>
               </prop>
             </node>
             <node oor:name="R4" oor:op="replace">
               <prop oor:name="URL">
-                <value>private:resource/toolpanel/DrawingFramework/SlideTransitions</value>
+                <value>private:resource/toolpanel/SlideTransitions</value>
               </prop>
             </node>
           </node>
         </node>
       </node>
       <node oor:name="StartupServices">
-        <node oor:name="S0" oor:op="replace">
-          <prop oor:name="ServiceName">
-            <value>com.sun.star.drawing.framework.PresentationFactoryProvider</value>
-          </prop>
-        </node>
+	<node oor:name="S0" oor:op="replace">
+	  <prop oor:name="ServiceName">
+	    <value>com.sun.star.drawing.framework.PresentationFactoryProvider</value>
+	  </prop>
+	</node>
       </node>  
     </node>
   </node>
diff --git a/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu b/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
index bccb083..7c7b74e 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
+++ b/main/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
@@ -81,18 +81,60 @@
           <value>com.sun.star.comp.framework.StatusBarFactory</value>
         </prop>
       </node>
-      <node oor:name="org.openoffice.Office.Impress.ImpressToolPanelFactory" oor:op="replace">
+      <node oor:name="SvxPanelFactory" oor:op="replace">
         <prop oor:name="Type">
           <value>toolpanel</value>
         </prop>
         <prop oor:name="Name">
-          <value>DrawingFramework</value>
+          <value>SvxPanelFactory</value>
         </prop>
         <prop oor:name="Module">
-          <value>com.sun.star.presentation.PresentationDocument</value>
+          <value/>
         </prop>
         <prop oor:name="FactoryImplementation">
-          <value>com.sun.star.drawing.DefaultToolPanelFactory</value>
+          <value>org.apache.openoffice.comp.svx.sidebar.PanelFactory</value>
+        </prop>
+      </node>
+      <node oor:name="SdPanelFactory" oor:op="replace">
+        <prop oor:name="Type">
+          <value>toolpanel</value>
+        </prop>
+        <prop oor:name="Name">
+          <value>SdPanelFactory</value>
+        </prop>
+        <prop oor:name="Module">
+          <value></value>
+        </prop>
+        <prop oor:name="FactoryImplementation">
+          <value>org.openoffice.comp.Draw.framework.PanelFactory</value>
+        </prop>
+      </node>
+      <node oor:name="ScPanelFactory" oor:op="replace">
+        <prop oor:name="Type">
+          <value>toolpanel</value>
+        </prop>
+        <prop oor:name="Name">
+          <value>ScPanelFactory</value>
+        </prop>
+        <prop oor:name="Module">
+          <value></value>
+        </prop>
+        <prop oor:name="FactoryImplementation">
+          <value>org.apache.openoffice.comp.sc.sidebar.ScPanelFactory</value>
+        </prop>
+      </node>
+      <node oor:name="SwPanelFactory" oor:op="replace">
+        <prop oor:name="Type">
+          <value>toolpanel</value>
+        </prop>
+        <prop oor:name="Name">
+          <value>SwPanelFactory</value>
+        </prop>
+        <prop oor:name="Module">
+          <value></value>
+        </prop>
+        <prop oor:name="FactoryImplementation">
+          <value>org.apache.openoffice.comp.sw.sidebar.SwPanelFactory</value>
         </prop>
       </node>
     </node>
diff --git a/main/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/main/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 93e453e..2ca3d11 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/main/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -5332,6 +5332,11 @@
                     <value xml:lang="en-US">Task Pane</value>
                 </prop>
             </node>
+            <node oor:name=".uno:Sidebar" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Sidebar</value>
+                </prop>
+            </node>
             <node oor:name=".uno:TestMode" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Test Mode On/Off</value>
diff --git a/main/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/main/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
index 0654d58..7f54305 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
+++ b/main/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
@@ -797,61 +797,6 @@
           <value>true</value>
         </prop>
       </node>
-      <node oor:name="private:resource/toolpanel/DrawingFramework/MasterPages" oor:op="replace">
-        <prop oor:name="Visible" oor:type="xs:boolean">
-          <value>false</value>
-        </prop>
-        <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Master Pages</value>
-        </prop>
-        <prop oor:name="ImageURL" oor:type="xs:string">
-          <value>private:commandimage/PresentationLayout</value>
-        </prop>
-      </node>
-      <node oor:name="private:resource/toolpanel/DrawingFramework/Layouts" oor:op="replace">
-        <prop oor:name="Visible" oor:type="xs:boolean">
-          <value>false</value>
-        </prop>
-        <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Layouts</value>
-        </prop>
-        <prop oor:name="ImageURL" oor:type="xs:string">
-          <value>private:commandimage/ModifyPage</value>
-        </prop>
-      </node>
-      <node oor:name="private:resource/toolpanel/DrawingFramework/TableDesign" oor:op="replace">
-        <prop oor:name="Visible" oor:type="xs:boolean">
-          <value>false</value>
-        </prop>
-        <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Table Design</value>
-        </prop>
-        <prop oor:name="ImageURL" oor:type="xs:string">
-          <value>private:commandimage/InsertTable</value>
-        </prop>
-      </node>
-      <node oor:name="private:resource/toolpanel/DrawingFramework/CustomAnimations" oor:op="replace">
-        <prop oor:name="Visible" oor:type="xs:boolean">
-          <value>false</value>
-        </prop>
-        <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Custom Animation</value>
-        </prop>
-        <prop oor:name="ImageURL" oor:type="xs:string">
-          <value>private:commandimage/CustomAnimation</value>
-        </prop>
-      </node>
-      <node oor:name="private:resource/toolpanel/DrawingFramework/SlideTransitions" oor:op="replace">
-        <prop oor:name="Visible" oor:type="xs:boolean">
-          <value>false</value>
-        </prop>
-        <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Slide Transition</value>
-        </prop>
-        <prop oor:name="ImageURL" oor:type="xs:string">
-          <value>private:commandimage/RehearseTimings</value>
-        </prop>
-      </node>
       <node oor:name="private:resource/toolbar/optimizetablebar" oor:op="replace">
         <prop oor:name="Docked" oor:type="xs:boolean">
           <value>false</value>
diff --git a/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
new file mode 100644
index 0000000..cff3633
--- /dev/null
+++ b/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -0,0 +1,987 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************
+ * 
+ * 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.
+ * 
+ ***********************************************************-->
+
+<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd">
+<oor:component-data oor:name="Sidebar" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <node oor:name="Content">
+    <node oor:name="DeckList">
+
+      <node oor:name="PropertyDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Properties</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-property-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-property-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="GalleryDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Gallery</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>GalleryDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-gallery-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-gallery-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="ImpressMasterPagesDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Master Pages</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>MasterPagesDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-template-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-template-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>120</value>
+        </prop>
+      </node>
+
+      <node oor:name="ImpressAnimationEffects" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Custom Animation</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>CustomAnimationDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-animation-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-animation-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>140</value>
+        </prop>
+      </node>
+
+      <node oor:name="SlideTransitionDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Slide Transition</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>SlideTransitionDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-transition-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-transition-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>160</value>
+        </prop>
+      </node>
+
+      <node oor:name="NavigatorDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Navigator</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>NavigatorDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-navigator-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-navigator-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>400</value>
+        </prop>
+      </node>
+
+      <node oor:name="StyleListDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Styles and Formatting</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>StyleListDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-style-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-style-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>200</value>
+        </prop>
+      </node>
+
+      <node oor:name="FunctionsDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Functions</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>FunctionsDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-functions-large.png</value>
+        </prop>
+        <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-functions-large-hc.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>500</value>
+        </prop>
+      </node>
+
+    </node>
+    <node oor:name="PanelList">
+
+      <node oor:name="TextPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Text</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>TextPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:FontDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,             Auditing,           visible,  .uno:CellTextDlg ;
+            Calc,             Cell,               visible,  .uno:CellTextDlg ;
+            Calc,             default,            visible,  .uno:CellTextDlg ;
+            Calc,             DrawText,           visible                    ;
+            Calc,             EditCell,           visible                    ;
+            Calc,             Pivot,              visible,  .uno:CellTextDlg ;
+            DrawImpress,      3DObject,           visible                    ;
+            DrawImpress,      Draw,               hidden                     ;
+            DrawImpress,      DrawText,           visible                    ;
+            DrawImpress,      Graphic,            hidden                     ;
+            DrawImpress,      OutlineText,        visible                    ;
+            DrawImpress,      Table,              visible                    ;
+            DrawImpress,      TextObject,         visible                    ;
+            WriterAndWeb,     Annotation,         visible                    ;
+            WriterAndWeb,     DrawText,           visible                    ;
+            WriterAndWeb,     Table,              visible                    ;
+            WriterAndWeb,     Text,               visible                    ;
+            WriterAndWeb,     default,            visible                    ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/TextPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="ContextPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Current Context (only for debugging)</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>Context</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            none, none, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/Debug_ContextPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>10</value>
+        </prop>
+      </node>
+
+      <node oor:name="PagePropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Page</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>PagePropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:PageDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Writer, Table,    hidden ;
+            Writer, Text,     hidden ;
+            Writer, default,  hidden ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SwPanelFactory/PagePropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="ColorPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Colors (only for debugging)</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ColorPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            none, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/Debug_ColorPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>110</value>
+        </prop>
+      </node>
+
+      <node oor:name="AreaPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Area</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>AreaPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:FormatArea</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,         Draw,       visible ;
+            DrawImpress,  3DObject,   visible ;
+            DrawImpress,  Draw,       visible ;
+            DrawImpress,  TextObject, hidden  ;
+            WriterAndWeb, Draw,       visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/AreaPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="LinePropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Line</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>LinePropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:FormatLine</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,         Draw,       visible ;
+            Calc,         Graphic,    visible ;
+            DrawImpress,  3DObject,   visible ;
+            DrawImpress,  Draw,       visible ;
+            DrawImpress,  Graphic,    visible ;
+            DrawImpress,  TextObject, hidden  ;
+            WriterAndWeb, Draw,       visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/LinePropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>400</value>
+        </prop>
+      </node>
+
+      <node oor:name="GalleryPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Gallery</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>GalleryPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>GalleryDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/GalleryPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="PosSizePropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Position and Size</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>PosSizePropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:TransformDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,         Chart,       visible                       ;
+            Calc,         Draw,        hidden                        ;
+            Calc,         Form,        visible                       ;
+            Calc,         Graphic,     hidden                        ;
+            Calc,         Media,       visible                       ;
+            Calc,         MultiObject, visible                       ;
+            Calc,         OLE,         visible                       ;
+            DrawImpress,  3DObject,    visible                       ;
+            DrawImpress,  Draw,        hidden                        ;
+            DrawImpress,  Form,        visible                       ;
+            DrawImpress,  Graphic,     hidden                        ;
+            DrawImpress,  Media,       visible                       ;
+            DrawImpress,  MultiObject, visible                       ;
+            DrawImpress,  OLE,         visible                       ;
+            DrawImpress,  TextObject,  hidden                        ;
+            WriterAndWeb, Draw,        hidden                        ;
+            WriterAndWeb, Form,        visible                       ;
+            WriterAndWeb, Graphic,     visible, .uno:GraphicDialog   ;
+            WriterAndWeb, Media,       visible                       ;
+            WriterAndWeb, OLE,         visible, .uno:FrameDialog     ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/PosSizePropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>500</value>
+        </prop>
+      </node>
+
+      <node oor:name="GraphicPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Graphic</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>GraphicPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,         Graphic,     visible   ;
+            DrawImpress,  Graphic,     visible   ;
+            WriterAndWeb, Graphic,     visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/GraphicPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress1" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Layouts</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ImpressLayoutsPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, DrawPage,        visible   ;
+            Impress, default,         visible   ;
+            Impress, HandoutPage,     visible   ;
+            Impress, NotesPage,       visible   ;
+            Impress, SlidesorterPage, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/Layouts</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress2" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Used in This Presentation</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>UsedMasterPagesPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>MasterPagesDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/UsedMasterPages</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress3" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Recently Used</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>RecentMasterPagesPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>MasterPagesDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/RecentMasterPages</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>200</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress4" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Available for Use</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>AllMasterPagesPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>MasterPagesDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/AllMasterPages</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress5" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Custom Animation</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>CustomAnimationPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>CustomAnimationDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/CustomAnimations</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress6" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Slide Transition</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>SlideTransitionPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>SlideTransitionDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, any, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/SlideTransitions</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="Impress7" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Table Design</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ImpressTableDesignPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Impress, Table, visible   ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/TableDesign</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="EmptyPanel" oor:op="replace">
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Empty</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>EmptyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, empty, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/EmptyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="AlignmentPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Alignment</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>AlignmentPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:Hyphenate</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,  Auditing, visible ;
+            Calc,  Cell,     visible ;
+            Calc,  default,  visible ;
+            Calc,  EditCell, visible ;
+            Calc,  Pivot,    visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ScPanelFactory/AlignmentPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>200</value>
+        </prop>
+      </node>
+
+      <node oor:name="CellAppearancePropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Cell Appearance</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>CellAppearancePropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:FormatCellDialg</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,  Auditing, visible ;
+            Calc,  Cell,     visible ;
+            Calc,  default,  visible ;
+            Calc,  Pivot,    visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ScPanelFactory/CellAppearancePropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>300</value>
+        </prop>
+      </node>
+
+      <node oor:name="NumberFormatPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Number Format</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>NumberFormatPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:FormatCellDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,  Auditing, hidden ;
+            Calc,  Cell,     hidden ;
+            Calc,  default,  hidden ;
+            Calc,  Pivot,    hidden ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ScPanelFactory/NumberFormatPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>400</value>
+        </prop>
+      </node>
+
+      <node oor:name="ParaPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Paragraph</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ParaPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:ParagraphDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc,         DrawText,   visible ;
+            DrawImpress,  3DObject,   hidden  ;
+            DrawImpress,  Draw,       hidden  ;
+            DrawImpress,  DrawText,   visible ;
+            DrawImpress,  Graphic,    hidden  ;
+            DrawImpress,  Table,      visible ;
+            DrawImpress,  TextObject, visible ;
+            WriterAndWeb, Annotation, visible ;
+            WriterAndWeb, DrawText,   visible ;
+            WriterAndWeb, Table,      visible ;
+            WriterAndWeb, Text,       visible ;
+            WriterAndWeb, default,    visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/ParaPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>200</value>
+        </prop>
+      </node>
+
+      <node oor:name="WrapPropertyPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Wrap</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>WrapPropertyPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>PropertyDeck</value>
+        </prop>
+        <prop oor:name="DefaultMenuCommand">
+          <value>.uno:ObjectWrapDialog</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+              Writer,   Graphic, visible ;
+              Writer,   OLE,     visible ;
+              Writer,   Frame,   visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SwPanelFactory/WrapPropertyPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>500</value>
+        </prop>
+      </node>
+
+      <node oor:name="SwNavigatorPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Navigator</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>SwNavigatorPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>NavigatorDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            WriterAndWeb, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SwPanelFactory/NavigatorPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="ScNavigatorPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Navigator</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ScNavigatorPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>NavigatorDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ScPanelFactory/NavigatorPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="SdNavigatorPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Navigator</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>SdNavigatorPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>NavigatorDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            DrawImpress, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SdPanelFactory/NavigatorPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="StyleListPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Styles and Formatting</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>StyleListPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>StyleListDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            any, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/SvxPanelFactory/StyleListPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+      <node oor:name="FunctionsPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Functions</value>
+        </prop>
+        <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>FunctionsPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>FunctionsDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Calc, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ScPanelFactory/FunctionsPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>100</value>
+        </prop>
+      </node>
+
+    </node>
+  </node>
+</oor:component-data>
diff --git a/main/officecfg/registry/data/org/openoffice/Office/UI/makefile.mk b/main/officecfg/registry/data/org/openoffice/Office/UI/makefile.mk
index 2c5544a..675db31 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/UI/makefile.mk
+++ b/main/officecfg/registry/data/org/openoffice/Office/UI/makefile.mk
@@ -64,6 +64,7 @@
     WriterWebWindowState.xcu \
     WriterCommands.xcu\
     GenericCategories.xcu\
+	Sidebar.xcu
 
 XCUFILES= \
     $(LOCALIZEDFILES) \
diff --git a/main/officecfg/registry/data/org/openoffice/Office/Views.xcu b/main/officecfg/registry/data/org/openoffice/Office/Views.xcu
index 53b50a4..1be777d 100644
--- a/main/officecfg/registry/data/org/openoffice/Office/Views.xcu
+++ b/main/officecfg/registry/data/org/openoffice/Office/Views.xcu
@@ -29,5 +29,13 @@
     <value>false</value>
    </prop>
   </node>
+
+  <!-- show Sidebar child window by default - oor:name == SID_SIDEBAR -->
+  <node oor:name="10336" oor:op="replace">
+    <prop oor:name="Visible" oor:type="xs:boolean">
+      <value>true</value>
+    </prop>
+  </node>
  </node>
+
 </oor:component-data>
diff --git a/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
new file mode 100644
index 0000000..ca821b7
--- /dev/null
+++ b/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************
+ * 
+ * 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.
+ * 
+ ***********************************************************-->
+
+
+<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
+<oor:component-schema
+    xmlns:oor="http://openoffice.org/2001/registry"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    oor:name="Sidebar"
+    oor:package="org.openoffice.Office.UI"
+    xml:lang="en-US">
+  <info>
+    <author>Andre Fischer</author>
+    <desc>Specification of decks and content panels of the sidebar.</desc>
+  </info>
+  <templates>
+    <group oor:name="Deck">
+      <info>
+        <desc>Specification of a sidebar deck which is a container of content panels.</desc>
+      </info>
+      <prop oor:name="Title" oor:type="xs:string" oor:localized="true">
+        <info>
+          <desc>The deck title is displayed above the content panels.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="Id" oor:type="xs:string" oor:localized="false">
+        <info>
+          <desc>Internally used to identify the deck.  Not displayed in the UI.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="IconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the sidebar tab bar.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="HighContrastIconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the sidebar tab bar when high contrast mode is active.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="HelpURL" oor:type="xs:string">
+        <info>
+          <desc>Help about the sidebar deck.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <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
+                 com.sun.star.sheet.SpreadsheetDocument
+                 com.sun.star.presentation.PresentationDocument
+                 com.sun.star.drawing.DrawingDocument
+             
+             Recognized shortcuts:
+                 Writer
+                 Calc
+                 Impress
+                 Draw
+
+             Shortcuts for multiple applications:
+                 DrawImpress
+                 WriterAndWeb
+             These shortcuts exist for even more convenience and handle the frequent case of Draw
+	     and Impress as well as Writer and WriterWeb having otherwise identical context descriptions.
+             
+             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 
+             visible  Panel is initially visible and expanded
+             hidden   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>
+        </info>
+        <value>10000</value>
+      </prop>
+    </group>
+    <group oor:name="Panel">
+      <info>
+        <desc>Specification of a sidebar content panel.</desc>
+      </info>
+      <prop oor:name="Title" oor:type="xs:string" oor:localized="true">
+        <info>
+          <desc>The panel title is displayed above the content panel.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+        <info>
+          <desc>When true then the title bar can be ommitted when the panel is the only panel in a deck.</desc>
+        </info>
+        <value>false</value>
+      </prop>
+      <prop oor:name="Id" oor:type="xs:string" oor:localized="false">
+        <info>
+          <desc>Internally used to identify the panel.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="DeckId" oor:type="xs:string" oor:localized="false">
+        <info>
+          <desc>Id of the deck to which the panel belongs.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="HelpURL" oor:type="xs:string">
+        <info>
+          <desc>Help about the sidebar content panel.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <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>For documentation, please see the Deck/ContextList.</desc>
+        </info>
+      </prop>
+      <prop oor:name="ImplementationURL" oor:type="xs:string">
+        <info>
+          <desc>URL by which the implementation of the panel is known by its factory.</desc>
+        </info>
+        <value></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="WantsCanvas" oor:type="xs:boolean">
+        <info>
+          <desc>Experimental: Set to true when panel wants to paint its content via a XCanvas.</desc>
+        </info>
+        <value>false</value>
+      </prop>
+    </group>
+  </templates>
+  <component>
+    <group oor:name="Content">
+      <info>
+        <desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc>
+      </info>
+      <set oor:name="DeckList" oor:node-type="Deck">
+        <info>
+          <desc>Contains all registered sidebar decks.</desc>
+        </info>
+      </set>
+      <set oor:name="PanelList" oor:node-type="Panel">
+        <info>
+          <desc>Contains all registered sidebar content panels.</desc>
+        </info>
+      </set>
+    </group>
+  </component>
+</oor:component-schema>
diff --git a/main/officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk b/main/officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk
index 0d36b6a..01dcd84 100644
--- a/main/officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk
+++ b/main/officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk
@@ -70,7 +70,8 @@
     Category.xcs \
     GenericCategories.xcs \
     GlobalSettings.xcs \
-    WindowContentFactories.xcs
+    WindowContentFactories.xcs \
+    Sidebar.xcs
 
 .INCLUDE :  target.mk
 
diff --git a/main/postprocess/packregistry/makefile.mk b/main/postprocess/packregistry/makefile.mk
index edf6164..07d41cf 100644
--- a/main/postprocess/packregistry/makefile.mk
+++ b/main/postprocess/packregistry/makefile.mk
@@ -196,6 +196,7 @@
     $(MY_XCS)/Office/UI/GenericCategories.xcs \
     $(MY_XCS)/Office/UI/GenericCommands.xcs \
     $(MY_XCS)/Office/UI/GlobalSettings.xcs \
+    $(MY_XCS)/Office/UI/Sidebar.xcs \
     $(MY_XCS)/Office/UI/StartModuleCommands.xcs \
     $(MY_XCS)/Office/UI/StartModuleWindowState.xcs \
     $(MY_XCS)/Office/UI/WindowContentFactories.xcs \
@@ -259,6 +260,7 @@
     $(MY_XCU)/Office/UI/Factories.xcu \
     $(MY_XCU)/Office/UI/GenericCategories.xcu \
     $(MY_XCU)/Office/UI/GenericCommands.xcu \
+    $(MY_XCU)/Office/UI/Sidebar.xcu \
     $(MY_XCU)/Office/UI/StartModuleCommands.xcu \
     $(MY_XCU)/Office/UI/StartModuleWindowState.xcu \
     $(MY_XCU)/Office/UI.xcu \
diff --git a/main/reportdesign/source/ui/dlg/Condition.cxx b/main/reportdesign/source/ui/dlg/Condition.cxx
index 483925b..b9cb77d 100644
--- a/main/reportdesign/source/ui/dlg/Condition.cxx
+++ b/main/reportdesign/source/ui/dlg/Condition.cxx
@@ -146,7 +146,7 @@
     m_aColorSet.SetHelpId( HID_RPT_POPUP_COLOR_CTRL );
     SetHelpId( HID_RPT_POPUP_COLOR );
     const Size aSize12( 13, 13 );
-    ::std::auto_ptr<XColorTable> pColorTable(new XColorTable( SvtPathOptions().GetPalettePath() ));
+    ::std::auto_ptr< XColorList > pColorTable(new XColorList( SvtPathOptions().GetPalettePath() ));
     short i = 0;
     long nCount = pColorTable->Count();
     XColorEntry* pEntry = NULL;
diff --git a/main/reportdesign/source/ui/misc/UITools.cxx b/main/reportdesign/source/ui/misc/UITools.cxx
index 0f4a648..a724021 100644
--- a/main/reportdesign/source/ui/misc/UITools.cxx
+++ b/main/reportdesign/source/ui/misc/UITools.cxx
@@ -44,7 +44,7 @@
 #include <editeng/charscaleitem.hxx>
 #include <svx/algitem.hxx>
 #include <svx/svdpagv.hxx>
-#include <svx/xtable.hxx>		// XColorTable
+#include <svx/xtable.hxx>		// XColorList
 #include <editeng/brshitem.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/emphitem.hxx>
@@ -654,7 +654,7 @@
 	};
     Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
 	::std::auto_ptr<FontList> pFontList(new FontList( pParent ));
-	::std::auto_ptr<XColorTable> pColorTable( new XColorTable( SvtPathOptions().GetPalettePath() ));
+	::std::auto_ptr< XColorList > pColorTable( new XColorList( SvtPathOptions().GetPalettePath() ));
 	SfxPoolItem* pDefaults[] =
 	{
 		new SvxFontItem(ITEMID_FONT),
@@ -774,7 +774,7 @@
             // #i74099# by default, the dialog deletes the current color table if a different one is loaded
             // (see SwDrawShell::ExecDrawDlg)
             const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( pDescriptor->GetItem(SID_COLOR_TABLE) );
-            if (pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+            if (pColorItem && pColorItem->GetColorTable() == XColorList::GetStdColorList())
                 pDialog->DontDeleteColorTable();
             bSuccess = ( RET_OK == pDialog->Execute() );
             if ( bSuccess )
diff --git a/main/sc/inc/ScPanelFactory.hxx b/main/sc/inc/ScPanelFactory.hxx
new file mode 100755
index 0000000..acbc09b
--- /dev/null
+++ b/main/sc/inc/ScPanelFactory.hxx
@@ -0,0 +1,70 @@
+/**************************************************************
+ * 
+ * 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 SC_SIDEBAR_PANEL_FACTORY_HXX
+#define SC_SIDEBAR_PANEL_FACTORY_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <boost/noncopyable.hpp>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sc { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::ui::XUIElementFactory
+        > PanelFactoryInterfaceBase;
+}
+
+
+class ScPanelFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public PanelFactoryInterfaceBase
+{
+public:
+    static ::rtl::OUString SAL_CALL getImplementationName(void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL createInstance(
+        const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+    static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames(void);
+
+    ScPanelFactory(void);
+    virtual ~ScPanelFactory(void);
+
+    // XUIElementFactory
+    cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement(
+        const ::rtl::OUString& rsResourceURL,
+        const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException );
+};
+
+
+} } // end of namespace sc::sidebar
+
+#endif
diff --git a/main/sc/inc/document.hxx b/main/sc/inc/document.hxx
index 7f35cca..6ff4669 100644
--- a/main/sc/inc/document.hxx
+++ b/main/sc/inc/document.hxx
@@ -75,7 +75,7 @@
 class SvxSearchItem;
 class SvxShadowItem;
 class Window;
-class XColorTable;
+class XColorList;
 class List;
 
 class ScAutoFormatData;
@@ -261,7 +261,7 @@
 	SfxPrinter*			pPrinter;
 	VirtualDevice*		pVirtualDevice_100th_mm;
 	ScDrawLayer*		pDrawLayer;						// SdrModel
-	XColorTable*		pColorTable;
+	XColorList*		pColorTable;
 	ScConditionalFormatList* pCondFormList;				// bedingte Formate
 	ScValidationDataList* pValidationList;				// Gueltigkeit
 	SvNumberFormatterIndexTable*	pFormatExchangeList;			// zum Umsetzen von Zahlenformaten
@@ -460,7 +460,7 @@
 	void			GetDocStat( ScDocStat& rDocStat );
 
 	SC_DLLPUBLIC void			InitDrawLayer( SfxObjectShell* pDocShell = NULL );
-	XColorTable*	GetColorTable();
+	XColorList*	GetColorTable();
 
 	SC_DLLPUBLIC sfx2::LinkManager*		GetLinkManager() const;
 
diff --git a/main/sc/inc/helpids.h b/main/sc/inc/helpids.h
index 4c93b88..54fa719 100644
--- a/main/sc/inc/helpids.h
+++ b/main/sc/inc/helpids.h
@@ -402,6 +402,73 @@
 #define HID_MN_FORMAT_ALGN                                      "SC_HID_MN_FORMAT_ALGN"
 #define HID_MN_FORMAT_LINESPACE                                 "SC_HID_MN_FORMAT_LINESPACE"
 
+// sidebar -----------------------------------------
+// AlignmentPropertyPanel -----------------------------------------
+#define HID_PROPERTYPANEL_SC_ALIGN_SECTION                      "SC_HID_PROPERTYPANEL_SC_ALIGN_SECTION"
+#define HID_PROPERTY_PANEL_ALIGN_TBX_HOR                        "SC_HID_PROPERTY_PANEL_ALIGN_TBX_HOR"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J"
+#define HID_PROPERTY_PANEL_ALIGN_TBX_VER                        "SC_HID_PROPERTY_PANEL_ALIGN_TBX_VER"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_T                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_T"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_C                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_C"
+#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_B                      "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_B"
+#define HID_PROPERTY_PANEL_ALIGN_MBX_INDENT                     "SC_HID_PROPERTY_PANEL_ALIGN_MBX_INDENT"
+#define HID_PROPERTY_PANEL_ALIGN_CBX_WRAP                       "SC_HID_PROPERTY_PANEL_ALIGN_CBX_WRAP"
+#define HID_PROPERTY_PANEL_ALIGN_CBX_MERGE                      "SC_HID_PROPERTY_PANEL_ALIGN_CBX_MERGE"
+#define HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE                      "SC_HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE"
+#define HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL                   "SC_HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL"
+#define HID_PROPERTY_PANEL_ALIGN_CBX_VERT                       "SC_HID_PROPERTY_PANEL_ALIGN_CBX_VERT"
+
+// CellAppearancePropertyPanel -----------------------------------------
+#define HID_PROPERTYPANEL_SC_CELL_SECTION                       "SC_HID_PROPERTYPANEL_SC_CELL_SECTION"
+#define HID_PROPERTYPANEL_SC_TBX_BKCOLOR                        "SC_HID_PROPERTYPANEL_SC_TBX_BKCOLOR"
+#define HID_PROPERTYPANEL_SC_TBI_BKCOLOR                        "SC_HID_PROPERTYPANEL_SC_TBI_BKCOLOR"
+#define HID_PROPERTYPANEL_SC_TBX_BORDER                         "SC_HID_PROPERTYPANEL_SC_TBX_BORDER"
+#define HID_PROPERTYPANEL_SC_TBI_BORDER                         "SC_HID_PROPERTYPANEL_SC_TBI_BORDER"
+#define HID_PROPERTYPANEL_SC_TBX_STYLE                          "SC_HID_PROPERTYPANEL_SC_TBX_STYLE"
+#define HID_PROPERTYPANEL_SC_TBI_STYLE                          "SC_HID_PROPERTYPANEL_SC_TBI_STYLE"
+#define HID_PROPERTYPANEL_SC_TBX_LINECOLOR                      "SC_HID_PROPERTYPANEL_SC_TBX_LINECOLOR"
+#define HID_PROPERTYPANEL_SC_TBI_LINECOLOR                      "SC_HID_PROPERTYPANEL_SC_TBI_LINECOLOR"
+#define HID_PROPERTYPANEL_SC_CBOX_SHOWGRID                      "SC_HID_PROPERTYPANEL_SC_CBOX_SHOWGRID"
+#define HID_PROPERTYPANEL_FILL_COLOR_VS                         "SC_HID_PROPERTYPANEL_FILL_COLOR_VS"
+#define HID_PROPERTYPANEL_LINE_COLOR_VS                         "SC_HID_PROPERTYPANEL_LINE_COLOR_VS"
+#define HID_PROPERTYPANEL_SC_STYLE_VS                           "SC_HID_PROPERTYPANEL_SC_STYLE_VS"
+#define HID_PROPERTYPANEL_SC_STYLE_PB                           "SC_HID_PROPERTYPANEL_SC_STYLE_PB"
+#define HID_PROPERTYPANEL_SC_BORDER1_TBX                        "SC_HID_PROPERTYPANEL_SC_BORDER1_TBX"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_NONE                    "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_NONE"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_ALL                     "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_ALL"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER                   "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD               "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD"
+#define HID_PROPERTYPANEL_SC_BORDER2_TBX                        "SC_HID_PROPERTYPANEL_SC_BORDER2_TBX"
+#define HID_PROPERTYPANEL_SC_BORDER3_TBX                        "SC_HID_PROPERTYPANEL_SC_BORDER3_TBX"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_S1                      "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S1"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_S2                      "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S2"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_S3                      "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S3"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_S4                      "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S4"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT                    "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT                   "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_TOP                     "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TOP"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_BOT                     "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_BOT"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR                    "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR                    "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT                  "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT"
+#define HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT               "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT"
+
+// NumberFormatPropertyPanel -----------------------------------------
+#define HID_PROPERTYPANEL_SC_NUM_SECTION                        "SC_HID_PROPERTYPANEL_SC_NUM_SECTION"
+#define HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY                   "SC_HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY"
+#define HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY                  "SC_HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY"
+#define HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER                     "SC_HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER"
+#define HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT                    "SC_HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT"
+#define HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY                   "SC_HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY"
+#define HID_PROPERTY_PANEL_NUMFMT_ID_DATE                       "SC_HID_PROPERTY_PANEL_NUMFMT_ID_DATE"
+#define HID_PROPERTY_PANEL_NUMFMT_ID_TEXT                       "SC_HID_PROPERTY_PANEL_NUMFMT_ID_TEXT"
+#define HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS                   "SC_HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS"
+#define HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES                 "SC_HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES"
+#define HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED                    "SC_HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED"
+#define HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND                  "SC_HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND"
 
 // Ende Hilfe IDs ------------------------------------------------------------
 
diff --git a/main/sc/inc/sc.hrc b/main/sc/inc/sc.hrc
index 7e36f19..c0c3ba4 100644
--- a/main/sc/inc/sc.hrc
+++ b/main/sc/inc/sc.hrc
@@ -51,6 +51,8 @@
 #define SC_FUNCTION_END			(SID_SC_START + 299)
 #define SC_PARAM_START			(SID_SC_START + 300)
 #define SC_PARAM_END			(SID_SC_START + 399)
+#define SC_SIDEBAR_PROPERTY_BEGIN	(SID_SC_START + 400)
+#define SC_SIDEBAR_PROPERTY_END	(SID_SC_START + 499)
 
 //	kompatibel zu frueher bleiben:
 #define SC_RESOURCE_START		(RID_APP_START+5000)
@@ -752,6 +754,11 @@
 #define SID_SORT_ATTRIBS		(SC_PARAM_START+3)
 #define SID_SORT_USERDEF		(SC_PARAM_START+4)
 
+// Sidebar -------------------------------------------------------------
+
+#define SID_SCGRIDSHOW          (SC_SIDEBAR_PROPERTY_BEGIN+1)
+#define SID_NUMBER_TYPE_FORMAT  (SC_SIDEBAR_PROPERTY_BEGIN+2)
+
 // Resourcen -------------------------------------------------------------
 
 #define RID_OBJECTBAR_APP		(SC_RESOURCE_START)
@@ -1276,7 +1283,18 @@
 #define RID_POPUP_FILTER                (SC_DIALOGS_START + 153)
 #define RID_SCDLG_TAB_BG_COLOR          (SC_DIALOGS_START + 154)
 
-#define SC_DIALOGS_END                  (SC_DIALOGS_START + 155)
+// defines for AlignmentPropertyPanel
+#define RID_PROPERTYPANEL_SC_ALIGNMENT  (SC_DIALOGS_START + 155)
+
+// defines for CellAppearancePropertyPanel
+#define RID_PROPERTYPANEL_SC_APPEAR     (SC_DIALOGS_START + 156)
+#define RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR (SC_DIALOGS_START + 157)
+#define RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR (SC_DIALOGS_START + 158)
+#define RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE (SC_DIALOGS_START + 159)
+#define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 160)
+#define RID_PROPERTYPANEL_SC_NUMBERFORMAT (SC_DIALOGS_START + 161)
+
+#define SC_DIALOGS_END                  (RID_PROPERTYPANEL_SC_NUMBERFORMAT+1)
 
 #ifndef STD_MASKCOLOR
 #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
diff --git a/main/sc/prj/build.lst b/main/sc/prj/build.lst
index f124daf..8656d1b 100644
--- a/main/sc/prj/build.lst
+++ b/main/sc/prj/build.lst
@@ -27,6 +27,7 @@
 sc	sc\source\ui\navipi					nmake	-	all	sc_nvipi sc_sdi sc_inc NULL
 sc	sc\source\ui\optdlg					nmake	-	all	sc_opt sc_sdi sc_inc NULL
 sc	sc\source\ui\pagedlg					nmake	-	all	sc_page sc_sdi sc_inc NULL
+sc	sc\source\ui\sidebar					nmake	-	all	sc_sidebar sc_sdi sc_inc NULL
 sc	sc\source\ui\src					nmake	-	all	sc_uisrc sc_sdi sc_inc NULL
 sc	sc\source\ui\styleui					nmake	-	all	sc_style sc_sdi sc_inc NULL
 sc	sc\source\ui\undo					nmake	-	all	sc_undo sc_sdi sc_inc NULL
@@ -47,7 +48,7 @@
 sc	sc\addin\datefunc					nmake	-	all	sc_addfu sc_add sc_sdi sc_inc NULL
 sc	sc\addin\rot13						nmake	-	all	sc_adrot sc_add sc_sdi sc_inc NULL
 sc	sc\addin\util						nmake	-	all	sc_adutil sc_addfu sc_adrot sc_sdi sc_inc NULL
-sc	sc\util							nmake	-	all	sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_inc sc_vba NULL
+sc	sc\util							nmake	-	all	sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_sidebar sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_inc sc_vba NULL
 
 # remarked due to the fact, key press is need in this test.
 # sc      sc\qa\complex\calcPreview                               nmake   -       all     qa_calcpreview   NULL
diff --git a/main/sc/sdi/cellsh.sdi b/main/sc/sdi/cellsh.sdi
index 2f3213a..28a2b9c 100644
--- a/main/sc/sdi/cellsh.sdi
+++ b/main/sc/sdi/cellsh.sdi
@@ -89,6 +89,8 @@
 	SID_SELECT_SCENARIO		[ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
 	FID_CELL_FORMAT			[ ExecMethod = Execute; StateMethod = GetBlockState; ]
 	SID_ENABLE_HYPHENATION	[ ExecMethod = Execute; StateMethod = GetBlockState; ]
+	SID_CELL_FORMAT_BORDER	[ ExecMethod = Execute; ]
+	SID_CHAR_DLG_EFFECT		[ ExecMethod = Execute; ]
 	FID_ROW_HEIGHT			[ ExecMethod = Execute; StateMethod = GetState; ]
 	FID_ROW_OPT_HEIGHT		[ ExecMethod = Execute; StateMethod = GetState; ]
 	FID_ROW_HIDE			[ ExecMethod = Execute; StateMethod = GetState; ]
diff --git a/main/sc/sdi/drawsh.sdi b/main/sc/sdi/drawsh.sdi
index 695bec7..9fa81e6 100644
--- a/main/sc/sdi/drawsh.sdi
+++ b/main/sc/sdi/drawsh.sdi
@@ -64,7 +64,8 @@
     SID_BITMAP_LIST 		[ StateMethod = GetDrawAttrState; Export = FALSE; ]
     SID_DASH_LIST			[ StateMethod = GetDrawAttrState; Export = FALSE; ]
     SID_LINEEND_LIST		[ StateMethod = GetDrawAttrState; Export = FALSE; ]
-	 // Flaechen-Attribute
+
+     // Flaechen-Attribute
 	SID_ATTR_FILL_STYLE		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 
 	// #i25616#
@@ -79,15 +80,37 @@
 	SID_ATTR_FILL_GRADIENT	[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTR_FILL_HATCH		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTR_FILL_BITMAP	[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+	SID_ATTR_FILL_TRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+	SID_ATTR_FILL_FLOATTRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+
 	 // ---- Linien-Attribute:
 	SID_ATTR_LINE_STYLE		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTR_LINEEND_STYLE	[ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
+	SID_ATTR_LINE_START [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
+	SID_ATTR_LINE_END [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
 	SID_ATTR_LINE_DASH		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTR_LINE_WIDTH		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTR_LINE_COLOR		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+	SID_ATTR_LINE_TRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+	SID_ATTR_LINE_JOINT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
+	SID_ATTR_LINE_CAP [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
 	SID_ATTRIBUTES_AREA		[ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
 	SID_ATTRIBUTES_LINE		[ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
 	SID_ATTR_TRANSFORM		[ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
+
+    // For the sidebar
+	SID_ATTR_TRANSFORM_WIDTH	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_HEIGHT	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] 
+    SID_ATTR_TRANSFORM_POS_X	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_POS_Y	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_ANGLE	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_ROT_X	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_ROT_Y	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_PROTECT_POS	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_PROTECT_SIZE	[ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_AUTOWIDTH [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+    SID_ATTR_TRANSFORM_AUTOHEIGHT [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ]
+
 	 // ---- Ausrichtungs - Funktionen:
 	 //!	PseudoSlots gibt Aerger mit Referenz-Dialogen ???
 	SID_OBJECT_ALIGN
@@ -161,6 +184,8 @@
 	]
 	*/
 	SID_MIRROR_VERTICAL		[ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ]
+	SID_FLIP_HORIZONTAL     [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ]
+	SID_FLIP_VERTICAL       [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ]
 	SID_ANCHOR_PAGE			[ ExecMethod = ExecDrawFunc; StateMethod = GetState; Export = FALSE; ]
 	SID_ANCHOR_TOGGLE		[ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ]
 	SID_ANCHOR_CELL			[ ExecMethod = ExecDrawFunc; StateMethod = GetState; Export = FALSE; ]
diff --git a/main/sc/sdi/drtxtob.sdi b/main/sc/sdi/drtxtob.sdi
index 52fae4d..34e7fce 100644
--- a/main/sc/sdi/drtxtob.sdi
+++ b/main/sc/sdi/drtxtob.sdi
@@ -83,12 +83,23 @@
 	SID_ALIGNCENTERHOR			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_ALIGNRIGHT				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_ALIGNBLOCK				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	
+	SID_ATTR_PARA_ADJUST_LEFT				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_ADJUST_CENTER			    [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_ADJUST_RIGHT				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_ADJUST_BLOCK				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_LRSPACE                   [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_LINESPACE                 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_PARA_ULSPACE                   [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	
 	SID_ATTR_PARA_LINESPACE_10	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_ATTR_PARA_LINESPACE_15	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_ATTR_PARA_LINESPACE_20	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_SET_SUPER_SCRIPT		[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_SET_SUB_SCRIPT			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_CHAR_KERNING		[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_CHAR_DLG				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_CHAR_DLG_EFFECT			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_PARA_DLG				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	 // ---- FontWork:
 	SID_FONTWORK	[ ExecMethod = ExecuteExtra; StateMethod = GetState; Export = FALSE; ]
@@ -133,6 +144,10 @@
 	SID_TRANSLITERATE_FULLWIDTH	[ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ]
 	SID_TRANSLITERATE_HIRAGANA	[ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ]
 	SID_TRANSLITERATE_KATAGANA	[ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ]
+
+	SID_TABLE_VERT_NONE [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;]
+	SID_TABLE_VERT_CENTER [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;]
+	SID_TABLE_VERT_BOTTOM [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;]
 }
 
 
diff --git a/main/sc/sdi/editsh.sdi b/main/sc/sdi/editsh.sdi
index 7bc61e6..784ab92 100644
--- a/main/sc/sdi/editsh.sdi
+++ b/main/sc/sdi/editsh.sdi
@@ -69,8 +69,10 @@
 	SID_ATTR_CHAR_CONTOUR		[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_SET_SUPER_SCRIPT		[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_SET_SUB_SCRIPT			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
+	SID_ATTR_CHAR_KERNING		[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
 	SID_CELL_FORMAT_RESET	[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
 	SID_CHAR_DLG			[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+	SID_CHAR_DLG_EFFECT		[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] 
 	SID_TOGGLE_REL			[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
 
 	SID_HYPERLINK_SETLINK	[ ExecMethod = Execute; Export = FALSE; ]
diff --git a/main/sc/sdi/formatsh.sdi b/main/sc/sdi/formatsh.sdi
index 1ed8b31..86faf71 100644
--- a/main/sc/sdi/formatsh.sdi
+++ b/main/sc/sdi/formatsh.sdi
@@ -70,6 +70,7 @@
     SID_ATTR_ALIGN_INDENT [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
     SID_ATTR_ALIGN_HYPHENATION [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
     SID_ATTR_ALIGN_DEGREES     [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
+    SID_ATTR_ALIGN_STACKED     [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
     SID_ATTR_ALIGN_LOCKPOS     [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
     SID_ATTR_ALIGN_MARGIN      [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
 
@@ -99,6 +100,7 @@
 	SID_ALIGNCENTERVER	[ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ]
 	SID_ALIGNBLOCK		[ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ]
 	SID_ALIGNCENTERHOR	[ ExecMethod = ExecuteTextAttr;	StateMethod = GetTextAttrState;	]
+	SID_SCGRIDSHOW		[ ExecMethod = ExecViewOptions; StateMethod = GetViewOptions; ]
 
 	SID_V_ALIGNCELL			[ ExecMethod = ExecuteAlignment; StateMethod = GetAlignState; ]
 	SID_H_ALIGNCELL			[ ExecMethod = ExecuteAlignment; StateMethod = GetAlignState; ]
@@ -122,6 +124,8 @@
 	SID_NUMBER_INCDEC		[ ExecMethod = ExecuteNumFormat;]
 	SID_NUMBER_DECDEC		[ ExecMethod = ExecuteNumFormat;]
 
+    SID_NUMBER_TYPE_FORMAT  [ ExecMethod = ExecuteNumFormat;StateMethod = GetNumFormatState; ]
+
 	SID_ATTR_BORDER				[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] 	//XXX
 	SID_ATTR_BORDER_INNER		[                           StateMethod = GetBorderState; ] // status()
     SID_ATTR_BORDER_OUTER       [ ExecMethod = ExecuteAttr; StateMethod = GetBorderState; ]
@@ -129,6 +133,8 @@
 	SID_ATTR_ALIGN_LINEBREAK	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
 	SID_FRAME_LINESTYLE			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
 	SID_FRAME_LINECOLOR			[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
+	SID_ATTR_BORDER_DIAG_TLBR	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
+	SID_ATTR_BORDER_DIAG_BLTR	[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
 
     SID_FORMATPAINTBRUSH    [ ExecMethod = ExecFormatPaintbrush; StateMethod = StateFormatPaintbrush; ]
 }
diff --git a/main/sc/sdi/scalc.sdi b/main/sc/sdi/scalc.sdi
index 1b7b870..c035965 100644
--- a/main/sc/sdi/scalc.sdi
+++ b/main/sc/sdi/scalc.sdi
@@ -7822,3 +7822,53 @@
     GroupId = GID_FORMAT;
 ]
 
+//--------------------------------------------------------------------------
+SfxBoolItem ViewOption SID_SCGRIDSHOW
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE, //TRUE
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config */
+	AccelConfig = FALSE, //TRUE
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE, //FALSE
+	GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item NumberType SID_NUMBER_TYPE_FORMAT
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = TRUE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_VIEW;
+]
diff --git a/main/sc/source/core/data/docpool.cxx b/main/sc/source/core/data/docpool.cxx
index f0298ed..c1ad6bb 100644
--- a/main/sc/source/core/data/docpool.cxx
+++ b/main/sc/source/core/data/docpool.cxx
@@ -181,7 +181,8 @@
 	{ SID_ATTR_PAGE_FOOTERSET,		SFX_ITEM_POOLABLE },	// ATTR_PAGE_FOOTERSET
 	{ SID_SCATTR_PAGE_FORMULAS,		SFX_ITEM_POOLABLE },	// ATTR_PAGE_FORMULAS
     { SID_SCATTR_PAGE_NULLVALS,     SFX_ITEM_POOLABLE },    // ATTR_PAGE_NULLVALS
-    { SID_SCATTR_PAGE_SCALETO,      SFX_ITEM_POOLABLE }     // ATTR_PAGE_SCALETO
+    { SID_SCATTR_PAGE_SCALETO,      SFX_ITEM_POOLABLE },    // ATTR_PAGE_SCALETO
+	{ SID_SCGRIDSHOW,				SFX_ITEM_POOLABLE }
 };
 
 // -----------------------------------------------------------------------
diff --git a/main/sc/source/core/data/documen9.cxx b/main/sc/source/core/data/documen9.cxx
index 98eccfa..ed35090 100644
--- a/main/sc/source/core/data/documen9.cxx
+++ b/main/sc/source/core/data/documen9.cxx
@@ -89,7 +89,7 @@
 		delete pDrawLayer->GetCalcUndo();
 }
 
-XColorTable* ScDocument::GetColorTable()
+XColorList* ScDocument::GetColorTable()
 {
 	if (pDrawLayer)
 		return pDrawLayer->GetColorTable();
@@ -98,7 +98,7 @@
 		if (!pColorTable)
 		{
 			SvtPathOptions aPathOpt;
-			pColorTable = new XColorTable( aPathOpt.GetPalettePath() );
+			pColorTable = new XColorList( aPathOpt.GetPalettePath() );
 		}
 
 		return pColorTable;
diff --git a/main/sc/source/core/data/drwlayer.cxx b/main/sc/source/core/data/drwlayer.cxx
index cef21b6..a6351d8 100644
--- a/main/sc/source/core/data/drwlayer.cxx
+++ b/main/sc/source/core/data/drwlayer.cxx
@@ -225,11 +225,11 @@
 
 		// set color table
         SvxColorTableItem* pColItem = (SvxColorTableItem*) pObjSh->GetItem( SID_COLOR_TABLE );
-		XColorTable* pXCol = pColItem ? pColItem->GetColorTable() : XColorTable::GetStdColorTable();
+		XColorList* pXCol = pColItem ? pColItem->GetColorTable() : XColorList::GetStdColorList();
 		SetColorTable( pXCol );
 	}
 	else
-		SetColorTable( XColorTable::GetStdColorTable() );
+		SetColorTable( XColorList::GetStdColorList() );
 
 	SetSwapGraphics(sal_True);
 //	SetSwapAsynchron(sal_True);		// an der View
diff --git a/main/sc/source/filter/excel/xiescher.cxx b/main/sc/source/filter/excel/xiescher.cxx
index a4469fe..6e8df7d 100644
--- a/main/sc/source/filter/excel/xiescher.cxx
+++ b/main/sc/source/filter/excel/xiescher.cxx
@@ -648,7 +648,7 @@
         long nLineWidth = 35 * ::std::min( rLineData.mnWidth, EXC_OBJ_LINE_THICK );
         rSdrObj.SetMergedItem( XLineWidthItem( nLineWidth ) );
         rSdrObj.SetMergedItem( XLineColorItem( EMPTY_STRING, GetPalette().GetColor( rLineData.mnColorIdx ) ) );
-        rSdrObj.SetMergedItem( XLineJointItem( XLINEJOINT_MITER ) );
+        rSdrObj.SetMergedItem( XLineJointItem( com::sun::star::drawing::LineJoint_MITER ) );
 
         sal_uLong nDotLen = ::std::max< sal_uLong >( 70 * rLineData.mnWidth, 35 );
         sal_uLong nDashLen = 3 * nDotLen;
diff --git a/main/sc/source/ui/app/inputhdl.cxx b/main/sc/source/ui/app/inputhdl.cxx
index c7860d5..59a4cbc 100644
--- a/main/sc/source/ui/app/inputhdl.cxx
+++ b/main/sc/source/ui/app/inputhdl.cxx
@@ -2282,6 +2282,12 @@
 		rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
 
 		rBindings.Invalidate( SID_HYPERLINK_GETLINK );
+		
+		rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
+		rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
+		rBindings.Invalidate( SID_SET_SUB_SCRIPT );
+		rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+		rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); 
 	}
 }
 
diff --git a/main/sc/source/ui/app/scdll.cxx b/main/sc/source/ui/app/scdll.cxx
index 3ad74df..df5d451 100644
--- a/main/sc/source/ui/app/scdll.cxx
+++ b/main/sc/source/ui/app/scdll.cxx
@@ -37,6 +37,7 @@
 
 #include <sot/clsids.hxx>
 #include <sfx2/taskpane.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <sfx2/docfilt.hxx>
 #include <sfx2/fcontnr.hxx>
 #include <sfx2/docfile.hxx>
@@ -262,7 +263,8 @@
 
     // common SFX controller
     ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod );
-
+    ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
+    
 	// Svx-StatusBar-Controller
 	SvxInsertStatusBarControl		::RegisterControl(SID_ATTR_INSERT,		pMod);
 	SvxSelectionModeControl			::RegisterControl(SID_STATUS_SELMODE,	pMod);
diff --git a/main/sc/source/ui/app/scmod.cxx b/main/sc/source/ui/app/scmod.cxx
index a541983..3ea864c 100644
--- a/main/sc/source/ui/app/scmod.cxx
+++ b/main/sc/source/ui/app/scmod.cxx
@@ -1034,7 +1034,10 @@
 		}
 		SetViewOptions( rNewOpt );
 		if (pBindings)
+        {
 			pBindings->Invalidate(SID_HELPLINES_MOVE);
+			pBindings->Invalidate(SID_SCGRIDSHOW);
+        }
 	}
 
 	//============================================
diff --git a/main/sc/source/ui/app/typemap.cxx b/main/sc/source/ui/app/typemap.cxx
index d5adf97..67a4d0f 100644
--- a/main/sc/source/ui/app/typemap.cxx
+++ b/main/sc/source/ui/app/typemap.cxx
@@ -108,6 +108,10 @@
 #include <editeng/crsditem.hxx>
 #include <editeng/brkitem.hxx>
 #include <editeng/charreliefitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/kernitem.hxx>
 #include <svx/rotmodit.hxx>
 #include <svx/drawitem.hxx>
 #include <svl/ilstitem.hxx>
@@ -128,5 +132,10 @@
 #define SvxChooseControlItem		SfxEnumItem
 #define avmedia_MediaItem           ::avmedia::MediaItem
 
+#include <svx/xflftrit.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/AffineMatrixItem.hxx>
+
 #define SFX_TYPEMAP
 #include "scslots.hxx"
diff --git a/main/sc/source/ui/dbgui/scendlg.cxx b/main/sc/source/ui/dbgui/scendlg.cxx
index 97e40e6..a6bb83a 100644
--- a/main/sc/source/ui/dbgui/scendlg.cxx
+++ b/main/sc/source/ui/dbgui/scendlg.cxx
@@ -78,7 +78,7 @@
         const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
 		if ( pItem )
 		{
-			XColorTable* pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+			XColorList* pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
 			if (pColorTable)
 			{
 				aLbColor.SetUpdateMode( sal_False );
diff --git a/main/sc/source/ui/docshell/docfunc.cxx b/main/sc/source/ui/docshell/docfunc.cxx
index cde5e14..dde0d0c 100644
--- a/main/sc/source/ui/docshell/docfunc.cxx
+++ b/main/sc/source/ui/docshell/docfunc.cxx
@@ -3668,6 +3668,11 @@
 		pBindings->Invalidate( SID_ALIGNRIGHT );
 		pBindings->Invalidate( SID_ALIGNBLOCK );
 		pBindings->Invalidate( SID_ALIGNCENTERHOR );
+		pBindings->Invalidate( SID_ATTR_LRSPACE );
+		pBindings->Invalidate( SID_ATTR_PARA_ADJUST_LEFT );			
+		pBindings->Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
+		pBindings->Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
+		pBindings->Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
         // pseudo slots for Format menu
         pBindings->Invalidate( SID_ALIGN_ANY_HDEFAULT );
         pBindings->Invalidate( SID_ALIGN_ANY_LEFT );
diff --git a/main/sc/source/ui/docshell/docsh2.cxx b/main/sc/source/ui/docshell/docsh2.cxx
index a42f6bf..f5cd3ba 100644
--- a/main/sc/source/ui/docshell/docsh2.cxx
+++ b/main/sc/source/ui/docshell/docsh2.cxx
@@ -169,7 +169,7 @@
 	else
 	{
 		//	always use global color table instead of local copy
-        PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE ) );
+        PutItem( SvxColorTableItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ) );
 	}
 
 	if ( !aDocument.GetForbiddenCharacters().isValid() ||
diff --git a/main/sc/source/ui/docshell/docsh4.cxx b/main/sc/source/ui/docshell/docsh4.cxx
index f638d84..fc43acd 100644
--- a/main/sc/source/ui/docshell/docsh4.cxx
+++ b/main/sc/source/ui/docshell/docsh4.cxx
@@ -568,7 +568,7 @@
 			{
 				//	passende ColorTable ist per PutItem gesetzt worden
 				SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
-				XColorTable* pTable = pColItem->GetColorTable();
+				XColorList* pTable = pColItem->GetColorTable();
 				rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable));
 			}
 			break;
diff --git a/main/sc/source/ui/drawfunc/chartsh.cxx b/main/sc/source/ui/drawfunc/chartsh.cxx
index 2872028..c5fd7d3 100644
--- a/main/sc/source/ui/drawfunc/chartsh.cxx
+++ b/main/sc/source/ui/drawfunc/chartsh.cxx
@@ -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 @@
 {
 	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 @@
 }
 
 
-
+void ScChartShell::HandleSelectionChange (void)
+{
+    // Do not call the implementation in the base class.  Let
+    // Activate()/Deactivate() handle context switches.
+}
diff --git a/main/sc/source/ui/drawfunc/drawsh.cxx b/main/sc/source/ui/drawfunc/drawsh.cxx
index e985838..ce6e0ad 100644
--- a/main/sc/source/ui/drawfunc/drawsh.cxx
+++ b/main/sc/source/ui/drawfunc/drawsh.cxx
@@ -58,6 +58,8 @@
 #include <svx/dialogs.hrc>
 #include <svx/drawitem.hxx>
 #include <svx/xtable.hxx>
+#include "tabvwsh.hxx"
+#include <sfx2/bindings.hxx>
 
 #define ScDrawShell
 #include "scslots.hxx"
@@ -139,14 +141,21 @@
 
 		case SID_ATTR_LINE_STYLE:
 		case SID_ATTR_LINEEND_STYLE:
+        case SID_ATTR_LINE_START:
+        case SID_ATTR_LINE_END:
 		case SID_ATTR_LINE_DASH:
 		case SID_ATTR_LINE_WIDTH:
 		case SID_ATTR_LINE_COLOR:
+        case SID_ATTR_LINE_TRANSPARENCE:
+        case SID_ATTR_LINE_JOINT:
+        case SID_ATTR_LINE_CAP:
 		case SID_ATTR_FILL_STYLE:
 		case SID_ATTR_FILL_COLOR:
 		case SID_ATTR_FILL_GRADIENT:
 		case SID_ATTR_FILL_HATCH:
 		case SID_ATTR_FILL_BITMAP:
+		case SID_ATTR_FILL_TRANSPARENCE:
+		case SID_ATTR_FILL_FLOATTRANSPARENCE:
 
 		// #i25616#
 		case SID_ATTR_FILL_SHADOW:
@@ -160,6 +169,9 @@
 						case SID_ATTR_LINE_DASH:
 						case SID_ATTR_LINE_WIDTH:
 						case SID_ATTR_LINE_COLOR:
+                        case SID_ATTR_LINE_TRANSPARENCE:
+                        case SID_ATTR_LINE_JOINT:
+                        case SID_ATTR_LINE_CAP:
 							ExecuteLineDlg( rReq );
 							break;
 
@@ -168,6 +180,8 @@
 						case SID_ATTR_FILL_GRADIENT:
 						case SID_ATTR_FILL_HATCH:
 						case SID_ATTR_FILL_BITMAP:
+		                case SID_ATTR_FILL_TRANSPARENCE:
+		                case SID_ATTR_FILL_FLOATTRANSPARENCE:
 
 						// #i25616#
 						case SID_ATTR_FILL_SHADOW:
@@ -235,6 +249,7 @@
 #endif
 
 		case SID_ATTR_TRANSFORM:
+        {
 			{
 				if ( pView->AreObjectsMarked() )
 				{
@@ -302,8 +317,21 @@
 						pView->SetGeoAttrToMarked( *pArgs );
 				}
 			}
-			break;
 
+            ScTabViewShell* pViewShell = pViewData->GetViewShell();
+            SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings();
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH);
+            rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT);
+            break;
+        }
+        
 		default:
 			break;
 	}
@@ -438,7 +466,7 @@
     // (see SwDrawShell::ExecDrawDlg)
     const SvxColorTableItem* pColorItem =
         static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
-    if (pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+    if (pColorItem->GetColorTable() == XColorList::GetStdColorList())
         pDlg->DontDeleteColorTable();
 
 	if ( nTabPage != 0xffff )
diff --git a/main/sc/source/ui/drawfunc/drawsh2.cxx b/main/sc/source/ui/drawfunc/drawsh2.cxx
index cbbe2fa..4f6c3ef 100644
--- a/main/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/main/sc/source/ui/drawfunc/drawsh2.cxx
@@ -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 @@
     }
 	SetHelpId( HID_SCSHELL_DRAWSH );
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Drawing")));
+
+    mpSelectionChangeHandler->Connect();
 }
 
 ScDrawShell::~ScDrawShell()
 {
+    mpSelectionChangeHandler->Disconnect();
 }
 
 void ScDrawShell::GetState( SfxItemSet& rSet )			// Zustaende / Toggles
@@ -138,6 +151,8 @@
 	{
 		rSet.DisableItem( SID_MIRROR_HORIZONTAL );
 		rSet.DisableItem( SID_MIRROR_VERTICAL );
+		rSet.DisableItem( SID_FLIP_HORIZONTAL );
+		rSet.DisableItem( SID_FLIP_VERTICAL );
 	}
 
 	const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
@@ -392,4 +407,20 @@
 	return bResult;
 }
 
+void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
+{
+  	ScDrawView* pView = pViewData->GetScDrawView();
+  	const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+  
+  	if( rMarkList.GetMark(0) != 0 )
+  	{
+  		SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked());
+  		rSet.Put(aNewAttr, sal_False);
+  	}
+}
 
+sfx2::sidebar::EnumContext::Context ScDrawShell::GetContextForSelection (void)
+{
+    return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
+        GetDrawView()->GetMarkedObjectList());
+}
diff --git a/main/sc/source/ui/drawfunc/drawsh4.cxx b/main/sc/source/ui/drawfunc/drawsh4.cxx
index 0d8389f..4940260 100644
--- a/main/sc/source/ui/drawfunc/drawsh4.cxx
+++ b/main/sc/source/ui/drawfunc/drawsh4.cxx
@@ -94,7 +94,7 @@
 			if ( pDocSh )
 			{
                 const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
-				XColorTable*		pColorTable = NULL;
+				XColorList*		pColorTable = NULL;
 
 				if ( pItem )
 					pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
diff --git a/main/sc/source/ui/drawfunc/drawsh5.cxx b/main/sc/source/ui/drawfunc/drawsh5.cxx
index 8c161d8..189da9a 100644
--- a/main/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/main/sc/source/ui/drawfunc/drawsh5.cxx
@@ -325,10 +325,14 @@
             break;
 
         case SID_MIRROR_HORIZONTAL:
+        case SID_FLIP_HORIZONTAL:
             pView->MirrorAllMarkedHorizontal();
+            rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
             break;
         case SID_MIRROR_VERTICAL:
+        case SID_FLIP_VERTICAL:
             pView->MirrorAllMarkedVertical();
+            rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
             break;
 
         case SID_OBJECT_ALIGN_LEFT:
diff --git a/main/sc/source/ui/drawfunc/drformsh.cxx b/main/sc/source/ui/drawfunc/drformsh.cxx
index fad5cc8..2fc4973 100644
--- a/main/sc/source/ui/drawfunc/drformsh.cxx
+++ b/main/sc/source/ui/drawfunc/drformsh.cxx
@@ -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 @@
 {
 	SetHelpId(HID_SCSHELL_DRAWFORMSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("DrawForm")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
 }
 
 ScDrawFormShell::~ScDrawFormShell()
 {
 }
-
-
-
diff --git a/main/sc/source/ui/drawfunc/drtxtob.cxx b/main/sc/source/ui/drawfunc/drtxtob.cxx
index d444437..24f0c4c 100644
--- a/main/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/main/sc/source/ui/drawfunc/drtxtob.cxx
@@ -42,6 +42,9 @@
 #include <editeng/flditem.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
 #include <svx/hlnkitem.hxx>
 #include <editeng/lspcitem.hxx>
 #include <svx/svdoutl.hxx>
@@ -68,6 +71,7 @@
 
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 #include "sc.hrc"
 #include "globstr.hrc"
@@ -132,6 +136,7 @@
 
 	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()
@@ -643,7 +648,7 @@
 		{
 			SvUShorts aPortions;
 			rEditEng.GetPortions( (sal_uInt16)nPar, aPortions );
-			//!	GetPortions should use xub_StrLen instead of USHORT
+			//!	GetPortions should use xub_StrLen instead of sal_uInt16
 
 			for ( sal_uInt16 nPos = aPortions.Count(); nPos; )
 			{
@@ -731,10 +736,11 @@
 			}
 			break;
 
+			case SID_CHAR_DLG_EFFECT: 
 			case SID_CHAR_DLG:						// Dialog-Button
 			case SID_ATTR_CHAR_FONT:				// Controller nicht angezeigt
 			case SID_ATTR_CHAR_FONTHEIGHT:
-				bDone = ExecuteCharDlg( aEditAttr, aNewAttr );
+				bDone = ExecuteCharDlg( aEditAttr, aNewAttr , nSlot);
 				break;
 
 			case SID_PARA_DLG:
@@ -851,6 +857,11 @@
 						aNewAttr.Put( *pDlg->GetOutputItemSet() );
 
 					delete pDlg;
+
+					SfxBindings& rBindings = pViewData->GetBindings();
+					rBindings.Invalidate( SID_TABLE_VERT_NONE );
+					rBindings.Invalidate( SID_TABLE_VERT_CENTER );
+					rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
 				}
 				break;
 		}
@@ -882,6 +893,122 @@
 
 			pView->SetAttributes( aSetItem.GetItemSet() );
 		}
+		else if( nSlot == SID_ATTR_PARA_LRSPACE )
+		{
+			sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
+			const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
+				pArgs->Get( nId );
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+			nId = EE_PARA_LRSPACE;
+			SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
+				rItem.GetRight(), rItem.GetTxtLeft(),
+				rItem.GetTxtFirstLineOfst(), nId );
+			aEditAttr.Put( aLRSpaceItem );
+//			rReq.Done( aEditAttr );
+//			pArgs = rReq.GetArgs();
+//			pView->SetAttributes( *pArgs );
+			pView->SetAttributes( aEditAttr );
+//			Invalidate(SID_ATTR_PARA_LRSPACE);
+		}
+		else if( nSlot == SID_ATTR_PARA_LINESPACE )
+		{
+			sal_uInt16 nId = SID_ATTR_PARA_LINESPACE;
+			SvxLineSpacingItem aLineSpaceItem = (const SvxLineSpacingItem&)pArgs->Get(
+																GetPool().GetWhich(nSlot));
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
+			aEditAttr.Put( aLineSpaceItem );
+//			rReq.Done( aEditAttr );
+//			pArgs = rReq.GetArgs();
+//			pView->SetAttributes( *pArgs );
+			pView->SetAttributes( aEditAttr );
+//			Invalidate(SID_ATTR_PARA_LINESPACE);
+		}
+		else if( nSlot == SID_ATTR_PARA_ULSPACE )
+		{
+			sal_uInt16 nId = SID_ATTR_PARA_ULSPACE;
+			SvxULSpaceItem aULSpaceItem = (const SvxULSpaceItem&)pArgs->Get(
+																GetPool().GetWhich(nSlot));
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
+			aULSpaceItem.SetWhich(EE_PARA_ULSPACE);
+			aEditAttr.Put( aULSpaceItem );
+//			rReq.Done( aEditAttr );
+//			pArgs = rReq.GetArgs();
+//			pView->SetAttributes( *pArgs );
+			pView->SetAttributes( aEditAttr );
+//			Invalidate(SID_ATTR_PARA_ULSPACE);
+		}
+		else if(nSlot ==  SID_SET_SUPER_SCRIPT )
+		{
+			SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());
+			pView->GetAttributes(aEditAttr);	
+			SfxItemSet	aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
+
+			SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+			SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+			if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+			else
+				aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+			aNewAttr.Put( aItem );
+			pView->SetAttributes( aNewAttr );
+		}
+		else if( nSlot ==  SID_SET_SUB_SCRIPT )
+		{
+			SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());
+			pView->GetAttributes(aEditAttr);	
+			SfxItemSet	aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
+
+			SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+			SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+			if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+			else
+				aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+			aNewAttr.Put( aItem );
+			pView->SetAttributes( aNewAttr );
+		}
+
+		else if (bArgsInReq &&
+			( nSlot == SID_TABLE_VERT_NONE || nSlot == SID_TABLE_VERT_CENTER ||
+			  nSlot == SID_TABLE_VERT_BOTTOM ) )
+		{		
+			SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
+			if (nSlot == SID_TABLE_VERT_CENTER)
+				eTVA = SDRTEXTVERTADJUST_CENTER;
+			else if (nSlot == SID_TABLE_VERT_BOTTOM)
+				eTVA = SDRTEXTVERTADJUST_BOTTOM;
+
+			SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());
+			SfxItemSet	aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
+			aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
+			pView->SetAttributes(aNewAttr);
+		}
+		else if (bArgsInReq &&
+			(nSlot == SID_ATTR_PARA_ADJUST_LEFT || nSlot == SID_ATTR_PARA_ADJUST_CENTER || nSlot == SID_ATTR_PARA_ADJUST_RIGHT || nSlot == SID_ATTR_PARA_ADJUST_BLOCK ))
+		{
+			SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());			
+			SfxItemSet	aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
+			switch ( nSlot )
+			{
+			case SID_ATTR_PARA_ADJUST_LEFT:
+				aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+				break;
+			case SID_ATTR_PARA_ADJUST_CENTER:
+				aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+				break;
+			case SID_ATTR_PARA_ADJUST_RIGHT:
+				aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+				break;
+			case SID_ATTR_PARA_ADJUST_BLOCK:
+				aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
+				break;
+			}
+			pView->SetAttributes(aNewAttr);
+		}
 		else
 		{
 			// use args directly
@@ -934,24 +1061,35 @@
 		ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_WEIGHT, nScript );
 	if ( rDestSet.GetItemState( EE_CHAR_ITALIC ) != SFX_ITEM_UNKNOWN )
 		ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_ITALIC, nScript );
-
 	//	Ausrichtung
 
 	SvxAdjust eAdj = ((const SvxAdjustItem&)aAttrSet.Get(EE_PARA_JUST)).GetAdjust();
 	switch( eAdj )
 	{
-		case SVX_ADJUST_LEFT:
+	case SVX_ADJUST_LEFT:
+		{
 			rDestSet.Put( SfxBoolItem( SID_ALIGNLEFT, sal_True ) );
-			break;
-		case SVX_ADJUST_CENTER:
+			rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
+		}
+		break;
+	case SVX_ADJUST_CENTER:
+		{
 			rDestSet.Put( SfxBoolItem( SID_ALIGNCENTERHOR, sal_True ) );
-			break;
-		case SVX_ADJUST_RIGHT:
+			rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
+		}
+		break;
+	case SVX_ADJUST_RIGHT:
+		{
 			rDestSet.Put( SfxBoolItem( SID_ALIGNRIGHT, sal_True ) );
-			break;
-		case SVX_ADJUST_BLOCK:
+			rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
+		}
+		break;
+	case SVX_ADJUST_BLOCK:
+		{
 			rDestSet.Put( SfxBoolItem( SID_ALIGNBLOCK, sal_True ) );
-			break;
+			rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
+		}
+		break;
         default:
         {
             // added to avoid warnings
@@ -963,6 +1101,32 @@
     rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT,     eAdj == SVX_ADJUST_RIGHT ) );
     rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED, eAdj == SVX_ADJUST_BLOCK ) );
 
+    	SvxLRSpaceItem aLR = ((const SvxLRSpaceItem&)aAttrSet.Get( EE_PARA_LRSPACE ));
+	aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
+	rDestSet.Put(aLR);
+	Invalidate( SID_ATTR_PARA_LRSPACE );
+	SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
+	if ( eState == SFX_ITEM_DONTCARE )
+		rDestSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
+	//xuxu for Line Space
+	SvxLineSpacingItem aLineSP = ((const SvxLineSpacingItem&)aAttrSet.
+						Get( EE_PARA_SBL ));
+	aLineSP.SetWhich(SID_ATTR_PARA_LINESPACE);
+	rDestSet.Put(aLineSP);
+	Invalidate(SID_ATTR_PARA_LINESPACE);
+	eState = aAttrSet.GetItemState( EE_PARA_SBL );
+	if ( eState == SFX_ITEM_DONTCARE )
+		rDestSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
+	//xuxu for UL Space
+	SvxULSpaceItem aULSP = ((const SvxULSpaceItem&)aAttrSet.
+						Get( EE_PARA_ULSPACE ));
+	aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
+	rDestSet.Put(aULSP);
+	Invalidate(SID_ATTR_PARA_ULSPACE);
+	eState = aAttrSet.GetItemState( EE_PARA_ULSPACE );
+	if ( eState == SFX_ITEM_DONTCARE )
+		rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
+
 	//	Zeilenabstand
 
 	sal_uInt16 nLineSpace = (sal_uInt16)
@@ -992,7 +1156,7 @@
 
 	//	Unterstreichung
 
-	SfxItemState eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True );
+	eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True );
 	if ( eState == SFX_ITEM_DONTCARE )
 	{
 		rDestSet.InvalidateItem( SID_ULINE_VAL_NONE );
@@ -1089,3 +1253,54 @@
 	}
 }
 
+void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet &rSet)
+{
+	SfxWhichIter	aIter( rSet );
+	sal_uInt16			nWhich = aIter.FirstWhich();
+	
+	SdrView*			pView = pViewData->GetScDrawView();
+
+	SfxItemSet aEditAttr(pView->GetModel()->GetItemPool());
+	pView->GetAttributes(aEditAttr);
+	//SfxItemSet	aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
+	
+	while ( nWhich )
+	{
+		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+			? GetPool().GetSlotId(nWhich)
+			: nWhich; 
+		switch ( nSlotId )
+		{
+			case SID_TABLE_VERT_NONE:
+			case SID_TABLE_VERT_CENTER:
+			case SID_TABLE_VERT_BOTTOM:
+				sal_Bool bContour = sal_False;
+				SfxItemState eConState = aEditAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
+				if( eConState != SFX_ITEM_DONTCARE )
+				{
+					bContour = ( ( const SdrTextContourFrameItem& )aEditAttr.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
+				}
+				if (bContour) break;
+
+				SfxItemState eVState = aEditAttr.GetItemState( SDRATTR_TEXT_VERTADJUST );
+				//SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
+
+				//if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
+				if(SFX_ITEM_DONTCARE != eVState)
+				{					
+					SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aEditAttr.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
+					sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP||
+                            nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER ||
+                            nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM;
+					rSet.Put(SfxBoolItem(nSlotId, bSet));
+				}
+				else 
+				{
+					rSet.Put(SfxBoolItem(nSlotId, sal_False));
+				}
+				break;	
+		}
+		nWhich = aIter.NextWhich();
+	}	
+}
+
diff --git a/main/sc/source/ui/drawfunc/drtxtob1.cxx b/main/sc/source/ui/drawfunc/drtxtob1.cxx
index 54b5a27..6d3c042 100644
--- a/main/sc/source/ui/drawfunc/drtxtob1.cxx
+++ b/main/sc/source/ui/drawfunc/drtxtob1.cxx
@@ -53,7 +53,7 @@
 //------------------------------------------------------------------------
 
 sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
-												SfxItemSet& rOutSet )
+												SfxItemSet& rOutSet , sal_uInt16 nSlot)
 {
 //CHINA001	ScCharDlg* pDlg = new ScCharDlg( pViewData->GetDialogParent(),
 //CHINA001	&rArgs,
@@ -65,6 +65,10 @@
 	SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg(  pViewData->GetDialogParent(), &rArgs,
 														pViewData->GetSfxDocShell(),RID_SCDLG_CHAR );
 	DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
+	if (nSlot == SID_CHAR_DLG_EFFECT)
+	{
+		pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
+	}
 	sal_Bool bRet = ( pDlg->Execute() == RET_OK );
 
 	if ( bRet )
diff --git a/main/sc/source/ui/drawfunc/drtxtob2.cxx b/main/sc/source/ui/drawfunc/drtxtob2.cxx
index a6253aa..b9dd6b1 100644
--- a/main/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/main/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -276,7 +276,7 @@
 			if ( pDocSh )
 			{
                 const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
-				XColorTable*		pColorTable = NULL;
+				XColorList*		pColorTable = NULL;
 
 				if ( pItem )
 					pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
diff --git a/main/sc/source/ui/drawfunc/futext.cxx b/main/sc/source/ui/drawfunc/futext.cxx
index 8230423..ae66bbc 100644
--- a/main/sc/source/ui/drawfunc/futext.cxx
+++ b/main/sc/source/ui/drawfunc/futext.cxx
@@ -67,6 +67,10 @@
 	rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
 	rBindings.Invalidate( SID_ATTR_CHAR_FONT );
 	rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );			
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
 	rBindings.Invalidate( SID_ALIGNLEFT );
 	rBindings.Invalidate( SID_ALIGNCENTERHOR );
 	rBindings.Invalidate( SID_ALIGNRIGHT );
@@ -86,6 +90,11 @@
     rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
     rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
     rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
+	rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
+	rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
+	rBindings.Invalidate( SID_SET_SUB_SCRIPT );
+	rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+	rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); 
 }
 
 void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj )
diff --git a/main/sc/source/ui/drawfunc/graphsh.cxx b/main/sc/source/ui/drawfunc/graphsh.cxx
index 61e8ce9..78b382e 100644
--- a/main/sc/source/ui/drawfunc/graphsh.cxx
+++ b/main/sc/source/ui/drawfunc/graphsh.cxx
@@ -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 @@
 {
 	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 @@
 
 	Invalidate();
 }
-
diff --git a/main/sc/source/ui/drawfunc/mediash.cxx b/main/sc/source/ui/drawfunc/mediash.cxx
index 6f75542..1094016 100644
--- a/main/sc/source/ui/drawfunc/mediash.cxx
+++ b/main/sc/source/ui/drawfunc/mediash.cxx
@@ -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 @@
 {
 	SetHelpId(HID_SCSHELL_MEDIA);
 	SetName( String( ScResId( SCSTR_MEDIASHELL ) ) );
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
 }
 
 ScMediaShell::~ScMediaShell()
diff --git a/main/sc/source/ui/drawfunc/oleobjsh.cxx b/main/sc/source/ui/drawfunc/oleobjsh.cxx
index 252855c..4f17072 100644
--- a/main/sc/source/ui/drawfunc/oleobjsh.cxx
+++ b/main/sc/source/ui/drawfunc/oleobjsh.cxx
@@ -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 @@
 {
 	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 @@
 }
 
 
-
+void ScOleObjectShell::HandleSelectionChange (void)
+{
+    // Do not call the implementation in the base class.  Let
+    // Activate()/Deactivate() handle context switches.
+}
diff --git a/main/sc/source/ui/formdlg/dwfunctr.cxx b/main/sc/source/ui/formdlg/dwfunctr.cxx
index 0e257cc..e2e51e3 100644
--- a/main/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/main/sc/source/ui/formdlg/dwfunctr.cxx
@@ -118,7 +118,10 @@
 	aTimer.SetTimeout(200);
 	aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl));
 
-	eSfxNewAlignment=GetAlignment();
+    if (pCW != NULL)
+        eSfxNewAlignment=GetAlignment();
+    else
+        eSfxNewAlignment=SFX_ALIGN_RIGHT;
 	eSfxOldAlignment=eSfxNewAlignment;
 	aFiFuncDesc.SetUpdateMode(sal_True);
 	pAllFuncList=&aFuncList;
diff --git a/main/sc/source/ui/inc/chartsh.hxx b/main/sc/source/ui/inc/chartsh.hxx
index 05ff3f2..7c8ae8e 100644
--- a/main/sc/source/ui/inc/chartsh.hxx
+++ b/main/sc/source/ui/inc/chartsh.hxx
@@ -42,7 +42,7 @@
 
 				ScChartShell(ScViewData* pData);
 	virtual		~ScChartShell();
-
+    virtual void HandleSelectionChange (void);    
 };
 
 #endif
diff --git a/main/sc/source/ui/inc/drawsh.hxx b/main/sc/source/ui/inc/drawsh.hxx
index a622b6a..b1d0510 100644
--- a/main/sc/source/ui/inc/drawsh.hxx
+++ b/main/sc/source/ui/inc/drawsh.hxx
@@ -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* );
 
@@ -81,6 +87,9 @@
     ScDrawView* GetDrawView();
 
 	sal_Bool	AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark);
+
+    void GetDrawAttrStateForIFBX( SfxItemSet& rSet );
+    ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void);
 };
 
 
diff --git a/main/sc/source/ui/inc/drformsh.hxx b/main/sc/source/ui/inc/drformsh.hxx
index edaf60e..aef6fae 100644
--- a/main/sc/source/ui/inc/drformsh.hxx
+++ b/main/sc/source/ui/inc/drformsh.hxx
@@ -43,9 +43,6 @@
 
 				ScDrawFormShell(ScViewData* pData);
 	virtual		~ScDrawFormShell();
-
-//	void		Execute(SfxRequest &);
-//	void		GetState(SfxItemSet &);
 };
 
 #endif
diff --git a/main/sc/source/ui/inc/drtxtob.hxx b/main/sc/source/ui/inc/drtxtob.hxx
index d1ac33e..a4766d4 100644
--- a/main/sc/source/ui/inc/drtxtob.hxx
+++ b/main/sc/source/ui/inc/drtxtob.hxx
@@ -64,8 +64,9 @@
 	void ExecuteAttr( SfxRequest &rReq );
 	void GetAttrState( SfxItemSet& rSet );
 	void ExecuteToggle( SfxRequest &rReq );
+	void GetStatePropPanelAttr(SfxItemSet &);
 
-	sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet );
+	sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet , sal_uInt16 nSlot);
 	sal_Bool ExecuteParaDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet );
 
 	void ExecuteExtra( SfxRequest &rReq );
diff --git a/main/sc/source/ui/inc/formatsh.hxx b/main/sc/source/ui/inc/formatsh.hxx
index addbebe..4dfac82 100644
--- a/main/sc/source/ui/inc/formatsh.hxx
+++ b/main/sc/source/ui/inc/formatsh.hxx
@@ -70,6 +70,9 @@
 
     void        ExecFormatPaintbrush( SfxRequest& rReq );
     void        StateFormatPaintbrush( SfxItemSet& rSet );
+
+    void        ExecViewOptions( SfxRequest& rReq );
+    void        GetViewOptions( SfxItemSet& rSet );
 };
 
 #endif
diff --git a/main/sc/source/ui/inc/navipi.hxx b/main/sc/source/ui/inc/navipi.hxx
index 0343a23..e975fbb 100644
--- a/main/sc/source/ui/inc/navipi.hxx
+++ b/main/sc/source/ui/inc/navipi.hxx
@@ -273,7 +273,8 @@
 	SCROW			nCurRow;
 	SCTAB			nCurTab;
 	sal_Bool			bFirstBig;
-
+    bool mbUseStyleSettingsBackground;
+    
 	ScNavigatorControllerItem** ppBoundItems;
 
 	DECL_LINK( TimeHdl, Timer* );
@@ -325,7 +326,8 @@
 	virtual void	Resizing( Size& rSize );
 
 public:
-				ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent );
+                ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent,
+                    const bool bUseStyleSettingsBackground);
 				~ScNavigatorDlg();
 
     using Window::Notify;
diff --git a/main/sc/source/ui/inc/oleobjsh.hxx b/main/sc/source/ui/inc/oleobjsh.hxx
index e23f92a..e2e8bfd 100644
--- a/main/sc/source/ui/inc/oleobjsh.hxx
+++ b/main/sc/source/ui/inc/oleobjsh.hxx
@@ -43,6 +43,7 @@
 				ScOleObjectShell(ScViewData* pData);
 	virtual		~ScOleObjectShell();
 
+    virtual void HandleSelectionChange (void);
 };
 
 #endif
diff --git a/main/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/main/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index 37186b0..d99c0d2 100644
--- a/main/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/main/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -89,8 +89,8 @@
 {
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     const SfxPoolItem* pItem = NULL;
-    XColorTable* pColorTable = NULL;
-    ::boost::scoped_ptr<XColorTable> pOwnColorTable; // locally instantiated in case the doc shell doesn't have one.
+    XColorList* pColorTable = NULL;
+    ::boost::scoped_ptr< XColorList > pOwnColorTable; // locally instantiated in case the doc shell doesn't have one.
 
     const Size aSize15x15 = Size( 15, 15 );
     const Size aSize10x10 = Size( 10, 10 );
@@ -103,7 +103,7 @@
         pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
     if ( !pColorTable )
     {
-        pOwnColorTable.reset(new XColorTable(SvtPathOptions().GetPalettePath()));
+        pOwnColorTable.reset(new XColorList(SvtPathOptions().GetPalettePath()));
         pColorTable = pOwnColorTable.get();
     }
     if ( pColorTable )
diff --git a/main/sc/source/ui/navipi/navipi.cxx b/main/sc/source/ui/navipi/navipi.cxx
index 6c988f0..1c338c2 100644
--- a/main/sc/source/ui/navipi/navipi.cxx
+++ b/main/sc/source/ui/navipi/navipi.cxx
@@ -428,8 +428,8 @@
 			else
 				eNewMode = NAV_LMODE_NONE;
 		}
-		rDlg.SetListMode( eNewMode );
-		UpdateButtons();
+        rDlg.SetListMode( eNewMode );
+        UpdateButtons();
 	}
 	else
 		switch ( nSelId )
@@ -576,7 +576,7 @@
                                     SfxChildWinInfo* /* pInfo */ ) :
 		SfxChildWindowContext( nId )
 {
-	pNavigator = new ScNavigatorDlg( pBind, this, pParent );
+	pNavigator = new ScNavigatorDlg( pBind, this, pParent, true );
 	SetWindow( pNavigator );
 
 	//	Einstellungen muessen anderswo gemerkt werden,
@@ -652,7 +652,8 @@
 #define REGISTER_SLOT(i,id) \
 	ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings);
 
-ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ) :
+ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent,
+    const bool bUseStyleSettingsBackground) :
 		Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ),
 		rBindings	( *pB ),								// is used in CommandToolBox ctor
 		aCmdImageList( ScResId( IL_CMD ) ),
@@ -678,7 +679,8 @@
 		nCurCol		( 0 ),
 		nCurRow		( 0 ),
 		nCurTab		( 0 ),
-		bFirstBig	( sal_False )
+		bFirstBig	( sal_False ),
+        mbUseStyleSettingsBackground(bUseStyleSettingsBackground)
 {
 	ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
 	nDropMode = rCfg.GetDragMode();
@@ -767,6 +769,16 @@
 	aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries);
 	aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd);
 	aLbDocuments.SetAccessibleName(aStrActiveWin);
+
+    if (pContextWin == NULL)
+    {
+        // When the context window is missing then the navigator is
+        // displayed in the sidebar and has the whole deck to fill.
+        // Therefore hide the button that hides all controls below the
+        // top two rows of buttons.
+        aTbxCmd.Select(IID_ZOOMOUT);
+        aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT));
+    }
 }
 
 //------------------------------------------------------------------------
@@ -790,7 +802,7 @@
 
 void __EXPORT ScNavigatorDlg::Resizing( Size& rNewSize )  // Size = Outputsize?
 {
-	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+	FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
 	if ( pFloat )
 	{
 		Size aMinOut = pFloat->GetMinOutputSizePixel();
@@ -814,14 +826,22 @@
 
 void ScNavigatorDlg::Paint( const Rectangle& rRec )
 {
-	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-	Color aBgColor = rStyleSettings.GetFaceColor();
-	Wallpaper aBack( aBgColor );
+    if (mbUseStyleSettingsBackground)
+    {
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+        Color aBgColor = rStyleSettings.GetFaceColor();
+        Wallpaper aBack( aBgColor );
 
-	SetBackground( aBack );
-	aFtCol.SetBackground( aBack );
-	aFtRow.SetBackground( aBack );
-
+        SetBackground( aBack );
+        aFtCol.SetBackground( aBack );
+        aFtRow.SetBackground( aBack );
+    }
+    else
+    {
+        aFtCol.SetBackground(Wallpaper());
+        aFtRow.SetBackground(Wallpaper());
+    }
+    
 	Window::Paint( rRec );
 }
 
@@ -897,9 +917,12 @@
 	//@@ 03.11.97 end
 
 	sal_Bool bListMode = (eListMode != NAV_LMODE_NONE);
-	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
-	if ( pFloat && bListMode )
-		nListModeHeight = nTotalHeight;
+    if (pContextWin != NULL)
+    {
+        FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+        if ( pFloat && bListMode )
+            nListModeHeight = nTotalHeight;
+    }
 }
 
 //------------------------------------------------------------------------
@@ -1201,18 +1224,18 @@
 		switch ( eMode )
 		{
 			case NAV_LMODE_NONE:
-				ShowList( sal_False, bSetSize );
+                ShowList( sal_False, bSetSize );
 				break;
 
 			case NAV_LMODE_AREAS:
 			case NAV_LMODE_DBAREAS:
 			case NAV_LMODE_DOCS:
 				aLbEntries.Refresh();
-				ShowList( sal_True, bSetSize );
+                ShowList( sal_True, bSetSize );
 				break;
 
 			case NAV_LMODE_SCENARIOS:
-				ShowScenarios( sal_True, bSetSize );
+                ShowScenarios( sal_True, bSetSize );
 				break;
 		}
 
@@ -1220,8 +1243,8 @@
 
 		if ( eMode != NAV_LMODE_NONE )
 		{
-			ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
-			rCfg.SetListMode( (sal_uInt16) eMode );
+            ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
+            rCfg.SetListMode( (sal_uInt16) eMode );
 		}
 	}
 
@@ -1233,7 +1256,7 @@
 
 void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize )
 {
-	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+	FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
 	Size aSize = GetParent()->GetOutputSizePixel();
 
 	if ( bShow )
@@ -1245,7 +1268,7 @@
 			pFloat->SetMinOutputSizePixel( aMinSize );
 		aSize.Height() = nListModeHeight;
 		aLbEntries.Show();
-		aLbDocuments.Show();
+        aLbDocuments.Show();
 	}
 	else
 	{
@@ -1267,10 +1290,13 @@
 	}
 	else
 	{
-		SfxNavigator* pNav = (SfxNavigator*)GetParent();
-		Size aFloating = pNav->GetFloatingSize();
-		aFloating.Height() = aSize.Height();
-		pNav->SetFloatingSize( aFloating );
+		SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent());
+        if (pNav != NULL)
+        {
+            Size aFloating = pNav->GetFloatingSize();
+            aFloating.Height() = aSize.Height();
+            pNav->SetFloatingSize( aFloating );
+        }
 	}
 }
 
@@ -1278,7 +1304,7 @@
 
 void ScNavigatorDlg::ShowScenarios( sal_Bool bShow, sal_Bool bSetSize )
 {
-	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+	FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
 	Size aSize = GetParent()->GetOutputSizePixel();
 
 	if ( bShow )
diff --git a/main/sc/source/ui/optdlg/opredlin.cxx b/main/sc/source/ui/optdlg/opredlin.cxx
index 60a828f..e3216c7 100644
--- a/main/sc/source/ui/optdlg/opredlin.cxx
+++ b/main/sc/source/ui/optdlg/opredlin.cxx
@@ -171,7 +171,7 @@
 void __EXPORT ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
 {
 
-	XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+	XColorList* pColorTbl = XColorList::GetStdColorList();
 	aContentColorLB.InsertEntry(aAuthorStr);
 	aMoveColorLB.InsertEntry(aAuthorStr);
 	aInsertColorLB.InsertEntry(aAuthorStr);
diff --git a/main/sc/source/ui/optdlg/tpview.cxx b/main/sc/source/ui/optdlg/tpview.cxx
index 30475ee..096d24f 100644
--- a/main/sc/source/ui/optdlg/tpview.cxx
+++ b/main/sc/source/ui/optdlg/tpview.cxx
@@ -351,7 +351,7 @@
 		// hier koennte auch eine andere DocShell kommen!
 		pDocSh = PTR_CAST(ScDocShell, pDocSh);
 
-		XColorTable* pColorTable = NULL;
+		XColorList* pColorTable = NULL;
 
 		if ( pDocSh  )
 		{
@@ -361,7 +361,7 @@
 				pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
 		}
 		else
-			pColorTable = XColorTable::GetStdColorTable();
+			pColorTable = XColorList::GetStdColorList();
 
 		if ( !pColorTable )
 			return;
diff --git a/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
new file mode 100755
index 0000000..191905a
--- /dev/null
+++ b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -0,0 +1,636 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <AlignmentPropertyPanel.hxx>
+#include <AlignmentPropertyPanel.hrc>
+#include <svx/dialmgr.hxx>
+#include "sc.hrc"
+#include "scresid.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/algitem.hxx>
+#include <svx/dlgutil.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/sidebar/SidebarDialControl.hxx>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::ControlFactory;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace open
+
+namespace sc { namespace sidebar {
+
+//////////////////////////////////////////////////////////////////////////////
+
+AlignmentPropertyPanel::AlignmentPropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+    : Control(
+        pParent, 
+            ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)),
+      mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)),
+      mpTBHorizontal(ControlFactory::CreateToolBox(
+              mpTBHorizontalBackground.get(),
+              ScResId(TBX_HORIZONTAL_ALIGNMENT))),
+      mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)),
+      mpTBVertical(ControlFactory::CreateToolBox(
+              mpTBVerticalBackground.get(),
+              ScResId(TBX_VERTICAL_ALIGN))),
+      mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))),
+      mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))),
+      mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))),
+      mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))),
+      mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))),
+      mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)),
+      mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))),
+      mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))),
+      maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
+      maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
+      maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
+      maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
+      maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
+      maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
+      maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
+      maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)),
+      maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)),
+      maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)),
+      maIMGAlignJust(ScResId(IMG_ALIGN_JUST)),
+      maIMGAlignTop(ScResId(IMG_ALIGN_TOP)),
+      maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)),
+      maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)),
+      meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
+      meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
+      mbMultiDisable(false),
+      mxFrame(rxFrame),
+      maContext(),
+      mpBindings(pBindings)
+{
+    Initialize();
+    FreeResource();
+
+    mpFTLeftIndent->SetBackground(Wallpaper());
+    mpFtRotate->SetBackground(Wallpaper());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+AlignmentPropertyPanel::~AlignmentPropertyPanel()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::Initialize()
+{
+	mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft);
+	mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter);
+	mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight);
+	mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust);
+	Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() );
+	mpTBHorizontal->SetOutputSizePixel( aTbxSize );
+	mpTBHorizontal->SetBackground(Wallpaper());
+	mpTBHorizontal->SetPaintTransparent(true);
+	Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
+	mpTBHorizontal->SetSelectHdl ( aLink );
+
+	mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop);
+	mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV);
+	mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom);
+	Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() );
+	mpTBVertical->SetOutputSizePixel( aTbxSize2 );
+	mpTBVertical->SetBackground(Wallpaper());
+	mpTBVertical->SetPaintTransparent(true);
+	aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
+	mpTBVertical->SetSelectHdl ( aLink );
+
+	mpFTLeftIndent->Disable();
+	mpMFLeftIndent->Disable();
+	mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent")));	//wj acc
+	aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl);
+	mpMFLeftIndent->SetModifyHdl ( aLink );
+
+	aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl);
+	mpCBXMergeCell->SetClickHdl ( aLink );
+	
+	aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl);
+	mpCBXWrapText->SetClickHdl ( aLink );
+
+	//rotation control
+	mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation")));	//wj acc
+	mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl));
+
+    //rotation
+	mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation")));	//wj acc
+	mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl));
+	mpMtrAngle->EnableAutocomplete( false );
+
+    //Vertical stacked
+	mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) );
+
+	mpMtrAngle->InsertValue(0, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(45, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(90, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(135, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(180, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(225, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(270, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(315, FUNIT_CUSTOM);
+    mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
+
+    mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get());
+	mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get());
+	mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get());
+	mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get());
+#ifdef HAS_IA2
+	mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get());
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG )
+{
+	String sTmp = mpMtrAngle->GetText();
+
+	sal_Unicode nChar = sTmp.GetChar( 0 );
+	if((sTmp.Len()== 1 &&  nChar == '-') || 
+		(nChar != '-' && ((nChar < '0') || (nChar > '9') ) ))	////modify 
+		return 0;
+
+	double dTmp = sTmp.ToDouble();
+	FormatDegrees(dTmp);
+
+	sal_Int64 nTmp = (sal_Int64)dTmp*100;
+	SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
+	
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG )
+{
+	sal_Int32 nTmp = mpCtrlDial->GetRotation();
+	SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
+	
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
+
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG )
+{
+	bool bVertical = mpCbStacked->IsChecked() ? true : false;
+	SfxBoolItem  aStackItem( SID_ATTR_ALIGN_STACKED, bVertical );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L );
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+
+	if(nId == ID_SUBSTLEFT)
+	{
+		if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT)
+			meHorAlignState = SVX_HOR_JUSTIFY_LEFT;
+		else
+			meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
+	}
+	else if( nId == ID_SUBSTCENTER )
+	{
+		if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER)
+			meHorAlignState = SVX_HOR_JUSTIFY_CENTER;
+		else
+			meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
+	}
+	else if( nId == ID_SUBSTRIGHT )
+	{
+		if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT)
+			meHorAlignState = SVX_HOR_JUSTIFY_RIGHT;
+		else
+			meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
+	}
+	else if( nId == ID_SUBSTJUSTIFY )
+	{
+		if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK)
+			meHorAlignState = SVX_HOR_JUSTIFY_BLOCK;
+		else
+			meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
+	}
+	SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL);
+	GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L);
+	UpdateHorAlign();
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+
+	//Bold
+	if(nId == IID_VERT_TOP)
+	{
+		if(meVerAlignState != SVX_VER_JUSTIFY_TOP)
+			meVerAlignState = SVX_VER_JUSTIFY_TOP;
+		else
+			meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
+	}
+	else if( nId == IID_VERT_CENTER )
+	{
+		if(meVerAlignState != SVX_VER_JUSTIFY_CENTER)
+			meVerAlignState = SVX_VER_JUSTIFY_CENTER;
+		else
+			meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
+	}
+	else if( nId == IID_VERT_BOTTOM )
+	{
+		if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM)
+			meVerAlignState = SVX_VER_JUSTIFY_BOTTOM;
+		else
+			meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
+	}
+	SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL);
+	GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L);
+	UpdateVerAlign();
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG)
+{
+	mpCBXWrapText->EnableTriState(false);
+	sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue();
+	SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT,  (sal_uInt16)CalcToUnit( nVal,  SFX_MAPUNIT_TWIP ) );
+
+	GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L);
+	return( 0L );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG)
+{
+	bool bState = mpCBXMergeCell->IsChecked();
+
+	//Modified 
+	//SfxBoolItem aItem( FID_MERGE_TOGGLE , bState);
+	//GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L);
+	if(bState)
+		GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD);
+	else
+		GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD);
+	GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false);	
+	//modified end
+
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG)
+{
+	bool bState = mpCBXWrapText->IsChecked();
+	SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState);
+	GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L);
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+AlignmentPropertyPanel* AlignmentPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2);
+    
+    return new AlignmentPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::HandleContextChange(
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if(maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+
+
+
+    // todo
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{
+	switch(nSID)
+	{
+	case SID_H_ALIGNCELL:
+		if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) )
+		{
+				const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState;
+				meHorAlignState = (SvxCellHorJustify)pItem->GetValue();
+		}
+		else
+		{
+			meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
+		}
+		UpdateHorAlign();
+		break;
+	case SID_V_ALIGNCELL:
+		if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) )
+		{
+				const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState;
+				meVerAlignState = (SvxCellVerJustify)pItem->GetValue();
+		}
+		else
+		{
+			meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
+		}
+		UpdateVerAlign();
+		break;
+	case SID_ATTR_ALIGN_INDENT:
+		if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) )
+		{
+				const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState;
+				sal_uInt16 nVal = pItem->GetValue();
+				mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) );
+		}
+		else
+		{
+			mpMFLeftIndent->SetValue(0);
+			mpMFLeftIndent->SetText(String());
+		}
+		break;
+	case FID_MERGE_TOGGLE:
+		if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
+		{
+			mpCBXMergeCell->Enable();
+			const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+			bool bVal = pItem->GetValue();
+			if(bVal)
+				mpCBXMergeCell->Check(true);
+			else
+				mpCBXMergeCell->Check(false);
+		}
+		else
+		{
+			mpCBXMergeCell->Check(false);
+			mpCBXMergeCell->Disable();
+		}
+		break;
+
+	case SID_ATTR_ALIGN_LINEBREAK:
+		if(eState == SFX_ITEM_DISABLED)
+		{
+			mpCBXWrapText->EnableTriState(false);
+			mpCBXWrapText->Check(false);
+			mpCBXWrapText->Disable();
+		}
+		else 
+		{
+			mpCBXWrapText->Enable();
+			if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
+			{
+				mpCBXWrapText->EnableTriState(false);
+				const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+				bool bVal = pItem->GetValue();
+				if(bVal)
+					mpCBXWrapText->Check(true);
+				else
+					mpCBXWrapText->Check(false);
+			}
+			else if(eState == SFX_ITEM_DONTCARE)
+			{
+				mpCBXWrapText->EnableTriState(true);
+				mpCBXWrapText->SetState(STATE_DONTKNOW);
+			}
+		}
+		break;
+	case SID_ATTR_ALIGN_DEGREES:
+		if (eState >= SFX_ITEM_AVAILABLE)
+		{
+			long nTmp = ((const SfxInt32Item*)pState)->GetValue(); 
+			mpMtrAngle->SetValue( nTmp / 100);	//wj
+			mpCtrlDial->SetRotation( nTmp );
+			switch(nTmp)
+			{
+				case 0:
+					mpMtrAngle->SelectEntryPos(0);
+				break;
+				case 4500:
+					mpMtrAngle->SelectEntryPos(1);
+				break;
+				case 9000:
+					mpMtrAngle->SelectEntryPos(2);
+				break;
+				case 13500:
+					mpMtrAngle->SelectEntryPos(3);
+				break;
+				case 18000:
+					mpMtrAngle->SelectEntryPos(4);
+				break;
+				case 22500:
+					mpMtrAngle->SelectEntryPos(5);
+				break;
+				case 27000:
+					mpMtrAngle->SelectEntryPos(6);
+				break;
+				case 31500:
+					mpMtrAngle->SelectEntryPos(7);
+			}
+		}
+		else
+		{
+			mpMtrAngle->SetText( String() );
+			mpCtrlDial->SetRotation( 0 );
+		}
+		break;
+	case SID_ATTR_ALIGN_STACKED:
+		if (eState >= SFX_ITEM_AVAILABLE)
+		{			
+			mpCbStacked->EnableTriState(false);
+			const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState;
+			bool IsChecked = (bool)aStackItem->GetValue();
+			if(IsChecked)
+			{
+				mpCbStacked->Check(IsChecked);
+				mpFtRotate->Disable();
+				mpMtrAngle->Disable();
+				mpCtrlDial->Disable();
+				mbMultiDisable = true;
+			}
+			else
+			{
+				mpCbStacked->Check(IsChecked);
+				mpFtRotate->Enable();
+				mpMtrAngle->Enable();
+				mpCtrlDial->Enable();
+				mbMultiDisable = false;
+			}
+		}
+		else
+		{
+			mbMultiDisable = true;
+			mpFtRotate->Disable();
+			mpMtrAngle->Disable();
+			mpCtrlDial->Disable();
+			mpCbStacked->EnableTriState(true);
+			mpCbStacked->SetState(STATE_DONTKNOW);
+		}
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SfxBindings* AlignmentPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::FormatDegrees(double& dTmp)
+{
+	while(dTmp<0)
+		dTmp += 360;
+	while (dTmp > 359)	//modify 
+		dTmp = 359;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::UpdateHorAlign()
+{
+	mpTBHorizontal->SetItemState(ID_SUBSTLEFT,	STATE_NOCHECK);
+	mpTBHorizontal->SetItemState(ID_SUBSTCENTER,	STATE_NOCHECK);
+	mpTBHorizontal->SetItemState(ID_SUBSTRIGHT,	STATE_NOCHECK);
+	mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK);
+	mpFTLeftIndent->Disable();
+	mpMFLeftIndent->Disable();
+	if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT)
+	{
+		mpFtRotate->Disable();
+		mpCtrlDial->Disable();
+		mpMtrAngle->Disable();
+		mpCbStacked->Disable();
+	}
+	else
+	{
+		if(!mbMultiDisable)
+		{
+			mpFtRotate->Enable();
+			mpCtrlDial->Enable();
+			mpMtrAngle->Enable();
+		}
+		else
+		{
+			mpFtRotate->Disable();
+			mpCtrlDial->Disable();
+			mpMtrAngle->Disable();
+		}
+		mpCbStacked->Enable();
+	}
+	switch(meHorAlignState)
+	{
+	case SVX_HOR_JUSTIFY_LEFT:	
+		mpTBHorizontal->SetItemState(ID_SUBSTLEFT,	STATE_CHECK);
+		mpFTLeftIndent->Enable();
+		mpMFLeftIndent->Enable();
+		break;
+	case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER,	STATE_CHECK);break;
+	case SVX_HOR_JUSTIFY_RIGHT:	mpTBHorizontal->SetItemState(ID_SUBSTRIGHT,	STATE_CHECK);break;
+	case SVX_HOR_JUSTIFY_BLOCK:	mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break;
+	default:;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AlignmentPropertyPanel::UpdateVerAlign()
+{
+	mpTBVertical->SetItemState(IID_VERT_TOP,		STATE_NOCHECK);
+	mpTBVertical->SetItemState(IID_VERT_CENTER,	STATE_NOCHECK);
+	mpTBVertical->SetItemState(IID_VERT_BOTTOM,	STATE_NOCHECK);
+	
+	switch(meVerAlignState)
+	{
+	case SVX_VER_JUSTIFY_TOP:	mpTBVertical->SetItemState(IID_VERT_TOP,		STATE_CHECK);break;
+	case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER,	STATE_CHECK);break;
+	case SVX_VER_JUSTIFY_BOTTOM:	mpTBVertical->SetItemState(IID_VERT_BOTTOM,	STATE_CHECK);break;
+	default:;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace close
+
+}} // end of namespace ::sc::sidebar
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc
new file mode 100755
index 0000000..1929aa6
--- /dev/null
+++ b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+// RID_PROPERTYPANEL_SC_ALIGNMENT--------------------------------------------------------------
+#define FT_ORIENT                                            1
+#define CBX_WRAP										     5
+#define FT_LEFT_INDENT										 7
+#define MF_LEFT_INDENT										 8
+#define CBX_MERGE											 9
+#define CBX_VERT											10
+#define CTL_SBSHAPE_POSREFERENCE                            12
+#define CBOX_ANGLE										14
+#define TBX_HORIZONTAL_ALIGNMENT						15
+#define TBX_VERTICAL_ALIGN								16
+#define DIAL_CONTROL									17
+#define ID_SUBSTLEFT			    20
+#define ID_SUBSTCENTER				21
+#define ID_SUBSTRIGHT				22
+#define ID_SUBSTJUSTIFY				23
+#define IID_VERT_TOP				24
+#define IID_VERT_CENTER				25
+#define IID_VERT_BOTTOM				26
+
+#define MBOX_WIDTH						45
+#define TEXT_WIDTH                      40
+#define FLIP_BUTTON_SIZE                13
+#define ALIGNMENT_TBX_HEIGHT			17
+#define ALIGNMENT_TBX_WIDTH				13
+
+#define	IMG_ALIGN_LEFT					50
+#define IMG_ALIGN_CENTER				51
+#define IMG_ALIGN_RIGHT					52
+#define IMG_ALIGN_JUST					53
+#define IMG_ALIGN_TOP					54
+#define IMG_ALIGN_CENTER_V				55
+#define IMG_ALIGN_BOTTOM				56
+
+//---------------position-----------------
+
+#define ALIGNMENT_X						     	SECTIONPAGE_MARGIN_HORIZONTAL
+#define ALIGNMENT_Y							    SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define ALIGNMENT_VERT_X						(ALIGNMENT_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL)
+#define ALIGNMENT_VERT_Y						ALIGNMENT_Y
+
+#define FT_LEFTINDENT_X							ALIGNMENT_X
+#define FT_LEFTINDENT_Y							(ALIGNMENT_Y + TOOLBOX_ITEM_HEIGHT + TBX_OUT_BORDER_OFFSET_Y + CONTROL_SPACING_VERTICAL)
+#define MTR_LEFTINDENT_X						ALIGNMENT_X
+#define MTR_LEFTINDENT_Y						(FT_LEFTINDENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)
+
+#define CBX_WRAP_X							    (ALIGNMENT_X + TEXT_WIDTH + 10 + CONTROL_SPACING_HORIZONTAL)
+#define CBX_WRAP_Y							    (FT_LEFTINDENT_Y + 2)
+
+#define CBX_MERGE_X							    CBX_WRAP_X
+#define CBX_MERGE_Y							    CBX_WRAP_Y + CBOX_HEIGHT + 2
+
+#define FT_ORIENT_X								ALIGNMENT_X
+#define FT_ORIENT_Y								MTR_LEFTINDENT_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+
+#define COMOBX_ROTATION_X						FT_ORIENT_X + 30 + CONTROL_SPACING_HORIZONTAL
+#define COMOBX_ROTATION_Y						FT_ORIENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + 5
+
+#define ROTATE_CONTROL_X						FT_ORIENT_X
+#define ROTATE_CONTROL_Y						COMOBX_ROTATION_Y - 3
+
+#define CBX_VERT_X							    COMOBX_ROTATION_X
+#define CBX_VERT_Y							    COMOBX_ROTATION_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 2
+
+#define PANEL_HEIGHT							CBX_VERT_Y + 6 + SECTIONPAGE_MARGIN_VERTICAL_BOT
+
+// eof
diff --git a/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
new file mode 100755
index 0000000..73d6b7e
--- /dev/null
+++ b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -0,0 +1,130 @@
+/**************************************************************
+ * 
+ * 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 SC_PROPERTYPANEL_ALIGNMENT_HXX
+#define SC_PROPERTYPANEL_ALIGNMENT_HXX
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <vcl/fixed.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <editeng/svxenum.hxx>
+
+class ToolBox;
+class MetricField;
+class MetricBox;
+class CheckBox;
+namespace svx { namespace sidebar { class SidebarDialControl; }}
+
+namespace sc { namespace sidebar {
+
+class AlignmentPropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::IContextChangeReceiver,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static AlignmentPropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void HandleContextChange(
+        const ::sfx2::sidebar::EnumContext aContext);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+private:
+    //ui controls
+	::boost::scoped_ptr<Window> 			    mpTBHorizontalBackground;
+    ::boost::scoped_ptr< ToolBox >              mpTBHorizontal;
+	::boost::scoped_ptr<Window> 			    mpTBVerticalBackground;
+    ::boost::scoped_ptr< ToolBox >              mpTBVertical;
+    ::boost::scoped_ptr< FixedText >            mpFTLeftIndent;
+    ::boost::scoped_ptr< MetricField >          mpMFLeftIndent;
+    ::boost::scoped_ptr< CheckBox >             mpCBXWrapText;
+    ::boost::scoped_ptr< CheckBox >             mpCBXMergeCell;
+    ::boost::scoped_ptr< FixedText >            mpFtRotate;
+    ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
+    ::boost::scoped_ptr< MetricBox >            mpMtrAngle;
+    ::boost::scoped_ptr< CheckBox >             mpCbStacked;
+
+    ::sfx2::sidebar::ControllerItem             maAlignHorControl;
+    ::sfx2::sidebar::ControllerItem             maAlignVerControl;
+    ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
+    ::sfx2::sidebar::ControllerItem             maMergeCellControl;
+    ::sfx2::sidebar::ControllerItem             maWrapTextControl;
+    ::sfx2::sidebar::ControllerItem             maAngleControl;
+    ::sfx2::sidebar::ControllerItem             maStackControl;
+
+    Image                                       maIMGAlignLeft;
+    Image                                       maIMGAlignCenter;
+    Image                                       maIMGAlignRight;
+    Image                                       maIMGAlignJust;
+    Image                                       maIMGAlignTop;
+    Image                                       maIMGAlignCenterV;
+    Image                                       maIMGAlignBottom;
+
+    SvxCellHorJustify                           meHorAlignState;
+    SvxCellVerJustify                           meVerAlignState;
+
+    /// bitfield
+    bool                                        mbMultiDisable : 1;
+
+    cssu::Reference<css::frame::XFrame>         mxFrame;
+    ::sfx2::sidebar::EnumContext                maContext;
+    SfxBindings*                                mpBindings;
+
+    DECL_LINK( TbxHorAlignSelectHdl, ToolBox* );
+    DECL_LINK( TbxVerAlignSelectHdl, ToolBox* );
+    DECL_LINK( MFLeftIndentMdyHdl, void * );
+    DECL_LINK( CBOXMergnCellClkHdl, void * );
+    DECL_LINK( CBOXWrapTextClkHdl, void * );
+    DECL_LINK( AngleModifiedHdl, void * );
+    DECL_LINK( RotationHdl, void * );
+    DECL_LINK( ClickStackHdl, void * );
+
+    // constructor/destuctor
+    AlignmentPropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~AlignmentPropertyPanel();
+
+    void Initialize();
+    void UpdateHorAlign();
+    void UpdateVerAlign();
+    void FormatDegrees(double& dTmp);
+};
+
+} } // end of namespace ::sc::sidebar
+
+#endif
+// eof
diff --git a/main/sc/source/ui/sidebar/AlignmentPropertyPanel.src b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.src
new file mode 100755
index 0000000..f7ff8af
--- /dev/null
+++ b/main/sc/source/ui/sidebar/AlignmentPropertyPanel.src
@@ -0,0 +1,217 @@
+/**************************************************************
+ * 
+ * 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 "AlignmentPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include "sc.hrc"
+#include "helpids.h"
+
+Control RID_PROPERTYPANEL_SC_ALIGNMENT
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PANEL_HEIGHT );	
+	HelpID = HID_PROPERTYPANEL_SC_ALIGN_SECTION;
+	Text [ en-US ] = "Alignment";
+		
+	//------------ Alignment -------------
+	ToolBox TBX_HORIZONTAL_ALIGNMENT
+	{
+        Pos = MAP_APPFONT ( ALIGNMENT_X , ALIGNMENT_Y );
+        Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_HOR;
+		Text [ en-US ] = "Horizontal Alignment" ;	
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = ID_SUBSTLEFT ;
+				Text [ en-US ] = "Align Left" ;	
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L;		
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_SUBSTCENTER ;
+				Text [ en-US ] = "Align Center" ;	
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C;			
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_SUBSTRIGHT ;
+				Text [ en-US ] = "Align Right" ;
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R;		
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_SUBSTJUSTIFY ;
+				Text [ en-US ] = "Align Justified" ;
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J;			
+			};
+		};
+	};
+	ToolBox TBX_VERTICAL_ALIGN
+	{
+		SVLook = TRUE ;
+		Border = FALSE ;
+		Pos = MAP_APPFONT ( ALIGNMENT_VERT_X,  ALIGNMENT_VERT_Y ) ;
+		Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 ,  TOOLBOX_ITEM_HEIGHT) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_VER;
+		Text [ en-US ] = "Vertical Alignment" ;	
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_TOP ;
+				Text [ en-US ] = "Align Top" ;	
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_T;		
+			};
+			
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_CENTER ;
+				Text [ en-US ] = "Align Center Vertically" ;	
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_C;			
+			};
+			
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_BOTTOM ;
+				Text [ en-US ] = "Align Bottom" ;
+				HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_B;				
+			};
+		};
+	};
+	//------------ Left indent ------------
+	FixedText FT_LEFT_INDENT
+	{
+		Pos = MAP_APPFONT ( FT_LEFTINDENT_X, FT_LEFTINDENT_Y );
+		Size = MAP_APPFONT (CBX_WRAP_X - FT_LEFTINDENT_X - 1 , TEXT_HEIGHT) ; //MBOX_WIDTH 
+		Text [ en-US ] = "Left ~indent:";
+	};
+	MetricField MF_LEFT_INDENT
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MTR_LEFTINDENT_X , MTR_LEFTINDENT_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ;
+		TabStop = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Minimum = 0;
+		Maximum = 990;
+		Unit = FUNIT_POINT;
+		SpinSize = 10;
+		QuickHelpText [ en-US ] = "Indents from the left edge.";
+		HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_INDENT;
+	};
+	CheckBox CBX_WRAP
+	{
+		Pos = MAP_APPFONT ( CBX_WRAP_X , CBX_WRAP_Y ) ;
+        Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;//
+		TabStop = TRUE ;
+		Text [ en-US ] = "~Wrap text" ;
+		QuickHelpText [ en-US ] = "Wrap texts automatically.";
+		HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_WRAP;
+	};	
+	CheckBox CBX_MERGE
+	{
+		Pos = MAP_APPFONT ( CBX_MERGE_X , CBX_MERGE_Y ) ;
+        Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;//
+		TabStop = TRUE ;
+		Text [ en-US ] = "~Merge cells" ;
+		QuickHelpText [ en-US ] = "Joins the selected cells into one.";
+		HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_MERGE;
+	};	
+	//------------ Text orientation ------------
+	FixedText FT_ORIENT
+	{
+	    Pos = MAP_APPFONT ( FT_ORIENT_X, FT_ORIENT_Y );
+        Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ;
+		Text [ en-US ] = "Text ~orientation:";
+	};
+	MetricBox CBOX_ANGLE
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( COMOBX_ROTATION_X , COMOBX_ROTATION_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 20, MBOX_HEIGHT ) ;
+        Unit = FUNIT_CUSTOM ;
+		CustomUnitText [ en-US ] = " degrees";
+		DecimalDigits = 0;
+		Minimum = 0;
+		Maximum = 359;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		QuickHelpText [ en-US ] = "Select the angle for rotation.";
+		HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE;
+	};
+
+	Control	DIAL_CONTROL
+	{
+		Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y );
+		Size = MAP_PIXEL( 50, 50 );
+		HelpID = HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL;
+		QuickHelpText [ en-US ] = "Drag to change the rotation value.";
+	};
+	CheckBox CBX_VERT
+	{
+		Pos = MAP_APPFONT ( CBX_VERT_X , CBX_VERT_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH + 20 , CBOX_HEIGHT + 5 ) ;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~Vertically stacked" ;
+		QuickHelpText [ en-US ] = "Aligns text vertically.";
+		HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_VERT;
+	};
+	
+	Image IMG_ALIGN_LEFT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_alignleft.png";};
+	};
+	Image IMG_ALIGN_CENTER
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter.png";};
+	};
+	Image IMG_ALIGN_RIGHT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_alignright.png";};
+	};
+	Image IMG_ALIGN_JUST
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_alignjust.png";};
+	};
+	Image IMG_ALIGN_TOP
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_aligntop.png";};
+	};
+	Image IMG_ALIGN_CENTER_V
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter_v.png";};
+	};
+	Image IMG_ALIGN_BOTTOM
+	{
+		ImageBitmap = Bitmap{File = "sidebar/sc_alignbottom.png";};
+	};
+};
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
new file mode 100755
index 0000000..c840489
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -0,0 +1,879 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <CellAppearancePropertyPanel.hxx>
+#include <CellAppearancePropertyPanel.hrc>
+#include "sc.hrc"
+#include "scresid.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/colritem.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sidebar/ColorControl.hxx>
+#include <boost/bind.hpp>
+#include <svx/sidebar/PopupContainer.hxx>
+#include <CellLineStyleControl.hxx>
+#include <CellLineStylePopup.hxx>
+#include <CellBorderUpdater.hxx>
+#include <CellBorderStyleControl.hxx>
+#include <CellBorderStylePopup.hxx>
+
+using namespace css;
+using namespace cssu;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+//////////////////////////////////////////////////////////////////////////////
+// helpers
+
+namespace 
+{
+    Color GetTransparentColor(void)
+    {
+        return COL_TRANSPARENT;
+    }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace open
+
+namespace sc { namespace sidebar {
+
+//////////////////////////////////////////////////////////////////////////////
+
+svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent)
+{
+    const ScResId aResId(VS_NOFILLCOLOR);
+
+    return new svx::sidebar::ColorControl(
+        pParent,
+        mpBindings,
+        ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR),
+        ScResId(VS_FILLCOLOR),
+        ::boost::bind(GetTransparentColor),
+        ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2),
+        pParent,
+        &aResId);
+}
+
+void CellAppearancePropertyPanel::SetFillColor(
+    const String& /*rsColorName*/,
+    const Color aColor)
+{
+    const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
+    mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+    maBackColor = aColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent)
+{
+    return new svx::sidebar::ColorControl(
+        pParent,
+        mpBindings,
+        ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR),
+        ScResId(VS_LINECOLOR),
+        ::boost::bind(GetTransparentColor),
+        ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2),
+        pParent,
+        0);
+}
+
+void CellAppearancePropertyPanel::SetLineColor(
+    const String& /*rsColorName*/,
+    const Color aColor)
+{
+    const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR);
+    mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+    maLineColor = aColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent)
+{
+    return new CellLineStyleControl(pParent, *this);
+}
+
+void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void)
+{
+    if(mpCellLineStylePopup.get())
+    {
+        mpCellLineStylePopup->Hide();
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent)
+{
+    return new CellBorderStyleControl(pParent, *this);
+}
+
+void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void)
+{
+    if(mpCellBorderStylePopup.get())
+    {
+        mpCellBorderStylePopup->Hide();
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+CellAppearancePropertyPanel::CellAppearancePropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+:   Control(
+        pParent, 
+        ScResId(RID_PROPERTYPANEL_SC_APPEAR)),
+
+    mpFTFillColor(new FixedText(this, ScResId(FT_BK_COLOR))),
+    mpTBFillColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBFillColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBFillColorBackground.get(), ScResId(TB_BK_COLOR))),
+    mpFillColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH, TBI_BK_COLOR, mpTBFillColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
+
+    mpFTCellBorder(new FixedText(this, ScResId(FT_BORDER))),
+    mpTBCellBorderBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBCellBorder(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCellBorderBackground.get(), ScResId(TB_APP_BORDER))),
+    mpCellBorderUpdater(new CellBorderUpdater(TBI_BORDER, *mpTBCellBorder)),
+
+    mpTBLineStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBLineStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineStyleBackground.get(), ScResId(TB_BORDER_LINE_STYLE))),
+
+    mpTBLineColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBLineColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineColorBackground.get(), ScResId(TB_BORDER_LINE_COLOR))),
+    mpLineColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR, TBI_LINE_COLOR, mpTBLineColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
+
+    mpCBXShowGrid(new CheckBox(this, ScResId(CBX_SHOW_GRID))),
+
+    maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this),
+    maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this),
+    maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this),
+    maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this),
+    maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this),
+    maGridShowControl(SID_SCGRIDSHOW, *pBindings, *this),
+    maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this),
+    maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this),
+
+    maIMGBKColor(ScResId(IMG_BK_COLOR)),
+    maIMGCellBorder(ScResId(IMG_CELL_BORDER)),
+    maIMGLineColor(ScResId(IMG_LINE_COLOR)),
+    maIMGLineStyle1(ScResId(IMG_LINE_STYLE1)),
+    maIMGLineStyle2(ScResId(IMG_LINE_STYLE2)),
+    maIMGLineStyle3(ScResId(IMG_LINE_STYLE3)),
+    maIMGLineStyle4(ScResId(IMG_LINE_STYLE4)),
+    maIMGLineStyle5(ScResId(IMG_LINE_STYLE5)),
+    maIMGLineStyle6(ScResId(IMG_LINE_STYLE6)),
+    maIMGLineStyle7(ScResId(IMG_LINE_STYLE7)),
+    maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)),
+    maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)),
+
+    maIMGBKColorH(ScResId(IMG_BK_COLOR_H)),
+    maIMGLineStyle1H(ScResId(IMG_LINE_STYLE1_H)),
+    maIMGLineStyle2H(ScResId(IMG_LINE_STYLE2_H)),
+    maIMGLineStyle3H(ScResId(IMG_LINE_STYLE3_H)),
+    maIMGLineStyle4H(ScResId(IMG_LINE_STYLE4_H)),
+    maIMGLineStyle5H(ScResId(IMG_LINE_STYLE5_H)),
+    maIMGLineStyle6H(ScResId(IMG_LINE_STYLE6_H)),
+    maIMGLineStyle7H(ScResId(IMG_LINE_STYLE7_H)),
+    maIMGLineStyle8H(ScResId(IMG_LINE_STYLE8_H)),
+    maIMGLineStyle9H(ScResId(IMG_LINE_STYLE9_H)),
+
+    maBackColor(COL_TRANSPARENT),
+    maLineColor(COL_BLACK),
+    maTLBRColor(COL_BLACK),
+    maBLTRColor(COL_BLACK),
+    mnIn(0),
+    mnOut(0),
+    mnDis(0),
+    mnTLBRIn(0), 
+    mnTLBROut(0), 
+    mnTLBRDis(0),
+    mnBLTRIn(0), 
+    mnBLTROut(0), 
+    mnBLTRDis(0),
+    mbBackColorAvailable(true),
+    mbLineColorAvailable(true),
+    mbBorderStyleAvailable(true),
+    mbLeft(false), 
+    mbRight(false), 
+    mbTop(false), 
+    mbBottom(false), 
+    mbVer(false), 
+    mbHor(false),
+    mbOuterBorder(false), 
+    mbInnerBorder(false),
+    mbTLBR(false), 
+    mbBLTR(false),
+
+    maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)),
+    maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)),
+    mpCellLineStylePopup(),
+    mpCellBorderStylePopup(),
+
+    mxFrame(rxFrame),
+    maContext(),
+    mpBindings(pBindings)
+{
+    Initialize();
+    FreeResource();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+CellAppearancePropertyPanel::~CellAppearancePropertyPanel()
+{
+    // Destroy the toolboxes, then their background windows.
+    mpTBFillColor.reset();
+    mpTBCellBorder.reset();
+    mpTBLineStyle.reset();
+    mpTBLineColor.reset();
+
+    mpTBFillColorBackground.reset();
+    mpTBCellBorderBackground.reset();
+    mpTBLineStyleBackground.reset();
+    mpTBLineColorBackground.reset();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::Initialize()
+{
+	mpTBFillColor->SetItemImage(TBI_BK_COLOR, GetDisplayBackground().GetColor().IsDark() ? maIMGBKColorH : maIMGBKColor);
+	mpTBFillColor->SetItemBits( TBI_BK_COLOR, mpTBFillColor->GetItemBits( TBI_BK_COLOR ) | TIB_DROPDOWNONLY );
+	mpTBFillColor->SetQuickHelpText(TBI_BK_COLOR,String(ScResId(STR_QH_BK_COLOR)));	//Add
+	Size aTbxSize1( mpTBFillColor->CalcWindowSizePixel() );
+	mpTBFillColor->SetOutputSizePixel( aTbxSize1 );
+	mpTBFillColor->SetBackground(Wallpaper());
+	mpTBFillColor->SetPaintTransparent(true);
+	Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl);
+	mpTBFillColor->SetDropdownClickHdl ( aLink );
+	mpTBFillColor->SetSelectHdl ( aLink );
+
+	mpTBCellBorder->SetItemImage(TBI_BORDER, maIMGCellBorder);
+	mpTBCellBorder->SetItemBits( TBI_BORDER, mpTBCellBorder->GetItemBits( TBI_BORDER ) | TIB_DROPDOWNONLY );
+	mpTBCellBorder->SetQuickHelpText(TBI_BORDER,String(ScResId(STR_QH_BORDER)));	//Add
+	Size aTbxSize2( mpTBCellBorder->CalcWindowSizePixel() );
+	mpTBCellBorder->SetOutputSizePixel( aTbxSize2 );
+	mpTBCellBorder->SetBackground(Wallpaper());
+	mpTBCellBorder->SetPaintTransparent(true);
+	aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl);
+	mpTBCellBorder->SetDropdownClickHdl ( aLink );
+	mpTBCellBorder->SetSelectHdl ( aLink );
+
+	mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1);
+	mpTBLineStyle->SetItemBits( TBI_LINE_STYLE, mpTBLineStyle->GetItemBits( TBI_LINE_STYLE ) | TIB_DROPDOWNONLY );
+	mpTBLineStyle->SetQuickHelpText(TBI_LINE_STYLE,String(ScResId(STR_QH_BORDER_LINE_STYLE)));	//Add
+	Size aTbxSize3( mpTBLineStyle->CalcWindowSizePixel() );
+	mpTBLineStyle->SetOutputSizePixel( aTbxSize3 );
+	mpTBLineStyle->SetBackground(Wallpaper());
+	mpTBLineStyle->SetPaintTransparent(true);
+	aLink = LINK(this, CellAppearancePropertyPanel, TbxLineStyleSelectHdl);
+	mpTBLineStyle->SetDropdownClickHdl ( aLink );
+	mpTBLineStyle->SetSelectHdl ( aLink );
+	mpTBLineStyle->Disable();
+
+	mpTBLineColor->SetItemImage(TBI_LINE_COLOR, maIMGLineColor);
+	mpTBLineColor->SetItemBits( TBI_LINE_COLOR, mpTBLineColor->GetItemBits( TBI_LINE_COLOR ) | TIB_DROPDOWNONLY );
+	mpTBLineColor->SetQuickHelpText(TBI_LINE_COLOR,String(ScResId(STR_QH_BORDER_LINE_COLOR)));	//Add
+	Size aTbxSize4( mpTBLineColor->CalcWindowSizePixel() );
+	mpTBLineColor->SetOutputSizePixel( aTbxSize4 );
+	mpTBLineColor->SetBackground(Wallpaper());
+	mpTBLineColor->SetPaintTransparent(true);
+	aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl);
+	mpTBLineColor->SetDropdownClickHdl ( aLink );
+	mpTBLineColor->SetSelectHdl ( aLink );
+	mpTBLineColor->Disable();
+
+	aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl);
+	mpCBXShowGrid->SetClickHdl ( aLink );
+
+	mpTBFillColor->SetAccessibleRelationLabeledBy(mpFTFillColor.get());
+	mpTBLineColor->SetAccessibleRelationLabeledBy(mpTBLineColor.get());
+	mpTBCellBorder->SetAccessibleRelationLabeledBy(mpFTCellBorder.get());
+	mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle.get());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_BK_COLOR)
+	{
+        maFillColorPopup.Show(*pToolBox);
+        maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
+	}
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_LINE_COLOR)
+	{
+        maLineColorPopup.Show(*pToolBox);
+        maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable);
+	}
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	
+    if(nId == TBI_BORDER)
+	{
+        // create popup on demand
+        if(!mpCellBorderStylePopup.get())
+        {
+            mpCellBorderStylePopup.reset(
+                new CellBorderStylePopup(
+                    this, 
+                    ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1)));
+        }
+
+        if(mpCellBorderStylePopup.get())
+        {
+            mpCellBorderStylePopup->Show(*pToolBox);
+        }
+	}
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_LINE_STYLE)
+	{
+        // create popup on demand
+        if(!mpCellLineStylePopup.get())
+        {
+            mpCellLineStylePopup.reset(
+                new CellLineStylePopup(
+                    this, 
+                    ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1)));
+        }
+
+        if(mpCellLineStylePopup.get())
+        {
+            mpCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis);
+            mpCellLineStylePopup->Show(*pToolBox);
+        }
+	}
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG)
+{
+	bool bState = mpCBXShowGrid->IsChecked();
+	SfxBoolItem aItem( SID_SCGRIDSHOW , bState);
+	GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW, SFX_CALLMODE_RECORD, &aItem, false, 0L);
+	return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to CellAppearancePropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to CellAppearancePropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to CellAppearancePropertyPanel::Create"), NULL, 2);
+    
+    return new CellAppearancePropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::HandleContextChange(
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if(maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+
+
+
+    // todo
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{
+	switch(nSID)
+	{
+	case SID_BACKGROUND_COLOR:
+		if(eState >= SFX_ITEM_DEFAULT)
+		{
+            const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState);
+
+            if(pSvxColorItem)
+            {
+			    maBackColor = ((const SvxColorItem*)pState)->GetValue();
+			    mbBackColorAvailable = true;
+			    mpFillColorUpdater->Update(maBackColor);
+                break;
+            }
+		}
+
+        mbBackColorAvailable = false;
+		maBackColor.SetColor(COL_TRANSPARENT);
+		mpFillColorUpdater->Update(COL_TRANSPARENT);
+        break;
+	case SID_FRAME_LINECOLOR:
+		if( eState == SFX_ITEM_DONTCARE)
+		{
+			mbLineColorAvailable = true;
+			maLineColor.SetColor( COL_TRANSPARENT );
+    		UpdateControlState();
+            break;
+		}
+
+        if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxColorItem) )
+		{
+            const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState);
+
+            if(pSvxColorItem)
+            {
+			    maLineColor = ((const SvxColorItem*)pState)->GetValue();
+			    if(maLineColor == COL_AUTO)
+				    mbLineColorAvailable = false;
+			    else
+			    {
+				    mbLineColorAvailable = true;
+			    //	mpLineColorUpdater->Update(maLineColor);
+			    }
+		        
+                UpdateControlState();
+                break;
+            }
+		}
+
+        mbLineColorAvailable = false;
+		maLineColor.SetColor(COL_AUTO);
+	    //	mpLineColorUpdater->Update(maLineColor);
+		UpdateControlState();
+		break;
+	case SID_FRAME_LINESTYLE:
+		if( eState == SFX_ITEM_DONTCARE )
+		{
+			mbBorderStyleAvailable = true;
+			mnIn = 0;
+			mnOut = 0;
+			mnDis = 0;
+    		SetStyleIcon();
+            break;
+		}
+
+        if(eState >= SFX_ITEM_DEFAULT)
+		{
+            const SvxLineItem* pSvxLineItem = dynamic_cast< const SvxLineItem* >(pState);
+
+            if(pSvxLineItem)
+            {
+			    const SvxBorderLine* mbLineItem = pSvxLineItem->GetLine();
+			    mnIn = mbLineItem->GetInWidth();
+			    mnOut = mbLineItem->GetOutWidth();
+			    mnDis = mbLineItem->GetDistance();
+
+                if(mnIn == 0 && mnOut == 0 && mnDis == 0)
+				    mbBorderStyleAvailable = false;
+			    else
+				    mbBorderStyleAvailable = true;
+    		    
+                SetStyleIcon();
+                break;
+            }
+		}
+
+		mbBorderStyleAvailable = false;
+		SetStyleIcon();
+		break;
+	case SID_ATTR_BORDER_OUTER:
+		if(eState >= SFX_ITEM_DEFAULT)
+		{ 
+			const SvxBoxItem* pBoxItem = dynamic_cast< const SvxBoxItem* >(pState);
+
+            if(pBoxItem)
+            {
+			    mbLeft=false, mbRight=false, mbTop=false, mbBottom=false;
+
+			    if(pBoxItem->GetLeft())
+				    mbLeft = true;
+			
+                if(pBoxItem->GetRight())
+				    mbRight = true;
+			
+                if(pBoxItem->GetTop())
+				    mbTop = true;
+			
+                if(pBoxItem->GetBottom())
+				    mbBottom = true;
+
+                if(!Application::GetSettings().GetLayoutRTL())
+				    mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor);
+			    else
+				    mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor);
+			
+                if(mbLeft || mbRight || mbTop || mbBottom)
+				    mbOuterBorder = true;
+			    else
+				    mbOuterBorder = false;
+			
+                UpdateControlState();
+            }
+		}
+		break;
+	case SID_ATTR_BORDER_INNER:
+		if(eState >= SFX_ITEM_DEFAULT)
+		{
+			const SvxBoxInfoItem* pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >(pState);
+
+            if(pBoxInfoItem)
+            {
+			    bool bLeft(false), bRight(false), bTop(false), bBottom(false);
+
+			    mbVer = false, mbHor = false;
+
+                if(!pBoxInfoItem->IsValid( VALID_VERT )  || pBoxInfoItem->GetVert())
+				    mbVer = true;
+
+			    if(!pBoxInfoItem->IsValid( VALID_HORI )  || pBoxInfoItem->GetHori())
+				    mbHor = true;
+
+			    if(!pBoxInfoItem->IsValid( VALID_LEFT ) || mbLeft)
+				    bLeft = true;
+
+			    if(!pBoxInfoItem->IsValid( VALID_RIGHT ) || mbRight)
+				    bRight = true;
+
+			    if(!pBoxInfoItem->IsValid( VALID_TOP ) || mbTop)
+				    bTop = true;
+
+			    if(!pBoxInfoItem->IsValid( VALID_BOTTOM ) || mbBottom)
+				    bBottom = true;
+
+                if(!Application::GetSettings().GetLayoutRTL())
+				    mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor);
+			    else
+				    mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor);
+			
+                if(mbVer || mbHor || bLeft || bRight || bTop || bBottom)
+				    mbInnerBorder = true;
+			    else 
+				    mbInnerBorder = false;
+			
+                UpdateControlState();
+            }
+		}
+		break;
+	case SID_ATTR_BORDER_DIAG_TLBR:
+		if( eState == SFX_ITEM_DONTCARE )
+		{
+			mbTLBR = true;
+			maTLBRColor.SetColor(COL_TRANSPARENT);
+			mnTLBRIn = mnTLBROut = mnTLBRDis = 0;
+    		UpdateControlState();
+            break;
+		}
+
+        if(eState >= SFX_ITEM_DEFAULT)
+		{
+			const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState);
+
+            if(pItem)
+            {
+			    const SvxBorderLine* aLine = pItem->GetLine();
+
+                if(!aLine)
+                {
+				    mbTLBR = false;
+                }
+			    else
+			    {
+				    mbTLBR = true;
+				    maTLBRColor = aLine->GetColor();
+				    mnTLBRIn = aLine->GetInWidth();
+				    mnTLBROut = aLine->GetOutWidth();
+				    mnTLBRDis = aLine->GetDistance();
+
+                    if(mnTLBRIn == 0 && mnTLBROut == 0 && mnTLBRDis == 0)
+					    mbTLBR = false;
+			    }
+
+                UpdateControlState();
+                break;
+            }
+		}
+
+        mbTLBR = false;
+		UpdateControlState();
+		break;
+	case SID_ATTR_BORDER_DIAG_BLTR:
+		if( eState == SFX_ITEM_DONTCARE )
+		{
+			mbBLTR = true;
+			maBLTRColor.SetColor( COL_TRANSPARENT );
+			mnBLTRIn = mnBLTROut = mnBLTRDis = 0;
+    		UpdateControlState();
+            break;
+		}
+
+        if(eState >= SFX_ITEM_DEFAULT)
+		{
+			const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState);
+
+            if(pItem)
+            {
+			    const SvxBorderLine* aLine = pItem->GetLine();
+
+                if(!aLine)
+                {
+				    mbBLTR = false;
+                }
+			    else
+			    {
+				    mbBLTR = true;
+				    maBLTRColor = aLine->GetColor();
+				    mnBLTRIn = aLine->GetInWidth();
+				    mnBLTROut = aLine->GetOutWidth();
+				    mnBLTRDis = aLine->GetDistance();
+
+                    if(mnBLTRIn == 0 && mnBLTROut == 0 && mnBLTRDis == 0)
+					    mbBLTR = false;
+			    }
+
+                UpdateControlState();
+            }
+            break;
+		}
+
+        mbBLTR = false;
+		UpdateControlState();
+		break;
+	case SID_SCGRIDSHOW:
+		if(eState >= SFX_ITEM_DEFAULT)
+		{
+			const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState);
+
+            if(pItem)
+            {
+			    const bool bVal = pItem->GetValue();
+
+			    if(bVal)
+				    mpCBXShowGrid->Check(true);
+			    else
+				    mpCBXShowGrid->Check(false);
+            }
+		}
+		break;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SfxBindings* CellAppearancePropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::SetStyleIcon()
+{
+	if(mnOut == DEF_LINE_WIDTH_0 && mnIn == 0 && mnDis == 0)	//1
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle1H : maIMGLineStyle1);
+	else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == 0 && mnDis == 0) //2
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle2H :maIMGLineStyle2);
+	else if(mnOut == DEF_LINE_WIDTH_3 && mnIn == 0 && mnDis == 0) //3
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle3H :maIMGLineStyle3);
+	else if(mnOut == DEF_LINE_WIDTH_4 && mnIn == 0 && mnDis == 0) //4
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle4H :maIMGLineStyle4);
+	else if(mnOut == DEF_DOUBLE_LINE0_OUT && mnIn == DEF_DOUBLE_LINE0_IN && mnDis == DEF_DOUBLE_LINE0_DIST) //5
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle5H :maIMGLineStyle5);
+	else if(mnOut == DEF_DOUBLE_LINE7_OUT && mnIn == DEF_DOUBLE_LINE7_IN && mnDis == DEF_DOUBLE_LINE7_DIST) //6
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle6H :maIMGLineStyle6);
+	else if(mnOut == DEF_DOUBLE_LINE4_OUT && mnIn == DEF_DOUBLE_LINE4_IN && mnDis == DEF_DOUBLE_LINE4_DIST) //7
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle7H :maIMGLineStyle7);
+	else if(mnOut == DEF_DOUBLE_LINE9_OUT && mnIn == DEF_DOUBLE_LINE9_IN && mnDis == DEF_DOUBLE_LINE9_DIST) //8
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle8H :maIMGLineStyle8);
+	else if(mnOut == DEF_DOUBLE_LINE2_OUT && mnIn == DEF_DOUBLE_LINE2_IN && mnDis == DEF_DOUBLE_LINE2_DIST) //9
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle9H :maIMGLineStyle9);
+	else
+		mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle1H :maIMGLineStyle1);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void CellAppearancePropertyPanel::UpdateControlState()
+{
+	if(mbOuterBorder || mbInnerBorder || mbTLBR || mbBLTR)
+	{
+		mpTBLineColor->Enable();
+		mpTBLineStyle->Enable();
+
+		//set line color state
+		if( mbLineColorAvailable && !mbTLBR && !mbBLTR )
+			mpLineColorUpdater->Update(maLineColor);
+		else if( !mbLineColorAvailable && mbTLBR && !mbBLTR )
+			mpLineColorUpdater->Update(maTLBRColor);
+		else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR )
+			mpLineColorUpdater->Update(maBLTRColor);
+		else if( !mbLineColorAvailable && mbTLBR && mbBLTR)
+		{
+			if( maTLBRColor == maBLTRColor)
+				mpLineColorUpdater->Update(maBLTRColor);
+			else 
+				mpLineColorUpdater->Update(COL_TRANSPARENT);
+		}
+		else if( mbLineColorAvailable && mbTLBR && !mbBLTR )
+		{
+			if( maTLBRColor == maLineColor)
+				mpLineColorUpdater->Update(maLineColor);
+			else
+				mpLineColorUpdater->Update(COL_TRANSPARENT);
+		}
+		else if( mbLineColorAvailable && !mbTLBR && mbBLTR )
+		{
+			if( maBLTRColor == maLineColor)
+				mpLineColorUpdater->Update(maLineColor);
+			else
+				mpLineColorUpdater->Update(COL_TRANSPARENT);
+		}
+		else
+			mpLineColorUpdater->Update(COL_TRANSPARENT);
+
+		//set line style state
+		if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR )
+		{
+		}
+		else if( !mbBorderStyleAvailable && mbTLBR && !mbBLTR )
+		{
+			mnIn = mnTLBRIn;
+			mnOut = mnTLBROut;
+			mnDis = mnTLBRDis;
+		}
+		else if ( !mbBorderStyleAvailable && !mbTLBR && mbBLTR )
+		{
+			mnIn = mnBLTRIn;
+			mnOut = mnBLTROut;
+			mnDis = mnBLTRDis;
+		}
+		else if( !mbBorderStyleAvailable && mbTLBR && mbBLTR)
+		{
+			if( mnTLBRIn == mnBLTRIn && mnTLBROut == mnBLTROut && mnTLBRDis == mnBLTRDis)
+			{
+				mnIn = mnTLBRIn;
+				mnOut = mnTLBROut;
+				mnDis = mnTLBRDis;
+			}
+			else 
+			{
+				mnIn = 0;
+				mnOut = 0;
+				mnDis = 0;
+			}
+		}
+		else if( mbBorderStyleAvailable && mbTLBR && !mbBLTR )
+		{
+			if( mnTLBRIn != mnIn || mnTLBROut != mnOut || mnTLBRDis != mnDis)
+			{
+				mnIn = 0;
+				mnOut = 0;
+				mnDis = 0;
+			}
+		}	
+		else if( mbBorderStyleAvailable && !mbTLBR && mbBLTR )
+		{
+			if(  mnBLTRIn != mnIn || mnBLTROut != mnOut || mnBLTRDis != mnDis )
+			{
+				mnIn = 0;
+				mnOut = 0;
+				mnDis = 0;
+			}
+		}
+		else
+		{
+			mnIn = 0;
+			mnOut = 0;
+			mnDis = 0;
+		}
+		SetStyleIcon();
+	}
+	else
+	{
+		mpTBLineColor->Disable();
+		mpTBLineStyle->Disable();
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace close
+
+}} // end of namespace ::sc::sidebar
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
new file mode 100755
index 0000000..356e3da
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
@@ -0,0 +1,149 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+#define FT_BK_COLOR		1
+#define TB_BK_COLOR		2
+#define TBI_BK_COLOR	3
+#define FT_BORDER		4
+#define TB_APP_BORDER		5
+#define TBI_BORDER		6
+#define	TB_BORDER_LINE_STYLE	7
+#define TBI_LINE_STYLE			8
+#define TB_BORDER_LINE_COLOR	9
+#define TBI_LINE_COLOR			10
+#define CBX_SHOW_GRID			11
+
+#define STR_QH_BK_COLOR			12
+#define STR_QH_BORDER			13
+#define STR_QH_BORDER_LINE_STYLE		14
+#define STR_QH_BORDER_LINE_COLOR		15
+
+#define IMG_BK_COLOR	21
+#define IMG_CELL_BORDER	22
+#define IMG_LINE_COLOR	23
+#define IMG_LINE_STYLE1			25
+#define IMG_LINE_STYLE2			26
+#define IMG_LINE_STYLE3			27
+#define IMG_LINE_STYLE4			28
+#define IMG_LINE_STYLE5			29
+#define IMG_LINE_STYLE6			30
+#define IMG_LINE_STYLE7			31
+#define IMG_LINE_STYLE8			32
+#define IMG_LINE_STYLE9			33
+
+//high contrast
+#define IMG_BK_COLOR_H		 41
+#define IMG_LINE_STYLE1_H			45
+#define IMG_LINE_STYLE2_H			46
+#define IMG_LINE_STYLE3_H			47
+#define IMG_LINE_STYLE4_H			48
+#define IMG_LINE_STYLE5_H			49
+#define IMG_LINE_STYLE6_H			50
+#define IMG_LINE_STYLE7_H			51
+#define IMG_LINE_STYLE8_H			52
+#define IMG_LINE_STYLE9_H			53
+
+//BACK_COLOR PAGE
+#define VS_BACK_COLOR	1
+#define STR_AUTOMATICE	2
+
+//LINE COLOR PAGE
+#define VS_LINE_COLOR	1
+
+//line style page
+#define VS_STYLE		1
+#define PB_OPTIONS		2
+#define BMP_UNDERLINE_MORE		3
+#define BMP_UNDERLINE_MORE_H	4
+
+//line border page
+#define TB_BORDER1				1
+#define TB_BORDER2				2	
+#define TB_BORDER3				3	
+
+#define TBI_BORDER1_NONE		7
+#define TBI_BORDER1_ALL			8
+#define TBI_BORDER1_OUTER		9
+#define TBI_BORDER1_OUTERBOLD	10
+#define TBI_BORDER2_LEFT		11
+#define TBI_BORDER2_RIGHT		12
+#define TBI_BORDER2_TOP			13
+#define TBI_BORDER2_BOT			14
+#define TBI_BORDER2_BLTR		15
+#define TBI_BORDER2_TLBR		16
+#define TBI_BORDER2_TOPBOT		17
+#define TBI_BORDER2_LEFTRIGHT	18
+#define TBI_BORDER3_S1			19
+#define TBI_BORDER3_S2			20
+#define TBI_BORDER3_S3			21
+#define TBI_BORDER3_S4			22
+#define FL_1					23
+#define FL_2					24
+
+#define IMG_BORDER1				25
+#define IMG_BORDER2				26
+#define IMG_BORDER3				27
+#define IMG_BORDER4				28
+#define IMG_BORDER5				29
+#define IMG_BORDER6				30
+#define IMG_BORDER7				31
+#define IMG_BORDER8				32
+#define IMG_BORDER9				33
+#define IMG_BORDER10				34
+#define IMG_BORDER11				35
+#define IMG_BORDER12				36
+#define IMG_BORDER13				37
+#define IMG_BORDER14				38
+#define IMG_BORDER15				39
+#define IMG_BORDER16				40
+
+#define STR_BORDER_1			41
+#define STR_BORDER_2			42
+#define STR_BORDER_3			43
+#define STR_BORDER_4			44
+#define STR_BORDER_5			45
+#define STR_BORDER_6			46
+#define STR_BORDER_7			47
+#define STR_BORDER_8			48
+
+//high contrast
+#define IMG_BORDER1_H				65
+#define IMG_BORDER2_H				66
+#define IMG_BORDER3_H				67
+#define IMG_BORDER4_H				68
+#define IMG_BORDER5_H				69
+#define IMG_BORDER6_H				70
+#define IMG_BORDER7_H				71
+#define IMG_BORDER8_H				72
+#define IMG_BORDER9_H				73
+#define IMG_BORDER10_H				74
+#define IMG_BORDER11_H				75
+#define IMG_BORDER12_H				76
+#define IMG_BORDER13_H				77
+#define IMG_BORDER14_H				78
+#define IMG_BORDER15_H				79
+#define IMG_BORDER16_H				80
+
+#define VS_FILLCOLOR			1
+#define VS_NOFILLCOLOR          2
+#define VS_LINECOLOR			1
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
new file mode 100755
index 0000000..c771e051
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -0,0 +1,214 @@
+/**************************************************************
+ * 
+ * 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 SC_PROPERTYPANEL_APPEARANCE_HXX
+#define SC_PROPERTYPANEL_APPEARANCE_HXX
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <svx/sidebar/ColorPopup.hxx>
+
+class FixedText;
+namespace svx { class ToolboxButtonColorUpdater; }
+namespace sc { namespace sidebar { 
+    class CellLineStylePopup;
+    class CellBorderStylePopup;
+    class CellLineStyleControl;
+    class CellBorderUpdater; 
+}}
+class ToolBox;
+class CheckBox;
+
+namespace sc { namespace sidebar {
+
+class CellAppearancePropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::IContextChangeReceiver,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+private:
+    friend class CellLineStyleControl;
+    friend class CellBorderStyleControl;
+
+public:
+    static CellAppearancePropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void HandleContextChange(
+        const ::sfx2::sidebar::EnumContext aContext);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+private:
+    //ui controls
+    ::boost::scoped_ptr< FixedText >        mpFTFillColor;
+    ::boost::scoped_ptr< Window >           mpTBFillColorBackground;
+    ::boost::scoped_ptr< ToolBox >          mpTBFillColor;
+    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater;
+
+    ::boost::scoped_ptr< FixedText >        mpFTCellBorder;
+    ::boost::scoped_ptr< Window >           mpTBCellBorderBackground;
+    ::boost::scoped_ptr< ToolBox >          mpTBCellBorder;
+    ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
+
+    ::boost::scoped_ptr< Window >           mpTBLineStyleBackground;
+    ::boost::scoped_ptr< ToolBox >          mpTBLineStyle;
+
+    ::boost::scoped_ptr< Window >           mpTBLineColorBackground;
+    ::boost::scoped_ptr< ToolBox >          mpTBLineColor;
+    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
+
+    ::boost::scoped_ptr< CheckBox >         mpCBXShowGrid;
+
+    ::sfx2::sidebar::ControllerItem         maBackColorControl;
+    ::sfx2::sidebar::ControllerItem         maLineColorControl;
+    ::sfx2::sidebar::ControllerItem         maLineStyleControl;
+    ::sfx2::sidebar::ControllerItem         maBorderOuterControl;
+    ::sfx2::sidebar::ControllerItem         maBorderInnerControl;
+    ::sfx2::sidebar::ControllerItem         maGridShowControl;
+    ::sfx2::sidebar::ControllerItem         maBorderTLBRControl;
+    ::sfx2::sidebar::ControllerItem         maBorderBLTRControl;
+
+    // images
+    Image                                   maIMGBKColor;
+    Image                                   maIMGCellBorder;
+    Image                                   maIMGLineColor;
+    Image                                   maIMGLineStyle1;
+    Image                                   maIMGLineStyle2;
+    Image                                   maIMGLineStyle3;
+    Image                                   maIMGLineStyle4;
+    Image                                   maIMGLineStyle5;
+    Image                                   maIMGLineStyle6;
+    Image                                   maIMGLineStyle7;
+    Image                                   maIMGLineStyle8;
+    Image                                   maIMGLineStyle9;
+
+    // high contrast images
+    Image                                   maIMGBKColorH;
+    Image                                   maIMGLineStyle0H;
+    Image                                   maIMGLineStyle1H;
+    Image                                   maIMGLineStyle2H;
+    Image                                   maIMGLineStyle3H;
+    Image                                   maIMGLineStyle4H;
+    Image                                   maIMGLineStyle5H;
+    Image                                   maIMGLineStyle6H;
+    Image                                   maIMGLineStyle7H;
+    Image                                   maIMGLineStyle8H;
+    Image                                   maIMGLineStyle9H;
+
+    // cell background color
+    Color                                   maBackColor;
+
+    // cell line color(s)
+    Color                                   maLineColor;
+    Color                                   maTLBRColor;
+    Color                                   maBLTRColor;
+
+    // BorderStyle defines
+    sal_uInt16                              mnIn;
+    sal_uInt16                              mnOut;
+    sal_uInt16                              mnDis;
+    sal_uInt16                              mnTLBRIn;
+    sal_uInt16                              mnTLBROut;
+    sal_uInt16                              mnTLBRDis;
+    sal_uInt16                              mnBLTRIn;
+    sal_uInt16                              mnBLTROut;
+    sal_uInt16                              mnBLTRDis;
+
+    /// bitfield
+    bool                                    mbBackColorAvailable : 1;
+    bool                                    mbLineColorAvailable : 1;
+    bool                                    mbBorderStyleAvailable : 1;
+
+    // CellBorder defines
+    bool                                    mbLeft : 1;
+    bool                                    mbRight : 1;
+    bool                                    mbTop : 1;
+    bool                                    mbBottom : 1;
+    bool                                    mbVer : 1;
+    bool                                    mbHor : 1;
+
+    bool                                    mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom
+    bool                                    mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
+
+    bool                                    mbTLBR : 1;
+    bool                                    mbBLTR : 1;
+
+    // popups
+    svx::sidebar::ColorPopup                maFillColorPopup; 
+    svx::sidebar::ColorPopup                maLineColorPopup; 
+    ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
+    ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
+
+    cssu::Reference<css::frame::XFrame>     mxFrame;
+    ::sfx2::sidebar::EnumContext            maContext;
+    SfxBindings*                            mpBindings;
+
+    DECL_LINK(TbxBKColorSelectHdl, ToolBox*);
+    DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
+    DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
+    DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
+    DECL_LINK(CBOXGridShowClkHdl, void*);
+
+    // for fill color picker 
+    svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent);
+    void SetFillColor(const String& rsColorName, const Color aColor);
+
+    // for line color picker 
+    svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
+    void SetLineColor(const String& rsColorName, const Color aColor);
+
+    // for CellLineStyle popup
+    svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
+    void EndCellLineStylePopupMode(void);
+
+    // for CellBorderStyle popup
+    svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent);
+    void EndCellBorderStylePopupMode(void);
+
+    // constructor/destuctor
+    CellAppearancePropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~CellAppearancePropertyPanel();
+
+    void Initialize();
+    void SetStyleIcon();
+    void UpdateControlState();
+};
+
+} } // end of namespace ::sc::sidebar
+
+#endif
+// eof
diff --git a/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
new file mode 100755
index 0000000..a559cb4
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
@@ -0,0 +1,612 @@
+/**************************************************************
+ * 
+ * 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 "CellAppearancePropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include "sc.hrc"
+#include "helpids.h"
+
+#define TOOLBOX_WIDTH		50
+#define TOOLBOX_HEIGHT		15
+
+#define TOOLBOX_WIDTH_2		34
+#define TOOLBOX_HEIGHT_2	30
+
+#define TOOLBOX_BORDER_WIDTH	107
+#define PB_BORDER_MOREBTN		57
+#define POPUPPANEL_MARGIN_SMALL_PIXEL	8
+
+//////////////////////////////////////////////////////////////////////////////
+// the basic propertypanel
+
+Control RID_PROPERTYPANEL_SC_APPEAR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH,  SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 +  TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL * 2 +  TOOLBOX_HEIGHT_2 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT - 2);	
+	HelpID = HID_PROPERTYPANEL_SC_CELL_SECTION ;
+	Text [ en-US ] = "Cell Appearance";
+	
+	FixedText FT_BK_COLOR
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Cell background:";
+	};
+	ToolBox TB_BK_COLOR
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_TBX_BKCOLOR ;
+		Text [ en-US ] = "Cell Background";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BK_COLOR ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Cell background" ;
+				HelpID = HID_PROPERTYPANEL_SC_TBI_BKCOLOR;
+			};
+		};
+	};
+	String STR_QH_BK_COLOR
+	{
+		Text [ en-US ] = "Select the background color of the selected cells." ;
+	};
+	FixedText FT_BORDER
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT +  TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL);
+		Size = MAP_APPFONT (  PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ;
+		Text [ en-US ] = "Cell ~border:";
+	};
+	ToolBox TB_APP_BORDER
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 +  TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH_2 ,TOOLBOX_HEIGHT_2 ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_TBX_BORDER ;
+		Text [ en-US ] = "Cell Border";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Cell border" ;
+				HelpID = HID_PROPERTYPANEL_SC_TBI_BORDER;
+			};
+		};
+	};
+	String STR_QH_BORDER
+	{
+		Text [ en-US ] = "Specify the borders of the selected cells." ;
+	};
+	ToolBox TB_BORDER_LINE_STYLE
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 +  TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL ) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_TBX_STYLE ;
+		Text [ en-US ] = "Line Style";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_LINE_STYLE ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Line style" ;
+				HelpID = HID_PROPERTYPANEL_SC_TBI_STYLE;
+			};
+		};
+	};
+	String STR_QH_BORDER_LINE_STYLE
+	{
+		Text [ en-US ] = "Select the line style of the borders." ;
+	};
+	ToolBox TB_BORDER_LINE_COLOR
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 +  TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT * 2  + CONTROL_SPACING_VERTICAL + 3) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_TBX_LINECOLOR ;
+		Text [ en-US ] = "Line Color";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_LINE_COLOR ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Line color" ;
+				HelpID = HID_PROPERTYPANEL_SC_TBI_LINECOLOR;
+			};
+		};
+	};
+	String STR_QH_BORDER_LINE_COLOR
+	{
+		Text [ en-US ] = "Select the line color of the borders." ;
+	};
+	CheckBox CBX_SHOW_GRID
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 +  TEXT_CONTROL_SPACING_VERTICAL * 2  +  TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 +  TOOLBOX_HEIGHT_2 + 2) ;
+        Size = MAP_APPFONT ( 90 , CBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		Text [ en-US ] = "Show cell ~grid lines" ;
+		QuickHelpText [ en-US ] = "Show the grid lines of the cells in the entire spreadsheet.";
+		HelpID = HID_PROPERTYPANEL_SC_CBOX_SHOWGRID;
+	};	
+	
+	Image IMG_BK_COLOR
+	{
+		ImageBitmap = Bitmap{File = "sidebar/fill_color.png";};
+	};
+	Image IMG_CELL_BORDER
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder.png";};
+		//MaskColor = STD_MASKCOLOR ;
+	};
+	Image IMG_LINE_COLOR
+	{
+		ImageBitmap = Bitmap{File = "sidebar/Line_color.png";};
+	};
+	Image IMG_LINE_STYLE1
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_005.png";};
+	};
+	Image IMG_LINE_STYLE2
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_250.png";};
+	};
+	Image IMG_LINE_STYLE3
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_400.png";};
+	};
+	Image IMG_LINE_STYLE4
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_500.png";};
+	};
+	Image IMG_LINE_STYLE5
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_110.png";};
+	};
+	Image IMG_LINE_STYLE6
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_260.png";};
+	};
+	Image IMG_LINE_STYLE7
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_450.png";};
+	};
+	Image IMG_LINE_STYLE8
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_505.png";};
+	};
+	Image IMG_LINE_STYLE9
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";};
+	};
+	
+	//high contrast
+	Image IMG_BK_COLOR_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/fill_color_h.png";};
+	};
+	Image IMG_LINE_STYLE1_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_005_h.png";};
+	};
+	Image IMG_LINE_STYLE2_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_250_h.png";};
+	};
+	Image IMG_LINE_STYLE3_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_400_h.png";};
+	};
+	Image IMG_LINE_STYLE4_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_500_h.png";};
+	};
+	Image IMG_LINE_STYLE5_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_110_h.png";};
+	};
+	Image IMG_LINE_STYLE6_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_260_h.png";};
+	};
+	Image IMG_LINE_STYLE7_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_450_h.png";};
+	};
+	Image IMG_LINE_STYLE8_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_505_h.png";};
+	};
+	Image IMG_LINE_STYLE9_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750_h.png";};
+	};
+	
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// fill color popup
+
+Control RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
+	
+	Control VS_FILLCOLOR
+	{
+		HelpID = HID_PROPERTYPANEL_FILL_COLOR_VS;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+		TabStop = TRUE ;
+		Text [ en-US ] = "Color";
+	};
+
+	String VS_NOFILLCOLOR
+	{
+		Text [ en-US ] = "No Color" ;
+	};
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// line color popup
+
+Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
+	
+	Control VS_LINECOLOR
+	{
+		HelpID = HID_PROPERTYPANEL_LINE_COLOR_VS;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+		TabStop = TRUE ;
+		Text [ en-US ] = "Color";
+	};
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// cell line style popup
+
+Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  
+        POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80,  
+        13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE + 12*9);
+	
+	Control VS_STYLE
+	{
+		HelpID = HID_PROPERTYPANEL_SC_STYLE_VS ;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( 80  , 12 * 9);
+		TabStop = TRUE ;
+		Text [ en-US ] = "Line Style";
+	};
+	PushButton PB_OPTIONS
+	{
+		HelpID = HID_PROPERTYPANEL_SC_STYLE_PB;
+		Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + 12 * 9);
+		Size = MAP_APPFONT ( 75 , 12 );
+		TabStop = TRUE;
+		Text [ en-US ] = "~More Options...";
+	};
+	Bitmap	BMP_UNDERLINE_MORE
+	{
+		File = "sidebar/morebutton.png";
+	};
+	Bitmap	BMP_UNDERLINE_MORE_H
+	{
+		File = "sidebar/morebutton_h.png";
+	};	
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// cell border style popup
+
+Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_PIXEL(  POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108,  POPUPPANEL_MARGIN_SMALL_PIXEL * 2  + 138);
+	
+	ToolBox TB_BORDER1
+	{
+		SVLook = TRUE ;
+		Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL); //MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 1) ;
+		Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 31); //MAP_APPFONT (TOOLBOX_BORDER_WIDTH ,20) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_BORDER1_TBX;
+		Text [ en-US ] = "Cell Border 1";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER1_NONE ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_NONE;
+				Text [ en-US ] = "No Border" ;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER1_ALL ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_ALL;
+				Text [ en-US ] = "All Borders" ;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER1_OUTER ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER;
+				Text [ en-US ] = "Outside Borders" ;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER1_OUTERBOLD ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD;
+				Text [ en-US ] = "Thick Box Border" ;
+			};
+		};
+	};
+	FixedLine FL_1
+	{
+		Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31); //MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 1) ;
+        Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 8); // MAP_APPFONT ( TOOLBOX_BORDER_WIDTH , 5 ) ;
+	};
+	ToolBox TB_BORDER2
+	{
+		SVLook = TRUE ;
+		Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 5 + 1) ;
+		Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,61) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_BORDER2_TBX;
+		Text [ en-US ] = "Cell Border 2";
+	};
+	FixedLine FL_2
+	{
+		Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8 + 61); // MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 5 + 1) ;
+        Size = MAP_PIXEL ( TOOLBOX_BORDER_WIDTH , 8 ) ;
+	};
+	ToolBox TB_BORDER3
+	{
+		SVLook = TRUE ;
+		Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 +8 + 61 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 10 + 1) ;
+		Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,31) ;
+		TabStop = TRUE ;
+		HelpID = HID_PROPERTYPANEL_SC_BORDER3_TBX;
+		Text [ en-US ] = "Cell Border 3";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER3_S1;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S1;
+				Text [ en-US ] = "Thick Bottom Border" ;	
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER3_S2 ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S2;
+				Text [ en-US ] = "Double Bottom Border" ;	
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER3_S3 ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S3;
+				Text [ en-US ] = "Top and Thick Bottom Borders" ;	
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_BORDER3_S4 ;
+				HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S4;
+				Text [ en-US ] = "Top and Double Bottom Borders" ;	
+			};
+		};
+	};
+	
+	Image IMG_BORDER1
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Empty_18x18.png";};
+	};
+	Image IMG_BORDER2
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_All_18x18.png";};
+	};
+	Image IMG_BORDER3
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_18x18.png";};
+	};
+	Image IMG_BORDER4
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_Thick_18x18.png";};
+	};
+	Image IMG_BORDER5
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Left_18x18.png";};
+	};
+	Image IMG_BORDER6
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Right_18x18.png";};
+	};
+	Image IMG_BORDER7
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Top_18x18.png";};
+	};
+	Image IMG_BORDER8
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_18x18.png";};
+	};
+	Image IMG_BORDER9
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_RightDiagonal_18x18.png";};
+	};
+	Image IMG_BORDER10
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftDiagonal_18x18.png";};
+	};
+	Image IMG_BORDER11
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopAndBottom_18x18.png";};
+	};
+	Image IMG_BORDER12
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftAndRight_18x18.png";};
+	};
+	Image IMG_BORDER13
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Thick_18x18.png";};
+	};
+	Image IMG_BORDER14
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Double_18x18.png";};
+	};
+	Image IMG_BORDER15
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopThin_BottomThick_18x18.png";};
+	};
+	Image IMG_BORDER16
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopSingle_BottomDouble_18x18.png";};
+	};
+	String STR_BORDER_1
+	{
+		Text [ en-US ] = "Left Border";
+	};
+	String STR_BORDER_2
+	{
+		Text [ en-US ] = "Right Border";
+	};
+	String STR_BORDER_3
+	{
+		Text [ en-US ] = "Top Border";
+	};
+	String STR_BORDER_4
+	{
+		Text [ en-US ] = "Bottom Border";
+	};
+	String STR_BORDER_5
+	{
+		Text [ en-US ] = "Diagonal Up Border";
+	};
+	String STR_BORDER_6
+	{
+		Text [ en-US ] = "Diagonal Down Border";
+	};
+	String STR_BORDER_7
+	{
+		Text [ en-US ] = "Top and Bottom Borders";
+	};
+	String STR_BORDER_8
+	{
+		Text [ en-US ] = "Left and Right Borders";
+	};
+
+	//high contrast
+	Image IMG_BORDER1_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Empty_18x18_h.png";};
+	};
+	Image IMG_BORDER2_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_All_18x18_h.png";};
+	};
+	Image IMG_BORDER3_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_18x18_h.png";};
+	};
+	Image IMG_BORDER4_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_Thick_18x18_h.png";};
+	};
+	Image IMG_BORDER5_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Left_18x18_h.png";};
+	};
+	Image IMG_BORDER6_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Right_18x18_h.png";};
+	};
+	Image IMG_BORDER7_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Top_18x18_h.png";};
+	};
+	Image IMG_BORDER8_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_18x18_h.png";};
+	};
+	Image IMG_BORDER9_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_RightDiagonal_18x18_h.png";};
+	};
+	Image IMG_BORDER10_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftDiagonal_18x18_h.png";};
+	};
+	Image IMG_BORDER11_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopAndBottom_18x18_h.png";};
+	};
+	Image IMG_BORDER12_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftAndRight_18x18_h.png";};
+	};
+	Image IMG_BORDER13_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Thick_18x18_h.png";};
+	};
+	Image IMG_BORDER14_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Double_18x18_h.png";};
+	};
+	Image IMG_BORDER15_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopThin_BottomThick_18x18_h.png";};
+	};
+	Image IMG_BORDER16_H
+	{
+		ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopSingle_BottomDouble_18x18_h.png";};
+	};
+};
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/main/sc/source/ui/sidebar/CellBorderStyleControl.cxx
new file mode 100755
index 0000000..cbfa6cb
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderStyleControl.cxx
@@ -0,0 +1,364 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <CellBorderStyleControl.hxx>
+#include "sc.hrc"
+#include "scresid.hxx"
+#include <CellAppearancePropertyPanel.hrc>
+#include <editeng/boxitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <CellAppearancePropertyPanel.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sc { namespace sidebar {
+
+#define FRM_VALID_LEFT 		0x01
+#define FRM_VALID_RIGHT 	0x02
+#define FRM_VALID_TOP 		0x04
+#define FRM_VALID_BOTTOM 	0x08
+#define FRM_VALID_HINNER 	0x10
+#define FRM_VALID_VINNER 	0x20
+#define FRM_VALID_OUTER		0x0f
+#define FRM_VALID_ALL       0xff
+
+CellBorderStyleControl::CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel)
+:   svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)),
+    mrCellAppearancePropertyPanel(rPanel),
+    maTBBorder1(this, ScResId(TB_BORDER1)),
+    maTBBorder2(this, ScResId(TB_BORDER2)),
+    maTBBorder3(this, ScResId(TB_BORDER3)),
+    maFL1(this, ScResId(FL_1)),
+    maFL2(this, ScResId(FL_2)),
+    mpImageList(0),
+    mpImageListH(0)
+{
+    Initialize();
+    FreeResource();
+}
+
+CellBorderStyleControl::~CellBorderStyleControl(void)
+{
+    delete[] mpImageList;
+    delete[] mpImageListH;
+}
+
+void CellBorderStyleControl::Initialize()
+{
+    mpImageList = new Image[16];
+    mpImageList[0] = Image(ScResId(IMG_BORDER1));
+    mpImageList[1] = Image(ScResId(IMG_BORDER2));
+    mpImageList[2] = Image(ScResId(IMG_BORDER3));
+    mpImageList[3] = Image(ScResId(IMG_BORDER4));
+    mpImageList[4] = Image(ScResId(IMG_BORDER5));
+    mpImageList[5] = Image(ScResId(IMG_BORDER6));
+    mpImageList[6] = Image(ScResId(IMG_BORDER7));
+    mpImageList[7] = Image(ScResId(IMG_BORDER8));
+    mpImageList[8] = Image(ScResId(IMG_BORDER9));
+    mpImageList[9] = Image(ScResId(IMG_BORDER10));
+    mpImageList[10] = Image(ScResId(IMG_BORDER11));
+    mpImageList[11] = Image(ScResId(IMG_BORDER12));
+    mpImageList[12] = Image(ScResId(IMG_BORDER13));
+    mpImageList[13] = Image(ScResId(IMG_BORDER14));
+    mpImageList[14] = Image(ScResId(IMG_BORDER15));
+    mpImageList[15] = Image(ScResId(IMG_BORDER16));
+
+    //high contrast
+    mpImageListH = new Image[16];
+    mpImageListH[0] = Image(ScResId(IMG_BORDER1_H));
+    mpImageListH[1] = Image(ScResId(IMG_BORDER2_H));
+    mpImageListH[2] = Image(ScResId(IMG_BORDER3_H));
+    mpImageListH[3] = Image(ScResId(IMG_BORDER4_H));
+    mpImageListH[4] = Image(ScResId(IMG_BORDER5_H));
+    mpImageListH[5] = Image(ScResId(IMG_BORDER6_H));
+    mpImageListH[6] = Image(ScResId(IMG_BORDER7_H));
+    mpImageListH[7] = Image(ScResId(IMG_BORDER8_H));
+    mpImageListH[8] = Image(ScResId(IMG_BORDER9_H));
+    mpImageListH[9] = Image(ScResId(IMG_BORDER10_H));
+    mpImageListH[10] = Image(ScResId(IMG_BORDER11_H));
+    mpImageListH[11] = Image(ScResId(IMG_BORDER12_H));
+    mpImageListH[12] = Image(ScResId(IMG_BORDER13_H));
+    mpImageListH[13] = Image(ScResId(IMG_BORDER14_H));
+    mpImageListH[14] = Image(ScResId(IMG_BORDER15_H));
+    mpImageListH[15] = Image(ScResId(IMG_BORDER16_H));
+
+    maTBBorder1.SetItemImage(TBI_BORDER1_NONE, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[0] : mpImageList[0]); 
+    maTBBorder1.SetItemImage(TBI_BORDER1_ALL, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[1] : mpImageList[1]);
+    maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[2] : mpImageList[2]);
+    maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[3] : mpImageList[3]);
+    maTBBorder1.SetBackground(Wallpaper());
+    maTBBorder1.SetPaintTransparent(true);
+    Size aTbxSize( maTBBorder1.CalcWindowSizePixel() );
+    maTBBorder1.SetOutputSizePixel( aTbxSize );
+    Link aLink  = LINK(this, CellBorderStyleControl, TB1SelectHdl);
+    maTBBorder1.SetSelectHdl ( aLink );
+    
+    maTBBorder2.SetLineCount(2);
+    maTBBorder2.InsertItem(TBI_BORDER2_LEFT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[4] : mpImageList[4]);
+    maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[5] : mpImageList[5]);
+    maTBBorder2.InsertItem(TBI_BORDER2_TOP, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[6] : mpImageList[6]);
+    maTBBorder2.InsertItem(TBI_BORDER2_BOT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[7] : mpImageList[7]);
+    maTBBorder2.InsertBreak();
+    maTBBorder2.InsertItem(TBI_BORDER2_BLTR, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[8] : mpImageList[8]);
+    maTBBorder2.InsertItem(TBI_BORDER2_TLBR, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[9] : mpImageList[9]);
+    maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[10] : mpImageList[10]);
+    maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[11] : mpImageList[11]);
+    maTBBorder2.SetBackground(Wallpaper());
+    maTBBorder2.SetPaintTransparent(true);
+    aTbxSize = maTBBorder2.CalcWindowSizePixel() ;
+    maTBBorder2.SetOutputSizePixel( aTbxSize );
+    maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT);
+    maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT);
+    maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP);
+    maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT);
+    maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR);
+    maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR);
+    maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT);
+    maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT);
+    maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1));
+    maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2));
+    maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3));
+    maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4));
+    maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5));
+    maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6));
+    maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7));
+    maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8));
+    aLink  = LINK(this, CellBorderStyleControl, TB2SelectHdl);
+    maTBBorder2.SetSelectHdl ( aLink );
+    
+    maTBBorder3.SetItemImage(TBI_BORDER3_S1, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[12] : mpImageList[12]);
+    maTBBorder3.SetItemImage(TBI_BORDER3_S2, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[13] : mpImageList[13]);
+    maTBBorder3.SetItemImage(TBI_BORDER3_S3, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[14] : mpImageList[14]);
+    maTBBorder3.SetItemImage(TBI_BORDER3_S4, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[15] : mpImageList[15]);
+    maTBBorder3.SetBackground(Wallpaper());
+    maTBBorder3.SetPaintTransparent(true);
+    aTbxSize = maTBBorder3.CalcWindowSizePixel() ;
+    maTBBorder3.SetOutputSizePixel( aTbxSize );
+    aLink  = LINK(this, CellBorderStyleControl, TB3SelectHdl);
+    maTBBorder3.SetSelectHdl ( aLink );
+}
+
+IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox)
+{
+    sal_uInt16 nId = pToolBox->GetCurItemId();
+    ::Color				aColBlack( COL_BLACK );
+    SvxBoxItem			aBorderOuter( SID_ATTR_BORDER_OUTER );
+    SvxBoxInfoItem		aBorderInner( SID_ATTR_BORDER_INNER );
+    SvxBorderLine		theDefLine(NULL,1, 0, 0);
+    SvxBorderLine       *pLeft = 0, *pRight = 0, *pTop = 0, *pBottom = 0;
+    sal_uInt8 nValidFlags = 0;
+	switch ( nId )
+	{
+	case TBI_BORDER1_NONE:
+		{
+		 nValidFlags |= FRM_VALID_ALL;
+		SvxLineItem     aLineItem1( SID_ATTR_BORDER_DIAG_BLTR );	
+		SvxLineItem     aLineItem2( SID_ATTR_BORDER_DIAG_TLBR );	
+		aLineItem1.SetLine( NULL );		//modify 
+		aLineItem2.SetLine( NULL );		//modify 
+		mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem1, 0L);
+		mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem2, 0L);
+		}
+		break;
+	case TBI_BORDER1_ALL:
+		pLeft = pRight = pTop = pBottom = &theDefLine;
+		aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
+		aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT );
+		nValidFlags |= FRM_VALID_ALL;
+		break;
+	case TBI_BORDER1_OUTER:
+		pLeft = pRight = pTop = pBottom = &theDefLine;
+		nValidFlags |= FRM_VALID_OUTER;
+		break;
+	case TBI_BORDER1_OUTERBOLD:
+		theDefLine.SetOutWidth(DEF_LINE_WIDTH_2);
+		pLeft = pRight = pTop = pBottom = &theDefLine;
+		nValidFlags |= FRM_VALID_OUTER;
+		break;
+	}
+
+    aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT );
+	aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT );
+	aBorderOuter.SetLine( pTop, BOX_LINE_TOP );
+	aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM );
+
+	aBorderInner.SetValid( VALID_TOP, 		0 != (nValidFlags&FRM_VALID_TOP ));
+	aBorderInner.SetValid( VALID_BOTTOM, 	0 != (nValidFlags&FRM_VALID_BOTTOM ));
+	aBorderInner.SetValid( VALID_LEFT, 		0 != (nValidFlags&FRM_VALID_LEFT));
+	aBorderInner.SetValid( VALID_RIGHT, 	0 != (nValidFlags&FRM_VALID_RIGHT ));
+	aBorderInner.SetValid( VALID_HORI, 		0 != (nValidFlags&FRM_VALID_HINNER ));
+	aBorderInner.SetValid( VALID_VERT, 		0 != (nValidFlags&FRM_VALID_VINNER));
+	aBorderInner.SetValid( VALID_DISTANCE, true );
+	aBorderInner.SetValid( VALID_DISABLE, false );
+
+	mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L);
+    mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode();
+	return 0;
+}
+
+IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+
+    if( nId != TBI_BORDER2_BLTR && nId != TBI_BORDER2_TLBR )
+	{
+		::Color				aColBlack( COL_BLACK );
+		SvxBoxItem			aBorderOuter( SID_ATTR_BORDER_OUTER );
+		SvxBoxInfoItem		aBorderInner( SID_ATTR_BORDER_INNER );
+		SvxBorderLine		theDefLine(NULL, 1, 0, 0);
+		SvxBorderLine       *pLeft = 0,
+							*pRight = 0,
+							*pTop = 0,
+							*pBottom = 0;
+		sal_uInt8 				nValidFlags = 0;
+		switch ( nId )
+		{
+		case TBI_BORDER2_LEFT:
+			pLeft = &theDefLine;
+			nValidFlags |= FRM_VALID_LEFT;
+			break;
+		case TBI_BORDER2_RIGHT:
+			//
+			if(!Application::GetSettings().GetLayoutRTL())
+			{
+				pRight = &theDefLine;
+				nValidFlags |= FRM_VALID_RIGHT;
+			}
+			else
+			{
+				pLeft = &theDefLine;
+				nValidFlags |= FRM_VALID_LEFT;
+			}
+			break;
+		case TBI_BORDER2_TOP:
+			pTop = &theDefLine;
+			nValidFlags |= FRM_VALID_TOP;
+			break;
+		case TBI_BORDER2_BOT:
+			pBottom = &theDefLine;
+			nValidFlags |= FRM_VALID_BOTTOM;
+			break;
+		case TBI_BORDER2_TOPBOT:
+			pTop =  pBottom = &theDefLine;
+			nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
+			break;
+		case TBI_BORDER2_LEFTRIGHT:
+			pLeft = pRight = &theDefLine;
+			nValidFlags |= 	FRM_VALID_RIGHT|FRM_VALID_LEFT;
+			break;
+		}
+		aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT );
+		aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT );
+		aBorderOuter.SetLine( pTop, BOX_LINE_TOP );
+		aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM );
+
+		aBorderInner.SetValid( VALID_TOP, 		0 != (nValidFlags&FRM_VALID_TOP ));
+		aBorderInner.SetValid( VALID_BOTTOM, 	0 != (nValidFlags&FRM_VALID_BOTTOM ));
+		aBorderInner.SetValid( VALID_LEFT, 		0 != (nValidFlags&FRM_VALID_LEFT));
+		aBorderInner.SetValid( VALID_RIGHT, 	0 != (nValidFlags&FRM_VALID_RIGHT ));
+		aBorderInner.SetValid( VALID_HORI, 		0 != (nValidFlags&FRM_VALID_HINNER ));
+		aBorderInner.SetValid( VALID_VERT, 		0 != (nValidFlags&FRM_VALID_VINNER));
+		aBorderInner.SetValid( VALID_DISTANCE, true );
+		aBorderInner.SetValid( VALID_DISABLE, false );
+
+		mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L);
+	}
+	else if(nId == TBI_BORDER2_BLTR)
+	{
+		SvxBorderLine aTmp( NULL, 1, 0, 0 );
+		SvxLineItem     aLineItem( SID_ATTR_BORDER_DIAG_BLTR );	
+		aLineItem.SetLine( &aTmp );
+		mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+	}
+	else if(nId == TBI_BORDER2_TLBR)
+	{
+		SvxBorderLine aTmp( NULL, 1, 0, 0 );
+		SvxLineItem     aLineItem( SID_ATTR_BORDER_DIAG_TLBR );	
+		aLineItem.SetLine( &aTmp );
+		mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+	}
+
+    mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode();
+	return 0;
+}
+
+IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+
+	::Color				aColBlack( COL_BLACK );
+	SvxBoxItem			aBorderOuter( SID_ATTR_BORDER_OUTER );
+	SvxBoxInfoItem		aBorderInner( SID_ATTR_BORDER_INNER );
+	SvxBorderLine       *pTop = 0 ,
+						*pBottom = 0 ;
+	sal_uInt8 				nValidFlags = 0;
+
+    switch ( nId )
+	{
+	case TBI_BORDER3_S1:
+		pBottom = new SvxBorderLine(NULL, DEF_LINE_WIDTH_2, 0, 0);
+		nValidFlags |= FRM_VALID_BOTTOM;
+		break;
+	case TBI_BORDER3_S2:
+		pBottom = new SvxBorderLine(NULL, DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST);
+		nValidFlags |= FRM_VALID_BOTTOM;
+		break;
+	case TBI_BORDER3_S3:
+		pBottom = new SvxBorderLine(NULL, DEF_LINE_WIDTH_2, 0, 0);
+		pTop = new SvxBorderLine(NULL, 1, 0, 0);
+		nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
+		break;
+	case TBI_BORDER3_S4:
+		pBottom = new SvxBorderLine(NULL, DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST);
+		pTop = new SvxBorderLine(NULL, 1, 0, 0);
+		nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
+		break;
+	}
+
+    aBorderOuter.SetLine( pTop, BOX_LINE_TOP );
+	aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM );
+	aBorderOuter.SetLine( NULL, BOX_LINE_LEFT );
+	aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT );
+
+	aBorderInner.SetValid( VALID_TOP, 		0 != (nValidFlags&FRM_VALID_TOP ));
+	aBorderInner.SetValid( VALID_BOTTOM, 	0 != (nValidFlags&FRM_VALID_BOTTOM ));
+	aBorderInner.SetValid( VALID_LEFT, 		0 != (nValidFlags&FRM_VALID_LEFT ));
+	aBorderInner.SetValid( VALID_RIGHT, 	0 != (nValidFlags&FRM_VALID_RIGHT ));
+	aBorderInner.SetValid( VALID_HORI, 		0 != (nValidFlags&FRM_VALID_HINNER ));
+	aBorderInner.SetValid( VALID_VERT, 		0 != (nValidFlags&FRM_VALID_VINNER));
+	aBorderInner.SetValid( VALID_DISTANCE, true );
+	aBorderInner.SetValid( VALID_DISABLE, false );
+
+	mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L);
+
+	delete pTop;
+	delete pBottom;
+
+    mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode();
+	return 0;
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/main/sc/source/ui/sidebar/CellBorderStyleControl.hxx
new file mode 100755
index 0000000..0c59cc0
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderStyleControl.hxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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 SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX
+#define SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX
+
+#include <svx/sidebar/PopupControl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+
+namespace sc { namespace sidebar {
+
+class CellAppearancePropertyPanel;
+
+class CellBorderStyleControl : public svx::sidebar::PopupControl
+{
+private:
+    CellAppearancePropertyPanel&    mrCellAppearancePropertyPanel;
+    ToolBox                         maTBBorder1;
+    ToolBox                         maTBBorder2;
+    ToolBox                         maTBBorder3;
+    FixedLine                       maFL1;
+    FixedLine                       maFL2;
+    Image*                          mpImageList;
+    Image*                          mpImageListH; //high contrast
+    
+    void Initialize();
+    
+    DECL_LINK(TB1SelectHdl, ToolBox *);
+    DECL_LINK(TB2SelectHdl, ToolBox *);
+    DECL_LINK(TB3SelectHdl, ToolBox *);
+
+public:
+    CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel);
+    virtual ~CellBorderStyleControl(void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif // SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderStylePopup.cxx b/main/sc/source/ui/sidebar/CellBorderStylePopup.cxx
new file mode 100755
index 0000000..2a26775
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderStylePopup.cxx
@@ -0,0 +1,42 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include "CellBorderStylePopup.hxx"
+#include "CellLineStyleControl.hxx"
+
+namespace sc { namespace sidebar {
+
+CellBorderStylePopup::CellBorderStylePopup (
+    Window* pParent,
+    const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator)
+:   Popup(pParent, rControlCreator,  ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellBorderStyle")))
+{
+}
+
+CellBorderStylePopup::~CellBorderStylePopup (void)
+{
+}
+
+} } // end of namespace sc::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderStylePopup.hxx b/main/sc/source/ui/sidebar/CellBorderStylePopup.hxx
new file mode 100755
index 0000000..ab1132f
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderStylePopup.hxx
@@ -0,0 +1,43 @@
+/**************************************************************
+ * 
+ * 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 _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_
+#define _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_
+
+#include <svx/sidebar/Popup.hxx>
+#include <boost/function.hpp>
+
+namespace sc { namespace sidebar {
+
+class CellBorderStylePopup : public svx::sidebar::Popup
+{
+public :
+    CellBorderStylePopup(
+        Window* pParent,
+        const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator);
+    virtual ~CellBorderStylePopup(void);
+};
+
+} } // end of namespace sc::sidebar
+
+#endif // _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderUpdater.cxx b/main/sc/source/ui/sidebar/CellBorderUpdater.cxx
new file mode 100755
index 0000000..c658163
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderUpdater.cxx
@@ -0,0 +1,127 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <CellBorderUpdater.hxx>
+#include <vcl/bmpacc.hxx>
+#include <vcl/svapp.hxx>
+
+namespace sc { namespace sidebar {
+
+CellBorderUpdater::CellBorderUpdater(
+    sal_uInt16 nTbxBtnId,
+    ToolBox& rTbx)
+:   mnBtnId(nTbxBtnId),
+    mrTbx(rTbx)
+{
+}
+
+CellBorderUpdater::~CellBorderUpdater()
+{
+}
+
+void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor)
+{
+    BitmapEx            aBmpEx( aImg.GetBitmapEx() );
+    Bitmap              aBmp( aBmpEx.GetBitmap() );
+    BitmapWriteAccess*  pBmpAcc = aBmp.AcquireWriteAccess();
+    const Size maBmpSize = aBmp.GetSizePixel();
+
+    if( pBmpAcc )
+    {
+        Bitmap              aMsk;
+        BitmapWriteAccess*  pMskAcc;
+
+        if( aBmpEx.IsAlpha() )
+            pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess();
+        else if( aBmpEx.IsTransparent() )
+            pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess();
+        else
+            pMskAcc = NULL;
+
+		pBmpAcc->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
+		pBmpAcc->SetFillColor( COL_BLACK);
+
+        if(maBmpSize.Width() == 43 && maBmpSize.Height() == 43)
+		{
+			Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41); 
+			if( pMskAcc )
+			{
+				pMskAcc->SetLineColor( COL_BLACK );
+				pMskAcc->SetFillColor( COL_BLACK );
+			}
+			if(bLeft)
+			{
+				pBmpAcc->DrawLine( aTL,aBL );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aTL,aBL );
+			}	
+			if(bRight)
+			{
+				pBmpAcc->DrawLine( aTR,aBR );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aTR,aBR );
+			}	
+			if(bTop)
+			{
+				pBmpAcc->DrawLine( aTL,aTR );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aTL,aTR );
+			}
+			if(bBot)
+			{
+				pBmpAcc->DrawLine( aBL,aBR );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aBL,aBR );
+			}
+			if(bVer)
+			{
+				pBmpAcc->DrawLine( aVT,aVB );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aVT,aVB );
+			}	
+			if(bHor)
+			{
+				pBmpAcc->DrawLine( aHL,aHR );
+				if( pMskAcc )
+					pMskAcc->DrawLine( aHL,aHR );
+			}
+		}      
+	
+		aBmp.ReleaseAccess( pBmpAcc );
+		if( pMskAcc )
+                aMsk.ReleaseAccess( pMskAcc );
+
+        if( aBmpEx.IsAlpha() )
+            aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) );
+        else if( aBmpEx.IsTransparent() )
+            aBmpEx = BitmapEx( aBmp, aMsk );
+        else
+            aBmpEx = aBmp;
+
+        mrTbx.SetItemImage( mnBtnId, Image( aBmpEx ) );
+    }
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellBorderUpdater.hxx b/main/sc/source/ui/sidebar/CellBorderUpdater.hxx
new file mode 100755
index 0000000..64a211d
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellBorderUpdater.hxx
@@ -0,0 +1,46 @@
+/**************************************************************
+ * 
+ * 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 SC_SIDEBAR_CELL_BORDER_UPDATER_HXX
+#define SC_SIDEBAR_CELL_BORDER_UPDATER_HXX
+
+#include <vcl/toolbox.hxx>
+
+namespace sc { namespace sidebar {
+
+class CellBorderUpdater
+{
+private:
+    sal_uInt16  mnBtnId;
+    ToolBox&    mrTbx;
+
+public:
+    CellBorderUpdater(sal_uInt16 nTbxBtnId, ToolBox& rTbx);
+    ~CellBorderUpdater();
+
+    void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif // SC_SIDEBAR_CELL_BORDER_UPDATER_HXX
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStyleControl.cxx b/main/sc/source/ui/sidebar/CellLineStyleControl.cxx
new file mode 100755
index 0000000..4eb8b2c
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStyleControl.cxx
@@ -0,0 +1,246 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <CellLineStyleControl.hxx>
+#include "sc.hrc"
+#include "scresid.hxx"
+#include <CellAppearancePropertyPanel.hrc>
+#include <CellLineStyleValueSet.hxx>
+#include <vcl/i18nhelp.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <CellAppearancePropertyPanel.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+namespace sc { namespace sidebar {
+
+CellLineStyleControl::CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel)
+:   svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)),
+    mrCellAppearancePropertyPanel(rPanel),
+    maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)),
+    maCellLineStyleValueSet(this, ScResId(VS_STYLE)),
+    mpStr(0),
+    mbVSfocus(true)
+{
+    Initialize();
+    FreeResource();
+}
+
+CellLineStyleControl::~CellLineStyleControl(void)
+{
+    delete[] mpStr;
+}
+
+void CellLineStyleControl::Initialize()
+{
+    //maPushButtonMoreOptions.SetIcoPosX(2);
+    Link aLink = LINK(this, CellLineStyleControl, PBClickHdl);
+    maPushButtonMoreOptions.SetClickHdl(aLink);
+    
+    maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT);
+    maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor());
+    maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); 
+
+    for(sal_uInt16 i = 1 ; i <= 9 ; i++)
+    {
+        maCellLineStyleValueSet.InsertItem(i);
+    }
+
+    mpStr = new XubString[9];
+    mpStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt");
+    mpStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt");
+    mpStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt");
+    mpStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt");
+    mpStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt");
+    mpStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt");
+    mpStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt");
+    mpStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt");
+    mpStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt");
+    maCellLineStyleValueSet.SetUnit(mpStr);
+
+    for(sal_uInt16 i = 1 ; i <= 9 ; i++)
+    {
+        maCellLineStyleValueSet.SetItemText(i, mpStr[i-1]);
+    }
+
+    SetAllNoSel();
+    aLink = LINK(this, CellLineStyleControl, VSSelectHdl);
+    maCellLineStyleValueSet.SetSelectHdl(aLink);
+    maCellLineStyleValueSet.StartSelection();
+    maCellLineStyleValueSet.Show();
+}
+
+void CellLineStyleControl::GetFocus()
+{
+    if(!mbVSfocus)
+    {
+        maPushButtonMoreOptions.GrabFocus();
+    }
+    else
+    {
+        maCellLineStyleValueSet.GrabFocus();
+    }
+}
+
+void CellLineStyleControl::SetAllNoSel()
+{
+    maCellLineStyleValueSet.SelectItem(0);
+    maCellLineStyleValueSet.SetNoSelection();
+    maCellLineStyleValueSet.Format();
+    Invalidate();
+    maCellLineStyleValueSet.StartSelection();
+}
+
+IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl)
+{
+    if(pControl == &maCellLineStyleValueSet)  
+    {
+        const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId());
+        SvxLineItem aLineItem(SID_FRAME_LINESTYLE);
+        sal_uInt16 n1 = 0;
+        sal_uInt16 n2 = 0;
+        sal_uInt16 n3 = 0;
+
+        switch(iPos)
+        {
+            case 1: 
+                n1 = DEF_LINE_WIDTH_0; 
+                break;
+            case 2: 
+                n1 = DEF_LINE_WIDTH_2; 
+                break;
+            case 3: 
+                n1 = DEF_LINE_WIDTH_3; 
+                break;
+            case 4: 
+                n1 = DEF_LINE_WIDTH_4; 
+                break;
+            case 5: 
+                n1 = DEF_DOUBLE_LINE0_OUT;
+                n2 = DEF_DOUBLE_LINE0_IN;
+                n3 = DEF_DOUBLE_LINE0_DIST;
+                break;
+            case 6: 
+                n1 = DEF_DOUBLE_LINE7_OUT;
+                n2 = DEF_DOUBLE_LINE7_IN;
+                n3 = DEF_DOUBLE_LINE7_DIST;
+                break;
+            case 7: 
+                n1 = DEF_DOUBLE_LINE4_OUT;
+                n2 = DEF_DOUBLE_LINE4_IN;
+                n3 = DEF_DOUBLE_LINE4_DIST;
+                break;
+            case 8: 
+                n1 = DEF_DOUBLE_LINE9_OUT;
+                n2 = DEF_DOUBLE_LINE9_IN;
+                n3 = DEF_DOUBLE_LINE9_DIST;
+                break;
+            case 9: 
+                n1 = DEF_DOUBLE_LINE2_OUT;
+                n2 = DEF_DOUBLE_LINE2_IN;
+                n3 = DEF_DOUBLE_LINE2_DIST;
+                break;
+            default:
+                break;
+        }
+
+        SvxBorderLine aTmp( NULL, n1, n2, n3 );
+        aLineItem.SetLine( &aTmp );
+        mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_FRAME_LINESTYLE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+        SetAllNoSel();
+        mrCellAppearancePropertyPanel.EndCellLineStylePopupMode();
+    }
+
+    return(0L);
+}
+
+IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn)
+{
+    if(pPBtn == &maPushButtonMoreOptions)  
+    {
+        if(mrCellAppearancePropertyPanel.GetBindings())
+        {
+            mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_CELL_FORMAT_BORDER, SFX_CALLMODE_ASYNCHRON);
+        }
+
+        mrCellAppearancePropertyPanel.EndCellLineStylePopupMode();
+    }
+
+    return 0;
+}
+
+void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis)
+{
+    SetAllNoSel();
+    mbVSfocus = true;
+
+    if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0)  //1
+    {
+        maCellLineStyleValueSet.SetSelItem(1);
+    }
+    else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2
+    {
+        maCellLineStyleValueSet.SetSelItem(2);
+    }
+    else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3
+    {
+        maCellLineStyleValueSet.SetSelItem(3);
+    }
+    else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4
+    {
+        maCellLineStyleValueSet.SetSelItem(4);
+    }
+    else if(out == DEF_DOUBLE_LINE0_OUT && in == DEF_DOUBLE_LINE0_IN && dis == DEF_DOUBLE_LINE0_DIST) //5
+    {
+        maCellLineStyleValueSet.SetSelItem(5);
+    }
+    else if(out == DEF_DOUBLE_LINE7_OUT && in == DEF_DOUBLE_LINE7_IN && dis == DEF_DOUBLE_LINE7_DIST) //6
+    {
+        maCellLineStyleValueSet.SetSelItem(6);
+    }
+    else if(out == DEF_DOUBLE_LINE4_OUT && in == DEF_DOUBLE_LINE4_IN && dis == DEF_DOUBLE_LINE4_DIST) //7
+    {
+        maCellLineStyleValueSet.SetSelItem(7);
+    }
+    else if(out == DEF_DOUBLE_LINE9_OUT && in == DEF_DOUBLE_LINE9_IN && dis == DEF_DOUBLE_LINE9_DIST) //8
+    {
+        maCellLineStyleValueSet.SetSelItem(8);
+    }
+    else if(out == DEF_DOUBLE_LINE2_OUT && in == DEF_DOUBLE_LINE2_IN && dis == DEF_DOUBLE_LINE2_DIST) //9
+    {
+        maCellLineStyleValueSet.SetSelItem(9);
+    }
+    else
+    {
+        maCellLineStyleValueSet.SetSelItem(0);
+        mbVSfocus = false;
+    }
+
+    maCellLineStyleValueSet.Format();
+    maCellLineStyleValueSet.StartSelection();
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStyleControl.hxx b/main/sc/source/ui/sidebar/CellLineStyleControl.hxx
new file mode 100755
index 0000000..b8dfb58
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStyleControl.hxx
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * 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 SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX
+#define SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX
+
+#include <svx/sidebar/PopupControl.hxx>
+#include <vcl/button.hxx>
+#include <CellLineStyleValueSet.hxx>
+
+namespace sc { namespace sidebar {
+
+class CellAppearancePropertyPanel;
+
+class CellLineStyleControl : public svx::sidebar::PopupControl
+{
+private:
+    CellAppearancePropertyPanel&       mrCellAppearancePropertyPanel;
+    PushButton                         maPushButtonMoreOptions;
+    CellLineStyleValueSet              maCellLineStyleValueSet;
+    XubString*                         mpStr;
+
+    /// bitfield
+    bool                               mbVSfocus : 1;
+
+    void Initialize();
+    void SetAllNoSel();
+
+    DECL_LINK(VSSelectHdl, void*);
+    DECL_LINK(PBClickHdl, PushButton*);
+
+public:
+    CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel);
+    virtual ~CellLineStyleControl(void);
+
+    void GetFocus();
+    void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis);
+
+    ValueSet& GetValueSet()
+    {
+        return maCellLineStyleValueSet;
+    }
+
+    Control& GetPushButton()
+    {
+        return maPushButtonMoreOptions;
+    }
+};
+
+} } // end of namespace svx::sidebar
+
+#endif // SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStylePopup.cxx b/main/sc/source/ui/sidebar/CellLineStylePopup.cxx
new file mode 100755
index 0000000..e2694c0
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStylePopup.cxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include "CellLineStylePopup.hxx"
+#include "CellLineStyleControl.hxx"
+
+namespace sc { namespace sidebar {
+
+CellLineStylePopup::CellLineStylePopup (
+    Window* pParent,
+    const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator)
+:   Popup(pParent, rControlCreator,  ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellLineStyle")))
+{
+}
+
+CellLineStylePopup::~CellLineStylePopup (void)
+{
+}
+
+void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis)
+{
+    ProvideContainerAndControl();
+
+    CellLineStyleControl* pControl = dynamic_cast< CellLineStyleControl* >(mpControl.get());
+
+    if(pControl)
+    {
+        pControl->SetLineStyleSelect(out, in, dis);
+    }
+}
+
+} } // end of namespace sc::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStylePopup.hxx b/main/sc/source/ui/sidebar/CellLineStylePopup.hxx
new file mode 100755
index 0000000..5f18492
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStylePopup.hxx
@@ -0,0 +1,45 @@
+/**************************************************************
+ * 
+ * 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 _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_
+#define _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_
+
+#include <svx/sidebar/Popup.hxx>
+#include <boost/function.hpp>
+
+namespace sc { namespace sidebar {
+
+class CellLineStylePopup : public svx::sidebar::Popup
+{
+public :
+    CellLineStylePopup(
+        Window* pParent,
+        const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator);
+    virtual ~CellLineStylePopup(void);
+
+    void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis);
+};
+
+} } // end of namespace sc::sidebar
+
+#endif // _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/main/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
new file mode 100755
index 0000000..87fb256
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
@@ -0,0 +1,184 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <CellLineStyleValueSet.hxx>
+#include <i18npool/mslangid.hxx>
+
+namespace sc { namespace sidebar {
+
+CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rResId)
+:   ValueSet( pParent, rResId ),
+    pVDev(NULL),
+    nSelItem(0),
+    bCusEnable(false)
+{
+	strUnit = new XubString[9];
+	SetColCount( 1 );
+    SetLineCount( 9);
+}
+
+CellLineStyleValueSet::~CellLineStyleValueSet()
+{	
+	delete pVDev;
+	delete[] strUnit;
+}
+
+void CellLineStyleValueSet::SetUnit(XubString* str)
+{
+	for(int i = 0; i < 9; i++)
+	{
+		strUnit[i] = str[i];
+	}
+}
+
+void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel)
+{
+	nSelItem = nSel;
+	if(nSel == 0)
+	{
+		SelectItem(1);
+		SetNoSelection();
+	}
+	else
+	{
+		SelectItem(nSelItem);	
+		GrabFocus();
+	}
+}
+
+sal_uInt16 CellLineStyleValueSet::GetSelItem()
+{
+	return nSelItem;
+}
+
+void CellLineStyleValueSet::SetImage(Image img)
+{
+	imgCus = img;
+}
+
+void CellLineStyleValueSet::SetCusEnable(bool bEnable)
+{
+	bCusEnable = bEnable;
+}
+
+void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+	Rectangle aRect = rUDEvt.GetRect();
+	OutputDevice*  pDev = rUDEvt.GetDevice();
+	sal_uInt16	nItemId = rUDEvt.GetItemId();
+	
+	long nRectHeight = aRect.GetHeight();
+	long nRectWidth = aRect.GetWidth();	
+	Point aBLPos = aRect.TopLeft();	
+
+	Font aOldFont = pDev->GetFont();
+	Color aOldColor = pDev->GetLineColor();
+	Color aOldFillColor = pDev->GetFillColor();	
+
+	Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+	Size aSize = aFont.GetSize();	
+	aSize.Height() = nRectHeight*3/5;
+	aFont.SetSize( aSize );
+
+	Point aLineStart(aBLPos.X() + 5,			aBLPos.Y() + ( nRectHeight - nItemId )/2);
+	Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 15, aBLPos.Y() + ( nRectHeight - nItemId )/2);
+	long  nTLX = aBLPos.X() + 5,  nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
+	long  nTRX = aBLPos.X() + nRectWidth * 7 / 9 - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
+
+	if( nSelItem ==  nItemId )
+	{
+		Color aBackColor(50,107,197);
+		Rectangle aBackRect = aRect;
+		aBackRect.Top() += 3;
+		aBackRect.Bottom() -= 2;
+		pDev->SetFillColor(aBackColor);
+		pDev->DrawRect(aBackRect);
+	}
+	else
+	{
+		pDev->SetFillColor( COL_TRANSPARENT );
+		pDev->DrawRect(aRect);
+	}
+
+	//draw text	
+	if(nSelItem ==  nItemId )
+		aFont.SetColor(COL_WHITE);
+	else
+		aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast
+
+	pDev->SetFont(aFont);		
+	Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6);
+	pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear
+
+	//draw line
+	if( nSelItem ==  nItemId )
+	{
+		pDev->SetFillColor(COL_WHITE);
+		pDev->SetLineColor(COL_WHITE);
+	}
+	else
+	{
+		pDev->SetFillColor(GetSettings().GetStyleSettings().GetFieldTextColor());	//high contrast
+		pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor());	//high contrast 
+	}
+
+    switch( nItemId )
+	{
+		case 1:
+		case 2:
+		case 3:
+		case 4:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + nItemId * 2 - 1 ));
+			break;
+		case 5:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 ));
+			pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 4 ));
+			break;
+		case 6:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 ));
+			pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 ));
+			break;
+		case 7:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 ));
+			pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 6 ));
+			break;
+		case 8:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 ));
+			pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 ));
+			break;
+		case 9:
+			pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 ));
+			pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 8 ));
+			break;
+	}
+
+	Invalidate( aRect );
+	pDev->SetLineColor(aOldColor);
+	pDev->SetFillColor(aOldFillColor);
+	pDev->SetFont(aOldFont);
+	
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/main/sc/source/ui/sidebar/CellLineStyleValueSet.hxx
new file mode 100755
index 0000000..aaefbeb
--- /dev/null
+++ b/main/sc/source/ui/sidebar/CellLineStyleValueSet.hxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ * 
+ * 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 SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX
+#define SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX
+
+#include <svtools/valueset.hxx>
+#include <vcl/image.hxx>
+
+namespace sc { namespace sidebar {
+
+class CellLineStyleValueSet : public ValueSet
+{
+private:
+    VirtualDevice*  pVDev;
+    sal_uInt16      nSelItem;
+    XubString*      strUnit;
+    Image           imgCus;
+    bool            bCusEnable;
+public:
+    CellLineStyleValueSet( Window* pParent, const ResId& rResId);
+    virtual ~CellLineStyleValueSet();
+    
+    void SetUnit(XubString* str);
+    void SetSelItem(sal_uInt16 nSel);
+    sal_uInt16 GetSelItem();
+    void SetImage(Image img);
+    void SetCusEnable(bool bEnable);
+    virtual void UserDraw( const UserDrawEvent& rUDEvt );
+};
+
+} } // end of namespace svx::sidebar
+
+#endif // SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX
+
+// eof
diff --git a/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
new file mode 100755
index 0000000..03c51a3
--- /dev/null
+++ b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -0,0 +1,389 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <NumberFormatPropertyPanel.hxx>
+#include <NumberFormatPropertyPanel.hrc>
+#include "sc.hrc"
+#include "scresid.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+
+using namespace css;
+using namespace cssu;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace open
+
+namespace sc { namespace sidebar {
+
+//////////////////////////////////////////////////////////////////////////////
+
+NumberFormatPropertyPanel::NumberFormatPropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+:   Control(
+        pParent, 
+        ScResId(RID_PROPERTYPANEL_SC_NUMBERFORMAT)),
+    mpFtCategory(new FixedText(this, ScResId(FT_CATEGORY))),
+    mpLbCategory(new ListBox(this, ScResId(LB_CATEGORY))),
+    mpTBCategoryBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBCategory(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCategoryBackground.get(), ScResId(TBX_CATEGORY))),
+    mpFtDecimals(new FixedText(this, ScResId(FT_DECIMALS))),
+    mpEdDecimals(new NumericField(this, ScResId(ED_DECIMALS))),
+    mpFtLeadZeroes(new FixedText(this, ScResId(FT_LEADZEROES))),
+    mpEdLeadZeroes(new NumericField(this, ScResId(ED_LEADZEROES))),
+    mpBtnNegRed(new CheckBox(this, ScResId(BTN_NEGRED))),
+    mpBtnThousand(new CheckBox(this, ScResId(BTN_THOUSAND))),
+    maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this),
+
+    // Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If
+    // yes, grep for it in SC and symphony (!)
+    maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this),
+
+    maImgNumber(ScResId(IMG_NUMBER)),
+    maImgPercent(ScResId(IMG_PERCENT)),
+    maImgCurrency(ScResId(IMG_CURRENCY)),
+    maImgDate(ScResId(IMG_DATE)),
+    maImgText(ScResId(IMG_TEXT)),
+    mnCategorySelected(0),
+    mxFrame(rxFrame),
+    maContext(),
+    mpBindings(pBindings)
+{
+    Initialize();
+    FreeResource();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+NumberFormatPropertyPanel::~NumberFormatPropertyPanel()
+{
+    // Destroy the toolboxes, then their background windows.
+    mpTBCategory.reset();
+    mpTBCategoryBackground.reset();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void NumberFormatPropertyPanel::Initialize()
+{
+	Link aLink = LINK(this, NumberFormatPropertyPanel, NumFormatSelectHdl);
+	mpLbCategory->SetSelectHdl ( aLink );
+	mpLbCategory->SelectEntryPos(0);
+	mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category")));		//wj acc
+    mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount());
+
+	mpTBCategory->SetItemImage(ID_NUMBER, maImgNumber);
+	mpTBCategory->SetItemImage(ID_PERCENT, maImgPercent);
+	mpTBCategory->SetItemImage(ID_CURRENCY, maImgCurrency);
+	mpTBCategory->SetItemImage(ID_DATE, maImgDate);
+	mpTBCategory->SetItemImage(ID_TEXT, maImgText);
+	Size aTbxSize( mpTBCategory->CalcWindowSizePixel() );
+	mpTBCategory->SetOutputSizePixel( aTbxSize );
+	mpTBCategory->SetBackground(Wallpaper());
+	mpTBCategory->SetPaintTransparent(true);
+	aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl);
+	mpTBCategory->SetSelectHdl ( aLink );
+
+	aLink = LINK(this, NumberFormatPropertyPanel, NumFormatValueHdl);
+	
+	mpEdDecimals->SetModifyHdl( aLink );	
+	mpEdLeadZeroes->SetModifyHdl( aLink );
+	mpEdDecimals->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Decimal Places")));		//wj acc
+	mpEdLeadZeroes->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Leading Zeroes")));		//wj acc
+	mpBtnNegRed->SetClickHdl( aLink );
+	mpBtnThousand->SetClickHdl( aLink );
+
+    mpLbCategory->SetAccessibleRelationLabeledBy(mpFtCategory.get());
+	mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory.get());
+	mpEdDecimals->SetAccessibleRelationLabeledBy(mpFtDecimals.get());
+	mpEdLeadZeroes->SetAccessibleRelationLabeledBy(mpFtLeadZeroes.get());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox )
+{
+	sal_uInt16 nVal = pBox->GetCurItemId();
+	sal_uInt16 nId = 0;
+	switch(nVal)
+	{
+	case ID_NUMBER:
+		nId = 1;
+		break;
+	case ID_PERCENT:
+		nId = 2;
+		break;
+	case ID_CURRENCY:
+		nId = 3;
+		break;
+	case ID_DATE:
+		nId = 4;
+		break;
+	case ID_TEXT:
+		nId = 9;
+		break;
+	default:
+		;
+	}
+	if( nId != mnCategorySelected )
+	{
+		SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT,  nId );
+		GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L);
+	}
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( NumberFormatPropertyPanel, NumFormatSelectHdl, ListBox*, pBox )
+{
+	sal_uInt16 nVal = pBox->GetSelectEntryPos();
+	if( nVal != mnCategorySelected )
+	{
+		SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT,  nVal );
+		GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L);
+		mnCategorySelected = nVal;
+	}
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG )
+{
+	String		  aFormat;
+	String		  sBreak = String::CreateFromAscii(",");
+	bool		  bThousand 	=    mpBtnThousand->IsEnabled()
+		&& mpBtnThousand->IsChecked();
+	bool		  bNegRed		=    mpBtnNegRed->IsEnabled()
+		&& mpBtnNegRed->IsChecked();
+	sal_uInt16		  nPrecision	= (mpEdDecimals->IsEnabled())
+		? (sal_uInt16)mpEdDecimals->GetValue()
+		: (sal_uInt16)0;
+	sal_uInt16		  nLeadZeroes	= (mpEdLeadZeroes->IsEnabled())
+		? (sal_uInt16)mpEdLeadZeroes->GetValue()
+		: (sal_uInt16)0;
+
+	String sThousand = String::CreateFromInt32(bThousand);
+	String sNegRed = String::CreateFromInt32(bNegRed);
+	String sPrecision = String::CreateFromInt32(nPrecision);
+	String sLeadZeroes = String::CreateFromInt32(nLeadZeroes);
+
+	aFormat += sThousand;
+	aFormat += sBreak;
+	aFormat += sNegRed;
+	aFormat += sBreak;
+	aFormat += sPrecision;
+	aFormat += sBreak;
+	aFormat += sLeadZeroes;
+	aFormat += sBreak;
+
+	SfxStringItem aItem( SID_NUMBER_FORMAT,  aFormat );
+	GetBindings()->GetDispatcher()->Execute(SID_NUMBER_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to NumberFormatPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to NumberFormatPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to NumberFormatPropertyPanel::Create"), NULL, 2);
+    
+    return new NumberFormatPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void NumberFormatPropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void NumberFormatPropertyPanel::HandleContextChange(
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if(maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+
+
+
+    // todo
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void NumberFormatPropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{
+	switch(nSID)
+	{
+	case SID_NUMBER_TYPE_FORMAT:
+		{
+			if( eState >= SFX_ITEM_AVAILABLE)
+			{
+				const SfxInt16Item* pItem = (const SfxInt16Item*)pState;
+				sal_uInt16 nVal = pItem->GetValue();
+				mnCategorySelected = nVal;
+				mpLbCategory->SelectEntryPos(nVal);
+				if( nVal < 4 )
+				{
+					mpBtnThousand->Enable();
+					mpBtnNegRed->Enable();
+					mpEdDecimals->Enable();
+					mpEdLeadZeroes->Enable();
+				}
+				else
+				{
+					mpBtnThousand->Disable();
+					mpBtnNegRed->Disable();
+					mpEdDecimals->Disable();
+					mpEdLeadZeroes->Disable();
+				}
+			}
+			else
+			{
+				mpLbCategory->SetNoSelection();
+				mnCategorySelected = 0;
+				mpBtnThousand->Disable();
+				mpBtnNegRed->Disable();
+				mpEdDecimals->Disable();
+				mpEdLeadZeroes->Disable();
+			}
+		}
+		break;
+	case SID_NUMBER_FORMAT:
+		{
+			bool		  bThousand 	=    0;
+			bool		  bNegRed		=    0;
+			sal_uInt16		  nPrecision	=	 0;
+			sal_uInt16		  nLeadZeroes	=    0;
+			if( eState >= SFX_ITEM_AVAILABLE)
+			{
+				const SfxStringItem* pItem = (const SfxStringItem*)pState;
+				String aCode = pItem->GetValue();
+			/*	if(aCode.Equals(String::CreateFromAscii("General")))
+				{
+					mnCategorySelected = 0;
+					mpLbCategory->SelectEntryPos(0);
+					mpBtnThousand->Check(0);
+					mpBtnNegRed->Check(0);
+					mpEdDecimals->SetValue(0);
+					mpEdLeadZeroes->SetValue(1);
+					break;
+				}
+				else if( mpLbCategory->GetSelectEntryPos() == 0 )
+				{
+					mnCategorySelected = 1;
+					mpLbCategory->SelectEntryPos(1);
+				}*/
+				sal_uInt16 aLen = aCode.Len();
+				String* sFormat = new String[4];
+				String  sTmpStr = String::CreateFromAscii(""); 
+				sal_uInt16 nCount = 0;
+				sal_uInt16 nStrCount = 0;
+				while( nCount < aLen )
+				{
+					sal_Unicode cChar = aCode.GetChar(nCount);
+					if(cChar == sal_Unicode(','))
+					{
+						sFormat[nStrCount] = sTmpStr;
+						sTmpStr = String::CreateFromAscii("");
+						nStrCount++;
+					}
+					else
+					{
+						sTmpStr += cChar;
+					}
+					nCount++;
+				}
+				bThousand 	=    sFormat[0].ToInt32();
+				bNegRed		=    sFormat[1].ToInt32();
+				nPrecision	=	 (sal_uInt16)sFormat[2].ToInt32();
+				nLeadZeroes	=    (sal_uInt16)sFormat[3].ToInt32();
+				delete[] sFormat;
+			}
+			else
+			{
+				bThousand 	=    0;
+				bNegRed		=    0;
+				nPrecision	=	 0;
+				nLeadZeroes	=    1;
+			}
+			mpBtnThousand->Check(bThousand);
+			mpBtnNegRed->Check(bNegRed);
+			mpEdDecimals->SetValue(nPrecision);
+			mpEdLeadZeroes->SetValue(nLeadZeroes);
+		}
+	default:
+		;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SfxBindings* NumberFormatPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace close
+
+}} // end of namespace ::sc::sidebar
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc
new file mode 100755
index 0000000..8b31113
--- /dev/null
+++ b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc
@@ -0,0 +1,74 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+#define FT_CATEGORY					1
+#define LB_CATEGORY					2
+#define FT_DECIMALS					3
+#define ED_DECIMALS					4
+#define FT_LEADZEROES				5
+#define ED_LEADZEROES				6
+#define BTN_NEGRED					7
+#define BTN_THOUSAND				8
+#define TBX_CATEGORY				9
+#define ID_NUMBER					10
+#define ID_PERCENT					11
+#define ID_CURRENCY 				12
+#define ID_DATE						13
+#define ID_TEXT						14
+#define IMG_NUMBER					15
+#define IMG_PERCENT					16
+#define IMG_CURRENCY				17
+#define IMG_DATE					18
+#define IMG_TEXT					19
+
+//===============================================================position=============================================
+
+#define MBOX_WIDTH							28
+#define	TOOLBOX_ITEM_HEIGHT					12
+#define CHECKBOX_HEIGHT						10
+
+#define FT_CATEGORY_X						SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_CATEGORY_Y						SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define LB_CATEGORY_X						FT_CATEGORY_X
+#define LB_CATEGORY_Y						FT_CATEGORY_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define TBX_CATEGORY_X						SECTIONPAGE_MARGIN_HORIZONTAL + 1
+#define TBX_CATEGORY_Y						LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+
+#define FT_DECIMALS_X						SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_DECIMALS_Y						TBX_CATEGORY_Y + TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL
+#define LB_DECIMALS_X						FT_CATEGORY_X
+#define LB_DECIMALS_Y						FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define FT_LEADZEROES_X						SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH*2 + CONTROL_SPACING_HORIZONTAL
+#define FT_LEADZEROES_Y						FT_DECIMALS_Y
+#define LB_LEADZEROES_X						FT_LEADZEROES_X
+#define LB_LEADZEROES_Y						FT_LEADZEROES_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define BTN_NEGRED_X						SECTIONPAGE_MARGIN_HORIZONTAL
+#define BTN_NEGRED_Y						LB_LEADZEROES_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+
+#define BTN_THOUSAND_X						SECTIONPAGE_MARGIN_HORIZONTAL
+#define BTN_THOUSAND_Y						BTN_NEGRED_Y + CHECKBOX_HEIGHT + CONTROL_SPACING_VERTICAL - 3
+
+#define PROPERTYPAGE_HEIGHT					BTN_THOUSAND_Y + CHECKBOX_HEIGHT + 2
+
+// eof
diff --git a/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
new file mode 100755
index 0000000..4f55664
--- /dev/null
+++ b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -0,0 +1,108 @@
+/**************************************************************
+ * 
+ * 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 SC_PROPERTYPANEL_NUMFORMAT_HXX
+#define SC_PROPERTYPANEL_NUMFORMAT_HXX
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <boost/scoped_ptr.hpp>
+
+class FixedText;
+class ListBox;
+class NumericField;
+
+namespace sc { namespace sidebar {
+
+class NumberFormatPropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::IContextChangeReceiver,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+public:
+    static NumberFormatPropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void HandleContextChange(
+        const ::sfx2::sidebar::EnumContext aContext);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+private:
+    //ui controls
+    ::boost::scoped_ptr< FixedText >        mpFtCategory;
+    ::boost::scoped_ptr< ListBox >          mpLbCategory;
+    ::boost::scoped_ptr< Window >           mpTBCategoryBackground;
+    ::boost::scoped_ptr< ToolBox >          mpTBCategory;
+    ::boost::scoped_ptr< FixedText >        mpFtDecimals;
+    ::boost::scoped_ptr< NumericField >     mpEdDecimals;
+    ::boost::scoped_ptr< FixedText >        mpFtLeadZeroes;
+    ::boost::scoped_ptr< NumericField >     mpEdLeadZeroes;
+    ::boost::scoped_ptr< CheckBox >         mpBtnNegRed;
+    ::boost::scoped_ptr< CheckBox >         mpBtnThousand;
+
+    ::sfx2::sidebar::ControllerItem         maNumFormatControl;
+    ::sfx2::sidebar::ControllerItem         maFormatControl;
+
+    // images
+    Image                                   maImgNumber;
+    Image                                   maImgPercent;
+    Image                                   maImgCurrency;
+    Image                                   maImgDate;
+    Image                                   maImgText;
+
+    sal_uInt16                              mnCategorySelected;
+
+    cssu::Reference<css::frame::XFrame>     mxFrame;
+    ::sfx2::sidebar::EnumContext            maContext;
+    SfxBindings*                            mpBindings;
+
+    DECL_LINK(NumFormatHdl, ToolBox*);
+    DECL_LINK(NumFormatSelectHdl, ListBox*);
+    DECL_LINK(NumFormatValueHdl, void*);
+
+    // constructor/destuctor
+    NumberFormatPropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~NumberFormatPropertyPanel();
+
+    void Initialize();
+};
+
+} } // end of namespace ::sc::sidebar
+
+#endif SC_PROPERTYPANEL_NUMFORMAT_HXX
+
+// eof
diff --git a/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.src b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.src
new file mode 100755
index 0000000..84caf03
--- /dev/null
+++ b/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.src
@@ -0,0 +1,187 @@
+/**************************************************************
+ * 
+ * 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 "NumberFormatPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include "sc.hrc"
+#include "helpids.h"
+
+Control RID_PROPERTYPANEL_SC_NUMBERFORMAT
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PROPERTYPAGE_HEIGHT );
+	HelpID = HID_PROPERTYPANEL_SC_NUM_SECTION ;	
+	Text = "Number Format";
+	
+	FixedText FT_CATEGORY
+	{
+		Pos = MAP_APPFONT ( FT_CATEGORY_X , FT_CATEGORY_Y ) ;
+		Size = MAP_APPFONT ( MBOX_WIDTH*4 , TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Category:" ;
+	};
+	ListBox LB_CATEGORY
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( LB_CATEGORY_X , LB_CATEGORY_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH *2 , MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY;
+        QuickHelpText [ en-US ] = "Select a category of contents.";
+        TabStop = TRUE ;
+		DropDown = TRUE ;
+		StringList [ en-US ] =
+		{
+			< "General" ; Default ; > ;
+			< "Number" ;> ;
+			< "Percent" ;> ;
+			< "Currency" ;> ;
+			< "Date" ;> ;
+			< "Time" ;> ;
+			< "Scientific" ;> ;
+			< "Fraction" ;> ;
+			< "Boolean Value" ;> ;
+			< "Text" ;> ;
+		};
+	};
+	ToolBox TBX_CATEGORY
+	{
+        Pos = MAP_APPFONT ( TBX_CATEGORY_X , TBX_CATEGORY_Y );
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY;
+		Text = "Format";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = ID_NUMBER ;
+				Text [ en-US ] = "Number" ;	
+				HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER;		
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_PERCENT ;
+				Text [ en-US ] = "Percent" ;	
+				HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT;			
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_CURRENCY ;
+				Text [ en-US ] = "Currency" ;
+				HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY;		
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_DATE ;
+				Text [ en-US ] = "Date" ;
+				HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_DATE;			
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_TEXT ;
+				Text [ en-US ] = "Text" ;
+				HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_TEXT;			
+			};
+		};
+	};
+	FixedText FT_DECIMALS
+	{
+        Pos = MAP_APPFONT ( FT_DECIMALS_X , FT_DECIMALS_Y ) ;
+		Size = MAP_APPFONT ( MBOX_WIDTH *2, TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Decimal places:" ;
+	};
+	NumericField ED_DECIMALS
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( LB_DECIMALS_X , LB_DECIMALS_Y ) ;
+		Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
+		HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS;
+		QuickHelpText [ en-US ] = "Enter the number of decimal places that you want to display.";
+		Spin = TRUE ;
+		Maximum = 20 ;
+		Last = 15 ;
+		First = 0 ;
+		StrictFormat = TRUE ;
+		SpinSize = 1 ;
+		Repeat = TRUE ;
+	};
+	FixedText FT_LEADZEROES
+	{
+        Pos = MAP_APPFONT ( FT_LEADZEROES_X , FT_LEADZEROES_Y ) ;
+		Size = MAP_APPFONT (PROPERTYPAGE_WIDTH -  MBOX_WIDTH *2 - SECTIONPAGE_MARGIN_HORIZONTAL * 2, TEXT_HEIGHT ) ; // 
+		Text [ en-US ] = "Leading ~zeroes:" ;
+	};
+	NumericField ED_LEADZEROES
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( LB_LEADZEROES_X , LB_LEADZEROES_Y ) ;
+		Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
+		HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES;
+		QuickHelpText [ en-US ] = "Enter the maximum number of zeroes to display before the decimal point.";
+		Spin = TRUE ;
+		Maximum = 20 ;
+		Last = 15 ;
+		First = 0 ;
+		StrictFormat = TRUE ;
+		SpinSize = 1 ;
+		Repeat = TRUE ;
+	};
+	CheckBox BTN_NEGRED
+	{
+        Pos = MAP_APPFONT ( BTN_NEGRED_X , BTN_NEGRED_Y ) ;
+		Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ;
+		HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED;
+		QuickHelpText [ en-US ] = "Changes the font color of negative numbers to red.";
+		Text [ en-US ] = "~Negative numbers red" ;
+	};
+	CheckBox BTN_THOUSAND
+	{
+        Pos = MAP_APPFONT ( BTN_THOUSAND_X , BTN_THOUSAND_Y ) ;
+		Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ;
+		HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND;
+		QuickHelpText [ en-US ] = "Inserts a separator between thousands.";
+		Text [ en-US ] = "~Thousands separator" ;
+	};
+	Image IMG_NUMBER
+	{
+		ImageBitmap = Bitmap{File = "sidebar/123.png";};
+	};
+	Image IMG_PERCENT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/percent.png";};
+	};
+	Image IMG_CURRENCY
+	{
+		ImageBitmap = Bitmap{File = "sidebar/money.png";};
+	};
+	Image IMG_DATE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/canlendar.png";};
+	};
+	Image IMG_TEXT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/ABC.png";};
+	};
+};
+
+// eof
diff --git a/main/sc/source/ui/sidebar/ScPanelFactory.cxx b/main/sc/source/ui/sidebar/ScPanelFactory.cxx
new file mode 100755
index 0000000..dc946da
--- /dev/null
+++ b/main/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -0,0 +1,173 @@
+/**************************************************************
+ * 
+ * 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_sc.hxx"
+
+#include "ScPanelFactory.hxx"
+
+#include <AlignmentPropertyPanel.hxx>
+#include <CellAppearancePropertyPanel.hxx>
+#include <NumberFormatPropertyPanel.hxx>
+#include <navipi.hxx>
+#include <dwfunctr.hxx>
+#include "sc.hrc"
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <rtl/ref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <boost/bind.hpp>
+
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+namespace sc { namespace sidebar {
+
+#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sc.sidebar.ScPanelFactory"
+#define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
+
+
+::rtl::OUString SAL_CALL ScPanelFactory::getImplementationName (void)
+{
+    return A2S(IMPLEMENTATION_NAME);
+}
+
+
+cssu::Reference<cssu::XInterface> SAL_CALL ScPanelFactory::createInstance(
+    const uno::Reference<lang::XMultiServiceFactory>& )
+{
+    ::rtl::Reference<ScPanelFactory> pPanelFactory (new ScPanelFactory());
+    cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY);
+    return xService;
+}
+
+
+cssu::Sequence<OUString> SAL_CALL ScPanelFactory::getSupportedServiceNames (void)
+{
+    cssu::Sequence<OUString> aServiceNames (1);
+    aServiceNames[0] = A2S(SERVICE_NAME);
+    return aServiceNames;
+
+}
+
+
+ScPanelFactory::ScPanelFactory (void)
+    : PanelFactoryInterfaceBase(m_aMutex)
+{
+}
+
+
+ScPanelFactory::~ScPanelFactory (void)
+{
+}
+
+
+Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
+    const ::rtl::OUString& rsResourceURL,
+    const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        container::NoSuchElementException,
+        lang::IllegalArgumentException,
+        RuntimeException)
+{
+    Reference<ui::XUIElement> xElement;
+
+    const ::comphelper::NamedValueCollection aArguments (rArguments);
+    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+    const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( ! xParentWindow.is() || pParentWindow==NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without ParentWindow"),
+            NULL);
+    if ( ! xFrame.is())
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without Frame"),
+            NULL);
+    if (pBindings == NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without SfxBindings"),
+            NULL);
+
+#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
+    if (DoesResourceEndWith("/AlignmentPropertyPanel"))
+    {
+        AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(-1,-1,-1));
+    }
+    else if (DoesResourceEndWith("/CellAppearancePropertyPanel"))
+    {
+        CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(-1,-1,-1));
+    }
+    else if (DoesResourceEndWith("/NumberFormatPropertyPanel"))
+    {
+        NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(-1,-1,-1));
+    }
+    else if (DoesResourceEndWith("/NavigatorPanel"))
+    {
+        Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(0,-1,-1));
+    }
+    else if (DoesResourceEndWith("/FunctionsPanel"))
+    {
+        Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(0,-1,-1));
+    }
+#undef DoesResourceEndWith
+
+    return xElement;
+}
+
+} } // end of namespace sc::sidebar
+
+// eof
diff --git a/main/sc/source/ui/sidebar/makefile.mk b/main/sc/source/ui/sidebar/makefile.mk
new file mode 100755
index 0000000..4c20fec
--- /dev/null
+++ b/main/sc/source/ui/sidebar/makefile.mk
@@ -0,0 +1,56 @@
+#**************************************************************
+#  
+#  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.
+#  
+#**************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sc
+TARGET=sidebar
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :  settings.mk
+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =  \
+    AlignmentPropertyPanel.src          \
+    CellAppearancePropertyPanel.src     \
+    NumberFormatPropertyPanel.src
+
+SLOFILES = \
+    $(SLO)$/ScPanelFactory.obj                  \
+    $(SLO)$/AlignmentPropertyPanel.obj          \
+    $(SLO)$/CellLineStyleControl.obj            \
+    $(SLO)$/CellLineStylePopup.obj              \
+    $(SLO)$/CellLineStyleValueSet.obj           \
+    $(SLO)$/CellBorderUpdater.obj               \
+    $(SLO)$/CellAppearancePropertyPanel.obj     \
+    $(SLO)$/CellBorderStyleControl.obj          \
+    $(SLO)$/CellBorderStylePopup.obj            \
+    $(SLO)$/NumberFormatPropertyPanel.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE :  target.mk
+
diff --git a/main/sc/source/ui/unoobj/appluno.cxx b/main/sc/source/ui/unoobj/appluno.cxx
index 78c4528..2db15af 100644
--- a/main/sc/source/ui/unoobj/appluno.cxx
+++ b/main/sc/source/ui/unoobj/appluno.cxx
@@ -45,6 +45,7 @@
 #include "unonames.hxx"
 #include "funcdesc.hxx"
 #include <com/sun/star/sheet/FunctionArgument.hpp>
+#include "ScPanelFactory.hxx"
 
 using namespace com::sun::star;
 
@@ -198,154 +199,189 @@
 	rtl::OUString aImpl(rtl::OUString::createFromAscii(pImplName));
 
 	if ( aImpl == ScSpreadsheetSettings::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createOneInstanceFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScSpreadsheetSettings::getImplementationName_Static(),
 				ScSpreadsheetSettings_CreateInstance,
 				ScSpreadsheetSettings::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() )
+    }
+	else if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createOneInstanceFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScRecentFunctionsObj::getImplementationName_Static(),
 				ScRecentFunctionsObj_CreateInstance,
 				ScRecentFunctionsObj::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScFunctionListObj::getImplementationName_Static() )
+    }
+	else if ( aImpl == ScFunctionListObj::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createOneInstanceFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScFunctionListObj::getImplementationName_Static(),
 				ScFunctionListObj_CreateInstance,
 				ScFunctionListObj::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() )
+    }
+	else if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createOneInstanceFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScAutoFormatsObj::getImplementationName_Static(),
 				ScAutoFormatsObj_CreateInstance,
 				ScAutoFormatsObj::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScFunctionAccess::getImplementationName_Static() )
+    }
+	else if ( aImpl == ScFunctionAccess::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createOneInstanceFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScFunctionAccess::getImplementationName_Static(),
 				ScFunctionAccess_CreateInstance,
 				ScFunctionAccess::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() )
+    }
+	else if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScFilterOptionsObj::getImplementationName_Static(),
 				ScFilterOptionsObj_CreateInstance,
 				ScFilterOptionsObj::getSupportedServiceNames_Static() ));
-
-	if ( aImpl == ScXMLImport_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLImport_getImplementationName() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLImport_getImplementationName(),
 				ScXMLImport_createInstance,
 				ScXMLImport_getSupportedServiceNames() ));
-
-	if ( aImpl == ScXMLImport_Meta_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLImport_Meta_getImplementationName() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLImport_Meta_getImplementationName(),
 				ScXMLImport_Meta_createInstance,
 				ScXMLImport_Meta_getSupportedServiceNames() ));
-
-	if ( aImpl == ScXMLImport_Styles_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLImport_Styles_getImplementationName() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLImport_Styles_getImplementationName(),
 				ScXMLImport_Styles_createInstance,
 				ScXMLImport_Styles_getSupportedServiceNames() ));
-
-	if ( aImpl == ScXMLImport_Content_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLImport_Content_getImplementationName() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLImport_Content_getImplementationName(),
 				ScXMLImport_Content_createInstance,
 				ScXMLImport_Content_getSupportedServiceNames() ));
-
-	if ( aImpl == ScXMLImport_Settings_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLImport_Settings_getImplementationName() )
+    {
 		xFactory.set(cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLImport_Settings_getImplementationName(),
 				ScXMLImport_Settings_createInstance,
 				ScXMLImport_Settings_getSupportedServiceNames() ));
-
-	if ( aImpl == ScXMLOOoExport_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOOoExport_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOOoExport_getImplementationName(),
 				ScXMLOOoExport_createInstance,
 				ScXMLOOoExport_getSupportedServiceNames() );
-
-	if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOOoExport_Meta_getImplementationName(),
 				ScXMLOOoExport_Meta_createInstance,
 				ScXMLOOoExport_Meta_getSupportedServiceNames() );
-
-	if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOOoExport_Styles_getImplementationName(),
 				ScXMLOOoExport_Styles_createInstance,
 				ScXMLOOoExport_Styles_getSupportedServiceNames() );
-
-	if ( aImpl == ScXMLOOoExport_Content_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOOoExport_Content_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOOoExport_Content_getImplementationName(),
 				ScXMLOOoExport_Content_createInstance,
 				ScXMLOOoExport_Content_getSupportedServiceNames() );
-
-	if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOOoExport_Settings_getImplementationName(),
 				ScXMLOOoExport_Settings_createInstance,
 				ScXMLOOoExport_Settings_getSupportedServiceNames() );
-
-	if ( aImpl == ScXMLOasisExport_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOasisExport_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOasisExport_getImplementationName(),
 				ScXMLOasisExport_createInstance,
 				ScXMLOasisExport_getSupportedServiceNames() );
-	if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOasisExport_Meta_getImplementationName(),
 				ScXMLOasisExport_Meta_createInstance,
 				ScXMLOasisExport_Meta_getSupportedServiceNames() );
-	if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOasisExport_Styles_getImplementationName(),
 				ScXMLOasisExport_Styles_createInstance,
 				ScXMLOasisExport_Styles_getSupportedServiceNames() );
-	if ( aImpl == ScXMLOasisExport_Content_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOasisExport_Content_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOasisExport_Content_getImplementationName(),
 				ScXMLOasisExport_Content_createInstance,
 				ScXMLOasisExport_Content_getSupportedServiceNames() );
-	if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() )
+    }
+	else if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() )
+    {
 		xFactory = cppu::createSingleFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScXMLOasisExport_Settings_getImplementationName(),
 				ScXMLOasisExport_Settings_createInstance,
 				ScXMLOasisExport_Settings_getSupportedServiceNames() );
-
-	if ( aImpl == ScDocument_getImplementationName() )
+    }
+	else if ( aImpl == ScDocument_getImplementationName() )
+    {
 		xFactory.set(sfx2::createSfxModelFactory(
 				reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
 				ScDocument_getImplementationName(),
 				ScDocument_createInstance,
 				ScDocument_getSupportedServiceNames() ));
+    }
+    else if ( aImpl == ::sc::sidebar::ScPanelFactory::getImplementationName() )
+    {
+        xFactory = ::cppu::createSingleFactory( 
+            reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
+            ::sc::sidebar::ScPanelFactory::getImplementationName(),
+            ::sc::sidebar::ScPanelFactory::createInstance,
+            ::sc::sidebar::ScPanelFactory::getSupportedServiceNames() );
+    }
 
 	void* pRet = NULL;
 	if (xFactory.is())
diff --git a/main/sc/source/ui/view/auditsh.cxx b/main/sc/source/ui/view/auditsh.cxx
index 9d9b083..d31abf6 100644
--- a/main/sc/source/ui/view/auditsh.cxx
+++ b/main/sc/source/ui/view/auditsh.cxx
@@ -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 @@
     }
 	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 @@
 {
 	rSet.Put( SfxBoolItem( nFunction, sal_True ) );			// aktive Funktion markieren
 }
-
-
diff --git a/main/sc/source/ui/view/cellsh.cxx b/main/sc/source/ui/view/cellsh.cxx
index 4acc8d3..c2483a7 100644
--- a/main/sc/source/ui/view/cellsh.cxx
+++ b/main/sc/source/ui/view/cellsh.cxx
@@ -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 @@
 {
 	SetHelpId(HID_SCSHELL_CELLSH);
 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Cell")));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Cell));
 }
 
 ScCellShell::~ScCellShell()
diff --git a/main/sc/source/ui/view/cellsh3.cxx b/main/sc/source/ui/view/cellsh3.cxx
index 50421d7..1b091ed 100644
--- a/main/sc/source/ui/view/cellsh3.cxx
+++ b/main/sc/source/ui/view/cellsh3.cxx
@@ -360,6 +360,14 @@
 			pTabViewShell->ExecuteCellFormatDlg( rReq, TP_ALIGNMENT );
 			break;
 
+		case SID_CELL_FORMAT_BORDER:
+			pTabViewShell->ExecuteCellFormatDlg( rReq, TP_BORDER );
+			break;
+
+		case SID_CHAR_DLG_EFFECT:
+			pTabViewShell->ExecuteCellFormatDlg( rReq, TP_FONTEFF );
+			break;
+
 		case SID_OPENDLG_SOLVE:
 			{
 				sal_uInt16			nId  = ScSolverDlgWrapper::GetChildWindowId();
diff --git a/main/sc/source/ui/view/drawview.cxx b/main/sc/source/ui/view/drawview.cxx
index baa3c00..0a8b80b 100644
--- a/main/sc/source/ui/view/drawview.cxx
+++ b/main/sc/source/ui/view/drawview.cxx
@@ -225,6 +225,10 @@
 	rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
 	rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
 	rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );			
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
 	rBindings.Invalidate( SID_ALIGNLEFT );
 	rBindings.Invalidate( SID_ALIGNCENTERHOR );
 	rBindings.Invalidate( SID_ALIGNRIGHT );
@@ -234,6 +238,9 @@
 	rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
 	rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
 	rBindings.Invalidate( SID_SET_SUB_SCRIPT );
+	rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); 
+	rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+	rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); 
 	rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
 	rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
 	rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
diff --git a/main/sc/source/ui/view/editsh.cxx b/main/sc/source/ui/view/editsh.cxx
index b8c5169..9c872ae 100644
--- a/main/sc/source/ui/view/editsh.cxx
+++ b/main/sc/source/ui/view/editsh.cxx
@@ -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 @@
 	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()
@@ -331,6 +333,17 @@
 					pTableView->SetSelection(ESelection(0,0,nPar-1,nLen));
 					if (pTopView)
 						pTopView->SetSelection(ESelection(0,0,nPar-1,nLen));
+					rBindings.Invalidate( SID_ATTR_CHAR_FONT );
+					rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+					rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
+					rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
+					rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
+					rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+					rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); 
+					rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); 
+					rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
+					rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
+					rBindings.Invalidate( SID_SET_SUB_SCRIPT );
 				}
                 bSetModified = sal_False;
 			}
@@ -453,6 +466,7 @@
 			}
 			break;
 
+		case SID_CHAR_DLG_EFFECT:
 		case SID_CHAR_DLG:
 			{
 				SfxItemSet aAttrs( pTableView->GetAttribs() );
@@ -466,6 +480,10 @@
 				SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &aAttrs,
 																	 pObjSh, RID_SCDLG_CHAR );
 				DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
+				if (nSlot == SID_CHAR_DLG_EFFECT)
+				{
+					pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
+				}
 				short nRet = pDlg->Execute();
 				// pDlg is needed below
 
@@ -988,6 +1006,15 @@
 				rBindings.Invalidate( nSlot );
 			}
 			break;
+		case SID_ATTR_CHAR_KERNING:
+			{
+				if(pArgs)
+				{
+					aSet.Put ( pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
+					rBindings.Invalidate( nSlot );  
+				}
+			}
+			break;
 	}
 
 	//
@@ -1074,6 +1101,27 @@
 	ScInputHandler* pHdl = GetMyInputHdl();
 	if ( pHdl && pHdl->IsFormulaMode() )
 		rSet.ClearItem( EE_CHAR_WEIGHT );	// hervorgehobene Klammern hier nicht
+
+	SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+					aAttribs.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+	if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+	{
+		rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
+	}
+	else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+	{
+		rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
+	}
+	pViewData->GetBindings().Invalidate( SID_SET_SUPER_SCRIPT );	
+	pViewData->GetBindings().Invalidate( SID_SET_SUB_SCRIPT );
+
+	eState = aAttribs.GetItemState( EE_CHAR_KERNING, sal_True );
+	pViewData->GetBindings().Invalidate( SID_ATTR_CHAR_KERNING );
+	if ( eState == SFX_ITEM_DONTCARE )
+	{
+	//	rSet.InvalidateItem( SID_ATTR_CHAR_KERNING );
+		rSet.InvalidateItem(EE_CHAR_KERNING);
+	}
 }
 
 String ScEditShell::GetSelectionText( sal_Bool bWholeWord )
@@ -1202,4 +1250,3 @@
 		pHdl->DataChanged();
 	}
 }
-
diff --git a/main/sc/source/ui/view/formatsh.cxx b/main/sc/source/ui/view/formatsh.cxx
index 989fe38..1855383 100644
--- a/main/sc/source/ui/view/formatsh.cxx
+++ b/main/sc/source/ui/view/formatsh.cxx
@@ -990,13 +990,97 @@
 			break;
 
 		case SID_NUMBER_FORMAT:
-			if ( pReqArgs )
+			//if ( pReqArgs )
+			//{
+			//	const SfxPoolItem* pItem;
+			//	if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET)
+			//	{
+			//		String aCode = ((const SfxStringItem*)pItem)->GetValue();
+			//		pTabViewShell->SetNumFmtByStr( aCode );
+			//	}
+			//}
+
+            // symphony version with format interpretation
+			if(pReqArgs)
 			{
 				const SfxPoolItem* pItem;
-				if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET)
+				ScDocument* pDoc = pViewData->GetDocument();
+				SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+				LanguageType eLanguage = ScGlobal::eLnge;
+				sal_Int16 eType = -1;
+				sal_uInt32 nCurrentNumberFormat;
+				
+                pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
+				const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
+
+                if(pEntry)
+				{
+					eLanguage = pEntry->GetLanguage();
+					eType = pEntry->GetType();
+				}
+
+				//Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY
+				//In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable
+				switch(eType)
+				{
+				case NUMBERFORMAT_ALL:
+				case NUMBERFORMAT_NUMBER:
+				case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED:
+				case NUMBERFORMAT_PERCENT:
+				case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED:
+				case NUMBERFORMAT_CURRENCY:
+				case NUMBERFORMAT_CURRENCY|NUMBERFORMAT_DEFINED:
+					eType = 0; 
+					break;
+				default:
+					eType =-1;
+				}
+				
+				if(SFX_ITEM_SET == pReqArgs->GetItemState(nSlot, true, &pItem) && eType != -1)
 				{
 					String aCode = ((const SfxStringItem*)pItem)->GetValue();
-					pTabViewShell->SetNumFmtByStr( aCode );
+					sal_uInt16 aLen = aCode.Len();
+					String* sFormat = new String[4];
+					String sTmpStr = String::CreateFromAscii(""); 
+					sal_uInt16 nCount(0);
+					sal_uInt16 nStrCount(0);
+
+					while(nCount < aLen)
+					{
+						sal_Unicode cChar = aCode.GetChar(nCount);
+
+						if(cChar == sal_Unicode(','))
+						{
+							sFormat[nStrCount] = sTmpStr;
+							sTmpStr = String::CreateFromAscii("");
+							nStrCount++;
+						}
+						else
+						{
+							sTmpStr += cChar;
+						}
+
+						nCount++;
+
+						if(nStrCount > 3)
+							break;
+					}
+
+					const sal_Bool bThousand = (sal_Bool)sFormat[0].ToInt32();
+					const sal_Bool bNegRed = (sal_Bool)sFormat[1].ToInt32();
+					const sal_uInt16 nPrecision = (sal_uInt16)sFormat[2].ToInt32();
+					const sal_uInt16 nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32();
+
+					pFormatter->GenerateFormat(
+                        aCode, 
+                        nCurrentNumberFormat,//modify
+						eLanguage,
+						bThousand,
+						bNegRed,
+						nPrecision,
+						nLeadZeroes);
+					pTabViewShell->SetNumFmtByStr(aCode);
+					delete[] sFormat;
 				}
 			}
 			break;
@@ -1020,7 +1104,50 @@
 			}
 			break;
 
-		default:
+		case SID_NUMBER_TYPE_FORMAT:
+			{
+				SfxInt16Item aFormatItem((const SfxInt16Item&)rReq.GetArgs()->Get(nSlot));
+				sal_uInt16 nFormat = aFormatItem.GetValue();
+				switch(nFormat)
+				{
+				case 0:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER); //Modify
+					break;
+				case 1:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER, 2 ); //Modify
+					break;
+				case 2:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT );
+					break;
+				case 3:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY );
+					break;
+				case 4:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE );
+					break;
+				case 5:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME );
+					break;
+				case 6:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC );
+					break;
+				case 7:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_FRACTION );
+					break;
+				case 8:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_LOGICAL );
+					break;
+				case 9:
+					pTabViewShell->SetNumberFormat( NUMBERFORMAT_TEXT );
+					break;
+				default:
+					;
+				}	
+				rReq.Done();
+			}
+			break;
+
+        default:
 			DBG_ERROR("falscher Slot bei ExecuteEdit");
 			break;
 	}
@@ -1109,7 +1236,10 @@
                 }
             }
     }
-
+    rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );			
+    rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
+    rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
+    rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
     rBindings.Invalidate( SID_ALIGNLEFT );
     rBindings.Invalidate( SID_ALIGNRIGHT );
     rBindings.Invalidate( SID_ALIGNCENTERHOR );
@@ -1622,6 +1752,44 @@
 				}
 				break;
 
+			case SID_ATTR_BORDER_DIAG_TLBR:
+			case SID_ATTR_BORDER_DIAG_BLTR:
+				{
+					ScDocument* pDoc = GetViewData()->GetDocument();
+					const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
+					SfxItemSet* pOldSet = new SfxItemSet(pOldAttrs->GetItemSet());
+					SfxItemSet* pNewSet = new SfxItemSet(pOldAttrs->GetItemSet());
+					const SfxPoolItem* pItem = 0;
+
+                    if(SID_ATTR_BORDER_DIAG_TLBR == nSlot)
+					{
+						if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem))
+						{
+							SvxLineItem aItem(ATTR_BORDER_TLBR);
+							aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine());
+							pNewSet->Put(aItem);
+							rReq.AppendItem(aItem);
+							pTabViewShell->ApplyAttributes(pNewSet, pOldSet);
+						}
+					}
+					else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR )
+					{
+						if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem ))
+						{
+							SvxLineItem aItem(ATTR_BORDER_BLTR);
+							aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine());
+							pNewSet->Put(aItem);
+							rReq.AppendItem(aItem);
+							pTabViewShell->ApplyAttributes(pNewSet, pOldSet);
+						}
+					}
+
+                    delete pOldSet;
+					delete pNewSet;
+					rBindings.Invalidate(nSlot);
+				}
+				break;
+
 			// ATTR_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
 			// gesetzt werden:
 			case SID_BACKGROUND_COLOR:
@@ -1700,11 +1868,184 @@
 			case SID_BACKGROUND_COLOR:
 			{
                 rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) );
+
+                if(SFX_ITEM_DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND))
+                {
+                    rSet.InvalidateItem(SID_BACKGROUND_COLOR);
+                }
 			}
 			break;
+    		case SID_FRAME_LINESTYLE:
 			case SID_FRAME_LINECOLOR:
 			{
-                rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
+                // handled together because both need the cell border information for decisions
+                // rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
+				Color aCol = 0;
+				sal_uInt16 nOut = 0, nIn = 0, nDis = 0;
+				SvxBorderLine aLine(0,0,0,0);
+				bool bCol = 0;
+				bool bColDisable = 0, bStyleDisable = 0;
+                SvxBoxItem aBoxItem(ATTR_BORDER);
+                SvxBoxInfoItem aInfoItem(ATTR_BORDER_INNER);
+
+                pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem);
+
+				if( aBoxItem.GetTop() ) 
+				{
+					bCol = 1;
+					aCol = aBoxItem.GetTop()->GetColor() ;
+					aLine.SetColor(aCol);
+					aLine.SetOutWidth( aBoxItem.GetTop()->GetOutWidth());
+					aLine.SetInWidth( aBoxItem.GetTop()->GetInWidth());
+					aLine.SetDistance( aBoxItem.GetTop()->GetDistance());
+				}
+				
+                if( aBoxItem.GetBottom() )
+				{
+					if(bCol == 0)
+					{
+						bCol = 1;
+						aCol = aBoxItem.GetBottom()->GetColor() ;
+						aLine.SetColor(aCol);
+						aLine.SetOutWidth( aBoxItem.GetBottom()->GetOutWidth());
+						aLine.SetInWidth( aBoxItem.GetBottom()->GetInWidth());
+						aLine.SetDistance( aBoxItem.GetBottom()->GetDistance());
+					}
+					else
+					{
+						if(aCol != aBoxItem.GetBottom()->GetColor() )
+							bColDisable = 1;
+						if(!( aLine == *(aBoxItem.GetBottom())) )
+							bStyleDisable = 1;
+					}
+				}
+				
+                if( aBoxItem.GetLeft() )
+				{
+					if(bCol == 0)
+					{
+						bCol = 1;
+						aCol = aBoxItem.GetLeft()->GetColor() ;
+						aLine.SetColor(aCol);
+						aLine.SetOutWidth( aBoxItem.GetLeft()->GetOutWidth());
+						aLine.SetInWidth( aBoxItem.GetLeft()->GetInWidth());
+						aLine.SetDistance( aBoxItem.GetLeft()->GetDistance());
+					}
+					else
+					{
+						if(aCol != aBoxItem.GetLeft()->GetColor() )
+							bColDisable = 1;
+						if(!( aLine == *(aBoxItem.GetLeft())) )
+							bStyleDisable = 1;
+					}
+				}
+				
+                if( aBoxItem.GetRight() )
+				{
+					if(bCol == 0)
+					{
+						bCol = 1;
+						aCol = aBoxItem.GetRight()->GetColor() ;
+						aLine.SetColor(aCol);
+						aLine.SetOutWidth( aBoxItem.GetRight()->GetOutWidth());
+						aLine.SetInWidth( aBoxItem.GetRight()->GetInWidth());
+						aLine.SetDistance( aBoxItem.GetRight()->GetDistance());
+					}
+					else
+					{
+						if(aCol != aBoxItem.GetRight()->GetColor() )
+							bColDisable = 1;
+						if(!( aLine == *(aBoxItem.GetRight())) )
+							bStyleDisable = 1;
+					}
+				}
+				
+                if( aInfoItem.GetVert())
+				{
+					if(bCol == 0)
+					{
+						bCol = 1;
+						aCol = aInfoItem.GetVert()->GetColor() ;
+						aLine.SetColor(aCol);
+						aLine.SetOutWidth( aInfoItem.GetVert()->GetOutWidth());
+						aLine.SetInWidth( aInfoItem.GetVert()->GetInWidth());
+						aLine.SetDistance( aInfoItem.GetVert()->GetDistance());
+					}
+					else
+					{
+						if(aCol != aInfoItem.GetVert()->GetColor() )
+							bColDisable = 1;
+						if(!( aLine == *(aInfoItem.GetVert())) )
+							bStyleDisable = 1;
+					}
+				}
+				
+                if( aInfoItem.GetHori())
+				{
+					if(bCol == 0)
+					{
+						bCol = 1;
+						aCol = aInfoItem.GetHori()->GetColor() ;
+						aLine.SetColor(aCol);
+						aLine.SetOutWidth( aInfoItem.GetHori()->GetOutWidth());
+						aLine.SetInWidth( aInfoItem.GetHori()->GetInWidth());
+						aLine.SetDistance( aInfoItem.GetHori()->GetDistance());
+					}
+					else
+					{
+						if(aCol != aInfoItem.GetHori()->GetColor() )
+							bColDisable = 1;
+						if(!( aLine == *(aInfoItem.GetHori())) )
+							bStyleDisable = 1;
+					}
+				}
+
+				if( !aInfoItem.IsValid( VALID_VERT ) 
+					|| !aInfoItem.IsValid( VALID_HORI )
+					|| !aInfoItem.IsValid( VALID_LEFT )
+					|| !aInfoItem.IsValid( VALID_RIGHT )
+					|| !aInfoItem.IsValid( VALID_TOP )
+					|| !aInfoItem.IsValid( VALID_BOTTOM ) )
+				{
+					bColDisable = 1;
+					bStyleDisable = 1;
+				}
+
+				if(SID_FRAME_LINECOLOR == nWhich)
+				{
+					if(bColDisable) // if different lines have differernt colors
+					{
+						aCol = COL_TRANSPARENT;
+						rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
+						rSet.InvalidateItem(SID_FRAME_LINECOLOR);
+					}
+					else if( bCol == 0 && bColDisable == 0) // if no line available
+					{
+						aCol = COL_AUTO;	
+						rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
+					}
+					else
+						rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
+				}
+				else // if( nWhich == SID_FRAME_LINESTYLE)
+				{
+					if(bStyleDisable) // if have several lines but don't have same style
+					{
+						aLine.SetOutWidth( 1 );
+						aLine.SetInWidth( 0 );
+						aLine.SetDistance( 0 );
+						SvxLineItem aItem(SID_FRAME_LINESTYLE);
+						aItem.SetLine(&aLine);
+						rSet.Put( aItem );
+						rSet.InvalidateItem(SID_FRAME_LINESTYLE);
+					}
+					else // all the lines have same style or no line availavle, use initial value (0,0,0,0)
+					{
+						SvxLineItem aItem(SID_FRAME_LINESTYLE);
+						aItem.SetLine(&aLine);
+						rSet.Put( aItem );
+					}
+				}
 			}
 			break;
 			case SID_ATTR_BRUSH:
@@ -1722,6 +2063,13 @@
 		}
 		nWhich = aIter.NextWhich();
 	}
+
+    if(nWhich)
+    {
+        // stuff for sidebar panels
+        Invalidate(SID_ATTR_ALIGN_DEGREES);
+        Invalidate(SID_ATTR_ALIGN_STACKED);  
+    }
 }
 
 //------------------------------------------------------------------
@@ -1999,25 +2347,141 @@
 		switch ( nWhich )
 		{
 			case SID_NUMBER_FORMAT:
+				//{
+				//	String aFormatCode;			// bleibt leer, wenn dont-care
+                //
+				//	const SfxItemSet& rAttrSet  = pTabViewShell->GetSelectionPattern()->GetItemSet();
+				//	if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE )
+				//	{
+				//		sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(
+				//									ATTR_VALUE_FORMAT )).GetValue();
+                //
+				//		SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+				//		const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
+				//		if ( pFormatEntry )
+				//			aFormatCode = pFormatEntry->GetFormatstring();
+				//	}
+                //
+				//	rSet.Put( SfxStringItem( nWhich, aFormatCode ) );
+				//}
+
+                // symphony version with format interpretation
 				{
-					String aFormatCode;			// bleibt leer, wenn dont-care
+					const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
 
-					const SfxItemSet& rAttrSet  = pTabViewShell->GetSelectionPattern()->GetItemSet();
-					if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE )
+					if(SFX_ITEM_DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT))
 					{
-						sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(
-													ATTR_VALUE_FORMAT )).GetValue();
-
 						SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-						const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
-						if ( pFormatEntry )
-							aFormatCode = pFormatEntry->GetFormatstring();
-					}
+						sal_uInt32 nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
+						sal_Bool bThousand(false);
+						sal_Bool bNegRed(false);
+						sal_uInt16 nPrecision(0);
+						sal_uInt16 nLeadZeroes(0);
 
-					rSet.Put( SfxStringItem( nWhich, aFormatCode ) );
+                        pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes);
+						String aFormat;
+						static String sBreak = String::CreateFromAscii(",");
+						const String sThousand = String::CreateFromInt32(bThousand);
+						const String sNegRed = String::CreateFromInt32(bNegRed);
+						const String sPrecision = String::CreateFromInt32(nPrecision);
+						const String sLeadZeroes = String::CreateFromInt32(nLeadZeroes);
+
+						aFormat += sThousand;
+						aFormat += sBreak;
+						aFormat += sNegRed;
+						aFormat += sBreak;
+						aFormat += sPrecision;
+						aFormat += sBreak;
+						aFormat += sLeadZeroes;
+						aFormat += sBreak;
+
+						rSet.Put(SfxStringItem(nWhich, aFormat));
+					}
+					else
+					{
+						rSet.InvalidateItem( nWhich );
+					}
 				}
 				break;
 
+			case SID_NUMBER_TYPE_FORMAT:
+				{
+					sal_Int16 aFormatCode = -1;
+					const SfxItemSet& rAttrSet  = pTabViewShell->GetSelectionPattern()->GetItemSet();					
+					if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) >= SFX_ITEM_AVAILABLE ) //Modify for more robust
+					{
+						SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+						sal_uInt32 nNumberFormat = pTabViewShell->GetSelectionPattern()->GetNumberFormat( pFormatter );
+						const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
+						bool bStandard = false;
+
+						if ( pFormatEntry )
+						{
+							aFormatCode = pFormatEntry->GetType();
+							bStandard = pFormatEntry->IsStandard();
+						}
+
+                        switch(aFormatCode)
+						{
+						case NUMBERFORMAT_NUMBER:
+						case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED:    
+							//use format code and standard format code to judge whether it is General,
+							//if (nNumberFormat == nStandardNumberFormat)
+							if (bStandard)
+								aFormatCode = 0;
+							else
+                                aFormatCode = 1;
+							break;
+						case NUMBERFORMAT_PERCENT:
+						case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED:
+							aFormatCode = 2;
+							break;
+						case NUMBERFORMAT_CURRENCY:
+						case NUMBERFORMAT_CURRENCY| NUMBERFORMAT_DEFINED:
+							aFormatCode = 3;
+							break;
+						case NUMBERFORMAT_DATE:
+						case NUMBERFORMAT_DATE| NUMBERFORMAT_DEFINED:
+							//Add
+						case NUMBERFORMAT_DATETIME:
+						case NUMBERFORMAT_DATETIME | NUMBERFORMAT_DEFINED:
+							aFormatCode = 4;
+							break;
+						case NUMBERFORMAT_TIME:
+						case NUMBERFORMAT_TIME| NUMBERFORMAT_DEFINED:
+							aFormatCode = 5;
+							break;
+						case NUMBERFORMAT_SCIENTIFIC:
+						case NUMBERFORMAT_SCIENTIFIC| NUMBERFORMAT_DEFINED:
+							aFormatCode = 6;
+							break;
+						case NUMBERFORMAT_FRACTION:
+						case NUMBERFORMAT_FRACTION| NUMBERFORMAT_DEFINED:
+							aFormatCode = 7;
+							break;
+						case NUMBERFORMAT_LOGICAL:
+						case NUMBERFORMAT_LOGICAL| NUMBERFORMAT_DEFINED:
+							aFormatCode = 8;
+							break;
+						case NUMBERFORMAT_TEXT:
+						case NUMBERFORMAT_TEXT| NUMBERFORMAT_DEFINED:
+							aFormatCode = 9;
+							break;
+						default:
+							aFormatCode = -1;	//for more roburst							
+						}
+						if( aFormatCode == -1 )
+							rSet.InvalidateItem( nWhich );
+						else
+							rSet.Put( SfxInt16Item( nWhich, aFormatCode ) );
+					}
+					else
+					{
+						rSet.InvalidateItem( nWhich );
+					}
+					
+				}
+				break;
 		}
 		nWhich = aIter.NextWhich();
 	}
@@ -2168,3 +2632,52 @@
         rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) );
 }
 
+void  ScFormatShell::ExecViewOptions( SfxRequest& rReq )
+{
+	ScTabViewShell*	pTabViewShell  		= GetViewData()->GetViewShell();
+	SfxBindings&		rBindings = pViewData->GetBindings();
+	const SfxItemSet*	pNewAttrs = rReq.GetArgs();
+
+	if ( pNewAttrs )
+	{
+		sal_uInt16 nSlot = rReq.GetSlot();
+
+		if( nSlot  == SID_SCGRIDSHOW)
+		{
+
+			ScViewData*				pViewData = pTabViewShell->GetViewData();
+			const ScViewOptions&	rOldOpt	  = pViewData->GetOptions();
+			ScDocShell*				pDocSh  = PTR_CAST(ScDocShell, SfxObjectShell::Current());
+			bool bState =	((const SfxBoolItem &)pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) )).GetValue();
+
+			if ( (bool)rOldOpt.GetOption( VOPT_GRID ) !=  bState)
+			{
+				ScViewOptions rNewOpt(rOldOpt);
+				rNewOpt.SetOption( VOPT_GRID,  bState);
+				pViewData->SetOptions( rNewOpt );	
+				pViewData->GetDocument()->SetViewOptions( rNewOpt );
+				pDocSh->SetDocumentModified();
+				//add , write the change to sc view config 
+				ScModule*			pScMod		= SC_MOD();	
+				pScMod->SetViewOptions( rNewOpt );
+				//add end
+				rBindings.Invalidate( nSlot );
+			}
+		}
+	}
+
+}
+
+void  ScFormatShell::GetViewOptions( SfxItemSet& rSet )
+{
+	ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
+	if( pTabViewShell )
+	{
+		ScViewOptions	aViewOpt = pTabViewShell->GetViewData()->GetOptions();
+		rSet.ClearItem(SID_SCGRIDSHOW);
+		SfxBoolItem aItem( SID_SCGRIDSHOW, aViewOpt.GetOption( VOPT_GRID ) );
+		rSet.Put(aItem);
+	}
+}
+
+// eof
diff --git a/main/sc/source/ui/view/gridwin.cxx b/main/sc/source/ui/view/gridwin.cxx
index 6d2a552..cae6fb7 100644
--- a/main/sc/source/ui/view/gridwin.cxx
+++ b/main/sc/source/ui/view/gridwin.cxx
@@ -1903,7 +1903,20 @@
 	}
 
 	if (DrawMouseButtonUp(rMEvt))       // includes format paint brush handling for drawing objects
-		return;
+    {
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings();
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH);
+        rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT);
+        return;
+    }
 
 	rMark.SetMarking(sal_False);
 
@@ -3077,8 +3090,21 @@
 		if (pViewData->GetDocShell()->GetProgress())
 			return;
 
-		if (DrawKeyInput(rKEvt))
+        if (DrawKeyInput(rKEvt))
+        {
+            const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+            if (rKeyCode.GetCode() == KEY_DOWN
+                || rKeyCode.GetCode() == KEY_UP
+                || rKeyCode.GetCode() == KEY_LEFT
+                || rKeyCode.GetCode() == KEY_RIGHT)
+            {
+                ScTabViewShell* pViewShell = pViewData->GetViewShell();
+                SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
+                rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
+                rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y);
+ 			}
 			return;
+        }
 
 		if (!pViewData->GetView()->IsDrawSelMode() && !DrawHasMarkedObj())	//	keine Eingaben im Zeichenmodus
 		{															//! DrawShell abfragen !!!
diff --git a/main/sc/source/ui/view/pivotsh.cxx b/main/sc/source/ui/view/pivotsh.cxx
index db6d36a..66cd0c3 100644
--- a/main/sc/source/ui/view/pivotsh.cxx
+++ b/main/sc/source/ui/view/pivotsh.cxx
@@ -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 @@
     }
 	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 @@
     return rViewData.GetDocument()->GetDPAtCursor(
         rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
 }
-
diff --git a/main/sc/source/ui/view/tabview3.cxx b/main/sc/source/ui/view/tabview3.cxx
index 5fc5659..ce4e012 100644
--- a/main/sc/source/ui/view/tabview3.cxx
+++ b/main/sc/source/ui/view/tabview3.cxx
@@ -230,6 +230,18 @@
 
 	rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
 
+	rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
+	rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
+	rBindings.Invalidate( SID_SET_SUB_SCRIPT );
+	rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+	rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); 
+
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );			
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
+	rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
+	rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT);
+
 	rBindings.Invalidate( SID_ALIGNLEFT );
 	rBindings.Invalidate( SID_ALIGNRIGHT );
 	rBindings.Invalidate( SID_ALIGNBLOCK );
@@ -239,7 +251,22 @@
 	rBindings.Invalidate( SID_ALIGNBOTTOM );
 	rBindings.Invalidate( SID_ALIGNCENTERVER );
 
-	rBindings.Invalidate( SID_BACKGROUND_COLOR );
+    // stuff for sidebar panels
+    {
+        rBindings.Invalidate( SID_H_ALIGNCELL );	
+        rBindings.Invalidate( SID_V_ALIGNCELL );
+        rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
+        rBindings.Invalidate( SID_FRAME_LINECOLOR );
+        rBindings.Invalidate( SID_FRAME_LINESTYLE );
+        rBindings.Invalidate( SID_ATTR_BORDER_OUTER );
+        rBindings.Invalidate( SID_ATTR_BORDER_INNER );
+        rBindings.Invalidate( SID_SCGRIDSHOW ); 
+        rBindings.Invalidate( SID_ATTR_BORDER_DIAG_TLBR );
+        rBindings.Invalidate( SID_ATTR_BORDER_DIAG_BLTR );
+        rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT );
+    }
+
+    rBindings.Invalidate( SID_BACKGROUND_COLOR );
 
 	rBindings.Invalidate( SID_ATTR_ALIGN_LINEBREAK );
 	rBindings.Invalidate( SID_NUMBER_FORMAT );
diff --git a/main/sc/source/ui/view/tabvwsh.cxx b/main/sc/source/ui/view/tabvwsh.cxx
index a27466b..b9c2f0b 100644
--- a/main/sc/source/ui/view/tabvwsh.cxx
+++ b/main/sc/source/ui/view/tabvwsh.cxx
@@ -38,6 +38,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/app.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <avmedia/mediaplayer.hxx>
 
 #include "tabvwsh.hxx"
@@ -65,6 +66,7 @@
 	SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
 	SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
 	SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 	SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId());
 	SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
     SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId());
diff --git a/main/sc/source/ui/view/tabvwsh4.cxx b/main/sc/source/ui/view/tabvwsh4.cxx
index f29a308..f0e9c8a 100644
--- a/main/sc/source/ui/view/tabvwsh4.cxx
+++ b/main/sc/source/ui/view/tabvwsh4.cxx
@@ -39,6 +39,7 @@
 #include <editeng/sizeitem.hxx>
 #include <editeng/boxitem.hxx>
 #include <svx/prtqry.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/printer.hxx>
 #include <sfx2/dispatch.hxx>
@@ -220,6 +221,10 @@
 	//	Wenn Referenzeingabe-Tip-Hilfe hier wieder angezeigt werden soll (ShowRefTip),
 	//	muss sie beim Verschieben der View angepasst werden (gibt sonst Probleme unter OS/2
 	//	beim Umschalten zwischen Dokumenten)
+
+    ContextChangeEventMultiplexer::NotifyContextChange(
+        GetController(),
+        ::sfx2::sidebar::EnumContext::Context_Default);
 }
 
 void __EXPORT ScTabViewShell::Deactivate(sal_Bool bMDI)
diff --git a/main/sc/source/ui/view/viewfunc.cxx b/main/sc/source/ui/view/viewfunc.cxx
index d8809d7..a72cfed 100644
--- a/main/sc/source/ui/view/viewfunc.cxx
+++ b/main/sc/source/ui/view/viewfunc.cxx
@@ -2868,6 +2868,11 @@
 	{
 		pDocSh->UpdateOle(pViewData);
 		StartFormatArea();
+
+        // stuff for sidebar panels
+		SfxBindings& rBindings = GetViewData()->GetBindings();
+		rBindings.Invalidate( SID_H_ALIGNCELL );
+		rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
 	}
 }
 
diff --git a/main/sc/uiconfig/scalc/menubar/menubar.xml b/main/sc/uiconfig/scalc/menubar/menubar.xml
index f6531d8..e84db21 100644
--- a/main/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/main/sc/uiconfig/scalc/menubar/menubar.xml
@@ -144,6 +144,7 @@
 			<menu:menuitem menu:id=".uno:ViewDataSourceBrowser"/>
 			<menu:menuitem menu:id=".uno:Navigator"/>
       <menu:menuitem menu:id=".uno:TaskPane"/>
+      <menu:menuitem menu:id=".uno:Sidebar"/>
       <menu:menuseparator/>
 			<menu:menuitem menu:id=".uno:FullScreen"/>
 			<menu:menuitem menu:id=".uno:Zoom"/>
diff --git a/main/sc/util/makefile.mk b/main/sc/util/makefile.mk
index 9fd394a..d845657 100644
--- a/main/sc/util/makefile.mk
+++ b/main/sc/util/makefile.mk
@@ -41,6 +41,7 @@
 	$(SRS)$/ui.srs		\
 	$(SRS)$/dbgui.srs	\
 	$(SRS)$/drawfunc.srs \
+	$(SRS)$/sidebar.srs \
 	$(SRS)$/core.srs 	\
 	$(SRS)$/styleui.srs	\
 	$(SRS)$/formdlgs.srs \
@@ -125,6 +126,7 @@
 	$(SLB)$/dbgui.lib \
 	$(SLB)$/pagedlg.lib \
 	$(SLB)$/drawfunc.lib \
+	$(SLB)$/sidebar.lib \
 	$(SLB)$/navipi.lib
 
 LIB3FILES+= \
diff --git a/main/sc/util/sc.component b/main/sc/util/sc.component
index 76b5b2a..e5df04c 100644
--- a/main/sc/util/sc.component
+++ b/main/sc/util/sc.component
@@ -90,4 +90,7 @@
   <implementation name="stardiv.StarCalc.ScSpreadsheetSettings">
     <service name="com.sun.star.sheet.GlobalSheetSettings"/>
   </implementation>
+  <implementation name="org.apache.openoffice.comp.sc.sidebar.ScPanelFactory">
+    <service name="com.sun.star.ui.UIElementFactory"/>
+  </implementation>
 </component>
diff --git a/main/sd/inc/glob.hrc b/main/sd/inc/glob.hrc
index b693eac..33bd4a4 100644
--- a/main/sd/inc/glob.hrc
+++ b/main/sd/inc/glob.hrc
@@ -127,15 +127,14 @@
 #define STR_3DOBJECTBARSHELL					RID_GLOB_START+104
 #define STR_FONTWORKOBJECTBARSHELL				RID_GLOB_START+105
 #define STR_SLIDESORTERVIEWSHELL                RID_GLOB_START+106
-#define STR_TASKPANEVIEWSHELL                   RID_GLOB_START+107
+#define STR_SIDEBARVIEWSHELL                    RID_GLOB_START+107
 #define STR_MASTERPAGESSELECTOR                 RID_GLOB_START+108
-#define STR_TASKPANELAYOUTMENU                  RID_GLOB_START+109
+#define STR_SIDEBAR_LAYOUTMENU                  RID_GLOB_START+109
 #define STR_MEDIAOBJECTBARSHELL					RID_GLOB_START+110
 #define STR_PAGE_NAME                           RID_GLOB_START+111
 #define STR_SLIDE_NAME                          RID_GLOB_START+112
 #define STR_LEFT_IMPRESS_PANE_SHELL             RID_GLOB_START+113
 #define STR_LEFT_DRAW_PANE_SHELL                RID_GLOB_START+114
-#define STR_RIGHT_PANE_SHELL                    RID_GLOB_START+115
 #define STR_TOOL_PANEL_SHELL                    RID_GLOB_START+116
 
 #define RID_CUSTOMANIMATION_START				RID_GLOB_START+120
diff --git a/main/sd/inc/glob.hxx b/main/sd/inc/glob.hxx
index 5d24195..59b42bc 100644
--- a/main/sd/inc/glob.hxx
+++ b/main/sd/inc/glob.hxx
@@ -53,7 +53,7 @@
 #define SD_IF_SD3DOBJECTBAR				SFX_INTERFACE_SD_START + 17
 #define SD_IF_SDFONTWORKOBJECTBAR		SFX_INTERFACE_SD_START + 18
 #define SD_IF_SDSLIDESORTERVIEWSHELL    SFX_INTERFACE_SD_START + 19
-#define SD_IF_SDTASKPANEVIEWSHELL       SFX_INTERFACE_SD_START + 20
+#define SD_IF_SDSIDEBARVIEWSHELL        SFX_INTERFACE_SD_START + 20
 #define SD_IF_SDMASTERPAGESSELECTOR     SFX_INTERFACE_SD_START + 21
 #define SD_IF_SDLAYOUTMENU              SFX_INTERFACE_SD_START + 22
 #define SD_IF_SDDRAWMEDIAOBJECTBAR		SFX_INTERFACE_SD_START + 23 
diff --git a/main/sd/inc/sdabstdlg.hxx b/main/sd/inc/sdabstdlg.hxx
index 3d48af1..def446f 100644
--- a/main/sd/inc/sdabstdlg.hxx
+++ b/main/sd/inc/sdabstdlg.hxx
@@ -51,7 +51,7 @@
 class SfxObjectShellLock;
 class SvxFieldData;
 class GDIMetaFile;
-class XColorTable;
+class XColorList;
 class SdDrawDocument;
 class SfxMedium;
 class SdrObject;
@@ -182,7 +182,7 @@
 	static SdAbstractDialogFactory* 	Create();
 
 	virtual VclAbstractDialog* 			CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0;
-	virtual AbstractCopyDlg*			CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView ) = 0;
+	virtual AbstractCopyDlg*			CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorList* pColTab, ::sd::View* pView ) = 0;
 	virtual AbstractSdCustomShowDlg*	CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ) = 0;
 	virtual SfxAbstractTabDialog*		CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) = 0;
 	virtual SfxAbstractTabDialog*		CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ) = 0;
diff --git a/main/sd/prj/build.lst b/main/sd/prj/build.lst
index 72ee277..c38be3f 100644
--- a/main/sd/prj/build.lst
+++ b/main/sd/prj/build.lst
@@ -18,9 +18,8 @@
 sd	sd\source\ui\docshell					nmake	-	all	sd_docsh sd_sdi sd_inc NULL
 sd	sd\source\ui\unoidl						nmake	-	all	sd_unid sd_sdi sd_inc NULL
 sd	sd\source\ui\accessibility				nmake	-	all	sd_accessibility sd_inc NULL
-sd	sd\source\ui\toolpanel  				nmake	-	all	sd_toolpanel sd_sdi sd_inc NULL
-sd	sd\source\ui\toolpanel\controls			nmake	-	all	sd_toolpanel_controls sd_sdi sd_inc NULL
 sd	sd\source\ui\tools      				nmake	-	all	sd_tools sd_inc NULL
+sd	sd\source\ui\sidebar         			nmake	-	all	sd_sidebar sd_sdi sd_inc NULL
 sd	sd\source\ui\slidesorter\shell			nmake	-	all	sd_slsshell sd_sdi sd_inc NULL
 sd	sd\source\ui\slidesorter\model			nmake	-	all	sd_slsmodel sd_inc NULL
 sd	sd\source\ui\slidesorter\view			nmake	-	all	sd_slsview sd_inc NULL
@@ -44,5 +43,5 @@
 sd	sd\source\ui\framework\factories       	nmake	-	all sd_framework_factories sd_inc NULL
 sd	sd\source\ui\framework\tools           	nmake	-	all sd_framework_tools sd_inc NULL
 sd	sd\source\ui\annotations				nmake	-	all sd_uiannotations sd_inc NULL
-sd	sd\util									nmake	-	all	sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_controller sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL
+sd	sd\util									nmake	-	all	sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_controller sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations sd_sidebar NULL
 sd sd\qa\unoapi nmake - all sd_qa_unoapi NULL
diff --git a/main/sd/sdi/ToolPanelViewShell.sdi b/main/sd/sdi/ToolPanelViewShell.sdi
deleted file mode 100644
index 95e73a3..0000000
--- a/main/sd/sdi/ToolPanelViewShell.sdi
+++ /dev/null
@@ -1,127 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-interface MasterPagesSelectorInterface
-{
-    SID_TP_APPLY_TO_ALL_SLIDES
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_TP_APPLY_TO_SELECTED_SLIDES
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_TP_USE_FOR_NEW_PRESENTATIONS
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_TP_SHOW_SMALL_PREVIEW
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_TP_SHOW_LARGE_PREVIEW
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-
-    SID_TP_EDIT_MASTER
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-
-    // The copy and paste slots are included here so that they later can be
-    // disabled in order to remove them from context menus.
-	SID_CUT
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-	SID_COPY
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-	SID_PASTE
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_DELETE_MASTER_PAGE
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-}
-
-interface TaskPaneLayoutMenuInterface
-{
-    SID_TP_APPLY_TO_SELECTED_SLIDES
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-    SID_INSERTPAGE_LAYOUT_MENU
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-
-    // The copy and paste slots are included here so that they later can be
-    // disabled in order to remove them from context menus.
-	SID_CUT
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-	SID_COPY
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-	SID_PASTE
-	[
-		ExecMethod = Execute ;
-		StateMethod = GetState ;
-	]
-}
-
-shell MasterPagesSelector
-{
-    import MasterPagesSelectorInterface[Automation];
-}
-
-shell LayoutMenu
-{
-    import TaskPaneLayoutMenuInterface[Automation];
-}
-
-shell ToolPanelViewShell
-{
-}
-
diff --git a/main/sd/sdi/_drvwsh.sdi b/main/sd/sdi/_drvwsh.sdi
index c8d1f11..9e396e7 100644
--- a/main/sd/sdi/_drvwsh.sdi
+++ b/main/sd/sdi/_drvwsh.sdi
@@ -211,12 +211,72 @@
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+
+    SID_ATTR_TRANSFORM_WIDTH // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_HEIGHT // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_POS_X // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_POS_Y // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_ANGLE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+	SID_ATTR_TRANSFORM_ROT_X	
+	[
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+	SID_ATTR_TRANSFORM_ROT_Y	
+	[
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_PROTECT_POS	
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+	SID_ATTR_TRANSFORM_PROTECT_SIZE	
+	[
+        ExecMethod = FuTemporary ;
+        StateMethod = GetDrawAttrState ;
+    ]
+    SID_ATTR_TRANSFORM_AUTOWIDTH
+    [
+        StateMethod = GetDrawAttrState ;
+    ]
+	SID_ATTR_TRANSFORM_AUTOHEIGHT
+	[
+        StateMethod = GetDrawAttrState ;
+    ]
+
      /// !?
     SID_CHAR_DLG // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_CHAR_DLG_EFFECT // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     /* -> SVX
     SID_PARA_DLG // ole : no, status : ?
     [
@@ -639,12 +699,42 @@
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    FN_NUM_BULLET_ON
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    FN_NUM_NUMBERING_ON
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
     SID_OUTLINE_BULLET // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
 		MenuConfig = TRUE;
     ]
+    FN_SVX_SET_BULLET
+    [
+   		ExecMethod = FuTemporary ;
+    ]
+    FN_SVX_SET_NUMBER
+    [
+    	ExecMethod = FuTemporary ;
+    ]
+    FN_BUL_NUM_RULE_INDEX
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+        Asynchron , AutoUpdate ;
+    ]
+    FN_NUM_NUM_RULE_INDEX
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+        Asynchron  , AutoUpdate ;
+    ]
     SID_ATTR_CHAR // ole : no, status : ?
     [
         ExecMethod = FuPermanent ;
@@ -1268,11 +1358,36 @@
         ExecMethod = FuTemporary ;
         StateMethod = GetAttrState ;
     ]
+    SID_ATTR_FILL_TRANSPARENCE // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_FILL_FLOATTRANSPARENCE // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
     SID_ATTR_LINE_STYLE // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
         StateMethod = GetAttrState ;
     ]
+    SID_ATTR_LINE_JOINT // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_LINE_CAP // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_LINE_TRANSPARENCE // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
     SID_ATTR_LINE_DASH // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
@@ -1317,6 +1432,16 @@
         ExecMethod = FuTemporary ;
         StateMethod = GetAttrState ;
     ]
+    SID_ATTR_LINE_START // ole : no, status : play rec
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_LINE_END // ole : no, status : play rec
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+    ]
     SID_DELETE_PAGE // ole : no, status : play rec
     [
         ExecMethod = FuTemporary ;
@@ -1452,7 +1577,37 @@
     SID_ATTR_PARA_LRSPACE // ole : no, status : ?
     [
         ExecMethod = ExecRuler ;
-        StateMethod = GetRulerState ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_LINESPACE
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_ULSPACE
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_ADJUST_LEFT
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_ADJUST_CENTER
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_ADJUST_RIGHT
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_PARA_ADJUST_BLOCK
+    [
+        ExecMethod = ExecRuler ;
+        StateMethod = GetAttrState ;
     ]
     SID_ATTR_POSITION // ole : no, status : ?
     [
@@ -1645,11 +1800,21 @@
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_FLIP_HORIZONTAL
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_VERTICAL // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_FLIP_VERTICAL
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_ATTR_FILL_SHADOW // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
@@ -2509,4 +2674,84 @@
         ExecMethod = FuTable ;
         StateMethod = GetTableMenuState ;
     ]
+    SID_ATTR_CHAR_FONT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_FONTHEIGHT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_WEIGHT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_POSTURE
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_UNDERLINE
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_SHADOWED
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_STRIKEOUT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_COLOR
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_ATTR_CHAR_KERNING
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_SET_SUB_SCRIPT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_SET_SUPER_SCRIPT
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_SHRINK_FONT_SIZE
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_GROW_FONT_SIZE
+    [
+        ExecMethod = ExecChar ;
+        StateMethod = GetAttrState ;
+    ]
+    SID_TABLE_VERT_NONE
+    [
+        ExecMethod = ExecutePropPanelAttr ;
+        StateMethod = GetStatePropPanelAttr ;		
+    ]
+    SID_TABLE_VERT_CENTER
+    [
+        ExecMethod = ExecutePropPanelAttr ;
+        StateMethod = GetStatePropPanelAttr ;	
+    ]
+    SID_TABLE_VERT_BOTTOM
+    [
+        ExecMethod = ExecutePropPanelAttr ;
+        StateMethod = GetStatePropPanelAttr ;	
+    ]
 }
diff --git a/main/sd/sdi/drtxtob.sdi b/main/sd/sdi/drtxtob.sdi
index 0c521a8..8e1847b 100644
--- a/main/sd/sdi/drtxtob.sdi
+++ b/main/sd/sdi/drtxtob.sdi
@@ -166,6 +166,12 @@
 		StateMethod = GetAttrState;
 	]
 
+	SID_ATTR_CHAR_KERNING   
+	[
+		ExecMethod = Execute;
+		StateMethod = GetCharState;
+	]
+
 	SID_PARASPACE_INCREASE  // ole : ?, status : ?
 	[
 		ExecMethod = Execute;
@@ -178,6 +184,20 @@
 		StateMethod = GetAttrState;
 	]
 
+	SID_ATTR_PARA_LRSPACE
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetAttrState;
+	]
+	SID_ATTR_PARA_RIGHT
+	[
+	    ExecMethod = Execute ;
+	]
+	SID_ATTR_PARA_LEFT
+	[
+	    ExecMethod = Execute ;
+	]
+
 	SID_OUTLINE_LEFT // ole : no, status : ?
 	[
 		ExecMethod = Execute ;
diff --git a/main/sd/sdi/makefile.mk b/main/sd/sdi/makefile.mk
index b1e89fc..cd18ca6 100644
--- a/main/sd/sdi/makefile.mk
+++ b/main/sd/sdi/makefile.mk
@@ -62,7 +62,6 @@
 	outlnvsh.sdi \
 	SlideSorterController.sdi \
 	ViewShellBase.sdi \
-	ToolPanelViewShell.sdi \
 	sdslots.hrc \
 	$(PRJ)$/inc$/app.hrc
 
@@ -84,7 +83,6 @@
         mediaob.sdi \
 	outlnvsh.sdi \
 	ViewShellBase.sdi \
-	ToolPanelViewShell.sdi \
 	sdslots.hrc \
 	$(PRJ)$/inc$/app.hrc
 
diff --git a/main/sd/sdi/outlnvsh.sdi b/main/sd/sdi/outlnvsh.sdi
index 1ba8494..65f152f 100644
--- a/main/sd/sdi/outlnvsh.sdi
+++ b/main/sd/sdi/outlnvsh.sdi
@@ -174,7 +174,14 @@
         ExecMethod = FuTemporaryModify ;
         StateMethod = GetMenuState ;
     ]
-
+    FN_SVX_SET_BULLET
+    [
+   		ExecMethod = FuTemporaryModify ;
+    ]
+    FN_SVX_SET_NUMBER
+    [
+    	ExecMethod = FuTemporaryModify ;
+    ]
 	SID_OUTLINE_BULLET // ole : no, status : ?
 	[
 		ExecMethod = FuTemporaryModify ;
@@ -187,6 +194,12 @@
 		StateMethod = GetMenuState ;
 		 //        Cachable , HasDialog , Export ;
 	]
+	SID_CHAR_DLG_EFFECT // wj for sym2_1876
+	[
+		ExecMethod = FuTemporaryModify ;
+		StateMethod = GetMenuState ;
+		 //        Cachable , HasDialog , Export ;
+	]
 	SID_SELECTALL // ole : no, status : ?
 	[
 		ExecMethod = FuTemporary ;
diff --git a/main/sd/sdi/sdslots.sdi b/main/sd/sdi/sdslots.sdi
index d8adb15..94d94e0 100644
--- a/main/sd/sdi/sdslots.sdi
+++ b/main/sd/sdi/sdslots.sdi
@@ -100,5 +100,4 @@
         include "ViewShellBase.sdi"
 		include "mediaob.sdi"
 		include "tables.sdi"	
-        include "ToolPanelViewShell.sdi"
-}
+        }
diff --git a/main/sd/source/core/typemap.cxx b/main/sd/source/core/typemap.cxx
index bde67d4..ffe8f4c 100644
--- a/main/sd/source/core/typemap.cxx
+++ b/main/sd/source/core/typemap.cxx
@@ -38,6 +38,9 @@
 #include <editeng/fontitem.hxx>
 #include <svl/poolitem.hxx>
 #include <editeng/tstpitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <editeng/protitem.hxx>
 #include <svx/chrtitem.hxx>
@@ -126,6 +129,10 @@
 #include <svl/rectitem.hxx>
 
 #include <sfx2/frame.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/AffineMatrixItem.hxx>
 
 #define SFX_TYPEMAP
 #include "sdslots.hxx"
diff --git a/main/sd/source/ui/accessibility/makefile.mk b/main/sd/source/ui/accessibility/makefile.mk
index 9588a39..3edb55d 100644
--- a/main/sd/source/ui/accessibility/makefile.mk
+++ b/main/sd/source/ui/accessibility/makefile.mk
@@ -49,12 +49,13 @@
 	$(SLO)$/AccessibleViewForwarder.obj				\
 	$(SLO)$/AccessibleOutlineEditSource.obj			\
 	$(SLO)$/AccessiblePageShape.obj					\
-	$(SLO)$/AccessibleScrollPanel.obj				\
 	$(SLO)$/AccessibleSlideSorterView.obj			\
 	$(SLO)$/AccessibleSlideSorterObject.obj			\
-	$(SLO)$/AccessibleTreeNode.obj					\
 	$(SLO)$/SdShapeTypes.obj
 
+#SIDEBAR_TO_BE_REMOVED
+#	$(SLO)$/AccessibleScrollPanel.obj				\
+#	$(SLO)$/AccessibleTreeNode.obj					\
 
 EXCEPTIONSFILES= 
 
diff --git a/main/sd/source/ui/animations/CustomAnimationDialog.cxx b/main/sd/source/ui/animations/CustomAnimationDialog.cxx
index e14adb5..f0ddc5d 100644
--- a/main/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/main/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -230,7 +230,7 @@
 
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	DBG_ASSERT( pDocSh, "DocShell not found!" );
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	bool bKillTable = false;
 	const SfxPoolItem* pItem = NULL;
 
@@ -239,7 +239,7 @@
 
 	if ( !pColorTable )
 	{
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 		bKillTable = sal_True;
 	}
 
@@ -1250,7 +1250,7 @@
 	// fill the color box
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	DBG_ASSERT( pDocSh, "DocShell not found!" );
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	bool bKillTable = false;
 	const SfxPoolItem* pItem = NULL;
 
@@ -1259,7 +1259,7 @@
 
 	if ( !pColorTable )
 	{
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 		bKillTable = sal_True;
 	}
 
@@ -2387,10 +2387,10 @@
 				pSet->setPropertyValue( nHandleTextGroupingAuto, makeAny( fTextGroupingAuto ) );
 		}
 	}
-	//bug 120049

-	//[crash] Aoo crash when modify the "Random effects" animation effect's trigger condition to "Start effect on click of" .

-	//If this control is disabled, we should ignore its value

-	if (maCBXAnimateForm.IsEnabled())

+	//bug 120049
+	//[crash] Aoo crash when modify the "Random effects" animation effect's trigger condition to "Start effect on click of" .
+	//If this control is disabled, we should ignore its value
+	if (maCBXAnimateForm.IsEnabled())
 	{
 		sal_Bool bAnimateForm = maCBXAnimateForm.IsChecked();
 		sal_Bool bOldAnimateForm = !bAnimateForm;
@@ -2399,7 +2399,7 @@
 			mpSet->getPropertyValue( nHandleAnimateForm ) >>= bOldAnimateForm;
 
 		if( bAnimateForm != bOldAnimateForm )
-			pSet->setPropertyValue( nHandleAnimateForm, makeAny( bAnimateForm ) );

+			pSet->setPropertyValue( nHandleAnimateForm, makeAny( bAnimateForm ) );
 	}
 }
 
diff --git a/main/sd/source/ui/animations/CustomAnimationPane.cxx b/main/sd/source/ui/animations/CustomAnimationPane.cxx
index ad35f93..b58f413 100644
--- a/main/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/main/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -59,6 +59,7 @@
 
 #include <comphelper/sequence.hxx>
 #include <sfx2/frame.hxx>
+#include <sfx2/sidebar/Theme.hxx>
 
 #include <svx/unoapi.hxx>
 #include <svx/svxids.hrc>
@@ -246,6 +247,8 @@
     maLateInitTimer.SetTimeout(100);
     maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback));
     maLateInitTimer.Start();
+
+    UpdateLook();
 }
 
 CustomAnimationPane::~CustomAnimationPane()
@@ -1073,6 +1076,42 @@
 	updateControls();
 }
 
+
+
+
+void CustomAnimationPane::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    UpdateLook();
+}
+
+
+
+
+void CustomAnimationPane::UpdateLook (void)
+{
+    SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground));
+    if (mpFLModify != NULL)
+        mpFLModify->SetBackground(Wallpaper());
+	if (mpFLEffect != NULL)
+        mpFLEffect->SetBackground(Wallpaper());
+	if (mpFTStart != NULL)
+        mpFTStart->SetBackground(Wallpaper());
+    if (mpFTProperty != NULL)
+        mpFTProperty->SetBackground(Wallpaper());
+    if (mpFTSpeed != NULL)
+        mpFTSpeed->SetBackground(Wallpaper());
+	if (mpFTChangeOrder != NULL)
+        mpFTChangeOrder->SetBackground(Wallpaper());
+	if (mpFLSeperator1 != NULL)
+        mpFLSeperator1->SetBackground(Wallpaper());
+    if (mpFLSeperator2 != NULL)
+        mpFLSeperator2->SetBackground(Wallpaper());
+}
+
+
+
+
 void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
 {
 	switch( pSet->getPropertyState( nHandle ) )
@@ -2540,8 +2579,10 @@
 	if( pDocSh )
 	{
 		pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL );
+		const Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) );
+        pWindow->SetSizePixel(aMinSize);
+        pWindow->SetBackground(Wallpaper(Color(COL_BLUE)));
 
-		Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) );
 		::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize );
 		pWindow->SetChildWindow( pPaneWindow, aMinSize );
 		pWindow->SetText( pPaneWindow->GetText() );
@@ -2552,4 +2593,13 @@
 
 
 
+
+sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pDialog)
+{
+    if (pDialog != NULL)
+		return pDialog->LogicToPixel(Size( 80, 256 ), MAP_APPFONT).Height();
+    else
+        return 0;
+}
+
 }
diff --git a/main/sd/source/ui/animations/CustomAnimationPane.hxx b/main/sd/source/ui/animations/CustomAnimationPane.hxx
index 548c9cc..7a8b6ad 100644
--- a/main/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/main/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -93,6 +93,9 @@
 	virtual void onDoubleClick();
 	virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry );
 
+    // Window
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+    
 	void addUndo();
 
 	void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
@@ -116,6 +119,7 @@
 
 	::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
 	bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
+    void UpdateLook (void);
 
 	DECL_LINK( implControlHdl, Control* );
 	DECL_LINK( implPropertyHdl, Control* );
diff --git a/main/sd/source/ui/animations/SlideTransitionPane.cxx b/main/sd/source/ui/animations/SlideTransitionPane.cxx
index c4b0cf4..0527a2b 100644
--- a/main/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/main/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -57,6 +57,7 @@
 #include "framework/FrameworkHelper.hxx"
 
 #include "DialogListBox.hxx"
+#include <sfx2/sidebar/Theme.hxx>
 
 #include <algorithm>
 #include <memory>
@@ -515,6 +516,8 @@
     maLateInitTimer.SetTimeout(200);
     maLateInitTimer.SetTimeoutHdl(LINK(this, SlideTransitionPane, LateInitCallback));
     maLateInitTimer.Start();
+
+    UpdateLook();
 }
 
 SlideTransitionPane::~SlideTransitionPane()
@@ -528,6 +531,33 @@
 	updateLayout();
 }
 
+
+
+
+void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    UpdateLook();
+}
+
+
+
+
+void SlideTransitionPane::UpdateLook (void)
+{
+    SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground));
+    maFL_APPLY_TRANSITION.SetBackground(Wallpaper());
+    maFL_MODIFY_TRANSITION.SetBackground(Wallpaper());;
+    maFT_SPEED.SetBackground(Wallpaper());
+    maFT_SOUND.SetBackground(Wallpaper());
+    maFL_ADVANCE_SLIDE.SetBackground(Wallpaper());
+    maFL_EMPTY1.SetBackground(Wallpaper());
+    maFL_EMPTY2.SetBackground(Wallpaper());
+}
+
+
+
+
 void SlideTransitionPane::onSelectionChanged()
 {
     updateControls();
@@ -1314,4 +1344,15 @@
 }
 
 
+
+
+sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pDialog)
+{
+    if (pDialog != NULL)
+		return pDialog->LogicToPixel(Size( 72, 216 ), MAP_APPFONT).Height();
+    else
+        return 0;
+}
+
+
 } //  namespace sd
diff --git a/main/sd/source/ui/animations/SlideTransitionPane.hxx b/main/sd/source/ui/animations/SlideTransitionPane.hxx
index ea90682..0e3cf89 100644
--- a/main/sd/source/ui/animations/SlideTransitionPane.hxx
+++ b/main/sd/source/ui/animations/SlideTransitionPane.hxx
@@ -61,7 +61,9 @@
         SdDrawDocument* pDoc );
 	virtual ~SlideTransitionPane();
 
+    // Window
     virtual void Resize();
+    virtual void DataChanged (const DataChangedEvent& rEvent);
 
 	void onSelectionChanged();
 	void onChangeCurrentPage();
@@ -84,6 +86,8 @@
 
     ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const;
 
+    void UpdateLook (void);
+
     DECL_LINK( ApplyToAllButtonClicked, void * );
     DECL_LINK( PlayButtonClicked, void * );
     DECL_LINK( SlideShowButtonClicked, void * );
@@ -98,7 +102,6 @@
     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
     DECL_LINK(LateInitCallback, Timer*);
 
-private:
     ViewShellBase &   mrBase;
     SdDrawDocument *  mpDrawDoc;
     Size              maMinSize;
diff --git a/main/sd/source/ui/app/sddll1.cxx b/main/sd/source/ui/app/sddll1.cxx
index b464ef8..60e3466 100644
--- a/main/sd/source/ui/app/sddll1.cxx
+++ b/main/sd/source/ui/app/sddll1.cxx
@@ -45,7 +45,6 @@
 #include "DrawDocShell.hxx"
 #include "GraphicDocShell.hxx"
 #include "SlideSorterViewShell.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
 #include "FactoryIds.hxx"
 #include "sdmod.hxx"
 #include "app.hrc"
@@ -123,8 +122,4 @@
 
     // View shells for the side panes.
     ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod);
-	::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod);
-    // Tell the tool panel view shell to register the interfaces of its
-    // controls.
-	::sd::toolpanel::ToolPanelViewShell::RegisterControls();
 }
diff --git a/main/sd/source/ui/app/sddll2.cxx b/main/sd/source/ui/app/sddll2.cxx
index d066ad2..aa55cd8 100644
--- a/main/sd/source/ui/app/sddll2.cxx
+++ b/main/sd/source/ui/app/sddll2.cxx
@@ -63,6 +63,7 @@
 
 #include <svx/layctrl.hxx>
 #include <svx/subtoolboxcontrol.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 
 #include "sddll.hxx"
 #define _SD_DIACTRL_CXX
@@ -136,7 +137,7 @@
 	::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
 	::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod);
 	::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod);
-	::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod);
+    ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
 
 	SvxFillToolBoxControl::RegisterControl(0, pMod);
 	SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
diff --git a/main/sd/source/ui/app/sdmod1.cxx b/main/sd/source/ui/app/sdmod1.cxx
index 0e8ecf8..026f6c0 100644
--- a/main/sd/source/ui/app/sdmod1.cxx
+++ b/main/sd/source/ui/app/sdmod1.cxx
@@ -753,7 +753,7 @@
             ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
             if (pBase != NULL)
             {
-                FrameworkHelper::Instance(*pBase)->RequestTaskPanel(
+                FrameworkHelper::Instance(*pBase)->RequestSidebarPanel(
                     FrameworkHelper::msLayoutTaskPanelURL);
             }
 		}
diff --git a/main/sd/source/ui/dlg/NavigatorChildWindow.cxx b/main/sd/source/ui/dlg/NavigatorChildWindow.cxx
index 1fb0488..5bca92d 100644
--- a/main/sd/source/ui/dlg/NavigatorChildWindow.cxx
+++ b/main/sd/source/ui/dlg/NavigatorChildWindow.cxx
@@ -29,11 +29,31 @@
 #include "app.hrc"
 #include "navigatr.hrc"
 #include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/eitem.hxx>
+#include <boost/bind.hpp>
+
 
 namespace sd {
 
 SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR)
 
+void RequestNavigatorUpdate (SfxBindings* pBindings)
+{
+    if (pBindings != NULL
+        && pBindings->GetDispatcher() != NULL)
+    {
+        SfxBoolItem aItem (SID_NAVIGATOR_INIT, sal_True);
+        pBindings->GetDispatcher()->Execute(
+            SID_NAVIGATOR_INIT,
+            SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+            &aItem,
+            0L);
+    }
+}
+
+
 NavigatorChildWindow::NavigatorChildWindow (
     ::Window* pParent,
     sal_uInt16 nId,
@@ -41,8 +61,12 @@
     SfxChildWinInfo* ) 
     : SfxChildWindowContext( nId )
 {
-	SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this,
-										SdResId( FLT_NAVIGATOR ), pBindings );
+	SdNavigatorWin* pNavWin = new SdNavigatorWin(
+        pParent,
+        this,
+        SdResId( FLT_NAVIGATOR ),
+        pBindings,
+        ::boost::bind(RequestNavigatorUpdate, pBindings));
 
 	SetWindow( pNavWin );
 }
diff --git a/main/sd/source/ui/dlg/PaneChildWindows.cxx b/main/sd/source/ui/dlg/PaneChildWindows.cxx
index a14c85e..aa9ce82 100644
--- a/main/sd/source/ui/dlg/PaneChildWindows.cxx
+++ b/main/sd/source/ui/dlg/PaneChildWindows.cxx
@@ -28,7 +28,6 @@
 #include "PaneDockingWindow.hxx"
 #include "ViewShellBase.hxx"
 #include "framework/FrameworkHelper.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
 #include "app.hrc"
 #include "strings.hrc"
 #include "sdresid.hxx"
@@ -52,7 +51,6 @@
 
 SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS)
 SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW)
-SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE)
 
 //===== PaneChildWindow =======================================================
 
@@ -142,89 +140,4 @@
 }
 
 
-
-
-//======================================================================================================================
-//= ToolPanelChildWindow
-//======================================================================================================================
-//----------------------------------------------------------------------------------------------------------------------
-ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings, 
-        SfxChildWinInfo* i_pChildWindowInfo )
-    :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo,
-        FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT )
-{
-    // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework
-    // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the
-    // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell
-    // which has this responsibility. And this view shell is created implicitly via the resource framework.)
-    // #i113788# / 2010-09-03 / frank.schoenheit@oracle.com
-    SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
-    ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
-    ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" );
-
-    const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
-    ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" );
-    Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() );
-    ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" );
-    xConfigController->requestResourceActivation(
-        framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ),
-        ResourceActivationMode_ADD );
-    xConfigController->requestResourceActivation(
-        framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ),
-        ResourceActivationMode_REPLACE
-    );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-struct DelayedToolPanelActivation
-{
-    DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const ::rtl::OUString& i_rPanelURL )
-        :m_rToolPanelWindow( i_rToolPanelWindow )
-        ,m_sPanelURL( i_rPanelURL )
-    {
-    }
-
-    void operator() (bool)
-    {
-        m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL );
-    }
-
-private:
-    ToolPanelChildWindow&   m_rToolPanelWindow;
-    const ::rtl::OUString   m_sPanelURL;
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL )
-{
-    SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
-    ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
-    ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" );
-
-    const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
-
-    if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 )
-    {
-        // it's one of our standard panels known to the drawing framework
-        pFrameworkHelper->RequestTaskPanel( i_rPanelURL );
-    }
-    else
-    {
-        // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by
-        // extensions, too. As long as this is not the case, we need to take the direct way ...
-        ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
-        toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() );
-        if ( pToolPanelViewShell )
-        {
-            pToolPanelViewShell->ActivatePanel( i_rPanelURL );
-        }
-        else
-        {
-            Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView(
-                framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL );
-            pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) );
-        }
-    }
-}
-
 } // end of namespace ::sd
diff --git a/main/sd/source/ui/dlg/PaneShells.cxx b/main/sd/source/ui/dlg/PaneShells.cxx
index f38908c..d174b92 100644
--- a/main/sd/source/ui/dlg/PaneShells.cxx
+++ b/main/sd/source/ui/dlg/PaneShells.cxx
@@ -103,33 +103,4 @@
 }
 
 
-
-
-//===== ToolPanelPaneShell ========================================================
-
-#undef ShellClass
-#define ShellClass ToolPanelPaneShell
-
-SFX_SLOTMAP( ToolPanelPaneShell )
-{
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-};
-
-SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) )
-{
-    SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() );
-}
-
-TYPEINIT1( ToolPanelPaneShell, SfxShell );
-
-ToolPanelPaneShell::ToolPanelPaneShell()
-    :SfxShell()
-{
-    SetName( ::rtl::OUString::createFromAscii( "ToolPanel" ) );
-}
-
-ToolPanelPaneShell::~ToolPanelPaneShell(void)
-{
-}
-
 } // end of namespace ::sd
diff --git a/main/sd/source/ui/dlg/copydlg.cxx b/main/sd/source/ui/dlg/copydlg.cxx
index 6ae2436..cde9c7e 100644
--- a/main/sd/source/ui/dlg/copydlg.cxx
+++ b/main/sd/source/ui/dlg/copydlg.cxx
@@ -62,7 +62,7 @@
 CopyDlg::CopyDlg(
     ::Window* pWindow, 
     const SfxItemSet& rInAttrs,
-    XColorTable* pColTab, 
+    XColorList* pColTab, 
     ::sd::View* pInView ) 
     : SfxModalDialog     ( pWindow, SdResId( DLG_COPY ) ),
       maFtCopies           ( this, SdResId( FT_COPIES ) ),
diff --git a/main/sd/source/ui/dlg/navigatr.cxx b/main/sd/source/ui/dlg/navigatr.cxx
index b30ce59..144f27c 100644
--- a/main/sd/source/ui/dlg/navigatr.cxx
+++ b/main/sd/source/ui/dlg/navigatr.cxx
@@ -72,18 +72,19 @@
     ::Window* pParent,
     ::sd::NavigatorChildWindow* pChWinCtxt,
     const SdResId& rSdResId,
-    SfxBindings* pInBindings )
-:	::Window( pParent, rSdResId )
-,	maToolbox        ( this, SdResId( 1 ) )
-,	maTlbObjects( this, SdResId( TLB_OBJECTS ) )
-,	maLbDocs         ( this, SdResId( LB_DOCS ) )
-,	mpChildWinContext( pChWinCtxt )
-,	mbDocImported	( sal_False )
-    // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen!
-,	meDragType		( NAVIGATOR_DRAGTYPE_EMBEDDED )
-,	mpBindings		( pInBindings )
-,	maImageList		( SdResId( IL_NAVIGATR ) )
-,	maImageListH	( SdResId( ILH_NAVIGATR ) )
+    SfxBindings* pInBindings,
+    const UpdateRequestFunctor& rUpdateRequest)
+    : ::Window( pParent, rSdResId ),
+      maToolbox        ( this, SdResId( 1 ) ),
+      maTlbObjects( this, SdResId( TLB_OBJECTS ) ),
+      maLbDocs         ( this, SdResId( LB_DOCS ) ),
+      mpChildWinContext( pChWinCtxt ),
+      mbDocImported	( sal_False ),
+      // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen!
+      meDragType		( NAVIGATOR_DRAGTYPE_EMBEDDED ),
+      mpBindings		( pInBindings ),
+      maImageList		( SdResId( IL_NAVIGATR ) ),
+      maImageListH	( SdResId( ILH_NAVIGATR ) )
 {
 	maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
 
@@ -91,8 +92,8 @@
 
     maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE)));
 
-	mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings );
-	mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings );
+	mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest);
+	mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest);
 	mpDocList = new List();
 
 	ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
@@ -137,13 +138,13 @@
     if( nMinWidth > maMinSize.Width() )
         maMinSize.Width() = nMinWidth;
 	maMinSize.Height() -= 40;
-	((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize );
+    SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetParent());
+	if (pDockingParent != NULL)
+        pDockingParent->SetMinOutputSizePixel( maMinSize );
 
 	// InitTlb; Wird ueber Slot initiiert
-	SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
-	mpBindings->GetDispatcher()->Execute(
-		SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
-
+    if (rUpdateRequest)
+        rUpdateRequest();
 }
 
 // -----------------------------------------------------------------------
@@ -882,11 +883,14 @@
 |*
 \************************************************************************/
 
-SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId,
-								SdNavigatorWin* pNavWin,
-								SfxBindings*	_pBindings) :
-	SfxControllerItem( _nId, *_pBindings ),
-	pNavigatorWin( pNavWin )
+SdNavigatorControllerItem::SdNavigatorControllerItem(
+    sal_uInt16 _nId,
+    SdNavigatorWin* pNavWin,
+    SfxBindings*	_pBindings,
+    const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest)
+    : SfxControllerItem( _nId, *_pBindings ),
+      pNavigatorWin( pNavWin ),
+      maUpdateRequest(rUpdateRequest)
 {
 }
 
@@ -954,9 +958,8 @@
 			if( nState & NAVTLB_UPDATE )
 			{
 				// InitTlb; Wird ueber Slot initiiert
-				SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
-				GetBindings().GetDispatcher()->Execute(
-					SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+                if (maUpdateRequest)
+                    maUpdateRequest();
 			}
 		}
 	}
@@ -968,11 +971,14 @@
 |*
 \************************************************************************/
 
-SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId,
-								SdNavigatorWin* pNavWin,
-								SfxBindings*	_pBindings) :
-	SfxControllerItem( _nId, *_pBindings ),
-	pNavigatorWin( pNavWin )
+SdPageNameControllerItem::SdPageNameControllerItem(
+    sal_uInt16 _nId,
+    SdNavigatorWin* pNavWin,
+    SfxBindings*	_pBindings,
+    const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest)
+	: SfxControllerItem( _nId, *_pBindings ),
+      pNavigatorWin( pNavWin ),
+      maUpdateRequest(rUpdateRequest)
 {
 }
 
diff --git a/main/sd/source/ui/dlg/sddlgfact.cxx b/main/sd/source/ui/dlg/sddlgfact.cxx
index 732a640..ea5f23d 100644
--- a/main/sd/source/ui/dlg/sddlgfact.cxx
+++ b/main/sd/source/ui/dlg/sddlgfact.cxx
@@ -391,7 +391,7 @@
 //add for CopyDlg begin
 AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg(
 											::Window* pWindow, const SfxItemSet& rInAttrs,
-											XColorTable* pColTab, ::sd::View* pView ) //add for CopyDlg
+											XColorList* pColTab, ::sd::View* pView ) //add for CopyDlg
 {
 	return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) );
 }
diff --git a/main/sd/source/ui/dlg/sddlgfact.hxx b/main/sd/source/ui/dlg/sddlgfact.hxx
index eab5c90..5d91e8e 100644
--- a/main/sd/source/ui/dlg/sddlgfact.hxx
+++ b/main/sd/source/ui/dlg/sddlgfact.hxx
@@ -255,7 +255,7 @@
 
 public:
 	virtual VclAbstractDialog* 			CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount );
-	virtual AbstractCopyDlg*			CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView );
+	virtual AbstractCopyDlg*			CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorList* pColTab, ::sd::View* pView );
 	virtual AbstractSdCustomShowDlg*	CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc );
 	virtual SfxAbstractTabDialog*		CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell );
 	virtual SfxAbstractTabDialog*		CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True );
diff --git a/main/sd/source/ui/docshell/docshel3.cxx b/main/sd/source/ui/docshell/docshel3.cxx
index 6029c28..0f814f8 100644
--- a/main/sd/source/ui/docshell/docshel3.cxx
+++ b/main/sd/source/ui/docshell/docshel3.cxx
@@ -192,7 +192,7 @@
 		{
 			//	passende ColorTable ist per PutItem gesetzt worden
 			SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE );
-			XColorTable* pTable = pColItem->GetColorTable();
+			XColorList* pTable = pColItem->GetColorTable();
 			rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) );
 		}
 		break;
diff --git a/main/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/main/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
index fbeb752..b4719a7 100644
--- a/main/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
+++ b/main/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
@@ -143,7 +143,7 @@
     if ( ! xFactory.is())
     {
 #if defined VERBOSE && VERBOSE>=1
-        OSL_TRACE("    no factory found fo %s\n",
+        OSL_TRACE("    no factory found for %s\n",
             OUStringToOString(sResourceURL, RTL_TEXTENCODING_UTF8).getStr());
 #endif
         return;
@@ -163,9 +163,9 @@
             // of registered factories.
             mpResourceFactoryContainer->RemoveFactoryForReference(xFactory);
         }
-        catch(Exception&)
+        catch (Exception& e)
         {
-            DBG_UNHANDLED_EXCEPTION();
+            (void)e;
         }
         
         if (xResource.is())
@@ -204,9 +204,10 @@
 /* In this method we do following steps.
     1. Remove the resource from the URL->Object map of the configuration
     controller.
-    2. Notify listeners.
+    2. Notify listeners that deactivation has started.
     3. Remove the resource id from the current configuration.
     4. Release the resource.
+    5. Notify listeners about that deactivation is completed.
 */
 void ConfigurationControllerResourceManager::DeactivateResource (
     const Reference<XResourceId>& rxResourceId,
@@ -256,6 +257,12 @@
     {
         DBG_UNHANDLED_EXCEPTION();
     }
+    
+    // 5.  Notifiy listeners that the resource is being deactivated. 
+    mpBroadcaster->NotifyListeners(
+        FrameworkHelper::msResourceDeactivationEndEvent,
+        rxResourceId,
+        NULL);
 
 #if defined VERBOSE && VERBOSE>=1
     if (bSuccess)
diff --git a/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
index 29b8a45..fd9be83 100644
--- a/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
+++ b/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -37,6 +37,9 @@
 using namespace ::com::sun::star::drawing::framework;
 using ::rtl::OUString;
 
+#undef VERBOSE
+//#define VERBOSE 1
+
 namespace sd { namespace framework {
 
 ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager)
@@ -84,10 +87,22 @@
     {
         // The URL is a URL pattern not an single URL.
         maFactoryPatternList.push_back(FactoryPatternList::value_type(rsURL, rxFactory));
+
+#if defined VERBOSE && VERBOSE>=1
+        OSL_TRACE("ResourceFactoryManager::AddFactory pattern %s %x\n",
+            OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(),
+            rxFactory.get());
+#endif
     }
     else
     {
         maFactoryMap[rsURL] = rxFactory;
+
+#if defined VERBOSE && VERBOSE>=1
+        OSL_TRACE("ResourceFactoryManager::AddFactory fixed %s %x\n",
+            OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(),
+            rxFactory.get());
+#endif
     }
 }
 
diff --git a/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index dcd6a37..af5c1a9 100644
--- a/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -51,8 +51,7 @@
         CenterPaneId,
         FullScreenPaneId,
         LeftImpressPaneId,
-        LeftDrawPaneId,
-        RightPaneId
+        LeftDrawPaneId
     };
 
     static const sal_Int32 gnConfigurationUpdateStartEvent(0);
@@ -205,7 +204,7 @@
             mxConfigurationControllerWeak = xCC;
 
             // Add pane factories for the two left panes (one for Impress and one for
-            // Draw), the center pane, and the right pane.
+            // Draw) and the center pane.
             if (xController.is() && xCC.is())
             {
                 PaneDescriptor aDescriptor;
@@ -231,11 +230,6 @@
                 aDescriptor.mePaneId = LeftDrawPaneId;
                 mpPaneContainer->push_back(aDescriptor);
                 xCC->addResourceFactory(aDescriptor.msPaneURL, this);
-
-                aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL;
-                aDescriptor.mePaneId = RightPaneId;
-                mpPaneContainer->push_back(aDescriptor);
-                xCC->addResourceFactory(aDescriptor.msPaneURL, this);
             }
 
             // Register as configuration change listener.
@@ -304,7 +298,6 @@
 
                 case LeftImpressPaneId:
                 case LeftDrawPaneId:
-                case RightPaneId:
                     xPane = CreateChildWindowPane(
                         rxPaneId,
                         *iDescriptor);
@@ -523,11 +516,6 @@
                 pShell.reset(new LeftDrawPaneShell());
                 nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId();
                 break;
-            
-            case RightPaneId:
-                pShell.reset(new ToolPanelPaneShell());
-                nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId();
-                break;
 
             default:
                 break;
diff --git a/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx
index 4253ca0..1098dc9 100644
--- a/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx
+++ b/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx
@@ -67,7 +67,6 @@
         private:resource/pane/FullScreenPane
         private:resource/pane/LeftImpressPane
         private:resource/pane/LeftDrawPane
-        private:resource/pane/RightPane
     There are two left panes because this is (seems to be) the only way to
     show different titles for the left pane in Draw and Impress.
 */
@@ -127,7 +126,7 @@
     ::boost::scoped_ptr<PaneContainer> mpPaneContainer;
     bool mbFirstUpdateSeen;
     ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
-
+    
     /** Create a new instance of FrameWindowPane.
         @param rPaneId
             There is only one frame window so this id is just checked to
diff --git a/main/sd/source/ui/framework/factories/BasicViewFactory.cxx b/main/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 3360d66..9144d81 100644
--- a/main/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/main/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -38,7 +38,6 @@
 #include "DrawViewShell.hxx"
 #include "GraphicViewShell.hxx"
 #include "OutlineViewShell.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
 #include "PresentationViewShell.hxx"
 #include "SlideSorterViewShell.hxx"
 #include "FrameView.hxx"
@@ -327,7 +326,6 @@
             mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
             mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
             mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
-            mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this);
             mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
         }
         catch (RuntimeException&)
@@ -445,15 +443,6 @@
                 &rWindow,
                 pFrameView));
     }
-    else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL))
-    {
-        pViewShell.reset(
-            new ::sd::toolpanel::ToolPanelViewShell(
-                &rFrame,
-                *mpBase,
-                &rWindow,
-                pFrameView));
-    }
     else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL))
     {
         pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create (
@@ -529,8 +518,6 @@
                 FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL));
             maCacheableResources.push_back(pHelper->CreateResourceId(
                 FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL));
-            maCacheableResources.push_back(pHelper->CreateResourceId(
-                FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL));
         }
 
         ::std::vector<Reference<XResourceId> >::const_iterator iId;
diff --git a/main/sd/source/ui/framework/factories/Pane.cxx b/main/sd/source/ui/framework/factories/Pane.cxx
index 88e6b38..28b68bb 100644
--- a/main/sd/source/ui/framework/factories/Pane.cxx
+++ b/main/sd/source/ui/framework/factories/Pane.cxx
@@ -81,6 +81,16 @@
 
 
 
+void Pane::SetWindow (::Window* pWindow)
+{
+    OSL_TRACE("setting Pane::mpWindow to %x", pWindow);
+    mpWindow = pWindow;
+    mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+}
+
+
+
+
 //----- XPane -----------------------------------------------------------------
     
 Reference<awt::XWindow> SAL_CALL Pane::getWindow (void)
diff --git a/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx
deleted file mode 100644
index a355339..0000000
--- a/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx
+++ /dev/null
@@ -1,319 +0,0 @@
-/**************************************************************
- * 
- * 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_sd.hxx"
-#include "TaskPanelFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "DrawController.hxx"
-#include "framework/FrameworkHelper.hxx"
-#include <cppuhelper/compbase1.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::drawing::framework;
-
-using ::rtl::OUString;
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace framework {
-
-Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance (
-    const Reference<XComponentContext>& rxContext)
-{
-    return Reference<XInterface>(static_cast<XWeak*>(new TaskPanelFactory(rxContext)));
-}
-
-
-
-
-::rtl::OUString TaskPanelFactory_getImplementationName (void) throw(RuntimeException)
-{
-    return ::rtl::OUString(
-        RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.TaskPanelFactory"));
-}
-
-
-
-
-Sequence<rtl::OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
-    throw (RuntimeException)
-{
-	static const OUString sServiceName(
-        OUString::createFromAscii("com.sun.star.drawing.framework.TaskPanelFactory"));
-	return Sequence<rtl::OUString>(&sServiceName, 1);
-}
-
-
-
-
-//===== ToolPanelResource =====================================================
-
-namespace {
-
-typedef ::cppu::WeakComponentImplHelper1 <
-    css::drawing::framework::XResource
-    > TaskPanelResourceInterfaceBase;
-
-class TaskPanelResource
-    : private ::cppu::BaseMutex,
-      public TaskPanelResourceInterfaceBase      
-{
-public:
-    TaskPanelResource (
-        const Reference<XResourceId>& rxResourceId );
-    virtual ~TaskPanelResource ();
-    
-    virtual void SAL_CALL disposing ();
-
-    // XResource
-
-    virtual Reference<XResourceId> SAL_CALL getResourceId (void)
-        throw (css::uno::RuntimeException);
-
-    virtual sal_Bool SAL_CALL isAnchorOnly () throw (RuntimeException)
-    { return false; }
-
-private:
-    const Reference<XResourceId> mxResourceId;
-};
-
-} // end of anonymous namespace.
-
-
-
-
-//===== TaskPanelFactory =======================================================
-
-TaskPanelFactory::TaskPanelFactory (
-    const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext)
-    : TaskPanelFactoryInterfaceBase(m_aMutex),
-      mpViewShellBase(NULL)
-{
-    (void)rxContext;
-}
-
-
-
-
-TaskPanelFactory::~TaskPanelFactory (void)
-{
-}
-
-
-
-
-void SAL_CALL TaskPanelFactory::disposing (void)
-{
-}
-
-
-
-    
-//===== XInitialization =======================================================
-    
-void SAL_CALL TaskPanelFactory::initialize(
-    const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
-    throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
-{
-    if (aArguments.getLength() > 0)
-    {
-        try
-        {
-            // Get the XController from the first argument.
-            Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
-
-            // Tunnel through the controller to obtain access to the ViewShellBase.
-            try
-            {
-                Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
-                DrawController* pController
-                    = reinterpret_cast<DrawController*>(
-                        sal::static_int_cast<sal_uIntPtr>(
-                            xTunnel->getSomething(DrawController::getUnoTunnelId())));
-                if (pController != NULL)
-                    mpViewShellBase = pController->GetViewShellBase();
-
-            }
-            catch(RuntimeException&)
-            {}
-
-
-            Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
-            Reference<XConfigurationController> xCC (
-                xCM->getConfigurationController(), UNO_QUERY_THROW);
-            xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this);
-            xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this);
-            xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this);
-            xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this);
-            xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this);
-        }
-        catch (RuntimeException&)
-        {
-        }
-    }
-}
-
-
-//===== XResourceController ===================================================
-
-namespace
-{
-    void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< ::rtl::OUString >& o_rResourceURLs )
-    {
-        ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" );
-        o_rResourceURLs.resize(0);
-
-        Reference< XResourceId > xResourceId( i_rResourceId );
-        ::rtl::OUString sResourceURL = xResourceId->getResourceURL();
-        while ( sResourceURL.getLength() > 0 )
-        {
-            o_rResourceURLs.push_back( sResourceURL );
-            xResourceId = xResourceId->getAnchor();
-            sResourceURL = xResourceId->getResourceURL();
-        }
-    }
-}
-
-Reference<XResource> SAL_CALL TaskPanelFactory::createResource (
-    const Reference<XResourceId>& rxResourceId)
-    throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
-{
-    Reference<XResource> xResource;
-    
-    if ( ! rxResourceId.is())
-        return NULL;
-
-    OUString sResourceURL (rxResourceId->getResourceURL());
-
-    if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) )
-    {
-        toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) );
-        
-        if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) )
-        {
-            ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
-
-            // assume that the top-level anchor is the URL of the pane
-            ::std::vector< ::rtl::OUString > aResourceURLs;
-            lcl_collectResourceURLs( rxResourceId, aResourceURLs );
-
-            const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
-            const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
-
-            toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
-            if ( pToolPanel != NULL )
-                xResource = new TaskPanelResource( rxResourceId );
-
-            OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" );
-        }
-    }
-
-    return xResource;
-}
-
-
-
-
-void SAL_CALL TaskPanelFactory::releaseResource (
-    const Reference<XResource>& rxResource)
-    throw (RuntimeException)
-{
-    ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" );
-    const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW );
-
-    // assume that the top-level anchor is the URL of the pane
-    ::std::vector< ::rtl::OUString > aResourceURLs;
-    lcl_collectResourceURLs( xResourceId, aResourceURLs );
-
-    OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" );
-    if ( !aResourceURLs.empty() )
-    {
-        const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
-        ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
-        const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
-        if ( pPaneViewShell != NULL )
-        {
-            const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() );
-            const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) );
-            toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
-
-            if  (   ( ePanelId != toolpanel::PID_UNKNOWN )
-                &&  ( pToolPanel != NULL )
-                )
-            {
-                pToolPanel->DeactivatePanel( sPanelResourceURL );
-            }
-            else
-            {
-                OSL_ENSURE( false, "TaskPanelFactory::releaseResource: don't know what to do with this resource!" );
-            }
-        }
-    }
-
-    Reference<XComponent> xComponent (rxResource, UNO_QUERY);
-    if (xComponent.is())
-        xComponent->dispose();
-}
-
-
-
-
-//===== ToolPanelResource =====================================================
-
-namespace {
-
-TaskPanelResource::TaskPanelResource (
-    const Reference<XResourceId>& rxResourceId)
-    : TaskPanelResourceInterfaceBase(m_aMutex),
-      mxResourceId(rxResourceId)
-{
-}
-
-
-
-
-TaskPanelResource::~TaskPanelResource (void)
-{
-}
-
-
-
-
-void SAL_CALL TaskPanelResource::disposing ()
-{
-}
-
-
-
-
-Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
-    throw (css::uno::RuntimeException)
-{
-    return mxResourceId;
-}
-
-} // end of anonymous namespace
-
-} } // end of namespace sd::framework
diff --git a/main/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/main/sd/source/ui/framework/factories/TaskPanelFactory.hxx
deleted file mode 100644
index 8afb90a..0000000
--- a/main/sd/source/ui/framework/factories/TaskPanelFactory.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
-#define SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
-
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <osl/mutex.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase2.hxx>
-
-#include <boost/scoped_ptr.hpp>
-
-namespace css = ::com::sun::star;
-
-namespace {
-
-typedef ::cppu::WeakComponentImplHelper2 <
-    css::lang::XInitialization,
-    css::drawing::framework::XResourceFactory
-    > TaskPanelFactoryInterfaceBase;
-
-} // end of anonymous namespace.
-
-
-namespace sd { class ViewShellBase; }
-
-namespace sd { namespace framework {
-
-/** This class creates panels for the task pane.
-*/
-class TaskPanelFactory
-    : private ::cppu::BaseMutex,
-      public TaskPanelFactoryInterfaceBase      
-{
-public:
-    TaskPanelFactory (
-        const css::uno::Reference<css::uno::XComponentContext>& rxContext);
-    virtual ~TaskPanelFactory (void);
-    
-    virtual void SAL_CALL disposing (void);
-
-    
-    // XInitialization
-    
-    virtual void SAL_CALL initialize(
-        const css::uno::Sequence<css::uno::Any>& aArguments)
-        throw (css::uno::Exception, css::uno::RuntimeException);
-
-
-    // XResourceFactory
-
-    virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
-            const css::uno::Reference<
-                css::drawing::framework::XResourceId>& rxResourcesId)
-        throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
-
-    virtual void SAL_CALL releaseResource (
-        const css::uno::Reference<
-            css::drawing::framework::XResource>& rxResource)
-        throw (css::uno::RuntimeException);
-
-private:
-    ViewShellBase* mpViewShellBase;
-};
-
-} } // end of namespace sd::framework
-
-#endif
diff --git a/main/sd/source/ui/framework/factories/TaskPanelResource.cxx b/main/sd/source/ui/framework/factories/TaskPanelResource.cxx
new file mode 100644
index 0000000..824ed25
--- /dev/null
+++ b/main/sd/source/ui/framework/factories/TaskPanelResource.cxx
@@ -0,0 +1,133 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "framework/TaskPanelResource.hxx"
+
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+using namespace css;
+using namespace cssu;
+using namespace cssdf;
+
+
+namespace sd { namespace framework {
+
+namespace {
+    ::Window* GetWindowForResource (
+        ViewShellBase& rViewShellBase,
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId)
+    {
+        ::Window* pWindow = NULL;
+        if (rxResourceId.is() && rxResourceId->getAnchor().is())
+        {
+            ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rViewShellBase));
+            Reference<awt::XWindow> xWindow (
+                pFrameworkHelper->GetPaneWindow(rxResourceId->getAnchor()->getAnchor()));
+            pWindow = VCLUnoHelper::GetWindow(xWindow);
+        }
+        return pWindow;
+    }
+}
+
+
+
+
+TaskPanelResource::TaskPanelResource (
+    sidebar::SidebarViewShell& rSidebarViewShell,
+    sidebar::PanelId ePanelId,
+    const Reference<XResourceId>& rxResourceId)
+    : TaskPanelResourceInterfaceBase(m_aMutex),
+      mxResourceId(rxResourceId),
+      mpControl(rSidebarViewShell.CreatePanel(
+              GetWindowForResource(rSidebarViewShell.GetViewShellBase(), rxResourceId),
+              ePanelId))
+{
+    if (mpControl.get() != NULL)
+    {
+        mpControl->Show();
+        mpControl->GetParent()->Show();
+        mpControl->AddEventListener(LINK(this,TaskPanelResource,WindowEventHandler));
+    }
+}
+
+
+
+
+TaskPanelResource::~TaskPanelResource (void)
+{
+    mpControl.reset();
+}
+
+
+
+
+void SAL_CALL TaskPanelResource::disposing ()
+{
+    mpControl.reset();
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
+    throw (css::uno::RuntimeException)
+{
+    return mxResourceId;
+}
+
+
+
+
+sal_Bool SAL_CALL TaskPanelResource::isAnchorOnly (void)
+    throw (RuntimeException)
+{
+    return false;
+}
+
+
+
+
+::Window* TaskPanelResource::GetControl (void) const
+{
+    return mpControl.get();
+}
+
+
+
+
+IMPL_LINK(TaskPanelResource,WindowEventHandler,VclWindowEvent*,pEvent)
+{
+    if (pEvent!=NULL && pEvent->GetId()==SFX_HINT_DYING)
+    {
+        // Somebody else deleted the window.  Release our reference so
+        // that we do not delete it again.
+        mpControl.release();
+        return sal_True;
+    }
+    else
+        return sal_False;
+}
+
+} } // end of namespace sd::framework
diff --git a/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx
index 722dd47..f43fe6e 100644
--- a/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx
+++ b/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -25,7 +25,6 @@
 
 #include "framework/ViewShellWrapper.hxx"
 #include "framework/Pane.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
 #include "ViewShell.hxx"
 #include "Window.hxx"
 
@@ -50,7 +49,6 @@
 using ::com::sun::star::lang::DisposedException;
 
 using ::rtl::OUString;
-using ::sd::toolpanel::ToolPanelViewShell;
 
 namespace sd { namespace framework {
 
diff --git a/main/sd/source/ui/framework/factories/makefile.mk b/main/sd/source/ui/framework/factories/makefile.mk
index 92ae795..c634ee8 100644
--- a/main/sd/source/ui/framework/factories/makefile.mk
+++ b/main/sd/source/ui/framework/factories/makefile.mk
@@ -47,7 +47,6 @@
 	$(SLO)$/FullScreenPane.obj				\
 	$(SLO)$/Pane.obj						\
 	$(SLO)$/PresentationFactory.obj			\
-	$(SLO)$/TaskPanelFactory.obj			\
 	$(SLO)$/ViewShellWrapper.obj
 
 # --- Tagets -------------------------------------------------------
diff --git a/main/sd/source/ui/framework/module/ImpressModule.cxx b/main/sd/source/ui/framework/module/ImpressModule.cxx
index 35b4ccf..3d5b194 100644
--- a/main/sd/source/ui/framework/module/ImpressModule.cxx
+++ b/main/sd/source/ui/framework/module/ImpressModule.cxx
@@ -29,7 +29,6 @@
 #include "ViewTabBarModule.hxx"
 #include "CenterViewFocusModule.hxx"
 #include "SlideSorterModule.hxx"
-#include "ToolPanelModule.hxx"
 #include "ToolBarModule.hxx"
 #include "ShellStackGuard.hxx"
 
@@ -50,7 +49,6 @@
     new SlideSorterModule(
         rxController,
         FrameworkHelper::msLeftImpressPaneURL);
-    ToolPanelModule::Initialize(rxController);
     new ToolBarModule(rxController);
     new ShellStackGuard(rxController);
 }
diff --git a/main/sd/source/ui/framework/module/ModuleController.cxx b/main/sd/source/ui/framework/module/ModuleController.cxx
index 0c106fe..0ca0710 100644
--- a/main/sd/source/ui/framework/module/ModuleController.cxx
+++ b/main/sd/source/ui/framework/module/ModuleController.cxx
@@ -304,9 +304,18 @@
                 // Create the factory service.
                 Sequence<Any> aArguments(1);
                 aArguments[0] <<= mxController;
-                xFactory = xGlobalFactory->createInstanceWithArguments(
-                    iFactory->second,
-                    aArguments);
+                OSL_TRACE("creating resource %s",
+                    OUStringToOString(iFactory->second, RTL_TEXTENCODING_ASCII_US).getStr());
+                try
+                {
+                    xFactory = xGlobalFactory->createInstanceWithArguments(
+                        iFactory->second,
+                        aArguments);
+                }
+                catch(Exception&e)
+                {
+                    OSL_TRACE("caught exception while creating factory.");
+                }
 
                 // Remember that this factory has been instanced.
                 (*mpLoadedFactories)[iFactory->second] = xFactory;
diff --git a/main/sd/source/ui/framework/module/ToolPanelModule.cxx b/main/sd/source/ui/framework/module/ToolPanelModule.cxx
index 6049460..4ffbf10 100644
--- a/main/sd/source/ui/framework/module/ToolPanelModule.cxx
+++ b/main/sd/source/ui/framework/module/ToolPanelModule.cxx
@@ -142,8 +142,8 @@
         new ResourceManager(
             rxController,
             FrameworkHelper::CreateResourceId(
-                FrameworkHelper::msTaskPaneURL,
-                FrameworkHelper::msRightPaneURL)));
+                FrameworkHelper::msSidebarViewURL,
+                FrameworkHelper::msSidebarPaneURL)));
     pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL);
     pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL);
     pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL);
diff --git a/main/sd/source/ui/framework/tools/FrameworkHelper.cxx b/main/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 50bd793..859fb2b 100644
--- a/main/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/main/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #include "precompiled_sd.hxx"
 
 #include <osl/time.h>
@@ -37,6 +35,7 @@
 #include "DrawController.hxx"
 #include "app.hrc"
 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
 #include <cppuhelper/compbase1.hxx>
 #include <svl/lstner.hxx>
 
@@ -102,8 +101,10 @@
     virtual ~CallbackCaller (void);
 
     virtual void SAL_CALL disposing (void);
+    // XEventListener
     virtual void SAL_CALL disposing (const lang::EventObject& rEvent)
         throw (RuntimeException);
+    // XConfigurationChangeListener
     virtual void SAL_CALL notifyConfigurationChange (const ConfigurationChangeEvent& rEvent)
         throw (RuntimeException);
 
@@ -179,8 +180,8 @@
     msPaneURLPrefix + OUString::createFromAscii("LeftImpressPane"));
 const OUString FrameworkHelper::msLeftDrawPaneURL(
     msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane"));
-const OUString FrameworkHelper::msRightPaneURL(
-    msPaneURLPrefix + OUString::createFromAscii("RightPane"));
+const OUString FrameworkHelper::msSidebarPaneURL(
+    msPaneURLPrefix + OUString::createFromAscii("SidebarPane"));
 
 
 // View URLs.
@@ -201,8 +202,8 @@
     msViewURLPrefix + OUString::createFromAscii("SlideSorter"));
 const OUString FrameworkHelper::msPresentationViewURL(
     msViewURLPrefix + OUString::createFromAscii("PresentationView"));
-const OUString FrameworkHelper::msTaskPaneURL(
-    msViewURLPrefix + OUString::createFromAscii("TaskPane"));
+const OUString FrameworkHelper::msSidebarViewURL(
+    msViewURLPrefix + OUString::createFromAscii("SidebarView"));
 
 
 // Tool bar URLs.
@@ -215,9 +216,13 @@
 
 // Task panel URLs.
 const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix(
-    OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/"));
-const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL(
-    msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages"));
+    OUString::createFromAscii("private:resource/toolpanel/"));
+const ::rtl::OUString FrameworkHelper::msAllMasterPagesTaskPanelURL(
+    msTaskPanelURLPrefix + OUString::createFromAscii("AllMasterPages"));
+const ::rtl::OUString FrameworkHelper::msRecentMasterPagesTaskPanelURL(
+    msTaskPanelURLPrefix + OUString::createFromAscii("RecentMasterPages"));
+const ::rtl::OUString FrameworkHelper::msUsedMasterPagesTaskPanelURL(
+    msTaskPanelURLPrefix + OUString::createFromAscii("UsedMasterPages"));
 const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL(
     msTaskPanelURLPrefix + OUString::createFromAscii("Layouts"));
 const ::rtl::OUString FrameworkHelper::msTableDesignPanelURL(
@@ -237,6 +242,8 @@
     OUString::createFromAscii("ResourceActivation"));
 const OUString FrameworkHelper::msResourceDeactivationEvent(
     OUString::createFromAscii("ResourceDeactivation"));
+const OUString FrameworkHelper::msResourceDeactivationEndEvent(
+    OUString::createFromAscii("ResourceDeactivationEnd"));
 const OUString FrameworkHelper::msConfigurationUpdateStartEvent(
     OUString::createFromAscii("ConfigurationUpdateStart"));
 const OUString FrameworkHelper::msConfigurationUpdateEndEvent(
@@ -337,6 +344,20 @@
 
 
 
+//----- FrameworkHelper::Deleter ----------------------------------------------
+
+class FrameworkHelper::Deleter
+{
+public:
+    void operator()(FrameworkHelper* pObject)
+    {
+        delete pObject;
+    }
+};
+
+
+
+
 //----- FrameworkHelper -------------------------------------------------------
 
 ::boost::scoped_ptr<FrameworkHelper::ViewURLMap> FrameworkHelper::mpViewURLMap(new ViewURLMap());
@@ -381,7 +402,9 @@
         ::osl::MutexGuard aGuard (aMutexFunctor());
         if (iHelper == maInstanceMap.end())
         {
-            pHelper = ::boost::shared_ptr<FrameworkHelper>(new FrameworkHelper(rBase));
+            pHelper = ::boost::shared_ptr<FrameworkHelper>(
+                new FrameworkHelper(rBase),
+                FrameworkHelper::Deleter());
             pHelper->Initialize();
             OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
             maInstanceMap[&rBase] = pHelper;
@@ -524,6 +547,61 @@
 
 
 
+Reference<awt::XWindow> FrameworkHelper::GetPaneWindow (const Reference<XResourceId>& rxPaneId)
+{
+    Reference<awt::XWindow> xWindow;
+    
+    if (rxPaneId.is() && mxConfigurationController.is())
+    {
+        try
+        {
+            if (rxPaneId->getResourceURL().match(msPaneURLPrefix))
+            {
+                Reference<XPane> xPane (mxConfigurationController->getResource(rxPaneId), UNO_QUERY);
+                if (xPane.is())
+                    xWindow = xPane->getWindow();
+            }
+        }
+        catch (lang::DisposedException&)
+        {
+            Dispose();
+        }
+        catch (RuntimeException&)
+        {
+        }
+    }
+    
+    return xWindow;
+}
+
+
+
+
+Reference<XResource> FrameworkHelper::GetResource (const Reference<XResourceId>& rxResourceId)
+{
+    Reference<XResource> xResource;
+    
+    if (rxResourceId.is() && mxConfigurationController.is())
+    {
+        try
+        {
+            return mxConfigurationController->getResource(rxResourceId);
+        }
+        catch (lang::DisposedException&)
+        {
+            Dispose();
+        }
+        catch (RuntimeException&)
+        {
+        }
+    }
+    
+    return NULL;
+}
+
+
+
+
 Reference<XResourceId> FrameworkHelper::RequestView (
     const OUString& rsResourceURL,
     const OUString& rsAnchorURL)
@@ -559,7 +637,7 @@
 
 
 
-void FrameworkHelper::RequestTaskPanel (
+Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
     const OUString& rsTaskPanelURL,
     const bool bEnsureTaskPaneIsVisible)
 {
@@ -572,26 +650,29 @@
             {
                 Reference<XConfiguration> xConfiguration (
                     mxConfigurationController->getCurrentConfiguration());
-            if (xConfiguration.is())
-                if ( ! xConfiguration->hasResource(
-                    CreateResourceId(msTaskPaneURL, msRightPaneURL)))
-                {
-                    // Task pane does is not active.  Do not force it.
-                    return;
-                }
+                if (xConfiguration.is())
+                    if ( ! xConfiguration->hasResource(
+                            CreateResourceId(msSidebarViewURL, msSidebarPaneURL)))
+                    {
+                        // Task pane is not active.  Do not force it.
+                        return NULL;
+                    }
             }
 
-            // Create the resource id from URLs for the pane, the task pane
-            // view, and the task panel.
+            // Create the resource id from URLs for the sidebar pane
+            // and view and the requested panel.
             mxConfigurationController->requestResourceActivation(
-                CreateResourceId(msRightPaneURL),
+                CreateResourceId(msSidebarPaneURL),
                 ResourceActivationMode_ADD);
             mxConfigurationController->requestResourceActivation(
-                CreateResourceId(msTaskPaneURL, msRightPaneURL),
+                CreateResourceId(msSidebarViewURL, msSidebarPaneURL),
                 ResourceActivationMode_REPLACE);
+            Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
             mxConfigurationController->requestResourceActivation(
-                CreateResourceId(rsTaskPanelURL, msTaskPaneURL, msRightPaneURL),
+                xPanelId,
                 ResourceActivationMode_REPLACE);
+
+            return xPanelId;
         }
     }
     catch (lang::DisposedException&)
@@ -600,6 +681,26 @@
     }
     catch (RuntimeException&)
     {}
+
+    return NULL;
+}
+
+
+
+
+void FrameworkHelper::RequestResourceDeactivation (const cssu::Reference<cssdf::XResourceId>& rxResourceId)
+{
+    try
+    {
+        if (mxConfigurationController.is() && rxResourceId.is())
+            mxConfigurationController->requestResourceDeactivation(rxResourceId);
+    }
+    catch (lang::DisposedException&)
+    {
+        Dispose();
+    }
+    catch (RuntimeException&)
+    {}
 }
 
 
@@ -616,7 +717,7 @@
         (*mpViewURLMap)[msHandoutViewURL] = ViewShell::ST_HANDOUT;
         (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER;
         (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION;
-        (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE;
+        (*mpViewURLMap)[msSidebarViewURL] = ViewShell::ST_SIDEBAR;
     }
     ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL));
     if (iView != mpViewURLMap->end())
@@ -639,7 +740,7 @@
         case ViewShell::ST_HANDOUT : return msHandoutViewURL;
         case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL;
         case ViewShell::ST_PRESENTATION : return msPresentationViewURL;
-        case ViewShell::ST_TASK_PANE : return msTaskPaneURL;
+        case ViewShell::ST_SIDEBAR : return msSidebarViewURL;
         default:
             return OUString();
     }
@@ -788,6 +889,30 @@
 
 
 
+void FrameworkHelper::RunOnResourceDeactivation(
+    const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+    const Callback& rCallback,
+    const bool bRunOnDeactivationEnd)
+{
+    if (mxConfigurationController.is()
+        && ! mxConfigurationController->getResource(rxResourceId).is())
+    {
+        rCallback(false);
+    }
+    else
+    {
+        RunOnEvent(
+            bRunOnDeactivationEnd
+                ? msResourceDeactivationEndEvent
+                : msResourceDeactivationEvent,
+            FrameworkHelperResourceIdFilter(rxResourceId),
+            rCallback);
+    }
+}
+
+
+
+
 /** A callback that sets a flag to a specified value when the callback is
     called.
 */
diff --git a/main/sd/source/ui/func/fuarea.cxx b/main/sd/source/ui/func/fuarea.cxx
index af86e72..87e985f 100644
--- a/main/sd/source/ui/func/fuarea.cxx
+++ b/main/sd/source/ui/func/fuarea.cxx
@@ -91,6 +91,8 @@
 						SID_ATTR_FILL_GRADIENT,
 						SID_ATTR_FILL_HATCH,
 						SID_ATTR_FILL_BITMAP,
+                        SID_ATTR_FILL_TRANSPARENCE,
+                        SID_ATTR_FILL_FLOATTRANSPARENCE,
 						0 };
 
 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
diff --git a/main/sd/source/ui/func/fuchar.cxx b/main/sd/source/ui/func/fuchar.cxx
index e361b86..fe3340d 100644
--- a/main/sd/source/ui/func/fuchar.cxx
+++ b/main/sd/source/ui/func/fuchar.cxx
@@ -26,7 +26,7 @@
 
 
 #include "fuchar.hxx"
-
+#include <svx/dialogs.hrc>
 #include <sfx2/viewfrm.hxx>
 
 #include <editeng/editdata.hxx>
@@ -87,6 +87,10 @@
 		SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
 		if( pDlg )
 		{
+			if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
+			{
+				pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
+			}
 			sal_uInt16 nResult = pDlg->Execute();
 
 			if( nResult == RET_OK )
@@ -110,9 +114,12 @@
 					SID_ATTR_CHAR_FONT,
 					SID_ATTR_CHAR_POSTURE,
 					SID_ATTR_CHAR_WEIGHT,
+					SID_ATTR_CHAR_SHADOWED,
+					SID_ATTR_CHAR_STRIKEOUT,
 					SID_ATTR_CHAR_UNDERLINE,
 					SID_ATTR_CHAR_FONTHEIGHT,
 					SID_ATTR_CHAR_COLOR,
+					SID_ATTR_CHAR_KERNING,	
 					SID_SET_SUPER_SCRIPT,
 					SID_SET_SUB_SCRIPT,
 					0 };
diff --git a/main/sd/source/ui/func/fuline.cxx b/main/sd/source/ui/func/fuline.cxx
index 2bd4ce6..a1bac11 100644
--- a/main/sd/source/ui/func/fuline.cxx
+++ b/main/sd/source/ui/func/fuline.cxx
@@ -99,11 +99,16 @@
 
 		// Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
 		static sal_uInt16 SidArray[] = {
-						SID_ATTR_LINE_STYLE,
-						SID_ATTR_LINE_DASH,
-						SID_ATTR_LINE_WIDTH,
-						SID_ATTR_LINE_COLOR,
-						0 };
+            SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
+            SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
+            SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
+            SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
+            SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
+            SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
+            SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
+            SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
+            SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
+            0 };
 
 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
 
diff --git a/main/sd/source/ui/func/fuolbull.cxx b/main/sd/source/ui/func/fuolbull.cxx
index 999fb50..4598db3 100644
--- a/main/sd/source/ui/func/fuolbull.cxx
+++ b/main/sd/source/ui/func/fuolbull.cxx
@@ -32,6 +32,9 @@
 #include <editeng/eeitem.hxx>
 #include <sfx2/request.hxx>
 #include <svl/intitem.hxx>
+#include <editeng/numitem.hxx>
+#include "sdresid.hxx"
+#include "glob.hrc"
 
 #include <editeng/editdata.hxx>
 #include <svx/svxids.hrc>
@@ -43,7 +46,10 @@
 #endif
 #include "drawdoc.hxx"
 #include "sdabstdlg.hxx"
-
+#include <svx/nbdtmg.hxx>
+#include <svx/nbdtmgfact.hxx>
+#include <svx/svdoutl.hxx>
+using namespace svx::sidebar;
 namespace sd {
 
 TYPEINIT1( FuOutlineBullet, FuPoor );
@@ -70,6 +76,16 @@
 
 void FuOutlineBullet::DoExecute( SfxRequest& rReq )
 {
+	sal_uInt16 nSId = rReq.GetSlot();
+	if (nSId == FN_SVX_SET_BULLET){
+		SetCurrentBullet(rReq);
+		return;
+	}
+	else if (nSId == FN_SVX_SET_NUMBER){
+		SetCurrentNumbering(rReq);
+		return;
+	}
+	
 	const SfxItemSet* pArgs = rReq.GetArgs();
 
 	if( !pArgs )
@@ -137,6 +153,390 @@
 */
 }
 
+void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq)
+{
+	if (!mpDoc || !mpView)
+		return;	
 
+	SfxItemSet aEditAttr( mpDoc->GetPool() );
+	mpView->GetAttributes( aEditAttr );		
+
+	SfxItemSet aNewAttr( mpViewShell->GetPool(),
+							 EE_ITEMS_START, EE_ITEMS_END );
+	aNewAttr.Put( aEditAttr, sal_False );
+
+	SfxItemSet aSetAttr( mpViewShell->GetPool(),
+							 EE_ITEMS_START, EE_ITEMS_END );
+
+	//Init bullet level in "Customize" tab page in bullet dialog in master page view
+	if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) 
+		&& ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE )
+	{
+		SdrObject* pObj = mpView->GetTextEditObject();
+		if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
+		{
+			sal_uInt16 nLevel = mpView->GetSelectionLevel();
+			if( nLevel != 0xFFFF )
+			{
+
+				SfxItemSet aStoreSet( aNewAttr );
+				aNewAttr.ClearItem();
+				//extend range
+				aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
+				aNewAttr.Put( aStoreSet );
+				//put current level user selected
+				aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
+			}
+		}
+	}
+	//End of add
+
+	sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;	
+	SvxNumRule* pNumRule = NULL;
+	const SfxPoolItem* pTmpItem=NULL;
+	sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
+
+	if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
+		nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
+	
+	pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
+
+	if (pTmpItem)
+		pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());		
+		
+	SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False );
+	if (pItem && pNumRule)
+	{
+		sal_uInt16 nIdx = pItem->GetValue();
+		// If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
+		// And the bullet default status is 1.
+		bool bBulletSwitch = false;
+        sal_Bool isRemoveNum =false;
+		if( nIdx == (sal_uInt16)0xFFFF )
+		{
+			nIdx = 1;
+			bBulletSwitch = true;
+		}
+		if (nIdx == DEFAULT_NONE) 
+		{
+			bBulletSwitch = false;
+			isRemoveNum = true;
+		}
+		nIdx--;
+		
+		NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
+		if ( pNumbering )
+		{
+			//Sym3_2508, set unit attribute to NB Manager
+			pNumbering->SetItems(&aNewAttr);
+			SvxNumRule aTmpRule( *pNumRule );
+			pNumbering->ApplyNumRule(aTmpRule,nIdx,nActNumLvl);
+			sal_uInt16 nMask = 1;
+			for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
+			{
+				if(nActNumLvl & nMask)
+				{
+					SvxNumberFormat aFmt(aTmpRule.GetLevel(i));
+					pNumRule->SetLevel(i, aFmt);
+				}
+				nMask <<= 1 ;
+			}
+			aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); 
+			OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+	       	 std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+	        	if (mpView->ISA(OutlineView))
+	        	{
+			        pOLV = static_cast<OutlineView*>(mpView)
+	                    ->GetViewByWindow(mpViewShell->GetActiveWindow());
+
+			        aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+	        	}
+
+            		SdrOutliner* pOwner = mpView->GetTextEditOutliner();
+			bool bMasterView = false;
+
+			DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell);
+			
+			if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE )					
+				bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
+
+			if( bMasterView )
+			{
+				pOwner->UndoActionStart( OLUNDO_ATTR );
+				pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule,isRemoveNum);
+				mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151
+				pOwner->UndoActionEnd( OLUNDO_ATTR );
+			}
+			else if( pOLV )                
+				pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule ,isRemoveNum);						
+			else
+			{
+				sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+				SdrModel* pSdrModel = mpView->GetModel();
+				sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False;
+				if (bInMasterView && bModelUndoEnabled)
+				{
+					pSdrModel->BegUndo();
+				}
+				mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_False, bInMasterView, pNumRule,isRemoveNum);
+				if (bInMasterView)
+				{
+					mpView->SetAttributes(aSetAttr);
+				}
+				if (bInMasterView && bModelUndoEnabled)
+				{
+					pSdrModel->EndUndo();
+				}
+			}
+		}
+		//End
+	}
+	delete pNumRule;
+	rReq.Done();
+}
+
+void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
+{
+	if (!mpDoc || !mpView)
+		return;	
+
+	SfxItemSet aEditAttr( mpDoc->GetPool() );
+	mpView->GetAttributes( aEditAttr );		
+
+	SfxItemSet aNewAttr( mpViewShell->GetPool(),
+							 EE_ITEMS_START, EE_ITEMS_END );
+	aNewAttr.Put( aEditAttr, sal_False );
+
+	//Add for Sym2_3151, should add new attributes in an empty item set, then use this item set as parameter in SetAttributes()
+	SfxItemSet aSetAttr( mpViewShell->GetPool(),
+							 EE_ITEMS_START, EE_ITEMS_END );
+
+	//Init bullet level in "Customize" tab page in bullet dialog in master page view
+	if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) 
+		&& ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE )
+	{
+		SdrObject* pObj = mpView->GetTextEditObject();
+		if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
+		{
+			sal_uInt16 nLevel = mpView->GetSelectionLevel();
+			if( nLevel != 0xFFFF )
+			{
+				//aNewAttr.MergeRange( SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL );
+				//aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
+				//save the itemset value
+				SfxItemSet aStoreSet( aNewAttr );
+				aNewAttr.ClearItem();
+				//extend range
+				aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
+				aNewAttr.Put( aStoreSet );
+				//put current level user selected
+				aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
+			}
+		}
+	}
+	//End of add
+
+	sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;	
+	SvxNumRule* pNumRule = NULL;	
+	const SfxPoolItem* pTmpItem=NULL;
+	sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
+
+	if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
+		nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
+	
+	pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
+
+	if (pTmpItem)
+		pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
+		
+	SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False );
+	if (pItem && pNumRule)
+	{
+		sal_uInt16 nIdx = pItem->GetValue();
+		// If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
+		// And the bullet default status is 2.
+		bool bBulletSwitch = false;
+        sal_Bool isRemoveNum =false;
+		if( nIdx == (sal_uInt16)0xFFFF )
+		{
+			nIdx = 1;
+			bBulletSwitch = true;
+		}
+		if (nIdx == DEFAULT_NONE) 
+		{
+			bBulletSwitch = false;
+			isRemoveNum = true;
+		}
+
+		nIdx--;
+		//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.8.7
+		
+		NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
+		if ( pBullets )
+		{
+			//Sym3_2508, set unit attribute to NB Manager
+			pBullets->SetItems(&aNewAttr);
+			SvxNumRule aTmpRule( *pNumRule );
+			//Sym3_3423 Always apply the "." if wants a default numbering rule
+			if (bBulletSwitch==true && nIdx==0) //want to reset bullet
+			{
+				pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true);
+			}
+			else {
+				pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl);
+			}
+			sal_uInt16 nMask = 1;
+			for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
+			{
+				if(nActNumLvl & nMask)
+				{
+					SvxNumberFormat aFmt(aTmpRule.GetLevel(i));					
+					pNumRule->SetLevel(i, aFmt);
+				}
+				nMask <<= 1;
+			}
+			aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId);
+
+			OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+	        	std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+		       if (mpView->ISA(OutlineView))
+		       {
+			        pOLV = static_cast<OutlineView*>(mpView)
+	                    ->GetViewByWindow(mpViewShell->GetActiveWindow());
+
+			        aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+		       }
+	
+			SdrOutliner* pOwner = mpView->GetTextEditOutliner();
+			bool bMasterView = false;
+
+			DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell);
+			
+			if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE )
+				bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
+
+			if( bMasterView )
+			{
+				pOwner->UndoActionStart( OLUNDO_ATTR );			
+				pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum );
+				mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151	
+				pOwner->UndoActionEnd( OLUNDO_ATTR );
+			}
+			else if( pOLV )	            
+				pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum );
+			else
+			{	
+				sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+				SdrModel* pSdrModel = mpView->GetModel();
+				sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False;
+				if (bInMasterView && bModelUndoEnabled)
+				{
+					pSdrModel->BegUndo();
+				}
+				mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_True, bInMasterView, pNumRule, isRemoveNum );
+				if (bInMasterView)
+				{
+					mpView->SetAttributes(aSetAttr);
+				}
+				if (bInMasterView && bModelUndoEnabled)
+				{
+					pSdrModel->EndUndo();
+				}
+			}
+		}
+		//End
+	}
+	delete pNumRule;
+	rReq.Done();
+}
+
+const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)
+{
+	//SvxNumBulletItem* pRetItem = NULL;
+	const SfxPoolItem* pTmpItem = NULL;
+	
+	if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET)
+	{
+		return pTmpItem;
+	}
+	else
+	{
+		nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+		SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+		if (eState == SFX_ITEM_SET)
+			return pTmpItem;
+		else
+		{
+			sal_Bool bOutliner = sal_False;
+			sal_Bool bTitle = sal_False;
+
+			if( mpView )
+     		{
+				const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+				const sal_uInt32 nCount = rMarkList.GetMarkCount();
+            
+				for(sal_uInt32 nNum = 0; nNum < nCount; nNum++)
+				{
+					SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+					if( pObj->GetObjInventor() == SdrInventor )
+					{
+						switch(pObj->GetObjIdentifier())
+						{
+						case OBJ_TITLETEXT:
+							bTitle = sal_True;
+							break;
+						case OBJ_OUTLINETEXT:
+							bOutliner = sal_True;
+							break;
+						}
+					}
+				}
+			}
+
+			const SvxNumBulletItem *pItem = NULL;
+			if(bOutliner)
+			{				
+				SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
+				String aStyleName((SdResId((sal_uInt16)STR_LAYOUT_OUTLINE)));
+				aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+				SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
+				if( pFirstStyleSheet )
+					pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
+			}
+
+			if( pItem == NULL )
+				pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+
+			//DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" );
+
+			aNewAttr.Put(*pItem, EE_PARA_NUMBULLET);
+		
+			if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
+			{
+				SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True);
+				SvxNumRule* pRule = pItem->GetNumRule();
+				if(pRule)
+				{
+					SvxNumRule aNewRule( *pRule );
+					aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
+
+					SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+					aNewAttr.Put(aNewItem);
+				}
+			}
+
+			SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+			if (eState == SFX_ITEM_SET)
+				return pTmpItem;
+
+		}
+		//DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!")
+	}
+	return pTmpItem;
+}
 
 } // end of namespace sd
diff --git a/main/sd/source/ui/func/fuoltext.cxx b/main/sd/source/ui/func/fuoltext.cxx
index b548ae9..6b7d912 100644
--- a/main/sd/source/ui/func/fuoltext.cxx
+++ b/main/sd/source/ui/func/fuoltext.cxx
@@ -61,9 +61,12 @@
 				SID_ATTR_CHAR_FONT,
 				SID_ATTR_CHAR_POSTURE,
 				SID_ATTR_CHAR_WEIGHT,
+				SID_ATTR_CHAR_SHADOWED,
+				SID_ATTR_CHAR_STRIKEOUT,
 				SID_ATTR_CHAR_UNDERLINE,
 				SID_ATTR_CHAR_FONTHEIGHT,
 				SID_ATTR_CHAR_COLOR,
+				SID_ATTR_CHAR_KERNING,
 				SID_OUTLINE_UP,
 				SID_OUTLINE_DOWN,
 				SID_OUTLINE_LEFT,
diff --git a/main/sd/source/ui/func/fuparagr.cxx b/main/sd/source/ui/func/fuparagr.cxx
index 4883a46..1cfb3b3 100644
--- a/main/sd/source/ui/func/fuparagr.cxx
+++ b/main/sd/source/ui/func/fuparagr.cxx
@@ -154,6 +154,8 @@
 	// invalidieren der Slots
 	static sal_uInt16 SidArray[] = {
         SID_ATTR_TABSTOP,
+	SID_ATTR_PARA_LINESPACE,
+	SID_ATTR_PARA_ULSPACE,
         SID_ATTR_PARA_ADJUST_LEFT,
         SID_ATTR_PARA_ADJUST_RIGHT,
         SID_ATTR_PARA_ADJUST_CENTER,
diff --git a/main/sd/source/ui/func/futext.cxx b/main/sd/source/ui/func/futext.cxx
index 985d429..a62a530 100644
--- a/main/sd/source/ui/func/futext.cxx
+++ b/main/sd/source/ui/func/futext.cxx
@@ -93,9 +93,12 @@
 	SID_ATTR_CHAR_FONT,               //   10007
 	SID_ATTR_CHAR_POSTURE,            //   10008
 	SID_ATTR_CHAR_WEIGHT,             //   10009
+	SID_ATTR_CHAR_SHADOWED,		//10010
+	SID_ATTR_CHAR_STRIKEOUT,		//10013
 	SID_ATTR_CHAR_UNDERLINE,          //   10014
 	SID_ATTR_CHAR_FONTHEIGHT,         //   10015
 	SID_ATTR_CHAR_COLOR,              //   10017
+	SID_ATTR_CHAR_KERNING,			//10018
 	SID_ATTR_PARA_ADJUST_LEFT,        //   10028
 	SID_ATTR_PARA_ADJUST_RIGHT,       //   10029
 	SID_ATTR_PARA_ADJUST_CENTER,      //   10030
@@ -103,14 +106,26 @@
 	SID_ATTR_PARA_LINESPACE_10,       //   10034
 	SID_ATTR_PARA_LINESPACE_15,       //   10035
 	SID_ATTR_PARA_LINESPACE_20,       //   10036
+	SID_ATTR_PARA_ULSPACE,  	   //   10042
 	SID_ATTR_PARA_LRSPACE,            //   10043
+    SID_ATTR_TRANSFORM_POS_X, //  10088
+    SID_ATTR_TRANSFORM_POS_Y, //  10089
+    SID_ATTR_TRANSFORM_WIDTH, //  10090
+    SID_ATTR_TRANSFORM_HEIGHT,//  10091
+    SID_ATTR_TRANSFORM_ROT_X, //  10093
+    SID_ATTR_TRANSFORM_ROT_Y, //  10094
+    SID_ATTR_TRANSFORM_ANGLE, //  10095 //Added
 	SID_OUTLINE_UP,                   //   10150
 	SID_OUTLINE_DOWN,                 //   10151
 	SID_OUTLINE_LEFT,                 //   10152
 	SID_OUTLINE_RIGHT,                //   10153
+    SID_ATTR_TRANSFORM_PROTECT_POS,//  10236
+    SID_ATTR_TRANSFORM_PROTECT_SIZE,// 10237 //Added
 	SID_FORMTEXT_STYLE,               //   10257
 	SID_SET_SUPER_SCRIPT,             //   10294
 	SID_SET_SUB_SCRIPT,               //   10295
+    SID_ATTR_TRANSFORM_AUTOWIDTH,//    10310
+    SID_ATTR_TRANSFORM_AUTOHEIGHT,//   10311 //Added
 	SID_HYPERLINK_GETLINK,            //   10361
 	SID_CHARMAP,					  //   10503
 	SID_TEXTDIRECTION_LEFT_TO_RIGHT,  //   10907
@@ -1183,7 +1198,8 @@
 						{
 							// #98198# Move cursor to end of text
 							ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
-							pOLV->SetSelection(aNewSelection);
+							if (pOLV != NULL)
+								pOLV->SetSelection(aNewSelection);
 						}
 					}
 					else
diff --git a/main/sd/source/ui/inc/DrawViewShell.hxx b/main/sd/source/ui/inc/DrawViewShell.hxx
index 0fe4893..82d1930 100644
--- a/main/sd/source/ui/inc/DrawViewShell.hxx
+++ b/main/sd/source/ui/inc/DrawViewShell.hxx
@@ -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>
 
@@ -164,6 +166,7 @@
 
 	void	        ExecCtrl(SfxRequest& rReq);
 	void	        GetCtrlState(SfxItemSet& rSet);
+	void	        GetDrawAttrState(SfxItemSet& rSet);
 	void	        GetMenuState(SfxItemSet& rSet);
 	void	        GetTableMenuState(SfxItemSet& rSet);
     /** Set the items of the given item set that are related to
@@ -196,6 +199,9 @@
 	void	        ExecNavigatorWin(SfxRequest& rReq);
 	void	        GetNavigatorWinState(SfxItemSet& rSet);
 
+	void         ExecutePropPanelAttr (SfxRequest& rReq);
+	void	        GetStatePropPanelAttr(SfxItemSet& rSet);
+
 	void	        ExecEffectWin(SfxRequest& rReq);
 
 	void	        Update3DWindow();
@@ -218,6 +224,8 @@
 	void	        AttrExec (SfxRequest& rReq);
 	void	        AttrState (SfxItemSet& rSet);
 
+	void		ExecChar(SfxRequest& rReq);
+
     void            ExecuteAnnotation (SfxRequest& rRequest);
     void            GetAnnotationState (SfxItemSet& rItemSet);
 
@@ -430,6 +438,10 @@
     */
     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
@@ -483,6 +495,8 @@
         const sal_uInt16 nSnapLineIndex,
         const Point& rMouseLocation);
 
+    ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const;
+    
 	using ViewShell::Notify;
 	
 	::std::auto_ptr< AnnotationManager > mpAnnotationManager;
diff --git a/main/sd/source/ui/inc/PaneChildWindows.hxx b/main/sd/source/ui/inc/PaneChildWindows.hxx
index 70863ba..294e824 100644
--- a/main/sd/source/ui/inc/PaneChildWindows.hxx
+++ b/main/sd/source/ui/inc/PaneChildWindows.hxx
@@ -68,29 +68,7 @@
     SFX_DECL_CHILDWINDOW(LeftPaneDrawChildWindow);
 };
 
-
-
-
-//======================================================================================================================
-//= ToolPanelChildWindow
-//======================================================================================================================
-class ToolPanelChildWindow  :public PaneChildWindow
-                            ,public ::sfx2::ITaskPaneToolPanelAccess
-{
-public:
-    ToolPanelChildWindow(
-        ::Window* i_pParentWindow,
-        sal_uInt16 i_nId, 
-        SfxBindings* i_pBindings, 
-        SfxChildWinInfo* i_pChildWindowInfo );
-
-    SFX_DECL_CHILDWINDOW( ToolPanelChildWindow );
-
-    // ::sfx2::ITaskPaneToolPanelAccess
-    virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
-};
-
-
+    
 } // end of namespace ::sd
 
 #endif
diff --git a/main/sd/source/ui/inc/SidebarPanelId.hxx b/main/sd/source/ui/inc/SidebarPanelId.hxx
new file mode 100644
index 0000000..bdf22a8
--- /dev/null
+++ b/main/sd/source/ui/inc/SidebarPanelId.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANEL_ID_HXX
+#define SD_SIDEBAR_PANEL_ID_HXX
+
+namespace rtl
+{
+    class OUString;
+}
+
+
+namespace sd { namespace sidebar {
+
+/** List of top level panels that can be shown in the task pane.
+*/
+enum PanelId
+{
+    PID__START = 0,
+    PID_UNKNOWN = PID__START,
+    PID_MASTER_PAGES_ALL,
+    PID_MASTER_PAGES_RECENT,
+    PID_MASTER_PAGES_USED,
+    PID_LAYOUT,
+    PID_TABLE_DESIGN,
+    PID_ANIMATION_SCHEMES,
+    PID_CUSTOM_ANIMATION,
+    PID_SLIDE_TRANSITION,
+    PID__END = PID_SLIDE_TRANSITION
+};
+
+} } // namespace sd::sidebar
+
+
+#endif
diff --git a/main/sd/source/ui/inc/SlideSorterViewShell.hxx b/main/sd/source/ui/inc/SlideSorterViewShell.hxx
index 65dd80e..3d60b92 100644
--- a/main/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/main/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -115,6 +115,7 @@
     virtual void ArrangeGUIElements (void);
 
 	virtual void Activate (sal_Bool IsMDIActivate);
+	virtual void Deactivate (sal_Bool IsMDIActivate);
 
     //===== Drag and Drop =====================================================
 
diff --git a/main/sd/source/ui/inc/TextObjectBar.hxx b/main/sd/source/ui/inc/TextObjectBar.hxx
index 4117b74..d9d9eff 100644
--- a/main/sd/source/ui/inc/TextObjectBar.hxx
+++ b/main/sd/source/ui/inc/TextObjectBar.hxx
@@ -51,6 +51,7 @@
 	virtual ~TextObjectBar (void);
 
 	void GetAttrState( SfxItemSet& rSet );
+	void GetCharState( SfxItemSet& rSet );
 	void Execute( SfxRequest &rReq );
 
 	virtual void Command( const CommandEvent& rCEvt );
diff --git a/main/sd/source/ui/inc/View.hxx b/main/sd/source/ui/inc/View.hxx
index dfb4f70..5b9897c 100644
--- a/main/sd/source/ui/inc/View.hxx
+++ b/main/sd/source/ui/inc/View.hxx
@@ -36,6 +36,7 @@
 #include "fupoor.hxx"
 
 #include "smarttag.hxx"
+#include <editeng/numitem.hxx>
 
 class SdDrawDocument;
 class SdrOle2Obj;
@@ -190,6 +191,8 @@
 	virtual void CheckPossibilities();
 	virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
 	using SdrMarkView::MarkPoints;
+	sal_Bool ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet);
+	void ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false);
 
 	void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
 	void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
diff --git a/main/sd/source/ui/inc/ViewShell.hxx b/main/sd/source/ui/inc/ViewShell.hxx
index cac5f16..1573b46 100644
--- a/main/sd/source/ui/inc/ViewShell.hxx
+++ b/main/sd/source/ui/inc/ViewShell.hxx
@@ -35,9 +35,7 @@
 #include "glob.hxx"
 #include "pres.hxx"
 #include "cfgids.hxx"
-#ifndef _SD_VIEW_HXX
 #include "View.hxx"
-#endif
 #include "sddllapi.h"
 
 #include <com/sun/star/drawing/XDrawSubController.hpp>
@@ -111,7 +109,7 @@
         ST_OUTLINE, 
         ST_SLIDE_SORTER,
         ST_PRESENTATION,
-        ST_TASK_PANE
+        ST_SIDEBAR
     };
     static const int MAX_HSPLIT_CNT = 1;
     static const int MAX_VSPLIT_CNT = 1;
@@ -212,6 +210,8 @@
 	virtual void SetUIUnit(FieldUnit eUnit);
 	virtual void SetDefTabHRuler( sal_uInt16 nDefTab );
 
+	const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId);
+
     sal_Bool HasRuler (void);
 	void SetRuler(sal_Bool bRuler);
 
diff --git a/main/sd/source/ui/inc/celltempl.hxx b/main/sd/source/ui/inc/celltempl.hxx
index 0a7271a..ede68c9 100644
--- a/main/sd/source/ui/inc/celltempl.hxx
+++ b/main/sd/source/ui/inc/celltempl.hxx
@@ -26,7 +26,7 @@
 
 #include <sfx2/styledlg.hxx>
 
-class XColorTable;
+class XColorList;
 class XGradientList;
 class XHatchList;
 class XBitmapList;
@@ -36,7 +36,7 @@
 class SdPresCellTemplateDlg : public SfxStyleDialog
 {
 private:
-	XColorTable*		mpColorTab;
+	XColorList*		mpColorTab;
 	XGradientList*		mpGradientList;
 	XHatchList*			mpHatchingList;
 	XBitmapList*		mpBitmapList;
diff --git a/main/sd/source/ui/inc/copydlg.hxx b/main/sd/source/ui/inc/copydlg.hxx
index 3b116cb..42b906e 100644
--- a/main/sd/source/ui/inc/copydlg.hxx
+++ b/main/sd/source/ui/inc/copydlg.hxx
@@ -33,7 +33,7 @@
 #include <vcl/fixed.hxx>
 #include <sfx2/basedlgs.hxx>
 
-class XColorTable;
+class XColorList;
 
 namespace sd {
 
@@ -49,7 +49,7 @@
 {
 public:
     CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs,
-        XColorTable* pColTab, ::sd::View* pView );
+        XColorList* pColTab, ::sd::View* pView );
     ~CopyDlg();
 
 	void	GetAttr( SfxItemSet& rOutAttrs );
@@ -86,7 +86,7 @@
 	PushButton			maBtnSetDefault;
 
 	const SfxItemSet&	mrOutAttrs;
-	XColorTable*		mpColorTab;
+	XColorList*		mpColorTab;
 	Fraction			maUIScale;
 	::sd::View*			mpView;
 
diff --git a/main/sd/source/ui/inc/dlgpage.hxx b/main/sd/source/ui/inc/dlgpage.hxx
index dd98efe..a58f492 100644
--- a/main/sd/source/ui/inc/dlgpage.hxx
+++ b/main/sd/source/ui/inc/dlgpage.hxx
@@ -29,7 +29,7 @@
 #include "dlgpage.hrc"
 
 class SfxObjectShell;
-class XColorTable;
+class XColorList;
 class XGradientList;
 class XHatchList;
 class XBitmapList;
@@ -48,7 +48,7 @@
 
 	const SfxObjectShell* mpDocShell;
 
-	XColorTable*		mpColorTab;
+	XColorList*		mpColorTab;
 	XGradientList*		mpGradientList;
 	XHatchList*			mpHatchingList;
 	XBitmapList*		mpBitmapList;
diff --git a/main/sd/source/ui/inc/framework/FrameworkHelper.hxx b/main/sd/source/ui/inc/framework/FrameworkHelper.hxx
index 7b82c71..d896a3c 100644
--- a/main/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/main/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -48,6 +48,8 @@
 }
 
 namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
 
 namespace sd { namespace framework {
 
@@ -56,10 +58,10 @@
     It has three main tasks:
     1. Provide frequently used strings of resource URLs and event names.
     2. Provide shortcuts for accessing the sd framework.
-    3. Easy the migration to the drawing framwork.
+    3. Ease the migration to the drawing framwork.
 
     Note that a FrameworkHelper disposes itself when one of the resource
-    controllers called by it throw a DisposedException.
+    controllers called by it throws a DisposedException.
 */
 class FrameworkHelper
     : public ::boost::enable_shared_from_this<FrameworkHelper>,
@@ -72,7 +74,7 @@
     static const ::rtl::OUString msFullScreenPaneURL;
     static const ::rtl::OUString msLeftImpressPaneURL;
     static const ::rtl::OUString msLeftDrawPaneURL;
-    static const ::rtl::OUString msRightPaneURL;
+    static const ::rtl::OUString msSidebarPaneURL;
 
     // URLs of frequently used views.
     static const ::rtl::OUString msViewURLPrefix;
@@ -83,7 +85,7 @@
     static const ::rtl::OUString msHandoutViewURL;
     static const ::rtl::OUString msSlideSorterURL;
     static const ::rtl::OUString msPresentationViewURL;
-    static const ::rtl::OUString msTaskPaneURL;
+    static const ::rtl::OUString msSidebarViewURL;
 
     // URLs of frequently used tool bars.
     static const ::rtl::OUString msToolBarURLPrefix;
@@ -91,7 +93,9 @@
 
     // URLs of task panels.
     static const ::rtl::OUString msTaskPanelURLPrefix;
-    static const ::rtl::OUString msMasterPagesTaskPanelURL;
+    static const ::rtl::OUString msAllMasterPagesTaskPanelURL;
+    static const ::rtl::OUString msRecentMasterPagesTaskPanelURL;
+    static const ::rtl::OUString msUsedMasterPagesTaskPanelURL;
     static const ::rtl::OUString msLayoutTaskPanelURL;
     static const ::rtl::OUString msTableDesignPanelURL;
     static const ::rtl::OUString msCustomAnimationTaskPanelURL;
@@ -102,6 +106,7 @@
     static const ::rtl::OUString msResourceDeactivationRequestEvent;
     static const ::rtl::OUString msResourceActivationEvent;
     static const ::rtl::OUString msResourceDeactivationEvent;
+    static const ::rtl::OUString msResourceDeactivationEndEvent;
     static const ::rtl::OUString msConfigurationUpdateStartEvent;
     static const ::rtl::OUString msConfigurationUpdateEndEvent;
 
@@ -116,7 +121,7 @@
     static ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase);
 
     static ::boost::shared_ptr<FrameworkHelper> Instance (
-        const css::uno::Reference<css::frame::XController>& rxController);
+        const cssu::Reference<css::frame::XController>& rxController);
 
     /** Mark the FrameworkHelper object for the given ViewShellBase as
         disposed.  A following ReleaseInstance() call will destroy the
@@ -153,17 +158,15 @@
             reference then an empty pointer is returned.
     */
     static ::boost::shared_ptr<ViewShell> GetViewShell (
-        const css::uno::Reference<css::drawing::framework::XView>& rxView);
+        const cssu::Reference<cssdf::XView>& rxView);
 
-    ~FrameworkHelper (void);
-
-    typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)>
+    typedef ::boost::function<bool(const cssdf::ConfigurationChangeEvent&)>
         ConfigurationChangeEventFilter;
     typedef ::boost::function<void(bool bEventSeen)> Callback;
     typedef ::boost::function<
         void(
-            const css::uno::Reference<
-                css::drawing::framework::XResourceId>&)
+            const cssu::Reference<
+                cssdf::XResourceId>&)
         > ResourceFunctor;
 
     /** Test whether the called FrameworkHelper object is valid.
@@ -196,10 +199,19 @@
             of the involved objects does not support XTunnel (where
             necessary).
     */
-    css::uno::Reference<css::drawing::framework::XView>
-        GetView (
-            const css::uno::Reference<
-                css::drawing::framework::XResourceId>& rxPaneOrViewId);
+    cssu::Reference<cssdf::XView> GetView (
+        const cssu::Reference<cssdf::XResourceId>& rxPaneOrViewId);
+
+    /** Return the XWindow that is represented by the pane with the
+        given resource id.
+    */
+    cssu::Reference<css::awt::XWindow> GetPaneWindow (
+        const cssu::Reference<cssdf::XResourceId>& rxPaneId);
+
+    /** Return the XResource object with the given resource id.
+    */
+    cssu::Reference<cssdf::XResource> GetResource (
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId);
 
     /** Request the specified view to be displayed in the specified pane.
         When the pane is not visible its creation is also requested.  The
@@ -213,24 +225,33 @@
             the caller can, for example, call RunOnResourceActivation() to
             do some initialization after the requested view becomes active.
     */
-    css::uno::Reference<css::drawing::framework::XResourceId> RequestView (
+    cssu::Reference<cssdf::XResourceId> RequestView (
         const ::rtl::OUString& rsResourceURL,
         const ::rtl::OUString& rsAnchorURL);
 
-    /** Request the activation of the specified task panel in the standard
-        task pane.
-        @param rsTaskPanelURL
+    /** Request the activation of the specified panel in the
+        sidebar.
+        @param rsSidebarPanelURL
             The panel that is to be activated.
-        @param bEnsureTaskPaneIsVisible
-            When this is <TRUE/> then the task pane is activated when not
+        @param bEnsurePaneIsVisible
+            When this is <TRUE/> then the sidebar pane is activated when not
             yet active.
             When this flag is <FALSE/> then the requested panel
             is activated only when the task pane is already active.  When it
             is not active then this call is silently ignored.
+        @return
+            The resource id of the requested sidebar panel is returned.  With that
+            the caller can, for example, call RunOnResourceActivation() to
+            do some initialization after the requested view becomes active.
     */
-    void RequestTaskPanel (
-        const ::rtl::OUString& rsTaskPanelURL,
+    cssu::Reference<cssdf::XResourceId> RequestSidebarPanel (
+        const ::rtl::OUString& rsSidebarPanelURL,
         const bool bEnsureTaskPaneIsVisible = true);
+
+    /** Request the deactivation of the specified resource.
+    */
+    void RequestResourceDeactivation (
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId);
     
     /** Process a slot call that requests a view shell change.
     */
@@ -260,9 +281,30 @@
         
     */
     void RunOnResourceActivation(
-        const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId,
         const Callback& rCallback);
 
+    /** Run the given callback when the specified resource has been
+        deactivated.  When the resource is not active already when
+        this method is called then rCallback is called before this
+        method returns.
+        @param rxResourceId
+            Wait for the deactivation of this resource before calling
+            rCallback.
+        @param rCallback
+            The callback to be called when the resource is
+            deactivated.
+        @param bRunOnDeactivationEnd
+            The callback is run either when the deactivation starts
+            and the callback can still access the resource or when the
+            deactivatio is complete and the resource is no longer available.
+        
+    */
+    void RunOnResourceDeactivation(
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId,
+        const Callback& rCallback,
+        const bool bRunOnDeactivationEnd);
+
     /** Normally the requested changes of the configuration are executed
         asynchronously.  However, there is at least one situation (searching
         with the Outliner) where the surrounding code does not cope with
@@ -296,21 +338,21 @@
     /** Return a string representation of the given XResourceId object.
     */
     static ::rtl::OUString ResourceIdToString (
-        const css::uno::Reference<
-            css::drawing::framework::XResourceId>& rxResourceId);
+        const cssu::Reference<
+            cssdf::XResourceId>& rxResourceId);
 
     /** Create a new XResourceId object for the given resource URL.
     */
-    static css::uno::Reference<
-        css::drawing::framework::XResourceId>
+    static cssu::Reference<
+        cssdf::XResourceId>
             CreateResourceId (
                 const ::rtl::OUString& rsResourceURL);
 
     /** Create a new XResourceId object for the given resource URL and a
         single anchor URL.
     */
-    static css::uno::Reference<
-        css::drawing::framework::XResourceId>
+    static cssu::Reference<
+        cssdf::XResourceId>
             CreateResourceId (
                 const ::rtl::OUString& rsResourceURL,
                 const ::rtl::OUString& rsAnchorURL);
@@ -318,8 +360,8 @@
     /** Create a new XResourceId object for the given resource URL and the
         two given anchor URLs.
     */
-    static css::uno::Reference<
-        css::drawing::framework::XResourceId>
+    static cssu::Reference<
+        cssdf::XResourceId>
             CreateResourceId (
                 const ::rtl::OUString& rsResourceURL,
                 const ::rtl::OUString& rsFirstAnchorURL,
@@ -327,14 +369,14 @@
 
     /** Create a new XResourceId object for the given resource URL.
     */
-    static css::uno::Reference<
-        css::drawing::framework::XResourceId>
+    static cssu::Reference<
+        cssdf::XResourceId>
             CreateResourceId (
                 const ::rtl::OUString& rsResourceURL,
-                const css::uno::Reference<
-                    css::drawing::framework::XResourceId>& rxAnchor);
+                const cssu::Reference<
+                    cssdf::XResourceId>& rxAnchor);
 
-    css::uno::Reference<css::drawing::framework::XConfigurationController>
+    cssu::Reference<cssdf::XConfigurationController>
         GetConfigurationController (void) const;
 
 
@@ -350,16 +392,18 @@
     static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap;
 
     ViewShellBase& mrBase;
-    css::uno::Reference<css::drawing::framework::XConfigurationController>
+    cssu::Reference<cssdf::XConfigurationController>
         mxConfigurationController;
 
     class DisposeListener;
     friend class DisposeListener;
-    css::uno::Reference<css::lang::XComponent>
+    cssu::Reference<css::lang::XComponent>
         mxDisposeListener;
     
     FrameworkHelper (ViewShellBase& rBase);
     FrameworkHelper (const FrameworkHelper& rHelper); // Not implemented.
+    ~FrameworkHelper (void);
+    class Deleter; friend class Deleter;
     FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented.
 
     void Initialize (void);
@@ -399,7 +443,7 @@
     class FrameworkHelperAllPassFilter
     {
     public:
-        bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; }
+        bool operator() (const cssdf::ConfigurationChangeEvent&) { return true; }
     };
 
 
@@ -407,12 +451,12 @@
     {
     public:
         FrameworkHelperResourceIdFilter (
-            const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
-        bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+            const cssu::Reference<cssdf::XResourceId>& rxResourceId);
+        bool operator() (const cssdf::ConfigurationChangeEvent& rEvent)
         { return mxResourceId.is() && rEvent.ResourceId.is()
                 && mxResourceId->compareTo(rEvent.ResourceId) == 0; }
     private:
-        css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
+        cssu::Reference<cssdf::XResourceId> mxResourceId;
     };
 
 } // end of anonymous namespace
diff --git a/main/sd/source/ui/inc/framework/Pane.hxx b/main/sd/source/ui/inc/framework/Pane.hxx
index 1cd577b..bdeea26 100644
--- a/main/sd/source/ui/inc/framework/Pane.hxx
+++ b/main/sd/source/ui/inc/framework/Pane.hxx
@@ -94,6 +94,7 @@
     */
     virtual ::Window* GetWindow (void);
 
+    void SetWindow (::Window* pWindow);
     
     //----- XPane -------------------------------------------------------------
 
diff --git a/main/sd/source/ui/inc/framework/TaskPanelResource.hxx b/main/sd/source/ui/inc/framework/TaskPanelResource.hxx
new file mode 100644
index 0000000..7b65a05
--- /dev/null
+++ b/main/sd/source/ui/inc/framework/TaskPanelResource.hxx
@@ -0,0 +1,85 @@
+/**************************************************************
+ * 
+ * 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 <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "SidebarPanelId.hxx"
+
+#include <com/sun/star/drawing/framework/XResource.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
+
+class Window;
+
+namespace sd { namespace sidebar {
+    class SidebarViewShell;
+} }
+
+
+namespace sd { namespace framework {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+    cssdf::XResource
+    > TaskPanelResourceInterfaceBase;
+
+
+/** A simple wrapper around a legacy task pane control that gives
+    access to that control (via GetControl()).
+*/
+class TaskPanelResource
+    : private ::cppu::BaseMutex,
+      public TaskPanelResourceInterfaceBase      
+{
+public:
+    /** Create a resource object that represents the legacy taskpane
+        panel.
+        @param rxResourceId
+            drawing framework resource id
+        @param pControl
+            The new TaskPanelResource object takes ownership for this control.
+    */
+    TaskPanelResource (
+        sidebar::SidebarViewShell& rSidebarViewShell,
+        sidebar::PanelId ePanelId,
+        const cssu::Reference<cssdf::XResourceId>& rxResourceId);
+    virtual ~TaskPanelResource (void);
+    virtual void SAL_CALL disposing (void);
+
+    // XResource
+    virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException);
+    virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException);
+
+    ::Window* GetControl (void) const;
+    
+private:
+    const cssu::Reference<cssdf::XResourceId> mxResourceId;
+    // Using auto_ptr because it has release(), what scoped_ptr doesn't.
+    ::std::auto_ptr< ::Window> mpControl;
+
+    DECL_LINK(WindowEventHandler,VclWindowEvent*);
+};
+
+} } // end of namespace sd::framework
diff --git a/main/sd/source/ui/inc/fuolbull.hxx b/main/sd/source/ui/inc/fuolbull.hxx
index de2d6cf..1f5c3e8 100644
--- a/main/sd/source/ui/inc/fuolbull.hxx
+++ b/main/sd/source/ui/inc/fuolbull.hxx
@@ -28,6 +28,8 @@
 
 class SdDrawDocument;
 class SfxRequest;
+class SfxItemSet;
+class SfxPoolItem;
 
 namespace sd {
 
@@ -49,6 +51,8 @@
 
 	static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
 	virtual void DoExecute( SfxRequest& rReq );
+	void SetCurrentBullet(SfxRequest& rReq);
+	void SetCurrentNumbering(SfxRequest& rReq);
 
 private:
 	FuOutlineBullet (
@@ -57,8 +61,11 @@
         ::sd::View* pView,
         SdDrawDocument* pDoc, 
         SfxRequest& rReq);
+
+	const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
 };
 
+
 } // end of namespace sd
 
 #endif
diff --git a/main/sd/source/ui/inc/navigatr.hxx b/main/sd/source/ui/inc/navigatr.hxx
index d56bc78..db232a1 100644
--- a/main/sd/source/ui/inc/navigatr.hxx
+++ b/main/sd/source/ui/inc/navigatr.hxx
@@ -88,11 +88,21 @@
     : public Window
 {
 public:
+    typedef ::boost::function<void(void)> UpdateRequestFunctor;
+    
+    /** Create a new instance of the navigator.
+        @param bUseActiveUpdate
+            When <TRUE/>, the default, then the SdNavigatorWin object
+            will make a SID_NAVIGATOR_INIT call whenever it thinks an
+            update is necessary.  When <FALSE/> the navigator will
+            rely on others to trigger updates.
+    */
     SdNavigatorWin(
         ::Window* pParent,
         ::sd::NavigatorChildWindow* pChildWinContext,
         const SdResId& rSdResId,
-        SfxBindings* pBindings );
+        SfxBindings* pBindings,
+        const UpdateRequestFunctor& rUpdateRequest);
     virtual ~SdNavigatorWin();
 
 	virtual void				KeyInput( const KeyEvent& rKEvt );
@@ -137,7 +147,7 @@
     /** This flag controls whether all shapes or only the named shapes are
         shown.
     */
-    bool                        mbShowAllShapes;
+    //    bool                        mbShowAllShapes;
 
 	sal_uInt16						GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
 	NavDocInfo*					GetDocInfo();
@@ -169,7 +179,8 @@
 class SdNavigatorControllerItem : public SfxControllerItem
 {
 public:
-	SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
+	SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
+        const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
 
 protected:
 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
@@ -177,6 +188,7 @@
 
 private:
 	SdNavigatorWin* pNavigatorWin;
+    const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
 };
 
 
@@ -190,7 +202,8 @@
 class SdPageNameControllerItem : public SfxControllerItem
 {
 public:
-	SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
+	SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
+        const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
 
 protected:
 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
@@ -198,6 +211,7 @@
 
 private:
 	SdNavigatorWin* pNavigatorWin;
+    const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
 };
 
 #endif
diff --git a/main/sd/source/ui/inc/prltempl.hxx b/main/sd/source/ui/inc/prltempl.hxx
index 37e51fa..8771d75 100644
--- a/main/sd/source/ui/inc/prltempl.hxx
+++ b/main/sd/source/ui/inc/prltempl.hxx
@@ -34,7 +34,7 @@
 #include "prlayout.hxx" // fuer enum PresentationObjects
 
 
-class XColorTable;
+class XColorList;
 class XGradientList;
 class XHatchList;
 class XBitmapList;
@@ -54,7 +54,7 @@
 private:
 	const SfxObjectShell*	mpDocShell;
 
-	XColorTable*		pColorTab;
+	XColorList*		pColorTab;
 	XGradientList*		pGradientList;
 	XHatchList*			pHatchingList;
 	XBitmapList*		pBitmapList;
diff --git a/main/sd/source/ui/inc/tabtempl.hxx b/main/sd/source/ui/inc/tabtempl.hxx
index f98ab79..c8d973a 100644
--- a/main/sd/source/ui/inc/tabtempl.hxx
+++ b/main/sd/source/ui/inc/tabtempl.hxx
@@ -30,7 +30,7 @@
 class SdrModel;
 class SfxObjectShell;
 class SdrView;
-class XColorTable;
+class XColorList;
 class XGradientList;
 class XBitmapList;
 class XDashList;
@@ -49,7 +49,7 @@
 	const SfxObjectShell&	rDocShell;
 	SdrView*				pSdrView;
 
-	XColorTable*		pColorTab;
+	XColorList*		pColorTab;
 	XGradientList*		pGradientList;
 	XHatchList*			pHatchingList;
 	XBitmapList*		pBitmapList;
diff --git a/main/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx b/main/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
deleted file mode 100644
index 857d3b9..0000000
--- a/main/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
+++ /dev/null
@@ -1,98 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX
-#define SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX
-
-#include <tools/gen.hxx>
-#include <sal/types.h>
-
-class Window;
-
-namespace sd { namespace toolpanel {
-
-
-class ILayouter
-{
-public:
-    /** This method is called by layoutable controls when they have to be
-        resized.
-    */
-    virtual void RequestResize (void) = 0;
-};
-
-
-
-/** This interface has to be implemented by windows that want to be
-    layouted by a SubToolPanel or ScrollablePanel object. 
-*/
-class ILayoutableWindow
-{
-public:
-    virtual ~ILayoutableWindow (void) {};
-
-    /** Return the preferred size without constraints on either the
-        height or the width.
-        The size the window will later be set to may but does not have
-        to be equal to this size.
-    */
-    virtual Size GetPreferredSize (void) = 0;
-
-    /** Return the preferred width with the constraint, that the
-        window will be set to the given height.
-        The width the window will later be set to may but does not have
-        to be equal to this width.
-    */
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight) = 0;
-
-    /** Return the preferred height with the constraint, that the
-        window will be set to the given width.
-        The height the window will later be set to may but does not have
-        to be equal to this height.
-    */
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth) = 0;
-
-    /** Return wether the window is generally resizable.  When used by
-        a VerticalLayouter then the width will always be resized and
-        the return value of this method determines whether the height
-        may be modified as well. 
-    */
-    virtual bool IsResizable (void) = 0;
-    
-    /** Return the window so that its size and position can be set.
-        @return
-            Returns the window which is layouted or NULL to indicate
-            that the object is in an invalid state.
-    */
-    virtual ::Window* GetWindow (void) = 0;
-
-    /** Return the minimal width of the window.
-    */
-    virtual sal_Int32 GetMinimumWidth (void) = 0; 
-};
-
-
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/inc/taskpane/PanelId.hxx b/main/sd/source/ui/inc/taskpane/PanelId.hxx
deleted file mode 100644
index 6c324b1..0000000
--- a/main/sd/source/ui/inc/taskpane/PanelId.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_UI_TASKPANE_PANELID_HXX
-#define SD_UI_TASKPANE_PANELID_HXX
-
-namespace rtl
-{
-    class OUString;
-}
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-	//==================================================================================================================
-	//= PanelId
-	//==================================================================================================================
-    /** List of top level panels that can be shown in the task pane.
-    */
-    enum PanelId
-    {
-        PID_MASTER_PAGES        = 0,
-        PID_LAYOUT              = 1,
-		PID_TABLE_DESIGN        = 2,
-        PID_CUSTOM_ANIMATION    = 3,
-        PID_SLIDE_TRANSITION    = 4,
-
-        PID_UNKNOWN             = 5
-    };
-
-    PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL );
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_UI_TASKPANE_PANELID_HXX
diff --git a/main/sd/source/ui/inc/tpaction.hxx b/main/sd/source/ui/inc/tpaction.hxx
index be48e26..6232025 100644
--- a/main/sd/source/ui/inc/tpaction.hxx
+++ b/main/sd/source/ui/inc/tpaction.hxx
@@ -89,7 +89,7 @@
 	const SfxItemSet&	    rOutAttrs;
 	const ::sd::View*		mpView;
 	SdDrawDocument*		    mpDoc;
-	XColorTable*		    pColTab;
+	XColorList*		    pColTab;
                             
 	sal_Bool				    bTreeUpdated;
 	List*   			    pCurrentActions;
diff --git a/main/sd/source/ui/presenter/PresenterHelper.hxx b/main/sd/source/ui/presenter/PresenterHelper.hxx
index 613fe56..4a7d052 100644
--- a/main/sd/source/ui/presenter/PresenterHelper.hxx
+++ b/main/sd/source/ui/presenter/PresenterHelper.hxx
@@ -47,7 +47,7 @@
 /** Implementation of the XPresenterHelper interface: functionality that can
     not be implemented in an extension.
 */
-    class PresenterHelper
+class PresenterHelper
     : private ::boost::noncopyable,
       private ::cppu::BaseMutex,
       public PresenterHelperInterfaceBase
diff --git a/main/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/main/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
new file mode 100644
index 0000000..e6d675d
--- /dev/null
+++ b/main/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
@@ -0,0 +1,231 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "AllMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "SidebarShellManager.hxx"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "app.hrc"
+#include "helpids.h"
+
+#include <tools/link.hxx>
+#include <set>
+
+namespace {
+
+using namespace sd::sidebar;
+
+int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor)
+{
+    int nPriority (0);
+    switch (rpDescriptor->GetURLClassification())
+    {
+        case MasterPageDescriptor::URLCLASS_USER:         nPriority = 0; break;
+        case MasterPageDescriptor::URLCLASS_LAYOUT:       nPriority = 1; break;
+        case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break;
+        case MasterPageDescriptor::URLCLASS_OTHER:        nPriority = 3; break;
+        case MasterPageDescriptor::URLCLASS_UNKNOWN:      nPriority = 4; break;
+        default:
+        case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break;
+    }
+    return nPriority;
+}
+
+
+class MasterPageDescriptorOrder
+{
+public:
+    bool operator() (
+        const SharedMasterPageDescriptor& rp1,
+        const SharedMasterPageDescriptor& rp2)
+    {
+        if (rp1->meOrigin == MasterPageContainer::DEFAULT)
+            return true;
+        else if (rp2->meOrigin == MasterPageContainer::DEFAULT)
+            return false;
+        else if (rp1->GetURLClassification() == rp2->GetURLClassification())
+            return rp1->mnTemplateIndex < rp2->mnTemplateIndex;
+        else
+            return GetURLPriority(rp1) < GetURLPriority(rp2);
+    }
+};
+
+} // end of anonymous namespace
+
+
+
+namespace sd { namespace sidebar {
+
+class AllMasterPagesSelector::SortedMasterPageDescriptorList
+    : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder>
+{
+public:
+    SortedMasterPageDescriptorList (void) {}
+};
+
+
+
+
+MasterPagesSelector* AllMasterPagesSelector::Create (
+    ::Window* pParent,
+    ViewShellBase& rViewShellBase,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    SdDrawDocument* pDocument = rViewShellBase.GetDocument();
+    if (pDocument == NULL)
+        return NULL;
+
+    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+    
+    MasterPagesSelector* pSelector(
+        new AllMasterPagesSelector (
+            pParent, 
+            *pDocument,
+            rViewShellBase,
+            pContainer,
+            rxSidebar));
+    pSelector->LateInit();
+    pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL);
+
+    return pSelector;
+}
+
+
+
+
+AllMasterPagesSelector::AllMasterPagesSelector (
+    ::Window* pParent,
+    SdDrawDocument& rDocument,
+    ViewShellBase& rBase,
+    const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar),
+      mpSortedMasterPages(new SortedMasterPageDescriptorList())
+{
+    MasterPagesSelector::Fill();
+}
+
+
+
+
+AllMasterPagesSelector::~AllMasterPagesSelector (void)
+{
+}
+
+
+
+
+void AllMasterPagesSelector::Fill (ItemList& rItemList)
+{
+    if (mpSortedMasterPages->empty())
+        UpdateMasterPageList();
+    UpdatePageSet(rItemList);
+}
+
+
+
+
+void AllMasterPagesSelector::NotifyContainerChangeEvent (
+    const MasterPageContainerChangeEvent& rEvent)
+{
+    switch (rEvent.meEventType)
+    {
+        case MasterPageContainerChangeEvent::CHILD_ADDED:
+            AddItem(rEvent.maChildToken);
+            MasterPagesSelector::Fill();
+            break;
+            
+        case MasterPageContainerChangeEvent::INDEX_CHANGED:
+        case MasterPageContainerChangeEvent::INDEXES_CHANGED:
+            mpSortedMasterPages->clear();
+            MasterPagesSelector::Fill();
+            break;
+
+        default:
+            MasterPagesSelector::NotifyContainerChangeEvent(rEvent);
+            break;
+    }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdateMasterPageList (void)
+{
+    mpSortedMasterPages->clear();
+    int nTokenCount = mpContainer->GetTokenCount();
+    for (int i=0; i<nTokenCount; i++)
+        AddItem(mpContainer->GetTokenForIndex(i));
+}
+
+
+
+
+void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken)
+{
+    switch (mpContainer->GetOriginForToken(aToken))
+    {
+        case MasterPageContainer::DEFAULT:
+        case MasterPageContainer::TEMPLATE:
+            // Templates are added only when coming from the
+            // MasterPageContainerFiller so that they have an id which
+            // defines their place in the list.  Templates (pre) loaded from
+            // RecentlyUsedMasterPages are ignored (they will be loaded
+            // later by the MasterPageContainerFiller.)
+            if (mpContainer->GetTemplateIndexForToken(aToken) >= 0)
+                mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken));
+            break;
+
+        default:
+            break;
+    }
+}
+
+
+
+
+void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList)
+{
+    SortedMasterPageDescriptorList::const_iterator iDescriptor;
+    SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end());
+    for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor)
+        rItemList.push_back((*iDescriptor)->maToken);
+}
+
+
+
+
+void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet)
+{
+    //    MasterPagesSelector::GetState(rItemSet);
+
+	if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
+        rItemSet.DisableItem(SID_TP_EDIT_MASTER);
+}
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/main/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
new file mode 100644
index 0000000..d86dfc5
--- /dev/null
+++ b/main/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
@@ -0,0 +1,91 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+
+#include <memory>
+
+namespace sd { namespace sidebar {
+
+
+/** Show a list of all available master pages so that the user can assign
+    them to the document.
+*/
+class AllMasterPagesSelector
+    : public MasterPagesSelector
+{
+public:
+    static MasterPagesSelector* Create (
+        ::Window* pParent,
+        ViewShellBase& rViewShellBase,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    
+    /** Scan the set of templates for the ones whose first master pages are
+        shown by this control and store them in the MasterPageContainer.
+    */
+    virtual void Fill (ItemList& rItemList);
+
+    virtual void GetState (SfxItemSet& rItemSet);
+
+protected:
+    virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
+
+private:
+    /** The list of master pages displayed by this class.
+    */
+    class SortedMasterPageDescriptorList;
+    ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
+
+    AllMasterPagesSelector (
+        ::Window* pParent, 
+        SdDrawDocument& rDocument,
+        ViewShellBase& rBase,
+        const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~AllMasterPagesSelector (void);
+
+    void AddTemplate (const TemplateEntry& rEntry);
+
+    /** This filter returns <TRUE/> when the master page specified by the
+        given file name belongs to the set of Impress master pages.
+    */
+    bool FileFilter (const String& sFileName);
+
+    void AddItem (MasterPageContainer::Token aToken);
+
+    /** Add all items in the internal master page list into the given list.
+    */
+    void UpdatePageSet (ItemList& rItemList);
+
+    /** Update the internal list of master pages that are to show in the
+        control.
+    */
+    void UpdateMasterPageList (void);
+
+	using MasterPagesSelector::Fill;
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
new file mode 100644
index 0000000..9160d79
--- /dev/null
+++ b/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -0,0 +1,355 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "CurrentMasterPagesSelector.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include "SidebarShellManager.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "EventMultiplexer.hxx"
+#include "app.hrc"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "res_bmp.hrc"
+#include "sdresid.hxx"
+#include "helpids.h"
+
+#include <vcl/image.hxx>
+#include <svx/svdmodel.hxx>
+#include <sfx2/request.hxx>
+
+#include <set>
+
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace sidebar {
+
+MasterPagesSelector* CurrentMasterPagesSelector::Create (
+    ::Window* pParent,
+    ViewShellBase& rViewShellBase,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    SdDrawDocument* pDocument = rViewShellBase.GetDocument();
+    if (pDocument == NULL)
+        return NULL;
+
+    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+    
+    MasterPagesSelector* pSelector(
+        new CurrentMasterPagesSelector (
+            pParent, 
+            *pDocument,
+            rViewShellBase,
+            pContainer,
+            rxSidebar));
+    pSelector->LateInit();
+    pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
+
+    return pSelector;
+}
+
+
+
+
+CurrentMasterPagesSelector::CurrentMasterPagesSelector (
+    ::Window* pParent,
+    SdDrawDocument& rDocument,
+    ViewShellBase& rBase,
+    const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar)
+{
+    // For this master page selector only we change the default action for
+    // left clicks.
+    mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES;
+
+    Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+    rBase.GetEventMultiplexer()->AddEventListener(aLink,
+        sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+        | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
+        | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER
+        | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER
+        | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED
+        | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED
+        | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED);
+}
+
+
+
+
+CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
+{
+    if (mrDocument.GetDocSh() != NULL)
+    {
+        EndListening(*mrDocument.GetDocSh());
+    }
+    else
+    {
+        OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+    }
+    
+    Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
+    mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+}
+
+
+
+
+void CurrentMasterPagesSelector::LateInit (void)
+{
+    MasterPagesSelector::LateInit();
+    MasterPagesSelector::Fill();
+    if (mrDocument.GetDocSh() != NULL)
+    {
+        StartListening(*mrDocument.GetDocSh());
+    }
+    else
+    {
+        OSL_ASSERT(mrDocument.GetDocSh() != NULL);
+    }
+}
+
+
+
+
+void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
+{
+	sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
+    SdPage* pMasterPage;
+    // Remember the names of the master pages that have been inserted to
+    // avoid double insertion.
+    ::std::set<String> aMasterPageNames;
+    for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
+    {
+        pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+        if (pMasterPage == NULL)
+            continue;
+
+        // Use the name of the master page to avoid duplicate entries.
+        String sName (pMasterPage->GetName());
+        if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
+            continue;
+        aMasterPageNames.insert (sName);
+
+        // Look up the master page in the container and, when it is not yet
+        // in it, insert it.
+        MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage);
+        if (aToken == MasterPageContainer::NIL_TOKEN)
+        {
+            SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+                MasterPageContainer::MASTERPAGE,
+                nIndex,
+                String(),
+                pMasterPage->GetName(),
+                String(),
+                pMasterPage->IsPrecious(),
+                ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)),
+                ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
+            aToken = mpContainer->PutMasterPage(pDescriptor);
+        }
+
+        rItemList.push_back(aToken);
+    }
+}
+
+
+
+
+ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const
+{
+    return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP);
+}
+
+
+
+
+void CurrentMasterPagesSelector::UpdateSelection (void)
+{
+    // Iterate over all pages and for the selected ones put the name of
+    // their master page into a set.
+	sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
+    SdPage* pPage;
+    ::std::set<String> aNames;
+    sal_uInt16 nIndex;
+    bool bLoop (true);
+    for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
+    {
+        pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD);
+        if (pPage != NULL && pPage->IsSelected())
+        {
+            if ( ! pPage->TRG_HasMasterPage())
+            {
+                // One of the pages has no master page.  This is an
+                // indicator for that this method is called in the middle of
+                // a document change and that the model is not in a valid
+                // state.  Therefore we stop update the selection and wait
+                // for another call to UpdateSelection when the model is
+                // valid again.
+                bLoop = false;
+            }
+            else
+            {
+                SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
+                SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
+                if (pMasterPage != NULL)
+                    aNames.insert (pMasterPage->GetName());
+            }
+        }
+    }
+
+    // Find the items for the master pages in the set.
+    sal_uInt16 nItemCount (PreviewValueSet::GetItemCount());
+    for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++)
+    {
+        String sName (PreviewValueSet::GetItemText (nIndex));
+        if (aNames.find(sName) != aNames.end())
+        {
+            PreviewValueSet::SelectItem (nIndex);
+        }
+    }
+}
+
+
+
+
+void CurrentMasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId)
+{
+	if (nCommandId == SID_DELETE_MASTER_PAGE)
+    {
+        // Check once again that the master page can safely be deleted,
+        // i.e. is not used.
+        SdPage* pMasterPage = GetSelectedMasterPage();
+        if (pMasterPage != NULL
+            && mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
+        {
+            // Removing the precious flag so that the following call to
+            // RemoveUnnessesaryMasterPages() will remove this master page.
+            pMasterPage->SetPrecious(false);
+            mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True);
+        }
+    }
+    else
+        MasterPagesSelector::ExecuteCommand(nCommandId);
+}
+
+
+
+
+void CurrentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu)
+{
+    // Disable the SID_DELTE_MASTER slot when there is only one master page.
+    if (mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
+    {
+        if (rMenu.GetItemPos(SID_DELETE_MASTER_PAGE) != MENU_ITEM_NOTFOUND)
+            rMenu.EnableItem(SID_DELETE_MASTER_PAGE, sal_False);
+    }
+
+    ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+        ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+	if (pDrawViewShell
+        && pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+    {
+        if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND)
+            rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False);
+    }
+
+    MasterPagesSelector::ProcessPopupMenu(rMenu);
+}
+
+
+
+
+
+
+IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
+    sd::tools::EventMultiplexerEvent*,pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->meEventId)
+        {
+            case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+            case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
+            case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
+            case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+                UpdateSelection();
+                break;
+
+            case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER:
+				// This is tricky.  If a master page is removed, moved, or
+				// added we have to wait until both the notes master page
+				// and the standard master page have been removed, moved,
+				// or added.  We do this by looking at the number of master
+				// pages which has to be odd in the consistent state (the
+				// handout master page is always present).  If the number is
+				// even we ignore the hint.
+                if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
+                    MasterPagesSelector::Fill();
+                break;
+
+            case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
+            case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
+            case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
+                InvalidatePreview((const SdPage*)pEvent->mpUserData);
+                break;
+        }
+    }
+    
+    return 0;
+}
+
+
+
+
+void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint)
+{
+    const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+    if (pSimpleHint != NULL)
+    {
+        if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
+        {
+            // Is the edit view visible in the center pane?
+            ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+                ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+            if (pDrawViewShell.get() != NULL)
+            {
+                // Is the edit view in master page mode?
+            	if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+                {
+                    // Mark the currently edited master page as precious.
+                    SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage();
+                    if (pCurrentMasterPage != NULL)
+                        pCurrentMasterPage->SetPrecious(true);
+                }
+            }
+        }
+    }
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
new file mode 100644
index 0000000..f00eb7f
--- /dev/null
+++ b/main/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sd { namespace tools { class EventMultiplexerEvent; } }
+
+
+namespace sd { namespace sidebar {
+
+
+/** Show the master pages currently used by a SdDrawDocument.
+*/
+class CurrentMasterPagesSelector
+    : public MasterPagesSelector,
+      public SfxListener
+{
+public:
+    static MasterPagesSelector* Create (
+        ::Window* pParent,
+        ViewShellBase& rViewShellBase,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+    /** Set the selection so that the master page is selected that is
+        used by the currently selected page of the document in the
+        center pane.
+    */
+    virtual void UpdateSelection (void);
+
+    /** Copy all master pages that are to be shown into the given list.
+    */
+    virtual void Fill (ItemList& rItemList);
+
+	using MasterPagesSelector::Fill;
+
+protected:
+    virtual ResId GetContextMenuResId (void) const;
+
+    virtual void ProcessPopupMenu (Menu& rMenu);
+    virtual void ExecuteCommand (const sal_Int32 nCommandId);
+
+private:
+    cssu::Reference<css::lang::XComponent> mxListener;
+
+    CurrentMasterPagesSelector (
+        ::Window* pParent, 
+        SdDrawDocument& rDocument,
+        ViewShellBase& rBase,
+        const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~CurrentMasterPagesSelector (void);
+
+    virtual void LateInit (void);
+
+    DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
+    void Notify (SfxBroadcaster&, const SfxHint& rHint);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/CustomAnimationPanel.cxx b/main/sd/source/ui/sidebar/CustomAnimationPanel.cxx
new file mode 100644
index 0000000..3fc5eac
--- /dev/null
+++ b/main/sd/source/ui/sidebar/CustomAnimationPanel.cxx
@@ -0,0 +1,79 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "CustomAnimationPanel.hxx"
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+    extern ::Window * createCustomAnimationPanel (::Window* pParent, ViewShellBase& rBase);
+    extern sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pParent);
+}
+
+
+
+
+namespace sd { namespace sidebar {
+
+
+CustomAnimationPanel::CustomAnimationPanel (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+    : PanelBase(
+        pParentWindow,
+        rViewShellBase)
+{
+#ifdef DEBUG
+    SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:CustomAnimationPanel")));
+#endif
+}
+
+
+
+
+CustomAnimationPanel::~CustomAnimationPanel (void)
+{
+}
+
+
+
+
+::Window* CustomAnimationPanel::CreateWrappedControl (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+{
+    return createCustomAnimationPanel(pParentWindow, rViewShellBase);
+}
+
+
+
+
+css::ui::LayoutSize CustomAnimationPanel::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    const sal_Int32 nMinimumHeight(getCustomAnimationPanelMinimumHeight(mpWrappedControl.get()));
+    return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight);
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/CustomAnimationPanel.hxx b/main/sd/source/ui/sidebar/CustomAnimationPanel.hxx
new file mode 100644
index 0000000..c7ab0bb
--- /dev/null
+++ b/main/sd/source/ui/sidebar/CustomAnimationPanel.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX
+#define SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX
+
+#include "PanelBase.hxx"
+
+
+namespace sd { namespace sidebar {
+
+class CustomAnimationPanel
+    : public PanelBase
+{
+public:
+    CustomAnimationPanel (
+        ::Window* pParentWindow, 
+        ViewShellBase& rViewShellBase);
+    virtual ~CustomAnimationPanel (void);
+
+    // ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+protected:
+    virtual ::Window* CreateWrappedControl (
+        ::Window* pParentWindow,
+        ViewShellBase& rViewShellBase);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/DocumentHelper.cxx b/main/sd/source/ui/sidebar/DocumentHelper.cxx
new file mode 100644
index 0000000..15144ca
--- /dev/null
+++ b/main/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -0,0 +1,578 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "DocumentHelper.hxx"
+
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "unmovss.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "undoback.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include "stlpool.hxx"
+#include <svx/xfillit0.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+
+namespace sd { namespace sidebar {
+
+SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
+    SdDrawDocument& rTargetDocument,
+    SdPage* pMasterPage)
+{
+    SdPage* pNewMasterPage = NULL;
+
+    do
+    {
+        if (pMasterPage == NULL)
+            break;
+
+        // Check the presence of the source document.
+        SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
+            pMasterPage->GetModel());
+        if (pSourceDocument == NULL)
+            break;
+
+        // When the given master page already belongs to the target document
+        // then there is nothing more to do.
+        if (pSourceDocument == &rTargetDocument)
+        {
+            pNewMasterPage = pMasterPage;
+            break;
+        }
+
+        // Test if the master pages of both the slide and its notes page are
+        // present.  This is not the case when we are called during the
+        // creation of the slide master page because then the notes master
+        // page is not there.
+        sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount();
+        if (nSourceMasterPageCount%2 == 0)
+            // There should be 1 handout page + n slide masters + n notes
+            // masters = 2*n+1.  An even value indicates that a new slide
+            // master but not yet the notes master has been inserted.
+            break;
+        sal_uInt16 nIndex = pMasterPage->GetPageNum();
+        if (nSourceMasterPageCount <= nIndex+1)
+            break;
+        // Get the slide master page.
+        if (pMasterPage != static_cast<SdPage*>(
+            pSourceDocument->GetMasterPage(nIndex)))
+            break;
+        // Get the notes master page.
+        SdPage* pNotesMasterPage = static_cast<SdPage*>(
+            pSourceDocument->GetMasterPage(nIndex+1));
+        if (pNotesMasterPage == NULL)
+            break;
+
+
+        // Check if a master page with the same name as that of the given
+        // master page already exists.
+        bool bPageExists (false);
+        sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD));
+        for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++)
+        {
+            SdPage* pCandidate = static_cast<SdPage*>(
+                rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD));
+            if (pMasterPage!=NULL
+                && pCandidate->GetName().CompareTo(pMasterPage->GetName())==0)
+            {
+                bPageExists = true;
+                pNewMasterPage = pCandidate;
+                break;
+            }
+        }
+        if (bPageExists)
+            break;
+        
+        // Create a new slide (and its notes page.)
+        uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (
+            rTargetDocument.getUnoModel(), uno::UNO_QUERY);
+        if ( ! xSlideSupplier.is())
+            break;
+        uno::Reference<drawing::XDrawPages> xSlides (
+            xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+        if ( ! xSlides.is())
+            break;
+        xSlides->insertNewByIndex (xSlides->getCount());
+
+        // Set a layout.
+        SdPage* pSlide = rTargetDocument.GetSdPage(
+            rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
+            PK_STANDARD);
+        if (pSlide == NULL)
+            break;
+        pSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
+
+        // Create a copy of the master page and the associated notes
+        // master page and insert them into our document.
+        pNewMasterPage = AddMasterPage(rTargetDocument, pMasterPage);
+        if (pNewMasterPage==NULL)
+            break;
+        SdPage* pNewNotesMasterPage 
+            = AddMasterPage(rTargetDocument, pNotesMasterPage);
+        if (pNewNotesMasterPage==NULL)
+            break;
+
+        // Make the connection from the new slide to the master page
+        // (and do the same for the notes page.)
+        rTargetDocument.SetMasterPage (
+            rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
+            pNewMasterPage->GetName(),
+            &rTargetDocument,
+            sal_False, // Connect the new master page with the new slide but
+                   // do not modify other (master) pages.
+            sal_True);
+    }
+    while (false);
+
+    // We are not interested in any automatisms for our modified internal
+    // document.
+    rTargetDocument.SetChanged (sal_False);
+
+    return pNewMasterPage;
+}
+
+
+
+
+SdPage* DocumentHelper::GetSlideForMasterPage (SdPage* pMasterPage)
+{
+    SdPage* pCandidate = NULL;
+
+    SdDrawDocument* pDocument = NULL;
+    if (pMasterPage != NULL)
+        pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
+
+    // Iterate over all pages and check if it references the given master
+    // page.
+    if (pDocument!=NULL && pDocument->GetSdPageCount(PK_STANDARD) > 0)
+    {
+        // In most cases a new slide has just been inserted so start with
+        // the last page.
+        sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PK_STANDARD)-1);
+        bool bFound (false);
+        while ( ! bFound)
+        {
+            pCandidate = pDocument->GetSdPage(
+                nPageIndex,
+                PK_STANDARD);
+            if (pCandidate != NULL)
+            {
+                if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage())
+                    == pMasterPage)
+                {
+                    bFound = true;
+                    break;
+                }
+            }
+
+            if (nPageIndex == 0)
+                break;
+            else
+                nPageIndex --;
+        }
+
+        // If no page was found that refernced the given master page reset
+        // the pointer that is returned.
+        if ( ! bFound)
+            pCandidate = NULL;
+    }
+
+    return pCandidate;
+}
+
+
+
+
+SdPage* DocumentHelper::AddMasterPage (
+    SdDrawDocument& rTargetDocument,
+    SdPage* pMasterPage)
+{
+    SdPage* pClonedMasterPage = NULL;
+
+    if (pMasterPage!=NULL)
+    {
+        try
+        {
+            // Duplicate the master page.
+            pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+
+            // Copy the necessary styles.
+            SdDrawDocument* pSourceDocument
+                = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+            if (pSourceDocument != NULL)
+                ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+
+            // Copy the precious flag.
+            pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
+            
+            // Now that the styles are available we can insert the cloned
+            // master page.
+            rTargetDocument.InsertMasterPage (pClonedMasterPage);
+        }
+        catch (uno::Exception& rException)
+        {
+            pClonedMasterPage = NULL;
+            DBG_UNHANDLED_EXCEPTION();
+        }
+        catch (::std::exception rException)
+        {
+            pClonedMasterPage = NULL;
+            OSL_TRACE ("caught general exception");
+        }
+        catch (...)
+        {
+            pClonedMasterPage = NULL;
+            OSL_TRACE ("caught general exception");
+        }
+    }
+
+    return pClonedMasterPage;
+}
+
+
+
+
+void DocumentHelper::ProvideStyles (
+    SdDrawDocument& rSourceDocument,
+    SdDrawDocument& rTargetDocument,
+    SdPage* pPage)
+{
+    // Get the layout name of the given page.
+    String sLayoutName (pPage->GetLayoutName());
+    sLayoutName.Erase (sLayoutName.SearchAscii (SD_LT_SEPARATOR));
+
+    // Copy the style sheet from source to target document.
+	SdStyleSheetPool* pSourceStyleSheetPool =
+        static_cast<SdStyleSheetPool*>(rSourceDocument.GetStyleSheetPool());
+	SdStyleSheetPool* pTargetStyleSheetPool =
+        static_cast<SdStyleSheetPool*>(rTargetDocument.GetStyleSheetPool());
+    SdStyleSheetVector aCreatedStyles;
+    pTargetStyleSheetPool->CopyLayoutSheets (
+        sLayoutName, 
+        *pSourceStyleSheetPool, 
+        aCreatedStyles);
+
+    // Add an undo action for the copied style sheets.
+    if( !aCreatedStyles.empty() )
+    {
+     	::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager();
+       if (pUndoManager != NULL)
+       {
+           SdMoveStyleSheetsUndoAction* pMovStyles =
+               new SdMoveStyleSheetsUndoAction (
+                   &rTargetDocument, 
+                   aCreatedStyles, 
+                   sal_True);
+           pUndoManager->AddUndoAction (pMovStyles);
+       }
+    }
+}
+
+
+
+
+void DocumentHelper::AssignMasterPageToPageList (
+    SdDrawDocument& rTargetDocument,
+    SdPage* pMasterPage,
+    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+    do
+    {
+        if (pMasterPage == NULL && pMasterPage->IsMasterPage())
+            break;
+
+        // Make the layout name by stripping ouf the layout postfix from the
+        // layout name of the given master page.
+        String sFullLayoutName (pMasterPage->GetLayoutName());
+        String sBaseLayoutName (sFullLayoutName);
+        sBaseLayoutName.Erase (sBaseLayoutName.SearchAscii (SD_LT_SEPARATOR));
+
+        if (rpPageList->empty())
+            break;
+
+        // Create a second list that contains only the valid pointers to
+        // pages for which an assignment is necessary.
+        ::std::vector<SdPage*>::const_iterator iPage;
+        ::std::vector<SdPage*> aCleanedList;
+        for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
+        {
+            OSL_ASSERT(*iPage!=NULL && (*iPage)->GetModel() == &rTargetDocument);
+            if (*iPage != NULL
+                && (*iPage)->GetLayoutName().CompareTo(sFullLayoutName)!=0)
+            {
+                aCleanedList.push_back(*iPage);
+            }
+        }
+        if (aCleanedList.empty() )
+            break;
+
+		::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
+		if( pUndoMgr )
+			pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_SET_PRESLAYOUT)), String());
+
+        SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
+        if (pMasterPageInDocument == NULL)
+            break;
+
+        // Assign the master pages to the given list of pages.
+        for (iPage=aCleanedList.begin(); 
+             iPage!=aCleanedList.end(); 
+             ++iPage)
+        {
+            AssignMasterPageToPage (
+                pMasterPageInDocument,
+                sBaseLayoutName,
+                *iPage);
+        }
+
+		if( pUndoMgr )
+			pUndoMgr->LeaveListAction();
+    }
+    while (false);
+}
+
+
+
+
+SdPage* DocumentHelper::AddMasterPage (
+    SdDrawDocument& rTargetDocument,
+    SdPage* pMasterPage,
+    sal_uInt16 nInsertionIndex)
+{
+    SdPage* pClonedMasterPage = NULL;
+
+    if (pMasterPage!=NULL)
+    {
+        // Duplicate the master page.
+        pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+
+        // Copy the precious flag.
+        pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
+        
+        // Copy the necessary styles.
+        SdDrawDocument* pSourceDocument
+            = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+        if (pSourceDocument != NULL)
+        {
+            ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+
+            // Now that the styles are available we can insert the cloned
+            // master page.
+            rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
+
+            // Adapt the size of the new master page to that of the pages in
+            // the document.
+            Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
+            Rectangle aBorders (
+                pClonedMasterPage->GetLftBorder(),
+                pClonedMasterPage->GetUppBorder(),
+                pClonedMasterPage->GetRgtBorder(),
+                pClonedMasterPage->GetLwrBorder());
+            pClonedMasterPage->ScaleObjects(aNewSize, aBorders, sal_True);
+            pClonedMasterPage->SetSize(aNewSize);
+            pClonedMasterPage->CreateTitleAndLayout(sal_True);
+        }
+    }
+
+    return pClonedMasterPage;
+}
+
+
+
+
+/** In here we have to handle three cases:
+    1. pPage is a normal slide.  We can use SetMasterPage to assign the
+    master pages to it.
+    2. pPage is a master page that is used by at least one slide.  We can
+    assign the master page to these slides.
+    3. pPage is a master page that is currently not used by any slide.
+    We can delete that page and add copies of the given master pages
+    instead.
+
+    For points 2 and 3 where one master page A is assigned to another B we have
+    to keep in mind that the master page that page A has already been
+    inserted into the target document.
+*/
+void DocumentHelper::AssignMasterPageToPage (
+    SdPage* pMasterPage,
+    const String& rsBaseLayoutName,
+    SdPage* pPage)
+{
+    // Leave early when the parameters are invalid.
+    if (pPage == NULL || pMasterPage == NULL)
+        return;
+    SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
+    if (pDocument == NULL)
+        return;
+    
+    if ( ! pPage->IsMasterPage())
+    {
+        // 1. Remove the background object (so that that, if it exists, does
+        // not override the new master page) and assign the master page to
+        // the regular slide.
+        pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
+            new SdBackgroundObjUndoAction(
+                *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
+            sal_True);
+        pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+          
+        pDocument->SetMasterPage (
+            (pPage->GetPageNum()-1)/2,
+            rsBaseLayoutName,
+            pDocument,
+            sal_False,
+            sal_False);
+    }
+    else
+    {
+        // Find first slide that uses the master page.
+        SdPage* pSlide = NULL;
+        sal_uInt16 nPageCount = pDocument->GetSdPageCount(PK_STANDARD);
+        for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==NULL; nPage++)
+        {
+            SdrPage* pCandidate = pDocument->GetSdPage(nPage,PK_STANDARD);
+            if (pCandidate != NULL
+                && pCandidate->TRG_HasMasterPage()
+                && &(pCandidate->TRG_GetMasterPage()) == pPage)
+            {
+                pSlide = static_cast<SdPage*>(pCandidate);
+            }
+        }
+
+        if (pSlide != NULL)
+        {
+            // 2. Assign the given master pages to the first slide that was
+            // found above that uses the master page.
+            pDocument->SetMasterPage (
+                (pSlide->GetPageNum()-1)/2,
+                rsBaseLayoutName,
+                pDocument,
+                sal_False,
+                sal_False);
+        }
+        else
+        {
+            // 3. Replace the master page A by a copy of the given master
+            // page B.
+            pDocument->RemoveUnnecessaryMasterPages (
+                pPage, sal_False);
+        }
+    }
+}
+
+
+
+
+SdPage* DocumentHelper::ProvideMasterPage (
+    SdDrawDocument& rTargetDocument,
+    SdPage* pMasterPage,
+    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+    // Make sure that both the master page and its notes master exist
+    // in the source document.  If one is missing then return without
+    // making any changes.
+    if (pMasterPage == NULL)
+    {
+        // The caller should make sure that the master page is valid.
+        OSL_ASSERT(pMasterPage != NULL);
+        return NULL;
+    }
+    SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+    if (pSourceDocument == NULL)
+        return NULL;
+    SdPage* pNotesMasterPage = static_cast<SdPage*>(
+        pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
+    if (pNotesMasterPage == NULL)
+    {
+        // The model is not in a valid state.  Maybe a new master page
+        // is being (not finished yet) created?  Return without making
+        // any changes.
+        return NULL;
+    }
+
+    SdPage* pMasterPageInDocument = NULL;
+    // Search for a master page with the same name as the given one in
+    // the target document.
+    const XubString sMasterPageLayoutName (pMasterPage->GetLayoutName());
+    for (sal_uInt16 nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex)
+    {
+        SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex));
+        if (pCandidate!=NULL 
+            && sMasterPageLayoutName==pCandidate->GetLayoutName())
+        {
+            // The requested master page does already exist in the
+            // target document, return it.
+            return pCandidate;
+        }
+    }
+    
+    // The given master page does not already belong to the target
+    // document so we have to create copies and insert them into the
+    // targer document.
+
+    // Determine the position where the new master pages are inserted.
+    // By default they are inserted at the end.  When we assign to a
+    // master page then insert after the last of the (selected) pages.
+    sal_uInt16 nInsertionIndex = rTargetDocument.GetMasterPageCount();
+    if (rpPageList->front()->IsMasterPage())
+    {
+        nInsertionIndex = rpPageList->back()->GetPageNum();
+    }
+
+    // Clone the master page.
+    if (pMasterPage->GetModel() != &rTargetDocument)
+    {
+        pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
+        if( rTargetDocument.IsUndoEnabled() )
+				rTargetDocument.AddUndo(
+					rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument));
+    }
+    else
+        pMasterPageInDocument = pMasterPage;
+
+    // Clone the notes master.
+    if (pNotesMasterPage->GetModel() != &rTargetDocument)
+    {
+        SdPage* pClonedNotesMasterPage 
+            = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
+        if( rTargetDocument.IsUndoEnabled() )
+            rTargetDocument.AddUndo(
+                rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
+    }
+
+    return pMasterPageInDocument;
+}
+
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/DocumentHelper.hxx b/main/sd/source/ui/sidebar/DocumentHelper.hxx
new file mode 100644
index 0000000..257028a
--- /dev/null
+++ b/main/sd/source/ui/sidebar/DocumentHelper.hxx
@@ -0,0 +1,110 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX
+#define SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX
+
+#include <tools/solar.h>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class SdDrawDocument;
+class SdPage;
+class String;
+
+namespace sd { namespace sidebar {
+
+/** A collection of methods supporting the handling of master pages.
+*/
+class DocumentHelper
+{
+public:
+    /** Return a copy of the given master page in the given document.
+    */
+    static SdPage* CopyMasterPageToLocalDocument (
+        SdDrawDocument& rTargetDocument,
+        SdPage* pMasterPage);
+
+    /** Return and, when not yet present, create a slide that uses the given
+        masster page.
+    */
+    static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
+
+    /** Copy the styles used by the given page from the source document to
+        the target document.
+    */
+    static void ProvideStyles (
+        SdDrawDocument& rSourceDocument,
+        SdDrawDocument& rTargetDocument,
+        SdPage* pPage);
+
+    /** Assign the given master page to the list of pages.
+        @param rTargetDocument
+            The document that is the owner of the pages in rPageList.
+        @param pMasterPage
+            This master page will usually be a member of the list of all
+            available master pages as provided by the MasterPageContainer.
+        @param rPageList
+            The pages to which to assign the master page.  These pages may
+            be slides or master pages themselves.
+    */
+    static void AssignMasterPageToPageList (
+        SdDrawDocument& rTargetDocument,
+        SdPage* pMasterPage,
+        const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
+
+private:
+    static SdPage* AddMasterPage (
+        SdDrawDocument& rTargetDocument,
+        SdPage* pMasterPage);
+    static SdPage* AddMasterPage (
+        SdDrawDocument& rTargetDocument,
+        SdPage* pMasterPage,
+        sal_uInt16 nInsertionIndex);
+    static SdPage* ProvideMasterPage (
+        SdDrawDocument& rTargetDocument,
+        SdPage* pMasterPage,
+        const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
+    
+    /** Assign the given master page to the given page.
+        @param pMasterPage
+            In contrast to AssignMasterPageToPageList() this page is assumed
+            to be in the target document, i.e. the same document that pPage
+            is in.  The caller will usually call AddMasterPage() to create a
+            clone of a master page in a another document to create it.
+        @param rsBaseLayoutName
+            The layout name of the given master page.  It is given so that
+            it has not to be created on every call.  It could be generated
+            from the given master page, though.
+        @param pPage
+            The page to which to assign the master page.  It can be a slide
+            or a master page itself.
+    */
+    static void AssignMasterPageToPage (
+        SdPage* pMasterPage,
+        const String& rsBaseLayoutName,
+        SdPage* pPage);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/IDisposable.hxx b/main/sd/source/ui/sidebar/IDisposable.hxx
new file mode 100644
index 0000000..c4c3a3c
--- /dev/null
+++ b/main/sd/source/ui/sidebar/IDisposable.hxx
@@ -0,0 +1,44 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX
+#define SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX
+
+#include <tools/gen.hxx>
+#include <sal/types.h>
+
+class Window;
+
+namespace sd { namespace sidebar {
+
+
+class IDisposable
+{
+public:
+    virtual void Dispose (void) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/ISidebarReceiver.hxx b/main/sd/source/ui/sidebar/ISidebarReceiver.hxx
new file mode 100644
index 0000000..fc8b064
--- /dev/null
+++ b/main/sd/source/ui/sidebar/ISidebarReceiver.hxx
@@ -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 SD_SIDEBAR_RECEIVER_INTERFACE_HXX
+#define SD_SIDEBAR_RECEIVER_INTERFACE_HXX
+
+#include <com/sun/star/ui/XSidebar.hpp>
+
+namespace sd { namespace sidebar {
+
+
+class ISidebarReceiver
+{
+public:
+    virtual void SetSidebar (const ::com::sun::star::uno::Reference<
+        ::com::sun::star::ui::XSidebar>& rxSidebar) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/LayoutMenu.cxx b/main/sd/source/ui/sidebar/LayoutMenu.cxx
new file mode 100644
index 0000000..0a9b590
--- /dev/null
+++ b/main/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -0,0 +1,984 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "LayoutMenu.hxx"
+
+#include "SidebarShellManager.hxx"
+#include "app.hrc"
+#include "drawdoc.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "helpids.h"
+#include "pres.hxx"
+#include "res_bmp.hrc"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "tools/SlotStateListener.hxx"
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "EventMultiplexer.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include <sfx2/sidebar/Theme.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/languageoptions.hxx>
+#include <vcl/image.hxx>
+#include <vcl/floatwin.hxx>
+
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+
+#include <vector>
+#include <memory>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using namespace ::sd::slidesorter;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace sidebar {
+
+
+
+struct snewfoil_value_info
+{
+    sal_uInt16 mnBmpResId;
+    sal_uInt16 mnHCBmpResId;
+    sal_uInt16 mnStrResId;
+    WritingMode meWritingMode;
+    AutoLayout maAutoLayout;
+};
+
+static snewfoil_value_info notes[] =
+{
+    {BMP_FOILN_01, BMP_FOILN_01_H, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB,
+     AUTOLAYOUT_NOTES},
+    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info handout[] =
+{
+    {BMP_FOILH_01, BMP_FOILH_01_H, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT1},
+    {BMP_FOILH_02, BMP_FOILH_02_H, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT2},
+    {BMP_FOILH_03, BMP_FOILH_03_H, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT3},
+    {BMP_FOILH_04, BMP_FOILH_04_H, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT4},
+    {BMP_FOILH_06, BMP_FOILH_06_H, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT6},
+    {BMP_FOILH_09, BMP_FOILH_09_H, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB,
+     AUTOLAYOUT_HANDOUT9},
+    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+};
+
+static snewfoil_value_info standard[] =
+{
+    {BMP_LAYOUT_EMPTY, BMP_LAYOUT_EMPTY_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB,        AUTOLAYOUT_NONE},
+	{BMP_LAYOUT_HEAD03, BMP_LAYOUT_HEAD03_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB,       AUTOLAYOUT_TITLE},
+    {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB,        AUTOLAYOUT_ENUM},   
+	{BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB,       AUTOLAYOUT_2TEXT},
+	{BMP_LAYOUT_HEAD01, BMP_LAYOUT_HEAD01_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB,  AUTOLAYOUT_ONLY_TITLE},    
+	{BMP_LAYOUT_TEXTONLY, BMP_LAYOUT_TEXTONLY_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB,   AUTOLAYOUT_ONLY_TEXT},
+    {BMP_LAYOUT_HEAD03B, BMP_LAYOUT_HEAD03B_H, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_2OBJTEXT},
+	{BMP_LAYOUT_HEAD03C, BMP_LAYOUT_HEAD03C_H, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_TEXT2OBJ},
+	{BMP_LAYOUT_HEAD03A, BMP_LAYOUT_HEAD03A_H, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT},    
+	{BMP_LAYOUT_HEAD02B, BMP_LAYOUT_HEAD02B_H, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT},
+    {BMP_LAYOUT_HEAD04, BMP_LAYOUT_HEAD04_H, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB,        AUTOLAYOUT_4OBJ},   
+	{BMP_LAYOUT_HEAD06, BMP_LAYOUT_HEAD06_H, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_6CLIPART},
+
+	// vertical
+    {BMP_LAYOUT_VERTICAL02, BMP_LAYOUT_VERTICAL02_H, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART},
+    {BMP_LAYOUT_VERTICAL01, BMP_LAYOUT_VERTICAL01_H, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE},
+    {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE},
+    {BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART,   WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART},
+    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
+};
+
+
+
+
+LayoutMenu::LayoutMenu (
+    ::Window* pParent,
+    ViewShellBase& rViewShellBase,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : ValueSet (pParent),
+      DragSourceHelper(this),
+      DropTargetHelper(this),
+      mrBase(rViewShellBase),
+      mbUseOwnScrollBar(false),
+      mnPreferredColumnCount(3),
+      mxListener(NULL),
+      mbSelectionUpdatePending(true),
+      mbIsMainViewChangePending(false),
+      mxSidebar(rxSidebar),
+      mbIsDisposed(false)
+{
+    implConstruct( *mrBase.GetDocument()->GetDocSh() );
+    OSL_TRACE("created LayoutMenu at %x", this);
+
+    SetStyle(GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_TABSTOP);
+
+    SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+    SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
+    
+#ifdef DEBUG
+    SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:LayoutMenu")));
+#endif
+}
+
+
+
+
+void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
+{
+    OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell,
+        "LayoutMenu::implConstruct: hmm?" );
+    // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ...
+
+	SetStyle (
+        ( GetStyle()  & ~(WB_ITEMBORDER) )
+        | WB_TABSTOP
+        | WB_MENUSTYLEVALUESET
+        | WB_NO_DIRECTSELECT
+        );
+    if (mbUseOwnScrollBar)
+        SetStyle (GetStyle() | WB_VSCROLL);
+	SetExtraSpacing(2);
+	SetSelectHdl (LINK(this, LayoutMenu, ClickHandler));
+    InvalidateContent();
+
+    Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener));
+    mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink,
+        ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
+        | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
+        | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
+        | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
+        | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED
+        | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
+        | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER);
+
+    Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS);
+    SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE));
+    
+    Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler));
+    mxListener = new ::sd::tools::SlotStateListener(
+        aStateChangeLink,
+        Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY),
+        ::rtl::OUString::createFromAscii(".uno:VerticalTextState"));
+
+    SetSizePixel(GetParent()->GetSizePixel());
+    Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
+    GetParent()->AddEventListener(aWindowEventHandlerLink);
+}
+
+
+
+
+LayoutMenu::~LayoutMenu (void)
+{
+    OSL_TRACE("destroying LayoutMenu at %x", this);
+    Dispose();
+}
+
+
+
+
+void LayoutMenu::Dispose (void)
+{
+    if (mbIsDisposed)
+        return;
+
+    OSL_TRACE("disposing LayoutMenu at %x", this);
+
+    mbIsDisposed = true;
+
+    Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY);
+    if (xComponent.is())
+        xComponent->dispose();
+
+    Clear();
+    Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener));
+    mrBase.GetEventMultiplexer()->RemoveEventListener (aLink);
+
+    Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler));
+    GetParent()->RemoveEventListener(aWindowEventHandlerLink);
+}
+
+
+
+
+AutoLayout LayoutMenu::GetSelectedAutoLayout (void)
+{
+    AutoLayout aResult = AUTOLAYOUT_NONE;
+    
+    if ( ! IsNoSelection() && GetSelectItemId()!=0)
+    {
+        AutoLayout* pLayout = static_cast<AutoLayout*>(GetItemData(GetSelectItemId()));
+        if (pLayout != NULL)
+            aResult = *pLayout;
+    }
+
+    return aResult;
+}
+
+
+
+
+/** The preferred size depends on the preferred number of columns, the
+    number of items, and the size of the items.
+*/
+Size LayoutMenu::GetPreferredSize (void)
+{
+    Size aItemSize = CalcItemSizePixel (Size());
+    Size aPreferredWindowSize = CalcWindowSizePixel (
+        aItemSize, 
+         (sal_uInt16)mnPreferredColumnCount,
+        (sal_uInt16)CalculateRowCount (aItemSize,mnPreferredColumnCount));
+    return aPreferredWindowSize;
+}
+
+
+
+
+sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight)
+{
+    sal_Int32 nPreferredWidth = 100;
+    if (GetItemCount() > 0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        if (nHeight>0 && aItemSize.Height()>0)
+        {
+            int nRowCount = nHeight / aItemSize.Height();
+            if (nRowCount <= 0)
+                nRowCount = 1;
+            int nColumnCount = (GetItemCount() + nRowCount-1) / nRowCount;
+            nPreferredWidth = nColumnCount * aItemSize.Width();
+        }
+    }
+
+    return nPreferredWidth;
+}
+
+
+
+
+ui::LayoutSize LayoutMenu::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    sal_Int32 nPreferredHeight = 200;
+    if ( ! mbUseOwnScrollBar && GetItemCount()>0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        if (nWidth>0 && aItemSize.Width()>0)
+        {
+            aItemSize.Width() += 8;
+            aItemSize.Height() += 8;
+            int nColumnCount = nWidth / aItemSize.Width();
+            if (nColumnCount <= 0)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+            int nRowCount = (GetItemCount() + nColumnCount-1) / nColumnCount;
+            nPreferredHeight = nRowCount * aItemSize.Height();
+        }
+    }
+    return ui::LayoutSize(nPreferredHeight,nPreferredHeight,nPreferredHeight);
+}
+
+
+
+
+sal_Int32 LayoutMenu::GetMinimumWidth (void)
+{
+    sal_Int32 nMinimumWidth = 0;
+    if (GetItemCount()>0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        nMinimumWidth = aItemSize.Width();
+    }
+    return nMinimumWidth;
+}
+
+
+
+
+void LayoutMenu::UpdateEnabledState (const MasterMode eMode)
+{
+    bool bIsEnabled (false);
+
+    ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell());
+    if (pMainViewShell)
+    {
+        switch (pMainViewShell->GetShellType())
+        {
+            case ViewShell::ST_NONE:
+            case ViewShell::ST_OUTLINE:
+            case ViewShell::ST_PRESENTATION:
+            case ViewShell::ST_SIDEBAR:
+                // The complete task pane is disabled for these values or
+                // not even visible.  Disabling the LayoutMenu would be
+                // logical but unnecessary.  The main disadvantage is that
+                // after re-enabling it (typically) another panel is
+                // expanded.
+                bIsEnabled = true;
+                break;
+                
+            case ViewShell::ST_DRAW:
+            case ViewShell::ST_IMPRESS:
+            {
+                switch (eMode)
+                {
+                    case MM_UNKNOWN:
+                    {
+                        ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+                            ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell));
+                        if (pDrawViewShell)
+                            bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE;
+                        break;
+                    }
+                    case MM_NORMAL:
+                        bIsEnabled = true;
+                        break;
+
+                    case MM_MASTER:
+                        bIsEnabled = false;
+                        break;
+                }
+                break;
+            }
+
+            case ViewShell::ST_HANDOUT:
+            case ViewShell::ST_NOTES:
+            case ViewShell::ST_SLIDE_SORTER:
+            default:
+                bIsEnabled = true;
+                break;
+        }
+    }
+}
+
+
+
+
+void LayoutMenu::Paint (const Rectangle& rRect)
+{
+    if (mbSelectionUpdatePending)
+    {
+        mbSelectionUpdatePending = false;
+        UpdateSelection();
+    }
+    ValueSet::Paint (rRect);
+}
+
+
+
+
+void LayoutMenu::Resize (void)
+{
+    Size aWindowSize = GetOutputSizePixel();
+    if (IsVisible() && aWindowSize.Width() > 0)
+    {
+        // Calculate the number of rows and columns.
+        if (GetItemCount() > 0)
+        {
+            Image aImage = GetItemImage(GetItemId(0));
+            Size aItemSize = CalcItemSizePixel (
+                aImage.GetSizePixel());
+            aItemSize.Width() += 8;
+            aItemSize.Height() += 8;
+            int nColumnCount = aWindowSize.Width() / aItemSize.Width();
+            if (nColumnCount < 1)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+
+            int nRowCount = CalculateRowCount (aItemSize, nColumnCount);
+            
+            SetColCount ((sal_uInt16)nColumnCount);
+            SetLineCount ((sal_uInt16)nRowCount);
+        }
+    }
+
+    ValueSet::Resize ();
+}
+
+
+
+
+void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent)
+{
+    // As a preparation for the context menu the item under the mouse is
+    // selected.
+    if (rEvent.IsRight())
+    {
+        ReleaseMouse();
+        sal_uInt16 nIndex = GetItemId (rEvent.GetPosPixel());
+        if (nIndex > 0)
+            SelectItem(nIndex);
+    }
+    
+    ValueSet::MouseButtonDown (rEvent);
+}
+
+
+
+
+void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout)
+{
+    ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+    if (pViewShell == NULL)
+        return;
+
+    SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+    if (pViewFrame == NULL)
+        return;
+
+    SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+    if (pDispatcher == NULL)
+        return;
+
+    // Call SID_INSERTPAGE with the right arguments.  This is because
+    // the popup menu can not call this slot with arguments directly.
+    SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
+    if (aRequest.GetArgs() != NULL)
+    {
+        pDispatcher->Execute(
+            SID_INSERTPAGE,
+            SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+            *aRequest.GetArgs());
+    }
+    UpdateSelection();
+}
+
+
+
+
+void LayoutMenu::InvalidateContent (void)
+{
+    // Throw away the current set and fill the menu anew according to the
+    // current settings (this includes the support for vertical writing.)
+    Fill();
+
+    if (mxSidebar.is())
+        mxSidebar->requestLayout();
+}
+
+
+
+
+int LayoutMenu::CalculateRowCount (const Size&, int nColumnCount)
+{
+    int nRowCount = 0;
+
+    if (GetItemCount() > 0 && nColumnCount > 0)
+    {
+        nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount;
+        //        nRowCount = GetOutputSizePixel().Height() / rItemSize.Height();
+        if (nRowCount < 1)
+            nRowCount = 1;
+    }
+
+    return nRowCount;
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, ClickHandler, ValueSet*, EMPTYARG)
+{
+    AssignLayoutToSelectedSlides (GetSelectedAutoLayout());
+    return 0;
+}
+
+
+
+
+/** The specified layout is assigned to the current page of the view shell
+    in the center pane.
+*/
+void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
+{
+    using namespace ::sd::slidesorter;
+    using namespace ::sd::slidesorter::controller;
+
+    do
+    {
+        // The view shell in the center pane has to be present.
+        ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
+        if (pMainViewShell == NULL)
+            break;
+
+        // Determine if the current view is in an invalid master page mode.
+        // The handout view is always in master page mode and therefore not
+        // invalid.
+        bool bMasterPageMode (false);
+        switch (pMainViewShell->GetShellType())
+        {
+            case ViewShell::ST_NOTES:
+            case ViewShell::ST_IMPRESS:
+            {
+                DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
+                if (pDrawViewShell != NULL)
+                    if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+                        bMasterPageMode = true;
+            }
+			default:
+				break;
+        }
+        if (bMasterPageMode)
+            break;
+
+        // Get a list of all selected slides and call the SID_MODIFYPAGE
+        // slot for all of them.
+		::sd::slidesorter::SharedPageSelection pPageSelection;
+
+        // Get a list of selected pages.
+        // First we try to obtain this list from a slide sorter.  This is
+        // possible only some of the view shells in the center pane.  When
+        // no valid slide sorter is available then ask the main view shell
+        // for its current page.
+        SlideSorterViewShell* pSlideSorter = NULL;
+        switch (pMainViewShell->GetShellType())
+        {
+            case ViewShell::ST_IMPRESS:
+            case ViewShell::ST_NOTES:
+            case ViewShell::ST_SLIDE_SORTER:
+                pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
+                break;
+			default:
+				break;
+        }
+		if (pSlideSorter != NULL)
+		{
+			// There is a slide sorter visible so get the list of selected pages from it.
+            pPageSelection = pSlideSorter->GetPageSelection();
+		}
+
+		if( (pSlideSorter == NULL) || (pPageSelection.get() == 0) || pPageSelection->empty() )
+		{
+			// No valid slide sorter available.  Ask the main view shell for
+			// its current page.
+            pPageSelection.reset(new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
+            pPageSelection->push_back(pMainViewShell->GetActualPage());
+		}
+			
+
+		if (pPageSelection->empty())
+			break;
+
+		::std::vector<SdPage*>::iterator iPage;
+		for (iPage=pPageSelection->begin(); iPage!=pPageSelection->end(); ++iPage)
+			{
+				if ((*iPage) == NULL)
+					continue;
+
+				// Call the SID_ASSIGN_LAYOUT slot with all the necessary parameters.
+				SfxRequest aRequest (mrBase.GetViewFrame(), SID_ASSIGN_LAYOUT);
+				aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATPAGE, ((*iPage)->GetPageNum()-1)/2));
+				aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
+				pMainViewShell->ExecuteSlot (aRequest, sal_Bool(sal_False));
+			}
+    }
+    while(false);
+}
+
+
+
+
+SfxRequest LayoutMenu::CreateRequest (
+    sal_uInt16 nSlotId,
+    AutoLayout aLayout)
+{
+    SfxRequest aRequest (mrBase.GetViewFrame(), nSlotId);
+
+    do
+    {
+        SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin());
+        sal_uInt8 aBackground (rLayerAdmin.GetLayerID(
+            String(SdResId(STR_LAYER_BCKGRND)), sal_False));
+        sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID(
+            String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
+        ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+        if (pViewShell == NULL)
+            break;
+        SdPage* pPage = pViewShell->GetActualPage();
+        if (pPage == NULL)
+            break;
+
+        SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers());
+    
+        aRequest.AppendItem(
+            SfxStringItem (ID_VAL_PAGENAME, String()));//pPage->GetName()));
+        aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
+        aRequest.AppendItem(
+            SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground)));
+        aRequest.AppendItem(
+            SfxBoolItem(
+                ID_VAL_ISPAGEOBJ,
+                aVisibleLayers.IsSet(aBackgroundObject)));
+    }
+    while (false);
+
+    return aRequest;
+}
+
+
+
+
+void LayoutMenu::Fill (void)
+{
+	const bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+	SvtLanguageOptions aLanguageOptions;
+    sal_Bool bVertical = aLanguageOptions.IsVerticalTextEnabled();
+    SdDrawDocument* pDocument = mrBase.GetDocument();
+    sal_Bool bRightToLeft = (pDocument!=NULL 
+        && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB);
+
+    // Get URL of the view in the center pane.
+    ::rtl::OUString sCenterPaneViewName;
+    try
+    {
+        Reference<XControllerManager> xControllerManager (
+            Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW);
+        Reference<XResourceId> xPaneId (ResourceId::create(
+            ::comphelper::getProcessComponentContext(),
+            FrameworkHelper::msCenterPaneURL));
+        Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
+        if (xView.is())
+            sCenterPaneViewName = xView->getResourceId()->getResourceURL();
+    }
+    catch (RuntimeException&)
+    {}
+    
+	snewfoil_value_info* pInfo = NULL;
+    if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL))
+    {
+        pInfo = notes;
+    }
+    else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL))
+    {
+        pInfo = handout;
+    }
+    else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL)
+        || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL))
+    {
+        pInfo = standard;
+    }
+    else
+    {
+        pInfo = NULL;
+	}
+
+    Clear();
+    int n = 0;
+	for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++)
+	{
+        if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical)
+        {
+            BitmapEx aBmp (SdResId (bHighContrast 
+                             ? pInfo->mnHCBmpResId 
+                             : pInfo->mnBmpResId));
+		
+            if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode))
+                aBmp.Mirror (BMP_MIRROR_HORZ);
+
+            InsertItem (i, aBmp, String (SdResId (pInfo->mnStrResId)));
+            SetItemData (i, new AutoLayout(pInfo->maAutoLayout));
+            n++;
+        }
+	}
+
+    mbSelectionUpdatePending = true;
+}
+
+
+
+
+void LayoutMenu::Clear (void)
+{
+    for (sal_uInt16 nId=1; nId<=GetItemCount(); nId++)
+        delete static_cast<AutoLayout*>(GetItemData(nId));
+    ValueSet::Clear();
+}
+
+
+
+void LayoutMenu::StartDrag (sal_Int8 , const Point& )
+{
+}
+
+
+
+
+sal_Int8 LayoutMenu::AcceptDrop (const AcceptDropEvent& )
+{
+    return 0;
+}
+
+
+
+
+sal_Int8 LayoutMenu::ExecuteDrop (const ExecuteDropEvent& )
+{
+    return 0;
+}
+
+
+
+
+void LayoutMenu::Command (const CommandEvent& rEvent)
+{
+    switch (rEvent.GetCommand())
+    {
+        case COMMAND_CONTEXTMENU:
+            if ( ! SD_MOD()->GetWaterCan())
+            {
+                // Determine the position where to show the menu.
+                Point aMenuPosition;
+                if (rEvent.IsMouseEvent())
+                {
+                    if (GetItemId(rEvent.GetMousePosPixel()) <= 0)
+                        return;
+                    aMenuPosition = rEvent.GetMousePosPixel();
+                }
+                else
+                {
+                    if (GetSelectItemId() == (sal_uInt16)-1)
+                        return;
+                    Rectangle aBBox (GetItemRect(GetSelectItemId()));
+                    aMenuPosition = aBBox.Center();
+                }
+
+                // Setup the menu.
+                ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP)));
+                FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
+                if (pMenuWindow != NULL)
+                    pMenuWindow->SetPopupModeFlags(
+                        pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE);
+                pMenu->SetSelectHdl(LINK(this, LayoutMenu, OnMenuItemSelected));
+
+                // Disable the SID_INSERTPAGE_LAYOUT_MENU item when
+                // the document is read-only.
+                const SfxPoolItem* pItem = NULL;
+                const SfxItemState aState (
+                    mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem));
+                if (aState == SFX_ITEM_DISABLED)
+                    pMenu->EnableItem(SID_INSERTPAGE_LAYOUT_MENU, sal_False);
+
+                // Show the menu.
+                pMenu->Execute(this, Rectangle(aMenuPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN);
+            }
+            break;
+
+        default:
+            ValueSet::Command(rEvent);
+            break;
+    }
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, StateChangeHandler, ::rtl::OUString*, EMPTYARG)
+{
+    InvalidateContent();
+    return 0;
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, OnMenuItemSelected, Menu*, pMenu)
+{
+    if (pMenu == NULL)
+    {
+        OSL_ENSURE(pMenu!=NULL, "LayoutMenu::OnMenuItemSelected: illegal menu!");
+        return 0;
+    }
+
+    pMenu->Deactivate();
+    const sal_Int32 nIndex (pMenu->GetCurItemId());
+
+    if (nIndex == SID_TP_APPLY_TO_SELECTED_SLIDES)
+    {
+        AssignLayoutToSelectedSlides(GetSelectedAutoLayout());
+    }
+    else if (nIndex == SID_INSERTPAGE_LAYOUT_MENU)
+    {
+        // Add arguments to this slot and forward it to the main view
+        // shell.
+        InsertPageWithLayout(GetSelectedAutoLayout());
+    }
+
+    return 0;
+}
+
+
+
+
+void LayoutMenu::UpdateSelection (void)
+{
+    bool bItemSelected = false;
+
+    do
+    {
+        // Get current page of main view.
+        ViewShell* pViewShell = mrBase.GetMainViewShell().get();
+        if (pViewShell == NULL)
+            break;
+        
+        SdPage* pCurrentPage = pViewShell->getCurrentPage();
+        if (pCurrentPage == NULL)
+            break;
+
+        // Get layout of current page.
+        AutoLayout aLayout (pCurrentPage->GetAutoLayout());
+        if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END)
+            break;
+
+        // Find the entry of the menu for to the layout.
+        sal_uInt16 nItemCount (GetItemCount());
+        for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
+        {
+            if (*static_cast<AutoLayout*>(GetItemData(nId)) == aLayout)
+            {
+                SelectItem(nId);
+                bItemSelected = true;
+                break;
+            }
+        }
+    }
+    while (false);
+
+    if ( ! bItemSelected)
+        SetNoSelection();
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
+{
+    switch (pEvent->meEventId)
+    {
+        case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
+        case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
+            if ( ! mbSelectionUpdatePending)
+                UpdateSelection();
+            break;
+
+        case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
+            mbIsMainViewChangePending = true;
+            UpdateEnabledState(MM_UNKNOWN);
+            break;
+
+        case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
+            HideFocus();
+            break;
+
+        case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
+            if (mbIsMainViewChangePending)
+            {
+                mbIsMainViewChangePending = false;
+                InvalidateContent();
+            }
+            break;
+
+        case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
+            UpdateEnabledState(MM_NORMAL);
+            break;
+
+        case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
+            UpdateEnabledState(MM_MASTER);
+            break;
+
+        default:
+            /* Ignored */
+            break;
+    }
+
+    return 0;
+}
+
+
+
+
+IMPL_LINK(LayoutMenu, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->GetId())
+        {
+            case VCLEVENT_WINDOW_SHOW:
+            case VCLEVENT_WINDOW_RESIZE:
+                SetSizePixel(GetParent()->GetSizePixel());
+                return sal_True;
+
+            default:
+                return sal_False;
+        }
+
+        const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, pEvent);
+        if (pSimpleHint != NULL
+            && pSimpleHint->GetId() == SFX_HINT_DYING)
+        {
+            return sal_True;
+        }
+    }
+
+    return sal_False;
+}
+
+
+
+
+void LayoutMenu::DataChanged (const DataChangedEvent& rEvent)
+{
+    Fill();
+    ValueSet::DataChanged(rEvent);
+    SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+    SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
+}
+
+
+
+
+
+} } // end of namespace ::sd::sidebar
diff --git a/main/sd/source/ui/sidebar/LayoutMenu.hxx b/main/sd/source/ui/sidebar/LayoutMenu.hxx
new file mode 100644
index 0000000..42ee938
--- /dev/null
+++ b/main/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -0,0 +1,225 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_LAYOUT_MENU_HXX
+#define SD_SIDEBAR_LAYOUT_MENU_HXX
+
+#include "IDisposable.hxx"
+#include "ISidebarReceiver.hxx"
+#include <sfx2/sidebar/ILayoutableWindow.hxx>
+
+#include "glob.hxx"
+#include "pres.hxx"
+
+#include <vcl/ctrl.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/shell.hxx>
+
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+
+class SfxModule;
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sd {
+class DrawDocShell;
+class PaneManagerEvent;
+class ViewShellBase;
+}
+
+
+namespace sd { namespace tools {
+class EventMultiplexerEvent;
+} }
+
+
+namespace sd { namespace sidebar {
+
+class ControlFactory;
+class SidebarViewShell;
+class SidebarShellManager;
+
+
+class LayoutMenu
+    : public ValueSet,
+      public DragSourceHelper, 
+      public DropTargetHelper,
+      public sfx2::sidebar::ILayoutableWindow
+{
+public:
+    /** Create a new layout menu.  Depending on the given flag it
+        displays its own scroll bar or lets a surrounding window
+        handle that.
+        @param i_pParent
+            the parent node in the control tree
+        @param i_rPanelViewShell
+            the view shell of the task pane.
+    */
+    LayoutMenu (
+        ::Window* pParent,
+        ViewShellBase& rViewShellBase,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~LayoutMenu (void);
+
+    virtual void Dispose (void);
+    
+    /** Return a numerical value representing the currently selected
+        layout.
+    */
+    AutoLayout GetSelectedAutoLayout (void);
+
+    Size GetPreferredSize (void);
+    sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+    sal_Int32 GetMinimumWidth (void);
+
+    // From ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+    // From ::Window
+	virtual void Paint (const Rectangle& rRect);
+    virtual void Resize (void);
+
+    /** Show a context menu when the right mouse button is pressed.
+    */
+    virtual void MouseButtonDown (const MouseEvent& rEvent);
+
+    /** The LayoutMenu does not support some main views.  In this case the
+        LayoutMenu is disabled.  This state is updated in this method.
+        @param eMode
+            On some occasions the edit mode is being switched when this
+            method is called can not (yet) be reliably detected.  Luckily,
+            in these cases the new value is provided by some broadcaster.
+            On other occasions the edit mode is not modified and is also not
+            provided.  Therefore the Unknown value.
+    */
+    enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN };
+    void UpdateEnabledState (const MasterMode eMode);
+
+    /** Call this method when the set of displayed layouts is not up-to-date
+        anymore.  It will re-assemple this set according to the current
+        settings.
+    */
+    void InvalidateContent (void);
+
+	// DragSourceHelper
+	virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel);
+
+	// DropTargetHelper
+	virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent);
+	virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent);
+
+    /** The context menu is requested over this Command() method.
+    */
+	virtual void Command (const CommandEvent& rEvent);
+
+    /** Call Fill() when switching to or from high contrast mode so that the
+        correct set of icons is displayed.
+    */
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+	using Window::GetWindow;
+	using ValueSet::StartDrag;
+
+private:
+    ViewShellBase& mrBase;
+
+    /** Do we use our own scroll bar or is viewport handling done by
+        our parent?
+    */
+    bool mbUseOwnScrollBar;
+
+    /** If we are asked for the preferred window size, then use this
+        many columns for the calculation.
+    */
+    const int mnPreferredColumnCount;
+    cssu::Reference<css::frame::XStatusListener> mxListener;
+    bool mbSelectionUpdatePending;
+    bool mbIsMainViewChangePending;
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+    bool mbIsDisposed;
+
+    /** Calculate the number of displayed rows.  This depends on the given
+        item size, the given number of columns, and the size of the
+        control.  Note that this is not the number of rows managed by the
+        valueset.  This number may be larger.  In that case a vertical
+        scroll bar is displayed.
+    */
+    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+
+    /** Fill the value set with the layouts that are applicable to the
+        current main view shell.
+    */
+    void Fill (void);
+
+    /** Remove all items from the value set.
+    */
+    void Clear (void);
+
+    /** Assign the given layout to all selected slides of a slide sorter.
+        If no slide sorter is active then this call is ignored.  The slide
+        sorter in the center pane is preferred if the choice exists.
+    */
+    void AssignLayoutToSelectedSlides (AutoLayout aLayout);
+
+    /** Insert a new page with the given layout.  The page is inserted via
+        the main view shell, i.e. its SID_INSERTPAGE slot is called.  It it
+        does not support this slot then inserting a new page does not take
+        place.  The new page is inserted after the currently active one (the
+        one returned by ViewShell::GetActualPage().)
+    */
+    void InsertPageWithLayout (AutoLayout aLayout);
+
+    /** Create a request structure that can be used with the SID_INSERTPAGE
+        and SID_MODIFYPAGE slots.  The parameters are set so that the given
+        layout is assigned to the current page of the main view shell.
+        @param nSlotId
+            Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE.
+        @param aLayout
+            Layout of the page to insert or to assign.
+    */
+    SfxRequest CreateRequest (
+        sal_uInt16 nSlotId,
+        AutoLayout aLayout);
+
+    /** Select the layout that is used by the current page.
+    */
+    void UpdateSelection (void);
+
+    // internal ctor
+    void    implConstruct( DrawDocShell& rDocumentShell );
+
+    /** When clicked then set the current page of the view in the center pane.
+    */
+    DECL_LINK(ClickHandler, ValueSet*);
+    DECL_LINK(RightClickHandler, MouseEvent*);
+    DECL_LINK(StateChangeHandler, ::rtl::OUString*);
+    DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*);
+    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    DECL_LINK(OnMenuItemSelected, Menu*);
+};
+
+} } // end of namespace ::sd::toolpanel
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageContainer.cxx b/main/sd/source/ui/sidebar/MasterPageContainer.cxx
new file mode 100644
index 0000000..16e413d
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainer.cxx
@@ -0,0 +1,1212 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageContainer.hxx"
+
+#include "MasterPageDescriptor.hxx"
+#include "MasterPageContainerFiller.hxx"
+#include "MasterPageContainerQueue.hxx"
+#include "TemplateScanner.hxx"
+#include "tools/AsynchronousTask.hxx"
+#include "strings.hrc"
+#include <algorithm>
+#include <list>
+#include <set>
+
+#include "unomodel.hxx"
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdpage.hxx>
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
+#include "sdresid.hxx"
+#include "tools/TimerBasedTaskExecution.hxx"
+#include "pres.hxx"
+#include <osl/mutex.hxx>
+#include <boost/weak_ptr.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace {
+
+typedef ::std::vector<sd::sidebar::SharedMasterPageDescriptor> MasterPageContainerType;
+
+} // end of anonymous namespace
+
+
+namespace sd { namespace sidebar {
+
+
+/** Inner implementation class of the MasterPageContainer.
+*/
+class MasterPageContainer::Implementation
+    : public SdGlobalResource,
+      public MasterPageContainerFiller::ContainerAdapter,
+      public MasterPageContainerQueue::ContainerAdapter
+{
+public:
+    mutable ::osl::Mutex maMutex;
+
+    static ::boost::weak_ptr<Implementation> mpInstance;
+    MasterPageContainerType maContainer;
+
+    static ::boost::shared_ptr<Implementation> Instance (void);
+
+    void LateInit (void);
+    void AddChangeListener (const Link& rLink);
+    void RemoveChangeListener (const Link& rLink);
+    void UpdatePreviewSizePixel (void);
+    Size GetPreviewSizePixel (PreviewSize eSize) const;
+
+    bool HasToken (Token aToken) const;
+    const SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken) const;
+    SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken);
+    virtual Token PutMasterPage (const SharedMasterPageDescriptor& rDescriptor);
+    void InvalidatePreview (Token aToken);
+    Image GetPreviewForToken (
+        Token aToken,
+        PreviewSize ePreviewSize);
+    PreviewState GetPreviewState (Token aToken) const;
+    bool RequestPreview (Token aToken);
+
+    Reference<frame::XModel> GetModel (void);
+    SdDrawDocument* GetDocument (void);
+
+    void FireContainerChange (
+        MasterPageContainerChangeEvent::EventType eType,
+        Token aToken,
+        bool bNotifyAsynchronously = false);
+
+    virtual bool UpdateDescriptor (
+        const SharedMasterPageDescriptor& rpDescriptor,
+        bool bForcePageObject,
+        bool bForcePreview,
+        bool bSendEvents);
+
+    void ReleaseDescriptor (Token aToken);
+
+    /** Called by the MasterPageContainerFiller to notify that all master
+        pages from template documents have been added.
+    */
+    virtual void FillingDone (void);
+
+private:
+    Implementation (void);
+    virtual ~Implementation (void);
+
+    class Deleter { public:
+        void operator() (Implementation* pObject) { delete pObject; }
+    };
+    friend class Deleter;
+
+    enum InitializationState { NOT_INITIALIZED, INITIALIZING, INITIALIZED } meInitializationState;
+
+    ::boost::scoped_ptr<MasterPageContainerQueue> mpRequestQueue;
+    ::com::sun::star::uno::Reference<com::sun::star::frame::XModel> mxModel;
+    SdDrawDocument* mpDocument;
+    PreviewRenderer maPreviewRenderer;
+    /** Remember whether the first page object has already been used to
+        determine the correct size ratio.
+    */
+    bool mbFirstPageObjectSeen;
+    
+    // The widths for the previews contain two pixels for the border that is
+    // painted arround the preview.
+    static const int SMALL_PREVIEW_WIDTH = 72 + 2;
+    static const int LARGE_PREVIEW_WIDTH = 2*72 + 2;
+
+    /** This substition of page preview shows "Preparing preview" and is
+        shown as long as the actual previews are not being present.
+    */
+    Image maLargePreviewBeingCreated;
+    Image maSmallPreviewBeingCreated;
+
+    /** This substition of page preview is shown when a preview can not be
+        created and thus is not available.
+    */
+    Image maLargePreviewNotAvailable;
+    Image maSmallPreviewNotAvailable;
+
+    ::std::vector<Link> maChangeListeners;
+
+    // We have to remember the tasks for initialization and filling in case
+    // a MasterPageContainer object is destroyed before these tasks have
+    // been completed.
+    ::boost::weak_ptr<sd::tools::TimerBasedTaskExecution> mpFillerTask;
+
+    Size maSmallPreviewSizePixel;
+    Size maLargePreviewSizePixel;
+    bool mbPageRatioKnown;
+
+    bool mbContainerCleaningPending;
+
+    typedef ::std::pair<MasterPageContainerChangeEvent::EventType,Token> EventData;
+    DECL_LINK(AsynchronousNotifyCallback, EventData*);
+    ::sd::DrawDocShell* LoadDocument (
+        const String& sFileName,
+        SfxObjectShellLock& rxDocumentShell);
+
+    Image GetPreviewSubstitution (sal_uInt16 nId, PreviewSize ePreviewSize);
+
+    void CleanContainer (void);
+};
+
+
+
+
+//===== MasterPageContainer ===================================================
+
+::boost::weak_ptr<MasterPageContainer::Implementation>
+    MasterPageContainer::Implementation::mpInstance;
+static const MasterPageContainer::Token NIL_TOKEN (-1);
+
+
+
+
+::boost::shared_ptr<MasterPageContainer::Implementation>
+    MasterPageContainer::Implementation::Instance (void)
+{
+    ::boost::shared_ptr<MasterPageContainer::Implementation> pInstance;
+    
+    if (Implementation::mpInstance.expired())
+    {
+        ::osl::GetGlobalMutex aMutexFunctor;
+        ::osl::MutexGuard aGuard (aMutexFunctor());
+        if (Implementation::mpInstance.expired())
+        {
+            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+            pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+                new MasterPageContainer::Implementation(),
+                MasterPageContainer::Implementation::Deleter());
+            SdGlobalResourceContainer::Instance().AddResource(pInstance);
+            Implementation::mpInstance = pInstance;
+        }
+        else
+            pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+                Implementation::mpInstance);
+    }
+    else
+    {
+        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+        pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
+            Implementation::mpInstance);
+    }
+
+    DBG_ASSERT (pInstance.get()!=NULL,
+        "MasterPageContainer::Implementation::Instance(): instance is NULL");
+    return pInstance;
+}
+
+
+
+
+MasterPageContainer::MasterPageContainer (void)
+    : mpImpl(Implementation::Instance()),
+      mePreviewSize(SMALL)
+{
+    mpImpl->LateInit();
+}
+
+
+
+
+MasterPageContainer::~MasterPageContainer (void)
+{
+}
+
+
+
+
+void MasterPageContainer::AddChangeListener (const Link& rLink)
+{
+    mpImpl->AddChangeListener(rLink);
+}
+
+
+
+
+void MasterPageContainer::RemoveChangeListener (const Link& rLink)
+{
+    mpImpl->RemoveChangeListener(rLink);
+}
+
+
+
+
+void MasterPageContainer::SetPreviewSize (PreviewSize eSize)
+{
+    mePreviewSize = eSize;
+    mpImpl->FireContainerChange(
+        MasterPageContainerChangeEvent::SIZE_CHANGED,
+        NIL_TOKEN);
+}
+
+
+
+
+MasterPageContainer::PreviewSize MasterPageContainer::GetPreviewSize (void) const
+{
+    return mePreviewSize;
+}
+
+
+
+
+Size MasterPageContainer::GetPreviewSizePixel (void) const
+{
+    return mpImpl->GetPreviewSizePixel(mePreviewSize);
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::PutMasterPage (
+    const SharedMasterPageDescriptor& rDescriptor)
+{
+    return mpImpl->PutMasterPage(rDescriptor);
+}
+
+
+
+
+void MasterPageContainer::AcquireToken (Token aToken)
+{
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+    {
+        ++pDescriptor->mnUseCount;
+    }
+}
+
+
+
+
+void MasterPageContainer::ReleaseToken (Token aToken)
+{
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+    {
+        OSL_ASSERT(pDescriptor->mnUseCount>0);
+        --pDescriptor->mnUseCount;
+        if (pDescriptor->mnUseCount <= 0)
+        {
+            switch (pDescriptor->meOrigin)
+            {
+                case DEFAULT:
+                case TEMPLATE:
+                default:
+                    break;
+
+                case MASTERPAGE:
+                    mpImpl->ReleaseDescriptor(aToken);
+                    break;
+            }
+        }
+    }
+}
+
+
+
+
+int MasterPageContainer::GetTokenCount (void) const
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    return mpImpl->maContainer.size();
+}
+
+
+
+
+bool MasterPageContainer::HasToken (Token aToken) const
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    return mpImpl->HasToken(aToken);
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForIndex (int nIndex)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    Token aResult (NIL_TOKEN);
+    if (HasToken(nIndex))
+        aResult = mpImpl->maContainer[nIndex]->maToken;
+    return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForURL (
+    const String& sURL)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    Token aResult (NIL_TOKEN);
+    if (sURL.Len() > 0)
+    {
+        MasterPageContainerType::iterator iEntry (
+            ::std::find_if (
+                mpImpl->maContainer.begin(),
+                mpImpl->maContainer.end(),
+                MasterPageDescriptor::URLComparator(sURL)));
+        if (iEntry != mpImpl->maContainer.end())
+            aResult = (*iEntry)->maToken;
+    }
+    return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForStyleName (const String& sStyleName)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    Token aResult (NIL_TOKEN);
+    if (sStyleName.Len() > 0)
+    {
+        MasterPageContainerType::iterator iEntry (
+            ::std::find_if (
+                mpImpl->maContainer.begin(),
+                mpImpl->maContainer.end(),
+                MasterPageDescriptor::StyleNameComparator(sStyleName)));
+        if (iEntry != mpImpl->maContainer.end())
+            aResult = (*iEntry)->maToken;
+    }
+    return aResult;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::GetTokenForPageObject (
+    const SdPage* pPage)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    Token aResult (NIL_TOKEN);
+    if (pPage != NULL)
+    {
+        MasterPageContainerType::iterator iEntry (
+            ::std::find_if (
+                mpImpl->maContainer.begin(),
+                mpImpl->maContainer.end(),
+                MasterPageDescriptor::PageObjectComparator(pPage)));
+        if (iEntry != mpImpl->maContainer.end())
+            aResult = (*iEntry)->maToken;
+    }
+    return aResult;
+}
+
+
+
+
+String MasterPageContainer::GetURLForToken (
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return pDescriptor->msURL;
+    else
+        return String();
+}
+
+
+
+
+String MasterPageContainer::GetPageNameForToken (
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return pDescriptor->msPageName;
+    else
+        return String();
+}
+
+
+
+
+String MasterPageContainer::GetStyleNameForToken (
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return pDescriptor->msStyleName;
+    else
+        return String();
+}
+
+
+
+
+SdPage* MasterPageContainer::GetPageObjectForToken (
+    MasterPageContainer::Token aToken,
+    bool bLoad)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SdPage* pPageObject = NULL;
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+    {
+        pPageObject = pDescriptor->mpMasterPage;
+        if (pPageObject == NULL)
+        {
+            // The page object is not (yet) present.  Call
+            // UpdateDescriptor() to trigger the PageObjectProvider() to
+            // provide it.
+            if (bLoad)
+                mpImpl->GetModel();
+            if (mpImpl->UpdateDescriptor(pDescriptor,bLoad,false, true))
+                pPageObject = pDescriptor->mpMasterPage;
+        }
+    }
+    return pPageObject;
+}
+
+
+
+
+MasterPageContainer::Origin MasterPageContainer::GetOriginForToken (Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return pDescriptor->meOrigin;
+    else
+        return UNKNOWN;
+}
+
+
+
+
+sal_Int32 MasterPageContainer::GetTemplateIndexForToken (Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return pDescriptor->mnTemplateIndex;
+    else
+        return -1;
+}
+
+
+
+
+SharedMasterPageDescriptor MasterPageContainer::GetDescriptorForToken (
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
+
+    return mpImpl->GetDescriptor(aToken);
+}
+
+
+
+void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken)
+{
+    mpImpl->InvalidatePreview(aToken);
+}
+
+
+
+
+Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken)
+{
+    return mpImpl->GetPreviewForToken(aToken,mePreviewSize);
+}
+
+
+
+
+MasterPageContainer::PreviewState MasterPageContainer::GetPreviewState (Token aToken)
+{
+    return mpImpl->GetPreviewState(aToken);
+}
+
+
+
+
+bool MasterPageContainer::RequestPreview (Token aToken)
+{
+    return mpImpl->RequestPreview(aToken);
+}
+
+
+
+
+//==== Implementation ================================================
+
+MasterPageContainer::Implementation::Implementation (void)
+    : maMutex(),
+      maContainer(),
+	  meInitializationState(NOT_INITIALIZED),
+      mpRequestQueue(NULL),
+      mxModel(NULL),
+      mpDocument(NULL),
+      maPreviewRenderer(),
+      mbFirstPageObjectSeen(false),
+      maLargePreviewBeingCreated(),
+      maSmallPreviewBeingCreated(),
+      maLargePreviewNotAvailable(),
+      maSmallPreviewNotAvailable(),
+      maChangeListeners(),
+      maSmallPreviewSizePixel(),
+      maLargePreviewSizePixel(),
+      mbPageRatioKnown(false),
+      mbContainerCleaningPending(true)
+
+{
+    UpdatePreviewSizePixel();
+}
+
+
+
+
+MasterPageContainer::Implementation::~Implementation (void)
+{
+    // When the initializer or filler tasks are still running then we have
+    // to stop them now in order to prevent them from calling us back.
+    tools::TimerBasedTaskExecution::ReleaseTask(mpFillerTask);
+
+    mpRequestQueue.reset();
+
+    uno::Reference<util::XCloseable> xCloseable (mxModel, uno::UNO_QUERY);
+    if (xCloseable.is())
+    {
+        try
+        {
+            xCloseable->close(true);
+        }
+        catch (::com::sun::star::util::CloseVetoException aException)
+        {
+        }
+    }
+    mxModel = NULL;
+}
+
+
+
+
+void MasterPageContainer::Implementation::LateInit (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    if (meInitializationState == NOT_INITIALIZED)
+    {
+        meInitializationState = INITIALIZING;
+
+        OSL_ASSERT(Instance().get()==this);
+        mpRequestQueue.reset(MasterPageContainerQueue::Create(
+            ::boost::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance())));
+
+        mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create(
+            ::boost::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)),
+            5,
+            50);
+
+        meInitializationState = INITIALIZED;
+    }
+}
+
+
+
+
+void MasterPageContainer::Implementation::AddChangeListener (const Link& rLink)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    ::std::vector<Link>::iterator iListener (
+        ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
+    if (iListener == maChangeListeners.end())
+        maChangeListeners.push_back(rLink);
+
+}
+
+
+
+
+void MasterPageContainer::Implementation::RemoveChangeListener (const Link& rLink)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    ::std::vector<Link>::iterator iListener (
+        ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
+    if (iListener != maChangeListeners.end())
+        maChangeListeners.erase(iListener);
+}
+
+
+
+
+void MasterPageContainer::Implementation::UpdatePreviewSizePixel (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    // The default aspect ratio is 4:3
+    int nWidth (4);
+    int nHeight (3);
+    
+    // Search for the first entry with an existing master page.
+    MasterPageContainerType::const_iterator iDescriptor;
+    MasterPageContainerType::const_iterator iContainerEnd(maContainer.end());
+    for (iDescriptor=maContainer.begin(); iDescriptor!=iContainerEnd; ++iDescriptor)
+        if (*iDescriptor!=NULL && (*iDescriptor)->mpMasterPage != NULL)
+        {
+            Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize());
+            nWidth = aPageSize.Width();
+            nHeight = aPageSize.Height();
+            mbFirstPageObjectSeen = true;
+            break;
+        }
+
+    maSmallPreviewSizePixel.Width() = SMALL_PREVIEW_WIDTH;
+    maLargePreviewSizePixel.Width() = LARGE_PREVIEW_WIDTH;
+
+    int nNewSmallHeight ((maSmallPreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
+    int nNewLargeHeight ((maLargePreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
+
+    if (nNewSmallHeight!=maSmallPreviewSizePixel.Height()
+        || nNewLargeHeight!=maLargePreviewSizePixel.Height())
+    {
+        maSmallPreviewSizePixel.Height() = nNewSmallHeight;
+        maLargePreviewSizePixel.Height() = nNewLargeHeight;
+        FireContainerChange(
+            MasterPageContainerChangeEvent::SIZE_CHANGED,
+            NIL_TOKEN);
+    }
+}
+
+
+
+
+Size MasterPageContainer::Implementation::GetPreviewSizePixel (PreviewSize eSize) const
+{
+    if (eSize == SMALL)
+        return maSmallPreviewSizePixel;
+    else
+        return maLargePreviewSizePixel;
+}
+
+
+
+
+IMPL_LINK(MasterPageContainer::Implementation,AsynchronousNotifyCallback, EventData*, pData)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    if (pData != NULL)
+    {
+        FireContainerChange(pData->first, pData->second, false);
+        delete pData;
+    }
+
+    return 0;
+}
+
+
+
+
+MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage (
+    const SharedMasterPageDescriptor& rpDescriptor)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    Token aResult (NIL_TOKEN);
+
+    // Get page object and preview when that is inexpensive.
+    UpdateDescriptor(rpDescriptor,false,false, false);
+
+    // Look up the new MasterPageDescriptor and either insert it or update
+    // an already existing one.
+    MasterPageContainerType::iterator aEntry (
+        ::std::find_if (
+            maContainer.begin(),
+            maContainer.end(),
+            MasterPageDescriptor::AllComparator(rpDescriptor)));
+    if (aEntry == maContainer.end())
+    {
+        // Insert a new MasterPageDescriptor.
+        bool bIgnore (rpDescriptor->mpPageObjectProvider.get()==NULL
+            && rpDescriptor->msURL.getLength()==0);
+
+        if ( ! bIgnore)
+        {
+            if (mbContainerCleaningPending)
+                CleanContainer();
+            
+            aResult = maContainer.size();
+            rpDescriptor->SetToken(aResult);
+
+            // Templates are precious, i.e. we lock them so that they will
+            // not be destroyed when (temporarily) no one references them.
+            // They will only be deleted when the container is destroyed.
+            switch (rpDescriptor->meOrigin)
+            {
+                case TEMPLATE:
+                case DEFAULT:
+                    ++rpDescriptor->mnUseCount;
+                    break;
+
+                default:
+                    break;
+            }
+            
+            maContainer.push_back(rpDescriptor);
+            aEntry = maContainer.end()-1;
+            
+            FireContainerChange(MasterPageContainerChangeEvent::CHILD_ADDED,aResult);
+        }
+    }
+    else
+    {
+        // Update an existing MasterPageDescriptor.
+        aResult = (*aEntry)->maToken;
+        ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pEventTypes(
+            (*aEntry)->Update(*rpDescriptor));
+        if (pEventTypes.get()!=NULL && pEventTypes->size()>0)
+        {
+            // One or more aspects of the descriptor have changed.  Send
+            // appropriate events to the listeners.
+            UpdateDescriptor(*aEntry,false,false, true);
+            
+            std::vector<MasterPageContainerChangeEvent::EventType>::const_iterator iEventType;
+            for (iEventType=pEventTypes->begin(); iEventType!=pEventTypes->end(); ++iEventType)
+            {
+                FireContainerChange(
+                    *iEventType,
+                    (*aEntry)->maToken,
+                    false);
+            }
+        }
+    }
+
+    return aResult;
+}
+
+
+
+
+bool MasterPageContainer::Implementation::HasToken (Token aToken) const
+{
+    return aToken>=0
+        && (unsigned)aToken<maContainer.size()
+        && maContainer[aToken].get()!=NULL;
+}
+
+
+
+
+const SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (
+    Token aToken) const
+{
+    if (aToken>=0 && (unsigned)aToken<maContainer.size())
+        return maContainer[aToken];
+    else
+        return SharedMasterPageDescriptor();
+}
+
+
+
+
+SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (Token aToken)
+{
+    if (aToken>=0 && (unsigned)aToken<maContainer.size())
+        return maContainer[aToken];
+    else
+        return SharedMasterPageDescriptor();
+}
+
+
+
+
+void MasterPageContainer::Implementation::InvalidatePreview (Token aToken)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    SharedMasterPageDescriptor pDescriptor (GetDescriptor(aToken));
+    if (pDescriptor.get() != NULL)
+    {
+        pDescriptor->maSmallPreview = Image();
+        pDescriptor->maLargePreview = Image();
+        RequestPreview(aToken);
+    }
+}
+
+
+
+
+Image MasterPageContainer::Implementation::GetPreviewForToken (
+    MasterPageContainer::Token aToken,
+    PreviewSize ePreviewSize)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    Image aPreview;
+    PreviewState ePreviewState (GetPreviewState(aToken));
+
+    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+    
+    // When the preview is missing but inexpensively creatable then do that
+    // now.
+    if (pDescriptor.get()!=NULL)
+    {
+        if (ePreviewState == PS_CREATABLE)
+            if (UpdateDescriptor(pDescriptor, false,false, true))
+                if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
+                    ePreviewState = PS_AVAILABLE;
+
+        switch (ePreviewState)
+        {
+            case PS_AVAILABLE:
+                aPreview = pDescriptor->GetPreview(ePreviewSize);
+                break;
+
+            case PS_PREPARING:
+                aPreview = GetPreviewSubstitution(
+                    STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
+                    ePreviewSize);
+                break;
+
+            case PS_CREATABLE:
+                aPreview = GetPreviewSubstitution(
+                    STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
+                    ePreviewSize);
+                break;
+
+            case PS_NOT_AVAILABLE:
+                aPreview = GetPreviewSubstitution(
+                    STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION,
+                    ePreviewSize);
+                if (ePreviewSize == SMALL)
+                    pDescriptor->maSmallPreview = aPreview;
+                else
+                    pDescriptor->maLargePreview = aPreview;
+                break;
+        }
+    }
+    
+    return aPreview;
+}
+
+
+
+
+MasterPageContainer::PreviewState MasterPageContainer::Implementation::GetPreviewState (
+    Token aToken) const
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    PreviewState eState (PS_NOT_AVAILABLE);
+
+    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+    {
+        if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
+            eState = PS_AVAILABLE;
+        else if (pDescriptor->mpPreviewProvider.get() != NULL)
+        {
+            // The preview does not exist but can be created.  When that is
+            // not expensive then do it at once.
+            if (mpRequestQueue->HasRequest(aToken))
+                eState = PS_PREPARING;
+            else
+                eState = PS_CREATABLE;
+        }
+        else
+            eState = PS_NOT_AVAILABLE;
+    }
+
+    return eState;
+}
+
+
+
+
+bool MasterPageContainer::Implementation::RequestPreview (Token aToken)
+{
+    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
+    if (pDescriptor.get() != NULL)
+        return mpRequestQueue->RequestPreview(pDescriptor);
+    else
+        return false;
+}
+
+
+
+
+Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    if ( ! mxModel.is())
+    {
+        // Get the desktop a s service factory.
+        ::rtl::OUString sDesktopServiceName (
+            RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"));
+        uno::Reference<frame::XComponentLoader> xDesktop (
+            ::comphelper::getProcessServiceFactory()->createInstance(
+                sDesktopServiceName), 
+            uno::UNO_QUERY);
+
+        // Create a new model.
+        ::rtl::OUString sModelServiceName (
+            RTL_CONSTASCII_USTRINGPARAM(
+                "com.sun.star.presentation.PresentationDocument"));
+        mxModel = uno::Reference<frame::XModel>(
+            ::comphelper::getProcessServiceFactory()->createInstance(
+                sModelServiceName),
+            uno::UNO_QUERY);
+
+        // Initialize the model.
+        uno::Reference<frame::XLoadable> xLoadable (mxModel,uno::UNO_QUERY);
+        if (xLoadable.is())
+            xLoadable->initNew();
+
+        // Use its tunnel to get a pointer to its core implementation.
+        uno::Reference<lang::XUnoTunnel> xUnoTunnel (mxModel, uno::UNO_QUERY);
+        if (xUnoTunnel.is())
+        {
+            mpDocument = reinterpret_cast<SdXImpressDocument*>(
+                xUnoTunnel->getSomething(
+                    SdXImpressDocument::getUnoTunnelId()))->GetDoc();
+        }
+
+        // Create a default page.
+        uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, uno::UNO_QUERY);
+        if (xSlideSupplier.is())
+        {
+            uno::Reference<drawing::XDrawPages> xSlides (
+                xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+            if (xSlides.is())
+            {
+                sal_Int32 nIndex (0);
+                uno::Reference<drawing::XDrawPage> xNewPage (xSlides->insertNewByIndex(nIndex));
+                uno::Reference<beans::XPropertySet> xProperties(xNewPage, uno::UNO_QUERY);
+                if (xProperties.is())
+                    xProperties->setPropertyValue(
+                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")),
+                        makeAny((sal_Int16)AUTOLAYOUT_TITLE));
+            }
+        }
+    }
+    return mxModel;
+}
+
+
+
+
+SdDrawDocument* MasterPageContainer::Implementation::GetDocument (void)
+{
+    GetModel();
+    return mpDocument;
+}
+
+
+
+
+Image MasterPageContainer::Implementation::GetPreviewSubstitution (
+    sal_uInt16 nId,
+    PreviewSize ePreviewSize)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    Image aPreview;
+    
+    switch (nId)
+    {
+        case STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION:
+        {
+            Image& rPreview (ePreviewSize==SMALL
+                ? maSmallPreviewBeingCreated
+                : maLargePreviewBeingCreated);
+            if (rPreview.GetSizePixel().Width() == 0)
+            {
+                rPreview = maPreviewRenderer.RenderSubstitution(
+                    ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
+                    SdResId(STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION));
+            }
+            aPreview = rPreview;
+        }
+        break;
+
+        case STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION:
+        {
+            Image& rPreview (ePreviewSize==SMALL
+                ? maSmallPreviewNotAvailable
+                : maLargePreviewNotAvailable);
+            if (rPreview.GetSizePixel().Width() == 0)
+            {
+                rPreview = maPreviewRenderer.RenderSubstitution(
+                    ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
+                    SdResId(STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION));
+            }
+            aPreview = rPreview;
+        }
+        break;
+    }
+
+    return aPreview;
+}
+
+
+
+
+void MasterPageContainer::Implementation::CleanContainer (void)
+{
+    // Remove the empty elements at the end of the container.  The empty
+    // elements in the middle can not be removed because that would
+    // invalidate the references still held by others.
+    int nIndex (maContainer.size()-1);
+    while (nIndex>=0 && maContainer[nIndex].get()==NULL)
+        --nIndex;
+    maContainer.resize(++nIndex);
+}
+
+
+
+
+void MasterPageContainer::Implementation::FireContainerChange (
+    MasterPageContainerChangeEvent::EventType eType,
+    Token aToken,
+    bool bNotifyAsynchronously)
+{
+    if (bNotifyAsynchronously)
+    {
+        Application::PostUserEvent(
+            LINK(this,Implementation,AsynchronousNotifyCallback),
+            new EventData(eType,aToken));
+    }
+    else
+    {
+        ::std::vector<Link> aCopy(maChangeListeners.begin(),maChangeListeners.end());
+        ::std::vector<Link>::iterator iListener;
+        MasterPageContainerChangeEvent aEvent;
+        aEvent.meEventType = eType;
+        aEvent.maChildToken = aToken;
+        for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener)
+            iListener->Call(&aEvent);
+    }
+}
+
+
+
+
+bool MasterPageContainer::Implementation::UpdateDescriptor (
+    const SharedMasterPageDescriptor& rpDescriptor,
+    bool bForcePageObject,
+    bool bForcePreview,
+    bool bSendEvents)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    // We have to create the page object when the preview provider needs it
+    // and the caller needs the preview.
+    bForcePageObject |= (bForcePreview
+        && rpDescriptor->mpPreviewProvider->NeedsPageObject()
+        && rpDescriptor->mpMasterPage==NULL);
+
+    // Define a cost threshold so that an update or page object or preview
+    // that is at least this cost are made at once. Updates with higher cost
+    // are scheduled for later.
+    sal_Int32 nCostThreshold (mpRequestQueue->IsEmpty() ? 5 : 0);
+
+    // Update the page object (which may be used for the preview update).
+    if (bForcePageObject)
+        GetDocument();
+    bool bPageObjectModified (rpDescriptor->UpdatePageObject(
+        (bForcePageObject ? -1 : nCostThreshold),
+        mpDocument));
+    if (bPageObjectModified && bSendEvents)
+        FireContainerChange(
+            MasterPageContainerChangeEvent::DATA_CHANGED,
+            rpDescriptor->maToken);
+    if (bPageObjectModified && ! mbFirstPageObjectSeen)
+        UpdatePreviewSizePixel();
+
+    // Update the preview.
+    bool bPreviewModified (rpDescriptor->UpdatePreview(
+        (bForcePreview ? -1 : nCostThreshold),
+        maSmallPreviewSizePixel,
+        maLargePreviewSizePixel,
+        maPreviewRenderer));
+
+    if (bPreviewModified && bSendEvents)
+        FireContainerChange(
+            MasterPageContainerChangeEvent::PREVIEW_CHANGED,
+            rpDescriptor->maToken);
+
+    return bPageObjectModified || bPreviewModified;
+}
+
+
+
+
+void MasterPageContainer::Implementation::ReleaseDescriptor (Token aToken)
+{
+    if (aToken>=0 && (unsigned)aToken<maContainer.size())
+    {
+        maContainer[aToken].reset();
+        mbContainerCleaningPending = true;
+    }
+}
+
+
+
+
+void MasterPageContainer::Implementation::FillingDone (void)
+{
+    mpRequestQueue->ProcessAllRequests();
+}
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPageContainer.hxx b/main/sd/source/ui/sidebar/MasterPageContainer.hxx
new file mode 100644
index 0000000..e160c49
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainer.hxx
@@ -0,0 +1,214 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX
+
+#include "MasterPageContainerProviders.hxx"
+
+#include <osl/mutex.hxx>
+#include <tools/string.hxx>
+#include <vcl/image.hxx>
+#include <memory>
+#include "PreviewRenderer.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <vcl/timer.hxx>
+#include "tools/SdGlobalResourceContainer.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+class SdPage;
+class SdDrawDocument;
+class SfxObjectShellLock;
+
+namespace sd {
+class DrawDocShell;
+}
+
+namespace sd { namespace sidebar {
+
+class MasterPageDescriptor;
+
+/** This container manages the master pages used by the MasterPagesSelector
+    controls.  It uses internally a singleton implementation object.
+    Therefore, all MasterPageContainer object operator on the same set of
+    master pages.  Each MasterPageContainer, however, has its own
+    PreviewSize value and thus can independantly switch between large and
+    small previews.
+    
+    The container maintains its own document to store master page objects.
+    
+    For each master page container stores its URL, preview bitmap, page
+    name, and, if available, the page object.
+    
+    Entries are accessed via a Token, which is mostly a numerical index but
+    whose values do not neccessarily have to be consecutive.
+*/
+class MasterPageContainer
+{
+public:
+    typedef int Token;
+    static const Token NIL_TOKEN = -1;
+
+    MasterPageContainer (void);
+    virtual ~MasterPageContainer (void);
+
+    void AddChangeListener (const Link& rLink);
+    void RemoveChangeListener (const Link& rLink);
+
+    enum PreviewSize { SMALL, LARGE };
+    /** There are two different preview sizes, a small one and a large one.
+        Which one is used by the called container can be changed with this
+        method.
+        When the preview size is changed then all change listeners are
+        notified of this.
+    */
+    void SetPreviewSize (PreviewSize eSize);
+
+    /** Returns the preview size.
+    */
+    PreviewSize GetPreviewSize (void) const;
+
+    /** Return the preview size in pixels.
+    */
+    Size GetPreviewSizePixel (void) const;
+
+    enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE };
+    PreviewState GetPreviewState (Token aToken);
+
+    /** This method is typically called for entries in the container for
+        which GetPreviewState() returns OS_CREATABLE.  The creation of the
+        preview is then scheduled to be executed asynchronously at a later
+        point in time.  When the preview is available the change listeners
+        will be notified.
+    */
+    bool RequestPreview (Token aToken);
+
+    /** Each entry of the container is either the first page of a template
+        document or is a master page of an Impress document. 
+    */
+    enum Origin {
+        MASTERPAGE,  // Master page of a document.
+        TEMPLATE,    // First page of a template file.
+        DEFAULT,     // Empty master page with default style.
+        UNKNOWN
+    };
+
+    /** Put the master page identified and described by the given parameters
+        into the container.  When there already is a master page with the
+        given URL, page name, or object pointer (when that is not NULL) then
+        the existing entry is replaced/updated by the given one.  Otherwise
+        a new entry is inserted.
+    */
+    Token PutMasterPage (const ::boost::shared_ptr<MasterPageDescriptor>& rDescriptor);
+    void AcquireToken (Token aToken);
+    void ReleaseToken (Token aToken);
+
+    /** This and the GetTokenForIndex() methods can be used to iterate over
+        all members of the container.
+    */
+    int GetTokenCount (void) const;
+
+    /** Determine whether the container has a member for the given token.
+    */
+    bool HasToken (Token aToken) const;
+    
+    /** Return a token for an index in the range 
+        0 <= index < GetTokenCount().
+    */
+    Token GetTokenForIndex (int nIndex);
+
+    Token GetTokenForURL (const String& sURL);
+    Token GetTokenForStyleName (const String& sStyleName);
+    Token GetTokenForPageObject (const SdPage* pPage);
+
+    String GetURLForToken (Token aToken);
+    String GetPageNameForToken (Token aToken);
+    String GetStyleNameForToken (Token aToken);
+    SdPage* GetPageObjectForToken (Token aToken, bool bLoad=true);
+    Origin GetOriginForToken (Token aToken);
+    sal_Int32 GetTemplateIndexForToken (Token aToken);
+    ::boost::shared_ptr<MasterPageDescriptor> GetDescriptorForToken (Token aToken);
+    
+    void InvalidatePreview (Token aToken);
+
+    /** Return a preview for the specified token.  When the preview is not
+        present then the PreviewProvider associated with the token is
+        executed only when that is not expensive.  It is the responsibility
+        of the caller to call RequestPreview() to do the same
+        (asynchronously) for expensive PreviewProviders.
+        Call GetPreviewState() to find out if that is necessary.
+        @param aToken
+            This token specifies for which master page to return the prview.
+            Tokens are returned for example by the GetTokenFor...() methods.
+        @return
+            The returned image is the requested preview or a substitution.
+    */
+    Image GetPreviewForToken (Token aToken);
+
+private:
+    class Implementation;
+    ::boost::shared_ptr<Implementation> mpImpl;
+    PreviewSize mePreviewSize;
+
+    /** Retrieve the preview of the document specified by the given URL.
+    */
+    static BitmapEx LoadPreviewFromURL (const ::rtl::OUString& aURL);
+};
+
+
+
+
+/** For some changes to the set of master pages in a MasterPageContainer or
+    to the data stored for each master page one or more events are sent to
+    registered listeners.
+    Each event has an event type and a token that tells the listener where
+    the change took place.
+*/
+class MasterPageContainerChangeEvent
+{
+public:
+    enum EventType {
+        // A master page was added to the container.
+        CHILD_ADDED,
+        // A master page was removed from the container.
+        CHILD_REMOVED,
+        // The preview of a master page has changed.
+        PREVIEW_CHANGED,
+        // The size of a preview has changed.
+        SIZE_CHANGED,
+        // Some of the data stored for a master page has changed.
+        DATA_CHANGED,
+        // The TemplateIndex of a master page has changed.
+        INDEX_CHANGED,
+        // More than one entries changed their TemplateIndex
+        INDEXES_CHANGED
+    } meEventType;
+
+    // Token of the container entry whose data changed or which was added or
+    // removed.
+    MasterPageContainer::Token maChildToken;
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerFiller.cxx b/main/sd/source/ui/sidebar/MasterPageContainerFiller.cxx
new file mode 100644
index 0000000..af7b76c
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerFiller.cxx
@@ -0,0 +1,191 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageContainerFiller.hxx"
+
+#include "MasterPageDescriptor.hxx"
+#include "MasterPageContainerProviders.hxx"
+#include "TemplateScanner.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sd { namespace sidebar {
+
+MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter)
+    : mrContainerAdapter(rpAdapter),
+      meState(INITIALIZE_TEMPLATE_SCANNER),
+      mpScannerTask(),
+      mpLastAddedEntry(NULL),
+      mnIndex(1)
+{
+    // Add one entry for the default master page.  We use temporarily the
+    // DefaultPagePreviewProvider to prevent the rendering (and the
+    // expensive creation) of the default page.  It is replaced later on by
+    // another.
+    SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+        MasterPageContainer::DEFAULT,
+        0,
+        String(),
+        String(),
+        String(),
+        false,
+        ::boost::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()),
+        ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
+    mrContainerAdapter.PutMasterPage(pDescriptor);
+}
+
+
+
+
+MasterPageContainerFiller::~MasterPageContainerFiller (void)
+{
+}
+
+
+
+
+void MasterPageContainerFiller::RunNextStep (void)
+{
+    switch (meState)
+    {
+        case INITIALIZE_TEMPLATE_SCANNER:
+            mpScannerTask.reset(new TemplateScanner());
+            meState = SCAN_TEMPLATE;
+            break;
+
+        case SCAN_TEMPLATE:
+            meState = ScanTemplate();
+            break;
+            
+        case ADD_TEMPLATE:
+            meState = AddTemplate();
+            break;
+            
+        case DONE:
+        case ERROR:
+        default:
+            break;
+    }
+
+    // When the state has just been set to DONE or ERROR then tell the
+    // container that no more templates will be coming and stop the
+    // scanning.
+    switch (meState)
+    {
+        case DONE:
+        case ERROR:
+            if (mpScannerTask.get() != NULL)
+            {
+                mrContainerAdapter.FillingDone();
+                mpScannerTask.reset();
+            }
+		default:
+			break;
+    }
+}
+
+
+
+
+bool MasterPageContainerFiller::HasNextStep (void)
+{
+    switch (meState)
+    {
+        case DONE:
+        case ERROR:
+            return false;
+            
+        default:
+            return true;
+    }
+}
+
+
+
+
+MasterPageContainerFiller::State MasterPageContainerFiller::ScanTemplate (void)
+{
+    State eState (ERROR);
+
+    if (mpScannerTask.get() != NULL)
+    {
+        if (mpScannerTask->HasNextStep())
+        {
+            mpScannerTask->RunNextStep();
+            if (mpScannerTask->GetLastAddedEntry() != mpLastAddedEntry)
+            {
+                mpLastAddedEntry = mpScannerTask->GetLastAddedEntry();
+                if (mpLastAddedEntry != NULL)
+                    eState = ADD_TEMPLATE;
+                else
+                    eState = SCAN_TEMPLATE;
+            }
+            else
+                eState = SCAN_TEMPLATE;
+        }
+        else
+            eState = DONE;
+    }
+
+    return eState;
+}
+
+
+
+
+MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void)
+{
+    if (mpLastAddedEntry != NULL)
+    {
+        SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+            MasterPageContainer::TEMPLATE,
+            mnIndex,
+            mpLastAddedEntry->msPath,
+            mpLastAddedEntry->msTitle,
+            String(),
+            false,
+            ::boost::shared_ptr<PageObjectProvider>(
+                new TemplatePageObjectProvider(mpLastAddedEntry->msPath)),
+            ::boost::shared_ptr<PreviewProvider>(
+                new TemplatePreviewProvider(mpLastAddedEntry->msPath))));
+        // For user supplied templates we use a different preview provider:
+        // The preview in the document shows not only shapes on the master
+        // page but also shapes on the foreground.  This is misleading and
+        // therefore these previews are discarded and created directly from
+        // the page objects.
+        if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
+            pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
+                new PagePreviewProvider());
+
+        mrContainerAdapter.PutMasterPage(pDescriptor);
+        ++mnIndex;
+    }
+
+    return SCAN_TEMPLATE;
+}
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerFiller.hxx b/main/sd/source/ui/sidebar/MasterPageContainerFiller.hxx
new file mode 100644
index 0000000..6d75a18
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerFiller.hxx
@@ -0,0 +1,89 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX
+
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "tools/AsynchronousTask.hxx"
+
+namespace sd {
+class TemplateScanner;
+class TemplateEntry;
+}
+
+namespace sd { namespace sidebar {
+
+/** Fill a MasterPageContainer with information about the available master
+    pages.  These are provided by one default page and from the existing
+    Impress templates.  This is done asynchronously.
+*/
+class MasterPageContainerFiller
+    : public ::sd::tools::AsynchronousTask
+{
+public:
+    class ContainerAdapter
+    {
+    public:
+        virtual MasterPageContainer::Token PutMasterPage (
+            const SharedMasterPageDescriptor& rpDescriptor) = 0;
+        /** This method is called when all Impress templates have been added
+            to the container via the PutMasterPage() method.
+        */
+        virtual void FillingDone (void) = 0;
+    };
+    
+    MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
+    virtual ~MasterPageContainerFiller (void);
+    
+    /** Run the next step of the task.  After HasNextStep() returns false
+        this method should ignore further calls.
+    */
+    virtual void RunNextStep (void);
+
+    /** Return <TRUE/> when there is at least one more step to execute.
+        When the task has been executed completely then <FALSE/> is
+        returned.
+    */
+    virtual bool HasNextStep (void);
+
+private:
+    ContainerAdapter& mrContainerAdapter;
+    // Remember what the next step has to do.
+    enum State {
+        INITIALIZE_TEMPLATE_SCANNER,
+        SCAN_TEMPLATE,
+        ADD_TEMPLATE,
+        ERROR,
+        DONE
+    } meState;
+    ::std::auto_ptr<TemplateScanner> mpScannerTask;
+    const TemplateEntry* mpLastAddedEntry;
+    int mnIndex;
+    
+    State ScanTemplate (void);
+    State AddTemplate (void);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerProviders.cxx b/main/sd/source/ui/sidebar/MasterPageContainerProviders.cxx
new file mode 100644
index 0000000..e662df4
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerProviders.cxx
@@ -0,0 +1,420 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageContainerProviders.hxx"
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "PreviewRenderer.hxx"
+#include <comphelper/processfactory.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/image.hxx>
+#include <vcl/pngread.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd { namespace sidebar {
+
+
+//===== PagePreviewProvider ===================================================
+
+PagePreviewProvider::PagePreviewProvider (void)
+{
+}
+
+
+
+
+Image PagePreviewProvider::operator () (
+    int nWidth,
+    SdPage* pPage,
+    ::sd::PreviewRenderer& rRenderer)
+{
+    Image aPreview;
+    
+    if (pPage != NULL)
+    {
+        // Use the given renderer to create a preview of the given page
+        // object.
+        aPreview = rRenderer.RenderPage(
+            pPage,
+            nWidth,
+            String::CreateFromAscii(""),
+            false);
+    }
+
+    return aPreview;
+}
+
+
+
+
+int PagePreviewProvider::GetCostIndex (void)
+{
+    return 5;
+}
+
+
+
+
+bool PagePreviewProvider::NeedsPageObject (void)
+{
+    return true;
+}
+
+
+
+
+//===== TemplatePreviewProvider ===============================================
+
+TemplatePreviewProvider::TemplatePreviewProvider (const ::rtl::OUString& rsURL)
+    : msURL(rsURL)
+{
+}
+
+
+
+
+Image TemplatePreviewProvider::operator() (
+    int nWidth,
+    SdPage* pPage,
+    ::sd::PreviewRenderer& rRenderer)
+{
+    // Unused parameters.
+    (void)nWidth;
+    (void)pPage; 
+    (void)rRenderer;
+    
+    // Load the thumbnail from a template document.
+	uno::Reference<io::XInputStream> xIStream;
+
+    uno::Reference< lang::XMultiServiceFactory > xServiceManager (
+        ::comphelper::getProcessServiceFactory());
+	if (xServiceManager.is())
+	{
+		try
+        {
+			uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
+				xServiceManager->createInstance( 
+                    ::rtl::OUString::createFromAscii(
+                        "com.sun.star.embed.StorageFactory")),
+				uno::UNO_QUERY);
+		
+			if (xStorageFactory.is())
+			{
+				uno::Sequence<uno::Any> aArgs (2);
+				aArgs[0] <<= msURL;
+				aArgs[1] <<= embed::ElementModes::READ;
+				uno::Reference<embed::XStorage> xDocStorage (
+                    xStorageFactory->createInstanceWithArguments(aArgs),
+                    uno::UNO_QUERY);
+
+                try
+                {
+                    if (xDocStorage.is())
+                    {
+                        uno::Reference<embed::XStorage> xStorage (
+                            xDocStorage->openStorageElement(
+                                ::rtl::OUString::createFromAscii("Thumbnails"),
+                                embed::ElementModes::READ));
+                        if (xStorage.is())
+                        {
+                            uno::Reference<io::XStream> xThumbnailCopy (
+                                xStorage->cloneStreamElement(
+                                    ::rtl::OUString::createFromAscii(
+                                        "thumbnail.png")));
+                            if (xThumbnailCopy.is())
+                                xIStream = xThumbnailCopy->getInputStream();
+                        }
+                    }
+                }
+                catch (uno::Exception& rException)
+                {
+                    OSL_TRACE (
+                        "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
+                        ::rtl::OUStringToOString(msURL,
+                            RTL_TEXTENCODING_UTF8).getStr(),
+                        ::rtl::OUStringToOString(rException.Message,
+                            RTL_TEXTENCODING_UTF8).getStr());
+                }
+
+                try
+                {
+                    // An (older) implementation had a bug - The storage
+                    // name was "Thumbnail" instead of "Thumbnails".  The
+                    // old name is still used as fallback but this code can
+                    // be removed soon.
+                    if ( ! xIStream.is())
+                    {
+                        uno::Reference<embed::XStorage> xStorage (
+                            xDocStorage->openStorageElement(
+                                ::rtl::OUString::createFromAscii("Thumbnail"),
+                                embed::ElementModes::READ));
+                        if (xStorage.is())
+                        {
+                            uno::Reference<io::XStream> xThumbnailCopy (
+                                xStorage->cloneStreamElement(
+                                    ::rtl::OUString::createFromAscii(
+                                        "thumbnail.png")));
+                            if (xThumbnailCopy.is())
+                                xIStream = xThumbnailCopy->getInputStream();
+                        }
+					}
+                }
+                catch (uno::Exception& rException)
+                {
+                    OSL_TRACE (
+                        "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
+                        ::rtl::OUStringToOString(msURL,
+                            RTL_TEXTENCODING_UTF8).getStr(),
+                        ::rtl::OUStringToOString(rException.Message,
+                            RTL_TEXTENCODING_UTF8).getStr());
+                }
+			}
+		}
+		catch (uno::Exception& rException)
+		{
+            OSL_TRACE (
+                "caught exception while trying to access tuhmbnail of %s: %s",
+                ::rtl::OUStringToOString(msURL,
+                    RTL_TEXTENCODING_UTF8).getStr(),
+                ::rtl::OUStringToOString(rException.Message,
+                    RTL_TEXTENCODING_UTF8).getStr());
+        }
+	}
+
+    // Extract the image from the stream.
+    BitmapEx aThumbnail;
+	if (xIStream.is())
+    {
+        ::std::auto_ptr<SvStream> pStream (
+            ::utl::UcbStreamHelper::CreateStream (xIStream));
+        ::vcl::PNGReader aReader (*pStream);
+        aThumbnail = aReader.Read ();
+    }
+
+    // Note that the preview is returned without scaling it to the desired
+    // width.  This gives the caller the chance to take advantage of a
+    // possibly larger resolution then was asked for.
+    return aThumbnail;
+}
+
+
+
+
+int TemplatePreviewProvider::GetCostIndex (void)
+{
+    return 10;
+}
+
+
+
+
+bool TemplatePreviewProvider::NeedsPageObject (void)
+{
+    return false;
+}
+
+
+
+
+//===== TemplatePageObjectProvider =============================================
+
+TemplatePageObjectProvider::TemplatePageObjectProvider (const ::rtl::OUString& rsURL)
+    : msURL(rsURL),
+      mxDocumentShell()
+{
+}
+
+
+
+
+SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument)
+{
+    // Unused parameters.
+    (void)pContainerDocument;
+    
+    SdPage* pPage = NULL;
+    
+    mxDocumentShell = NULL;
+    ::sd::DrawDocShell* pDocumentShell = NULL;
+    try
+    {
+        // Load the template document and return its first page.
+        pDocumentShell = LoadDocument (msURL);
+        if (pDocumentShell != NULL)
+        {
+            SdDrawDocument* pDocument = pDocumentShell->GetDoc();
+            if (pDocument != NULL)
+            {
+                pPage = pDocument->GetMasterSdPage(0, PK_STANDARD);
+                // In order to make the newly loaded master page deletable
+                // when copied into documents it is marked as no "precious".
+                // When it is modified then it is marked as "precious".
+                if (pPage != NULL)
+                    pPage->SetPrecious(false);
+            }
+        }
+    }
+    catch (uno::RuntimeException)
+    {
+        DBG_UNHANDLED_EXCEPTION();
+        pPage = NULL;
+    }
+
+    return pPage;
+}
+
+
+
+
+::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const ::rtl::OUString& sFileName)
+{
+	SfxApplication* pSfxApp = SFX_APP();
+    SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool());
+    pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True));
+    pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True));
+    if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet))
+    {
+        mxDocumentShell = NULL;
+    }
+    SfxObjectShell* pShell = mxDocumentShell;
+    return PTR_CAST(::sd::DrawDocShell,pShell);
+}
+
+
+
+
+int TemplatePageObjectProvider::GetCostIndex (void)
+{
+    return 20;
+}
+
+
+
+
+bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider)
+{
+    const TemplatePageObjectProvider* pTemplatePageObjectProvider
+        = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider);
+    if (pTemplatePageObjectProvider != NULL)
+        return (msURL == pTemplatePageObjectProvider->msURL);
+    else
+        return false;
+}
+
+
+
+
+//===== DefaultPageObjectProvider ==============================================
+
+DefaultPageObjectProvider::DefaultPageObjectProvider (void)
+{
+}
+
+
+
+
+SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument)
+{
+    SdPage* pLocalMasterPage = NULL;
+    if (pContainerDocument != NULL)
+    {
+        sal_Int32 nIndex (0);
+        SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD);
+        if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage())
+            pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage());
+    }
+
+    if (pLocalMasterPage == NULL)
+    {
+        DBG_ASSERT(false, "can not create master page for slide");
+    }
+
+    return pLocalMasterPage;
+}
+
+
+
+
+int DefaultPageObjectProvider::GetCostIndex (void)
+{
+    return 15;
+}
+
+
+
+
+bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider)
+{
+    return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL);
+}
+
+
+
+
+//===== ExistingPageProvider ==================================================
+
+ExistingPageProvider::ExistingPageProvider (SdPage* pPage)
+    : mpPage(pPage)
+{
+}
+
+
+
+
+SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument)
+{
+    (void)pDocument; // Unused parameter.
+    
+    return mpPage;
+}
+
+
+
+
+int ExistingPageProvider::GetCostIndex (void)
+{
+    return 0;
+}
+
+
+
+
+bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider)
+{
+    const ExistingPageProvider* pExistingPageProvider
+        = dynamic_cast<const ExistingPageProvider*>(&rProvider);
+    if (pExistingPageProvider != NULL)
+        return (mpPage == pExistingPageProvider->mpPage);
+    else
+        return false;
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerProviders.hxx b/main/sd/source/ui/sidebar/MasterPageContainerProviders.hxx
new file mode 100644
index 0000000..55976ad
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerProviders.hxx
@@ -0,0 +1,183 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
+
+#include <rtl/ustring.hxx>
+#include <sfx2/objsh.hxx>
+
+class Image;
+class SdDrawDocument;
+class SdPage;
+namespace sd { class PreviewRenderer; }
+namespace sd { class DrawDocShell; }
+
+
+namespace sd { namespace sidebar {
+
+
+/** Interface for a provider of page objects.  It is used by the
+    MasterPageDescriptor to create master page objects on demand.
+*/
+class PageObjectProvider
+{
+public:
+    /** Return a master page either by returning an already existing one, by
+        creating a new page, or by loading a document.
+        @param pDocument
+            The document of the MasterPageContainer.  It may be used to
+            create new pages.
+    */
+    virtual SdPage* operator() (SdDrawDocument* pDocument) = 0;
+
+    /** An abstract value for the expected cost of providing a master page
+        object.
+        @return
+            A value of 0 represents for the lowest cost, i.e. an almost
+            immediate return.  Positive values stand for higher costs.
+            Negative values are not supported.
+    */
+    virtual int GetCostIndex (void) = 0;
+
+    virtual bool operator== (const PageObjectProvider& rProvider) = 0;
+};
+
+
+
+
+class PreviewProvider
+{
+public:
+    /** Create a preview image in the specified width.
+        @param nWidth
+            Requested width of the preview.  The calling method can cope
+            with other sizes as well but the resulting image quality is
+            better when the returned image has the requested size.
+        @param pPage
+            Page object for which a preview is requested.  This may be NULL
+            when the page object is expensive to get and the PreviewProvider
+            does not need this object (NeedsPageObject() returns false.)
+        @param rRenderer
+            This PreviewRenderer may be used by the PreviewProvider to
+            create a preview image.
+    */
+    virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer) = 0;
+
+    /** Return a value that indicates how expensive the creation of a
+        preview image is.  The higher the returned value the more expensive
+        is the preview creation.  Return 0 when the preview is already
+        present and can be returned immediately.
+    */
+    virtual int GetCostIndex (void) = 0;
+
+    /** Return whether the page object passed is necessary to create a
+        preview.
+    */
+    virtual bool NeedsPageObject (void) = 0;
+};
+
+
+
+
+/** Provide previews of existing page objects by rendering them.
+*/
+class PagePreviewProvider : public PreviewProvider
+{
+public:
+    PagePreviewProvider (void);
+    virtual Image operator () (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
+    virtual int GetCostIndex (void);
+    virtual bool NeedsPageObject (void);
+private:
+};
+
+
+
+
+/** Provide master page objects for template documents for which only the
+    URL is given.
+*/
+class TemplatePageObjectProvider : public PageObjectProvider
+{
+public:
+    TemplatePageObjectProvider (const ::rtl::OUString& rsURL);
+    virtual ~TemplatePageObjectProvider (void) {};
+    virtual SdPage* operator () (SdDrawDocument* pDocument);
+    virtual int GetCostIndex (void);
+    virtual bool operator== (const PageObjectProvider& rProvider);
+private:
+    ::rtl::OUString msURL;
+    SfxObjectShellLock mxDocumentShell;
+    ::sd::DrawDocShell* LoadDocument (const ::rtl::OUString& sFileName);
+};
+
+
+
+
+/** Provide previews for template documents by loading the thumbnails from
+    the documents.
+*/
+class TemplatePreviewProvider : public PreviewProvider
+{
+public:
+    TemplatePreviewProvider (const ::rtl::OUString& rsURL);
+    virtual ~TemplatePreviewProvider (void) {};
+    virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
+    virtual int GetCostIndex (void);
+    virtual bool NeedsPageObject (void);
+private:
+    ::rtl::OUString msURL;
+};
+
+
+
+
+/** Create an empty default master page.
+*/
+class DefaultPageObjectProvider : public PageObjectProvider
+{
+public:
+    DefaultPageObjectProvider (void);
+    virtual SdPage* operator () (SdDrawDocument* pDocument);
+    virtual int GetCostIndex (void);
+    virtual bool operator== (const PageObjectProvider& rProvider);
+};
+
+
+
+/** This implementation of the PageObjectProvider simply returns an already
+    existing master page object.
+*/
+class ExistingPageProvider : public PageObjectProvider
+{
+public:
+    ExistingPageProvider (SdPage* pPage);
+    virtual SdPage* operator() (SdDrawDocument* pDocument);
+    virtual int GetCostIndex (void);
+    virtual bool operator== (const PageObjectProvider& rProvider);
+private:
+    SdPage* mpPage;
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerQueue.cxx b/main/sd/source/ui/sidebar/MasterPageContainerQueue.cxx
new file mode 100644
index 0000000..c34a317
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerQueue.cxx
@@ -0,0 +1,297 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageContainerQueue.hxx"
+
+#include "tools/IdleDetection.hxx"
+
+#include <set>
+
+namespace sd { namespace sidebar {
+
+const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15);
+const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100);
+const sal_Int32 MasterPageContainerQueue::snMasterPagePriorityBoost (5);
+const sal_Int32 MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold (-10);
+sal_uInt32 MasterPageContainerQueue::snWaitForMoreRequestsCount(15);
+
+//===== MasterPageContainerQueue::PreviewCreationRequest ======================
+
+class MasterPageContainerQueue::PreviewCreationRequest
+{
+public:
+    PreviewCreationRequest (const SharedMasterPageDescriptor& rpDescriptor, int nPriority)
+        : mpDescriptor(rpDescriptor),
+          mnPriority(nPriority)
+    {}
+    SharedMasterPageDescriptor mpDescriptor;
+    int mnPriority;
+    class Compare {public:
+        bool operator() (const PreviewCreationRequest& r1,const PreviewCreationRequest& r2)
+        {
+            if (r1.mnPriority != r2.mnPriority)
+            {
+                // Prefer requests with higher priority.
+                return r1.mnPriority > r2.mnPriority;
+            }
+            else
+            {
+                // Prefer tokens that have been earlier created (those with lower
+                // value).
+                return r1.mpDescriptor->maToken < r2.mpDescriptor->maToken;
+            }
+        }
+    };
+    class CompareToken {public:
+        MasterPageContainer::Token maToken;
+        CompareToken(MasterPageContainer::Token aToken) : maToken(aToken) {}
+        bool operator() (const PreviewCreationRequest& rRequest)
+        {     return maToken==rRequest.mpDescriptor->maToken; }
+    };
+};
+
+
+
+
+//===== MasterPageContainerQueue::RequestQueue ================================
+
+class MasterPageContainerQueue::RequestQueue
+    : public ::std::set<PreviewCreationRequest,PreviewCreationRequest::Compare>
+{
+public:
+    RequestQueue (void) {}
+};
+
+
+
+
+//===== MasterPageContainerQueue ==============================================
+
+MasterPageContainerQueue* MasterPageContainerQueue::Create (
+    const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
+{
+    MasterPageContainerQueue* pQueue = new MasterPageContainerQueue(rpContainer);
+    pQueue->LateInit();
+    return pQueue;
+}
+
+
+
+
+MasterPageContainerQueue::MasterPageContainerQueue (
+    const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
+    : mpWeakContainer(rpContainer),
+      mpRequestQueue(new RequestQueue()),
+      maDelayedPreviewCreationTimer(),
+      mnRequestsServedCount(0)
+{
+}
+
+
+
+
+MasterPageContainerQueue::~MasterPageContainerQueue (void)
+{
+    maDelayedPreviewCreationTimer.Stop();
+    while ( ! mpRequestQueue->empty())
+        mpRequestQueue->erase(mpRequestQueue->begin());
+}
+
+
+
+
+void MasterPageContainerQueue::LateInit (void)
+{
+    // Set up the timer for the delayed creation of preview bitmaps.
+    maDelayedPreviewCreationTimer.SetTimeout (snDelayedCreationTimeout);
+    Link aLink (LINK(this,MasterPageContainerQueue,DelayedPreviewCreation));
+    maDelayedPreviewCreationTimer.SetTimeoutHdl(aLink);
+}
+
+
+
+
+bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& rpDescriptor)
+{
+    bool bSuccess (false);
+    if (rpDescriptor.get() != NULL
+        && rpDescriptor->maLargePreview.GetSizePixel().Width() == 0)
+    {
+        sal_Int32 nPriority (CalculatePriority(rpDescriptor));
+        
+        // Add a new or replace an existing request.
+        RequestQueue::iterator iRequest (::std::find_if(
+            mpRequestQueue->begin(),
+            mpRequestQueue->end(),
+            PreviewCreationRequest::CompareToken(rpDescriptor->maToken)));
+        // When a request for the same token exists then the lowest of the
+        // two priorities is used.
+        if (iRequest != mpRequestQueue->end())
+            if (iRequest->mnPriority < nPriority)
+            {
+                mpRequestQueue->erase(iRequest);
+                iRequest = mpRequestQueue->end();
+            }
+
+        // Add a new request when none exists (or has just been erased).
+        if (iRequest == mpRequestQueue->end())
+        {
+            mpRequestQueue->insert(PreviewCreationRequest(rpDescriptor,nPriority));
+            maDelayedPreviewCreationTimer.Start();
+            bSuccess = true;
+        }
+    }
+    return bSuccess;
+}
+
+
+
+
+sal_Int32 MasterPageContainerQueue::CalculatePriority (
+    const SharedMasterPageDescriptor& rpDescriptor) const
+{
+    sal_Int32 nPriority;
+
+    // The cost is used as a starting value.
+    int nCost (0);
+    if (rpDescriptor->mpPreviewProvider.get() != NULL)
+    {
+        nCost = rpDescriptor->mpPreviewProvider->GetCostIndex();
+        if (rpDescriptor->mpPreviewProvider->NeedsPageObject())
+            if (rpDescriptor->mpPageObjectProvider.get() != NULL)
+                nCost += rpDescriptor->mpPageObjectProvider->GetCostIndex();
+    }
+
+    // Its negative value is used so that requests with a low cost are
+    // preferred over those with high costs.
+    nPriority = -nCost;
+
+    // Add a term that introduces an order based on the appearance in the
+    // AllMasterPagesSelector.
+    nPriority -= rpDescriptor->maToken / 3;
+    
+    // Process requests for the CurrentMasterPagesSelector first.
+    if (rpDescriptor->meOrigin == MasterPageContainer::MASTERPAGE)
+        nPriority += snMasterPagePriorityBoost;
+
+    return nPriority;
+}
+
+
+
+
+IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer)
+{
+    bool bIsShowingFullScreenShow (false);
+    bool bWaitForMoreRequests (false);
+
+    do
+    {
+        if (mpRequestQueue->size() == 0)
+            break;
+
+        // First check whether the system is idle.
+        sal_Int32 nIdleState (tools::IdleDetection::GetIdleState());
+        if (nIdleState != tools::IdleDetection::IDET_IDLE)
+        {
+            if ((nIdleState&tools::IdleDetection::IDET_FULL_SCREEN_SHOW_ACTIVE) != 0)
+                bIsShowingFullScreenShow = true;
+            break;
+        }
+
+        PreviewCreationRequest aRequest (*mpRequestQueue->begin());
+
+        // Check if the request should really be processed right now.
+        // Reasons to not do it are when its cost is high and not many other
+        // requests have been inserted into the queue that would otherwise
+        // be processed first.
+        if (aRequest.mnPriority < snWaitForMoreRequestsPriorityThreshold
+            && (mnRequestsServedCount+mpRequestQueue->size() < snWaitForMoreRequestsCount))
+        {
+            // Wait for more requests before this one is processed.  Note
+            // that the queue processing is not started anew when this
+            // method is left.  That is done when the next request is
+            // inserted.
+            bWaitForMoreRequests = true;
+            break;
+        }
+
+        mpRequestQueue->erase(mpRequestQueue->begin());
+        
+        if (aRequest.mpDescriptor.get() != NULL)
+        {
+            mnRequestsServedCount += 1;
+            if ( ! mpWeakContainer.expired())
+            {
+                ::boost::shared_ptr<ContainerAdapter> pContainer (mpWeakContainer);
+                if (pContainer.get() != NULL)
+                    pContainer->UpdateDescriptor(aRequest.mpDescriptor,false,true,true);
+            }
+        }
+    }
+    while (false);
+    
+    if (mpRequestQueue->size() > 0 && ! bWaitForMoreRequests)
+    {
+        int nTimeout (snDelayedCreationTimeout);
+        if (bIsShowingFullScreenShow)
+            nTimeout = snDelayedCreationTimeoutWhenNotIdle;
+        maDelayedPreviewCreationTimer.SetTimeout(nTimeout);
+        pTimer->Start();
+    }
+
+    return 0;
+}
+
+
+
+
+bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const
+{
+    RequestQueue::iterator iRequest (::std::find_if(
+        mpRequestQueue->begin(),
+        mpRequestQueue->end(),
+        PreviewCreationRequest::CompareToken(aToken)));
+    return (iRequest != mpRequestQueue->end());
+}
+
+
+
+
+bool MasterPageContainerQueue::IsEmpty (void) const
+{
+    return mpRequestQueue->empty();
+}
+
+
+
+
+void MasterPageContainerQueue::ProcessAllRequests (void)
+{
+    snWaitForMoreRequestsCount = 0;
+    if (mpRequestQueue->size() > 0)
+        maDelayedPreviewCreationTimer.Start();
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPageContainerQueue.hxx b/main/sd/source/ui/sidebar/MasterPageContainerQueue.hxx
new file mode 100644
index 0000000..f096c89
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageContainerQueue.hxx
@@ -0,0 +1,130 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX
+
+#include "MasterPageContainer.hxx"
+#include "MasterPageDescriptor.hxx"
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+namespace sd { namespace sidebar {
+
+
+/** The queue stores and processes all requests from a MasterPageContainer
+    for the creation of previews.
+    The order of request processing and its timing is controlled by a
+    heuristic that uses values given with each request and which is
+    controlled by various parameters that are described below.
+*/
+class MasterPageContainerQueue
+{
+public:
+    class ContainerAdapter { public:
+        virtual bool UpdateDescriptor (
+            const SharedMasterPageDescriptor& rpDescriptor,
+            bool bForcePageObject,
+            bool bForcePreview,
+            bool bSendEvents) = 0;
+    };
+
+    static MasterPageContainerQueue* Create (
+        const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
+    virtual ~MasterPageContainerQueue (void);
+
+    /** This method is typically called for entries in the container for
+        which GetPreviewState() returns OS_CREATABLE.  The creation of the
+        preview is then scheduled to be executed asynchronously at a later
+        point in time.  When the preview is available the change listeners
+        will be notified.
+    */
+    bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor);
+
+    /** Return <TRUE/> when there is a request currently in the queue for
+        the given token.
+    */
+    bool HasRequest (MasterPageContainer::Token aToken) const;
+
+    /** Return <TRUE/> when there is at least one request in the queue.
+    */
+    bool IsEmpty (void) const;
+
+    /** After this call the queue does not wait anymore for requests with
+        higher priority when only a small number of requests with lower
+        priority are present.  This method should be called when all
+        templates are inserted into the MasterPageContainer.
+    */
+    void ProcessAllRequests (void);
+    
+private:
+    ::boost::weak_ptr<ContainerAdapter> mpWeakContainer;
+    class PreviewCreationRequest;
+    class RequestQueue;
+    ::boost::scoped_ptr<RequestQueue> mpRequestQueue;
+    Timer maDelayedPreviewCreationTimer;
+    sal_uInt32 mnRequestsServedCount;
+
+    // There are a couple of values that define various aspects of the
+    // heuristic that defines the order and timing in which requests for
+    // preview creation are processed.
+    
+    /** The time to wait (in milliseconds) between the creation of previews.
+    */
+    static const sal_Int32 snDelayedCreationTimeout;
+
+    /** The time to wait when the system is not idle.
+    */
+    static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle;
+    
+    /** Requests for previews of master pages in a document have their
+        priority increased by this value.
+    */
+    static const sal_Int32 snMasterPagePriorityBoost;
+
+    /** When only requests which a priority lower than this threshold exist
+        and not many requests have been made yet then wait with processing
+        them until more requests are present.
+    */
+    static const sal_Int32 snWaitForMoreRequestsPriorityThreshold;
+
+    /** When only requests which a priority lower than a threshold exist
+        and not more requests than this number have been made or already
+        processed then wait with processing them until more requests are
+        present.
+    */
+    static sal_uInt32 snWaitForMoreRequestsCount;
+    
+    MasterPageContainerQueue (const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
+    void LateInit (void);
+
+    /** Calculate the priority that defines the order in which requests
+        are processed.
+    */
+    sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor) const;
+    
+    DECL_LINK(DelayedPreviewCreation, Timer *);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/main/sd/source/ui/sidebar/MasterPageDescriptor.cxx
new file mode 100644
index 0000000..ac5dcbd
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageDescriptor.cxx
@@ -0,0 +1,416 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageDescriptor.hxx"
+
+#include "DocumentHelper.hxx"
+#include "sdpage.hxx"
+#include <tools/urlobj.hxx>
+
+namespace sd { namespace sidebar {
+
+
+//===== MasterPageDescriptor ==================================================
+
+MasterPageDescriptor::MasterPageDescriptor (
+    MasterPageContainer::Origin eOrigin,
+    const sal_Int32 nTemplateIndex,
+    const String& rsURL,
+    const String& rsPageName,
+    const String& rsStyleName,
+    const bool bIsPrecious,
+    const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
+    const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider)
+    : maToken(MasterPageContainer::NIL_TOKEN),
+      meOrigin(eOrigin),
+      msURL(INetURLObject(rsURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS)),
+      msPageName(rsPageName),
+      msStyleName(rsStyleName),
+      mbIsPrecious(bIsPrecious),
+      mpMasterPage(NULL),
+      mpSlide(NULL),
+      maSmallPreview(),
+      maLargePreview(),
+      mpPreviewProvider(rpPreviewProvider),
+      mpPageObjectProvider(rpPageObjectProvider),
+      mnTemplateIndex(nTemplateIndex),
+      meURLClassification(URLCLASS_UNDETERMINED),
+      mnUseCount(0)
+{
+}
+   
+
+
+
+MasterPageDescriptor::MasterPageDescriptor (const MasterPageDescriptor& rDescriptor)
+    : maToken(rDescriptor.maToken),
+      meOrigin(rDescriptor.meOrigin),
+      msURL(rDescriptor.msURL),
+      msPageName(rDescriptor.msPageName),
+      msStyleName(rDescriptor.msStyleName),
+      mbIsPrecious(rDescriptor.mbIsPrecious),
+      mpMasterPage(rDescriptor.mpMasterPage),
+      mpSlide(rDescriptor.mpSlide),
+      maSmallPreview(rDescriptor.maSmallPreview),
+      maLargePreview(rDescriptor.maLargePreview),
+      mpPreviewProvider(rDescriptor.mpPreviewProvider),
+      mpPageObjectProvider(rDescriptor.mpPageObjectProvider),
+      mnTemplateIndex(rDescriptor.mnTemplateIndex),
+      meURLClassification(rDescriptor.meURLClassification),
+      mnUseCount(rDescriptor.mnUseCount)
+{
+}
+
+
+
+
+MasterPageDescriptor::~MasterPageDescriptor (void)
+{
+}
+
+
+
+
+void MasterPageDescriptor::SetToken (MasterPageContainer::Token aToken)
+{
+    maToken = aToken;
+}
+
+
+
+
+Image MasterPageDescriptor::GetPreview (MasterPageContainer::PreviewSize eSize)
+{
+    if (eSize == MasterPageContainer::SMALL)
+        return maSmallPreview;
+    else
+        return maLargePreview;
+}
+
+
+
+
+::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
+    MasterPageDescriptor::Update (
+        const MasterPageDescriptor& rDescriptor)
+{
+    bool bDataChanged (false);
+    bool bIndexChanged (false);
+    bool bPreviewChanged (false);
+
+    if (meOrigin==MasterPageContainer::UNKNOWN
+        && rDescriptor.meOrigin!=MasterPageContainer::UNKNOWN)
+    {
+        meOrigin = rDescriptor.meOrigin;
+        bIndexChanged = true;
+    }
+    
+    if (msURL.getLength()==0 && rDescriptor.msURL.getLength()!=0)
+    {
+        msURL = rDescriptor.msURL;
+        bDataChanged = true;
+    }
+    
+    if (msPageName.getLength()==0 && rDescriptor.msPageName.getLength()!=0)
+    {
+        msPageName = rDescriptor.msPageName;
+        bDataChanged = true;
+    }
+    
+    if (msStyleName.getLength()==0 && rDescriptor.msStyleName.getLength()!=0)
+    {
+        msStyleName = rDescriptor.msStyleName;
+        bDataChanged = true;
+    }
+    
+    if (mpPageObjectProvider.get()==NULL && rDescriptor.mpPageObjectProvider.get()!=NULL)
+    {
+        mpPageObjectProvider = rDescriptor.mpPageObjectProvider;
+        bDataChanged = true;
+    }
+    
+     if (mpPreviewProvider.get()==NULL && rDescriptor.mpPreviewProvider.get()!=NULL)
+     {
+         mpPreviewProvider = rDescriptor.mpPreviewProvider;
+         bPreviewChanged = true;
+     }
+
+     if (mnTemplateIndex<0 && rDescriptor.mnTemplateIndex>=0)
+     {
+         mnTemplateIndex = rDescriptor.mnTemplateIndex;
+         bIndexChanged = true;
+     }
+
+     // Prepare the list of event types that will be returned.
+     ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pResult;
+     if (bDataChanged || bIndexChanged || bPreviewChanged)
+     {
+         pResult.reset(new std::vector<MasterPageContainerChangeEvent::EventType>());
+         if (bDataChanged)
+             pResult->push_back(MasterPageContainerChangeEvent::DATA_CHANGED);
+         if (bIndexChanged)
+             pResult->push_back(MasterPageContainerChangeEvent::INDEX_CHANGED);
+         if (bPreviewChanged)
+             pResult->push_back(MasterPageContainerChangeEvent::PREVIEW_CHANGED);
+     }
+     
+     return pResult;
+}
+
+
+
+
+bool MasterPageDescriptor::UpdatePageObject (
+    sal_Int32 nCostThreshold,
+    SdDrawDocument* pDocument)
+{
+    bool bModified (false);
+    
+    // Update the page object when that is not yet known.
+    if (mpMasterPage == NULL
+        && mpPageObjectProvider.get()!=NULL
+        && (nCostThreshold<0 || mpPageObjectProvider->GetCostIndex()<=nCostThreshold))
+    {
+        // Note that pDocument may be NULL.
+            
+        SdPage* pPage = (*mpPageObjectProvider)(pDocument);
+        if (meOrigin == MasterPageContainer::MASTERPAGE)
+        {
+            mpMasterPage = pPage;
+            if (mpMasterPage != NULL)
+                mpMasterPage->SetPrecious(mbIsPrecious);
+        }
+        else
+        {
+            // Master pages from templates are copied into the local document.
+            if (pDocument != NULL)
+                mpMasterPage = DocumentHelper::CopyMasterPageToLocalDocument(*pDocument,pPage);
+            mpSlide = DocumentHelper::GetSlideForMasterPage(mpMasterPage);
+        }
+
+        if (mpMasterPage != NULL)
+        {
+            // Update page name and style name.
+            if (msPageName.getLength() == 0)
+                msPageName = mpMasterPage->GetName();
+            msStyleName = mpMasterPage->GetName();
+
+            // Delete an existing substitution. The next request for a preview
+            // will create the real one.
+            maSmallPreview = Image();
+            maLargePreview = Image();
+            mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider());
+        }
+        else
+        {
+            DBG_ASSERT(false, "UpdatePageObject: master page is NULL");
+        }
+
+        bModified = true;
+    }
+
+    return bModified;
+}
+
+
+
+
+bool MasterPageDescriptor::UpdatePreview (
+    sal_Int32 nCostThreshold,
+    const Size& rSmallSize,
+    const Size& rLargeSize,
+    ::sd::PreviewRenderer& rRenderer)
+{
+    bool bModified (false);
+    
+    // Update the preview when that is not yet known.
+    if (maLargePreview.GetSizePixel().Width()==0
+        && mpPreviewProvider.get()!=NULL
+        && (nCostThreshold<0 || mpPreviewProvider->GetCostIndex()<=nCostThreshold))
+    {
+        SdPage* pPage = mpSlide;
+        if (pPage == NULL)
+        {
+            pPage = mpMasterPage;
+        }
+        maLargePreview = (*mpPreviewProvider)(
+            rLargeSize.Width(),
+            pPage,
+            rRenderer);
+        if (maLargePreview.GetSizePixel().Width() > 0)
+        {
+            // Create the small preview by scaling the large one down.
+            maSmallPreview = rRenderer.ScaleBitmap(
+                maLargePreview.GetBitmapEx(),
+                rSmallSize.Width());
+            // The large preview may not have the desired width.  Scale it
+            // accrodingly.
+            if (maLargePreview.GetSizePixel().Width() != rLargeSize.Width())
+                maLargePreview = rRenderer.ScaleBitmap(
+                    maLargePreview.GetBitmapEx(),
+                    rLargeSize.Width());
+            bModified = true;
+        }
+    }
+
+    return bModified;
+}
+
+
+
+
+MasterPageDescriptor::URLClassification MasterPageDescriptor::GetURLClassification (void)
+{
+    if (meURLClassification == URLCLASS_UNDETERMINED)
+    {
+        if (msURL.getLength() == 0)
+            meURLClassification = URLCLASS_UNKNOWN;
+        else if (msURL.indexOf(::rtl::OUString::createFromAscii("presnt"))>=0)
+        {
+            meURLClassification = URLCLASS_PRESENTATION;
+        }
+        else if (msURL.indexOf(::rtl::OUString::createFromAscii("layout"))>=0)
+        {
+            meURLClassification = URLCLASS_LAYOUT;
+        }
+        else if (msURL.indexOf(::rtl::OUString::createFromAscii("educate"))>=0)
+        {
+            meURLClassification = URLCLASS_OTHER;
+        }
+        else
+        {
+            meURLClassification = URLCLASS_USER;
+        }
+    }
+    
+    return meURLClassification;
+}
+
+
+
+//===== URLComparator =========================================================
+
+MasterPageDescriptor::URLComparator::URLComparator (const ::rtl::OUString& sURL)
+    : msURL(sURL)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::URLComparator::operator() (
+    const SharedMasterPageDescriptor& rDescriptor)
+{
+    if (rDescriptor.get() == NULL)
+        return false;
+    else
+        return rDescriptor->msURL.equals(msURL);
+}
+
+
+
+
+// ===== StyleNameComparator ==================================================
+
+MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const ::rtl::OUString& sStyleName)
+    : msStyleName(sStyleName)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::StyleNameComparator::operator() (
+    const SharedMasterPageDescriptor& rDescriptor)
+{
+    if (rDescriptor.get() == NULL)
+        return false;
+    else
+        return rDescriptor->msStyleName.equals(msStyleName);
+}
+
+
+
+
+//===== PageObjectComparator ==================================================
+
+MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage* pPageObject) 
+    : mpMasterPage(pPageObject)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::PageObjectComparator::operator() (
+    const SharedMasterPageDescriptor& rDescriptor)
+{
+    if (rDescriptor.get() == NULL)
+        return false;
+    else
+        return rDescriptor->mpMasterPage==mpMasterPage;
+}
+
+
+
+
+//===== AllComparator =========================================================
+
+MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescriptor& rDescriptor)
+    : mpDescriptor(rDescriptor)
+{
+}
+
+
+
+
+bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor)
+{
+    if (rDescriptor.get() == NULL)
+        return false;
+    else
+    {
+        // Take URL, page name, style name, and page object into account
+        // when comparing two descriptors.  When two descriptors are
+        // identical in any of these values then their are thought of as
+        // equivalent.  Only the Origin has to be the same in both
+        // descriptors.
+        return
+            mpDescriptor->meOrigin == rDescriptor->meOrigin
+            && (
+                (mpDescriptor->msURL.getLength()>0
+                    && mpDescriptor->msURL.equals(rDescriptor->msURL))
+                || (mpDescriptor->msPageName.getLength()>0
+                    && mpDescriptor->msPageName.equals(rDescriptor->msPageName))
+                || (mpDescriptor->msStyleName.getLength()>0
+                    && mpDescriptor->msStyleName.equals(rDescriptor->msStyleName))
+                || (mpDescriptor->mpMasterPage!=NULL
+                    && mpDescriptor->mpMasterPage==rDescriptor->mpMasterPage)
+                || (mpDescriptor->mpPageObjectProvider.get()!=NULL
+                    && rDescriptor->mpPageObjectProvider.get()!=NULL
+                    && mpDescriptor->mpPageObjectProvider==rDescriptor->mpPageObjectProvider));
+    }
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPageDescriptor.hxx b/main/sd/source/ui/sidebar/MasterPageDescriptor.hxx
new file mode 100644
index 0000000..ed2851e
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageDescriptor.hxx
@@ -0,0 +1,234 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX
+
+#include "MasterPageContainer.hxx"
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace sidebar {
+
+class PageObjectProvider;
+class PreviewProvider;
+
+class MasterPageDescriptor;
+typedef ::boost::shared_ptr<MasterPageDescriptor> SharedMasterPageDescriptor;
+
+/** A collection of data that is stored for every master page in the
+    MasterpageContainer.
+*/
+class MasterPageDescriptor
+{
+public:
+    MasterPageDescriptor (
+        MasterPageContainer::Origin eOrigin,
+        const sal_Int32 nTemplateIndex,
+        const String& rURL,
+        const String& rPageName,
+        const String& rStyleName,
+        const bool bIsPrecious,
+        const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
+        const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider);
+    MasterPageDescriptor (const MasterPageDescriptor& rDescriptor);
+    ~MasterPageDescriptor (void);
+
+    void SetToken (MasterPageContainer::Token aToken);
+
+    /** Update the called MasterPageDescriptor object with values from the
+        given one.  Only those values are updated that have default values
+        in the called object and that have non-default values in the given
+        one.
+        @return
+            Returns a list of event types for which event notifications have
+            to be sent to listeners.  The list may be empty or NULL.
+    */
+    ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
+        Update (
+            const MasterPageDescriptor& rDescriptor);
+    
+    /** This convenience method returns either a small or a large preview,
+        depending on the given size specifier.
+        Note that the previews are not created when they are not present.
+        @return
+            The returned preview may be empty.
+    */
+    Image GetPreview (MasterPageContainer::PreviewSize ePreviewSize);
+
+    /** Use the PreviewProvider to get access to a preview of the master
+        page.
+        
+        Note that this is only done, when either bForce is <TRUE/> or
+        the PreviewProvider::GetCostIndex() returns 0.
+        
+        The small preview is created by scaling the large one, not by
+        calling PreviewProvider::operator() a second time.
+        
+        It is the responsibility of the caller to call UpdatePageObject()
+        before calling this method  when the PreviewProvider can only work
+        when the master page object is present, i.e. its NeedsPageObject()
+        method returns <TRUE/>.
+        
+        @param nCostThreshold
+            When this is zero or positive then the preview is created only
+            when the preview provider has a cost equal to or smaller than
+            this threshold.  A negative value forces the preview to be
+            created, regardless of the cost.
+        @param rSmallSize
+            Size of the small preview.
+        @param rLargeSize
+            Size of the large preview.
+        @param rRenderer
+            A PreviewRenderer object that may be used to create a preview.
+        @return
+            When the previews are successfully provided then <TRUE/> is
+            returned.
+    */
+    bool UpdatePreview (
+        sal_Int32 nCostThreshold,
+        const Size& rSmallSize,
+        const Size& rLargeSize,
+        ::sd::PreviewRenderer& rRenderer);
+
+    /** Use the PageObjectProvider to get access to the master page object.
+        
+        Note that this is only done, when either bForce is <TRUE/> or the
+        PreviewProvider::GetCostIndex() returns 0.
+
+        @param nCostThreshold
+            When this is zero or positive then the page object is created
+            only when the page object provider has a cost equal to or
+            smaller than this threshold.  A negative value forces the
+            page object be created, regardless of the cost.
+        @param pDocument
+            This document of the MasterPageContainer may be used to create
+            a page object with or store one in.
+        @return
+            When the master page object is successfully provided then
+            <TRUE/> is returned.
+    */
+    bool UpdatePageObject (
+        sal_Int32 nCostThreshold,
+        SdDrawDocument* pDocument);
+
+    enum URLClassification {
+        URLCLASS_USER,
+        URLCLASS_LAYOUT,
+        URLCLASS_PRESENTATION,
+        URLCLASS_OTHER,
+        URLCLASS_UNKNOWN,
+        URLCLASS_UNDETERMINED
+    };
+
+    URLClassification GetURLClassification (void);
+    
+    /** The Token under which the MasterPageContainer gives access to the
+        object.
+    */
+    MasterPageContainer::Token maToken;
+
+    /** A rough specification of the origin of the master page.
+    */
+    MasterPageContainer::Origin meOrigin;
+    
+    /** The URL is not empty for master pages loaded from a template
+        document.
+    */
+    ::rtl::OUString msURL;
+    
+    /** Taken from the title of the template file.
+    */
+    ::rtl::OUString msPageName;
+    
+    /** Taken from the master page object.
+    */
+    ::rtl::OUString msStyleName;
+
+    const bool mbIsPrecious;
+
+    /** The actual master page.
+    */
+    SdPage* mpMasterPage;
+    
+    /** A slide that uses the master page.
+    */
+    SdPage* mpSlide;
+    
+    /** A small (the default size) preview of the master page.  May be
+        empty.  When this smaller preview is not empty then the larger one
+        is not empty, too.
+    */
+    Image maSmallPreview;
+    
+    /** A large preview of the master page.  May be empty.  When this larger
+        preview is not empty then the smaller one is not empty, too.
+    */
+    Image maLargePreview;
+
+    /** The prewview provider. May be empty.  May be replaced during the
+        lifetime of a MasterPageDescriptor object.
+    */
+    ::boost::shared_ptr<PreviewProvider> mpPreviewProvider;
+
+    /** The master page provider.  May be empty.  May be replaced during
+        the lifetime of a MasterPageDescriptor object.
+    */
+    ::boost::shared_ptr<PageObjectProvider> mpPageObjectProvider;
+    
+    /** This index represents the order in which templates are provided via
+        the TemplateScanner.  It defines the order in which the entries in
+        the AllMasterPagesSelector are displayed.  The default value is -1.
+    */
+    sal_Int32 mnTemplateIndex;
+
+    URLClassification meURLClassification;
+
+    sal_Int32 mnUseCount;
+
+    class URLComparator { public:
+        ::rtl::OUString msURL;
+        URLComparator (const ::rtl::OUString& sURL);
+        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+    };
+    class StyleNameComparator { public:
+        ::rtl::OUString msStyleName;
+        StyleNameComparator (const ::rtl::OUString& sStyleName);
+        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+    };
+    class PageObjectComparator { public:
+        const SdPage* mpMasterPage;
+        PageObjectComparator (const SdPage* pPageObject);
+        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+    };
+    class AllComparator { public:
+        AllComparator(const SharedMasterPageDescriptor& rDescriptor);
+        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
+    private:
+        SharedMasterPageDescriptor mpDescriptor;
+    };
+
+
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/MasterPageObserver.cxx b/main/sd/source/ui/sidebar/MasterPageObserver.cxx
new file mode 100644
index 0000000..cbaa70e
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -0,0 +1,419 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPageObserver.hxx"
+
+#include <algorithm>
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <hash_map>
+#include <set>
+#include <vector>
+#include <svl/lstner.hxx>
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+
+
+namespace sd {
+
+class MasterPageObserver::Implementation
+    : public SfxListener
+{
+public:
+    /** The single instance of this class.  It is created on demand when
+        Instance() is called for the first time.
+    */
+    static MasterPageObserver* mpInstance;
+
+    /** The master page observer will listen to events of this document and
+        detect changes of the use of master pages.
+    */
+    void RegisterDocument (SdDrawDocument& rDocument);
+
+    /** The master page observer will stop to listen to events of this
+        document.
+    */
+    void UnregisterDocument (SdDrawDocument& rDocument);
+    
+    /** Add a listener that is informed of master pages that are newly
+        assigned to slides or become unassigned.
+        @param rEventListener
+            The event listener to call for future events.  Call
+            RemoveEventListener() before the listener is destroyed.
+    */
+    void AddEventListener (const Link& rEventListener);
+
+    /** Remove the given listener from the list of listeners.
+        @param rEventListener
+            After this method returns the given listener is not called back
+            from this object.  Passing a listener that has not
+            been registered before is safe and is silently ignored.
+    */
+    void RemoveEventListener (const Link& rEventListener);
+
+    /** Return a set of the names of master pages for the given document.
+        This convenience method exists because this set is part of the
+        internal data structure and thus takes no time to create.
+    */
+    inline MasterPageObserver::MasterPageNameSet GetMasterPageNames (
+        SdDrawDocument& rDocument);
+
+private:
+    ::std::vector<Link> maListeners;
+
+    struct DrawDocHash {
+        size_t operator()(SdDrawDocument* argument) const 
+        { return reinterpret_cast<unsigned long>(argument); }
+    };
+    typedef ::std::hash_map<SdDrawDocument*,
+                            MasterPageObserver::MasterPageNameSet,
+                            DrawDocHash>
+        MasterPageContainer;
+    MasterPageContainer maUsedMasterPages;
+
+    virtual void Notify(
+        SfxBroadcaster& rBroadcaster,
+        const SfxHint& rHint);
+
+    void AnalyzeUsedMasterPages (SdDrawDocument& rDocument);
+
+    void SendEvent (MasterPageObserverEvent& rEvent);
+};
+
+MasterPageObserver* MasterPageObserver::Implementation::mpInstance = NULL;
+
+
+
+//===== MasterPageObserver ====================================================
+
+MasterPageObserver&  MasterPageObserver::Instance (void)
+{
+    if (Implementation::mpInstance == NULL)
+    {
+        ::osl::GetGlobalMutex aMutexFunctor;
+        ::osl::MutexGuard aGuard (aMutexFunctor());
+        if (Implementation::mpInstance == NULL)
+        {
+            MasterPageObserver* pInstance = new MasterPageObserver ();
+            SdGlobalResourceContainer::Instance().AddResource (
+                ::std::auto_ptr<SdGlobalResource>(pInstance));
+            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+            Implementation::mpInstance = pInstance;
+        }
+    }
+    else
+    {
+        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+    }
+    
+    DBG_ASSERT(Implementation::mpInstance!=NULL,
+        "MasterPageObserver::Instance(): instance is NULL");
+    return *Implementation::mpInstance;
+}
+
+
+
+
+void MasterPageObserver::RegisterDocument (SdDrawDocument& rDocument)
+{
+    mpImpl->RegisterDocument (rDocument);
+}
+
+
+
+
+void MasterPageObserver::UnregisterDocument (SdDrawDocument& rDocument)
+{
+    mpImpl->UnregisterDocument (rDocument);
+}
+
+
+
+    
+void MasterPageObserver::AddEventListener (const Link& rEventListener)
+{
+
+    mpImpl->AddEventListener (rEventListener);
+}
+
+
+
+
+void MasterPageObserver::RemoveEventListener (const Link& rEventListener)
+{
+    mpImpl->RemoveEventListener (rEventListener);
+}
+
+
+
+
+MasterPageObserver::MasterPageObserver (void)
+    : mpImpl (new Implementation())
+{}
+
+
+
+
+MasterPageObserver::~MasterPageObserver (void)
+{}
+
+
+
+
+//===== MasterPageObserver::Implementation ====================================
+
+void MasterPageObserver::Implementation::RegisterDocument (
+    SdDrawDocument& rDocument)
+{
+    // Gather the names of all the master pages in the given document.
+    MasterPageContainer::data_type aMasterPageSet;
+    sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
+    for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
+    {
+        SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+        if (pMasterPage != NULL)
+            aMasterPageSet.insert (pMasterPage->GetName());
+    }
+
+    maUsedMasterPages[&rDocument] = aMasterPageSet;
+
+    StartListening (rDocument);
+}
+
+
+
+
+void MasterPageObserver::Implementation::UnregisterDocument (
+    SdDrawDocument& rDocument)
+{
+    EndListening (rDocument);
+
+	MasterPageContainer::iterator aMasterPageDescriptor(maUsedMasterPages.find(&rDocument));
+	if(aMasterPageDescriptor != maUsedMasterPages.end())
+		maUsedMasterPages.erase(aMasterPageDescriptor);
+}
+
+
+
+    
+void MasterPageObserver::Implementation::AddEventListener (
+    const Link& rEventListener)
+{
+    if (::std::find (
+        maListeners.begin(),
+        maListeners.end(),
+        rEventListener) == maListeners.end())
+    {
+        maListeners.push_back (rEventListener);
+        
+        // Tell the new listener about all the master pages that are
+        // currently in use.
+        typedef ::std::vector<String> StringList;
+        StringList aNewMasterPages;
+        StringList aRemovedMasterPages;
+        MasterPageContainer::iterator aDocumentIterator;
+        for (aDocumentIterator=maUsedMasterPages.begin();
+             aDocumentIterator!=maUsedMasterPages.end();
+             ++aDocumentIterator)
+        {
+            ::std::set<String>::reverse_iterator aNameIterator;
+            for (aNameIterator=aDocumentIterator->second.rbegin();
+                 aNameIterator!=aDocumentIterator->second.rend();
+                 ++aNameIterator)
+            {
+			  MasterPageObserverEvent aEvent (
+				  MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS,
+				  *aDocumentIterator->first,
+				  *aNameIterator);
+			  SendEvent (aEvent);
+            }
+        }
+    }
+}
+
+
+
+
+void MasterPageObserver::Implementation::RemoveEventListener (
+    const Link& rEventListener)
+{
+    maListeners.erase (
+        ::std::find (
+            maListeners.begin(),
+            maListeners.end(),
+            rEventListener));
+}
+
+
+
+
+MasterPageObserver::MasterPageNameSet 
+    MasterPageObserver::Implementation::GetMasterPageNames (
+        SdDrawDocument& rDocument)
+{
+    MasterPageContainer::iterator aMasterPageDescriptor (
+        maUsedMasterPages.find(&rDocument));
+    if (aMasterPageDescriptor != maUsedMasterPages.end())
+        return aMasterPageDescriptor->second;
+    else
+        // Not found so return an empty set.
+        return MasterPageObserver::MasterPageNameSet();
+}
+
+
+
+
+void MasterPageObserver::Implementation::Notify(
+    SfxBroadcaster& rBroadcaster,
+    const SfxHint& rHint)
+{
+    if (rHint.ISA(SdrHint))
+    {
+        SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
+        switch (rSdrHint.GetKind())
+        {
+            case HINT_PAGEORDERCHG:
+                // Process the modified set of pages only when the number of
+                // standard and notes master pages are equal.  This test
+                // filters out events that are sent in between the insertion
+                // of a new standard master page and a new notes master
+                // page.
+                if (rBroadcaster.ISA(SdDrawDocument))
+                {
+                    SdDrawDocument& rDocument (
+                        static_cast<SdDrawDocument&>(rBroadcaster));
+                    if (rDocument.GetMasterSdPageCount(PK_STANDARD)
+                        == rDocument.GetMasterSdPageCount(PK_NOTES))
+                    {
+                        AnalyzeUsedMasterPages (rDocument);
+                    }
+                }
+                break;
+
+			default:
+				break;
+        }
+    }
+}
+
+
+
+
+void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
+    SdDrawDocument& rDocument)
+{
+    // Create a set of names of the master pages used by the given document.
+    sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
+    ::std::set<String> aCurrentMasterPages;
+    for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
+    {
+        SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+        if (pMasterPage != NULL)
+            aCurrentMasterPages.insert (pMasterPage->GetName());
+        OSL_TRACE("currently used master page %d is %s",
+            nIndex,
+            ::rtl::OUStringToOString(pMasterPage->GetName(),
+                RTL_TEXTENCODING_UTF8).getStr());
+    }
+
+    typedef ::std::vector<String> StringList;
+    StringList aNewMasterPages;
+    StringList aRemovedMasterPages;
+    MasterPageContainer::iterator aOldMasterPagesDescriptor (
+        maUsedMasterPages.find(&rDocument));
+    if (aOldMasterPagesDescriptor != maUsedMasterPages.end())
+    {
+        StringList::iterator I;
+
+        ::std::set<String>::iterator J;
+        int i=0;
+        for (J=aOldMasterPagesDescriptor->second.begin(); 
+             J!=aOldMasterPagesDescriptor->second.end(); 
+             ++J)
+            OSL_TRACE("old used master page %d is %s",
+            i++,
+            ::rtl::OUStringToOString(*J,
+                RTL_TEXTENCODING_UTF8).getStr());
+
+        // Send events about the newly used master pages.
+        ::std::set_difference (
+            aCurrentMasterPages.begin(),
+            aCurrentMasterPages.end(),
+            aOldMasterPagesDescriptor->second.begin(),
+            aOldMasterPagesDescriptor->second.end(),
+            ::std::back_insert_iterator<StringList>(aNewMasterPages));
+        for (I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
+        {
+            OSL_TRACE("    added master page %s",
+                ::rtl::OUStringToOString(*I,
+                    RTL_TEXTENCODING_UTF8).getStr());
+
+			MasterPageObserverEvent aEvent (
+				MasterPageObserverEvent::ET_MASTER_PAGE_ADDED, 
+				rDocument, 
+				*I);
+            SendEvent (aEvent);
+        }
+
+        // Send events about master pages that are not used any longer.
+        ::std::set_difference (
+            aOldMasterPagesDescriptor->second.begin(),
+            aOldMasterPagesDescriptor->second.end(),
+            aCurrentMasterPages.begin(),
+            aCurrentMasterPages.end(),
+            ::std::back_insert_iterator<StringList>(aRemovedMasterPages));
+        for (I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
+        {
+            OSL_TRACE("    removed master page %s",
+                ::rtl::OUStringToOString(*I,
+                    RTL_TEXTENCODING_UTF8).getStr());
+
+			MasterPageObserverEvent aEvent (
+				MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
+				rDocument, 
+				*I);
+			SendEvent (aEvent);
+        }
+
+        // Store the new list of master pages.
+        aOldMasterPagesDescriptor->second = aCurrentMasterPages;
+    }
+}
+
+
+
+
+void MasterPageObserver::Implementation::SendEvent (
+    MasterPageObserverEvent& rEvent)
+{
+    ::std::vector<Link>::iterator aLink (maListeners.begin());
+    ::std::vector<Link>::iterator aEnd (maListeners.end());
+    while (aLink!=aEnd)
+    {
+        aLink->Call (&rEvent);
+        ++aLink;
+    }
+}
+
+
+} // end of namespace sd
diff --git a/main/sd/source/ui/sidebar/MasterPagesSelector.cxx b/main/sd/source/ui/sidebar/MasterPagesSelector.cxx
new file mode 100644
index 0000000..2f129f6
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -0,0 +1,849 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "MasterPagesSelector.hxx"
+
+#include "MasterPageContainer.hxx"
+#include "DocumentHelper.hxx"
+#include "SidebarShellManager.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "sdpage.hxx"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "DrawViewShell.hxx"
+#include "DrawController.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "PreviewValueSet.hxx"
+#include "ViewShellBase.hxx"
+#include <sfx2/objface.hxx>
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include <vcl/image.hxx>
+#include <vcl/floatwin.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+#include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svxids.hrc>
+#include "FrameView.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "unmovss.hxx"
+#include <sfx2/request.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+
+
+using namespace ::com::sun::star::text;
+
+
+
+namespace sd { namespace sidebar {
+
+
+MasterPagesSelector::MasterPagesSelector (
+    ::Window* pParent,
+    SdDrawDocument& rDocument,
+    ViewShellBase& rBase,
+    const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : PreviewValueSet(pParent),
+      maMutex(),
+      mpContainer(rpContainer),
+      mrDocument(rDocument),
+      mrBase(rBase),
+      mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES),
+      maPreviewUpdateQueue(),
+      maCurrentItemList(),
+      maTokenToValueSetIndex(),
+      maLockedMasterPages(),
+      mxSidebar(rxSidebar)
+{
+    PreviewValueSet::SetSelectHdl (
+        LINK(this, MasterPagesSelector, ClickHandler));
+	PreviewValueSet::SetRightMouseClickHandler (
+        LINK(this, MasterPagesSelector, RightClickHandler));
+    PreviewValueSet::SetStyle(PreviewValueSet::GetStyle() | WB_NO_DIRECTSELECT);
+    PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel());
+    PreviewValueSet::Show();
+
+    SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+    SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
+
+    Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
+    mpContainer->AddChangeListener(aChangeListener);
+}
+
+
+
+
+MasterPagesSelector::~MasterPagesSelector (void)
+{
+    Clear();
+    UpdateLocks(ItemList());
+
+    Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
+    mpContainer->RemoveChangeListener(aChangeListener);
+}
+
+
+
+
+void MasterPagesSelector::LateInit (void)
+{
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    return PreviewValueSet::GetPreferredWidth (nHeight);
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    return PreviewValueSet::GetPreferredHeight (nWidth);
+}
+
+
+
+
+Size MasterPagesSelector::GetPreferredSize (void)
+{
+    int nPreferredWidth = GetPreferredWidth(
+        PreviewValueSet::GetOutputSizePixel().Height());
+    int nPreferredHeight = GetPreferredHeight(nPreferredWidth);
+    return Size (nPreferredWidth, nPreferredHeight);
+
+}
+
+
+
+
+void MasterPagesSelector::UpdateLocks (const ItemList& rItemList)
+{
+    ItemList aNewLockList;
+    
+    // In here we first lock the master pages in the given list and then
+    // release the locks acquired in a previous call to this method.  When
+    // this were done the other way round the lock count of some master
+    // pages might drop temporarily to 0 and would lead to unnecessary
+    // deletion and re-creation of MasterPageDescriptor objects.
+
+    // Lock the master pages in the given list.
+    ItemList::const_iterator iItem;
+    for (iItem=rItemList.begin(); iItem!=rItemList.end(); ++iItem)
+    {
+        mpContainer->AcquireToken(*iItem);
+        aNewLockList.push_back(*iItem);
+    }
+
+    // Release the previously locked master pages.
+    ItemList::const_iterator iPage;
+    ItemList::const_iterator iEnd (maLockedMasterPages.end());
+    for (iPage=maLockedMasterPages.begin(); iPage!=iEnd; ++iPage)
+        mpContainer->ReleaseToken(*iPage);
+
+    maLockedMasterPages.swap(aNewLockList);
+}
+
+
+
+
+void MasterPagesSelector::Fill (void)
+{
+    ::std::auto_ptr<ItemList> pItemList (new ItemList());
+    
+    Fill(*pItemList);
+
+    UpdateLocks(*pItemList);
+    UpdateItemList(pItemList);
+}
+
+
+
+
+ResId MasterPagesSelector::GetContextMenuResId (void) const
+{
+    return SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP);
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, ClickHandler, PreviewValueSet*, EMPTYARG)
+{
+    // We use the framework to assign the clicked-on master page because we
+    // so use the same mechanism as the context menu does (where we do not
+    // have the option to call the assignment method directly.)
+    ExecuteCommand(mnDefaultClickAction);
+
+    return 0;
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent)
+{
+    // Here we only prepare the display of the context menu: the item under
+    // the mouse is selected.  The actual display of the context menu is
+    // done in ContextMenuCallback which is called indirectly through
+    // PreviewValueSet::Command().
+    PreviewValueSet::GrabFocus ();
+    PreviewValueSet::ReleaseMouse();
+    SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+    if (pViewFrame != NULL)
+    {
+        SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+        if (pDispatcher != NULL &&  pEvent != NULL)
+        {
+            sal_uInt16 nIndex = PreviewValueSet::GetItemId (pEvent->GetPosPixel());
+            if (nIndex > 0)
+                PreviewValueSet::SelectItem (nIndex);
+        }
+    }
+    return 0;
+}
+
+
+
+
+void MasterPagesSelector::Command (const CommandEvent& rEvent)
+{
+    switch (rEvent.GetCommand())
+    {
+        case COMMAND_CONTEXTMENU:
+        {
+            // Use the currently selected item and show the popup menu in its
+            // center.
+            const sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId();
+            if (nIndex > 0)
+            {
+                // The position of the upper left corner of the context menu is
+                // taken either from the mouse position (when the command was sent
+                // as reaction to a right click) or in the center of the selected
+                // item (when the command was sent as reaction to Shift+F10.)
+                Point aPosition (rEvent.GetMousePosPixel());
+                if ( ! rEvent.IsMouseEvent())
+                {
+                    Rectangle aBBox (PreviewValueSet::GetItemRect(nIndex));
+                    aPosition = aBBox.Center();
+                }
+
+                // Setup the menu.
+                ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu(GetContextMenuResId()));
+                FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
+                if (pMenuWindow != NULL)
+                    pMenuWindow->SetPopupModeFlags(
+                        pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE);
+                pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected));
+
+                ProcessPopupMenu(*pMenu);
+
+                // Show the menu.
+                pMenu->Execute(this, Rectangle(aPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN);
+            }
+            break;
+        }
+    }
+}
+
+
+
+
+void MasterPagesSelector::ProcessPopupMenu (Menu& rMenu)
+{
+    // Disable some entries.
+    if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL)
+        rMenu.EnableItem(SID_TP_SHOW_SMALL_PREVIEW, sal_False);
+    else
+        rMenu.EnableItem(SID_TP_SHOW_LARGE_PREVIEW, sal_False);
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, OnMenuItemSelected, Menu*, pMenu)
+{
+    if (pMenu == NULL)
+    {
+        OSL_ENSURE(pMenu!=NULL, "MasterPagesSelector::OnMenuItemSelected: illegal menu!");
+        return 0;
+    }
+
+    pMenu->Deactivate();
+    ExecuteCommand(pMenu->GetCurItemId());
+    return 0;
+}
+
+
+
+
+void MasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId)
+{
+	switch (nCommandId)
+    {
+        case SID_TP_APPLY_TO_ALL_SLIDES:
+            mrBase.SetBusyState (true);
+            AssignMasterPageToAllSlides (GetSelectedMasterPage());
+            mrBase.SetBusyState (false);
+            break;
+
+        case SID_TP_APPLY_TO_SELECTED_SLIDES:
+            mrBase.SetBusyState (true);
+            AssignMasterPageToSelectedSlides (GetSelectedMasterPage());
+            mrBase.SetBusyState (false);
+            break;
+
+        case SID_TP_USE_FOR_NEW_PRESENTATIONS:
+            DBG_ASSERT (false, 
+                "Using slides as default for new presentations"
+                " is not yet implemented");
+            break;
+
+        case SID_TP_SHOW_SMALL_PREVIEW:
+        case SID_TP_SHOW_LARGE_PREVIEW:
+        {
+            mrBase.SetBusyState (true);
+            mpContainer->SetPreviewSize(
+                nCommandId==SID_TP_SHOW_SMALL_PREVIEW
+                ? MasterPageContainer::SMALL
+                : MasterPageContainer::LARGE);
+            mrBase.SetBusyState (false);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+            break;
+        }
+
+        case SID_TP_EDIT_MASTER:
+        {
+            using namespace ::com::sun::star;
+            uno::Reference<drawing::XDrawPage> xSelectedMaster (
+                GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY);
+            SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+            if (pViewFrame != NULL && xSelectedMaster.is())
+            {
+                SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+                if (pDispatcher != NULL)
+                {
+                    sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId();
+                    pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON);
+                    PreviewValueSet::SelectItem (nIndex);
+                    mrBase.GetDrawController().setCurrentPage(xSelectedMaster);
+                }
+            }
+            break;
+        }
+
+        case SID_CUT:
+        case SID_COPY:
+        case SID_PASTE:
+            // Cut, copy, and paste are not supported and thus are ignored.
+            break;
+    }
+}
+
+
+
+
+IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent)
+{
+    if (pEvent)
+        NotifyContainerChangeEvent(*pEvent);
+    return 0;
+}
+
+
+
+
+SdPage* MasterPagesSelector::GetSelectedMasterPage (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    SdPage* pMasterPage = NULL;
+    sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId();
+    UserData* pData = GetUserData(nIndex);
+    if (pData != NULL)
+    {
+        pMasterPage = mpContainer->GetPageObjectForToken(pData->second);
+    }
+    return pMasterPage;
+}
+
+
+
+
+/** Assemble a list of all slides of the document and pass it to
+    AssignMasterPageToPageList().
+*/
+void MasterPagesSelector::AssignMasterPageToAllSlides (SdPage* pMasterPage)
+{
+    do
+    {
+        if (pMasterPage == NULL)
+            break;
+
+        sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
+        if (nPageCount == 0)
+            break;
+
+        // Get a list of all pages.  As a little optimization we only
+        // include pages that do not already have the given master page
+        // assigned.
+        String sFullLayoutName (pMasterPage->GetLayoutName());
+        ::sd::slidesorter::SharedPageSelection pPageList (
+            new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
+        for (sal_uInt16 nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
+        {
+            SdPage* pPage = mrDocument.GetSdPage (nPageIndex, PK_STANDARD);
+            if (pPage != NULL
+                && pPage->GetLayoutName().CompareTo(sFullLayoutName)!=0)
+            {
+                pPageList->push_back (pPage);
+            }
+        }
+
+        AssignMasterPageToPageList(pMasterPage, pPageList);
+    }
+    while (false);
+}
+
+
+
+
+/** Assemble a list of the currently selected slides (selected in a visible
+    slide sorter) and pass it to AssignMasterPageToPageList().
+*/
+void MasterPagesSelector::AssignMasterPageToSelectedSlides (
+    SdPage* pMasterPage)
+{
+    do
+    {
+        using namespace ::std;
+        using namespace ::sd::slidesorter;
+        using namespace ::sd::slidesorter::controller;
+
+        if (pMasterPage == NULL)
+            break;
+
+        // Find a visible slide sorter.
+        SlideSorterViewShell* pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
+        if (pSlideSorter == NULL)
+            break;
+
+        // Get a list of selected pages.
+        ::sd::slidesorter::SharedPageSelection pPageSelection = pSlideSorter->GetPageSelection();
+        if (pPageSelection->empty())
+            break;
+
+        AssignMasterPageToPageList(pMasterPage, pPageSelection);
+
+        // Restore the previous selection.
+        pSlideSorter->SetPageSelection(pPageSelection);
+    }
+    while (false);
+}
+
+
+
+
+void MasterPagesSelector::AssignMasterPageToPageList (
+    SdPage* pMasterPage,
+    const ::sd::slidesorter::SharedPageSelection& rPageList)
+{
+    DocumentHelper::AssignMasterPageToPageList(mrDocument, pMasterPage, rPageList);
+}
+
+
+
+
+void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    switch (rEvent.meEventType)
+    {
+        case MasterPageContainerChangeEvent::SIZE_CHANGED:
+            PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel());
+            UpdateAllPreviews();
+            break;
+
+        case MasterPageContainerChangeEvent::PREVIEW_CHANGED:
+        {
+            int nIndex (GetIndexForToken(rEvent.maChildToken));
+            if (nIndex >= 0)
+            {
+                PreviewValueSet::SetItemImage (
+                    (sal_uInt16)nIndex,
+                    mpContainer->GetPreviewForToken(rEvent.maChildToken));
+                PreviewValueSet::Invalidate(PreviewValueSet::GetItemRect((sal_uInt16)nIndex));
+            }
+        }
+        break;
+
+        case MasterPageContainerChangeEvent::DATA_CHANGED:
+        {
+            InvalidateItem(rEvent.maChildToken);
+            Fill();
+        }
+        break;
+
+		default:
+			break;
+   }
+}
+
+
+
+
+MasterPagesSelector::UserData* MasterPagesSelector::CreateUserData (
+    int nIndex,
+    MasterPageContainer::Token aToken) const
+{
+    return new UserData(nIndex,aToken);
+}
+
+
+
+
+MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    if (nIndex>0 && nIndex<=PreviewValueSet::GetItemCount())
+        return reinterpret_cast<UserData*>(PreviewValueSet::GetItemData((sal_uInt16)nIndex));
+    else
+        return NULL;
+}
+
+
+
+
+void MasterPagesSelector::SetUserData (int nIndex, UserData* pData)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    if (nIndex>0 && nIndex<=PreviewValueSet::GetItemCount())
+    {
+        UserData* pOldData = GetUserData(nIndex);
+        if (pOldData!=NULL && pOldData!=pData)
+            delete pOldData;
+        PreviewValueSet::SetItemData((sal_uInt16)nIndex, pData);
+    }
+}
+
+
+
+
+bool MasterPagesSelector::IsResizable (void)
+{
+    return false;
+}
+
+
+
+
+::Window* MasterPagesSelector::GetWindow (void)
+{
+    return this;
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetMinimumWidth (void)
+{
+    return mpContainer->GetPreviewSizePixel().Width() + 2*3;
+}
+
+
+
+
+void MasterPagesSelector::UpdateSelection (void)
+{
+}
+
+
+
+
+void MasterPagesSelector::SetItem (
+    sal_uInt16 nIndex,
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    RemoveTokenToIndexEntry(nIndex,aToken);
+
+    if (nIndex > 0)
+    {
+        if (aToken != MasterPageContainer::NIL_TOKEN)
+        {
+            Image aPreview (mpContainer->GetPreviewForToken(aToken));
+            MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken));
+
+            if (aPreview.GetSizePixel().Width()>0)
+            {
+                if (PreviewValueSet::GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND)
+                {
+                    PreviewValueSet::SetItemImage(nIndex,aPreview);
+                    PreviewValueSet::SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken));
+                }
+                else
+                {
+                    PreviewValueSet::InsertItem (
+                        nIndex,
+                        aPreview,
+                        mpContainer->GetPageNameForToken(aToken),
+                        nIndex);
+                }
+                SetUserData(nIndex, CreateUserData(nIndex,aToken));
+
+                AddTokenToIndexEntry(nIndex,aToken);
+            }
+
+            if (eState == MasterPageContainer::PS_CREATABLE)
+                mpContainer->RequestPreview(aToken);
+        }
+        else
+        {
+            PreviewValueSet::RemoveItem(nIndex);
+        }
+    }
+  
+}
+
+
+
+
+void MasterPagesSelector::AddTokenToIndexEntry (
+    sal_uInt16 nIndex,
+    MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    maTokenToValueSetIndex[aToken] = nIndex;
+}
+
+
+
+
+void MasterPagesSelector::RemoveTokenToIndexEntry (
+    sal_uInt16 nIndex,
+    MasterPageContainer::Token aNewToken)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    UserData* pData = GetUserData(nIndex);
+    if (pData != NULL)
+    {
+        // Get the token that the index pointed to previously.
+        MasterPageContainer::Token aOldToken (pData->second);
+
+        if (aNewToken != aOldToken
+            && nIndex == GetIndexForToken(aOldToken))
+        {
+            maTokenToValueSetIndex[aOldToken] = 0;
+        }
+    }
+}
+
+
+
+
+void MasterPagesSelector::InvalidatePreview (const SdPage* pPage)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++)
+    {
+        UserData* pData = GetUserData(nIndex);
+        if (pData != NULL)
+        {
+            MasterPageContainer::Token aToken (pData->second);
+            if (pPage == mpContainer->GetPageObjectForToken(aToken,false))
+            {
+                mpContainer->InvalidatePreview(aToken);
+                mpContainer->RequestPreview(aToken);
+                break;
+            }
+        }
+    }
+}
+
+void MasterPagesSelector::UpdateAllPreviews (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+    
+    for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++)
+    {
+        UserData* pData = GetUserData(nIndex);
+        if (pData != NULL)
+        {
+            MasterPageContainer::Token aToken (pData->second);
+            PreviewValueSet::SetItemImage(
+                nIndex,
+                mpContainer->GetPreviewForToken(aToken));
+            if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE)
+                mpContainer->RequestPreview(aToken);
+        }
+    }
+    PreviewValueSet::Rearrange(true);
+}
+
+
+
+
+void MasterPagesSelector::ClearPageSet (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++)
+    {
+        UserData* pData = GetUserData(nIndex);
+        if (pData != NULL)
+            delete pData;
+    }
+    PreviewValueSet::Clear();
+}
+
+
+
+
+void MasterPagesSelector::SetHelpId( const rtl::OString& aId )
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+	PreviewValueSet::SetHelpId( aId );
+}
+
+
+
+
+sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    TokenToValueSetIndex::const_iterator iIndex (maTokenToValueSetIndex.find(aToken));
+    if (iIndex != maTokenToValueSetIndex.end())
+        return iIndex->second;
+    else
+        return -1;
+}
+
+
+
+
+void MasterPagesSelector::Clear (void)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    ClearPageSet();
+}
+
+
+
+
+void MasterPagesSelector::InvalidateItem (MasterPageContainer::Token aToken)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    ItemList::iterator iItem;
+    for (iItem=maCurrentItemList.begin(); iItem!=maCurrentItemList.end(); ++iItem)
+    {
+        if (*iItem == aToken)
+        {
+            *iItem = MasterPageContainer::NIL_TOKEN;
+            break;
+        }
+    }
+}
+
+
+
+
+void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList)
+{
+    const ::osl::MutexGuard aGuard (maMutex);
+
+    ItemList::const_iterator iNewItem (pNewItemList->begin());
+    ItemList::const_iterator iCurrentItem (maCurrentItemList.begin());
+    ItemList::const_iterator iNewEnd (pNewItemList->end());
+    ItemList::const_iterator iCurrentEnd (maCurrentItemList.end());
+    sal_uInt16 nIndex (1);
+
+    // Update existing items.
+    for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex)
+    {
+        if (*iNewItem != *iCurrentItem)
+        {
+            SetItem(nIndex,*iNewItem);
+        }
+    }
+    
+    // Append new items.
+    for ( ; iNewItem!=iNewEnd; ++iNewItem,++nIndex)
+    {
+        SetItem(nIndex,*iNewItem);
+    }
+    
+    // Remove trailing items.
+    for ( ; iCurrentItem!=iCurrentEnd; ++iCurrentItem,++nIndex)
+    {
+        SetItem(nIndex,MasterPageContainer::NIL_TOKEN);
+    }
+
+    maCurrentItemList.swap(*pNewItemList);
+    
+    PreviewValueSet::Rearrange();
+    if (mxSidebar.is())
+        mxSidebar->requestLayout();
+}
+
+
+
+
+css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    const sal_Int32 nHeight (GetPreferredHeight(nWidth));
+    return css::ui::LayoutSize(nHeight,nHeight,nHeight);
+}
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/MasterPagesSelector.hxx b/main/sd/source/ui/sidebar/MasterPagesSelector.hxx
new file mode 100644
index 0000000..6529c06
--- /dev/null
+++ b/main/sd/source/ui/sidebar/MasterPagesSelector.hxx
@@ -0,0 +1,242 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPageContainer.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "PreviewValueSet.hxx"
+#include "ISidebarReceiver.hxx"
+#include <sfx2/sidebar/ILayoutableWindow.hxx>
+
+#include "pres.hxx"
+#include <sfx2/shell.hxx>
+#include <vcl/image.hxx>
+#include "glob.hxx"
+#include <osl/mutex.hxx>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <queue>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+class MouseEvent;
+class SdDrawDocument;
+class SdPage;
+class SfxModule;
+
+namespace sd { 
+class DrawViewShell;
+class TemplateEntry;
+class TemplateDir;
+class ViewShellBase;
+}
+
+namespace sd { namespace sidebar {
+
+class PreviewValueSet;
+class SidebarShellManager;
+
+
+/** Base class of a menu that lets the user select from a list of
+    templates or designs that are loaded from files.
+*/
+class MasterPagesSelector
+    : public PreviewValueSet,
+      public sfx2::sidebar::ILayoutableWindow
+{
+public:
+    MasterPagesSelector (
+        ::Window* pParent,
+        SdDrawDocument& rDocument,
+        ViewShellBase& rBase,
+        const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~MasterPagesSelector (void);
+
+    virtual void LateInit (void);
+
+    /** Return the height that this control needs to show all of its lines.
+    */
+    long GetRequiredHeight (int nWidth) const;
+
+    /** The given master page, either the master page of a slide or a notes
+        page, is cloned and inserted into mrDocument.  The necessary styles
+        are copied as well.
+    */
+    static SdPage* AddMasterPage (
+        SdDrawDocument* pTargetDocument,
+        SdPage* pMasterPage,
+        sal_uInt16 nInsertionIndex);
+
+    virtual Size GetPreferredSize (void);
+    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+    virtual bool IsResizable (void);
+    virtual ::Window* GetWindow (void);
+    virtual sal_Int32 GetMinimumWidth (void);
+
+    /** Update the selection of previews according to whatever
+        influences them appart from mouse and keyboard.  If, for
+        example, the current page of the main pane changes, then call
+        this method at the CurrentMasterPagesSelector to select the
+        previews of the master pages that are assigned to the new
+        current page.
+
+        The default implementation of this method ignores the call. This is
+        used by e.g. the RecentMasterPagesSelector because it does not show
+        the currently used master pages by default and thus is not
+        influenced by its changes.
+    */
+    virtual void UpdateSelection (void);
+
+    void FillPageSet (void);
+
+    /** Make the selector empty.  This method clear the value set from any
+        entries. Overload this method to add functionality, especially to
+        destroy objects set as data items at the value set.
+    */
+    void ClearPageSet (void);
+
+	void SetHelpId( const rtl::OString& aId );
+
+    /** Mark the preview that belongs to the given index as not up-to-date
+        anymore with respect to page content or preview size.
+        The implementation of this method will either sunchronously or
+        asynchronously call UpdatePreview().
+        @param nIndex
+            Index into the value set control that is used for displaying the
+            previews.
+    */
+    void InvalidatePreview (const SdPage* pPage);
+
+    void UpdateAllPreviews (void);
+
+    // ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+protected:
+    mutable ::osl::Mutex maMutex;
+    ::boost::shared_ptr<MasterPageContainer> mpContainer;
+
+    SdDrawDocument& mrDocument;
+    bool mbSmallPreviewSize;
+    ViewShellBase& mrBase;
+    /** Slot that is executed as default action when the left mouse button is
+        clicked over a master page.
+    */
+	sal_uInt16 mnDefaultClickAction;
+    /** Pages with pointers in this queue have their previews updated
+        eventually.  Filled by InvalidatePreview() and operated upon by
+        UpdatePreviews(). 
+    */
+    ::std::queue<sal_uInt16> maPreviewUpdateQueue;
+
+    virtual SdPage* GetSelectedMasterPage (void);
+
+    /** Assign the given master page to all slides of the document.
+        @param pMasterPage
+            The master page to assign to all slides.
+    */
+    void AssignMasterPageToAllSlides (SdPage* pMasterPage);
+
+    /** Assign the given master page to all slides that are selected in a
+        slide sorter that is displayed in the lef or center pane.  When both
+        panes display a slide sorter then the one in the center pane is
+        used.
+    */
+    void AssignMasterPageToSelectedSlides (SdPage* pMasterPage);
+
+    virtual void AssignMasterPageToPageList (
+        SdPage* pMasterPage,
+        const ::sd::slidesorter::SharedPageSelection& rPageList);
+
+    virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
+
+    typedef ::std::pair<int, MasterPageContainer::Token> UserData;
+    UserData* CreateUserData (int nIndex, MasterPageContainer::Token aToken) const;
+    UserData* GetUserData (int nIndex) const;
+    void SetUserData (int nIndex, UserData* pData);
+
+    virtual sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const;
+    typedef ::std::vector<MasterPageContainer::Token> ItemList;
+    void UpdateItemList (::std::auto_ptr<ItemList> pList);
+    void Clear (void);
+    /** Invalidate the specified item so that on the next Fill() this item
+        is updated.
+    */
+    void InvalidateItem (MasterPageContainer::Token aToken);
+
+    // For every item in the ValueSet we store its associated token.  This
+    // allows a faster access and easier change tracking.
+    ItemList maCurrentItemList;
+    typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex;
+    TokenToValueSetIndex maTokenToValueSetIndex;
+
+    ItemList maLockedMasterPages;
+    /** Lock master pages in the given list and release locks that where
+        previously aquired.
+    */
+    void UpdateLocks (const ItemList& rItemList);
+
+    void Fill (void);
+    virtual void Fill (ItemList& rItemList) = 0;
+
+    /** Give derived classes the oportunity to provide their own context
+        menu.  If they do then they probably have to provide their own
+        Execute() and GetState() methods as well.
+    */
+    virtual ResId GetContextMenuResId (void) const;
+
+    virtual void Command (const CommandEvent& rEvent);
+
+    virtual void ProcessPopupMenu (Menu& rMenu);
+    virtual void ExecuteCommand (const sal_Int32 nCommandId);
+
+private:
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+
+    /** The offset between ValueSet index and MasterPageContainer::Token
+        last seen.  This value is used heuristically to speed up the lookup
+        of an index for a token.
+    */
+    DECL_LINK(ClickHandler, PreviewValueSet*);
+    DECL_LINK(RightClickHandler, MouseEvent*);
+    DECL_LINK(ContextMenuCallback, CommandEvent*);
+    DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*);
+    DECL_LINK(OnMenuItemSelected, Menu*);
+    
+    void SetItem (
+        sal_uInt16 nIndex,
+        MasterPageContainer::Token aToken);
+    void AddTokenToIndexEntry (
+        sal_uInt16 nIndex,
+        MasterPageContainer::Token aToken);
+    void RemoveTokenToIndexEntry (
+        sal_uInt16 nIndex,
+        MasterPageContainer::Token aToken);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/NavigatorWrapper.cxx b/main/sd/source/ui/sidebar/NavigatorWrapper.cxx
new file mode 100644
index 0000000..b7e65be
--- /dev/null
+++ b/main/sd/source/ui/sidebar/NavigatorWrapper.cxx
@@ -0,0 +1,89 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "NavigatorWrapper.hxx"
+#include "navigatr.hrc"
+#include "ViewShellBase.hxx"
+
+#include <sfx2/sidebar/Theme.hxx>
+
+#include <boost/bind.hpp>
+
+
+namespace sd { namespace sidebar {
+
+NavigatorWrapper::NavigatorWrapper (
+    ::Window* pParent,
+    sd::ViewShellBase& rViewShellBase,
+    SfxBindings* pBindings)
+    : Control(pParent, 0),
+      mrViewShellBase(rViewShellBase),
+      maNavigator(
+        this,
+        NULL,
+        SdResId(FLT_NAVIGATOR),
+        pBindings,
+        ::boost::bind(&NavigatorWrapper::UpdateNavigator, this))
+{
+    maNavigator.SetPosSizePixel(
+        Point(0,0),
+        GetSizePixel());
+    maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+    maNavigator.Show();
+}
+
+
+
+
+NavigatorWrapper::~NavigatorWrapper (void)
+{
+}
+
+
+
+
+void NavigatorWrapper::Resize (void)
+{
+    maNavigator.SetSizePixel(GetSizePixel());
+}
+
+
+
+
+css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    (void)nWidth;
+    
+    return css::ui::LayoutSize(-1,-1,-1);
+}
+
+
+
+
+void NavigatorWrapper::UpdateNavigator (void)
+{
+    maNavigator.InitTreeLB(mrViewShellBase.GetDocument());
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/NavigatorWrapper.hxx b/main/sd/source/ui/sidebar/NavigatorWrapper.hxx
new file mode 100644
index 0000000..e544c24
--- /dev/null
+++ b/main/sd/source/ui/sidebar/NavigatorWrapper.hxx
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX
+#define SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX
+
+#include <sfx2/sidebar/ILayoutableWindow.hxx>
+#include <vcl/ctrl.hxx>
+#include "navigatr.hxx"
+
+
+class SfxBindings;
+namespace sd { class ViewShellBase; }
+
+namespace css = ::com::sun::star;
+
+namespace sd { namespace sidebar {
+
+/** Present the navigator as control that can be displayed inside the
+    sidebar.
+    This wrapper has two main responsibilities:
+    - Watch for document changes and update the navigator when one
+    happens.
+    - Forward size changes from sidebar to navigator.
+*/
+class NavigatorWrapper
+    : public Control,
+      public sfx2::sidebar::ILayoutableWindow
+{
+public:
+    NavigatorWrapper (
+        ::Window* pParent,
+        sd::ViewShellBase& rViewShellBase,
+        SfxBindings* pBindings);
+
+    virtual ~NavigatorWrapper (void);
+
+    // Control
+    virtual void Resize (void);
+
+    // From ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+private:
+    ViewShellBase& mrViewShellBase;
+    SdNavigatorWin maNavigator;
+
+    void UpdateNavigator (void);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/PanelBase.cxx b/main/sd/source/ui/sidebar/PanelBase.cxx
new file mode 100644
index 0000000..211e8b4
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PanelBase.cxx
@@ -0,0 +1,130 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "TableDesignPanel.hxx"
+
+
+
+namespace sd { namespace sidebar {
+
+
+PanelBase::PanelBase (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+    : Control(pParentWindow),
+      mpWrappedControl(NULL),
+      mxSidebar(),
+      mrViewShellBase(rViewShellBase)
+{
+    OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow);
+
+#ifdef DEBUG
+    SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase")));
+#endif
+}
+
+
+
+
+PanelBase::~PanelBase (void)
+{
+    OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get());
+    mpWrappedControl.reset();
+    OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent());
+}
+
+
+
+
+
+void PanelBase::Dispose (void)
+{
+    OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get());
+    mpWrappedControl.reset();
+}
+
+
+
+
+css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    sal_Int32 nHeight (0);
+    if (ProvideWrappedControl())
+        nHeight = mpWrappedControl->GetSizePixel().Height();
+    return css::ui::LayoutSize(nHeight,nHeight,nHeight);
+}
+
+
+
+
+void PanelBase::Resize (void)
+{
+    if (ProvideWrappedControl())
+    {
+        Size aNewSize (GetSizePixel());
+        mpWrappedControl->SetOutputSizePixel(aNewSize);
+    }
+}
+
+
+
+
+::com::sun::star::uno::Reference<
+    ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
+        const ::com::sun::star::uno::Reference<
+        ::com::sun::star::accessibility::XAccessible>& )
+{
+    if (ProvideWrappedControl())
+        return mpWrappedControl->GetAccessible();
+    else
+        return NULL;
+}
+
+
+
+
+void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    mxSidebar = rxSidebar;
+    if (mxSidebar.is() && mpWrappedControl!=NULL)
+        mxSidebar->requestLayout();
+}
+
+
+
+
+bool PanelBase::ProvideWrappedControl (void)
+{
+    if ( ! mpWrappedControl)
+    {
+        mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
+        OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this);
+        if (mpWrappedControl)
+            mpWrappedControl->Show();
+        if (mxSidebar.is())
+            mxSidebar->requestLayout();
+    }
+    return mpWrappedControl.get() != NULL;
+}
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/PanelBase.hxx b/main/sd/source/ui/sidebar/PanelBase.hxx
new file mode 100644
index 0000000..5a6e509
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PanelBase.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_PANEL_BASE_HXX
+#define SD_SIDEBAR_PANELS_PANEL_BASE_HXX
+
+#include "IDisposable.hxx"
+#include "ISidebarReceiver.hxx"
+#include <sfx2/sidebar/ILayoutableWindow.hxx>
+
+#include <vcl/ctrl.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sd {
+    class ViewShellBase;
+}
+
+
+
+
+namespace sd { namespace sidebar {
+
+
+class PanelBase
+    : public Control,
+      public sfx2::sidebar::ILayoutableWindow,
+      public IDisposable,
+      public ISidebarReceiver
+{
+public:
+    PanelBase (
+        ::Window* pParentWindow,
+        ViewShellBase& rViewShellBase);
+    virtual ~PanelBase (void);
+
+    virtual void Resize (void);
+
+    // IDisposable
+    virtual void Dispose (void);
+    
+    // ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+    // ISidebarReceiver
+    virtual void SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+    virtual ::com::sun::star::uno::Reference<
+        ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
+            const ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>& rxParent);
+
+protected:
+    ::boost::scoped_ptr< ::Window> mpWrappedControl;
+    virtual ::Window* CreateWrappedControl (
+        ::Window* pParentWindow,
+        ViewShellBase& rViewShellBase) = 0;
+
+private:
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+    ViewShellBase& mrViewShellBase;
+
+    bool ProvideWrappedControl (void);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/PanelFactory.cxx b/main/sd/source/ui/sidebar/PanelFactory.cxx
new file mode 100644
index 0000000..c154478
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PanelFactory.cxx
@@ -0,0 +1,212 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "PanelFactory.hxx"
+#include "framework/Pane.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawController.hxx"
+#include "LayoutMenu.hxx"
+#include "CurrentMasterPagesSelector.hxx"
+#include "RecentMasterPagesSelector.hxx"
+#include "AllMasterPagesSelector.hxx"
+#include "CustomAnimationPanel.hxx"
+#include "SlideTransitionPanel.hxx"
+#include "NavigatorWrapper.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+using namespace css;
+using namespace cssu;
+using namespace ::sd::framework;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd {
+	extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase);
+}
+
+namespace sd { namespace sidebar {
+
+namespace {
+    /** Note that these names have to be identical to (the tail of)
+        the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu
+        for the TaskPanelFactory.
+    */
+    const static char* gsResourceNameCustomAnimations = "/CustomAnimations";
+    const static char* gsResourceNameLayouts = "/Layouts";
+    const static char* gsResourceNameAllMasterPages = "/AllMasterPages";
+    const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages";
+    const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages";
+    const static char* gsResourceNameSlideTransitions = "/SlideTransitions";
+    const static char* gsResourceNameTableDesign = "/TableDesign";
+    const static char* gsResourceNameNavigator = "/NavigatorPanel";
+}
+
+Reference<lang::XEventListener> mxControllerDisposeListener;
+
+
+
+// ----- Service functions ----------------------------------------------------
+
+Reference<XInterface> SAL_CALL PanelFactory_createInstance (
+    const Reference<XComponentContext>& rxContext)
+{
+    return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString PanelFactory_getImplementationName (void) throw(RuntimeException)
+{
+    return ::rtl::OUString(
+        RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.PanelFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void)
+    throw (RuntimeException)
+{
+	static const ::rtl::OUString sServiceName(
+        ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.PanelFactory"));
+	return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//----- PanelFactory --------------------------------------------------------
+
+PanelFactory::PanelFactory(
+        const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+    : PanelFactoryInterfaceBase(m_aMutex)
+{
+}
+
+
+
+
+PanelFactory::~PanelFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL PanelFactory::disposing (void)
+{
+}
+
+
+
+
+// XUIElementFactory
+
+Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
+    const ::rtl::OUString& rsUIElementResourceURL,
+    const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        css::container::NoSuchElementException,
+        css::lang::IllegalArgumentException,
+        cssu::RuntimeException)
+{
+    // Process arguments.
+    const ::comphelper::NamedValueCollection aArguments (rArguments);
+    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+    Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
+
+    // Throw exceptions when the arguments are not as expected.
+    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( ! xParentWindow.is() || pParentWindow==NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without ParentWindow"),
+            NULL);
+    if ( ! xFrame.is())
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without XFrame"),
+            NULL);
+
+    // Tunnel through the controller to obtain a ViewShellBase.
+    ViewShellBase* pBase = NULL;
+    Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY);
+    if (xTunnel.is())
+    {
+        ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+            xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+        if (pController != NULL)
+            pBase = pController->GetViewShellBase();
+    }
+    if (pBase == NULL)
+        throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL);
+
+    // Get bindings from given arguments.
+    const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+    // Create a framework view.
+    ::Window* pControl = NULL;
+    css::ui::LayoutSize aLayoutSize (-1,-1,-1);
+    
+#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
+    if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
+        pControl = new CustomAnimationPanel(pParentWindow, *pBase);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
+        pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages))
+        pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages))
+        pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
+        pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
+        pControl = new SlideTransitionPanel(pParentWindow, *pBase);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
+        pControl = createTableDesignPanel(pParentWindow, *pBase);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator))
+        pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings);
+#undef EndsWith
+
+    if (pControl == NULL)
+        throw lang::IllegalArgumentException();
+
+    // Create a wrapper around the control that implements the
+    // necessary UNO interfaces.
+    return sfx2::sidebar::SidebarPanelBase::Create(
+        rsUIElementResourceURL,
+        xFrame,
+        pControl,
+        aLayoutSize);
+}
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/PanelFactory.hxx b/main/sd/source/ui/sidebar/PanelFactory.hxx
new file mode 100644
index 0000000..a2d31eb
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PanelFactory.hxx
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANEL_FACTORY_HXX
+#define SD_SIDEBAR_PANEL_FACTORY_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <rtl/ref.hxx>
+#include "framework/Pane.hxx"
+
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <map>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sd {
+    class ViewShellBase;
+}
+
+namespace sd { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::ui::XUIElementFactory
+        > PanelFactoryInterfaceBase;
+}
+
+
+class PanelFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public PanelFactoryInterfaceBase
+{
+public:
+    static ::rtl::OUString SAL_CALL getImplementationName (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL createInstance (
+        const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+    static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void);
+
+    PanelFactory (const cssu::Reference<cssu::XComponentContext>& rxContext);
+    virtual ~PanelFactory (void);
+
+    virtual void SAL_CALL disposing (void);
+
+
+    // XUIElementFactory
+
+    cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
+        const ::rtl::OUString& rsResourceURL,
+        const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/PreviewValueSet.cxx b/main/sd/source/ui/sidebar/PreviewValueSet.cxx
new file mode 100644
index 0000000..651eb2a
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PreviewValueSet.cxx
@@ -0,0 +1,185 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "PreviewValueSet.hxx"
+#include <vcl/image.hxx>
+
+
+namespace sd { namespace sidebar {
+
+
+PreviewValueSet::PreviewValueSet (::Window* pParent)
+    : ValueSet (pParent, WB_TABSTOP),
+      maPreviewSize(10,10),
+      mnBorderWidth(3),
+      mnBorderHeight(3),
+      mnMaxColumnCount(-1)
+{
+	SetStyle (
+        GetStyle() 
+        & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET)
+        //        | WB_FLATVALUESET);
+        );
+	SetColCount(2);
+	SetExtraSpacing (2);
+}
+
+
+
+
+PreviewValueSet::~PreviewValueSet (void)
+{
+}
+
+
+
+
+void PreviewValueSet::SetPreviewSize (const Size& rSize)
+{
+    maPreviewSize = rSize;
+}
+
+
+
+
+void PreviewValueSet::SetRightMouseClickHandler (const Link& rLink)
+{
+    maRightMouseClickHandler = rLink;
+}
+
+
+
+
+void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent)
+{
+    if (rEvent.IsRight())
+        maRightMouseClickHandler.Call(reinterpret_cast<void*>(
+            &const_cast<MouseEvent&>(rEvent)));
+    else
+        ValueSet::MouseButtonDown (rEvent);
+
+}
+
+
+
+
+void PreviewValueSet::Resize (void)
+{
+    ValueSet::Resize ();
+
+    Size aWindowSize (GetOutputSizePixel());
+    if (aWindowSize.Width()>0 && aWindowSize.Height()>0)
+    {
+        Rearrange();
+    }
+}
+
+
+
+
+void PreviewValueSet::Rearrange (bool bForceRequestResize)
+{
+    sal_uInt16 nOldColumnCount (GetColCount());
+    sal_uInt16 nOldRowCount (GetLineCount());
+
+    sal_uInt16 nNewColumnCount (CalculateColumnCount (
+        GetOutputSizePixel().Width()));
+    sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount));
+
+    SetColCount(nNewColumnCount);
+    SetLineCount(nNewRowCount);
+}
+
+
+
+
+sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
+{
+    int nColumnCount = 0;
+    if (nWidth > 0)
+    {
+        nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth);
+        if (nColumnCount < 1)
+            nColumnCount = 1;
+        else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
+            nColumnCount = mnMaxColumnCount;
+    }
+    return (sal_uInt16)nColumnCount;
+}
+
+
+
+
+sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const
+{
+    int nRowCount = 0;
+    int nItemCount = GetItemCount();
+    if (nColumnCount > 0)
+    {
+        nRowCount = (nItemCount+nColumnCount-1) / nColumnCount;
+        if (nRowCount < 1)
+            nRowCount = 1;
+    }
+
+    return (sal_uInt16)nRowCount;
+}
+
+
+
+
+sal_Int32 PreviewValueSet::GetPreferredWidth (sal_Int32 nHeight)
+{
+    int nPreferredWidth (maPreviewSize.Width() + 2*mnBorderWidth);
+
+    // Get height of each row.
+    int nItemHeight (maPreviewSize.Height() + 2*mnBorderHeight);
+
+    // Calculate the row- and column count and from the later the preferred
+    // width.
+    int nRowCount = nHeight / nItemHeight;
+    if (nRowCount > 0)
+    {
+        int nColumnCount = (GetItemCount()+nRowCount-1) / nRowCount;
+        if (nColumnCount > 0)
+            nPreferredWidth = (maPreviewSize.Width() + 2*mnBorderWidth) 
+                * nColumnCount;
+    }
+
+    return nPreferredWidth;
+}
+
+
+
+
+sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth)
+{
+    int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth)));
+    int nItemHeight (maPreviewSize.Height());
+    
+    return nRowCount * (nItemHeight + 2*mnBorderHeight);
+}
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/PreviewValueSet.hxx b/main/sd/source/ui/sidebar/PreviewValueSet.hxx
new file mode 100644
index 0000000..419b8cc
--- /dev/null
+++ b/main/sd/source/ui/sidebar/PreviewValueSet.hxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX
+#define SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX
+
+#include <svtools/valueset.hxx>
+
+
+namespace sd { namespace sidebar {
+
+
+/** Adapt the svtools valueset to the needs of the master page controlls.
+*/
+class PreviewValueSet
+    : public ValueSet
+{
+public:
+    PreviewValueSet (::Window* pParent);
+    ~PreviewValueSet (void);
+
+	void SetRightMouseClickHandler (const Link& rLink);
+    virtual void Resize (void);
+    
+    void SetPreviewSize (const Size& rSize);
+
+    sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
+    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+
+    /** Set the number of rows and columns according to the current number
+        of items.  Call this method when new items have been inserted.
+    */
+    void Rearrange (bool bForceRequestResize = false);
+
+protected:
+    virtual void MouseButtonDown (const MouseEvent& rEvent);
+
+private:
+    Link maRightMouseClickHandler;
+    Size maPreviewSize;
+    const int mnBorderWidth;
+    const int mnBorderHeight;
+    const int mnMaxColumnCount;
+    
+    sal_uInt16 CalculateColumnCount (int nWidth) const;
+    sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
new file mode 100644
index 0000000..2a37ef2
--- /dev/null
+++ b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
@@ -0,0 +1,181 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "RecentMasterPagesSelector.hxx"
+
+#include "ViewShellBase.hxx"
+#include "RecentlyUsedMasterPages.hxx"
+#include "MasterPageContainerProviders.hxx"
+#include "MasterPageObserver.hxx"
+#include "SidebarShellManager.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include "helpids.h"
+
+#include <vcl/bitmap.hxx>
+#include <tools/color.hxx>
+
+namespace sd { namespace sidebar {
+
+
+MasterPagesSelector* RecentMasterPagesSelector::Create (
+    ::Window* pParent,
+    ViewShellBase& rViewShellBase,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    SdDrawDocument* pDocument = rViewShellBase.GetDocument();
+    if (pDocument == NULL)
+        return NULL;
+
+    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
+    
+    MasterPagesSelector* pSelector(
+        new RecentMasterPagesSelector (
+            pParent, 
+            *pDocument,
+            rViewShellBase,
+            pContainer,
+            rxSidebar));
+    pSelector->LateInit();
+    pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT);
+
+    return pSelector;
+}
+
+
+
+
+RecentMasterPagesSelector::RecentMasterPagesSelector (
+    ::Window* pParent,
+    SdDrawDocument& rDocument,
+    ViewShellBase& rBase,
+    const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar)
+{
+}
+
+
+
+
+RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
+{
+    RecentlyUsedMasterPages::Instance().RemoveEventListener (
+        LINK(this,RecentMasterPagesSelector,MasterPageListListener));
+}
+
+
+
+
+void RecentMasterPagesSelector::LateInit (void)
+{
+    MasterPagesSelector::LateInit();
+
+    MasterPagesSelector::Fill();
+    RecentlyUsedMasterPages::Instance().AddEventListener (
+        LINK(this,RecentMasterPagesSelector,MasterPageListListener));
+}
+
+
+
+
+IMPL_LINK(RecentMasterPagesSelector,MasterPageListListener, void*, EMPTYARG)
+{
+    MasterPagesSelector::Fill();
+    return 0;
+}
+
+
+
+
+void RecentMasterPagesSelector::Fill (ItemList& rItemList)
+{
+    // Create a set of names of the master pages used by the document.
+    MasterPageObserver::MasterPageNameSet aCurrentNames;
+    sal_uInt16 nMasterPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
+    sal_uInt16 nIndex;
+    for (nIndex=0; nIndex<nMasterPageCount; nIndex++)
+    {
+        SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
+        if (pMasterPage != NULL)
+            aCurrentNames.insert (pMasterPage->GetName());
+    }
+    MasterPageObserver::MasterPageNameSet::iterator aI;
+
+    // Insert the recently used master pages that are currently not used.
+    RecentlyUsedMasterPages& rInstance (RecentlyUsedMasterPages::Instance());
+    int nPageCount = rInstance.GetMasterPageCount();
+    for (nIndex=0; nIndex<nPageCount; nIndex++)
+    {
+        // Add an entry when a) the page is already known to the
+        // MasterPageContainer, b) the style name is empty, i.e. it has not yet
+        // been loaded (and thus can not be in use) or otherwise c) the
+        // style name is not currently in use.
+        MasterPageContainer::Token aToken (rInstance.GetTokenForIndex(nIndex));
+        if (aToken != MasterPageContainer::NIL_TOKEN)
+        {
+            String sStyleName (mpContainer->GetStyleNameForToken(aToken));
+            if (sStyleName.Len()==0 
+                || aCurrentNames.find(sStyleName) == aCurrentNames.end())
+            {
+                rItemList.push_back(aToken);
+            }
+        }
+    }
+}
+
+
+
+
+void RecentMasterPagesSelector::AssignMasterPageToPageList (
+    SdPage* pMasterPage,
+    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
+{
+	sal_uInt16 nSelectedItemId = PreviewValueSet::GetSelectItemId();
+    
+    MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList);
+
+    // Restore the selection.
+    if (PreviewValueSet::GetItemCount() > 0)
+    {
+        if (PreviewValueSet::GetItemCount() >= nSelectedItemId)
+            PreviewValueSet::SelectItem(nSelectedItemId);
+        else
+            PreviewValueSet::SelectItem(PreviewValueSet::GetItemCount());
+    }
+}
+
+
+
+
+void RecentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu)
+{
+    if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND)
+        rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False);
+}
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
new file mode 100644
index 0000000..50f8f3a
--- /dev/null
+++ b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
@@ -0,0 +1,79 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX
+#define SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX
+
+#include "MasterPagesSelector.hxx"
+
+namespace sd { namespace sidebar {
+
+
+/** Show the recently used master pages (that are not currently used).
+*/
+class RecentMasterPagesSelector
+    : public MasterPagesSelector
+{
+public:
+    static MasterPagesSelector* Create (
+        ::Window* pParent,
+        ViewShellBase& rViewShellBase,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+protected:
+    DECL_LINK(MasterPageListListener, void*);
+    virtual void Fill (ItemList& rItemList);
+
+	using sd::sidebar::MasterPagesSelector::Fill;
+
+    /** Forward this call to the base class but save and restore the
+        currently selected item.
+        Assign the given master page to the list of pages.
+        @param pMasterPage
+            This master page will usually be a member of the list of all
+            available master pages as provided by the MasterPageContainer.
+        @param rPageList
+            The pages to which to assign the master page.  These pages may
+            be slides or master pages themselves.
+    */
+    virtual void AssignMasterPageToPageList (
+        SdPage* pMasterPage,
+        const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
+
+    virtual void ProcessPopupMenu (Menu& rMenu);
+
+private:
+    RecentMasterPagesSelector (
+        ::Window* pParent, 
+        SdDrawDocument& rDocument,
+        ViewShellBase& rBase,
+        const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~RecentMasterPagesSelector (void);
+
+    virtual void LateInit (void);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx
new file mode 100644
index 0000000..e9bcd8e
--- /dev/null
+++ b/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx
@@ -0,0 +1,494 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "RecentlyUsedMasterPages.hxx"
+#include "MasterPageObserver.hxx"
+#include "MasterPagesSelector.hxx"
+#include "MasterPageDescriptor.hxx"
+#include "tools/ConfigurationAccess.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+
+#include <algorithm>
+#include <vector>
+
+#include <comphelper/processfactory.hxx>
+#include "unomodel.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <tools/urlobj.hxx>
+#include <unotools/confignode.hxx>
+#include <osl/doublecheckedlocking.h>
+#include <osl/getglobalmutex.hxx>
+
+using namespace ::std;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace {
+
+static const OUString& GetPathToImpressConfigurationRoot (void)
+{
+    static const OUString sPathToImpressConfigurationRoot (
+        RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/"));
+    return sPathToImpressConfigurationRoot;
+}
+static const OUString& GetPathToSetNode (void)
+{
+    static const OUString sPathToSetNode(
+        RTL_CONSTASCII_USTRINGPARAM(
+            "MultiPaneGUI/ToolPanel/RecentlyUsedMasterPages"));
+    return sPathToSetNode;
+}
+
+
+class Descriptor
+{
+public:
+    ::rtl::OUString msURL;
+    ::rtl::OUString msName;
+    ::sd::sidebar::MasterPageContainer::Token maToken;
+    Descriptor (const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
+        : msURL(rsURL),
+          msName(rsName),
+          maToken(::sd::sidebar::MasterPageContainer::NIL_TOKEN)
+    {}
+    Descriptor (::sd::sidebar::MasterPageContainer::Token aToken,
+        const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
+        : msURL(rsURL),
+          msName(rsName),
+          maToken(aToken)
+    {}
+    class TokenComparator
+    { public:
+        TokenComparator(::sd::sidebar::MasterPageContainer::Token aToken)
+            : maToken(aToken) {}
+        bool operator () (const Descriptor& rDescriptor)
+        { return maToken==rDescriptor.maToken; }
+    private: ::sd::sidebar::MasterPageContainer::Token maToken;
+    };
+};
+
+} // end of anonymous namespace
+
+
+
+
+namespace sd { namespace sidebar {
+
+class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor>
+{
+public:
+    MasterPageList (void) {}
+};
+
+
+RecentlyUsedMasterPages* RecentlyUsedMasterPages::mpInstance = NULL;
+
+
+RecentlyUsedMasterPages&  RecentlyUsedMasterPages::Instance (void)
+{
+    if (mpInstance == NULL)
+    {
+        ::osl::GetGlobalMutex aMutexFunctor;
+        ::osl::MutexGuard aGuard (aMutexFunctor());
+        if (mpInstance == NULL)
+        {
+            RecentlyUsedMasterPages* pInstance = new RecentlyUsedMasterPages();
+            pInstance->LateInit();
+            SdGlobalResourceContainer::Instance().AddResource (
+                ::std::auto_ptr<SdGlobalResource>(pInstance));
+            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+            mpInstance = pInstance;
+        }
+    }
+    else {
+        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+    }
+    
+    return *mpInstance;
+}
+
+
+
+
+RecentlyUsedMasterPages::RecentlyUsedMasterPages (void)
+    : maListeners(),
+      mpMasterPages(new MasterPageList()),
+      mnMaxListSize(8),
+      mpContainer(new MasterPageContainer())
+{
+}
+
+
+
+
+RecentlyUsedMasterPages::~RecentlyUsedMasterPages (void)
+{
+    Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
+    mpContainer->RemoveChangeListener(aLink);
+    
+    MasterPageObserver::Instance().RemoveEventListener(
+        LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
+}
+
+
+
+
+void RecentlyUsedMasterPages::LateInit (void)
+{
+    Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
+    mpContainer->AddChangeListener(aLink);
+    
+    LoadPersistentValues ();
+    MasterPageObserver::Instance().AddEventListener(
+        LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
+}
+
+
+
+
+void RecentlyUsedMasterPages::LoadPersistentValues (void)
+{
+    try
+    {
+        do
+        {
+            tools::ConfigurationAccess aConfiguration (
+                GetPathToImpressConfigurationRoot(),
+                tools::ConfigurationAccess::READ_ONLY);
+            Reference<container::XNameAccess> xSet (
+                aConfiguration.GetConfigurationNode(GetPathToSetNode()),
+                UNO_QUERY);
+            if ( ! xSet.is())
+                break;
+
+            const String sURLMemberName (OUString::createFromAscii("URL"));
+            const String sNameMemberName (OUString::createFromAscii("Name"));
+            OUString sURL;
+            OUString sName;
+
+            // Read the names and URLs of the master pages.
+            Sequence<OUString> aKeys (xSet->getElementNames());
+            mpMasterPages->clear();
+            mpMasterPages->reserve(aKeys.getLength());
+            for (int i=0; i<aKeys.getLength(); i++)
+            {
+                Reference<container::XNameAccess> xSetItem (
+                    xSet->getByName(aKeys[i]), UNO_QUERY);
+                if (xSetItem.is())
+                {
+                    Any aURL (xSetItem->getByName(sURLMemberName));
+                    Any aName (xSetItem->getByName(sNameMemberName));
+                    aURL >>= sURL;
+                    aName >>= sName;
+                    SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
+                        MasterPageContainer::TEMPLATE,
+                        -1,
+                        sURL,
+                        String(),
+                        sName,
+                        false,
+                        ::boost::shared_ptr<PageObjectProvider>(
+                            new TemplatePageObjectProvider(sURL)),
+                        ::boost::shared_ptr<PreviewProvider>(
+                            new TemplatePreviewProvider(sURL))));
+                    // For user supplied templates we use a different
+                    // preview provider: The preview in the document shows
+                    // not only shapes on the master page but also shapes on
+                    // the foreground.  This is misleading and therefore
+                    // these previews are discarded and created directly
+                    // from the page objects.
+                    if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
+                        pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
+                            new PagePreviewProvider());
+                    MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor));
+                    mpMasterPages->push_back(Descriptor(aToken,sURL,sName));
+                }
+            }
+
+            ResolveList();
+        }
+        while (false);
+    }
+    catch (Exception&)
+    {
+        // Ignore exception.
+    }
+}
+
+
+
+
+void RecentlyUsedMasterPages::SavePersistentValues (void)
+{
+    try
+    {
+        do
+        {
+            tools::ConfigurationAccess aConfiguration (
+                GetPathToImpressConfigurationRoot(),
+                tools::ConfigurationAccess::READ_WRITE);
+            Reference<container::XNameContainer> xSet (
+                aConfiguration.GetConfigurationNode(GetPathToSetNode()),
+                UNO_QUERY);
+            if ( ! xSet.is())
+                break;
+
+            // Clear the set.
+            Sequence<OUString> aKeys (xSet->getElementNames());
+            sal_Int32 i;
+            for (i=0; i<aKeys.getLength(); i++)
+                xSet->removeByName (aKeys[i]);
+
+            // Fill it with the URLs of this object.
+            const String sURLMemberName (OUString::createFromAscii("URL"));
+            const String sNameMemberName (OUString::createFromAscii("Name"));
+            Any aValue;
+            Reference<lang::XSingleServiceFactory> xChildFactory (
+                xSet, UNO_QUERY);
+            if ( ! xChildFactory.is())
+                break;
+            MasterPageList::const_iterator iDescriptor;
+            sal_Int32 nIndex(0);
+            for (iDescriptor=mpMasterPages->begin();
+                 iDescriptor!=mpMasterPages->end();
+                 ++iDescriptor,++nIndex)
+            {
+                // Create new child.
+                OUString sKey (OUString::createFromAscii("index_"));
+                sKey += OUString::valueOf(nIndex);
+                Reference<container::XNameReplace> xChild(
+                    xChildFactory->createInstance(), UNO_QUERY);
+                if (xChild.is())
+                {
+                    xSet->insertByName (sKey, makeAny(xChild));
+
+                    aValue <<= OUString(iDescriptor->msURL);
+                    xChild->replaceByName (sURLMemberName, aValue);
+
+                    aValue <<= OUString(iDescriptor->msName);
+                    xChild->replaceByName (sNameMemberName, aValue);
+                }
+            }
+
+            // Write the data back to disk.
+            aConfiguration.CommitChanges();
+        }
+        while (false);
+    }
+    catch (Exception&)
+    {
+        // Ignore exception.
+    }
+}
+
+
+
+
+void RecentlyUsedMasterPages::AddEventListener (const Link& rEventListener)
+{
+    if (::std::find (
+        maListeners.begin(),
+        maListeners.end(),
+        rEventListener) == maListeners.end())
+    {
+        maListeners.push_back (rEventListener);
+    }
+}
+
+
+
+
+void RecentlyUsedMasterPages::RemoveEventListener (const Link& rEventListener)
+{
+    maListeners.erase (
+        ::std::find (
+            maListeners.begin(),
+            maListeners.end(),
+            rEventListener));
+}
+
+
+
+
+int RecentlyUsedMasterPages::GetMasterPageCount (void) const
+{
+    return mpMasterPages->size();
+}
+
+
+
+
+MasterPageContainer::Token RecentlyUsedMasterPages::GetTokenForIndex (sal_uInt32 nIndex) const
+{
+    if(nIndex<mpMasterPages->size())
+        return (*mpMasterPages)[nIndex].maToken;
+    else
+        return MasterPageContainer::NIL_TOKEN;
+}
+
+
+
+
+void RecentlyUsedMasterPages::SendEvent (void)
+{
+    ::std::vector<Link>::iterator aLink (maListeners.begin());
+    ::std::vector<Link>::iterator aEnd (maListeners.end());
+    while (aLink!=aEnd)
+    {
+        aLink->Call (NULL);
+        ++aLink;
+    }
+}
+
+
+
+
+IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener,
+    MasterPageObserverEvent*, pEvent)
+{
+    switch (pEvent->meType)
+    {
+        case MasterPageObserverEvent::ET_MASTER_PAGE_ADDED:
+        case MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS:
+            AddMasterPage(
+                mpContainer->GetTokenForStyleName(pEvent->mrMasterPageName));
+            break;
+
+        case MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED:
+            // Do not change the list of recently master pages (the deleted
+            // page was recently used) but tell the listeners.  They may want
+            // to update their lists.
+            SendEvent();
+            break;
+    }
+    return 0;
+}
+
+
+
+
+IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener,
+    MasterPageContainerChangeEvent*, pEvent)
+{
+    if (pEvent != NULL)
+        switch (pEvent->meEventType)
+        {
+            case MasterPageContainerChangeEvent::CHILD_ADDED:
+            case MasterPageContainerChangeEvent::CHILD_REMOVED:
+            case MasterPageContainerChangeEvent::INDEX_CHANGED:
+            case MasterPageContainerChangeEvent::INDEXES_CHANGED:
+                ResolveList();
+                break;
+
+            default:
+                // Ignored.
+                break;
+        }
+    return 0;
+}
+
+
+
+
+void RecentlyUsedMasterPages::AddMasterPage (
+    MasterPageContainer::Token aToken,
+    bool bMakePersistent)
+{
+    // For the page to be inserted the token has to be valid and the page
+    // has to have a valid URL.  This excludes master pages that do not come
+    // from template files.
+    if (aToken != MasterPageContainer::NIL_TOKEN
+        && mpContainer->GetURLForToken(aToken).Len()>0)
+    {
+
+        MasterPageList::iterator aIterator (
+            ::std::find_if(mpMasterPages->begin(),mpMasterPages->end(),
+                Descriptor::TokenComparator(aToken)));
+        if (aIterator != mpMasterPages->end())
+        {
+            // When an entry for the given token already exists then remove
+            // it now and insert it later at the head of the list.
+            mpMasterPages->erase (aIterator);
+        }
+
+        mpMasterPages->insert(mpMasterPages->begin(),
+            Descriptor(
+                aToken,
+                mpContainer->GetURLForToken(aToken),
+                mpContainer->GetStyleNameForToken(aToken)));
+
+        // Shorten list to maximal size.
+        while (mpMasterPages->size() > mnMaxListSize)
+        {
+            mpMasterPages->pop_back ();
+        }
+
+        if (bMakePersistent)
+            SavePersistentValues ();
+        SendEvent();
+    }
+}
+
+
+
+
+void RecentlyUsedMasterPages::ResolveList (void)
+{
+    bool bNotify (false);
+
+    MasterPageList::iterator iDescriptor;
+    for (iDescriptor=mpMasterPages->begin(); iDescriptor!=mpMasterPages->end(); ++iDescriptor)
+    {
+        if (iDescriptor->maToken == MasterPageContainer::NIL_TOKEN)
+        {
+            MasterPageContainer::Token aToken (mpContainer->GetTokenForURL(iDescriptor->msURL));
+            iDescriptor->maToken = aToken;
+            if (aToken != MasterPageContainer::NIL_TOKEN)
+                bNotify = true;
+        }
+        else
+        {
+            if ( ! mpContainer->HasToken(iDescriptor->maToken))
+            {
+                iDescriptor->maToken = MasterPageContainer::NIL_TOKEN;
+                bNotify = true;
+            }
+        }
+    }
+
+    if (bNotify)
+        SendEvent();
+}
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx b/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx
new file mode 100644
index 0000000..b1d9736
--- /dev/null
+++ b/main/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx
@@ -0,0 +1,124 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX
+#define SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX
+
+#include "tools/SdGlobalResourceContainer.hxx"
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+#include <vcl/image.hxx>
+#include <vector>
+#include <tools/string.hxx>
+
+#include "DrawDocShell.hxx"
+#include "MasterPageContainer.hxx"
+#include <com/sun/star/uno/XInterface.hpp>
+
+class SdPage;
+
+namespace sd {
+class MasterPageObserverEvent;
+}
+
+
+namespace sd { namespace sidebar {
+
+/** This singleton holds a list of the most recently used master pages.
+*/
+class RecentlyUsedMasterPages
+    : public SdGlobalResource
+{
+public:
+    /** Return the single instance of this class.
+    */
+    static RecentlyUsedMasterPages& Instance (void);
+
+    void AddEventListener (const Link& rEventListener);
+    void RemoveEventListener (const Link& rEventListener);
+    
+    int GetMasterPageCount (void) const;
+    MasterPageContainer::Token GetTokenForIndex (sal_uInt32 nIndex) const;
+
+private:
+    /** The single instance of this class.  It is created on demand when
+        Instance() is called for the first time.
+    */
+    static RecentlyUsedMasterPages* mpInstance;
+
+    ::std::vector<Link> maListeners;
+
+    class MasterPageList;
+    ::std::auto_ptr<MasterPageList> mpMasterPages;
+    unsigned long int mnMaxListSize;
+    ::boost::shared_ptr<MasterPageContainer> mpContainer;
+    
+    RecentlyUsedMasterPages (void);
+    virtual ~RecentlyUsedMasterPages (void);
+
+    /** Call this method after a new object has been created.
+    */
+    void LateInit (void);
+
+    /// The copy constructor is not implemented.  Do not use!
+    RecentlyUsedMasterPages (const RecentlyUsedMasterPages&);
+
+    /// The assignment operator is not implemented.  Do not use!
+    RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&);
+
+    void SendEvent (void);
+    DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*);
+    DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*);
+
+    /** Add a descriptor for the specified master page to the end of the
+        list of most recently used master pages.  When the page is already a
+        member of that list the associated descriptor is moved to the end of
+        the list to make it the most recently used entry.
+        @param bMakePersistent
+            When <TRUE/> is given then the new list of recently used master
+            pages is written back into the configuration to make it
+            persistent.  Giving <FALSE/> to ommit this is used while loading
+            the persistent list from the configuration.
+    */
+    void AddMasterPage (
+        MasterPageContainer::Token aToken,
+        bool bMakePersistent = true);
+
+    /** Load the list of recently used master pages from the registry where
+        it was saved to make it persistent.
+    */
+    void LoadPersistentValues (void);
+
+    /** Save the list of recently used master pages to the registry to make
+        it presistent.
+    */
+    void SavePersistentValues (void);
+
+    void ResolveList (void);
+};
+
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/SidebarFactory.cxx b/main/sd/source/ui/sidebar/SidebarFactory.cxx
new file mode 100644
index 0000000..852c953
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SidebarFactory.cxx
@@ -0,0 +1,240 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "SidebarFactory.hxx"
+#include "framework/Pane.hxx"
+#include "ViewShellBase.hxx"
+#include "DrawController.hxx"
+#include "LayoutMenu.hxx"
+#include "CurrentMasterPagesSelector.hxx"
+#include "RecentMasterPagesSelector.hxx"
+#include "AllMasterPagesSelector.hxx"
+#include "CustomAnimationPanel.hxx"
+#include "TableDesignPanel.hxx"
+#include "SlideTransitionPanel.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+using namespace css;
+using namespace cssu;
+using namespace ::sd::framework;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd { namespace sidebar {
+
+namespace {
+    /** Note that these names have to be identical to (the tail of)
+        the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu
+        for the TaskPanelFactory.
+    */
+    const static char* gsResourceNameCustomAnimations = "/CustomAnimations";
+    const static char* gsResourceNameLayouts = "/Layouts";
+    const static char* gsResourceNameAllMasterPages = "/AllMasterPages";
+    const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages";
+    const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages";
+    const static char* gsResourceNameSlideTransitions = "/SlideTransitions";
+    const static char* gsResourceNameTableDesign = "/TableDesign";
+}
+
+Reference<lang::XEventListener> mxControllerDisposeListener;
+
+
+
+// ----- Service functions ----------------------------------------------------
+
+Reference<XInterface> SAL_CALL SidebarFactory_createInstance (
+    const Reference<XComponentContext>& rxContext)
+{
+    return Reference<XInterface>(static_cast<XWeak*>(new SidebarFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString SidebarFactory_getImplementationName (void) throw(RuntimeException)
+{
+    return ::rtl::OUString(
+        RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.SidebarFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL SidebarFactory_getSupportedServiceNames (void)
+    throw (RuntimeException)
+{
+	static const ::rtl::OUString sServiceName(
+        ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.SidebarFactory"));
+	return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//----- SidebarFactory --------------------------------------------------------
+
+SidebarFactory::SidebarFactory(
+        const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+    : SidebarFactoryInterfaceBase(m_aMutex)
+{
+}
+
+
+
+
+SidebarFactory::~SidebarFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL SidebarFactory::disposing (void)
+{
+}
+
+
+
+
+// XInitialization
+
+void SAL_CALL SidebarFactory::initialize (const Sequence<Any>& aArguments)
+    throw (Exception, RuntimeException)
+{
+}
+
+
+
+
+// XUIElementFactory
+
+Reference<ui::XUIElement> SAL_CALL SidebarFactory::createUIElement (
+    const ::rtl::OUString& rsUIElementResourceURL,
+    const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        css::container::NoSuchElementException,
+        css::lang::IllegalArgumentException,
+        cssu::RuntimeException)
+{
+    // Process arguments.
+    const ::comphelper::NamedValueCollection aArguments (rArguments);
+    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+    Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
+
+    // Throw exceptions when the arguments are not as expected.
+    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( ! xParentWindow.is() || pParentWindow==NULL)
+        throw RuntimeException(
+            A2S("SidebarFactory::createUIElement called without ParentWindow"),
+            NULL);
+    if ( ! xFrame.is())
+        throw RuntimeException(
+            A2S("SidebarFactory::createUIElement called without XFrame"),
+            NULL);
+
+    // Tunnel through the controller to obtain a ViewShellBase.
+    ViewShellBase* pBase = NULL;
+    Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY);
+    if (xTunnel.is())
+    {
+        ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+            xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+        if (pController != NULL)
+            pBase = pController->GetViewShellBase();
+    }
+    if (pBase == NULL)
+        throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL);
+
+    // Create a framework view.
+    ::Window* pControl = NULL;
+
+#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
+    if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
+        pControl = new CustomAnimationPanel(pParentWindow, *pBase);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
+        pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages))
+        pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages))
+        pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
+        pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
+        pControl = new SlideTransitionPanel(pParentWindow, *pBase);
+    else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
+        pControl = new TableDesignPanel(pParentWindow, *pBase);
+#undef EndsWith
+
+    if (pControl == NULL)
+        throw lang::IllegalArgumentException();
+
+    // Create a wrapper around pane and view and return it as
+    // XUIElement.
+    Reference<ui::XUIElement> xUIElement;
+    try
+    {
+        xUIElement.set(
+            sfx2::sidebar::SidebarPanelBase::Create(
+                rsUIElementResourceURL,
+                xFrame,
+                pControl,
+                ui::LayoutSize(-1,-1,-1)));
+    }
+    catch(Exception& rException)
+    {
+        // Creation of XUIElement failed. mxUIElement remains empty.
+    }
+
+    Reference<lang::XComponent> xComponent (xUIElement, UNO_QUERY);
+    if (xComponent.is())
+        xComponent->addEventListener(this);
+    
+    return xUIElement;
+}
+
+
+
+
+void SAL_CALL SidebarFactory::disposing (const ::css::lang::EventObject& rEvent)
+    throw(cssu::RuntimeException)
+{
+    /*
+    if (mpImplementation
+        && rEvent.Source == mpImplementation->mxUIElement)
+    {
+        mpImplementation->mxUIElement.clear();
+    }
+    */
+}
+
+
+
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/SidebarFactory.hxx b/main/sd/source/ui/sidebar/SidebarFactory.hxx
new file mode 100644
index 0000000..81e7f1b
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SidebarFactory.hxx
@@ -0,0 +1,120 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_FACTORY_HXX
+#define SD_SIDEBAR_FACTORY_HXX
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <rtl/ref.hxx>
+#include "framework/Pane.hxx"
+
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <map>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sd {
+    class ViewShellBase;
+}
+
+namespace sd { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper3 <
+        css::lang::XInitialization,
+        css::ui::XUIElementFactory,
+        css::lang::XEventListener
+        > SidebarFactoryInterfaceBase;
+}
+
+
+/** This factory creates both XUIElements (for sidebar panels) and
+    a drawing framework pane.
+
+    The drawing framework pane is a container for the SidebarViewShell
+    which is necessary to run the legacy implementations of the task
+    pane panels.
+    
+    Control and information flow is like this:
+
+    When one of the old task panels is requested to be displayed in
+    the sidebar this factory is called for
+    XUIElementFactory::createUIElement().
+    One of the arguments, the window, is then exported into the
+    drawing framework as pane.  After this the drawing framework is
+    used to create the SidebarViewShell (once known as
+    TaskPaneViewShell or ToolPanelViewShell) and the requested panel.
+*/
+class SidebarFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public SidebarFactoryInterfaceBase
+{
+public:
+    static ::rtl::OUString SAL_CALL getImplementationName (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL createInstance (
+        const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+    static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void);
+
+    SidebarFactory (const cssu::Reference<cssu::XComponentContext>& rxContext);
+    virtual ~SidebarFactory (void);
+
+    virtual void SAL_CALL disposing (void);
+
+
+    // XInitialization
+    
+    virtual void SAL_CALL initialize(
+        const css::uno::Sequence<css::uno::Any>& aArguments)
+        throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+    // XUIElementFactory
+
+    cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
+        const ::rtl::OUString& rsResourceURL,
+        const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+
+
+    // XEventListener
+
+    virtual void SAL_CALL disposing (const ::css::lang::EventObject& rEvent)
+        throw(cssu::RuntimeException);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx b/main/sd/source/ui/sidebar/SidebarFocusManager.hxx
similarity index 100%
rename from main/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx
rename to main/sd/source/ui/sidebar/SidebarFocusManager.hxx
diff --git a/main/sd/source/ui/sidebar/SidebarShellManager.cxx b/main/sd/source/ui/sidebar/SidebarShellManager.cxx
new file mode 100644
index 0000000..513e7dc
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SidebarShellManager.cxx
@@ -0,0 +1,176 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "SidebarShellManager.hxx"
+
+#include "ViewShellManager.hxx"
+#include <tools/diagnose_ex.h>
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+namespace sd { namespace sidebar {
+
+SidebarShellManager::SidebarShellManager (
+    const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+    const ViewShell& rViewShell)
+    : mpViewShellManager(rpViewShellManager),
+      mrViewShell(rViewShell),
+      maSubShells()
+{
+}
+
+
+
+
+SidebarShellManager::~SidebarShellManager (void)
+{
+    while ( ! maSubShells.empty())
+        RemoveSubShell(maSubShells.begin()->second.mpShell);
+}
+
+
+
+
+SfxShell* SidebarShellManager::CreateShell( ShellId nId, ::Window* , FrameView* )
+{
+    SubShells::const_iterator iShell (maSubShells.find(nId));
+    if (iShell != maSubShells.end())
+        return iShell->second.mpShell;
+    else
+        return NULL;
+}
+
+
+
+
+void SidebarShellManager::ReleaseShell (SfxShell* )
+{
+    // Nothing to do.
+}
+
+void SidebarShellManager::AddSubShell (
+    ShellId nId,
+    SfxShell* pShell,
+    ::Window* pWindow)
+{
+    if (pShell != NULL)
+    {
+        maSubShells[nId] = ShellDescriptor(pShell,pWindow);
+        if (pWindow != NULL)
+        {
+            pWindow->AddEventListener(LINK(this,SidebarShellManager,WindowCallback));
+            if (pWindow->IsReallyVisible())
+                mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+        }
+        else
+            mpViewShellManager->ActivateSubShell(mrViewShell, nId);
+    }
+}
+
+
+
+
+void SidebarShellManager::RemoveSubShell (const ShellId i_nShellId)
+{
+    SubShells::iterator pos = maSubShells.find( i_nShellId );
+    ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" );
+    if ( pos->second.mpWindow != NULL )
+    {
+        pos->second.mpWindow->RemoveEventListener( LINK( this, SidebarShellManager, WindowCallback ) );
+    }
+    mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first );
+    maSubShells.erase( pos );
+}
+
+
+
+
+void SidebarShellManager::RemoveSubShell (const SfxShell* pShell)
+{
+    if (pShell != NULL)
+    {
+        SubShells::iterator iShell;
+        for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+            if (iShell->second.mpShell == pShell)
+            {
+                if (iShell->second.mpWindow != NULL)
+                    iShell->second.mpWindow->RemoveEventListener(
+                        LINK(this,SidebarShellManager,WindowCallback));
+                mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+                maSubShells.erase(iShell);
+                break;
+            }
+    }
+}
+
+
+
+
+void SidebarShellManager::MoveToTop (SfxShell* pShell)
+{
+    SubShells::const_iterator iShell;
+    for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+        if (iShell->second.mpShell == pShell)
+        {
+            ViewShellManager::UpdateLock aLocker (mpViewShellManager);
+            mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first);
+            mpViewShellManager->MoveToTop(mrViewShell);
+            break;
+        }
+}
+
+
+
+
+IMPL_LINK(SidebarShellManager, WindowCallback, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        SubShells::const_iterator iShell;
+        ::Window* pWindow = pEvent->GetWindow();
+        for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
+            if (iShell->second.mpWindow == pWindow)
+                break;
+        if (iShell != maSubShells.end())
+            switch (pEvent->GetId())
+            {
+                case VCLEVENT_WINDOW_SHOW:
+                    mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first);
+                    break;
+
+                case VCLEVENT_WINDOW_HIDE:
+                    // Do not activate the sub shell.  This leads to
+                    // problems with shapes currently being in text edit
+                    // mode: Deactivating the shell leads to leaving the
+                    // text editing mode.
+                    // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
+                    break;
+            }
+    }
+
+    return 0;
+}
+
+
+} } // end of namespace ::sd::sidebar
diff --git a/main/sd/source/ui/sidebar/SidebarShellManager.hxx b/main/sd/source/ui/sidebar/SidebarShellManager.hxx
new file mode 100644
index 0000000..d7f2777
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SidebarShellManager.hxx
@@ -0,0 +1,117 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_SHELL_MANAGER_HXX
+#define SD_SIDEBAR_SHELL_MANAGER_HXX
+
+#include "ShellFactory.hxx"
+#include "ViewShellManager.hxx"
+#include <map>
+
+class FrameView;
+class SfxShell;
+class VclWindowEvent;
+class Window;
+
+namespace sd {
+class ViewShell;
+}
+
+namespace sd { namespace sidebar {
+
+/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
+    interface.  However, it does not create or delete shells.  It only
+    gives the ViewShellManager access to the sub shells of the
+    ToolPanelViewShell.  Life time control of the sub shells is managed by
+    the sub shells themselves.
+*/
+class SidebarShellManager
+    : public ShellFactory<SfxShell>
+{
+public:
+    /** Create a shell manager that manages the stacked shells for the given
+        view shell.  It works together with the given view shell manager.
+    */
+    SidebarShellManager (
+        const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
+        const ViewShell& rViewShell);
+    ~SidebarShellManager (void);
+
+    /** Return the requested sub shell.
+        @param nId
+            The id of the requested sub shell.
+        @return
+            When there is no sub shell currently registered under the given
+            id then NULL is returned.
+    */
+    virtual SfxShell* CreateShell (
+        ShellId nId,
+        ::Window* pParentWindow,
+        FrameView* pFrameView = NULL);
+    
+    virtual void ReleaseShell (SfxShell* pShell);
+
+    /** Add a sub shell to the set of sub shells managed by the
+        TaskPaneShellManager.  Only shells added by this method are returned
+        by CreateShell().
+    */
+    void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
+
+    /** Remove the given shell from the set of sub shells managed by the
+        TaskPaneShellManager.  Following calls to CreateShell() will return
+        NULL when this shell is requested.
+    */
+    void RemoveSubShell (const SfxShell* pShell);
+    /** removes the shell given by its ID from the set of sub shells managed by the 
+        TaskPaneShellManager. Subsequent calls to CreateShell() will return
+        NULL when this shell is requested.
+    */
+    void RemoveSubShell (const ShellId i_nShellId);
+
+    /** Move the given sub-shell to the top of the local shell stack.
+        Furthermore move the view shell whose sub-shells this class manages
+        to the top of the global shell stack.
+    */
+    void MoveToTop (SfxShell* pShell);
+
+    DECL_LINK(WindowCallback,VclWindowEvent*);
+
+private:
+    ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
+
+    /// The view shell whose sub-shells this class manages.
+    const ViewShell& mrViewShell;
+
+    class ShellDescriptor { public:
+        SfxShell* mpShell;
+        ::Window* mpWindow;
+        ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
+        ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
+    };
+    typedef ::std::map<ShellId,ShellDescriptor> SubShells;
+    SubShells maSubShells;
+};
+
+} } // end of namespace ::sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/SlideTransitionPanel.cxx b/main/sd/source/ui/sidebar/SlideTransitionPanel.cxx
new file mode 100644
index 0000000..8cbeecb
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SlideTransitionPanel.cxx
@@ -0,0 +1,76 @@
+/**************************************************************
+ * 
+ * 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_sd.hxx"
+
+#include "SlideTransitionPanel.hxx"
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+    extern ::Window* createSlideTransitionPanel (::Window* pParent, ViewShellBase& rBase);
+    extern sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pParent);
+}
+
+
+
+
+namespace sd { namespace sidebar {
+
+
+SlideTransitionPanel::SlideTransitionPanel (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+    : PanelBase(pParentWindow, rViewShellBase)
+{
+#ifdef DEBUG
+    SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:SlideTransitionPanel")));
+#endif
+}
+
+
+
+
+SlideTransitionPanel::~SlideTransitionPanel (void)
+{
+}
+
+
+
+
+::Window* SlideTransitionPanel::CreateWrappedControl (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+{
+    return createSlideTransitionPanel(pParentWindow, rViewShellBase);
+}
+
+
+
+
+css::ui::LayoutSize SlideTransitionPanel::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    const sal_Int32 nMinimumHeight(getSlideTransitionPanelMinimumHeight(mpWrappedControl.get()));
+    return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight);
+}
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/SlideTransitionPanel.hxx b/main/sd/source/ui/sidebar/SlideTransitionPanel.hxx
new file mode 100644
index 0000000..410c1d9
--- /dev/null
+++ b/main/sd/source/ui/sidebar/SlideTransitionPanel.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX
+#define SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX
+
+#include "PanelBase.hxx"
+
+namespace sd { namespace sidebar {
+
+class SlideTransitionPanel
+    : public PanelBase
+{
+public:
+    SlideTransitionPanel (
+        ::Window* pParentWindow, 
+        ViewShellBase& rViewShellBase);
+    virtual ~SlideTransitionPanel (void);
+
+    // ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+protected:
+    virtual ::Window* CreateWrappedControl (
+        ::Window* pParentWindow,
+        ViewShellBase& rViewShellBase);
+};
+
+} } // end of namespace sd::sidebar
+
+
+#endif
diff --git a/main/sd/source/ui/sidebar/TableDesignPanel.cxx b/main/sd/source/ui/sidebar/TableDesignPanel.cxx
new file mode 100644
index 0000000..85cdb8f
--- /dev/null
+++ b/main/sd/source/ui/sidebar/TableDesignPanel.cxx
@@ -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.
+ * 
+ *************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "TableDesignPanel.hxx"
+
+#include "ViewShellBase.hxx"
+
+
+namespace sd {
+	extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase);
+}
+
+
+namespace sd { namespace sidebar {
+
+
+TableDesignPanel::TableDesignPanel (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+    : PanelBase(pParentWindow, rViewShellBase)
+{
+#ifdef DEBUG
+    SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:TableDesignPanel")));
+#endif
+}
+
+
+
+
+TableDesignPanel::~TableDesignPanel (void)
+{
+}
+
+
+
+
+::Window* TableDesignPanel::CreateWrappedControl (
+    ::Window* pParentWindow,
+    ViewShellBase& rViewShellBase)
+{
+    return createTableDesignPanel(pParentWindow, rViewShellBase);
+}
+
+
+
+
+css::ui::LayoutSize TableDesignPanel::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    //TODO: make the sizes depend on the font size.
+    return css::ui::LayoutSize(350,-1, 400);
+}
+
+} } // end of namespace sd::sidebar
diff --git a/main/sd/source/ui/sidebar/TableDesignPanel.hxx b/main/sd/source/ui/sidebar/TableDesignPanel.hxx
new file mode 100644
index 0000000..b4604dd
--- /dev/null
+++ b/main/sd/source/ui/sidebar/TableDesignPanel.hxx
@@ -0,0 +1,49 @@
+/**************************************************************
+ * 
+ * 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 SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX
+#define SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX
+
+#include "PanelBase.hxx"
+
+namespace sd { namespace sidebar {
+
+class TableDesignPanel
+    : public PanelBase
+{
+public:
+    TableDesignPanel (
+        ::Window* pParentWindow, 
+        ViewShellBase& rViewShellBase);
+    virtual ~TableDesignPanel (void);
+
+    // ILayoutableWindow
+    virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
+protected:
+    virtual ::Window* CreateWrappedControl (
+        ::Window* pParentWindow,
+        ViewShellBase& rViewShellBase);
+};
+
+} } // end of namespace sd::sidebar
+
+#endif
diff --git a/main/sd/source/ui/sidebar/makefile.mk b/main/sd/source/ui/sidebar/makefile.mk
new file mode 100644
index 0000000..9dcd9a7
--- /dev/null
+++ b/main/sd/source/ui/sidebar/makefile.mk
@@ -0,0 +1,65 @@
+#**************************************************************
+#  
+#  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.
+#  
+#**************************************************************
+
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=sidebar
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :  settings.mk
+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =      							\
+	$(SLO)$/AllMasterPagesSelector.obj		\
+	$(SLO)$/CurrentMasterPagesSelector.obj	\
+	$(SLO)$/CustomAnimationPanel.obj		\
+	$(SLO)$/DocumentHelper.obj				\
+	$(SLO)$/LayoutMenu.obj					\
+	$(SLO)$/MasterPageContainer.obj			\
+	$(SLO)$/MasterPageContainerFiller.obj	\
+	$(SLO)$/MasterPageContainerProviders.obj\
+	$(SLO)$/MasterPageContainerQueue.obj	\
+	$(SLO)$/MasterPageDescriptor.obj		\
+	$(SLO)$/MasterPageObserver.obj			\
+	$(SLO)$/MasterPagesSelector.obj			\
+	$(SLO)$/NavigatorWrapper.obj			\
+	$(SLO)$/PanelBase.obj					\
+	$(SLO)$/PanelFactory.obj				\
+	$(SLO)$/PreviewValueSet.obj				\
+	$(SLO)$/RecentlyUsedMasterPages.obj		\
+	$(SLO)$/RecentMasterPagesSelector.obj	\
+	$(SLO)$/SlideTransitionPanel.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE :  target.mk
+
diff --git a/main/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/main/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 924cba2..dc65a84 100644
--- a/main/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/main/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -191,7 +191,8 @@
             // in the tool pane.
             if (mrSlideSorter.GetViewShellBase() != NULL)
                 framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
-                    ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+                    ->RequestSidebarPanel(
+                        sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
             rRequest.Ignore ();
             break;
         }
diff --git a/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 9512d58..f21e6b8 100644
--- a/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -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::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());
 }
 
 
@@ -220,12 +226,11 @@
 {
     SlideSorterViewShell* pViewShell = NULL;
     
-    // Test the center, left, and then the right pane for showing a slide sorter.
+    // Test the center and left pane for showing a slide sorter.
     ::rtl::OUString aPaneURLs[] = {
         FrameworkHelper::msCenterPaneURL,
         FrameworkHelper::msFullScreenPaneURL,
         FrameworkHelper::msLeftImpressPaneURL,
-        FrameworkHelper::msRightPaneURL,
         ::rtl::OUString()};
 
     try
@@ -547,6 +552,50 @@
     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);
 }
 
 
diff --git a/main/sd/source/ui/table/TableDesignPane.cxx b/main/sd/source/ui/table/TableDesignPane.cxx
index 8d53b03..b3c0337 100644
--- a/main/sd/source/ui/table/TableDesignPane.cxx
+++ b/main/sd/source/ui/table/TableDesignPane.cxx
@@ -105,7 +105,7 @@
 {
 	Window* pControlParent = mbModal ? pParent : this;
 
-	mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) );
+    //	mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) );
 
 	ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) );
 	mxControls[CT_TABLE_STYLES].reset( pValueSet );
@@ -122,7 +122,7 @@
 	}
 	pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl));
 
-	mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) );
+    //	mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) );
 	sal_uInt16 i;
 	for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
 	{
@@ -132,8 +132,15 @@
 	}
 
 	for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ )
-		mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y();
-
+    {
+        if (mxControls[i])
+            mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y();
+        else if (i > 0)
+            mnOrgOffsetY[i] = mnOrgOffsetY[i-1];
+        else
+            mnOrgOffsetY[i] = 0;
+    }
+    
 	// get current controller and initialize listeners
 	try
 	{
@@ -180,6 +187,60 @@
 	updateLayout();
 }
 
+
+
+
+LayoutSize TableDesignPane::GetHeightForWidth (const sal_Int32 nWidth)
+{
+    if ( ! IsVisible() || nWidth<=0)
+        return LayoutSize(0,0,0);
+
+    // Initialize the height with the offset above and below the value
+    // set and below the check boxes.
+    const Point aOffset (LogicToPixel( Point(3,3), MAP_APPFONT));
+    sal_Int32 nHeight (3 * aOffset.Y());
+
+    // Add the height for the check boxes.
+    nHeight += mnOrgOffsetY[CB_BANDED_COLUMNS] - mnOrgOffsetY[CB_HEADER_ROW]
+        + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height();
+
+    // Setup minimal and maximal heights that include all check boxes
+    // and a small or large value set.
+    const sal_Int32 nMinimalHeight (nHeight+100);
+    const sal_Int32 nMaximalHeight (nHeight+450);
+
+    // Calculate the number of rows and columns and then add the
+    // preferred size of the value set.
+    ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+    if (pValueSet->GetItemCount() > 0)
+    {
+        Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0));
+        Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel());
+        aItemSize.Width() += 10;
+        aItemSize.Height() += 10;
+        
+        int nColumnCount = (pValueSet->GetSizePixel().Width() - pValueSet->GetScrollWidth()) / aItemSize.Width();
+        if (nColumnCount < 1)
+            nColumnCount = 1;
+
+        int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount;
+        if (nRowCount < 1)
+            nRowCount = 1;
+
+        nHeight += nRowCount * aItemSize.Height();
+    }
+
+    // Clip the requested height.
+    if (nHeight<nMinimalHeight)
+        nHeight = nMinimalHeight;
+    else if (nHeight>nMaximalHeight)
+        nHeight = nMaximalHeight;
+    return LayoutSize(nMinimalHeight, nMaximalHeight, nHeight);
+}
+
+
+
+
 // --------------------------------------------------------------------
 
 static SfxBindings* getBindings( ViewShellBase& rBase )
@@ -378,16 +439,19 @@
 
 			const long nStylesHeight = aPaneSize.Height() - nOptionsHeight;
 
-			// set with of controls to size of pane
+			// set width of controls to size of pane
 			for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId )
 			{
-				Size aSize( mxControls[nId]->GetSizePixel() );
-				aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X();
-				mxControls[nId]->SetSizePixel( aSize );
-				mxControls[nId]->SetPaintTransparent(sal_True);
-				mxControls[nId]->SetBackground();
+                if (mxControls[nId])
+                {
+                    Size aSize( mxControls[nId]->GetSizePixel() );
+                    aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X();
+                    mxControls[nId]->SetSizePixel( aSize );
+                    mxControls[nId]->SetPaintTransparent(sal_True);
+                    mxControls[nId]->SetBackground();
+                }
 			}
-			aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES]  );
+			aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight  );
 		}
 		else
 		{
@@ -449,18 +513,22 @@
 
 			// shift show options section down
 			const long nOptionsPos = aPos.Y() + aValueSetSize.Height();
-			for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId )
+            sal_Int32 nMaxY (0);
+			for( sal_Int32 nId = FL_STYLE_OPTIONS+1; nId <= CB_BANDED_COLUMNS; ++nId )
 			{
-				Point aCPos( mxControls[nId]->GetPosPixel() );
-				aCPos.X() = ( nId == FL_STYLE_OPTIONS ?  1 : 2 ) * aOffset.X();
-				aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos;
-				mxControls[nId]->SetPosPixel( aCPos );
+                if (mxControls[nId])
+                {
+                    Point aCPos( mxControls[nId]->GetPosPixel() );
+                    aCPos.X() = ( nId == FL_STYLE_OPTIONS ?  1 : 2 ) * aOffset.X();
+                    aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos;
+                    mxControls[nId]->SetPosPixel( aCPos );
+                    const sal_Int32 nBottom (aCPos.Y() + mxControls[nId]->GetSizePixel().Height());
+                    if (nBottom > nMaxY)
+                        nMaxY = nBottom;
+                }
 			}
 		}
     }
-
-	if( !mbModal )
-		SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
 }
 
 // --------------------------------------------------------------------
diff --git a/main/sd/source/ui/table/TableDesignPane.hxx b/main/sd/source/ui/table/TableDesignPane.hxx
index b169e03..0b404aa 100644
--- a/main/sd/source/ui/table/TableDesignPane.hxx
+++ b/main/sd/source/ui/table/TableDesignPane.hxx
@@ -26,6 +26,7 @@
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/LayoutSize.hpp>
 #include <com/sun/star/drawing/XDrawView.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 
@@ -33,6 +34,7 @@
 #include <vcl/fixed.hxx>
 #include <vcl/button.hxx>
 #include <svtools/valueset.hxx>
+#include <sfx2/sidebar/ILayoutableWindow.hxx>
 
 #include <boost/scoped_ptr.hpp>
 
@@ -49,7 +51,7 @@
 
 // --------------------------------------------------------------------
 
-class TableDesignPane : public Control
+class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow
 {
 public:
 	TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
@@ -61,6 +63,9 @@
 	// Control
 	virtual void Resize();
 
+    // ILayoutableWindow
+    virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
+
     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
 
 	void ApplyOptions();
diff --git a/main/sd/source/ui/table/TableDesignPane.src b/main/sd/source/ui/table/TableDesignPane.src
index 4d580b3..3d39144 100644
--- a/main/sd/source/ui/table/TableDesignPane.src
+++ b/main/sd/source/ui/table/TableDesignPane.src
@@ -30,7 +30,7 @@
 	DialogControl = TRUE;
 	Border = FALSE;
 
-	Size = MAP_APPFONT( 264, 160 );
+	Size = MAP_APPFONT( 264, 134 );
 	Text [ en-US ] = "Table Design";
 	
 	FixedLine FL_STYLE_OPTIONS+1
@@ -43,7 +43,7 @@
 	
 	CheckBox CB_HEADER_ROW+1
 	{
-        Pos = MAP_APPFONT ( 146, 16 ) ;
+        Pos = MAP_APPFONT ( 146, 3 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "Header Row" ;	
@@ -51,7 +51,7 @@
 	
 	CheckBox CB_TOTAL_ROW+1
 	{
-        Pos = MAP_APPFONT ( 146, 29 ) ;
+        Pos = MAP_APPFONT ( 146, 16 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "Total Row" ;	
@@ -59,7 +59,7 @@
 	
 	CheckBox CB_BANDED_ROWS+1
 	{
-        Pos = MAP_APPFONT ( 146, 42 ) ;
+        Pos = MAP_APPFONT ( 146, 29 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "Banded Rows" ;	
@@ -67,7 +67,7 @@
 
 	CheckBox CB_FIRST_COLUMN+1
 	{
-        Pos = MAP_APPFONT ( 146, 55 ) ;
+        Pos = MAP_APPFONT ( 146, 42 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "First Column" ;	
@@ -75,7 +75,7 @@
 
 	CheckBox CB_LAST_COLUMN+1
 	{
-        Pos = MAP_APPFONT ( 146, 68 ) ;
+        Pos = MAP_APPFONT ( 146, 55 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "Last Column" ;	
@@ -83,7 +83,7 @@
 
 	CheckBox CB_BANDED_COLUMNS+1
 	{
-        Pos = MAP_APPFONT ( 146, 82 ) ;
+        Pos = MAP_APPFONT ( 146, 68 ) ;
         Size = MAP_APPFONT ( 120 , 10 ) ;
 		TabStop = TRUE ;
 		Text [ en-US ] = "Banded Columns" ;	
@@ -99,7 +99,7 @@
 	
 	Control CT_TABLE_STYLES+1
 	{
-        Pos = MAP_APPFONT ( 6, 14 ) ;
+        Pos = MAP_APPFONT ( 4, 3 ) ;
 		Size = MAP_APPFONT( 120, 143 );
 		Border = TRUE ;
 		TabStop = TRUE ;	
diff --git a/main/sd/source/ui/table/tablefunction.cxx b/main/sd/source/ui/table/tablefunction.cxx
index cfed0e6..940cced 100644
--- a/main/sd/source/ui/table/tablefunction.cxx
+++ b/main/sd/source/ui/table/tablefunction.cxx
@@ -206,7 +206,7 @@
 		{
 			// Make the slide transition panel visible (expand it) in the
 	        // tool pane.
-		    framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+		    framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
 			    framework::FrameworkHelper::msTableDesignPanelURL);
 		}
 
diff --git a/main/sd/source/ui/table/tableobjectbar.cxx b/main/sd/source/ui/table/tableobjectbar.cxx
index 5b6c5c0..d3b04ef 100644
--- a/main/sd/source/ui/table/tableobjectbar.cxx
+++ b/main/sd/source/ui/table/tableobjectbar.cxx
@@ -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 @@
 	SetRepeatTarget( mpView );
 	SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR );
 	SetName( String( SdResId( RID_DRAW_TABLE_TOOLBOX ) ) );
+    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
 }
 
 // -----------------------------------------------------------------------------
@@ -203,6 +205,8 @@
 			pBindings->Invalidate( SID_FRAME_LINECOLOR );
 			pBindings->Invalidate( SID_ATTR_BORDER );
 			pBindings->Invalidate( SID_ATTR_FILL_STYLE );
+			pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE );
+			pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE );
 			pBindings->Invalidate( SID_TABLE_MERGE_CELLS );
 			pBindings->Invalidate( SID_TABLE_SPLIT_CELLS );
 			pBindings->Invalidate( SID_OPTIMIZE_TABLE );
diff --git a/main/sd/source/ui/toolpanel/ConstrainedIterator.cxx b/main/sd/source/ui/toolpanel/ConstrainedIterator.cxx
deleted file mode 100644
index 875aa3a..0000000
--- a/main/sd/source/ui/toolpanel/ConstrainedIterator.cxx
+++ /dev/null
@@ -1,263 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-// This is a definition file of a template class.  It is therefore
-// included by other files and thus has to be guarded against multiple
-// inclusion.
-
-#ifndef SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX
-#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX
-
-namespace sd { namespace toolpanel {
-
-
-template <class Container>
-ConstrainedIterator<Container>::value_type& 
-    ConstrainedIterator<Container>::operator* (void)
-{
-    return *maIterator;
-}
-
-
-
-
-template <class Container>
-const ConstrainedIterator<Container>::value_type& 
-    ConstrainedIterator<Container>::operator* (void)
-    const
-{
-    return *maIterator;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>::value_type& 
-    ConstrainedIterator<Container>::operator-> (void)
-{
-    return *maIterator;
-}
-
-
-
-
-template <class Container>
-const ConstrainedIterator<Container>::value_type& 
-    ConstrainedIterator<Container>::operator-> (void)
-    const
-{
-    return *maIterator;
-}
-
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>
-    ::ConstrainedIterator (void)
-    : mpContainer (NULL)
-{
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>::ConstrainedIterator (
-    const Container& rContainer,
-    const Container::iterator& rIterator)
-    : mpContainer(&rContainer),
-      maIterator (rIterator),
-      mpConstraint (NULL)
-{
-    AdvanceToNextValidElement();
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>::ConstrainedIterator (
-    const Container& rContainer,
-    const Container::iterator& rIterator,
-    const Constraint<Container>& rConstraint)
-    : mpContainer(&rContainer),
-      maIterator (rIterator),
-      mpConstraint (&rConstraint)
-{
-    AdvanceToNextValidElement();
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>::ConstrainedIterator (
-    const ConstrainedIterator& rIterator)
-    : mpContainer (rIterator.mpContainer),
-      maIterator (rIterator.maIterator),
-      mpConstraint (rIterator.mpConstraint)
-{
-    // Everything has been done in the initializer
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>&
-    ConstrainedIterator<Container>
-	::operator= (const ConstrainedIterator& rIterator)
-{
-    mpContainer = rIterator.mpContainer;
-    maIterator = rIterator.maIterator;
-    mpConstraint = rIterator.mpConstraint;
-
-    AdvanceToNextValidElement();
-
-    return *this;
-}
-
-
-
-
-template <class Container>
-bool ConstrainedIterator<Container>::operator== (
-    const ConstrainedIterator& aIterator) const
-{
-    return ! operator!=(aIterator);
-}
-
-
-
-
-template <class Container>
-bool ConstrainedIterator<Container>::operator!= (
-    const ConstrainedIterator& aIterator) const
-{
-    return maIterator != aIterator.maIterator;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>&
-    ConstrainedIterator<Container>::operator++ (void)
-{
-    maIterator++;
-    AdvanceToNextValidElement();
-    return *this;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>
-    ConstrainedIterator<Container>::operator++ (int)
-{
-    ConstrainedIterator aIterator (*this);
-    ++(*this);
-    return aIterator;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>&
-    ConstrainedIterator<Container>::operator-- (void)
-{
-    maIterator--;
-    AdvanceToPreviousValidElement();
-    return *this;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>
-    ConstrainedIterator<Container>::operator-- (int)
-{
-    ConstrainedIterator aIterator (*this);
-    --(*this);
-    return aIterator;
-}
-
-
-
-
-template <class Container>
-ConstrainedIterator<Container>
-    ConstrainedIterator<Container>::operator+ (int nValue) const
-{
-    return ConstrainedIterator (*mpContainer, maIterator+nValue);
-}
-
-
-
-template <class Container>
-ConstrainedIterator<Container>
-    ConstrainedIterator<Container>::operator- (int nValue) const
-{
-    return ConstrainedIterator (*mpContainer, maIterator-nValue);
-}
-
-
-
-template <class Container>
-void ConstrainedIterator<Container>::AdvanceToNextValidElement (void)
-{
-    if (mpContainer!=NULL && mpConstraint!=NULL)
-    {
-        while (maIterator != mpContainer->end()
-            && ! mpConstraint->operator()(*mpContainer, maIterator))
-            ++maIterator;
-    }
-}
-
-
-
-
-template <class Container>
-void ConstrainedIterator<Container>::AdvanceToPreviousValidElement (void)
-{
-    if (mpContainer!=NULL && mpConstraint!=NULL)
-    {
-        while (maIterator != mpContainer->begin()
-            && ! mpConstraint->operator()(*mpContainer, maIterator))
-            --maIterator;
-    }
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/ConstrainedIterator.hxx b/main/sd/source/ui/toolpanel/ConstrainedIterator.hxx
deleted file mode 100644
index b2b78e9..0000000
--- a/main/sd/source/ui/toolpanel/ConstrainedIterator.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX
-#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX
-
-#include <iterator>
-
-namespace sd { namespace toolpanel {
-
-
-template <class Container>
-class Constraint
-{
-public:
-    virtual bool operator() (
-        const Container& rContainer, 
-        const Container::iterator& rIterator) const = 0;
-};
-
-
-
-
-/** This iterator is a bidirectional iterator with something of random
-    access thrown in.  It uses a constraint object to jump over
-    elements in the underlying container that do not meet the
-    constraint.
-*/
-template <class Container>
-class ConstrainedIterator
-    : public ::std::bidirectional_iterator_tag
-{
-public:
-    typedef Container::value_type value_type;
-    typedef value_type& reference;
-    typedef const value_type& const_reference;
-
-    ConstrainedIterator (void);
-    ConstrainedIterator (
-        const Container& rContainer, 
-        const Container::iterator& rIterator);
-    ConstrainedIterator (
-        const Container& rContainer, 
-        const Container::iterator& rIterator,
-        const Constraint<Container>& pConstraint);
-    ConstrainedIterator (
-        const ConstrainedIterator& rIterator);
-
-    ConstrainedIterator& operator= (
-        const ConstrainedIterator& aIterator);
-
-    reference operator* (void);
-    const_reference operator* (void) const;
-    reference operator-> (void);
-    const_reference operator-> (void) const;
-
-    bool operator== (const ConstrainedIterator& aIterator) const;
-    bool operator!= (const ConstrainedIterator& aIterator) const;
-
-    ConstrainedIterator& operator++ (void);
-    ConstrainedIterator operator++ (int);
-    ConstrainedIterator& operator-- (void);
-    ConstrainedIterator operator-- (int);
-
-    ConstrainedIterator operator+ (int nValue) const;
-    ConstrainedIterator operator- (int nValue) const;
-
-
-private:
-    const Container* mpContainer;
-    Container::iterator maIterator;
-    const Constraint<Container>* mpConstraint;
-
-    void AdvanceToNextValidElement (void);
-    void AdvanceToPreviousValidElement (void);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/ControlContainer.cxx b/main/sd/source/ui/toolpanel/ControlContainer.cxx
deleted file mode 100644
index 8cb25a0..0000000
--- a/main/sd/source/ui/toolpanel/ControlContainer.cxx
+++ /dev/null
@@ -1,441 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/ControlContainer.hxx"
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-
-namespace sd { namespace toolpanel {
-
-
-ControlContainer::ControlContainer (TreeNode* pNode)
-    : mpNode(pNode),
-      mnActiveControlIndex((sal_uInt32)-1),
-      mbMultiSelection(false)
-{
-}
-
-
-
-
-ControlContainer::~ControlContainer (void)
-{
-    // Set mpNode to NULL so that no one calls it from now on.
-    mpNode = NULL;
-    DeleteChildren();
-}
-
-
-
-
-void ControlContainer::DeleteChildren (void)
-{
-    // Deleting the children may lead to calls back to the container.  To
-    // prevent the container from accessing the just deleted children, the
-    // maControlList member is first cleared (by transferring its content to
-    // a local list) before the children are destroyed.
-    ControlList maList;
-    maList.swap(maControlList);
-    ControlList::iterator I;
-    ControlList::iterator Iend (maList.end());
-    for (I=maList.begin(); I!=Iend; ++I)
-        delete *I;
-
-    if (mpNode != NULL)
-        mpNode->FireStateChangeEvent(EID_ALL_CHILDREN_REMOVED);
-}
-
-
-
-sal_uInt32 ControlContainer::AddControl (::std::auto_ptr<TreeNode> pControl)
-{
-    ::osl::MutexGuard aGuard (maMutex);
-
-    pControl->GetWindow()->Show();
-    sal_uInt32 nIndex = maControlList.size();
-    maControlList.push_back (pControl.get());
-    pControl.release();
-
-    ListHasChanged ();
-
-    if (mpNode != NULL)
-        mpNode->FireStateChangeEvent(EID_CHILD_ADDED, pControl.get());
-
-    return nIndex;
-}
-
-
-
-
-void ControlContainer::SetExpansionState (
-    sal_uInt32 nIndex,
-    ExpansionState aState)
-{
-    ::osl::MutexGuard aGuard (maMutex);
-    
-    bool bResizeNecessary (false);
-
-    if (mbMultiSelection)
-    {
-        TreeNode* pControl = GetControl(nIndex);
-        switch (aState)
-        {
-            case ES_TOGGLE:
-                bResizeNecessary = pControl->Expand( ! pControl->IsExpanded());
-                break;
-
-            case ES_EXPAND:
-                bResizeNecessary = pControl->Expand(true);
-                break;
-
-            case ES_COLLAPSE:
-                bResizeNecessary = pControl->Expand(false);
-                break;
-        }
-    }
-    else
-    {
-        // When bExpansionState is true then the control to expand is the
-        // one with the given index.  If bExpansionState is false and the
-        // given index points to the active control then then following
-        // control (in cyclic order) it is expanded.  When there is only one
-        // control then that is always expanded.
-        do
-        {
-            // Ignore a call with an invalid index. (The seperate comparison
-            // with -1 is not strictly necessary but it is here just in
-            // case.)
-            if (nIndex>=GetControlCount() || nIndex==(sal_uInt32)-1)
-                break;
-
-            bool bExpand;
-            switch (aState)
-            {
-                default:
-                case ES_TOGGLE:
-                    bExpand = ! GetControl(nIndex)->IsExpanded();
-                    break;
-
-                case ES_EXPAND:
-                    bExpand = true;
-                    break;
-
-                case ES_COLLAPSE:
-                    bExpand = false;
-                    break;
-            }
-            if (bExpand)
-            {
-                // Make the specified control the active one and expand it.
-                mnActiveControlIndex = nIndex;
-            }
-            else
-            {
-                if (nIndex == mnActiveControlIndex)
-                {
-                    // We have to determine a new active control since the
-                    // current one is about to be collapsed.  Choose the
-                    // previous one for the last and the next one for all
-                    // other.
-                    if (mnActiveControlIndex+1 == GetControlCount())
-                        mnActiveControlIndex
-                            = GetPreviousIndex(mnActiveControlIndex);
-                    else
-                        mnActiveControlIndex
-                            = GetNextIndex (mnActiveControlIndex);
-                }
-            }
-
-            // Update the expansion state of all controls.
-            for (sal_uInt32 i=0; i<GetControlCount(); i=GetNextIndex(i))
-            {
-                TreeNode* pControl = GetControl(i);
-                bResizeNecessary |= pControl->Expand(i == mnActiveControlIndex);
-            }
-        }
-        while (false);
-    }
-
-    if (bResizeNecessary && mpNode != NULL)
-        mpNode->RequestResize();
-}
-
-
-
-
-void ControlContainer::SetExpansionState (
-    TreeNode* pControl,
-    ExpansionState aState)
-{
-    SetExpansionState (GetControlIndex(pControl), aState);
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetControlIndex (TreeNode* pControlToExpand) const
-{
-    sal_uInt32 nIndex;
-    for (nIndex=0; nIndex<GetControlCount(); nIndex++)
-    {
-        TreeNode* pControl = GetControl(nIndex);
-        if (pControl == pControlToExpand)
-            break;
-    }
-    return nIndex;
-}
-
-
-
-
-void ControlContainer::ListHasChanged (void)
-{
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetControlCount (void) const
-{
-    return maControlList.size();
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetVisibleControlCount (void) const
-{
-    sal_uInt32 nCount (0);
-
-    sal_uInt32 nIndex;
-    sal_uInt32 nAllCount (maControlList.size());
-    for (nIndex=0; nIndex<nAllCount; nIndex=GetNextIndex(nIndex,true))
-    {
-        if (maControlList[nIndex]->GetWindow()->IsVisible())
-            nCount += 1;
-    }
-    
-    return nCount;
-}
-
-
-
-
-TreeNode* ControlContainer::GetControl (sal_uInt32 nIndex) const
-{
-    if (nIndex<maControlList.size() && nIndex!=(sal_uInt32)-1)
-        return maControlList[nIndex];
-    else
-        return NULL;
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetPreviousIndex (
-    sal_uInt32 nIndex,
-    bool bIncludeHidden,
-    bool bCycle) const
-{
-    sal_uInt32 nCandidate (nIndex);
-
-    while (true)
-    {
-        if (nCandidate==0)
-            if ( ! bCycle)
-            {
-                // We have reached the head of the list of controls and must
-                // not cycle to its end.
-                nCandidate = maControlList.size();
-                break;
-            }
-            else
-            {
-                // Cycle to the end of the list.
-                nCandidate = maControlList.size() - 1;
-            }
-        else
-            // Go to the regular predecessor.
-            nCandidate -= 1;
-
-        if (nCandidate == nIndex)
-        {
-            // Made one full loop and found no valid control.
-            nCandidate = maControlList.size();
-            break;
-        }
-        else if (bIncludeHidden)
-        {
-            // Return the candidate index regardless of whether the control
-            // is hidden or not.
-            break;
-        }
-        else if (maControlList[nCandidate]->GetWindow()->IsVisible())
-        {
-            // Found a visible control.
-            break;
-        }
-
-        // The candidate does not meet our constraints so do one more loop.
-    }
-    
-    return nCandidate;
-}
-
-
-
-sal_uInt32 ControlContainer::GetNextIndex (
-    sal_uInt32 nIndex,
-    bool bIncludeHidden,
-    bool bCycle) const
-{
-    sal_uInt32 nCandidate (nIndex);
-
-    while (true)
-    {
-        // Go to the regular successor.
-        nCandidate += 1;
-        if (nCandidate==maControlList.size())
-        {
-            if ( ! bCycle)
-            {
-                // We have reached the end of the list of controls and must
-                // not cycle to its head.
-                break;
-            }
-            else
-            {
-                // Cycle to the head of the list.
-                nCandidate = 0;
-            }
-        }
-
-        if (nCandidate == nIndex)
-        {
-            // Made one full loop and found no valid control.
-            nCandidate = maControlList.size();
-            break;
-        }
-        else if (bIncludeHidden)
-        {
-            // Return the candidate index regardless of whether the control
-            // is hidden or not.
-            break;
-        }
-        else if (maControlList[nCandidate]->GetWindow()->IsVisible())
-        {
-            // Found a visible control.
-            break;
-        }
-
-        // The candidate does not meet our constraints so do one more loop.
-    }
-    
-    return nCandidate;
-}
-
-
-
-
-void ControlContainer::SetMultiSelection (bool bFlag)
-{
-    mbMultiSelection = bFlag;
-}
-
-
-
-
-void ControlContainer::SetVisibilityState (
-    sal_uInt32 nControlIndex,
-    VisibilityState aState)
-{
-    TreeNode* pControl = GetControl (nControlIndex);
-    if (pControl != NULL)
-    {
-        bool bShow;
-        switch (aState)
-        {
-            default:
-            case VS_TOGGLE:
-                bShow = ! pControl->IsShowing();
-                break;
-            case VS_SHOW:
-                bShow = true;
-                break;
-            case VS_HIDE:
-                bShow = false;
-                break;
-        }
-
-        bool bControlWasExpanded = pControl->IsExpanded();
-        if (bShow != pControl->IsShowing())
-        {
-            pControl->Show (bShow);
-
-            if (bShow)
-            {
-                // If we just turned on the first control then expand it, too.
-                // If we turned on another control collapse it.
-                if (GetVisibleControlCount() == 1)
-                    SetExpansionState (nControlIndex, ES_EXPAND);
-                else
-                    SetExpansionState (nControlIndex, ES_COLLAPSE);
-            }
-            else
-            {
-                if (GetVisibleControlCount() > 0)
-                {
-                    if (bControlWasExpanded)
-                    {
-                        // We turned off an expanded control.  Make sure that
-                        // one of the still visible ones is expanded.
-                        sal_uInt32 nIndex = GetNextIndex(
-                            nControlIndex,
-                            false,
-                            false);
-                        if (nIndex == GetControlCount())
-                            nIndex = GetPreviousIndex(
-                                nControlIndex,
-                                false,
-                                false);
-                        SetExpansionState (nIndex, ES_EXPAND);
-                    }
-                }
-            }
-
-            if (mpNode != NULL)
-                mpNode->RequestResize();
-        }
-    }
-}
-
-
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx b/main/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
deleted file mode 100644
index 3ecb034..0000000
--- a/main/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
-#define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
-
-#include "taskpane/ILayoutableWindow.hxx"
-#include "taskpane/TitleBar.hxx"
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-#ifndef SD_WINDOW_HXX
-#include <vcl/window.hxx>
-#endif
-#include <memory>
-
-class Window;
-
-namespace sd { namespace toolpanel {
-
-class ControlContainer;
-
-/** Collection of information the describes entries of the tool
-    panel.  A descriptor owns the control it is associated with.
-*/
-class ControlContainerDescriptor
-    : public ::Window,
-      public virtual ILayoutableWindow
-{
-public:
-    /** Create a new descriptor for the given control.
-        @param rContainer
-            The container to inform about selection (caused by mouse
-            clicks or keyboard.)
-        @param pParent
-            The parent window of the new descriptor.
-        @param pControl
-            The control that is shown when being in the expanded
-            state.
-        @param rTitle
-            String that is shown as title in the title area above the
-            control.
-        @param eType
-            Type of the title bar.  This specifies how the title bar
-            will be formated.  For more information see TitleBar.
-            
-    */
-    ControlContainerDescriptor (
-        ControlContainer& rContainer,
-        ::Window* pParent,
-        ::std::auto_ptr<ILayoutableWindow> pControl, 
-        const String& rTitle,
-        TitleBar::TitleBarType eType);
-
-    virtual ~ControlContainerDescriptor (void);
-
-
-    virtual Size GetPreferredSize (void);
-    virtual int GetPreferredWidth (int nHeight);
-    virtual int GetPreferredHeight (int nWidth);
-    virtual bool IsResizable (void);
-    virtual ::Window* GetWindow (void);
-
-    virtual void Resize (void);
-    virtual void GetFocus (void);
-    virtual void LoseFocus (void);
-    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
-    virtual void KeyInput (const KeyEvent& rEvent);
-
-    void Select (bool bExpansionState);
-
-    //    const Rectangle& GetTitleBarBox (void) const;
-
-    Window* GetControl (void) const;
-    const String& GetTitle (void) const;
-
-    void Expand (bool bExpanded = true);
-    void Collapse (void);
-    bool IsExpanded (void) const;
-
-    /** Ownership of the given data remains with the caller.  The data
-        is thus not destroyed when the destructor of this class is
-        called.
-    */
-    void SetUserData (void* pUserData);
-    void* GetUserData (void) const;
-
-    bool IsVisible (void) const;
-    void SetVisible (bool bVisible);
-
-	using Window::GetWindow;
-	using sd::toolpanel::ILayoutableWindow::GetPreferredWidth;
-	using sd::toolpanel::ILayoutableWindow::GetPreferredHeight;
-
-private:
-    ControlContainer& mrContainer;
-    ::std::auto_ptr<TitleBar> mpTitleBar;
-    ::std::auto_ptr<ILayoutableWindow> mpControl;
-    String msTitle;
-    bool mbExpanded;
-    bool mbVisible;
-    void* mpUserData;
-    bool mnVisible;
-
-    /// Do not use! Assignment operator is not supported.
-    const ControlContainerDescriptor& operator= (
-        const ControlContainerDescriptor& aDescriptor);
-
-    void UpdateStates (void);
-
-    DECL_LINK(WindowEventListener, VclSimpleEvent*);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/ControlList.hxx b/main/sd/source/ui/toolpanel/ControlList.hxx
deleted file mode 100644
index 8926deb..0000000
--- a/main/sd/source/ui/toolpanel/ControlList.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROL_LIST_HXX
-#define SD_TOOLPANEL_CONTROL_LIST_HXX
-
-#include "ConstrainedIterator.hxx"
-#include "ConstrainedIterator.cxx"
-#include "TitledControl.hxx"
-
-#include <vector>
-
-namespace sd { namespace toolpanel {
-
-
-typedef ::std::vector<TitledControl*> ControlList;
-typedef ConstrainedIterator<ControlList> ControlIterator;
-
-
-class VisibilityConstraint
-    : public Constraint<ControlList>
-{
-public:
-    virtual bool operator() (
-        const ControlList& rContainer,
-        const ControlList::iterator& rIterator) const
-    {
-        return (**rIterator).GetWindow()->IsVisible();
-    }
-};
-
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/LayoutMenu.cxx b/main/sd/source/ui/toolpanel/LayoutMenu.cxx
deleted file mode 100644
index c69b3fb..0000000
--- a/main/sd/source/ui/toolpanel/LayoutMenu.cxx
+++ /dev/null
@@ -1,1008 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "LayoutMenu.hxx"
-
-#include "TaskPaneShellManager.hxx"
-#include "pres.hxx"
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "glob.hrc"
-#include "app.hrc"
-#include "helpids.h"
-#include "res_bmp.hrc"
-#include "strings.hrc"
-#include "ViewShellBase.hxx"
-#include "DrawViewShell.hxx"
-#include "SlideSorterViewShell.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsPageSelector.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "taskpane/ScrollPanel.hxx"
-#include "tools/SlotStateListener.hxx"
-#include "EventMultiplexer.hxx"
-#include "DrawController.hxx"
-#include "framework/FrameworkHelper.hxx"
-
-#include <vector>
-#include <memory>
-#include <sfx2/objface.hxx>
-#include "sdresid.hxx"
-#include <vcl/image.hxx>
-#include <svl/languageoptions.hxx>
-#include <sfx2/app.hxx>
-#include "taskpane/TitledControl.hxx"
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <comphelper/processfactory.hxx>
-#include <sfx2/viewfrm.hxx>
-
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/drawing/framework/XControllerManager.hpp>
-#include <com/sun/star/drawing/framework/XView.hpp>
-#include <com/sun/star/drawing/framework/ResourceId.hpp>
-
-using namespace ::sd::toolpanel;
-#define LayoutMenu
-#include "sdslots.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::drawing::framework;
-using namespace ::sd::slidesorter;
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace toolpanel {
-
-class LayoutMenuRootFactory
-    : public ControlFactory
-{
-public:
-    LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell)
-        :mrPanelViewShell(i_rPanelViewShell)
-    {
-    }
-
-protected:
-    virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
-    {
-        ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent);
-        ::std::auto_ptr<TreeNode> pMenu (
-            new LayoutMenu (
-                pScrollPanel,
-                mrPanelViewShell));
-        pScrollPanel->AddControl(pMenu);
-        return pScrollPanel;
-    }
-
-private:
-    ToolPanelViewShell& mrPanelViewShell;
-};
-
-
-SFX_IMPL_INTERFACE(LayoutMenu, SfxShell, 
-    SdResId(STR_TASKPANELAYOUTMENU))
-{
-	SFX_POPUPMENU_REGISTRATION(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
-}
-
-TYPEINIT1(LayoutMenu, SfxShell);
-
-struct snewfoil_value_info
-{
-    sal_uInt16 mnBmpResId;
-    sal_uInt16 mnHCBmpResId;
-    sal_uInt16 mnStrResId;
-    WritingMode meWritingMode;
-    AutoLayout maAutoLayout;
-};
-
-static snewfoil_value_info notes[] =
-{
-    {BMP_FOILN_01, BMP_FOILN_01_H, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB,
-     AUTOLAYOUT_NOTES},
-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
-};
-
-static snewfoil_value_info handout[] =
-{
-    {BMP_FOILH_01, BMP_FOILH_01_H, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT1},
-    {BMP_FOILH_02, BMP_FOILH_02_H, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT2},
-    {BMP_FOILH_03, BMP_FOILH_03_H, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT3},
-    {BMP_FOILH_04, BMP_FOILH_04_H, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT4},
-    {BMP_FOILH_06, BMP_FOILH_06_H, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT6},
-    {BMP_FOILH_09, BMP_FOILH_09_H, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB,
-     AUTOLAYOUT_HANDOUT9},
-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
-};
-
-static snewfoil_value_info standard[] =
-{
-    {BMP_LAYOUT_EMPTY, BMP_LAYOUT_EMPTY_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB,        AUTOLAYOUT_NONE},
-	{BMP_LAYOUT_HEAD03, BMP_LAYOUT_HEAD03_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB,       AUTOLAYOUT_TITLE},
-    {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB,        AUTOLAYOUT_ENUM},   
-	{BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB,       AUTOLAYOUT_2TEXT},
-	{BMP_LAYOUT_HEAD01, BMP_LAYOUT_HEAD01_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB,  AUTOLAYOUT_ONLY_TITLE},    
-	{BMP_LAYOUT_TEXTONLY, BMP_LAYOUT_TEXTONLY_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB,   AUTOLAYOUT_ONLY_TEXT},
-    {BMP_LAYOUT_HEAD03B, BMP_LAYOUT_HEAD03B_H, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_2OBJTEXT},
-	{BMP_LAYOUT_HEAD03C, BMP_LAYOUT_HEAD03C_H, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_TEXT2OBJ},
-	{BMP_LAYOUT_HEAD03A, BMP_LAYOUT_HEAD03A_H, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT},    
-	{BMP_LAYOUT_HEAD02B, BMP_LAYOUT_HEAD02B_H, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT},
-    {BMP_LAYOUT_HEAD04, BMP_LAYOUT_HEAD04_H, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB,        AUTOLAYOUT_4OBJ},   
-	{BMP_LAYOUT_HEAD06, BMP_LAYOUT_HEAD06_H, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB,    AUTOLAYOUT_6CLIPART},
-
-	// vertical
-    {BMP_LAYOUT_VERTICAL02, BMP_LAYOUT_VERTICAL02_H, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART},
-    {BMP_LAYOUT_VERTICAL01, BMP_LAYOUT_VERTICAL01_H, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE},
-    {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE},
-    {BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART,   WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART},
-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
-};
-
-LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell )
-    : ValueSet (pParent->GetWindow()),
-      TreeNode(pParent),
-      DragSourceHelper(this),
-      DropTargetHelper(this),
-      mrBase( i_rPanelViewShell.GetViewShellBase() ),
-      mpShellManager (&i_rPanelViewShell.GetSubShellManager()),
-      mbUseOwnScrollBar( false ),
-      mnPreferredColumnCount(3),
-      mxListener(NULL),
-      mbSelectionUpdatePending(true),
-      mbIsMainViewChangePending(false)
-{
-    implConstruct( *mrBase.GetDocument()->GetDocSh() );
-}
-
-
-void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
-{
-    OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell,
-        "LayoutMenu::implConstruct: hmm?" );
-    // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ...
-
-	SetStyle (
-        ( GetStyle()  & ~(WB_ITEMBORDER) )
-        | WB_TABSTOP
-        | WB_NO_DIRECTSELECT
-        );
-    if (mbUseOwnScrollBar)
-        SetStyle (GetStyle() | WB_VSCROLL);
-	SetExtraSpacing(2);
-	SetSelectHdl (LINK(this, LayoutMenu, ClickHandler));
-	SetPool (&rDocumentShell.GetDoc()->GetPool());
-    SetName(String(RTL_CONSTASCII_USTRINGPARAM("LayoutMenu")));
-    InvalidateContent();
-
-    Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener));
-    mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink,
-        ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
-        | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
-        | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
-        | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
-        | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED
-        | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
-        | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER);
-
-    Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS);
-    SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE));
-    
-    Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler));
-    mxListener = new ::sd::tools::SlotStateListener(
-        aStateChangeLink,
-        Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY),
-        ::rtl::OUString::createFromAscii(".uno:VerticalTextState"));
-
-    // Add this new object as shell to the shell factory.
-    GetShellManager()->AddSubShell(SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this);
-}
-
-
-
-LayoutMenu::~LayoutMenu (void)
-{
-    // Tell the shell factory that this object is no longer available.
-    if (GetShellManager() != NULL)
-        GetShellManager()->RemoveSubShell(this);
-    
-    Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY);
-    if (xComponent.is())
-        xComponent->dispose();
-
-    Clear();
-    Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener));
-    mrBase.GetEventMultiplexer()->RemoveEventListener (aLink);
-}
-
-
-
-
-::std::auto_ptr<ControlFactory> LayoutMenu::CreateControlFactory (
-    ToolPanelViewShell& i_rPanelViewShell )
-{
-    return ::std::auto_ptr<ControlFactory>(new LayoutMenuRootFactory(i_rPanelViewShell));
-}
-
-
-
-
-AutoLayout LayoutMenu::GetSelectedAutoLayout (void)
-{
-    AutoLayout aResult = AUTOLAYOUT_NONE;
-    
-    if ( ! IsNoSelection() && GetSelectItemId()!=0)
-    {
-        AutoLayout* pLayout = static_cast<AutoLayout*>(GetItemData(GetSelectItemId()));
-        if (pLayout != NULL)
-            aResult = *pLayout;
-    }
-
-    return aResult;
-}
-
-
-
-
-/** The preferred size depends on the preferred number of columns, the
-    number of items, and the size of the items.
-*/
-Size LayoutMenu::GetPreferredSize (void)
-{
-    Size aItemSize = CalcItemSizePixel (Size());
-    Size aPreferredWindowSize = CalcWindowSizePixel (
-        aItemSize, 
-         (sal_uInt16)mnPreferredColumnCount,
-        (sal_uInt16)CalculateRowCount (aItemSize,mnPreferredColumnCount));
-    return aPreferredWindowSize;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight)
-{
-    sal_Int32 nPreferredWidth = 100;
-    if (GetItemCount() > 0)
-    {
-        Image aImage = GetItemImage(GetItemId(0));
-        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
-        if (nHeight>0 && aItemSize.Height()>0)
-        {
-            int nRowCount = nHeight / aItemSize.Height();
-            if (nRowCount <= 0)
-                nRowCount = 1;
-            int nColumnCount = (GetItemCount() + nRowCount-1) / nRowCount;
-            nPreferredWidth = nColumnCount * aItemSize.Width();
-        }
-    }
-
-    return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetPreferredHeight (sal_Int32 nWidth)
-{
-    sal_Int32 nPreferredHeight = 200;
-    if ( ! mbUseOwnScrollBar && GetItemCount()>0)
-    {
-        Image aImage = GetItemImage(GetItemId(0));
-        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
-        if (nWidth>0 && aItemSize.Width()>0)
-        {
-            aItemSize.Width() += 8;
-            aItemSize.Height() += 8;
-            int nColumnCount = nWidth / aItemSize.Width();
-            if (nColumnCount <= 0)
-                nColumnCount = 1;
-            else if (nColumnCount > 4)
-                nColumnCount = 4;
-            int nRowCount = (GetItemCount() + nColumnCount-1) / nColumnCount;
-            nPreferredHeight = nRowCount * aItemSize.Height();
-        }
-    }
-    return nPreferredHeight;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetMinimumWidth (void)
-{
-    sal_Int32 nMinimumWidth = 0;
-    if (GetItemCount()>0)
-    {
-        Image aImage = GetItemImage(GetItemId(0));
-        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
-        nMinimumWidth = aItemSize.Width();
-    }
-    return nMinimumWidth;
-}
-
-
-
-
-bool LayoutMenu::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-void LayoutMenu::UpdateEnabledState (const MasterMode eMode)
-{
-    bool bIsEnabled (false);
-
-    ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell());
-    if (pMainViewShell)
-    {
-        switch (pMainViewShell->GetShellType())
-        {
-            case ViewShell::ST_NONE:
-            case ViewShell::ST_OUTLINE:
-            case ViewShell::ST_PRESENTATION:
-            case ViewShell::ST_TASK_PANE:
-                // The complete task pane is disabled for these values or
-                // not even visible.  Disabling the LayoutMenu would be
-                // logical but unnecessary.  The main disadvantage is that
-                // after re-enabling it (typically) another panel is
-                // expanded.
-                bIsEnabled = true;
-                break;
-                
-            case ViewShell::ST_DRAW:
-            case ViewShell::ST_IMPRESS:
-            {
-                switch (eMode)
-                {
-                    case MM_UNKNOWN:
-                    {
-                        ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
-                            ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell));
-                        if (pDrawViewShell)
-                            bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE;
-                        break;
-                    }
-                    case MM_NORMAL:
-                        bIsEnabled = true;
-                        break;
-
-                    case MM_MASTER:
-                        bIsEnabled = false;
-                        break;
-                }
-                break;
-            }
-
-            case ViewShell::ST_HANDOUT:
-            case ViewShell::ST_NOTES:
-            case ViewShell::ST_SLIDE_SORTER:
-            default:
-                bIsEnabled = true;
-                break;
-        }
-
-        TreeNode* pParentNode = GetParentNode();
-        if (pParentNode != NULL)
-        {
-            TitledControl* pGrandParentNode
-                = dynamic_cast<TitledControl*>(pParentNode->GetParentNode());
-            if (pGrandParentNode != NULL)
-                pGrandParentNode->SetEnabledState(bIsEnabled);
-        }
-
-    }
-}
-
-
-
-
-::Window* LayoutMenu::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-void LayoutMenu::Paint (const Rectangle& rRect)
-{
-	SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
-
-    if (mbSelectionUpdatePending)
-    {
-        mbSelectionUpdatePending = false;
-        UpdateSelection();
-    }
-    ValueSet::Paint (rRect);
-
-	SetBackground (Wallpaper());
-}
-
-
-
-
-void LayoutMenu::Resize (void)
-{
-    Size aWindowSize = GetOutputSizePixel();
-    if (IsVisible() && aWindowSize.Width() > 0)
-    {
-        // Calculate the number of rows and columns.
-        if (GetItemCount() > 0)
-        {
-            Image aImage = GetItemImage(GetItemId(0));
-            Size aItemSize = CalcItemSizePixel (
-                aImage.GetSizePixel());
-            aItemSize.Width() += 8;
-            aItemSize.Height() += 8;
-            int nColumnCount = aWindowSize.Width() / aItemSize.Width();
-            if (nColumnCount < 1)
-                nColumnCount = 1;
-            else if (nColumnCount > 4)
-                nColumnCount = 4;
-
-            int nRowCount = CalculateRowCount (aItemSize, nColumnCount);
-            
-            SetColCount ((sal_uInt16)nColumnCount);
-            SetLineCount ((sal_uInt16)nRowCount);
-        }
-    }
-
-    ValueSet::Resize ();
-}
-
-
-
-
-void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent)
-{
-    // As a preparation for the context menu the item under the mouse is
-    // selected.
-    if (rEvent.IsRight())
-    {
-        ReleaseMouse();
-        sal_uInt16 nIndex = GetItemId (rEvent.GetPosPixel());
-        if (nIndex > 0)
-            SelectItem(nIndex);
-    }
-    
-    ValueSet::MouseButtonDown (rEvent);
-}
-
-
-
-
-void LayoutMenu::Execute (SfxRequest& rRequest)
-{
-	switch (rRequest.GetSlot())
-    {
-        case SID_TP_APPLY_TO_SELECTED_SLIDES:
-            AssignLayoutToSelectedSlides(GetSelectedAutoLayout());
-            rRequest.Done();
-            break;
-
-        case SID_INSERTPAGE_LAYOUT_MENU:
-            // Add arguments to this slot and forward it to the main view
-            // shell.
-            InsertPageWithLayout(GetSelectedAutoLayout());
-            break;
-    }
-}
-
-
-
-
-void LayoutMenu::GetState (SfxItemSet& rItemSet)
-{
-    // Cut and paste is not supported.  The SID_(CUT,COPY,PASTE) entries
-    // therefore must not show up in the context menu.
-    rItemSet.DisableItem (SID_CUT);
-    rItemSet.DisableItem (SID_COPY);
-    rItemSet.DisableItem (SID_PASTE);
-
-    // The SID_INSERTPAGE_LAYOUT_MENU slot depends on the SID_INSERTPAGE
-    // slot being supported elsewhere.
-    const SfxPoolItem* pItem = NULL;
-    const SfxItemState aState (
-        mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem));
-    if (aState == SFX_ITEM_DISABLED)
-        rItemSet.DisableItem(SID_INSERTPAGE_LAYOUT_MENU);
-}
-
-
-
-
-void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout)
-{
-    ViewShell* pViewShell = mrBase.GetMainViewShell().get();
-    if (pViewShell == NULL)
-        return;
-
-    SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
-    if (pViewFrame == NULL)
-        return;
-
-    SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-    if (pDispatcher == NULL)
-        return;
-
-    // Call SID_INSERTPAGE with the right arguments.  This is because
-    // the popup menu can not call this slot with arguments directly.
-    SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
-    if (aRequest.GetArgs() != NULL)
-    {
-        pDispatcher->Execute(
-            SID_INSERTPAGE,
-            SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
-            *aRequest.GetArgs());
-    }
-    UpdateSelection();
-}
-
-
-
-
-TaskPaneShellManager* LayoutMenu::GetShellManager()
-{
-    if ( mpShellManager )
-        return mpShellManager;
-    return TreeNode::GetShellManager();
-}
-
-void LayoutMenu::InvalidateContent (void)
-{
-    // The number of items may have changed.  Request a resize so that the
-    // vertical size of this control can be adapted.
-    RequestResize();
-
-    // Throw away the current set and fill the menu anew according to the
-    // current settings (this includes the support for vertical writing.)
-    Fill();
-}
-
-
-
-
-int LayoutMenu::CalculateRowCount (const Size&, int nColumnCount)
-{
-    int nRowCount = 0;
-
-    if (GetItemCount() > 0 && nColumnCount > 0)
-    {
-        nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount;
-        //        nRowCount = GetOutputSizePixel().Height() / rItemSize.Height();
-        if (nRowCount < 1)
-            nRowCount = 1;
-    }
-
-    return nRowCount;
-}
-
-
-
-
-IMPL_LINK(LayoutMenu, ClickHandler, ValueSet*, EMPTYARG)
-{
-    AssignLayoutToSelectedSlides (GetSelectedAutoLayout());
-    return 0;
-}
-
-
-
-
-/** The specified layout is assigned to the current page of the view shell
-    in the center pane.
-*/
-void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
-{
-    using namespace ::sd::slidesorter;
-    using namespace ::sd::slidesorter::controller;
-
-    do
-    {
-        // The view shell in the center pane has to be present.
-        ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
-        if (pMainViewShell == NULL)
-            break;
-
-        // Determine if the current view is in an invalid master page mode.
-        // The handout view is always in master page mode and therefore not
-        // invalid.
-        bool bMasterPageMode (false);
-        switch (pMainViewShell->GetShellType())
-        {
-            case ViewShell::ST_NOTES:
-            case ViewShell::ST_IMPRESS:
-            {
-                DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
-                if (pDrawViewShell != NULL)
-                    if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
-                        bMasterPageMode = true;
-            }
-			default:
-				break;
-        }
-        if (bMasterPageMode)
-            break;
-
-        // Get a list of all selected slides and call the SID_MODIFYPAGE
-        // slot for all of them.
-		::sd::slidesorter::SharedPageSelection pPageSelection;
-
-        // Get a list of selected pages.
-        // First we try to obtain this list from a slide sorter.  This is
-        // possible only some of the view shells in the center pane.  When
-        // no valid slide sorter is available then ask the main view shell
-        // for its current page.
-        SlideSorterViewShell* pSlideSorter = NULL;
-        switch (pMainViewShell->GetShellType())
-        {
-            case ViewShell::ST_IMPRESS:
-            case ViewShell::ST_NOTES:
-            case ViewShell::ST_SLIDE_SORTER:
-                pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
-                break;
-			default:
-				break;
-        }
-		if (pSlideSorter != NULL)
-		{
-			// There is a slide sorter visible so get the list of selected pages from it.
-            pPageSelection = pSlideSorter->GetPageSelection();
-		}
-
-		if( (pSlideSorter == NULL) || (pPageSelection.get() == 0) || pPageSelection->empty() )
-		{
-			// No valid slide sorter available.  Ask the main view shell for
-			// its current page.
-            pPageSelection.reset(new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
-            pPageSelection->push_back(pMainViewShell->GetActualPage());
-		}
-			
-
-		if (pPageSelection->empty())
-			break;
-
-		::std::vector<SdPage*>::iterator iPage;
-		for (iPage=pPageSelection->begin(); iPage!=pPageSelection->end(); ++iPage)
-			{
-				if ((*iPage) == NULL)
-					continue;
-
-				// Call the SID_ASSIGN_LAYOUT slot with all the necessary parameters.
-				SfxRequest aRequest (mrBase.GetViewFrame(), SID_ASSIGN_LAYOUT);
-				aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATPAGE, ((*iPage)->GetPageNum()-1)/2));
-				aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
-				pMainViewShell->ExecuteSlot (aRequest, sal_Bool(sal_False));
-			}
-    }
-    while(false);
-}
-
-
-
-
-SfxRequest LayoutMenu::CreateRequest (
-    sal_uInt16 nSlotId,
-    AutoLayout aLayout)
-{
-    SfxRequest aRequest (mrBase.GetViewFrame(), nSlotId);
-
-    do
-    {
-        SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin());
-        sal_uInt8 aBackground (rLayerAdmin.GetLayerID(
-            String(SdResId(STR_LAYER_BCKGRND)), sal_False));
-        sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID(
-            String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
-        ViewShell* pViewShell = mrBase.GetMainViewShell().get();
-        if (pViewShell == NULL)
-            break;
-        SdPage* pPage = pViewShell->GetActualPage();
-        if (pPage == NULL)
-            break;
-
-        SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers());
-    
-        aRequest.AppendItem(
-            SfxStringItem (ID_VAL_PAGENAME, String()));//pPage->GetName()));
-        aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
-        aRequest.AppendItem(
-            SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground)));
-        aRequest.AppendItem(
-            SfxBoolItem(
-                ID_VAL_ISPAGEOBJ,
-                aVisibleLayers.IsSet(aBackgroundObject)));
-    }
-    while (false);
-
-    return aRequest;
-}
-
-
-
-
-void LayoutMenu::Fill (void)
-{
-	const bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
-	SvtLanguageOptions aLanguageOptions;
-    sal_Bool bVertical = aLanguageOptions.IsVerticalTextEnabled();
-    SdDrawDocument* pDocument = mrBase.GetDocument();
-    sal_Bool bRightToLeft = (pDocument!=NULL 
-        && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB);
-
-    // Get URL of the view in the center pane.
-    ::rtl::OUString sCenterPaneViewName;
-    try
-    {
-        Reference<XControllerManager> xControllerManager (
-            Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW);
-        Reference<XResourceId> xPaneId (ResourceId::create(
-            ::comphelper::getProcessComponentContext(),
-            FrameworkHelper::msCenterPaneURL));
-        Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
-        if (xView.is())
-            sCenterPaneViewName = xView->getResourceId()->getResourceURL();
-    }
-    catch (RuntimeException&)
-    {}
-    
-	snewfoil_value_info* pInfo = NULL;
-    if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL))
-    {
-        pInfo = notes;
-    }
-    else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL))
-    {
-        pInfo = handout;
-    }
-    else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL)
-        || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL))
-    {
-        pInfo = standard;
-    }
-    else
-    {
-        pInfo = NULL;
-	}
-
-    Clear();
-    int n = 0;
-	for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++)
-	{
-        if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical)
-        {
-            BitmapEx aBmp (SdResId (bHighContrast 
-                             ? pInfo->mnHCBmpResId 
-                             : pInfo->mnBmpResId));
-		
-            if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode))
-                aBmp.Mirror (BMP_MIRROR_HORZ);
-
-            InsertItem (i, aBmp, String (SdResId (pInfo->mnStrResId)));
-            SetItemData (i, new AutoLayout(pInfo->maAutoLayout));
-            n++;
-        }
-	}
-
-    mbSelectionUpdatePending = true;
-}
-
-
-
-
-void LayoutMenu::Clear (void)
-{
-    for (sal_uInt16 nId=1; nId<=GetItemCount(); nId++)
-        delete static_cast<AutoLayout*>(GetItemData(nId));
-    ValueSet::Clear();
-}
-
-
-
-void LayoutMenu::StartDrag (sal_Int8 , const Point& )
-{
-}
-
-
-
-
-sal_Int8 LayoutMenu::AcceptDrop (const AcceptDropEvent& )
-{
-    return 0;
-}
-
-
-
-
-sal_Int8 LayoutMenu::ExecuteDrop (const ExecuteDropEvent& )
-{
-    return 0;
-}
-
-
-
-
-void LayoutMenu::Command (const CommandEvent& rEvent)
-{
-    switch (rEvent.GetCommand())
-    {
-        case COMMAND_CONTEXTMENU:
-            if ( ! SD_MOD()->GetWaterCan())
-            {
-                if (GetShellManager() != NULL)
-                    GetShellManager()->MoveToTop(this);
-                if (rEvent.IsMouseEvent())
-                {
-                    // Do not show the context menu when the mouse was not
-                    // pressed over an item.
-                    if (GetItemId(rEvent.GetMousePosPixel()) > 0)
-                        mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
-                            SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
-                }
-                else
-                {
-                    // When the command event was not caused by a mouse
-                    // event (for example a key press instead) then show the
-                    // popup menu at the center of the current item.
-                    if (GetSelectItemId() != (sal_uInt16)-1)
-                    {
-                    	Rectangle aBBox (GetItemRect(GetSelectItemId()));
-                        Point aPosition (aBBox.Center());
-                        mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
-                            SdResId(RID_TASKPANE_LAYOUTMENU_POPUP),
-                            this,
-                            &aPosition);
-                    }
-                }
-            }
-            break;
-
-        default:
-            ValueSet::Command(rEvent);
-            break;
-    }
-}
-
-
-
-
-IMPL_LINK(LayoutMenu, StateChangeHandler, ::rtl::OUString*, EMPTYARG)
-{
-    InvalidateContent();
-    return 0;
-}
-
-
-
-
-void LayoutMenu::UpdateSelection (void)
-{
-    bool bItemSelected = false;
-
-    do
-    {
-        // Get current page of main view.
-        ViewShell* pViewShell = mrBase.GetMainViewShell().get();
-        if (pViewShell == NULL)
-            break;
-        
-        SdPage* pCurrentPage = pViewShell->getCurrentPage();
-        if (pCurrentPage == NULL)
-            break;
-
-        // Get layout of current page.
-        AutoLayout aLayout (pCurrentPage->GetAutoLayout());
-        if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END)
-            break;
-
-        // Find the entry of the menu for to the layout.
-        sal_uInt16 nItemCount (GetItemCount());
-        for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
-        {
-            if (*static_cast<AutoLayout*>(GetItemData(nId)) == aLayout)
-            {
-                SelectItem(nId);
-                bItemSelected = true;
-                break;
-            }
-        }
-    }
-    while (false);
-
-    if ( ! bItemSelected)
-        SetNoSelection();
-}
-
-
-
-
-IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
-{
-    switch (pEvent->meEventId)
-    {
-        case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
-        case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
-            if ( ! mbSelectionUpdatePending)
-                UpdateSelection();
-            break;
-
-        case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
-            mbIsMainViewChangePending = true;
-            UpdateEnabledState(MM_UNKNOWN);
-            break;
-
-        case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
-            HideFocus();
-            break;
-
-        case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
-            if (mbIsMainViewChangePending)
-            {
-                mbIsMainViewChangePending = false;
-                InvalidateContent();
-            }
-            break;
-
-        case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
-            UpdateEnabledState(MM_NORMAL);
-            break;
-
-        case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
-            UpdateEnabledState(MM_MASTER);
-            break;
-
-        default:
-            /* Ignored */
-            break;
-    }
-
-    return 0;
-}
-
-
-
-
-void LayoutMenu::DataChanged (const DataChangedEvent& rEvent)
-{
-    Fill();
-    ValueSet::DataChanged(rEvent);
-}
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/LayoutMenu.hxx b/main/sd/source/ui/toolpanel/LayoutMenu.hxx
deleted file mode 100644
index 0490eff..0000000
--- a/main/sd/source/ui/toolpanel/LayoutMenu.hxx
+++ /dev/null
@@ -1,235 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_LAYOUT_MENU_HXX
-#define SD_TASKPANE_LAYOUT_MENU_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#ifndef _COM_SUN_STAR_FRAME_XSTATUS_LISTENER_HPP_
-#include <com/sun/star/frame/XStatusListener.hpp>
-#endif
-
-#include "glob.hxx"
-#include "pres.hxx"
-#include <vcl/ctrl.hxx>
-#include <svtools/valueset.hxx>
-#include <svtools/transfer.hxx>
-#include <sfx2/shell.hxx>
-
-
-class SfxModule;
-
-
-namespace sd {
-class DrawDocShell;
-class PaneManagerEvent;
-class ViewShellBase;
-}
-
-
-namespace sd { namespace tools {
-class EventMultiplexerEvent;
-} }
-
-
-namespace sd { namespace toolpanel {
-
-class ControlFactory;
-class ToolPanelViewShell;
-
-
-class LayoutMenu
-    : public ValueSet,
-      public TreeNode,
-      public SfxShell,
-      public DragSourceHelper, 
-      public DropTargetHelper
-{
-public:
-    TYPEINFO();
-    SFX_DECL_INTERFACE(SD_IF_SDLAYOUTMENU)
-
-    /** Create a new layout menu.  Depending on the given flag it
-        displays its own scroll bar or lets a surrounding window
-        handle that.
-        @param i_pParent
-            the parent node in the control tree
-        @param i_rPanelViewShell
-            the view shell of the task pane.
-    */
-    LayoutMenu (
-        TreeNode* i_pParent,
-        ToolPanelViewShell& i_rPanelViewShell);
-    virtual ~LayoutMenu (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (
-        ToolPanelViewShell& i_rPanelViewShell );
-
-    /** Return a numerical value representing the currently selected
-        layout.
-    */
-    AutoLayout GetSelectedAutoLayout (void);
-
-
-    // From ILayoutableWindow
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual sal_Int32 GetMinimumWidth (void);
-    virtual bool IsResizable (void);
-    virtual ::Window* GetWindow (void);
-
-    // From ::Window
-	virtual void Paint (const Rectangle& rRect);
-    virtual void Resize (void);
-
-    /** Show a context menu when the right mouse button is pressed.
-    */
-    virtual void MouseButtonDown (const MouseEvent& rEvent);
-
-    void Execute (SfxRequest& rRequest);
-    void GetState (SfxItemSet& rItemSet);
-
-    /** The LayoutMenu does not support some main views.  In this case the
-        LayoutMenu is disabled.  This state is updated in this method.
-        @param eMode
-            On some occasions the edit mode is being switched when this
-            method is called can not (yet) be reliably detected.  Luckily,
-            in these cases the new value is provided by some broadcaster.
-            On other occasions the edit mode is not modified and is also not
-            provided.  Therefore the Unknown value.
-    */
-    enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN };
-    void UpdateEnabledState (const MasterMode eMode);
-
-    // TreeNode overridables
-    virtual TaskPaneShellManager* GetShellManager (void);
-
-    /** Call this method when the set of displayed layouts is not up-to-date
-        anymore.  It will re-assemple this set according to the current
-        settings.
-    */
-    void InvalidateContent (void);
-
-	// DragSourceHelper
-	virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel);
-
-	// DropTargetHelper
-	virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent);
-	virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent);
-
-    /** The context menu is requested over this Command() method.
-    */
-	virtual void Command (const CommandEvent& rEvent);
-
-    /** Call Fill() when switching to or from high contrast mode so that the
-        correct set of icons is displayed.
-    */
-    virtual void DataChanged (const DataChangedEvent& rEvent);
-
-	using Window::GetWindow;
-	using ValueSet::StartDrag;
-
-private:
-    ViewShellBase& mrBase;
-
-    TaskPaneShellManager*   mpShellManager;
-
-    /** Do we use our own scroll bar or is viewport handling done by
-        our parent?
-    */
-    bool mbUseOwnScrollBar;
-
-    /** If we are asked for the preferred window size, then use this
-        many columns for the calculation.
-    */
-    const int mnPreferredColumnCount;
-
-    ::com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> mxListener;
-
-    bool mbSelectionUpdatePending;
-
-    bool mbIsMainViewChangePending;
-
-    /** Calculate the number of displayed rows.  This depends on the given
-        item size, the given number of columns, and the size of the
-        control.  Note that this is not the number of rows managed by the
-        valueset.  This number may be larger.  In that case a vertical
-        scroll bar is displayed.
-    */
-    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
-
-    /** Fill the value set with the layouts that are applicable to the
-        current main view shell.
-    */
-    void Fill (void);
-
-    /** Remove all items from the value set.
-    */
-    void Clear (void);
-
-    /** Assign the given layout to all selected slides of a slide sorter.
-        If no slide sorter is active then this call is ignored.  The slide
-        sorter in the center pane is preferred if the choice exists.
-    */
-    void AssignLayoutToSelectedSlides (AutoLayout aLayout);
-
-    /** Insert a new page with the given layout.  The page is inserted via
-        the main view shell, i.e. its SID_INSERTPAGE slot is called.  It it
-        does not support this slot then inserting a new page does not take
-        place.  The new page is inserted after the currently active one (the
-        one returned by ViewShell::GetActualPage().)
-    */
-    void InsertPageWithLayout (AutoLayout aLayout);
-
-    /** Create a request structure that can be used with the SID_INSERTPAGE
-        and SID_MODIFYPAGE slots.  The parameters are set so that the given
-        layout is assigned to the current page of the main view shell.
-        @param nSlotId
-            Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE.
-        @param aLayout
-            Layout of the page to insert or to assign.
-    */
-    SfxRequest CreateRequest (
-        sal_uInt16 nSlotId,
-        AutoLayout aLayout);
-
-    /** Select the layout that is used by the current page.
-    */
-    void UpdateSelection (void);
-
-    // internal ctor
-    void    implConstruct( DrawDocShell& rDocumentShell );
-
-    /** When clicked then set the current page of the view in the center pane.
-    */
-    DECL_LINK(ClickHandler, ValueSet*);
-    DECL_LINK(RightClickHandler, MouseEvent*);
-    DECL_LINK(StateChangeHandler, ::rtl::OUString*);
-    DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/MethodGuard.hxx b/main/sd/source/ui/toolpanel/MethodGuard.hxx
deleted file mode 100644
index f3b3614..0000000
--- a/main/sd/source/ui/toolpanel/MethodGuard.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_METHODGUARD_HXX
-#define SD_METHODGUARD_HXX
-
-#include <osl/mutex.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-	//==================================================================================================================
-	//= MethodGuard
-	//==================================================================================================================
-    template < class COMPONENT >
-	class MethodGuard
-	{
-    public:
-        MethodGuard( COMPONENT& i_rComponent )
-            :m_aGuard( i_rComponent.getMutex() )
-        {
-            i_rComponent.checkDisposed();
-        }
-
-        ~MethodGuard()
-        {
-        }
-
-        inline void clear()
-        {
-            m_aGuard.clear();
-        }
-
-    private:
-        ::osl::ClearableMutexGuard  m_aGuard;
-	};
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_METHODGUARD_HXX
diff --git a/main/sd/source/ui/toolpanel/ScrollPanel.cxx b/main/sd/source/ui/toolpanel/ScrollPanel.cxx
deleted file mode 100644
index 5ea3fbf..0000000
--- a/main/sd/source/ui/toolpanel/ScrollPanel.cxx
+++ /dev/null
@@ -1,811 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/ScrollPanel.hxx"
-
-#include "taskpane/ControlContainer.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "AccessibleScrollPanel.hxx"
-
-#include <vcl/svapp.hxx>
-#include <svtools/valueset.hxx>
-
-namespace sd { namespace toolpanel {
-
-ScrollPanel::ScrollPanel (
-    ::Window& i_rParentWindow)
-    : Control (&i_rParentWindow, WB_DIALOGCONTROL),
-      TreeNode(NULL),
-      maScrollWindow(this, WB_DIALOGCONTROL),
-      maVerticalScrollBar(this, WB_VERT),
-      maHorizontalScrollBar(this, WB_HORZ),
-      maScrollBarFiller(this),
-      maScrollWindowFiller(&maScrollWindow),
-      mbIsRearrangePending(true),
-      mbIsLayoutPending(true),
-      mnChildrenWidth(0),
-      mnVerticalBorder(2),
-      mnVerticalGap(3),
-      mnHorizontalBorder(2)
-{
-    Construct();
-}
-
-void ScrollPanel::Construct()
-{
-    SetAccessibleName (
-        ::rtl::OUString::createFromAscii("Sub Task Panel"));
-    mpControlContainer->SetMultiSelection (true);
-
-    SetBorderStyle (WINDOW_BORDER_NORMAL);
-    SetMapMode (MapMode(MAP_PIXEL));
-
-    // To reduce flickering during repaints make the container windows
-    // transparent and rely on their children to paint the whole area.
-    SetBackground(Wallpaper());
-    maScrollWindow.SetBackground(Wallpaper());
-    maScrollWindowFiller.SetBackground(
-        Application::GetSettings().GetStyleSettings().GetWindowColor());
-
-    maScrollWindow.Show();
-
-    // Initialize the scroll bars.
-    maVerticalScrollBar.SetScrollHdl (
-        LINK(this, ScrollPanel, ScrollBarHandler));
-    maVerticalScrollBar.EnableDrag (sal_True);
-    maHorizontalScrollBar.SetScrollHdl (
-        LINK(this, ScrollPanel, ScrollBarHandler));
-    maHorizontalScrollBar.EnableDrag (sal_True);
-}
-
-
-
-
-ScrollPanel::~ScrollPanel (void)
-{
-    sal_uInt32 nCount = mpControlContainer->GetControlCount();
-    for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pNode = mpControlContainer->GetControl(nIndex);
-        TreeNode* pControl = pNode;
-        // When the node has been created as TitledControl then use its
-        // control instead of pNode directly.
-        TitledControl* pTitledControl = static_cast<TitledControl*>(pNode);
-        if (pTitledControl != NULL)
-            pControl = pTitledControl->GetControl();
-
-        // Remove this object as listener from the control.
-        if (pControl != NULL && pControl->GetWindow()!=NULL)
-        {
-            pControl->GetWindow()->RemoveEventListener(
-                LINK(this,ScrollPanel,WindowEventListener));
-        }
-    }
-    mpControlContainer->DeleteChildren();
-}
-
-
-
-
-TitledControl* ScrollPanel::AddControl (
-    ::std::auto_ptr<TreeNode> pControl, 
-    const String& rTitle,
-    const rtl::OString& rHelpId)
-{
-    // We are interested only in the title.  The control itself is
-    // managed by the content object.
-    TitledControl* pTitledControl = new TitledControl(
-        this,
-        pControl, 
-        rTitle,
-        TitledControlStandardClickHandler(GetControlContainer(), ControlContainer::ES_TOGGLE),
-        TitleBar::TBT_SUB_CONTROL_HEADLINE);
-    pTitledControl->GetTitleBar()->SetHelpId(rHelpId);
-
-    AddControl(::std::auto_ptr<TreeNode>(pTitledControl));
-    
-    return pTitledControl;
-}
-
-
-
-
-void ScrollPanel::AddControl (::std::auto_ptr<TreeNode> pControl)
-{
-    if (pControl.get() != NULL)
-    {
-        // Add a window event listener which does two things:
-        // 1. Listen for controls being shown or hidden so that the layout
-        // can be adapted.
-        // 2. Track selection changes in order to make the selected elements
-        // visible.
-        const Link aWindowListener(LINK(this,ScrollPanel,WindowEventListener));
-        OSL_ASSERT(pControl->GetWindow()!=NULL);
-        pControl->GetWindow()->AddEventListener(aWindowListener);
-        
-        TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pControl.get());
-        if (pTitledControl != NULL)
-        {
-            OSL_ASSERT(pTitledControl->GetControl()!=NULL);
-            OSL_ASSERT(pTitledControl->GetControl()->GetWindow()!=NULL);
-            pTitledControl->GetControl()->GetWindow()->AddEventListener(aWindowListener);
-        }
-
-        FocusManager& rFocusManager (FocusManager::Instance());
-        int nControlCount (mpControlContainer->GetControlCount());
-        // Replace the old links for cycling between first and last child by
-        // current ones.
-        if (nControlCount > 0)
-        {
-            ::Window* pFirst = mpControlContainer->GetControl(0)->GetWindow();
-            ::Window* pLast = mpControlContainer->GetControl(nControlCount-1)->GetWindow();
-            rFocusManager.RemoveLinks(pFirst,pLast);
-            rFocusManager.RemoveLinks(pLast,pFirst);
-
-            rFocusManager.RegisterLink(pFirst,pControl->GetWindow(), KEY_UP);
-            rFocusManager.RegisterLink(pControl->GetWindow(),pFirst, KEY_DOWN);
-        }
-        
-        
-        // Add a down link only for the first control so that when entering
-        // the sub tool panel the focus is set to the first control.
-        if (nControlCount == 0)
-            rFocusManager.RegisterDownLink(GetParent(), pControl->GetWindow());
-        rFocusManager.RegisterUpLink(pControl->GetWindow(), GetParent());
-
-        pControl->GetWindow()->SetParent(&maScrollWindow);
-        mpControlContainer->AddControl (pControl);
-        mpControlContainer->SetExpansionState(
-            mpControlContainer->GetControlCount()-1,
-            ControlContainer::ES_EXPAND);
-    }
-}
-
-
-
-
-void ScrollPanel::Paint (const Rectangle& rRect)
-{
-    if (mbIsRearrangePending)
-        Rearrange();
-    if (mbIsLayoutPending)
-        LayoutChildren();
-    ::Window::Paint (rRect);
-
-    // Paint the outer border and the space between every two children.
-    Color aOriginalLineColor (maScrollWindow.GetLineColor());
-    Color aOriginalFillColor (maScrollWindow.GetFillColor());
-
-    maScrollWindow.SetLineColor ();
-    maScrollWindow.SetFillColor (
-        GetSettings().GetStyleSettings().GetWindowColor());
-
-    Size aSize (maScrollWindow.GetOutputSizePixel());
-    // Paint left and right vertical border.
-    Rectangle aVerticalArea (
-        Point(0,0), 
-        Size(mnHorizontalBorder,aSize.Height()));
-    maScrollWindow.DrawRect (aVerticalArea);
-    aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
-    aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
-    maScrollWindow.DrawRect (aVerticalArea);
-
-    // Paint horizontal stripes.
-    Rectangle aStripeArea (
-        Point (mnHorizontalBorder,0),
-        Size(mnChildrenWidth,0));
-    StripeList::const_iterator iStripe;
-    for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); iStripe++)
-    {
-        aStripeArea.Top() = iStripe->first;
-        aStripeArea.Bottom() = iStripe->second;
-        if (aStripeArea.Bottom() < 0)
-            continue;
-        if (aStripeArea.Top() >= aSize.Height())
-            break;
-        maScrollWindow.DrawRect (aStripeArea);
-    }
-    
-    maScrollWindow.SetLineColor (aOriginalLineColor);
-    maScrollWindow.SetFillColor (aOriginalFillColor);
-}
-
-
-
-
-void ScrollPanel::Resize (void)
-{
-    ::Window::Resize();
-    mbIsRearrangePending = true;
-    mbIsLayoutPending = true;
-}
-
-
-
-
-void ScrollPanel::RequestResize (void)
-{
-    mbIsRearrangePending = true;
-    mbIsLayoutPending = true;
-    Invalidate();
-}
-
-
-
-
-Size ScrollPanel::GetPreferredSize (void)
-{
-    return GetRequiredSize();
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetPreferredWidth (sal_Int32 )
-{
-    return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetPreferredHeight (sal_Int32 )
-{
-    return GetPreferredSize().Height();
-}
-
-
-
-
-bool ScrollPanel::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-::Window* ScrollPanel::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetMinimumWidth (void)
-{
-    return TreeNode::GetMinimumWidth();
-}
-
-
-
-
-void ScrollPanel::ExpandControl (
-    TreeNode* pControl,
-    bool bExpansionState)
-{
-    // Toggle expand status.
-    pControl->Expand (bExpansionState);
-
-    Rearrange ();
-    Invalidate ();
-}
-
-
-
-
-bool ScrollPanel::IsVerticalScrollBarVisible (void) const
-{
-    return maVerticalScrollBar.IsReallyVisible();
-}
-
-
-
-
-bool ScrollPanel::IsHorizontalScrollBarVisible (void) const
-{
-    return maHorizontalScrollBar.IsReallyVisible();
-}
-
-
-
-
-ScrollBar& ScrollPanel::GetVerticalScrollBar (void)
-{
-    return maVerticalScrollBar;
-}
-
-
-
-
-ScrollBar& ScrollPanel::GetHorizontalScrollBar (void)
-{
-    return maHorizontalScrollBar;
-}
-
-
-
-
-/** This control shows an expansion bar for every control and in a
-    separate area below that expansion area it shows all controls each
-    with its title bar.  When there is not enough space then show a
-    scroll bar in the control area.
-*/
-void ScrollPanel::Rearrange (void)
-{
-    Size aRequiredSize (GetRequiredSize());
-    if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
-    {
-        Size aAvailableSize (SetupScrollBars (aRequiredSize));
-        maScrollWindow.SetPosSizePixel(
-            Point(0,0),
-            aAvailableSize);
-
-        // Make the children at least as wide as the sub tool panel.
-        if (aRequiredSize.Width() < aAvailableSize.Width())
-            aRequiredSize.Width() = aAvailableSize.Width();
-        mnChildrenWidth = -2*mnHorizontalBorder;
-        if (maHorizontalScrollBar.IsVisible())
-            mnChildrenWidth += aRequiredSize.Width();
-        else
-            mnChildrenWidth += aAvailableSize.Width();
-        
-        sal_Int32 nChildrenHeight (LayoutChildren());
-        maVerticalScrollBar.SetRangeMax (
-            nChildrenHeight + mnVerticalBorder);
-
-        mbIsRearrangePending = false;
-    }
-}
-
-
-
-
-Size ScrollPanel::GetRequiredSize (void)
-{
-    // First determine the width of the children.  This is the maximum of
-    // the current window width and the individual minimum widths of the
-    // children. 
-    int nChildrenWidth (GetSizePixel().Width());
-    unsigned int nCount = mpControlContainer->GetControlCount();
-    unsigned int nIndex;
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        int nMinimumWidth (pChild->GetMinimumWidth());
-        if (nMinimumWidth > nChildrenWidth)
-            nChildrenWidth = nMinimumWidth;
-    }
-
-    // Determine the accumulated width of all children when scaled to the
-    // minimum width.
-    nChildrenWidth -= 2*mnHorizontalBorder;
-    Size aTotalSize (nChildrenWidth, 
-        2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
-        aTotalSize.Height() += nHeight;
-    }
-
-    return aTotalSize;
-}
-
-
-
-
-sal_Int32 ScrollPanel::LayoutChildren (void)
-{
-    maStripeList.clear();
-
-    Point aPosition (maScrollOffset);
-    aPosition.X() += mnHorizontalBorder;
-    maStripeList.push_back( ::std::pair<int,int>(
-        aPosition.Y(),
-        aPosition.Y() + mnVerticalBorder - 1));
-    aPosition.Y() += mnVerticalBorder;
-
-    // Place the controls one over the other.
-    unsigned int nCount (mpControlContainer->GetControlCount());
-    for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
-    {
-        if (nIndex > 0)
-        {
-            maStripeList.push_back( ::std::pair<int,int>(
-                aPosition.Y(),
-                aPosition.Y() + mnVerticalGap - 1));
-            aPosition.Y() += mnVerticalGap;
-        }
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
-        pChild->GetWindow()->SetPosSizePixel(
-            aPosition,
-            Size(mnChildrenWidth, nControlHeight));
-        aPosition.Y() += nControlHeight;
-    }
-
-    // If the children do not cover their parent window completely
-    // (regarding the height) we put a filler below that is responsible for
-    // painting the remaining space.
-    int nWindowHeight = maScrollWindow.GetSizePixel().Height();
-    if (aPosition.Y() < nWindowHeight)
-    {
-        maScrollWindowFiller.SetPosSizePixel (
-            aPosition,
-            Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
-        maStripeList.push_back( ::std::pair<int,int>(
-            aPosition.Y(),
-            nWindowHeight-1));
-        //        maScrollWindowFiller.Show();
-        aPosition.Y() = nWindowHeight;
-    }
-    else
-        maScrollWindowFiller.Hide();
-
-    aPosition.Y() += mnVerticalBorder;
-    mbIsLayoutPending = false;
-
-    return aPosition.Y()-maScrollOffset.Y();
-}
-
-
-
-
-Size ScrollPanel::SetupScrollBars (const Size& rRequiredSize)
-{
-    Size aWindowSize (GetSizePixel());
-    Size aScrollBarSize (
-        maVerticalScrollBar.GetSizePixel().Width(),
-        maHorizontalScrollBar.GetSizePixel().Height());
-    Size aRemainingSize (aWindowSize);
-
-    // Determine which scroll bars have to be shown.
-    bool bShowHorizontal = false;
-    if (rRequiredSize.Width() > aWindowSize.Width())
-        bShowHorizontal = true;
-    bool bShowVertical = false;
-    if (rRequiredSize.Height() > aWindowSize.Height())
-        bShowVertical = true;
-    // Showing one scroll bar may reduce the available size so that the
-    // other one has to be shown as well.
-    if (bShowHorizontal && ! bShowVertical)
-    {
-        if ((rRequiredSize.Height() + aScrollBarSize.Height())
-            > aWindowSize.Height())
-            bShowVertical = true;
-    }
-    else if (bShowVertical && ! bShowHorizontal)
-    {
-        if (GetMinimumWidth() + aScrollBarSize.Width() > aWindowSize.Width())
-            bShowHorizontal = true;
-    }
-        
-    // Setup the scroll bars.
-    aRemainingSize.Width()
-        = SetupVerticalScrollBar (bShowVertical, rRequiredSize.Height());
-    aRemainingSize.Height()
-        = SetupHorizontalScrollBar (bShowHorizontal, rRequiredSize.Width());
-
-    // Place the filler.
-    if (bShowHorizontal && bShowVertical)
-    {
-        maScrollBarFiller.SetPosSizePixel (
-            Point(aWindowSize.Width(), aWindowSize.Height()),
-            aScrollBarSize);
-        maScrollBarFiller.Show();
-    }
-    else
-        maScrollBarFiller.Hide();
-
-
-    return aRemainingSize;
-}
-
-
-
-
-sal_Int32 ScrollPanel::SetupVerticalScrollBar (bool bShow, sal_Int32 nRange)
-{
-    Size aScrollBarSize (
-        maVerticalScrollBar.GetSizePixel().Width(),
-        maHorizontalScrollBar.GetSizePixel().Height());
-    Size aWindowSize (GetOutputSizePixel());
-    sal_Int32 nRemainingWidth (aWindowSize.Width());
-
-    // Setup the verical scroll bar.
-    if (bShow)
-    {
-        int nWidth = aScrollBarSize.Width();
-        int nHeight = aWindowSize.Height();
-        maVerticalScrollBar.SetPosSizePixel(
-            Point(aWindowSize.Width()-nWidth,0),
-            Size(nWidth, nHeight));
-        maVerticalScrollBar.Show();
-
-        // Set the scroll bar range and thumb size.
-        maVerticalScrollBar.SetRangeMin (0);
-        maVerticalScrollBar.SetRangeMax (
-            nRange + 2*mnVerticalBorder);
-        maVerticalScrollBar.SetVisibleSize (aWindowSize.Height());
-        // Make page size approx. 10% of visible area.
-        maVerticalScrollBar.SetLineSize (aWindowSize.Height()/10);
-        // Make page size approx. 100% of visible area.
-        maVerticalScrollBar.SetPageSize (aWindowSize.Height());
-        // Make sure that thumb is inside the valid range.
-        maVerticalScrollBar.SetThumbPos(-maScrollOffset.Y());
-        long nMinPos = maVerticalScrollBar.GetRangeMin();
-        if (maVerticalScrollBar.GetThumbPos() < nMinPos)
-            maVerticalScrollBar.SetThumbPos(nMinPos);
-        long nMaxPos = maVerticalScrollBar.GetRangeMax() 
-            - maVerticalScrollBar.GetVisibleSize();
-        if (maVerticalScrollBar.GetThumbPos() >= nMaxPos)
-            maVerticalScrollBar.SetThumbPos(nMaxPos);
-        // Set offset to match thumb pos.
-        maScrollOffset.Y() = -maVerticalScrollBar.GetThumbPos();
-
-        nRemainingWidth -= aScrollBarSize.Width();
-    }
-    else
-    {
-        maVerticalScrollBar.Hide();
-        maScrollOffset.Y() = 0;
-    }
-
-    return nRemainingWidth;
-}
-
-
-
-
-sal_Int32 ScrollPanel::SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange)
-{
-    Size aScrollBarSize (
-        maVerticalScrollBar.GetSizePixel().Width(),
-        maHorizontalScrollBar.GetSizePixel().Height());
-    Size aWindowSize (GetOutputSizePixel());
-    sal_Int32 nRemainingHeight (aWindowSize.Height());
-
-    // Setup the horizontal scroll bar.
-    if (bShow)
-    {
-        int nHeight = aScrollBarSize.Height();
-        int nWidth = GetOutputSizePixel().Width();
-        maHorizontalScrollBar.SetPosSizePixel(
-            Point(0, aWindowSize.Height()-nHeight),
-            Size(nWidth,nHeight));
-        maHorizontalScrollBar.Show();
-
-        // Set the scroll bar range and thumb size.
-        maHorizontalScrollBar.SetRangeMin (0);
-        maHorizontalScrollBar.SetRangeMax (
-            nRange + 2*mnHorizontalBorder);
-        maHorizontalScrollBar.SetVisibleSize (aWindowSize.Width());
-        // Make page size approx. 5% of visible area.
-        maHorizontalScrollBar.SetLineSize (aWindowSize.Width()/20+1);
-        // Make page size approx. 50% of visible area.
-        maHorizontalScrollBar.SetPageSize (aWindowSize.Width()/2+1);
-        // Make sure that thumb is inside the valid range.
-        maHorizontalScrollBar.SetThumbPos(-maScrollOffset.X());
-        long nMinPos = maHorizontalScrollBar.GetRangeMin();
-        if (maHorizontalScrollBar.GetThumbPos() < nMinPos)
-            maHorizontalScrollBar.SetThumbPos(nMinPos);
-        long nMaxPos = maHorizontalScrollBar.GetRangeMax() 
-            - maHorizontalScrollBar.GetVisibleSize();
-        if (maHorizontalScrollBar.GetThumbPos() >= nMaxPos)
-            maHorizontalScrollBar.SetThumbPos(nMaxPos);
-        // Set offset to match thumb pos.
-        maScrollOffset.X() = -maHorizontalScrollBar.GetThumbPos();
-
-        nRemainingHeight -= aScrollBarSize.Height();
-    }
-    else
-    {
-        maHorizontalScrollBar.Hide();
-        maScrollOffset.X() = 0;
-    }
-
-    return nRemainingHeight;
-}
-
-
-IMPL_LINK(ScrollPanel, ScrollBarHandler, ScrollBar*, EMPTYARG)
-{
-    maScrollOffset.X() -= maHorizontalScrollBar.GetDelta();
-    maScrollOffset.Y() -= maVerticalScrollBar.GetDelta();
-
-    // Scrolling is done by moving the child windows up or down.
-    mbIsLayoutPending = true;
-    Invalidate();
-    //    LayoutChildren();
-
-    return 0;
-}
-
-
-
-
-long ScrollPanel::Notify( NotifyEvent& rNEvt )
-{
-    long nRet = sal_False;
-    if( rNEvt.GetType() == EVENT_COMMAND )
-    {
-        // note: dynamic_cast is not possible as GetData() returns a void*
-        CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
-        DBG_ASSERT( pCmdEvent!=0 &&
-                    ( pCmdEvent->IsMouseEvent() == sal_True ||
-                      pCmdEvent->IsMouseEvent() == sal_False ),
-                    "Invalid CommandEvent" );
-        if (pCmdEvent)
-            switch (pCmdEvent->GetCommand())
-            {
-                case COMMAND_WHEEL:
-                case COMMAND_STARTAUTOSCROLL:
-                case COMMAND_AUTOSCROLL:
-                {
-                    nRet = HandleScrollCommand (*pCmdEvent, &maHorizontalScrollBar, &maVerticalScrollBar);
-                    break;
-                }
-            }
-    }
-
-    if( ! nRet )
-        nRet = ::Window::Notify( rNEvt );
-
-    return nRet;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> ScrollPanel::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    return new ::accessibility::AccessibleScrollPanel (
-        *this,
-        ::rtl::OUString::createFromAscii("Scroll Panel"),
-        ::rtl::OUString::createFromAscii("Scroll Panel"));
-}
-
-
-
-
-void ScrollPanel::MakeRectangleVisible (
-    Rectangle& aRectangle,
-    ::Window* pWindow)
-{
-    if (maVerticalScrollBar.IsVisible() && aRectangle.GetWidth()>0 && aRectangle.GetHeight()>0)
-    {
-        const Rectangle aRelativeBox (pWindow->GetWindowExtentsRelative(&maScrollWindow));
-
-        aRectangle.Move(
-            -maScrollOffset.X() + aRelativeBox.Left(),
-            -maScrollOffset.Y() + aRelativeBox.Top());
-    
-        const int nVisibleHeight (maVerticalScrollBar.GetVisibleSize());
-        const int nVisibleTop (maVerticalScrollBar.GetThumbPos());
-        if (aRectangle.Bottom() >= nVisibleTop+nVisibleHeight)
-            maVerticalScrollBar.DoScroll(aRectangle.Bottom() - nVisibleHeight);
-        else if (aRectangle.Top() < nVisibleTop)
-            maVerticalScrollBar.DoScroll(aRectangle.Top());
-    }
-}
-
-
-
-
-IMPL_LINK(ScrollPanel,WindowEventListener,VclSimpleEvent*,pEvent)
-{
-    VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(pEvent);
-    if (pWindowEvent != NULL)
-    {
-        switch (pWindowEvent->GetId())
-        {
-            case VCLEVENT_WINDOW_KEYUP:
-            case VCLEVENT_WINDOW_MOUSEBUTTONUP:
-            {
-                // Make the currently selected item visible.
-                ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
-                if (pControl != NULL)
-                {
-                    // Get the bounding box of the currently selected item
-                    // and enlarge this so that the selection frame is
-                    // inside as well.
-                    Rectangle aBox (pControl->GetItemRect(pControl->GetSelectItemId()));
-                    aBox.Top()-=4;
-                    aBox.Bottom()+=4;
-                    
-                    MakeRectangleVisible(aBox, pControl);
-                }
-            }
-            break;
-            
-            case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
-            {
-                // Make the item under the mouse visible.  We need this case
-                // for right clicks that open context menus.  For these we
-                // only get the mouse down event.  The following mouse up
-                // event is sent to the context menu.
-                ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
-                if (pControl != NULL)
-                {
-                    // Get the bounding box of the item at the mouse
-                    // position and enlarge this so that the selection frame
-                    // is inside as well.
-                    MouseEvent* pMouseEvent
-                        = reinterpret_cast<MouseEvent*>(pWindowEvent->GetData());
-                    if (pMouseEvent != NULL)
-                    {
-                        Point aPosition (pMouseEvent->GetPosPixel());
-                        Rectangle aBox (pControl->GetItemRect(pControl->GetItemId(aPosition)));
-                        aBox.Top()-=4;
-                        aBox.Bottom()+=4;
-                    
-                        MakeRectangleVisible(aBox, pControl);
-                    }
-                }
-            }
-            break;
-                
-
-            case VCLEVENT_WINDOW_GETFOCUS:
-            {
-                // Move title bars into the visible area when they get the
-                // focus (::Window wise their enclosing TitledControl gets
-                // the focus.)
-                TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pWindowEvent->GetWindow());
-                if (pTitledControl!=NULL && pTitledControl->GetTitleBar()!=NULL)
-                {
-                    ::Window* pTitleBarWindow = pTitledControl->GetTitleBar()->GetWindow();
-                    Rectangle aBox(pTitleBarWindow->GetPosPixel(),pTitleBarWindow->GetSizePixel());
-                    MakeRectangleVisible(
-                        aBox,
-                        pTitleBarWindow);
-                }
-            }
-            break;
-                
-            case VCLEVENT_WINDOW_SHOW:
-            case VCLEVENT_WINDOW_HIDE:
-            case VCLEVENT_WINDOW_ACTIVATE:
-            case VCLEVENT_WINDOW_RESIZE:
-                // Rearrange the children of the scroll panel when one of
-                // the children changes its size or visibility.
-                RequestResize();
-                break;
-        }
-    }
-    return 0;
-}
-
-
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx b/main/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
deleted file mode 100644
index e4ab807..0000000
--- a/main/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
+++ /dev/null
@@ -1,368 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/SlideSorterCacheDisplay.hxx"
-
-#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
-
-#include "taskpane/ScrollPanel.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/button.hxx>
-
-namespace {
-
-static const Color maBackgroundColor (255,250,245);
-
-class PageCacheWindow : public ::Window
-{
-public:
-    PageCacheWindow (
-        ::Window* pParentWindow,
-        ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay)
-        : ::Window(pParentWindow),
-           mpDisplay(pDisplay)
-    {
-        SetBackground(Wallpaper(maBackgroundColor));
-    }
-
-    virtual void Paint (const Rectangle& rBoundingBox)
-    { mpDisplay->Paint(rBoundingBox); ::Window::Paint(rBoundingBox); }
-    virtual void Resize (void) { mpDisplay->Resize(); ::Window::Resize(); }
-    
-private:
-    ::sd::toolpanel::SlideSorterCacheDisplay* mpDisplay;
-};
-
-}
-
-
-
-namespace sd { namespace toolpanel {
-
-::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> SlideSorterCacheDisplay::maDisplays;
-
-SlideSorterCacheDisplay::SlideSorterCacheDisplay (const SdDrawDocument* pDocument)
-    : TreeNode(NULL),
-      mpWindow(NULL),
-      mnPageCount(0),
-      mnColumnCount(0),
-      mnRowCount(0),
-      maCellSize(0,0),
-      mnHorizontalBorder(0),
-      mnVerticalBorder(0)
-{
-    SlideSorterCacheDisplay::AddInstance(pDocument,this);
-}
-
-
-
-
-SlideSorterCacheDisplay::~SlideSorterCacheDisplay (void)
-{
-    if (mpWindow != NULL)
-        delete mpWindow;
-    SlideSorterCacheDisplay::RemoveInstance(this);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetParentWindow (::Window* pParentWindow)
-{
-    mpWindow = new PageCacheWindow(pParentWindow, this);
-}
-
-
-
-
-void SlideSorterCacheDisplay::Paint (const Rectangle& rBoundingBox)
-{
-    if (maCellSize.Width()>0 && maCellSize.Height()>0 && mpWindow!=NULL)
-    {
-        Color maSavedFillColor (mpWindow->GetFillColor());
-        Color maSavedLineColor (mpWindow->GetLineColor());
-        sal_Int32 nC0 = (rBoundingBox.Left() - mnHorizontalBorder) / maCellSize.Width();
-        sal_Int32 nC1 = (rBoundingBox.Right() - mnHorizontalBorder) / maCellSize.Width();
-        sal_Int32 nR0 = (rBoundingBox.Top() - mnVerticalBorder) / maCellSize.Height();
-        sal_Int32 nR1 = (rBoundingBox.Bottom() - mnVerticalBorder) / maCellSize.Height();
-        for (sal_Int32 nC=nC0; nC<=nC1; ++nC)
-            for (sal_Int32 nR=nR0; nR<=nR1; ++nR)
-            {
-                sal_Int32 nPageIndex (nC + nR*mnColumnCount);
-                if (nPageIndex < mnPageCount)
-                {
-                    Rectangle aBox (GetPageBox(nPageIndex));
-                    if ( ! maPageDescriptors[nPageIndex].mbVisible)
-                    {
-                        mpWindow->SetLineColor();
-                        mpWindow->SetFillColor(maBackgroundColor);
-                        mpWindow->DrawRect(aBox);
-
-                        aBox.Left() += maCellSize.Width()/4;
-                        aBox.Right() -= maCellSize.Width()/4;
-                        aBox.Top() += maCellSize.Height()/4;
-                        aBox.Bottom() -= maCellSize.Height()/4;
-                    }
-
-                    switch (maPageDescriptors[nPageIndex].meStatus)
-                    {
-                        case NONE : mpWindow->SetFillColor (Color(95,255,128)); break;
-                        case RENDERING : mpWindow->SetFillColor (Color(236,125,128)); break;
-                        case IN_QUEUE_PRIORITY_0 : mpWindow->SetFillColor (Color(255,243,0)); break;
-                        case IN_QUEUE_PRIORITY_1 : mpWindow->SetFillColor (Color(255,199,0)); break;
-                        case IN_QUEUE_PRIORITY_2 : mpWindow->SetFillColor (Color(20,255,128)); break;
-                        default : mpWindow->SetFillColor (COL_BLACK); break;
-                    }
-                    mpWindow->SetLineColor(COL_BLACK);
-                    mpWindow->DrawRect(aBox);
-
-                    if ( ! maPageDescriptors[nPageIndex].mbUpToDate)
-                        mpWindow->DrawLine(aBox.TopLeft(), aBox.BottomRight());
-                }
-            }
-        mpWindow->SetLineColor(maSavedLineColor);
-        mpWindow->SetFillColor(maSavedFillColor);
-    }
-}
-
-
-
-
-void SlideSorterCacheDisplay::Resize (void)
-{
-    if (mpWindow != NULL)
-    {
-        double nW = mpWindow->GetSizePixel().Width();
-        double nH = mpWindow->GetSizePixel().Height();
-        if (nH > 0)
-        {
-            double nAspect = nW / nH;
-            sal_Int32 nR = 1;
-            sal_Int32 nC = 1;
-            while (nR * nC < mnPageCount)
-            {
-                if (double(nC) / double(nR) > nAspect)
-                    ++nR;
-                else
-                    ++nC;
-            }
-            double nAspect2 = double(nC) / double(nR);
-            
-            mnRowCount = nR;
-            mnColumnCount = nC;
-            mnHorizontalGap = 2;
-            mnVerticalGap = 2;
-            maCellSize = Size(
-                (int)((nW-(nC-1)*mnHorizontalGap) / nC),
-                (int)((nH-(nR-1)*mnVerticalGap) / nR));
-            mnHorizontalBorder = (int)(nW - nC*maCellSize.Width() - ((nC-1)*mnHorizontalGap))/2;
-            mnVerticalBorder = (int)(nH - nR*maCellSize.Height() - ((nR-1)*mnVerticalGap))/2;
-        }
-    }
-}
-
-
-
-
-SlideSorterCacheDisplay* SlideSorterCacheDisplay::Instance (const SdDrawDocument* pDocument)
-{
-    SlideSorterCacheDisplay* pDisplay = NULL;
-    ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
-    for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
-        if (iDisplay->first == pDocument)
-            pDisplay = iDisplay->second;
-
-    if (pDisplay == NULL)
-    {
-        pDisplay = new SlideSorterCacheDisplay(pDocument);
-    }
-    
-    return pDisplay;
-}
-    
-
-
-
-void SlideSorterCacheDisplay::SetPageCount (sal_Int32 nPageCount)
-{
-    mnPageCount = nPageCount;
-    maPageDescriptors.resize(nPageCount);
-    Resize();
-    if (mpWindow != NULL)
-        mpWindow->Invalidate();
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus)
-{
-    ProvideSize(nPageIndex);
-    maPageDescriptors[nPageIndex].meStatus = eStatus;
-    PaintPage(nPageIndex);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetPageVisibility (sal_Int32 nPageIndex, bool bVisible)
-{
-    ProvideSize(nPageIndex);
-    maPageDescriptors[nPageIndex].mbVisible = bVisible;
-    PaintPage(nPageIndex);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate)
-{
-    ProvideSize(nPageIndex);
-    maPageDescriptors[nPageIndex].mbUpToDate = bUpToDate;
-    PaintPage(nPageIndex);
-}
-
-
-
-
-Rectangle SlideSorterCacheDisplay::GetPageBox (sal_Int32 nPageIndex)
-{
-    sal_Int32 nRow = nPageIndex / mnColumnCount;
-    sal_Int32 nColumn = nPageIndex % mnColumnCount;
-    return Rectangle(
-        Point(mnHorizontalBorder + nColumn * maCellSize.Width() + nColumn*mnHorizontalGap,
-            mnVerticalBorder + nRow * maCellSize.Height() + nRow*mnVerticalGap),
-        maCellSize);
-}
-
-
-
-
-void SlideSorterCacheDisplay::AddInstance (
-    const SdDrawDocument* pDocument,
-    SlideSorterCacheDisplay* pControl)
-{
-    maDisplays[pDocument] = pControl;
-}
-
-
-
-
-void SlideSorterCacheDisplay::RemoveInstance (SlideSorterCacheDisplay* pControl)
-{
-    ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
-    for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
-        if (iDisplay->second == pControl)
-        {
-            maDisplays.erase(iDisplay);
-            break;
-        }
-}
-
-
-
-
-void SlideSorterCacheDisplay::ProvideSize (sal_Int32 nPageIndex)
-{
-    if (maPageDescriptors.size() <= (sal_uInt32)nPageIndex)
-        maPageDescriptors.resize(nPageIndex+1);
-    if (mnPageCount <= nPageIndex)
-        mnPageCount = nPageIndex;
-}
-
-
-
-
-Size SlideSorterCacheDisplay::GetPreferredSize (void)
-{
-    return Size(100,100);
-}
-
-
-
-
-sal_Int32 SlideSorterCacheDisplay::GetPreferredWidth (sal_Int32 nHeigh)
-{
-    return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 SlideSorterCacheDisplay::GetPreferredHeight (sal_Int32 nWidth)
-{
-    return GetPreferredSize().Height();
-}
-
-
-
-::Window* SlideSorterCacheDisplay::GetWindow (void)
-{
-    return mpWindow;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsExpandable (void) const
-{
-    return true;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsExpanded (void) const
-{
-    return true;
-}
-
-
-
-
-void SlideSorterCacheDisplay::PaintPage (sal_Int32 nPageIndex)
-{
-    if (mpWindow != NULL)
-    {
-        Paint(GetPageBox(nPageIndex));
-    }
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/SubToolPanel.cxx b/main/sd/source/ui/toolpanel/SubToolPanel.cxx
deleted file mode 100644
index 16eba12..0000000
--- a/main/sd/source/ui/toolpanel/SubToolPanel.cxx
+++ /dev/null
@@ -1,386 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/SubToolPanel.hxx"
-
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TitleBar.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "AccessibleTreeNode.hxx"
-#include <vcl/decoview.hxx>
-#include <vcl/svapp.hxx>
-
-namespace sd { namespace toolpanel {
-
-
-SubToolPanel::SubToolPanel (
-    Window& i_rParentWindow)
-    : Control (&i_rParentWindow, WB_DIALOGCONTROL),
-      TreeNode(NULL),
-      maWindowFiller(this),
-      mbIsRearrangePending(true),
-      mbIsLayoutPending(true),
-      mnChildrenWidth(0),
-      mnVerticalBorder(0),
-      mnVerticalGap(3),
-      mnHorizontalBorder(2)
-{
-    SetAccessibleName (
-        ::rtl::OUString::createFromAscii("Sub Task Panel"));
-    mpControlContainer->SetMultiSelection (true);
-
-    SetBorderStyle (WINDOW_BORDER_NORMAL);
-    SetMapMode (MapMode(MAP_PIXEL));
-
-    // To reduce flickering during repaints make the container windows
-    // transparent and rely on their children to paint the whole area.
-    SetBackground(Wallpaper());
-    maWindowFiller.SetBackground(
-        Application::GetSettings().GetStyleSettings().GetWindowColor());
-}
-
-
-
-
-SubToolPanel::~SubToolPanel (void)
-{
-    sal_uInt32 nCount = mpControlContainer->GetControlCount();
-    for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TitledControl* pControl = static_cast<TitledControl*>(
-            mpControlContainer->GetControl(nIndex));
-        pControl->GetControl()->GetWindow()->RemoveEventListener(
-            LINK(this,SubToolPanel,WindowEventListener));
-    }
-    mpControlContainer->DeleteChildren();
-}
-
-
-
-
-void SubToolPanel::Paint (const Rectangle& rRect)
-{
-    if (mbIsRearrangePending)
-        Rearrange();
-    if (mbIsLayoutPending)
-        LayoutChildren();
-    ::Window::Paint (rRect);
-
-    // Paint the outer border and the space between every two children.
-    Color aOriginalLineColor (GetLineColor());
-    Color aOriginalFillColor (GetFillColor());
-
-    SetLineColor ();
-    SetFillColor (GetSettings().GetStyleSettings().GetWindowColor());
-
-    Size aSize (GetOutputSizePixel());
-    // Paint left and right vertical border.
-    Rectangle aVerticalArea (
-        Point(0,0), 
-        Size(mnHorizontalBorder,aSize.Height()));
-    DrawRect (aVerticalArea);
-    aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
-    aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
-    DrawRect (aVerticalArea);
-
-    // Paint horizontal stripes.
-    Rectangle aStripeArea (
-        Point (mnHorizontalBorder,0),
-        Size(mnChildrenWidth,0));
-    StripeList::const_iterator iStripe;
-    for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); iStripe++)
-    {
-        aStripeArea.Top() = iStripe->first;
-        aStripeArea.Bottom() = iStripe->second;
-        if (aStripeArea.Bottom() < 0)
-            continue;
-        if (aStripeArea.Top() >= aSize.Height())
-            break;
-        DrawRect (aStripeArea);
-    }
-    
-    SetLineColor (aOriginalLineColor);
-    SetFillColor (aOriginalFillColor);
-}
-
-
-
-
-void SubToolPanel::Resize (void)
-{
-    ::Window::Resize();
-    mbIsRearrangePending = true;
-    mbIsLayoutPending = true;
-}
-
-
-
-
-void SubToolPanel::RequestResize (void)
-{
-    mbIsRearrangePending = true;
-    mbIsLayoutPending = true;
-    Invalidate();
-}
-
-
-
-
-Size SubToolPanel::GetPreferredSize (void)
-{
-    return GetRequiredSize();
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetPreferredWidth (sal_Int32 )
-{
-    return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetPreferredHeight (sal_Int32 )
-{
-    return GetPreferredSize().Height();
-}
-
-
-
-
-bool SubToolPanel::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-::Window* SubToolPanel::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetMinimumWidth (void)
-{
-    return TreeNode::GetMinimumWidth();
-}
-
-
-
-
-void SubToolPanel::ExpandControl (
-    TreeNode* pControl,
-    bool bExpansionState)
-{
-    // Toggle expand status.
-    pControl->Expand (bExpansionState);
-
-    Rearrange ();
-    Invalidate ();
-}
-
-
-
-
-/** This control shows an expansion bar for every control and in a
-    separate area below that expansion area it shows all controls each
-    with its title bar.  When there is not enough space then show a
-    scroll bar in the control area.
-*/
-void SubToolPanel::Rearrange (void)
-{
-    Size aRequiredSize (GetRequiredSize());
-    if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
-    {
-        Size aAvailableSize (GetOutputSizePixel());
-
-        // Make the children at least as wide as the sub tool panel.
-        if (aRequiredSize.Width() < aAvailableSize.Width())
-            aRequiredSize.Width() = aAvailableSize.Width();
-        mnChildrenWidth = -2*mnHorizontalBorder;
-        mnChildrenWidth += aAvailableSize.Width();
-        
-        LayoutChildren();
-
-        mbIsRearrangePending = false;
-    }
-}
-
-
-
-
-Size SubToolPanel::GetRequiredSize (void)
-{
-    // First determine the width of the children.  This is the maximum of
-    // the current window width and the individual minimum widths of the
-    // children. 
-    int nChildrenWidth (GetSizePixel().Width());
-    unsigned int nCount = mpControlContainer->GetControlCount();
-    unsigned int nIndex;
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        int nMinimumWidth (pChild->GetMinimumWidth());
-        if (nMinimumWidth > nChildrenWidth)
-            nChildrenWidth = nMinimumWidth;
-    }
-
-    // Determine the accumulated width of all children when scaled to the
-    // minimum width.
-    nChildrenWidth -= 2*mnHorizontalBorder;
-    Size aTotalSize (nChildrenWidth, 
-        2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
-        aTotalSize.Height() += nHeight;
-    }
-
-    return aTotalSize;
-}
-
-
-
-
-sal_Int32 SubToolPanel::LayoutChildren (void)
-{
-    // Determine vertical space that can be distributed to sizable children.
-    unsigned int nCount (mpControlContainer->GetControlCount());
-    unsigned int nResizableCount = 0;
-    int nAvailableHeight = GetSizePixel().Height() - 2*mnVerticalBorder;
-    unsigned int nIndex;
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
-        if (pChild->IsResizable())
-            nResizableCount++;
-        else
-            nAvailableHeight -= nControlHeight;
-    }
-
-    maStripeList.clear();
-
-    Point aPosition (0,0);
-    aPosition.X() += mnHorizontalBorder;
-    maStripeList.push_back( ::std::pair<int,int>(
-        aPosition.Y(),
-        aPosition.Y() + mnVerticalBorder - 1));
-    aPosition.Y() += mnVerticalBorder;
-
-    // Place the controls one over the other.
-    for (nIndex=0; nIndex<nCount; nIndex++)
-    {
-        if (nIndex > 0)
-        {
-            maStripeList.push_back( ::std::pair<int,int>(
-                aPosition.Y(),
-                aPosition.Y() + mnVerticalGap - 1));
-            aPosition.Y() += mnVerticalGap;
-        }
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
-        if (pChild->IsResizable())
-        {
-            nControlHeight = nAvailableHeight / nResizableCount;
-            nResizableCount--;
-        }
-        nAvailableHeight -= nControlHeight;
-        pChild->GetWindow()->SetPosSizePixel(
-            aPosition,
-            Size(mnChildrenWidth, nControlHeight));
-        aPosition.Y() += nControlHeight;
-    }
-
-    // If the children do not cover their parent window completely
-    // (regarding the height) we put a filler below that is responsible for
-    // painting the remaining space.
-    int nWindowHeight = GetSizePixel().Height();
-    if (aPosition.Y() < nWindowHeight)
-    {
-        maWindowFiller.SetPosSizePixel (
-            aPosition,
-            Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
-        maStripeList.push_back( ::std::pair<int,int>(
-            aPosition.Y(),
-            nWindowHeight-1));
-        //        maScrollWindowFiller.Show();
-        aPosition.Y() = nWindowHeight;
-    }
-    else
-        maWindowFiller.Hide();
-
-    aPosition.Y() += mnVerticalBorder;
-    mbIsLayoutPending = false;
-
-    return aPosition.Y();
-}
-
-
-
-
-IMPL_LINK(SubToolPanel, WindowEventListener, VclSimpleEvent*, pEvent)
-{
-    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
-    {
-        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
-        switch (pWindowEvent->GetId())
-        {
-            case VCLEVENT_WINDOW_SHOW:
-            case VCLEVENT_WINDOW_HIDE:
-            case VCLEVENT_WINDOW_ACTIVATE:
-            case VCLEVENT_WINDOW_RESIZE:
-                RequestResize();
-                break;
-        }
-    }
-    return 0;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> SubToolPanel::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    return new ::accessibility::AccessibleTreeNode (
-        *this,
-        ::rtl::OUString::createFromAscii("Sub Task Panel"),
-        ::rtl::OUString::createFromAscii("Sub Task Panel"),
-        ::com::sun::star::accessibility::AccessibleRole::PANEL);
-}
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/main/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
deleted file mode 100644
index 6e40a40..0000000
--- a/main/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <vos/diagnose.hxx>
-
-namespace sd { namespace toolpanel {
-
-ControlFactory::ControlFactory (void)
-{
-}
-
-
-
-
-ControlFactory::~ControlFactory (void)
-{
-}
-
-
-
-
-::std::auto_ptr<TreeNode> ControlFactory::CreateControl( ::Window& i_rParent )
-{
-    TreeNode* pNewNode = InternalCreateControl( i_rParent );
-    return ::std::auto_ptr<TreeNode>( pNewNode );
-}
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx b/main/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
deleted file mode 100644
index 3daa9f1..0000000
--- a/main/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
+++ /dev/null
@@ -1,328 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "TaskPaneFocusManager.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/event.hxx>
-#include <rtl/instance.hxx>
-#include <hash_map>
-
-namespace {
-
-class WindowHash
-{
-public:
-    size_t operator()(const ::Window* argument) const 
-    { return reinterpret_cast<unsigned long>(argument); }
-};
-
-class EventDescriptor
-{
-public:
-    EventDescriptor (const KeyCode& rKey, ::Window* pWindow)
-        : maKeyCode(rKey), mpTargetWindow(pWindow) {}
-    KeyCode maKeyCode;
-    ::Window* mpTargetWindow;
-};
-
-} // end of anonymous namespace
-
-
-
-
-namespace sd { namespace toolpanel {
-
-
-
-class FocusManager::LinkMap
-    : public ::std::hash_multimap< ::Window*, EventDescriptor, WindowHash>
-{
-};
-
-
-
-FocusManager& FocusManager::Instance (void)
-{
-    static FocusManager* spInstance = NULL;
-
-    if (spInstance == NULL)
-    {
-        ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
-        if (spInstance == NULL)
-        {
-            static FocusManager aInstance;
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-            spInstance = &aInstance;
-        }
-    }
-    else
-    {
-        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-    }
-    return *spInstance;
-}
-
-
-
-
-FocusManager::FocusManager (void)
-    : mpLinks(new LinkMap())
-{
-}
-
-
-
-
-FocusManager::~FocusManager (void)
-{
-    Clear();
-}
-
-
-
-
-void FocusManager::Clear (void)
-{
-    if (mpLinks.get() != NULL)
-    {
-        while ( ! mpLinks->empty())
-        {
-            ::Window* pWindow = mpLinks->begin()->first;
-            if (pWindow == NULL)
-            {
-                mpLinks->erase(mpLinks->begin());
-            }
-            else
-            {
-                RemoveLinks(pWindow);
-            }
-        }
-    }
-}
-
-
-
-
-void FocusManager::RegisterUpLink (::Window* pSource, ::Window* pTarget)
-{
-    RegisterLink(pSource, pTarget, KEY_ESCAPE);
-}
-
-
-
-
-void FocusManager::RegisterDownLink (::Window* pSource, ::Window* pTarget)
-{
-    RegisterLink(pSource, pTarget, KEY_RETURN);
-}
-
-
-
-
-void FocusManager::RegisterLink (
-    ::Window* pSource,
-    ::Window* pTarget,
-    const KeyCode& rKey)
-{
-    OSL_ASSERT(pSource!=NULL);
-    OSL_ASSERT(pTarget!=NULL);
-
-    if (pSource==NULL || pTarget==NULL)
-        return;
-
-    // Register this focus manager as event listener at the source window.
-    if (mpLinks->equal_range(pSource).first == mpLinks->end())
-        pSource->AddEventListener (LINK (this, FocusManager, WindowEventListener));
-    mpLinks->insert(LinkMap::value_type(pSource, EventDescriptor(rKey,pTarget)));
-}
-
-
-
-
-void FocusManager::RemoveLinks (
-    ::Window* pSourceWindow,
-    ::Window* pTargetWindow)
-{
-    OSL_ASSERT(pSourceWindow!=NULL);
-    OSL_ASSERT(pTargetWindow!=NULL);
-
-    if (pSourceWindow==NULL || pTargetWindow==NULL)
-    {
-        // This method was called with invalid arguments.  To avoid
-        // referencing windows that will soon be deleted we clear *all*
-        // links as an emergency fallback.
-        Clear();
-        return;
-    }
-    
-    ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates;
-    LinkMap::iterator iCandidate;
-    bool bLoop (mpLinks->size() > 0);
-    while (bLoop)
-    {
-        aCandidates = mpLinks->equal_range(pSourceWindow);
-        if (aCandidates.first == mpLinks->end())
-        {
-            // No links for the source window found -> nothing more to do.
-            bLoop = false;
-        }
-        else
-        {
-            // Set the loop control to false so that when no candidate for
-            // deletion is found the loop is left.
-            bLoop = false;
-            for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
-                if (iCandidate->second.mpTargetWindow == pTargetWindow)
-                {
-                    mpLinks->erase(iCandidate);
-                    // One link erased.  The iterators have become invalid so
-                    // start the search for links to delete anew.
-                    bLoop = true;
-                    break;
-                }
-        }
-    }
-
-    RemoveUnusedEventListener(pSourceWindow);
-}
-
-
-
-
-void FocusManager::RemoveLinks (::Window* pWindow)
-{
-    OSL_ASSERT(pWindow!=NULL);
-
-    if (pWindow == NULL)
-    {
-        // This method was called with invalid arguments.  To avoid
-        // referencing windows that will soon be deleted we clear *all*
-        // links as an emergency fallback.
-        Clear();
-        return;
-    }
-
-    // Make sure that we are not called back for the window.
-    pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
-    
-    // Remove the links from the given window.
-    ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates(mpLinks->equal_range(pWindow));
-    mpLinks->erase(aCandidates.first, aCandidates.second);
-
-    // Remove links to the given window.
-    bool bLinkRemoved;
-    do
-    {
-		bLinkRemoved = false;
-        LinkMap::iterator iLink;
-        for (iLink=mpLinks->begin(); iLink!=mpLinks->end(); ++iLink)
-        {
-            if (iLink->second.mpTargetWindow == pWindow)
-            {
-                RemoveUnusedEventListener(iLink->first);
-                mpLinks->erase(iLink);
-                bLinkRemoved = true;
-                break;
-            }
-        }
-    }
-    while (bLinkRemoved);
-}
-
-
-
-
-void FocusManager::RemoveUnusedEventListener (::Window* pWindow)
-{
-    OSL_ASSERT(pWindow!=NULL);
-    
-    if (pWindow == NULL)
-        return;
-
-    // When there are no more links from the window to another window
-    // then remove the event listener from the window.
-    if (mpLinks->find(pWindow) == mpLinks->end())
-        pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
-}
-
-
-
-
-bool FocusManager::TransferFocus (
-    ::Window* pSourceWindow,
-    const KeyCode& rKeyCode)
-{
-    bool bSuccess (false);
-
-    OSL_ASSERT(pSourceWindow!=NULL);
-    if (pSourceWindow == NULL)
-        return bSuccess;
-
-    ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates (
-        mpLinks->equal_range(pSourceWindow));
-    LinkMap::const_iterator iCandidate;
-    for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
-        if (iCandidate->second.maKeyCode == rKeyCode)
-        {
-            OSL_ASSERT(iCandidate->second.mpTargetWindow != NULL);
-            iCandidate->second.mpTargetWindow->GrabFocus();
-            bSuccess = true;
-            break;
-        }
-
-    return bSuccess;
-}
-
-
-
-
-IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
-{
-    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
-    {
-        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
-        switch (pWindowEvent->GetId())
-        {
-            case VCLEVENT_WINDOW_KEYINPUT:
-            {
-                ::Window* pSource = pWindowEvent->GetWindow();
-                KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
-                TransferFocus(pSource, pKeyEvent->GetKeyCode());
-            }
-            break;
-
-            case VCLEVENT_OBJECT_DYING:
-                RemoveLinks(pWindowEvent->GetWindow());
-                break;
-        }
-    }
-    return 1;
-}
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/main/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
deleted file mode 100644
index 109ed7c..0000000
--- a/main/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "TaskPaneShellManager.hxx"
-
-#include "ViewShellManager.hxx"
-#include <tools/diagnose_ex.h>
-#include <vcl/window.hxx>
-
-#include <algorithm>
-
-namespace sd { namespace toolpanel {
-
-TaskPaneShellManager::TaskPaneShellManager (
-    const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
-    const ViewShell& rViewShell)
-    : mpViewShellManager(rpViewShellManager),
-      mrViewShell(rViewShell),
-      maSubShells()
-{
-}
-
-
-
-
-TaskPaneShellManager::~TaskPaneShellManager (void)
-{
-    while ( ! maSubShells.empty())
-        RemoveSubShell(maSubShells.begin()->second.mpShell);
-}
-
-
-
-
-SfxShell* TaskPaneShellManager::CreateShell( ShellId nId, ::Window* , FrameView* )
-{
-    SubShells::const_iterator iShell (maSubShells.find(nId));
-    if (iShell != maSubShells.end())
-        return iShell->second.mpShell;
-    else
-        return NULL;
-}
-
-
-
-
-void TaskPaneShellManager::ReleaseShell (SfxShell* )
-{
-    // Nothing to do.
-}
-
-void TaskPaneShellManager::AddSubShell (
-    ShellId nId,
-    SfxShell* pShell,
-    ::Window* pWindow)
-{
-    if (pShell != NULL)
-    {
-        maSubShells[nId] = ShellDescriptor(pShell,pWindow);
-        if (pWindow != NULL)
-        {
-            pWindow->AddEventListener(LINK(this,TaskPaneShellManager,WindowCallback));
-            if (pWindow->IsReallyVisible())
-                mpViewShellManager->ActivateSubShell(mrViewShell, nId);
-        }
-        else
-            mpViewShellManager->ActivateSubShell(mrViewShell, nId);
-    }
-}
-
-
-
-
-void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId)
-{
-    SubShells::iterator pos = maSubShells.find( i_nShellId );
-    ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" );
-    if ( pos->second.mpWindow != NULL )
-    {
-        pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) );
-    }
-    mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first );
-    maSubShells.erase( pos );
-}
-
-
-
-
-void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell)
-{
-    if (pShell != NULL)
-    {
-        SubShells::iterator iShell;
-        for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
-            if (iShell->second.mpShell == pShell)
-            {
-                if (iShell->second.mpWindow != NULL)
-                    iShell->second.mpWindow->RemoveEventListener(
-                        LINK(this,TaskPaneShellManager,WindowCallback));
-                mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
-                maSubShells.erase(iShell);
-                break;
-            }
-    }
-}
-
-
-
-
-void TaskPaneShellManager::MoveToTop (SfxShell* pShell)
-{
-    SubShells::const_iterator iShell;
-    for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
-        if (iShell->second.mpShell == pShell)
-        {
-            ViewShellManager::UpdateLock aLocker (mpViewShellManager);
-            mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first);
-            mpViewShellManager->MoveToTop(mrViewShell);
-            break;
-        }
-}
-
-
-
-
-IMPL_LINK(TaskPaneShellManager, WindowCallback, VclWindowEvent*, pEvent)
-{
-    if (pEvent != NULL)
-    {
-        SubShells::const_iterator iShell;
-        ::Window* pWindow = pEvent->GetWindow();
-        for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
-            if (iShell->second.mpWindow == pWindow)
-                break;
-        if (iShell != maSubShells.end())
-            switch (pEvent->GetId())
-            {
-                case VCLEVENT_WINDOW_SHOW:
-                    mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first);
-                    break;
-
-                case VCLEVENT_WINDOW_HIDE:
-                    // Do not activate the sub shell.  This leads to
-                    // problems with shapes currently being in text edit
-                    // mode: Deactivating the shell leads to leaving the
-                    // text editing mode.
-                    // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
-                    break;
-            }
-    }
-
-    return 0;
-}
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/main/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
deleted file mode 100644
index 0235f0a..0000000
--- a/main/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
-#define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
-
-#include "ShellFactory.hxx"
-#include "ViewShellManager.hxx"
-#include <map>
-
-class FrameView;
-class SfxShell;
-class VclWindowEvent;
-class Window;
-
-namespace sd {
-class ViewShell;
-}
-
-namespace sd { namespace toolpanel {
-
-/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
-    interface.  However, it does not create or delete shells.  It only
-    gives the ViewShellManager access to the sub shells of the
-    ToolPanelViewShell.  Life time control of the sub shells is managed by
-    the sub shells themselves.
-*/
-class TaskPaneShellManager
-    : public ShellFactory<SfxShell>
-{
-public:
-    /** Create a shell manager that manages the stacked shells for the given
-        view shell.  It works together with the given view shell manager.
-    */
-    TaskPaneShellManager (
-        const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
-        const ViewShell& rViewShell);
-    ~TaskPaneShellManager (void);
-
-    /** Return the requested sub shell.
-        @param nId
-            The id of the requested sub shell.
-        @return
-            When there is no sub shell currently registered under the given
-            id then NULL is returned.
-    */
-    virtual SfxShell* CreateShell (
-        ShellId nId,
-        ::Window* pParentWindow,
-        FrameView* pFrameView = NULL);
-    
-    virtual void ReleaseShell (SfxShell* pShell);
-
-    /** Add a sub shell to the set of sub shells managed by the
-        TaskPaneShellManager.  Only shells added by this method are returned
-        by CreateShell().
-    */
-    void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
-
-    /** Remove the given shell from the set of sub shells managed by the
-        TaskPaneShellManager.  Following calls to CreateShell() will return
-        NULL when this shell is requested.
-    */
-    void RemoveSubShell (const SfxShell* pShell);
-    /** removes the shell given by its ID from the set of sub shells managed by the 
-        TaskPaneShellManager. Subsequent calls to CreateShell() will return
-        NULL when this shell is requested.
-    */
-    void RemoveSubShell (const ShellId i_nShellId);
-
-    /** Move the given sub-shell to the top of the local shell stack.
-        Furthermore move the view shell whose sub-shells this class manages
-        to the top of the global shell stack.
-    */
-    void MoveToTop (SfxShell* pShell);
-
-    DECL_LINK(WindowCallback,VclWindowEvent*);
-
-private:
-    ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
-
-    /// The view shell whose sub-shells this class manages.
-    const ViewShell& mrViewShell;
-
-    class ShellDescriptor { public:
-        SfxShell* mpShell;
-        ::Window* mpWindow;
-        ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
-        ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
-    };
-    typedef ::std::map<ShellId,ShellDescriptor> SubShells;
-    SubShells maSubShells;
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/main/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
deleted file mode 100644
index 866967b..0000000
--- a/main/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
+++ /dev/null
@@ -1,288 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#include "taskpane/ControlContainer.hxx"
-#include "taskpane/TitledControl.hxx"
-
-#include <vector>
-#include <algorithm>
-
-namespace sd { namespace toolpanel {
-
-TreeNode::TreeNode( TreeNode* pParent)
-: mpControlContainer (new ControlContainer(this))
-, mpParent (pParent)
-, maStateChangeListeners()
-{
-}
-
-
-
-
-TreeNode::~TreeNode (void)
-{
-}
-
-
-
-
-void TreeNode::SetParentNode (TreeNode* pNewParent)
-{
-    mpParent = pNewParent;
-    GetWindow()->SetParent (pNewParent->GetWindow());
-}
-
-
-
-
-TreeNode* TreeNode::GetParentNode (void)
-{
-    return mpParent;
-}
-
-
-
-
-::Window* TreeNode::GetWindow (void)
-{
-    return NULL;
-}
-
-
-
-
-const ::Window* TreeNode::GetConstWindow (void) const
-{
-    return const_cast<TreeNode*>(this)->GetWindow();
-}
-
-
-
-
-sal_Int32 TreeNode::GetMinimumWidth (void)
-{
-    sal_Int32 nTotalMinimumWidth = 0;
-    unsigned int nCount = mpControlContainer->GetControlCount();
-    for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
-    {
-        TreeNode* pChild = mpControlContainer->GetControl (nIndex);
-        sal_Int32 nMinimumWidth = pChild->GetMinimumWidth ();
-        if (nMinimumWidth > nTotalMinimumWidth)
-            nTotalMinimumWidth = nMinimumWidth;
-    }
-
-    return nTotalMinimumWidth;;
-}
-
-
-
-
-bool TreeNode::IsResizable (void)
-{
-    return false;
-}
-
-
-
-
-void TreeNode::RequestResize (void)
-{
-    if (mpParent != NULL)
-        mpParent->RequestResize();
-}
-
-
-
-
-ControlContainer& TreeNode::GetControlContainer (void)
-{
-    return *mpControlContainer.get();
-}
-
-
-
-
-bool TreeNode::Expand (bool bExpansionState)
-{
-    bool bExpansionStateChanged (false);
-
-    if (IsExpandable() && IsExpanded()!=bExpansionState)
-    {
-        if (bExpansionState)
-            GetWindow()->Show();
-        else
-            GetWindow()->Hide();
-        bExpansionStateChanged = true;
-
-        FireStateChangeEvent (EID_EXPANSION_STATE_CHANGED);
-    }
-
-    return bExpansionStateChanged;
-}
-
-
-
-
-bool TreeNode::IsExpanded (void) const
-{
-    if (GetConstWindow()!=NULL)
-        return GetConstWindow()->IsVisible();
-    else
-        return false;
-}
-
-
-
-
-bool TreeNode::IsExpandable (void) const
-{
-    return GetConstWindow()!=NULL;
-}
-
-
-
-
-void TreeNode::Show (bool bExpansionState)
-{
-    if (GetWindow() != NULL)
-    {
-        bool bWasShowing (IsShowing());
-        GetWindow()->Show (bExpansionState);
-        if (bWasShowing != bExpansionState)
-            FireStateChangeEvent (EID_SHOWING_STATE_CHANGED);
-    }
-}
-
-
-
-
-bool TreeNode::IsShowing (void) const
-{
-    const ::Window* pWindow = const_cast<TreeNode*>(this)->GetWindow();
-    if (pWindow != NULL)
-        return pWindow->IsVisible();
-    else
-        return false;
-}
-
-
-
-
-TaskPaneShellManager* TreeNode::GetShellManager (void)
-{
-    if (mpParent != NULL)
-        return mpParent->GetShellManager();
-    else
-        return NULL;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> TreeNode::GetAccessibleObject (void)
-{
-    ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible> xAccessible;
-    ::Window* pWindow = GetWindow();
-    if (pWindow != NULL)
-    {
-        xAccessible = pWindow->GetAccessible(sal_False);
-        if ( ! xAccessible.is())
-        {
-            ::com::sun::star::uno::Reference<
-                ::com::sun::star::accessibility::XAccessible> xParent;
-            if (pWindow!=NULL && pWindow->GetAccessibleParentWindow()!=NULL)
-                xParent = pWindow->GetAccessibleParentWindow()->GetAccessible();
-            xAccessible = CreateAccessibleObject(xParent);
-            pWindow->SetAccessible(xAccessible);
-        }
-    }
-    return xAccessible;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> TreeNode::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    if (GetWindow() != NULL)
-        return GetWindow()->CreateAccessible();
-    else
-        return NULL;
-}
-
-
-
-
-void TreeNode::AddStateChangeListener (const Link& rListener)
-{
-    if (::std::find (
-        maStateChangeListeners.begin(), 
-        maStateChangeListeners.end(),
-        rListener) == maStateChangeListeners.end())
-    {
-        maStateChangeListeners.push_back(rListener);
-    }
-}
-
-
-
-
-void TreeNode::FireStateChangeEvent (
-    TreeNodeStateChangeEventId eEventId,
-    TreeNode* pChild) const
-{
-    TreeNodeStateChangeEvent aEvent (*this, eEventId, pChild);
-    StateChangeListenerContainer aContainerCopy(maStateChangeListeners);
-    StateChangeListenerContainer::iterator aLink (aContainerCopy.begin());
-    StateChangeListenerContainer::iterator aEnd (aContainerCopy.end());
-    while (aLink!=aEnd)
-    {
-        aLink->Call (&aEvent);
-        ++aLink;
-    }
-}
-
-
-
-TreeNodeStateChangeEvent::TreeNodeStateChangeEvent (
-    const TreeNode& rNode,
-    TreeNodeStateChangeEventId eEventId,
-    TreeNode* pChild)
-    : mrSource(rNode),
-      meEventId(eEventId),
-      mpChild(pChild)
-{
-}
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TestMenu.cxx b/main/sd/source/ui/toolpanel/TestMenu.cxx
deleted file mode 100644
index bf81561..0000000
--- a/main/sd/source/ui/toolpanel/TestMenu.cxx
+++ /dev/null
@@ -1,314 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "TestMenu.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <vcl/image.hxx>
-#include <vcl/svapp.hxx>
-
-namespace sd { namespace toolpanel {
-
-#ifdef SHOW_COLOR_MENU
-/** This factory class is used to create instances of ColorMenu.  It can be
-    extended so that its constructor stores arguments that later are passed
-    to new ColorMenu objects.
-*/
-class ColorMenuFactory
-    : public ControlFactory
-{
-protected:
-    virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
-    {
-        return new ColorMenu (&i_rParent);
-    }
-};
-
-
-ColorMenu::ColorMenu (::Window* i_pParent)
-    : Window (i_pParent),
-      TreeNode(NULL),
-      maSet (this),
-      mnPreferredColumnCount(2)
-{
-    WinBits aStyle = 
-        WB_ITEMBORDER 
-        | WB_DOUBLEBORDER 
-        | WB_NAMEFIELD 
-        | WB_FLATVALUESET
-        | WB_TABSTOP
-        | WB_VSCROLL;
-
-    maSet.SetStyle (maSet.GetStyle() | aStyle); 
-	maSet.SetExtraSpacing(2);
-
-    Fill ();
-    maSet.Show();
-    i_pParent->Resize();
-}
-
-
-
-
-ColorMenu::~ColorMenu (void)
-{
-}
-
-
-::std::auto_ptr<ControlFactory> ColorMenu::CreateControlFactory (void)
-{
-    return ::std::auto_ptr<ControlFactory>(new ColorMenuFactory());
-}
-
-
-/** The preferred size depends on the preferred number of columns, the
-    number of items, and the size of the items.
-*/
-Size ColorMenu::GetPreferredSize (void)
-{
-    Size aItemSize = maSet.CalcItemSizePixel (Size());
-    Size aPreferredWindowSize = maSet.CalcWindowSizePixel (
-        aItemSize,
-        (sal_uInt16)mnPreferredColumnCount,
-        (sal_uInt16)CalculateRowCount (aItemSize, (sal_uInt16)mnPreferredColumnCount));
-    return aPreferredWindowSize;
-}
-
-
-
-
-sal_Int32 ColorMenu::GetPreferredWidth (sal_Int32 nHeight)
-{
-    sal_Int32 nPreferredWidth = 0;
-    if (maSet.GetItemCount() > 0)
-    {
-        Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
-        Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel());
-        if (nHeight>0 && aItemSize.Height()>0)
-        {
-            int nRowCount = nHeight / aItemSize.Height();
-            if (nRowCount <= 0)
-                nRowCount = 1;
-            int nColumnCount = (maSet.GetItemCount() + nRowCount-1) 
-                / nRowCount;
-            nPreferredWidth = nColumnCount * aItemSize.Width();
-        }
-    }
-
-    return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 ColorMenu::GetPreferredHeight (sal_Int32 nWidth)
-{
-    sal_Int32 nPreferredHeight = 0;
-    if (maSet.GetItemCount()>0)
-    {
-        Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
-        Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel());
-        if (nWidth>0 && aItemSize.Width()>0)
-        {
-            int nColumnCount = nWidth / aItemSize.Width();
-            if (nColumnCount <= 0)
-                nColumnCount = 1;
-            else if (nColumnCount > 4)
-                nColumnCount = 4;
-            int nRowCount = (maSet.GetItemCount() + nColumnCount-1) 
-                / nColumnCount;
-            nPreferredHeight = nRowCount * aItemSize.Height();
-        }
-    }
-    return nPreferredHeight;
-}
-
-
-
-
-bool ColorMenu::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-::Window* ColorMenu::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-void ColorMenu::Resize (void)
-{
-    ::Window::Resize();
-    Size aWindowSize = GetOutputSizePixel();
-    maSet.SetPosSizePixel (Point(0,0), aWindowSize);
-    if (IsVisible() && aWindowSize.Width() > 0)
-    {
-        //        maSet.SetPosSizePixel (
-        //            Point (0,0),
-        //            aWindowSize);
-
-        // Calculate the number of rows and columns.
-        if (maSet.GetItemCount() > 0)
-        {
-            Image aImage = maSet.GetItemImage(maSet.GetItemId(0));
-            Size aItemSize = maSet.CalcItemSizePixel (
-                aImage.GetSizePixel());
-            int nColumnCount = aWindowSize.Width() / 30;
-            if (nColumnCount < 1)
-                nColumnCount = 1;
-            else if (nColumnCount > 4)
-                nColumnCount = 4;
-
-            sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount (aItemSize, nColumnCount);
-            
-            maSet.SetColCount ((sal_uInt16)nColumnCount);
-            maSet.SetLineCount (nRowCount);
-        }
-    }
-
-}
-
-
-
-
-int ColorMenu::CalculateRowCount (const Size&, int nColumnCount)
-{
-    int nRowCount = 0;
-
-    if (maSet.GetItemCount()>0 && nColumnCount>0)
-    {
-        nRowCount = GetOutputSizePixel().Height() / 30;
-        if (nRowCount < 1)
-            nRowCount = 1;
-    }
-
-    return nRowCount;
-}
-
-
-
-
-void ColorMenu::Fill (void)
-{
-    const StyleSettings& rSettings (
-        Application::GetSettings().GetStyleSettings());
-    maSet.Clear();
-    maSet.SetItemWidth (30);
-    maSet.SetItemHeight (30);
-    sal_uInt16 i = 0;
-    maSet.InsertItem (++i, rSettings.GetFaceColor());
-    maSet.SetItemText (i, String::CreateFromAscii("FaceColor"));
-    maSet.InsertItem (++i, rSettings.GetCheckedColor());
-    maSet.SetItemText (i, String::CreateFromAscii("CheckedColor"));
-    maSet.InsertItem (++i, rSettings.GetLightColor());
-    maSet.SetItemText (i, String::CreateFromAscii("LightColor"));
-    maSet.InsertItem (++i, rSettings.GetLightBorderColor());
-    maSet.SetItemText (i, String::CreateFromAscii("LightBorderColor"));
-    maSet.InsertItem (++i, rSettings.GetShadowColor());
-    maSet.SetItemText (i, String::CreateFromAscii("ShadowColor"));
-    maSet.InsertItem (++i, rSettings.GetDarkShadowColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DarkShadowColor"));
-    maSet.InsertItem (++i, rSettings.GetButtonTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("ButtonTextColor"));
-    maSet.InsertItem (++i, rSettings.GetRadioCheckTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("RadioCheckTextColor"));
-    maSet.InsertItem (++i, rSettings.GetGroupTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("GroupTextColor"));
-    maSet.InsertItem (++i, rSettings.GetLabelTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("LabelTextColor"));
-    maSet.InsertItem (++i, rSettings.GetInfoTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("InfoTextColor"));
-    maSet.InsertItem (++i, rSettings.GetWindowColor());
-    maSet.SetItemText (i, String::CreateFromAscii("WindowColor"));
-    maSet.InsertItem (++i, rSettings.GetWindowTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("WindowTextColor"));
-    maSet.InsertItem (++i, rSettings.GetDialogColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DialogColor"));
-    maSet.InsertItem (++i, rSettings.GetDialogTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DialogTextColor"));
-    maSet.InsertItem (++i, rSettings.GetWorkspaceColor());
-    maSet.SetItemText (i, String::CreateFromAscii("WorkspaceColor"));
-    maSet.InsertItem (++i, rSettings.GetFieldColor());
-    maSet.SetItemText (i, String::CreateFromAscii("FieldColor"));
-    maSet.InsertItem (++i, rSettings.GetFieldTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("FieldTextColor"));
-    maSet.InsertItem (++i, rSettings.GetActiveColor());
-    maSet.SetItemText (i, String::CreateFromAscii("ActiveColor"));
-    maSet.InsertItem (++i, rSettings.GetActiveColor2());
-    maSet.SetItemText (i, String::CreateFromAscii("ActiveColor2"));
-    maSet.InsertItem (++i, rSettings.GetActiveTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("ActiveTextColor"));
-    maSet.InsertItem (++i, rSettings.GetActiveBorderColor());
-    maSet.SetItemText (i, String::CreateFromAscii("ActiveBorderColor"));
-    maSet.InsertItem (++i, rSettings.GetDeactiveColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor"));
-    maSet.InsertItem (++i, rSettings.GetDeactiveColor2());
-    maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor2"));
-    maSet.InsertItem (++i, rSettings.GetDeactiveTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DeactiveTextColor"));
-    maSet.InsertItem (++i, rSettings.GetDeactiveBorderColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DeactiveBorderColor"));
-    maSet.InsertItem (++i, rSettings.GetHighlightColor());
-    maSet.SetItemText (i, String::CreateFromAscii("HighlightColor"));
-    maSet.InsertItem (++i, rSettings.GetHighlightTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("HighlightTextColor"));
-    maSet.InsertItem (++i, rSettings.GetDisableColor());
-    maSet.SetItemText (i, String::CreateFromAscii("DisableColor"));
-    maSet.InsertItem (++i, rSettings.GetHelpColor());
-    maSet.SetItemText (i, String::CreateFromAscii("HelpColor"));
-    maSet.InsertItem (++i, rSettings.GetHelpTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("HelpTextColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuBarColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuBarColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuBorderColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuBorderColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuTextColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuHighlightColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightColor"));
-    maSet.InsertItem (++i, rSettings.GetMenuHighlightTextColor());
-    maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor"));
-    maSet.InsertItem (++i, rSettings.GetLinkColor());
-    maSet.SetItemText (i, String::CreateFromAscii("LinkColor"));
-    maSet.InsertItem (++i, rSettings.GetVisitedLinkColor());
-    maSet.SetItemText (i, String::CreateFromAscii("VisitedLinkColor"));
-    maSet.InsertItem (++i, rSettings.GetHighlightLinkColor());
-    maSet.SetItemText (i, String::CreateFromAscii("HighlightLinkColor"));
-    maSet.InsertItem (++i, rSettings.GetFontColor());
-    maSet.SetItemText (i, String::CreateFromAscii("FontColor"));
-}
-#endif
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TestMenu.hxx b/main/sd/source/ui/toolpanel/TestMenu.hxx
deleted file mode 100644
index f0cce96..0000000
--- a/main/sd/source/ui/toolpanel/TestMenu.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_COLOR_MENU_HXX
-#define SD_TASKPANE_COLOR_MENU_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-#include <svtools/valueset.hxx>
-#include <vcl/window.hxx>
-
-#include <memory>
-
-
-namespace sd { namespace toolpanel {
-
-class ControlFactory;
-
-#ifdef SHOW_COLOR_MENU
-
-/** This demo menu shows the colors that are available from the
-    StyleSettings.
-*/
-class ColorMenu
-    : public ::Window,
-      public TreeNode
-{
-public:
-    ColorMenu (::Window* i_pParent);
-    virtual ~ColorMenu (void);
-
-    static ::std::auto_ptr<ControlFactory> CreateControlFactory (void);
-
-    // From ILayoutableWindow
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual bool IsResizable (void);
-    virtual ::Window* GetWindow (void);
-
-    // From ::Window
-    virtual void Resize (void);
-
-	using Window::GetWindow;
-
-private:
-    ValueSet maSet;
-    int mnPreferredColumnCount;
-
-    /** Depending on the given number of columns and the item size
-        calculate the number of rows that are necessary to display all
-        items.
-    */
-    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
-    void Fill (void);
-};
-#endif
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/TestPanel.cxx b/main/sd/source/ui/toolpanel/TestPanel.cxx
deleted file mode 100644
index e298646..0000000
--- a/main/sd/source/ui/toolpanel/TestPanel.cxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "TestPanel.hxx"
-#include "taskpane/ScrollPanel.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <vcl/lstbox.hxx>
-#include <vcl/button.hxx>
-
-namespace sd { namespace toolpanel {
-
-#ifdef SHOW_TEST_PANEL
-/** This factory class is used to create instances of TestPanel.  It can be
-    extended so that its constructor stores arguments that later are passed
-    to new TestPanel objects.
-*/
-class TestPanelFactory
-    : public ControlFactory
-{
-protected:
-    virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
-    {
-        return new TestPanel (i_rParent);
-    }
-};
-
-
-class Wrapper
-    : public TreeNode
-{
-public:
-    Wrapper (
-        TreeNode* pParent, 
-        Size aPreferredSize, 
-        ::Window* pWrappedControl,
-        bool bIsResizable)
-        : TreeNode (pParent),
-          maPreferredSize(aPreferredSize),
-          mpWrappedControl(pWrappedControl),
-          mbIsResizable(bIsResizable)
-    {
-        mpWrappedControl->Show();
-    }
-    virtual ~Wrapper (void) 
-    {
-        delete mpWrappedControl;
-    }
-
-    virtual Size GetPreferredSize (void)
-    {
-        return maPreferredSize;
-    }
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 )
-    {
-        return maPreferredSize.Width();
-    }
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 )
-    {
-        return maPreferredSize.Height();
-    }
-    virtual ::Window* GetWindow (void)
-    {
-        return mpWrappedControl;
-    }
-    virtual bool IsResizable (void)
-    {
-        return mbIsResizable;
-    }
-    virtual bool IsExpandable (void) const
-    {
-        return false;
-    }
-    virtual bool IsExpanded (void) const
-    {
-        return true;
-    }
-
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-    bool mbIsResizable;
-};
-
-
-TestPanel::TestPanel (::Window& i_rParent)
-    : SubToolPanel (i_rParent)
-{
-    // Create a scrollable panel with two list boxes.
-    ScrollPanel* pScrollPanel = new ScrollPanel (this);
-
-    ListBox* pBox = new ListBox (pScrollPanel->GetWindow());
-    int i;
-    for (i=1; i<=20; i++)
-    {
-        XubString aString (XubString::CreateFromAscii("Text "));
-        aString.Append (XubString::CreateFromInt32(i));
-        aString.Append (XubString::CreateFromAscii("/20"));
-        pBox->InsertEntry (aString);
-    }
-    pScrollPanel->AddControl (
-        ::std::auto_ptr<TreeNode>(new Wrapper (
-            pScrollPanel, Size (200,300), pBox, true)),
-        String::CreateFromAscii ("First ListBox"),
-        "");
-
-    pBox = new ListBox (pScrollPanel->GetWindow());
-    for (i=1; i<=20; i++)
-    {
-        XubString aString (XubString::CreateFromAscii("More Text "));
-        aString.Append (XubString::CreateFromInt32(i));
-        aString.Append (XubString::CreateFromAscii("/20"));
-        pBox->InsertEntry (aString);
-    }
-    pScrollPanel->AddControl (
-        ::std::auto_ptr<TreeNode>(new Wrapper (
-            pScrollPanel, Size (200,300), pBox, true)),
-        String::CreateFromAscii ("Second ListBox"),
-        "");
-
-    AddControl (::std::auto_ptr<TreeNode>(pScrollPanel));
-
-    // Add a fixed size button.
-    Button* pButton = new OKButton (this);
-    AddControl (
-        ::std::auto_ptr<TreeNode>(new Wrapper (
-            this, Size (100,30), pButton, false)),
-        String::CreateFromAscii ("Button Area"),
-        "");
-}
-
-
-
-
-
-TestPanel::~TestPanel (void)
-{
-}
-
-std::auto_ptr<ControlFactory> TestPanel::CreateControlFactory (void)
-{
-    return std::auto_ptr<ControlFactory>(new TestPanelFactory());
-}
-#endif
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TestPanel.hxx b/main/sd/source/ui/toolpanel/TestPanel.hxx
deleted file mode 100644
index fb73d4e..0000000
--- a/main/sd/source/ui/toolpanel/TestPanel.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_TEST_PANEL_HXX
-#define SD_TASKPANE_TEST_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-
-namespace sd { namespace toolpanel {
-
-class ControlFactory;
-class TreeNode;
-
-#ifdef SHOW_TEST_PANEL
-
-/** This panel demonstrates how to create a panel for the task pane.
-*/
-class TestPanel
-    : public SubToolPanel
-{
-public:
-    TestPanel (::Window& i_rParent);
-    virtual ~TestPanel (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (void);
-};
-
-#endif
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/TitleBar.cxx b/main/sd/source/ui/toolpanel/TitleBar.cxx
deleted file mode 100644
index 7f829a0..0000000
--- a/main/sd/source/ui/toolpanel/TitleBar.cxx
+++ /dev/null
@@ -1,581 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/TitleBar.hxx"
-
-#include "ControlContainerDescriptor.hxx"
-#include "tools/IconCache.hxx"
-#include "AccessibleTreeNode.hxx"
-#include <vcl/decoview.hxx>
-#include <vcl/window.hxx>
-#include <vcl/virdev.hxx>
-#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include "sdresid.hxx"
-#include <vcl/bitmap.hxx>
-#include <vcl/lineinfo.hxx>
-#include <vcl/bitmapex.hxx>
-#include <tools/color.hxx>
-#include <svx/xdash.hxx>
-#include <svl/itemset.hxx>
-#include <svx/xlndsit.hxx>
-#include <svx/xlineit0.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdpool.hxx>
-#include <svtools/colorcfg.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xfillit0.hxx>
-#include "res_bmp.hrc"
-
-
-namespace sd { namespace toolpanel {
-
-const int TitleBar::snIndentationWidth = 16;
- 
-TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable)
-: ::Window (pParent, WB_TABSTOP)
-, TreeNode(this)
-, meType(eType)
-, msTitle(rsTitle)
-, mbExpanded(false)
-, mbFocused(false)
-, mpDevice(new VirtualDevice (*this))
-, mbIsExpandable (bIsExpandable)
-{
-    EnableMapMode (sal_False);
-
-    SetBackground (Wallpaper());
-
-    // Change the mouse pointer shape so that it acts as a mouse over effect.
-    switch (meType)
-    {
-        case TBT_SUB_CONTROL_HEADLINE:
-            if (mbIsExpandable)
-                SetPointer (POINTER_REFHAND);
-            break;
-    }
-}
-
-
-
-
-TitleBar::~TitleBar (void)
-{
-}
-
-
-
-
-Size TitleBar::GetPreferredSize (void)
-{
-    int nWidth = GetOutputSizePixel().Width();
-    Rectangle aTitleBarBox (
-        CalculateTitleBarBox(
-            CalculateTextBoundingBox(nWidth, true),
-            nWidth));
-
-    return aTitleBarBox.GetSize();
-}
-
-
-
-
-sal_Int32 TitleBar::GetPreferredWidth (sal_Int32 )
-{
-    Rectangle aTitleBarBox (
-        CalculateTitleBarBox(
-            CalculateTextBoundingBox(0, true),
-            0));
-    return aTitleBarBox.GetWidth();
-}
-
-
-
-
-sal_Int32 TitleBar::GetPreferredHeight (sal_Int32 nWidth)
-{
-    Rectangle aTitleBarBox (
-        CalculateTitleBarBox(
-            CalculateTextBoundingBox(nWidth, true),
-            nWidth));
-
-    return aTitleBarBox.GetHeight();
-}
-
-
-
-
-bool TitleBar::IsResizable (void)
-{
-    return true;
-}
-
-
-
-
-::Window* TitleBar::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-sal_Int32 TitleBar::GetMinimumWidth (void)
-{
-    return 20;
-}
-
-
-
-
-void TitleBar::Paint (const Rectangle& rBoundingBox)
-{
-    mpDevice->SetMapMode(GetMapMode());
-    mpDevice->SetOutputSize (GetOutputSizePixel());
-    mpDevice->SetSettings(GetSettings());
-    mpDevice->SetDrawMode(GetDrawMode());
-
-    switch (meType)
-    {
-        case TBT_SUB_CONTROL_HEADLINE:
-            PaintSubPanelHeadLineBar ();
-            break;
-    }
-
-    DrawOutDev (
-        Point(0,0),
-        GetOutputSizePixel(),
-        Point(0,0),
-        GetOutputSizePixel(),
-        *mpDevice);
-
-    ::Window::Paint (rBoundingBox);
-}
-
-
-
-
-bool TitleBar::Expand (bool bFlag)
-{
-    bool bExpansionStateChanged (bFlag!=IsExpanded());
-    mbExpanded = bFlag;
-    Invalidate ();
-    return bExpansionStateChanged;
-}
-
-
-
-
-bool TitleBar::IsExpanded (void) const
-{
-    return mbExpanded;
-}
-
-
-void TitleBar::SetEnabledState(bool bFlag)
-{
-    if(bFlag)
-	    Enable();
-    else
-	    Disable();
-    Invalidate ();
-}
-
-
-
-
-void TitleBar::GetFocus()
-{
-    mbFocused = true;
-    Invalidate();
-}
-
-
-
-
-void TitleBar::LoseFocus()
-{
-    mbFocused = false;
-    Invalidate();
-}
-
-
-
-
-bool TitleBar::HasExpansionIndicator (void) const
-{
-    bool bHasExpansionIndicator (false);
-    if (mbIsExpandable)
-    {
-        switch (meType)
-        {
-            case TBT_SUB_CONTROL_HEADLINE:
-                bHasExpansionIndicator = true;
-                break;
-        }
-    }
-    return bHasExpansionIndicator;
-}
-
-
-
-
-Image TitleBar::GetExpansionIndicator (void) const
-{
-    Image aIndicator;
-    bool bHighContrastMode (GetSettings().GetStyleSettings().GetHighContrastMode() != 0);
-    if (mbIsExpandable)
-    {
-        sal_uInt16 nResourceId = 0;
-        switch (meType)
-        {
-            case TBT_SUB_CONTROL_HEADLINE:
-                if (mbExpanded)
-                    if (bHighContrastMode)
-                        nResourceId = BMP_COLLAPSE_H;
-                    else
-                        nResourceId = BMP_COLLAPSE;
-                else
-                    if (bHighContrastMode)
-                        nResourceId = BMP_EXPAND_H;
-                    else
-                        nResourceId = BMP_EXPAND;
-
-                aIndicator = IconCache::Instance().GetIcon(nResourceId);
-                break;
-        }
-    }
-
-    return aIndicator;
-}
-
-
-
-
-void TitleBar::PaintSubPanelHeadLineBar (void)
-{
-    int nWidth (GetOutputSizePixel().Width());
-    Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true));
-
-    Rectangle aTitleBarBox (CalculateTitleBarBox(aTextBox, nWidth));
-    int nVerticalOffset = -aTitleBarBox.Top(); 
-    aTitleBarBox.Top() += nVerticalOffset;
-    aTitleBarBox.Bottom() += nVerticalOffset;
-    aTextBox.Top() += nVerticalOffset;
-    aTextBox.Bottom() += nVerticalOffset;
-
-    PaintBackground (aTitleBarBox);
-    Rectangle aFocusBox (PaintExpansionIndicator (aTextBox));
-    PaintText (aTextBox);
-
-    aFocusBox.Union (aTextBox);
-    aFocusBox.Left() -= 2;
-    aFocusBox.Right() += 1;
-    PaintFocusIndicator (aFocusBox);
-}
-
-
-
-
-void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox)
-{
-    if (mbFocused)
-    {
-        Rectangle aTextPixelBox (mpDevice->LogicToPixel (rTextBox));
-        mpDevice->EnableMapMode (sal_False);
-        Rectangle aBox (rTextBox);
-        aBox.Top() -= 1;
-        aBox.Bottom() += 1;
-
-        mpDevice->SetFillColor ();
-
-        mpDevice->DrawRect (aTextPixelBox);
-
-        LineInfo aDottedStyle (LINE_DASH);
-        aDottedStyle.SetDashCount (0);
-        aDottedStyle.SetDotCount (1);
-        aDottedStyle.SetDotLen (1);
-        aDottedStyle.SetDistance (1);
-
-        mpDevice->SetLineColor (COL_BLACK);
-        mpDevice->DrawPolyLine (Polygon(aTextPixelBox), aDottedStyle);
-        mpDevice->EnableMapMode (sal_False);
-    }
-    else
-        HideFocus ();
-}
-
-
-
-
-Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox)
-{
-    Rectangle aExpansionIndicatorArea;
-
-    if (HasExpansionIndicator())
-    {
-        Image aImage = GetExpansionIndicator();
-        int nHeight (aImage.GetSizePixel().Height());
-        if (nHeight > 0)
-        {
-            Point aPosition (
-                0,
-                rTextBox.Top() + (GetTextHeight() - nHeight) / 2);
-            if (meType == TBT_SUB_CONTROL_HEADLINE)
-                aPosition.X() += 3;
-            mpDevice->DrawImage (aPosition, aImage);
-            
-            aExpansionIndicatorArea = Rectangle (
-                aPosition, aImage.GetSizePixel());
-        }
-    }
-
-    return aExpansionIndicatorArea;
-}
-
-
-
-
-void TitleBar::PaintText (const Rectangle& rTextBox)
-{
-    mpDevice->DrawText (rTextBox, msTitle, GetTextStyle());
-}
-
-
-
-
-sal_uInt16 TitleBar::GetTextStyle (void)
-{
- 	if(IsEnabled())
- 	{
- 		return TEXT_DRAW_LEFT 
- 			| TEXT_DRAW_TOP
- 			| TEXT_DRAW_MULTILINE 
- 			| TEXT_DRAW_WORDBREAK;
- 	}
- 	else
- 	{
- 		return TEXT_DRAW_DISABLE;
- 	}
-}
-
-
-
-void TitleBar::PaintBackground (const Rectangle& rTitleBarBox)
-{
-    // Fill a slightly rounded rectangle.
-    Color aFillColor (GetFillColor());
-    Color aLineColor (GetLineColor());
-
-    switch (meType)
-    {
-        case TBT_SUB_CONTROL_HEADLINE:
-        {
-            Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
-            if (mbExpanded)
-            {
-                // Make the color a little bit darker.
-                aColor.SetRed(sal_uInt8(((sal_uInt16)aColor.GetRed()) * 8 / 10));
-                aColor.SetGreen(sal_uInt8(((sal_uInt16)aColor.GetGreen()) * 8 / 10));
-                aColor.SetBlue(sal_uInt8(((sal_uInt16)aColor.GetBlue()) * 8 / 10));
-            }
-
-            mpDevice->SetFillColor (aColor);
-            mpDevice->SetLineColor ();
-            mpDevice->DrawRect (rTitleBarBox);
-
-            // Erase the four corner pixels to make the rectangle appear
-            // rounded.
-            mpDevice->SetLineColor (
-                GetSettings().GetStyleSettings().GetWindowColor());
-            mpDevice->DrawPixel (
-                rTitleBarBox.TopLeft());
-            mpDevice->DrawPixel (
-                Point(rTitleBarBox.Right(), rTitleBarBox.Top()));
-            mpDevice->DrawPixel (
-                Point(rTitleBarBox.Left(), rTitleBarBox.Bottom()));
-            mpDevice->DrawPixel (
-                Point(rTitleBarBox.Right(), rTitleBarBox.Bottom()));
-        }
-        break;
-    }
-}
-
-
-
-
-Rectangle TitleBar::CalculateTextBoundingBox (
-    int nAvailableWidth,
-    bool bEmphasizeExpanded)
-{
-    // Show the title of expanded controls in bold font.
-    const Font& rOriginalFont (GetFont());
-    Font aFont (rOriginalFont);
-    if (bEmphasizeExpanded && mbExpanded)
-        aFont.SetWeight (WEIGHT_BOLD);
-    else
-        aFont.SetWeight (WEIGHT_NORMAL);
-    mpDevice->SetFont (aFont);
-
-    // Use the natural width of the text when no width is given.
-    if (nAvailableWidth == 0)
-        nAvailableWidth = GetTextWidth (msTitle);
-
-    Rectangle aTextBox (
-        Point(0,0),
-        Size (nAvailableWidth, 
-            GetSettings().GetStyleSettings().GetTitleHeight()));
-    aTextBox.Top() += (aTextBox.GetHeight() - GetTextHeight()) / 2;
-    if (HasExpansionIndicator())
-        aTextBox.Left() += snIndentationWidth;
-    else
-        aTextBox.Left() += 3;
-    aTextBox.Right() -= 1;
-
-   aTextBox = mpDevice->GetTextRect (aTextBox, msTitle, GetTextStyle());
-
-   return aTextBox;
-}
-
-
-
-
-Rectangle TitleBar::CalculateTitleBarBox (
-    const Rectangle& rTextBox,
-    int nWidth)
-{
-    Rectangle aTitleBarBox (rTextBox);
-
-   switch (meType)
-   {
-        case TBT_SUB_CONTROL_HEADLINE:
-           aTitleBarBox.Top() -= 3;
-           aTitleBarBox.Bottom() += 3;
-           break;
-
-   }
-    aTitleBarBox.Left() = 0;
-    if (aTitleBarBox.GetWidth() < nWidth)
-        aTitleBarBox.Right() = nWidth-1;
-
-    return aTitleBarBox;
-}
-
-
-
-
-void TitleBar::MouseMove (const MouseEvent& )
-{
-}
-
-
-
-
-void TitleBar::MouseButtonDown (const MouseEvent& )
-{
-    // Do not forward to parent window so that the mouse button handler of
-    // the docking window is not invoked.
-}
-
-
-
-
-void TitleBar::MouseButtonUp (const MouseEvent& )
-{
-    // Do not forward to parent window so that the mouse button handler of
-    // the docking window is not invoked.
-}
-
-
-
-
-void TitleBar::DataChanged (const DataChangedEvent& rEvent)
-{
-    ::Window::DataChanged (rEvent);
-
-    switch (rEvent.GetType())
-    {
-        case DATACHANGED_SETTINGS:
-            if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0)
-                break;
-            SetSettings(Application::GetSettings());
-            mpDevice.reset(new VirtualDevice (*this));
-
-            // fall through.
-            
-        case DATACHANGED_FONTS:
-        case DATACHANGED_FONTSUBSTITUTION:
-        {
-            const StyleSettings& rStyleSettings (GetSettings().GetStyleSettings());
-
-            // Font.
-            Font aFont = rStyleSettings.GetAppFont();
-            if (IsControlFont())
-                aFont.Merge(GetControlFont());
-            SetZoomedPointFont(aFont);
-            
-            // Color.
-            Color aColor;
-            if (IsControlForeground())
-                aColor = GetControlForeground();
-            else
-                aColor = rStyleSettings.GetButtonTextColor();
-            SetTextColor(aColor);
-            SetTextFillColor();
-
-            Resize();
-            Invalidate();
-        }
-        break;
-    }
-}
-
-
-
-
-String TitleBar::GetTitle (void) const
-{
-    return msTitle;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible > TitleBar::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    return new ::accessibility::AccessibleTreeNode(
-        *this,
-        GetTitle(),
-        GetTitle(),
-        ::com::sun::star::accessibility::AccessibleRole::LABEL);
-}
-
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/TitledControl.cxx b/main/sd/source/ui/toolpanel/TitledControl.cxx
deleted file mode 100644
index ee49fd3..0000000
--- a/main/sd/source/ui/toolpanel/TitledControl.cxx
+++ /dev/null
@@ -1,428 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/TitledControl.hxx"
-
-#include "AccessibleTreeNode.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include <vcl/ctrl.hxx>
-#include <vcl/svapp.hxx>
-
-
-namespace sd { namespace toolpanel { 
-
-
-TitledControl::TitledControl (
-    TreeNode* pParent,
-    ::std::auto_ptr<TreeNode> pControl, 
-    const String& rTitle,
-    const ClickHandler& rClickHandler,
-    TitleBar::TitleBarType eType)
-    : ::Window (pParent->GetWindow(), WB_TABSTOP),
-      TreeNode(pParent),
-      msTitle(rTitle),
-      mbVisible(true),
-      mpUserData(NULL),
-      mpClickHandler(new ClickHandler(rClickHandler))
-{
-    mpControlContainer->AddControl (::std::auto_ptr<TreeNode> (
-        new TitleBar (this, rTitle, eType, pControl->IsExpandable())));
-    pControl->SetParentNode (this);
-    mpControlContainer->AddControl (pControl);
-
-    FocusManager::Instance().RegisterDownLink( GetTitleBar()->GetWindow(), GetControl()->GetWindow() );
-    FocusManager::Instance().RegisterUpLink( GetControl()->GetWindow(), GetTitleBar()->GetWindow() );
-
-    SetBackground (Wallpaper());
-
-    GetTitleBar()->GetWindow()->Show ();
-    GetTitleBar()->GetWindow()->AddEventListener (
-        LINK(this,TitledControl,WindowEventListener));
-
-    UpdateStates ();
-}
-
-
-
-
-TitledControl::~TitledControl (void)
-{
-    GetTitleBar()->GetWindow()->RemoveEventListener (
-        LINK(this,TitledControl,WindowEventListener));
-}
-
-
-
-
-Size TitledControl::GetPreferredSize (void)
-{
-    Size aPreferredSize;
-    if (GetControl() != NULL)
-    {
-        aPreferredSize = GetControl()->GetPreferredSize();
-        if ( ! IsExpanded())
-            aPreferredSize.Height() = 0;
-    }
-    else
-        aPreferredSize = Size (GetSizePixel().Width(), 0);
-    if (aPreferredSize.Width() == 0)
-        aPreferredSize.Width() = 300;
-    aPreferredSize.Height() += GetTitleBar()->GetPreferredHeight(
-        aPreferredSize.Width());
-
-    return aPreferredSize;
-}
-
-
-
-
-sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight)
-{
-    int nPreferredWidth = 0;
-    if (GetControl() != NULL)
-        nPreferredWidth = GetControl()->GetPreferredWidth(
-            nHeight - GetTitleBar()->GetWindow()->GetSizePixel().Height());
-    else
-        nPreferredWidth = GetSizePixel().Width();
-    if (nPreferredWidth == 0)
-        nPreferredWidth = 300;
-
-    return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 TitledControl::GetPreferredHeight (sal_Int32 nWidth)
-{
-    int nPreferredHeight = 0;
-    if (IsExpanded() && GetControl()!=NULL)
-        nPreferredHeight = GetControl()->GetPreferredHeight(nWidth);
-    nPreferredHeight += GetTitleBar()->GetPreferredHeight(nWidth);
-
-    return nPreferredHeight;
-}
-
-
-
-
-bool TitledControl::IsResizable (void)
-{
-    return IsExpanded() 
-        && GetControl()->IsResizable();
-}
-
-
-
-
-::Window* TitledControl::GetWindow (void)
-{
-    return this;
-}
-
-
-
-
-void TitledControl::Resize (void)
-{
-    Size aWindowSize (GetOutputSizePixel());
-
-    int nTitleBarHeight 
-        = GetTitleBar()->GetPreferredHeight(aWindowSize.Width());
-    GetTitleBar()->GetWindow()->SetPosSizePixel (
-        Point (0,0),
-        Size (aWindowSize.Width(), nTitleBarHeight));
-
-
-    TreeNode* pControl = GetControl();
-    if (pControl != NULL 
-        && pControl->GetWindow() != NULL
-        && pControl->GetWindow()->IsVisible())
-    {
-        pControl->GetWindow()->SetPosSizePixel (
-            Point (0,nTitleBarHeight),
-            Size (aWindowSize.Width(), aWindowSize.Height()-nTitleBarHeight));
-    }
-}
-
-
-
-
-void TitledControl::GetFocus (void)
-{
-    ::Window::GetFocus();
-    if (GetTitleBar() != NULL)
-        GetTitleBar()->GrabFocus();
-}
-
-
-
-
-void TitledControl::KeyInput (const KeyEvent& rEvent)
-{
-	KeyCode nCode = rEvent.GetKeyCode();
-    if (nCode == KEY_SPACE)
-    {
-        // Toggle the expansion state of the control (when toggling is
-        // supported.)  The focus remains on this control.
-        GetParentNode()->GetControlContainer().SetExpansionState (
-            this,
-            ControlContainer::ES_TOGGLE);
-    }
-    else if (nCode == KEY_RETURN)
-    {
-        // Return, also called enter, enters the control and puts the
-        // focus to the first child.  If the control is not yet
-        // expanded then do that first.
-        GetParentNode()->GetControlContainer().SetExpansionState (
-            this,
-            ControlContainer::ES_EXPAND);
-
-        if ( ! FocusManager::Instance().TransferFocus(this,nCode))
-        {
-            // When already expanded then put focus on first child.
-            TreeNode* pControl = GetControl();
-            if (pControl!=NULL && IsExpanded())
-                if (pControl->GetWindow() != NULL)
-                    pControl->GetWindow()->GrabFocus();
-        }
-    }
-    else if (nCode == KEY_ESCAPE)
-    {
-        if ( ! FocusManager::Instance().TransferFocus(this,nCode))
-            // Put focus to parent.
-            GetParent()->GrabFocus();
-    }
-    else
-        Window::KeyInput (rEvent);
-}
-
-
-
-
-const String& TitledControl::GetTitle (void) const
-{
-    return msTitle;
-}
-
-
-
-
-bool TitledControl::Expand (bool bExpanded)
-{
-    bool bExpansionStateChanged (false);
-
-    if (IsExpandable() && IsEnabled())
-    {
-        if (GetTitleBar()->IsExpanded() != bExpanded)
-            bExpansionStateChanged |= GetTitleBar()->Expand (bExpanded);
-        // Get the control.  Use the bExpanded parameter as argument to
-        // indicate that a control is created via its factory only when it
-        // is to be expanded.  When it is collapsed this is not necessary.
-        TreeNode* pControl = GetControl();
-        if (pControl != NULL
-            && GetControl()->IsExpanded() != bExpanded)
-        {
-            bExpansionStateChanged |= pControl->Expand (bExpanded);
-        }
-        if (bExpansionStateChanged)
-            UpdateStates();
-    }
-    
-    return bExpansionStateChanged;
-}
-
-
-
-
-bool TitledControl::IsExpandable (void) const
-{
-    const TreeNode* pControl = GetConstControl();
-    if (pControl != NULL)
-        return pControl->IsExpandable();
-    else
-        // When a control factory is given but the control has not yet been
-        // created we assume that the control is expandable.
-        return true;
-}
-
-
-
-
-bool TitledControl::IsExpanded (void) const
-{
-    const TreeNode* pControl = GetConstControl();
-    if (pControl != NULL)
-        return pControl->IsExpanded();
-    else
-        return false;
-}
-
-void TitledControl::SetEnabledState(bool bFlag) 
-{
-    if (!bFlag)
-    {
-	    GetParentNode()->GetControlContainer().SetExpansionState (
-		    this,
-		    ControlContainer::ES_COLLAPSE);
-	    Disable();
-    }
-    else 
-    {
-/*    
-	    GetParentNode()->GetControlContainer().SetExpansionState (
-		    this,
-		    ControlContainer::ES_EXPAND);
-*/		   
-	    Enable();
-    }
-
-    GetTitleBar()->SetEnabledState(bFlag);
-}
-
-
-
-bool TitledControl::IsShowing (void) const
-{
-    return mbVisible;
-}
-
-
-
-
-void TitledControl::Show (bool bVisible)
-{
-    if (mbVisible != bVisible)
-    {
-        mbVisible = bVisible;
-        UpdateStates ();
-    }
-}
-
-
-
-
-void TitledControl::UpdateStates (void)
-{
-    if (mbVisible)
-        GetWindow()->Show();
-    else
-        GetWindow()->Hide();
-
-    TreeNode* pControl = GetControl();
-    if (pControl!=NULL  &&  pControl->GetWindow() != NULL)
-    {
-        if (IsVisible() && IsExpanded())
-            pControl->GetWindow()->Show();
-        else
-            pControl->GetWindow()->Hide();
-    }
-}
-
-
-
-
-IMPL_LINK(TitledControl, WindowEventListener, 
-    VclSimpleEvent*, pEvent)
-{
-    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
-    {
-        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
-        switch (pWindowEvent->GetId())
-        {
-            case VCLEVENT_WINDOW_MOUSEBUTTONUP:
-                if (IsEnabled())
-                    (*mpClickHandler)(*this);
-                break;
-        }
-    }
-    return 0;
-}
-
-
-
-
-TreeNode* TitledControl::GetControl (void)
-{
-    return mpControlContainer->GetControl(1);
-}
-
-
-
-
-const TreeNode* TitledControl::GetConstControl () const
-{
-    return const_cast<TitledControl*>(this)->GetControl();
-}
-
-
-
-
-TitleBar* TitledControl::GetTitleBar (void)
-{
-    return static_cast<TitleBar*>(mpControlContainer->GetControl(0));
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> TitledControl::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    return new ::accessibility::AccessibleTreeNode(
-        *this,
-        GetTitle(),
-        GetTitle(),
-        ::com::sun::star::accessibility::AccessibleRole::LIST_ITEM);
-}
-
-
-
-
-//===== TitledControlStandardClickHandler =====================================
-
-TitledControlStandardClickHandler::TitledControlStandardClickHandler (
-    ControlContainer& rControlContainer,
-    ControlContainer::ExpansionState eExpansionState)
-    : mrControlContainer(rControlContainer),
-      meExpansionState(eExpansionState)
-{
-}
-
-
-
-
-void TitledControlStandardClickHandler::operator () (TitledControl& rTitledControl)
-{
-    // Toggle expansion.
-    mrControlContainer.SetExpansionState (&rTitledControl, meExpansionState);
-}
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/ToolPanel.cxx b/main/sd/source/ui/toolpanel/ToolPanel.cxx
deleted file mode 100644
index 8d210d0..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanel.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/**************************************************************
- * 
- * 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_sd.hxx"
-
-#include "ToolPanel.hxx"
-#include "MethodGuard.hxx"
-#include <taskpane/TaskPaneTreeNode.hxx>
-
-/** === begin UNO includes === **/
-#include <com/sun/star/lang/DisposedException.hpp>
-/** === end UNO includes === **/
-
-#include <vcl/window.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-	/** === begin UNO using === **/
-	using ::com::sun::star::uno::Reference;
-	using ::com::sun::star::uno::XInterface;
-	using ::com::sun::star::uno::UNO_QUERY;
-	using ::com::sun::star::uno::UNO_QUERY_THROW;
-	using ::com::sun::star::uno::UNO_SET_THROW;
-	using ::com::sun::star::uno::Exception;
-	using ::com::sun::star::uno::RuntimeException;
-	using ::com::sun::star::uno::Any;
-	using ::com::sun::star::uno::makeAny;
-	using ::com::sun::star::uno::Sequence;
-	using ::com::sun::star::uno::Type;
-    using ::com::sun::star::lang::DisposedException;
-    using ::com::sun::star::awt::XWindow;
-    using ::com::sun::star::accessibility::XAccessible;
-	/** === end UNO using === **/
-
-    typedef MethodGuard< ToolPanel > ToolPanelGuard;
-
-	//==================================================================================================================
-	//= ToolPanel
-	//==================================================================================================================
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
-        :ToolPanel_Base( m_aMutex )
-        ,m_pControl( i_rControl )
-    {
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanel::~ToolPanel()
-    {
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    void ToolPanel::checkDisposed()
-    {
-        if ( m_pControl.get() == NULL )
-            throw DisposedException( ::rtl::OUString(), *this );
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
-    {
-        ToolPanelGuard aGuard( *this );
-        return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
-    }
-    
-    //------------------------------------------------------------------------------------------------------------------
-    Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
-    {
-        ToolPanelGuard aGuard( *this );
-        Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
-        if ( !xAccessible.is() )
-        {
-            xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
-            m_pControl->GetWindow()->SetAccessible( xAccessible );
-        }
-        return xAccessible;
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    void SAL_CALL ToolPanel::disposing()
-    {
-        m_pControl.reset();
-    }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
diff --git a/main/sd/source/ui/toolpanel/ToolPanel.hxx b/main/sd/source/ui/toolpanel/ToolPanel.hxx
deleted file mode 100644
index b151c29..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanel.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_HXX
-#define SD_TOOLPANEL_HXX
-
-/** === begin UNO includes === **/
-#include <com/sun/star/ui/XToolPanel.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase1.hxx>
-
-#include <memory>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-    class TreeNode;
-
-	//==================================================================================================================
-	//= ToolPanel
-	//==================================================================================================================
-    typedef ::cppu::WeakComponentImplHelper1    <   ::com::sun::star::ui::XToolPanel
-                                                >   ToolPanel_Base;
-    class ToolPanel :public ::cppu::BaseMutex
-                    ,public ToolPanel_Base
-	{
-    public:
-        ToolPanel(
-            ::std::auto_ptr< TreeNode >& i_rControl
-        );
-
-        // XToolPanel
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
-
-        // OComponentHelper
-        virtual void SAL_CALL disposing();
-
-        ::osl::Mutex& getMutex() { return m_aMutex; }
-        void checkDisposed();
-
-    protected:
-        ~ToolPanel();
-
-    private:
-        ::std::auto_ptr< TreeNode > m_pControl;
-	};
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANEL_HXX
diff --git a/main/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx b/main/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx
deleted file mode 100644
index 8bf11a4..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOL_PANEL_DESCRIPTOR_HXX
-#define SD_TOOL_PANEL_DESCRIPTOR_HXX
-
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-#include <memory>
-
-class Window;
-
-namespace sd { namespace toolpanel {
-
-
-/** Collection of information the describes entries of the tool
-    panel.  A descriptor owns the control it is associated with.
-*/
-class ToolPanelDescriptor
-{
-public:
-    /** Create a new descriptor for the given control.
-        @param pControl
-    */
-    ToolPanelDescriptor (::std::auto_ptr< ::Window> pControl, 
-        const String& rTitle);
-
-    ~ToolPanelDescriptor (void);
-
-    /** Return the height of the title bar.
-        @return
-            The title bar height is returned in pixels.
-    */
-    int GetTitleBarHeight (void) const;
-
-
-    void SetPositionAndSize (const Point& aPosition,
-        const Size& aSize);
-    void SetPositionAndSize (const Rectangle& aBox);
-    void SetWeight (double nWeight);
-
-    Window* GetControl (void) const;
-    const String& GetTitle (void) const;
-    const Rectangle& GetTitleBox (void) const;
-    Rectangle GetPositionAndSize (void) const;
-    double GetWeight (void) const;
-
-    int GetTotalHeight (void) const;
-    int GetWindowHeight (void) const;
-    
-private:
-    ::std::auto_ptr< ::Window> mpControl;
-    String msTitle;
-    Rectangle maTitleBox;
-    double mnWeight;
-    int mnTotalHeight;
-
-    /// Do not use! Assignment operator is not supported.
-    const ToolPanelDescriptor& operator= (
-        const ToolPanelDescriptor& aDescriptor);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/main/sd/source/ui/toolpanel/ToolPanelFactory.cxx
deleted file mode 100644
index 3d89dd8..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanelFactory.cxx
+++ /dev/null
@@ -1,252 +0,0 @@
-/**************************************************************
- * 
- * 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_sd.hxx"
-
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "framework/FrameworkHelper.hxx"
-#include "PaneChildWindows.hxx"
-#include "ViewShellBase.hxx"
-#include "app.hrc"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-/** === end UNO includes === **/
-
-#include <sfx2/frame.hxx>
-#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-	/** === begin UNO using === **/
-	using ::com::sun::star::uno::Reference;
-	using ::com::sun::star::uno::XInterface;
-	using ::com::sun::star::uno::UNO_QUERY;
-	using ::com::sun::star::uno::UNO_QUERY_THROW;
-	using ::com::sun::star::uno::UNO_SET_THROW;
-	using ::com::sun::star::uno::Exception;
-	using ::com::sun::star::uno::RuntimeException;
-	using ::com::sun::star::uno::Any;
-	using ::com::sun::star::uno::makeAny;
-	using ::com::sun::star::uno::Sequence;
-	using ::com::sun::star::uno::Type;
-    using ::com::sun::star::uno::XComponentContext;
-    using ::com::sun::star::ui::XUIElementFactory;
-    using ::com::sun::star::ui::XUIElement;
-    using ::com::sun::star::beans::PropertyValue;
-    using ::com::sun::star::container::NoSuchElementException;
-    using ::com::sun::star::lang::IllegalArgumentException;
-    using ::com::sun::star::lang::XServiceInfo;
-    using ::com::sun::star::lang::XInitialization;
-    using ::com::sun::star::frame::XFrame;
-    using ::com::sun::star::awt::XWindow;
-	/** === end UNO using === **/
-
-	//==================================================================================================================
-	//= ToolPanelFactory
-	//==================================================================================================================
-    typedef ::cppu::WeakImplHelper3 <   XUIElementFactory
-                                    ,   XServiceInfo
-                                    ,   XInitialization
-                                    >   ToolPanelFactory_Base;
-    class ToolPanelFactory : public ToolPanelFactory_Base
-    {
-    public:
-        ToolPanelFactory( const Reference< XComponentContext >& i_rContext );
-
-        // XUIElementFactory
-        virtual Reference< XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException);
-
-        // XServiceInfo
-        virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (RuntimeException);
-        virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
-        virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException);
-
-        // XInitialization
-        virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
-
-    protected:
-        virtual ~ToolPanelFactory();
-
-    private:
-        const Reference< XComponentContext >    m_xContext;
-    };
-
-	//------------------------------------------------------------------------------------------------------------------
-    Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext )
-    {
-        return Reference< XInterface >( *new ToolPanelFactory( i_rContext ) );
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ::rtl::OUString ToolPanelFactory_getImplementationName() throw(RuntimeException)
-    {
-        return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.drawing.ToolPanelFactory" ) );
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
-        throw (RuntimeException)
-    {
-        const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DefaultToolPanelFactory" ) );
-        return Sequence< ::rtl::OUString >( &sServiceName, 1 );
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext )
-        :m_xContext( i_rContext )
-    {
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanelFactory::~ToolPanelFactory()
-    {
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException)
-    {
-        ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
-        const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) );
-        if ( ePanelId == PID_UNKNOWN )
-            throw NoSuchElementException( i_rResourceURL, *this );
-
-        const ::comphelper::NamedValueCollection aArgs( i_rArgs );
-        const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) );
-        const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) );
-        if ( !xDocFrame.is() || !xParentWindow.is() )
-            throw IllegalArgumentException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "For creating a standard tool panel, a Frame and a Parent window are needed." ) ),
-                *this,
-                2
-            );
-
-        // look up the Sfx(View)Frame for the given XFrame
-        SfxViewFrame* pViewFrame = NULL;
-        for (   SfxFrame* pFrame = SfxFrame::GetFirst();
-                pFrame != NULL;
-                pFrame = SfxFrame::GetNext( *pFrame )
-            )
-        {
-            if ( pFrame->GetFrameInterface() == xDocFrame )
-            {
-                pViewFrame = pFrame->GetCurrentViewFrame();
-                break;
-            }
-        }
-
-        if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_TASKPANE ) )
-            throw IllegalArgumentException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ),
-                *this,
-                2
-            );
-
-        // retrieve the task pane
-        ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_TASKPANE ) ) );
-        if ( !pToolPanelWindow )
-            throw IllegalArgumentException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ),
-                *this,
-                2
-            );
-
-        // retrieve the ViewShellBase, and the view shell of the task pane
-        ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() );
-        ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper;
-        if ( pViewShellBase )
-            pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase );
-        ::boost::shared_ptr< ViewShell > pViewShell;
-        if ( pFrameworkHelper.get() )
-            pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
-        ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() );
-
-        if ( !pToolPanelShell )
-            throw IllegalArgumentException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong document type." ) ),
-                *this,
-                2
-            );
-
-        ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
-        if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) )
-            throw IllegalArgumentException(
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported parent window." ) ),
-                *this,
-                2
-            );
-
-        return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL );
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName(  ) throw (RuntimeException)
-    {
-        return ToolPanelFactory_getImplementationName();
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException)
-    {
-        const Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
-        for (   const ::rtl::OUString* pSupported = aSupported.getConstArray();
-                pSupported != aSupported.getConstArray() + aSupported.getLength();
-                ++pSupported
-            )
-            if ( *pSupported == i_rServiceName )
-                return sal_True;
-
-        return sal_False;
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames(  ) throw (RuntimeException)
-    {
-        return ToolPanelFactory_getSupportedServiceNames();
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException)
-    {
-        ::comphelper::NamedValueCollection aArgs( i_rArguments );
-        (void)aArgs;
-        // TODO
-    }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
diff --git a/main/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/main/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
deleted file mode 100644
index 05aebca..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/**************************************************************
- * 
- * 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_sd.hxx"
-
-#include "ToolPanelUIElement.hxx"
-#include "MethodGuard.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-/** === end UNO includes === **/
-
-#include <tools/diagnose_ex.h>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-	/** === begin UNO using === **/
-	using ::com::sun::star::uno::Reference;
-	using ::com::sun::star::uno::XInterface;
-	using ::com::sun::star::uno::UNO_QUERY;
-	using ::com::sun::star::uno::UNO_QUERY_THROW;
-	using ::com::sun::star::uno::UNO_SET_THROW;
-	using ::com::sun::star::uno::Exception;
-	using ::com::sun::star::uno::RuntimeException;
-	using ::com::sun::star::uno::Any;
-	using ::com::sun::star::uno::makeAny;
-	using ::com::sun::star::uno::Sequence;
-	using ::com::sun::star::uno::Type;
-    using ::com::sun::star::frame::XFrame;
-    using ::com::sun::star::lang::XComponent;
-    using ::com::sun::star::ui::XToolPanel;
-    using ::com::sun::star::lang::DisposedException;
-	/** === end UNO using === **/
-    namespace UIElementType = ::com::sun::star::ui::UIElementType;
-
-    typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard;
-
-	//==================================================================================================================
-	//= ToolPanelUIElement
-	//==================================================================================================================
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL,
-            const Reference< XToolPanel >& i_rToolPanel )
-        :ToolPanelUIElement_Base( m_aMutex )
-        ,m_xFrame( i_rFrame )
-        ,m_sResourceURL( i_rResourceURL )
-        ,m_xToolPanel( i_rToolPanel )
-    {
-    }
-
-	//------------------------------------------------------------------------------------------------------------------
-    ToolPanelUIElement::~ToolPanelUIElement()
-    {
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    void ToolPanelUIElement::checkDisposed()
-    {
-        if ( !m_xToolPanel.is() )
-            throw DisposedException( ::rtl::OUString(), *this );
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException)
-    {
-        UIElementMethodGuard aGuard( *this );
-        return m_xFrame;
-    }
-    
-    //------------------------------------------------------------------------------------------------------------------
-    ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException)
-    {
-        UIElementMethodGuard aGuard( *this );
-        return m_sResourceURL;
-    }
-    
-    //------------------------------------------------------------------------------------------------------------------
-    ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException)
-    {
-        UIElementMethodGuard aGuard( *this );
-        return UIElementType::TOOLPANEL;
-    }
-    
-    //------------------------------------------------------------------------------------------------------------------
-    Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface(  ) throw (RuntimeException)
-    {
-        UIElementMethodGuard aGuard( *this );
-        return m_xToolPanel.get();
-    }
-
-    //------------------------------------------------------------------------------------------------------------------
-    void SAL_CALL ToolPanelUIElement::disposing()
-    {
-        try
-        {
-            Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
-            xPanelComponent->dispose();
-        }
-        catch( const Exception& )
-        {
-        	DBG_UNHANDLED_EXCEPTION();
-        }
-    }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
diff --git a/main/sd/source/ui/toolpanel/ToolPanelUIElement.hxx b/main/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
deleted file mode 100644
index 62e1d3e..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANELUIELEMENT_HXX
-#define SD_TOOLPANELUIELEMENT_HXX
-
-/** === begin UNO includes === **/
-#include <com/sun/star/ui/XUIElement.hpp>
-#include <com/sun/star/ui/XToolPanel.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/compbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-#include <memory>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
-    class TreeNode;
-
-	//==================================================================================================================
-	//= ToolPanelUIElement
-	//==================================================================================================================
-    typedef ::cppu::WeakComponentImplHelper1    <   ::com::sun::star::ui::XUIElement
-                                                >   ToolPanelUIElement_Base;
-    class ToolPanelUIElement    :public ::cppu::BaseMutex
-                                ,public ToolPanelUIElement_Base
-	{
-    public:
-        ToolPanelUIElement(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
-            const ::rtl::OUString& i_rResourceURL,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel
-        );
-
-        // XUIElement
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
-        virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
-        virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface(  ) throw (::com::sun::star::uno::RuntimeException);
-
-        void checkDisposed();
-        ::osl::Mutex& getMutex() { return m_aMutex; }
-
-    protected:
-        virtual ~ToolPanelUIElement();
-
-        // OComponentHelper
-        virtual void SAL_CALL disposing();
-
-    private:
-        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >   m_xFrame;
-        const ::rtl::OUString                                                       m_sResourceURL;
-        const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >  m_xToolPanel;
-	};
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANELUIELEMENT_HXX
diff --git a/main/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/main/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
deleted file mode 100644
index 3563cc3..0000000
--- a/main/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ /dev/null
@@ -1,900 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "TaskPaneShellManager.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "controls/MasterPagesPanel.hxx"
-#include "LayoutMenu.hxx"
-#include "DrawDocShell.hxx"
-#include "controls/TableDesignPanel.hxx"
-#include "controls/CustomAnimationPanel.hxx"
-#include "controls/SlideTransitionPanel.hxx"
-#include "controls/MasterPagesSelector.hxx"
-#include "ToolPanel.hxx"
-#include "ToolPanelUIElement.hxx"
-#include "PaneDockingWindow.hxx"
-#include "FrameView.hxx"
-#include "Window.hxx"
-#include "sdmod.hxx"
-#include "app.hrc"
-#include "glob.hrc"
-#include "res_bmp.hrc"
-#include "helpids.h"
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "framework/FrameworkHelper.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/drawing/framework/XResourceId.hpp>
-#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
-#include <com/sun/star/drawing/framework/AnchorBindingMode.hpp>
-#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
-#include <com/sun/star/drawing/XDrawSubController.hpp>
-/** === end UNO includes === **/
-
-#include <svtools/toolpanel/toolpanel.hxx>
-#include <svtools/toolpanel/toolpaneldeck.hxx>
-#include <svx/dlgctrl.hxx>
-#include <sfx2/taskpane.hxx>
-#include <sfx2/imagemgr.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/msg.hxx>
-#include <sfx2/objface.hxx>
-#include <svx/colrctrl.hxx>
-#include <svx/xtable.hxx>
-#include <vcl/dockwin.hxx>
-#include "sdtreelb.hxx"
-#include "DrawViewShell.hxx"
-#include "drawdoc.hxx"
-#include "ViewShellBase.hxx"
-#include <svx/ruler.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/toolbox.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/confignode.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/componentcontext.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-#include <vector>
-
-using namespace ::sd::toolpanel;
-
-#define ToolPanelViewShell
-#include "sdslots.hxx"
-
-/** === begin UNO using === **/
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::makeAny;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Type;
-using ::com::sun::star::accessibility::XAccessible;
-using ::com::sun::star::drawing::XDrawSubController;
-using ::com::sun::star::frame::XFrame;
-using ::com::sun::star::drawing::framework::XResourceId;
-using ::com::sun::star::drawing::framework::XConfigurationChangeListener;
-using ::com::sun::star::drawing::framework::ConfigurationChangeEvent;
-using ::com::sun::star::lang::EventObject;
-using ::com::sun::star::lang::DisposedException;
-using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster;
-using ::com::sun::star::drawing::framework::XConfigurationController;
-using ::com::sun::star::drawing::framework::XConfiguration;
-using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT;
-using ::com::sun::star::ui::XUIElement;
-using ::com::sun::star::ui::XToolPanel;
-using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
-/** === end UNO using === **/
-
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace toolpanel {
-
-// =====================================================================================================================
-// = misc helper
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown )
-{
-    PanelId ePanelId( PID_UNKNOWN );
-
-    if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) )
-    {
-        ePanelId = PID_MASTER_PAGES;
-    }
-    else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) )
-    {
-        ePanelId = PID_LAYOUT;
-    }
-	else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) )
-	{
-		ePanelId = PID_TABLE_DESIGN;
-	}
-    else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) )
-    {
-        ePanelId = PID_CUSTOM_ANIMATION;
-    }
-    else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) )
-    {
-        ePanelId = PID_SLIDE_TRANSITION;
-    }
-    else
-    {
-        OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" );
-        (void)i_bIgnoreUnknown;
-    }
-
-    return ePanelId;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL )
-{
-    return GetStandardPanelId( i_rTaskPanelResourceURL, false );
-}
-
-// =====================================================================================================================
-// = ConfigurationListener - declaration
-// =====================================================================================================================
-typedef ::cppu::WeakImplHelper1 <   XConfigurationChangeListener
-                                >   ConfigurationListener_Base;
-
-class ConfigurationListener :public ::cppu::BaseMutex
-                            ,public ConfigurationListener_Base
-{
-public:
-    ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl );
-
-    // XConfigurationChangeListener
-    virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException);
-
-    // XEventListener
-    virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
-
-    // XComponent equivalents (not available per UNO interface)
-    void    dispose();
-
-protected:
-    ~ConfigurationListener();
-
-    void impl_checkDisposed_throw()
-    {
-        if ( !m_pShellImpl )
-            throw DisposedException( ::rtl::OUString(), *this );
-    }
-
-private:
-    ToolPanelViewShell_Impl* m_pShellImpl;
-};
-
-// =====================================================================================================================
-// = ToolPanelViewShell_Impl - declaration
-// =====================================================================================================================
-/** Inner implementation class of ToolPanelViewShell.
-*/
-class ToolPanelViewShell_Impl   :public ::boost::noncopyable
-                                ,public ::svt::IToolPanelDeckListener
-                                ,public ::sfx2::IToolPanelCompare
-{
-public:
-    static const size_t mnInvalidId = static_cast< size_t >( -1 );
-
-    ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent );
-    ~ToolPanelViewShell_Impl();
-
-    ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; }
-
-    /** Here the panels are created that are shown in the task pane.
-    */
-    void Setup();
-
-    /** clean up the instance
-    */
-    void Cleanup();
-
-    /** activates the panel which has the given resource URL
-    */
-    void    ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
-
-    /** de-activates the panel given by its resource URL, bypassing the configuration controller
-
-        If the panel is not active currently, nothing happens.
-    */
-    void    DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
-    
-    /** provides access to the the VCL window of the panel deck
-    */
-          ::sfx2::ModuleTaskPane& GetTaskPane()       { return *m_pTaskPane; }
-    const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; }
-
-          ::svt::ToolPanelDeck& GetToolPanelDeck()       { return GetTaskPane().GetPanelDeck(); }
-    const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); }
-
-    Reference< XAccessible >
-            CreateAccessible( ::sd::Window& i_rWindow );
-
-    void    ConnectToDockingWindow();
-
-private:
-    // IToolPanelDeckListener overridables
-    virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
-    virtual void PanelRemoved( const size_t i_nPosition );
-    virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
-    virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
-    virtual void Dying();
-
-    // IToolPanelCompare overridables
-    virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const;
-
-private:
-    struct InitialPanel
-    {
-        ::rtl::OUString sPanelResourceURL;
-        bool            bActivateDirectly;
-        InitialPanel()
-            :sPanelResourceURL()
-            ,bActivateDirectly( true )
-        {
-        }
-    };
-    InitialPanel        impl_determineInitialPanel();
-    ::rtl::OUString     impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel );
-
-private:
-    ToolPanelViewShell&                             m_rPanelViewShell;
-    ::boost::scoped_ptr< ::sfx2::ModuleTaskPane >   m_pTaskPane;
-    ::std::auto_ptr< ::sfx2::TaskPaneController >   m_pTaskPaneController;
-    ::rtl::Reference< ConfigurationListener >       m_pConfigListener;
-    bool                                            m_bInitialized;
-};
-
-// =====================================================================================================================
-// = ConfigurationListener - implementation
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl )
-    :m_pShellImpl( &i_rShellImpl )
-{
-    ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) );
-    Reference< XConfigurationControllerBroadcaster > xBroadcaster;
-    if ( pFrameworkHelper.get() )
-        xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() );
-    ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" );
-
-    osl_incrementInterlockedCount( &m_refCount );
-    {
-        xBroadcaster->addConfigurationChangeListener( this, ::rtl::OUString(), Any() );
-    }
-    osl_decrementInterlockedCount( &m_refCount );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ConfigurationListener::~ConfigurationListener()
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException)
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
-    impl_checkDisposed_throw();
-
-    // is this an event we're interested in?
-    if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent )
-        return;
-
-    // is this a resource we're interested in? Must be anchored in the task pane ...
-    Reference< XResourceId > xAnchorId;
-    if ( i_rEvent.ResourceId.is() )
-        xAnchorId = i_rEvent.ResourceId->getAnchor();
-    if ( !xAnchorId.is() )
-        return;
-    const ::rtl::OUString sAnchorURL( xAnchorId->getResourceURL() );
-    if ( sAnchorURL != FrameworkHelper::msTaskPaneURL )
-        return;
-
-    m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
-{
-    (void)i_rEvent;
-    {
-        ::osl::MutexGuard aGuard( m_aMutex );
-        impl_checkDisposed_throw();
-    }
-
-    dispose();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ConfigurationListener::dispose()
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
-    m_pShellImpl = NULL;
-}
-
-// =====================================================================================================================
-// = ToolPanelViewShell
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-TYPEINIT1(ToolPanelViewShell, ViewShell);
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel()
-{
-    InitialPanel aPanelToActivate;
-    if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW )
-        // for Draw, rely on SFX's default handling, which is to activate the previously active panel
-        return aPanelToActivate;
-
-    // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case,
-    // use that one.
-    aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL;
-    aPanelToActivate.bActivateDirectly = false;
-    try
-    {
-        ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
-        const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
-        Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
-        Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW );
-        Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
-            FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ),
-            FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) );
-
-        if ( aViewIds.getLength() > 0 )
-        {
-            const ::rtl::OUString sResourceURL( aViewIds[0]->getResourceURL() );
-            PanelId nRequestedPanel = GetStandardPanelId( sResourceURL );
-            if ( nRequestedPanel != PID_UNKNOWN )
-            {
-                aPanelToActivate.sPanelResourceURL = sResourceURL;
-                aPanelToActivate.bActivateDirectly = true;
-            }
-        }
-    }
-    catch( const Exception& )
-    {
-    	DBG_UNHANDLED_EXCEPTION();
-    }
-    return aPanelToActivate;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Setup()
-{
-    if ( m_bInitialized )
-        return;
-    m_bInitialized = true;
-
-    // initially activate a panel
-    const InitialPanel aInitialPanel = impl_determineInitialPanel();
-    if ( aInitialPanel.sPanelResourceURL.getLength() )
-    {
-        if ( aInitialPanel.bActivateDirectly )
-        {
-            ActivatePanelByResource( aInitialPanel.sPanelResourceURL );
-        }
-        else
-        {
-            ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
-            pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL );
-        }
-    }
-
-    // listen at the configuration
-    m_pConfigListener.set( new ConfigurationListener( *this ) );
-
-    m_pTaskPane->Show();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Cleanup()
-{
-    if ( m_bInitialized )
-    {
-        if ( m_pConfigListener.is() )
-            m_pConfigListener->dispose();
-    }
-    GetToolPanelDeck().RemoveListener( *this );
-    m_pTaskPaneController.reset();
-    m_pTaskPane.reset();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL )
-{
-    // determine position of the requested panel
-    ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL );
-    OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
-    if ( !!aPanelPos )
-        GetToolPanelDeck().ActivatePanel( *aPanelPos );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL )
-{
-    // determine position of the requested panel
-    ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL );
-    OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
-    if ( !!aPanelPos )
-    {
-        if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos )
-            GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() );
-    }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::Initialize()
-{
-    mpImpl->Setup();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow,
-        FrameView* pFrameViewArgument )
-    :ViewShell(pFrame, pParentWindow, rViewShellBase)
-    ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) )
-    ,mpSubShellManager()
-    ,mnMenuId(0)
-{
-    meShellType = ST_TASK_PANE;
-
-    mpContentWindow->SetCenterAllowed( false );
-    pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL );
-
-    GetParentWindow()->SetBackground( Wallpaper() );
-    mpContentWindow->SetBackground( Wallpaper() );
-
-    GetParentWindow()->SetHelpId(HID_SD_TASK_PANE);
-
-    mpImpl->ConnectToDockingWindow();
-
-	SetPool( &GetDoc()->GetPool() );
-
-	if ( pFrameViewArgument )
-		mpFrameView = pFrameViewArgument;
-	else
-        mpFrameView = new FrameView( GetDoc() );
-	GetFrameView()->Connect();
-
-    // Hide or delete unused controls that we have inherited from the
-    // ViewShell base class.
-	mpHorizontalScrollBar.reset();
-	mpVerticalScrollBar.reset();
-    mpScrollBarBox.reset();
-    mpHorizontalRuler.reset();
-    mpVerticalRuler.reset();
-
-	SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) );
-
-    // enforce the creation of the Accessible object here.
-    // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some
-    // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular)
-    // loop (which is /not/ a bug in the tool, of course).
-    // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation
-    // (which originally was intended as a workaround) herein. Better to be safe ...
-    // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible
-    // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only
-    // create the former here, the latter is still created on demand, when somebody requests it.
-    // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com
-    if (mpContentWindow.get())
-        mpContentWindow->GetAccessible( sal_True );
-
-    // For accessibility we have to shortly hide the content window.  This
-    // triggers the construction of a new accessibility object for the new
-    // view shell.  (One is created earlier while the construtor of the base
-    // class is executed.  At that time the correct accessibility object can
-    // not be constructed.)
-    if (mpContentWindow.get())
-    {
-        mpContentWindow->Hide();
-        mpContentWindow->Show();
-    }
-
-    // Register the shell manager as factory at the ViewShellManager.
-    mpSubShellManager.reset( new TaskPaneShellManager(
-        GetViewShellBase().GetViewShellManager(),
-        *this
-    ) );
-    GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell::~ToolPanelViewShell()
-{
-    mpImpl->Cleanup();
-
-    // reset our impl before destroying the panel deck, to ensure the hidden panels are properly
-    // disposed/destroyed, too
-    mpImpl.reset();
-    GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
-
-    GetFrameView()->Disconnect(); // i120663, release the FrameView object
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// static
-void ToolPanelViewShell::RegisterControls()
-{
-    SfxModule* pModule = SD_MOD();
-    controls::MasterPagesSelector::RegisterInterface( pModule );
-    LayoutMenu::RegisterInterface( pModule );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::ArrangeGUIElements()
-{
-    ViewShell::ArrangeGUIElements();
-
-    Initialize();
-
-    mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::GetFocus()
-{
-    Invalidate();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::LoseFocus()
-{
-    Invalidate();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent )
-{
-    const KeyCode nCode = i_rKeyEvent.GetKeyCode();
-    if ( nCode == KEY_RETURN )
-    {
-        if ( !mpImpl->GetTaskPane().HasChildPathFocus() )
-            mpImpl->GetTaskPane().GrabFocus();
-    }
-    else
-        ViewShell::KeyInput( i_rKeyEvent, NULL );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-SdPage*	ToolPanelViewShell::GetActualPage()
-{
-    return NULL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-SdPage*	ToolPanelViewShell::getCurrentPage() const
-{
-    return NULL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const
-{
-    return *mpSubShellManager.get();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-DockingWindow* ToolPanelViewShell::GetDockingWindow()
-{
-    ::Window* pParentWindow = GetParentWindow();
-    DockingWindow* pDockingWindow = NULL;
-    while (pParentWindow!=NULL && pDockingWindow==NULL)
-    {
-        pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
-        pParentWindow = pParentWindow->GetParent();
-    }
-    return pDockingWindow;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
-{
-    ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
-    return mpImpl->CreateAccessible( *i_pWindow );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XDrawSubController > ToolPanelViewShell::CreateSubController()
-{
-    // This view shell is not designed to be the main view shell and thus
-    // does not support a UNO sub controller.
-    return Reference< XDrawSubController >();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
-{
-    ::Window* pOldParentWindow = GetParentWindow();
-    FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() );
-    FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow );
-
-    PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() );
-    if ( pDockingWindow != NULL )
-    {
-        pDockingWindow->SetEndDockingHdl( Link() );
-    }
-
-    ViewShell::RelocateToParentWindow(pParentWindow);
-
-    mpImpl->ConnectToDockingWindow();
-
-    Resize();
-
-    return true;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const
-{
-    return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-namespace
-{
-    typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
-
-    struct PanelFactory
-    {
-        ControlFactoryFactory   pFactory;
-        rtl::OString            sHelpID;
-        PanelFactory( const ControlFactoryFactory i_pFactory, const rtl::OString& i_nHelpID )
-            :pFactory( i_pFactory )
-            ,sHelpID( i_nHelpID )
-        {
-        }
-    };
-
-    const PanelFactory lcl_describePanel( const PanelId i_ePanelId )
-    {
-        switch ( i_ePanelId )
-        {
-        case PID_MASTER_PAGES:
-            return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS );
-        case PID_LAYOUT:
-            return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS );
-        case PID_TABLE_DESIGN:
-            return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN );
-        case PID_CUSTOM_ANIMATION:
-            return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS );
-        case PID_SLIDE_TRANSITION:
-            return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS );
-        default:
-            break;
-        }
-        throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal panel ID" ) ), NULL );
-    }
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL )
-{
-    const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) );
-    ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL );
-
-    // a TreeNode which will resemble the panel
-    const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) );
-    ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) );
-    ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) );
-    ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ),
-        "illegal node returned by the control factory" );
-    pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID );
-
-    // create an XToolPanel
-    Reference< XToolPanel > xPanel( new ToolPanel( pNode ) );
-
-    // create an XUIElement providing this panel
-    const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) );
-
-    return xUIElement;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
-{
-    OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0,
-        "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" );
-    mpImpl->ActivatePanelByResource( i_rPanelResourceURL );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
-{
-    mpImpl->DeactivatePanelByResource( i_rPanelResourceURL );
-}
-
-// =====================================================================================================================
-// = ToolPanelViewShell_Impl - implementation
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
-    :m_rPanelViewShell( i_rPanelViewShell )
-    ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) )
-    ,m_bInitialized( false )
-{
-    const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
-    GetToolPanelDeck().SetAccessibleName( sPaneTitle );
-    GetToolPanelDeck().SetAccessibleDescription( sPaneTitle );
-
-    GetToolPanelDeck().AddListener( *this );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl()
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
-{
-    // not interested in
-    (void)i_pPanel;
-    (void)i_nPosition;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition )
-{
-    // not interested in
-    (void)i_nPosition;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-::rtl::OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel )
-{
-    ::rtl::OUString sPanelURL;
-    if ( !!i_rPanel )
-    {
-        sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel );
-        const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) );
-        if ( ePanelId == PID_UNKNOWN )
-            sPanelURL = ::rtl::OUString();
-    }
-    return sPanelURL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
-{
-    // update the configuration controller, since this change in the active panel might have been triggered by means other
-    // than the drawing framework, so it does not yet know about it.
-
-    const ::rtl::OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) );
-    const ::rtl::OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) );
-
-    const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
-    if ( sNewPanelURL.getLength() )
-    {
-        // activate the resource belonging to the new panel. This will automatically de-activate the previously active
-        // panel resource (since ResourceActivationMode_REPLACE is used)
-        pFrameworkHelper->RequestTaskPanel( sNewPanelURL );
-    }
-    else if ( sOldPanelURL.getLength() )
-    {
-        // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the
-        // resource framework. => Deactivate the old resource.
-        try
-        {
-            Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
-            xConfigController->requestResourceDeactivation(
-                pFrameworkHelper->CreateResourceId(
-                    sOldPanelURL,
-                    FrameworkHelper::msTaskPaneURL,
-                    FrameworkHelper::msRightPaneURL
-                )
-            );
-        }
-        catch( const Exception& )
-        {
-        	DBG_UNHANDLED_EXCEPTION();
-        }
-    }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
-{
-    // not interested in
-    (void)i_rNewLayouter;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Dying()
-{
-    // not interested in
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const
-{
-    const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) );
-    const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) );
-    if ( eLHS < eRHS )
-        return -1;
-    if ( eLHS == eRHS )
-        return 0;
-    return 1;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ConnectToDockingWindow()
-{
-    m_pTaskPaneController.reset();
-    DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() );
-    if ( pDockingWindow )
-    {
-        PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow );
-        OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" );
-        if ( pPaneDockingWindow != NULL )
-            m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) );
-    }
-
-    // Tell the focus manager that we want to pass the focus to our
-    // child.
-    FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow )
-{
-    Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( sal_False ) );
-    if ( !xAccessible.is() )
-    {
-        // determine the XAccessible which is the parent of the to-be-created object
-        ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
-        OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" );
-        GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent );
-
-        xAccessible = GetToolPanelDeck().GetAccessible( sal_True );
-        ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL );
-        OSL_ENSURE( xAccessible->getAccessibleContext().is()
-                &&  xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(),
-                "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" );
-    }
-    return xAccessible;
-}
-
-} } // end of namespace ::sd::toolpanel
diff --git a/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx b/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
deleted file mode 100644
index fc4dba9..0000000
--- a/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "AllMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-#include "app.hrc"
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include <tools/link.hxx>
-#include <set>
-
-namespace {
-
-using namespace sd::toolpanel::controls;
-
-int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor)
-{
-    int nPriority (0);
-    switch (rpDescriptor->GetURLClassification())
-    {
-        case MasterPageDescriptor::URLCLASS_USER:         nPriority = 0; break;
-        case MasterPageDescriptor::URLCLASS_LAYOUT:       nPriority = 1; break;
-        case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break;
-        case MasterPageDescriptor::URLCLASS_OTHER:        nPriority = 3; break;
-        case MasterPageDescriptor::URLCLASS_UNKNOWN:      nPriority = 4; break;
-        default:
-        case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break;
-    }
-    return nPriority;
-}
-
-
-class MasterPageDescriptorOrder
-{
-public:
-    bool operator() (const sd::toolpanel::controls::SharedMasterPageDescriptor& rp1,
-        const sd::toolpanel::controls::SharedMasterPageDescriptor& rp2)
-    {
-        if (rp1->meOrigin == MasterPageContainer::DEFAULT)
-            return true;
-        else if (rp2->meOrigin == MasterPageContainer::DEFAULT)
-            return false;
-        else if (rp1->GetURLClassification() == rp2->GetURLClassification())
-            return rp1->mnTemplateIndex < rp2->mnTemplateIndex;
-        else
-            return GetURLPriority(rp1) < GetURLPriority(rp2);
-    }
-};
-
-} // end of anonymous namespace
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class AllMasterPagesSelector::SortedMasterPageDescriptorList
-    : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder>
-{
-public:
-    SortedMasterPageDescriptorList (void) {}
-};
-
-
-
-
-AllMasterPagesSelector::AllMasterPagesSelector (
-    TreeNode* pParent,
-    SdDrawDocument& rDocument,
-    ViewShellBase& rBase,
-    DrawViewShell& rViewShell,
-    const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
-    : MasterPagesSelector(pParent, rDocument, rBase, rpContainer),
-      mrViewShell(rViewShell),
-      mpSortedMasterPages(new SortedMasterPageDescriptorList())
-{
-    SetName (String(RTL_CONSTASCII_USTRINGPARAM("AllMasterPagesSelector")));
-    MasterPagesSelector::Fill();
-}
-
-
-
-
-AllMasterPagesSelector::~AllMasterPagesSelector (void)
-{
-}
-
-
-
-
-void AllMasterPagesSelector::Fill (ItemList& rItemList)
-{
-    if (mpSortedMasterPages->empty())
-        UpdateMasterPageList();
-    UpdatePageSet(rItemList);
-}
-
-
-
-
-void AllMasterPagesSelector::NotifyContainerChangeEvent (
-    const MasterPageContainerChangeEvent& rEvent)
-{
-    switch (rEvent.meEventType)
-    {
-        case MasterPageContainerChangeEvent::CHILD_ADDED:
-            AddItem(rEvent.maChildToken);
-            MasterPagesSelector::Fill();
-            break;
-            
-        case MasterPageContainerChangeEvent::INDEX_CHANGED:
-        case MasterPageContainerChangeEvent::INDEXES_CHANGED:
-            mpSortedMasterPages->clear();
-            MasterPagesSelector::Fill();
-            break;
-
-        default:
-            MasterPagesSelector::NotifyContainerChangeEvent(rEvent);
-            break;
-    }
-}
-
-
-
-
-void AllMasterPagesSelector::UpdateMasterPageList (void)
-{
-    mpSortedMasterPages->clear();
-    int nTokenCount = mpContainer->GetTokenCount();
-    for (int i=0; i<nTokenCount; i++)
-        AddItem(mpContainer->GetTokenForIndex(i));
-}
-
-
-
-
-void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken)
-{
-    switch (mpContainer->GetOriginForToken(aToken))
-    {
-        case MasterPageContainer::DEFAULT:
-        case MasterPageContainer::TEMPLATE:
-            // Templates are added only when coming from the
-            // MasterPageContainerFiller so that they have an id which
-            // defines their place in the list.  Templates (pre) loaded from
-            // RecentlyUsedMasterPages are ignored (they will be loaded
-            // later by the MasterPageContainerFiller.)
-            if (mpContainer->GetTemplateIndexForToken(aToken) >= 0)
-                mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken));
-            break;
-
-        default:
-            break;
-    }
-}
-
-
-
-
-void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList)
-{
-    SortedMasterPageDescriptorList::const_iterator iDescriptor;
-    SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end());
-    for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor)
-        rItemList.push_back((*iDescriptor)->maToken);
-}
-
-
-
-
-void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
-    MasterPagesSelector::GetState(rItemSet);
-
-	if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
-        rItemSet.DisableItem(SID_TP_EDIT_MASTER);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::control
diff --git a/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx b/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
deleted file mode 100644
index bfa4ccd..0000000
--- a/main/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-
-#include <memory>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show a list of all available master pages so that the user can assign
-    them to the document.
-*/
-class AllMasterPagesSelector
-    : public MasterPagesSelector
-{
-public:
-    AllMasterPagesSelector (
-        TreeNode* pParent, 
-        SdDrawDocument& rDocument,
-        ViewShellBase& rBase,
-        DrawViewShell& rViewShell,
-        const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
-    virtual ~AllMasterPagesSelector (void);
-
-    /** Scan the set of templates for the ones whose first master pages are
-        shown by this control and store them in the MasterPageContainer.
-    */
-    virtual void Fill (ItemList& rItemList);
-
-    virtual void GetState (SfxItemSet& rItemSet);
-
-protected:
-    virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
-
-private:
-    DrawViewShell& mrViewShell;
-
-    /** The list of master pages displayed by this class.
-    */
-    class SortedMasterPageDescriptorList;
-    ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
-
-    void AddTemplate (const TemplateEntry& rEntry);
-
-    /** This filter returns <TRUE/> when the master page specified by the
-        given file name belongs to the set of Impress master pages.
-    */
-    bool FileFilter (const String& sFileName);
-
-    void AddItem (MasterPageContainer::Token aToken);
-
-    /** Add all items in the internal master page list into the given list.
-    */
-    void UpdatePageSet (ItemList& rItemList);
-
-    /** Update the internal list of master pages that are to show in the
-        control.
-    */
-    void UpdateMasterPageList (void);
-
-	using sd::toolpanel::controls::MasterPagesSelector::Fill;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx b/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx
deleted file mode 100644
index 8c41df6..0000000
--- a/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-#include "AnimationSchemesPanel.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-
-namespace sd
-{
-
-	class ViewShellBase;
-    extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase );
-
-namespace toolpanel { namespace controls {
-
-
-AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase)
-    : SubToolPanel (pParent),
-      maPreferredSize( 100, 200 )
-{
-	mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase );
-	mpWrappedControl->Show();
-}
-
-AnimationSchemesPanel::~AnimationSchemesPanel()
-{
-	delete mpWrappedControl;
-}
-
-Size AnimationSchemesPanel::GetPreferredSize()
-{
-    return maPreferredSize;
-}
-sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 )
-{
-    return maPreferredSize.Width();
-}
-sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 )
-{
-    return maPreferredSize.Height();
-}
-::Window* AnimationSchemesPanel::GetWindow()
-{
-    return mpWrappedControl;
-}
-bool AnimationSchemesPanel::IsResizable()
-{
-    return true;
-}
-bool AnimationSchemesPanel::IsExpandable() const
-{
-    return true;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-#include "AnimationSchemesPanel.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-
-namespace sd
-{
-
-	class ViewShellBase;
-    extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase );
-
-namespace toolpanel { namespace controls {
-
-
-AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase)
-    : SubToolPanel (pParent),
-      maPreferredSize( 100, 200 )
-{
-	mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase );
-	mpWrappedControl->Show();
-}
-
-AnimationSchemesPanel::~AnimationSchemesPanel()
-{
-	delete mpWrappedControl;
-}
-
-Size AnimationSchemesPanel::GetPreferredSize()
-{
-    return maPreferredSize;
-}
-sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 )
-{
-    return maPreferredSize.Width();
-}
-sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 )
-{
-    return maPreferredSize.Height();
-}
-::Window* AnimationSchemesPanel::GetWindow()
-{
-    return mpWrappedControl;
-}
-bool AnimationSchemesPanel::IsResizable()
-{
-    return true;
-}
-bool AnimationSchemesPanel::IsExpandable() const
-{
-    return true;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx b/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx
deleted file mode 100644
index 058982e..0000000
--- a/main/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
-#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class AnimationSchemesPanel
-    : public SubToolPanel
-{
-public:
-    AnimationSchemesPanel (
-        TreeNode* pParent,
-        ViewShellBase& rBase);
-    virtual ~AnimationSchemesPanel (void);
-
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual ::Window* GetWindow (void);
-    virtual bool IsResizable (void);
-    virtual bool IsExpandable (void) const;
-
-	using Window::GetWindow;
-
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-#ifndef SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
-#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class AnimationSchemesPanel
-    : public SubToolPanel
-{
-public:
-    AnimationSchemesPanel (
-        TreeNode* pParent,
-        ViewShellBase& rBase);
-    virtual ~AnimationSchemesPanel (void);
-
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual ::Window* GetWindow (void);
-    virtual bool IsResizable (void);
-    virtual bool IsExpandable (void) const;
-
-	using Window::GetWindow;
-
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx b/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
deleted file mode 100644
index 7196d76..0000000
--- a/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
+++ /dev/null
@@ -1,339 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "CurrentMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-#include "ViewShellBase.hxx"
-#include "DrawViewShell.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "EventMultiplexer.hxx"
-#include "app.hrc"
-#include "DrawDocShell.hxx"
-#include "DrawViewShell.hxx"
-#include "res_bmp.hrc"
-#include "sdresid.hxx"
-
-#include <vcl/image.hxx>
-#include <svx/svdmodel.hxx>
-#include <sfx2/request.hxx>
-
-#include <set>
-
-
-using namespace ::com::sun::star;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-CurrentMasterPagesSelector::CurrentMasterPagesSelector (
-    TreeNode* pParent,
-    SdDrawDocument& rDocument,
-    ViewShellBase& rBase,
-    const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
-    : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
-{
-	SetName(String(RTL_CONSTASCII_USTRINGPARAM("CurrentMasterPagesSelector")));
-
-    // For this master page selector only we change the default action for
-    // left clicks.
-    mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES;
-
-    Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
-    rBase.GetEventMultiplexer()->AddEventListener(aLink,
-        sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
-        | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
-        | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER
-        | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER
-        | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED
-        | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED
-        | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED);
-}
-
-
-
-
-CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
-{
-    if (mrDocument.GetDocSh() != NULL)
-    {
-        EndListening(*mrDocument.GetDocSh());
-    }
-    else
-    {
-        OSL_ASSERT(mrDocument.GetDocSh() != NULL);
-    }
-    
-    Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
-    mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
-}
-
-
-
-
-void CurrentMasterPagesSelector::LateInit (void)
-{
-    MasterPagesSelector::LateInit();
-    MasterPagesSelector::Fill();
-    if (mrDocument.GetDocSh() != NULL)
-    {
-        StartListening(*mrDocument.GetDocSh());
-    }
-    else
-    {
-        OSL_ASSERT(mrDocument.GetDocSh() != NULL);
-    }
-}
-
-
-
-
-void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
-{
-	sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
-    SdPage* pMasterPage;
-    // Remember the names of the master pages that have been inserted to
-    // avoid double insertion.
-    ::std::set<String> aMasterPageNames;
-    for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
-    {
-        pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
-        if (pMasterPage == NULL)
-            continue;
-
-        // Use the name of the master page to avoid duplicate entries.
-        String sName (pMasterPage->GetName());
-        if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
-            continue;
-        aMasterPageNames.insert (sName);
-
-        // Look up the master page in the container and, when it is not yet
-        // in it, insert it.
-        MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage);
-        if (aToken == MasterPageContainer::NIL_TOKEN)
-        {
-            SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
-                MasterPageContainer::MASTERPAGE,
-                nIndex,
-                String(),
-                pMasterPage->GetName(),
-                String(),
-                pMasterPage->IsPrecious(),
-                ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)),
-                ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
-            aToken = mpContainer->PutMasterPage(pDescriptor);
-        }
-
-        rItemList.push_back(aToken);
-    }
-}
-
-
-
-
-ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const
-{
-    return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP);
-}
-
-
-
-
-void CurrentMasterPagesSelector::UpdateSelection (void)
-{
-    // Iterate over all pages and for the selected ones put the name of
-    // their master page into a set.
-	sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
-    SdPage* pPage;
-    ::std::set<String> aNames;
-    sal_uInt16 nIndex;
-    bool bLoop (true);
-    for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
-    {
-        pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD);
-        if (pPage != NULL && pPage->IsSelected())
-        {
-            if ( ! pPage->TRG_HasMasterPage())
-            {
-                // One of the pages has no master page.  This is an
-                // indicator for that this method is called in the middle of
-                // a document change and that the model is not in a valid
-                // state.  Therefore we stop update the selection and wait
-                // for another call to UpdateSelection when the model is
-                // valid again.
-                bLoop = false;
-            }
-            else
-            {
-                SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
-                SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
-                if (pMasterPage != NULL)
-                    aNames.insert (pMasterPage->GetName());
-            }
-        }
-    }
-
-    // Find the items for the master pages in the set.
-    sal_uInt16 nItemCount (mpPageSet->GetItemCount());
-    for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++)
-    {
-        String sName (mpPageSet->GetItemText (nIndex));
-        if (aNames.find(sName) != aNames.end())
-        {
-            mpPageSet->SelectItem (nIndex);
-        }
-    }
-}
-
-
-
-
-void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest)
-{
-	switch (rRequest.GetSlot())
-    {
-        case SID_DELETE_MASTER_PAGE:
-        {
-            // Check once again that the master page can safely be deleted,
-            // i.e. is not used.
-            SdPage* pMasterPage = GetSelectedMasterPage();
-            if (pMasterPage != NULL
-                && mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
-            {
-                // Removing the precious flag so that the following call to
-                // RemoveUnnessesaryMasterPages() will remove this master page.
-                pMasterPage->SetPrecious(false);
-                mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True);
-            }
-        }
-        break;
-            
-        default:
-            MasterPagesSelector::Execute(rRequest);
-            break;
-    }
-}
-
-
-
-
-void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
-    // Disable the SID_DELTE_MASTER slot when there is only one master page.
-    if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE
-        && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
-    {
-        rItemSet.DisableItem(SID_DELETE_MASTER_PAGE);
-    }
-
-    ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
-        ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
-	if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE
-        && pDrawViewShell
-        && pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
-    {
-        rItemSet.DisableItem (SID_TP_EDIT_MASTER);
-    }
-
-    MasterPagesSelector::GetState(rItemSet);
-}
-
-
-
-
-
-
-IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
-    sd::tools::EventMultiplexerEvent*,pEvent)
-{
-    if (pEvent != NULL)
-    {
-        switch (pEvent->meEventId)
-        {
-            case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
-            case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
-            case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
-            case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
-                UpdateSelection();
-                break;
-
-            case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER:
-				// This is tricky.  If a master page is removed, moved, or
-				// added we have to wait until both the notes master page
-				// and the standard master page have been removed, moved,
-				// or added.  We do this by looking at the number of master
-				// pages which has to be odd in the consistent state (the
-				// handout master page is always present).  If the number is
-				// even we ignore the hint.
-                if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
-                    MasterPagesSelector::Fill();
-                break;
-
-            case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
-            case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
-            case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
-                InvalidatePreview((const SdPage*)pEvent->mpUserData);
-                break;
-        }
-    }
-    
-    return 0;
-}
-
-
-
-
-void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint)
-{
-    const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
-    if (pSimpleHint != NULL)
-    {
-        if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
-        {
-            // Is the edit view visible in the center pane?
-            ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
-                ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
-            if (pDrawViewShell.get() != NULL)
-            {
-                // Is the edit view in master page mode?
-            	if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
-                {
-                    // Mark the currently edited master page as precious.
-                    SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage();
-                    if (pCurrentMasterPage != NULL)
-                        pCurrentMasterPage->SetPrecious(true);
-                }
-            }
-        }
-    }
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx b/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
deleted file mode 100644
index 3d3424a..0000000
--- a/main/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-#include <com/sun/star/lang/XComponent.hpp>
-
-namespace sd { namespace tools { class EventMultiplexerEvent; } }
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show the master pages currently used by a SdDrawDocument.
-*/
-class CurrentMasterPagesSelector
-    : public MasterPagesSelector,
-      public SfxListener
-{
-public:
-    CurrentMasterPagesSelector (
-        TreeNode* pParent, 
-        SdDrawDocument& rDocument,
-        ViewShellBase& rBase,
-        const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
-    virtual ~CurrentMasterPagesSelector (void);
-
-    virtual void LateInit (void);
-
-    /** Set the selection so that the master page is selected that is
-        used by the currently selected page of the document in the
-        center pane.
-    */
-    virtual void UpdateSelection (void);
-
-    /** Copy all master pages that are to be shown into the given list.
-    */
-    virtual void Fill (ItemList& rItemList);
-
-	using sd::toolpanel::controls::MasterPagesSelector::Fill;
-
-protected:
-    virtual ResId GetContextMenuResId (void) const;
-    virtual void Execute (SfxRequest& rRequest);
-    virtual void GetState (SfxItemSet& rItemSet);
-    
-private:
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
-        mxListener;
-
-    DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
-    void Notify (SfxBroadcaster&, const SfxHint& rHint);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
deleted file mode 100644
index f241401..0000000
--- a/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "CustomAnimationPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-
-namespace sd
-{ 
-	
-	class ViewShellBase;
-	extern ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase );
-	
-namespace toolpanel { namespace controls {
-
-
-CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
-    :SubToolPanel( i_rParentWindow )
-    ,m_pPanelViewShell( &i_rPanelViewShell )
-{
-	mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() );
-	mpWrappedControl->Show();
-}
-
-CustomAnimationPanel::~CustomAnimationPanel()
-{
-	delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
-    return std::auto_ptr< ControlFactory >(
-        new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* CustomAnimationPanel::GetShellManager()
-{
-    if ( m_pPanelViewShell )
-        return &m_pPanelViewShell->GetSubShellManager();
-    return SubToolPanel::GetShellManager();
-}
-
-Size CustomAnimationPanel::GetPreferredSize()
-{
-    return maPreferredSize;
-}
-sal_Int32 CustomAnimationPanel::GetPreferredWidth(sal_Int32 )
-{
-    return maPreferredSize.Width();
-}
-sal_Int32 CustomAnimationPanel::GetPreferredHeight(sal_Int32 )
-{
-    return maPreferredSize.Height();
-}
-::Window* CustomAnimationPanel::GetWindow()
-{
-    return mpWrappedControl;
-}
-bool CustomAnimationPanel::IsResizable()
-{
-    return true;
-}
-bool CustomAnimationPanel::IsExpandable() const
-{
-    return true;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> CustomAnimationPanel::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    if (GetWindow() != NULL)
-        return GetWindow()->GetAccessible();
-    else
-        return NULL;
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
deleted file mode 100644
index 2e97970..0000000
--- a/main/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-class ControlFactory;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class CustomAnimationPanel
-    : public SubToolPanel
-{
-public:
-    CustomAnimationPanel (
-        Window& i_rParentWindow, 
-        ToolPanelViewShell& i_rPanelViewShell);
-    virtual ~CustomAnimationPanel (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell);
-
-    // TreeNode overridables
-    virtual TaskPaneShellManager* GetShellManager();
-
-    // ILayoutableWindow overridables
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual ::Window* GetWindow (void);
-    virtual bool IsResizable (void);
-    virtual bool IsExpandable (void) const;
-
-    virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::accessibility::XAccessible>& rxParent);
-
-	using Window::GetWindow;
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-    ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/main/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
deleted file mode 100644
index 213bc75..0000000
--- a/main/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
+++ /dev/null
@@ -1,581 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "DocumentHelper.hxx"
-
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "unmovss.hxx"
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "undoback.hxx"
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPages.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include "stlpool.hxx"
-#include <svx/xfillit0.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
-    SdDrawDocument& rTargetDocument,
-    SdPage* pMasterPage)
-{
-    SdPage* pNewMasterPage = NULL;
-
-    do
-    {
-        if (pMasterPage == NULL)
-            break;
-
-        // Check the presence of the source document.
-        SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
-            pMasterPage->GetModel());
-        if (pSourceDocument == NULL)
-            break;
-
-        // When the given master page already belongs to the target document
-        // then there is nothing more to do.
-        if (pSourceDocument == &rTargetDocument)
-        {
-            pNewMasterPage = pMasterPage;
-            break;
-        }
-
-        // Test if the master pages of both the slide and its notes page are
-        // present.  This is not the case when we are called during the
-        // creation of the slide master page because then the notes master
-        // page is not there.
-        sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount();
-        if (nSourceMasterPageCount%2 == 0)
-            // There should be 1 handout page + n slide masters + n notes
-            // masters = 2*n+1.  An even value indicates that a new slide
-            // master but not yet the notes master has been inserted.
-            break;
-        sal_uInt16 nIndex = pMasterPage->GetPageNum();
-        if (nSourceMasterPageCount <= nIndex+1)
-            break;
-        // Get the slide master page.
-        if (pMasterPage != static_cast<SdPage*>(
-            pSourceDocument->GetMasterPage(nIndex)))
-            break;
-        // Get the notes master page.
-        SdPage* pNotesMasterPage = static_cast<SdPage*>(
-            pSourceDocument->GetMasterPage(nIndex+1));
-        if (pNotesMasterPage == NULL)
-            break;
-
-
-        // Check if a master page with the same name as that of the given
-        // master page already exists.
-        bool bPageExists (false);
-        sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD));
-        for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++)
-        {
-            SdPage* pCandidate = static_cast<SdPage*>(
-                rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD));
-            if (pMasterPage!=NULL
-                && pCandidate->GetName().CompareTo(pMasterPage->GetName())==0)
-            {
-                bPageExists = true;
-                pNewMasterPage = pCandidate;
-                break;
-            }
-        }
-        if (bPageExists)
-            break;
-        
-        // Create a new slide (and its notes page.)
-        uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (
-            rTargetDocument.getUnoModel(), uno::UNO_QUERY);
-        if ( ! xSlideSupplier.is())
-            break;
-        uno::Reference<drawing::XDrawPages> xSlides (
-            xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
-        if ( ! xSlides.is())
-            break;
-        xSlides->insertNewByIndex (xSlides->getCount());
-
-        // Set a layout.
-        SdPage* pSlide = rTargetDocument.GetSdPage(
-            rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
-            PK_STANDARD);
-        if (pSlide == NULL)
-            break;
-        pSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
-
-        // Create a copy of the master page and the associated notes
-        // master page and insert them into our document.
-        pNewMasterPage = AddMasterPage(rTargetDocument, pMasterPage);
-        if (pNewMasterPage==NULL)
-            break;
-        SdPage* pNewNotesMasterPage 
-            = AddMasterPage(rTargetDocument, pNotesMasterPage);
-        if (pNewNotesMasterPage==NULL)
-            break;
-
-        // Make the connection from the new slide to the master page
-        // (and do the same for the notes page.)
-        rTargetDocument.SetMasterPage (
-            rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
-            pNewMasterPage->GetName(),
-            &rTargetDocument,
-            sal_False, // Connect the new master page with the new slide but
-                   // do not modify other (master) pages.
-            sal_True);
-    }
-    while (false);
-
-    // We are not interested in any automatisms for our modified internal
-    // document.
-    rTargetDocument.SetChanged (sal_False);
-
-    return pNewMasterPage;
-}
-
-
-
-
-SdPage* DocumentHelper::GetSlideForMasterPage (SdPage* pMasterPage)
-{
-    SdPage* pCandidate = NULL;
-
-    SdDrawDocument* pDocument = NULL;
-    if (pMasterPage != NULL)
-        pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
-
-    // Iterate over all pages and check if it references the given master
-    // page.
-    if (pDocument!=NULL && pDocument->GetSdPageCount(PK_STANDARD) > 0)
-    {
-        // In most cases a new slide has just been inserted so start with
-        // the last page.
-        sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PK_STANDARD)-1);
-        bool bFound (false);
-        while ( ! bFound)
-        {
-            pCandidate = pDocument->GetSdPage(
-                nPageIndex,
-                PK_STANDARD);
-            if (pCandidate != NULL)
-            {
-                if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage())
-                    == pMasterPage)
-                {
-                    bFound = true;
-                    break;
-                }
-            }
-
-            if (nPageIndex == 0)
-                break;
-            else
-                nPageIndex --;
-        }
-
-        // If no page was found that refernced the given master page reset
-        // the pointer that is returned.
-        if ( ! bFound)
-            pCandidate = NULL;
-    }
-
-    return pCandidate;
-}
-
-
-
-
-SdPage* DocumentHelper::AddMasterPage (
-    SdDrawDocument& rTargetDocument,
-    SdPage* pMasterPage)
-{
-    SdPage* pClonedMasterPage = NULL;
-
-    if (pMasterPage!=NULL)
-    {
-        try
-        {
-            // Duplicate the master page.
-            pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
-
-            // Copy the necessary styles.
-            SdDrawDocument* pSourceDocument
-                = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
-            if (pSourceDocument != NULL)
-                ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
-
-            // Copy the precious flag.
-            pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
-            
-            // Now that the styles are available we can insert the cloned
-            // master page.
-            rTargetDocument.InsertMasterPage (pClonedMasterPage);
-        }
-        catch (uno::Exception& rException)
-        {
-            pClonedMasterPage = NULL;
-            DBG_UNHANDLED_EXCEPTION();
-        }
-        catch (::std::exception rException)
-        {
-            pClonedMasterPage = NULL;
-            OSL_TRACE ("caught general exception");
-        }
-        catch (...)
-        {
-            pClonedMasterPage = NULL;
-            OSL_TRACE ("caught general exception");
-        }
-    }
-
-    return pClonedMasterPage;
-}
-
-
-
-
-void DocumentHelper::ProvideStyles (
-    SdDrawDocument& rSourceDocument,
-    SdDrawDocument& rTargetDocument,
-    SdPage* pPage)
-{
-    // Get the layout name of the given page.
-    String sLayoutName (pPage->GetLayoutName());
-    sLayoutName.Erase (sLayoutName.SearchAscii (SD_LT_SEPARATOR));
-
-    // Copy the style sheet from source to target document.
-	SdStyleSheetPool* pSourceStyleSheetPool =
-        static_cast<SdStyleSheetPool*>(rSourceDocument.GetStyleSheetPool());
-	SdStyleSheetPool* pTargetStyleSheetPool =
-        static_cast<SdStyleSheetPool*>(rTargetDocument.GetStyleSheetPool());
-    SdStyleSheetVector aCreatedStyles;
-    pTargetStyleSheetPool->CopyLayoutSheets (
-        sLayoutName, 
-        *pSourceStyleSheetPool, 
-        aCreatedStyles);
-
-    // Add an undo action for the copied style sheets.
-    if( !aCreatedStyles.empty() )
-    {
-     	::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager();
-       if (pUndoManager != NULL)
-       {
-           SdMoveStyleSheetsUndoAction* pMovStyles =
-               new SdMoveStyleSheetsUndoAction (
-                   &rTargetDocument, 
-                   aCreatedStyles, 
-                   sal_True);
-           pUndoManager->AddUndoAction (pMovStyles);
-       }
-    }
-}
-
-
-
-
-void DocumentHelper::AssignMasterPageToPageList (
-    SdDrawDocument& rTargetDocument,
-    SdPage* pMasterPage,
-    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
-    do
-    {
-        if (pMasterPage == NULL && pMasterPage->IsMasterPage())
-            break;
-
-        // Make the layout name by stripping ouf the layout postfix from the
-        // layout name of the given master page.
-        String sFullLayoutName (pMasterPage->GetLayoutName());
-        String sBaseLayoutName (sFullLayoutName);
-        sBaseLayoutName.Erase (sBaseLayoutName.SearchAscii (SD_LT_SEPARATOR));
-
-        if (rpPageList->empty())
-            break;
-
-        // Create a second list that contains only the valid pointers to
-        // pages for which an assignment is necessary.
-        ::std::vector<SdPage*>::const_iterator iPage;
-        ::std::vector<SdPage*> aCleanedList;
-        for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
-        {
-            OSL_ASSERT(*iPage!=NULL && (*iPage)->GetModel() == &rTargetDocument);
-            if (*iPage != NULL
-                && (*iPage)->GetLayoutName().CompareTo(sFullLayoutName)!=0)
-            {
-                aCleanedList.push_back(*iPage);
-            }
-        }
-        if (aCleanedList.empty() )
-            break;
-
-		::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
-		if( pUndoMgr )
-			pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_SET_PRESLAYOUT)), String());
-
-        SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
-        if (pMasterPageInDocument == NULL)
-            break;
-
-        // Assign the master pages to the given list of pages.
-        for (iPage=aCleanedList.begin(); 
-             iPage!=aCleanedList.end(); 
-             ++iPage)
-        {
-            AssignMasterPageToPage (
-                pMasterPageInDocument,
-                sBaseLayoutName,
-                *iPage);
-        }
-
-		if( pUndoMgr )
-			pUndoMgr->LeaveListAction();
-    }
-    while (false);
-}
-
-
-
-
-SdPage* DocumentHelper::AddMasterPage (
-    SdDrawDocument& rTargetDocument,
-    SdPage* pMasterPage,
-    sal_uInt16 nInsertionIndex)
-{
-    SdPage* pClonedMasterPage = NULL;
-
-    if (pMasterPage!=NULL)
-    {
-        // Duplicate the master page.
-        pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
-
-        // Copy the precious flag.
-        pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
-        
-        // Copy the necessary styles.
-        SdDrawDocument* pSourceDocument
-            = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
-        if (pSourceDocument != NULL)
-        {
-            ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
-
-            // Now that the styles are available we can insert the cloned
-            // master page.
-            rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
-
-            // Adapt the size of the new master page to that of the pages in
-            // the document.
-            Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
-            Rectangle aBorders (
-                pClonedMasterPage->GetLftBorder(),
-                pClonedMasterPage->GetUppBorder(),
-                pClonedMasterPage->GetRgtBorder(),
-                pClonedMasterPage->GetLwrBorder());
-            pClonedMasterPage->ScaleObjects(aNewSize, aBorders, sal_True);
-            pClonedMasterPage->SetSize(aNewSize);
-            pClonedMasterPage->CreateTitleAndLayout(sal_True);
-        }
-    }
-
-    return pClonedMasterPage;
-}
-
-
-
-
-/** In here we have to handle three cases:
-    1. pPage is a normal slide.  We can use SetMasterPage to assign the
-    master pages to it.
-    2. pPage is a master page that is used by at least one slide.  We can
-    assign the master page to these slides.
-    3. pPage is a master page that is currently not used by any slide.
-    We can delete that page and add copies of the given master pages
-    instead.
-
-    For points 2 and 3 where one master page A is assigned to another B we have
-    to keep in mind that the master page that page A has already been
-    inserted into the target document.
-*/
-void DocumentHelper::AssignMasterPageToPage (
-    SdPage* pMasterPage,
-    const String& rsBaseLayoutName,
-    SdPage* pPage)
-{
-    // Leave early when the parameters are invalid.
-    if (pPage == NULL || pMasterPage == NULL)
-        return;
-    SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
-    if (pDocument == NULL)
-        return;
-    
-    if ( ! pPage->IsMasterPage())
-    {
-        // 1. Remove the background object (so that that, if it exists, does
-        // not override the new master page) and assign the master page to
-        // the regular slide.
-        pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
-            new SdBackgroundObjUndoAction(
-                *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
-            sal_True);
-        pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
-          
-        pDocument->SetMasterPage (
-            (pPage->GetPageNum()-1)/2,
-            rsBaseLayoutName,
-            pDocument,
-            sal_False,
-            sal_False);
-    }
-    else
-    {
-        // Find first slide that uses the master page.
-        SdPage* pSlide = NULL;
-        sal_uInt16 nPageCount = pDocument->GetSdPageCount(PK_STANDARD);
-        for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==NULL; nPage++)
-        {
-            SdrPage* pCandidate = pDocument->GetSdPage(nPage,PK_STANDARD);
-            if (pCandidate != NULL
-                && pCandidate->TRG_HasMasterPage()
-                && &(pCandidate->TRG_GetMasterPage()) == pPage)
-            {
-                pSlide = static_cast<SdPage*>(pCandidate);
-            }
-        }
-
-        if (pSlide != NULL)
-        {
-            // 2. Assign the given master pages to the first slide that was
-            // found above that uses the master page.
-            pDocument->SetMasterPage (
-                (pSlide->GetPageNum()-1)/2,
-                rsBaseLayoutName,
-                pDocument,
-                sal_False,
-                sal_False);
-        }
-        else
-        {
-            // 3. Replace the master page A by a copy of the given master
-            // page B.
-            pDocument->RemoveUnnecessaryMasterPages (
-                pPage, sal_False);
-        }
-    }
-}
-
-
-
-
-SdPage* DocumentHelper::ProvideMasterPage (
-    SdDrawDocument& rTargetDocument,
-    SdPage* pMasterPage,
-    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
-    // Make sure that both the master page and its notes master exist
-    // in the source document.  If one is missing then return without
-    // making any changes.
-    if (pMasterPage == NULL)
-    {
-        // The caller should make sure that the master page is valid.
-        OSL_ASSERT(pMasterPage != NULL);
-        return NULL;
-    }
-    SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
-    if (pSourceDocument == NULL)
-        return NULL;
-    SdPage* pNotesMasterPage = static_cast<SdPage*>(
-        pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
-    if (pNotesMasterPage == NULL)
-    {
-        // The model is not in a valid state.  Maybe a new master page
-        // is being (not finished yet) created?  Return without making
-        // any changes.
-        return NULL;
-    }
-
-    SdPage* pMasterPageInDocument = NULL;
-    // Search for a master page with the same name as the given one in
-    // the target document.
-    const XubString sMasterPageLayoutName (pMasterPage->GetLayoutName());
-    for (sal_uInt16 nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex)
-    {
-        SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex));
-        if (pCandidate!=NULL 
-            && sMasterPageLayoutName==pCandidate->GetLayoutName())
-        {
-            // The requested master page does already exist in the
-            // target document, return it.
-            return pCandidate;
-        }
-    }
-    
-    // The given master page does not already belong to the target
-    // document so we have to create copies and insert them into the
-    // targer document.
-
-    // Determine the position where the new master pages are inserted.
-    // By default they are inserted at the end.  When we assign to a
-    // master page then insert after the last of the (selected) pages.
-    sal_uInt16 nInsertionIndex = rTargetDocument.GetMasterPageCount();
-    if (rpPageList->front()->IsMasterPage())
-    {
-        nInsertionIndex = rpPageList->back()->GetPageNum();
-    }
-
-    // Clone the master page.
-    if (pMasterPage->GetModel() != &rTargetDocument)
-    {
-        pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
-        if( rTargetDocument.IsUndoEnabled() )
-				rTargetDocument.AddUndo(
-					rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument));
-    }
-    else
-        pMasterPageInDocument = pMasterPage;
-
-    // Clone the notes master.
-    if (pNotesMasterPage->GetModel() != &rTargetDocument)
-    {
-        SdPage* pClonedNotesMasterPage 
-            = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
-        if( rTargetDocument.IsUndoEnabled() )
-            rTargetDocument.AddUndo(
-                rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
-    }
-
-    return pMasterPageInDocument;
-}
-
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/DocumentHelper.hxx b/main/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
deleted file mode 100644
index 4fe21e2..0000000
--- a/main/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
-#define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
-
-#include <tools/solar.h>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-class SdDrawDocument;
-class SdPage;
-class String;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** A collection of methods supporting the handling of master pages.
-*/
-class DocumentHelper
-{
-public:
-    /** Return a copy of the given master page in the given document.
-    */
-    static SdPage* CopyMasterPageToLocalDocument (
-        SdDrawDocument& rTargetDocument,
-        SdPage* pMasterPage);
-
-    /** Return and, when not yet present, create a slide that uses the given
-        masster page.
-    */
-    static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
-
-    /** Copy the styles used by the given page from the source document to
-        the target document.
-    */
-    static void ProvideStyles (
-        SdDrawDocument& rSourceDocument,
-        SdDrawDocument& rTargetDocument,
-        SdPage* pPage);
-
-    /** Assign the given master page to the list of pages.
-        @param rTargetDocument
-            The document that is the owner of the pages in rPageList.
-        @param pMasterPage
-            This master page will usually be a member of the list of all
-            available master pages as provided by the MasterPageContainer.
-        @param rPageList
-            The pages to which to assign the master page.  These pages may
-            be slides or master pages themselves.
-    */
-    static void AssignMasterPageToPageList (
-        SdDrawDocument& rTargetDocument,
-        SdPage* pMasterPage,
-        const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
-
-private:
-    static SdPage* AddMasterPage (
-        SdDrawDocument& rTargetDocument,
-        SdPage* pMasterPage);
-    static SdPage* AddMasterPage (
-        SdDrawDocument& rTargetDocument,
-        SdPage* pMasterPage,
-        sal_uInt16 nInsertionIndex);
-    static SdPage* ProvideMasterPage (
-        SdDrawDocument& rTargetDocument,
-        SdPage* pMasterPage,
-        const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
-    
-    /** Assign the given master page to the given page.
-        @param pMasterPage
-            In contrast to AssignMasterPageToPageList() this page is assumed
-            to be in the target document, i.e. the same document that pPage
-            is in.  The caller will usually call AddMasterPage() to create a
-            clone of a master page in a another document to create it.
-        @param rsBaseLayoutName
-            The layout name of the given master page.  It is given so that
-            it has not to be created on every call.  It could be generated
-            from the given master page, though.
-        @param pPage
-            The page to which to assign the master page.  It can be a slide
-            or a master page itself.
-    */
-    static void AssignMasterPageToPage (
-        SdPage* pMasterPage,
-        const String& rsBaseLayoutName,
-        SdPage* pPage);
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
deleted file mode 100644
index faed78e..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
+++ /dev/null
@@ -1,1216 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageContainer.hxx"
-
-#include "MasterPageDescriptor.hxx"
-#include "MasterPageContainerFiller.hxx"
-#include "MasterPageContainerQueue.hxx"
-#include "TemplateScanner.hxx"
-#include "tools/AsynchronousTask.hxx"
-#include "strings.hrc"
-#include <algorithm>
-#include <list>
-#include <set>
-
-#include "unomodel.hxx"
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/processfactory.hxx>
-#include <tools/urlobj.hxx>
-#include <sfx2/app.hxx>
-#include <svx/svdpage.hxx>
-#include "DrawDocShell.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include <svl/itemset.hxx>
-#include <svl/eitem.hxx>
-#include "sdresid.hxx"
-#include "tools/TimerBasedTaskExecution.hxx"
-#include "pres.hxx"
-#include <osl/mutex.hxx>
-#include <boost/weak_ptr.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-namespace {
-
-typedef ::std::vector<SharedMasterPageDescriptor> MasterPageContainerType;
-
-} // end of anonymous namespace
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Inner implementation class of the MasterPageContainer.
-*/
-class MasterPageContainer::Implementation
-    : public SdGlobalResource,
-      public MasterPageContainerFiller::ContainerAdapter,
-      public MasterPageContainerQueue::ContainerAdapter
-{
-public:
-    mutable ::osl::Mutex maMutex;
-
-    static ::boost::weak_ptr<Implementation> mpInstance;
-    MasterPageContainerType maContainer;
-
-    static ::boost::shared_ptr<Implementation> Instance (void);
-
-    void LateInit (void);
-    void AddChangeListener (const Link& rLink);
-    void RemoveChangeListener (const Link& rLink);
-    void UpdatePreviewSizePixel (void);
-    Size GetPreviewSizePixel (PreviewSize eSize) const;
-
-    bool HasToken (Token aToken) const;
-    const SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken) const;
-    SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken);
-    virtual Token PutMasterPage (const SharedMasterPageDescriptor& rDescriptor);
-    void InvalidatePreview (Token aToken);
-    Image GetPreviewForToken (
-        Token aToken,
-        PreviewSize ePreviewSize);
-    PreviewState GetPreviewState (Token aToken) const;
-    bool RequestPreview (Token aToken);
-
-    Reference<frame::XModel> GetModel (void);
-    SdDrawDocument* GetDocument (void);
-
-    void FireContainerChange (
-        MasterPageContainerChangeEvent::EventType eType,
-        Token aToken,
-        bool bNotifyAsynchronously = false);
-
-    virtual bool UpdateDescriptor (
-        const SharedMasterPageDescriptor& rpDescriptor,
-        bool bForcePageObject,
-        bool bForcePreview,
-        bool bSendEvents);
-
-    void ReleaseDescriptor (Token aToken);
-
-    /** Called by the MasterPageContainerFiller to notify that all master
-        pages from template documents have been added.
-    */
-    virtual void FillingDone (void);
-
-private:
-    Implementation (void);
-    virtual ~Implementation (void);
-
-    class Deleter { public:
-        void operator() (Implementation* pObject) { delete pObject; }
-    };
-    friend class Deleter;
-
-    enum InitializationState { NOT_INITIALIZED, INITIALIZING, INITIALIZED } meInitializationState;
-
-    ::boost::scoped_ptr<MasterPageContainerQueue> mpRequestQueue;
-    ::com::sun::star::uno::Reference<com::sun::star::frame::XModel> mxModel;
-    SdDrawDocument* mpDocument;
-    PreviewRenderer maPreviewRenderer;
-    /** Remember whether the first page object has already been used to
-        determine the correct size ratio.
-    */
-    bool mbFirstPageObjectSeen;
-    
-    // The widths for the previews contain two pixels for the border that is
-    // painted arround the preview.
-    static const int SMALL_PREVIEW_WIDTH = 72 + 2;
-    static const int LARGE_PREVIEW_WIDTH = 2*72 + 2;
-
-    /** This substition of page preview shows "Preparing preview" and is
-        shown as long as the actual previews are not being present.
-    */
-    Image maLargePreviewBeingCreated;
-    Image maSmallPreviewBeingCreated;
-
-    /** This substition of page preview is shown when a preview can not be
-        created and thus is not available.
-    */
-    Image maLargePreviewNotAvailable;
-    Image maSmallPreviewNotAvailable;
-
-    ::std::vector<Link> maChangeListeners;
-
-    // We have to remember the tasks for initialization and filling in case
-    // a MasterPageContainer object is destroyed before these tasks have
-    // been completed.
-    ::boost::weak_ptr<sd::tools::TimerBasedTaskExecution> mpFillerTask;
-
-    Size maSmallPreviewSizePixel;
-    Size maLargePreviewSizePixel;
-    bool mbPageRatioKnown;
-
-    bool mbContainerCleaningPending;
-
-    typedef ::std::pair<MasterPageContainerChangeEvent::EventType,Token> EventData;
-    DECL_LINK(AsynchronousNotifyCallback, EventData*);
-    ::sd::DrawDocShell* LoadDocument (
-        const String& sFileName,
-        SfxObjectShellLock& rxDocumentShell);
-
-    Image GetPreviewSubstitution (sal_uInt16 nId, PreviewSize ePreviewSize);
-
-    void CleanContainer (void);
-};
-
-
-
-
-//===== MasterPageContainer ===================================================
-
-::boost::weak_ptr<MasterPageContainer::Implementation>
-    MasterPageContainer::Implementation::mpInstance;
-static const MasterPageContainer::Token NIL_TOKEN (-1);
-
-
-
-
-::boost::shared_ptr<MasterPageContainer::Implementation>
-    MasterPageContainer::Implementation::Instance (void)
-{
-    ::boost::shared_ptr<MasterPageContainer::Implementation> pInstance;
-    
-    if (Implementation::mpInstance.expired())
-    {
-        ::osl::GetGlobalMutex aMutexFunctor;
-        ::osl::MutexGuard aGuard (aMutexFunctor());
-        if (Implementation::mpInstance.expired())
-        {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-            pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
-                new MasterPageContainer::Implementation(),
-                MasterPageContainer::Implementation::Deleter());
-            SdGlobalResourceContainer::Instance().AddResource(pInstance);
-            Implementation::mpInstance = pInstance;
-        }
-        else
-            pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
-                Implementation::mpInstance);
-    }
-    else
-    {
-        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
-            Implementation::mpInstance);
-    }
-
-    DBG_ASSERT (pInstance.get()!=NULL,
-        "MasterPageContainer::Implementation::Instance(): instance is NULL");
-    return pInstance;
-}
-
-
-
-
-MasterPageContainer::MasterPageContainer (void)
-    : mpImpl(Implementation::Instance()),
-      mePreviewSize(SMALL)
-{
-    mpImpl->LateInit();
-}
-
-
-
-
-MasterPageContainer::~MasterPageContainer (void)
-{
-}
-
-
-
-
-void MasterPageContainer::AddChangeListener (const Link& rLink)
-{
-    mpImpl->AddChangeListener(rLink);
-}
-
-
-
-
-void MasterPageContainer::RemoveChangeListener (const Link& rLink)
-{
-    mpImpl->RemoveChangeListener(rLink);
-}
-
-
-
-
-void MasterPageContainer::SetPreviewSize (PreviewSize eSize)
-{
-    mePreviewSize = eSize;
-    mpImpl->FireContainerChange(
-        MasterPageContainerChangeEvent::SIZE_CHANGED,
-        NIL_TOKEN);
-}
-
-
-
-
-MasterPageContainer::PreviewSize MasterPageContainer::GetPreviewSize (void) const
-{
-    return mePreviewSize;
-}
-
-
-
-
-Size MasterPageContainer::GetPreviewSizePixel (void) const
-{
-    return mpImpl->GetPreviewSizePixel(mePreviewSize);
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::PutMasterPage (
-    const SharedMasterPageDescriptor& rDescriptor)
-{
-    return mpImpl->PutMasterPage(rDescriptor);
-}
-
-
-
-
-void MasterPageContainer::AcquireToken (Token aToken)
-{
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-    {
-        ++pDescriptor->mnUseCount;
-    }
-}
-
-
-
-
-void MasterPageContainer::ReleaseToken (Token aToken)
-{
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-    {
-        OSL_ASSERT(pDescriptor->mnUseCount>0);
-        --pDescriptor->mnUseCount;
-        if (pDescriptor->mnUseCount <= 0)
-        {
-            switch (pDescriptor->meOrigin)
-            {
-                case DEFAULT:
-                case TEMPLATE:
-                default:
-                    break;
-
-                case MASTERPAGE:
-                    mpImpl->ReleaseDescriptor(aToken);
-                    break;
-            }
-        }
-    }
-}
-
-
-
-
-int MasterPageContainer::GetTokenCount (void) const
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    return mpImpl->maContainer.size();
-}
-
-
-
-
-bool MasterPageContainer::HasToken (Token aToken) const
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    return mpImpl->HasToken(aToken);
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForIndex (int nIndex)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    Token aResult (NIL_TOKEN);
-    if (HasToken(nIndex))
-        aResult = mpImpl->maContainer[nIndex]->maToken;
-    return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForURL (
-    const String& sURL)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    Token aResult (NIL_TOKEN);
-    if (sURL.Len() > 0)
-    {
-        MasterPageContainerType::iterator iEntry (
-            ::std::find_if (
-                mpImpl->maContainer.begin(),
-                mpImpl->maContainer.end(),
-                MasterPageDescriptor::URLComparator(sURL)));
-        if (iEntry != mpImpl->maContainer.end())
-            aResult = (*iEntry)->maToken;
-    }
-    return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForStyleName (const String& sStyleName)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    Token aResult (NIL_TOKEN);
-    if (sStyleName.Len() > 0)
-    {
-        MasterPageContainerType::iterator iEntry (
-            ::std::find_if (
-                mpImpl->maContainer.begin(),
-                mpImpl->maContainer.end(),
-                MasterPageDescriptor::StyleNameComparator(sStyleName)));
-        if (iEntry != mpImpl->maContainer.end())
-            aResult = (*iEntry)->maToken;
-    }
-    return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForPageObject (
-    const SdPage* pPage)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    Token aResult (NIL_TOKEN);
-    if (pPage != NULL)
-    {
-        MasterPageContainerType::iterator iEntry (
-            ::std::find_if (
-                mpImpl->maContainer.begin(),
-                mpImpl->maContainer.end(),
-                MasterPageDescriptor::PageObjectComparator(pPage)));
-        if (iEntry != mpImpl->maContainer.end())
-            aResult = (*iEntry)->maToken;
-    }
-    return aResult;
-}
-
-
-
-
-String MasterPageContainer::GetURLForToken (
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return pDescriptor->msURL;
-    else
-        return String();
-}
-
-
-
-
-String MasterPageContainer::GetPageNameForToken (
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return pDescriptor->msPageName;
-    else
-        return String();
-}
-
-
-
-
-String MasterPageContainer::GetStyleNameForToken (
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return pDescriptor->msStyleName;
-    else
-        return String();
-}
-
-
-
-
-SdPage* MasterPageContainer::GetPageObjectForToken (
-    MasterPageContainer::Token aToken,
-    bool bLoad)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SdPage* pPageObject = NULL;
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-    {
-        pPageObject = pDescriptor->mpMasterPage;
-        if (pPageObject == NULL)
-        {
-            // The page object is not (yet) present.  Call
-            // UpdateDescriptor() to trigger the PageObjectProvider() to
-            // provide it.
-            if (bLoad)
-                mpImpl->GetModel();
-            if (mpImpl->UpdateDescriptor(pDescriptor,bLoad,false, true))
-                pPageObject = pDescriptor->mpMasterPage;
-        }
-    }
-    return pPageObject;
-}
-
-
-
-
-MasterPageContainer::Origin MasterPageContainer::GetOriginForToken (Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return pDescriptor->meOrigin;
-    else
-        return UNKNOWN;
-}
-
-
-
-
-sal_Int32 MasterPageContainer::GetTemplateIndexForToken (Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return pDescriptor->mnTemplateIndex;
-    else
-        return -1;
-}
-
-
-
-
-SharedMasterPageDescriptor MasterPageContainer::GetDescriptorForToken (
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
-    return mpImpl->GetDescriptor(aToken);
-}
-
-
-
-void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken)
-{
-    mpImpl->InvalidatePreview(aToken);
-}
-
-
-
-
-Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken)
-{
-    return mpImpl->GetPreviewForToken(aToken,mePreviewSize);
-}
-
-
-
-
-MasterPageContainer::PreviewState MasterPageContainer::GetPreviewState (Token aToken)
-{
-    return mpImpl->GetPreviewState(aToken);
-}
-
-
-
-
-bool MasterPageContainer::RequestPreview (Token aToken)
-{
-    return mpImpl->RequestPreview(aToken);
-}
-
-
-
-
-//==== Implementation ================================================
-
-MasterPageContainer::Implementation::Implementation (void)
-    : maMutex(),
-      maContainer(),
-	  meInitializationState(NOT_INITIALIZED),
-      mpRequestQueue(NULL),
-      mxModel(NULL),
-      mpDocument(NULL),
-      maPreviewRenderer(),
-      mbFirstPageObjectSeen(false),
-      maLargePreviewBeingCreated(),
-      maSmallPreviewBeingCreated(),
-      maLargePreviewNotAvailable(),
-      maSmallPreviewNotAvailable(),
-      maChangeListeners(),
-      maSmallPreviewSizePixel(),
-      maLargePreviewSizePixel(),
-      mbPageRatioKnown(false),
-      mbContainerCleaningPending(true)
-
-{
-    UpdatePreviewSizePixel();
-}
-
-
-
-
-MasterPageContainer::Implementation::~Implementation (void)
-{
-    // When the initializer or filler tasks are still running then we have
-    // to stop them now in order to prevent them from calling us back.
-    tools::TimerBasedTaskExecution::ReleaseTask(mpFillerTask);
-
-    mpRequestQueue.reset();
-
-    uno::Reference<util::XCloseable> xCloseable (mxModel, uno::UNO_QUERY);
-    if (xCloseable.is())
-    {
-        try
-        {
-            xCloseable->close(true);
-        }
-        catch (::com::sun::star::util::CloseVetoException aException)
-        {
-        }
-    }
-    mxModel = NULL;
-}
-
-
-
-
-void MasterPageContainer::Implementation::LateInit (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    if (meInitializationState == NOT_INITIALIZED)
-    {
-        meInitializationState = INITIALIZING;
-
-        OSL_ASSERT(Instance().get()==this);
-        mpRequestQueue.reset(MasterPageContainerQueue::Create(
-            ::boost::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance())));
-
-        mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create(
-            ::boost::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)),
-            5,
-            50);
-
-        meInitializationState = INITIALIZED;
-    }
-}
-
-
-
-
-void MasterPageContainer::Implementation::AddChangeListener (const Link& rLink)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    ::std::vector<Link>::iterator iListener (
-        ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
-    if (iListener == maChangeListeners.end())
-        maChangeListeners.push_back(rLink);
-
-}
-
-
-
-
-void MasterPageContainer::Implementation::RemoveChangeListener (const Link& rLink)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    ::std::vector<Link>::iterator iListener (
-        ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
-    if (iListener != maChangeListeners.end())
-        maChangeListeners.erase(iListener);
-}
-
-
-
-
-void MasterPageContainer::Implementation::UpdatePreviewSizePixel (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    // The default aspect ratio is 4:3
-    int nWidth (4);
-    int nHeight (3);
-    
-    // Search for the first entry with an existing master page.
-    MasterPageContainerType::const_iterator iDescriptor;
-    MasterPageContainerType::const_iterator iContainerEnd(maContainer.end());
-    for (iDescriptor=maContainer.begin(); iDescriptor!=iContainerEnd; ++iDescriptor)
-        if (*iDescriptor!=NULL && (*iDescriptor)->mpMasterPage != NULL)
-        {
-            Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize());
-            nWidth = aPageSize.Width();
-            nHeight = aPageSize.Height();
-            mbFirstPageObjectSeen = true;
-            break;
-        }
-
-    maSmallPreviewSizePixel.Width() = SMALL_PREVIEW_WIDTH;
-    maLargePreviewSizePixel.Width() = LARGE_PREVIEW_WIDTH;
-
-    int nNewSmallHeight ((maSmallPreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
-    int nNewLargeHeight ((maLargePreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
-
-    if (nNewSmallHeight!=maSmallPreviewSizePixel.Height()
-        || nNewLargeHeight!=maLargePreviewSizePixel.Height())
-    {
-        maSmallPreviewSizePixel.Height() = nNewSmallHeight;
-        maLargePreviewSizePixel.Height() = nNewLargeHeight;
-        FireContainerChange(
-            MasterPageContainerChangeEvent::SIZE_CHANGED,
-            NIL_TOKEN);
-    }
-}
-
-
-
-
-Size MasterPageContainer::Implementation::GetPreviewSizePixel (PreviewSize eSize) const
-{
-    if (eSize == SMALL)
-        return maSmallPreviewSizePixel;
-    else
-        return maLargePreviewSizePixel;
-}
-
-
-
-
-IMPL_LINK(MasterPageContainer::Implementation,AsynchronousNotifyCallback, EventData*, pData)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    if (pData != NULL)
-    {
-        FireContainerChange(pData->first, pData->second, false);
-        delete pData;
-    }
-
-    return 0;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage (
-    const SharedMasterPageDescriptor& rpDescriptor)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    Token aResult (NIL_TOKEN);
-
-    // Get page object and preview when that is inexpensive.
-    UpdateDescriptor(rpDescriptor,false,false, false);
-
-    // Look up the new MasterPageDescriptor and either insert it or update
-    // an already existing one.
-    MasterPageContainerType::iterator aEntry (
-        ::std::find_if (
-            maContainer.begin(),
-            maContainer.end(),
-            MasterPageDescriptor::AllComparator(rpDescriptor)));
-    if (aEntry == maContainer.end())
-    {
-        // Insert a new MasterPageDescriptor.
-        bool bIgnore (rpDescriptor->mpPageObjectProvider.get()==NULL
-            && rpDescriptor->msURL.getLength()==0);
-
-        if ( ! bIgnore)
-        {
-            if (mbContainerCleaningPending)
-                CleanContainer();
-            
-            aResult = maContainer.size();
-            rpDescriptor->SetToken(aResult);
-
-            // Templates are precious, i.e. we lock them so that they will
-            // not be destroyed when (temporarily) no one references them.
-            // They will only be deleted when the container is destroyed.
-            switch (rpDescriptor->meOrigin)
-            {
-                case TEMPLATE:
-                case DEFAULT:
-                    ++rpDescriptor->mnUseCount;
-                    break;
-
-                default:
-                    break;
-            }
-            
-            maContainer.push_back(rpDescriptor);
-            aEntry = maContainer.end()-1;
-            
-            FireContainerChange(MasterPageContainerChangeEvent::CHILD_ADDED,aResult);
-        }
-    }
-    else
-    {
-        // Update an existing MasterPageDescriptor.
-        aResult = (*aEntry)->maToken;
-        ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pEventTypes(
-            (*aEntry)->Update(*rpDescriptor));
-        if (pEventTypes.get()!=NULL && pEventTypes->size()>0)
-        {
-            // One or more aspects of the descriptor have changed.  Send
-            // appropriate events to the listeners.
-            UpdateDescriptor(*aEntry,false,false, true);
-            
-            std::vector<MasterPageContainerChangeEvent::EventType>::const_iterator iEventType;
-            for (iEventType=pEventTypes->begin(); iEventType!=pEventTypes->end(); ++iEventType)
-            {
-                FireContainerChange(
-                    *iEventType,
-                    (*aEntry)->maToken,
-                    false);
-            }
-        }
-    }
-
-    return aResult;
-}
-
-
-
-
-bool MasterPageContainer::Implementation::HasToken (Token aToken) const
-{
-    return aToken>=0
-        && (unsigned)aToken<maContainer.size()
-        && maContainer[aToken].get()!=NULL;
-}
-
-
-
-
-const SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (
-    Token aToken) const
-{
-    if (aToken>=0 && (unsigned)aToken<maContainer.size())
-        return maContainer[aToken];
-    else
-        return SharedMasterPageDescriptor();
-}
-
-
-
-
-SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (Token aToken)
-{
-    if (aToken>=0 && (unsigned)aToken<maContainer.size())
-        return maContainer[aToken];
-    else
-        return SharedMasterPageDescriptor();
-}
-
-
-
-
-void MasterPageContainer::Implementation::InvalidatePreview (Token aToken)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    SharedMasterPageDescriptor pDescriptor (GetDescriptor(aToken));
-    if (pDescriptor.get() != NULL)
-    {
-        pDescriptor->maSmallPreview = Image();
-        pDescriptor->maLargePreview = Image();
-        RequestPreview(aToken);
-    }
-}
-
-
-
-
-Image MasterPageContainer::Implementation::GetPreviewForToken (
-    MasterPageContainer::Token aToken,
-    PreviewSize ePreviewSize)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    Image aPreview;
-    PreviewState ePreviewState (GetPreviewState(aToken));
-
-    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
-    
-    // When the preview is missing but inexpensively creatable then do that
-    // now.
-    if (pDescriptor.get()!=NULL)
-    {
-        if (ePreviewState == PS_CREATABLE)
-            if (UpdateDescriptor(pDescriptor, false,false, true))
-                if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
-                    ePreviewState = PS_AVAILABLE;
-
-        switch (ePreviewState)
-        {
-            case PS_AVAILABLE:
-                aPreview = pDescriptor->GetPreview(ePreviewSize);
-                break;
-
-            case PS_PREPARING:
-                aPreview = GetPreviewSubstitution(
-                    STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
-                    ePreviewSize);
-                break;
-
-            case PS_CREATABLE:
-                aPreview = GetPreviewSubstitution(
-                    STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
-                    ePreviewSize);
-                break;
-
-            case PS_NOT_AVAILABLE:
-                aPreview = GetPreviewSubstitution(
-                    STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION,
-                    ePreviewSize);
-                if (ePreviewSize == SMALL)
-                    pDescriptor->maSmallPreview = aPreview;
-                else
-                    pDescriptor->maLargePreview = aPreview;
-                break;
-        }
-    }
-    
-    return aPreview;
-}
-
-
-
-
-MasterPageContainer::PreviewState MasterPageContainer::Implementation::GetPreviewState (
-    Token aToken) const
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    PreviewState eState (PS_NOT_AVAILABLE);
-
-    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-    {
-        if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
-            eState = PS_AVAILABLE;
-        else if (pDescriptor->mpPreviewProvider.get() != NULL)
-        {
-            // The preview does not exist but can be created.  When that is
-            // not expensive then do it at once.
-            if (mpRequestQueue->HasRequest(aToken))
-                eState = PS_PREPARING;
-            else
-                eState = PS_CREATABLE;
-        }
-        else
-            eState = PS_NOT_AVAILABLE;
-    }
-
-    return eState;
-}
-
-
-
-
-bool MasterPageContainer::Implementation::RequestPreview (Token aToken)
-{
-    SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
-    if (pDescriptor.get() != NULL)
-        return mpRequestQueue->RequestPreview(pDescriptor);
-    else
-        return false;
-}
-
-
-
-
-Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    if ( ! mxModel.is())
-    {
-        // Get the desktop a s service factory.
-        ::rtl::OUString sDesktopServiceName (
-            RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"));
-        uno::Reference<frame::XComponentLoader> xDesktop (
-            ::comphelper::getProcessServiceFactory()->createInstance(
-                sDesktopServiceName), 
-            uno::UNO_QUERY);
-
-        // Create a new model.
-        ::rtl::OUString sModelServiceName (
-            RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.presentation.PresentationDocument"));
-        mxModel = uno::Reference<frame::XModel>(
-            ::comphelper::getProcessServiceFactory()->createInstance(
-                sModelServiceName),
-            uno::UNO_QUERY);
-
-        // Initialize the model.
-        uno::Reference<frame::XLoadable> xLoadable (mxModel,uno::UNO_QUERY);
-        if (xLoadable.is())
-            xLoadable->initNew();
-
-        // Use its tunnel to get a pointer to its core implementation.
-        uno::Reference<lang::XUnoTunnel> xUnoTunnel (mxModel, uno::UNO_QUERY);
-        if (xUnoTunnel.is())
-        {
-            mpDocument = reinterpret_cast<SdXImpressDocument*>(
-                xUnoTunnel->getSomething(
-                    SdXImpressDocument::getUnoTunnelId()))->GetDoc();
-        }
-
-        // Create a default page.
-        uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, uno::UNO_QUERY);
-        if (xSlideSupplier.is())
-        {
-            uno::Reference<drawing::XDrawPages> xSlides (
-                xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
-            if (xSlides.is())
-            {
-                sal_Int32 nIndex (0);
-                uno::Reference<drawing::XDrawPage> xNewPage (xSlides->insertNewByIndex(nIndex));
-                uno::Reference<beans::XPropertySet> xProperties(xNewPage, uno::UNO_QUERY);
-                if (xProperties.is())
-                    xProperties->setPropertyValue(
-                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")),
-                        makeAny((sal_Int16)AUTOLAYOUT_TITLE));
-            }
-        }
-    }
-    return mxModel;
-}
-
-
-
-
-SdDrawDocument* MasterPageContainer::Implementation::GetDocument (void)
-{
-    GetModel();
-    return mpDocument;
-}
-
-
-
-
-Image MasterPageContainer::Implementation::GetPreviewSubstitution (
-    sal_uInt16 nId,
-    PreviewSize ePreviewSize)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    Image aPreview;
-    
-    switch (nId)
-    {
-        case STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION:
-        {
-            Image& rPreview (ePreviewSize==SMALL
-                ? maSmallPreviewBeingCreated
-                : maLargePreviewBeingCreated);
-            if (rPreview.GetSizePixel().Width() == 0)
-            {
-                rPreview = maPreviewRenderer.RenderSubstitution(
-                    ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
-                    SdResId(STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION));
-            }
-            aPreview = rPreview;
-        }
-        break;
-
-        case STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION:
-        {
-            Image& rPreview (ePreviewSize==SMALL
-                ? maSmallPreviewNotAvailable
-                : maLargePreviewNotAvailable);
-            if (rPreview.GetSizePixel().Width() == 0)
-            {
-                rPreview = maPreviewRenderer.RenderSubstitution(
-                    ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
-                    SdResId(STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION));
-            }
-            aPreview = rPreview;
-        }
-        break;
-    }
-
-    return aPreview;
-}
-
-
-
-
-void MasterPageContainer::Implementation::CleanContainer (void)
-{
-    // Remove the empty elements at the end of the container.  The empty
-    // elements in the middle can not be removed because that would
-    // invalidate the references still held by others.
-    int nIndex (maContainer.size()-1);
-    while (nIndex>=0 && maContainer[nIndex].get()==NULL)
-        --nIndex;
-    maContainer.resize(++nIndex);
-}
-
-
-
-
-void MasterPageContainer::Implementation::FireContainerChange (
-    MasterPageContainerChangeEvent::EventType eType,
-    Token aToken,
-    bool bNotifyAsynchronously)
-{
-    if (bNotifyAsynchronously)
-    {
-        Application::PostUserEvent(
-            LINK(this,Implementation,AsynchronousNotifyCallback),
-            new EventData(eType,aToken));
-    }
-    else
-    {
-        ::std::vector<Link> aCopy(maChangeListeners.begin(),maChangeListeners.end());
-        ::std::vector<Link>::iterator iListener;
-        MasterPageContainerChangeEvent aEvent;
-        aEvent.meEventType = eType;
-        aEvent.maChildToken = aToken;
-        for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener)
-            iListener->Call(&aEvent);
-    }
-}
-
-
-
-
-bool MasterPageContainer::Implementation::UpdateDescriptor (
-    const SharedMasterPageDescriptor& rpDescriptor,
-    bool bForcePageObject,
-    bool bForcePreview,
-    bool bSendEvents)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    // We have to create the page object when the preview provider needs it
-    // and the caller needs the preview.
-    bForcePageObject |= (bForcePreview
-        && rpDescriptor->mpPreviewProvider->NeedsPageObject()
-        && rpDescriptor->mpMasterPage==NULL);
-
-    // Define a cost threshold so that an update or page object or preview
-    // that is at least this cost are made at once. Updates with higher cost
-    // are scheduled for later.
-    sal_Int32 nCostThreshold (mpRequestQueue->IsEmpty() ? 5 : 0);
-
-    // Update the page object (which may be used for the preview update).
-    if (bForcePageObject)
-        GetDocument();
-    bool bPageObjectModified (rpDescriptor->UpdatePageObject(
-        (bForcePageObject ? -1 : nCostThreshold),
-        mpDocument));
-    if (bPageObjectModified && bSendEvents)
-        FireContainerChange(
-            MasterPageContainerChangeEvent::DATA_CHANGED,
-            rpDescriptor->maToken);
-    if (bPageObjectModified && ! mbFirstPageObjectSeen)
-        UpdatePreviewSizePixel();
-
-    // Update the preview.
-    bool bPreviewModified (rpDescriptor->UpdatePreview(
-        (bForcePreview ? -1 : nCostThreshold),
-        maSmallPreviewSizePixel,
-        maLargePreviewSizePixel,
-        maPreviewRenderer));
-
-    if (bPreviewModified && bSendEvents)
-        FireContainerChange(
-            MasterPageContainerChangeEvent::PREVIEW_CHANGED,
-            rpDescriptor->maToken);
-
-    return bPageObjectModified || bPreviewModified;
-}
-
-
-
-
-void MasterPageContainer::Implementation::ReleaseDescriptor (Token aToken)
-{
-    if (aToken>=0 && (unsigned)aToken<maContainer.size())
-    {
-        maContainer[aToken].reset();
-        mbContainerCleaningPending = true;
-    }
-}
-
-
-
-
-void MasterPageContainer::Implementation::FillingDone (void)
-{
-    mpRequestQueue->ProcessAllRequests();
-}
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
deleted file mode 100644
index e5757e2..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
+++ /dev/null
@@ -1,216 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
-
-#include "MasterPageContainerProviders.hxx"
-
-#include <osl/mutex.hxx>
-#include <tools/string.hxx>
-#include <vcl/image.hxx>
-#include <memory>
-#include "PreviewRenderer.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-#include <vcl/timer.hxx>
-#include "tools/SdGlobalResourceContainer.hxx"
-
-#include <boost/shared_ptr.hpp>
-
-class SdPage;
-class SdDrawDocument;
-class SfxObjectShellLock;
-
-namespace sd {
-class DrawDocShell;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class MasterPageDescriptor;
-
-/** This container manages the master pages used by the MasterPagesSelector
-    controls.  It uses internally a singleton implementation object.
-    Therefore, all MasterPageContainer object operator on the same set of
-    master pages.  Each MasterPageContainer, however, has its own
-    PreviewSize value and thus can independantly switch between large and
-    small previews.
-    
-    The container maintains its own document to store master page objects.
-    
-    For each master page container stores its URL, preview bitmap, page
-    name, and, if available, the page object.
-    
-    Entries are accessed via a Token, which is mostly a numerical index but
-    whose values do not neccessarily have to be consecutive.
-*/
-class MasterPageContainer
-{
-public:
-    typedef int Token;
-    static const Token NIL_TOKEN = -1;
-
-    MasterPageContainer (void);
-    virtual ~MasterPageContainer (void);
-
-    void AddChangeListener (const Link& rLink);
-    void RemoveChangeListener (const Link& rLink);
-
-    enum PreviewSize { SMALL, LARGE };
-    /** There are two different preview sizes, a small one and a large one.
-        Which one is used by the called container can be changed with this
-        method.
-        When the preview size is changed then all change listeners are
-        notified of this.
-    */
-    void SetPreviewSize (PreviewSize eSize);
-
-    /** Returns the preview size.
-    */
-    PreviewSize GetPreviewSize (void) const;
-
-    /** Return the preview size in pixels.
-    */
-    Size GetPreviewSizePixel (void) const;
-
-    enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE };
-    PreviewState GetPreviewState (Token aToken);
-
-    /** This method is typically called for entries in the container for
-        which GetPreviewState() returns OS_CREATABLE.  The creation of the
-        preview is then scheduled to be executed asynchronously at a later
-        point in time.  When the preview is available the change listeners
-        will be notified.
-    */
-    bool RequestPreview (Token aToken);
-
-    /** Each entry of the container is either the first page of a template
-        document or is a master page of an Impress document. 
-    */
-    enum Origin {
-        MASTERPAGE,  // Master page of a document.
-        TEMPLATE,    // First page of a template file.
-        DEFAULT,     // Empty master page with default style.
-        UNKNOWN
-    };
-
-    /** Put the master page identified and described by the given parameters
-        into the container.  When there already is a master page with the
-        given URL, page name, or object pointer (when that is not NULL) then
-        the existing entry is replaced/updated by the given one.  Otherwise
-        a new entry is inserted.
-    */
-    Token PutMasterPage (const ::boost::shared_ptr<MasterPageDescriptor>& rDescriptor);
-    void AcquireToken (Token aToken);
-    void ReleaseToken (Token aToken);
-
-    /** This and the GetTokenForIndex() methods can be used to iterate over
-        all members of the container.
-    */
-    int GetTokenCount (void) const;
-
-    /** Determine whether the container has a member for the given token.
-    */
-    bool HasToken (Token aToken) const;
-    
-    /** Return a token for an index in the range 
-        0 <= index < GetTokenCount().
-    */
-    Token GetTokenForIndex (int nIndex);
-
-    Token GetTokenForURL (const String& sURL);
-    Token GetTokenForStyleName (const String& sStyleName);
-    Token GetTokenForPageObject (const SdPage* pPage);
-
-    String GetURLForToken (Token aToken);
-    String GetPageNameForToken (Token aToken);
-    String GetStyleNameForToken (Token aToken);
-    SdPage* GetPageObjectForToken (Token aToken, bool bLoad=true);
-    Origin GetOriginForToken (Token aToken);
-    sal_Int32 GetTemplateIndexForToken (Token aToken);
-    ::boost::shared_ptr<MasterPageDescriptor> GetDescriptorForToken (Token aToken);
-    
-    void InvalidatePreview (Token aToken);
-
-    /** Return a preview for the specified token.  When the preview is not
-        present then the PreviewProvider associated with the token is
-        executed only when that is not expensive.  It is the responsibility
-        of the caller to call RequestPreview() to do the same
-        (asynchronously) for expensive PreviewProviders.
-        Call GetPreviewState() to find out if that is necessary.
-        @param aToken
-            This token specifies for which master page to return the prview.
-            Tokens are returned for example by the GetTokenFor...() methods.
-        @return
-            The returned image is the requested preview or a substitution.
-    */
-    Image GetPreviewForToken (Token aToken);
-
-private:
-    class Implementation;
-    ::boost::shared_ptr<Implementation> mpImpl;
-    PreviewSize mePreviewSize;
-
-    /** Retrieve the preview of the document specified by the given URL.
-    */
-    static BitmapEx LoadPreviewFromURL (const ::rtl::OUString& aURL);
-};
-
-
-
-
-/** For some changes to the set of master pages in a MasterPageContainer or
-    to the data stored for each master page one or more events are sent to
-    registered listeners.
-    Each event has an event type and a token that tells the listener where
-    the change took place.
-*/
-class MasterPageContainerChangeEvent
-{
-public:
-    enum EventType {
-        // A master page was added to the container.
-        CHILD_ADDED,
-        // A master page was removed from the container.
-        CHILD_REMOVED,
-        // The preview of a master page has changed.
-        PREVIEW_CHANGED,
-        // The size of a preview has changed.
-        SIZE_CHANGED,
-        // Some of the data stored for a master page has changed.
-        DATA_CHANGED,
-        // The TemplateIndex of a master page has changed.
-        INDEX_CHANGED,
-        // More than one entries changed their TemplateIndex
-        INDEXES_CHANGED
-    } meEventType;
-
-    // Token of the container entry whose data changed or which was added or
-    // removed.
-    MasterPageContainer::Token maChildToken;
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
deleted file mode 100644
index dbb2910..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageContainerFiller.hxx"
-
-#include "MasterPageDescriptor.hxx"
-#include "MasterPageContainerProviders.hxx"
-#include "TemplateScanner.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter)
-    : mrContainerAdapter(rpAdapter),
-      meState(INITIALIZE_TEMPLATE_SCANNER),
-      mpScannerTask(),
-      mpLastAddedEntry(NULL),
-      mnIndex(1)
-{
-    // Add one entry for the default master page.  We use temporarily the
-    // DefaultPagePreviewProvider to prevent the rendering (and the
-    // expensive creation) of the default page.  It is replaced later on by
-    // another.
-    SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
-        MasterPageContainer::DEFAULT,
-        0,
-        String(),
-        String(),
-        String(),
-        false,
-        ::boost::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()),
-        ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
-    mrContainerAdapter.PutMasterPage(pDescriptor);
-}
-
-
-
-
-MasterPageContainerFiller::~MasterPageContainerFiller (void)
-{
-}
-
-
-
-
-void MasterPageContainerFiller::RunNextStep (void)
-{
-    switch (meState)
-    {
-        case INITIALIZE_TEMPLATE_SCANNER:
-            mpScannerTask.reset(new TemplateScanner());
-            meState = SCAN_TEMPLATE;
-            break;
-
-        case SCAN_TEMPLATE:
-            meState = ScanTemplate();
-            break;
-            
-        case ADD_TEMPLATE:
-            meState = AddTemplate();
-            break;
-            
-        case DONE:
-        case ERROR:
-        default:
-            break;
-    }
-
-    // When the state has just been set to DONE or ERROR then tell the
-    // container that no more templates will be coming and stop the
-    // scanning.
-    switch (meState)
-    {
-        case DONE:
-        case ERROR:
-            if (mpScannerTask.get() != NULL)
-            {
-                mrContainerAdapter.FillingDone();
-                mpScannerTask.reset();
-            }
-		default:
-			break;
-    }
-}
-
-
-
-
-bool MasterPageContainerFiller::HasNextStep (void)
-{
-    switch (meState)
-    {
-        case DONE:
-        case ERROR:
-            return false;
-            
-        default:
-            return true;
-    }
-}
-
-
-
-
-MasterPageContainerFiller::State MasterPageContainerFiller::ScanTemplate (void)
-{
-    State eState (ERROR);
-
-    if (mpScannerTask.get() != NULL)
-    {
-        if (mpScannerTask->HasNextStep())
-        {
-            mpScannerTask->RunNextStep();
-            if (mpScannerTask->GetLastAddedEntry() != mpLastAddedEntry)
-            {
-                mpLastAddedEntry = mpScannerTask->GetLastAddedEntry();
-                if (mpLastAddedEntry != NULL)
-                    eState = ADD_TEMPLATE;
-                else
-                    eState = SCAN_TEMPLATE;
-            }
-            else
-                eState = SCAN_TEMPLATE;
-        }
-        else
-            eState = DONE;
-    }
-
-    return eState;
-}
-
-
-
-
-MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void)
-{
-    if (mpLastAddedEntry != NULL)
-    {
-        SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
-            MasterPageContainer::TEMPLATE,
-            mnIndex,
-            mpLastAddedEntry->msPath,
-            mpLastAddedEntry->msTitle,
-            String(),
-            false,
-            ::boost::shared_ptr<PageObjectProvider>(
-                new TemplatePageObjectProvider(mpLastAddedEntry->msPath)),
-            ::boost::shared_ptr<PreviewProvider>(
-                new TemplatePreviewProvider(mpLastAddedEntry->msPath))));
-        // For user supplied templates we use a different preview provider:
-        // The preview in the document shows not only shapes on the master
-        // page but also shapes on the foreground.  This is misleading and
-        // therefore these previews are discarded and created directly from
-        // the page objects.
-        if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
-            pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
-                new PagePreviewProvider());
-
-        mrContainerAdapter.PutMasterPage(pDescriptor);
-        ++mnIndex;
-    }
-
-    return SCAN_TEMPLATE;
-}
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
deleted file mode 100644
index f2a0d4b..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
-
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "tools/AsynchronousTask.hxx"
-
-namespace sd {
-class TemplateScanner;
-class TemplateEntry;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** Fill a MasterPageContainer with information about the available master
-    pages.  These are provided by one default page and from the existing
-    Impress templates.  This is done asynchronously.
-*/
-class MasterPageContainerFiller
-    : public ::sd::tools::AsynchronousTask
-{
-public:
-    class ContainerAdapter
-    {
-    public:
-        virtual MasterPageContainer::Token PutMasterPage (
-            const SharedMasterPageDescriptor& rpDescriptor) = 0;
-        /** This method is called when all Impress templates have been added
-            to the container via the PutMasterPage() method.
-        */
-        virtual void FillingDone (void) = 0;
-    };
-    
-    MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
-    virtual ~MasterPageContainerFiller (void);
-    
-    /** Run the next step of the task.  After HasNextStep() returns false
-        this method should ignore further calls.
-    */
-    virtual void RunNextStep (void);
-
-    /** Return <TRUE/> when there is at least one more step to execute.
-        When the task has been executed completely then <FALSE/> is
-        returned.
-    */
-    virtual bool HasNextStep (void);
-
-private:
-    ContainerAdapter& mrContainerAdapter;
-    // Remember what the next step has to do.
-    enum State {
-        INITIALIZE_TEMPLATE_SCANNER,
-        SCAN_TEMPLATE,
-        ADD_TEMPLATE,
-        ERROR,
-        DONE
-    } meState;
-    ::std::auto_ptr<TemplateScanner> mpScannerTask;
-    const TemplateEntry* mpLastAddedEntry;
-    int mnIndex;
-    
-    State ScanTemplate (void);
-    State AddTemplate (void);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
deleted file mode 100644
index b850994..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
+++ /dev/null
@@ -1,425 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageContainerProviders.hxx"
-
-#include "DrawDocShell.hxx"
-#include "drawdoc.hxx"
-#include "PreviewRenderer.hxx"
-#include <comphelper/processfactory.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/sfxsids.hrc>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/image.hxx>
-#include <vcl/pngread.hxx>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-//===== PagePreviewProvider ===================================================
-
-PagePreviewProvider::PagePreviewProvider (void)
-{
-}
-
-
-
-
-Image PagePreviewProvider::operator () (
-    int nWidth,
-    SdPage* pPage,
-    ::sd::PreviewRenderer& rRenderer)
-{
-    Image aPreview;
-    
-    if (pPage != NULL)
-    {
-        // Use the given renderer to create a preview of the given page
-        // object.
-        aPreview = rRenderer.RenderPage(
-            pPage,
-            nWidth,
-            String::CreateFromAscii(""),
-            false);
-    }
-
-    return aPreview;
-}
-
-
-
-
-int PagePreviewProvider::GetCostIndex (void)
-{
-    return 5;
-}
-
-
-
-
-bool PagePreviewProvider::NeedsPageObject (void)
-{
-    return true;
-}
-
-
-
-
-//===== TemplatePreviewProvider ===============================================
-
-TemplatePreviewProvider::TemplatePreviewProvider (const ::rtl::OUString& rsURL)
-    : msURL(rsURL)
-{
-}
-
-
-
-
-Image TemplatePreviewProvider::operator() (
-    int nWidth,
-    SdPage* pPage,
-    ::sd::PreviewRenderer& rRenderer)
-{
-    // Unused parameters.
-    (void)nWidth;
-    (void)pPage; 
-    (void)rRenderer;
-    
-    // Load the thumbnail from a template document.
-	uno::Reference<io::XInputStream> xIStream;
-
-    uno::Reference< lang::XMultiServiceFactory > xServiceManager (
-        ::comphelper::getProcessServiceFactory());
-	if (xServiceManager.is())
-	{
-		try
-        {
-			uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
-				xServiceManager->createInstance( 
-                    ::rtl::OUString::createFromAscii(
-                        "com.sun.star.embed.StorageFactory")),
-				uno::UNO_QUERY);
-		
-			if (xStorageFactory.is())
-			{
-				uno::Sequence<uno::Any> aArgs (2);
-				aArgs[0] <<= msURL;
-				aArgs[1] <<= embed::ElementModes::READ;
-				uno::Reference<embed::XStorage> xDocStorage (
-                    xStorageFactory->createInstanceWithArguments(aArgs),
-                    uno::UNO_QUERY);
-
-                try
-                {
-                    if (xDocStorage.is())
-                    {
-                        uno::Reference<embed::XStorage> xStorage (
-                            xDocStorage->openStorageElement(
-                                ::rtl::OUString::createFromAscii("Thumbnails"),
-                                embed::ElementModes::READ));
-                        if (xStorage.is())
-                        {
-                            uno::Reference<io::XStream> xThumbnailCopy (
-                                xStorage->cloneStreamElement(
-                                    ::rtl::OUString::createFromAscii(
-                                        "thumbnail.png")));
-                            if (xThumbnailCopy.is())
-                                xIStream = xThumbnailCopy->getInputStream();
-                        }
-                    }
-                }
-                catch (uno::Exception& rException)
-                {
-                    OSL_TRACE (
-                        "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
-                        ::rtl::OUStringToOString(msURL,
-                            RTL_TEXTENCODING_UTF8).getStr(),
-                        ::rtl::OUStringToOString(rException.Message,
-                            RTL_TEXTENCODING_UTF8).getStr());
-                }
-
-                try
-                {
-                    // An (older) implementation had a bug - The storage
-                    // name was "Thumbnail" instead of "Thumbnails".  The
-                    // old name is still used as fallback but this code can
-                    // be removed soon.
-                    if ( ! xIStream.is())
-                    {
-                        uno::Reference<embed::XStorage> xStorage (
-                            xDocStorage->openStorageElement(
-                                ::rtl::OUString::createFromAscii("Thumbnail"),
-                                embed::ElementModes::READ));
-                        if (xStorage.is())
-                        {
-                            uno::Reference<io::XStream> xThumbnailCopy (
-                                xStorage->cloneStreamElement(
-                                    ::rtl::OUString::createFromAscii(
-                                        "thumbnail.png")));
-                            if (xThumbnailCopy.is())
-                                xIStream = xThumbnailCopy->getInputStream();
-                        }
-					}
-                }
-                catch (uno::Exception& rException)
-                {
-                    OSL_TRACE (
-                        "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
-                        ::rtl::OUStringToOString(msURL,
-                            RTL_TEXTENCODING_UTF8).getStr(),
-                        ::rtl::OUStringToOString(rException.Message,
-                            RTL_TEXTENCODING_UTF8).getStr());
-                }
-			}
-		}
-		catch (uno::Exception& rException)
-		{
-            OSL_TRACE (
-                "caught exception while trying to access tuhmbnail of %s: %s",
-                ::rtl::OUStringToOString(msURL,
-                    RTL_TEXTENCODING_UTF8).getStr(),
-                ::rtl::OUStringToOString(rException.Message,
-                    RTL_TEXTENCODING_UTF8).getStr());
-        }
-	}
-
-    // Extract the image from the stream.
-    BitmapEx aThumbnail;
-	if (xIStream.is())
-    {
-        ::std::auto_ptr<SvStream> pStream (
-            ::utl::UcbStreamHelper::CreateStream (xIStream));
-        ::vcl::PNGReader aReader (*pStream);
-        aThumbnail = aReader.Read ();
-    }
-
-    // Note that the preview is returned without scaling it to the desired
-    // width.  This gives the caller the chance to take advantage of a
-    // possibly larger resolution then was asked for.
-    return aThumbnail;
-}
-
-
-
-
-int TemplatePreviewProvider::GetCostIndex (void)
-{
-    return 10;
-}
-
-
-
-
-bool TemplatePreviewProvider::NeedsPageObject (void)
-{
-    return false;
-}
-
-
-
-
-//===== TemplatePageObjectProvider =============================================
-
-TemplatePageObjectProvider::TemplatePageObjectProvider (const ::rtl::OUString& rsURL)
-    : msURL(rsURL),
-      mxDocumentShell()
-{
-}
-
-
-
-
-SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument)
-{
-    // Unused parameters.
-    (void)pContainerDocument;
-    
-    SdPage* pPage = NULL;
-    
-    mxDocumentShell = NULL;
-    ::sd::DrawDocShell* pDocumentShell = NULL;
-    try
-    {
-        // Load the template document and return its first page.
-        pDocumentShell = LoadDocument (msURL);
-        if (pDocumentShell != NULL)
-        {
-            SdDrawDocument* pDocument = pDocumentShell->GetDoc();
-            if (pDocument != NULL)
-            {
-                pPage = pDocument->GetMasterSdPage(0, PK_STANDARD);
-                // In order to make the newly loaded master page deletable
-                // when copied into documents it is marked as no "precious".
-                // When it is modified then it is marked as "precious".
-                if (pPage != NULL)
-                    pPage->SetPrecious(false);
-            }
-        }
-    }
-    catch (uno::RuntimeException)
-    {
-        DBG_UNHANDLED_EXCEPTION();
-        pPage = NULL;
-    }
-
-    return pPage;
-}
-
-
-
-
-::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const ::rtl::OUString& sFileName)
-{
-	SfxApplication* pSfxApp = SFX_APP();
-    SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool());
-    pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True));
-    pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True));
-    if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet))
-    {
-        mxDocumentShell = NULL;
-    }
-    SfxObjectShell* pShell = mxDocumentShell;
-    return PTR_CAST(::sd::DrawDocShell,pShell);
-}
-
-
-
-
-int TemplatePageObjectProvider::GetCostIndex (void)
-{
-    return 20;
-}
-
-
-
-
-bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider)
-{
-    const TemplatePageObjectProvider* pTemplatePageObjectProvider
-        = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider);
-    if (pTemplatePageObjectProvider != NULL)
-        return (msURL == pTemplatePageObjectProvider->msURL);
-    else
-        return false;
-}
-
-
-
-
-//===== DefaultPageObjectProvider ==============================================
-
-DefaultPageObjectProvider::DefaultPageObjectProvider (void)
-{
-}
-
-
-
-
-SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument)
-{
-    SdPage* pLocalMasterPage = NULL;
-    if (pContainerDocument != NULL)
-    {
-        sal_Int32 nIndex (0);
-        SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD);
-        if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage())
-            pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage());
-    }
-
-    if (pLocalMasterPage == NULL)
-    {
-        DBG_ASSERT(false, "can not create master page for slide");
-    }
-
-    return pLocalMasterPage;
-}
-
-
-
-
-int DefaultPageObjectProvider::GetCostIndex (void)
-{
-    return 15;
-}
-
-
-
-
-bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider)
-{
-    return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL);
-}
-
-
-
-
-//===== ExistingPageProvider ==================================================
-
-ExistingPageProvider::ExistingPageProvider (SdPage* pPage)
-    : mpPage(pPage)
-{
-}
-
-
-
-
-SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument)
-{
-    (void)pDocument; // Unused parameter.
-    
-    return mpPage;
-}
-
-
-
-
-int ExistingPageProvider::GetCostIndex (void)
-{
-    return 0;
-}
-
-
-
-
-bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider)
-{
-    const ExistingPageProvider* pExistingPageProvider
-        = dynamic_cast<const ExistingPageProvider*>(&rProvider);
-    if (pExistingPageProvider != NULL)
-        return (mpPage == pExistingPageProvider->mpPage);
-    else
-        return false;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
deleted file mode 100644
index c3d9389..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
-
-#include <rtl/ustring.hxx>
-#include <sfx2/objsh.hxx>
-
-class Image;
-class SdDrawDocument;
-class SdPage;
-namespace sd { class PreviewRenderer; }
-namespace sd { class DrawDocShell; }
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Interface for a provider of page objects.  It is used by the
-    MasterPageDescriptor to create master page objects on demand.
-*/
-class PageObjectProvider
-{
-public:
-    /** Return a master page either by returning an already existing one, by
-        creating a new page, or by loading a document.
-        @param pDocument
-            The document of the MasterPageContainer.  It may be used to
-            create new pages.
-    */
-    virtual SdPage* operator() (SdDrawDocument* pDocument) = 0;
-
-    /** An abstract value for the expected cost of providing a master page
-        object.
-        @return
-            A value of 0 represents for the lowest cost, i.e. an almost
-            immediate return.  Positive values stand for higher costs.
-            Negative values are not supported.
-    */
-    virtual int GetCostIndex (void) = 0;
-
-    virtual bool operator== (const PageObjectProvider& rProvider) = 0;
-};
-
-
-
-
-class PreviewProvider
-{
-public:
-    /** Create a preview image in the specified width.
-        @param nWidth
-            Requested width of the preview.  The calling method can cope
-            with other sizes as well but the resulting image quality is
-            better when the returned image has the requested size.
-        @param pPage
-            Page object for which a preview is requested.  This may be NULL
-            when the page object is expensive to get and the PreviewProvider
-            does not need this object (NeedsPageObject() returns false.)
-        @param rRenderer
-            This PreviewRenderer may be used by the PreviewProvider to
-            create a preview image.
-    */
-    virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer) = 0;
-
-    /** Return a value that indicates how expensive the creation of a
-        preview image is.  The higher the returned value the more expensive
-        is the preview creation.  Return 0 when the preview is already
-        present and can be returned immediately.
-    */
-    virtual int GetCostIndex (void) = 0;
-
-    /** Return whether the page object passed is necessary to create a
-        preview.
-    */
-    virtual bool NeedsPageObject (void) = 0;
-};
-
-
-
-
-/** Provide previews of existing page objects by rendering them.
-*/
-class PagePreviewProvider : public PreviewProvider
-{
-public:
-    PagePreviewProvider (void);
-    virtual Image operator () (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
-    virtual int GetCostIndex (void);
-    virtual bool NeedsPageObject (void);
-private:
-};
-
-
-
-
-/** Provide master page objects for template documents for which only the
-    URL is given.
-*/
-class TemplatePageObjectProvider : public PageObjectProvider
-{
-public:
-    TemplatePageObjectProvider (const ::rtl::OUString& rsURL);
-    virtual ~TemplatePageObjectProvider (void) {};
-    virtual SdPage* operator () (SdDrawDocument* pDocument);
-    virtual int GetCostIndex (void);
-    virtual bool operator== (const PageObjectProvider& rProvider);
-private:
-    ::rtl::OUString msURL;
-    SfxObjectShellLock mxDocumentShell;
-    ::sd::DrawDocShell* LoadDocument (const ::rtl::OUString& sFileName);
-};
-
-
-
-
-/** Provide previews for template documents by loading the thumbnails from
-    the documents.
-*/
-class TemplatePreviewProvider : public PreviewProvider
-{
-public:
-    TemplatePreviewProvider (const ::rtl::OUString& rsURL);
-    virtual ~TemplatePreviewProvider (void) {};
-    virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
-    virtual int GetCostIndex (void);
-    virtual bool NeedsPageObject (void);
-private:
-    ::rtl::OUString msURL;
-};
-
-
-
-
-/** Create an empty default master page.
-*/
-class DefaultPageObjectProvider : public PageObjectProvider
-{
-public:
-    DefaultPageObjectProvider (void);
-    virtual SdPage* operator () (SdDrawDocument* pDocument);
-    virtual int GetCostIndex (void);
-    virtual bool operator== (const PageObjectProvider& rProvider);
-};
-
-
-
-/** This implementation of the PageObjectProvider simply returns an already
-    existing master page object.
-*/
-class ExistingPageProvider : public ::sd::toolpanel::controls::PageObjectProvider
-{
-public:
-    ExistingPageProvider (SdPage* pPage);
-    virtual SdPage* operator() (SdDrawDocument* pDocument);
-    virtual int GetCostIndex (void);
-    virtual bool operator== (const PageObjectProvider& rProvider);
-private:
-    SdPage* mpPage;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
deleted file mode 100644
index e39823b..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
+++ /dev/null
@@ -1,300 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageContainerQueue.hxx"
-
-#include "tools/IdleDetection.hxx"
-
-#include <set>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15);
-const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100);
-const sal_Int32 MasterPageContainerQueue::snMasterPagePriorityBoost (5);
-const sal_Int32 MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold (-10);
-sal_uInt32 MasterPageContainerQueue::snWaitForMoreRequestsCount(15);
-
-//===== MasterPageContainerQueue::PreviewCreationRequest ======================
-
-class MasterPageContainerQueue::PreviewCreationRequest
-{
-public:
-    PreviewCreationRequest (const SharedMasterPageDescriptor& rpDescriptor, int nPriority)
-        : mpDescriptor(rpDescriptor),
-          mnPriority(nPriority)
-    {}
-    SharedMasterPageDescriptor mpDescriptor;
-    int mnPriority;
-    class Compare {public:
-        bool operator() (const PreviewCreationRequest& r1,const PreviewCreationRequest& r2)
-        {
-            if (r1.mnPriority != r2.mnPriority)
-            {
-                // Prefer requests with higher priority.
-                return r1.mnPriority > r2.mnPriority;
-            }
-            else
-            {
-                // Prefer tokens that have been earlier created (those with lower
-                // value).
-                return r1.mpDescriptor->maToken < r2.mpDescriptor->maToken;
-            }
-        }
-    };
-    class CompareToken {public:
-        MasterPageContainer::Token maToken;
-        CompareToken(MasterPageContainer::Token aToken) : maToken(aToken) {}
-        bool operator() (const PreviewCreationRequest& rRequest)
-        {     return maToken==rRequest.mpDescriptor->maToken; }
-    };
-};
-
-
-
-
-//===== MasterPageContainerQueue::RequestQueue ================================
-
-class MasterPageContainerQueue::RequestQueue
-    : public ::std::set<PreviewCreationRequest,PreviewCreationRequest::Compare>
-{
-public:
-    RequestQueue (void) {}
-};
-
-
-
-
-//===== MasterPageContainerQueue ==============================================
-
-MasterPageContainerQueue* MasterPageContainerQueue::Create (
-    const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
-{
-    MasterPageContainerQueue* pQueue = new MasterPageContainerQueue(rpContainer);
-    pQueue->LateInit();
-    return pQueue;
-}
-
-
-
-
-MasterPageContainerQueue::MasterPageContainerQueue (
-    const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
-    : mpWeakContainer(rpContainer),
-      mpRequestQueue(new RequestQueue()),
-      maDelayedPreviewCreationTimer(),
-      mnRequestsServedCount(0)
-{
-}
-
-
-
-
-MasterPageContainerQueue::~MasterPageContainerQueue (void)
-{
-    maDelayedPreviewCreationTimer.Stop();
-    while ( ! mpRequestQueue->empty())
-        mpRequestQueue->erase(mpRequestQueue->begin());
-}
-
-
-
-
-void MasterPageContainerQueue::LateInit (void)
-{
-    // Set up the timer for the delayed creation of preview bitmaps.
-    maDelayedPreviewCreationTimer.SetTimeout (snDelayedCreationTimeout);
-    Link aLink (LINK(this,MasterPageContainerQueue,DelayedPreviewCreation));
-    maDelayedPreviewCreationTimer.SetTimeoutHdl(aLink);
-}
-
-
-
-
-bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& rpDescriptor)
-{
-    bool bSuccess (false);
-    if (rpDescriptor.get() != NULL
-        && rpDescriptor->maLargePreview.GetSizePixel().Width() == 0)
-    {
-        sal_Int32 nPriority (CalculatePriority(rpDescriptor));
-        
-        // Add a new or replace an existing request.
-        RequestQueue::iterator iRequest (::std::find_if(
-            mpRequestQueue->begin(),
-            mpRequestQueue->end(),
-            PreviewCreationRequest::CompareToken(rpDescriptor->maToken)));
-        // When a request for the same token exists then the lowest of the
-        // two priorities is used.
-        if (iRequest != mpRequestQueue->end())
-            if (iRequest->mnPriority < nPriority)
-            {
-                mpRequestQueue->erase(iRequest);
-                iRequest = mpRequestQueue->end();
-            }
-
-        // Add a new request when none exists (or has just been erased).
-        if (iRequest == mpRequestQueue->end())
-        {
-            mpRequestQueue->insert(PreviewCreationRequest(rpDescriptor,nPriority));
-            maDelayedPreviewCreationTimer.Start();
-            bSuccess = true;
-        }
-    }
-    return bSuccess;
-}
-
-
-
-
-sal_Int32 MasterPageContainerQueue::CalculatePriority (
-    const SharedMasterPageDescriptor& rpDescriptor) const
-{
-    sal_Int32 nPriority;
-
-    // The cost is used as a starting value.
-    int nCost (0);
-    if (rpDescriptor->mpPreviewProvider.get() != NULL)
-    {
-        nCost = rpDescriptor->mpPreviewProvider->GetCostIndex();
-        if (rpDescriptor->mpPreviewProvider->NeedsPageObject())
-            if (rpDescriptor->mpPageObjectProvider.get() != NULL)
-                nCost += rpDescriptor->mpPageObjectProvider->GetCostIndex();
-    }
-
-    // Its negative value is used so that requests with a low cost are
-    // preferred over those with high costs.
-    nPriority = -nCost;
-
-    // Add a term that introduces an order based on the appearance in the
-    // AllMasterPagesSelector.
-    nPriority -= rpDescriptor->maToken / 3;
-    
-    // Process requests for the CurrentMasterPagesSelector first.
-    if (rpDescriptor->meOrigin == MasterPageContainer::MASTERPAGE)
-        nPriority += snMasterPagePriorityBoost;
-
-    return nPriority;
-}
-
-
-
-
-IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer)
-{
-    bool bIsShowingFullScreenShow (false);
-    bool bWaitForMoreRequests (false);
-
-    do
-    {
-        if (mpRequestQueue->size() == 0)
-            break;
-
-        // First check whether the system is idle.
-        sal_Int32 nIdleState (tools::IdleDetection::GetIdleState());
-        if (nIdleState != tools::IdleDetection::IDET_IDLE)
-        {
-            if ((nIdleState&tools::IdleDetection::IDET_FULL_SCREEN_SHOW_ACTIVE) != 0)
-                bIsShowingFullScreenShow = true;
-            break;
-        }
-
-        PreviewCreationRequest aRequest (*mpRequestQueue->begin());
-
-        // Check if the request should really be processed right now.
-        // Reasons to not do it are when its cost is high and not many other
-        // requests have been inserted into the queue that would otherwise
-        // be processed first.
-        if (aRequest.mnPriority < snWaitForMoreRequestsPriorityThreshold
-            && (mnRequestsServedCount+mpRequestQueue->size() < snWaitForMoreRequestsCount))
-        {
-            // Wait for more requests before this one is processed.  Note
-            // that the queue processing is not started anew when this
-            // method is left.  That is done when the next request is
-            // inserted.
-            bWaitForMoreRequests = true;
-            break;
-        }
-
-        mpRequestQueue->erase(mpRequestQueue->begin());
-        
-        if (aRequest.mpDescriptor.get() != NULL)
-        {
-            mnRequestsServedCount += 1;
-            if ( ! mpWeakContainer.expired())
-            {
-                ::boost::shared_ptr<ContainerAdapter> pContainer (mpWeakContainer);
-                if (pContainer.get() != NULL)
-                    pContainer->UpdateDescriptor(aRequest.mpDescriptor,false,true,true);
-            }
-        }
-    }
-    while (false);
-    
-    if (mpRequestQueue->size() > 0 && ! bWaitForMoreRequests)
-    {
-        int nTimeout (snDelayedCreationTimeout);
-        if (bIsShowingFullScreenShow)
-            nTimeout = snDelayedCreationTimeoutWhenNotIdle;
-        maDelayedPreviewCreationTimer.SetTimeout(nTimeout);
-        pTimer->Start();
-    }
-
-    return 0;
-}
-
-
-
-
-bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const
-{
-    RequestQueue::iterator iRequest (::std::find_if(
-        mpRequestQueue->begin(),
-        mpRequestQueue->end(),
-        PreviewCreationRequest::CompareToken(aToken)));
-    return (iRequest != mpRequestQueue->end());
-}
-
-
-
-
-bool MasterPageContainerQueue::IsEmpty (void) const
-{
-    return mpRequestQueue->empty();
-}
-
-
-
-
-void MasterPageContainerQueue::ProcessAllRequests (void)
-{
-    snWaitForMoreRequestsCount = 0;
-    if (mpRequestQueue->size() > 0)
-        maDelayedPreviewCreationTimer.Start();
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx b/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
deleted file mode 100644
index a46f315..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
+++ /dev/null
@@ -1,132 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
-
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-
-#include <boost/scoped_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** The queue stores and processes all requests from a MasterPageContainer
-    for the creation of previews.
-    The order of request processing and its timing is controlled by a
-    heuristic that uses values given with each request and which is
-    controlled by various parameters that are described below.
-*/
-class MasterPageContainerQueue
-{
-public:
-    class ContainerAdapter { public:
-        virtual bool UpdateDescriptor (
-            const SharedMasterPageDescriptor& rpDescriptor,
-            bool bForcePageObject,
-            bool bForcePreview,
-            bool bSendEvents) = 0;
-    };
-
-    static MasterPageContainerQueue* Create (
-        const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
-    virtual ~MasterPageContainerQueue (void);
-
-    /** This method is typically called for entries in the container for
-        which GetPreviewState() returns OS_CREATABLE.  The creation of the
-        preview is then scheduled to be executed asynchronously at a later
-        point in time.  When the preview is available the change listeners
-        will be notified.
-    */
-    bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor);
-
-    /** Return <TRUE/> when there is a request currently in the queue for
-        the given token.
-    */
-    bool HasRequest (MasterPageContainer::Token aToken) const;
-
-    /** Return <TRUE/> when there is at least one request in the queue.
-    */
-    bool IsEmpty (void) const;
-
-    /** After this call the queue does not wait anymore for requests with
-        higher priority when only a small number of requests with lower
-        priority are present.  This method should be called when all
-        templates are inserted into the MasterPageContainer.
-    */
-    void ProcessAllRequests (void);
-    
-private:
-    ::boost::weak_ptr<ContainerAdapter> mpWeakContainer;
-    class PreviewCreationRequest;
-    class RequestQueue;
-    ::boost::scoped_ptr<RequestQueue> mpRequestQueue;
-    Timer maDelayedPreviewCreationTimer;
-    sal_uInt32 mnRequestsServedCount;
-
-    // There are a couple of values that define various aspects of the
-    // heuristic that defines the order and timing in which requests for
-    // preview creation are processed.
-    
-    /** The time to wait (in milliseconds) between the creation of previews.
-    */
-    static const sal_Int32 snDelayedCreationTimeout;
-
-    /** The time to wait when the system is not idle.
-    */
-    static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle;
-    
-    /** Requests for previews of master pages in a document have their
-        priority increased by this value.
-    */
-    static const sal_Int32 snMasterPagePriorityBoost;
-
-    /** When only requests which a priority lower than this threshold exist
-        and not many requests have been made yet then wait with processing
-        them until more requests are present.
-    */
-    static const sal_Int32 snWaitForMoreRequestsPriorityThreshold;
-
-    /** When only requests which a priority lower than a threshold exist
-        and not more requests than this number have been made or already
-        processed then wait with processing them until more requests are
-        present.
-    */
-    static sal_uInt32 snWaitForMoreRequestsCount;
-    
-    MasterPageContainerQueue (const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
-    void LateInit (void);
-
-    /** Calculate the priority that defines the order in which requests
-        are processed.
-    */
-    sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor) const;
-    
-    DECL_LINK(DelayedPreviewCreation, Timer *);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
deleted file mode 100644
index 873b98d..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
+++ /dev/null
@@ -1,419 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageDescriptor.hxx"
-
-#include "DocumentHelper.hxx"
-#include "sdpage.hxx"
-#include <tools/urlobj.hxx>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-//===== MasterPageDescriptor ==================================================
-
-MasterPageDescriptor::MasterPageDescriptor (
-    MasterPageContainer::Origin eOrigin,
-    const sal_Int32 nTemplateIndex,
-    const String& rsURL,
-    const String& rsPageName,
-    const String& rsStyleName,
-    const bool bIsPrecious,
-    const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
-    const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider)
-    : maToken(MasterPageContainer::NIL_TOKEN),
-      meOrigin(eOrigin),
-      msURL(INetURLObject(rsURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS)),
-      msPageName(rsPageName),
-      msStyleName(rsStyleName),
-      mbIsPrecious(bIsPrecious),
-      mpMasterPage(NULL),
-      mpSlide(NULL),
-      maSmallPreview(),
-      maLargePreview(),
-      mpPreviewProvider(rpPreviewProvider),
-      mpPageObjectProvider(rpPageObjectProvider),
-      mnTemplateIndex(nTemplateIndex),
-      meURLClassification(URLCLASS_UNDETERMINED),
-      mnUseCount(0)
-{
-}
-   
-
-
-
-MasterPageDescriptor::MasterPageDescriptor (const MasterPageDescriptor& rDescriptor)
-    : maToken(rDescriptor.maToken),
-      meOrigin(rDescriptor.meOrigin),
-      msURL(rDescriptor.msURL),
-      msPageName(rDescriptor.msPageName),
-      msStyleName(rDescriptor.msStyleName),
-      mbIsPrecious(rDescriptor.mbIsPrecious),
-      mpMasterPage(rDescriptor.mpMasterPage),
-      mpSlide(rDescriptor.mpSlide),
-      maSmallPreview(rDescriptor.maSmallPreview),
-      maLargePreview(rDescriptor.maLargePreview),
-      mpPreviewProvider(rDescriptor.mpPreviewProvider),
-      mpPageObjectProvider(rDescriptor.mpPageObjectProvider),
-      mnTemplateIndex(rDescriptor.mnTemplateIndex),
-      meURLClassification(rDescriptor.meURLClassification),
-      mnUseCount(rDescriptor.mnUseCount)
-{
-}
-
-
-
-
-MasterPageDescriptor::~MasterPageDescriptor (void)
-{
-}
-
-
-
-
-void MasterPageDescriptor::SetToken (MasterPageContainer::Token aToken)
-{
-    maToken = aToken;
-}
-
-
-
-
-Image MasterPageDescriptor::GetPreview (MasterPageContainer::PreviewSize eSize)
-{
-    if (eSize == MasterPageContainer::SMALL)
-        return maSmallPreview;
-    else
-        return maLargePreview;
-}
-
-
-
-
-::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
-    MasterPageDescriptor::Update (
-        const MasterPageDescriptor& rDescriptor)
-{
-    bool bDataChanged (false);
-    bool bIndexChanged (false);
-    bool bPreviewChanged (false);
-
-    if (meOrigin==MasterPageContainer::UNKNOWN
-        && rDescriptor.meOrigin!=MasterPageContainer::UNKNOWN)
-    {
-        meOrigin = rDescriptor.meOrigin;
-        bIndexChanged = true;
-    }
-    
-    if (msURL.getLength()==0 && rDescriptor.msURL.getLength()!=0)
-    {
-        msURL = rDescriptor.msURL;
-        bDataChanged = true;
-    }
-    
-    if (msPageName.getLength()==0 && rDescriptor.msPageName.getLength()!=0)
-    {
-        msPageName = rDescriptor.msPageName;
-        bDataChanged = true;
-    }
-    
-    if (msStyleName.getLength()==0 && rDescriptor.msStyleName.getLength()!=0)
-    {
-        msStyleName = rDescriptor.msStyleName;
-        bDataChanged = true;
-    }
-    
-    if (mpPageObjectProvider.get()==NULL && rDescriptor.mpPageObjectProvider.get()!=NULL)
-    {
-        mpPageObjectProvider = rDescriptor.mpPageObjectProvider;
-        bDataChanged = true;
-    }
-    
-     if (mpPreviewProvider.get()==NULL && rDescriptor.mpPreviewProvider.get()!=NULL)
-     {
-         mpPreviewProvider = rDescriptor.mpPreviewProvider;
-         bPreviewChanged = true;
-     }
-
-     if (mnTemplateIndex<0 && rDescriptor.mnTemplateIndex>=0)
-     {
-         mnTemplateIndex = rDescriptor.mnTemplateIndex;
-         bIndexChanged = true;
-     }
-
-     // Prepare the list of event types that will be returned.
-     ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pResult;
-     if (bDataChanged || bIndexChanged || bPreviewChanged)
-     {
-         pResult.reset(new std::vector<MasterPageContainerChangeEvent::EventType>());
-         if (bDataChanged)
-             pResult->push_back(MasterPageContainerChangeEvent::DATA_CHANGED);
-         if (bIndexChanged)
-             pResult->push_back(MasterPageContainerChangeEvent::INDEX_CHANGED);
-         if (bPreviewChanged)
-             pResult->push_back(MasterPageContainerChangeEvent::PREVIEW_CHANGED);
-     }
-     
-     return pResult;
-}
-
-
-
-
-bool MasterPageDescriptor::UpdatePageObject (
-    sal_Int32 nCostThreshold,
-    SdDrawDocument* pDocument)
-{
-    bool bModified (false);
-    
-    // Update the page object when that is not yet known.
-    if (mpMasterPage == NULL
-        && mpPageObjectProvider.get()!=NULL
-        && (nCostThreshold<0 || mpPageObjectProvider->GetCostIndex()<=nCostThreshold))
-    {
-        // Note that pDocument may be NULL.
-            
-        SdPage* pPage = (*mpPageObjectProvider)(pDocument);
-        if (meOrigin == MasterPageContainer::MASTERPAGE)
-        {
-            mpMasterPage = pPage;
-            if (mpMasterPage != NULL)
-                mpMasterPage->SetPrecious(mbIsPrecious);
-        }
-        else
-        {
-            // Master pages from templates are copied into the local document.
-            if (pDocument != NULL)
-                mpMasterPage = DocumentHelper::CopyMasterPageToLocalDocument(*pDocument,pPage);
-            mpSlide = DocumentHelper::GetSlideForMasterPage(mpMasterPage);
-        }
-
-        if (mpMasterPage != NULL)
-        {
-            // Update page name and style name.
-            if (msPageName.getLength() == 0)
-                msPageName = mpMasterPage->GetName();
-            msStyleName = mpMasterPage->GetName();
-
-            // Delete an existing substitution. The next request for a preview
-            // will create the real one.
-            maSmallPreview = Image();
-            maLargePreview = Image();
-            mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider());
-        }
-        else
-        {
-            DBG_ASSERT(false, "UpdatePageObject: master page is NULL");
-        }
-
-        bModified = true;
-    }
-
-    return bModified;
-}
-
-
-
-
-bool MasterPageDescriptor::UpdatePreview (
-    sal_Int32 nCostThreshold,
-    const Size& rSmallSize,
-    const Size& rLargeSize,
-    ::sd::PreviewRenderer& rRenderer)
-{
-    bool bModified (false);
-    
-    // Update the preview when that is not yet known.
-    if (maLargePreview.GetSizePixel().Width()==0
-        && mpPreviewProvider.get()!=NULL
-        && (nCostThreshold<0 || mpPreviewProvider->GetCostIndex()<=nCostThreshold))
-    {
-        SdPage* pPage = mpSlide;
-        if (pPage == NULL)
-        {
-            pPage = mpMasterPage;
-        }
-        maLargePreview = (*mpPreviewProvider)(
-            rLargeSize.Width(),
-            pPage,
-            rRenderer);
-        if (maLargePreview.GetSizePixel().Width() > 0)
-        {
-            // Create the small preview by scaling the large one down.
-            maSmallPreview = rRenderer.ScaleBitmap(
-                maLargePreview.GetBitmapEx(),
-                rSmallSize.Width());
-            // The large preview may not have the desired width.  Scale it
-            // accrodingly.
-            if (maLargePreview.GetSizePixel().Width() != rLargeSize.Width())
-                maLargePreview = rRenderer.ScaleBitmap(
-                    maLargePreview.GetBitmapEx(),
-                    rLargeSize.Width());
-            bModified = true;
-        }
-    }
-
-    return bModified;
-}
-
-
-
-
-MasterPageDescriptor::URLClassification MasterPageDescriptor::GetURLClassification (void)
-{
-    if (meURLClassification == URLCLASS_UNDETERMINED)
-    {
-        if (msURL.getLength() == 0)
-            meURLClassification = URLCLASS_UNKNOWN;
-        else if (msURL.indexOf(::rtl::OUString::createFromAscii("presnt"))>=0)
-        {
-            meURLClassification = URLCLASS_PRESENTATION;
-        }
-        else if (msURL.indexOf(::rtl::OUString::createFromAscii("layout"))>=0)
-        {
-            meURLClassification = URLCLASS_LAYOUT;
-        }
-        else if (msURL.indexOf(::rtl::OUString::createFromAscii("educate"))>=0)
-        {
-            meURLClassification = URLCLASS_OTHER;
-        }
-        else
-        {
-            meURLClassification = URLCLASS_USER;
-        }
-    }
-    
-    return meURLClassification;
-}
-
-
-
-//===== URLComparator =========================================================
-
-MasterPageDescriptor::URLComparator::URLComparator (const ::rtl::OUString& sURL)
-    : msURL(sURL)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::URLComparator::operator() (
-    const SharedMasterPageDescriptor& rDescriptor)
-{
-    if (rDescriptor.get() == NULL)
-        return false;
-    else
-        return rDescriptor->msURL.equals(msURL);
-}
-
-
-
-
-// ===== StyleNameComparator ==================================================
-
-MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const ::rtl::OUString& sStyleName)
-    : msStyleName(sStyleName)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::StyleNameComparator::operator() (
-    const SharedMasterPageDescriptor& rDescriptor)
-{
-    if (rDescriptor.get() == NULL)
-        return false;
-    else
-        return rDescriptor->msStyleName.equals(msStyleName);
-}
-
-
-
-
-//===== PageObjectComparator ==================================================
-
-MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage* pPageObject) 
-    : mpMasterPage(pPageObject)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::PageObjectComparator::operator() (
-    const SharedMasterPageDescriptor& rDescriptor)
-{
-    if (rDescriptor.get() == NULL)
-        return false;
-    else
-        return rDescriptor->mpMasterPage==mpMasterPage;
-}
-
-
-
-
-//===== AllComparator =========================================================
-
-MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescriptor& rDescriptor)
-    : mpDescriptor(rDescriptor)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor)
-{
-    if (rDescriptor.get() == NULL)
-        return false;
-    else
-    {
-        // Take URL, page name, style name, and page object into account
-        // when comparing two descriptors.  When two descriptors are
-        // identical in any of these values then their are thought of as
-        // equivalent.  Only the Origin has to be the same in both
-        // descriptors.
-        return
-            mpDescriptor->meOrigin == rDescriptor->meOrigin
-            && (
-                (mpDescriptor->msURL.getLength()>0
-                    && mpDescriptor->msURL.equals(rDescriptor->msURL))
-                || (mpDescriptor->msPageName.getLength()>0
-                    && mpDescriptor->msPageName.equals(rDescriptor->msPageName))
-                || (mpDescriptor->msStyleName.getLength()>0
-                    && mpDescriptor->msStyleName.equals(rDescriptor->msStyleName))
-                || (mpDescriptor->mpMasterPage!=NULL
-                    && mpDescriptor->mpMasterPage==rDescriptor->mpMasterPage)
-                || (mpDescriptor->mpPageObjectProvider.get()!=NULL
-                    && rDescriptor->mpPageObjectProvider.get()!=NULL
-                    && mpDescriptor->mpPageObjectProvider==rDescriptor->mpPageObjectProvider));
-    }
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx b/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
deleted file mode 100644
index 57ab3f4..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
-
-#include "MasterPageContainer.hxx"
-#include <boost/shared_ptr.hpp>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class PageObjectProvider;
-class PreviewProvider;
-
-class MasterPageDescriptor;
-typedef ::boost::shared_ptr<MasterPageDescriptor> SharedMasterPageDescriptor;
-
-/** A collection of data that is stored for every master page in the
-    MasterpageContainer.
-*/
-class MasterPageDescriptor
-{
-public:
-    MasterPageDescriptor (
-        MasterPageContainer::Origin eOrigin,
-        const sal_Int32 nTemplateIndex,
-        const String& rURL,
-        const String& rPageName,
-        const String& rStyleName,
-        const bool bIsPrecious,
-        const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
-        const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider);
-    MasterPageDescriptor (const MasterPageDescriptor& rDescriptor);
-    ~MasterPageDescriptor (void);
-
-    void SetToken (MasterPageContainer::Token aToken);
-
-    /** Update the called MasterPageDescriptor object with values from the
-        given one.  Only those values are updated that have default values
-        in the called object and that have non-default values in the given
-        one.
-        @return
-            Returns a list of event types for which event notifications have
-            to be sent to listeners.  The list may be empty or NULL.
-    */
-    ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
-        Update (
-            const MasterPageDescriptor& rDescriptor);
-    
-    /** This convenience method returns either a small or a large preview,
-        depending on the given size specifier.
-        Note that the previews are not created when they are not present.
-        @return
-            The returned preview may be empty.
-    */
-    Image GetPreview (MasterPageContainer::PreviewSize ePreviewSize);
-
-    /** Use the PreviewProvider to get access to a preview of the master
-        page.
-        
-        Note that this is only done, when either bForce is <TRUE/> or
-        the PreviewProvider::GetCostIndex() returns 0.
-        
-        The small preview is created by scaling the large one, not by
-        calling PreviewProvider::operator() a second time.
-        
-        It is the responsibility of the caller to call UpdatePageObject()
-        before calling this method  when the PreviewProvider can only work
-        when the master page object is present, i.e. its NeedsPageObject()
-        method returns <TRUE/>.
-        
-        @param nCostThreshold
-            When this is zero or positive then the preview is created only
-            when the preview provider has a cost equal to or smaller than
-            this threshold.  A negative value forces the preview to be
-            created, regardless of the cost.
-        @param rSmallSize
-            Size of the small preview.
-        @param rLargeSize
-            Size of the large preview.
-        @param rRenderer
-            A PreviewRenderer object that may be used to create a preview.
-        @return
-            When the previews are successfully provided then <TRUE/> is
-            returned.
-    */
-    bool UpdatePreview (
-        sal_Int32 nCostThreshold,
-        const Size& rSmallSize,
-        const Size& rLargeSize,
-        ::sd::PreviewRenderer& rRenderer);
-
-    /** Use the PageObjectProvider to get access to the master page object.
-        
-        Note that this is only done, when either bForce is <TRUE/> or the
-        PreviewProvider::GetCostIndex() returns 0.
-
-        @param nCostThreshold
-            When this is zero or positive then the page object is created
-            only when the page object provider has a cost equal to or
-            smaller than this threshold.  A negative value forces the
-            page object be created, regardless of the cost.
-        @param pDocument
-            This document of the MasterPageContainer may be used to create
-            a page object with or store one in.
-        @return
-            When the master page object is successfully provided then
-            <TRUE/> is returned.
-    */
-    bool UpdatePageObject (
-        sal_Int32 nCostThreshold,
-        SdDrawDocument* pDocument);
-
-    enum URLClassification {
-        URLCLASS_USER,
-        URLCLASS_LAYOUT,
-        URLCLASS_PRESENTATION,
-        URLCLASS_OTHER,
-        URLCLASS_UNKNOWN,
-        URLCLASS_UNDETERMINED
-    };
-
-    URLClassification GetURLClassification (void);
-    
-    /** The Token under which the MasterPageContainer gives access to the
-        object.
-    */
-    MasterPageContainer::Token maToken;
-
-    /** A rough specification of the origin of the master page.
-    */
-    MasterPageContainer::Origin meOrigin;
-    
-    /** The URL is not empty for master pages loaded from a template
-        document.
-    */
-    ::rtl::OUString msURL;
-    
-    /** Taken from the title of the template file.
-    */
-    ::rtl::OUString msPageName;
-    
-    /** Taken from the master page object.
-    */
-    ::rtl::OUString msStyleName;
-
-    const bool mbIsPrecious;
-
-    /** The actual master page.
-    */
-    SdPage* mpMasterPage;
-    
-    /** A slide that uses the master page.
-    */
-    SdPage* mpSlide;
-    
-    /** A small (the default size) preview of the master page.  May be
-        empty.  When this smaller preview is not empty then the larger one
-        is not empty, too.
-    */
-    Image maSmallPreview;
-    
-    /** A large preview of the master page.  May be empty.  When this larger
-        preview is not empty then the smaller one is not empty, too.
-    */
-    Image maLargePreview;
-
-    /** The prewview provider. May be empty.  May be replaced during the
-        lifetime of a MasterPageDescriptor object.
-    */
-    ::boost::shared_ptr<PreviewProvider> mpPreviewProvider;
-
-    /** The master page provider.  May be empty.  May be replaced during
-        the lifetime of a MasterPageDescriptor object.
-    */
-    ::boost::shared_ptr<PageObjectProvider> mpPageObjectProvider;
-    
-    /** This index represents the order in which templates are provided via
-        the TemplateScanner.  It defines the order in which the entries in
-        the AllMasterPagesSelector are displayed.  The default value is -1.
-    */
-    sal_Int32 mnTemplateIndex;
-
-    URLClassification meURLClassification;
-
-    sal_Int32 mnUseCount;
-
-    class URLComparator { public:
-        ::rtl::OUString msURL;
-        URLComparator (const ::rtl::OUString& sURL);
-        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
-    };
-    class StyleNameComparator { public:
-        ::rtl::OUString msStyleName;
-        StyleNameComparator (const ::rtl::OUString& sStyleName);
-        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
-    };
-    class PageObjectComparator { public:
-        const SdPage* mpMasterPage;
-        PageObjectComparator (const SdPage* pPageObject);
-        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
-    };
-    class AllComparator { public:
-        AllComparator(const SharedMasterPageDescriptor& rDescriptor);
-        bool operator() (const SharedMasterPageDescriptor& rDescriptor);
-    private:
-        SharedMasterPageDescriptor mpDescriptor;
-    };
-
-
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx b/main/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
deleted file mode 100644
index 81fc1ed..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
+++ /dev/null
@@ -1,422 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPageObserver.hxx"
-
-#include <algorithm>
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include <hash_map>
-#include <set>
-#include <vector>
-#include <svl/lstner.hxx>
-#include <osl/doublecheckedlocking.h>
-#include <osl/getglobalmutex.hxx>
-
-
-namespace sd {
-
-class MasterPageObserver::Implementation
-    : public SfxListener
-{
-public:
-    /** The single instance of this class.  It is created on demand when
-        Instance() is called for the first time.
-    */
-    static MasterPageObserver* mpInstance;
-
-    /** The master page observer will listen to events of this document and
-        detect changes of the use of master pages.
-    */
-    void RegisterDocument (SdDrawDocument& rDocument);
-
-    /** The master page observer will stop to listen to events of this
-        document.
-    */
-    void UnregisterDocument (SdDrawDocument& rDocument);
-    
-    /** Add a listener that is informed of master pages that are newly
-        assigned to slides or become unassigned.
-        @param rEventListener
-            The event listener to call for future events.  Call
-            RemoveEventListener() before the listener is destroyed.
-    */
-    void AddEventListener (const Link& rEventListener);
-
-    /** Remove the given listener from the list of listeners.
-        @param rEventListener
-            After this method returns the given listener is not called back
-            from this object.  Passing a listener that has not
-            been registered before is safe and is silently ignored.
-    */
-    void RemoveEventListener (const Link& rEventListener);
-
-    /** Return a set of the names of master pages for the given document.
-        This convenience method exists because this set is part of the
-        internal data structure and thus takes no time to create.
-    */
-    inline MasterPageObserver::MasterPageNameSet GetMasterPageNames (
-        SdDrawDocument& rDocument);
-
-private:
-    ::std::vector<Link> maListeners;
-
-    struct DrawDocHash {
-        size_t operator()(SdDrawDocument* argument) const 
-        { return reinterpret_cast<unsigned long>(argument); }
-    };
-    typedef ::std::hash_map<SdDrawDocument*,
-                            MasterPageObserver::MasterPageNameSet,
-                            DrawDocHash>
-        MasterPageContainer;
-    MasterPageContainer maUsedMasterPages;
-
-    virtual void Notify(
-        SfxBroadcaster& rBroadcaster,
-        const SfxHint& rHint);
-
-    void AnalyzeUsedMasterPages (SdDrawDocument& rDocument);
-
-    void SendEvent (MasterPageObserverEvent& rEvent);
-};
-
-MasterPageObserver* MasterPageObserver::Implementation::mpInstance = NULL;
-
-
-
-//===== MasterPageObserver ====================================================
-
-MasterPageObserver&  MasterPageObserver::Instance (void)
-{
-    if (Implementation::mpInstance == NULL)
-    {
-        ::osl::GetGlobalMutex aMutexFunctor;
-        ::osl::MutexGuard aGuard (aMutexFunctor());
-        if (Implementation::mpInstance == NULL)
-        {
-            MasterPageObserver* pInstance = new MasterPageObserver ();
-            SdGlobalResourceContainer::Instance().AddResource (
-                ::std::auto_ptr<SdGlobalResource>(pInstance));
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-            Implementation::mpInstance = pInstance;
-        }
-    }
-    else
-    {
-        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-    }
-    
-    DBG_ASSERT(Implementation::mpInstance!=NULL,
-        "MasterPageObserver::Instance(): instance is NULL");
-    return *Implementation::mpInstance;
-}
-
-
-
-
-void MasterPageObserver::RegisterDocument (SdDrawDocument& rDocument)
-{
-    mpImpl->RegisterDocument (rDocument);
-}
-
-
-
-
-void MasterPageObserver::UnregisterDocument (SdDrawDocument& rDocument)
-{
-    mpImpl->UnregisterDocument (rDocument);
-}
-
-
-
-    
-void MasterPageObserver::AddEventListener (const Link& rEventListener)
-{
-
-    mpImpl->AddEventListener (rEventListener);
-}
-
-
-
-
-void MasterPageObserver::RemoveEventListener (const Link& rEventListener)
-{
-    mpImpl->RemoveEventListener (rEventListener);
-}
-
-
-
-
-MasterPageObserver::MasterPageObserver (void)
-    : mpImpl (new Implementation())
-{}
-
-
-
-
-MasterPageObserver::~MasterPageObserver (void)
-{}
-
-
-
-
-//===== MasterPageObserver::Implementation ====================================
-
-void MasterPageObserver::Implementation::RegisterDocument (
-    SdDrawDocument& rDocument)
-{
-    // Gather the names of all the master pages in the given document.
-    MasterPageContainer::data_type aMasterPageSet;
-    sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
-    for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
-    {
-        SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
-        if (pMasterPage != NULL)
-            aMasterPageSet.insert (pMasterPage->GetName());
-    }
-
-    maUsedMasterPages[&rDocument] = aMasterPageSet;
-
-    StartListening (rDocument);
-}
-
-
-
-
-void MasterPageObserver::Implementation::UnregisterDocument (
-    SdDrawDocument& rDocument)
-{
-    EndListening (rDocument);
-
-	MasterPageContainer::iterator aMasterPageDescriptor(maUsedMasterPages.find(&rDocument));
-	if(aMasterPageDescriptor != maUsedMasterPages.end())
-		maUsedMasterPages.erase(aMasterPageDescriptor);
-}
-
-
-
-    
-void MasterPageObserver::Implementation::AddEventListener (
-    const Link& rEventListener)
-{
-    if (::std::find (
-        maListeners.begin(),
-        maListeners.end(),
-        rEventListener) == maListeners.end())
-    {
-        maListeners.push_back (rEventListener);
-        
-        // Tell the new listener about all the master pages that are
-        // currently in use.
-        typedef ::std::vector<String> StringList;
-        StringList aNewMasterPages;
-        StringList aRemovedMasterPages;
-        MasterPageContainer::iterator aDocumentIterator;
-        for (aDocumentIterator=maUsedMasterPages.begin();
-             aDocumentIterator!=maUsedMasterPages.end();
-             ++aDocumentIterator)
-        {
-            ::std::set<String>::reverse_iterator aNameIterator;
-            for (aNameIterator=aDocumentIterator->second.rbegin();
-                 aNameIterator!=aDocumentIterator->second.rend();
-                 ++aNameIterator)
-            {
-			  MasterPageObserverEvent aEvent (
-				  MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS,
-				  *aDocumentIterator->first,
-				  *aNameIterator);
-			  SendEvent (aEvent);
-            }
-        }
-    }
-}
-
-
-
-
-void MasterPageObserver::Implementation::RemoveEventListener (
-    const Link& rEventListener)
-{
-    maListeners.erase (
-        ::std::find (
-            maListeners.begin(),
-            maListeners.end(),
-            rEventListener));
-}
-
-
-
-
-MasterPageObserver::MasterPageNameSet 
-    MasterPageObserver::Implementation::GetMasterPageNames (
-        SdDrawDocument& rDocument)
-{
-    MasterPageContainer::iterator aMasterPageDescriptor (
-        maUsedMasterPages.find(&rDocument));
-    if (aMasterPageDescriptor != maUsedMasterPages.end())
-        return aMasterPageDescriptor->second;
-    else
-        // Not found so return an empty set.
-        return MasterPageObserver::MasterPageNameSet();
-}
-
-
-
-
-void MasterPageObserver::Implementation::Notify(
-    SfxBroadcaster& rBroadcaster,
-    const SfxHint& rHint)
-{
-    if (rHint.ISA(SdrHint))
-    {
-        SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
-        switch (rSdrHint.GetKind())
-        {
-            case HINT_PAGEORDERCHG:
-                // Process the modified set of pages only when the number of
-                // standard and notes master pages are equal.  This test
-                // filters out events that are sent in between the insertion
-                // of a new standard master page and a new notes master
-                // page.
-                if (rBroadcaster.ISA(SdDrawDocument))
-                {
-                    SdDrawDocument& rDocument (
-                        static_cast<SdDrawDocument&>(rBroadcaster));
-                    if (rDocument.GetMasterSdPageCount(PK_STANDARD)
-                        == rDocument.GetMasterSdPageCount(PK_NOTES))
-                    {
-                        AnalyzeUsedMasterPages (rDocument);
-                    }
-                }
-                break;
-
-			default:
-				break;
-        }
-    }
-}
-
-
-
-
-void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
-    SdDrawDocument& rDocument)
-{
-    // Create a set of names of the master pages used by the given document.
-    sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
-    ::std::set<String> aCurrentMasterPages;
-    for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
-    {
-        SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
-        if (pMasterPage != NULL)
-            aCurrentMasterPages.insert (pMasterPage->GetName());
-        OSL_TRACE("currently used master page %d is %s",
-            nIndex,
-            ::rtl::OUStringToOString(pMasterPage->GetName(),
-                RTL_TEXTENCODING_UTF8).getStr());
-    }
-
-    typedef ::std::vector<String> StringList;
-    StringList aNewMasterPages;
-    StringList aRemovedMasterPages;
-    MasterPageContainer::iterator aOldMasterPagesDescriptor (
-        maUsedMasterPages.find(&rDocument));
-    if (aOldMasterPagesDescriptor != maUsedMasterPages.end())
-    {
-        StringList::iterator I;
-
-        ::std::set<String>::iterator J;
-        int i=0;
-        for (J=aOldMasterPagesDescriptor->second.begin(); 
-             J!=aOldMasterPagesDescriptor->second.end(); 
-             ++J)
-            OSL_TRACE("old used master page %d is %s",
-            i++,
-            ::rtl::OUStringToOString(*J,
-                RTL_TEXTENCODING_UTF8).getStr());
-
-        // Send events about the newly used master pages.
-        ::std::set_difference (
-            aCurrentMasterPages.begin(),
-            aCurrentMasterPages.end(),
-            aOldMasterPagesDescriptor->second.begin(),
-            aOldMasterPagesDescriptor->second.end(),
-            ::std::back_insert_iterator<StringList>(aNewMasterPages));
-        for (I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
-        {
-            OSL_TRACE("    added master page %s",
-                ::rtl::OUStringToOString(*I,
-                    RTL_TEXTENCODING_UTF8).getStr());
-
-			MasterPageObserverEvent aEvent (
-				MasterPageObserverEvent::ET_MASTER_PAGE_ADDED, 
-				rDocument, 
-				*I);
-            SendEvent (aEvent);
-        }
-
-        // Send events about master pages that are not used any longer.
-        ::std::set_difference (
-            aOldMasterPagesDescriptor->second.begin(),
-            aOldMasterPagesDescriptor->second.end(),
-            aCurrentMasterPages.begin(),
-            aCurrentMasterPages.end(),
-            ::std::back_insert_iterator<StringList>(aRemovedMasterPages));
-        for (I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
-        {
-            OSL_TRACE("    removed master page %s",
-                ::rtl::OUStringToOString(*I,
-                    RTL_TEXTENCODING_UTF8).getStr());
-
-			MasterPageObserverEvent aEvent (
-				MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
-				rDocument, 
-				*I);
-			SendEvent (aEvent);
-        }
-
-        // Store the new list of master pages.
-        aOldMasterPagesDescriptor->second = aCurrentMasterPages;
-    }
-}
-
-
-
-
-void MasterPageObserver::Implementation::SendEvent (
-    MasterPageObserverEvent& rEvent)
-{
-    ::std::vector<Link>::iterator aLink (maListeners.begin());
-    ::std::vector<Link>::iterator aEnd (maListeners.end());
-    while (aLink!=aEnd)
-    {
-        aLink->Call (&rEvent);
-        ++aLink;
-    }
-}
-
-
-} // end of namespace sd
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
deleted file mode 100644
index d19421e..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPagesPanel.hxx"
-#include "taskpane/ScrollPanel.hxx"
-#include "CurrentMasterPagesSelector.hxx"
-#include "RecentMasterPagesSelector.hxx"
-#include "AllMasterPagesSelector.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "../TaskPaneShellManager.hxx"
-
-#include "DrawViewShell.hxx"
-#include "ViewShellBase.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "helpids.h"
-#include <svtools/valueset.hxx>
-#include "app.hrc"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
-    :ScrollPanel (i_rParentWindow)
-    ,m_pPanelViewShell( &i_rPanelViewShell )
-{
-    impl_construct( m_pPanelViewShell->GetViewShellBase() );
-}
-
-void MasterPagesPanel::impl_construct( ViewShellBase& rBase )
-{
-    SdDrawDocument* pDocument = rBase.GetDocument();
-    ::std::auto_ptr<controls::MasterPagesSelector> pSelector;
-    TitledControl* pTitledControl;
-
-    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
-    
-    // Create a panel with the master pages that are in use by the currently
-    // edited document.
-    DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(rBase.GetMainViewShell().get());
-    pSelector.reset(new controls::CurrentMasterPagesSelector (
-        this, 
-        *pDocument,
-        rBase,
-        pContainer));
-    pSelector->LateInit();
-    pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
-    GetShellManager()->AddSubShell(
-        SHELLID_SD_TASK_PANE_PREVIEW_CURRENT,
-        pSelector.get(),
-        pSelector->GetWindow());
-    pTitledControl = AddControl (
-        ::std::auto_ptr<TreeNode>(pSelector.release()),
-        SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE),
-        HID_SD_CURRENT_MASTERS);
-    
-    // Create a panel with the most recently used master pages.
-    pSelector.reset(new controls::RecentMasterPagesSelector (
-        this, 
-        *pDocument,
-        rBase,
-        pContainer));
-    pSelector->LateInit();
-    pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT );
-    GetShellManager()->AddSubShell(
-        SHELLID_SD_TASK_PANE_PREVIEW_RECENT,
-        pSelector.get(),
-        pSelector->GetWindow());
-    pTitledControl = AddControl (
-        ::std::auto_ptr<TreeNode>(pSelector.release()),
-        SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE),
-        HID_SD_RECENT_MASTERS);
-
-    // Create a panel with all available master pages.
-    pSelector.reset(new controls::AllMasterPagesSelector (
-        this, 
-        *pDocument,
-        rBase,
-        *pDrawViewShell,
-        pContainer));
-    pSelector->LateInit();
-    pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL );
-    GetShellManager()->AddSubShell(
-        SHELLID_SD_TASK_PANE_PREVIEW_ALL,
-        pSelector.get(),
-        pSelector->GetWindow());
-    pTitledControl = AddControl (
-        ::std::auto_ptr<TreeNode>(pSelector.release()),
-        SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE),
-        HID_SD_ALL_MASTERS);
-}
-
-
-
-
-
-MasterPagesPanel::~MasterPagesPanel (void)
-{
-    TaskPaneShellManager* pShellManager( GetShellManager() );
-    OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" );
-    if ( pShellManager )
-    {
-        pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT );
-        pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT );
-        pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL );
-    }
-}
-
-
-
-
-TaskPaneShellManager* MasterPagesPanel::GetShellManager()
-{
-    if ( m_pPanelViewShell )
-        return &m_pPanelViewShell->GetSubShellManager();
-    return TreeNode::GetShellManager();
-}
-
-
-
-
-std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
-    return std::auto_ptr< ControlFactory >(
-        new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
deleted file mode 100644
index 23cd773..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
-#define SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
-
-#include "taskpane/ScrollPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class ControlFactory;
-class TreeNode;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** The master pages panel combines three master page related panels into
-    one.  This has the benefit that creation of the task pane becomes a
-    little bit simpler and that common scroll bars can be displayed.
-*/
-class MasterPagesPanel
-    : public ScrollPanel
-{
-public:
-    MasterPagesPanel (
-        ::Window& i_rParentWindow, 
-        ToolPanelViewShell& i_rPanelViewShell);
-    virtual ~MasterPagesPanel (void);
-
-    // TreeNode overridables
-    virtual TaskPaneShellManager* GetShellManager (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
-private:
-    void    impl_construct( ViewShellBase& rBase );
-
-private:
-    ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
deleted file mode 100644
index 90c1234..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
+++ /dev/null
@@ -1,850 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "MasterPagesSelector.hxx"
-
-#include "MasterPageContainer.hxx"
-#include "DocumentHelper.hxx"
-#include "pres.hxx"
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "glob.hrc"
-#include "app.hrc"
-#include "res_bmp.hrc"
-#include "strings.hrc"
-#include "DrawViewShell.hxx"
-#include "DrawController.hxx"
-#include "SlideSorterViewShell.hxx"
-#include "PreviewValueSet.hxx"
-#include "ViewShellBase.hxx"
-#include "../TaskPaneShellManager.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsPageSelector.hxx"
-#include <sfx2/objface.hxx>
-#include "sdresid.hxx"
-#include "TemplateScanner.hxx"
-#ifndef _SD_DRAWVIEW_HXX
-#include "drawview.hxx"
-#endif
-#include <vcl/image.hxx>
-#include <svl/languageoptions.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/mnumgr.hxx>
-#include <svl/itemset.hxx>
-#include <svl/eitem.hxx>
-#include <svx/dlgutil.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svxids.hrc>
-#include "FrameView.hxx"
-#include "sdpage.hxx"
-#include "stlpool.hxx"
-#include "unmovss.hxx"
-#include <sfx2/request.hxx>
-#include <svl/itempool.hxx>
-
-using namespace ::sd::toolpanel::controls;
-#define MasterPagesSelector
-#include "sdslots.hxx"
-
-using namespace ::com::sun::star::text;
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-SFX_IMPL_INTERFACE(MasterPagesSelector, SfxShell, 
-    SdResId(STR_MASTERPAGESSELECTOR))
-{
-	SFX_POPUPMENU_REGISTRATION( SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP) );
-}
-
-TYPEINIT1(MasterPagesSelector, SfxShell);
-
-
-
-MasterPagesSelector::MasterPagesSelector (
-    TreeNode* pParent,
-    SdDrawDocument& rDocument,
-    ViewShellBase& rBase,
-    const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
-    : TreeNode (pParent),
-      SfxShell(),
-      maMutex(),
-      mpContainer(rpContainer),
-      mrDocument(rDocument),
-      mpPageSet (new PreviewValueSet(pParent)),
-      mrBase(rBase),
-      mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES),
-      maPreviewUpdateQueue(),
-      maCurrentItemList(),
-      maTokenToValueSetIndex(),
-      maLockedMasterPages()
-{
-	SetPool (&rDocument.GetPool());
-
-	mpPageSet->SetSelectHdl (
-        LINK(this, MasterPagesSelector, ClickHandler));
-	mpPageSet->SetRightMouseClickHandler (
-        LINK(this, MasterPagesSelector, RightClickHandler));
-	mpPageSet->SetContextMenuCallback (
-        LINK(this, MasterPagesSelector, ContextMenuCallback));
-    mpPageSet->SetStyle(mpPageSet->GetStyle() | WB_NO_DIRECTSELECT);
-    mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
-    mpPageSet->Show();
-
-    Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
-    mpContainer->AddChangeListener(aChangeListener);
-}
-
-
-
-
-MasterPagesSelector::~MasterPagesSelector (void)
-{
-    Clear();
-    mpPageSet.reset();
-    UpdateLocks(ItemList());
-
-    if (GetShellManager() != NULL)
-        GetShellManager()->RemoveSubShell (this);
-
-    Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
-    mpContainer->RemoveChangeListener(aChangeListener);
-}
-
-
-
-
-void MasterPagesSelector::LateInit (void)
-{
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    return mpPageSet->GetPreferredWidth (nHeight);
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    return mpPageSet->GetPreferredHeight (nWidth);
-}
-
-
-
-
-Size MasterPagesSelector::GetPreferredSize (void)
-{
-    int nPreferredWidth = GetPreferredWidth(
-        mpPageSet->GetOutputSizePixel().Height());
-    int nPreferredHeight = GetPreferredHeight(nPreferredWidth);
-    return Size (nPreferredWidth, nPreferredHeight);
-
-}
-
-
-
-
-void MasterPagesSelector::UpdateLocks (const ItemList& rItemList)
-{
-    ItemList aNewLockList;
-    
-    // In here we first lock the master pages in the given list and then
-    // release the locks acquired in a previous call to this method.  When
-    // this were done the other way round the lock count of some master
-    // pages might drop temporarily to 0 and would lead to unnecessary
-    // deletion and re-creation of MasterPageDescriptor objects.
-
-    // Lock the master pages in the given list.
-    ItemList::const_iterator iItem;
-    for (iItem=rItemList.begin(); iItem!=rItemList.end(); ++iItem)
-    {
-        mpContainer->AcquireToken(*iItem);
-        aNewLockList.push_back(*iItem);
-    }
-
-    // Release the previously locked master pages.
-    ItemList::const_iterator iPage;
-    ItemList::const_iterator iEnd (maLockedMasterPages.end());
-    for (iPage=maLockedMasterPages.begin(); iPage!=iEnd; ++iPage)
-        mpContainer->ReleaseToken(*iPage);
-
-    maLockedMasterPages.swap(aNewLockList);
-}
-
-
-
-
-void MasterPagesSelector::Fill (void)
-{
-    ::std::auto_ptr<ItemList> pItemList (new ItemList());
-    
-    Fill(*pItemList);
-
-    UpdateLocks(*pItemList);
-    UpdateItemList(pItemList);
-}
-
-
-
-
-ResId MasterPagesSelector::GetContextMenuResId (void) const
-{
-    return SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP);
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, ClickHandler, PreviewValueSet*, EMPTYARG)
-{
-    // We use the framework to assign the clicked-on master page because we
-    // so use the same mechanism as the context menu does (where we do not
-    // have the option to call the assignment method directly.)
-    if (GetShellManager() != NULL)
-        GetShellManager()->MoveToTop (this);
-
-    SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
-    if (pViewFrame != NULL)
-    {
-        SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-        if (pDispatcher != NULL)
-            pDispatcher->Execute(mnDefaultClickAction);
-    }
-
-    return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent)
-{
-    // Here we only prepare the display of the context menu: the item under
-    // the mouse is selected.  The actual display of the context menu is
-    // done in ContextMenuCallback which is called indirectly through
-    // PreviewValueSet::Command().
-    mpPageSet->GrabFocus ();
-    mpPageSet->ReleaseMouse();
-    if (GetDispatcher() != NULL &&  pEvent != NULL)
-    {
-        sal_uInt16 nIndex = mpPageSet->GetItemId (pEvent->GetPosPixel());
-        if (nIndex > 0)
-            mpPageSet->SelectItem (nIndex);
-    }
-    return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, ContextMenuCallback, CommandEvent*, pEvent)
-{
-    // Use the currently selected item and show the popup menu in its
-    // center.
-    if (GetShellManager() != NULL)
-        GetShellManager()->MoveToTop (this);
-    const sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
-    if (nIndex > 0 && pEvent!=NULL)
-    {
-        // The position of the upper left corner of the context menu is
-        // taken either from the mouse position (when the command was sent
-        // as reaction to a right click) or in the center of the selected
-        // item (when the command was sent as reaction to Shift+F10.)
-        Point aPosition (pEvent->GetMousePosPixel());
-        if ( ! pEvent->IsMouseEvent())
-        {
-            Rectangle aBBox (mpPageSet->GetItemRect(nIndex));
-            aPosition = aBBox.Center();
-        }
-
-        const ResId aPopupResId (GetContextMenuResId());
-        mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
-            aPopupResId,
-            mpPageSet.get(),
-            &aPosition);
-    }
-    
-    return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent)
-{
-    if (pEvent)
-        NotifyContainerChangeEvent(*pEvent);
-    return 0;
-}
-
-
-
-
-SdPage* MasterPagesSelector::GetSelectedMasterPage (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    SdPage* pMasterPage = NULL;
-    sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
-    UserData* pData = GetUserData(nIndex);
-    if (pData != NULL)
-    {
-        pMasterPage = mpContainer->GetPageObjectForToken(pData->second);
-    }
-    return pMasterPage;
-}
-
-
-
-
-/** Assemble a list of all slides of the document and pass it to
-    AssignMasterPageToPageList().
-*/
-void MasterPagesSelector::AssignMasterPageToAllSlides (SdPage* pMasterPage)
-{
-    do
-    {
-        if (pMasterPage == NULL)
-            break;
-
-        sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
-        if (nPageCount == 0)
-            break;
-
-        // Get a list of all pages.  As a little optimization we only
-        // include pages that do not already have the given master page
-        // assigned.
-        String sFullLayoutName (pMasterPage->GetLayoutName());
-        ::sd::slidesorter::SharedPageSelection pPageList (
-            new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
-        for (sal_uInt16 nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
-        {
-            SdPage* pPage = mrDocument.GetSdPage (nPageIndex, PK_STANDARD);
-            if (pPage != NULL
-                && pPage->GetLayoutName().CompareTo(sFullLayoutName)!=0)
-            {
-                pPageList->push_back (pPage);
-            }
-        }
-
-        AssignMasterPageToPageList(pMasterPage, pPageList);
-    }
-    while (false);
-}
-
-
-
-
-/** Assemble a list of the currently selected slides (selected in a visible
-    slide sorter) and pass it to AssignMasterPageToPageList().
-*/
-void MasterPagesSelector::AssignMasterPageToSelectedSlides (
-    SdPage* pMasterPage)
-{
-    do
-    {
-        using namespace ::std;
-        using namespace ::sd::slidesorter;
-        using namespace ::sd::slidesorter::controller;
-
-        if (pMasterPage == NULL)
-            break;
-
-        // Find a visible slide sorter.
-        SlideSorterViewShell* pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
-        if (pSlideSorter == NULL)
-            break;
-
-        // Get a list of selected pages.
-        ::sd::slidesorter::SharedPageSelection pPageSelection = pSlideSorter->GetPageSelection();
-        if (pPageSelection->empty())
-            break;
-
-        AssignMasterPageToPageList(pMasterPage, pPageSelection);
-
-        // Restore the previous selection.
-        pSlideSorter->SetPageSelection(pPageSelection);
-    }
-    while (false);
-}
-
-
-
-
-void MasterPagesSelector::AssignMasterPageToPageList (
-    SdPage* pMasterPage,
-    const ::sd::slidesorter::SharedPageSelection& rPageList)
-{
-    DocumentHelper::AssignMasterPageToPageList(mrDocument, pMasterPage, rPageList);
-}
-
-
-
-
-void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    switch (rEvent.meEventType)
-    {
-        case MasterPageContainerChangeEvent::SIZE_CHANGED:
-            mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
-            UpdateAllPreviews();
-            break;
-
-        case MasterPageContainerChangeEvent::PREVIEW_CHANGED:
-        {
-            int nIndex (GetIndexForToken(rEvent.maChildToken));
-            if (nIndex >= 0)
-            {
-                mpPageSet->SetItemImage (
-                    (sal_uInt16)nIndex,
-                    mpContainer->GetPreviewForToken(rEvent.maChildToken));
-                mpPageSet->Invalidate(mpPageSet->GetItemRect((sal_uInt16)nIndex));
-            }
-        }
-        break;
-
-        case MasterPageContainerChangeEvent::DATA_CHANGED:
-        {
-            InvalidateItem(rEvent.maChildToken);
-            Fill();
-        }
-        break;
-
-		default:
-			break;
-   }
-}
-
-
-
-
-MasterPagesSelector::UserData* MasterPagesSelector::CreateUserData (
-    int nIndex,
-    MasterPageContainer::Token aToken) const
-{
-    return new UserData(nIndex,aToken);
-}
-
-
-
-
-MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    if (nIndex>0 && nIndex<=mpPageSet->GetItemCount())
-        return reinterpret_cast<UserData*>(mpPageSet->GetItemData((sal_uInt16)nIndex));
-    else
-        return NULL;
-}
-
-
-
-
-void MasterPagesSelector::SetUserData (int nIndex, UserData* pData)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    if (nIndex>0 && nIndex<=mpPageSet->GetItemCount())
-    {
-        UserData* pOldData = GetUserData(nIndex);
-        if (pOldData!=NULL && pOldData!=pData)
-            delete pOldData;
-        mpPageSet->SetItemData((sal_uInt16)nIndex, pData);
-    }
-}
-
-
-
-
-bool MasterPagesSelector::IsResizable (void)
-{
-    return false;
-}
-
-
-
-
-::Window* MasterPagesSelector::GetWindow (void)
-{
-    return mpPageSet.get();
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetMinimumWidth (void)
-{
-    return mpContainer->GetPreviewSizePixel().Width() + 2*3;
-}
-
-
-
-
-void MasterPagesSelector::UpdateSelection (void)
-{
-}
-
-
-
-
-void MasterPagesSelector::Execute (SfxRequest& rRequest)
-{
-	switch (rRequest.GetSlot())
-    {
-        case SID_TP_APPLY_TO_ALL_SLIDES:
-            mrBase.SetBusyState (true);
-            AssignMasterPageToAllSlides (GetSelectedMasterPage());
-            mrBase.SetBusyState (false);
-            break;
-
-        case SID_TP_APPLY_TO_SELECTED_SLIDES:
-            mrBase.SetBusyState (true);
-            AssignMasterPageToSelectedSlides (GetSelectedMasterPage());
-            mrBase.SetBusyState (false);
-            break;
-
-        case SID_TP_USE_FOR_NEW_PRESENTATIONS:
-            DBG_ASSERT (false, 
-                "Using slides as default for new presentations"
-                " is not yet implemented");
-            break;
-
-        case SID_TP_SHOW_SMALL_PREVIEW:
-        case SID_TP_SHOW_LARGE_PREVIEW:
-        {
-            mrBase.SetBusyState (true);
-            mpContainer->SetPreviewSize(
-                rRequest.GetSlot()==SID_TP_SHOW_SMALL_PREVIEW
-                ? MasterPageContainer::SMALL
-                : MasterPageContainer::LARGE);
-            mrBase.SetBusyState (false);
-            break;
-        }
-
-        case SID_TP_EDIT_MASTER:
-        {
-            using namespace ::com::sun::star;
-            uno::Reference<drawing::XDrawPage> xSelectedMaster (
-                GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY);
-            SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
-            if (pViewFrame != NULL && xSelectedMaster.is())
-            {
-                SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-                if (pDispatcher != NULL)
-                {
-                    sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
-                    pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON);
-                    mpPageSet->SelectItem (nIndex);
-                    mrBase.GetDrawController().setCurrentPage(xSelectedMaster);
-                }
-            }
-            break;
-        }
-
-        case SID_CUT:
-        case SID_COPY:
-        case SID_PASTE:
-            // Cut, copy, and paste are not supported and thus are ignored.
-            break;
-    }
-}
-
-
-
-
-void MasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
-    if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL)
-        rItemSet.DisableItem (SID_TP_SHOW_SMALL_PREVIEW);
-    else
-        rItemSet.DisableItem (SID_TP_SHOW_LARGE_PREVIEW);
-
-    // Cut and paste is not supported so do not show the menu entries.
-    rItemSet.DisableItem (SID_CUT);
-    rItemSet.DisableItem (SID_COPY);
-    rItemSet.DisableItem (SID_PASTE);
-}
-
-
-
-
-void MasterPagesSelector::SetItem (
-    sal_uInt16 nIndex,
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    RemoveTokenToIndexEntry(nIndex,aToken);
-
-    if (nIndex > 0)
-    {
-        if (aToken != MasterPageContainer::NIL_TOKEN)
-        {
-            Image aPreview (mpContainer->GetPreviewForToken(aToken));
-            MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken));
-
-            if (aPreview.GetSizePixel().Width()>0)
-            {
-                if (mpPageSet->GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND)
-                {
-                    mpPageSet->SetItemImage(nIndex,aPreview);
-                    mpPageSet->SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken));
-                }
-                else
-                {
-                    mpPageSet->InsertItem (
-                        nIndex,
-                        aPreview,
-                        mpContainer->GetPageNameForToken(aToken),
-                        nIndex);
-                }
-                SetUserData(nIndex, CreateUserData(nIndex,aToken));
-
-                AddTokenToIndexEntry(nIndex,aToken);
-            }
-
-            if (eState == MasterPageContainer::PS_CREATABLE)
-                mpContainer->RequestPreview(aToken);
-        }
-        else
-        {
-            mpPageSet->RemoveItem(nIndex);
-        }
-    }
-  
-}
-
-
-
-
-void MasterPagesSelector::AddTokenToIndexEntry (
-    sal_uInt16 nIndex,
-    MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    maTokenToValueSetIndex[aToken] = nIndex;
-}
-
-
-
-
-void MasterPagesSelector::RemoveTokenToIndexEntry (
-    sal_uInt16 nIndex,
-    MasterPageContainer::Token aNewToken)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    UserData* pData = GetUserData(nIndex);
-    if (pData != NULL)
-    {
-        // Get the token that the index pointed to previously.
-        MasterPageContainer::Token aOldToken (pData->second);
-
-        if (aNewToken != aOldToken
-            && nIndex == GetIndexForToken(aOldToken))
-        {
-            maTokenToValueSetIndex[aOldToken] = 0;
-        }
-    }
-}
-
-
-
-
-void MasterPagesSelector::InvalidatePreview (const SdPage* pPage)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
-    {
-        UserData* pData = GetUserData(nIndex);
-        if (pData != NULL)
-        {
-            MasterPageContainer::Token aToken (pData->second);
-            if (pPage == mpContainer->GetPageObjectForToken(aToken,false))
-            {
-                mpContainer->InvalidatePreview(aToken);
-                mpContainer->RequestPreview(aToken);
-                break;
-            }
-        }
-    }
-}
-
-void MasterPagesSelector::UpdateAllPreviews (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-    
-    for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
-    {
-        UserData* pData = GetUserData(nIndex);
-        if (pData != NULL)
-        {
-            MasterPageContainer::Token aToken (pData->second);
-            mpPageSet->SetItemImage(
-                nIndex,
-                mpContainer->GetPreviewForToken(aToken));
-            if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE)
-                mpContainer->RequestPreview(aToken);
-        }
-    }
-    mpPageSet->Rearrange(true);
-}
-
-
-
-
-void MasterPagesSelector::ClearPageSet (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
-    {
-        UserData* pData = GetUserData(nIndex);
-        if (pData != NULL)
-            delete pData;
-    }
-    mpPageSet->Clear();
-}
-
-
-
-
-void MasterPagesSelector::SetHelpId( const rtl::OString& aId )
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-	mpPageSet->SetHelpId( aId );
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    TokenToValueSetIndex::const_iterator iIndex (maTokenToValueSetIndex.find(aToken));
-    if (iIndex != maTokenToValueSetIndex.end())
-        return iIndex->second;
-    else
-        return -1;
-}
-
-
-
-
-void MasterPagesSelector::Clear (void)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    ClearPageSet();
-}
-
-
-
-
-void MasterPagesSelector::InvalidateItem (MasterPageContainer::Token aToken)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    ItemList::iterator iItem;
-    for (iItem=maCurrentItemList.begin(); iItem!=maCurrentItemList.end(); ++iItem)
-    {
-        if (*iItem == aToken)
-        {
-            *iItem = MasterPageContainer::NIL_TOKEN;
-            break;
-        }
-    }
-}
-
-
-
-
-void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList)
-{
-    const ::osl::MutexGuard aGuard (maMutex);
-
-    ItemList::const_iterator iNewItem (pNewItemList->begin());
-    ItemList::const_iterator iCurrentItem (maCurrentItemList.begin());
-    ItemList::const_iterator iNewEnd (pNewItemList->end());
-    ItemList::const_iterator iCurrentEnd (maCurrentItemList.end());
-    sal_uInt16 nIndex (1);
-
-    // Update existing items.
-    for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex)
-    {
-        if (*iNewItem != *iCurrentItem)
-        {
-            SetItem(nIndex,*iNewItem);
-        }
-    }
-    
-    // Append new items.
-    for ( ; iNewItem!=iNewEnd; ++iNewItem,++nIndex)
-    {
-        SetItem(nIndex,*iNewItem);
-    }
-    
-    // Remove trailing items.
-    for ( ; iCurrentItem!=iCurrentEnd; ++iCurrentItem,++nIndex)
-    {
-        SetItem(nIndex,MasterPageContainer::NIL_TOKEN);
-    }
-
-    maCurrentItemList.swap(*pNewItemList);
-    
-    mpPageSet->Rearrange();
-    if (GetParentNode() != NULL)
-        GetParentNode()->RequestResize();
-}
-
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx b/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
deleted file mode 100644
index cabb2cf..0000000
--- a/main/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
-#define SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-#include "MasterPageContainer.hxx"
-#include "SlideSorterViewShell.hxx"
-
-#include "pres.hxx"
-#include <sfx2/shell.hxx>
-#include <vcl/image.hxx>
-#include "glob.hxx"
-#include <osl/mutex.hxx>
-
-#include <queue>
-
-class MouseEvent;
-class SdDrawDocument;
-class SdPage;
-class SfxModule;
-
-namespace sd { 
-class DrawViewShell;
-class TemplateEntry;
-class TemplateDir;
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class PreviewValueSet;
-
-/** Base class of a menu that lets the user select from a list of
-    templates or designs that are loaded from files.
-*/
-class MasterPagesSelector
-    : public TreeNode,
-      public SfxShell
-{
-public:
-    TYPEINFO();
-    SFX_DECL_INTERFACE(SD_IF_SDMASTERPAGESSELECTOR)
-
-    MasterPagesSelector (
-        TreeNode* pParent,
-        SdDrawDocument& rDocument,
-        ViewShellBase& rBase,
-        const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
-    virtual ~MasterPagesSelector (void);
-
-    virtual void LateInit (void);
-
-    /** Return the height that this control needs to show all of its lines.
-    */
-    long GetRequiredHeight (int nWidth) const;
-
-    /** The given master page, either the master page of a slide or a notes
-        page, is cloned and inserted into mrDocument.  The necessary styles
-        are copied as well.
-    */
-    static SdPage* AddMasterPage (
-        SdDrawDocument* pTargetDocument,
-        SdPage* pMasterPage,
-        sal_uInt16 nInsertionIndex);
-
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual bool IsResizable (void);
-    virtual ::Window* GetWindow (void);
-    virtual sal_Int32 GetMinimumWidth (void);
-
-    virtual void Execute (SfxRequest& rRequest);
-    virtual void GetState (SfxItemSet& rItemSet);
-
-    /** Update the selection of previews according to whatever
-        influences them appart from mouse and keyboard.  If, for
-        example, the current page of the main pane changes, then call
-        this method at the CurrentMasterPagesSelector to select the
-        previews of the master pages that are assigned to the new
-        current page.
-
-        The default implementation of this method ignores the call. This is
-        used by e.g. the RecentMasterPagesSelector because it does not show
-        the currently used master pages by default and thus is not
-        influenced by its changes.
-    */
-    virtual void UpdateSelection (void);
-
-    void FillPageSet (void);
-
-    /** Make the selector empty.  This method clear the value set from any
-        entries. Overload this method to add functionality, especially to
-        destroy objects set as data items at the value set.
-    */
-    void ClearPageSet (void);
-
-    using SfxShell::SetHelpId;
-	void SetHelpId( const rtl::OString& aId );
-
-    /** Mark the preview that belongs to the given index as not up-to-date
-        anymore with respect to page content or preview size.
-        The implementation of this method will either sunchronously or
-        asynchronously call UpdatePreview().
-        @param nIndex
-            Index into the value set control that is used for displaying the
-            previews.
-    */
-    void InvalidatePreview (const SdPage* pPage);
-
-    void UpdateAllPreviews (void);
-
-protected:
-    mutable ::osl::Mutex maMutex;
-    ::boost::shared_ptr<MasterPageContainer> mpContainer;
-
-    SdDrawDocument& mrDocument;
-    ::std::auto_ptr<PreviewValueSet> mpPageSet;
-    bool mbSmallPreviewSize;
-    ViewShellBase& mrBase;
-    /** Slot that is executed as default action when the left mouse button is
-        clicked over a master page.
-    */
-	sal_uInt16 mnDefaultClickAction;
-    /** Pages with pointers in this queue have their previews updated
-        eventually.  Filled by InvalidatePreview() and operated upon by
-        UpdatePreviews(). 
-    */
-    ::std::queue<sal_uInt16> maPreviewUpdateQueue;
-
-    virtual SdPage* GetSelectedMasterPage (void);
-
-    /** Assign the given master page to all slides of the document.
-        @param pMasterPage
-            The master page to assign to all slides.
-    */
-    void AssignMasterPageToAllSlides (SdPage* pMasterPage);
-
-    /** Assign the given master page to all slides that are selected in a
-        slide sorter that is displayed in the lef or center pane.  When both
-        panes display a slide sorter then the one in the center pane is
-        used.
-    */
-    void AssignMasterPageToSelectedSlides (SdPage* pMasterPage);
-
-    virtual void AssignMasterPageToPageList (
-        SdPage* pMasterPage,
-        const ::sd::slidesorter::SharedPageSelection& rPageList);
-
-    virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
-
-    typedef ::std::pair<int, MasterPageContainer::Token> UserData;
-    UserData* CreateUserData (int nIndex, MasterPageContainer::Token aToken) const;
-    UserData* GetUserData (int nIndex) const;
-    void SetUserData (int nIndex, UserData* pData);
-
-    virtual sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const;
-    typedef ::std::vector<MasterPageContainer::Token> ItemList;
-    void UpdateItemList (::std::auto_ptr<ItemList> pList);
-    void Clear (void);
-    /** Invalidate the specified item so that on the next Fill() this item
-        is updated.
-    */
-    void InvalidateItem (MasterPageContainer::Token aToken);
-
-    // For every item in the ValueSet we store its associated token.  This
-    // allows a faster access and easier change tracking.
-    ItemList maCurrentItemList;
-    typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex;
-    TokenToValueSetIndex maTokenToValueSetIndex;
-
-    ItemList maLockedMasterPages;
-    /** Lock master pages in the given list and release locks that where
-        previously aquired.
-    */
-    void UpdateLocks (const ItemList& rItemList);
-
-    void Fill (void);
-    virtual void Fill (ItemList& rItemList) = 0;
-
-    /** Give derived classes the oportunity to provide their own context
-        menu.  If they do then they probably have to provide their own
-        Execute() and GetState() methods as well.
-    */
-    virtual ResId GetContextMenuResId (void) const;
-
-private:
-    /** The offset between ValueSet index and MasterPageContainer::Token
-        last seen.  This value is used heuristically to speed up the lookup
-        of an index for a token.
-    */
-    DECL_LINK(ClickHandler, PreviewValueSet*);
-    DECL_LINK(RightClickHandler, MouseEvent*);
-    DECL_LINK(ContextMenuCallback, CommandEvent*);
-    DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*);
-    
-    void SetItem (
-        sal_uInt16 nIndex,
-        MasterPageContainer::Token aToken);
-    void AddTokenToIndexEntry (
-        sal_uInt16 nIndex,
-        MasterPageContainer::Token aToken);
-    void RemoveTokenToIndexEntry (
-        sal_uInt16 nIndex,
-        MasterPageContainer::Token aToken);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx b/main/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
deleted file mode 100644
index 96424cd..0000000
--- a/main/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "PreviewValueSet.hxx"
-#include <vcl/image.hxx>
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-PreviewValueSet::PreviewValueSet (TreeNode* pParent)
-    : ValueSet (pParent->GetWindow(), WB_TABSTOP),
-      mpParent(pParent),
-      maPreviewSize(10,10),
-      mnBorderWidth(3),
-      mnBorderHeight(3),
-      mnMaxColumnCount(-1)
-{
-	SetStyle (
-        GetStyle() 
-        & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET)
-        //        | WB_FLATVALUESET);
-        );
-
-	SetColCount(2);
-    //	SetLineCount(1);
-	SetExtraSpacing (2);
-}
-
-
-
-
-PreviewValueSet::~PreviewValueSet (void)
-{
-}
-
-
-
-
-void PreviewValueSet::SetPreviewSize (const Size& rSize)
-{
-    maPreviewSize = rSize;
-}
-
-
-
-
-void PreviewValueSet::SetRightMouseClickHandler (const Link& rLink)
-{
-    maRightMouseClickHandler = rLink;
-}
-
-
-
-
-void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent)
-{
-    if (rEvent.IsRight())
-        maRightMouseClickHandler.Call(reinterpret_cast<void*>(
-            &const_cast<MouseEvent&>(rEvent)));
-    else
-        ValueSet::MouseButtonDown (rEvent);
-
-}
-
-
-
-
-void PreviewValueSet::Paint (const Rectangle& rRect)
-{
-    SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
-
-    ValueSet::Paint (rRect);
-
-    SetBackground (Wallpaper());
-}
-
-
-
-
-void PreviewValueSet::Resize (void)
-{
-    ValueSet::Resize ();
-
-    Size aWindowSize (GetOutputSizePixel());
-    if (aWindowSize.Width()>0 && aWindowSize.Height()>0)
-    {
-        Rearrange();
-    }
-}
-
-
-
-
-void PreviewValueSet::Command (const CommandEvent& rEvent)
-{
-    switch (rEvent.GetCommand())
-    {
-        case COMMAND_CONTEXTMENU:
-        {
-            CommandEvent aNonConstEventCopy (rEvent);
-            maContextMenuCallback.Call(&aNonConstEventCopy);
-        }
-        break;
-            
-        default:
-            ValueSet::Command(rEvent);
-            break;
-    }
-}
-
-
-
-
-void PreviewValueSet::Rearrange (bool bForceRequestResize)
-{
-    sal_uInt16 nOldColumnCount (GetColCount());
-    sal_uInt16 nOldRowCount (GetLineCount());
-
-    sal_uInt16 nNewColumnCount (CalculateColumnCount (
-        GetOutputSizePixel().Width()));
-    sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount));
-
-    SetColCount(nNewColumnCount);
-    SetLineCount(nNewRowCount);
-
-    if (bForceRequestResize
-        || nOldColumnCount != nNewColumnCount
-        || nOldRowCount != nNewRowCount)
-        mpParent->RequestResize();
-}
-
-
-
-
-void PreviewValueSet::SetContextMenuCallback (const Link& rLink)
-{
-    maContextMenuCallback = rLink;
-}
-
-
-
-
-sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
-{
-    int nColumnCount = 0;
-    if (nWidth > 0)
-    {
-        nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth);
-        if (nColumnCount < 1)
-            nColumnCount = 1;
-        else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
-            nColumnCount = mnMaxColumnCount;
-    }
-    return (sal_uInt16)nColumnCount;
-}
-
-
-
-
-sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const
-{
-    int nRowCount = 0;
-    int nItemCount = GetItemCount();
-    if (nColumnCount > 0)
-    {
-        nRowCount = (nItemCount+nColumnCount-1) / nColumnCount;
-        if (nRowCount < 1)
-            nRowCount = 1;
-    }
-
-    return (sal_uInt16)nRowCount;
-}
-
-
-
-
-sal_Int32 PreviewValueSet::GetPreferredWidth (sal_Int32 nHeight)
-{
-    int nPreferredWidth (maPreviewSize.Width() + 2*mnBorderWidth);
-
-    // Get height of each row.
-    int nItemHeight (maPreviewSize.Height() + 2*mnBorderHeight);
-
-    // Calculate the row- and column count and from the later the preferred
-    // width.
-    int nRowCount = nHeight / nItemHeight;
-    if (nRowCount > 0)
-    {
-        int nColumnCount = (GetItemCount()+nRowCount-1) / nRowCount;
-        if (nColumnCount > 0)
-            nPreferredWidth = (maPreviewSize.Width() + 2*mnBorderWidth) 
-                * nColumnCount;
-    }
-
-    return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth)
-{
-    int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth)));
-    int nItemHeight (maPreviewSize.Height());
-    
-    return nRowCount * (nItemHeight + 2*mnBorderHeight);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx b/main/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
deleted file mode 100644
index 229d18c..0000000
--- a/main/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
-#define SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
-
-#include <svtools/valueset.hxx>
-
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Adapt the svtools valueset to the needs of the master page controlls.
-*/
-class PreviewValueSet
-    : public ValueSet
-{
-public:
-    PreviewValueSet (TreeNode* pParent);
-    ~PreviewValueSet (void);
-
-	void SetRightMouseClickHandler (const Link& rLink);
-	virtual void Paint (const Rectangle& rRect);
-    virtual void Resize (void);
-    
-    /** When a request for the display of a context menu is made to this
-        method then that request is forwarded via the ContextMenuCallback.
-        This way the owning class can handle the context menu without having
-        to be derived from this class.
-        Use SetContextMenuCallback to set or rest the handler.
-    */
-	virtual void Command (const CommandEvent& rEvent);
-
-    void SetPreviewSize (const Size& rSize);
-
-    sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
-    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-
-    /** Set the number of rows and columns according to the current number
-        of items.  Call this method when new items have been inserted.
-    */
-    void Rearrange (bool bForceRequestResize = false);
-
-    /** Set the callback function to which requests for context menus are
-        forewarded.  Call with an empty Link to reset the callback
-        function.
-    */
-    void SetContextMenuCallback (const Link& rLink);
-
-protected:
-    virtual void MouseButtonDown (const MouseEvent& rEvent);
-
-private:
-    Link maRightMouseClickHandler;
-    Link maContextMenuCallback;
-    TreeNode* mpParent;
-    Size maPreviewSize;
-    const int mnBorderWidth;
-    const int mnBorderHeight;
-    const int mnMaxColumnCount;
-    
-    sal_uInt16 CalculateColumnCount (int nWidth) const;
-    sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx b/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
deleted file mode 100644
index 105ba97..0000000
--- a/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
+++ /dev/null
@@ -1,155 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "RecentMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-
-#include "RecentlyUsedMasterPages.hxx"
-#include "MasterPageContainerProviders.hxx"
-#include "MasterPageObserver.hxx"
-#include "sdpage.hxx"
-#include "drawdoc.hxx"
-#include "app.hrc"
-#include <vcl/bitmap.hxx>
-#include <tools/color.hxx>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-RecentMasterPagesSelector::RecentMasterPagesSelector (
-    TreeNode* pParent,
-    SdDrawDocument& rDocument,
-    ViewShellBase& rBase,
-    const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
-    : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
-{
-	SetName (String(RTL_CONSTASCII_USTRINGPARAM("RecentMasterPagesSelector")));
-}
-
-
-
-
-RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
-{
-    RecentlyUsedMasterPages::Instance().RemoveEventListener (
-        LINK(this,RecentMasterPagesSelector,MasterPageListListener));
-}
-
-
-
-
-void RecentMasterPagesSelector::LateInit (void)
-{
-    MasterPagesSelector::LateInit();
-
-    MasterPagesSelector::Fill();
-    RecentlyUsedMasterPages::Instance().AddEventListener (
-        LINK(this,RecentMasterPagesSelector,MasterPageListListener));
-}
-
-
-
-
-IMPL_LINK(RecentMasterPagesSelector,MasterPageListListener, void*, EMPTYARG)
-{
-    MasterPagesSelector::Fill();
-    return 0;
-}
-
-
-
-
-void RecentMasterPagesSelector::Fill (ItemList& rItemList)
-{
-    // Create a set of names of the master pages used by the document.
-    MasterPageObserver::MasterPageNameSet aCurrentNames;
-    sal_uInt16 nMasterPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
-    sal_uInt16 nIndex;
-    for (nIndex=0; nIndex<nMasterPageCount; nIndex++)
-    {
-        SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
-        if (pMasterPage != NULL)
-            aCurrentNames.insert (pMasterPage->GetName());
-    }
-    MasterPageObserver::MasterPageNameSet::iterator aI;
-
-    // Insert the recently used master pages that are currently not used.
-    RecentlyUsedMasterPages& rInstance (RecentlyUsedMasterPages::Instance());
-    int nPageCount = rInstance.GetMasterPageCount();
-    for (nIndex=0; nIndex<nPageCount; nIndex++)
-    {
-        // Add an entry when a) the page is already known to the
-        // MasterPageContainer, b) the style name is empty, i.e. it has not yet
-        // been loaded (and thus can not be in use) or otherwise c) the
-        // style name is not currently in use.
-        MasterPageContainer::Token aToken (rInstance.GetTokenForIndex(nIndex));
-        if (aToken != MasterPageContainer::NIL_TOKEN)
-        {
-            String sStyleName (mpContainer->GetStyleNameForToken(aToken));
-            if (sStyleName.Len()==0 
-                || aCurrentNames.find(sStyleName) == aCurrentNames.end())
-            {
-                rItemList.push_back(aToken);
-            }
-        }
-    }
-}
-
-
-
-
-void RecentMasterPagesSelector::AssignMasterPageToPageList (
-    SdPage* pMasterPage,
-    const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
-	sal_uInt16 nSelectedItemId = mpPageSet->GetSelectItemId();
-    
-    MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList);
-
-    // Restore the selection.
-    if (mpPageSet->GetItemCount() > 0)
-    {
-        if (mpPageSet->GetItemCount() >= nSelectedItemId)
-            mpPageSet->SelectItem(nSelectedItemId);
-        else
-            mpPageSet->SelectItem(mpPageSet->GetItemCount());
-    }
-}
-
-
-
-
-void RecentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
-    MasterPagesSelector::GetState (rItemSet);
-    if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
-        rItemSet.DisableItem (SID_TP_EDIT_MASTER);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx b/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
deleted file mode 100644
index 6262c9d..0000000
--- a/main/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show the recently used master pages (that are not currently used).
-*/
-class RecentMasterPagesSelector
-    : public MasterPagesSelector
-{
-public:
-    RecentMasterPagesSelector (
-        TreeNode* pParent, 
-        SdDrawDocument& rDocument,
-        ViewShellBase& rBase,
-        const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
-    virtual ~RecentMasterPagesSelector (void);
-
-    virtual void LateInit (void);
-
-    virtual void GetState (SfxItemSet& rItemSet);
-
-protected:
-    DECL_LINK(MasterPageListListener, void*);
-    virtual void Fill (ItemList& rItemList);
-
-	using sd::toolpanel::controls::MasterPagesSelector::Fill;
-
-    /** Forward this call to the base class but save and restore the
-        currently selected item.
-        Assign the given master page to the list of pages.
-        @param pMasterPage
-            This master page will usually be a member of the list of all
-            available master pages as provided by the MasterPageContainer.
-        @param rPageList
-            The pages to which to assign the master page.  These pages may
-            be slides or master pages themselves.
-    */
-    virtual void AssignMasterPageToPageList (
-        SdPage* pMasterPage,
-        const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx b/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
deleted file mode 100644
index 8f7fcca..0000000
--- a/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
+++ /dev/null
@@ -1,497 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "RecentlyUsedMasterPages.hxx"
-#include "MasterPageObserver.hxx"
-#include "MasterPagesSelector.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "tools/ConfigurationAccess.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-
-#include <algorithm>
-#include <vector>
-
-#include <comphelper/processfactory.hxx>
-#include "unomodel.hxx"
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPages.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/PropertyState.hpp>
-#include <tools/urlobj.hxx>
-#include <unotools/confignode.hxx>
-#include <osl/doublecheckedlocking.h>
-#include <osl/getglobalmutex.hxx>
-
-using namespace ::std;
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-namespace {
-
-static const OUString& GetPathToImpressConfigurationRoot (void)
-{
-    static const OUString sPathToImpressConfigurationRoot (
-        RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Impress/"));
-    return sPathToImpressConfigurationRoot;
-}
-static const OUString& GetPathToSetNode (void)
-{
-    static const OUString sPathToSetNode(
-        RTL_CONSTASCII_USTRINGPARAM(
-            "MultiPaneGUI/ToolPanel/RecentlyUsedMasterPages"));
-    return sPathToSetNode;
-}
-
-
-class Descriptor
-{
-public:
-    ::rtl::OUString msURL;
-    ::rtl::OUString msName;
-    ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
-    Descriptor (const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
-        : msURL(rsURL),
-          msName(rsName),
-          maToken(::sd::toolpanel::controls::MasterPageContainer::NIL_TOKEN)
-    {}
-    Descriptor (::sd::toolpanel::controls::MasterPageContainer::Token aToken,
-        const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName)
-        : msURL(rsURL),
-          msName(rsName),
-          maToken(aToken)
-    {}
-    class TokenComparator
-    { public:
-        TokenComparator(::sd::toolpanel::controls::MasterPageContainer::Token aToken)
-            : maToken(aToken) {}
-        bool operator () (const Descriptor& rDescriptor)
-        { return maToken==rDescriptor.maToken; }
-    private: ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
-    };
-};
-
-} // end of anonymous namespace
-
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor>
-{
-public:
-    MasterPageList (void) {}
-};
-
-
-RecentlyUsedMasterPages* RecentlyUsedMasterPages::mpInstance = NULL;
-
-
-RecentlyUsedMasterPages&  RecentlyUsedMasterPages::Instance (void)
-{
-    if (mpInstance == NULL)
-    {
-        ::osl::GetGlobalMutex aMutexFunctor;
-        ::osl::MutexGuard aGuard (aMutexFunctor());
-        if (mpInstance == NULL)
-        {
-            RecentlyUsedMasterPages* pInstance = new RecentlyUsedMasterPages();
-            pInstance->LateInit();
-            SdGlobalResourceContainer::Instance().AddResource (
-                ::std::auto_ptr<SdGlobalResource>(pInstance));
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-            mpInstance = pInstance;
-        }
-    }
-    else {
-        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-    }
-    
-    return *mpInstance;
-}
-
-
-
-
-RecentlyUsedMasterPages::RecentlyUsedMasterPages (void)
-    : maListeners(),
-      mpMasterPages(new MasterPageList()),
-      mnMaxListSize(8),
-      mpContainer(new MasterPageContainer())
-{
-}
-
-
-
-
-RecentlyUsedMasterPages::~RecentlyUsedMasterPages (void)
-{
-    Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
-    mpContainer->RemoveChangeListener(aLink);
-    
-    MasterPageObserver::Instance().RemoveEventListener(
-        LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
-}
-
-
-
-
-void RecentlyUsedMasterPages::LateInit (void)
-{
-    Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
-    mpContainer->AddChangeListener(aLink);
-    
-    LoadPersistentValues ();
-    MasterPageObserver::Instance().AddEventListener(
-        LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
-}
-
-
-
-
-void RecentlyUsedMasterPages::LoadPersistentValues (void)
-{
-    try
-    {
-        do
-        {
-            tools::ConfigurationAccess aConfiguration (
-                GetPathToImpressConfigurationRoot(),
-                tools::ConfigurationAccess::READ_ONLY);
-            Reference<container::XNameAccess> xSet (
-                aConfiguration.GetConfigurationNode(GetPathToSetNode()),
-                UNO_QUERY);
-            if ( ! xSet.is())
-                break;
-
-            const String sURLMemberName (OUString::createFromAscii("URL"));
-            const String sNameMemberName (OUString::createFromAscii("Name"));
-            OUString sURL;
-            OUString sName;
-
-            // Read the names and URLs of the master pages.
-            Sequence<OUString> aKeys (xSet->getElementNames());
-            mpMasterPages->clear();
-            mpMasterPages->reserve(aKeys.getLength());
-            for (int i=0; i<aKeys.getLength(); i++)
-            {
-                Reference<container::XNameAccess> xSetItem (
-                    xSet->getByName(aKeys[i]), UNO_QUERY);
-                if (xSetItem.is())
-                {
-                    Any aURL (xSetItem->getByName(sURLMemberName));
-                    Any aName (xSetItem->getByName(sNameMemberName));
-                    aURL >>= sURL;
-                    aName >>= sName;
-                    SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
-                        MasterPageContainer::TEMPLATE,
-                        -1,
-                        sURL,
-                        String(),
-                        sName,
-                        false,
-                        ::boost::shared_ptr<PageObjectProvider>(
-                            new TemplatePageObjectProvider(sURL)),
-                        ::boost::shared_ptr<PreviewProvider>(
-                            new TemplatePreviewProvider(sURL))));
-                    // For user supplied templates we use a different
-                    // preview provider: The preview in the document shows
-                    // not only shapes on the master page but also shapes on
-                    // the foreground.  This is misleading and therefore
-                    // these previews are discarded and created directly
-                    // from the page objects.
-                    if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
-                        pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
-                            new PagePreviewProvider());
-                    MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor));
-                    mpMasterPages->push_back(Descriptor(aToken,sURL,sName));
-                }
-            }
-
-            ResolveList();
-        }
-        while (false);
-    }
-    catch (Exception&)
-    {
-        // Ignore exception.
-    }
-}
-
-
-
-
-void RecentlyUsedMasterPages::SavePersistentValues (void)
-{
-    try
-    {
-        do
-        {
-            tools::ConfigurationAccess aConfiguration (
-                GetPathToImpressConfigurationRoot(),
-                tools::ConfigurationAccess::READ_WRITE);
-            Reference<container::XNameContainer> xSet (
-                aConfiguration.GetConfigurationNode(GetPathToSetNode()),
-                UNO_QUERY);
-            if ( ! xSet.is())
-                break;
-
-            // Clear the set.
-            Sequence<OUString> aKeys (xSet->getElementNames());
-            sal_Int32 i;
-            for (i=0; i<aKeys.getLength(); i++)
-                xSet->removeByName (aKeys[i]);
-
-            // Fill it with the URLs of this object.
-            const String sURLMemberName (OUString::createFromAscii("URL"));
-            const String sNameMemberName (OUString::createFromAscii("Name"));
-            Any aValue;
-            Reference<lang::XSingleServiceFactory> xChildFactory (
-                xSet, UNO_QUERY);
-            if ( ! xChildFactory.is())
-                break;
-            MasterPageList::const_iterator iDescriptor;
-            sal_Int32 nIndex(0);
-            for (iDescriptor=mpMasterPages->begin();
-                 iDescriptor!=mpMasterPages->end();
-                 ++iDescriptor,++nIndex)
-            {
-                // Create new child.
-                OUString sKey (OUString::createFromAscii("index_"));
-                sKey += OUString::valueOf(nIndex);
-                Reference<container::XNameReplace> xChild(
-                    xChildFactory->createInstance(), UNO_QUERY);
-                if (xChild.is())
-                {
-                    xSet->insertByName (sKey, makeAny(xChild));
-
-                    aValue <<= OUString(iDescriptor->msURL);
-                    xChild->replaceByName (sURLMemberName, aValue);
-
-                    aValue <<= OUString(iDescriptor->msName);
-                    xChild->replaceByName (sNameMemberName, aValue);
-                }
-            }
-
-            // Write the data back to disk.
-            aConfiguration.CommitChanges();
-        }
-        while (false);
-    }
-    catch (Exception&)
-    {
-        // Ignore exception.
-    }
-}
-
-
-
-
-void RecentlyUsedMasterPages::AddEventListener (const Link& rEventListener)
-{
-    if (::std::find (
-        maListeners.begin(),
-        maListeners.end(),
-        rEventListener) == maListeners.end())
-    {
-        maListeners.push_back (rEventListener);
-    }
-}
-
-
-
-
-void RecentlyUsedMasterPages::RemoveEventListener (const Link& rEventListener)
-{
-    maListeners.erase (
-        ::std::find (
-            maListeners.begin(),
-            maListeners.end(),
-            rEventListener));
-}
-
-
-
-
-int RecentlyUsedMasterPages::GetMasterPageCount (void) const
-{
-    return mpMasterPages->size();
-}
-
-
-
-
-MasterPageContainer::Token RecentlyUsedMasterPages::GetTokenForIndex (sal_uInt32 nIndex) const
-{
-    if(nIndex<mpMasterPages->size())
-        return (*mpMasterPages)[nIndex].maToken;
-    else
-        return MasterPageContainer::NIL_TOKEN;
-}
-
-
-
-
-void RecentlyUsedMasterPages::SendEvent (void)
-{
-    ::std::vector<Link>::iterator aLink (maListeners.begin());
-    ::std::vector<Link>::iterator aEnd (maListeners.end());
-    while (aLink!=aEnd)
-    {
-        aLink->Call (NULL);
-        ++aLink;
-    }
-}
-
-
-
-
-IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener,
-    MasterPageObserverEvent*, pEvent)
-{
-    switch (pEvent->meType)
-    {
-        case MasterPageObserverEvent::ET_MASTER_PAGE_ADDED:
-        case MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS:
-            AddMasterPage(
-                mpContainer->GetTokenForStyleName(pEvent->mrMasterPageName));
-            break;
-
-        case MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED:
-            // Do not change the list of recently master pages (the deleted
-            // page was recently used) but tell the listeners.  They may want
-            // to update their lists.
-            SendEvent();
-            break;
-    }
-    return 0;
-}
-
-
-
-
-IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener,
-    MasterPageContainerChangeEvent*, pEvent)
-{
-    if (pEvent != NULL)
-        switch (pEvent->meEventType)
-        {
-            case MasterPageContainerChangeEvent::CHILD_ADDED:
-            case MasterPageContainerChangeEvent::CHILD_REMOVED:
-            case MasterPageContainerChangeEvent::INDEX_CHANGED:
-            case MasterPageContainerChangeEvent::INDEXES_CHANGED:
-                ResolveList();
-                break;
-
-            default:
-                // Ignored.
-                break;
-        }
-    return 0;
-}
-
-
-
-
-void RecentlyUsedMasterPages::AddMasterPage (
-    MasterPageContainer::Token aToken,
-    bool bMakePersistent)
-{
-    // For the page to be inserted the token has to be valid and the page
-    // has to have a valid URL.  This excludes master pages that do not come
-    // from template files.
-    if (aToken != MasterPageContainer::NIL_TOKEN
-        && mpContainer->GetURLForToken(aToken).Len()>0)
-    {
-
-        MasterPageList::iterator aIterator (
-            ::std::find_if(mpMasterPages->begin(),mpMasterPages->end(),
-                Descriptor::TokenComparator(aToken)));
-        if (aIterator != mpMasterPages->end())
-        {
-            // When an entry for the given token already exists then remove
-            // it now and insert it later at the head of the list.
-            mpMasterPages->erase (aIterator);
-        }
-
-        mpMasterPages->insert(mpMasterPages->begin(),
-            Descriptor(
-                aToken,
-                mpContainer->GetURLForToken(aToken),
-                mpContainer->GetStyleNameForToken(aToken)));
-
-        // Shorten list to maximal size.
-        while (mpMasterPages->size() > mnMaxListSize)
-        {
-            mpMasterPages->pop_back ();
-        }
-
-        if (bMakePersistent)
-            SavePersistentValues ();
-        SendEvent();
-    }
-}
-
-
-
-
-void RecentlyUsedMasterPages::ResolveList (void)
-{
-    bool bNotify (false);
-
-    MasterPageList::iterator iDescriptor;
-    for (iDescriptor=mpMasterPages->begin(); iDescriptor!=mpMasterPages->end(); ++iDescriptor)
-    {
-        if (iDescriptor->maToken == MasterPageContainer::NIL_TOKEN)
-        {
-            MasterPageContainer::Token aToken (mpContainer->GetTokenForURL(iDescriptor->msURL));
-            iDescriptor->maToken = aToken;
-            if (aToken != MasterPageContainer::NIL_TOKEN)
-                bNotify = true;
-        }
-        else
-        {
-            if ( ! mpContainer->HasToken(iDescriptor->maToken))
-            {
-                iDescriptor->maToken = MasterPageContainer::NIL_TOKEN;
-                bNotify = true;
-            }
-        }
-    }
-
-    if (bNotify)
-        SendEvent();
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx b/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
deleted file mode 100644
index 6733175..0000000
--- a/main/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
-#define SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
-
-#include "tools/SdGlobalResourceContainer.hxx"
-#include <osl/mutex.hxx>
-#include <tools/link.hxx>
-#include <vcl/image.hxx>
-#include <vector>
-#include <tools/string.hxx>
-
-#include "DrawDocShell.hxx"
-#include "MasterPageContainer.hxx"
-#include <com/sun/star/uno/XInterface.hpp>
-
-class SdPage;
-
-namespace sd {
-class MasterPageObserverEvent;
-}
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** This singleton holds a list of the most recently used master pages.
-*/
-class RecentlyUsedMasterPages
-    : public SdGlobalResource
-{
-public:
-    /** Return the single instance of this class.
-    */
-    static RecentlyUsedMasterPages& Instance (void);
-
-    void AddEventListener (const Link& rEventListener);
-    void RemoveEventListener (const Link& rEventListener);
-    
-    int GetMasterPageCount (void) const;
-    MasterPageContainer::Token GetTokenForIndex (sal_uInt32 nIndex) const;
-
-private:
-    /** The single instance of this class.  It is created on demand when
-        Instance() is called for the first time.
-    */
-    static RecentlyUsedMasterPages* mpInstance;
-
-    ::std::vector<Link> maListeners;
-
-    class MasterPageList;
-    ::std::auto_ptr<MasterPageList> mpMasterPages;
-    unsigned long int mnMaxListSize;
-    ::boost::shared_ptr<MasterPageContainer> mpContainer;
-    
-    RecentlyUsedMasterPages (void);
-    virtual ~RecentlyUsedMasterPages (void);
-
-    /** Call this method after a new object has been created.
-    */
-    void LateInit (void);
-
-    /// The copy constructor is not implemented.  Do not use!
-    RecentlyUsedMasterPages (const RecentlyUsedMasterPages&);
-
-    /// The assignment operator is not implemented.  Do not use!
-    RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&);
-
-    void SendEvent (void);
-    DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*);
-    DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*);
-
-    /** Add a descriptor for the specified master page to the end of the
-        list of most recently used master pages.  When the page is already a
-        member of that list the associated descriptor is moved to the end of
-        the list to make it the most recently used entry.
-        @param bMakePersistent
-            When <TRUE/> is given then the new list of recently used master
-            pages is written back into the configuration to make it
-            persistent.  Giving <FALSE/> to ommit this is used while loading
-            the persistent list from the configuration.
-    */
-    void AddMasterPage (
-        MasterPageContainer::Token aToken,
-        bool bMakePersistent = true);
-
-    /** Load the list of recently used master pages from the registry where
-        it was saved to make it persistent.
-    */
-    void LoadPersistentValues (void);
-
-    /** Save the list of recently used master pages to the registry to make
-        it presistent.
-    */
-    void SavePersistentValues (void);
-
-    void ResolveList (void);
-};
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
deleted file mode 100644
index b336962..0000000
--- a/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-#include "SlideTransitionPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-
-namespace sd
-{
-
-	class ViewShellBase;
-    extern ::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase );
-
-namespace toolpanel { namespace controls {
-
-
-
-SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell)
-    :SubToolPanel( i_rParentWindow )
-    ,maPreferredSize( 100, 200 )
-    ,m_pPanelViewShell( &i_rToolPanelShell )
-{
-	mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase() );
-	mpWrappedControl->Show();
-}
-
-SlideTransitionPanel::~SlideTransitionPanel()
-{
-	delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
-    return std::auto_ptr< ControlFactory >(
-        new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* SlideTransitionPanel::GetShellManager()
-{
-    if ( m_pPanelViewShell )
-        return &m_pPanelViewShell->GetSubShellManager();
-    return SubToolPanel::GetShellManager();
-}
-
-Size SlideTransitionPanel::GetPreferredSize()
-{
-    return maPreferredSize;
-}
-sal_Int32 SlideTransitionPanel::GetPreferredWidth(sal_Int32 )
-{
-    return maPreferredSize.Width();
-}
-sal_Int32 SlideTransitionPanel::GetPreferredHeight(sal_Int32 )
-{
-    return maPreferredSize.Height();
-}
-::Window* SlideTransitionPanel::GetWindow()
-{
-    return mpWrappedControl;
-}
-bool SlideTransitionPanel::IsResizable()
-{
-    return true;
-}
-bool SlideTransitionPanel::IsExpandable() const
-{
-    return true;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> SlideTransitionPanel::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    if (GetWindow() != NULL)
-        return GetWindow()->GetAccessible();
-    else
-        return NULL;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
deleted file mode 100644
index 37ecff8..0000000
--- a/main/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class ControlFactory;
-class TreeNode;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class SlideTransitionPanel
-    : public SubToolPanel
-{
-public:
-    SlideTransitionPanel (
-        Window& i_rParentWindow,
-        ToolPanelViewShell& i_rToolPanelShell);
-    virtual ~SlideTransitionPanel (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
-    // TreeNode overridables
-    virtual TaskPaneShellManager* GetShellManager();
-
-    // ILayoutableWindow overridables
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual ::Window* GetWindow (void);
-    virtual bool IsResizable (void);
-    virtual bool IsExpandable (void) const;
-
-    virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::accessibility::XAccessible>& rxParent);
-
-	using Window::GetWindow;
-
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-    ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/main/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
deleted file mode 100644
index c4c7454..0000000
--- a/main/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "TableDesignPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-
-namespace sd
-{ 
-	
-	class ViewShellBase;
-	extern ::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase );
-	
-namespace toolpanel { namespace controls {
-
-
-TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell )
-    :SubToolPanel( i_rParentWindow )
-    ,m_pPanelViewShell( &i_rPanelViewShell )
-{
-	mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() );
-	mpWrappedControl->Show();
-}
-
-TableDesignPanel::~TableDesignPanel()
-{
-	delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
-    return std::auto_ptr< ControlFactory >(
-        new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* TableDesignPanel::GetShellManager()
-{
-    if ( m_pPanelViewShell )
-        return &m_pPanelViewShell->GetSubShellManager();
-    return SubToolPanel::GetShellManager();
-}
-
-Size TableDesignPanel::GetPreferredSize()
-{
-    return maPreferredSize;
-}
-sal_Int32 TableDesignPanel::GetPreferredWidth(sal_Int32 )
-{
-    return maPreferredSize.Width();
-}
-sal_Int32 TableDesignPanel::GetPreferredHeight(sal_Int32 )
-{
-    return maPreferredSize.Height();
-}
-::Window* TableDesignPanel::GetWindow()
-{
-    return mpWrappedControl;
-}
-bool TableDesignPanel::IsResizable()
-{
-    return true;
-}
-bool TableDesignPanel::IsExpandable() const
-{
-    return true;
-}
-
-::com::sun::star::uno::Reference<
-    ::com::sun::star::accessibility::XAccessible> TableDesignPanel::CreateAccessibleObject (
-        const ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible>& )
-{
-    if (GetWindow() != NULL)
-        return GetWindow()->GetAccessible();
-    else
-        return NULL;
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
diff --git a/main/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/main/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
deleted file mode 100644
index facba75..0000000
--- a/main/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************
- * 
- * 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 SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-class ControlFactory;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class TableDesignPanel
-    : public SubToolPanel
-{
-public:
-    TableDesignPanel (
-        ::Window& i_rParentWindow, 
-        ToolPanelViewShell& i_rPanelViewShell);
-    virtual ~TableDesignPanel (void);
-
-    static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
-    // TreeNode overridables
-    virtual TaskPaneShellManager* GetShellManager();
-
-    // ILayoutableWindow overridables
-    virtual Size GetPreferredSize (void);
-    virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-    virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-    virtual ::Window* GetWindow (void);
-    virtual bool IsResizable (void);
-    virtual bool IsExpandable (void) const;
-
-    virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::accessibility::XAccessible>& rxParent);
-
-	using Window::GetWindow;
-private:
-    Size maPreferredSize;
-    ::Window* mpWrappedControl;
-    ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
diff --git a/main/sd/source/ui/toolpanel/controls/makefile.mk b/main/sd/source/ui/toolpanel/controls/makefile.mk
deleted file mode 100644
index 50526a2..0000000
--- a/main/sd/source/ui/toolpanel/controls/makefile.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-#**************************************************************
-#  
-#  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.
-#  
-#**************************************************************
-
-
-
-PRJ=..$/..$/..$/..
-
-PROJECTPCH=sd
-PROJECTPCHSOURCE=$(PRJ)$/util$/sd
-PRJNAME=sd
-TARGET=tpcontrols
-ENABLE_EXCEPTIONS=TRUE
-AUTOSEG=true
-PRJINC=..$/..$/ ..$/..$/slidesorter
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :  settings.mk
-.INCLUDE :  $(PRJ)$/util$/makefile.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES =      							\
-	$(SLO)$/AllMasterPagesSelector.obj		\
-	$(SLO)$/CurrentMasterPagesSelector.obj	\
-	$(SLO)$/DocumentHelper.obj				\
-	$(SLO)$/MasterPageObserver.obj			\
-	$(SLO)$/MasterPagesPanel.obj			\
-	$(SLO)$/MasterPagesSelector.obj			\
-	$(SLO)$/MasterPageContainer.obj			\
-	$(SLO)$/MasterPageContainerFiller.obj	\
-	$(SLO)$/MasterPageContainerProviders.obj\
-	$(SLO)$/MasterPageContainerQueue.obj	\
-	$(SLO)$/MasterPageDescriptor.obj		\
-	$(SLO)$/PreviewValueSet.obj				\
-	$(SLO)$/RecentlyUsedMasterPages.obj		\
-	$(SLO)$/RecentMasterPagesSelector.obj	\
-	$(SLO)$/CustomAnimationPanel.obj		\
-	$(SLO)$/SlideTransitionPanel.obj		\
-	$(SLO)$/TableDesignPanel.obj
-
-# --- Tagets -------------------------------------------------------
-
-.INCLUDE :  target.mk
-
diff --git a/main/sd/source/ui/toolpanel/makefile.mk b/main/sd/source/ui/toolpanel/makefile.mk
deleted file mode 100644
index c534ec1..0000000
--- a/main/sd/source/ui/toolpanel/makefile.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-#**************************************************************
-#  
-#  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.
-#  
-#**************************************************************
-
-
-
-PRJ=..$/..$/..
-
-PROJECTPCH=sd
-PROJECTPCHSOURCE=$(PRJ)$/util$/sd
-PRJNAME=sd
-TARGET=toolpanel
-ENABLE_EXCEPTIONS=TRUE
-AUTOSEG=true
-PRJINC=..$/slidesorter
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :  settings.mk
-.INCLUDE :  $(PRJ)$/util$/makefile.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES =      								\
-	$(SLO)$/ControlContainer.obj				\
-	$(SLO)$/ScrollPanel.obj						\
-	$(SLO)$/SubToolPanel.obj					\
-	$(SLO)$/TitleBar.obj 						\
-	$(SLO)$/TitledControl.obj 					\
-	$(SLO)$/TaskPaneControlFactory.obj 			\
-	$(SLO)$/TaskPaneFocusManager.obj 			\
-	$(SLO)$/TaskPaneShellManager.obj 			\
-	$(SLO)$/TaskPaneTreeNode.obj 			    \
-    $(SLO)$/ToolPanel.obj                       \
-	$(SLO)$/ToolPanelViewShell.obj              \
-    $(SLO)$/ToolPanelFactory.obj                \
-    $(SLO)$/ToolPanelUIElement.obj              \
-												\
-	$(SLO)$/LayoutMenu.obj                      \
-	$(SLO)$/TestMenu.obj                        \
-	$(SLO)$/TestPanel.obj						\
-	$(SLO)$/SlideSorterCacheDisplay.obj
-
-EXCEPTIONSFILES=
-
-# --- Tagets -------------------------------------------------------
-
-.INCLUDE :  target.mk
-
diff --git a/main/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/main/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 6ef8641..6cc1328 100644
--- a/main/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/main/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -278,7 +278,7 @@
 						aPathURL.removeSegment();
 						aPathURL.removeFinalSlash();
 
-						XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+						XColorList* pColTab = new XColorList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
 						pColTab->SetName( aURL.getName() );
 						if( pColTab->Load() )
 						{
diff --git a/main/sd/source/ui/unoidl/facreg.cxx b/main/sd/source/ui/unoidl/facreg.cxx
index 44e8377..b856df8 100644
--- a/main/sd/source/ui/unoidl/facreg.cxx
+++ b/main/sd/source/ui/unoidl/facreg.cxx
@@ -122,13 +122,6 @@
 extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
     throw (uno::RuntimeException);
 
-extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance(
-    const uno::Reference<uno::XComponentContext>& rxContext)
-    throw(uno::Exception);
-extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
-extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
-    throw (uno::RuntimeException);
-
 extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
     const uno::Reference<uno::XComponentContext>& rxContext)
     throw(uno::Exception);
@@ -145,14 +138,13 @@
     throw (uno::RuntimeException);
 } }
 
+namespace sd { namespace sidebar {
 
-namespace sd { namespace toolpanel {
-
-extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
+extern uno::Reference<uno::XInterface> SAL_CALL PanelFactory_createInstance(
     const uno::Reference<uno::XComponentContext>& rxContext)
     throw(uno::Exception);
-extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
-extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+extern OUString PanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void)
     throw (uno::RuntimeException);
 
 } }
@@ -214,7 +206,7 @@
 using namespace ::sd::framework;
 using namespace ::sd::presenter;
 using namespace ::sd::slidesorter;
-using namespace ::sd::toolpanel;
+using namespace ::sd::sidebar;
 
 
 
@@ -237,8 +229,7 @@
     BasicPaneFactoryFactoryId,
     BasicToolBarFactoryFactoryId,
     BasicViewFactoryFactoryId,
-    TaskPanelFactoryFactoryId,
-    ToolPanelFactoryFactoryId,
+    PanelFactoryFactoryId,
     ResourceIdFactoryId,
     PresentationFactoryProviderFactoryId,
     SlideRendererFactoryId,
@@ -271,8 +262,7 @@
         (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
         (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
         (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
-        (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
-        (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
+        (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId;
         (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
         (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
         (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
@@ -402,18 +392,11 @@
                         sd::framework::BasicViewFactory_getSupportedServiceNames());
                     break;
 
-                case TaskPanelFactoryFactoryId:
+                case PanelFactoryFactoryId:
                     xComponentFactory = ::cppu::createSingleComponentFactory(
-                        sd::framework::TaskPanelFactory_createInstance,
-                        sd::framework::TaskPanelFactory_getImplementationName(),
-                        sd::framework::TaskPanelFactory_getSupportedServiceNames());
-                    break;
-
-                case ToolPanelFactoryFactoryId:
-                    xComponentFactory = ::cppu::createSingleComponentFactory(
-                        sd::toolpanel::ToolPanelFactory_createInstance,
-                        sd::toolpanel::ToolPanelFactory_getImplementationName(),
-                        sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+                        sd::sidebar::PanelFactory_createInstance,
+                        sd::sidebar::PanelFactory_getImplementationName(),
+                        sd::sidebar::PanelFactory_getSupportedServiceNames());
                     break;
 
                 case ResourceIdFactoryId:
diff --git a/main/sd/source/ui/view/ToolBarManager.cxx b/main/sd/source/ui/view/ToolBarManager.cxx
index 4726159..3c5c824 100644
--- a/main/sd/source/ui/view/ToolBarManager.cxx
+++ b/main/sd/source/ui/view/ToolBarManager.cxx
@@ -1230,7 +1230,7 @@
 
         case ViewShell::ST_NONE:
         case ViewShell::ST_PRESENTATION:
-        case ViewShell::ST_TASK_PANE:
+        case ViewShell::ST_SIDEBAR:
         default:
             break;
     }
diff --git a/main/sd/source/ui/view/ViewShellBase.cxx b/main/sd/source/ui/view/ViewShellBase.cxx
index b8b2e9a..dfc755b 100644
--- a/main/sd/source/ui/view/ViewShellBase.cxx
+++ b/main/sd/source/ui/view/ViewShellBase.cxx
@@ -62,7 +62,7 @@
 #include "PresentationViewShell.hxx"
 #include "FormShellManager.hxx"
 #include "ToolBarManager.hxx"
-#include "taskpane/PanelId.hxx"
+#include "SidebarPanelId.hxx"
 #include "Window.hxx"
 #include "framework/ConfigurationController.hxx"
 #include "DocumentRenderer.hxx"
@@ -729,13 +729,6 @@
                 framework::FrameworkHelper::msSlideSorterURL);
             break;
             
-        case SID_TASKPANE:
-            mpImpl->SetPaneVisibility(
-                rRequest,
-                framework::FrameworkHelper::msRightPaneURL,
-                framework::FrameworkHelper::msTaskPaneURL);
-            break;
-
         case SID_NORMAL_MULTI_PANE_GUI:
         case SID_SLIDE_SORTER_MULTI_PANE_GUI:
         case SID_DRAWINGMODE:
@@ -1449,11 +1442,6 @@
                             xContext, FrameworkHelper::msLeftDrawPaneURL);
                         break;
 
-                    case SID_TASKPANE:
-                        xResourceId = ResourceId::create(
-                            xContext, FrameworkHelper::msRightPaneURL);
-                        break;
-            
                     case SID_NORMAL_MULTI_PANE_GUI:
                         xResourceId = ResourceId::createWithAnchorURL(
                             xContext,
@@ -1553,8 +1541,7 @@
     // Set the visibility state of the toolpanel and one of its top
     // level panels.
     sal_Bool bShowToolPanel = sal_True;
-    toolpanel::PanelId nPanelId (
-        toolpanel::PID_UNKNOWN);
+    sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN);
     bool bPanelIdGiven = false;
 
     // Extract the given arguments.
@@ -1574,9 +1561,7 @@
                 ID_VAL_PANEL_INDEX, sal_False);
             if (pPanelId != NULL)
             {
-                nPanelId = static_cast<
-                    toolpanel::PanelId>(
-                        pPanelId->GetValue());
+                nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue());
                 bPanelIdGiven = true;
             }
         }
@@ -1585,11 +1570,11 @@
     // Ignore the request for some combinations of panels and view
     // shell types.
     if (bPanelIdGiven
-        && ! (nPanelId==toolpanel::PID_LAYOUT
+        && ! (nPanelId==sidebar::PID_LAYOUT
             && mrBase.GetMainViewShell()!=NULL
             && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE))
     {
-        framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel(
+        framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel(
             framework::FrameworkHelper::msLayoutTaskPanelURL);
     }
 }
diff --git a/main/sd/source/ui/view/ViewShellImplementation.cxx b/main/sd/source/ui/view/ViewShellImplementation.cxx
index eeb466f..6dcf6ec 100644
--- a/main/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/main/sd/source/ui/view/ViewShellImplementation.cxx
@@ -47,7 +47,7 @@
 #include "FrameView.hxx"
 #include "DrawViewShell.hxx"
 #include "ViewShellHint.hxx"
-#include "taskpane/PanelId.hxx"
+#include "SidebarPanelId.hxx"
 #include "framework/FrameworkHelper.hxx"
 
 #include <sfx2/bindings.hxx>
@@ -148,8 +148,7 @@
 
             // Make the layout menu visible in the tool pane.
             SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True);
-            SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX,
-                ::sd::toolpanel::PID_LAYOUT);
+            SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT);
             SfxViewFrame* pFrame = mrViewShell.GetViewFrame();
             if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL)
             {
@@ -349,7 +348,7 @@
         // Since we have to return a view id for every possible shell type
         // and there is not (yet) a proper ViewShellBase sub class for the
         // remaining types we chose the Impress factory as a fall back.
-        case ViewShell::ST_TASK_PANE:
+        case ViewShell::ST_SIDEBAR:
         case ViewShell::ST_NONE:
         default:
             return IMPRESS_FACTORY_ID;
diff --git a/main/sd/source/ui/view/ViewShellManager.cxx b/main/sd/source/ui/view/ViewShellManager.cxx
index b80138a..60e87d6 100644
--- a/main/sd/source/ui/view/ViewShellManager.cxx
+++ b/main/sd/source/ui/view/ViewShellManager.cxx
@@ -61,6 +61,8 @@
     SfxShell* mpShell;
     ShellId mnId;
     ViewShellManager::SharedShellFactory mpFactory;
+    bool mbIsListenerAddedToWindow;
+    
     ShellDescriptor ();
     ShellDescriptor (SfxShell* pShell, ShellId nId);
     ShellDescriptor (const ShellDescriptor& rDescriptor);
@@ -241,7 +243,7 @@
         ShellId nShellId,
         ::Window* pParentWindow,
         FrameView* pFrameView);
-    void DestroyViewShell (const ShellDescriptor& rDescriptor);
+    void DestroyViewShell (ShellDescriptor& rDescriptor);
     void DestroySubShell (
         const SfxShell& rViewShell,
         const ShellDescriptor& rDescriptor);
@@ -519,8 +521,11 @@
     {
         ::Window* pWindow = aResult.GetWindow();
         if (pWindow != NULL)
+        {
             pWindow->AddEventListener(
                 LINK(this, ViewShellManager::Implementation, WindowEventHandler));
+            aResult.mbIsListenerAddedToWindow = true;
+        }
         else
         {
             DBG_ASSERT(false,
@@ -1181,6 +1186,23 @@
 
             case VCLEVENT_WINDOW_LOSEFOCUS:
                 break;
+
+            case VCLEVENT_OBJECT_DYING:
+                // Remember that we do not have to remove the window
+                // listener for this window.
+                for (ActiveShellList::iterator
+                         iShell(maActiveViewShells.begin()),
+                         iEnd(maActiveViewShells.end());
+                     iShell!=iEnd;
+                     ++iShell)
+                {
+                    if (iShell->GetWindow() == pEventWindow)
+                    {
+                        iShell->mbIsListenerAddedToWindow = false;
+                        break;
+                    }
+                }
+                break;
         }
     }
     return sal_True;
@@ -1225,15 +1247,19 @@
 
 
 void ViewShellManager::Implementation::DestroyViewShell (
-    const ShellDescriptor& rDescriptor)
+    ShellDescriptor& rDescriptor)
 {
     OSL_ASSERT(rDescriptor.mpShell != NULL);
-    
-    ::Window* pWindow = rDescriptor.GetWindow();
-    if (pWindow != NULL)
+
+    if (rDescriptor.mbIsListenerAddedToWindow)
     {
-        pWindow->RemoveEventListener(
-            LINK(this, ViewShellManager::Implementation, WindowEventHandler));
+        rDescriptor.mbIsListenerAddedToWindow = false;
+        ::Window* pWindow = rDescriptor.GetWindow();
+        if (pWindow != NULL)
+        {
+            pWindow->RemoveEventListener(
+                LINK(this, ViewShellManager::Implementation, WindowEventHandler));
+        }
     }
 
     // Destroy the sub shell factories.
@@ -1395,7 +1421,8 @@
 ShellDescriptor::ShellDescriptor (void)
     : mpShell(NULL),
       mnId(0),
-      mpFactory()
+      mpFactory(),
+      mbIsListenerAddedToWindow(false)
 {
 }
 
@@ -1407,7 +1434,8 @@
     ShellId nId)
     : mpShell(pShell),
       mnId(nId),
-      mpFactory()
+      mpFactory(),
+      mbIsListenerAddedToWindow(false)
 {
 }
 
@@ -1415,9 +1443,10 @@
 
 
 ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor)
-        : mpShell(rDescriptor.mpShell),
-          mnId(rDescriptor.mnId),
-          mpFactory(rDescriptor.mpFactory)
+    : mpShell(rDescriptor.mpShell),
+      mnId(rDescriptor.mnId),
+      mpFactory(rDescriptor.mpFactory),
+      mbIsListenerAddedToWindow(rDescriptor.mbIsListenerAddedToWindow)
 {
 }
 
@@ -1426,9 +1455,13 @@
 
 ShellDescriptor& ShellDescriptor::operator= (const ShellDescriptor& rDescriptor)
 {
-    mpShell = rDescriptor.mpShell;
-    mnId = rDescriptor.mnId;
-    mpFactory = rDescriptor.mpFactory;
+    if (this != &rDescriptor)
+    {
+        mpShell = rDescriptor.mpShell;
+        mnId = rDescriptor.mnId;
+        mpFactory = rDescriptor.mpFactory;
+        mbIsListenerAddedToWindow = rDescriptor.mbIsListenerAddedToWindow;
+    }
     return *this;
 }
 
diff --git a/main/sd/source/ui/view/drtxtob.cxx b/main/sd/source/ui/view/drtxtob.cxx
index 16ab89c..5ea89ba 100644
--- a/main/sd/source/ui/view/drtxtob.cxx
+++ b/main/sd/source/ui/view/drtxtob.cxx
@@ -39,6 +39,7 @@
 #include <editeng/ulspitem.hxx>
 #include <editeng/lspcitem.hxx>
 #include <editeng/adjitem.hxx>
+#include <editeng/kernitem.hxx>
 #include <vcl/vclenum.hxx>
 #include <sfx2/app.hxx>
 #include <svl/whiter.hxx>
@@ -153,6 +154,27 @@
 	SetRepeatTarget(NULL);
 }
 
+void TextObjectBar::GetCharState( SfxItemSet& rSet ) 
+{
+	SfxItemSet  aCharAttrSet( mpView->GetDoc()->GetPool() );
+	mpView->GetAttributes( aCharAttrSet );
+
+	SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END);
+
+	aNewAttr.Put(aCharAttrSet, sal_False);
+	rSet.Put(aNewAttr, sal_False);
+
+	SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) );
+	//aKern.SetWhich(SID_ATTR_CHAR_KERNING);
+	rSet.Put(aKern);
+
+	SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True );
+	if ( eState == SFX_ITEM_DONTCARE )
+	{
+		rSet.InvalidateItem(EE_CHAR_KERNING);
+	}
+}
+
 /*************************************************************************
 |*
 |* Status der Attribut-Items
@@ -183,6 +205,8 @@
             case SID_ATTR_CHAR_FONTHEIGHT:
             case SID_ATTR_CHAR_WEIGHT:
             case SID_ATTR_CHAR_POSTURE:
+		case SID_ATTR_CHAR_SHADOWED:
+            case SID_ATTR_CHAR_STRIKEOUT:
             {
                 SvxScriptSetItem aSetItem( nSlotId, GetPool() );
                 aSetItem.GetItemSet().Put( aAttrSet, sal_False );
@@ -464,7 +488,9 @@
 		}
 
 		// Absatzausrichtung
-        SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust();
+		SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
+		rSet.Put(aLR);
+		SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust();
 		switch( eAdj )
 		{
 			case SVX_ADJUST_LEFT:
@@ -483,6 +509,13 @@
 			break;
 		}
 
+		Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
+		Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
+		Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
+		Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
+		Invalidate(SID_ATTR_PARA_LINESPACE);
+		Invalidate(SID_ATTR_PARA_ULSPACE); 
+
         // paragraph text direction
         if( bDisableParagraphTextDirection )
         {
@@ -547,6 +580,17 @@
 			}
 		}
 */
+		SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
+		aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
+		rSet.Put(aLRSpace);
+		Invalidate(SID_ATTR_PARA_LRSPACE);
+		//Added by xuxu 
+		SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
+		if ( eState == SFX_ITEM_DONTCARE )
+		{
+			rSet.InvalidateItem(EE_PARA_LRSPACE);
+			rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
+		}
 		sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet.
                             Get( EE_PARA_SBL ) ).GetPropLineSpace();
 		switch( nLineSpace )
diff --git a/main/sd/source/ui/view/drtxtob1.cxx b/main/sd/source/ui/view/drtxtob1.cxx
index 73d48f7..1cb69c5 100644
--- a/main/sd/source/ui/view/drtxtob1.cxx
+++ b/main/sd/source/ui/view/drtxtob1.cxx
@@ -241,6 +241,7 @@
 		break;
 
 		case SID_OUTLINE_LEFT:
+		case SID_ATTR_PARA_LEFT:
 		{
 			if (pOLV)
 			{
@@ -256,6 +257,7 @@
 		break;
 
 		case SID_OUTLINE_RIGHT:
+		case SID_ATTR_PARA_RIGHT:
 		{
 			if (pOLV)
 			{
@@ -270,6 +272,22 @@
 		}
 		break;
 
+		case SID_ATTR_PARA_LRSPACE:
+		{
+			sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
+			SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
+				GetPool().GetWhich(nSlot));
+
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+			aLRSpace.SetWhich( EE_PARA_LRSPACE );
+
+			aEditAttr.Put( aLRSpace );
+			mpView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_LRSPACE);
+		}
+		break;
+
 		case SID_OUTLINE_UP:
 		{
 			if (pOLV)
@@ -585,6 +603,71 @@
 				rReq.Done( aNewAttr );
 				pArgs = rReq.GetArgs();
 			}
+			else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
+				nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
+				nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
+				nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
+			{
+				switch( nSlot )
+				{
+				case SID_ATTR_PARA_ADJUST_LEFT:
+					{
+						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+					}
+					break;
+				case SID_ATTR_PARA_ADJUST_CENTER:
+					{
+						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+					}
+					break;
+				case SID_ATTR_PARA_ADJUST_RIGHT:
+					{
+						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+					}
+					break;
+				case SID_ATTR_PARA_ADJUST_BLOCK:
+					{
+						aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
+					}
+					break;
+				}
+				rReq.Done( aNewAttr );
+				pArgs = rReq.GetArgs();
+			}
+			else if(nSlot == SID_ATTR_CHAR_KERNING)
+			{
+				aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
+				rReq.Done( aNewAttr );
+				pArgs = rReq.GetArgs();
+			}
+			else if(nSlot ==  SID_SET_SUPER_SCRIPT )
+			{
+				SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+				SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+								aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+				if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+					aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+				else
+					aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+				aNewAttr.Put( aItem );
+				rReq.Done( aNewAttr );
+				pArgs = rReq.GetArgs();
+			}
+			else if( nSlot ==  SID_SET_SUB_SCRIPT )
+			{
+				SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+				SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+								aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+				if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+					aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+				else
+					aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+				aNewAttr.Put( aItem );
+				rReq.Done( aNewAttr );
+				pArgs = rReq.GetArgs();
+			}
 
 			mpView->SetAttributes(*pArgs);
 
diff --git a/main/sd/source/ui/view/drviews2.cxx b/main/sd/source/ui/view/drviews2.cxx
index 03ebc86..539de93 100644
--- a/main/sd/source/ui/view/drviews2.cxx
+++ b/main/sd/source/ui/view/drviews2.cxx
@@ -63,6 +63,26 @@
 #include <svx/xlnedwit.hxx>
 #include <svx/fontworkbar.hxx>
 
+#include <editeng/escpitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/svdobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+
+#include <svl/whiter.hxx>
+
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
 
@@ -84,6 +104,7 @@
 #include "unmodpg.hxx"
 #include "slideshow.hxx"
 #include "fuvect.hxx"
+#include "futext.hxx"
 #include "stlpool.hxx"
 
 // #90356#
@@ -135,12 +156,19 @@
 		case SID_ATTR_FILL_HATCH:
 		case SID_ATTR_FILL_BITMAP:
 		case SID_ATTR_FILL_SHADOW:
+        case SID_ATTR_FILL_TRANSPARENCE:
+        case SID_ATTR_FILL_FLOATTRANSPARENCE:
 
 		case SID_ATTR_LINE_STYLE:
 		case SID_ATTR_LINE_DASH:
 		case SID_ATTR_LINE_WIDTH:
 		case SID_ATTR_LINE_COLOR:
 		case SID_ATTR_LINEEND_STYLE:
+        case SID_ATTR_LINE_START:
+        case SID_ATTR_LINE_END:
+        case SID_ATTR_LINE_TRANSPARENCE:
+        case SID_ATTR_LINE_JOINT:
+        case SID_ATTR_LINE_CAP:
 
 		case SID_ATTR_TEXT_FITTOSIZE:
 		{
@@ -287,12 +315,17 @@
 					case SID_ATTR_FILL_GRADIENT:
 					case SID_ATTR_FILL_HATCH:
 					case SID_ATTR_FILL_BITMAP:
+                    case SID_ATTR_FILL_TRANSPARENCE:
+                    case SID_ATTR_FILL_FLOATTRANSPARENCE:
 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
 						break;
 					case SID_ATTR_LINE_STYLE:
 					case SID_ATTR_LINE_DASH:
 					case SID_ATTR_LINE_WIDTH:
 					case SID_ATTR_LINE_COLOR:
+                    case SID_ATTR_LINE_TRANSPARENCE:
+                    case SID_ATTR_LINE_JOINT:
+                    case SID_ATTR_LINE_CAP:
 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
 						break;
 					case SID_ATTR_TEXT_FITTOSIZE:
@@ -985,7 +1018,176 @@
 	}
 }
 
+void DrawViewShell::ExecChar( SfxRequest &rReq )
+{
+	SdDrawDocument* pDoc = GetDoc();
+	if (!pDoc || !mpDrawView)
+	return; 
 
+	SfxItemSet aEditAttr( pDoc->GetPool() );
+	mpDrawView->GetAttributes( aEditAttr );
+
+	//modified by wj for sym2_1580, if put old itemset into new set,
+	//when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
+	// and use old attr to update all the attributes
+//	SfxItemSet aNewAttr( GetPool(),
+//	EE_ITEMS_START, EE_ITEMS_END );
+//	aNewAttr.Put( aEditAttr, sal_False );
+	SfxItemSet aNewAttr( pDoc->GetPool() );
+	//modified end
+
+	sal_uInt16 nSId = rReq.GetSlot();
+
+	MapSlot( nSId );
+
+	switch ( nSId )
+	{
+	case SID_ATTR_CHAR_FONT:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_FONTHEIGHT:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_WEIGHT:     
+		if( rReq.GetArgs() )
+		{
+			//const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) );
+			SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;	
+	case SID_ATTR_CHAR_POSTURE:
+		if( rReq.GetArgs() )
+		{
+			//const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) );
+			SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_UNDERLINE:
+		if( rReq.GetArgs() )
+		{
+			//<<modify by wj for sym2_1873
+			//SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
+			SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
+			//end>>
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+			else
+			{
+				FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
+				aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE,  EE_CHAR_UNDERLINE ) );
+			}//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) );
+		}
+		break;
+	case SID_ATTR_CHAR_SHADOWED:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_STRIKEOUT:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_COLOR:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_ATTR_CHAR_KERNING:
+		if( rReq.GetArgs() )
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False );
+			if (pItem)
+			{
+				aNewAttr.Put(*pItem);
+			}
+		}
+		break;
+	case SID_SET_SUB_SCRIPT:
+		if( rReq.GetArgs() )
+		{
+			SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
+			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+			if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+			else
+				aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+			aNewAttr.Put( aItem );
+		}
+		break;
+	case SID_SET_SUPER_SCRIPT:
+		if( rReq.GetArgs() )
+		{
+			SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
+			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+			if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+			else
+				aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+			aNewAttr.Put( aItem );
+		}
+		break;
+	case SID_SHRINK_FONT_SIZE:
+    	case SID_GROW_FONT_SIZE:
+		//if (rReq.GetArgs())
+		{
+			const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
+			const FontList* pFontList = pFonts->GetFontList();
+			if( pFontList )
+			{
+				FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView );
+				GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+			}
+		}
+	default:
+		;
+	}
+
+	mpDrawView->SetAttributes(aNewAttr);
+	rReq.Done();
+	Cancel();
+}
 
 
 /** This method consists basically of three parts:
@@ -1011,4 +1213,86 @@
     return pNewPage;
 }
 
+void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq)
+{
+	if(SlideShow::IsRunning( GetViewShellBase() ))
+		return;	
+
+	SdDrawDocument* pDoc = GetDoc();
+	if (!pDoc || !mpDrawView)
+		return;
+
+	sal_uInt16 nSId = rReq.GetSlot();
+	SfxItemSet aAttrs( pDoc->GetPool() );
+
+	switch ( nSId )
+	{
+	case SID_TABLE_VERT_NONE:		
+	case SID_TABLE_VERT_CENTER:
+	case SID_TABLE_VERT_BOTTOM:
+		SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
+		if (nSId == SID_TABLE_VERT_CENTER)
+			eTVA = SDRTEXTVERTADJUST_CENTER;
+		else if (nSId == SID_TABLE_VERT_BOTTOM)
+			eTVA = SDRTEXTVERTADJUST_BOTTOM;
+
+		aAttrs.Put( SdrTextVertAdjustItem(eTVA) );
+		mpDrawView->SetAttributes(aAttrs);
+
+		break;
+	}
+}
+
+void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet)
+{
+	SfxWhichIter	aIter( rSet );
+	sal_uInt16			nWhich = aIter.FirstWhich();
+
+	SdDrawDocument* pDoc = GetDoc();
+	if (!pDoc || !mpDrawView)
+		return;
+
+	SfxItemSet aAttrs( pDoc->GetPool() );		
+	mpDrawView->GetAttributes( aAttrs );
+	
+	while ( nWhich )
+	{
+		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+			? GetPool().GetSlotId(nWhich)
+			: nWhich; 
+		switch ( nSlotId )
+		{
+			case SID_TABLE_VERT_NONE:
+			case SID_TABLE_VERT_CENTER:
+			case SID_TABLE_VERT_BOTTOM:
+				sal_Bool bContour = sal_False;
+				SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
+				if( eConState != SFX_ITEM_DONTCARE )
+				{
+					bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
+				}
+				if (bContour) break;
+
+				SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
+				//SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
+
+				//if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
+				if(SFX_ITEM_DONTCARE != eVState)
+				{					
+					SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
+					sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP||
+                            nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER ||
+                            nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM;
+					rSet.Put(SfxBoolItem(nSlotId, bSet));
+				}
+				else 
+				{
+					rSet.Put(SfxBoolItem(nSlotId, sal_False));
+				}
+				break;	
+		}
+		nWhich = aIter.NextWhich();
+	}	
+}
+
 } // end of namespace sd
diff --git a/main/sd/source/ui/view/drviews3.cxx b/main/sd/source/ui/view/drviews3.cxx
index 55f88b4..4d2ddb9 100644
--- a/main/sd/source/ui/view/drviews3.cxx
+++ b/main/sd/source/ui/view/drviews3.cxx
@@ -32,6 +32,7 @@
 #include <editeng/lrspitem.hxx>
 #include <editeng/protitem.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <editeng/adjitem.hxx>
 #include <svx/ruler.hxx>
 #ifndef _SVX_RULERITEM_HXX
 #include <svx/rulritem.hxx>
@@ -96,7 +97,8 @@
 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
-
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing::framework;
 using ::com::sun::star::frame::XFrame;
@@ -677,17 +679,106 @@
 			break;
 		}
 
+		case SID_ATTR_PARA_LINESPACE:
+		{
+			sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE;
+			SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get(
+				GetPool().GetWhich(nSlot));
+
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
+			aParaLineSP.SetWhich( EE_PARA_SBL );
+
+			aEditAttr.Put( aParaLineSP );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_LINESPACE);
+		}
+		break;
+		case SID_ATTR_PARA_ADJUST_LEFT:
+		{
+			SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
+
+			aEditAttr.Put( aItem );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
+		}
+		break;
+		case SID_ATTR_PARA_ADJUST_CENTER:
+		{
+			SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST );
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
+
+			aEditAttr.Put( aItem );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
+		}
+		break;
+		case SID_ATTR_PARA_ADJUST_RIGHT:
+		{
+			SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST );
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
+
+			aEditAttr.Put( aItem );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
+		}
+		break;
+		case SID_ATTR_PARA_ADJUST_BLOCK:
+		{
+			SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST );
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
+
+			aEditAttr.Put( aItem );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
+		}
+		break;
+		case SID_ATTR_PARA_ULSPACE:
+		{
+			sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE;
+			SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get(
+				GetPool().GetWhich(nSlot));
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
+			aULSP.SetWhich( EE_PARA_ULSPACE );
+
+			aEditAttr.Put( aULSP );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_ULSPACE);
+		}
+		break;
+
 		case SID_ATTR_PARA_LRSPACE:
 		{
+			sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
+			SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
+				GetPool().GetWhich(nSlot));
+
+			SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+			aLRSpace.SetWhich( EE_PARA_LRSPACE );
+
+			aEditAttr.Put( aLRSpace );
+			mpDrawView->SetAttributes( aEditAttr );
+
+			Invalidate(SID_ATTR_PARA_LRSPACE);
+			break;
+		}
+		case SID_ATTR_LRSPACE:
+		{
 			if( mpDrawView->IsTextEdit() )
 			{
 				sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
 				const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
 							pArgs->Get( nId );
 
-                SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+		                SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
 
-                nId = EE_PARA_LRSPACE;
+		                nId = EE_PARA_LRSPACE;
 				SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
 						rItem.GetRight(), rItem.GetTxtLeft(),
 						rItem.GetTxtFirstLineOfst(), nId );
diff --git a/main/sd/source/ui/view/drviews6.cxx b/main/sd/source/ui/view/drviews6.cxx
index fbcfd56..54c69d5 100644
--- a/main/sd/source/ui/view/drviews6.cxx
+++ b/main/sd/source/ui/view/drviews6.cxx
@@ -601,7 +601,7 @@
 		{
             // Make the slide transition panel visible (expand it) in the
             // tool pane.
-            framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+            framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
                 framework::FrameworkHelper::msCustomAnimationTaskPanelURL);
 
 			Cancel();
@@ -613,7 +613,7 @@
 		{
             // Make the slide transition panel visible (expand it) in the
             // tool pane.
-            framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel(
+            framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
                 framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
 
 			Cancel();
diff --git a/main/sd/source/ui/view/drviews7.cxx b/main/sd/source/ui/view/drviews7.cxx
index f7e70f4..e343296 100644
--- a/main/sd/source/ui/view/drviews7.cxx
+++ b/main/sd/source/ui/view/drviews7.cxx
@@ -206,6 +206,20 @@
 	return 0;
 }
 
+
+
+
+void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet)
+{
+    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+    
+    SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() );
+    rSet.Put(aSet,sal_False);
+}
+
+
+
+
 /*************************************************************************
 |*
 |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
@@ -512,6 +526,8 @@
 	{
 		rSet.DisableItem( SID_HORIZONTAL );
 		rSet.DisableItem( SID_VERTICAL );
+		rSet.DisableItem( SID_FLIP_HORIZONTAL );
+		rSet.DisableItem( SID_FLIP_VERTICAL );
     }
 
     if( !mpDrawView->IsMirrorAllowed() )
diff --git a/main/sd/source/ui/view/drviews8.cxx b/main/sd/source/ui/view/drviews8.cxx
index 003bb76..dbf3419 100644
--- a/main/sd/source/ui/view/drviews8.cxx
+++ b/main/sd/source/ui/view/drviews8.cxx
@@ -118,6 +118,7 @@
 		}
 		break;
 
+		case SID_CHAR_DLG_EFFECT:
 		case SID_CHAR_DLG:	// BASIC
 		{
 			SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
@@ -131,8 +132,24 @@
 			Cancel();
 		}
 		break;
+		case FN_NUM_BULLET_ON: 
+		{
+			// The value (sal_uInt16)0xFFFF means set bullet on/off.
+			SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF);
+			GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L );
+		}
+		break;
+		case FN_NUM_NUMBERING_ON: 
+		{
+			// The value (sal_uInt16)0xFFFF means set bullet on/off.
+			SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF);
+			GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L );
+		}
+		break;
 
 		case SID_OUTLINE_BULLET:
+		case FN_SVX_SET_BULLET:
+		case FN_SVX_SET_NUMBER:
 		{
 			SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
 			Cancel();
diff --git a/main/sd/source/ui/view/drviewsa.cxx b/main/sd/source/ui/view/drviewsa.cxx
index f88777c..c3172e7 100644
--- a/main/sd/source/ui/view/drviewsa.cxx
+++ b/main/sd/source/ui/view/drviewsa.cxx
@@ -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 @@
 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()
 {
+    mpSelectionChangeHandler->Disconnect();
+    
     mpAnnotationManager.reset();
     mpViewOverlayManager.reset();
    
@@ -853,4 +866,20 @@
 }
 
 
+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
diff --git a/main/sd/source/ui/view/drviewsc.cxx b/main/sd/source/ui/view/drviewsc.cxx
index f6b8f5f..d66295a 100644
--- a/main/sd/source/ui/view/drviewsc.cxx
+++ b/main/sd/source/ui/view/drviewsc.cxx
@@ -472,14 +472,16 @@
 		break;
 
 		case SID_HORIZONTAL:  // BASIC
+        case SID_FLIP_HORIZONTAL:
 		{
-			mpDrawView->MirrorAllMarkedHorizontal();
+            mpDrawView->MirrorAllMarkedHorizontal();
 			Cancel();
 			rReq.Done ();
 		}
 		break;
 
 		case SID_VERTICAL:	// BASIC
+        case SID_FLIP_VERTICAL:
 		{
 			mpDrawView->MirrorAllMarkedVertical();
 			Cancel();
diff --git a/main/sd/source/ui/view/drviewsf.cxx b/main/sd/source/ui/view/drviewsf.cxx
index b4e403f..67f7a2d 100644
--- a/main/sd/source/ui/view/drviewsf.cxx
+++ b/main/sd/source/ui/view/drviewsf.cxx
@@ -73,6 +73,16 @@
 #include "cfgids.hxx"
 #include "anminfo.hxx"
 
+#include <editeng/lspcitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/nbdtmgfact.hxx>
+#include <svx/nbdtmg.hxx>
+
+using namespace svx::sidebar;
 using ::rtl::OUString;
 using namespace ::com::sun::star;
 
@@ -302,17 +312,133 @@
 			: nWhich;
 		switch ( nSlotId )
 		{
+			case SID_ATTR_PARA_ADJUST_LEFT:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				
+				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
+				SvxAdjust eAdj = aItem.GetAdjust();
+				if ( eAdj == SVX_ADJUST_LEFT)
+				{
+					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
+				}
+
+				bAttr = sal_True;
+
+				Invalidate(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_ADJUST_CENTER:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				
+				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
+				SvxAdjust eAdj = aItem.GetAdjust();
+				if ( eAdj == SVX_ADJUST_CENTER)
+				{
+					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
+				}
+
+				bAttr = sal_True;
+
+				Invalidate(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_ADJUST_RIGHT:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				
+				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
+				SvxAdjust eAdj = aItem.GetAdjust();
+				if ( eAdj == SVX_ADJUST_RIGHT)
+				{
+					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
+				}
+
+				bAttr = sal_True;
+
+				Invalidate(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_ADJUST_BLOCK:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				
+				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
+				SvxAdjust eAdj = aItem.GetAdjust();
+				if ( eAdj == SVX_ADJUST_BLOCK)
+				{
+					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
+				}
+
+				bAttr = sal_True;
+
+				Invalidate(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_LRSPACE:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) );
+				aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
+				rSet.Put(aLRSpace);
+				bAttr = sal_True;
+				Invalidate(SID_ATTR_PARA_LRSPACE);
+			}
+			break;
+			case SID_ATTR_PARA_LINESPACE:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) );
+				rSet.Put(aLineLR);
+				bAttr = sal_True;
+				Invalidate(SID_ATTR_PARA_LINESPACE);
+			}
+			break;
+			case SID_ATTR_PARA_ULSPACE:
+			{
+				SfxItemSet aAttrs( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aAttrs );
+				SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) );
+				aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
+				rSet.Put(aULSP);
+				bAttr = sal_True;
+				Invalidate(SID_ATTR_PARA_ULSPACE);
+			}
+			break;
 			case SID_ATTR_FILL_STYLE:
 			case SID_ATTR_FILL_COLOR:
 			case SID_ATTR_FILL_GRADIENT:
 			case SID_ATTR_FILL_HATCH:
 			case SID_ATTR_FILL_BITMAP:
 			case SID_ATTR_FILL_SHADOW:
+            case SID_ATTR_FILL_TRANSPARENCE:
+            case SID_ATTR_FILL_FLOATTRANSPARENCE:
 			case SID_ATTR_LINE_STYLE:
 			case SID_ATTR_LINE_DASH:
 			case SID_ATTR_LINE_WIDTH:
 			case SID_ATTR_LINE_COLOR:
+            case SID_ATTR_LINE_TRANSPARENCE:
+            case SID_ATTR_LINE_JOINT:
+            case SID_ATTR_LINE_CAP:
 			case SID_ATTR_TEXT_FITTOSIZE:
+			case SID_ATTR_CHAR_FONT:
+			case SID_ATTR_CHAR_FONTHEIGHT:
+			case SID_ATTR_CHAR_SHADOWED:
+			case SID_ATTR_CHAR_POSTURE:
+			case SID_ATTR_CHAR_UNDERLINE:
+			case SID_ATTR_CHAR_STRIKEOUT:
+			case SID_ATTR_CHAR_WEIGHT:
+			case SID_ATTR_CHAR_COLOR:
+			case SID_ATTR_CHAR_KERNING:
+			case SID_SET_SUB_SCRIPT:
+			case SID_SET_SUPER_SCRIPT:
 			{
 				bAttr = sal_True;
 			}
@@ -454,6 +580,118 @@
 				}
 			}
 			break;
+			case FN_BUL_NUM_RULE_INDEX:
+			case FN_NUM_NUM_RULE_INDEX:
+			{
+				SfxItemSet aEditAttr( GetDoc()->GetPool() );
+				mpDrawView->GetAttributes( aEditAttr );		
+
+				SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
+				aNewAttr.Put( aEditAttr, sal_False );
+
+
+				sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;	
+				SvxNumRule* pNumRule = NULL;	
+				const SfxPoolItem* pTmpItem=NULL;
+				sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
+
+				//if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
+				//	nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
+				rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
+				rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
+				nActNumLvl = mpDrawView->GetSelectionLevel();
+				pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
+
+				if (pTmpItem)
+					pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
+					
+				if ( pNumRule )
+				{
+					sal_uInt16 nMask = 1;
+					sal_uInt16 nCount = 0;
+					sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF;
+					for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
+					{
+						if(nActNumLvl & nMask)
+						{
+							nCount++;
+							nCurLevel = i;
+						}
+						nMask <<= 1;
+					}
+					if ( nCount == 1 )
+					{
+						sal_Bool bBullets = sal_False;
+						const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel);
+						if ( pNumFmt )
+						{
+							switch(pNumFmt->GetNumberingType())
+							{
+								case SVX_NUM_CHAR_SPECIAL:
+								case SVX_NUM_BITMAP:
+									bBullets = sal_True;
+									break;
+
+								default:
+									bBullets = sal_False;
+							}							
+
+							rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+							rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+							if ( bBullets )
+							{
+								NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
+								if ( pBullets )
+								{
+									sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
+									 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
+								}
+							}else
+							{
+								NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
+								if ( pNumbering )
+								{
+									sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
+									 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
+								}
+							}
+						}
+					}
+				}
+			}
+            		break;
+			//End
+			// Added by Li Hui for story 179.
+			case FN_NUM_BULLET_ON:
+			case FN_NUM_NUMBERING_ON:
+			{
+				sal_Bool bEnable = sal_False;
+				const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+				const sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
+				for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
+				{
+					SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
+					if (pTextObj && pTextObj->GetObjInventor() == SdrInventor)
+					{
+						if (pTextObj->GetObjIdentifier() != OBJ_OLE2)
+						{
+							bEnable = sal_True;
+							break;
+						}
+					}
+				}
+				if (bEnable)
+				{
+					rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
+					rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False));
+				}
+				else
+				{
+					rSet.DisableItem(FN_NUM_BULLET_ON);
+					rSet.DisableItem(FN_NUM_NUMBERING_ON);
+				}
+			}
+			break;
 		}
 		nWhich = aIter.NextWhich();
 	}
@@ -488,25 +726,45 @@
 				nWhich = aNewIter.NextWhich();
 			}
 		}
+
+		SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
+		if ( eState == SFX_ITEM_DONTCARE )
+		{
+			rSet.InvalidateItem(EE_PARA_LRSPACE);
+			rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
+		}
+		eState = pSet->GetItemState( EE_PARA_SBL );
+		if ( eState == SFX_ITEM_DONTCARE )
+		{
+			rSet.InvalidateItem(EE_PARA_SBL);
+			rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
+		}
+		eState = pSet->GetItemState( EE_PARA_ULSPACE );
+		if ( eState == SFX_ITEM_DONTCARE )
+		{
+			rSet.InvalidateItem(EE_PARA_ULSPACE);
+			rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
+		}
+
+		SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
+						pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+		if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+		{
+			rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
+		}
+		else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+		{
+			rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
+		}
+
+		eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True );
+		if ( eState == SFX_ITEM_DONTCARE )
+		{
+			rSet.InvalidateItem(EE_CHAR_KERNING);
+			rSet.InvalidateItem(SID_ATTR_CHAR_KERNING);
+		}
 		delete pSet;
 	}
-
-//    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
-//    sal_uLong nMarkCount = rMarkList.GetMarkCount();
-//    sal_Bool bDisabled = sal_False;
-//
-//    for (sal_uLong i = 0;
-//         i < nMarkCount && !bDisabled && i < 50; i++)
-//    {
-//        SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
-//
-//        if (pObj->GetObjInventor() == E3dInventor)
-//        {
-//            bDisabled = sal_True;
-//            rSet.ClearItem(SDRATTR_SHADOW);
-//            rSet.DisableItem(SDRATTR_SHADOW);
-//        }
-//    }
 }
 
 
diff --git a/main/sd/source/ui/view/drviewsj.cxx b/main/sd/source/ui/view/drviewsj.cxx
index c310907..1bce0ab 100644
--- a/main/sd/source/ui/view/drviewsj.cxx
+++ b/main/sd/source/ui/view/drviewsj.cxx
@@ -91,6 +91,8 @@
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) ||
 
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) ||
+			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_TRANSPARENCE ) ||
+			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_FLOATTRANSPARENCE ) ||
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) ||
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) ||
 			SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) ||
@@ -189,6 +191,8 @@
 			{
 				//rSet.DisableItem( SID_ATTRIBUTES_AREA ); // wieder raus!
 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
+				rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
+				rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
 			}
 			if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // Solange es JOE fehlerhaft behandelt!
 			{ // JOE: Ein Gruppenobjekt kann eben u.U. in ein PathObj gewandelt werden
@@ -411,6 +415,8 @@
 			{
 				//rSet.DisableItem( SID_ATTRIBUTES_AREA );
 				rSet.DisableItem( SID_ATTR_FILL_STYLE );
+				rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE );
+				rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE );
 			}
 			if( !bEdgeObj )
 				rSet.DisableItem( SID_CONNECTION_DLG );
@@ -532,6 +538,8 @@
 		rSet.DisableItem( SID_COPYOBJECTS );
 		rSet.DisableItem( SID_HORIZONTAL );
 		rSet.DisableItem( SID_VERTICAL );
+		rSet.DisableItem( SID_FLIP_HORIZONTAL );
+		rSet.DisableItem( SID_FLIP_VERTICAL );
 		rSet.DisableItem( SID_GROUP );
 		rSet.DisableItem( SID_UNGROUP );
 		rSet.DisableItem( SID_NAME_GROUP );
diff --git a/main/sd/source/ui/view/drvwshrg.cxx b/main/sd/source/ui/view/drvwshrg.cxx
index 9884dbe..215b72b 100644
--- a/main/sd/source/ui/view/drvwshrg.cxx
+++ b/main/sd/source/ui/view/drvwshrg.cxx
@@ -33,6 +33,7 @@
 #include <svx/imapdlg.hxx>
 #include <svx/colrctrl.hxx>
 #include <sfx2/objface.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <svx/f3dchild.hxx>
 #include <svx/tbxcustomshapes.hxx>
 
@@ -89,6 +90,7 @@
 	SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
 	SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
 	SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 }
 
 
@@ -115,6 +117,7 @@
 	SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
 	SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
 	SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() );
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 }
 
 TYPEINIT1( GraphicViewShell, DrawViewShell );
diff --git a/main/sd/source/ui/view/outlnvs2.cxx b/main/sd/source/ui/view/outlnvs2.cxx
index 04766a4..06000d8 100644
--- a/main/sd/source/ui/view/outlnvs2.cxx
+++ b/main/sd/source/ui/view/outlnvs2.cxx
@@ -330,12 +330,16 @@
 
 void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
 {
-	OutlineViewModelChangeGuard aGuard( *pOlView );
-
+	sal_uInt16 nSId = rReq.GetSlot();
+	std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+	if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER)
+	{
+		aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) );
+	}
 	DeactivateCurrentFunction();
 
 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
-	sal_uInt16 nSId = rReq.GetSlot();
+	//sal_uInt16 nSId = rReq.GetSlot();
 
 	switch( nSId )
 	{
@@ -380,6 +384,8 @@
 		break;
 
 		case SID_OUTLINE_BULLET:
+		case FN_SVX_SET_BULLET:
+		case FN_SVX_SET_NUMBER:
 		{
 			SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
 			Cancel();
@@ -394,6 +400,7 @@
 		}
 		break;
 
+		case SID_CHAR_DLG_EFFECT:
 		case SID_CHAR_DLG:
 		{
 			SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
diff --git a/main/sd/source/ui/view/outlnvsh.cxx b/main/sd/source/ui/view/outlnvsh.cxx
index d5a43b3..23d01be 100644
--- a/main/sd/source/ui/view/outlnvsh.cxx
+++ b/main/sd/source/ui/view/outlnvsh.cxx
@@ -52,6 +52,8 @@
 #include <editeng/editstat.hxx>
 #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>
@@ -128,6 +130,7 @@
 	SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
 	SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
 	SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 }
 
 
@@ -230,6 +233,8 @@
 	mpFrameView->Connect();
 
 	Construct(GetDocSh());
+
+    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText));
 }
 
 /*************************************************************************
diff --git a/main/sd/source/ui/view/sdview.cxx b/main/sd/source/ui/view/sdview.cxx
index f875175..7c4362d 100644
--- a/main/sd/source/ui/view/sdview.cxx
+++ b/main/sd/source/ui/view/sdview.cxx
@@ -51,11 +51,13 @@
 
 #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>
 #include <svx/xlineit0.hxx>
 #include <svx/xlnclit.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <vcl/virdev.hxx>
 
 #include "app.hrc"
@@ -79,6 +81,7 @@
 #include <svx/sdr/contact/viewobjectcontact.hxx>
 #include <svx/sdr/contact/viewcontact.hxx>
 #include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdotable.hxx>
 #include "EventMultiplexer.hxx"
 #include "ViewShellBase.hxx"
 #include "ViewShellManager.hxx"
@@ -89,6 +92,7 @@
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
 #include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/table/tablecontroller.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
 #include <svx/unoapi.hxx>
@@ -98,6 +102,7 @@
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
+using namespace sdr::table;
 namespace sd {
 
 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
@@ -775,6 +780,10 @@
 		pGivenOutlinerView, bDontDeleteOutliner,
 		bOnlyOneView, bGrabFocus);
 
+    ContextChangeEventMultiplexer::NotifyContextChange(
+        &GetViewShell()->GetViewShellBase(),
+        ::sfx2::sidebar::EnumContext::Context_DrawText);
+
 	if (bReturn)
 	{
 		::Outliner* pOL = GetTextEditOutliner();
@@ -790,11 +799,15 @@
 			{
 				aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
 			}
-			pOL->SetBackgroundColor( aBackground  );
+            if (pOL != NULL)
+                pOL->SetBackgroundColor( aBackground  );
 		}
 
-		pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
-		pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
+        if (pOL != NULL)
+        {
+            pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
+            pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
+        }
 	}
 
 	return(bReturn);
@@ -831,11 +844,17 @@
 		}
 	}
 
-	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() );
+	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
+        sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT,
+        (void*)xObj.get() );
 
 	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() );
 	}
@@ -1314,4 +1333,167 @@
 	}
 }
 
+sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet)
+{
+	// If setting bullets/numbering by the dialog, always should toggle on.
+	if (!bBulletOnOffMode)
+		return sal_True;
+	SdrModel* pSdrModel = GetModel();
+	if (!pSdrModel)
+		return sal_False;
+
+	sal_Bool bToggleOn = sal_False;
+	SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
+	sal_uInt32 nMarkCount = GetMarkedObjectCount();
+	for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++)
+	{
+		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+		if (!pTextObj || pTextObj->IsTextEditActive())
+			continue;
+		if (pTextObj->ISA(SdrTableObj))
+		{
+			SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
+			if (!pTableObj)
+				continue;
+			CellPos aStart, aEnd;
+			SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
+			if (pTableController)
+			{
+				pTableController->getSelectedCells(aStart, aEnd);
+			}
+			else
+			{
+				aStart = pTableObj->getFirstCell();
+				aEnd = pTableObj->getLastCell();
+			}
+			sal_Int32 nColCount = pTableObj->getColumnCount();
+			for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++)
+			{
+				for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++)
+				{
+					sal_Int32 nIndex = nRow * nColCount + nCol;
+					SdrText* pText = pTableObj->getText(nIndex);
+					if (!pText || !pText->GetOutlinerParaObject())
+						continue;
+					pOutliner->SetText(*(pText->GetOutlinerParaObject()));
+					sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
+					bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
+					pOutliner->Clear();
+				}
+			}
+		}
+		else
+		{
+			OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+			if (!pParaObj)
+				continue;
+			pOutliner->SetText(*pParaObj);
+			sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
+			bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
+			pOutliner->Clear();
+		}
+	}
+	delete pOutliner;
+	return bToggleOn;
+}
+
+void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff)
+{
+	SdrModel* pSdrModel = GetModel();
+	Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
+	if (!pSdrModel || !pWindow)
+		return;
+
+	sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled();
+	sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet);
+	if ( bForceBulletOnOff ) {
+		bToggleOn = bBulletOnOffMode;
+	}
+	SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel);
+	SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
+	OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
+
+	sal_uInt32 nMarkCount = GetMarkedObjectCount();
+	for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
+	{
+		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+		if (!pTextObj || pTextObj->IsTextEditActive())
+			continue;
+		if (pTextObj->ISA(SdrTableObj))
+		{
+			SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
+			if (!pTableObj)
+				continue;
+			CellPos aStart, aEnd;
+			SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
+			if (pTableController)
+			{
+				pTableController->getSelectedCells(aStart, aEnd);
+			}
+			else
+			{
+				aStart = pTableObj->getFirstCell();
+				aEnd = pTableObj->getLastCell();
+			}
+			sal_Int32 nColCount = pTableObj->getColumnCount();
+			for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++)
+			{
+				for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++)
+				{
+					sal_Int32 nIndex = nRow * nColCount + nCol;
+					SdrText* pText = pTableObj->getText(nIndex);
+					if (!pText || !pText->GetOutlinerParaObject())
+						continue;
+
+					pOutliner->SetText(*(pText->GetOutlinerParaObject()));
+					if (bUndoEnabled)
+					{
+						SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nIndex));
+						pUndoGroup->AddAction(pTxtUndo);
+					}
+					pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
+					sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
+					pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
+					pOutliner->Clear();
+				}
+			}
+			// Broadcast the object change event.
+			if (!pTextObj->AdjustTextFrameWidthAndHeight())
+			{
+				pTextObj->SetChanged();
+				pTextObj->BroadcastObjectChange();
+			}
+		}
+		else
+		{
+			OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+			if (!pParaObj)
+				continue;
+			pOutliner->SetText(*pParaObj);
+			if (bUndoEnabled)
+			{
+				SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0));
+				pUndoGroup->AddAction(pTxtUndo);
+			}
+			pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
+			sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
+			pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
+			pOutliner->Clear();
+		}
+	}
+
+	if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled)
+	{
+		pSdrModel->BegUndo();
+		pSdrModel->AddUndo(pUndoGroup);
+		pSdrModel->EndUndo();
+	}
+	else
+	{
+		delete pUndoGroup;
+	}
+	delete pOutliner;
+	delete pOutlinerView;
+}
+
 } // end of namespace sd
diff --git a/main/sd/source/ui/view/viewshel.cxx b/main/sd/source/ui/view/viewshel.cxx
index 7f8fbeb..fcb37e1 100644
--- a/main/sd/source/ui/view/viewshel.cxx
+++ b/main/sd/source/ui/view/viewshel.cxx
@@ -91,6 +91,11 @@
 #include "Window.hxx"
 #include "fupoor.hxx"
 
+#include <editeng/numitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/poolitem.hxx>
+#include <glob.hrc>
+
 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
 #define SO2_DECL_SVINPLACEOBJECT_DEFINED
 SO2_DECL_REF(SvInPlaceObject)
@@ -174,7 +179,8 @@
 {
     // Keep the content window from accessing in its destructor the
     // WindowUpdater.
-    mpContentWindow->SetViewShell(NULL);
+    if (mpContentWindow)
+        mpContentWindow->SetViewShell(NULL);
 
 	delete mpZoomList;
 
@@ -183,6 +189,13 @@
     if (mpImpl->mpSubShellFactory.get() != NULL)
         GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
             this,mpImpl->mpSubShellFactory);
+
+    if (mpContentWindow)
+    {
+        OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(),
+            mpContentWindow->GetParent());
+        mpContentWindow.reset();
+    }
 }
 
 
@@ -794,7 +807,86 @@
 	}
 }
 
+const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId)
+{	
+	const SfxPoolItem* pTmpItem = NULL;
+	
+	if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET)
+	{
+		return pTmpItem;
+	}
+	else
+	{
+		nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+		SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+		if (eState == SFX_ITEM_SET)
+			return pTmpItem;
+		else
+		{
+			sal_Bool bOutliner = sal_False;
+			sal_Bool bTitle = sal_False;
 
+			if( mpView )
+     			{
+				const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+				const sal_uInt32 nCount = rMarkList.GetMarkCount();
+            
+				for(sal_uInt32 nNum = 0; nNum < nCount; nNum++)
+				{
+					SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+					if( pObj->GetObjInventor() == SdrInventor )
+					{
+						switch(pObj->GetObjIdentifier())
+						{
+						case OBJ_TITLETEXT:
+							bTitle = sal_True;
+							break;
+						case OBJ_OUTLINETEXT:
+							bOutliner = sal_True;
+							break;
+						}
+					}
+				}
+			}
+
+			const SvxNumBulletItem *pItem = NULL;
+			if(bOutliner)
+			{				
+				SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
+				String aStyleName((SdResId(STR_LAYOUT_OUTLINE)));
+				aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+				SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
+				if( pFirstStyleSheet )
+					pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
+			}
+
+			if( pItem == NULL )
+				pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+
+			aNewAttr.Put(*pItem, EE_PARA_NUMBULLET);
+		
+			if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
+			{
+				SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True);
+				SvxNumRule* pRule = pItem->GetNumRule();
+				if(pRule)
+				{
+					SvxNumRule aNewRule( *pRule );
+					aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
+
+					SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+					aNewAttr.Put(aNewItem);
+				}
+			}
+
+			SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+			if (eState == SFX_ITEM_SET)
+				return pTmpItem;
+
+		}
+	}
+	return pTmpItem;
+}
 
 
 sal_Bool ViewShell::HasRuler (void)
@@ -964,9 +1056,10 @@
     {
         OSL_ASSERT (GetViewShell()!=NULL);
 
-        mpContentWindow->SetPosSizePixel(
-            Point(nLeft,nTop),
-            Size(nRight-nLeft,nBottom-nTop));
+        if (mpContentWindow)
+            mpContentWindow->SetPosSizePixel(
+                Point(nLeft,nTop),
+                Size(nRight-nLeft,nBottom-nTop));
     }
 
     // Windows in the center and rulers at the left and top side.
diff --git a/main/sd/uiconfig/sdraw/menubar/menubar.xml b/main/sd/uiconfig/sdraw/menubar/menubar.xml
index d4451d3..d651caf 100644
--- a/main/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/main/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -129,6 +129,7 @@
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:Navigator"/>
       <menu:menuitem menu:id=".uno:TaskPane"/>
+      <menu:menuitem menu:id=".uno:Sidebar"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:Zoom"/>
     </menu:menupopup>
diff --git a/main/sd/uiconfig/simpress/menubar/menubar.xml b/main/sd/uiconfig/simpress/menubar/menubar.xml
index baef237..8bb268d 100644
--- a/main/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/main/sd/uiconfig/simpress/menubar/menubar.xml
@@ -120,6 +120,7 @@
 			</menu:menu>
 			<menu:menuseparator/>
       <menu:menuitem menu:id=".uno:TaskPane"/>
+      <menu:menuitem menu:id=".uno:Sidebar"/>
       <menu:menuitem menu:id=".uno:LeftPaneImpress"/>
 			<menu:menuitem menu:id=".uno:AvailableToolbars"/>
 			<menu:menuitem menu:id=".uno:StatusBarVisible"/>
diff --git a/main/sd/util/makefile.mk b/main/sd/util/makefile.mk
index 75fd0d8..f1dcfbe 100644
--- a/main/sd/util/makefile.mk
+++ b/main/sd/util/makefile.mk
@@ -125,15 +125,14 @@
 			$(SLB)$/controller.lib
 
 LIB5TARGET=$(SLB)$/sdraw3_2.lib
-LIB5FILES=      \
-			$(SLB)$/html.lib		\
-			$(SLB)$/filter.lib		\
-			$(SLB)$/unoidl.lib		\
-			$(SLB)$/animui.lib		\
+LIB5FILES=     							\
+			$(SLB)$/html.lib			\
+			$(SLB)$/filter.lib			\
+			$(SLB)$/unoidl.lib			\
+			$(SLB)$/animui.lib			\
 			$(SLB)$/accessibility.lib	\
-			$(SLB)$/toolpanel.lib		\
 			$(SLB)$/uitools.lib			\
-			$(SLB)$/tpcontrols.lib
+			$(SLB)$/sidebar.lib
 
 LIB6TARGET=$(SLB)$/sdraw3_3.lib
 LIB6FILES=      								\
diff --git a/main/sd/util/sd.component b/main/sd/util/sd.component
index 1cc2099..ecb900d 100644
--- a/main/sd/util/sd.component
+++ b/main/sd/util/sd.component
@@ -68,8 +68,8 @@
   <implementation name="com.sun.star.comp.Draw.framework.ResourceId">
     <service name="com.sun.star.drawing.framework.ResourceId"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Draw.framework.TaskPanelFactory">
-    <service name="com.sun.star.drawing.framework.TaskPanelFactory"/>
+  <implementation name="org.openoffice.comp.Draw.framework.PanelFactory">
+    <service name="com.sun.star.drawing.framework.PanelFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.Draw.framework.configuration.Configuration">
     <service name="com.sun.star.drawing.framework.Configuration"/>
@@ -83,9 +83,6 @@
   <implementation name="com.sun.star.comp.draw.SdHtmlOptionsDialog">
     <service name="com.sun.star.ui.dialog.FilterOptionsDialog"/>
   </implementation>
-  <implementation name="com.sun.star.comp.drawing.ToolPanelFactory">
-    <service name="com.sun.star.drawing.DefaultToolPanelFactory"/>
-  </implementation>
   <implementation name="com.sun.star.comp.sd.InsertSlideController">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
diff --git a/main/sfx2/AllLangResTarget_sfx2.mk b/main/sfx2/AllLangResTarget_sfx2.mk
index fc55b33..2d7d699 100644
--- a/main/sfx2/AllLangResTarget_sfx2.mk
+++ b/main/sfx2/AllLangResTarget_sfx2.mk
@@ -72,6 +72,7 @@
 	sfx2/source/doc/graphhelp.src \
 	sfx2/source/doc/new.src \
 	sfx2/source/menu/menu.src \
+	sfx2/source/sidebar/Sidebar.src \
 	sfx2/source/view/view.src \
 ))
 
diff --git a/main/sfx2/Library_sfx.mk b/main/sfx2/Library_sfx.mk
index a9614df..402c4c3 100644
--- a/main/sfx2/Library_sfx.mk
+++ b/main/sfx2/Library_sfx.mk
@@ -213,6 +213,37 @@
 	sfx2/source/menu/virtmenu \
 	sfx2/source/notify/eventsupplier \
 	sfx2/source/notify/hintpost \
+	sfx2/source/sidebar/SidebarChildWindow \
+	sfx2/source/sidebar/SidebarDockingWindow \
+	sfx2/source/sidebar/SidebarController \
+	sfx2/source/sidebar/SidebarPanelBase \
+	sfx2/source/sidebar/SidebarToolBox \
+	sfx2/source/sidebar/AsynchronousCall \
+	sfx2/source/sidebar/Context \
+	sfx2/source/sidebar/ContextChangeBroadcaster \
+	sfx2/source/sidebar/ContextList \
+	sfx2/source/sidebar/ControlFactory \
+	sfx2/source/sidebar/ControllerItem \
+	sfx2/source/sidebar/CustomImageRadioButton \
+	sfx2/source/sidebar/Deck \
+	sfx2/source/sidebar/DeckDescriptor \
+	sfx2/source/sidebar/DeckLayouter \
+	sfx2/source/sidebar/DeckTitleBar \
+	sfx2/source/sidebar/DrawHelper \
+	sfx2/source/sidebar/EnumContext \
+	sfx2/source/sidebar/FocusManager \
+	sfx2/source/sidebar/MenuButton \
+	sfx2/source/sidebar/Paint \
+	sfx2/source/sidebar/Panel \
+	sfx2/source/sidebar/PanelDescriptor \
+	sfx2/source/sidebar/PanelTitleBar \
+	sfx2/source/sidebar/ResourceManager \
+	sfx2/source/sidebar/TabBar \
+	sfx2/source/sidebar/TabItem \
+	sfx2/source/sidebar/TitleBar \
+	sfx2/source/sidebar/Theme \
+	sfx2/source/sidebar/Tools \
+	sfx2/source/sidebar/ToolBoxBackground \
 	sfx2/source/statbar/stbitem \
 	sfx2/source/toolbox/imgmgr \
 	sfx2/source/toolbox/tbxitem \
diff --git a/main/sfx2/Package_inc.mk b/main/sfx2/Package_inc.mk
index dc65b78..1d8c541 100644
--- a/main/sfx2/Package_inc.mk
+++ b/main/sfx2/Package_inc.mk
@@ -131,3 +131,13 @@
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfac.hxx,sfx2/viewfac.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewfrm.hxx,sfx2/viewfrm.hxx))
 $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/viewsh.hxx,sfx2/viewsh.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarChildWindow.hxx,sfx2/sidebar/SidebarChildWindow.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarPanelBase.hxx,sfx2/sidebar/SidebarPanelBase.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerItem.hxx,sfx2/sidebar/ControllerItem.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/propertypanel.hrc,sfx2/sidebar/propertypanel.hrc))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/EnumContext.hxx,sfx2/sidebar/EnumContext.hxx))
+$(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))
+
diff --git a/main/sfx2/inc/sfx2/navigat.hxx b/main/sfx2/inc/sfx2/navigat.hxx
index 1199a7e..52072da 100644
--- a/main/sfx2/inc/sfx2/navigat.hxx
+++ b/main/sfx2/inc/sfx2/navigat.hxx
@@ -41,7 +41,7 @@
 						SFX_DECL_CHILDWINDOW(SfxNavigatorWrapper);
 };
 
-class SfxNavigator : public SfxDockingWindow
+class SFX2_DLLPUBLIC SfxNavigator : public SfxDockingWindow
 {
 	SfxChildWindow*		pWrapper;
 
diff --git a/main/sfx2/inc/sfx2/sfx.hrc b/main/sfx2/inc/sfx2/sfx.hrc
index 6385d11..e545639 100644
--- a/main/sfx2/inc/sfx2/sfx.hrc
+++ b/main/sfx2/inc/sfx2/sfx.hrc
@@ -126,6 +126,7 @@
 
 #define RID_SFX_SFXLOCAL_START				(RID_SFX_START + 3082)
 #define RID_SFX_VIEW_START					(RID_SFX_START + 4096)
+#define RID_SFX_SIDEBAR_START				(RID_SFX_START + 4150)
 #define RID_SFX_NODES_START					(RID_SFX_START + 4500)
 #define RID_CNT_START2     					(RID_SFX_NODES_START)
 #define RID_SFX_CHAOSDOC_START				(RID_SFX_START + 5120)
diff --git a/main/sfx2/inc/sfx2/sfxsids.hrc b/main/sfx2/inc/sfx2/sfxsids.hrc
index 9ffdb0f..442cfd6 100644
--- a/main/sfx2/inc/sfx2/sfxsids.hrc
+++ b/main/sfx2/inc/sfx2/sfxsids.hrc
@@ -853,6 +853,7 @@
 #define SID_ZOOM                            (SID_SVX_START + 289)
 #define SID_SEARCH_ITEM                     (SID_SVX_START + 291)
 #define SID_ATTR_CHAR_FONTWIDTH             (SID_SVX_START + 303)
+#define SID_SIDEBAR                         (SID_SVX_START + 336)
 #define SID_HYPERLINK_INSERT                (SID_SVX_START + 360)
 #define SID_HYPERLINK_GETLINK               (SID_SVX_START + 361)
 #define SID_HYPERLINK_SETLINK               (SID_SVX_START + 362)
diff --git a/main/sfx2/inc/sfx2/shell.hxx b/main/sfx2/inc/sfx2/shell.hxx
index ddfbb8c..588536e 100644
--- a/main/sfx2/inc/sfx2/shell.hxx
+++ b/main/sfx2/inc/sfx2/shell.hxx
@@ -254,6 +254,8 @@
     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);
diff --git a/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx b/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
new file mode 100644
index 0000000..0e7980d
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/ContextChangeBroadcaster.hxx
@@ -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
diff --git a/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx b/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
new file mode 100644
index 0000000..cd9ce4e
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/ControlFactory.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * 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_CONTROL_FACTORY_HXX
+#define SFX_SIDEBAR_CONTROL_FACTORY_HXX
+
+#include <sfx2/dllapi.h>
+#include <vcl/button.hxx>
+
+class ToolBox;
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBoxBackground;
+
+
+class SFX2_DLLPUBLIC ControlFactory
+{
+public:
+    static CheckBox* CreateMenuButton (Window* pParentWindow);
+    static ImageRadioButton* CreateTabItem (Window* pParentWindow);
+    static ToolBox* CreateToolBox (Window* pParentWindow, const ResId& rResId);
+    static Window* CreateToolBoxBackground (Window* pParentWindow);
+    static ImageRadioButton* CreateCustomImageRadionButton(
+        Window* pParentWindow,
+        const ResId& rResId );
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx b/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
new file mode 100644
index 0000000..ebd790a
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_CONTROLLER_ITEM_HXX
+#define SVX_SIDEBAR_CONTROLLER_ITEM_HXX
+
+#include <sfx2/ctrlitem.hxx>
+
+#include <boost/function.hpp>
+
+
+namespace sfx2 { namespace sidebar {
+
+class SFX2_DLLPUBLIC ControllerItem
+    : public SfxControllerItem
+{
+public:
+    class ItemUpdateReceiverInterface
+    {
+    public:
+        virtual void NotifyItemUpdate(
+            const sal_uInt16 nSId,
+            const SfxItemState eState,
+            const SfxPoolItem* pState) = 0;
+    };
+    ControllerItem (
+        const sal_uInt16 nId,
+        SfxBindings &rBindings,
+        ItemUpdateReceiverInterface& rItemUpdateReceiver);
+    virtual ~ControllerItem (void);
+
+    virtual void StateChanged (sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState);
+
+private:
+    ItemUpdateReceiverInterface& mrItemUpdateReceiver;
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx b/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
new file mode 100644
index 0000000..9b1c374
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/EnumContext.hxx
@@ -0,0 +1,173 @@
+/**************************************************************
+ * 
+ * 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_ENUM_CONTEXT_HXX
+#define SFX_SIDEBAR_ENUM_CONTEXT_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+
+namespace sfx2 { namespace sidebar {
+
+class SFX2_DLLPUBLIC EnumContext
+{
+public:
+    enum Application
+    {
+        Application_Writer,
+        Application_WriterWeb,
+        Application_Calc,
+        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,
+
+        // Also for your convenience for either Writer or WriterWeb.
+        Application_WriterAndWeb,
+
+        // Used only by deck or panel descriptors.  Matches any
+        // application.
+        Application_Any,
+
+        // Use this only in special circumstances.  One might be the
+        // wish to disable a deck or panel during debugging.
+        Application_None,
+
+        __LastApplicationEnum = Application_None
+    };
+    enum Context
+    {
+        Context_3DObject,
+        Context_Annotation,
+        Context_Auditing,
+        Context_Cell,
+        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,
+
+        // Default context of an application.  Do we need this?
+        Context_Default,
+
+        // Used only by deck or panel descriptors.  Matches any context.
+        Context_Any,
+
+        // Special context name that is only used when a deck would
+        // otherwise be empty.
+        Context_Empty,
+
+        Context_Unknown,
+        
+        __LastContextEnum = Context_Unknown
+    };
+
+    EnumContext (void);
+    EnumContext (
+        const Application eApplication,
+        const Context eContext);
+    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 treats some
+        application names as identical to each other.  Replacements
+        made are:
+            Draw or Impress     -> DrawImpress
+            Writer or WriterWeb -> WriterAndWeb
+        Use the Application_DrawImpress or Application_WriterAndWeb values in the CombinedEnumContext macro.
+    */
+    sal_Int32 GetCombinedContext_DI(void) const;
+
+    const ::rtl::OUString& GetApplicationName (void) const;
+    const ::rtl::OUString& GetContextName (void) const;
+
+    bool operator == (const EnumContext aOther);
+    bool operator != (const EnumContext aOther);
+    
+    /** When two contexts are matched against each other then
+        application or context name may have the wildcard value 'any'.
+        In order to prefer matches without wildcards over matches with
+        wildcards we introduce a integer evaluation for matches.
+    */
+    const static sal_Int32 NoMatch;
+    const static sal_Int32 OptimalMatch;
+
+    /** Return the numeric value that describes how good the match
+        between two contexts is.
+        Smaller values represent better matches.
+    */
+    sal_Int32 EvaluateMatch (const EnumContext& rOther) const;
+
+    /** Return the best match against the given list of contexts.
+    */
+    sal_Int32 EvaluateMatch (const ::std::vector<EnumContext>& rOthers) const;
+
+    static Application GetApplicationEnum (const ::rtl::OUString& rsApplicationName);
+    static const ::rtl::OUString& GetApplicationName (const Application eApplication);
+
+    static Context GetContextEnum (const ::rtl::OUString& rsContextName);
+    static const ::rtl::OUString& GetContextName (const Context eContext);
+
+private:
+    Application meApplication;
+    Context meContext;
+
+    static void ProvideApplicationContainers (void);
+    static void ProvideContextContainers (void);
+    static void AddEntry (const ::rtl::OUString& rsName, const Application eApplication);
+    static void AddEntry (const ::rtl::OUString& rsName, const Context eContext);
+};
+
+
+#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::a)<<16)\
+        | static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::e))
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx b/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx
new file mode 100644
index 0000000..658d9a2
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/IContextChangeReceiver.hxx
@@ -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
diff --git a/main/sfx2/inc/sfx2/sidebar/ILayoutableWindow.hxx b/main/sfx2/inc/sfx2/sidebar/ILayoutableWindow.hxx
new file mode 100644
index 0000000..9f7fb9f
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/ILayoutableWindow.hxx
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * 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_LAYOUTABLE_WINDOW_INTERFACE_HXX
+#define SFX_SIDEBAR_LAYOUTABLE_WINDOW_INTERFACE_HXX
+
+#include <tools/gen.hxx>
+#include <sal/types.h>
+
+#include <com/sun/star/ui/LayoutSize.hpp>
+
+class Window;
+
+namespace sfx2 { namespace sidebar {
+
+
+class ILayoutableWindow
+{
+public:
+    /** Return the preferred height with the constraint, that the
+        window will be set to the given width.
+    */
+    virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx b/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx
new file mode 100755
index 0000000..20894b5
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx
@@ -0,0 +1,41 @@
+/**************************************************************

+ * 

+ * 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_POPUP_CONTAINER_HXX

+#define SFX_SIDEBAR_POPUP_CONTAINER_HXX

+

+#include "sfx2/dllapi.h"

+#include <vcl/floatwin.hxx>

+

+namespace sfx2 { namespace sidebar {

+

+class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow

+{

+public:

+	PopupContainer (Window* pParent);

+    virtual ~PopupContainer (void);

+    

+	virtual long Notify (NotifyEvent& rNEvt);

+};

+

+} } // end of namespace sfx2::sidebar

+

+#endif

diff --git a/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx b/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
new file mode 100644
index 0000000..1a1fb98
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
@@ -0,0 +1,52 @@
+/**************************************************************
+ * 
+ * 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_CHILD_WINDOW_HXX
+#define SFX_SIDEBAR_CHILD_WINDOW_HXX
+
+#include "sfx2/childwin.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+/** Outer container of the sidbar window.
+
+    Has to be registered for every application via the
+    RegisterChildWindow() method from the RegisterControllers() method
+    of the applications DLL.
+*/
+class SFX2_DLLPUBLIC SidebarChildWindow
+    : public SfxChildWindow
+{
+public:
+    SidebarChildWindow(
+        Window* pParent,
+        sal_uInt16 nId,
+        SfxBindings* pBindings,
+        SfxChildWinInfo* pInfo);
+
+    SFX_DECL_CHILDWINDOW(SidebarChildWindow);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx b/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx
new file mode 100644
index 0000000..7edeffc
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/SidebarPanelBase.hxx
@@ -0,0 +1,128 @@
+/**************************************************************
+ * 
+ * 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_PANEL_BASE_HXX
+#define SFX_SIDEBAR_PANEL_BASE_HXX
+
+#include "EnumContext.hxx"
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+#include <com/sun/star/ui/XSidebarPanel.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/function.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+class Window;
+
+namespace sfx2 { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper4 <
+        css::ui::XContextChangeEventListener,
+        css::ui::XUIElement,
+        css::ui::XToolPanel,
+        css::ui::XSidebarPanel
+        > SidebarPanelBaseInterfaceBase;
+}
+
+/** Base class for sidebar panels that provides some convenience
+    functionality.
+*/
+class SFX2_DLLPUBLIC SidebarPanelBase
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public SidebarPanelBaseInterfaceBase
+{
+public:
+    static cssu::Reference<css::ui::XUIElement> Create (
+        const ::rtl::OUString& rsResourceURL,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        Window* mpWindow,
+        const css::ui::LayoutSize& rLayoutSize);
+
+    // XContextChangeEventListener
+    virtual void SAL_CALL notifyContextChangeEvent (
+        const css::ui::ContextChangeEventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+    // XEventListener
+    virtual void SAL_CALL disposing (
+        const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+    // XUIElement
+    virtual cssu::Reference<css::frame::XFrame> SAL_CALL getFrame (void)
+        throw(cssu::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getResourceURL (void)
+        throw(cssu::RuntimeException);
+    virtual sal_Int16 SAL_CALL getType (void)
+        throw(cssu::RuntimeException);
+    virtual cssu::Reference<cssu::XInterface> SAL_CALL getRealInterface (void)
+        throw(cssu::RuntimeException);
+
+    // XToolPanel
+    virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible (
+        const cssu::Reference<css::accessibility::XAccessible>& rxParentAccessible)
+        throw(cssu::RuntimeException);
+    virtual cssu::Reference<css::awt::XWindow> SAL_CALL getWindow (void)
+        throw(cssu::RuntimeException);
+
+    // XSidebarPanel
+    virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth)
+        throw(cssu::RuntimeException);
+
+protected:
+    cssu::Reference<css::frame::XFrame> mxFrame;
+
+    SidebarPanelBase (
+        const ::rtl::OUString& rsResourceURL,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        Window* pWindow,
+        const css::ui::LayoutSize& rLayoutSize);
+    virtual ~SidebarPanelBase (void);
+
+    virtual void SAL_CALL disposing (void)
+        throw (cssu::RuntimeException);
+
+    void SetControl (::Window* pControl);
+    ::Window* GetControl (void) const;
+    
+private:
+    Window* mpControl;
+    const ::rtl::OUString msResourceURL;
+    const css::ui::LayoutSize maLayoutSize;
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/Theme.hxx b/main/sfx2/inc/sfx2/sidebar/Theme.hxx
new file mode 100644
index 0000000..f400b64
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/Theme.hxx
@@ -0,0 +1,282 @@
+/**************************************************************
+ * 
+ * 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_THEME_HXX
+#define SFX_SIDEBAR_THEME_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <tools/color.hxx>
+#include <vcl/image.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <tools/gen.hxx>
+#include <rtl/ref.hxx>
+#include <vcl/wall.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <hash_map>
+#include <map>
+#include <boost/optional.hpp>
+
+
+class SvBorder;
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper2 <
+        css::beans::XPropertySet,
+        css::beans::XPropertySetInfo
+        > ThemeInterfaceBase;
+}
+
+class Paint;
+
+/** Simple collection of colors, gradients, fonts that define the
+    look of the sidebar and its controls.
+*/
+class SFX2_DLLPUBLIC Theme
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public ThemeInterfaceBase
+{
+public:
+    enum ThemeItem
+    {
+        __Begin,
+        __Pre_Image = __Begin,
+        
+        __AnyItem = __Pre_Image,
+        
+        Image_Grip,
+        Image_Expand,
+        Image_Collapse,
+        Image_TabBarMenu,
+        Image_PanelMenu,
+        Image_ToolBoxItemSeparator,
+        Image_Closer,
+
+        __Image_Color,
+        
+        Color_DeckTitleFont,
+        Color_PanelTitleFont,
+        Color_TabMenuSeparator,
+        Color_TabItemBorder,
+        Color_DropDownBorder,
+        Color_Highlight,
+        Color_HighlightText,
+
+        __Color_Paint,
+        
+        Paint_DeckBackground,
+        Paint_DeckTitleBarBackground,
+        Paint_PanelBackground,
+        Paint_PanelTitleBarBackground,
+        Paint_TabBarBackground,
+        Paint_TabItemBackgroundNormal,
+        Paint_TabItemBackgroundHighlight,
+        Paint_HorizontalBorder,
+        Paint_VerticalBorder,
+        Paint_ToolBoxBackground,
+        Paint_ToolBoxBorderTopLeft,
+        Paint_ToolBoxBorderCenterCorners,
+        Paint_ToolBoxBorderBottomRight,
+        Paint_DropDownBackground,
+
+        __Paint_Int,
+        
+        Int_DeckTitleBarHeight,
+        Int_DeckBorderSize,
+        Int_DeckSeparatorHeight,
+        Int_PanelTitleBarHeight,
+        Int_TabMenuPadding,
+        Int_TabMenuSeparatorPadding,
+        Int_TabItemWidth,
+        Int_TabItemHeight,
+        Int_DeckLeftPadding,
+        Int_DeckTopPadding,
+        Int_DeckRightPadding,
+        Int_DeckBottomPadding,
+        Int_TabBarLeftPadding,
+        Int_TabBarTopPadding,
+        Int_TabBarRightPadding,
+        Int_TabBarBottomPadding,
+        Int_ButtonCornerRadius,
+
+        __Int_Bool,
+
+        Bool_UseSymphonyIcons,
+        Bool_UseSystemColors,
+        Bool_UseToolBoxItemSeparator,
+        Bool_IsHighContrastModeActive,
+
+        __Bool_Rect,
+
+        Rect_ToolBoxPadding,
+        Rect_ToolBoxBorder,
+        
+        __Post_Rect,
+        __End=__Post_Rect
+    };
+    
+    static Image GetImage (const ThemeItem eItem);
+    static Color GetColor (const ThemeItem eItem);
+    static const Paint& GetPaint (const ThemeItem eItem);
+    static const Wallpaper GetWallpaper (const ThemeItem eItem);
+    static sal_Int32 GetInteger (const ThemeItem eItem);
+    static bool GetBoolean (const ThemeItem eItem);
+    static Rectangle GetRectangle (const ThemeItem eItem);
+    
+    static bool IsHighContrastMode (void);
+
+    static void HandleDataChange (void);
+
+    Theme (void);
+    virtual ~Theme (void);
+
+    virtual void SAL_CALL disposing (void);
+
+    static cssu::Reference<css::beans::XPropertySet> GetPropertySet (void);
+    
+    // beans::XPropertySet
+    virtual cssu::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo (void)
+        throw(cssu::RuntimeException);
+    virtual void SAL_CALL setPropertyValue (
+        const ::rtl::OUString& rsPropertyName,
+        const cssu::Any& rValue)
+        throw(cssu::RuntimeException);
+    virtual cssu::Any SAL_CALL getPropertyValue (
+        const ::rtl::OUString& rsPropertyName)
+        throw(css::beans::UnknownPropertyException,
+            css::lang::WrappedTargetException,
+            cssu::RuntimeException);
+    virtual void SAL_CALL addPropertyChangeListener(
+        const ::rtl::OUString& rsPropertyName,
+        const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
+        throw(css::beans::UnknownPropertyException,
+            css::lang::WrappedTargetException,
+            cssu::RuntimeException);
+    virtual void SAL_CALL removePropertyChangeListener(
+        const ::rtl::OUString& rsPropertyName,
+        const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
+        throw(css::beans::UnknownPropertyException,
+            css::lang::WrappedTargetException,
+            cssu::RuntimeException);
+    virtual void SAL_CALL addVetoableChangeListener(
+        const ::rtl::OUString& rsPropertyName,
+        const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
+        throw(css::beans::UnknownPropertyException,
+            css::lang::WrappedTargetException,
+            cssu::RuntimeException);
+    virtual void SAL_CALL removeVetoableChangeListener(
+        const ::rtl::OUString& rsPropertyName,
+        const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
+        throw(css::beans::UnknownPropertyException,
+            css::lang::WrappedTargetException,
+            cssu::RuntimeException);
+
+    // beans::XPropertySetInfo
+    virtual cssu::Sequence<css::beans::Property> SAL_CALL getProperties (void)
+        throw(cssu::RuntimeException);
+    virtual css::beans::Property SAL_CALL getPropertyByName (const ::rtl::OUString& rsName)
+        throw(css::beans::UnknownPropertyException,
+            cssu::RuntimeException);
+    virtual sal_Bool SAL_CALL hasPropertyByName (const ::rtl::OUString& rsName)
+        throw(cssu::RuntimeException);
+    
+private:
+    static ::rtl::Reference<Theme> mpInstance;
+    static Theme& GetCurrentTheme (void);
+
+    ::std::vector<Image> maImages;
+    ::std::vector<Color> maColors;
+    ::std::vector<Paint> maPaints;
+    ::std::vector<sal_Int32> maIntegers;
+    ::std::vector<bool> maBooleans;
+    ::std::vector<Rectangle> maRectangles;
+    bool mbIsHighContrastMode;
+    bool mbIsHighContrastModeSetManually;
+    
+    typedef ::std::hash_map<rtl::OUString,ThemeItem, rtl::OUStringHash> PropertyNameToIdMap;
+    PropertyNameToIdMap maPropertyNameToIdMap;
+    typedef ::std::vector<rtl::OUString> PropertyIdToNameMap;
+    PropertyIdToNameMap maPropertyIdToNameMap;
+    typedef ::std::vector<cssu::Any> RawValueContainer;
+    RawValueContainer maRawValues;
+        
+    typedef ::std::vector<cssu::Reference<css::beans::XPropertyChangeListener> > ChangeListenerContainer;
+    typedef ::std::map<ThemeItem,ChangeListenerContainer> ChangeListeners;
+    ChangeListeners maChangeListeners;
+    typedef ::std::vector<cssu::Reference<css::beans::XVetoableChangeListener> > VetoableListenerContainer;
+    typedef ::std::map<ThemeItem,VetoableListenerContainer> VetoableListeners;
+    VetoableListeners maVetoableListeners;
+
+    enum PropertyType
+    {
+        PT_Image,
+        PT_Color,
+        PT_Paint,
+        PT_Integer,
+        PT_Boolean,
+        PT_Rectangle,
+        PT_Invalid
+    };
+    
+    void SetupPropertyMaps (void);
+    void InitializeTheme (void);
+    void UpdateTheme (void);
+    static PropertyType GetPropertyType (const ThemeItem eItem);
+    static cssu::Type GetCppuType (const PropertyType eType);
+    static sal_Int32 GetIndex (
+        const ThemeItem eItem,
+        const PropertyType eType);
+
+    VetoableListenerContainer* GetVetoableListeners (
+        const ThemeItem eItem,
+        const bool bCreate);
+    ChangeListenerContainer* GetChangeListeners (
+        const ThemeItem eItem,
+        const bool bCreate);
+    bool DoVetoableListenersVeto (
+        const VetoableListenerContainer* pListeners,
+        const css::beans::PropertyChangeEvent& rEvent) const;
+    void BroadcastPropertyChange (
+        const ChangeListenerContainer* pListeners,
+        const css::beans::PropertyChangeEvent& rEvent) const;
+    void ProcessNewValue (
+        const cssu::Any& rValue,
+        const ThemeItem eItem,
+        const PropertyType eType);
+};
+
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/inc/sfx2/sidebar/propertypanel.hrc b/main/sfx2/inc/sfx2/sidebar/propertypanel.hrc
new file mode 100644
index 0000000..be65c60
--- /dev/null
+++ b/main/sfx2/inc/sfx2/sidebar/propertypanel.hrc
@@ -0,0 +1,132 @@
+/************************************************************************
+ *
+ * Licensed Materials - Property of IBM.
+ * (C) Copyright IBM Corporation 2003, 2012.  All Rights Reserved.
+ * U.S. Government Users Restricted Rights:
+ * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
+ *
+ ************************************************************************/
+
+#ifndef _SFX_PROPERTYPANEL_HRC
+#define _SFX_PROPERTYPANEL_HRC
+
+#include <sfx2/sfx.hrc>
+
+//section page RID
+#define RC_PROPERTYPANEL_START					RID_SFX_PROPERTYPANEL_START
+#define DLG_PROPERTY_DOCKING_WINDOW				( RC_PROPERTYPANEL_START + 0 )
+#define BMP_PROPERTYPANEL_EXPAND				( RC_PROPERTYPANEL_START + 1 )
+#define BMP_PROPERTYPANEL_COLLAPSE				( RC_PROPERTYPANEL_START + 2 )
+#define BMP_PROPERTYPANEL_EXPAND_HC				( RC_PROPERTYPANEL_START + 3 )
+#define BMP_PROPERTYPANEL_COLLAPSE_HC			( RC_PROPERTYPANEL_START + 4 )
+#define BMP_PROPERTYPANEL_MOREPROPERTY			( RC_PROPERTYPANEL_START + 5 )
+#define BMP_PROPERTYPANEL_MOREPROPERTY_HC		( RC_PROPERTYPANEL_START + 6 )
+#define FT_PROPERTYPANEL_NOTSUPPORT_DESC		( RC_PROPERTYPANEL_START + 7 )
+
+#define RID_PROPERTYPANEL_TEXTPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 8 )
+#define RID_PROPERTYPANEL_PARAGRAPHPAGE_TITLEBAR	( RC_PROPERTYPANEL_START + 9 )
+#define RID_PROPERTYPANEL_AREAPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 10 )
+#define RID_PROPERTYPANEL_TBLDESIGNPAGE_TITLEBAR	( RC_PROPERTYPANEL_START + 11 )
+#define RID_PROPERTYPANEL_LINEPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 12 )
+#define RID_PROPERTYPANEL_POSIZEPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 13 )
+#define RID_PROPERTYPANEL_GRAPHICPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 14 )
+#define RID_PROPERTYPANEL_CELLAPPEARPAGE_TITLEBAR		( RC_PROPERTYPANEL_START + 15 )
+#define RID_PROPERTYPANEL_SWPAGE_PAGE_TITLEBAR  (RC_PROPERTYPANEL_START + 16)
+#define RID_PROPERTYPANEL_SWOBJWRAP_PAGE_TITLEBAR  (RC_PROPERTYPANEL_START + 17)
+#define RID_PROPERTYPANEL_SCCELL_PAGE_TITLEBAR  (RC_PROPERTYPANEL_START + 18)
+#define RID_PROPERTYPANEL_SCALIGNMENT_PAGE_TITLEBAR  (RC_PROPERTYPANEL_START + 19)
+#define RID_PROPERTYPANEL_SD_PAGELAYOUT_TITLEBAR  (RC_PROPERTYPANEL_START+20)
+#define RID_PROPERTYPANEL_SD_PAGEPROPERTY_TITLEBAR  (RC_PROPERTYPANEL_START+21)
+#define RID_PROPERTYPANEL_SD_TABLEDESIGN_TITLEBAR	(RC_PROPERTYPANEL_START+22)
+#define RID_PROPERTYPANEL_NUMFORMAT_PAGE_TITLEBAR   (RC_PROPERTYPANEL_START+23)
+
+#define RID_PANELDOCK_WINDOW				( RC_PROPERTYPANEL_START + 24 )
+#define STR_TITLE_DISCRIPTION				( RC_PROPERTYPANEL_START + 25 )		//
+
+#ifndef STD_MASKCOLOR
+#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+#endif
+
+//unit pixel
+//panel common 
+#define PROPERTYPAGE_WIDTH		109
+
+//about titlebar
+
+#define FI_EXPANSION_INDICATOR	1
+#define FT_TITLE				2
+#define STR_MOREPROPERTY_QUICKHELP	3
+
+#define TITLEBAR_WIDTH				PROPERTYPAGE_WIDTH
+#define TITLEBAR_HEIGHT				13
+
+#define TITLEBAR_MARGIN_HORIZONTAL			3
+#define TITLEBAR_CONTROL_SPACING_HORIZONTAL	3
+
+#define FI_EXPANSION_INDICATOR_WIDTH	6
+#define FI_EXPANSION_INDICATOR_HEIGTH	6
+#define FI_EXPANSION_INDICATOR_X		TITLEBAR_MARGIN_HORIZONTAL
+#define FI_EXPANSION_INDICATOR_Y		(TITLEBAR_HEIGHT - FI_EXPANSION_INDICATOR_HEIGTH)/2
+
+#define FT_TITLE_WIDTH			85
+#define FT_TITLE_HEIGHT			10
+#define FT_TITLE_X				FI_EXPANSION_INDICATOR_X + FI_EXPANSION_INDICATOR_WIDTH + TITLEBAR_CONTROL_SPACING_HORIZONTAL
+#define FT_TITLE_Y				(TITLEBAR_HEIGHT - FT_TITLE_HEIGHT)/2 + 1
+
+
+//about section page 
+#define SECTIONPAGE_MARGIN_VERTICAL		12
+#define SECTIONPAGE_MARGIN_VERTICAL_TOP		1
+#define SECTIONPAGE_MARGIN_VERTICAL_BOT		5
+#define SECTIONPAGE_MARGIN_HORIZONTAL	3
+#define CONTROL_SPACING_VERTICAL		5
+#define CONTROL_SPACING_HORIZONTAL		3
+#define TEXT_CONTROL_SPACING_VERTICAL	2
+
+#define TEXT_HEIGHT			8
+#define CBOX_HEIGHT			12
+#define MBOX_HEIGHT			12
+
+#define TBX_OUT_BORDER_OFFSET_X		2
+#define TBX_OUT_BORDER_OFFSET_Y		1
+
+//for 16*16 pixel bmp
+#define TOOLBOX_ITEM_HEIGHT			15
+#define TOOLBOX_ITEM_WIDTH			13
+#define TOOLBOX_ITEM_DD_WIDTH		19
+
+//for 24*16 pixel bmp
+#define TOOLBOX_24_16_ITEM_HEIGHT		15
+#define TOOLBOX_24_16_ITEM_DD_WIDTH		23
+
+//for 24*24 pixel bmp
+#define TOOLBOX_24_24_ITEM_HEIGHT		18
+#define TOOLBOX_24_24_ITEM_DD_WIDTH		24
+
+//about popup panel
+#define POPUPPANEL_MARGIN_VERTICAL		7
+#define POPUPPANEL_MARGIN_HORIZONTAL	7
+
+//for 42*42 pixel bmp
+#define TOOLBOX_42_42_ITEM_HEIGHT		30
+#define TOOLBOX_42_42_ITEM_DD_WIDTH		27
+#define TB_BORDER				2
+
+#define POPUPPANEL_SEP_VERTICAL_1	10
+#define POPUPPANEL_SEP_VERTICAL_2	6
+#define POPUPPANEL_SEP_HEIGHT		1
+ 
+#define POPUP_BORDER_WIDTH		2
+#define POPUP_BORDER_HEIGHT		3
+#define OFFSET_X		1
+#define OFFSET_Y		1
+
+#define POPUP_TOP_GRADIENT_HEIGHT	4
+#define POPUP_BOT_GRADIENT_HEIGHT	6
+
+#define POPUP_COLOR_PICKER_WIDTH	97
+#define POPUP_COLOR_PICKER_HEIGHT	114
+//new
+#define POPUPPANEL_MARGIN_SMALL		2
+#define POPUPPANEL_MARGIN_LARGE		5
+#endif
diff --git a/main/sfx2/inc/sfx2/templdlg.hxx b/main/sfx2/inc/sfx2/templdlg.hxx
index 98e5a39..ec3f14e 100644
--- a/main/sfx2/inc/sfx2/templdlg.hxx
+++ b/main/sfx2/inc/sfx2/templdlg.hxx
@@ -25,7 +25,7 @@
 
 #include "sal/config.h"
 #include "sfx2/dllapi.h"
-
+#include <vcl/ctrl.hxx>
 #include <rsc/rscsfx.hxx>
 
 #include <sfx2/dockwin.hxx>
@@ -94,5 +94,29 @@
     void            SetParagraphFamily();
 };
 
+// class SfxTemplatePanelControl -----------------------------------------
+
+class SFX2_DLLPUBLIC SfxTemplatePanelControl : public DockingWindow
+{
+public:
+    SfxTemplatePanelControl (SfxBindings* pBindings, Window* pParentWindow);
+	~SfxTemplatePanelControl (void);
+
+    virtual void                Update();
+    virtual void                DataChanged( const DataChangedEvent& _rDCEvt );
+    virtual void                Resize();
+    virtual SfxChildAlignment   CheckAlignment( SfxChildAlignment, SfxChildAlignment );
+    virtual void                StateChanged( StateChangedType nStateChange );
+    virtual void                FreeResource (void);
+    
+    ISfxTemplateCommon*         GetISfxTemplateCommon();
+    void                        SetParagraphFamily();
+
+private:
+    SfxTemplateDialog_Impl*     pImpl;
+    SfxBindings* mpBindings;
+};
+
+
 #endif
 
diff --git a/main/sfx2/sdi/frmslots.sdi b/main/sfx2/sdi/frmslots.sdi
index edb818f..5e836e8 100644
--- a/main/sfx2/sdi/frmslots.sdi
+++ b/main/sfx2/sdi/frmslots.sdi
@@ -51,6 +51,11 @@
 		ExecMethod = ChildWindowExecute ;
 		StateMethod = ChildWindowState ;
 	]
+	SID_SIDEBAR // status(final|play)
+	[
+		ExecMethod = ChildWindowExecute ;
+		StateMethod = ChildWindowState ;
+	]
 	SID_SHOW_BROWSER // ole(no) api(final/play/rec)
 	[
 		ExecMethod = ChildWindowExecute ;
diff --git a/main/sfx2/sdi/sfx.sdi b/main/sfx2/sdi/sfx.sdi
index 3e6a9ed..1e115ae 100644
--- a/main/sfx2/sdi/sfx.sdi
+++ b/main/sfx2/sdi/sfx.sdi
@@ -3983,6 +3983,32 @@
 ]
 
 //--------------------------------------------------------------------------
+SfxBoolItem Sidebar SID_SIDEBAR
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = TRUE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Asynchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
 SfxVoidItem RestoreEditingView SID_RESTORE_EDITING_VIEW
 
 [
diff --git a/main/sfx2/source/control/bindings.cxx b/main/sfx2/source/control/bindings.cxx
index 7c3ae9b..05c01ae 100644
--- a/main/sfx2/source/control/bindings.cxx
+++ b/main/sfx2/source/control/bindings.cxx
@@ -1035,7 +1035,7 @@
 void SfxBindings::Register_Impl( SfxControllerItem& rItem, sal_Bool bInternal )
 {
     DBG_MEMTEST();
-    DBG_ASSERT( nRegLevel > 0, "registration without EnterRegistrations" );
+    //    DBG_ASSERT( nRegLevel > 0, "registration without EnterRegistrations" );
     DBG_ASSERT( !pImp->bInNextJob, "SfxBindings::Register while status-updating" );
 
     // insert new cache if it does not already exist
diff --git a/main/sfx2/source/control/shell.cxx b/main/sfx2/source/control/shell.cxx
index 129bd77..f455962 100644
--- a/main/sfx2/source/control/shell.cxx
+++ b/main/sfx2/source/control/shell.cxx
@@ -51,6 +51,7 @@
 #include <sfx2/mnumgr.hxx>
 #include "statcach.hxx"
 #include <sfx2/msgpool.hxx>
+#include <sfx2/sidebar/ContextChangeBroadcaster.hxx>
 
 //====================================================================
 
@@ -86,6 +87,8 @@
     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 @@
 
 {
 	DBG_DTOR(SfxShell, 0);
+
+    
 	delete pImp;
 }
 
@@ -764,6 +769,9 @@
 */
 
 {
+    SfxViewFrame* pViewFrame = GetFrame();
+    if (pViewFrame != NULL)
+        pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface());
 }
 
 //--------------------------------------------------------------------
@@ -797,6 +805,9 @@
 */
 
 {
+    SfxViewFrame* pViewFrame = GetFrame();
+    if (pViewFrame != NULL)
+        pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface());
 }
 
 void SfxShell::ParentActivate
@@ -1275,6 +1286,11 @@
 {
 }
 
+void SfxShell::SetContextName (const ::rtl::OUString& rsContextName)
+{
+    pImp->maContextChangeBroadcaster.Initialize(rsContextName);
+}
+
 void SfxShell::SetViewShell_Impl( SfxViewShell* pView )
 {
     pImp->pViewSh = pView;
diff --git a/main/sfx2/source/dialog/dialog.src b/main/sfx2/source/dialog/dialog.src
index 2708b70..c0b62d9 100644
--- a/main/sfx2/source/dialog/dialog.src
+++ b/main/sfx2/source/dialog/dialog.src
@@ -103,6 +103,10 @@
 {
     Text [ en-US ] = "Task Pane";
 };
+String SID_SIDEBAR
+{
+    Text [ en-US ] = "Sidebar";
+};
 
 ErrorBox MSG_ERROR_WRONG_CONFIRM
 {
diff --git a/main/sfx2/source/dialog/dockwin.cxx b/main/sfx2/source/dialog/dockwin.cxx
index 19b0908..f700975 100644
--- a/main/sfx2/source/dialog/dockwin.cxx
+++ b/main/sfx2/source/dialog/dockwin.cxx
@@ -1859,11 +1859,12 @@
 {
     if ( rEvt.GetType() == EVENT_GETFOCUS )
 	{
-		pBindings->SetActiveFrame( pMgr->GetFrame() );
+        if (pMgr != NULL)
+            pBindings->SetActiveFrame( pMgr->GetFrame() );
 
 		if ( pImp->pSplitWin )
 			pImp->pSplitWin->SetActiveWindow_Impl( this );
-		else
+		else if (pMgr != NULL)
 			pMgr->Activate_Impl();
 
         Window* pWindow = rEvt.GetWindow();
@@ -1894,7 +1895,8 @@
     else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() )
 	{
         pBindings->SetActiveFrame( NULL );
-        pMgr->Deactivate_Impl();
+        if (pMgr != NULL)
+            pMgr->Deactivate_Impl();
 	}
 
 	return DockingWindow::Notify( rEvt );
diff --git a/main/sfx2/source/dialog/taskpane.cxx b/main/sfx2/source/dialog/taskpane.cxx
index fcc91d6..2324b78 100644
--- a/main/sfx2/source/dialog/taskpane.cxx
+++ b/main/sfx2/source/dialog/taskpane.cxx
@@ -944,7 +944,7 @@
             LINK( this, TaskPaneController_Impl, OnToolboxClicked )
         );
         m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) );
-        impl_setLayout( LAYOUT_DRAWERS, true );
+        impl_setLayout(LAYOUT_TABS_RIGHT, true);
 
         m_rTaskPane.GetPanelDeck().AddListener( *this );
 
diff --git a/main/sfx2/source/dialog/templdlg.cxx b/main/sfx2/source/dialog/templdlg.cxx
index f82b2d4..cc3c91f 100644
--- a/main/sfx2/source/dialog/templdlg.cxx
+++ b/main/sfx2/source/dialog/templdlg.cxx
@@ -125,7 +125,7 @@
 */
 	: SfxDockingWindow( pBind, pCW, pParent, SfxResId(DLG_STYLE_DESIGNER) ),
 
-	pImpl( new SfxTemplateDialog_Impl( pParent, pBind, this ) )
+	pImpl( new SfxTemplateDialog_Impl( pBind, this ) )
 
 {
 	pImpl->updateNonFamilyImages();
@@ -405,6 +405,135 @@
     static_cast< SfxTemplateDialog* >( GetWindow() )->SetParagraphFamily();
 }
 
+
+
+//===== SfxTemplatePanelControl ===============================================
+
+SfxTemplatePanelControl::SfxTemplatePanelControl (
+    SfxBindings* pBindings,
+	Window* pParentWindow)
+    : DockingWindow(pParentWindow, SfxResId(DLG_STYLE_DESIGNER) ),
+      pImpl(new SfxTemplateDialog_Impl(pBindings, this)),
+      mpBindings(pBindings)
+{
+    OSL_ASSERT(mpBindings!=NULL);
+
+    pImpl->updateNonFamilyImages();
+}
+
+
+
+
+SfxTemplatePanelControl::~SfxTemplatePanelControl (void)
+{
+    delete pImpl;
+}
+
+
+
+
+ISfxTemplateCommon* SfxTemplatePanelControl::GetISfxTemplateCommon()
+{
+	return pImpl->GetISfxTemplateCommon();
+}
+
+
+
+
+void SfxTemplatePanelControl::SetParagraphFamily()
+{
+    // first select the paragraph family
+    pImpl->FamilySelect( SFX_STYLE_FAMILY_PARA );
+    // then select the automatic filter
+    pImpl->SetAutomaticFilter();
+}
+
+
+
+
+void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt )
+{
+	if ( ( DATACHANGED_SETTINGS == _rDCEvt.GetType() ) &&
+		 ( 0 != ( SETTINGS_STYLE & _rDCEvt.GetFlags() ) ) )
+	{
+        pImpl->updateFamilyImages();
+        pImpl->updateNonFamilyImages();
+	}
+
+	DockingWindow::DataChanged( _rDCEvt );
+}
+
+
+
+
+void SfxTemplatePanelControl::Update()
+{
+	pImpl->Update();
+}
+
+
+
+
+void SfxTemplatePanelControl::Resize()
+{
+	if(pImpl)
+		pImpl->Resize();
+	DockingWindow::Resize();
+}
+
+
+void SfxTemplatePanelControl::FreeResource (void)
+{
+    DockingWindow::FreeResource();
+}
+
+
+SfxChildAlignment SfxTemplatePanelControl::CheckAlignment(SfxChildAlignment eActAlign,SfxChildAlignment eAlign)
+{
+    switch (eAlign)
+    {
+        case SFX_ALIGN_TOP:
+        case SFX_ALIGN_HIGHESTTOP:
+        case SFX_ALIGN_LOWESTTOP:
+        case SFX_ALIGN_BOTTOM:
+        case SFX_ALIGN_LOWESTBOTTOM:
+        case SFX_ALIGN_HIGHESTBOTTOM:
+            return eActAlign;
+
+        case SFX_ALIGN_LEFT:
+        case SFX_ALIGN_RIGHT:
+        case SFX_ALIGN_FIRSTLEFT:
+        case SFX_ALIGN_LASTLEFT:
+        case SFX_ALIGN_FIRSTRIGHT:
+        case SFX_ALIGN_LASTRIGHT:
+            return eAlign;
+
+        default:
+            return eAlign;
+    }
+}
+
+
+void SfxTemplatePanelControl::StateChanged( StateChangedType nStateChange )
+{
+	if ( nStateChange == STATE_CHANGE_INITSHOW )
+	{
+		SfxViewFrame *pFrame = mpBindings->GetDispatcher_Impl()->GetFrame();
+		Window* pEditWin = pFrame->GetViewShell()->GetWindow();
+
+		Size aSize = pEditWin->GetSizePixel();
+		Point aPoint = pEditWin->OutputToScreenPixel( pEditWin->GetPosPixel() );
+		aPoint = GetParent()->ScreenToOutputPixel( aPoint );
+		Size aWinSize = GetSizePixel();
+		aPoint.X() += aSize.Width() - aWinSize.Width() - 20;
+		aPoint.Y() += aSize.Height() / 2 - aWinSize.Height() / 2;
+        //		SetFloatingPos( aPoint );
+	}
+
+	DockingWindow::StateChanged( nStateChange );
+}
+
+
 //=========================================================================
 SV_DECL_PTRARR_DEL(ExpandedEntries, StringPtr,16,8)
 SV_IMPL_PTRARR(ExpandedEntries, StringPtr)
@@ -740,7 +869,7 @@
 
 // Konstruktor
 
-SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, SfxDockingWindow* pW ) :
+SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* pW, bool ) :
 
 	aISfxTemplateCommon		( this ),
 	pBindings				( pB ),
@@ -788,7 +917,7 @@
 
 //-------------------------------------------------------------------------
 
-SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, ModalDialog* pW ) :
+SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* pW ) :
 
 	aISfxTemplateCommon		( this ),
 	pBindings				( pB ),
@@ -2321,10 +2450,11 @@
 
 // ------------------------------------------------------------------------
 
+   
 SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
-	Window* /*pParent*/, SfxBindings* pB, SfxTemplateDialog* pDlgWindow ) :
+	SfxBindings* pB, SfxTemplateDialog* pDlgWindow ) :
 
-	SfxCommonTemplateDialog_Impl( pB, pDlgWindow ),
+	SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ),
 
 	m_pFloat			( pDlgWindow ),
 	m_bZoomIn			( sal_False ),
@@ -2332,8 +2462,24 @@
 	m_aActionTbR		( pDlgWindow, SfxResId( TB_ACTION ) )
 
 {
-	pDlgWindow->FreeResource();
+    pDlgWindow->FreeResource();
+    Initialize();
+}
 
+SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(
+    SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow )
+    : SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ),
+      m_pFloat			( pDlgWindow ),
+      m_bZoomIn			( sal_False ),
+      m_aActionTbL        ( pDlgWindow, this ),
+      m_aActionTbR		( pDlgWindow, SfxResId( TB_ACTION ) )
+{
+    pDlgWindow->FreeResource();
+    Initialize();
+}
+
+void SfxTemplateDialog_Impl::Initialize (void)
+{
     // Read the filter stored in the configuration
     // This is already done in ReadResource(), invoked by Initialize()
     // and stored in nActFilter, but we can't rely on nActFilter's value
@@ -2343,17 +2489,17 @@
     const sal_uInt16 nConfigFilter = pCurObjShell ?
         static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) ) : 0;
 
-	Initialize();
+    SfxCommonTemplateDialog_Impl::Initialize();
 
-	m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
-	m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
+    m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
+    m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
     m_aActionTbR.SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
-	m_aActionTbL.Show();
-	m_aActionTbR.Show();
-	Font aFont=aFilterLb.GetFont();
-	aFont.SetWeight( WEIGHT_NORMAL );
-	aFilterLb.SetFont( aFont );
-	m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
+    m_aActionTbL.Show();
+    m_aActionTbR.Show();
+    Font aFont=aFilterLb.GetFont();
+    aFont.SetWeight( WEIGHT_NORMAL );
+    aFilterLb.SetFont( aFont );
+    m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
 
     if ( nConfigFilter == SFX_TEMPLDLG_FILTER_HIERARCHICAL )
     {
@@ -2405,7 +2551,11 @@
 		return;
 
 	// let the families collection update the images
-	sal_Bool bIsHighContrast = m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode();
+	sal_Bool bIsHighContrast;
+    if (m_pFloat != NULL)
+        bIsHighContrast = m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode();
+    else
+        bIsHighContrast = false;
 	pStyleFamilies->updateImages( *m_pStyleFamiliesId, bIsHighContrast ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL );
 
 	// and set the new images on our toolbox
@@ -2421,8 +2571,9 @@
 // ------------------------------------------------------------------------
 void SfxTemplateDialog_Impl::updateNonFamilyImages()
 {
-	m_aActionTbR.SetImageList( ImageList( SfxResId(
-		m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_LST_STYLE_DESIGNER_HC
+    if (m_pFloat != NULL)
+        m_aActionTbR.SetImageList( ImageList( SfxResId(
+                    m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_LST_STYLE_DESIGNER_HC
 															 : DLG_STYLE_DESIGNER ) ) );
 }
 
@@ -2477,7 +2628,8 @@
 // Die Groesse der Listboxen wird angepasst
 void SfxTemplateDialog_Impl::Resize()
 {
-	FloatingWindow *pF = m_pFloat->GetFloatingWindow();
+    SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat);
+	FloatingWindow *pF = pDockingWindow!=NULL ? pDockingWindow->GetFloatingWindow() : NULL;
 	if ( pF )
 	{
 // 		if(pF->IsZoomedIn() && m_bZoomIn==sal_False)
@@ -2489,6 +2641,8 @@
 			return;
 	}
 
+    if (m_pFloat == NULL)
+        return;            
 	Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel());
 	Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
 	Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
@@ -2551,23 +2705,29 @@
 
 Size SfxTemplateDialog_Impl::GetMinOutputSizePixel()
 {
-	Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
-	Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
-	Size aMinSize=Size(
-		aSizeATL.Width()+aSizeATR.Width()+
-		2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE,
-		4*aSizeATL.Height()+2*SFX_TEMPLDLG_MIDVSPACE);
-	return aMinSize;
+    if (m_pFloat != NULL)
+    {
+        Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
+        Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
+        Size aMinSize=Size(
+            aSizeATL.Width()+aSizeATR.Width()+
+                2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE,
+            4*aSizeATL.Height()+2*SFX_TEMPLDLG_MIDVSPACE);
+        return aMinSize;
+    }
+    else
+        return Size(0,0);
 }
 
 //-------------------------------------------------------------------------
 
 void SfxTemplateDialog_Impl::Command( const CommandEvent& rCEvt )
 {
-	if(COMMAND_CONTEXTMENU  == rCEvt.GetCommand())
-		ExecuteContextMenu_Impl( rCEvt.GetMousePosPixel(), m_pFloat );
-	else
-		m_pFloat->Command(rCEvt);
+    if (m_pFloat != NULL)
+        if(COMMAND_CONTEXTMENU  == rCEvt.GetCommand())
+            ExecuteContextMenu_Impl( rCEvt.GetMousePosPixel(), m_pFloat );
+        else
+            m_pFloat->Command(rCEvt);
 }
 
 //-------------------------------------------------------------------------
diff --git a/main/sfx2/source/inc/helpid.hrc b/main/sfx2/source/inc/helpid.hrc
index 1630939..4b8c7aa 100644
--- a/main/sfx2/source/inc/helpid.hrc
+++ b/main/sfx2/source/inc/helpid.hrc
@@ -332,6 +332,8 @@
 #define HID_TASKPANE_VIEW_MENU                                  "SFX2_HID_TASKPANE_VIEW_MENU"
 #define HID_DOCINFOSECURITY                                     "SFX2_HID_DOCINFOSECURITY"
 
+#define HID_SIDEBAR_WINDOW                                     "SFX2_HID_SIDEBAR_WINDOW"
+
 #endif // #ifndef _SFX_HELPID_HRC
 
 // ******************************************************************* EOF
diff --git a/main/sfx2/source/inc/templdgi.hxx b/main/sfx2/source/inc/templdgi.hxx
index c80a5cd..b5b68f4 100644
--- a/main/sfx2/source/inc/templdgi.hxx
+++ b/main/sfx2/source/inc/templdgi.hxx
@@ -241,8 +241,8 @@
 public:
 	TYPEINFO();
 
-	SfxCommonTemplateDialog_Impl( SfxBindings* pB, SfxDockingWindow* );
-	SfxCommonTemplateDialog_Impl( SfxBindings* pB, ModalDialog* );
+	SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window*, bool );
+	SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* );
 	~SfxCommonTemplateDialog_Impl();
 
 	DECL_LINK( MenuSelectHdl, Menu * );
@@ -297,9 +297,10 @@
 	friend class SfxTemplateControllerItem;
 	friend class SfxTemplateDialogWrapper;
     friend class DropToolBox_Impl;
+    friend class SfxTemplatePanelControl;
 
-	SfxTemplateDialog*	m_pFloat;
-	sal_Bool				m_bZoomIn;
+	Window*	m_pFloat;
+	sal_Bool			m_bZoomIn;
     DropToolBox_Impl    m_aActionTbL;
 	ToolBox				m_aActionTbR;
 
@@ -330,8 +331,11 @@
 	friend class SfxTemplateDialog;
 	TYPEINFO();
 
-	SfxTemplateDialog_Impl( Window* pParent, SfxBindings*, SfxTemplateDialog* pWindow );
+	SfxTemplateDialog_Impl( SfxBindings*, SfxTemplateDialog* pDlgWindow );
+	SfxTemplateDialog_Impl( SfxBindings*, SfxTemplatePanelControl* pDlgWindow );
 	~SfxTemplateDialog_Impl();
+
+    void Initialize (void);
 };
 
 // class SfxTemplateCatalog_Impl -----------------------------------------
diff --git a/main/sfx2/source/sidebar/AsynchronousCall.cxx b/main/sfx2/source/sidebar/AsynchronousCall.cxx
new file mode 100755
index 0000000..c7c679c
--- /dev/null
+++ b/main/sfx2/source/sidebar/AsynchronousCall.cxx
@@ -0,0 +1,93 @@
+/**************************************************************
+ * 
+ * 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 "AsynchronousCall.hxx"
+
+#include <vcl/svapp.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+AsynchronousCall::AsynchronousCall (const Action& rAction)
+    : maAction(rAction),
+      mnCallId(0)
+{
+}
+
+
+
+
+AsynchronousCall::~AsynchronousCall (void)
+{
+    CancelRequest();
+}
+
+
+
+
+void AsynchronousCall::RequestCall (const Action& rAction)
+{
+    CancelRequest();
+    maAction = rAction;
+    RequestCall();
+}
+
+
+
+
+void AsynchronousCall::RequestCall (void)
+{
+    if (mnCallId == 0)
+    {
+        Link aLink (LINK(this, AsynchronousCall, HandleUserCall));
+        mnCallId = Application::PostUserEvent(aLink);
+    }
+}
+
+
+
+
+void AsynchronousCall::CancelRequest (void)
+{
+    if (mnCallId != 0)
+    {
+        Application::RemoveUserEvent(mnCallId);
+        mnCallId = -1;
+    }
+}
+
+
+
+
+IMPL_LINK(AsynchronousCall, HandleUserCall, void*, EMPTYARG )
+{
+    mnCallId = 0;
+    if (maAction)
+        maAction();
+
+    return sal_True;
+}
+
+
+} } // end of namespace sfx2::sidebar
+
diff --git a/main/sfx2/source/sidebar/AsynchronousCall.hxx b/main/sfx2/source/sidebar/AsynchronousCall.hxx
new file mode 100755
index 0000000..78e49e1
--- /dev/null
+++ b/main/sfx2/source/sidebar/AsynchronousCall.hxx
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * 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_ASYNCHRONOUS_CALL_HXX
+#define SFX_SIDEBAR_ASYNCHRONOUS_CALL_HXX
+
+#include <boost/function.hpp>
+#include <tools/solar.h>
+#include <tools/link.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+/** A simple asynchronous call via Application::PostUserCall.
+*/
+class AsynchronousCall
+{
+public:
+    typedef ::boost::function<void(void)> Action;
+    
+    AsynchronousCall (const Action& rAction);
+    ~AsynchronousCall (void);
+
+    void RequestCall (const Action& rAction);
+    void RequestCall (void);
+    void CancelRequest (void);
+    
+private:
+    Action maAction;
+    sal_uLong mnCallId;
+
+    DECL_LINK(HandleUserCall, void*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Context.cxx b/main/sfx2/source/sidebar/Context.cxx
new file mode 100644
index 0000000..08b6071
--- /dev/null
+++ b/main/sfx2/source/sidebar/Context.cxx
@@ -0,0 +1,122 @@
+/**************************************************************
+ * 
+ * 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 "Context.hxx"
+
+#define AnyApplicationName "any"
+#define AnyContextName "any"
+
+namespace sfx2 { namespace sidebar {
+
+const sal_Int32 Context::NoMatch = 4;
+const sal_Int32 Context::ApplicationWildcardMatch = 1;
+const sal_Int32 Context::ContextWildcardMatch = 2;
+const sal_Int32 Context::OptimalMatch = 0;  // Neither application nor context name is "any".
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+Context::Context (void)
+    : msApplication(A2S(AnyApplicationName)),
+      msContext(A2S(AnyContextName))
+{
+}
+
+
+
+
+Context::Context (
+    const ::rtl::OUString& rsApplication,
+    const ::rtl::OUString& rsContext)
+    : msApplication(rsApplication),
+      msContext(rsContext)
+{
+}
+
+
+
+
+sal_Int32 Context::EvaluateMatch (
+    const Context& rOther) const
+{
+    const bool bApplicationNameIsAny (rOther.msApplication.equalsAscii(AnyApplicationName));
+    if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny)
+    {
+        // Application name matches.
+        const bool bContextNameIsAny (rOther.msContext.equalsAscii(AnyContextName));
+        if (rOther.msContext.equals(msContext) || bContextNameIsAny)
+        {
+            // Context name matches.
+            return (bApplicationNameIsAny ? ApplicationWildcardMatch : 0)
+                + (bContextNameIsAny ? ContextWildcardMatch : 0);
+        }
+    }
+    return NoMatch;
+}
+
+
+
+
+sal_Int32 Context::EvaluateMatch (const ::std::vector<Context>& rOthers) const
+{
+    sal_Int32 nBestMatch (NoMatch);
+    
+    for (::std::vector<Context>::const_iterator
+             iContext(rOthers.begin()),
+             iEnd(rOthers.end());
+         iContext!=iEnd;
+         ++iContext)
+    {
+        const sal_Int32 nMatch (EvaluateMatch(*iContext));
+        if (nMatch < nBestMatch)
+        {
+            if (nMatch == OptimalMatch)
+            {
+                // We will find no better match so stop searching.
+                return OptimalMatch;
+            }
+            nBestMatch = nMatch;
+        }
+    }
+    return nBestMatch;
+}
+
+
+
+
+bool Context::operator== (const Context& rOther) const
+{
+    return msApplication.equals(rOther.msApplication)
+        && msContext.equals(rOther.msContext);
+}
+
+
+
+
+bool Context::operator!= (const Context& rOther) const
+{
+    return ( ! msApplication.equals(rOther.msApplication))
+        || ( ! msContext.equals(rOther.msContext));
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Context.hxx b/main/sfx2/source/sidebar/Context.hxx
new file mode 100644
index 0000000..58e66f6
--- /dev/null
+++ b/main/sfx2/source/sidebar/Context.hxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ * 
+ * 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_HXX
+#define SFX_SIDEBAR_CONTEXT_HXX
+
+#include "rtl/ustring.hxx"
+
+#include <vector>
+
+namespace sfx2 { namespace sidebar {
+
+class Context
+{
+public:
+    ::rtl::OUString msApplication;
+    ::rtl::OUString msContext;
+
+    Context (void);
+    Context (
+        const ::rtl::OUString& rsApplication,
+        const ::rtl::OUString& rsContext);
+    
+    /** When two contexts are matched against each other then
+        application or context name may have the wildcard value 'any'.
+        In order to prefer matches without wildcards over matches with
+        wildcards we introduce a integer evaluation for matches.
+    */
+    const static sal_Int32 NoMatch;
+    const static sal_Int32 OptimalMatch;
+    const static sal_Int32 ApplicationWildcardMatch;
+    const static sal_Int32 ContextWildcardMatch;
+
+    /** Return the numeric value that describes how good the match
+        between two contexts is.
+        Smaller values represent better matches.
+    */
+    sal_Int32 EvaluateMatch (const Context& rOther) const;
+
+    /** Return the best match against the given list of contexts.
+    */
+    sal_Int32 EvaluateMatch (const ::std::vector<Context>& rOthers) const;
+
+    bool operator== (const Context& rOther) const;
+    bool operator!= (const Context& rOther) const;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
new file mode 100644
index 0000000..f2f6bb9
--- /dev/null
+++ b/main/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
@@ -0,0 +1,140 @@
+/**************************************************************
+ * 
+ * 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() || ! rxFrame->getController().is())
+    {
+        // Frame is (probably) being deleted.  Broadcasting context
+        // changes is not necessary anymore.
+        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)
+{
+    if ( ! rxFrame.is() || ! rxFrame->getController().is())
+        return OUString();
+    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
diff --git a/main/sfx2/source/sidebar/ContextList.cxx b/main/sfx2/source/sidebar/ContextList.cxx
new file mode 100644
index 0000000..ee4eca9
--- /dev/null
+++ b/main/sfx2/source/sidebar/ContextList.cxx
@@ -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
diff --git a/main/sfx2/source/sidebar/ContextList.hxx b/main/sfx2/source/sidebar/ContextList.hxx
new file mode 100644
index 0000000..473785c
--- /dev/null
+++ b/main/sfx2/source/sidebar/ContextList.hxx
@@ -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
diff --git a/main/sfx2/source/sidebar/ContextMatcher.cxx b/main/sfx2/source/sidebar/ContextMatcher.cxx
new file mode 100644
index 0000000..775d48d
--- /dev/null
+++ b/main/sfx2/source/sidebar/ContextMatcher.cxx
@@ -0,0 +1,140 @@
+/**************************************************************
+ * 
+ * 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 "ContextMatcher.hxx"
+#include "Context.hxx"
+
+using ::rtl::OUString;
+
+namespace sfx2 { namespace sidebar {
+
+namespace {
+    static const sal_Char* gsAny = "any";
+}
+
+
+
+ContextMatcher::ContextMatcher (void)
+    : maEntries()
+{
+}
+
+
+
+
+ContextMatcher::~ContextMatcher (void)
+{
+}
+
+
+
+
+sal_Int32 ContextMatcher::EvaluateMatch (
+    const Context& rContext) const
+{
+    sal_Int32 nBestMatch (Context::NoMatch);
+    
+    for (::std::vector<Entry>::const_iterator
+             iEntry(maEntries.begin()),
+             iEnd(maEntries.end());
+         iEntry!=iEnd;
+         ++iEntry)
+    {
+        const sal_Int32 nMatch (EvaluateMatch(rContext, *iEntry));
+        if (nMatch < nBestMatch)
+            nBestMatch = nMatch;
+            if (nBestMatch == Context::OptimalMatch)
+            break;
+    }
+
+    return nBestMatch;
+}
+
+
+
+
+sal_Int32 ContextMatcher::EvaluateMatch (
+    const Context& rContext,
+    const Entry& rEntry) const
+{
+    sal_Int32 nApplicationMatch (Context::NoMatch);
+    if (rContext.msApplication.equals(rEntry.msApplicationName))
+        nApplicationMatch = 0;
+    else if (rEntry.msApplicationName.equalsAscii(gsAny))
+        nApplicationMatch = Context::ApplicationWildcardMatch;
+    else
+        return Context::NoMatch;
+
+    sal_Int32 nBestContextMatch (Context::NoMatch);
+    for (::std::vector<OUString>::const_iterator
+             iContext(rEntry.maContextNames.begin()),
+             iEnd(rEntry.maContextNames.end());
+         iContext!=iEnd;
+         ++iContext)
+    {
+        sal_Int32 nContextMatch (Context::NoMatch);
+        if (rContext.msContext.equals(*iContext))
+            nContextMatch = 0;
+        else if (iContext->equalsAscii(gsAny))
+            nContextMatch = Context::ContextWildcardMatch;
+        else
+            continue;
+        if (nContextMatch < nBestContextMatch)
+            nBestContextMatch = nContextMatch;
+    }
+
+    if (rEntry.mbIsContextListNegated)
+        nBestContextMatch = Context::NoMatch - nBestContextMatch;
+        
+    return nApplicationMatch + nBestContextMatch;
+}
+
+
+
+
+void ContextMatcher::AddMatcher (
+    const ::rtl::OUString& rsApplicationName,
+    const ::std::vector<rtl::OUString>& rContextNames,
+    const bool bIsContextListNegated)
+{
+    maEntries.push_back(Entry());
+    maEntries.back().msApplicationName = rsApplicationName;
+    maEntries.back().maContextNames = rContextNames;
+    maEntries.back().mbIsContextListNegated = bIsContextListNegated;
+}
+
+
+
+
+void ContextMatcher::AddMatcher (
+    const ::rtl::OUString& rsApplicationName,
+    const ::rtl::OUString& rsContextName)
+{
+    maEntries.push_back(Entry());
+    maEntries.back().msApplicationName = rsApplicationName;
+    maEntries.back().maContextNames.push_back(rsContextName);
+    maEntries.back().mbIsContextListNegated = false;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/ContextMatcher.hxx b/main/sfx2/source/sidebar/ContextMatcher.hxx
new file mode 100644
index 0000000..29bd228
--- /dev/null
+++ b/main/sfx2/source/sidebar/ContextMatcher.hxx
@@ -0,0 +1,75 @@
+/**************************************************************
+ * 
+ * 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_MATCHER_HXX
+#define SFX_SIDEBAR_CONTEXT_MATCHER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+
+namespace sfx2 { namespace sidebar {
+
+class Context;
+
+
+/** Data read from the configuration for matching contexts.
+*/
+class ContextMatcher
+{
+public:
+    ContextMatcher (void);
+    ~ContextMatcher (void);
+
+    sal_Int32 EvaluateMatch (
+        const Context& rContext) const;
+
+    void AddMatcher (
+        const ::rtl::OUString& rsApplicationName,
+        const ::std::vector<rtl::OUString>& rContextNames,
+        const bool mbIsContextListNegated);
+    void AddMatcher (
+        const ::rtl::OUString& rsApplicationName,
+        const ::rtl::OUString& rsContextName);
+
+private:
+    class Entry
+    {
+    public:
+        ::rtl::OUString msApplicationName;
+        ::std::vector<rtl::OUString> maContextNames;
+        bool mbIsContextListNegated;
+    };
+    ::std::vector<Entry> maEntries;
+
+    sal_Int32 EvaluateMatch (
+        const Context& rContext,
+        const Entry& rEntry) const;
+
+};
+static bool IsMatchBetterThan (const sal_Int32 nMatchA, const sal_Int32 nMatchB);
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/ControlFactory.cxx b/main/sfx2/source/sidebar/ControlFactory.cxx
new file mode 100644
index 0000000..07a9c1d
--- /dev/null
+++ b/main/sfx2/source/sidebar/ControlFactory.cxx
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * 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 "sidebar/ControlFactory.hxx"
+
+#include "MenuButton.hxx"
+#include "TabItem.hxx"
+#include "SidebarToolBox.hxx"
+#include "ToolBoxBackground.hxx"
+#include "CustomImageRadioButton.hxx"
+#include <vcl/toolbox.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+
+CheckBox* ControlFactory::CreateMenuButton (Window* pParentWindow)
+{
+    return new MenuButton(pParentWindow);
+}
+
+
+
+
+ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow)
+{
+    return new TabItem(pParentWindow);
+}
+
+
+
+
+ToolBox* ControlFactory::CreateToolBox (
+    Window* pParentWindow,
+    const ResId& rResId)
+{
+    SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId);
+    pToolBox->SetBorderWindow(pParentWindow);
+
+    pToolBox->Invalidate();
+    
+    return pToolBox;
+}
+
+
+
+
+Window* ControlFactory::CreateToolBoxBackground (
+    Window* pParentWindow)
+{
+    ToolBoxBackground* pBorderWindow = new ToolBoxBackground(pParentWindow);
+    pBorderWindow->Show();
+    return pBorderWindow;
+}
+
+
+
+
+ImageRadioButton* ControlFactory::CreateCustomImageRadionButton(
+    Window* pParentWindow,
+    const ResId& rResId )
+{
+    return new CustomImageRadioButton(
+        pParentWindow,
+        rResId );
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/ControllerItem.cxx b/main/sfx2/source/sidebar/ControllerItem.cxx
new file mode 100644
index 0000000..15df1b5
--- /dev/null
+++ b/main/sfx2/source/sidebar/ControllerItem.cxx
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * 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 "sidebar/ControllerItem.hxx"
+
+namespace sfx2 { namespace sidebar {
+
+ControllerItem::ControllerItem (
+    const sal_uInt16 nId,
+    SfxBindings &rBindings,
+    ItemUpdateReceiverInterface& rItemUpdateReceiver)
+    : SfxControllerItem(nId, rBindings),
+      mrItemUpdateReceiver(rItemUpdateReceiver)
+{
+}
+
+
+
+
+ControllerItem::~ControllerItem (void)
+{
+}
+
+
+
+
+void ControllerItem::StateChanged (
+    sal_uInt16 nSID,
+    SfxItemState eState,
+    const SfxPoolItem* pState)
+{
+    mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState);
+}
+
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/CustomImageRadioButton.cxx b/main/sfx2/source/sidebar/CustomImageRadioButton.cxx
new file mode 100644
index 0000000..db0573f
--- /dev/null
+++ b/main/sfx2/source/sidebar/CustomImageRadioButton.cxx
@@ -0,0 +1,82 @@
+/**************************************************************
+ * 
+ * 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 "CustomImageRadioButton.hxx"
+
+#include "DrawHelper.hxx"
+#include "Paint.hxx"
+#include "Tools.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+CustomImageRadioButton::CustomImageRadioButton (
+    Window* pParentWindow,
+    const ResId& rResId )
+    : ImageRadioButton( pParentWindow, rResId )
+{
+    SetStyle( GetStyle() | WB_NOPOINTERFOCUS );
+}
+
+
+CustomImageRadioButton::~CustomImageRadioButton (void)
+{
+}
+
+
+void CustomImageRadioButton::Paint (const Rectangle& rUpdateArea)
+{
+    Rectangle aPaintRect( Rectangle(Point(0,0), GetSizePixel() ) );
+    SetMouseRect( aPaintRect );
+    SetStateRect( aPaintRect );
+
+    const Theme::ThemeItem eBackground = 
+        IsMouseOver()
+          ? Theme::Paint_TabItemBackgroundHighlight
+          : Theme::Paint_PanelBackground;
+    DrawHelper::DrawRoundedRectangle(
+        *this,
+        aPaintRect,
+        Theme::GetInteger(Theme::Int_ButtonCornerRadius),
+        IsChecked() || IsMouseOver() ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
+        Theme::GetPaint( eBackground ) );
+
+    const Image aIcon (GetModeRadioImage(Theme::IsHighContrastMode()
+            ? BMP_COLOR_HIGHCONTRAST
+            : BMP_COLOR_NORMAL));
+    const Size aIconSize (aIcon.GetSizePixel());
+    const Point aIconLocation(
+        (GetSizePixel().Width() - aIconSize.Width())/2,
+        (GetSizePixel().Height() - aIconSize.Height())/2 );
+    DrawImage(
+        aIconLocation,
+        aIcon,
+        IsEnabled() ? 0 : IMAGE_DRAW_DISABLE );
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/CustomImageRadioButton.hxx b/main/sfx2/source/sidebar/CustomImageRadioButton.hxx
new file mode 100644
index 0000000..c1c3f93
--- /dev/null
+++ b/main/sfx2/source/sidebar/CustomImageRadioButton.hxx
@@ -0,0 +1,49 @@
+/**************************************************************
+ * 
+ * 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_CUSTOM_IMAGE_RADIO_BUTTON_HXX
+#define SFX_SIDEBAR_CUSTOM_IMAGE_RADIO_BUTTON_HXX
+
+#include "vcl/button.hxx"
+
+#include "sfx2/sidebar/Theme.hxx"
+
+namespace sfx2 { namespace sidebar {
+
+/** A custom image radion button with more control over used colors for sidebar
+*/
+class CustomImageRadioButton
+    : public ImageRadioButton
+{
+public:
+    CustomImageRadioButton(
+        Window* pParentWindow,
+        const ResId& rResId );
+
+    virtual ~CustomImageRadioButton(void);
+
+    virtual void Paint( const Rectangle& rUpdateArea );
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Deck.cxx b/main/sfx2/source/sidebar/Deck.cxx
new file mode 100644
index 0000000..4bbb78a
--- /dev/null
+++ b/main/sfx2/source/sidebar/Deck.cxx
@@ -0,0 +1,389 @@
+/**************************************************************
+ * 
+ * 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 "Deck.hxx"
+#include "DeckDescriptor.hxx"
+#include "DeckLayouter.hxx"
+#include "DrawHelper.hxx"
+#include "DeckTitleBar.hxx"
+#include "Paint.hxx"
+#include "Panel.hxx"
+#include "ToolBoxBackground.hxx"
+#include "Tools.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <vcl/dockwin.hxx>
+#include <vcl/scrbar.hxx>
+#include <tools/svborder.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+namespace {
+    static const sal_Int32 MinimalPanelHeight (25);
+}
+
+
+Deck::Deck (
+    const DeckDescriptor& rDeckDescriptor,
+    Window* pParentWindow,
+    const ::boost::function<void(void)>& rCloserAction)
+    : Window(pParentWindow, 0),
+      msId(rDeckDescriptor.msId),
+      maIcon(),
+      msIconURL(rDeckDescriptor.msIconURL),
+      msHighContrastIconURL(rDeckDescriptor.msHighContrastIconURL),
+      maPanels(),
+      mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
+      mpScrollClipWindow(new Window(this)),
+      mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
+      mpFiller(new Window(this)),
+      mpVerticalScrollBar(new ScrollBar(this))
+{
+    SetBackground(Wallpaper());
+
+    mpScrollClipWindow->SetBackground(Wallpaper());
+    mpScrollClipWindow->Show();
+
+    mpScrollContainer->SetStyle(mpScrollContainer->GetStyle() | WB_DIALOGCONTROL);
+    mpScrollContainer->SetBackground(Wallpaper());
+    mpScrollContainer->Show();
+
+    mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange));
+
+#ifdef DEBUG
+    SetText(A2S("Deck"));
+    mpScrollClipWindow->SetText(A2S("ScrollClipWindow"));
+    mpFiller->SetText(A2S("Filler"));
+    mpVerticalScrollBar->SetText(A2S("VerticalScrollBar"));
+#endif
+}
+
+
+
+
+Deck::~Deck (void)
+{
+    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();
+}
+
+
+
+
+void Deck::Dispose (void)
+{
+    SharedPanelContainer aPanels;
+    aPanels.swap(maPanels);
+    for (SharedPanelContainer::iterator
+             iPanel(aPanels.begin()),
+             iEnd(aPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+		if (*iPanel)
+        {
+			(*iPanel)->Dispose();
+            OSL_ASSERT(iPanel->unique());
+            iPanel->reset();
+        }
+    }
+
+    mpTitleBar.reset();
+    mpFiller.reset();
+    mpVerticalScrollBar.reset();
+}
+
+
+
+
+const ::rtl::OUString& Deck::GetId (void) const
+{
+    return msId;
+}
+
+
+
+
+DeckTitleBar* Deck::GetTitleBar (void) const
+{
+    return mpTitleBar.get();
+}
+
+
+
+
+Rectangle Deck::GetContentArea (void) const
+{
+    const Size aWindowSize (GetSizePixel());
+    const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
+
+    return Rectangle(
+        Theme::GetInteger(Theme::Int_DeckLeftPadding) + nBorderSize,
+        Theme::GetInteger(Theme::Int_DeckTopPadding) + nBorderSize,
+        aWindowSize.Width() - 1 - Theme::GetInteger(Theme::Int_DeckRightPadding) - nBorderSize,
+        aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize);
+}
+
+
+
+
+::rtl::OUString Deck::GetIconURL (const bool bIsHighContrastModeActive) const
+{
+    if (bIsHighContrastModeActive)
+        return msHighContrastIconURL;
+    else
+        return msIconURL;
+}
+
+
+
+
+void Deck::Paint (const Rectangle& rUpdateArea)
+{
+    (void) rUpdateArea;
+    
+    const Size aWindowSize (GetSizePixel());
+    const SvBorder aPadding (
+            Theme::GetInteger(Theme::Int_DeckLeftPadding),
+            Theme::GetInteger(Theme::Int_DeckTopPadding),
+            Theme::GetInteger(Theme::Int_DeckRightPadding),
+            Theme::GetInteger(Theme::Int_DeckBottomPadding));
+
+    // Paint deck background outside the border.
+    Rectangle aBox(
+        0,
+        0,
+        aWindowSize.Width() - 1,
+        aWindowSize.Height() - 1);
+    DrawHelper::DrawBorder(
+        *this,
+        aBox,
+        aPadding,
+        Theme::GetPaint(Theme::Paint_DeckBackground),
+        Theme::GetPaint(Theme::Paint_DeckBackground));
+
+    // Paint the border.
+    const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
+    aBox.Left() += aPadding.Left();
+    aBox.Top() += aPadding.Top();
+    aBox.Right() -= aPadding.Right();
+    aBox.Bottom() -= aPadding.Bottom();
+    const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
+    DrawHelper::DrawBorder(
+        *this,
+        aBox,
+        SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize),
+        rHorizontalBorderPaint,
+        Theme::GetPaint(Theme::Paint_VerticalBorder));
+}
+
+
+
+
+void Deck::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    RequestLayout();
+}
+
+
+
+
+void Deck::SetPanels (const SharedPanelContainer& rPanels)
+{
+    maPanels = rPanels;
+
+    RequestLayout();
+}
+
+
+
+
+const SharedPanelContainer& Deck::GetPanels (void) const
+{
+    return maPanels;
+}
+
+
+
+
+void Deck::RequestLayout (void)
+{
+    //    PrintWindowTree();
+
+    DeckLayouter::LayoutDeck(
+        GetContentArea(),
+        maPanels,
+        *GetTitleBar(),
+        *mpScrollClipWindow,
+        *mpScrollContainer,
+        *mpFiller,
+        *mpVerticalScrollBar);
+
+    Invalidate();
+}
+
+
+
+
+::Window* Deck::GetPanelParentWindow (void)
+{
+    return mpScrollContainer.get();
+}
+
+
+
+
+const char* GetWindowClassification (const Window* pWindow)
+{
+    const String& rsName (pWindow->GetText());
+    if (rsName.Len() > 0)
+    {
+        return ::rtl::OUStringToOString(rsName, RTL_TEXTENCODING_ASCII_US).getStr();
+    }
+    else
+    {
+        static char msWindow[] = "window";
+        return msWindow;
+    }
+}
+
+
+void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation)
+{
+    static char* sIndentation = "                                                                  ";
+    const Point aLocation (pRoot->GetPosPixel());
+    const Size aSize (pRoot->GetSizePixel());
+    const char* sClassification = GetWindowClassification(pRoot);
+    const char* sVisible = pRoot->IsVisible() ? "visible" : "hidden";
+    OSL_TRACE("%s%x %s %s +%d+%d x%dx%d",
+        sIndentation+strlen(sIndentation)-nIndentation*4,
+        pRoot,
+        sClassification,
+        sVisible,
+        aLocation.X(),aLocation.Y(),
+        aSize.Width(),aSize.Height());
+
+    const sal_uInt16 nChildCount (pRoot->GetChildCount());
+    for (sal_uInt16 nIndex=0; nIndex<nChildCount; ++nIndex)
+        PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation+1);
+}
+
+
+
+
+void Deck::PrintWindowTree (void)
+{
+    PrintWindowSubTree(this, 0);
+}
+
+
+
+
+void Deck::PrintWindowTree (const ::std::vector<Panel*>& rPanels)
+{
+    (void)rPanels;
+    
+    PrintWindowTree();
+}
+
+
+
+
+IMPL_LINK(Deck, HandleVerticalScrollBarChange,void*, EMPTYARG)
+{
+    const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos());
+    mpScrollContainer->SetPosPixel(
+        Point(
+            mpScrollContainer->GetPosPixel().X(),
+            nYOffset));
+    return sal_True;
+}
+
+
+
+
+//----- Deck::ScrollContainerWindow -------------------------------------------
+
+Deck::ScrollContainerWindow::ScrollContainerWindow (Window* pParentWindow)
+    : Window(pParentWindow),
+      maSeparators()
+{
+#ifdef DEBUG
+    SetText(A2S("ScrollContainerWindow"));
+#endif
+}
+
+
+
+
+Deck::ScrollContainerWindow::~ScrollContainerWindow (void)
+{
+}
+
+
+
+
+void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
+{
+    (void)rUpdateArea;
+    
+    // Paint the separators.
+    const sal_Int32 nSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
+    const sal_Int32 nLeft  (0);
+    const sal_Int32 nRight (GetSizePixel().Width()-1);
+    const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
+    for (::std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()), iEnd(maSeparators.end());
+         iY!=iEnd;
+         ++iY)
+    {
+        DrawHelper::DrawHorizontalLine(
+            *this,
+            nLeft,
+            nRight,
+            *iY,
+            nSeparatorHeight,
+            rHorizontalBorderPaint);
+    }
+}
+
+
+
+
+void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators)
+{
+    maSeparators = rSeparators;
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Deck.hxx b/main/sfx2/source/sidebar/Deck.hxx
new file mode 100644
index 0000000..604c23d
--- /dev/null
+++ b/main/sfx2/source/sidebar/Deck.hxx
@@ -0,0 +1,105 @@
+/**************************************************************
+ * 
+ * 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_DECK_HXX
+#define SFX_SIDEBAR_DECK_HXX
+
+#include "Panel.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/image.hxx>
+#include <com/sun/star/ui/LayoutSize.hpp>
+
+#include <boost/function.hpp>
+#include <boost/scoped_ptr.hpp>
+
+class ScrollBar;
+
+namespace css = ::com::sun::star;
+
+namespace sfx2 { namespace sidebar {
+
+class DeckDescriptor;
+class DeckTitleBar;
+
+
+/** This is the parent window of the panels.
+    It displays the deck title.
+*/
+class Deck
+    : public Window
+{
+public:
+    Deck (
+        const DeckDescriptor& rDeckDescriptor,
+        Window* pParentWindow,
+        const ::boost::function<void(void)>& rCloserAction);
+    virtual ~Deck (void);
+
+    void Dispose (void);
+    
+    const ::rtl::OUString& GetId (void) const;
+    DeckTitleBar* GetTitleBar (void) const;
+    Rectangle GetContentArea (void) const;
+    ::rtl::OUString GetIconURL (const bool bIsHighContrastModeActive) const;
+    void SetPanels (const SharedPanelContainer& rPanels);
+    const SharedPanelContainer& GetPanels (void) const;
+    void RequestLayout (void);
+    ::Window* GetPanelParentWindow (void);
+    
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+    void PrintWindowTree (void);
+    void PrintWindowTree (const ::std::vector<Panel*>& rPanels);
+    static void PrintWindowSubTree (Window* pRoot, int nIndentation);
+
+    class ScrollContainerWindow : public Window
+    {
+    public:
+        ScrollContainerWindow (Window* pParentWindow);
+        virtual ~ScrollContainerWindow (void);
+        virtual void Paint (const Rectangle& rUpdateArea);
+        void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
+    private:
+        ::std::vector<sal_Int32> maSeparators;
+    };
+
+private:
+    const ::rtl::OUString msTitle;
+    const ::rtl::OUString msId;
+    Image maIcon;
+    const ::rtl::OUString msIconURL;
+    const ::rtl::OUString msHighContrastIconURL;
+    SharedPanelContainer maPanels;
+    ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
+    ::boost::scoped_ptr<Window> mpScrollClipWindow;
+    ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
+    ::boost::scoped_ptr<Window> mpFiller;
+    ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
+    
+    DECL_LINK(HandleVerticalScrollBarChange,void*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/DeckConfiguration.cxx b/main/sfx2/source/sidebar/DeckConfiguration.cxx
new file mode 100644
index 0000000..a7bc21a
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckConfiguration.cxx
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * 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 "DeckConfiguration.hxx"
+#include "Deck.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+DeckConfiguration::DeckConfiguration (void)
+    : mpDeck(NULL),
+      maPanels()
+{
+}
+
+
+
+
+void DeckConfiguration::Dispose (void)
+{
+    if (mpDeck != NULL)
+    {
+        mpDeck->Dispose();
+
+        Deck* pDeck = mpDeck;
+        mpDeck = NULL;
+        OSL_TRACE("deleting deck window subtree");
+        pDeck->PrintWindowTree();
+        delete pDeck;
+    }
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/DeckConfiguration.hxx b/main/sfx2/source/sidebar/DeckConfiguration.hxx
new file mode 100644
index 0000000..e5bee49
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckConfiguration.hxx
@@ -0,0 +1,49 @@
+/**************************************************************
+ * 
+ * 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_DECK_CONFIGURATION_HXX
+#define SFX_SIDEBAR_DECK_CONFIGURATION_HXX
+
+#include <vector>
+
+namespace sfx2 { namespace sidebar {
+
+class Deck;
+class Panel;
+
+
+class DeckConfiguration
+{
+public:
+    Deck* mpDeck;
+    ::std::vector<Panel*> maPanels;
+
+    DeckConfiguration (void);
+    
+    void Dispose (void);
+};
+
+
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/DeckDescriptor.cxx b/main/sfx2/source/sidebar/DeckDescriptor.cxx
new file mode 100644
index 0000000..10230ac
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckDescriptor.cxx
@@ -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.
+ * 
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "DeckDescriptor.hxx"
+
+namespace sfx2 { namespace sidebar {
+
+DeckDescriptor::DeckDescriptor (void)
+    : msTitle(),
+      msId(),
+      msIconURL(),
+      msHighContrastIconURL(),
+      msHelpURL(),
+      msHelpText(),
+      maContextList(),
+      mnOrderIndex(10000) // Default value as defined in Sidebar.xcs
+{
+}
+
+
+
+
+DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther)
+    : msTitle(rOther.msTitle),
+      msId(rOther.msId),
+      msIconURL(rOther.msIconURL),
+      msHighContrastIconURL(rOther.msHighContrastIconURL),
+      msHelpURL(rOther.msHelpURL),
+      msHelpText(rOther.msHelpText),
+      maContextList(rOther.maContextList),
+      mnOrderIndex(rOther.mnOrderIndex)
+{
+}
+
+
+
+
+DeckDescriptor::~DeckDescriptor (void)
+{
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/DeckDescriptor.hxx b/main/sfx2/source/sidebar/DeckDescriptor.hxx
new file mode 100644
index 0000000..8a2d523
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckDescriptor.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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_DECK_DESCRIPTOR_HXX
+#define SFX_SIDEBAR_DECK_DESCRIPTOR_HXX
+
+#include "sfx2/sidebar/EnumContext.hxx"
+#include "ContextList.hxx"
+#include <boost/shared_ptr.hpp>
+
+
+namespace sfx2 { namespace sidebar {
+
+class DeckDescriptor
+{
+public:
+    ::rtl::OUString msTitle;
+    ::rtl::OUString msId;
+    ::rtl::OUString msIconURL;
+    ::rtl::OUString msHighContrastIconURL;
+    ::rtl::OUString msHelpURL;
+    ::rtl::OUString msHelpText;
+    ContextList maContextList;
+    bool mbIsEnabled;
+    sal_Int32 mnOrderIndex;
+    
+    DeckDescriptor (void);
+    DeckDescriptor (const DeckDescriptor& rOther);
+    ~DeckDescriptor (void);
+};
+typedef ::boost::shared_ptr<DeckDescriptor> SharedDeckDescriptor;
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/DeckLayouter.cxx b/main/sfx2/source/sidebar/DeckLayouter.cxx
new file mode 100644
index 0000000..98b27b4
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckLayouter.cxx
@@ -0,0 +1,524 @@
+/**************************************************************
+ * 
+ * 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 "DeckLayouter.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "Panel.hxx"
+#include "TitleBar.hxx"
+#include "Deck.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/scrbar.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+namespace {
+    static const sal_Int32 MinimalPanelHeight (25);
+}
+
+#define IterateLayoutItems(iterator_name,container)                     \
+    for(::std::vector<LayoutItem>::iterator                             \
+                   iterator_name(container.begin()),                    \
+                   iEnd(container.end());                               \
+        iterator_name!=iEnd;                                            \
+        ++iterator_name)
+
+
+
+void DeckLayouter::LayoutDeck (
+    const Rectangle aContentArea,
+    SharedPanelContainer& rPanels,
+    Window& rDeckTitleBar,
+    Window& rScrollClipWindow,
+    Window& rScrollContainer,
+    Window& rFiller,
+    ScrollBar& rVerticalScrollBar)
+{
+    if (aContentArea.GetWidth()<=0 || aContentArea.GetHeight()<=0)
+        return;
+    Rectangle aBox (PlaceDeckTitle(rDeckTitleBar, aContentArea));
+    
+    if ( ! rPanels.empty())
+    {
+        // Prepare the layout item container.
+        ::std::vector<LayoutItem> aLayoutItems;
+        aLayoutItems.resize(rPanels.size());
+        for (sal_Int32 nIndex(0),nCount(rPanels.size()); nIndex<nCount; ++nIndex)
+        {
+            aLayoutItems[nIndex].mpPanel = rPanels[nIndex];
+            aLayoutItems[nIndex].mnPanelIndex = nIndex;
+        }
+        aBox = LayoutPanels(
+            aBox,
+            aLayoutItems,
+            rScrollClipWindow,
+            rScrollContainer,
+            rVerticalScrollBar,
+            false);
+    }
+    UpdateFiller(rFiller, aBox);
+}
+
+
+
+
+Rectangle DeckLayouter::LayoutPanels (
+    const Rectangle aContentArea,
+    ::std::vector<LayoutItem>& rLayoutItems,
+    Window& rScrollClipWindow,
+    Window& rScrollContainer,
+    ScrollBar& rVerticalScrollBar,
+    const bool bShowVerticalScrollBar)
+{
+    Rectangle aBox (PlaceVerticalScrollBar(rVerticalScrollBar, aContentArea, bShowVerticalScrollBar));
+
+    const sal_Int32 nWidth (aBox.GetWidth());
+    const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
+
+    // Prepare the separators, horizontal lines above and below the
+    // panel titels.
+    const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
+
+    // Get the requested heights of the panels and the available
+    // height that is left when all panel titles and separators are
+    // taken into account.
+    sal_Int32 nAvailableHeight (aBox.GetHeight());
+    GetRequestedSizes(rLayoutItems, nAvailableHeight, aBox);
+    const sal_Int32 nTotalDecorationHeight (aBox.GetHeight() - nAvailableHeight);
+
+    // Analyze the requested heights.
+    // Determine the height that is available for panel content
+    // and count the different layouts.
+    sal_Int32 nTotalPreferredHeight (0);
+    sal_Int32 nTotalMinimumHeight (0);
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        nTotalMinimumHeight += iItem->maLayoutSize.Minimum;
+        nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
+    }
+    
+    if (nTotalMinimumHeight > nAvailableHeight
+        && ! bShowVerticalScrollBar)
+    {
+        // Not enough space, even when all panels are shrunk to their
+        // minimum height.
+        // Show a vertical scrollbar.
+        return LayoutPanels(
+            aContentArea,
+            rLayoutItems,
+            rScrollClipWindow,
+            rScrollContainer,
+            rVerticalScrollBar,
+            true);
+    }
+    
+    // We are now in one of three modes.
+    // - The preferred height fits into the available size:
+    //   Use the preferred size, distribute the remaining height bei
+    //   enlarging panels.
+    // - The total minimum height fits into the available size:
+    //   Use the minimum size, distribute the remaining height bei
+    //   enlarging panels.
+    // - The total minimum height does not fit into the available
+    //   size:
+    //   Use the unmodified preferred height for all panels.
+
+    LayoutMode eMode (MinimumOrLarger);
+    if (bShowVerticalScrollBar)
+        eMode = Preferred;
+    else if (nTotalPreferredHeight <= nAvailableHeight)
+        eMode = PreferredOrLarger;
+    else
+        eMode = MinimumOrLarger;
+
+    if (eMode != Preferred)
+    {
+        const sal_Int32 nTotalHeight (eMode==MinimumOrLarger ? nTotalMinimumHeight : nTotalPreferredHeight);
+            
+        DistributeHeights(
+            rLayoutItems,
+            nAvailableHeight-nTotalHeight,
+            aBox.GetHeight(),
+            eMode==MinimumOrLarger);
+    }
+
+    // Set position and size of the mpScrollClipWindow to the available
+    // size.  Its child, the mpScrollContainer, may have a bigger
+    // height.
+    rScrollClipWindow.SetPosSizePixel(aBox.Left(), aBox.Top(), aBox.GetWidth(), aBox.GetHeight());
+
+    const sal_Int32 nContentHeight (
+        eMode==Preferred
+            ? nTotalPreferredHeight + nTotalDecorationHeight
+            : aBox.GetHeight());
+    sal_Int32 nY = rVerticalScrollBar.GetThumbPos();
+    if (nContentHeight-nY < aBox.GetHeight())
+        nY = nContentHeight-aBox.GetHeight();
+    if (nY < 0)
+        nY = 0;
+    rScrollContainer.SetPosSizePixel(
+        0,
+        -nY,
+        nWidth,
+        nContentHeight);
+
+    if (bShowVerticalScrollBar)
+        SetupVerticalScrollBar(rVerticalScrollBar, nContentHeight, aBox.GetHeight());
+
+    const sal_Int32 nUsedHeight (PlacePanels(rLayoutItems, nWidth, eMode, rScrollContainer));
+    aBox.Top() += nUsedHeight;
+    return aBox;
+}
+
+
+
+
+sal_Int32 DeckLayouter::PlacePanels (
+    ::std::vector<LayoutItem>& rLayoutItems,
+    const sal_Int32 nWidth,
+    const LayoutMode eMode,
+    Window& rScrollContainer)
+{
+    ::std::vector<sal_Int32> aSeparators;
+    const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
+    const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
+    sal_Int32 nY (0);
+
+    // Assign heights and places.
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        if (iItem->mpPanel == NULL)
+            continue;
+
+        Panel& rPanel (*iItem->mpPanel);
+
+        // Separator above the panel title bar.
+        aSeparators.push_back(nY);
+        nY += nDeckSeparatorHeight;
+        
+        // Place the title bar.
+        TitleBar* pTitleBar = rPanel.GetTitleBar();
+        if (pTitleBar != NULL)
+        {
+            if (iItem->mbShowTitleBar)
+            {
+                pTitleBar->SetPosSizePixel(0, nY, nWidth, nPanelTitleBarHeight);
+                pTitleBar->Show();
+                nY += nPanelTitleBarHeight;
+            }
+            else
+            {
+                pTitleBar->Hide();
+            }
+        }
+
+        if (rPanel.IsExpanded())
+        {
+            rPanel.Show();
+            
+            // Determine the height of the panel depending on layout
+            // mode and distributed heights.
+            sal_Int32 nPanelHeight (0);
+            switch(eMode)
+            {
+                case MinimumOrLarger:
+                    nPanelHeight = iItem->maLayoutSize.Minimum + iItem->mnDistributedHeight;
+                    break;
+                case PreferredOrLarger:
+                    nPanelHeight = iItem->maLayoutSize.Preferred + iItem->mnDistributedHeight;
+                    break;
+                case Preferred:
+                    nPanelHeight = iItem->maLayoutSize.Preferred;
+                    break;
+                default:
+                    OSL_ASSERT(false);
+                    break;
+            }
+
+            // Place the panel.
+            rPanel.SetPosSizePixel(0, nY, nWidth, nPanelHeight);
+            
+            nY += nPanelHeight;
+        }
+        else
+        {
+            rPanel.Hide();
+
+            // Add a separator below the collapsed panel, if it is the
+            // last panel in the deck.
+            if (iItem == rLayoutItems.end()-1)
+            {
+                // Separator below the panel title bar.
+                aSeparators.push_back(nY);
+                nY += nDeckSeparatorHeight;
+            }
+        }
+    }
+
+    Deck::ScrollContainerWindow* pScrollContainerWindow
+        = dynamic_cast<Deck::ScrollContainerWindow*>(&rScrollContainer);
+    if (pScrollContainerWindow != NULL)
+        pScrollContainerWindow->SetSeparators(aSeparators);
+
+    return nY;
+}
+
+
+
+
+void DeckLayouter::GetRequestedSizes (
+    ::std::vector<LayoutItem>& rLayoutItems,
+    sal_Int32& rAvailableHeight,
+    const Rectangle& rContentBox)
+{
+    rAvailableHeight = rContentBox.GetHeight();
+
+    const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
+    const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
+
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
+        if (iItem->mpPanel != NULL)
+        {
+            if (rLayoutItems.size() == 1
+                && iItem->mpPanel->IsTitleBarOptional())
+            {
+                // There is only one panel and its title bar is
+                // optional => hide it.
+                rAvailableHeight -= nDeckSeparatorHeight;
+                iItem->mbShowTitleBar = false;
+            }
+            else
+            {
+                // Show the title bar and a separator above and below
+                // the title bar.
+                rAvailableHeight -= nPanelTitleBarHeight;
+                rAvailableHeight -= nDeckSeparatorHeight;
+            }
+            
+            if (iItem->mpPanel->IsExpanded())
+            {
+                Reference<ui::XSidebarPanel> xPanel (iItem->mpPanel->GetPanelComponent());
+                if (xPanel.is())
+                    aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
+                else
+                    aLayoutSize = ui::LayoutSize(MinimalPanelHeight, 0, -1);
+            }
+        }
+        iItem->maLayoutSize = aLayoutSize;
+    }
+}
+
+
+
+
+void DeckLayouter::DistributeHeights (
+    ::std::vector<LayoutItem>& rLayoutItems,
+    const sal_Int32 nHeightToDistribute,
+    const sal_Int32 nContainerHeight,
+    const bool bMinimumHeightIsBase)
+{
+    if (nHeightToDistribute <= 0)
+        return;
+
+    sal_Int32 nRemainingHeightToDistribute (nHeightToDistribute);
+
+    // Compute the weights as difference between panel base height
+    // (either its minimum or preferred height) and the container height.
+    sal_Int32 nTotalWeight (0);
+    sal_Int32 nNoMaximumCount (0);
+    sal_Int32 nIndex (0);
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        if (iItem->maLayoutSize.Maximum == 0)
+            continue;
+        if (iItem->maLayoutSize.Maximum < 0)
+            ++nNoMaximumCount;
+        
+        const sal_Int32 nBaseHeight (
+            bMinimumHeightIsBase
+                ? iItem->maLayoutSize.Minimum
+                : iItem->maLayoutSize.Preferred);
+        if (nBaseHeight < nContainerHeight)
+        {
+            iItem->mnWeight = nContainerHeight - nBaseHeight;
+            nTotalWeight += iItem->mnWeight;
+        }
+    }
+	
+	if (nTotalWeight == 0)
+		return;
+
+    // First pass of height distribution.
+    nIndex = 0;
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        const sal_Int32 nBaseHeight (
+            bMinimumHeightIsBase
+                ? iItem->maLayoutSize.Minimum
+                : iItem->maLayoutSize.Preferred);
+        sal_Int32 nDistributedHeight (iItem->mnWeight * nHeightToDistribute / nTotalWeight);
+        if (nBaseHeight+nDistributedHeight > iItem->maLayoutSize.Maximum
+            && iItem->maLayoutSize.Maximum >= 0)
+        {
+            nDistributedHeight = ::std::max<sal_Int32>(0,iItem->maLayoutSize.Maximum - nBaseHeight);
+        }
+        iItem->mnDistributedHeight = nDistributedHeight;
+        nRemainingHeightToDistribute -= nDistributedHeight;
+    }
+
+    if (nRemainingHeightToDistribute == 0)
+        return;
+    OSL_ASSERT(nRemainingHeightToDistribute > 0);
+
+    // It is possible that not all of the height could be distributed
+    // because of Maximum heights being smaller than expected.
+    // Distribute the remaining height between the panels that have no
+    // Maximum (ie Maximum==-1).
+    if (nNoMaximumCount == 0)
+    {
+        // There are no panels with unrestricted height.
+        return;
+    }
+    const sal_Int32 nAdditionalHeightPerPanel (nRemainingHeightToDistribute / nNoMaximumCount);
+    // Handle rounding error.
+    sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute
+        - nNoMaximumCount*nAdditionalHeightPerPanel);
+    nIndex = 0;
+    IterateLayoutItems(iItem,rLayoutItems)
+    {
+        if (iItem->maLayoutSize.Maximum < 0)
+        {
+            iItem->mnDistributedHeight += nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel;
+            nRemainingHeightToDistribute -= nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel;
+        }
+    }
+
+    OSL_ASSERT(nRemainingHeightToDistribute==0);
+}
+
+
+
+
+Rectangle DeckLayouter::PlaceDeckTitle (
+    Window& rDeckTitleBar,
+    const Rectangle& rAvailableSpace)
+{
+    if (static_cast<DockingWindow*>(rDeckTitleBar.GetParent()->GetParent())->IsFloatingMode())
+    {
+        // When the side bar is undocked then the outer system window displays the deck title.
+        rDeckTitleBar.Hide();
+        return rAvailableSpace;
+    }
+    else
+    {
+        const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight));
+        rDeckTitleBar.SetPosSizePixel(
+            rAvailableSpace.Left(),
+            rAvailableSpace.Top(),
+            rAvailableSpace.GetWidth(),
+            nDeckTitleBarHeight);
+        rDeckTitleBar.Show();
+        return Rectangle(
+            rAvailableSpace.Left(),
+            rAvailableSpace.Top() + nDeckTitleBarHeight,
+            rAvailableSpace.Right(),
+            rAvailableSpace.Bottom());
+    }
+}
+
+
+
+
+Rectangle DeckLayouter::PlaceVerticalScrollBar (
+    ScrollBar& rVerticalScrollBar,
+    const Rectangle& rAvailableSpace,
+    const bool bShowVerticalScrollBar)
+{
+    if (bShowVerticalScrollBar)
+    {
+        const sal_Int32 nScrollBarWidth (rVerticalScrollBar.GetSizePixel().Width());
+        rVerticalScrollBar.SetPosSizePixel(
+            rAvailableSpace.Right() - nScrollBarWidth + 1,
+            rAvailableSpace.Top(),
+            nScrollBarWidth,
+            rAvailableSpace.GetHeight());
+        rVerticalScrollBar.Show();
+        return Rectangle(
+            rAvailableSpace.Left(),
+            rAvailableSpace.Top(),
+            rAvailableSpace.Right() - nScrollBarWidth,
+            rAvailableSpace.Bottom());
+    }
+    else
+    {
+        rVerticalScrollBar.Hide();
+        return rAvailableSpace;
+    }
+}
+
+
+
+
+void DeckLayouter::SetupVerticalScrollBar(
+    ScrollBar& rVerticalScrollBar,
+    const sal_Int32 nContentHeight,
+    const sal_Int32 nVisibleHeight)
+{
+    OSL_ASSERT(nContentHeight > nVisibleHeight);
+
+    rVerticalScrollBar.SetRangeMin(0);
+    rVerticalScrollBar.SetRangeMax(nContentHeight-1);
+    rVerticalScrollBar.SetVisibleSize(nVisibleHeight);
+}
+
+
+
+
+void DeckLayouter::UpdateFiller (
+    Window& rFiller,
+    const Rectangle& rBox)
+{
+    if (rBox.GetHeight() > 0)
+    {
+        // Show the filler.
+        rFiller.SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper());
+        rFiller.SetPosSizePixel(rBox.TopLeft(), rBox.GetSize());
+        rFiller.Show();
+    }
+    else
+    {
+        // Hide the filler.
+        rFiller.Hide();
+    }
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/DeckLayouter.hxx b/main/sfx2/source/sidebar/DeckLayouter.hxx
new file mode 100644
index 0000000..e030a37
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckLayouter.hxx
@@ -0,0 +1,123 @@
+/**************************************************************
+ * 
+ * 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_DECK_LAYOUTER_HXX
+#define SFX_SIDEBAR_DECK_LAYOUTER_HXX
+
+#include "Panel.hxx"
+
+#include <tools/gen.hxx>
+
+#include <com/sun/star/ui/LayoutSize.hpp>
+
+#include <vector>
+
+class ScrollBar;
+class Window;
+
+namespace css = ::com::sun::star;
+
+namespace sfx2 { namespace sidebar {
+
+class Panel;
+
+
+/** Helper class for layouting the direct and indirect children of a
+    deck like title bars, panels, and scroll bars.
+*/
+class DeckLayouter
+{
+public:
+    static void LayoutDeck (
+        const Rectangle aContentArea,
+        SharedPanelContainer& rPanels,
+        Window& pDeckTitleBar,
+        Window& pScrollClipWindow,
+        Window& pScrollContainer,
+        Window& pFiller,
+        ScrollBar& pVerticalScrollBar);
+
+private:
+    // Do not use constructor or destructor.
+    DeckLayouter (void);
+    ~DeckLayouter (void);
+
+    enum LayoutMode
+    {
+        MinimumOrLarger,
+        PreferredOrLarger,
+        Preferred
+    };
+    class LayoutItem
+    {
+    public:
+        SharedPanel mpPanel;
+        css::ui::LayoutSize maLayoutSize;
+        sal_Int32 mnDistributedHeight;
+        sal_Int32 mnWeight;
+        sal_Int32 mnPanelIndex;
+        bool mbShowTitleBar;
+        
+        LayoutItem (void)
+            : mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mnPanelIndex(0),mbShowTitleBar(true)
+        {}
+    };
+    static Rectangle LayoutPanels (
+        const Rectangle aContentArea,
+        ::std::vector<LayoutItem>& rLayoutItems,
+        Window& rScrollClipWindow,
+        Window& rScrollContainer,
+        ScrollBar& pVerticalScrollBar,
+        const bool bShowVerticalScrollBar);
+    static void GetRequestedSizes (
+        ::std::vector<LayoutItem>& rLayoutItem,
+        sal_Int32& rAvailableHeight,
+        const Rectangle& rContentBox);
+    static void DistributeHeights (
+        ::std::vector<LayoutItem>& rLayoutItems,
+        const sal_Int32 nHeightToDistribute,
+        const sal_Int32 nContainerHeight,
+        const bool bMinimumHeightIsBase);
+    static sal_Int32 PlacePanels (
+        ::std::vector<LayoutItem>& rLayoutItems,
+        const sal_Int32 nWidth,
+        const LayoutMode eMode,
+        Window& rScrollContainer);
+    static Rectangle PlaceDeckTitle (
+        Window& rTittleBar,
+        const Rectangle& rAvailableSpace);
+    static Rectangle PlaceVerticalScrollBar (
+        ScrollBar& rVerticalScrollBar,
+        const Rectangle& rAvailableSpace,
+        const bool bShowVerticalScrollBar);
+    static void SetupVerticalScrollBar(
+        ScrollBar& rVerticalScrollBar,
+        const sal_Int32 nContentHeight,
+        const sal_Int32 nVisibleHeight);        
+    static void UpdateFiller (
+        Window& rFiller,
+        const Rectangle& rBox);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/DeckTitleBar.cxx b/main/sfx2/source/sidebar/DeckTitleBar.cxx
new file mode 100644
index 0000000..579348c
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -0,0 +1,148 @@
+/**************************************************************
+ * 
+ * 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 "DeckTitleBar.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <vcl/image.hxx>
+
+#ifdef DEBUG
+#include "Tools.hxx"
+#endif
+
+
+namespace sfx2 { namespace sidebar {
+
+static const sal_Int32 gaLeftGripPadding (3);
+static const sal_Int32 gaRightGripPadding (3);
+
+
+DeckTitleBar::DeckTitleBar (
+    const ::rtl::OUString& rsTitle,
+    Window* pParentWindow,
+    const ::boost::function<void(void)>& rCloserAction)
+    : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()),
+      mnCloserItemIndex(1),
+      maCloserAction(rCloserAction),
+      mbIsCloserVisible(rCloserAction)
+{
+    OSL_ASSERT(pParentWindow != NULL);
+    
+    if (maCloserAction)
+    {
+        maToolBox.InsertItem(
+            mnCloserItemIndex,
+            Theme::GetImage(Theme::Image_Closer));
+    }
+
+#ifdef DEBUG
+    SetText(A2S("DeckTitleBar"));
+#endif
+}
+
+
+
+
+DeckTitleBar::~DeckTitleBar (void)
+{
+}
+
+
+
+
+void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
+{
+    if (mbIsCloserVisible != bIsCloserVisible)
+    {
+        mbIsCloserVisible = bIsCloserVisible;
+
+        if (mbIsCloserVisible)
+            maToolBox.InsertItem(
+                mnCloserItemIndex,
+                Theme::GetImage(Theme::Image_Closer));
+        else
+            maToolBox.RemoveItem(
+                maToolBox.GetItemPos(mnCloserItemIndex));
+    }
+}
+
+
+
+
+Rectangle DeckTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
+{
+    Image aGripImage (Theme::GetImage(Theme::Image_Grip));
+    return Rectangle(
+        aGripImage.GetSizePixel().Width() + gaLeftGripPadding + gaRightGripPadding,
+        rTitleBarBox.Top(),
+        rTitleBarBox.Right(),
+        rTitleBarBox.Bottom());
+}
+
+
+
+
+void DeckTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
+{
+    (void)rTitleBarBox;
+}
+
+
+
+
+sidebar::Paint DeckTitleBar::GetBackgroundPaint (void)
+{
+    return Theme::GetPaint(Theme::Paint_DeckTitleBarBackground);
+}
+
+
+
+
+Color DeckTitleBar::GetTextColor (void)
+{
+    return Theme::GetColor(Theme::Color_DeckTitleFont);
+}
+
+
+
+
+void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+{
+    if (nItemIndex == mnCloserItemIndex)
+        if (maCloserAction)
+            maCloserAction();
+}
+
+
+
+
+void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
+{
+    maToolBox.SetItemImage(
+        mnCloserItemIndex,
+        Theme::GetImage(Theme::Image_Closer));
+    TitleBar::DataChanged(rEvent);
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/DeckTitleBar.hxx b/main/sfx2/source/sidebar/DeckTitleBar.hxx
new file mode 100644
index 0000000..3074ef1
--- /dev/null
+++ b/main/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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_DECK_TITLE_BAR_HXX
+#define SFX_SIDEBAR_DECK_TITLE_BAR_HXX
+
+#include "TitleBar.hxx"
+
+#include <boost/function.hpp>
+
+
+namespace sfx2 { namespace sidebar {
+
+class DeckTitleBar
+    : public TitleBar
+{
+public:
+    DeckTitleBar (
+        const ::rtl::OUString& rsTitle,
+        Window* pParentWindow,
+        const ::boost::function<void(void)>& rCloserAction);
+    virtual ~DeckTitleBar (void);
+
+    void SetCloserVisible (const bool bIsCloserVisible);
+    
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+protected:
+    virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox);
+    virtual void PaintDecoration (const Rectangle& rTitleBarBox);
+    virtual sidebar::Paint GetBackgroundPaint (void);
+    virtual Color GetTextColor (void);
+    virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+
+private:
+    const sal_uInt16 mnCloserItemIndex;
+    const ::boost::function<void(void)> maCloserAction;
+    bool mbIsCloserVisible;
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/DrawHelper.cxx b/main/sfx2/source/sidebar/DrawHelper.cxx
new file mode 100644
index 0000000..5c73a06
--- /dev/null
+++ b/main/sfx2/source/sidebar/DrawHelper.cxx
@@ -0,0 +1,249 @@
+/**************************************************************
+ * 
+ * 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 "DrawHelper.hxx"
+#include "Paint.hxx"
+
+#include <vcl/lineinfo.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+void DrawHelper::DrawBorder (
+    OutputDevice& rDevice,
+    const Rectangle rBox,
+    const SvBorder aBorderSize,
+    const Paint& rHorizontalPaint,
+    const Paint& rVerticalPaint)
+{
+    // Draw top line.
+    DrawHorizontalLine(
+        rDevice,
+        rBox.Left(),
+        rBox.Right(),
+        rBox.Top(),
+        aBorderSize.Top(),
+        rHorizontalPaint);
+    // Draw bottom line.
+    DrawHorizontalLine(
+        rDevice,
+        rBox.Left()+aBorderSize.Left(),
+        rBox.Right(),
+        rBox.Bottom()-aBorderSize.Bottom()+1,
+        aBorderSize.Bottom(),
+        rHorizontalPaint);
+    // Draw left line.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Top()+aBorderSize.Top(),
+        rBox.Bottom(),
+        rBox.Left(),
+        aBorderSize.Left(),
+        rVerticalPaint);
+    // Draw right line.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Top()+aBorderSize.Top(),
+        rBox.Bottom()-aBorderSize.Bottom(),
+        rBox.Right()-aBorderSize.Right()+1,
+        aBorderSize.Right(),
+        rVerticalPaint);
+}
+
+
+
+
+void DrawHelper::DrawBevelBorder (
+    OutputDevice& rDevice,
+    const Rectangle rBox,
+    const SvBorder aBorderSize,
+    const Paint& rTopLeftPaint,
+    const Paint& rCenterPaint,
+    const Paint& rBottomRightPaint)
+{
+    // Draw top line.
+    DrawHorizontalLine(
+        rDevice,
+        rBox.Left(),
+        rBox.Right() - aBorderSize.Right(),
+        rBox.Top(),
+        aBorderSize.Top(),
+        rTopLeftPaint);
+    // Draw bottom line.
+    DrawHorizontalLine(
+        rDevice,
+        rBox.Left()+aBorderSize.Left(),
+        rBox.Right(),
+        rBox.Bottom()-aBorderSize.Bottom()+1,
+        aBorderSize.Bottom(),
+        rBottomRightPaint);
+    // Draw left line.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Top()+aBorderSize.Top(),
+        rBox.Bottom() - aBorderSize.Bottom(),
+        rBox.Left(),
+        aBorderSize.Left(),
+        rTopLeftPaint);
+    // Draw right line.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Top()+aBorderSize.Top(),
+        rBox.Bottom()-aBorderSize.Bottom(),
+        rBox.Right()-aBorderSize.Right()+1,
+        aBorderSize.Right(),
+        rBottomRightPaint);
+    // Draw top right corner.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Top(),
+        rBox.Top()+aBorderSize.Top()-1,
+        rBox.Right()-aBorderSize.Right()+1,
+        aBorderSize.Right(),
+        rCenterPaint);
+    // Draw bottom right corner.
+    DrawVerticalLine(
+        rDevice,
+        rBox.Bottom() - aBorderSize.Bottom()+1,
+        rBox.Bottom(),
+        rBox.Left(),
+        aBorderSize.Left(),
+        rCenterPaint);
+}
+
+
+
+
+void DrawHelper::DrawHorizontalLine(
+    OutputDevice& rDevice,
+    const sal_Int32 nLeft,
+    const sal_Int32 nRight,
+    const sal_Int32 nY,
+    const sal_Int32 nHeight,
+    const Paint& rPaint)
+{
+    switch (rPaint.GetType())
+    {
+        case Paint::NoPaint:
+        default:
+            break;
+
+        case Paint::ColorPaint:
+        {
+            const Color aColor (rPaint.GetColor());
+            rDevice.SetLineColor(aColor);
+            for (sal_Int32 nYOffset=0; nYOffset<nHeight; ++nYOffset)
+                rDevice.DrawLine(
+                    Point(nLeft,nY+nYOffset),
+                    Point(nRight,nY+nYOffset));
+            break;
+        }
+        case Paint::GradientPaint:
+            rDevice.DrawGradient(
+                Rectangle(
+                    nLeft,
+                    nY,
+                    nRight,
+                    nY+nHeight-1),
+                rPaint.GetGradient());
+            break;
+    }
+}
+
+
+
+
+void DrawHelper::DrawVerticalLine(
+    OutputDevice& rDevice,
+    const sal_Int32 nTop,
+    const sal_Int32 nBottom,
+    const sal_Int32 nX,
+    const sal_Int32 nWidth,
+    const Paint& rPaint)
+{
+    switch (rPaint.GetType())
+    {
+        case Paint::NoPaint:
+        default:
+            break;
+
+        case Paint::ColorPaint:
+        {
+            const Color aColor (rPaint.GetColor());
+            rDevice.SetLineColor(aColor);
+            for (sal_Int32 nXOffset=0; nXOffset<nWidth; ++nXOffset)
+                rDevice.DrawLine(
+                    Point(nX+nXOffset, nTop),
+                    Point(nX+nXOffset, nBottom));
+            break;
+        }
+        case Paint::GradientPaint:
+            rDevice.DrawGradient(
+                Rectangle(
+                    nX,
+                    nTop,
+                    nX+nWidth-1,
+                    nBottom),
+                rPaint.GetGradient());
+            break;
+    }
+}
+
+
+
+
+void DrawHelper::DrawRoundedRectangle (
+    OutputDevice& rDevice,
+    const Rectangle& rBox,
+    const sal_Int32 nCornerRadius,
+    const Color& rBorderColor,
+    const Paint& rFillPaint)
+{
+    rDevice.SetLineColor(rBorderColor);
+    switch(rFillPaint.GetType())
+    {
+        case Paint::NoPaint:
+        default:
+            rDevice.SetFillColor();
+            rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
+            break;
+
+        case Paint::ColorPaint:
+            rDevice.SetFillColor(rFillPaint.GetColor());
+            rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
+            break;
+
+        case Paint::GradientPaint:
+            rDevice.DrawGradient(
+                rBox,
+                rFillPaint.GetGradient());
+            rDevice.SetFillColor();
+            rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
+            break;
+    }    
+}
+
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/DrawHelper.hxx b/main/sfx2/source/sidebar/DrawHelper.hxx
new file mode 100644
index 0000000..955eadf
--- /dev/null
+++ b/main/sfx2/source/sidebar/DrawHelper.hxx
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * 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_DRAW_HELPER_HXX
+#define SFX_SIDEBAR_DRAW_HELPER_HXX
+
+#include "vcl/window.hxx"
+
+#include <tools/svborder.hxx>
+
+class Color;
+
+namespace sfx2 { namespace sidebar {
+
+class Paint;
+
+/** Some convenience functions for painting backgrounds and borders.
+*/
+class DrawHelper
+{
+public:
+    static void DrawBorder (
+        OutputDevice& rDevice,
+        const Rectangle rBox,
+        const SvBorder aBorderSize,
+        const Paint& rHorizontalPaint,
+        const Paint& rVerticalPaint);
+    static void DrawBevelBorder (
+        OutputDevice& rDevice,
+        const Rectangle rBox,
+        const SvBorder aBorderSize,
+        const Paint& rTopLeftPaint,
+        const Paint& rCenterPaint,
+        const Paint& rBottomRightPaint);
+    static void DrawHorizontalLine(
+        OutputDevice& rDevice,
+        const sal_Int32 nLeft,
+        const sal_Int32 nRight,
+        const sal_Int32 nY,
+        const sal_Int32 nHeight,
+        const Paint& rPaint);
+    static void DrawVerticalLine(
+        OutputDevice& rDevice,
+        const sal_Int32 nTop,
+        const sal_Int32 nBottom,
+        const sal_Int32 nX,
+        const sal_Int32 nWidth,
+        const Paint& rPaint);
+    static void DrawRoundedRectangle (
+        OutputDevice& rDevice,
+        const Rectangle& rBox,
+        const sal_Int32 nCornerRadius,
+        const Color& rBorderColor,
+        const Paint& rFillPaint);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/EnumContext.cxx b/main/sfx2/source/sidebar/EnumContext.cxx
new file mode 100644
index 0000000..b3269fc
--- /dev/null
+++ b/main/sfx2/source/sidebar/EnumContext.cxx
@@ -0,0 +1,332 @@
+/**************************************************************
+ * 
+ * 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 "sidebar/EnumContext.hxx"
+
+#include <map>
+
+namespace sfx2 { namespace sidebar {
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace {
+
+typedef ::std::map<rtl::OUString,EnumContext::Application> ApplicationMap;
+typedef ::std::vector<rtl::OUString> ApplicationVector;
+static ApplicationMap maApplicationMap;
+static ApplicationVector maApplicationVector;
+
+typedef ::std::map<rtl::OUString,EnumContext::Context> ContextMap;
+typedef ::std::vector<rtl::OUString> ContextVector;
+static ContextMap maContextMap;
+static ContextVector maContextVector;
+
+}
+
+const sal_Int32 EnumContext::NoMatch = 4;
+const sal_Int32 EnumContext::OptimalMatch = 0;  // Neither application nor context name is "any".
+
+
+EnumContext::EnumContext (void)
+    : meApplication(Application_None),
+      meContext(Context_Unknown)
+{
+}
+
+
+
+
+EnumContext::EnumContext (
+    const Application eApplication,
+    const Context eContext)
+    : meApplication(eApplication),
+      meContext(eContext)
+{
+}
+
+
+
+
+EnumContext::EnumContext (
+    const ::rtl::OUString& rsApplicationName,
+    const ::rtl::OUString& rsContextName)
+    : meApplication(GetApplicationEnum(rsApplicationName)),
+      meContext(GetContextEnum(rsContextName))
+{
+}
+
+
+
+
+sal_Int32 EnumContext::GetCombinedContext (void) const
+{
+    return CombinedEnumContext(meApplication, meContext);
+}
+
+
+
+
+sal_Int32 EnumContext::GetCombinedContext_DI (void) const
+{
+    switch (meApplication)
+    {
+        case Application_Draw:
+        case Application_Impress:
+            return CombinedEnumContext(Application_DrawImpress, meContext);
+            
+        case Application_Writer:
+        case Application_WriterWeb:
+            return CombinedEnumContext(Application_WriterAndWeb, meContext);
+            
+        default:
+            return CombinedEnumContext(meApplication, meContext);
+    }
+}
+
+
+
+
+const ::rtl::OUString& EnumContext::GetApplicationName (void) const
+{
+    return EnumContext::GetApplicationName(meApplication);
+}
+
+
+
+
+const ::rtl::OUString& EnumContext::GetContextName (void) const
+{
+    return EnumContext::GetContextName(meContext);
+}
+
+
+
+
+bool EnumContext::operator== (const EnumContext aOther)
+{
+    return meApplication==aOther.meApplication
+        && meContext==aOther.meContext;
+}
+
+
+
+
+bool EnumContext::operator!= (const EnumContext aOther)
+{
+    return meApplication!=aOther.meApplication
+        || meContext!=aOther.meContext;
+}
+
+
+
+
+void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Application eApplication)
+{
+    maApplicationMap[rsName] = eApplication;
+    OSL_ASSERT(eApplication<=__LastApplicationEnum);
+    if (maApplicationVector.size() <= size_t(eApplication))
+        maApplicationVector.resize(eApplication+1);
+    maApplicationVector[eApplication]=rsName;
+}
+
+
+
+
+void EnumContext::ProvideApplicationContainers (void)
+{
+    if (maApplicationMap.empty())
+    {
+        maApplicationVector.resize(static_cast<size_t>(EnumContext::__LastApplicationEnum)+1);
+        AddEntry(A2S("com.sun.star.text.TextDocument"), EnumContext::Application_Writer);
+        AddEntry(A2S("com.sun.star.text.WebDocument"), EnumContext::Application_WriterWeb);
+        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("none"), EnumContext::Application_None);
+    }
+}
+
+
+
+
+EnumContext::Application EnumContext::GetApplicationEnum (const ::rtl::OUString& rsApplicationName)
+{
+    ProvideApplicationContainers();
+    
+    ApplicationMap::const_iterator iApplication(
+        maApplicationMap.find(rsApplicationName));
+    if (iApplication != maApplicationMap.end())
+        return iApplication->second;
+    else
+        return EnumContext::Application_None;
+}
+
+
+
+
+const ::rtl::OUString& EnumContext::GetApplicationName (const Application eApplication)
+{
+    ProvideApplicationContainers();
+
+    const sal_Int32 nIndex (eApplication);
+    if (nIndex<0 || nIndex>= __LastApplicationEnum)
+        return maApplicationVector[Application_None];
+    else
+        return maApplicationVector[nIndex];
+}
+
+
+
+
+void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Context eApplication)
+{
+    maContextMap[rsName] = eApplication;
+    OSL_ASSERT(eApplication<=__LastContextEnum);
+    if (maContextVector.size() <= size_t(eApplication))
+        maContextVector.resize(eApplication+1);
+    maContextVector[eApplication] = rsName;
+}
+
+
+
+
+void EnumContext::ProvideContextContainers (void)
+{
+    if (maContextMap.empty())
+    {
+        maContextVector.resize(static_cast<size_t>(__LastContextEnum)+1);
+        AddEntry(A2S("any"), Context_Any);
+        AddEntry(A2S("default"), Context_Default);
+        AddEntry(A2S("empty"), Context_Empty);
+#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
+    }
+}
+
+
+
+
+EnumContext::Context EnumContext::GetContextEnum (const ::rtl::OUString& rsContextName)
+{
+    ProvideContextContainers();
+    
+    ContextMap::const_iterator iContext(
+        maContextMap.find(rsContextName));
+    if (iContext != maContextMap.end())
+        return iContext->second;
+    else
+        return EnumContext::Context_Unknown;
+}
+
+
+
+
+const ::rtl::OUString& EnumContext::GetContextName (const Context eContext)
+{
+    ProvideContextContainers();
+
+    const sal_Int32 nIndex (eContext);
+    if (nIndex<0 || nIndex>= __LastContextEnum)
+        return maContextVector[Context_Unknown];
+    else
+        return maContextVector[nIndex];
+}
+
+
+
+
+sal_Int32 EnumContext::EvaluateMatch (
+    const EnumContext& rOther) const
+{
+    const bool bApplicationNameIsAny (rOther.meApplication == Application_Any);
+    if (rOther.meApplication==meApplication || bApplicationNameIsAny)
+    {
+        // Application name matches.
+        const bool bContextNameIsAny (rOther.meContext == Context_Any);
+        if (rOther.meContext==meContext || bContextNameIsAny)
+        {
+            // Context name matches.
+            return (bApplicationNameIsAny ? 1 : 0)
+                + (bContextNameIsAny ? 2 : 0);
+        }
+    }
+    return NoMatch;
+}
+
+
+
+
+sal_Int32 EnumContext::EvaluateMatch (const ::std::vector<EnumContext>& rOthers) const
+{
+    sal_Int32 nBestMatch (NoMatch);
+    
+    for (::std::vector<EnumContext>::const_iterator
+             iContext(rOthers.begin()),
+             iEnd(rOthers.end());
+         iContext!=iEnd;
+         ++iContext)
+    {
+        const sal_Int32 nMatch (EvaluateMatch(*iContext));
+        if (nMatch < nBestMatch)
+        {
+            if (nMatch == OptimalMatch)
+            {
+                // We will find no better match so stop searching.
+                return OptimalMatch;
+            }
+            nBestMatch = nMatch;
+        }
+    }
+    return nBestMatch;
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/FocusManager.cxx b/main/sfx2/source/sidebar/FocusManager.cxx
new file mode 100644
index 0000000..94b04cd
--- /dev/null
+++ b/main/sfx2/source/sidebar/FocusManager.cxx
@@ -0,0 +1,565 @@
+/**************************************************************
+ * 
+ * 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 "FocusManager.hxx"
+#include "Panel.hxx"
+#include "Tools.hxx"
+#include "TitleBar.hxx"
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+namespace
+{
+    enum PanelComponent
+    {
+        PC_TitleBar,
+        PC_ToolBox,
+        PC_Content,
+        PC_None
+    };
+
+    PanelComponent GetFocusedComponent (const Panel& rPanel)
+    {
+        if (rPanel.HasFocus())
+            return PC_Content;
+        else if (rPanel.GetTitleBar() != NULL)
+            if (rPanel.GetTitleBar()->HasFocus())
+                return PC_TitleBar;
+            else if (rPanel.GetTitleBar()->GetToolBox().HasFocus())
+                return PC_ToolBox;
+            else
+                return PC_None;
+    }
+}
+
+
+FocusManager::FocusManager (void)
+    : maPanels(),
+      maButtons(),
+      mpTopLevelWindow(NULL)
+{
+}
+
+
+
+
+FocusManager::~FocusManager (void)
+{
+    Clear();
+}
+
+
+
+
+void FocusManager::GrabFocus (void)
+{
+    if ( ! maPanels.empty())
+        FocusPanel(0);
+}
+
+
+
+
+void FocusManager::Clear (void)
+{
+    ClearPanels();
+    ClearButtons();
+}
+
+
+
+void FocusManager::ClearPanels (void)
+{
+    SetTopLevelWindow(NULL);
+    
+    ::std::vector<Panel*> aPanels;
+    aPanels.swap(maPanels);
+    for (::std::vector<Panel*>::iterator iPanel(aPanels.begin()),iEnd(aPanels.end());
+         iPanel!=iEnd;
+        ++iPanel)
+    {
+        UnregisterWindow(**iPanel);
+        if ((*iPanel)->GetTitleBar() != NULL)
+        {
+            UnregisterWindow(*(*iPanel)->GetTitleBar());
+            UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+        }
+    }
+}
+
+
+
+
+void FocusManager::ClearButtons (void)
+{
+    ::std::vector<Window*> aButtons;
+    for (::std::vector<Window*>::iterator iButton(aButtons.begin()),iEnd(aButtons.end());
+         iButton!=iEnd;
+        ++iButton)
+    {
+        UnregisterWindow(**iButton);
+    }
+}
+
+
+
+
+void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
+{
+    ClearPanels();
+    for(SharedPanelContainer::const_iterator iPanel(rPanels.begin()),iEnd(rPanels.end());
+        iPanel!=iEnd;
+        ++iPanel)
+    {
+        RegisterWindow(**iPanel);
+        if ((*iPanel)->GetTitleBar() != NULL)
+        {        
+            RegisterWindow(*(*iPanel)->GetTitleBar());
+            RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+        }
+        maPanels.push_back(iPanel->get());
+    }
+
+    RegisterTopLevelListener();
+}
+
+
+
+
+void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons)
+{
+    ClearButtons();
+    for (::std::vector<Button*>::const_iterator iButton(rButtons.begin()),iEnd(rButtons.end());
+         iButton!=iEnd;
+         ++iButton)
+    {
+        RegisterWindow(**iButton);
+        maButtons.push_back(*iButton);
+    }
+}
+
+
+
+
+void FocusManager::RegisterWindow (Window& rWindow)
+{
+    rWindow.AddEventListener(LINK(this, FocusManager, WindowEventListener));
+}
+
+
+
+
+void FocusManager::UnregisterWindow (Window& rWindow)
+{
+    rWindow.RemoveEventListener(LINK(this, FocusManager, WindowEventListener));
+}
+
+
+
+
+void FocusManager::RegisterTopLevelListener (void)
+{
+    if (maPanels.empty())
+        return;
+    Window* pWindow = maPanels.front();
+    while (pWindow != NULL && pWindow->GetParent()!=NULL)
+    {
+        pWindow = pWindow->GetParent();
+    }
+    SetTopLevelWindow(pWindow);
+}
+
+
+
+
+void FocusManager::SetTopLevelWindow (Window* pWindow)
+{
+    if (mpTopLevelWindow != pWindow)
+    {
+        if (mpTopLevelWindow != NULL)
+        {
+            UnregisterWindow(*mpTopLevelWindow);
+            mpTopLevelWindow->RemoveChildEventListener(LINK(this, FocusManager, WindowEventListener));
+        }
+        mpTopLevelWindow = pWindow;
+        if (mpTopLevelWindow != NULL)
+        {
+            RegisterWindow(*mpTopLevelWindow);
+            mpTopLevelWindow->AddChildEventListener(LINK(this, FocusManager, WindowEventListener));
+        }
+    }
+}
+
+
+
+
+sal_Int32 FocusManager::GetPanelIndex (const Window& rWindow) const
+{
+    for (sal_Int32 nIndex=0,nCount(maPanels.size()); nIndex<nCount; ++nIndex)
+    {
+        if (maPanels[nIndex] == &rWindow)
+            return nIndex;
+        TitleBar* pTitleBar = maPanels[nIndex]->GetTitleBar();
+        if (pTitleBar == &rWindow)
+            return nIndex;
+        if (pTitleBar!=NULL && &pTitleBar->GetToolBox()==&rWindow)
+            return nIndex;
+    }
+    return -1;
+}
+
+
+
+
+sal_Int32 FocusManager::GetButtonIndex (const Window& rWindow) const
+{
+    for (sal_Int32 nIndex=0,nCount(maButtons.size()); nIndex<nCount; ++nIndex)
+        if (maButtons[nIndex] == &rWindow)
+            return nIndex;
+    return -1;
+}
+                   
+
+
+
+bool FocusManager::IsAnyPanelFocused (void) const
+{
+    for (::std::vector<Panel*>::const_iterator iPanel(maPanels.begin()),iEnd(maPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        if ((*iPanel)->HasFocus())
+            return true;
+        else if ((*iPanel)->HasChildPathFocus())
+            return true;
+    }
+    return false;
+}
+
+
+
+
+bool FocusManager::IsAnyButtonFocused (void) const
+{
+    for (::std::vector<Button*>::const_iterator iButton(maButtons.begin()),iEnd(maButtons.end());
+         iButton!=iEnd;
+         ++iButton)
+    {
+        if ((*iButton)->HasFocus())
+            return true;
+    }
+    return false;
+}
+
+
+
+
+void FocusManager::FocusPanel (const sal_Int32 nPanelIndex)
+{
+    Panel& rPanel (*maPanels[nPanelIndex]);
+    TitleBar* pTitleBar = rPanel.GetTitleBar();
+    if (pTitleBar!=NULL && pTitleBar->IsVisible())
+    {
+        rPanel.SetExpanded(true);
+        pTitleBar->GrabFocus();
+    }
+    else
+        FocusPanelContent(nPanelIndex);
+}
+
+
+
+
+void FocusManager::FocusPanelContent (const sal_Int32 nPanelIndex)
+{
+    Window* pWindow = VCLUnoHelper::GetWindow(maPanels[nPanelIndex]->GetElementWindow());
+    if (pWindow != NULL)
+        pWindow->GrabFocus();
+}
+
+
+
+
+void FocusManager::FocusButton (const sal_Int32 nButtonIndex)
+{
+    maButtons[nButtonIndex]->GrabFocus();
+    maButtons[nButtonIndex]->Invalidate();
+}
+
+
+
+
+void FocusManager::ClickButton (const sal_Int32 nButtonIndex)
+{
+    maButtons[nButtonIndex]->Click();
+    if (nButtonIndex > 0)
+        if ( ! maPanels.empty())
+            FocusPanel(0);
+    maButtons[nButtonIndex]->GetParent()->Invalidate();
+}
+
+
+
+
+void FocusManager::RemoveWindow (Window& rWindow)
+{
+    ::std::vector<Panel*>::iterator iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow));
+    if (iPanel != maPanels.end())
+    {
+        UnregisterWindow(rWindow);
+        if ((*iPanel)->GetTitleBar() != NULL)
+        {
+            UnregisterWindow(*(*iPanel)->GetTitleBar());
+            UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+        }
+        maPanels.erase(iPanel);
+        return;
+    }
+
+    ::std::vector<Button*>::iterator iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow));
+    if (iButton != maButtons.end())
+    {
+        UnregisterWindow(rWindow);
+        maButtons.erase(iButton);
+        return;
+    }
+}
+
+
+
+
+bool FocusManager::MoveFocusInsidePanel (
+    const sal_Int32 nPanelIndex,
+    const sal_Int32 nDirection)
+{
+    Panel& rPanel (*maPanels[nPanelIndex]);
+    switch (GetFocusedComponent(rPanel))
+    {
+        case  PC_TitleBar:
+            if (nDirection > 0)
+                rPanel.GetTitleBar()->GetToolBox().GrabFocus();
+            else
+                FocusPanelContent(nPanelIndex);
+            return true;
+            
+        case PC_ToolBox:
+            if (nDirection > 0)
+                FocusPanelContent(nPanelIndex);
+            else
+                rPanel.GetTitleBar()->GrabFocus();
+            return true;
+
+        default:
+            return false;
+    }
+}
+
+
+
+
+long FocusManager::NotifyDockingWindowEvent (const KeyEvent& rKeyEvent)
+{
+    switch(rKeyEvent.GetKeyCode().GetCode())
+    {
+        case KEY_F6:
+            if (rKeyEvent.GetKeyCode().IsShift())
+            {
+                if (IsAnyButtonFocused())
+                {
+                    FocusPanel(0);
+                    return 1;
+                }
+            }
+            else
+            {
+                if (IsAnyPanelFocused())
+                {
+                    FocusButton(0);
+                    return 1;
+                }
+            }
+            break;
+    }
+    return 0;
+}
+
+
+
+
+void FocusManager::HandleKeyEvent (
+    const KeyCode& rKeyCode,
+    const Window& rWindow)
+{
+    if (rKeyCode.GetModifier() != 0)
+        return;
+    
+    const sal_Int32 nPanelIndex (GetPanelIndex(rWindow));
+    const bool bIsPanelTitleFocused (nPanelIndex>=0 && maPanels[nPanelIndex] != &rWindow);
+    const bool bIsPanelToolBoxFocused (nPanelIndex>=0 && maPanels[nPanelIndex] != &rWindow);
+    sal_Int32 nButtonIndex (nPanelIndex==-1 ? GetButtonIndex(rWindow) : -1);
+    
+    switch (rKeyCode.GetCode())
+    {
+        case KEY_F6:
+            if (nPanelIndex >= 0)
+                FocusButton(0);
+            else
+                return;
+            break;
+            
+        case KEY_SPACE:
+            if (nPanelIndex >= 0)
+            {
+                if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar)
+                {
+                    // Toggle the expansion state.
+                    maPanels[nPanelIndex]->SetExpanded( ! maPanels[nPanelIndex]->IsExpanded());
+                }
+            }
+            else if (nButtonIndex >= 0)
+            {
+                // Activate the button.
+                ClickButton(nButtonIndex);
+            }
+            return;
+            
+        case KEY_RETURN:
+            if (nPanelIndex >= 0)
+            {
+                if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar)
+                {
+                    // Enter the panel.
+                    FocusPanelContent(nPanelIndex);
+                }
+            }
+            else if (nButtonIndex >= 0)
+            {
+                // Activate the button.
+                ClickButton(nButtonIndex);
+            }
+            return;
+
+        case KEY_TAB:
+            if (nPanelIndex >= 0)
+            {
+                if (rKeyCode.IsShift())
+                    MoveFocusInsidePanel(nPanelIndex, -1);
+                else
+                    MoveFocusInsidePanel(nPanelIndex, +1);
+            }
+            break;
+            
+        case KEY_LEFT:
+        case KEY_UP:
+            // Go to previous element in focus ring.
+            if (nPanelIndex >= 0)
+            {
+                FocusPanel((nPanelIndex + maPanels.size() - 1) % maPanels.size());
+            }
+            else if (nButtonIndex >= 0)
+            {
+                FocusButton((nButtonIndex + maButtons.size() - 1) % maButtons.size());
+            }
+            break;
+                
+        case KEY_RIGHT:
+        case KEY_DOWN:
+            // Go to next element in focus ring.
+            if (nPanelIndex >= 0)
+            {
+                FocusPanel((nPanelIndex + 1) % maPanels.size());
+            }
+            else if (nButtonIndex >= 0)
+            {
+                FocusButton((nButtonIndex + 1) % maButtons.size());
+            }
+            break;
+    }
+}
+
+
+
+
+void FocusManager::HandleTopLevelEvent (VclWindowEvent& rEvent)
+{
+    switch (rEvent.GetId())
+    {
+        case VCLEVENT_WINDOW_KEYINPUT:
+        {
+            KeyEvent* pKeyEvent = static_cast<KeyEvent*>(rEvent.GetData());
+            switch (pKeyEvent->GetKeyCode().GetCode())
+            {
+                case KEY_F6:
+                    OSL_TRACE("");
+                    break;
+            }
+        }
+    }
+}
+
+
+
+
+IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
+{
+    if (pEvent == NULL)
+        return 0;
+    
+    if ( ! pEvent->ISA(VclWindowEvent))
+        return 0;
+
+    VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
+    Window* pSource = pWindowEvent->GetWindow();
+    if (pSource == NULL)
+        return 0;
+
+    if (pSource == mpTopLevelWindow)
+        HandleTopLevelEvent(*pWindowEvent);
+    else
+        switch (pWindowEvent->GetId())
+        {
+            case VCLEVENT_WINDOW_KEYINPUT:
+            {
+                KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
+                HandleKeyEvent(pKeyEvent->GetKeyCode(), *pSource);
+                return 1;
+            }
+
+            case VCLEVENT_OBJECT_DYING:
+                RemoveWindow(*pSource);
+                return 1;
+
+            case VCLEVENT_WINDOW_GETFOCUS:
+            case VCLEVENT_WINDOW_LOSEFOCUS:
+                pSource->Invalidate();
+        }
+    return 0;
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/FocusManager.hxx b/main/sfx2/source/sidebar/FocusManager.hxx
new file mode 100644
index 0000000..90937b5
--- /dev/null
+++ b/main/sfx2/source/sidebar/FocusManager.hxx
@@ -0,0 +1,112 @@
+/**************************************************************
+ * 
+ * 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_FOCUS_MANAGER_HXX
+#define SFX_SIDEBAR_FOCUS_MANAGER_HXX
+
+#include "Panel.hxx"
+#include <tools/link.hxx>
+
+class Button;
+class KeyCode;
+class VclSimpleEvent;
+
+namespace sfx2 { namespace sidebar {
+
+/** Concentrate all focus handling in this class.
+    There are two rings of windows that accept the input focus: panels
+    and tab bar buttons.
+    Arrow keys move the focus between them.  Tab moves focus between rings.
+*/
+class FocusManager
+{
+public:
+    FocusManager (void);
+    ~FocusManager (void);
+
+    /** Forget all panels and buttons.  Remove all window listeners.
+    */
+    void Clear (void);
+
+    /** Transfer the focus into the sidebar tree of windows.  This is
+        typically called from the SidebarChildWindow as result of
+        pressing the F6 key.
+    */
+    void GrabFocus (void);
+
+    /** Handle the key event that was sent to the docking window.
+    */
+    long NotifyDockingWindowEvent (const KeyEvent& rKeyEvent);
+    
+    void SetPanels (const SharedPanelContainer& rPanels);
+
+    void SetButtons (const ::std::vector<Button*>& rButtons);
+
+private:
+    ::std::vector<Panel*> maPanels;
+    ::std::vector<Button*> maButtons;
+    Window* mpTopLevelWindow;
+    
+    /** Listen for key events for panels and buttons.
+    */
+    DECL_LINK(WindowEventListener, VclSimpleEvent*);
+
+    void ClearPanels (void);
+    void ClearButtons (void);
+    
+    /** Let the focus manager listen for window events for the given
+        window.
+    */
+    void RegisterWindow (Window& rWindow);
+    void UnregisterWindow (Window& rWindow);
+    void RegisterTopLevelListener (void);
+
+    /** Remove the window from the panel or the button container.
+    */
+    void RemoveWindow (Window& rWindow);
+    
+    sal_Int32 GetPanelIndex (const Window& rWindow) const;
+    sal_Int32 GetButtonIndex (const Window& rWindow) const;
+    bool IsAnyPanelFocused (void) const;
+    bool IsAnyButtonFocused (void) const;
+
+    /** Set the focus to the title bar of the panel or, if the the
+        title bar is not visible, directly to the panel.
+    */
+    void FocusPanel (const sal_Int32 nPanelIndex);
+    void FocusPanelContent (const sal_Int32 nPanelIndex);
+    void FocusButton (const sal_Int32 nButtonIndex);
+    void ClickButton (const sal_Int32 nButtonIndex);
+    bool MoveFocusInsidePanel (
+        const sal_Int32 nPanelIndex,
+        const sal_Int32 nDirection);
+
+    void HandleKeyEvent (
+        const KeyCode& rKeyCode,
+        const Window& rWindow);
+
+    void SetTopLevelWindow (Window* pWindow);
+    void HandleTopLevelEvent (VclWindowEvent& rEvent);
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/MenuButton.cxx b/main/sfx2/source/sidebar/MenuButton.cxx
new file mode 100644
index 0000000..50c4291
--- /dev/null
+++ b/main/sfx2/source/sidebar/MenuButton.cxx
@@ -0,0 +1,157 @@
+/**************************************************************
+ * 
+ * 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 "MenuButton.hxx"
+
+#include "DrawHelper.hxx"
+#include "Paint.hxx"
+#include "Tools.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+MenuButton::MenuButton (Window* pParentWindow)
+    : CheckBox(pParentWindow),
+      mbIsLeftButtonDown(false),
+      mePaintType(PT_Theme)
+{
+#ifdef DEBUG
+    SetText(A2S("MenuButton"));
+#endif
+}
+
+
+
+
+MenuButton::~MenuButton (void)
+{
+}
+
+
+
+
+void MenuButton::Paint (const Rectangle& rUpdateArea)
+{
+    switch(mePaintType)
+    {
+        case PT_Theme:
+        default:
+        {
+            const bool bIsSelected (IsChecked());
+            const bool bIsHighlighted (IsMouseOver() || HasFocus());
+            DrawHelper::DrawRoundedRectangle(
+                *this,
+                Rectangle(Point(0,0), GetSizePixel()),
+                3,
+                bIsHighlighted||bIsSelected
+                    ? Theme::GetColor(Theme::Color_TabItemBorder)
+                    : Color(0xffffffff),
+                bIsHighlighted
+                    ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
+                    : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
+        
+            const Image aIcon (Button::GetModeImage(Theme::IsHighContrastMode()
+                    ? BMP_COLOR_HIGHCONTRAST
+                    : BMP_COLOR_NORMAL));
+            const Size aIconSize (aIcon.GetSizePixel());
+            const Point aIconLocation(
+                (GetSizePixel().Width() - aIconSize.Width())/2,
+                (GetSizePixel().Height() - aIconSize.Height())/2);
+            DrawImage(
+                aIconLocation,
+                aIcon);
+            break;
+        }
+        case PT_Native:
+            Button::Paint(rUpdateArea);
+            //            DrawImage(maIconPosition, maIcon);
+            break;
+    }
+}
+
+
+
+
+void MenuButton::MouseMove (const MouseEvent& rEvent)
+{
+    if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow())
+        Invalidate();
+    CheckBox::MouseMove(rEvent);
+}
+
+
+
+
+void MenuButton::MouseButtonDown (const MouseEvent& rMouseEvent)
+{
+#if 0
+    Hide();
+    CheckBox::MouseButtonDown(rMouseEvent);
+    Show();
+#else
+    if (rMouseEvent.IsLeft())
+    {
+        mbIsLeftButtonDown = true;
+        CaptureMouse();
+        Invalidate();
+    }
+#endif
+}
+
+
+
+
+void MenuButton::MouseButtonUp (const MouseEvent& rMouseEvent)
+{
+#if 0
+    Hide();
+    CheckBox::MouseButtonUp(rMouseEvent);
+    Show();
+#else
+    if (IsMouseCaptured())
+        ReleaseMouse();
+    
+    if (rMouseEvent.IsLeft())
+    {
+        if (mbIsLeftButtonDown)
+        {
+            Check();
+            Click();
+            GetParent()->Invalidate();
+        }
+    }
+    if (mbIsLeftButtonDown)
+    {
+        mbIsLeftButtonDown = false;
+        Invalidate();
+    }
+#endif
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/MenuButton.hxx b/main/sfx2/source/sidebar/MenuButton.hxx
new file mode 100644
index 0000000..f436526
--- /dev/null
+++ b/main/sfx2/source/sidebar/MenuButton.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ * 
+ * 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_MENU_BUTTON_HXX
+#define SFX_SIDEBAR_MENU_BUTTON_HXX
+
+#include "vcl/button.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+class MenuButton
+    : public CheckBox
+{
+public:
+    MenuButton (Window* pParentWindow);
+    virtual ~MenuButton (void);
+
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void MouseMove (const MouseEvent& rEvent);
+    virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
+    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+
+protected:
+    using CheckBox::FillLayoutData;
+    
+private:
+    bool mbIsLeftButtonDown;
+    enum PaintType {
+        PT_Native,
+        PT_Theme
+    } mePaintType;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Paint.cxx b/main/sfx2/source/sidebar/Paint.cxx
new file mode 100644
index 0000000..c57f35f
--- /dev/null
+++ b/main/sfx2/source/sidebar/Paint.cxx
@@ -0,0 +1,142 @@
+/**************************************************************
+ * 
+ * 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 "Paint.hxx"
+#include "Tools.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+
+
+using namespace ::com::sun::star;
+
+namespace sfx2 { namespace sidebar {
+
+Paint::Paint (void)
+    : meType(NoPaint)
+{
+}
+
+
+
+
+Paint::Paint (const Color& rColor)
+    : meType(ColorPaint),
+      maValue(rColor)
+{
+}
+
+
+
+
+Paint::Paint (const Gradient& rGradient)
+    : meType(GradientPaint),
+      maValue(rGradient)
+{
+}
+
+
+
+
+Paint Paint::Create (const cssu::Any& rValue)
+{
+    ColorData aColor (0);
+    if (rValue >>= aColor)
+        return Paint(Color(aColor));
+
+    awt::Gradient aAwtGradient;
+    if (rValue >>= aAwtGradient)
+        return Paint(Tools::AwtToVclGradient(aAwtGradient));
+
+    return Paint();        
+}
+
+
+
+
+void Paint::Set (const Paint& rOther)
+{
+    meType = rOther.meType;
+    maValue = rOther.maValue;
+}
+
+
+
+
+Paint::Type Paint::GetType (void) const
+{
+    return meType;
+}
+
+
+
+
+const Color& Paint::GetColor (void) const
+{
+    if (meType != ColorPaint)
+    {
+        assert(meType==ColorPaint);
+        static Color aErrorColor;
+        return aErrorColor;
+    }
+    else
+        return ::boost::get<Color>(maValue);
+}
+
+
+
+
+const Gradient& Paint::GetGradient (void) const
+{
+    if (meType != GradientPaint)
+    {
+        assert(meType==GradientPaint);
+        static Gradient aErrorGradient;
+        return aErrorGradient;
+    }
+    else
+        return ::boost::get<Gradient>(maValue);
+}
+
+
+
+
+Wallpaper Paint::GetWallpaper (void) const
+{
+    switch (meType)
+    {
+        case Paint::NoPaint:
+        default:
+            return Wallpaper();
+            break;
+            
+        case Paint::ColorPaint:
+            return Wallpaper(GetColor());
+            break;
+            
+        case Paint::GradientPaint:
+            return Wallpaper(GetGradient());
+            break;
+    }
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Paint.hxx b/main/sfx2/source/sidebar/Paint.hxx
new file mode 100644
index 0000000..c5a4d78
--- /dev/null
+++ b/main/sfx2/source/sidebar/Paint.hxx
@@ -0,0 +1,84 @@
+/**************************************************************
+ * 
+ * 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_PAINT_HXX
+#define SFX_SIDEBAR_PAINT_HXX
+
+#include <tools/color.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/wall.hxx>
+#include <com/sun/star/awt/Gradient.hpp>
+
+#include <boost/variant.hpp>
+
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+/** Abstraction of different ways to fill outlines.
+    Can be
+     - none (empty: outline is not filled)
+     - singular color
+     - gradient
+*/
+class Paint
+{
+public:
+    enum Type
+    {
+        NoPaint,
+        ColorPaint,
+        GradientPaint
+    };
+
+    // Create a Paint object for an Any that may contain a color, a
+    // awt::Gradient, or nothing.
+    static Paint Create (const cssu::Any& rValue);
+    
+    // Create paint with type NoPaint.
+    explicit Paint (void);
+
+    // Create a Paint object for the given color.
+    explicit Paint (const Color& rColor);
+
+    // Create a Paint object for the given gradient.
+    explicit Paint (const Gradient& rGradient);
+
+    void Set (const ::sfx2::sidebar::Paint& rOther);
+    
+    Type GetType (void) const;
+    const Color& GetColor (void) const;
+    const Gradient& GetGradient (void) const;
+
+    Wallpaper GetWallpaper (void) const;
+
+private:
+    Type meType;
+    ::boost::variant<
+        Color,
+        Gradient
+    > maValue;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Panel.cxx b/main/sfx2/source/sidebar/Panel.cxx
new file mode 100644
index 0000000..ca2cf31
--- /dev/null
+++ b/main/sfx2/source/sidebar/Panel.cxx
@@ -0,0 +1,272 @@
+/**************************************************************
+ * 
+ * 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 "Panel.hxx"
+#include "PanelTitleBar.hxx"
+#include "PanelDescriptor.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "Paint.hxx"
+
+#ifdef DEBUG
+#include "Tools.hxx"
+#include "Deck.hxx"
+#endif
+
+#include <tools/svborder.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/ui/XToolPanel.hpp>
+
+#include <boost/bind.hpp>
+
+
+using namespace css;
+using namespace cssu;
+
+
+
+namespace sfx2 { namespace sidebar {
+
+Panel::Panel (
+    const PanelDescriptor& rPanelDescriptor,
+    Window* pParentWindow,
+    const ::boost::function<void(void)>& rDeckLayoutTrigger,
+    const ::boost::function<void(void)>& rShowMenuFunctor)
+    : Window(pParentWindow),
+      msPanelId(rPanelDescriptor.msId),
+      mpTitleBar(new PanelTitleBar(
+              rPanelDescriptor.msTitle,
+              pParentWindow,
+              this,
+              rShowMenuFunctor)),
+      mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional),
+      mxElement(),
+      mxPanelComponent(),
+      mbIsExpanded(true),
+      maDeckLayoutTrigger(rDeckLayoutTrigger)
+{
+    SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper());
+
+#ifdef DEBUG
+    OSL_TRACE("creating Panel at %x", this);
+    SetText(A2S("Panel"));
+#endif
+}
+
+
+
+
+Panel::~Panel (void)
+{
+    OSL_TRACE("destroying Panel at %x", this);
+    Dispose();
+}
+
+
+
+
+void Panel::Dispose (void)
+{
+    mxPanelComponent = NULL;
+
+    if (mxElement.is())
+    {
+        Reference<lang::XComponent> xComponent (mxElement->getRealInterface(), UNO_QUERY);
+        if (xComponent.is())
+            xComponent->dispose();
+    }
+
+    {    
+        Reference<lang::XComponent> xComponent (mxElement, UNO_QUERY);
+        mxElement = NULL;
+        if (xComponent.is())
+            xComponent->dispose();
+    }
+
+    {
+        Reference<lang::XComponent> xComponent (GetElementWindow(), UNO_QUERY);
+        if (xComponent.is())
+            xComponent->dispose();
+    }
+
+    mpTitleBar.reset();
+}
+
+
+
+
+TitleBar* Panel::GetTitleBar (void) const
+{
+    return mpTitleBar.get();
+}
+
+
+
+
+bool Panel::IsTitleBarOptional (void) const
+{
+    return mbIsTitleBarOptional;
+}
+
+
+
+
+void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement)
+{
+    mxElement = rxElement;
+    if (mxElement.is())
+    {
+        mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY);
+    }
+}
+
+
+
+
+void Panel::SetExpanded (const bool bIsExpanded)
+{
+    if (mbIsExpanded != bIsExpanded)
+    {
+        mbIsExpanded = bIsExpanded;
+        maDeckLayoutTrigger();
+    }
+}
+
+
+
+
+bool Panel::IsExpanded (void) const
+{
+    return mbIsExpanded;
+}
+
+
+
+
+bool Panel::HasIdPredicate (const ::rtl::OUString& rsId) const
+{
+    if (this == NULL)
+        return false;
+    else
+        return msPanelId.equals(rsId);
+}
+
+
+
+
+const ::rtl::OUString& Panel::GetId (void) const
+{
+    return msPanelId;
+}
+
+
+
+
+void Panel::Paint (const Rectangle& rUpdateArea)
+{
+    Window::Paint(rUpdateArea);
+}
+
+
+
+
+void Panel::Resize (void)
+{
+    Window::Resize();
+
+    // Forward new size to window of XUIElement.
+    Reference<awt::XWindow> xElementWindow (GetElementWindow());
+    if (xElementWindow.is())
+    {
+        const Size aSize (GetSizePixel());
+        xElementWindow->setPosSize(
+            0,
+            0,
+            aSize.Width(),
+            aSize.Height(),
+            awt::PosSize::POSSIZE);
+    }
+}
+
+
+
+
+void Panel::Activate (void)
+{
+    Window::Activate();
+}
+
+
+
+
+
+void Panel::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper());
+}
+
+
+
+
+Reference<ui::XSidebarPanel> Panel::GetPanelComponent (void) const
+{
+    return mxPanelComponent;
+}
+
+
+
+
+void Panel::PrintWindowTree (void)
+{
+#ifdef DEBUG
+    Window* pElementWindow = VCLUnoHelper::GetWindow(GetElementWindow());
+    if (pElementWindow != NULL)
+    {
+        OSL_TRACE("panel parent is %x", pElementWindow->GetParent());
+        Deck::PrintWindowSubTree(pElementWindow, 2);
+    }
+    else
+        OSL_TRACE("    panel is empty");
+#endif
+}
+
+
+
+
+Reference<awt::XWindow> Panel::GetElementWindow (void)
+{
+    if (mxElement.is())
+    {
+        Reference<ui::XToolPanel> xToolPanel(mxElement->getRealInterface(), UNO_QUERY);
+        if (xToolPanel.is())
+            return xToolPanel->getWindow();
+    }
+
+    return NULL;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Panel.hxx b/main/sfx2/source/sidebar/Panel.hxx
new file mode 100644
index 0000000..9d1195c
--- /dev/null
+++ b/main/sfx2/source/sidebar/Panel.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ * 
+ * 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_PANEL_HXX
+#define SFX_SIDEBAR_PANEL_HXX
+
+#include <vcl/window.hxx>
+
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XSidebarPanel.hpp>
+
+#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;
+
+namespace sfx2 { namespace sidebar {
+
+class PanelDescriptor;
+class TitleBar;
+
+
+class Panel
+    : public Window
+{
+public:
+    Panel (
+        const PanelDescriptor& rPanelDescriptor,
+        Window* pParentWindow,
+        const ::boost::function<void(void)>& rDeckLayoutTrigger,
+        const ::boost::function<void(void)>& rShowMenuFunctor);
+    virtual ~Panel (void);
+
+    void Dispose (void);
+    
+    TitleBar* GetTitleBar (void) const;
+    bool IsTitleBarOptional (void) const;
+    void SetUIElement (const cssu::Reference<css::ui::XUIElement>& rxElement);
+    cssu::Reference<css::ui::XSidebarPanel> GetPanelComponent (void) const;
+    cssu::Reference<css::awt::XWindow> GetElementWindow (void);
+    void SetExpanded (const bool bIsExpanded);
+    bool IsExpanded (void) const;
+    bool HasIdPredicate (const ::rtl::OUString& rsId) const;
+    const ::rtl::OUString& GetId (void) const;
+    
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void Resize (void);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+    virtual void Activate (void);
+
+    void PrintWindowTree (void);
+    
+private:
+    const ::rtl::OUString msPanelId;
+    ::boost::scoped_ptr<TitleBar> mpTitleBar;
+    const bool mbIsTitleBarOptional;
+    cssu::Reference<css::ui::XUIElement> mxElement;
+    cssu::Reference<css::ui::XSidebarPanel> mxPanelComponent;
+    bool mbIsExpanded;
+    const ::boost::function<void(void)> maDeckLayoutTrigger;
+    Rectangle maBoundingBox;
+};
+typedef ::boost::shared_ptr<Panel> SharedPanel;
+typedef ::std::vector<SharedPanel> SharedPanelContainer;
+    
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/PanelDescriptor.cxx b/main/sfx2/source/sidebar/PanelDescriptor.cxx
new file mode 100644
index 0000000..8713a49
--- /dev/null
+++ b/main/sfx2/source/sidebar/PanelDescriptor.cxx
@@ -0,0 +1,65 @@
+/**************************************************************
+ * 
+ * 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 "PanelDescriptor.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+PanelDescriptor::PanelDescriptor (void)
+    : msTitle(),
+      mbIsTitleBarOptional(false),
+      msId(),
+      msDeckId(),
+      msHelpURL(),
+      maContextList(),
+      msImplementationURL(),
+      mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
+      mbWantsCanvas(false)
+{
+}
+
+
+
+
+PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther)
+    : msTitle(rOther.msTitle),
+      mbIsTitleBarOptional(rOther.mbIsTitleBarOptional),
+      msId(rOther.msId),
+      msDeckId(rOther.msDeckId),
+      msHelpURL(rOther.msHelpURL),
+      maContextList(rOther.maContextList),
+      msImplementationURL(rOther.msImplementationURL),
+      mnOrderIndex(rOther.mnOrderIndex),
+      mbWantsCanvas(rOther.mbWantsCanvas)
+{
+}
+
+
+
+PanelDescriptor::~PanelDescriptor (void)
+{
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/PanelDescriptor.hxx b/main/sfx2/source/sidebar/PanelDescriptor.hxx
new file mode 100644
index 0000000..da23f2a
--- /dev/null
+++ b/main/sfx2/source/sidebar/PanelDescriptor.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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_PANEL_DESCRIPTOR_HXX
+#define SFX_SIDEBAR_PANEL_DESCRIPTOR_HXX
+
+#include "sfx2/sidebar/EnumContext.hxx"
+#include "ContextList.hxx"
+#include <boost/shared_ptr.hpp>
+
+
+namespace sfx2 { namespace sidebar {
+
+class PanelDescriptor
+{
+public:
+    ::rtl::OUString msTitle;
+    sal_Bool mbIsTitleBarOptional;
+    ::rtl::OUString msId;
+    ::rtl::OUString msDeckId;
+    ::rtl::OUString msHelpURL;
+    ContextList maContextList;
+    ::rtl::OUString msImplementationURL;
+    sal_Int32 mnOrderIndex;
+    bool mbWantsCanvas;
+    
+    PanelDescriptor (void);
+    PanelDescriptor (const PanelDescriptor& rPanelDescriptor);
+    ~PanelDescriptor (void);
+};
+typedef ::boost::shared_ptr<PanelDescriptor> SharedPanelDescriptor;
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/PanelTitleBar.cxx b/main/sfx2/source/sidebar/PanelTitleBar.cxx
new file mode 100644
index 0000000..6b3651d
--- /dev/null
+++ b/main/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -0,0 +1,190 @@
+/**************************************************************
+ * 
+ * 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 "PanelTitleBar.hxx"
+
+#include "Paint.hxx"
+#include "Panel.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <tools/svborder.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/image.hxx>
+
+#ifdef DEBUG
+#include "Tools.hxx"
+#endif
+
+
+namespace sfx2 { namespace sidebar {
+
+
+static const sal_Int32 gaLeftIconPadding (5);
+static const sal_Int32 gaRightIconPadding (5);
+
+
+PanelTitleBar::PanelTitleBar (
+    const ::rtl::OUString& rsTitle,
+    Window* pParentWindow,
+    Panel* pPanel,
+    const ::boost::function<void(void)>& rMenuAction)
+    : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()),
+      mbIsLeftButtonDown(false),
+      mpPanel(pPanel),
+      mnMenuItemIndex(1),
+      maMenuAction(rMenuAction)
+{
+    OSL_ASSERT(mpPanel != NULL);
+
+    if (maMenuAction)
+    {
+        maToolBox.InsertItem(
+            mnMenuItemIndex,
+            Theme::GetImage(Theme::Image_PanelMenu));
+        maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
+    }
+
+#ifdef DEBUG
+    SetText(A2S("PanelTitleBar"));
+#endif
+}
+
+
+
+
+PanelTitleBar::~PanelTitleBar (void)
+{
+}
+
+
+
+
+Rectangle PanelTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
+{
+    if (mpPanel != NULL)
+    {
+        Image aImage (mpPanel->IsExpanded()
+            ? Theme::GetImage(Theme::Image_Expand)
+            : Theme::GetImage(Theme::Image_Collapse));
+        return Rectangle(
+            aImage.GetSizePixel().Width() + gaLeftIconPadding + gaRightIconPadding,
+            rTitleBarBox.Top(),
+            rTitleBarBox.Right(),
+            rTitleBarBox.Bottom());
+    }
+    else
+        return rTitleBarBox;
+}
+
+
+
+
+void PanelTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
+{
+    (void)rTitleBarBox;
+    
+    if (mpPanel != NULL)
+    {
+        Image aImage (mpPanel->IsExpanded()
+            ? Theme::GetImage(Theme::Image_Collapse)
+            : Theme::GetImage(Theme::Image_Expand));
+        const Point aTopLeft (
+            gaLeftIconPadding,
+            (GetSizePixel().Height()-aImage.GetSizePixel().Height())/2);
+        DrawImage(aTopLeft, aImage);
+    }
+}
+
+
+
+
+Paint PanelTitleBar::GetBackgroundPaint (void)
+{
+    return Theme::GetPaint(Theme::Paint_PanelTitleBarBackground);
+}
+
+
+
+
+Color PanelTitleBar::GetTextColor (void)
+{
+    return Theme::GetColor(Theme::Color_PanelTitleFont);
+}
+
+
+
+
+void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+{
+    if (nItemIndex == mnMenuItemIndex)
+        if (maMenuAction)
+            maMenuAction();
+}
+
+
+
+
+void PanelTitleBar::MouseButtonDown (const MouseEvent& rMouseEvent)
+{
+    if (rMouseEvent.IsLeft())
+    {
+        mbIsLeftButtonDown = true;
+        CaptureMouse();
+    }
+}
+
+
+
+
+void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
+{
+    if (IsMouseCaptured())
+        ReleaseMouse();
+    
+    if (rMouseEvent.IsLeft())
+    {
+        if (mbIsLeftButtonDown)
+        {
+            if (mpPanel != NULL)
+            {
+                mpPanel->SetExpanded( ! mpPanel->IsExpanded());
+                Invalidate();
+            }
+        }
+    }
+    if (mbIsLeftButtonDown)
+        mbIsLeftButtonDown = false;
+}
+
+
+
+
+void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
+{
+    maToolBox.SetItemImage(
+        mnMenuItemIndex,
+        Theme::GetImage(Theme::Image_PanelMenu));
+    TitleBar::DataChanged(rEvent);
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/PanelTitleBar.hxx b/main/sfx2/source/sidebar/PanelTitleBar.hxx
new file mode 100644
index 0000000..ce280f3
--- /dev/null
+++ b/main/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * 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_PANEL_TITLE_BAR_HXX
+#define SFX_SIDEBAR_PANEL_TITLE_BAR_HXX
+
+#include "TitleBar.hxx"
+
+#include <boost/function.hpp>
+
+
+namespace sfx2 { namespace sidebar {
+
+class Panel;
+
+class PanelTitleBar
+    : public TitleBar
+{
+public:
+    PanelTitleBar (
+        const ::rtl::OUString& rsTitle,
+        Window* pParentWindow,
+        Panel* pPanel,
+        const ::boost::function<void(void)>& rMenuAction);
+    virtual ~PanelTitleBar (void);
+
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+    virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
+    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+
+protected:
+    virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox);
+    virtual void PaintDecoration (const Rectangle& rTitleBarBox);
+    virtual sidebar::Paint GetBackgroundPaint (void);
+    virtual Color GetTextColor (void);
+    virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+
+private:
+    bool mbIsLeftButtonDown;
+    Panel* mpPanel;
+    const sal_uInt16 mnMenuItemIndex;
+    const ::boost::function<void(void)> maMenuAction;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/PopupContainer.cxx b/main/sfx2/source/sidebar/PopupContainer.cxx
new file mode 100755
index 0000000..9415eb8
--- /dev/null
+++ b/main/sfx2/source/sidebar/PopupContainer.cxx
@@ -0,0 +1,54 @@
+/**************************************************************

+ * 

+ * 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/PopupContainer.hxx"

+

+namespace sfx2 { namespace sidebar {

+

+PopupContainer::PopupContainer (Window* pParent)

+    : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK)

+{

+}

+

+

+

+

+PopupContainer::~PopupContainer (void)

+{

+}

+

+

+

+

+long  PopupContainer::Notify (NotifyEvent& rEvent)

+{

+	if (rEvent.GetType() == EVENT_LOSEFOCUS)

+	{

+		if( ! HasChildPathFocus(sal_True))

+			EndPopupMode();

+	}

+	return FloatingWindow::Notify(rEvent);

+}

+

+

+} } // end of namespace sfx2::sidebar

diff --git a/main/sfx2/source/sidebar/ResourceManager.cxx b/main/sfx2/source/sidebar/ResourceManager.cxx
new file mode 100644
index 0000000..4c83d86
--- /dev/null
+++ b/main/sfx2/source/sidebar/ResourceManager.cxx
@@ -0,0 +1,631 @@
+/**************************************************************
+ * 
+ * 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 "ResourceManager.hxx"
+#include "Tools.hxx"
+
+#include <unotools/confignode.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/stlunosequence.hxx>
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <com/sun/star/frame/XModuleManager.hpp>
+
+#include <map>
+
+
+
+using ::rtl::OUString;
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+#define gsPrivateResourceToolpanelPrefix "private:resource/toolpanel/"
+
+
+
+class ResourceManager::Deleter
+{
+public:
+    void operator() (ResourceManager* pObject)
+    {
+        delete pObject;
+    }
+};
+
+
+ResourceManager& ResourceManager::Instance (void)
+{
+    static ResourceManager maInstance;
+    return maInstance;
+}
+
+
+
+
+ResourceManager::ResourceManager (void)
+    : maDecks(),
+      maPanels(),
+      maProcessedApplications()
+{
+    ReadDeckList();
+    ReadPanelList();
+}
+
+
+
+
+ResourceManager::~ResourceManager (void)
+{
+    maPanels.clear();
+    maDecks.clear();
+}
+
+
+
+
+const DeckDescriptor* ResourceManager::GetBestMatchingDeck (
+    const Context& rContext,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    ReadLegacyAddons(rxFrame);
+    
+    for (DeckContainer::const_iterator iDeck(maDecks.begin()), iEnd(maDecks.end());
+         iDeck!=iEnd;
+         ++iDeck)
+    {
+        if (iDeck->maContextList.GetMatch(rContext) != NULL)
+            return &*iDeck;
+    }
+    return NULL;
+}
+
+
+
+
+const DeckDescriptor* ResourceManager::GetDeckDescriptor (
+    const ::rtl::OUString& rsDeckId) const
+{
+    for (DeckContainer::const_iterator
+             iDeck(maDecks.begin()),
+             iEnd(maDecks.end());
+         iDeck!=iEnd;
+         ++iDeck)
+    {
+        if (iDeck->msId.equals(rsDeckId))
+            return &*iDeck;
+    }
+    return NULL;
+}
+
+
+
+
+const PanelDescriptor* ResourceManager::GetPanelDescriptor (
+    const ::rtl::OUString& rsPanelId) const
+{
+    for (PanelContainer::const_iterator
+             iPanel(maPanels.begin()),
+             iEnd(maPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        if (iPanel->msId.equals(rsPanelId))
+            return &*iPanel;
+    }
+    return NULL;
+}
+
+
+
+
+void ResourceManager::SetIsDeckEnabled (
+    const ::rtl::OUString& rsDeckId,
+    const bool bIsEnabled)
+{
+    for (DeckContainer::iterator
+             iDeck(maDecks.begin()),
+             iEnd(maDecks.end());
+         iDeck!=iEnd;
+         ++iDeck)
+    {
+        if (iDeck->msId.equals(rsDeckId))
+        {
+            iDeck->mbIsEnabled = bIsEnabled;
+            return;
+        }
+    }
+}
+
+
+
+
+const ResourceManager::IdContainer& ResourceManager::GetMatchingDecks (
+    IdContainer& rDeckIds,
+    const Context& rContext,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    ReadLegacyAddons(rxFrame);
+
+    ::std::multimap<sal_Int32,OUString> aOrderedIds;
+    for (DeckContainer::const_iterator
+             iDeck(maDecks.begin()),
+             iEnd (maDecks.end());
+         iDeck!=iEnd;
+         ++iDeck)
+    {
+        const DeckDescriptor& rDeckDescriptor (*iDeck);
+        if (rDeckDescriptor.maContextList.GetMatch(rContext) != NULL)
+            aOrderedIds.insert(::std::multimap<sal_Int32,OUString>::value_type(
+                    rDeckDescriptor.mnOrderIndex,
+                    rDeckDescriptor.msId));
+    }
+
+    for (::std::multimap<sal_Int32,OUString>::const_iterator
+             iId(aOrderedIds.begin()),
+             iEnd(aOrderedIds.end());
+         iId!=iEnd;
+         ++iId)
+    {
+        rDeckIds.push_back(iId->second);
+    }
+    
+    return rDeckIds;
+}
+
+
+
+
+const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatchingPanels (
+    PanelContextDescriptorContainer& rPanelIds,
+    const Context& rContext,
+    const ::rtl::OUString& rsDeckId,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    ReadLegacyAddons(rxFrame);
+
+    ::std::multimap<sal_Int32,PanelContextDescriptor> aOrderedIds;
+    for (PanelContainer::const_iterator
+             iPanel(maPanels.begin()),
+             iEnd(maPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        const PanelDescriptor& rPanelDescriptor (*iPanel);
+        if (rPanelDescriptor.msDeckId.equals(rsDeckId))
+        {
+            const ContextList::Entry* pEntry = rPanelDescriptor.maContextList.GetMatch(rContext);
+            if (pEntry != NULL)
+            {
+                PanelContextDescriptor aPanelContextDescriptor;
+                aPanelContextDescriptor.msId = rPanelDescriptor.msId;
+                aPanelContextDescriptor.msMenuCommand = pEntry->msMenuCommand;
+                aPanelContextDescriptor.mbIsInitiallyVisible = pEntry->mbIsInitiallyVisible;
+                aOrderedIds.insert(::std::multimap<sal_Int32,PanelContextDescriptor>::value_type(
+                        rPanelDescriptor.mnOrderIndex,
+                        aPanelContextDescriptor));
+            }
+        }
+    }
+
+    for (::std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator
+             iId(aOrderedIds.begin()),
+             iEnd(aOrderedIds.end());
+         iId!=iEnd;
+         ++iId)
+    {
+        rPanelIds.push_back(iId->second);
+    }
+    
+    return rPanelIds;
+}
+
+
+
+
+void ResourceManager::ReadDeckList (void)
+{
+    const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+    const ::utl::OConfigurationTreeRoot aDeckRootNode (
+        aContext,
+        A2S("org.openoffice.Office.UI.Sidebar/Content/DeckList"),
+        false);
+    if ( ! aDeckRootNode.isValid() )
+        return;
+
+    const Sequence<OUString> aDeckNodeNames (aDeckRootNode.getNodeNames());
+    const sal_Int32 nCount (aDeckNodeNames.getLength());
+    maDecks.resize(nCount);
+    sal_Int32 nWriteIndex(0);
+    for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
+    {
+        const ::utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(aDeckNodeNames[nReadIndex]));
+        if ( ! aDeckNode.isValid())
+            continue;
+
+        DeckDescriptor& rDeckDescriptor (maDecks[nWriteIndex++]);
+
+        rDeckDescriptor.msTitle = ::comphelper::getString(
+            aDeckNode.getNodeValue("Title"));
+        rDeckDescriptor.msId = ::comphelper::getString(
+            aDeckNode.getNodeValue("Id"));
+        rDeckDescriptor.msIconURL = ::comphelper::getString(
+            aDeckNode.getNodeValue("IconURL"));
+        rDeckDescriptor.msHighContrastIconURL = ::comphelper::getString(
+            aDeckNode.getNodeValue("HighContrastIconURL"));
+        rDeckDescriptor.msHelpURL = ::comphelper::getString(
+            aDeckNode.getNodeValue("HelpURL"));
+        rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
+        rDeckDescriptor.mbIsEnabled = true;
+        rDeckDescriptor.mnOrderIndex = ::comphelper::getINT32(
+            aDeckNode.getNodeValue("OrderIndex"));
+
+        ReadContextList(
+            aDeckNode,
+            rDeckDescriptor.maContextList,
+            OUString());
+    }
+
+    // When there where invalid nodes then we have to adapt the size
+    // of the deck vector.
+    if (nWriteIndex<nCount)
+        maDecks.resize(nWriteIndex);
+}
+
+
+
+
+void ResourceManager::ReadPanelList (void)
+{
+    const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+    const ::utl::OConfigurationTreeRoot aPanelRootNode (
+        aContext,
+        A2S("org.openoffice.Office.UI.Sidebar/Content/PanelList"),
+        false);
+    if ( ! aPanelRootNode.isValid() )
+        return;
+
+    const Sequence<OUString> aPanelNodeNames (aPanelRootNode.getNodeNames());
+    const sal_Int32 nCount (aPanelNodeNames.getLength());
+    maPanels.resize(nCount);
+    sal_Int32 nWriteIndex (0);
+    for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
+    {
+        const ::utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(aPanelNodeNames[nReadIndex]));
+        if ( ! aPanelNode.isValid())
+            continue;
+
+        PanelDescriptor& rPanelDescriptor (maPanels[nWriteIndex++]);
+
+        rPanelDescriptor.msTitle = ::comphelper::getString(
+            aPanelNode.getNodeValue("Title"));
+        rPanelDescriptor.mbIsTitleBarOptional = ::comphelper::getBOOL(
+            aPanelNode.getNodeValue("TitleBarIsOptional"));
+        rPanelDescriptor.msId = ::comphelper::getString(
+            aPanelNode.getNodeValue("Id"));
+        rPanelDescriptor.msDeckId = ::comphelper::getString(
+            aPanelNode.getNodeValue("DeckId"));
+        rPanelDescriptor.msHelpURL = ::comphelper::getString(
+            aPanelNode.getNodeValue("HelpURL"));
+        rPanelDescriptor.msImplementationURL = ::comphelper::getString(
+            aPanelNode.getNodeValue("ImplementationURL"));
+        rPanelDescriptor.mnOrderIndex = ::comphelper::getINT32(
+            aPanelNode.getNodeValue("OrderIndex"));
+        rPanelDescriptor.mbWantsCanvas = ::comphelper::getBOOL(
+            aPanelNode.getNodeValue("WantsCanvas"));
+        const OUString sDefaultMenuCommand (::comphelper::getString(
+                aPanelNode.getNodeValue("DefaultMenuCommand")));
+
+        ReadContextList(
+            aPanelNode,
+            rPanelDescriptor.maContextList,
+            sDefaultMenuCommand);
+    }
+
+    // When there where invalid nodes then we have to adapt the size
+    // of the deck vector.
+    if (nWriteIndex<nCount)
+        maPanels.resize(nWriteIndex);
+}
+
+
+
+
+void ResourceManager::ReadContextList (
+    const ::utl::OConfigurationNode& rParentNode,
+    ContextList& rContextList,
+    const OUString& rsDefaultMenuCommand) const
+{
+    const Any aValue = rParentNode.getNodeValue("ContextList");
+    Sequence<OUString> aValues;
+    sal_Int32 nCount;
+    if (aValue >>= aValues)
+        nCount = aValues.getLength();
+    else
+        nCount = 0;
+
+    for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+    {
+        const OUString sValue (aValues[nIndex]);
+        sal_Int32 nCharacterIndex (0);
+        const OUString sApplicationName (sValue.getToken(0, ',', nCharacterIndex).trim());
+        if (nCharacterIndex < 0)
+        {
+            if (sApplicationName.getLength() == 0)
+            {
+                // This is a valid case: in the XML file the separator
+                // was used as terminator.  Using it in the last line
+                // creates an additional but empty entry.
+                break;
+            }
+            else
+            {
+                OSL_ASSERT("expecting three or four values per ContextList entry, separated by comma");
+                continue;
+            }
+        }
+        
+        const OUString sContextName (sValue.getToken(0, ',', nCharacterIndex).trim());
+        if (nCharacterIndex < 0)
+        {
+            OSL_ASSERT("expecting three or four values per ContextList entry, separated by comma");
+            continue;
+        }
+
+        const OUString sInitialState (sValue.getToken(0, ',', nCharacterIndex).trim());
+
+        // The fourth argument is optional.
+        const OUString sMenuCommandOverride (
+            nCharacterIndex<0
+                ? OUString()
+                : sValue.getToken(0, ',', nCharacterIndex).trim());
+        const OUString sMenuCommand (
+            sMenuCommandOverride.getLength()>0
+                ? (sMenuCommandOverride.equalsAscii("none")
+                    ? OUString()
+                    : sMenuCommandOverride)
+                : rsDefaultMenuCommand);
+
+        EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName));
+        EnumContext::Application eApplication2 (EnumContext::Application_None);
+        if (eApplication == EnumContext::Application_None
+            && !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None)))
+        {
+            // Handle some special names: abbreviations that make
+            // context descriptions more readable.
+            if (sApplicationName.equalsAscii("Writer"))
+                eApplication = EnumContext::Application_Writer;
+            else if (sApplicationName.equalsAscii("Calc"))
+                eApplication = EnumContext::Application_Calc;
+            else if (sApplicationName.equalsAscii("Draw"))
+                eApplication = EnumContext::Application_Draw;
+            else if (sApplicationName.equalsAscii("Impress"))
+                eApplication = EnumContext::Application_Impress;
+            else if (sApplicationName.equalsAscii("DrawImpress"))
+            {
+                // A special case among the special names:  it is
+                // common to use the same context descriptions for
+                // both Draw and Impress.  This special case helps to
+                // avoid duplication in the .xcu file.
+                eApplication = EnumContext::Application_Draw;
+                eApplication2 = EnumContext::Application_Impress;
+            }
+            else if (sApplicationName.equalsAscii("WriterAndWeb"))
+            {
+                // Another special case for Writer and WriterWeb.
+                eApplication = EnumContext::Application_Writer;
+                eApplication2 = EnumContext::Application_WriterWeb;
+            }
+            else
+            {
+                OSL_ASSERT("application name not recognized");
+                continue;
+            }
+        }
+        
+        const EnumContext::Context eContext (EnumContext::GetContextEnum(sContextName));
+        if (eContext == EnumContext::Context_Unknown)
+        {
+            OSL_ASSERT("context name not recognized");
+            continue;
+        }
+
+        bool bIsInitiallyVisible;
+        if (sInitialState.equalsAscii("visible"))
+            bIsInitiallyVisible = true;
+        else if (sInitialState.equalsAscii("hidden"))
+            bIsInitiallyVisible = false;
+        else
+        {
+            OSL_ASSERT("unrecognized state");
+            continue;
+        }
+
+        if (eApplication != EnumContext::Application_None)
+            rContextList.AddContextDescription(
+                Context(
+                    EnumContext::GetApplicationName(eApplication),
+                    EnumContext::GetContextName(eContext)),
+                bIsInitiallyVisible,
+                sMenuCommand);
+        if (eApplication2 != EnumContext::Application_None)
+            rContextList.AddContextDescription(
+                Context(
+                    EnumContext::GetApplicationName(eApplication2),
+                    EnumContext::GetContextName(eContext)),
+                bIsInitiallyVisible,
+                sMenuCommand);
+    }
+}
+
+
+
+
+void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
+{
+    // Get module name for given frame.
+    ::rtl::OUString sModuleName (GetModuleName(rxFrame));
+    if (sModuleName.getLength() == 0)
+        return;
+    if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end())
+    {
+        // Addons for this application have already been read.
+        // There is nothing more to do.
+        return;
+    }
+
+    // Mark module as processed.  Even when there is an error that
+    // prevents the configuration data from being read, this error
+    // will not be triggered a second time.
+    maProcessedApplications.insert(sModuleName);
+
+    // Get access to the configuration root node for the application.
+    ::utl::OConfigurationTreeRoot aLegacyRootNode (GetLegacyAddonRootNode(sModuleName));
+    if ( ! aLegacyRootNode.isValid())
+        return;
+
+    // Process child nodes.
+    ::std::vector<OUString> aMatchingNodeNames;
+    GetToolPanelNodeNames(aMatchingNodeNames, aLegacyRootNode);
+    const sal_Int32 nCount (aMatchingNodeNames.size());
+    size_t nDeckWriteIndex (maDecks.size());
+    size_t nPanelWriteIndex (maPanels.size());
+    maDecks.resize(maDecks.size() + nCount);
+    maPanels.resize(maPanels.size() + nCount);
+    for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
+    {
+        const OUString& rsNodeName (aMatchingNodeNames[nReadIndex]);
+        const ::utl::OConfigurationNode aChildNode (aLegacyRootNode.openNode(rsNodeName));
+        if ( ! aChildNode.isValid())
+            continue;
+
+        DeckDescriptor& rDeckDescriptor (maDecks[nDeckWriteIndex++]);
+        rDeckDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName"));
+        rDeckDescriptor.msId = rsNodeName;
+        rDeckDescriptor.msIconURL = ::comphelper::getString(aChildNode.getNodeValue("ImageURL"));
+        rDeckDescriptor.msHighContrastIconURL = rDeckDescriptor.msIconURL;
+        rDeckDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
+        rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
+        rDeckDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
+        rDeckDescriptor.mbIsEnabled = true;
+
+        PanelDescriptor& rPanelDescriptor (maPanels[nPanelWriteIndex++]);
+        rPanelDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName"));
+        rPanelDescriptor.mbIsTitleBarOptional = true;
+        rPanelDescriptor.msId = rsNodeName;
+        rPanelDescriptor.msDeckId = rsNodeName;
+        rPanelDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
+        rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString());
+        rPanelDescriptor.msImplementationURL = rsNodeName;            
+    }
+
+    // When there where invalid nodes then we have to adapt the size
+    // of the deck and panel vectors.
+    if (nDeckWriteIndex < maDecks.size())
+        maDecks.resize(nDeckWriteIndex);
+    if (nPanelWriteIndex < maPanels.size())
+        maPanels.resize(nPanelWriteIndex);
+}
+
+
+
+
+::rtl::OUString ResourceManager::GetModuleName (
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    if ( ! rxFrame.is() || ! rxFrame->getController().is())
+        return OUString();
+    
+    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&)
+    {
+        DBG_UNHANDLED_EXCEPTION();
+    }
+    return OUString();
+}   
+
+
+
+
+::utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode (
+    const ::rtl::OUString& rsModuleName) const
+{
+    try
+    {
+        const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+        const Reference<container::XNameAccess> xModuleAccess (
+            aContext.createComponent("com.sun.star.frame.ModuleManager"),
+            UNO_QUERY_THROW);
+        const ::comphelper::NamedValueCollection aModuleProperties (xModuleAccess->getByName(rsModuleName));
+        const ::rtl::OUString sWindowStateRef (aModuleProperties.getOrDefault(
+                "ooSetupFactoryWindowStateConfigRef",
+                ::rtl::OUString()));
+
+        ::rtl::OUStringBuffer aPathComposer;
+        aPathComposer.appendAscii("org.openoffice.Office.UI.");
+        aPathComposer.append(sWindowStateRef);
+        aPathComposer.appendAscii("/UIElements/States");
+
+        return ::utl::OConfigurationTreeRoot(aContext, aPathComposer.makeStringAndClear(), false);
+    }
+    catch( const Exception& )
+    {
+        DBG_UNHANDLED_EXCEPTION();
+    }
+
+    return ::utl::OConfigurationTreeRoot();
+}
+
+
+
+
+void ResourceManager::GetToolPanelNodeNames (
+    ::std::vector<OUString>& rMatchingNames,
+    const ::utl::OConfigurationTreeRoot aRoot) const
+{
+    Sequence<OUString> aChildNodeNames (aRoot.getNodeNames());
+    const sal_Int32 nCount (aChildNodeNames.getLength());
+    for (sal_Int32 nIndex(0); nIndex<nCount; ++nIndex)
+    {
+        if (aChildNodeNames[nIndex].matchAsciiL(
+                RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/")))
+            rMatchingNames.push_back(aChildNodeNames[nIndex]);
+    }
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/ResourceManager.hxx b/main/sfx2/source/sidebar/ResourceManager.hxx
new file mode 100644
index 0000000..0f504f5
--- /dev/null
+++ b/main/sfx2/source/sidebar/ResourceManager.hxx
@@ -0,0 +1,125 @@
+/**************************************************************
+ * 
+ * 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_RESOURCE_MANAGER_HXX
+#define SFX_SIDEBAR_RESOURCE_MANAGER_HXX
+
+#include "DeckDescriptor.hxx"
+#include "PanelDescriptor.hxx"
+#include "Context.hxx"
+#include <unotools/confignode.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <set>
+#include <boost/shared_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+class Context;
+class ContextList;
+
+/** Read the content of the Sidebar.xcu file and provide access
+    methods so that the sidebar can easily decide which content panels
+    to display for a certain context.
+*/
+class ResourceManager
+{
+public:
+    static ResourceManager& Instance (void);
+
+    const DeckDescriptor* GetBestMatchingDeck (
+        const Context& rContext,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    const DeckDescriptor* GetDeckDescriptor (
+        const ::rtl::OUString& rsDeckId) const;
+    const PanelDescriptor* GetPanelDescriptor (
+        const ::rtl::OUString& rsPanelId) const;
+
+    /** Excluded or include a deck from being displayed in the tab
+        bar.
+        Note that this value is not persistent.
+        The flag can not be set directly at a DeckDescriptor object
+        because the ResourceManager gives access to to them only
+        read-only.
+    */
+    void SetIsDeckEnabled (
+        const ::rtl::OUString& rsDeckId,
+        const bool bIsEnabled);
+
+    typedef ::std::vector<rtl::OUString> IdContainer;
+    class PanelContextDescriptor
+    {
+    public:
+        ::rtl::OUString msId;
+        ::rtl::OUString msMenuCommand;
+        bool mbIsInitiallyVisible;
+    };
+    typedef ::std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
+    
+    const IdContainer& GetMatchingDecks (
+        IdContainer& rDeckDescriptors,
+        const Context& rContext,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    const PanelContextDescriptorContainer& GetMatchingPanels (
+        PanelContextDescriptorContainer& rPanelDescriptors,
+        const Context& rContext,
+        const ::rtl::OUString& rsDeckId,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    static ::rtl::OUString GetModuleName (
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+private:
+    ResourceManager (void);
+    ~ResourceManager (void);
+    class Deleter;
+    friend class Deleter;
+
+    typedef ::std::vector<DeckDescriptor> DeckContainer;
+    DeckContainer maDecks;
+    typedef ::std::vector<PanelDescriptor> PanelContainer;
+    PanelContainer maPanels;
+    mutable ::std::set<rtl::OUString> maProcessedApplications;
+
+    void ReadDeckList (void);
+    void ReadPanelList (void);
+    void ReadContextList (
+        const ::utl::OConfigurationNode& rNode,
+        ContextList& rContextList,
+        const ::rtl::OUString& rsDefaultMenuCommand) const;
+    void ReadLegacyAddons (
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+    ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode (
+        const ::rtl::OUString& rsModuleName) const;
+    void GetToolPanelNodeNames (
+        ::std::vector<rtl::OUString>& rMatchingNames,
+        const ::utl::OConfigurationTreeRoot aRoot) const;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Sidebar.cxx b/main/sfx2/source/sidebar/Sidebar.cxx
new file mode 100644
index 0000000..7d8de0a
--- /dev/null
+++ b/main/sfx2/source/sidebar/Sidebar.cxx
@@ -0,0 +1,81 @@
+/**************************************************************
+ * 
+ * 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 "Sidebar.hxx"
+#include "ResourceManager.hxx"
+
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+Sidebar::Sidebar(
+    Window& rParentWindow,
+    const Reference<frame::XFrame>& rxDocumentFrame)
+    : Window(&rParentWindow, WB_DIALOGCONTROL)
+{
+    ContentPanelManager::Instance();
+}
+
+
+
+
+Sidebar::~Sidebar (void)
+{
+}
+
+
+
+
+void Sidebar::Resize (void)
+{
+    Window::Resize();
+    //    m_pImpl->OnResize();
+}
+
+
+
+
+void Sidebar::GetFocus (void)
+{
+    Window::GetFocus();
+    //    m_pImpl->OnGetFocus();
+}
+
+
+
+
+void Sidebar::DataChanged (const DataChangedEvent& rDataChangedEvent)
+{
+    if  (rDataChangedEvent.GetType() == DATACHANGED_SETTINGS
+        &&  (rDataChangedEvent.GetFlags() & SETTINGS_STYLE)!= 0)
+    {
+        Invalidate();
+    }
+    else
+        Window::DataChanged(rDataChangedEvent);
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Sidebar.hrc b/main/sfx2/source/sidebar/Sidebar.hrc
new file mode 100644
index 0000000..ba16479
--- /dev/null
+++ b/main/sfx2/source/sidebar/Sidebar.hrc
@@ -0,0 +1,87 @@
+/**************************************************************
+ * 
+ * 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 <sfx2/sfx.hrc>
+
+#define RID_SIDEBAR_RESOURCE  (RID_SFX_SIDEBAR_START +  0)
+
+#define IMAGE_SIDEBAR_PLUS                        1
+#define IMAGE_SIDEBAR_PLUS_HC                     2
+#define IMAGE_SIDEBAR_MINUS                       3
+#define IMAGE_SIDEBAR_MINUS_HC                    4
+#define IMAGE_SIDEBAR_GRIP                        5
+#define IMAGE_SIDEBAR_GRIP_HC                     6
+#define IMAGE_SIDEBAR_MENU                        7
+#define IMAGE_SIDEBAR_MENU_HC                     8
+#define IMAGE_SIDEBAR_DETAIL_DIALOG               9
+#define IMAGE_SIDEBAR_DETAIL_DIALOG_HC           10
+#define IMAGE_SIDEBAR_TOOLBOX_SEPARATOR          11
+#define IMAGE_SIDEBAR_DECK_3D_LARGE              20
+#define IMAGE_SIDEBAR_DECK_3D_LARGE_HC           21
+#define IMAGE_SIDEBAR_DECK_3D_SMALL              22
+#define IMAGE_SIDEBAR_DECK_3D_SMALL_HC           23
+#define IMAGE_SIDEBAR_DECK_ANIMATION_LARGE       30
+#define IMAGE_SIDEBAR_DECK_ANIMATION_LARGE_HC    31
+#define IMAGE_SIDEBAR_DECK_ANIMATION_SMALL       32
+#define IMAGE_SIDEBAR_DECK_ANIMATION_SMALL_HC    33
+#define IMAGE_SIDEBAR_DECK_COLORS_LARGE          40
+#define IMAGE_SIDEBAR_DECK_COLORS_LARGE_HC       41
+#define IMAGE_SIDEBAR_DECK_COLORS_SMALL          42
+#define IMAGE_SIDEBAR_DECK_COLORS_SMALL_HC       43
+#define IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE      50
+#define IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE_HC   51
+#define IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL      52
+#define IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL_HC   53
+#define IMAGE_SIDEBAR_DECK_GALLERY_LARGE         60
+#define IMAGE_SIDEBAR_DECK_GALLERY_LARGE_HC      61
+#define IMAGE_SIDEBAR_DECK_GALLERY_SMALL         62
+#define IMAGE_SIDEBAR_DECK_GALLERY_SMALL_HC      63
+#define IMAGE_SIDEBAR_DECK_IMGANIM_LARGE         70
+#define IMAGE_SIDEBAR_DECK_IMGANIM_LARGE_HC      71
+#define IMAGE_SIDEBAR_DECK_IMGANIM_SMALL         72
+#define IMAGE_SIDEBAR_DECK_IMGANIM_SMALL_HC      73
+#define IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE       80
+#define IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE_HC    81
+#define IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL       82
+#define IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL_HC    83
+#define IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE      90
+#define IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE_HC   91
+#define IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL      92
+#define IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL_HC   93
+#define IMAGE_SIDEBAR_DECK_STYLE_LARGE          100
+#define IMAGE_SIDEBAR_DECK_STYLE_LARGE_HC       101
+#define IMAGE_SIDEBAR_DECK_STYLE_SMALL          102
+#define IMAGE_SIDEBAR_DECK_STYLE_SMALL_HC       103
+#define IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE       110
+#define IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE_HC    111
+#define IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL       112
+#define IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL_HC    113
+#define IMAGE_SIDEBAR_DECK_TRANSITION_LARGE     120
+#define IMAGE_SIDEBAR_DECK_TRANSITION_LARGE_HC  121
+#define IMAGE_SIDEBAR_DECK_TRANSITION_SMALL     122
+#define IMAGE_SIDEBAR_DECK_TRANSITION_SMALL_HC  123
+#define IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE      130
+#define IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE_HC   131
+#define IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL      132
+#define IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL_HC   133
+#define STRING_CUSTOMIZATION                    200
+#define STRING_RESTORE                          201
diff --git a/main/sfx2/source/sidebar/Sidebar.hxx b/main/sfx2/source/sidebar/Sidebar.hxx
new file mode 100644
index 0000000..69068d1
--- /dev/null
+++ b/main/sfx2/source/sidebar/Sidebar.hxx
@@ -0,0 +1,68 @@
+/**************************************************************
+ * 
+ * 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_HXX
+#define SFX_SIDEBAR_HXX
+
+#include "sfx2/dllapi.h"
+#include <vcl/window.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+
+/** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
+    module's configuration
+*/
+class SFX2_DLLPUBLIC Sidebar
+    : public Window
+{
+public:
+        /** creates a new instance
+            @param i_rParentWindow
+                the parent window
+            @param i_rDocumentFrame
+                the frame to which the task pane belongs. Will be passed to any custom tool panels created
+                via an XUIElementFactory. Also, it is used to determine the module which the task pane is
+                responsible for, thus controlling which tool panels are actually available.
+        */
+    Sidebar(
+        Window& rParentWindow,
+        const cssu::Reference<css::frame::XFrame>& rxDocumentFrame);
+
+    
+    virtual ~Sidebar (void);
+
+protected:
+    virtual void Resize (void);
+    virtual void GetFocus (void);
+
+private:
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Sidebar.src b/main/sfx2/source/sidebar/Sidebar.src
new file mode 100644
index 0000000..2feaf96
--- /dev/null
+++ b/main/sfx2/source/sidebar/Sidebar.src
@@ -0,0 +1,295 @@
+/**************************************************************
+ * 
+ * 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 "Sidebar.hrc"
+
+Resource RID_SIDEBAR_RESOURCE
+{
+    Image IMAGE_SIDEBAR_PLUS
+    {
+        ImageBitmap = Bitmap { File = "plus.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_PLUS_HC
+    {
+        ImageBitmap = Bitmap { File = "plus_hc.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_MINUS
+    {
+        ImageBitmap = Bitmap { File = "minus.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_MINUS_HC
+    {
+        ImageBitmap = Bitmap { File = "minus_hc.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_GRIP
+    {
+        ImageBitmap = Bitmap { File = "grip.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_GRIP_HC
+    {
+        ImageBitmap = Bitmap { File = "grip_hc.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_MENU
+    {
+        ImageBitmap = Bitmap { File = "symphony/open_more.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_MENU_HC
+    {
+        ImageBitmap = Bitmap { File = "menu_hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DETAIL_DIALOG
+    {
+        ImageBitmap = Bitmap { File = "symphony/morebutton.png" ;};
+    };
+    
+    Image IMAGE_SIDEBAR_DETAIL_DIALOG_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/morebutton_h.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_TOOLBOX_SEPARATOR
+    {
+        ImageBitmap = Bitmap { File = "separator.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_3D_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-3d-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_3D_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-3d-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_3D_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-3d-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_3D_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-3d-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_ANIMATION_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-animation-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_ANIMATION_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-animation-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_ANIMATION_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-animation-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_ANIMATION_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-animation-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_COLORS_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-colors-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_COLORS_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-colors-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_COLORS_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-colors-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_COLORS_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-colors-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_GALLERY_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_GALLERY_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_GALLERY_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_GALLERY_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_IMGANIM_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_IMGANIM_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_IMGANIM_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_IMGANIM_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-property-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-property-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-property-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-property-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_STYLE_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-style-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_STYLE_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-style-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_STYLE_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-style-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_STYLE_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-style-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-template-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-template-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-template-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-template-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_TRANSITION_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-transition-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TRANSITION_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-transition-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TRANSITION_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-transition-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_TRANSITION_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-transition-small-hc.png" ;};
+    };
+
+    Image IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-functions-large.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-functions-large-hc.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-functions-small.png" ;};
+    };
+    Image IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL_HC
+    {
+        ImageBitmap = Bitmap { File = "symphony/sidebar-functions-small-hc.png" ;};
+    };
+
+    String STRING_CUSTOMIZATION
+    {
+	Text [en-US] = "Customization";
+    };
+    String STRING_RESTORE
+    {
+	Text [en-US] = "Restore Default";
+    };
+};
+
+
diff --git a/main/sfx2/source/sidebar/SidebarChildWindow.cxx b/main/sfx2/source/sidebar/SidebarChildWindow.cxx
new file mode 100644
index 0000000..4789c5f
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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/SidebarChildWindow.hxx"
+#include "SidebarDockingWindow.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "helpid.hrc"
+#include "sfx2/dockwin.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+
+SFX_IMPL_DOCKINGWINDOW(SidebarChildWindow, SID_SIDEBAR);
+
+
+SidebarChildWindow::SidebarChildWindow (
+    Window* pParent,
+    sal_uInt16 nId,
+    SfxBindings* pBindings,
+    SfxChildWinInfo* pInfo )
+    : SfxChildWindow(pParent, nId)
+{
+    this->pWindow = new SidebarDockingWindow(
+        pBindings,
+        *this,
+        pParent,
+        WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
+    eChildAlignment = SFX_ALIGN_RIGHT;
+
+    this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
+    this->pWindow->SetOutputSizePixel(Size(300, 450));
+
+    dynamic_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
+    SetHideNotDelete(sal_True);
+
+    this->pWindow->Show();
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarController.cxx b/main/sfx2/source/sidebar/SidebarController.cxx
new file mode 100644
index 0000000..2cb7a85
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarController.cxx
@@ -0,0 +1,934 @@
+/**************************************************************
+ * 
+ * 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 "SidebarController.hxx"
+#include "Deck.hxx"
+#include "DeckTitleBar.hxx"
+#include "Panel.hxx"
+#include "SidebarPanel.hxx"
+#include "SidebarResource.hxx"
+#include "TabBar.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "SidebarDockingWindow.hxx"
+#include "Context.hxx"
+#include "Tools.hxx"
+
+#include "sfxresid.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "sfx2/titledockwin.hxx"
+#include "sfxlocal.hrc"
+#include <vcl/floatwin.hxx>
+#include "splitwin.hxx"
+#include <svl/smplhint.hxx>
+#include <tools/link.hxx>
+#include <comphelper/componentfactory.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/ui/ContextChangeEventObject.hpp>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/scoped_array.hpp>
+
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+
+namespace sfx2 { namespace sidebar {
+
+namespace {
+    enum MenuId
+    {
+        MID_UNLOCK_TASK_PANEL = 1,
+        MID_LOCK_TASK_PANEL,
+        MID_CUSTOMIZATION,
+        MID_RESTORE_DEFAULT,
+        MID_FIRST_PANEL,
+        MID_FIRST_HIDE = 1000
+    };
+}
+
+
+SidebarController::SidebarController (
+    SidebarDockingWindow* pParentWindow,
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
+    : SidebarControllerInterfaceBase(m_aMutex),
+      mpCurrentDeck(),
+      mpParentWindow(pParentWindow),
+      mpTabBar(new TabBar(
+              mpParentWindow,
+              rxFrame,
+              ::boost::bind(&SidebarController::SwitchToDeck, this, _1),
+              ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
+      mxFrame(rxFrame),
+      maCurrentContext(OUString(), OUString()),
+      msCurrentDeckId(A2S("PropertyDeck")),
+      maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
+      mbIsDeckClosed(false),
+      mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
+{
+    if (pParentWindow == NULL)
+    {
+        OSL_ASSERT(pParentWindow!=NULL);
+            return;
+    }
+
+    // Listen for context change events.
+    cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+        css::ui::ContextChangeEventMultiplexer::get(
+            ::comphelper::getProcessComponentContext()));
+    if (xMultiplexer.is())
+        xMultiplexer->addContextChangeEventListener(
+            static_cast<css::ui::XContextChangeEventListener*>(this),
+            mxFrame->getController());
+
+    // Listen for window events.
+    mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
+
+    // Listen for theme property changes.
+    Theme::GetPropertySet()->addPropertyChangeListener(
+        A2S(""),
+        static_cast<css::beans::XPropertyChangeListener*>(this));
+
+    SwitchToDeck(A2S("default"));
+}
+
+
+
+
+SidebarController::~SidebarController (void)
+{
+}
+
+
+
+
+void SAL_CALL SidebarController::disposing (void)
+{
+    maFocusManager.Clear();
+
+    cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+        css::ui::ContextChangeEventMultiplexer::get(
+            ::comphelper::getProcessComponentContext()));
+    if (xMultiplexer.is())
+        xMultiplexer->removeAllContextChangeEventListeners(
+            static_cast<css::ui::XContextChangeEventListener*>(this));
+
+    if (mpParentWindow != NULL)
+    {
+        mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
+        mpParentWindow = NULL;
+    }
+
+    if (mpCurrentDeck)
+    {
+        mpCurrentDeck->Dispose();
+        OSL_TRACE("deleting deck window subtree");
+        mpCurrentDeck->PrintWindowTree();
+        mpCurrentDeck.reset();
+    }
+
+    mpTabBar.reset();
+
+    Theme::GetPropertySet()->removePropertyChangeListener(
+        A2S(""),
+        static_cast<css::beans::XPropertyChangeListener*>(this));
+}
+
+
+
+
+void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
+    throw(cssu::RuntimeException)
+{
+    UpdateConfigurations(
+        Context(
+            rEvent.ApplicationName,
+            rEvent.ContextName));
+}
+
+
+
+
+void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject)
+    throw(cssu::RuntimeException)
+{
+    (void)rEventObject;
+
+    dispose();
+}
+
+
+
+
+void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& rEvent)
+    throw(cssu::RuntimeException)
+{
+    (void)rEvent;
+    
+    maPropertyChangeForwarder.RequestCall();
+}
+
+
+
+
+void SAL_CALL SidebarController::requestLayout (void)
+    throw(cssu::RuntimeException)
+{
+    if (mpCurrentDeck)
+        mpCurrentDeck->RequestLayout();
+    RestrictWidth();
+}
+
+
+
+
+void SidebarController::BroadcastPropertyChange (void)
+{
+    DataChangedEvent aEvent (DATACHANGED_USER);
+    mpParentWindow->NotifyAllChilds(aEvent);
+    mpParentWindow->Invalidate(INVALIDATE_CHILDREN);
+}
+
+
+
+
+void SidebarController::NotifyResize (void)
+{
+    if (mpTabBar == NULL)
+    {
+        OSL_ASSERT(mpTabBar!=NULL);
+        return;
+    }
+    
+    Window* pParentWindow = mpTabBar->GetParent();
+    
+    const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
+    const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
+
+    // Place the deck.
+    if (mpCurrentDeck)
+    {
+        mpCurrentDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+        mpCurrentDeck->Show();
+        mpCurrentDeck->RequestLayout();
+    }
+
+    // Place the tab bar.
+    mpTabBar->SetPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
+    mpTabBar->Show();
+
+    // Determine if the closer of the deck can be shown.
+    if (mpCurrentDeck)
+    {
+        DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
+        if (pTitleBar != NULL && pTitleBar->IsVisible())
+            pTitleBar->SetCloserVisible(CanModifyChildWindowWidth());
+    }
+
+    if (nWidth > TabBar::GetDefaultWidth())
+        mnSavedSidebarWidth = nWidth;
+    
+    RestrictWidth();
+#ifdef DEBUG
+    if (mpCurrentDeck)
+    {
+        mpCurrentDeck->PrintWindowTree();
+        sal_Int32 nPanelIndex (0);
+        for (SharedPanelContainer::const_iterator
+                 iPanel(mpCurrentDeck->GetPanels().begin()),
+                 iEnd(mpCurrentDeck->GetPanels().end());
+             iPanel!=iEnd;
+             ++iPanel,++nPanelIndex)
+        {
+            OSL_TRACE("panel %d:", nPanelIndex);
+            (*iPanel)->PrintWindowTree();
+        }
+    }
+#endif
+}
+
+
+
+
+void SidebarController::UpdateConfigurations (const Context& rContext)
+{
+    if (maCurrentContext != rContext)
+    {
+        maCurrentContext = rContext;
+
+        // Notify the tab bar about the updated set of decks.
+        ResourceManager::IdContainer aDeckIds;
+        ResourceManager::Instance().GetMatchingDecks (
+            aDeckIds,
+            rContext,
+            mxFrame);
+        mpTabBar->SetDecks(aDeckIds);
+
+        // Check if the current deck is among the matching decks.
+        bool bCurrentDeckMatches (false);
+        for (ResourceManager::IdContainer::const_iterator
+                 iDeck(aDeckIds.begin()),
+                 iEnd(aDeckIds.end());
+             iDeck!=iEnd;
+             ++iDeck)
+        {
+            if (iDeck->equals(msCurrentDeckId))
+            {
+                bCurrentDeckMatches = true;
+                break;
+            }
+        }
+
+        DeckDescriptor const* pDeckDescriptor = NULL;
+        if ( ! bCurrentDeckMatches)
+            pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
+        else
+            pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
+        if (pDeckDescriptor != NULL)
+        {
+            msCurrentDeckId = pDeckDescriptor->msId;
+            SwitchToDeck(*pDeckDescriptor, rContext);
+        }
+        
+#ifdef DEBUG
+        // Show the context name in the deck title bar.
+        if (mpCurrentDeck)
+        {
+            DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
+            if (pTitleBar != NULL)
+                pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+rContext.msContext+A2S(")"));
+        }
+#endif
+    }
+}
+
+
+
+
+void SidebarController::SwitchToDeck (
+    const ::rtl::OUString& rsDeckId)
+{
+    if ( ! msCurrentDeckId.equals(rsDeckId) || mbIsDeckClosed)
+    {
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId);
+        if (pDeckDescriptor != NULL)
+            SwitchToDeck(*pDeckDescriptor, maCurrentContext);
+    }
+}
+
+
+
+
+void SidebarController::SwitchToDeck (
+    const DeckDescriptor& rDeckDescriptor,
+    const Context& rContext)
+{
+    maFocusManager.Clear();
+
+    if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId))
+    {
+        // When the deck changes then destroy the deck and all panels
+        // and create everything new.
+        if (mpCurrentDeck)
+        {
+            mpCurrentDeck->Dispose();
+            mpCurrentDeck.reset();
+        }
+
+        msCurrentDeckId = rDeckDescriptor.msId;
+    }
+
+    // Reopen the deck when necessary.
+    OpenDeck();
+
+    // Determine the panels to display in the deck.
+    ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
+    ResourceManager::Instance().GetMatchingPanels(
+        aPanelContextDescriptors,
+        rContext,
+        rDeckDescriptor.msId,
+        mxFrame);
+
+    if (aPanelContextDescriptors.empty())
+    {
+        // There are no panels to be displayed in the current context.
+        if (EnumContext::GetContextEnum(rContext.msContext) != EnumContext::Context_Empty)
+        {
+            // Switch to the "empty" context and try again.
+            SwitchToDeck(
+                rDeckDescriptor,
+                Context(
+                    rContext.msApplication,
+                    EnumContext::GetContextName(EnumContext::Context_Empty)));
+            return;
+        }
+        else
+        {
+            // This is already the "empty" context. Looks like we have
+            // to live with an empty deck.
+        }
+    }
+
+    if (mpCurrentDeck
+        && ArePanelSetsEqual(mpCurrentDeck->GetPanels(), aPanelContextDescriptors))
+    {
+        // Requested set of panels is identical to the current set of
+        // panels => Nothing to do.
+        return;
+    }
+    
+    // Provide a configuration and Deck object.
+    if ( ! mpCurrentDeck)
+    {
+        mpCurrentDeck.reset(
+            new Deck(
+                rDeckDescriptor,
+                mpParentWindow,
+                ::boost::bind(&SidebarController::CloseDeck, this)));
+        msCurrentDeckTitle = rDeckDescriptor.msTitle;
+    }
+    if ( ! mpCurrentDeck)
+        return;
+        
+    // Update the panel list.
+    const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
+    SharedPanelContainer aNewPanels;
+    const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());
+    aNewPanels.resize(nNewPanelCount);
+    sal_Int32 nWriteIndex (0);
+    bool bHasPanelSetChanged (false);
+    for (sal_Int32 nReadIndex=0; nReadIndex<nNewPanelCount; ++nReadIndex)
+    {
+        const ResourceManager::PanelContextDescriptor& rPanelContexDescriptor (
+            aPanelContextDescriptors[nReadIndex]);
+
+        // Find the corresponding panel among the currently active
+        // panels.
+        SharedPanelContainer::const_iterator iPanel (::std::find_if(
+                rCurrentPanels.begin(),
+                rCurrentPanels.end(),
+                ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId))));
+        if (iPanel != rCurrentPanels.end())
+        {
+            // Panel already exists in current deck.  Reuse it.
+            aNewPanels[nWriteIndex] = *iPanel;
+            OSL_TRACE("    reusing panel %s", S2A(rPanelContexDescriptor.msId));
+        }
+        else
+        {
+            // Panel does not yet exist.  Create it.
+            aNewPanels[nWriteIndex] = CreatePanel(
+                rPanelContexDescriptor.msId,
+                mpCurrentDeck->GetPanelParentWindow(),
+                rPanelContexDescriptor.msMenuCommand);
+            OSL_TRACE("    creating panel %s", S2A(rPanelContexDescriptor.msId));
+            bHasPanelSetChanged = true;
+        }
+        if (aNewPanels[nWriteIndex] != NULL)
+        {
+            // Depending on the context we have to collapse the panel.
+            aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
+
+            ++nWriteIndex;
+        }
+
+    }
+    aNewPanels.resize(nWriteIndex);
+
+    // Activate the deck and the new set of panels.
+    mpCurrentDeck->SetPosSizePixel(
+        0,
+        0,
+        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
+        mpParentWindow->GetSizePixel().Height());
+    mpCurrentDeck->SetPanels(aNewPanels);
+    mpCurrentDeck->Show();
+
+    // Tell the tab bar to highlight the button associated with the
+    // deck.
+    mpTabBar->HighlightDeck(rDeckDescriptor.msId);
+
+    mpParentWindow->SetText(rDeckDescriptor.msTitle);
+
+    if (bHasPanelSetChanged)
+        NotifyResize();
+
+    // Tell the focus manager about the new panels and tab bar
+    // buttons.
+    maFocusManager.SetPanels(aNewPanels);
+    mpTabBar->UpdateFocusManager(maFocusManager);
+}
+
+
+
+
+bool SidebarController::ArePanelSetsEqual (
+    const SharedPanelContainer& rCurrentPanels,
+    const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
+{
+    OSL_TRACE("current panel list:");
+    for (SharedPanelContainer::const_iterator
+             iPanel(rCurrentPanels.begin()),
+             iEnd(rCurrentPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        OSL_TRACE("    panel %s", S2A((*iPanel)->GetId()));
+    }
+
+    OSL_TRACE("requested panels: ");
+    for (ResourceManager::PanelContextDescriptorContainer::const_iterator
+             iId(rRequestedPanels.begin()),
+             iEnd(rRequestedPanels.end());
+         iId!=iEnd;
+         ++iId)
+    {
+        OSL_TRACE("    panel %s", S2A(iId->msId));
+    }
+
+    if (rCurrentPanels.size() != rRequestedPanels.size())
+        return false;
+    for (sal_Int32 nIndex=0,nCount=rCurrentPanels.size(); nIndex<nCount; ++nIndex)
+    {
+        if (rCurrentPanels[nIndex] == NULL)
+            return false;
+        if ( ! rCurrentPanels[nIndex]->GetId().equals(rRequestedPanels[nIndex].msId))
+            return false;
+    }
+    return true;
+}
+
+
+
+
+SharedPanel SidebarController::CreatePanel (
+    const OUString& rsPanelId,
+    ::Window* pParentWindow,
+    const OUString& rsMenuCommand)
+{
+    const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+    if (pPanelDescriptor == NULL)
+        return SharedPanel();
+
+#ifdef DEBUG
+    // Prevent the panel not being created in the same memory of an old panel.
+    ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]);
+    OSL_TRACE("allocated memory at %x", pUnused.get());
+#endif
+    
+    // Create the panel which is the parent window of the UIElement.
+    SharedPanel pPanel (new Panel(
+        *pPanelDescriptor,
+        pParentWindow,
+        ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
+        rsMenuCommand.getLength()>0
+            ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand)
+            : ::boost::function<void(void)>()));
+
+    // Create the XUIElement.
+    Reference<ui::XUIElement> xUIElement (CreateUIElement(
+            pPanel->GetComponentInterface(),
+            pPanelDescriptor->msImplementationURL));
+    if (xUIElement.is())
+    {
+        // Initialize the panel and add it to the active deck.
+        pPanel->SetUIElement(xUIElement);
+    }
+    else
+    {
+        pPanel.reset();
+    }
+
+    return pPanel;
+}
+
+
+
+
+Reference<ui::XUIElement> SidebarController::CreateUIElement (
+    const Reference<awt::XWindowPeer>& rxWindow,
+    const ::rtl::OUString& rsImplementationURL)
+{
+    try
+    {
+        const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
+        const Reference<ui::XUIElementFactory> xUIElementFactory (
+            aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"),
+            UNO_QUERY_THROW);
+
+       // Create the XUIElement.
+        ::comphelper::NamedValueCollection aCreationArguments;
+        aCreationArguments.put("Frame", makeAny(mxFrame));
+        aCreationArguments.put("ParentWindow", makeAny(rxWindow));
+        SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
+        if (pSfxDockingWindow != NULL)
+            aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
+        aCreationArguments.put("Theme", Theme::GetPropertySet());
+        aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
+        
+        Reference<ui::XUIElement> xUIElement(
+            xUIElementFactory->createUIElement(
+                rsImplementationURL,
+                Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())),
+            UNO_QUERY_THROW);
+
+        return xUIElement;
+    }
+    catch(Exception& rException)
+    {
+        OSL_TRACE("caught exception: %s",
+            OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+        // For some reason we can not create the actual panel.
+        // Probably because its factory was not properly registered.
+        // TODO: provide feedback to developer to better pinpoint the
+        // source of the error.
+
+        return NULL;
+    }
+}
+
+
+
+
+IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->GetId())
+        {
+            case VCLEVENT_WINDOW_GETFOCUS:
+            case VCLEVENT_WINDOW_LOSEFOCUS:
+                break;
+                
+            case VCLEVENT_WINDOW_SHOW:
+            case VCLEVENT_WINDOW_RESIZE:
+                NotifyResize();
+                break;
+
+            case VCLEVENT_WINDOW_DATACHANGED:
+                // Force an update of deck and tab bar to reflect
+                // changes in theme (high contrast mode).
+                Theme::HandleDataChange();
+                mpParentWindow->Invalidate();
+                break;
+                
+            case SFX_HINT_DYING:
+                dispose();
+                break;
+                
+            default:
+                break;
+        }
+    }
+
+    return sal_True;
+}
+
+
+
+
+void SidebarController::ShowPopupMenu (
+    const Rectangle& rButtonBox,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+{
+    ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rDeckSelectionData, rDeckShowData);
+    pMenu->SetSelectHdl(LINK(this, SidebarController, OnMenuItemSelected));
+        
+    // pass toolbox button rect so the menu can stay open on button up
+    Rectangle aBox (rButtonBox);
+    aBox.Move(mpTabBar->GetPosPixel().X(), 0);
+    pMenu->Execute(mpParentWindow, aBox, POPUPMENU_EXECUTE_DOWN);
+}
+
+
+
+
+void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const
+{
+    try
+    {
+        util::URL aURL;
+        aURL.Complete = rsMenuCommand;
+
+        const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
+        const Reference<util::XURLTransformer> xParser (
+            aComponentContext.createComponent("com.sun.star.util.URLTransformer"),
+            UNO_QUERY_THROW);
+        xParser->parseStrict(aURL);
+        Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW);
+        Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(aURL, OUString(), 0));
+        if (xDispatch.is())
+            xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>());
+    }
+    catch(Exception& rException)
+    {
+        OSL_TRACE("caught exception: %s",
+            OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+    }
+}
+
+
+
+
+::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
+    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+{
+    ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu());
+    FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
+    if (pMenuWindow != NULL)
+    {
+        pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE);
+    }
+
+    SidebarResource aLocalResource;
+    
+    // Add one entry for every tool panel element to individually make
+    // them visible or hide them.
+    {
+        sal_Int32 nIndex (MID_FIRST_PANEL);
+        for(::std::vector<TabBar::DeckMenuData>::const_iterator
+                iItem(rDeckSelectionData.begin()),
+                iEnd(rDeckSelectionData.end());
+            iItem!=iEnd;
+            ++iItem)
+        {
+            pMenu->InsertItem(nIndex, iItem->get<0>(), MIB_RADIOCHECK);
+            pMenu->CheckItem(nIndex, iItem->get<2>());
+            ++nIndex;
+        }
+    }
+
+    pMenu->InsertSeparator();
+
+    // Add entry for docking or un-docking the tool panel.
+    if (mpParentWindow->IsFloatingMode())
+        pMenu->InsertItem(MID_LOCK_TASK_PANEL, String(SfxResId(STR_SFX_DOCK)));
+    else
+        pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, String(SfxResId(STR_SFX_UNDOCK)));
+
+    // Add sub menu for customization (hiding of deck tabs.)
+    PopupMenu* pCustomizationMenu = new PopupMenu();
+    {
+        sal_Int32 nIndex (MID_FIRST_HIDE);
+        for(::std::vector<TabBar::DeckMenuData>::const_iterator
+                iItem(rDeckShowData.begin()),
+                iEnd(rDeckShowData.end());
+            iItem!=iEnd;
+            ++iItem)
+        {
+            pCustomizationMenu->InsertItem(nIndex, iItem->get<0>(), MIB_CHECKABLE);
+            pCustomizationMenu->CheckItem(nIndex, iItem->get<2>());
+            ++nIndex;
+        }
+    }
+
+    pCustomizationMenu->InsertSeparator();
+    pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, String(SfxResId(STRING_RESTORE)));
+    
+    pMenu->InsertItem(MID_CUSTOMIZATION, String(SfxResId(STRING_CUSTOMIZATION)));
+    pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu);
+
+    pMenu->RemoveDisabledEntries(sal_False, sal_False);
+    
+    return pMenu;
+}
+
+
+
+
+IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu)
+{
+    if (pMenu == NULL)
+    {
+        OSL_ENSURE(pMenu!=NULL, "sfx2::sidebar::SidebarController::OnMenuItemSelected: illegal menu!");
+        return 0;
+    }
+
+    pMenu->Deactivate();
+    const sal_Int32 nIndex (pMenu->GetCurItemId());
+    switch (nIndex)
+    {
+        case MID_UNLOCK_TASK_PANEL:
+            mpParentWindow->SetFloatingMode(sal_True);
+            break;
+
+        case MID_LOCK_TASK_PANEL:
+            mpParentWindow->SetFloatingMode(sal_False);
+            break;
+
+        case MID_RESTORE_DEFAULT:
+            mpTabBar->RestoreHideFlags();
+            break;
+            
+        default:
+        {
+            try
+            {
+                if (nIndex >= MID_FIRST_PANEL && nIndex<MID_FIRST_HIDE)
+                    SwitchToDeck(mpTabBar->GetDeckIdForIndex(nIndex - MID_FIRST_PANEL));
+                else if (nIndex >=MID_FIRST_HIDE)
+                    mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
+            }
+            catch (RuntimeException&)
+            {
+            }
+        }
+        break;
+    }
+
+    return 1;
+}
+
+
+
+
+void SidebarController::CloseDeck (void)
+{
+    if ( ! mbIsDeckClosed)
+    {
+        mbIsDeckClosed = true;
+        if ( ! mpParentWindow->IsFloatingMode())
+            mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
+        mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
+        
+        if (mpCurrentDeck)
+            mpCurrentDeck->Hide();
+            
+        NotifyResize();
+    }
+}
+
+
+
+
+void SidebarController::OpenDeck (void)
+{
+    if (mbIsDeckClosed)
+    {
+        mbIsDeckClosed = false;
+        SetChildWindowWidth(mnSavedSidebarWidth);
+
+        if (mpCurrentDeck)
+            mpCurrentDeck->Show();
+
+        NotifyResize();
+    }
+}
+
+
+
+
+FocusManager& SidebarController::GetFocusManager (void)
+{
+    return maFocusManager;
+}
+
+
+
+
+bool SidebarController::CanModifyChildWindowWidth (void) const
+{
+    SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+    if (pSplitWindow == NULL)
+    {
+        OSL_ASSERT(pSplitWindow!=NULL);
+        return 0;
+    }
+
+    sal_uInt16 nRow (0xffff);
+    sal_uInt16 nColumn (0xffff);
+    pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
+
+    sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));
+
+    return nRowCount == 1;
+}
+
+
+
+
+sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
+{
+    SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+    if (pSplitWindow == NULL)
+        return 0;
+
+    sal_uInt16 nRow (0xffff);
+    sal_uInt16 nColumn (0xffff);
+    pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
+    const long nColumnWidth (pSplitWindow->GetLineSize(nColumn));
+
+    Window* pWindow = mpParentWindow;
+    const Point aWindowPosition (pWindow->GetPosPixel());
+    const Size aWindowSize (pWindow->GetSizePixel());
+
+    pSplitWindow->MoveWindow(
+        mpParentWindow,
+        Size(nNewWidth, aWindowSize.Height()),
+        nColumn,
+        nRow);
+        
+    return static_cast<sal_Int32>(nColumnWidth);
+}
+
+
+
+
+void SidebarController::RestrictWidth (void)
+{
+    SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+    if (pSplitWindow != NULL)
+    {
+        const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow));
+        const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
+        // Minimum width is always that of the tabbar.
+        const sal_Int32 nMinimumWidth (TabBar::GetDefaultWidth());
+        // Maximum width depends on whether the deck is open or closed.
+        const sal_Int32 nMaximumWidth (
+            mbIsDeckClosed
+                ? TabBar::GetDefaultWidth()
+                : 400);
+        pSplitWindow->SetItemSizeRange(
+            nSetId,
+            Range(nMinimumWidth, nMaximumWidth));
+        if (nMinimumWidth == nMaximumWidth)
+            pSplitWindow->SetItemSize(nSetId, nMinimumWidth);
+    }
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarController.hxx b/main/sfx2/source/sidebar/SidebarController.hxx
new file mode 100644
index 0000000..d66c778
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarController.hxx
@@ -0,0 +1,169 @@
+/**************************************************************
+ * 
+ * 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_CONTROLLER_HXX
+#define SFX_SIDEBAR_CONTROLLER_HXX
+
+#include "AsynchronousCall.hxx"
+#include "Context.hxx"
+#include "FocusManager.hxx"
+#include "Panel.hxx"
+#include "ResourceManager.hxx"
+#include "TabBar.hxx"
+
+#include <vcl/menu.hxx>
+
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper3 <
+        css::ui::XContextChangeEventListener,
+        css::beans::XPropertyChangeListener,
+        css::ui::XSidebar
+        > SidebarControllerInterfaceBase;
+}
+
+namespace sfx2 { namespace sidebar {
+
+class ContentPanelDescriptor;
+class Deck;
+class DeckDescriptor;
+class SidebarDockingWindow;
+class TabBar;
+class TabBarConfiguration;
+
+class SidebarController
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public SidebarControllerInterfaceBase
+{
+public:
+    SidebarController(
+        SidebarDockingWindow* pParentWindow,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+    virtual ~SidebarController (void);
+
+    // ui::XContextChangeEventListener
+    virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
+        throw(cssu::RuntimeException);
+
+    // XEventListener
+    virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject)
+        throw(cssu::RuntimeException);
+
+    // beans::XPropertyChangeListener
+    virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent)
+        throw(cssu::RuntimeException);
+
+    // ui::XSidebar
+    virtual void SAL_CALL requestLayout (void)
+        throw(cssu::RuntimeException);
+    
+    void NotifyResize (void);
+
+    void SwitchToDeck (
+        const ::rtl::OUString& rsDeckId);
+
+    /** Show only the tab bar, not the deck.
+    */
+    void CloseDeck (void);
+
+    /** Open the deck area and restore the parent window to its old width.
+    */
+    void OpenDeck (void);
+
+    FocusManager& GetFocusManager (void);
+    
+private:
+    ::boost::scoped_ptr<Deck> mpCurrentDeck;
+    SidebarDockingWindow* mpParentWindow;
+    ::boost::scoped_ptr<TabBar> mpTabBar;
+    cssu::Reference<css::frame::XFrame> mxFrame;
+    Context maCurrentContext;
+    ::rtl::OUString msCurrentDeckId;
+    ::rtl::OUString msCurrentDeckTitle;
+    AsynchronousCall maPropertyChangeForwarder;
+    bool mbIsDeckClosed;
+    /** Before the deck is closed the sidebar width is saved into this variable,
+        so that it can be restored when the deck is reopended.
+    */
+    sal_Int32 mnSavedSidebarWidth;
+    FocusManager maFocusManager;
+    
+    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+    void UpdateConfigurations (const Context& rContext);
+    bool ArePanelSetsEqual (
+        const SharedPanelContainer& rCurrentPanels,
+        const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels);
+    cssu::Reference<css::ui::XUIElement> CreateUIElement (
+        const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
+        const ::rtl::OUString& rsImplementationURL);
+    SharedPanel CreatePanel (
+        const ::rtl::OUString& rsPanelId,
+        ::Window* pParentWindow,
+        const ::rtl::OUString& rsMenuCommand);
+    void SwitchToDeck (
+        const DeckDescriptor& rDeckDescriptor,
+        const Context& rContext);
+    void ShowPopupMenu (
+        const Rectangle& rButtonBox,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+    void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const;
+    ::boost::shared_ptr<PopupMenu> CreatePopupMenu (
+        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+    DECL_LINK(OnMenuItemSelected, Menu*);
+    void BroadcastPropertyChange (void);
+
+    /** The close of the deck changes the width of the child window.
+        That is only possible if there is no other docking window docked above or below the sidebar.
+        Return whether the width of the child window can be modified.
+    */
+    bool CanModifyChildWindowWidth (void) const;
+        
+    /** Set the child window container to a new width.
+        Return the old width.
+    */
+    sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth);
+
+    void RestrictWidth (void);
+    
+    virtual void SAL_CALL disposing (void);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/SidebarDockingWindow.cxx b/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
new file mode 100644
index 0000000..d67ba52
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -0,0 +1,136 @@
+/**************************************************************
+ * 
+ * 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 "SidebarDockingWindow.hxx"
+#include "sfx2/sidebar/SidebarChildWindow.hxx"
+#include "SidebarController.hxx"
+
+#include "sfx2/bindings.hxx"
+#include "sfx2/dispatch.hxx"
+#include <tools/link.hxx>
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+SidebarDockingWindow::SidebarDockingWindow(
+    SfxBindings* pBindings,
+    SidebarChildWindow& rChildWindow,
+    Window* pParent,
+    WinBits nBits)
+    : SfxDockingWindow(pBindings, &rChildWindow, pParent, nBits),
+      mpSidebarController()
+{
+    // Get the XFrame from the bindings.
+    if (pBindings==NULL || pBindings->GetDispatcher()==NULL)
+    {
+        OSL_ASSERT(pBindings!=NULL);
+        OSL_ASSERT(pBindings->GetDispatcher()!=NULL);
+    }
+    else
+    {
+        const SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame();
+        const SfxFrame& rFrame = pViewFrame->GetFrame();
+        mpSidebarController.set(new sfx2::sidebar::SidebarController(this, rFrame.GetFrameInterface()));
+    }
+}
+
+
+
+
+SidebarDockingWindow::~SidebarDockingWindow (void)
+{
+    DoDispose();
+}
+
+
+
+
+void SidebarDockingWindow::DoDispose (void)
+{
+}
+
+
+
+
+void SidebarDockingWindow::GetFocus()
+{
+    mpSidebarController->GetFocusManager().GrabFocus();
+}
+
+
+
+
+long SidebarDockingWindow::PreNotify (NotifyEvent& rEvent)
+{
+    switch (rEvent.GetType())
+    {
+        case EVENT_KEYINPUT:
+        {
+            const KeyEvent* pKeyEvent = rEvent.GetKeyEvent();
+            if (pKeyEvent != NULL)
+                return mpSidebarController->GetFocusManager().NotifyDockingWindowEvent(*pKeyEvent);
+            else
+                break;
+        }
+
+        case EVENT_GETFOCUS:
+            OSL_TRACE("");
+            break;
+
+    }
+    
+    return SfxDockingWindow::PreNotify(rEvent);
+}
+
+
+
+
+SfxChildWindow* SidebarDockingWindow::GetChildWindow (void)
+{
+    return GetChildWindow_Impl();
+}
+
+
+
+
+sal_Bool SidebarDockingWindow::Close (void)
+{
+    if (mpSidebarController.is())
+    {
+        // Do not close the floating window.
+        // Dock it and close just the deck instead.
+        mpSidebarController->CloseDeck();
+        SetFloatingMode(sal_False);
+        mpSidebarController->NotifyResize();
+        return sal_False;
+    }
+    else
+        return SfxDockingWindow::Close();
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarDockingWindow.hxx b/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
new file mode 100644
index 0000000..8ee7720
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -0,0 +1,67 @@
+/**************************************************************
+ * 
+ * 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_DOCKING_WINDOW_HXX
+#define SFX_SIDEBAR_DOCKING_WINDOW_HXX
+
+#include "sfx2/dockwin.hxx"
+#include "sfx2/dockwin.hxx"
+#include "Sidebar.hxx"
+
+#include <rtl/ref.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+class SidebarChildWindow;
+
+class SidebarController;
+
+class SidebarDockingWindow
+    : public SfxDockingWindow
+{
+public:
+    SidebarDockingWindow(
+        SfxBindings* pBindings,
+        SidebarChildWindow& rChildWindow,
+        Window* pParent,
+        WinBits nBits);
+    virtual ~SidebarDockingWindow (void);
+
+    virtual sal_Bool Close (void);
+    
+    SfxChildWindow* GetChildWindow (void);
+
+protected:
+    // Window overridables
+    virtual void GetFocus (void);
+    virtual long PreNotify (NotifyEvent& rEvent);
+
+private:
+    ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
+
+    void DoDispose (void);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+
+#endif
diff --git a/main/sfx2/source/sidebar/SidebarPanel.cxx b/main/sfx2/source/sidebar/SidebarPanel.cxx
new file mode 100644
index 0000000..db3687e
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarPanel.cxx
@@ -0,0 +1,175 @@
+/**************************************************************
+ * 
+ * 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 "SidebarPanel.hxx"
+
+#include "Panel.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/smplhint.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+
+
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+Reference<css::ui::XSidebarPanel> SidebarPanel::Create (Panel* pPanel)
+{
+    return Reference<css::ui::XSidebarPanel>(new SidebarPanel(pPanel));
+}
+
+
+
+
+SidebarPanel::SidebarPanel(Panel* pPanel)
+    : SidebarPanelInterfaceBase(m_aMutex),
+      mpPanel(pPanel),
+      mxCanvas()
+{
+    if (mpPanel != NULL)
+        mpPanel->AddEventListener(LINK(this, SidebarPanel, HandleWindowEvent));
+    else
+    {
+        mpPanel = NULL;
+        dispose();
+    }
+}
+
+
+
+
+SidebarPanel::~SidebarPanel (void)
+{
+}
+
+
+
+
+void SAL_CALL SidebarPanel::disposing (const css::lang::EventObject& rEventObject)
+    throw(cssu::RuntimeException)
+{
+    (void)rEventObject;
+}
+
+
+
+
+void SAL_CALL SidebarPanel::disposing (void)
+{
+    if (mpPanel != NULL)
+    {
+        mpPanel->RemoveEventListener(LINK(this, SidebarPanel, HandleWindowEvent));
+        mpPanel = NULL;
+    }
+}
+
+
+
+
+cssu::Reference<css::rendering::XCanvas> SAL_CALL SidebarPanel::getCanvas (void)
+    throw (cssu::RuntimeException)
+{
+    if ( ! mxCanvas.is())
+    {
+        Sequence<Any> aArg (5);
+        
+        // common: first any is VCL pointer to window (for VCL canvas)
+        aArg[0] = makeAny(reinterpret_cast<sal_Int64>(mpPanel));
+        aArg[1] = Any();
+        aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
+        aArg[3] = makeAny(sal_False);
+        aArg[4] = makeAny(mpPanel->GetComponentInterface());
+        
+        const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory());
+        mxCanvas = Reference<rendering::XCanvas>(
+            aComponentContext.createComponentWithArguments(
+                "com.sun.star.rendering.VCLCanvas",
+                aArg),
+            UNO_QUERY);
+    }
+
+    return mxCanvas;
+
+}
+
+
+
+
+awt::Point SAL_CALL SidebarPanel::getPositionOnScreen (void)
+    throw (cssu::RuntimeException)
+{
+    awt::Point aAwtPoint;
+    
+    if (mpPanel != NULL)
+    {
+        ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+        //        mpPanel->GetPosPixel()
+        const Point aLocationOnScreen (mpPanel->OutputToAbsoluteScreenPixel(Point(0,0)));
+
+        aAwtPoint.X = aLocationOnScreen.X();
+        aAwtPoint.Y = aLocationOnScreen.Y();
+    }
+
+    return aAwtPoint;
+}
+
+
+
+
+Reference<beans::XPropertySet> SAL_CALL SidebarPanel::getThemeProperties (void)
+    throw (RuntimeException)
+{
+    return Theme::GetPropertySet();
+}
+
+
+
+
+IMPL_LINK(SidebarPanel, HandleWindowEvent, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->GetId())
+        {
+            case SFX_HINT_DYING:
+                dispose();
+                break;
+                
+            default:
+                break;
+        }
+    }
+
+    return sal_True;
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarPanel.hxx b/main/sfx2/source/sidebar/SidebarPanel.hxx
new file mode 100644
index 0000000..92c032c
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarPanel.hxx
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * 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_SIDEBAR_PANEL_HXX
+#define SFX_SIDEBAR_SIDEBAR_PANEL_HXX
+
+#include <tools/link.hxx>
+#include <com/sun/star/ui/XSidebarPanel.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::ui::XSidebarPanel
+        > SidebarPanelInterfaceBase;
+}
+
+
+class DockingWindow;
+class VclWindowEvent;
+
+namespace sfx2 { namespace sidebar {
+
+class Panel;
+
+class SidebarPanel
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public SidebarPanelInterfaceBase
+{
+public:
+    static cssu::Reference<css::ui::XSidebarPanel> Create (Panel* pPanel);
+
+protected:
+    SidebarPanel(
+        Panel* pPanel);
+    virtual ~SidebarPanel (void);
+
+    virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject)
+        throw(cssu::RuntimeException);
+
+    virtual void SAL_CALL disposing (void);
+
+private:
+    Panel* mpPanel;
+    cssu::Reference<css::rendering::XCanvas> mxCanvas;
+
+    DECL_LINK(HandleWindowEvent, VclWindowEvent*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/SidebarPanelBase.cxx b/main/sfx2/source/sidebar/SidebarPanelBase.cxx
new file mode 100644
index 0000000..62d2470
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -0,0 +1,252 @@
+/**************************************************************
+ * 
+ * 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/SidebarPanelBase.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "sfx2/sidebar/ILayoutableWindow.hxx"
+#include "sfx2/sidebar/IContextChangeReceiver.hxx"
+#include "sfx2/imagemgr.hxx"
+#include <vcl/ctrl.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/ui/UIElementType.hpp>
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+Reference<ui::XUIElement> SidebarPanelBase::Create (
+    const ::rtl::OUString& rsResourceURL,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    Window* pWindow,
+    const css::ui::LayoutSize& rLayoutSize)
+{
+    Reference<ui::XUIElement> xUIElement (
+        new SidebarPanelBase(
+            rsResourceURL,
+            rxFrame,
+            pWindow,
+            rLayoutSize));
+    return xUIElement;
+}
+
+
+
+
+SidebarPanelBase::SidebarPanelBase (
+    const ::rtl::OUString& rsResourceURL,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    Window* pWindow,
+    const css::ui::LayoutSize& rLayoutSize)
+    : SidebarPanelBaseInterfaceBase(m_aMutex),
+      mxFrame(rxFrame),
+      mpControl(pWindow),
+      msResourceURL(rsResourceURL),
+      maLayoutSize(rLayoutSize)
+{
+    if (mxFrame.is())
+    {
+        cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+            css::ui::ContextChangeEventMultiplexer::get(
+                ::comphelper::getProcessComponentContext()));
+        if (xMultiplexer.is())
+            xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
+    }
+    if (mpControl != NULL)
+    {
+        mpControl->SetBackground(Theme::GetWallpaper(Theme::Paint_PanelBackground));
+        mpControl->Show();
+    }
+}
+
+
+
+
+SidebarPanelBase::~SidebarPanelBase (void)
+{
+}
+
+
+
+
+void SAL_CALL SidebarPanelBase::disposing (void)
+    throw (cssu::RuntimeException)
+{
+    if (mpControl != NULL)
+    {
+        delete mpControl;
+        mpControl = NULL;
+    }
+    
+    if (mxFrame.is())
+    {
+        cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+            css::ui::ContextChangeEventMultiplexer::get(
+                ::comphelper::getProcessComponentContext()));
+        if (xMultiplexer.is())
+            xMultiplexer->removeAllContextChangeEventListeners(this);
+        mxFrame = NULL;
+    }
+}
+
+
+
+
+void SidebarPanelBase::SetControl (::Window* pControl)
+{
+    mpControl = pControl;
+}
+
+
+
+
+::Window* SidebarPanelBase::GetControl (void) const
+{
+    return mpControl;
+}
+
+
+
+
+// XContextChangeEventListener
+void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
+    const ui::ContextChangeEventObject& rEvent)
+    throw (cssu::RuntimeException)
+{
+    IContextChangeReceiver* pContextChangeReceiver
+        = dynamic_cast<IContextChangeReceiver*>(mpControl);
+    if (pContextChangeReceiver != NULL)
+    {
+        const EnumContext aContext(
+            EnumContext::GetApplicationEnum(rEvent.ApplicationName),
+            EnumContext::GetContextEnum(rEvent.ContextName));
+        pContextChangeReceiver->HandleContextChange(aContext);
+    }
+}
+
+
+
+
+void SAL_CALL SidebarPanelBase::disposing (
+    const css::lang::EventObject& rEvent)
+    throw (cssu::RuntimeException)
+{
+    (void)rEvent;
+
+    mxFrame = NULL;
+    mpControl = NULL;
+}
+
+
+
+
+cssu::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame (void)
+    throw(cssu::RuntimeException)
+{
+    return mxFrame;
+}
+
+
+
+
+::rtl::OUString SAL_CALL SidebarPanelBase::getResourceURL (void)
+    throw(cssu::RuntimeException)
+{
+    return msResourceURL;
+}
+
+
+
+
+sal_Int16 SAL_CALL SidebarPanelBase::getType (void)
+    throw(cssu::RuntimeException)
+{
+    return ui::UIElementType::TOOLPANEL;
+}
+
+
+
+
+Reference<XInterface> SAL_CALL SidebarPanelBase::getRealInterface (void)
+    throw(cssu::RuntimeException)
+{
+    return Reference<XInterface>(static_cast<XWeak*>(this));
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessible (
+    const Reference<accessibility::XAccessible>& rxParentAccessible)
+    throw(cssu::RuntimeException)
+{
+    (void)rxParentAccessible;
+    
+    // Not yet implemented.
+    return NULL;
+}
+
+
+
+
+Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow (void)
+    throw(cssu::RuntimeException)
+{
+    if (mpControl != NULL)
+        return Reference<awt::XWindow>(
+            mpControl->GetComponentInterface(),
+            UNO_QUERY);
+    else
+        return NULL;
+}
+
+
+
+
+ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth)
+    throw(cssu::RuntimeException)
+{
+    if (maLayoutSize.Minimum >= 0)
+        return maLayoutSize;
+    else
+    {
+        ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl);
+        if (pLayoutableWindow != NULL)
+            return pLayoutableWindow->GetHeightForWidth(nWidth);
+        else if (mpControl != NULL)
+        {
+            const sal_Int32 nHeight (mpControl->GetSizePixel().Height());
+            return ui::LayoutSize(nHeight,nHeight,nHeight);
+        }
+    }
+
+    return ui::LayoutSize(0,0,0);
+}
+
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarResource.hxx b/main/sfx2/source/sidebar/SidebarResource.hxx
new file mode 100644
index 0000000..89665b6
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarResource.hxx
@@ -0,0 +1,39 @@
+/**************************************************************
+ * 
+ * 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_RESOURCE_HXX
+#define SFX_SIDEBAR_RESOURCE_HXX
+
+
+#include "Sidebar.hrc"
+#include <sfx2/sfxresid.hxx>
+#include <tools/rc.hxx>
+
+
+class SidebarResource : public Resource
+{
+public:
+    SidebarResource (void) : Resource(SfxResId(RID_SIDEBAR_RESOURCE)){}
+    ~SidebarResource (void) { FreeResource(); }
+};
+
+
+#endif
diff --git a/main/sfx2/source/sidebar/SidebarToolBox.cxx b/main/sfx2/source/sidebar/SidebarToolBox.cxx
new file mode 100644
index 0000000..4dd0f2e
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -0,0 +1,159 @@
+/**************************************************************
+ * 
+ * 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 "SidebarToolBox.hxx"
+#include "ToolBoxBackground.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "Tools.hxx"
+
+#include <vcl/gradient.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+SidebarToolBox::SidebarToolBox (
+    Window* pParentWindow,
+    const ResId& rResId)
+    : ToolBox(pParentWindow, rResId),
+      mbParentIsBorder(false),
+      maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
+{
+    SetBackground(Wallpaper());
+    SetPaintTransparent(true);
+#ifdef DEBUG
+    SetText(A2S("SidebarToolBox"));
+#endif
+}
+
+
+
+
+SidebarToolBox::~SidebarToolBox (void)
+{
+}
+
+
+
+
+void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow)
+{
+    if (pBorderWindow != GetParent())
+    {
+        OSL_ASSERT("SetBorderWindow can only handle parent as border window");
+        return;
+    }
+
+    if ( ! mbParentIsBorder)
+    {
+        mbParentIsBorder = true;
+
+        SetPosSizePixel (
+            GetPosPixel().X(),
+            GetPosPixel().Y(),
+            GetSizePixel().Width(),
+            GetSizePixel().Height(),
+            WINDOW_POSSIZE_ALL);
+    }
+}
+
+
+
+
+void SidebarToolBox::Paint (const Rectangle& rRect)
+{
+    ToolBox::Paint(rRect);
+    
+    if (Theme::GetBoolean(Theme::Bool_UseToolBoxItemSeparator))
+    {
+        const sal_Int32 nSeparatorY ((GetSizePixel().Height() - maItemSeparator.GetSizePixel().Height())/2);
+        const sal_uInt16 nItemCount (GetItemCount());
+        int nLastRight (-1);
+        for (sal_uInt16 nIndex=0; nIndex<nItemCount; ++nIndex)
+        {
+            const Rectangle aItemBoundingBox (GetItemPosRect(nIndex));
+            if (nLastRight >= 0)
+            {
+                const int nSeparatorX ((nLastRight + aItemBoundingBox.Left() - 1) / 2);
+                DrawImage(Point(nSeparatorX,nSeparatorY), maItemSeparator);
+            }
+        
+            nLastRight = aItemBoundingBox.Right();
+        }
+    }
+}
+
+
+
+
+Point SidebarToolBox::GetPosPixel (void) const
+{
+    if (mbParentIsBorder)
+    {
+        const Point aParentPoint (GetParent()->GetPosPixel());
+        const Point aChildPoint (ToolBox::GetPosPixel());
+        return Point(
+            aParentPoint.X() + aChildPoint.X(),
+            aParentPoint.Y() + aChildPoint.Y());
+    }
+    else
+        return ToolBox::GetPosPixel();
+}
+
+
+
+
+void SidebarToolBox::SetPosSizePixel (
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    sal_uInt16 nFlags)
+{
+    if (mbParentIsBorder)
+    {
+        const Point aRelativePosition (static_cast<ToolBoxBackground*>(GetParent())->SetToolBoxChild(
+                this,
+                nX,
+                nY,
+                nWidth,
+                nHeight,
+                nFlags));
+        ToolBox::SetPosSizePixel(
+            aRelativePosition.X(),
+            aRelativePosition.Y(),
+            nWidth,
+            nHeight,
+            nFlags);
+    }
+    else
+        ToolBox::SetPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/SidebarToolBox.hxx b/main/sfx2/source/sidebar/SidebarToolBox.hxx
new file mode 100644
index 0000000..b9f17e1
--- /dev/null
+++ b/main/sfx2/source/sidebar/SidebarToolBox.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ * 
+ * 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_TOOLBOX_HXX
+#define SFX_SIDEBAR_TOOLBOX_HXX
+
+#include "vcl/toolbox.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+class SidebarToolBox
+    : public ToolBox
+{
+public:
+    SidebarToolBox (Window* pParentWindow, const ResId& rResId);
+    virtual ~SidebarToolBox (void);
+
+    void SetBorderWindow (const Window* pBorderWindow);
+    virtual void Paint (const Rectangle& rRect);
+
+    virtual Point GetPosPixel (void) const;
+    virtual void SetPosSizePixel (
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags);
+
+private:
+    bool mbParentIsBorder;
+    Image maItemSeparator;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/TabBar.cxx b/main/sfx2/source/sidebar/TabBar.cxx
new file mode 100644
index 0000000..c26fa89
--- /dev/null
+++ b/main/sfx2/source/sidebar/TabBar.cxx
@@ -0,0 +1,401 @@
+/**************************************************************
+ * 
+ * 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 "TabBar.hxx"
+#include "TabItem.hxx"
+#include "sidebar/ControlFactory.hxx"
+#include "DeckDescriptor.hxx"
+#include "Paint.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+#include "Tools.hxx"
+#include "FocusManager.hxx"
+
+#include <vcl/gradient.hxx>
+#include <vcl/image.hxx>
+#include <vcl/wrkwin.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <tools/svborder.hxx>
+
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+
+
+namespace sfx2 { namespace sidebar {
+
+TabBar::TabBar (
+    Window* pParentWindow,
+    const Reference<frame::XFrame>& rxFrame,
+    const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor,
+    const PopupMenuProvider& rPopupMenuProvider)
+    : Window(pParentWindow, WB_DIALOGCONTROL),
+      mxFrame(rxFrame),
+      mpMenuButton(ControlFactory::CreateMenuButton(this)),
+      maItems(),
+      maDeckActivationFunctor(rDeckActivationFunctor),
+      maPopupMenuProvider(rPopupMenuProvider)
+{
+    SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
+    
+    mpMenuButton->SetModeImage(
+        Theme::GetImage(Theme::Image_TabBarMenu),
+        Theme::IsHighContrastMode()
+            ? BMP_COLOR_HIGHCONTRAST
+            : BMP_COLOR_NORMAL);
+    mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked));
+    Layout();
+
+#ifdef DEBUG
+    SetText(A2S("TabBar"));
+#endif
+}
+
+
+
+
+TabBar::~TabBar (void)
+{
+}
+
+
+
+
+void TabBar::Paint (const Rectangle& rUpdateArea)
+{
+    Window::Paint(rUpdateArea);
+
+    const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
+    SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
+    DrawLine(
+        Point(nHorizontalPadding, mnMenuSeparatorY),
+        Point(GetSizePixel().Width()-nHorizontalPadding, mnMenuSeparatorY));
+}
+
+
+
+
+sal_Int32 TabBar::GetDefaultWidth (void)
+{
+    return Theme::GetInteger(Theme::Int_TabItemWidth)
+        + Theme::GetInteger(Theme::Int_TabBarLeftPadding)
+        + Theme::GetInteger(Theme::Int_TabBarRightPadding);
+}
+
+
+
+
+void TabBar::SetDecks (
+    const ResourceManager::IdContainer& rDeckIds)
+{
+    // Remove the current buttons.
+    {
+        for(ItemContainer::iterator
+                iItem(maItems.begin()), iEnd(maItems.end());
+            iItem!=iEnd;
+            ++iItem)
+        {
+            iItem->mpButton.reset();
+        }
+        maItems.clear();
+    }
+
+    maItems.resize(rDeckIds.size());
+    sal_Int32 nIndex (0);
+    for (ResourceManager::IdContainer::const_iterator
+             iDeckId(rDeckIds.begin()),
+             iEnd(rDeckIds.end());
+         iDeckId!=iEnd;
+         ++iDeckId)
+    {
+        const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(*iDeckId);
+        if (pDescriptor == NULL)
+        {
+            OSL_ASSERT(pDescriptor!=NULL);
+            continue;
+        }
+            
+        Item& rItem (maItems[nIndex++]);
+        rItem.msDeckId = pDescriptor->msId;
+        rItem.mpButton.reset(CreateTabItem(*pDescriptor));
+        rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
+        rItem.maDeckActivationFunctor = maDeckActivationFunctor;
+        rItem.mbIsHiddenByDefault = false;
+        rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
+    }
+
+    UpdateButtonIcons();
+    Layout();
+}
+
+
+
+
+void TabBar::UpdateButtonIcons (void)
+{
+    const BmpColorMode eColorMode (
+        Theme::IsHighContrastMode()
+            ? BMP_COLOR_HIGHCONTRAST
+            : BMP_COLOR_NORMAL);
+    
+    mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu), eColorMode);
+
+    for(ItemContainer::const_iterator
+            iItem(maItems.begin()), iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+        if (pDeckDescriptor != NULL)
+            iItem->mpButton->SetModeImage(
+                GetItemImage(*pDeckDescriptor),
+                eColorMode);
+    }
+
+    Invalidate();
+}
+
+
+
+
+void TabBar::Layout (void)
+{
+    const SvBorder aPadding (
+        Theme::GetInteger(Theme::Int_TabBarLeftPadding),
+        Theme::GetInteger(Theme::Int_TabBarTopPadding),
+        Theme::GetInteger(Theme::Int_TabBarRightPadding),
+        Theme::GetInteger(Theme::Int_TabBarBottomPadding));
+    sal_Int32 nX (aPadding.Top());
+    sal_Int32 nY (aPadding.Left());
+    const Size aTabItemSize (
+        Theme::GetInteger(Theme::Int_TabItemWidth),
+        Theme::GetInteger(Theme::Int_TabItemHeight));
+
+    // Place the menu button and the separator.
+    if (mpMenuButton != NULL)
+    {
+        mpMenuButton->SetPosSizePixel(
+            Point(nX,nY),
+            aTabItemSize);
+        mpMenuButton->Show();
+        nY += mpMenuButton->GetSizePixel().Height() + 1 + Theme::GetInteger(Theme::Int_TabMenuPadding);
+        mnMenuSeparatorY = nY - Theme::GetInteger(Theme::Int_TabMenuPadding)/2 - 1;
+    }
+
+    // Place the deck selection buttons.
+    for(ItemContainer::const_iterator
+            iItem(maItems.begin()), iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        Button& rButton (*iItem->mpButton);
+        rButton.Show( ! iItem->mbIsHidden);
+        
+        if (iItem->mbIsHidden)
+            continue;
+
+        // Place and size the icon.
+        rButton.SetPosSizePixel(
+            Point(nX,nY),
+            aTabItemSize);
+        rButton.Show();
+        
+        nY += rButton.GetSizePixel().Height() + 1 + aPadding.Bottom();
+    }
+    Invalidate();
+}
+
+
+
+
+void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
+{
+    for (ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
+         iItem!=iEnd;
+         ++iItem)
+    {
+        if (iItem->msDeckId.equals(rsDeckId))
+        {
+            iItem->mpButton->Check();
+            break;
+        }
+    }
+}
+
+
+
+
+void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
+{
+    SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
+    UpdateButtonIcons();
+
+    Window::DataChanged(rDataChangedEvent);
+}
+
+
+
+
+RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
+{
+    RadioButton* pItem = ControlFactory::CreateTabItem(this);
+    pItem->SetHelpText(rDeckDescriptor.msHelpText);
+    pItem->SetQuickHelpText(rDeckDescriptor.msHelpText);
+
+    return pItem;
+}
+
+
+
+Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const
+{
+    return Tools::GetImage(
+        rDeckDescriptor.msIconURL,
+        rDeckDescriptor.msHighContrastIconURL,
+        mxFrame);
+}
+
+
+
+
+
+IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG)
+{
+    maDeckActivationFunctor(msDeckId);
+    return 1;
+}
+
+
+
+
+const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
+{
+    if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
+        throw RuntimeException();
+    else
+        return maItems[nIndex].msDeckId;
+}
+
+
+
+
+void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
+{
+    if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
+        throw RuntimeException();
+    else
+    {
+        maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
+        ResourceManager::Instance().SetIsDeckEnabled(
+            maItems[nIndex].msDeckId,
+            maItems[nIndex].mbIsHidden);
+        Layout();
+    }
+}
+
+
+
+
+void TabBar::RestoreHideFlags (void)
+{
+    bool bNeedsLayout (false);
+    for(ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
+        {
+            iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
+            bNeedsLayout = true;
+        }
+    }
+    if (bNeedsLayout)
+        Layout();
+}
+
+
+
+
+void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
+{
+    ::std::vector<Button*> aButtons;
+    aButtons.reserve(maItems.size()+1);
+    
+    aButtons.push_back(mpMenuButton.get());
+    for(ItemContainer::const_iterator
+            iItem(maItems.begin()), iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        aButtons.push_back(iItem->mpButton.get());
+    }
+    rFocusManager.SetButtons(aButtons);
+}
+
+
+
+
+IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
+{
+    ::std::vector<DeckMenuData> aSelectionData;
+    ::std::vector<DeckMenuData> aShowData;
+    
+    for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+        if (pDeckDescriptor != NULL)
+        {
+            if ( ! iItem->mbIsHidden)
+                aSelectionData.push_back(
+                    DeckMenuData(
+                        pDeckDescriptor->msTitle,
+                        pDeckDescriptor->msId,
+                        iItem->mpButton->IsChecked()));
+
+            aShowData.push_back(
+                DeckMenuData(
+                    pDeckDescriptor->msTitle,
+                    pDeckDescriptor->msId,
+                    !iItem->mbIsHidden));
+        }
+    }
+
+    maPopupMenuProvider(
+        Rectangle(
+            mpMenuButton->GetPosPixel(),
+            mpMenuButton->GetSizePixel()),
+        aSelectionData,
+        aShowData);
+    
+    return 0;
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/TabBar.hxx b/main/sfx2/source/sidebar/TabBar.hxx
new file mode 100644
index 0000000..0fc9b7d
--- /dev/null
+++ b/main/sfx2/source/sidebar/TabBar.hxx
@@ -0,0 +1,124 @@
+/**************************************************************
+ * 
+ * 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_TAB_BAR_HXX
+#define SFX_SIDEBAR_TAB_BAR_HXX
+
+#include "DeckDescriptor.hxx"
+#include "ResourceManager.hxx"
+
+#include <vcl/menu.hxx>
+#include <vcl/window.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <boost/function.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/scoped_ptr.hpp>
+
+class Button;
+class RadioButton;
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+class FocusManager;
+class TabBarConfiguration;
+class TabItem;
+
+/** The tab bar is the container for the individual tabs.
+*/
+class TabBar
+    : public Window
+{
+public:
+    /** DeckMenuData has entries for display name, deck id, and a flag:
+         - isCurrentDeck for the deck selection data
+         - isEnabled     for the show/hide menu 
+    */
+    typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData;
+    typedef ::boost::function<void(
+            const Rectangle&,
+            const ::std::vector<DeckMenuData>& rDeckSelectionData,
+            const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider;
+    TabBar (
+        Window* pParentWindow,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
+        const PopupMenuProvider& rPopupMenuProvider);
+    virtual ~TabBar (void);
+
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void DataChanged (const DataChangedEvent& rDataChangedEvent);
+
+    static sal_Int32 GetDefaultWidth (void);
+
+    void SetDecks (
+        const ResourceManager::IdContainer& rDeckIds);
+    void HighlightDeck (const ::rtl::OUString& rsDeckId);
+    void AddPopupMenuEntries (
+        PopupMenu& rMenu,
+        const sal_Int32 nFirstIndex);
+    void AddCustomizationMenuEntries (
+        PopupMenu& rMenu,
+        const sal_Int32 nFirstIndex);
+    const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
+    void ToggleHideFlag (const sal_Int32 nIndex);
+    void RestoreHideFlags (void);
+
+    void UpdateFocusManager (FocusManager& rFocusManager);
+
+private:
+    cssu::Reference<css::frame::XFrame> mxFrame;
+    ::boost::scoped_ptr<Button> mpMenuButton;
+    class Item
+    {
+    public:
+        DECL_LINK(HandleClick, Button*);
+        ::boost::shared_ptr<RadioButton> mpButton;
+        ::rtl::OUString msDeckId;
+        ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
+        bool mbIsHidden;
+        bool mbIsHiddenByDefault;
+    };
+    typedef ::std::vector<Item> ItemContainer;
+    ItemContainer maItems;
+    const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
+    sal_Int32 mnMenuSeparatorY;
+    PopupMenuProvider maPopupMenuProvider;
+    
+    RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
+    Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
+    void Layout (void);
+    void UpdateButtonIcons (void);
+
+    ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const;
+    void ShowPopupMenu (void) const;
+    DECL_LINK(OnToolboxClicked, void*);
+
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/TabItem.cxx b/main/sfx2/source/sidebar/TabItem.cxx
new file mode 100644
index 0000000..d71f138
--- /dev/null
+++ b/main/sfx2/source/sidebar/TabItem.cxx
@@ -0,0 +1,150 @@
+/**************************************************************
+ * 
+ * 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 "TabItem.hxx"
+
+#include "DrawHelper.hxx"
+#include "Paint.hxx"
+#include "Tools.hxx"
+
+#include "sfx2/sidebar/Theme.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+TabItem::TabItem (Window* pParentWindow)
+    : ImageRadioButton(pParentWindow),
+      mbIsLeftButtonDown(false),
+      mePaintType(PT_Theme)
+{
+    SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS);
+    SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
+#ifdef DEBUG
+    SetText(A2S("TabItem"));
+#endif
+}
+
+
+
+
+TabItem::~TabItem (void)
+{
+}
+
+
+
+
+void TabItem::Paint (const Rectangle& rUpdateArea)
+{
+    OSL_TRACE("TabItem::Paint");
+    switch(mePaintType)
+    {
+        case PT_Theme:
+        default:
+        {
+            const bool bIsSelected (IsChecked());
+            const bool bIsHighlighted (IsMouseOver() || HasFocus());
+            DrawHelper::DrawRoundedRectangle(
+                *this,
+                Rectangle(Point(0,0), GetSizePixel()),
+                Theme::GetInteger(Theme::Int_ButtonCornerRadius),
+                bIsHighlighted||bIsSelected
+                    ? Theme::GetColor(Theme::Color_TabItemBorder)
+                    : Color(0xffffffff),
+                bIsHighlighted
+                    ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
+                    : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
+
+            const Image aIcon (Button::GetModeImage(Theme::IsHighContrastMode()
+                    ? BMP_COLOR_HIGHCONTRAST
+                    : BMP_COLOR_NORMAL));
+            const Size aIconSize (aIcon.GetSizePixel());
+            const Point aIconLocation(
+                (GetSizePixel().Width() - aIconSize.Width())/2,
+                (GetSizePixel().Height() - aIconSize.Height())/2);
+            DrawImage(
+                aIconLocation,
+                aIcon);
+            break;
+        }
+        case PT_Native:
+            Button::Paint(rUpdateArea);
+            //            DrawImage(maIconPosition, maIcon);
+            break;
+    }
+}
+
+
+
+
+void TabItem::MouseMove (const MouseEvent& rEvent)
+{
+    if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow())
+        Invalidate();
+    ImageRadioButton::MouseMove(rEvent);
+}
+
+
+
+
+void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
+{
+    if (rMouseEvent.IsLeft())
+    {
+        mbIsLeftButtonDown = true;
+        CaptureMouse();
+        Invalidate();
+    }
+}
+
+
+
+
+void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent)
+{
+    if (IsMouseCaptured())
+        ReleaseMouse();
+    
+    if (rMouseEvent.IsLeft())
+    {
+        if (mbIsLeftButtonDown)
+        {
+            Check();
+            Click();
+            GetParent()->Invalidate();
+        }
+    }
+    if (mbIsLeftButtonDown)
+    {
+        mbIsLeftButtonDown = false;
+        Invalidate();
+    }
+}
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/TabItem.hxx b/main/sfx2/source/sidebar/TabItem.hxx
new file mode 100644
index 0000000..2ad42ae
--- /dev/null
+++ b/main/sfx2/source/sidebar/TabItem.hxx
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * 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_TAB_ITEM_HXX
+#define SFX_SIDEBAR_TAB_ITEM_HXX
+
+#include "vcl/button.hxx"
+
+#include "DeckDescriptor.hxx"
+
+class Window;
+
+namespace sfx2 { namespace sidebar {
+
+/** A single button in the The tab bar.
+*/
+class TabItem
+    : public ImageRadioButton
+{
+public:
+    TabItem (Window* pParentWindow);
+    virtual ~TabItem (void);
+
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void MouseMove (const MouseEvent& rEvent);
+    virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
+    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+
+private:
+    bool mbIsLeftButtonDown;
+    enum PaintType {
+        PT_Native,
+        PT_Theme
+    } mePaintType;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Theme.cxx b/main/sfx2/source/sidebar/Theme.cxx
new file mode 100644
index 0000000..e9b94dd
--- /dev/null
+++ b/main/sfx2/source/sidebar/Theme.cxx
@@ -0,0 +1,1174 @@
+/**************************************************************
+ * 
+ * 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/Theme.hxx"
+#include "Paint.hxx"
+#include "SidebarResource.hxx"
+#include "Tools.hxx"
+
+#include <tools/svborder.hxx>
+#include <tools/rc.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+::rtl::Reference<Theme> Theme::mpInstance;
+
+
+
+
+Theme& Theme::GetCurrentTheme (void)
+{
+    if ( ! mpInstance.is())
+    {
+        mpInstance.set(new Theme());
+        mpInstance->InitializeTheme();
+    }
+    return *mpInstance;
+}
+
+
+
+
+Theme::Theme (void)
+    : ThemeInterfaceBase(m_aMutex),
+      maImages(),
+      maColors(),
+      maPaints(),
+      maIntegers(),
+      maBooleans(),
+      mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()),
+      mbIsHighContrastModeSetManually(false),
+      maPropertyNameToIdMap(),
+      maPropertyIdToNameMap(),
+      maRawValues(),
+      maChangeListeners(),
+      maVetoableListeners()
+
+{
+    SetupPropertyMaps();
+}
+
+
+
+
+Theme::~Theme (void)
+{
+}
+
+
+
+
+Image Theme::GetImage (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Image);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maImages[nIndex];
+}
+
+
+
+
+Color Theme::GetColor (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Color || eType==PT_Paint);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    if (eType == PT_Color)
+        return rTheme.maColors[nIndex];
+    else if (eType == PT_Paint)
+        return rTheme.maPaints[nIndex].GetColor();
+    else
+        return COL_WHITE;
+}
+
+
+
+
+const Paint& Theme::GetPaint (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Paint);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maPaints[nIndex];
+}
+
+
+
+
+const Wallpaper Theme::GetWallpaper (const ThemeItem eItem)
+{
+    return GetPaint(eItem).GetWallpaper();
+}
+
+
+
+
+sal_Int32 Theme::GetInteger (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Integer);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maIntegers[nIndex];
+}
+
+
+
+
+bool Theme::GetBoolean (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Boolean);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maBooleans[nIndex];
+}
+
+
+
+
+Rectangle Theme::GetRectangle (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Rectangle);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maRectangles[nIndex];
+}
+
+
+
+
+bool Theme::IsHighContrastMode (void)
+{
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.mbIsHighContrastMode;
+}
+
+
+
+
+void Theme::HandleDataChange (void)
+{
+    Theme& rTheme (GetCurrentTheme());
+
+    if ( ! rTheme.mbIsHighContrastModeSetManually)
+    {
+        // Do not modify mbIsHighContrastMode when it was manually set.
+        GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+        rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode);
+    }
+
+    GetCurrentTheme().UpdateTheme();
+}
+
+
+
+
+void Theme::InitializeTheme (void)
+{
+    setPropertyValue(
+        maPropertyIdToNameMap[Bool_UseSymphonyIcons],
+        Any(false));
+    setPropertyValue(
+        maPropertyIdToNameMap[Bool_UseSystemColors],
+        Any(false));
+}
+
+
+
+
+void Theme::UpdateTheme (void)
+{
+    SidebarResource aLocalResource;
+
+    try
+    {
+        const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings());
+        const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors));
+
+#define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
+
+        const Color aBaseBackgroundColor (rStyle.GetDialogColor());
+        Color aBorderColor (aBaseBackgroundColor);
+        aBorderColor.DecreaseLuminance(15);
+        Color aSecondColor (aBaseBackgroundColor);
+        aSecondColor.DecreaseLuminance(15);
+        
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_DeckBackground],
+            Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
+            Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckLeftPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckTopPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckRightPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckBottomPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckBorderSize],
+            Any(sal_Int32(1)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckSeparatorHeight],
+            Any(sal_Int32(1)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_ButtonCornerRadius],
+            Any(sal_Int32(3)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_DeckTitleFont],
+            Any(sal_Int32(rStyle.GetFontColor().GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_DeckTitleBarHeight],
+            Any(sal_Int32(Alternatives(
+                        26,
+                        26,
+                        rStyle.GetFloatTitleHeight()))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_PanelBackground],
+            Any(sal_Int32(rStyle.GetDialogColor().GetRGBColor())));
+        //            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 :
+        //            0xffffff)));
+        
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_PanelTitleBarBackground],
+            Any(Tools::VclToAwtGradient(Gradient(
+                        GRADIENT_LINEAR,
+                        aSecondColor.GetRGBColor(),
+                        aBaseBackgroundColor.GetRGBColor()
+                        ))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_PanelTitleFont],
+            Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_PanelTitleBarHeight],
+            Any(sal_Int32(Alternatives(
+                        26,
+                        26,
+                        rStyle.GetTitleHeight()))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_TabBarBackground],
+            Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabBarLeftPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabBarTopPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabBarRightPadding],
+            Any(sal_Int32(2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabBarBottomPadding],
+            Any(sal_Int32(2)));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabMenuPadding],
+            Any(sal_Int32(6)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_TabMenuSeparator],
+            Any(sal_Int32(aBorderColor.GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabMenuSeparatorPadding],
+            Any(sal_Int32(7)));
+    
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabItemWidth],
+            Any(sal_Int32(32)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Int_TabItemHeight],
+            Any(sal_Int32(32)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_TabItemBorder],
+            Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
+        //                    mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_DropDownBackground],
+            Any(sal_Int32(aBaseBackgroundColor.GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_DropDownBorder],
+            Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor())));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_Highlight],
+            Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Color_HighlightText],
+            Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor())));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
+            Any());
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
+            Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor())));
+        //                    mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_HorizontalBorder],
+            Any(sal_Int32(aBorderColor.GetRGBColor())));
+        //                    mbIsHighContrastMode ? 0x00ff00 :  0xe4e4e4)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_VerticalBorder],
+            Any(sal_Int32(aBorderColor.GetRGBColor())));
+        //                    mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4)));
+
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_Grip],
+            Any(
+                mbIsHighContrastMode
+                    ? A2S("private:graphicrepository/sfx2/res/grip_hc.png")
+                    : A2S("private:graphicrepository/sfx2/res/grip.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_Expand],
+            Any(
+                mbIsHighContrastMode
+                    ? A2S("private:graphicrepository/res/plus_sch.png")
+                    : A2S("private:graphicrepository/res/plus.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_Collapse],
+            Any(
+                mbIsHighContrastMode
+                    ? A2S("private:graphicrepository/res/minus_sch.png")
+                    : A2S("private:graphicrepository/res/minus.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_TabBarMenu],
+            Any(
+                mbIsHighContrastMode
+                    ? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
+                    : A2S("private:graphicrepository/sfx2/res/symphony/open_more.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_PanelMenu],
+            Any(
+                mbIsHighContrastMode
+                    ? A2S("private:graphicrepository/sfx2/res/symphony/morebutton.png")
+                    : A2S("private:graphicrepository/sfx2/res/symphony/morebutton_h.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_Closer],
+            Any(A2S("private:graphicrepository/sfx2/res/closedoc.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
+            Any(
+                A2S("private:graphicrepository/sfx2/res/separator.png")));
+
+        // ToolBox
+
+        /*
+        // Separator style
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBackground],
+            Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor())));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
+            Any());
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
+            Any());
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
+            Any());
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxPadding],
+            Any(awt::Rectangle(2,2,2,2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxBorder],
+            Any(awt::Rectangle(0,0,0,0)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
+            Any(true));
+
+        */
+
+        // Gradient style
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBackground],
+            Any(Tools::VclToAwtGradient(Gradient(
+                        GRADIENT_LINEAR,
+                        Color(0xf2f2f2),
+                        Color(0xfefefe)
+                        ))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxPadding],
+            Any(awt::Rectangle(2,2,2,2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxBorder],
+            Any(awt::Rectangle(1,1,1,1)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
+            Any(false));
+    }
+    catch(beans::UnknownPropertyException& rException)
+    {
+        OSL_TRACE("unknown property: %s",
+            OUStringToOString(
+                rException.Message,
+                RTL_TEXTENCODING_ASCII_US).getStr());
+        OSL_ASSERT(false);
+    }
+}
+
+
+
+
+void SAL_CALL Theme::disposing (void)
+{
+    ChangeListeners aListeners;
+    maChangeListeners.swap(aListeners);
+
+    const lang::EventObject aEvent (static_cast<XWeak*>(this));
+    
+    for (ChangeListeners::const_iterator
+             iContainer(maChangeListeners.begin()),
+             iContainerEnd(maChangeListeners.end());
+         iContainerEnd!=iContainerEnd;
+         ++iContainerEnd)
+    {
+        for (ChangeListenerContainer::const_iterator
+                 iListener(iContainer->second.begin()),
+                 iEnd(iContainer->second.end());
+             iListener!=iEnd;
+             ++iListener)
+        {
+            try
+            {
+                (*iListener)->disposing(aEvent);
+            }
+            catch(const Exception&)
+            {
+            }
+        }
+    }
+}
+
+
+
+
+Reference<beans::XPropertySet> Theme::GetPropertySet (void)
+{
+    return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY);
+}
+
+
+
+
+Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
+    throw(cssu::RuntimeException)
+{
+    return Reference<beans::XPropertySetInfo>(this);
+}
+
+
+
+
+void SAL_CALL Theme::setPropertyValue (
+    const ::rtl::OUString& rsPropertyName,
+    const cssu::Any& rValue)
+    throw(cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        throw beans::UnknownPropertyException(rsPropertyName, NULL);
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        throw beans::UnknownPropertyException(rsPropertyName, NULL);
+
+    const ThemeItem eItem (iId->second);
+        
+    if (rValue == maRawValues[eItem])
+    {
+        // Value is not different from the one in the property
+        // set => nothing to do.
+        return;
+    }
+
+    const Any aOldValue (maRawValues[eItem]);
+
+    const beans::PropertyChangeEvent aEvent(
+        static_cast<XWeak*>(this),
+        rsPropertyName,
+        sal_False,
+        eItem,
+        aOldValue,
+        rValue);
+    
+    if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent))
+        return;
+    if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent))
+        return;
+    
+    maRawValues[eItem] = rValue;
+    ProcessNewValue(rValue, eItem, eType);
+
+    BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent);
+    BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent);
+}
+
+
+
+
+Any SAL_CALL Theme::getPropertyValue (
+    const ::rtl::OUString& rsPropertyName)
+    throw(css::beans::UnknownPropertyException,
+        css::lang::WrappedTargetException,
+        cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        throw beans::UnknownPropertyException();
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        throw beans::UnknownPropertyException();
+
+    const ThemeItem eItem (iId->second);
+
+    return maRawValues[eItem];
+}
+
+
+
+
+void SAL_CALL Theme::addPropertyChangeListener(
+    const ::rtl::OUString& rsPropertyName,
+    const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
+    throw(css::beans::UnknownPropertyException,
+        css::lang::WrappedTargetException,
+        cssu::RuntimeException)
+{
+    ThemeItem eItem (__AnyItem);
+    if (rsPropertyName.getLength() > 0)
+    {
+        PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+        if (iId == maPropertyNameToIdMap.end())
+            throw beans::UnknownPropertyException();
+
+        const PropertyType eType (GetPropertyType(iId->second));
+        if (eType == PT_Invalid)
+            throw beans::UnknownPropertyException();
+
+        eItem = iId->second;
+    }
+    ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true);
+    if (pListeners != NULL)
+        pListeners->push_back(rxListener);
+}
+
+
+
+
+void SAL_CALL Theme::removePropertyChangeListener(
+    const ::rtl::OUString& rsPropertyName,
+    const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener)
+    throw(css::beans::UnknownPropertyException,
+        css::lang::WrappedTargetException,
+        cssu::RuntimeException)
+{
+    ThemeItem eItem (__AnyItem);
+    if (rsPropertyName.getLength() > 0)
+    {
+        PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+        if (iId == maPropertyNameToIdMap.end())
+            throw beans::UnknownPropertyException();
+
+        const PropertyType eType (GetPropertyType(iId->second));
+        if (eType == PT_Invalid)
+            throw beans::UnknownPropertyException();
+
+        eItem = iId->second;
+    }
+    ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false);
+    if (pContainer != NULL)
+    {
+        ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
+        if (iListener != pContainer->end())
+        {
+            pContainer->erase(iListener);
+
+            // Remove the listener container when empty.
+            if (pContainer->empty())
+                maChangeListeners.erase(eItem);
+        }
+    }
+}
+
+
+
+
+void SAL_CALL Theme::addVetoableChangeListener(
+    const ::rtl::OUString& rsPropertyName,
+    const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
+    throw(css::beans::UnknownPropertyException,
+        css::lang::WrappedTargetException,
+        cssu::RuntimeException)
+{
+    ThemeItem eItem (__AnyItem);
+    if (rsPropertyName.getLength() > 0)
+    {
+        PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+        if (iId == maPropertyNameToIdMap.end())
+            throw beans::UnknownPropertyException();
+
+        const PropertyType eType (GetPropertyType(iId->second));
+        if (eType == PT_Invalid)
+            throw beans::UnknownPropertyException();
+
+        eItem = iId->second;
+    }
+    VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true);
+    if (pListeners != NULL)
+        pListeners->push_back(rxListener);
+}
+
+
+
+
+void SAL_CALL Theme::removeVetoableChangeListener(
+    const ::rtl::OUString& rsPropertyName,
+    const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener)
+    throw(css::beans::UnknownPropertyException,
+        css::lang::WrappedTargetException,
+        cssu::RuntimeException)
+{
+    ThemeItem eItem (__AnyItem);
+    if (rsPropertyName.getLength() > 0)
+    {
+        PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+        if (iId == maPropertyNameToIdMap.end())
+            throw beans::UnknownPropertyException();
+
+        const PropertyType eType (GetPropertyType(iId->second));
+        if (eType == PT_Invalid)
+            throw beans::UnknownPropertyException();
+
+        eItem = iId->second;
+    }
+    VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false);
+    if (pContainer != NULL)
+    {
+        VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener));
+        if (iListener != pContainer->end())
+        {
+            pContainer->erase(iListener);
+            // Remove container when empty.
+            if (pContainer->empty())
+                maVetoableListeners.erase(eItem);
+        }
+    }
+}
+
+
+
+
+cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
+    throw(cssu::RuntimeException)
+{
+    ::std::vector<beans::Property> aProperties;
+
+    for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
+    {
+        const ThemeItem eItem (static_cast<ThemeItem>(nItem));
+        const PropertyType eType (GetPropertyType(eItem));
+        if (eType == PT_Invalid)
+            continue;
+
+        const beans::Property aProperty(
+            maPropertyIdToNameMap[eItem],
+            eItem,
+            GetCppuType(eType),
+            0);
+        aProperties.push_back(aProperty);
+    }
+        
+    return cssu::Sequence<css::beans::Property>(
+        &aProperties.front(),
+        aProperties.size());
+}
+
+
+
+
+beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
+    throw(css::beans::UnknownPropertyException,
+        cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        throw beans::UnknownPropertyException();
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        throw beans::UnknownPropertyException();
+
+    const ThemeItem eItem (iId->second);
+
+    return beans::Property(
+        rsPropertyName,
+        eItem,
+        GetCppuType(eType),
+        0);
+}
+
+
+
+
+sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
+    throw(cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        return sal_False;
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        return sal_False;
+
+    return sal_True;
+}
+
+
+
+
+void Theme::SetupPropertyMaps (void)
+{
+    maPropertyIdToNameMap.resize(__Post_Rect);
+    maImages.resize(__Image_Color - __Pre_Image - 1);
+    maColors.resize(__Color_Paint - __Image_Color - 1);
+    maPaints.resize(__Paint_Int - __Color_Paint - 1);
+    maIntegers.resize(__Int_Bool - __Paint_Int - 1);
+    maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
+    maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
+    
+    #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
+    
+    AddEntry(Image_Grip);
+    AddEntry(Image_Expand);
+    AddEntry(Image_Collapse);
+    AddEntry(Image_TabBarMenu);
+    AddEntry(Image_PanelMenu);
+    AddEntry(Image_ToolBoxItemSeparator);
+    AddEntry(Image_Closer);
+
+    AddEntry(Color_DeckTitleFont);
+    AddEntry(Color_PanelTitleFont);
+    AddEntry(Color_TabMenuSeparator);
+    AddEntry(Color_TabItemBorder);
+    AddEntry(Color_DropDownBorder);
+    AddEntry(Color_Highlight);
+    AddEntry(Color_HighlightText);
+
+    AddEntry(Paint_DeckBackground);
+    AddEntry(Paint_DeckTitleBarBackground);
+    AddEntry(Paint_PanelBackground);
+    AddEntry(Paint_PanelTitleBarBackground);
+    AddEntry(Paint_TabBarBackground);
+    AddEntry(Paint_TabItemBackgroundNormal);
+    AddEntry(Paint_TabItemBackgroundHighlight);
+    AddEntry(Paint_HorizontalBorder);
+    AddEntry(Paint_VerticalBorder);
+    AddEntry(Paint_ToolBoxBackground);
+    AddEntry(Paint_ToolBoxBorderTopLeft);
+    AddEntry(Paint_ToolBoxBorderCenterCorners);
+    AddEntry(Paint_ToolBoxBorderBottomRight);
+    AddEntry(Paint_DropDownBackground);
+
+    AddEntry(Int_DeckTitleBarHeight);
+    AddEntry(Int_DeckBorderSize);
+    AddEntry(Int_DeckSeparatorHeight);
+    AddEntry(Int_PanelTitleBarHeight);
+    AddEntry(Int_TabMenuPadding);
+    AddEntry(Int_TabMenuSeparatorPadding);
+    AddEntry(Int_TabItemWidth);
+    AddEntry(Int_TabItemHeight);
+    AddEntry(Int_DeckLeftPadding);
+    AddEntry(Int_DeckTopPadding);
+    AddEntry(Int_DeckRightPadding);
+    AddEntry(Int_DeckBottomPadding);
+    AddEntry(Int_TabBarLeftPadding);
+    AddEntry(Int_TabBarTopPadding);
+    AddEntry(Int_TabBarRightPadding);
+    AddEntry(Int_TabBarBottomPadding);
+    AddEntry(Int_ButtonCornerRadius);
+
+    AddEntry(Bool_UseSymphonyIcons);
+    AddEntry(Bool_UseSystemColors);
+    AddEntry(Bool_UseToolBoxItemSeparator);
+    AddEntry(Bool_IsHighContrastModeActive);
+
+    AddEntry(Rect_ToolBoxPadding);
+    AddEntry(Rect_ToolBoxBorder);
+    
+    #undef AddEntry
+
+    maRawValues.resize(maPropertyIdToNameMap.size());
+}
+
+
+
+
+Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
+{
+    switch(eItem)
+    {
+        case Image_Grip:
+        case Image_Expand:
+        case Image_Collapse:
+        case Image_TabBarMenu:
+        case Image_PanelMenu:
+        case Image_ToolBoxItemSeparator:
+        case Image_Closer:
+            return PT_Image;
+
+        case Color_DeckTitleFont:
+        case Color_PanelTitleFont:
+        case Color_TabMenuSeparator:
+        case Color_TabItemBorder:
+        case Color_DropDownBorder:
+        case Color_Highlight:
+        case Color_HighlightText:
+            return PT_Color;
+
+        case Paint_DeckBackground:
+        case Paint_DeckTitleBarBackground:
+        case Paint_PanelBackground:
+        case Paint_PanelTitleBarBackground:
+        case Paint_TabBarBackground:
+        case Paint_TabItemBackgroundNormal:
+        case Paint_TabItemBackgroundHighlight:
+        case Paint_HorizontalBorder:
+        case Paint_VerticalBorder:
+        case Paint_ToolBoxBackground:
+        case Paint_ToolBoxBorderTopLeft:
+        case Paint_ToolBoxBorderCenterCorners:
+        case Paint_ToolBoxBorderBottomRight:
+        case Paint_DropDownBackground:
+            return PT_Paint;
+
+        case Int_DeckTitleBarHeight:
+        case Int_DeckBorderSize:
+        case Int_DeckSeparatorHeight:
+        case Int_PanelTitleBarHeight:
+        case Int_TabMenuPadding:
+        case Int_TabMenuSeparatorPadding:
+        case Int_TabItemWidth:
+        case Int_TabItemHeight:
+        case Int_DeckLeftPadding:
+        case Int_DeckTopPadding:
+        case Int_DeckRightPadding:
+        case Int_DeckBottomPadding:
+        case Int_TabBarLeftPadding:
+        case Int_TabBarTopPadding:
+        case Int_TabBarRightPadding:
+        case Int_TabBarBottomPadding:
+        case Int_ButtonCornerRadius:
+            return PT_Integer;
+
+        case Bool_UseSymphonyIcons:
+        case Bool_UseSystemColors:
+        case Bool_UseToolBoxItemSeparator:
+        case Bool_IsHighContrastModeActive:
+            return PT_Boolean;
+
+        case Rect_ToolBoxBorder:
+        case Rect_ToolBoxPadding:
+            return PT_Rectangle;
+            
+        default:
+            return PT_Invalid;
+    }
+}
+
+
+
+
+cssu::Type Theme::GetCppuType (const PropertyType eType)
+{
+    switch(eType)
+    {
+        case PT_Image:
+            return getCppuType((rtl::OUString*)NULL);
+
+        case PT_Color:
+            return getCppuType((sal_uInt32*)NULL);
+
+        case PT_Paint:
+            return getCppuVoidType();
+
+        case PT_Integer:
+            return getCppuType((sal_Int32*)NULL);
+
+        case PT_Boolean:
+            return getCppuType((sal_Bool*)NULL);
+
+        case PT_Rectangle:
+            return getCppuType((awt::Rectangle*)NULL);
+
+        case PT_Invalid:
+        default:
+            return getCppuVoidType();
+    }
+}
+
+
+
+
+sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
+{
+    switch(eType)
+    {
+        case PT_Image:
+            return eItem - __Pre_Image-1;
+        case PT_Color:
+            return eItem - __Image_Color-1;
+        case PT_Paint:
+            return eItem - __Color_Paint-1;
+        case PT_Integer:
+            return eItem - __Paint_Int-1;
+        case PT_Boolean:
+            return eItem - __Int_Bool-1;
+        case PT_Rectangle:
+            return eItem - __Bool_Rect-1;
+
+        default:
+            OSL_ASSERT(false);
+            return 0;
+    }
+}
+
+
+
+
+Theme::VetoableListenerContainer* Theme::GetVetoableListeners (
+    const ThemeItem eItem,
+    const bool bCreate)
+{
+    VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem));
+    if (iContainer != maVetoableListeners.end())
+        return &iContainer->second;
+    else if (bCreate)
+    {
+        maVetoableListeners[eItem] = VetoableListenerContainer();
+        return &maVetoableListeners[eItem];
+    }
+    else
+        return NULL;
+}
+
+
+
+
+Theme::ChangeListenerContainer* Theme::GetChangeListeners (
+    const ThemeItem eItem,
+    const bool bCreate)
+{
+    ChangeListeners::iterator iContainer (maChangeListeners.find(eItem));
+    if (iContainer != maChangeListeners.end())
+        return &iContainer->second;
+    else if (bCreate)
+    {
+        maChangeListeners[eItem] = ChangeListenerContainer();
+        return &maChangeListeners[eItem];
+    }
+    else
+        return NULL;
+}
+
+
+
+
+bool Theme::DoVetoableListenersVeto (
+    const VetoableListenerContainer* pListeners,
+    const beans::PropertyChangeEvent& rEvent) const
+{
+    if (pListeners == NULL)
+        return false;
+
+    VetoableListenerContainer aListeners (*pListeners);
+    try
+    {
+        for (VetoableListenerContainer::const_iterator
+                 iListener(aListeners.begin()),
+                 iEnd(aListeners.end());
+             iListener!=iEnd;
+             ++iListener)
+        {
+            (*iListener)->vetoableChange(rEvent);
+        }
+    }
+    catch(const beans::PropertyVetoException&)
+    {
+        return true;
+    }
+    catch(const Exception&)
+    {
+        // Ignore any other errors (such as disposed listeners).
+    }
+    return false;
+}
+
+
+
+
+void Theme::BroadcastPropertyChange (
+    const ChangeListenerContainer* pListeners,
+    const beans::PropertyChangeEvent& rEvent) const
+{
+    if (pListeners == NULL)
+        return;
+
+    const ChangeListenerContainer aListeners (*pListeners);
+    try
+    {
+        for (ChangeListenerContainer::const_iterator
+                 iListener(aListeners.begin()),
+                 iEnd(aListeners.end());
+             iListener!=iEnd;
+             ++iListener)
+        {
+            (*iListener)->propertyChange(rEvent);
+        }
+    }
+    catch(const Exception&)
+    {
+        // Ignore any errors (such as disposed listeners).
+    }
+}
+
+
+
+
+void Theme::ProcessNewValue (
+    const Any& rValue,
+    const ThemeItem eItem,
+    const PropertyType eType)
+{
+    const sal_Int32 nIndex (GetIndex (eItem, eType));
+    switch (eType)
+    {
+        case PT_Image:
+        {
+            ::rtl::OUString sURL;
+            if (rValue >>= sURL)
+            {
+                maImages[nIndex] = Tools::GetImage(sURL, NULL);
+            }
+            break;
+        }
+        case PT_Color:
+        {
+            sal_Int32 nColorValue (0);
+            if (rValue >>= nColorValue)
+            {
+                maColors[nIndex] = Color(nColorValue);
+            }
+            break;
+        }
+        case PT_Paint:
+        {
+            maPaints[nIndex] = Paint::Create(rValue);
+            break;
+        }
+        case PT_Integer:
+        {
+            sal_Int32 nValue (0);
+            if (rValue >>= nValue)
+            {
+                maIntegers[nIndex] = nValue;
+            }
+            break;
+        }
+        case PT_Boolean:
+        {
+            sal_Bool nValue (0);
+            if (rValue >>= nValue)
+            {
+                maBooleans[nIndex] = (nValue==sal_True);
+                if (eItem == Bool_IsHighContrastModeActive)
+                {
+                    mbIsHighContrastModeSetManually = true;
+                    mbIsHighContrastMode = maBooleans[nIndex];
+                    HandleDataChange();
+                }
+                else if (eItem == Bool_UseSystemColors)
+                {
+                    HandleDataChange();
+                }
+            }
+            break;
+        }
+        case PT_Rectangle:
+        {
+            awt::Rectangle aBox;
+            if (rValue >>= aBox)
+            {
+                maRectangles[nIndex] = Rectangle(
+                    aBox.X,
+                    aBox.Y,
+                    aBox.Width,
+                    aBox.Height);
+            }
+            break;
+        }
+        case PT_Invalid:
+            OSL_ASSERT(eType != PT_Invalid);
+            throw RuntimeException();
+    }
+}
+
+
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/TitleBar.cxx b/main/sfx2/source/sidebar/TitleBar.cxx
new file mode 100644
index 0000000..d05a751
--- /dev/null
+++ b/main/sfx2/source/sidebar/TitleBar.cxx
@@ -0,0 +1,198 @@
+/**************************************************************
+ * 
+ * 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 "TitleBar.hxx"
+#include "Paint.hxx"
+
+#include <tools/svborder.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/lineinfo.hxx>
+
+ToolbarValue::~ToolbarValue (void) {}
+
+
+namespace sfx2 { namespace sidebar {
+
+TitleBar::TitleBar (
+    const ::rtl::OUString& rsTitle,
+    Window* pParentWindow,
+    const sidebar::Paint& rInitialBackgroundPaint)
+    : Window(pParentWindow),
+      maToolBox(this),
+      msTitle(rsTitle)
+{
+    SetBackground(rInitialBackgroundPaint.GetWallpaper());
+
+    maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
+}
+
+
+
+
+TitleBar::~TitleBar (void)
+{
+}
+
+
+
+
+void TitleBar::SetTitle (const ::rtl::OUString& rsTitle)
+{
+    msTitle = rsTitle;
+    Invalidate();
+}
+
+
+
+
+void TitleBar::Paint (const Rectangle& rUpdateArea)
+{
+    (void)rUpdateArea;
+
+    // Paint title bar background.
+    Size aWindowSize (GetOutputSizePixel());
+    Rectangle aTitleBarBox(
+        0,
+        0, 
+        aWindowSize.Width(), 
+        aWindowSize.Height()
+        );
+
+    PaintDecoration(aTitleBarBox);
+    const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
+    PaintTitle(aTitleBox);
+    if (HasFocus())
+        PaintFocus(aTitleBox);
+}
+
+
+
+
+void TitleBar::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetBackground(GetBackgroundPaint().GetWallpaper());
+}
+
+
+
+
+void TitleBar::SetPosSizePixel (
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    sal_uInt16 nFlags)
+{
+    Window::SetPosSizePixel(nX,nY,nWidth,nHeight,nFlags);
+
+    // Place the toolbox.
+    const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
+    maToolBox.SetPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight);
+    maToolBox.Show();
+}
+
+
+
+
+ToolBox& TitleBar::GetToolBox (void)
+{
+    return maToolBox;
+}
+
+
+
+
+void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+{
+    (void)nItemIndex;
+    // Any real processing has to be done in derived class.
+}
+
+
+
+
+void TitleBar::PaintTitle (const Rectangle& rTitleBox)
+{
+    Push(PUSH_FONT | PUSH_TEXTCOLOR);
+
+    Font aFont(GetFont());
+    SetFont(aFont);
+
+    // Paint title bar text.
+    SetTextColor(GetTextColor());
+    DrawText(
+        rTitleBox,
+        msTitle,
+        TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
+
+    Pop();
+}
+
+
+
+
+void TitleBar::PaintFocus (const Rectangle& rFocusBox)
+{
+    Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR);
+
+    const Rectangle aTextBox (
+        GetTextRect(
+            rFocusBox,
+            msTitle,
+            TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER));
+    const Rectangle aLargerTextBox (
+        aTextBox.Left() - 2,
+        aTextBox.Top() - 2,
+        aTextBox.Right() + 2,
+        aTextBox.Bottom() + 2);
+
+    LineInfo aDottedStyle (LINE_DASH);
+    aDottedStyle.SetDashCount(0);
+    aDottedStyle.SetDotCount(1);
+    aDottedStyle.SetDotLen(1);
+    aDottedStyle.SetDistance(1);
+    
+    SetFillColor();
+    SetLineColor(COL_BLACK);
+    DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle);
+
+    Pop();
+}
+
+
+
+
+IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
+{
+    (void)pToolBox;
+    OSL_ASSERT(&maToolBox==pToolBox);
+    const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
+
+    HandleToolBoxItemClick(nItemId);
+    
+    return sal_True;
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/TitleBar.hxx b/main/sfx2/source/sidebar/TitleBar.hxx
new file mode 100644
index 0000000..a05d5f2
--- /dev/null
+++ b/main/sfx2/source/sidebar/TitleBar.hxx
@@ -0,0 +1,76 @@
+/**************************************************************
+ * 
+ * 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_TITLE_BAR_HXX
+#define SFX_SIDEBAR_TITLE_BAR_HXX
+
+#include "Paint.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/toolbox.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+class TitleBar
+    : public Window
+{
+public:
+    TitleBar (
+        const ::rtl::OUString& rsTitle,
+        Window* pParentWindow,
+        const sidebar::Paint& rInitialBackgroundPaint);
+    virtual ~TitleBar (void);
+
+    void SetTitle (const ::rtl::OUString& rsTitle);
+
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+    virtual void SetPosSizePixel (
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
+
+    ToolBox& GetToolBox (void);
+
+protected:
+    ToolBox maToolBox;
+
+    virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
+    virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
+    virtual void PaintFocus (const Rectangle& rFocusBox);
+    virtual sidebar::Paint GetBackgroundPaint (void) = 0;
+    virtual Color GetTextColor (void) = 0;
+    virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+    
+private:
+    ::rtl::OUString msTitle;
+
+    void PaintTitle (const Rectangle& rTitleBox);
+    DECL_LINK(SelectionHandler, ToolBox*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/ToolBox.hxx b/main/sfx2/source/sidebar/ToolBox.hxx
new file mode 100755
index 0000000..9d8a97f
--- /dev/null
+++ b/main/sfx2/source/sidebar/ToolBox.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ * 
+ * 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_TOOLBOX_HXX
+#define SFX_SIDEBAR_TOOLBOX_HXX
+
+#include "vcl/toolbox.hxx"
+
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBox
+    : public ::ToolBox
+{
+public:
+    MenuButton (Window* pParentWindow);
+    virtual ~MenuButton (void);
+
+    virtual void Paint (const Rectangle& rUpdateArea);
+    virtual void MouseMove (const MouseEvent& rEvent);
+    virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
+    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
+
+protected:
+    using CheckBox::FillLayoutData;
+    
+private:
+    bool mbIsLeftButtonDown;
+    enum PaintType {
+        PT_Native,
+        PT_Theme
+    } mePaintType;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/ToolBoxBackground.cxx b/main/sfx2/source/sidebar/ToolBoxBackground.cxx
new file mode 100755
index 0000000..261929e
--- /dev/null
+++ b/main/sfx2/source/sidebar/ToolBoxBackground.cxx
@@ -0,0 +1,154 @@
+/**************************************************************
+ * 
+ * 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 "ToolBoxBackground.hxx"
+#include "Paint.hxx"
+#include "DrawHelper.hxx"
+#include "Tools.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <vcl/toolbox.hxx>
+#include <vcl/gradient.hxx>
+#include <svl/smplhint.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+ToolBoxBackground::ToolBoxBackground (Window* pParentWindow)
+    : Window(pParentWindow, WB_DIALOGCONTROL),
+      maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)))
+{
+    SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+
+#ifdef DEBUG
+    SetText(A2S("ToolBoxBackground"));
+#endif
+}
+
+
+
+
+ToolBoxBackground::~ToolBoxBackground (void)
+{
+    Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler));
+    if (GetChildCount() > 0)
+        GetChild(0)->RemoveEventListener(aEventListener);
+}
+
+
+
+
+Point ToolBoxBackground::SetToolBoxChild (
+    ToolBox* pChild,
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    sal_uInt16 nFlags)
+{
+    if (pChild == NULL)
+    {
+        OSL_ASSERT(pChild!=NULL);
+        return Point(nX, nY);
+    }
+
+    Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler));
+    pChild->AddEventListener(aEventListener);
+    
+    SetPosSizePixel(
+        nX - maPadding.Left(),
+        nY - maPadding.Top(),
+        nWidth + maPadding.Left() + maPadding.Right(),
+        nHeight + maPadding.Top() + maPadding.Bottom(),
+        nFlags);
+    return Point(
+        maPadding.Left(),
+        maPadding.Top());
+}
+
+
+
+
+void ToolBoxBackground::Paint (const Rectangle& rRect)
+{
+    Window::Paint(rRect);
+
+    Rectangle aBox (Point(0,0), GetSizePixel());
+    
+    const sidebar::Paint aTopLeftBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderTopLeft));
+    const sidebar::Paint aCenterBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderCenterCorners));
+    const sidebar::Paint aBottomRightBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderBottomRight));
+    const Rectangle aBorderSize (Theme::GetRectangle(Theme::Rect_ToolBoxBorder));
+    DrawHelper::DrawBevelBorder (
+        *this,
+        aBox,
+        Tools::RectangleToSvBorder(aBorderSize),
+        aTopLeftBorderPaint,
+        aCenterBorderPaint,
+        aBottomRightBorderPaint);
+}
+
+
+
+
+void ToolBoxBackground::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+    maPadding = Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding));
+}
+
+
+
+
+IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->GetId())
+        {
+            case VCLEVENT_WINDOW_SHOW:
+                if (GetChild(0)->IsVisible())
+                    Show();
+                break;
+
+            case VCLEVENT_WINDOW_HIDE:
+                if ( ! GetChild(0)->IsVisible())
+                    Hide();
+                break;
+
+            case SFX_HINT_DYING:
+                doLazyDelete();
+                break;
+                
+            default:
+                break;
+        }
+    }
+
+    return sal_True;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/ToolBoxBackground.hxx b/main/sfx2/source/sidebar/ToolBoxBackground.hxx
new file mode 100755
index 0000000..47f4cfa
--- /dev/null
+++ b/main/sfx2/source/sidebar/ToolBoxBackground.hxx
@@ -0,0 +1,68 @@
+/**************************************************************
+ * 
+ * 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_TOOLBOX_BACKGROUND_HXX
+#define SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX
+
+#include "vcl/window.hxx"
+
+#include <tools/svborder.hxx>
+
+
+class ToolBox;
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBoxBackground
+    : public Window
+{
+public:
+    ToolBoxBackground (Window* pParentWindow);
+    virtual ~ToolBoxBackground (void);
+
+    /** Call this method once to
+        a) let the ToolBoxBackground object know which ToolBox to
+           monitor and
+        b) so that position and sizes can be set up.
+        @return
+            The relative position of the child.
+    */
+    Point SetToolBoxChild (
+        ToolBox* pChild,
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags);
+    
+    virtual void Paint (const Rectangle& rRect);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+    SvBorder maPadding;
+
+    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/sidebar/Tools.cxx b/main/sfx2/source/sidebar/Tools.cxx
new file mode 100644
index 0000000..5daaa28
--- /dev/null
+++ b/main/sfx2/source/sidebar/Tools.cxx
@@ -0,0 +1,156 @@
+/**************************************************************
+ * 
+ * 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 "Tools.hxx"
+
+#include "sfx2/sidebar/Theme.hxx"
+
+#include "sfx2/imagemgr.hxx"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/gradient.hxx>
+
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+#include <cstring>
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+Image Tools::GetImage (
+    const ::rtl::OUString& rsImageURL,
+    const ::rtl::OUString& rsHighContrastImageURL,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    if (Theme::IsHighContrastMode())
+        return GetImage(rsHighContrastImageURL, rxFrame);
+    else
+        return GetImage(rsImageURL, rxFrame);
+}
+
+
+
+
+Image Tools::GetImage (
+    const ::rtl::OUString& rsURL,
+    const Reference<frame::XFrame>& rxFrame)
+{
+    if (rsURL.getLength() > 0)
+    {
+        static const sal_Char* sUnoCommandPrefix = ".uno:";
+        static const sal_Int32 nUnoCommandPrefixLength = strlen(sUnoCommandPrefix);
+        static const sal_Char* sCommandImagePrefix = "private:commandimage/";
+        static const sal_Int32 nCommandImagePrefixLength = strlen(sCommandImagePrefix);
+        
+        if (rsURL.compareToAscii(sUnoCommandPrefix, nUnoCommandPrefixLength) == 0)
+        {
+            const Image aPanelImage (::GetImage(rxFrame, rsURL, sal_False, Theme::IsHighContrastMode()));
+            return aPanelImage;
+        }
+        else if (rsURL.compareToAscii(sCommandImagePrefix, nCommandImagePrefixLength) == 0)
+        {
+            ::rtl::OUStringBuffer aCommandName;
+            aCommandName.appendAscii(sUnoCommandPrefix);
+            aCommandName.append(rsURL.copy(nCommandImagePrefixLength));
+            const ::rtl::OUString sCommandName (aCommandName.makeStringAndClear());
+        
+            const Image aPanelImage (::GetImage(rxFrame, sCommandName, sal_False, Theme::IsHighContrastMode()));
+            return aPanelImage;
+        }
+        else
+        {
+            const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
+            const Reference<graphic::XGraphicProvider> xGraphicProvider (
+                aContext.createComponent("com.sun.star.graphic.GraphicProvider"),
+                UNO_QUERY);
+            if ( xGraphicProvider.is())
+            {
+                ::comphelper::NamedValueCollection aMediaProperties;
+                aMediaProperties.put("URL", rsURL);
+                const Reference<graphic::XGraphic> xGraphic (
+                    xGraphicProvider->queryGraphic(aMediaProperties.getPropertyValues()),
+                    UNO_QUERY);
+                if (xGraphic.is())
+                    return Image(xGraphic);
+            }
+        }
+    }
+    return Image();
+}
+
+
+
+
+css::awt::Gradient Tools::VclToAwtGradient (const Gradient aVclGradient)
+{
+    css::awt::Gradient aAwtGradient (
+        awt::GradientStyle(aVclGradient.GetStyle()),
+        aVclGradient.GetStartColor().GetRGBColor(),
+        aVclGradient.GetEndColor().GetRGBColor(),
+        aVclGradient.GetAngle(),
+        aVclGradient.GetBorder(),
+        aVclGradient.GetOfsX(),
+        aVclGradient.GetOfsY(),
+        aVclGradient.GetStartIntensity(),
+        aVclGradient.GetEndIntensity(),
+        aVclGradient.GetSteps());
+    return aAwtGradient;
+}
+
+
+
+
+Gradient Tools::AwtToVclGradient (const css::awt::Gradient aAwtGradient)
+{
+    Gradient aVclGradient (
+        GradientStyle(aAwtGradient.Style),
+        aAwtGradient.StartColor,
+        aAwtGradient.EndColor);
+    aVclGradient.SetAngle(aAwtGradient.Angle);
+    aVclGradient.SetBorder(aAwtGradient.Border);
+    aVclGradient.SetOfsX(aAwtGradient.XOffset);
+    aVclGradient.SetOfsY(aAwtGradient.YOffset);
+    aVclGradient.SetStartIntensity(aAwtGradient.StartIntensity);
+    aVclGradient.SetEndIntensity(aAwtGradient.EndIntensity);
+    aVclGradient.SetSteps(aAwtGradient.StepCount);
+
+    return aVclGradient;
+}
+
+
+
+
+SvBorder Tools::RectangleToSvBorder (const Rectangle aBox)
+{
+    return SvBorder(
+        aBox.Left(),
+        aBox.Top(),
+        aBox.Right(),
+        aBox.Bottom());
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/main/sfx2/source/sidebar/Tools.hxx b/main/sfx2/source/sidebar/Tools.hxx
new file mode 100644
index 0000000..1e3fbc6
--- /dev/null
+++ b/main/sfx2/source/sidebar/Tools.hxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ * 
+ * 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_TOOLS_HXX
+#define SFX_SIDEBAR_TOOLS_HXX
+
+#include <vcl/image.hxx>
+#include <vcl/gradient.hxx>
+#include <tools/svborder.hxx>
+
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+
+#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
+#define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr()
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sfx2 { namespace sidebar {
+
+class Tools
+{
+public:
+    static Image GetImage (
+        const ::rtl::OUString& rsImageURL,
+        const ::rtl::OUString& rsHighContrastImageURL,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    static Image GetImage (
+        const ::rtl::OUString& rsURL,
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    static css::awt::Gradient VclToAwtGradient (const Gradient aGradient);
+    static Gradient AwtToVclGradient (const css::awt::Gradient aGradient);
+
+    static SvBorder RectangleToSvBorder (const Rectangle aBox);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/main/sfx2/source/view/viewfrm.cxx b/main/sfx2/source/view/viewfrm.cxx
index 056a0ef..5998da5 100644
--- a/main/sfx2/source/view/viewfrm.cxx
+++ b/main/sfx2/source/view/viewfrm.cxx
@@ -3458,6 +3458,18 @@
 			    rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
             }
         }
+        else if ( nSID == SID_SIDEBAR )
+        {
+            if  ( !KnowsChildWindow( nSID ) )
+            {
+                OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" );
+			    rState.DisableItem( nSID );
+            }
+            else
+            {
+			    rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
+            }
+        }
 		else if ( KnowsChildWindow(nSID) )
 			rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
 		else
diff --git a/main/svx/AllLangResTarget_svx.mk b/main/svx/AllLangResTarget_svx.mk
index 11bd842..e51f421 100644
--- a/main/svx/AllLangResTarget_svx.mk
+++ b/main/svx/AllLangResTarget_svx.mk
@@ -77,6 +77,13 @@
     svx/source/items/svxerr.src \
     svx/source/items/svxitems.src \
     svx/source/mnuctrls/mnuctrls.src \
+    svx/source/sidebar/EmptyPanel.src \
+    svx/source/sidebar/area/AreaPropertyPanel.src \
+    svx/source/sidebar/graphic/GraphicPropertyPanel.src \
+    svx/source/sidebar/line/LinePropertyPanel.src \
+    svx/source/sidebar/possize/PosSizePropertyPanel.src \
+    svx/source/sidebar/text/TextPropertyPanel.src \
+    svx/source/sidebar/paragraph/ParaPropertyPanel.src \
     svx/source/stbctrls/stbctrls.src \
     svx/source/svdraw/svdstr.src \
     svx/source/table/table.src \
@@ -85,7 +92,6 @@
     svx/source/tbxctrls/fontworkgallery.src \
     svx/source/tbxctrls/grafctrl.src \
     svx/source/tbxctrls/lboxctrl.src \
-    svx/source/tbxctrls/linectrl.src \
     svx/source/tbxctrls/tbcontrl.src \
     svx/source/tbxctrls/tbunosearchcontrollers.src \
     svx/source/toolbars/extrusionbar.src \
diff --git a/main/svx/Library_svx.mk b/main/svx/Library_svx.mk
index b304801..f44205b 100644
--- a/main/svx/Library_svx.mk
+++ b/main/svx/Library_svx.mk
@@ -169,6 +169,47 @@
     svx/source/mnuctrls/fntctl \
     svx/source/mnuctrls/fntszctl \
     svx/source/mnuctrls/SmartTagCtl \
+    svx/source/sidebar/ContextChangeEventMultiplexer \
+    svx/source/sidebar/EmptyPanel \
+    svx/source/sidebar/nbdtmg \
+    svx/source/sidebar/nbdtmgfact	\
+    svx/source/sidebar/PanelFactory \
+    svx/source/sidebar/SelectionAnalyzer \
+    svx/source/sidebar/SelectionChangeHandler \
+    svx/source/sidebar/debug/ColorPanel \
+    svx/source/sidebar/debug/ContextPanel \
+    svx/source/sidebar/debug/NotYetImplementedPanel \
+    svx/source/sidebar/text/SvxSBFontNameBox \
+    svx/source/sidebar/text/TextCharacterSpacingControl \
+    svx/source/sidebar/text/TextCharacterSpacingPopup \
+    svx/source/sidebar/text/TextUnderlineControl \
+    svx/source/sidebar/text/TextUnderlinePopup \
+    svx/source/sidebar/text/TextPropertyPanel \
+    svx/source/sidebar/paragraph/ParaNumberingControl \
+    svx/source/sidebar/paragraph/ParaNumberingPopup \
+    svx/source/sidebar/paragraph/ParaBulletsControl \
+    svx/source/sidebar/paragraph/ParaBulletsPopup \
+    svx/source/sidebar/paragraph/ParaLineSpacingControl \
+    svx/source/sidebar/paragraph/ParaLineSpacingPopup \
+    svx/source/sidebar/paragraph/ParaPropertyPanel \
+    svx/source/sidebar/area/AreaPropertyPanel \
+    svx/source/sidebar/area/AreaTransparencyGradientControl \
+    svx/source/sidebar/area/AreaTransparencyGradientPopup \
+    svx/source/sidebar/graphic/GraphicPropertyPanel \
+    svx/source/sidebar/line/LinePropertyPanel \
+    svx/source/sidebar/line/LineStyleValueSet \
+    svx/source/sidebar/line/LineWidthControl \
+    svx/source/sidebar/line/LineWidthValueSet \
+    svx/source/sidebar/line/LineWidthPopup \
+    svx/source/sidebar/possize/PosSizePropertyPanel \
+    svx/source/sidebar/possize/SidebarDialControl \
+    svx/source/sidebar/possize/SidebarDialControlBmp \
+    svx/source/sidebar/tools/ColorControl \
+    svx/source/sidebar/tools/ColorPopup \
+    svx/source/sidebar/tools/PopupControl \
+    svx/source/sidebar/tools/PopupContainer \
+    svx/source/sidebar/tools/Popup \
+    svx/source/sidebar/tools/ValueSetWithTextControl \
     svx/source/stbctrls/pszctrl \
     svx/source/stbctrls/insctrl \
     svx/source/stbctrls/selctrl \
diff --git a/main/svx/Library_svxcore.mk b/main/svx/Library_svxcore.mk
index ad43f91..1362c47 100644
--- a/main/svx/Library_svxcore.mk
+++ b/main/svx/Library_svxcore.mk
@@ -177,6 +177,8 @@
     svx/source/gallery2/galmisc \
     svx/source/gallery2/galobj \
     svx/source/gallery2/galtheme \
+    svx/source/gallery2/GalleryControl \
+    svx/source/gallery2/GallerySplitter \
     svx/source/items/chrtitem \
     svx/source/items/clipfmtitem \
     svx/source/items/customshapeitem \
@@ -424,6 +426,7 @@
     svx/source/xoutdev/xtabgrdt \
     svx/source/xoutdev/xtabhtch \
     svx/source/xoutdev/xtable \
+    svx/source/xoutdev/XPropertyEntry \
     svx/source/xoutdev/xtablend \
 ))
 
diff --git a/main/svx/Package_inc.mk b/main/svx/Package_inc.mk
index 971c39e..3b2df39 100644
--- a/main/svx/Package_inc.mk
+++ b/main/svx/Package_inc.mk
@@ -173,6 +173,7 @@
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdedtv.hxx,svx/svdedtv.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlinjoit.hxx,svx/xlinjoit.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlncapit.hxx,svx/xlncapit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AffineMatrixItem.hxx,svx/AffineMatrixItem.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmbritm.hxx,svx/sxmbritm.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleGraphicShape.hxx,svx/AccessibleGraphicShape.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnstit.hxx,svx/xlnstit.hxx))
@@ -221,6 +222,7 @@
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dsceneproperties.hxx,svx/sdr/properties/e3dsceneproperties.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/measureproperties.hxx,svx/sdr/properties/measureproperties.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/table/tabledesign.hxx,svx/sdr/table/tabledesign.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/table/tablecontroller.hxx,svx/sdr/table/tablecontroller.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/primitiveFactory2d.hxx,svx/sdr/primitive2d/primitiveFactory2d.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx,svx/sdr/primitive2d/sdrpathprimitive2d.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx,svx/sdr/primitive2d/sdrtextprimitive2d.hxx))
@@ -411,6 +413,7 @@
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtaitm.hxx,svx/sxmtaitm.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/clipboardctl.hxx,svx/clipboardctl.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xtable.hxx,svx/xtable.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/XPropertyEntry.hxx,svx/XPropertyEntry.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgcoitm.hxx,svx/sdgcoitm.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdovirt.hxx,svx/svdovirt.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmshell.hxx,svx/fmshell.hxx))
@@ -554,4 +557,15 @@
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/globlmn.hrc,globlmn_tmpl.hrc))
-
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ColorControl.hxx,svx/sidebar/ColorControl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ColorPopup.hxx,svx/sidebar/ColorPopup.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ContextChangeEventMultiplexer.hxx,svx/sidebar/ContextChangeEventMultiplexer.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/Popup.hxx,svx/sidebar/Popup.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SidebarDialControl.hxx,svx/sidebar/SidebarDialControl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/PopupContainer.hxx,svx/sidebar/PopupContainer.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/PopupControl.hxx,svx/sidebar/PopupControl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SelectionAnalyzer.hxx,svx/sidebar/SelectionAnalyzer.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SelectionChangeHandler.hxx,svx/sidebar/SelectionChangeHandler.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ValueSetWithTextControl.hxx,svx/sidebar/ValueSetWithTextControl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/nbdtmgfact.hxx,svx/nbdtmgfact.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/nbdtmg.hxx,svx/nbdtmg.hxx))
diff --git a/main/svx/inc/GalleryControl.hxx b/main/svx/inc/GalleryControl.hxx
new file mode 100644
index 0000000..07d5ab8
--- /dev/null
+++ b/main/svx/inc/GalleryControl.hxx
@@ -0,0 +1,80 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_GALLERY_CONTROL_HXX
+#define SVX_SIDEBAR_GALLERY_CONTROL_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/graph.hxx>
+#include <tools/urlobj.hxx>
+#include "svx/svxdllapi.h"
+
+#include <boost/scoped_ptr.hpp>
+
+class SfxBindings;
+
+class Gallery;
+class GallerySplitter;
+class GalleryBrowser1;
+class GalleryBrowser2;
+class FmFormModel;
+
+namespace svx { namespace sidebar {
+
+
+class SVX_DLLPUBLIC GalleryControl : public Window
+{
+public:
+    GalleryControl (
+        SfxBindings* pBindings,
+        Window* pParentWindow);
+    virtual ~GalleryControl (void);
+
+    sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow);
+
+private:
+    Gallery* mpGallery;
+    ::boost::scoped_ptr<GallerySplitter> mpSplitter;
+    ::boost::scoped_ptr<GalleryBrowser1> mpBrowser1;
+    ::boost::scoped_ptr<GalleryBrowser2> mpBrowser2;
+	Size maLastSize;
+    bool mbIsInitialResize;
+
+    void InitSettings (void);
+
+	virtual void Resize (void);
+	virtual void GetFocus (void);
+
+    DECL_LINK(SplitHdl, void*);
+
+protected:
+	void ThemeSelectionHasChanged (void);
+							
+	INetURLObject GetURL (void) const;
+	String GetFilterName (void) const;
+	Graphic GetGraphic (void) const;
+	sal_Bool GetVCDrawModel (FmFormModel& rModel) const;
+	sal_Bool IsLinkage (void) const;
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/galbrws2.hxx b/main/svx/inc/galbrws2.hxx
index 4300398..256085e 100644
--- a/main/svx/inc/galbrws2.hxx
+++ b/main/svx/inc/galbrws2.hxx
@@ -95,9 +95,12 @@
 class Menu;
 class SgaObject;
 
+namespace svx { namespace sidebar { class GalleryControl; } }
+
 class GalleryBrowser2 : public Control, public SfxListener
 {
 	friend class GalleryBrowser;
+	friend class svx::sidebar::GalleryControl;
 	using Control::Notify;
 	using Window::KeyInput;
 
@@ -148,7 +151,7 @@
 
 public:
 
-						GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
+						GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery );
 						~GalleryBrowser2();
 
 	void				SelectTheme( const String& rThemeName );
diff --git a/main/svx/inc/helpid.hrc b/main/svx/inc/helpid.hrc
index 5c35a24..3e44d85 100644
--- a/main/svx/inc/helpid.hrc
+++ b/main/svx/inc/helpid.hrc
@@ -275,5 +275,127 @@
 #define HID_SVX_TP_DESKTOP                                    "SVX_HID_SVX_TP_DESKTOP"
 #define HID_CT_THES_ALTERNATIVES				              "SVX_HID_CT_THES_ALTERNATIVES"
 
+#define HID_PROPERTYPANEL_SECTIONPAGE_BEGIN "SVX_HID_PROPERTYPANEL_SECTIONPAGE_BEGIN"
+#define HID_PROPERTYPANEL_TEXT_SECTION "SVX_HID_PROPERTYPANEL_TEXT_SECTION"
+#define HID_PROPERTYPANEL_PARA_SECTION "SVX_HID_PROPERTYPANEL_PARA_SECTION"
+#define HID_PROPERTYPANEL_AREA_SECTION "SVX_HID_PROPERTYPANEL_AREA_SECTION"
+#define HID_PROPERTYPANEL_LINE_SECTION "SVX_HID_PROPERTYPANEL_LINE_SECTION"
+#define HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT"
+#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES"
+#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE"
+#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER"
+#define HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND "SVX_HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND"
+#define HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST "SVX_HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST"
+#define HID_PPROPERTYPANEL_TEXT_TBX_FONT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT"
+#define HID_PPROPERTYPANEL_TEXT_TBI_BOLD "SVX_HID_PPROPERTYPANEL_TEXT_TBI_BOLD"
+#define HID_PPROPERTYPANEL_TEXT_TBI_ITALIC "SVX_HID_PPROPERTYPANEL_TEXT_TBI_ITALIC"
+#define HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE"
+#define HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT "SVX_HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT"
+#define HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED"
+#define HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE"
+#define HID_PPROPERTYPANEL_TEXT_TBI_INCREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_INCREASE"
+#define HID_PPROPERTYPANEL_TEXT_TBI_DECREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_DECREASE"
+#define HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR"
+#define HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR"
+#define HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR"
+#define HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR"
+#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW"
+#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW"
+#define HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW"
+#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT"
+#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER"
+#define HID_PPROPERTYPANEL_TEXT_TBI_SUB "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB"
+#define HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS "SVX_HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS"
+#define HID_PPROPERTYPANEL_TEXT_COLOR_VS "SVX_HID_PPROPERTYPANEL_TEXT_COLOR_VS"
+#define HID_PPROPERTYPANEL_PARA_TBX_HALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_HALIGN"
+#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT"
+#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER"
+#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT"
+#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY"
+#define HID_PPROPERTYPANEL_PARA_TBX_VALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_VALIGN"
+#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP"
+#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER"
+#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT"
+#define HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR"
+#define HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR"
+#define HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS "SVX_HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS"
+#define HID_PPROPERTYPANEL_LINE_TBX_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBX_WIDTH"
+#define HID_PPROPERTYPANEL_LINE_TBI_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBI_WIDTH"
+#define HID_PPROPERTYPANEL_LINE_TBX_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBX_COLOR"
+#define HID_PPROPERTYPANEL_LINE_TBI_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBI_COLOR"
+#define HID_PPROPERTYPANEL_LINE_TBX_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBX_STYLE"
+#define HID_PPROPERTYPANEL_LINE_TBI_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBI_STYLE"
+#define HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE "SVX_HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE"
+#define HID_PPROPERTYPANEL_LINE_LB_START "SVX_HID_PPROPERTYPANEL_LINE_LB_START"
+#define HID_PPROPERTYPANEL_LINE_LB_END "SVX_HID_PPROPERTYPANEL_LINE_LB_END"
+#define HID_PPROPERTYPANEL_LINE_VS_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_VS_WIDTH"
+#define HID_PPROPERTYPANEL_LINE_MTR_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_MTR_WIDTH"
+#define HID_PPROPERTYPANEL_LINE_VS_COLOR "SVX_HID_PPROPERTYPANEL_LINE_VS_COLOR"
+#define HID_PPROPERTYPANEL_LINE_VS_STYLE "SVX_HID_PPROPERTYPANEL_LINE_VS_STYLE"
+#define HID_PPROPERTYPANEL_LINE_BTN_STYLE "SVX_HID_PPROPERTYPANEL_LINE_BTN_STYLE"
+#define HID_PPROPERTYPANEL_TEXT_SPACING_VS "SVX_HID_PPROPERTYPANEL_TEXT_SPACING_VS"
+#define HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE"
+#define HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE"
+//add for position and size
+#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH"
+#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT"
+#define HID_PROPERTY_PANEL_POSIZE_CBX_SCALE "SVX_HID_PROPERTY_PANEL_POSIZE_CBX_SCALE"
+#define HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL"
+#define HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL"
+#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE"
+#define HID_PROPERTY_PANEL_POSIZE_TBX_FLIP "SVX_HID_PROPERTY_PANEL_POSIZE_TBX_FLIP"
+#define HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL"
+#define HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL"
+#define HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL "SVX_HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL"
+//end
+//add for graphic
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST"
+#define HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE "SVX_HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_RED "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_RED"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE"
+#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA"
+//end
+
+#define HID_PROPERTYPANEL_POSIZE_SECTION "SVX_HID_PROPERTYPANEL_POSIZE_SECTION"
+#define HID_PROPERTYPANEL_GRAPHIC_SECTION "SVX_HID_PROPERTYPANEL_GRAPHIC_SECTION"
+
+
+#define HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET"
+#define HID_PPROPERTYPANEL_PARA_TBI_NUM "SVX_HID_PPROPERTYPANEL_PARA_TBI_NUM"
+#define HID_PPROPERTYPANEL_PARA_TBI_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBI_BULLET"
+#define HID_PPROPERTYPANEL_PARA_TBX_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INC_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INC"
+#define HID_PPROPERTYPANEL_PARA_TBI_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG"
+#define HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC"
+#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG"
+#define HID_PPROPERTYPANEL_PARA_TBX_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBX_LINESP"
+#define HID_PPROPERTYPANEL_PARA_TBI_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBI_LINESP"
+#define HID_PPROPERTYPANEL_AREA_TBX_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBX_COLOR"
+#define HID_PPROPERTYPANEL_AREA_TBI_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBI_COLOR"
+#define HID_PPROPERTYPANEL_AREA_COLOR_VS "SVX_HID_PPROPERTYPANEL_AREA_COLOR_VS"
+//add end
+
+#define HID_PPROPERTYPANEL_AREA_TBX_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBX_GRADIENT"
+#define HID_PPROPERTYPANEL_AREA_TBI_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBI_GRADIENT"
+#define HID_PROPERTYPANEL_SECTIONPAGE_END "SVX_HID_PROPERTYPANEL_SECTIONPAGE_END"
+
+#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES"
+#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR"
+
 #endif
 
diff --git a/main/svx/inc/sidebar/PanelFactory.hxx b/main/svx/inc/sidebar/PanelFactory.hxx
new file mode 100644
index 0000000..60abe32
--- /dev/null
+++ b/main/svx/inc/sidebar/PanelFactory.hxx
@@ -0,0 +1,74 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_PANEL_FACTORY_HXX
+#define SVX_SIDEBAR_PANEL_FACTORY_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+
+#include <boost/noncopyable.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace svx { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::ui::XUIElementFactory
+        > PanelFactoryInterfaceBase;
+}
+
+
+class PanelFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public PanelFactoryInterfaceBase
+{
+public:
+    static ::rtl::OUString SAL_CALL getImplementationName (void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL createInstance (
+        const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+    static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void);
+
+    PanelFactory (void);
+    virtual ~PanelFactory (void);
+
+    // XUIElementFactory
+    cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
+        const ::rtl::OUString& rsResourceURL,
+        const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException);
+};
+
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/AffineMatrixItem.hxx b/main/svx/inc/svx/AffineMatrixItem.hxx
new file mode 100755
index 0000000..aaa5032
--- /dev/null
+++ b/main/svx/inc/svx/AffineMatrixItem.hxx
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * 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 _SVX_AFFINEMATRIXITEM_HXX
+#define _SVX_AFFINEMATRIXITEM_HXX
+
+#include <svx/svxdllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/geometry/AffineMatrix2D.hpp>
+
+//---------------------
+// class AffineMatrixItem
+//---------------------
+
+class SVX_DLLPUBLIC AffineMatrixItem : public SfxPoolItem
+{
+private:
+    com::sun::star::geometry::AffineMatrix2D        maMatrix;
+
+public:
+    TYPEINFO();
+    AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix = 0);
+    AffineMatrixItem(SvStream& rIn);
+    AffineMatrixItem(const AffineMatrixItem&);
+    virtual ~AffineMatrixItem();
+
+    virtual int operator==(const SfxPoolItem&) const;
+    virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+    virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+    virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+    virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+    virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+    const com::sun::star::geometry::AffineMatrix2D& GetAffineMatrix2D() const;
+};
+
+#endif // _SVX_AFFINEMATRIXITEM_HXX
+
+// eof
diff --git a/main/svx/inc/svx/XPropertyEntry.hxx b/main/svx/inc/svx/XPropertyEntry.hxx
new file mode 100755
index 0000000..1417888
--- /dev/null
+++ b/main/svx/inc/svx/XPropertyEntry.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 _XPROPERTYENTRY_HXX
+#define _XPROPERTYENTRY_HXX
+
+#include <svx/svxdllapi.h>
+#include <tools/string.hxx>
+#include <vcl/bitmap.hxx>
+
+// ---------------------
+// class XPropertyEntry
+
+class SVX_DLLPUBLIC XPropertyEntry
+{
+private:
+	String  maName;
+    Bitmap  maUiBitmap;
+
+protected:
+	XPropertyEntry(const String& rName);
+	XPropertyEntry(const XPropertyEntry& rOther);
+
+public:
+    virtual ~XPropertyEntry();
+
+    void SetName(const String& rName) { maName = rName; }
+    const String& GetName() const { return maName; }
+    void SetUiBitmap(const Bitmap& rUiBitmap) { maUiBitmap = rUiBitmap; }
+    const Bitmap& GetUiBitmap() const { return maUiBitmap; }
+};
+
+#endif // _XPROPERTYENTRY_HXX
diff --git a/main/svx/inc/svx/XPropertyTable.hxx b/main/svx/inc/svx/XPropertyTable.hxx
index cb526fc..5f9e16b 100644
--- a/main/svx/inc/svx/XPropertyTable.hxx
+++ b/main/svx/inc/svx/XPropertyTable.hxx
@@ -28,7 +28,7 @@
 #include "svx/svxdllapi.h"
 #include <svx/xtable.hxx>
 
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pTable ) throw();
 SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw();
 SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw();
 SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw();
diff --git a/main/svx/inc/svx/bmpmask.hxx b/main/svx/inc/svx/bmpmask.hxx
index b2923f6..a42d232 100644
--- a/main/svx/inc/svx/bmpmask.hxx
+++ b/main/svx/inc/svx/bmpmask.hxx
@@ -119,7 +119,7 @@
 	CheckBox			aCbxTrans;
 	ColorLB				aLbColorTrans;
 
-	const XColorTable* 	pColTab;
+	const XColorList* 	pColTab;
 	Color				aPipetteColor;
 	SvxBmpMaskSelectItem aSelItem;
 
@@ -161,7 +161,7 @@
 	void				PipetteClicked();
 
 	sal_Bool				NeedsColorTable() const;
-	void 				SetColorTable( const XColorTable* pColorTable );
+	void 				SetColorTable( const XColorList* pColorTable );
 
 	void				SetExecState( sal_Bool bEnable );
 
diff --git a/main/svx/inc/svx/colrctrl.hxx b/main/svx/inc/svx/colrctrl.hxx
index 52c86db..91674f1 100644
--- a/main/svx/inc/svx/colrctrl.hxx
+++ b/main/svx/inc/svx/colrctrl.hxx
@@ -30,7 +30,7 @@
 #include <svl/lstner.hxx>
 #include "svx/svxdllapi.h"
 
-class XColorTable;
+class XColorList;
 class SvData;
 
 /*************************************************************************
@@ -95,7 +95,7 @@
  friend class SvxColorChildWindow;
 
 private:
-	XColorTable*		pColorTable;
+	XColorList*		pColorTable;
 	SvxColorValueSet	aColorSet;
 	sal_uInt16				nLeftSlot;
 	sal_uInt16				nRightSlot;
diff --git a/main/svx/inc/svx/dialcontrol.hxx b/main/svx/inc/svx/dialcontrol.hxx
index ba3a99a..d778e9a 100644
--- a/main/svx/inc/svx/dialcontrol.hxx
+++ b/main/svx/inc/svx/dialcontrol.hxx
@@ -29,13 +29,42 @@
 #include <sfx2/itemconnect.hxx>
 #include "svx/svxdllapi.h"
 
+#include <boost/scoped_ptr.hpp>
+
 class NumericField;
 
 namespace svx {
 
 // ============================================================================
 
-struct DialControl_Impl;
+class DialControlBmp : public VirtualDevice
+{
+public:
+    explicit            DialControlBmp( Window& rParent );
+
+    void                InitBitmap( const Size& rSize, const Font& rFont );
+    void                CopyBackground( const DialControlBmp& rSrc );
+    void                DrawBackground( const Size& rSize, bool bEnabled );
+    virtual void        DrawBackground();
+    virtual void        DrawElements( const String& rText, sal_Int32 nAngle );
+
+protected:
+    Rectangle           maRect;
+    bool                mbEnabled;
+    
+private:
+    const Color&        GetBackgroundColor() const;
+    const Color&        GetTextColor() const;
+    const Color&        GetScaleLineColor() const;
+    const Color&        GetButtonLineColor() const;
+    const Color&        GetButtonFillColor( bool bMain ) const;
+
+    void                Init( const Size& rSize );
+
+    Window&             mrParent;
+    long                mnCenterX;
+    long                mnCenterY;
+};
 
 /** This control allows to input a rotation angle, visualized by a dial.
 
@@ -90,20 +119,42 @@
     /** Returns the current modify handler. */
     const Link&         GetModifyHdl() const;
 
-private:
+protected:
+    struct DialControl_Impl
+    {
+        ::boost::scoped_ptr<DialControlBmp>      mpBmpEnabled;
+        ::boost::scoped_ptr<DialControlBmp>      mpBmpDisabled;
+        ::boost::scoped_ptr<DialControlBmp>      mpBmpBuffered;
+        Link                maModifyHdl;
+        NumericField*       mpLinkField;
+        Size                maWinSize;
+        Font                maWinFont;
+        sal_Int32           mnAngle;
+        sal_Int32           mnOldAngle;
+        long                mnCenterX;
+        long                mnCenterY;
+        bool                mbNoRot;
+
+        explicit            DialControl_Impl( Window& rParent );
+        void                Init( const Size& rWinSize, const Font& rWinFont );
+    };
+    std::auto_ptr< DialControl_Impl > mpImpl;
+
+    virtual void        HandleMouseEvent( const Point& rPos, bool bInitial );
+    virtual void        HandleEscapeEvent();
+
+    void                SetRotation( sal_Int32 nAngle, bool bBroadcast );
+
     void                Init( const Size& rWinSize, const Font& rWinFont );
     void                Init( const Size& rWinSize );
+
+private:
     void                InvalidateControl();
 
-    void                ImplSetRotation( sal_Int32 nAngle, bool bBroadcast );
     void                ImplSetFieldLink( const Link& rLink );
 
-    void                HandleMouseEvent( const Point& rPos, bool bInitial );
-    void                HandleEscapeEvent();
 
     DECL_LINK( LinkedFieldModifyHdl, NumericField* );
-
-    std::auto_ptr< DialControl_Impl > mpImpl;
 };
 
 // ============================================================================
diff --git a/main/svx/inc/svx/dialogs.hrc b/main/svx/inc/svx/dialogs.hrc
index d3ad30b..4a72578 100644
--- a/main/svx/inc/svx/dialogs.hrc
+++ b/main/svx/inc/svx/dialogs.hrc
@@ -30,8 +30,8 @@
 
 // Resource-Id's ------------------------------------------------------------
 
-// Bitte FIRSTFREE pflegen!!! (gilt nicht f"ur Strings)
-#define RID_SVX_FIRSTFREE                   305
+// !!! IMPORTANT: consider and update FIRSTFREE when introducing new RIDs !!! (not for RIDs for Strings - they have there own)
+#define RID_SVX_FIRSTFREE                   323
 
 // some strings also used in CUI
 #define RID_SVXERRCTX                       (RID_SVX_START + 351)
@@ -56,7 +56,6 @@
 #define RID_SVXSTR_GALLERY_PREVIEW			(RID_SVX_START + 255)
 //-----IAccessibility2 Implementation 2009
 
-
 // factory IDs of tabpages implemented in CUI
 #define RID_SVXPAGE_CHAR_TWOLINES			(RID_SVX_START + 242)
 #define RID_SVXPAGE_EXT_PARAGRAPH           (RID_SVX_START +   7)
@@ -379,7 +378,33 @@
 #define RID_SVXDLG_TEXTCONTROL_CHARATTR     (RID_SVX_START + 286)
 #define RID_SVXDLG_TEXTCONTROL_PARAATTR     (RID_SVX_START + 287)
 
-// !!! please update RID_SVX_FIRSTFREE !!! see line 46
+#define RID_SIDEBAR_TEXT_PANEL              (RID_SVX_START + 305)
+#define RID_POPUPPANEL_TEXTPAGE_UNDERLINE   (RID_SVX_START + 306)
+#define RID_POPUPPANEL_TEXTPAGE_FONT_COLOR  (RID_SVX_START + 307)
+#define RID_POPUPPANEL_TEXTPAGE_SPACING     (RID_SVX_START + 308)
+
+#define RID_SIDEBAR_AREA_PANEL              (RID_SVX_START + 309)
+#define RID_POPUPPANEL_AERAPAGE_COLOR		(RID_SVX_START + 310)
+#define RID_POPUPPANEL_AREAPAGE_TRGR		(RID_SVX_START + 311)
+
+#define RID_SIDEBAR_LINE_PANEL              (RID_SVX_START + 312)
+#define RID_POPUPPANEL_LINEPAGE_COLOR		(RID_SVX_START + 313)
+#define RID_POPUPPANEL_LINEPAGE_STYLE		(RID_SVX_START + 314)
+#define RID_POPUPPANEL_LINEPAGE_WIDTH       (RID_SVX_START + 315)
+
+#define RID_SIDEBAR_POSSIZE_PANEL           (RID_SVX_START + 316)
+#define RID_SIDEBAR_GRAPHIC_PANEL           (RID_SVX_START + 317)
+#define RID_SIDEBAR_EMPTY_PANEL             (RID_SVX_START + 318)
+
+#define RID_SIDEBAR_PARA_PANEL              (RID_SVX_START + 319)
+#define RID_POPUPPANEL_PARAPAGE_LINESPACING (RID_SVX_START + 320)
+#define RID_POPUPPANEL_PARAPAGE_BULLETS     (RID_SVX_START + 321)
+#define RID_POPUPPANEL_PARAPAGE_NUMBERING   (RID_SVX_START + 322)
+
+// !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above)
+
+
+
 
 // Strings ------------------------------------------------------------------
 
@@ -638,7 +663,7 @@
 #define RID_SVXSTR_LINECAP_ROUND            (RID_SVX_START + 587 )
 #define RID_SVXSTR_LINECAP_SQUARE           (RID_SVX_START + 588 )
 
-// string resources for XLineJoint item
+// string resources for com::sun::star::drawing::LineJoint item
 #define	RID_SVXSTR_LINEJOINT_NONE			RID_SVXSTR_NONE
 #define RID_SVXSTR_LINEJOINT_MIDDLE			(RID_SVX_START + 589 )
 #define RID_SVXSTR_LINEJOINT_BEVEL			(RID_SVX_START + 590 )
@@ -960,14 +985,67 @@
 #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_5                 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 5)//?	
 #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6                 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//?	
 #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7                 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//?	
-
-#define RID_SVXSTR_FINDBAR_FIND                             (RID_SVX_START + 1190)
-
-#define RID_SVXSTR_NEXTFREE                                 (RID_SVX_START + 1191)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS                      (RID_SVX_START + 1172)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0                     (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 0)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1                     (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 1)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2                     (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 2)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3                     (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 3)
+#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4                     (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 4)
 
 //IAccessibility2 Implementation 2009-----
 #define RID_SVXSTR_TEXTCOLOR								(RID_SVX_START + 1178)
 //-----IAccessibility2 Implementation 2009
+
+#define RID_SVXSTR_FINDBAR_FIND                             (RID_SVX_START + 1190)
+
+#define RID_SVXSTR_NUMBULLET_NONE                           (RID_SVX_START + 1191)
+#define RID_SVXSTR_NUMBULLET_CURRENT_LIST_DESCRIPTION       (RID_SVX_START + 1192)
+#define RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION      (RID_SVX_START + 1193)
+#define RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION   (RID_SVX_START + 1194)
+#define RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION  (RID_SVX_START + 1195)
+#define RID_SVXSTR_NUMBULLET_CUSTOMIZED_WATERMARK           (RID_SVX_START + 1196)
+#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_4                 (RID_SVX_START + 1197)
+#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_5                 (RID_SVX_START + 1198)
+#define RID_SVXSTR_OUTLINENUM_RTL_DESCRIPTION_7             (RID_SVX_START + 1199)
+
+#define RID_SVXSTR_GRAPHICS_DESCRIPTIONS                    (RID_SVX_START + 1200)
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_0                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 0) // 1200
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_1                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 1) // 1201
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_2                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 2) // 1202
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_3                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 3) // 1203
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_4                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 4) // 1204
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_5                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 5) // 1205
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_6                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 6) // 1206
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_7                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 7) // 1207
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_8                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 8) // 1208
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_9                   (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 9) // 1209
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_10                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 10) // 1210
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_11                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 11) // 1211
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_12                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 12) // 1212
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_13                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 13) // 1213
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_14                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 14) // 1214
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_15                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 15) // 1215
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_16                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 16) // 1216
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_17                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 17) // 1217
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_18                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 18) // 1218
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_19                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 19) // 1219
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_20                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 20) // 1220
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_21                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 21) // 1221
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_22                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 22) // 1222
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_23                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 23) // 1223
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_24                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 24) // 1224
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_25                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 25) // 1225
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_26                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 26) // 1226
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_27                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 27) // 1227
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_28                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 28) // 1228
+#define RID_SVXSTR_GRAPHICS_DESCRIPTION_29                  (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 29) // 1229
+
+// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!!
+#define RID_SVXSTR_NEXTFREE                                 (RID_SVX_START + 1230)
+
+
+
+
 // ----------------------------------------------------------------------------
 // if we have _a_lot_ time, we should group the resource ids by type, instead
 // of grouping them by semantics. The reason is that resource ids have to be
diff --git a/main/svx/inc/svx/dlgctrl.hxx b/main/svx/inc/svx/dlgctrl.hxx
index 882fe72..283406f 100644
--- a/main/svx/inc/svx/dlgctrl.hxx
+++ b/main/svx/inc/svx/dlgctrl.hxx
@@ -34,7 +34,7 @@
 class XBitmapEntry;
 class XBitmapList;
 class XColorEntry;
-class XColorTable;
+class XColorList;
 class XDash;
 class XDashEntry;
 class XDashList;
@@ -259,7 +259,7 @@
 		 ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {}
 		 ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {}
 
-	virtual void Fill( const XColorTable* pTab );
+	virtual void Fill( const XColorList* pTab );
 
 	void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL );
 	void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
@@ -327,8 +327,8 @@
 	virtual void Fill(const XBitmapList* pList);
 	virtual void UserDraw(const UserDrawEvent& rUDEvt);
 
-	void Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx = 0);
-	void Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0);
+	void Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx = 0);
+	void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0);
 	void SelectEntryByList(const XBitmapList* pList, const String& rStr);
 
 private:
@@ -338,7 +338,7 @@
 	XBitmapList*	mpList;
 	bool            mbUserDraw;
 
-	SVX_DLLPRIVATE void SetVirtualDevice();
+	SVX_DLLPRIVATE void SetVirtualDevice(const Size& rSize);
 };
 
 /*************************************************************************
@@ -352,13 +352,13 @@
 	VirtualDevice	maVD;
 	BitmapEx		maBitmapEx;
 
-	void SetVirtualDevice();
+	void SetVirtualDevice(const Size& rSize);
 
 public:
     FillAttrLB( Window* pParent, ResId Id );
     FillAttrLB( Window* pParent, WinBits aWB );
 
-	virtual void Fill( const XColorTable* pTab );
+	virtual void Fill( const XColorList* pTab );
 	virtual void Fill( const XHatchList* pList );
 	virtual void Fill( const XGradientList* pList );
 	virtual void Fill( const XBitmapList* pList );
@@ -395,11 +395,11 @@
 
 	virtual void Fill( const XDashList* pList );
 
-	void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL );
-	void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+	void Append( XDashEntry* pEntry, const Bitmap* pBmp = NULL );
+	void Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL );
 	void SelectEntryByList( const XDashList* pList, const String& rStr,
 							const XDash& rDash, sal_uInt16 nDist = 0 );
-	void FillStyles();
+	// void FillStyles();
 };
 
 /*************************************************************************
@@ -411,14 +411,15 @@
 {
 
 public:
-		 LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
-		 LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
-
+                          LineEndLB( Window* pParent, ResId Id );
+                          LineEndLB( Window* pParent, WinBits aWB );
+                 virtual ~LineEndLB (void);
+                 
 	virtual void Fill( const XLineEndList* pList, sal_Bool bStart = sal_True );
 
-	void	Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL,
+	void	Append( XLineEndEntry* pEntry, const Bitmap* pBmp = NULL,
 					sal_Bool bStart = sal_True );
-	void	Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL,
+	void	Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL,
 					sal_Bool bStart = sal_True );
 };
 
diff --git a/main/svx/inc/svx/dlgutil.hxx b/main/svx/inc/svx/dlgutil.hxx
index 869820f..11fc3b7 100644
--- a/main/svx/inc/svx/dlgutil.hxx
+++ b/main/svx/inc/svx/dlgutil.hxx
@@ -34,7 +34,8 @@
 // Functions -------------------------------------------------------------
 class SfxItemSet;
 
-SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& );
+SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet&);
+SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit();
 
 #define OUTPUT_DRAWMODE_COLOR		(DRAWMODE_DEFAULT)
 #define OUTPUT_DRAWMODE_CONTRAST	(DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
diff --git a/main/svx/inc/svx/drawitem.hxx b/main/svx/inc/svx/drawitem.hxx
index 5bf1f4b..8552137 100644
--- a/main/svx/inc/svx/drawitem.hxx
+++ b/main/svx/inc/svx/drawitem.hxx
@@ -34,16 +34,16 @@
 //	SvxColorTableItem
 //==================================================================
 
-class XColorTable;
+class XColorList;
 
 class SVX_DLLPUBLIC SvxColorTableItem: public SfxPoolItem
 {
-	XColorTable*			pColorTable;
+	XColorList*			pColorTable;
 
 public:
 							TYPEINFO();
 							SvxColorTableItem();
-							SvxColorTableItem( XColorTable* pTable,
+							SvxColorTableItem( XColorList* pTable,
                                     sal_uInt16 nWhich  );
 							SvxColorTableItem( const SvxColorTableItem& );
 
@@ -57,8 +57,8 @@
 	virtual	sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
     virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
 
-	XColorTable*			GetColorTable() const { return pColorTable; }
-	void			 		SetColorTable( XColorTable* pTable ) {
+	XColorList*			GetColorTable() const { return pColorTable; }
+	void			 		SetColorTable( XColorList* pTable ) {
 									pColorTable = pTable; }
 };
 
diff --git a/main/svx/inc/svx/fontwork.hxx b/main/svx/inc/svx/fontwork.hxx
index ed5d614..e1ce238 100644
--- a/main/svx/inc/svx/fontwork.hxx
+++ b/main/svx/inc/svx/fontwork.hxx
@@ -135,7 +135,7 @@
 	ImageList		maImageList;
 	ImageList		maImageListH;
 
-	const XColorTable* pColorTable;
+	const XColorList* pColorTable;
 
 #ifdef _SVX_FONTWORK_CXX
  friend class SvxFontWorkChildWindow;
@@ -181,7 +181,7 @@
 						const ResId& rResId );
 	~SvxFontWorkDialog();
 
-	void SetColorTable(const XColorTable* pTable);
+	void SetColorTable(const XColorList* pTable);
 	void SetActive(sal_Bool bActivate = sal_True);
 
 	void CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
diff --git a/main/svx/inc/svx/galbrws.hxx b/main/svx/inc/svx/galbrws.hxx
index 4f900c6..eba1b19 100644
--- a/main/svx/inc/svx/galbrws.hxx
+++ b/main/svx/inc/svx/galbrws.hxx
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef _SVX_GALBRWS_HXX_
 #define _SVX_GALBRWS_HXX_
 
@@ -64,7 +62,7 @@
 class GallerySplitter;
 class Gallery;
 
-class GalleryBrowser : public SfxDockingWindow
+class SVX_DLLPUBLIC GalleryBrowser : public SfxDockingWindow
 {
 	friend class GalleryBrowser1;
 	friend class GalleryBrowser2;
@@ -72,19 +70,16 @@
 	using Window::KeyInput;
 
 private:
-
 	Size					maLastSize;
 	GallerySplitter*		mpSplitter;
 	GalleryBrowser1*		mpBrowser1;
 	GalleryBrowser2*		mpBrowser2;
 	Gallery*				mpGallery;
-	long					mnDummy1;
-	long					mnDummy2;
-	long					mnDummy3;
 
+    /// bitfield
     void                    InitSettings();
 
-	virtual sal_Bool 			Close();
+	virtual sal_Bool 		Close();
 	virtual void			Resize();
 	virtual void			GetFocus();
 
diff --git a/main/svx/inc/svx/nbdtmg.hxx b/main/svx/inc/svx/nbdtmg.hxx
new file mode 100755
index 0000000..f6ebeca
--- /dev/null
+++ b/main/svx/inc/svx/nbdtmg.hxx
@@ -0,0 +1,390 @@
+/**************************************************************
+ * 
+ * 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 _NBDTMG_HXX
+#define _NBDTMG_HXX
+#include "svx/svxdllapi.h"
+
+#ifndef _SVX_NUMITEM_HXX
+#include <editeng/numitem.hxx>
+#endif
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <svl/svarray.hxx>
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _SV_FONT_HXX
+#include <vcl/font.hxx>
+#endif
+
+namespace svx { namespace sidebar {
+
+#define DEFAULT_BULLET_TYPES							8
+#define DEFAULT_NONE									10
+#define DEFAULT_NUM_TYPE_MEMBER							5 
+#define DEFAULT_NUM_VALUSET_COUNT						8
+#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION			0x10
+
+typedef sal_uInt16 NBOType;
+namespace eNBOType
+{
+    const NBOType BULLETS = 0x01;
+    const NBOType GRAPHICBULLETS = 0x02;
+    const NBOType NUMBERING = 0x03;
+    const NBOType OUTLINE = 0x04;
+    const NBOType MIXBULLETS = 0x05;
+}
+
+typedef sal_uInt16 NBType;
+namespace eNBType
+{
+    const NBOType BULLETS = 0x01;
+    const NBOType GRAPHICBULLETS = 0x02;
+}
+
+class  SVX_DLLPUBLIC NumSettings_Impl
+{
+	public:
+		short		nNumberType;
+		short 		nParentNumbering;
+		SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy;
+		long 		nTabValue;
+		SvxAdjust	eNumAlign;
+		long			nNumAlignAt;
+		long			nNumIndentAt;
+		rtl::OUString	sPrefix;
+		rtl::OUString	sSuffix;
+		rtl::OUString	sBulletChar;
+		rtl::OUString	sBulletFont;
+		SvxBrushItem   *pBrushItem;
+		Size			aSize;
+
+	public:
+		NumSettings_Impl() :
+			nNumberType(0),
+				pBrushItem(0),
+				aSize(0,0),
+			nParentNumbering(0)
+			{}
+		~NumSettings_Impl(){}
+};
+/*
+typedef NumSettings_Impl* NumSettings_ImplPtr;
+SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4)
+SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr )*/
+
+class NumSettingsArr_Impl;
+
+class  SVX_DLLPUBLIC BulletsSettings
+{
+	public:
+		sal_Bool 		bIsCustomized;
+		rtl::OUString	sDescription;
+		NBType		eType;		
+	public:
+		BulletsSettings(NBType eTy) :
+			bIsCustomized(sal_False),			
+			eType(eTy)
+			{}
+		virtual ~BulletsSettings(){}
+};
+
+class  SVX_DLLPUBLIC BulletsSettings_Impl:public BulletsSettings
+{
+	public:		
+		sal_Unicode	cBulletChar;
+		//rtl::OUString	sBulletFont;
+		Font			aFont;
+		
+	public:
+		BulletsSettings_Impl(NBType eTy) :
+			BulletsSettings(eTy)			
+			{}
+		virtual ~BulletsSettings_Impl(){}
+};
+
+class  SVX_DLLPUBLIC GrfBulDataRelation: public BulletsSettings
+{
+	public:
+		String 	sGrfName;
+		sal_uInt16	nTabIndex;
+		sal_uInt16	nGallaryIndex;
+		const Graphic*	pGrfObj;
+		Size aSize;
+	GrfBulDataRelation(NBType eTy):
+		BulletsSettings(eTy),
+		nTabIndex((sal_uInt16)0xFFFF),
+		nGallaryIndex((sal_uInt16)0xFFFF),
+		aSize(0,0),
+		pGrfObj(0)
+	{}
+	virtual ~GrfBulDataRelation(){}
+};
+
+class  SVX_DLLPUBLIC MixBulletsSettings_Impl
+{
+	public:
+		NBType			eType;
+		sal_uInt16			nIndex; //index in the tab page display
+		sal_uInt16			nIndexDefault;
+		BulletsSettings*	pBullets;		
+	public:
+		MixBulletsSettings_Impl(NBType eTy) :			
+			eType(eTy),
+			nIndex((sal_uInt16)0xFFFF),
+			nIndexDefault((sal_uInt16)0xFFFF),
+			pBullets(0)
+			{}
+		~MixBulletsSettings_Impl(){}
+};
+
+class  SVX_DLLPUBLIC NumberSettings_Impl
+{
+	public:
+		sal_Bool 		bIsCustomized;
+		rtl::OUString	sDescription;
+		sal_uInt16		nIndex; //index in the tab page display
+		sal_uInt16		nIndexDefault;
+		NumSettings_Impl	*pNumSetting;
+	public:
+		NumberSettings_Impl() :
+			bIsCustomized(sal_False),
+			nIndex((sal_uInt16)0xFFFF),
+			nIndexDefault((sal_uInt16)0xFFFF),
+			pNumSetting(NULL)
+			{}
+		~NumberSettings_Impl(){}
+};
+
+class NumberSettingsArr_Impl;
+
+class  SVX_DLLPUBLIC OutlineSettings_Impl
+{
+	public:
+		sal_Bool 		bIsCustomized;
+		rtl::OUString	sDescription;
+		NumSettingsArr_Impl	*pNumSettingsArr;
+	public:
+		OutlineSettings_Impl() :
+			bIsCustomized(sal_False),
+			pNumSettingsArr(NULL)
+			{}
+		~OutlineSettings_Impl(){
+		}
+};
+
+class SVX_DLLPUBLIC NBOTypeMgrBase
+{
+	public:
+		NBOType 		eType;
+	private:
+		const SfxItemSet*	pSet;
+		SfxMapUnit		eCoreUnit;
+		//Sym3_2508    store the attributes passed from pSet
+		String			aNumCharFmtName;
+		void			StoreBulCharFmtName_impl();
+		void			StoreMapUnit_impl();
+
+	public:
+		NBOTypeMgrBase(const NBOType aType):eType(aType),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){}
+		NBOTypeMgrBase(const NBOType aType,const SfxItemSet* pArg):eType(aType),pSet(pArg),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){}
+		NBOTypeMgrBase(const NBOTypeMgrBase& aTypeMgr){eType = aTypeMgr.eType;pSet = aTypeMgr.pSet;eCoreUnit = aTypeMgr.eCoreUnit;aNumCharFmtName = aTypeMgr.aNumCharFmtName; }
+		virtual ~NBOTypeMgrBase() {}	
+		virtual void Init()=0;
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0)=0;
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF)=0;
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF, sal_Bool isDefault=false,sal_Bool isResetSize=false)=0;
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false)=0;
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0;
+		sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel);
+		const SfxItemSet* GetItems() { return pSet;}
+		//Sym3_2508    store the attributes passed from pSet
+		void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();}
+	protected:
+		String GetBulCharFmtName();
+		SfxMapUnit GetMapUnit();
+	protected:
+		sal_Bool	bIsLoading;
+		void	ImplLoad(String filename);
+		void	ImplStore(String filename);
+		
+};
+
+
+class SVX_DLLPUBLIC BulletsTypeMgr: public NBOTypeMgrBase
+{
+	friend class OutlineTypeMgr;
+	friend class NumberingTypeMgr;
+	public:
+		static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES];
+		static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES];
+		static BulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES];
+		static BulletsTypeMgr* _instance;
+	public:		
+		BulletsTypeMgr(const NBOType aType);
+		BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg);
+		BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr);
+		virtual ~BulletsTypeMgr() {}
+		virtual void Init();			
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0);
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF);
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false);	
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false);
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex);
+		sal_Unicode GetBulChar(sal_uInt16 nIndex);
+		Font GetBulCharFont(sal_uInt16 nIndex);
+		static BulletsTypeMgr* GetInstance()
+		{
+			 if ( _instance == 0 )
+	                {
+	                    _instance = new BulletsTypeMgr(eNBOType::BULLETS);
+	                }
+
+	                return _instance;
+		}
+		
+};
+
+class SVX_DLLPUBLIC GraphyicBulletsTypeMgr: public NBOTypeMgrBase
+{
+	friend class OutlineTypeMgr;
+	friend class NumberingTypeMgr;
+	public:
+		List	aGrfDataLst;
+		static GraphyicBulletsTypeMgr* _instance;
+	public:		
+		GraphyicBulletsTypeMgr(const NBOType aType);
+		GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg);
+		GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr);
+		virtual ~GraphyicBulletsTypeMgr() {}
+		virtual void Init();			
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0);
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF);
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false);	
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false);
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex);
+		String GetGrfName(sal_uInt16 nIndex);
+		static GraphyicBulletsTypeMgr* GetInstance()
+		{
+			 if ( _instance == 0 )
+	                {
+	                    _instance = new GraphyicBulletsTypeMgr(eNBOType::BULLETS);
+	                }
+
+	                return _instance;
+		}
+		
+};
+
+class SVX_DLLPUBLIC MixBulletsTypeMgr: public NBOTypeMgrBase
+{
+	friend class OutlineTypeMgr;
+	friend class NumberingTypeMgr;
+	public:		
+		static MixBulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES];
+		static MixBulletsSettings_Impl* pDefaultActualBullets[DEFAULT_BULLET_TYPES];
+		static MixBulletsTypeMgr* _instance;
+	public:		
+		MixBulletsTypeMgr(const NBOType aType);
+		MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg);
+		MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr);
+		virtual ~MixBulletsTypeMgr() {}
+		virtual void Init();			
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0);
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF);
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false);	
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false);
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex);		
+		static MixBulletsTypeMgr* GetInstance()
+		{
+			 if ( _instance == 0 )
+	                {
+	                    _instance = new MixBulletsTypeMgr(eNBOType::MIXBULLETS);
+	                }
+
+	                return _instance;
+		}
+		
+};
+
+class SVX_DLLPUBLIC NumberingTypeMgr: public NBOTypeMgrBase
+{
+	public:
+		//NumSettingsArr_Impl*		pNumSettingsArr;
+		NumberSettingsArr_Impl*		pNumberSettingsArr;
+		NumberSettingsArr_Impl*		pDefaultNumberSettingsArr;
+		static NumberingTypeMgr* 	_instance;
+	public:		
+		NumberingTypeMgr(const NBOType aType);
+		NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg);
+		NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr);
+		virtual ~NumberingTypeMgr() {}
+		virtual void Init();
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0);
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF);
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false);	
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false);
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex);
+		sal_uInt16 GetNumCount() const;
+		NumberSettings_Impl* GetNumSettingByIndex(sal_uInt16 nIndex) const;
+		static NumberingTypeMgr* GetInstance()
+		{
+			 if ( _instance == 0 )
+	                {
+	                    _instance = new NumberingTypeMgr(eNBOType::NUMBERING);
+	                }
+
+	                return _instance;
+		}
+};
+
+class SVX_DLLPUBLIC OutlineTypeMgr: public NBOTypeMgrBase
+{
+	public:
+		//NumSettingsArr_Impl*		pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
+		OutlineSettings_Impl*		pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
+		OutlineSettings_Impl*		pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
+		static OutlineTypeMgr* 	_instance;
+	public:		
+		OutlineTypeMgr(const NBOType aType);
+		OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg);
+		OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr);
+		virtual ~OutlineTypeMgr() {}
+		virtual void Init();
+		virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0);
+		virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF);
+		virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false);	
+		virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false);
+		virtual sal_Bool IsCustomized(sal_uInt16 nIndex);
+		static OutlineTypeMgr* GetInstance()
+		{
+			 if ( _instance == 0 )
+	                {
+	                    _instance = new OutlineTypeMgr(eNBOType::OUTLINE);
+	                }
+
+	                return _instance;
+		}
+};
+}}
+#endif
+
diff --git a/main/svx/inc/svx/nbdtmgfact.hxx b/main/svx/inc/svx/nbdtmgfact.hxx
new file mode 100755
index 0000000..677e5f1
--- /dev/null
+++ b/main/svx/inc/svx/nbdtmgfact.hxx
@@ -0,0 +1,37 @@
+/**************************************************************

+ * 

+ * 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 _NBDTMGFACT_HXX

+#define _NBDTMGFACT_HXX

+#ifndef _NBDTMG_HXX

+#include "nbdtmg.hxx"

+#endif

+namespace svx { namespace sidebar {

+class SVX_DLLPUBLIC NBOutlineTypeMgrFact

+{

+public:

+	static NBOTypeMgrBase* CreateInstance(const NBOType aType);

+	NBOutlineTypeMgrFact();

+	virtual ~NBOutlineTypeMgrFact() {}

+};

+}}

+#endif

+

diff --git a/main/svx/inc/svx/sdr/table/tablecontroller.hxx b/main/svx/inc/svx/sdr/table/tablecontroller.hxx
new file mode 100755
index 0000000..b0d8d6e
--- /dev/null
+++ b/main/svx/inc/svx/sdr/table/tablecontroller.hxx
@@ -0,0 +1,169 @@
+/**************************************************************
+ * 
+ * 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 _SVX_TABLECONTROLLER_HXX_
+#define _SVX_TABLECONTROLLER_HXX_
+
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <rtl/ref.hxx>
+
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/selectioncontroller.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/svdview.hxx>
+//#include <tablemodel.hxx>
+
+class SdrObjEditView;
+class SdrObject;
+class SfxItemSet;
+
+namespace sdr { namespace table {
+
+class TableModel;
+
+const sal_Int16 SELTYPE_NONE = 0;
+const sal_Int16 SELTYPE_MOUSE = 1;
+const sal_Int16 SELTYPE_KEYS = 2;
+
+class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
+{
+public:
+    SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
+    SVX_DLLPRIVATE virtual ~SvxTableController();
+
+    // from sdr::SelectionController
+    SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin);
+    SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+    SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+    SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin);
+
+    SVX_DLLPRIVATE virtual bool DeleteMarked();
+
+    SVX_DLLPRIVATE virtual void onSelectionHasChanged();
+
+    SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet );
+    SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq );
+
+    SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
+    SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
+
+	SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  );
+	SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );	
+
+	// slots
+    SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
+    SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
+    SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
+    SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
+    SVX_DLLPRIVATE void MergeMarkedCells();
+    SVX_DLLPRIVATE void SplitMarkedCells();
+    SVX_DLLPRIVATE void DistributeColumns();
+    SVX_DLLPRIVATE void DistributeRows();
+    SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
+
+    SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
+
+    SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
+    SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
+
+    SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+    SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+
+    SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage );
+    SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel );
+
+    SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); }
+
+	void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
+	void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
+	void clearSelection();
+	void selectAll();
+
+    SVX_DLLPRIVATE void onTableModified();
+
+private:
+    SvxTableController(SvxTableController &); // not defined
+    void operator =(SvxTableController &); // not defined
+
+	// internals
+    SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
+    SVX_DLLPRIVATE void UpdateTableShape();
+
+    SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
+    SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
+
+    SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
+
+    SVX_DLLPRIVATE bool checkTableObject();
+    SVX_DLLPRIVATE bool updateTableObject();
+    SVX_DLLPRIVATE const CellPos& getSelectionStart();
+    SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
+    SVX_DLLPRIVATE const CellPos& getSelectionEnd();
+    SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellCursor > getSelectionCursor();
+    SVX_DLLPRIVATE void checkCell( CellPos& rPos );
+
+    SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
+
+    SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
+    SVX_DLLPRIVATE bool StopTextEdit();
+
+    SVX_DLLPRIVATE void DeleteTable();
+
+    SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow );
+    SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow );
+    SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 );
+
+    SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
+    SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
+    SVX_DLLPRIVATE void RemoveSelection();
+    SVX_DLLPRIVATE void updateSelectionOverlay();
+    SVX_DLLPRIVATE void destroySelectionOverlay();
+
+    SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
+
+	DECL_LINK( UpdateHdl, void * );
+
+	//TableModelRef mxTable;
+	rtl::Reference< TableModel > mxTable;
+
+	CellPos maCursorFirstPos;
+	CellPos maCursorLastPos;
+	bool mbCellSelectionMode;
+	CellPos maMouseDownPos;
+	bool mbLeftButtonDown;
+	::sdr::overlay::OverlayObjectList*	mpSelectionOverlay;
+
+	SdrView* mpView;
+	SdrObjectWeakRef mxTableObj;
+	SdrModel* mpModel;
+
+	::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
+
+	sal_uLong mnUpdateEvent;
+};
+
+} }
+
+#endif // _SVX_TABLECONTROLLER_HXX_
+
diff --git a/main/svx/inc/svx/sidebar/ColorControl.hxx b/main/svx/inc/svx/sidebar/ColorControl.hxx
new file mode 100644
index 0000000..5b53061
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/ColorControl.hxx
@@ -0,0 +1,86 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/PopupControl.hxx"
+
+#include <svtools/valueset.hxx>
+#include <boost/function.hpp>
+
+class Window;
+class SfxBindings;
+class RedId;
+class FloatingWindow;
+
+
+namespace svx { namespace sidebar {
+
+/** The ColorControl uses a ValueSet control for displaying all named
+    colors in a matrix.
+*/
+class SVX_DLLPUBLIC ColorControl
+    : public PopupControl
+{
+public:
+    /** Create a new ColorControl object.
+        @param rControlResId
+            The resource id for the whole color control.
+        @param rNoColorGetter
+            A functor for getting the color which will be returned when the
+            WB_NONEFIELD is used and got selected
+        @param rColorSetter
+            A functor for setting the color that is selected by the
+            user.
+        @param pNoColorStringResId
+            Resource id of an optional string for the "no color"
+            string.  When a value is given then a
+            field/button is created above the color matrix for
+            selecting "no color" ie. transparent.
+            When zero is given then no such field is created.            
+    */
+	ColorControl (
+        Window* pParent,
+        SfxBindings* pBindings,
+        const ResId& rControlResId,
+        const ResId& rValueSetResId,
+        const ::boost::function<Color(void)>& rNoColorGetter,
+        const ::boost::function<void(String&,Color)>& rColorSetter,
+        FloatingWindow* pFloatingWindow,
+        const ResId* pNoColorStringResId);
+    virtual ~ColorControl (void);
+    
+	void GetFocus (void);
+	void SetCurColorSelect (
+        const Color aCol,
+        const bool bAvl);
+
+private:	
+	SfxBindings* mpBindings;
+	ValueSet maVSColor;
+    FloatingWindow* mpFloatingWindow;
+    const String msNoColorString;
+    ::boost::function<Color(void)> maNoColorGetter;
+    ::boost::function<void(String&,Color)> maColorSetter;
+
+	void FillColors (void);
+	DECL_LINK(VSSelectHdl, void *);
+};
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/inc/svx/sidebar/ColorPopup.hxx b/main/svx/inc/svx/sidebar/ColorPopup.hxx
new file mode 100644
index 0000000..6698a70
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/ColorPopup.hxx
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_COLOR_POPUP_HXX_
+#define _SVX_SIDEBAR_COLOR_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <tools/color.hxx>
+
+
+namespace svx { namespace sidebar {
+
+/** Popup control that displays all named colors in a matrix.
+    The number of rows and columns of the matrix are computed from
+    the number of named colors so that both have roughly the same
+    value.
+    
+    The ColorPopup uses ColorControl as control for its content.
+*/
+class SVX_DLLPUBLIC ColorPopup
+    : public Popup
+{
+public :
+    ColorPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    virtual ~ColorPopup (void);
+
+    void SetCurrentColor (
+        const Color aCurrentColor,
+        const bool bIsColorAvailable);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx b/main/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx
new file mode 100644
index 0000000..5775bfe
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
+#define _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
+
+#include "svx/svxdllapi.h"
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+class SfxViewShell;
+
+/** Convenience frontend for com::sun::star::ui::ContextChangeEventMultiplexer
+*/
+class SVX_DLLPUBLIC ContextChangeEventMultiplexer
+{
+public:
+    /** Notify the activation of a context.
+        @param rxController
+            This controller is used to determine the module (ie
+            application like Writer or Calc).
+        @param eContext
+            The activated context.
+    */
+    static void NotifyContextChange (
+        const cssu::Reference<css::frame::XController>& rxController,
+        const ::sfx2::sidebar::EnumContext::Context eContext);
+
+    /** Notify the activation of a context.
+        @param pViewShell
+            This view shell is used to determine the module (ie
+            application like Writer or Calc).  When <NULL/> then no
+            notification is made.
+        @param eContext
+            The activated context.
+    */
+    static void NotifyContextChange (
+        SfxViewShell* pViewShell,
+        const ::sfx2::sidebar::EnumContext::Context eContext);
+
+private:
+    static ::rtl::OUString GetModuleName (
+        const cssu::Reference<css::frame::XFrame>& rxFrame);
+};
+
+#endif
+
diff --git a/main/svx/inc/svx/sidebar/Popup.hxx b/main/svx/inc/svx/sidebar/Popup.hxx
new file mode 100644
index 0000000..47c938e
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/Popup.hxx
@@ -0,0 +1,107 @@
+/**************************************************************

+ * 

+ * 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 _SVX_SIDEBAR_POPUP_HXX_

+#define _SVX_SIDEBAR_POPUP_HXX_

+

+#include "svx/svxdllapi.h"

+#include <rtl/ustring.hxx>

+#include <tools/link.hxx>

+

+#include <boost/function.hpp>

+#include <boost/scoped_ptr.hpp>

+

+class Window;

+class ToolBox;

+

+namespace svx { namespace sidebar {

+

+class PopupContainer;

+class PopupControl;

+

+/** A wrapper around a PopupContainer and a PopupControl object.

+    Usually used as drop down for a toolbox.  Use Show() to start

+    drop down mode and Hide() to end it.

+*/

+class SVX_DLLPUBLIC Popup

+{

+public :

+    /** Create a Popup wrapper object.

+        @param pParent

+            Parent window of the PopupContainer, which in turn is the

+            parent of the PopupControl.

+        @param rControlCreator

+            A functor that is called to create the PopupControl object

+            (usually an instance of a class derived from

+            PopupControl).

+    */

+    Popup (

+        Window* pParent,

+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator,

+        const ::rtl::OUString& rsAccessibleName);

+    virtual ~Popup (void);

+

+    /** Show the popup.

+        @rToolBox

+            The tool box is used to determine the position at which

+            the popup is displayed.

+    */

+    void Show (ToolBox& rToolBox);

+

+    /** Hide the popup.

+        This method is called automatically when eg. the user clicks

+        outside the popup or when the ESC-key is pressed.  The

+        application can call Hide() when the popup should be closed

+        for other, non-standard reasons.

+    */

+    void Hide (void);

+    

+    /** If you want to be informed when the popup closes then add a

+        callback that is called after that.

+    */

+    void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback);

+    

+protected:    

+    ::boost::scoped_ptr<PopupControl> mpControl;

+

+    /** Make sure that both PopupContainer and PopupControl objects

+        exist.  Calls the maControlCreator functor if necessary.

+    */

+    void ProvideContainerAndControl (void);

+

+    /** A derived specialisation class can override this method to do

+        additional work.

+    */

+    virtual void CreateContainerAndControl (void);

+

+private:

+    Window* mpParent;

+    ::boost::function<PopupControl*(PopupContainer*)> maControlCreator;

+    ::boost::function<void(void)> maPopupModeEndCallback;

+    const ::rtl::OUString msAccessibleName;

+    ::boost::scoped_ptr<PopupContainer> mpContainer;

+

+    DECL_LINK(PopupModeEndHandler, void*);

+};

+

+} } // end of namespace svx::sidebar

+

+#endif

diff --git a/main/svx/inc/svx/sidebar/PopupContainer.hxx b/main/svx/inc/svx/sidebar/PopupContainer.hxx
new file mode 100644
index 0000000..b7f1ced
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/PopupContainer.hxx
@@ -0,0 +1,48 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_POPUP_CONTAINER_HXX_
+#define _SVX_SIDEBAR_POPUP_CONTAINER_HXX_
+
+#include "svx/svxdllapi.h"
+#include <vcl/floatwin.hxx>
+
+namespace svx { namespace sidebar {
+
+/** Simple base class for popup container windows used by sidebar
+    related drop downs.
+    It initializes the underlying floating window with the right
+    flags and closes the drop down when appropriate.
+*/
+class SVX_DLLPUBLIC PopupContainer
+    : public FloatingWindow
+{
+public:
+    PopupContainer (Window* pParent);
+    virtual ~PopupContainer (void);
+
+    virtual long Notify (NotifyEvent& rNEvt);
+};
+
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/sidebar/PopupControl.hxx b/main/svx/inc/svx/sidebar/PopupControl.hxx
new file mode 100644
index 0000000..1864918
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/PopupControl.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_POPUP_CONTROL_HXX_
+#define _SVX_SIDEBAR_POPUP_CONTROL_HXX_
+
+#include "svx/svxdllapi.h"
+#include <vcl/ctrl.hxx>
+
+namespace svx { namespace sidebar {
+
+/** Base class for sidebar related popup controls.
+    A PopupControl is typically a child of a PopupContainer and
+    provides the actual content of a popup.
+    This base class takes care of painting the proper background and
+    border for sidebar popups.
+    Specialize by derivation.
+*/
+class SVX_DLLPUBLIC PopupControl
+    : public Control
+{
+public :
+    PopupControl (
+        Window* pParent,
+        const ResId& rResId);
+    virtual ~PopupControl (void);
+
+    virtual void Paint (const Rectangle& rect);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx b/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx
new file mode 100644
index 0000000..2c14e09
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/SelectionAnalyzer.hxx
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_
+#define _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_
+
+#include <sfx2/sidebar/EnumContext.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrMarkList;
+class SdrObject;
+
+
+namespace svx { namespace sidebar {
+
+class SVX_DLLPUBLIC SelectionAnalyzer
+{
+public :
+    static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC (
+        const SdrMarkList& rMarkList);
+    static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD (
+        const SdrMarkList& rMarkList,
+        const bool bIsMasterPage,
+        const bool bIsHandoutPage,
+        const bool bIsNotesPage);
+
+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);
+    static sal_uInt32 GetInventorTypeFromMark (
+        const SdrMarkList& rMarkList);
+    static sal_uInt16 GetObjectTypeFromMark (
+        const SdrMarkList& rMarkList);
+    static sal_uInt16 GetObjectTypeFromGroup (
+        const SdrObject* pObj);
+    static bool IsShapeType (
+        const sal_uInt16 nType);
+    static bool IsTextObjType (
+        const sal_uInt16 nType);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx b/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx
new file mode 100644
index 0000000..691116e
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/SelectionChangeHandler.hxx
@@ -0,0 +1,89 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_
+#define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_
+
+#include "svx/svxdllapi.h"
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/function.hpp>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+class SdrMarkView;
+
+
+namespace svx { namespace sidebar {
+
+namespace {
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::view::XSelectionChangeListener
+        > SelectionChangeHandlerInterfaceBase;
+}
+
+
+class SVX_DLLPUBLIC SelectionChangeHandler
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public SelectionChangeHandlerInterfaceBase
+{
+public:
+    SelectionChangeHandler (
+        const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback,
+        const cssu::Reference<css::frame::XController>& rxController,
+        const sfx2::sidebar::EnumContext::Context eDefaultContext);
+    virtual ~SelectionChangeHandler (void);
+        
+    virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+        
+    virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+        throw (cssu::RuntimeException);
+
+    virtual void SAL_CALL disposing (void)
+        throw (cssu::RuntimeException);
+
+    void Connect (void);
+    void Disconnect (void);
+
+private:
+    const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback;
+    cssu::Reference<css::frame::XController> mxController;
+    const sfx2::sidebar::EnumContext::Context meDefaultContext;
+    bool mbIsConnected;
+};
+
+
+} } // end of namespace svx::sidebar
+
+
+#endif
+
diff --git a/main/svx/inc/svx/sidebar/SidebarDialControl.hxx b/main/svx/inc/svx/sidebar/SidebarDialControl.hxx
new file mode 100644
index 0000000..e2698be
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/SidebarDialControl.hxx
@@ -0,0 +1,45 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_DIAL_CONTROL_HXX
+#define SVX_SIDEBAR_DIAL_CONTROL_HXX
+
+#include <svx/dialcontrol.hxx>
+
+namespace svx { namespace sidebar {
+
+/** Provide some improvements over the standard DialControl.
+*/
+class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl
+{
+public:
+    SidebarDialControl (Window* pParent, const ResId& rResId);
+    virtual ~SidebarDialControl (void);
+
+    virtual void MouseButtonDown (const MouseEvent& rMEvt);
+
+protected:
+    virtual void HandleMouseEvent (const Point& rPos, bool bInitial);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx b/main/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx
new file mode 100644
index 0000000..ff6d6a3
--- /dev/null
+++ b/main/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx
@@ -0,0 +1,161 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_
+#define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_
+
+#include "svx/svxdllapi.h"
+
+#include <svtools/valueset.hxx>
+#include <limits.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <vcl/image.hxx>
+
+#include <vector>
+
+namespace com{namespace sun{ namespace star{
+	namespace container{
+		class XIndexAccess;
+	}
+	namespace beans{
+		struct PropertyValue;
+	}
+	namespace text{
+		class XNumberingFormatter;
+	}
+}}}
+
+namespace svx { namespace sidebar {
+
+/** Specialization of class <ValueSet>.
+    This specialization allows is a one-columned ValueSet which allow
+    items containing an image and a text or a text and a second text.
+
+    Especially, used for sidebar related controls.
+*/
+class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet
+{
+public:
+    // control type of specialized <ValueSet>:
+    // - image + text
+    // - text + text
+    enum tControlType
+    {
+        IMAGE_TEXT,
+        TEXT_TEXT
+    };
+
+    ValueSetWithTextControl(
+        const tControlType eControlType,
+        Window* pParent,
+        const ResId& rResId);
+
+    virtual ~ValueSetWithTextControl(void);
+
+    // add item for control type IMAGE_TEXT
+    // if control type does not match IMAGE_TEXT no item is added.
+    // @param pSelectedItemImage
+    // selection item image is optional. if not provided, it is the same as the image item
+    // @param pItemHelpText
+    // help text is optional. if not provided, it is the same as the item text
+    void AddItem(
+        const Image& rItemImage,
+        const Image* pSelectedItemImage,
+        const XubString& rItemText,
+        const XubString* pItemHelpText );
+
+    // replace item images for control type IMAGE_TEXT
+    void ReplaceItemImages(
+        const sal_uInt16 nItemId,
+        const Image& rItemImage,
+        const Image* pSelectedItemImage );
+
+    // add item for control type TEXT_TEXT
+    // if control type does not match TEXT_TEXT no item is added.
+    // @param pItemHelpText
+    // help text is optional. if not provided, it is the same as the item text
+    void AddItem(
+        const XubString& rItemText,
+        const XubString& rItemText2,
+        const XubString* pItemHelpText );
+
+    virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+private:
+    struct ValueSetWithTextItem
+    {
+        Image maItemImage;
+        Image maSelectedItemImage;
+        XubString maItemText;
+        XubString maItemText2;
+    };
+
+    typedef ::std::vector< ValueSetWithTextItem > tItemList;
+
+    const tControlType meControlType;
+    tItemList maItems;
+};
+
+class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet
+{
+	Color 			aLineColor;
+	Rectangle		aOrgRect;
+	VirtualDevice* 	pVDev;
+
+	com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
+	com::sun::star::lang::Locale aLocale;
+
+	com::sun::star::uno::Sequence<
+		com::sun::star::uno::Sequence<
+			com::sun::star::beans::PropertyValue> > aNumSettings;
+
+
+	public:
+		SvxNumValueSet2( Window* pParent, const ResId& rResId);
+		~SvxNumValueSet2();
+
+	virtual void	UserDraw( const UserDrawEvent& rUDEvt );
+
+	
+	void			SetNumberingSettings(
+		const com::sun::star::uno::Sequence<
+			com::sun::star::uno::Sequence<
+				com::sun::star::beans::PropertyValue> >& aNum,
+		com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
+		const com::sun::star::lang::Locale& rLocale	);	
+};
+
+class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet
+{
+	public:
+		SvxNumValueSet3( Window* pParent, const ResId& rResId);
+		~SvxNumValueSet3();
+
+	virtual void	UserDraw( const UserDrawEvent& rUDEvt );	
+	
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/inc/svx/svdedtv.hxx b/main/svx/inc/svx/svdedtv.hxx
index 7c9a4db..fb6fa0a 100644
--- a/main/svx/inc/svx/svdedtv.hxx
+++ b/main/svx/inc/svx/svdedtv.hxx
@@ -243,6 +243,7 @@
 	void SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy=sal_False);
 	void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
 	void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+	void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bCopy, const bool bWdh, const bool bHgt);
 	long GetMarkedObjRotate() const;
 	void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false);
 	void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false);
diff --git a/main/svx/inc/svx/svdedxv.hxx b/main/svx/inc/svx/svdedxv.hxx
index 9ca6d95..f359cd8 100644
--- a/main/svx/inc/svx/svdedxv.hxx
+++ b/main/svx/inc/svx/svdedxv.hxx
@@ -270,6 +270,9 @@
 	virtual void AddWindowToPaintView(OutputDevice* pNewWin);
 	virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
 
+	sal_uInt16 GetSelectionLevel() const;
+	
+
 	//************************************************************************
 	// Object-MacroModus (z.B. Rect als Button oder sowas):
 	//************************************************************************
diff --git a/main/svx/inc/svx/svdmodel.hxx b/main/svx/inc/svx/svdmodel.hxx
index e3becbd..5c87af7 100644
--- a/main/svx/inc/svx/svdmodel.hxx
+++ b/main/svx/inc/svx/svdmodel.hxx
@@ -78,16 +78,11 @@
 class SfxUndoAction;
 class SfxUndoManager;
 class XBitmapList;
-class XBitmapTable;
-class XColorTable;
+class XColorList;
 class XDashList;
-class XDashTable;
 class XGradientList;
-class XGradientTable;
 class XHatchList;
-class XHatchTable;
 class XLineEndList;
-class XLineEndTable;
 class SvxForbiddenCharactersTable;
 class SvNumberFormatter;
 class SotStorage;
@@ -282,7 +277,7 @@
 	FASTBOOL        mbInDestruction;
 
 	// Zeiger auf Paletten, Listen und Tabellen
-	XColorTable*    pColorTable;
+	XColorList*    pColorTable;
 	XDashList*      pDashList;
 	XLineEndList*   pLineEndList;
 	XHatchList*     pHatchList;
@@ -658,8 +653,8 @@
 	const Link& GetIOProgressHdl() const                     { return aIOProgressLink; }
 
 	// Zugriffsmethoden fuer Paletten, Listen und Tabellen
-	void            SetColorTable(XColorTable* pTable)       ;
-	XColorTable*    GetColorTable() const                    { return pColorTable; }
+	void            SetColorTable(XColorList* pTable)       ;
+	XColorList*    GetColorTable() const                    { return pColorTable; }
 	void            SetDashList(XDashList* pList)            ;
 	XDashList*      GetDashList() const                      { return pDashList; }
 	void            SetLineEndList(XLineEndList* pList)      ;
diff --git a/main/svx/inc/svx/svdobj.hxx b/main/svx/inc/svx/svdobj.hxx
index 73263c1..56dd66b 100644
--- a/main/svx/inc/svx/svdobj.hxx
+++ b/main/svx/inc/svx/svdobj.hxx
@@ -40,6 +40,7 @@
 #include <svx/sdrobjectuser.hxx>
 #include "svx/svxdllapi.h"
 #include "svx/shapeproperty.hxx"
+#include <svl/poolitem.hxx>
 
 //************************************************************
 //   Vorausdeklarationen
@@ -855,6 +856,9 @@
 	void SetObjectItemSet(const SfxItemSet& rSet);
 	const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
 
+    // get SfxMapUnit the object is using
+    SfxMapUnit GetObjectMapUnit() const;
+
 public:
 	// syntactical sugar for ItemSet accesses
 	void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
diff --git a/main/svx/inc/svx/svdogrp.hxx b/main/svx/inc/svx/svdogrp.hxx
index 9af5519..eb07285 100644
--- a/main/svx/inc/svx/svdogrp.hxx
+++ b/main/svx/inc/svx/svdogrp.hxx
@@ -48,9 +48,6 @@
 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
 
     SdrObjList*					pSub;    // Subliste (Kinder)
-	long						nDrehWink;
-	long						nShearWink;
-
 	Point						aRefPoint; // Referenzpunkt innerhalb der Objektgruppe
 	FASTBOOL					bRefPoint; // Ist ein RefPoint gesetzt?
 
diff --git a/main/svx/inc/svx/svdstr.hrc b/main/svx/inc/svx/svdstr.hrc
index fbbbd96..bf0465c 100644
--- a/main/svx/inc/svx/svdstr.hrc
+++ b/main/svx/inc/svx/svdstr.hrc
@@ -786,8 +786,11 @@
 #define SIP_SA_CROP_MARKERS					(SIP_Begin + 276)
 #define SIP_SA_CROP_FINE_MARKERS			(SIP_Begin + 277)
 #define SIP_SA_ACCESSIBILITY_CROP_MARKERS	(SIP_Begin + 278)
+#define IMG_DIACONTROL_NORMAL               (SIP_Begin + 279)
+#define IMG_DIACONTROL_H                    (SIP_Begin + 280)
 
-#define	SIP_End								(SIP_SA_ACCESSIBILITY_CROP_MARKERS)
+
+#define	SIP_End								(IMG_DIACONTROL_H)
 
 #define SDR_ResourceEnd						(SIP_End)
 
diff --git a/main/svx/inc/svx/svxids.hrc b/main/svx/inc/svx/svxids.hrc
index 40ebe29..969995a 100644
--- a/main/svx/inc/svx/svxids.hrc
+++ b/main/svx/inc/svx/svxids.hrc
@@ -373,6 +373,8 @@
 #define FN_NUM_BULLET_OFF       (FN_EDIT + 37)  /* Numerierung aus */
 #define FN_NUM_BULLET_ON        (FN_EDIT + 38)  /* Numerierung mit Bullets an */
 #define FN_NUM_NUMBERING_ON     (FN_EDIT + 44)  /* Numerierung an */
+#define FN_BUL_NUM_RULE_INDEX	(FN_EDIT + 120)  /* Achieving num rule index */
+#define FN_NUM_NUM_RULE_INDEX	(FN_EDIT + 121)
 
 #define FN_INSERT               (SID_SW_START +  300)
 #define FN_DELETE_BOOKMARK      (FN_INSERT + 1)
@@ -683,6 +685,9 @@
 #define SID_TWAIN_TRANSFER                              ( SID_SVX_START + 332 )
 #define SID_CONTOUR_DLG                                 ( SID_SVX_START + 334 )
 #define SID_CONTOUR_EXEC                                ( SID_SVX_START + 335 )
+
+//#define SID_SIDEBAR                                   ( SID_SVX_START + 336 )   -> sfxsids.hrc
+
 #define SID_BORDER_OBJECT                               ( SID_SVX_START + 340 )
 #define SID_BORDER_LEFTLINE                             ( SID_SVX_START + 341 )
 #define SID_BORDER_RIGHTLINE                            ( SID_SVX_START + 342 )
@@ -749,6 +754,8 @@
 #define SID_ATTR_3D_AMBIENTCOLOR                        ( SID_SVX_START + 411 )
 #define SID_IMPORT_GRAPH_LINK                           ( SID_SVX_START + 412 )
 
+//#define SID_ATTR_PARA_REGISTER                          ( SID_SVX_START + 413 ) -> editids.hrc
+
 //! moved to sfx2, still in use:
 //#define SID_HTML_MODE                                   ( SID_SVX_START + 414 )
 
@@ -1258,8 +1265,26 @@
 #define SID_TRANSLITERATE_TITLE_CASE                    (SID_SVX_START+1103)
 #define SID_TRANSLITERATE_TOGGLE_CASE                   (SID_SVX_START+1104)
 
+// new slots for panels
+#define SID_ATTR_FILL_TRANSPARENCE                      (SID_SVX_START+1105)
+#define SID_ATTR_FILL_FLOATTRANSPARENCE                 (SID_SVX_START+1106)
+#define SID_ATTR_LINE_TRANSPARENCE                      (SID_SVX_START+1107)
+#define SID_FLIP_HORIZONTAL                             (SID_SVX_START+1108)
+#define SID_FLIP_VERTICAL                               (SID_SVX_START+1109)
+#define SID_ATTR_LINE_JOINT                             (SID_SVX_START+1110)
+#define SID_ATTR_LINE_CAP                               (SID_SVX_START+1111)
+#define SID_ATTR_TRANSFORM_MATRIX                       (SID_SVX_START+1112)
+
+#define SID_CELL_FORMAT_BORDER                          (SID_SVX_START+1113)
+#define SID_CHAR_DLG_EFFECT				(SID_SVX_START+1114) 
+#define SID_ATTR_PARA_LEFT				(SID_SVX_START + 1115) 
+#define SID_ATTR_PARA_RIGHT				(SID_SVX_START + 1116)
+
+#define FN_SVX_SET_NUMBER				(SID_SVX_START + 1117)
+#define FN_SVX_SET_BULLET				(SID_SVX_START + 1118)
+
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE								(SID_TRANSLITERATE_TOGGLE_CASE + 1)
+#define SID_SVX_FIRSTFREE                               (FN_SVX_SET_BULLET + 1)
 
 // --------------------------------------------------------------------------
 // Overflow check for slot IDs
diff --git a/main/svx/inc/svx/svxitems.hrc b/main/svx/inc/svx/svxitems.hrc
index d09dba1..1a88e9c 100644
--- a/main/svx/inc/svx/svxitems.hrc
+++ b/main/svx/inc/svx/svxitems.hrc
@@ -70,6 +70,9 @@
 #define RID_SVXITEMS_BRUSHSTYLE_75			(RID_SVXITEMS_START + 55)
 #define RID_SVXITEMS_BRUSHSTYLE_BITMAP		(RID_SVXITEMS_START + 56)
 
+// enum ColorName -----------------------------------------------------------
+#define RID_SVXITEMS_COLOR_WHITE			(RID_SVXITEMS_START + 76)
+
 // enum FontFamily -------------------------------------------------------
 #define RID_SVXITEMS_FONTFAMILY_BEGIN		(RID_SVXITEMS_START + 100)
 #define RID_SVXITEMS_FONTFAMILY_DONTKNOW	(RID_SVXITEMS_START + 100)
diff --git a/main/svx/inc/svx/xattr.hxx b/main/svx/inc/svx/xattr.hxx
index ca1beb8..9d5b837 100644
--- a/main/svx/inc/svx/xattr.hxx
+++ b/main/svx/inc/svx/xattr.hxx
@@ -24,26 +24,12 @@
 #define _XATTR_HXX
 
 // include ---------------------------------------------------------------
-
-#ifndef _XDEF_HXX
-//#include <svx/xdef.hxx>
-#endif
-#ifndef _XENUM_HXX
-//#include <svx/xenum.hxx>
-#endif
-#ifndef _XPOLY_HXX
-//#include <svx/xpoly.hxx>
-#endif
-#ifndef _SVX_RECTENUM_HXX
-//#include <svx/rectenum.hxx>
-#endif
-
-class XColorTable;
-class XDashTable;
-class XLineEndTable;
-class XHatchTable;
-class XBitmapTable;
-class XGradientTable;
+class XColorList;
+class XDashList;
+class XLineEndList;
+class XHatchList;
+class XBitmapList;
+class XGradientList;
 
 #include <svx/xit.hxx>
 #include <svx/xcolit.hxx>
diff --git a/main/svx/inc/svx/xcolit.hxx b/main/svx/inc/svx/xcolit.hxx
index 126d4e3..943a376 100644
--- a/main/svx/inc/svx/xcolit.hxx
+++ b/main/svx/inc/svx/xcolit.hxx
@@ -29,7 +29,7 @@
 
 #include <svx/xit.hxx>
 
-class XColorTable;
+class XColorList;
 
 //-----------------
 // class XColorItem
@@ -55,7 +55,7 @@
 	virtual SfxPoolItem*    Create(SvStream& rIn, sal_uInt16 nVer) const;
 	virtual SvStream&       Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
 
-	const Color&    GetColorValue(const XColorTable* pTable = 0) const;
+	const Color&    GetColorValue(const XColorList* pTable = 0) const;
 	void            SetColorValue(const Color& rNew) { aColor = rNew; Detach(); }
 };
 
diff --git a/main/svx/inc/svx/xenum.hxx b/main/svx/inc/svx/xenum.hxx
index 95ccba9..000707f 100644
--- a/main/svx/inc/svx/xenum.hxx
+++ b/main/svx/inc/svx/xenum.hxx
@@ -25,14 +25,6 @@
 #define _XENUM_HXX
 
 enum XLineStyle			{ XLINE_NONE, XLINE_SOLID, XLINE_DASH };
-enum XLineJoint			
-{
-	XLINEJOINT_NONE,		// no rounding
-	XLINEJOINT_MIDDLE,		// calc middle value between joints
-	XLINEJOINT_BEVEL,		// join edges with line
-	XLINEJOINT_MITER,		// extend till cut
-	XLINEJOINT_ROUND		// create arc
-};
 enum XDashStyle			{ XDASH_RECT, XDASH_ROUND, XDASH_RECTRELATIVE,
 						  XDASH_ROUNDRELATIVE };
 enum XFillStyle			{ XFILL_NONE, XFILL_SOLID, XFILL_GRADIENT, XFILL_HATCH,
diff --git a/main/svx/inc/svx/xflgrit.hxx b/main/svx/inc/svx/xflgrit.hxx
index 73e6502..dd48308 100644
--- a/main/svx/inc/svx/xflgrit.hxx
+++ b/main/svx/inc/svx/xflgrit.hxx
@@ -59,7 +59,7 @@
 									SfxMapUnit eCoreMetric,
 									SfxMapUnit ePresMetric,
                                     String &rText, const IntlWrapper * = 0 ) const;
-	const XGradient&		GetGradientValue(const XGradientTable* pTable = 0) const; // GetValue -> GetGradientValue
+	const XGradient&		GetGradientValue(const XGradientList* pTable = 0) const; // GetValue -> GetGradientValue
 	void					SetGradientValue(const XGradient& rNew) { aGradient = rNew; Detach(); } // SetValue -> SetGradientValue
 
 	static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
diff --git a/main/svx/inc/svx/xflhtit.hxx b/main/svx/inc/svx/xflhtit.hxx
index c8b47d5..9135ad4 100644
--- a/main/svx/inc/svx/xflhtit.hxx
+++ b/main/svx/inc/svx/xflhtit.hxx
@@ -61,7 +61,7 @@
 	virtual FASTBOOL		HasMetrics() const;
 	virtual FASTBOOL		ScaleMetrics(long nMul, long nDiv);
 
-	const XHatch&			GetHatchValue(const XHatchTable* pTable = 0) const; // GetValue -> GetHatchValue
+	const XHatch&			GetHatchValue(const XHatchList* pTable = 0) const; // GetValue -> GetHatchValue
 	void					SetHatchValue(const XHatch& rNew)  { aHatch = rNew; Detach(); } // SetValue -> SetHatchValue
 
 	static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
diff --git a/main/svx/inc/svx/xit.hxx b/main/svx/inc/svx/xit.hxx
index 7753ea8..ad4d104 100644
--- a/main/svx/inc/svx/xit.hxx
+++ b/main/svx/inc/svx/xit.hxx
@@ -30,12 +30,12 @@
 
 /************************************************************************/
 
-class XColorTable;
-class XDashTable;
-class XLineEndTable;
-class XHatchTable;
-class XBitmapTable;
-class XGradientTable;
+class XColorList;
+class XDashList;
+class XLineEndList;
+class XHatchList;
+class XBitmapList;
+class XGradientList;
 class SfxItemPool;
 class NameOrIndex;
 class XPropertyList;
diff --git a/main/svx/inc/svx/xlineit.hxx b/main/svx/inc/svx/xlineit.hxx
index 287939d..c8eb395 100644
--- a/main/svx/inc/svx/xlineit.hxx
+++ b/main/svx/inc/svx/xlineit.hxx
@@ -32,7 +32,7 @@
 #include <svl/eitem.hxx>
 
 class XDash;
-class XDashTable;
+class XDashList;
 class SvStream;
 
 #include <svx/xdash.hxx>
diff --git a/main/svx/inc/svx/xlinjoit.hxx b/main/svx/inc/svx/xlinjoit.hxx
index 99d35ee..aaaf91f 100644
--- a/main/svx/inc/svx/xlinjoit.hxx
+++ b/main/svx/inc/svx/xlinjoit.hxx
@@ -27,16 +27,17 @@
 #include <svl/eitem.hxx>
 #include <svx/xenum.hxx>
 #include "svx/svxdllapi.h"
+#include <com/sun/star/drawing/LineJoint.hpp>
 
 //---------------------
-// class LineStyleItem
+// class XLineJointItem
 //---------------------
 
 class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem
 {
 public:
 							TYPEINFO();
-							XLineJointItem( XLineJoint eLineJoint = XLINEJOINT_ROUND );
+							XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint = com::sun::star::drawing::LineJoint_ROUND );
 							XLineJointItem( SvStream& rIn );
 
 	virtual sal_uInt16           GetVersion( sal_uInt16 nFileFormatVersion ) const;
@@ -49,8 +50,8 @@
 									SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric,
                                     String &rText, const IntlWrapper * = 0 ) const;
 
-	virtual sal_uInt16          GetValueCount() const;
-	XLineJoint				GetValue() const { return (XLineJoint) SfxEnumItem::GetValue(); }
+	virtual sal_uInt16                 GetValueCount() const;
+	com::sun::star::drawing::LineJoint GetValue() const { return (com::sun::star::drawing::LineJoint) SfxEnumItem::GetValue(); }
 };
 
 #endif // _SVX_XLINJOIT_HXX
diff --git a/main/svx/inc/svx/xlncapit.hxx b/main/svx/inc/svx/xlncapit.hxx
index be525ea..c87dcca 100644
--- a/main/svx/inc/svx/xlncapit.hxx
+++ b/main/svx/inc/svx/xlncapit.hxx
@@ -28,7 +28,7 @@
 #include <com/sun/star/drawing/LineCap.hpp>
 
 //---------------------
-// class LineStyleItem
+// class XLineCapItem
 //---------------------
 
 class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem
diff --git a/main/svx/inc/svx/xlndsit.hxx b/main/svx/inc/svx/xlndsit.hxx
index 32c36d6..93dc448 100644
--- a/main/svx/inc/svx/xlndsit.hxx
+++ b/main/svx/inc/svx/xlndsit.hxx
@@ -65,7 +65,7 @@
 	virtual FASTBOOL		HasMetrics() const;
 	virtual FASTBOOL		ScaleMetrics(long nMul, long nDiv);
 
-	const XDash&			GetDashValue(const XDashTable* pTable = 0) const; // GetValue -> GetDashValue
+	const XDash&			GetDashValue(const XDashList* pTable = 0) const; // GetValue -> GetDashValue
 	void					SetDashValue(const XDash& rNew)   { aDash = rNew; Detach(); } // SetValue -> SetDashValue
 
 	static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
diff --git a/main/svx/inc/svx/xlnedit.hxx b/main/svx/inc/svx/xlnedit.hxx
index c756009..3a7c146 100644
--- a/main/svx/inc/svx/xlnedit.hxx
+++ b/main/svx/inc/svx/xlnedit.hxx
@@ -59,7 +59,7 @@
 									SfxMapUnit ePresMetric,
                                     String &rText, const IntlWrapper * = 0 ) const;
 
-	basegfx::B2DPolyPolygon GetLineEndValue(const XLineEndTable* pTable = 0) const;
+	basegfx::B2DPolyPolygon GetLineEndValue(const XLineEndList* pTable = 0) const;
 	void SetLineEndValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
 
 	XLineEndItem* checkForUniqueItem( SdrModel* pModel ) const;
diff --git a/main/svx/inc/svx/xlnstit.hxx b/main/svx/inc/svx/xlnstit.hxx
index a15a124..12175c9 100644
--- a/main/svx/inc/svx/xlnstit.hxx
+++ b/main/svx/inc/svx/xlnstit.hxx
@@ -59,7 +59,7 @@
 									SfxMapUnit ePresMetric,
                                     String &rText, const IntlWrapper * = 0 ) const;
 
-	basegfx::B2DPolyPolygon GetLineStartValue(const XLineEndTable* pTable = 0) const;
+	basegfx::B2DPolyPolygon GetLineStartValue(const XLineEndList* pTable = 0) const;
 	void SetLineStartValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
 
 	XLineStartItem* checkForUniqueItem( SdrModel* pModel ) const;
diff --git a/main/svx/inc/svx/xtable.hxx b/main/svx/inc/svx/xtable.hxx
index 3fa2c97..3fd7ece 100644
--- a/main/svx/inc/svx/xtable.hxx
+++ b/main/svx/inc/svx/xtable.hxx
@@ -33,19 +33,16 @@
 #include <tools/color.hxx>
 #include <tools/string.hxx>
 #include <tools/table.hxx>
-#include "svx/svxdllapi.h"
+#include <svx/svxdllapi.h>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <svtools/grfmgr.hxx>
+#include <svx/XPropertyEntry.hxx>
 
 class Color;
 class Bitmap;
 class VirtualDevice;
 class XOutdevItemPool;
 
-// Breite und Hoehe der LB-Bitmaps
-#define BITMAP_WIDTH  32
-#define BITMAP_HEIGHT 12
-
 // Standard-Vergleichsstring
 extern sal_Unicode __FAR_DATA pszStandard[]; // "standard"
 
@@ -53,24 +50,6 @@
 // enum COL_NAME nicht verglichen werden kann.
 SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName );
 
-// ---------------------
-// class XPropertyEntry
-// ---------------------
-
-class XPropertyEntry
-{
-protected:
-	String  aName;
-
-			XPropertyEntry(const String& rName) : aName(rName) {}
-			XPropertyEntry(const XPropertyEntry& rOther): aName(rOther.aName) {}
-public:
-
-	virtual        ~XPropertyEntry() {}
-	void            SetName(const String& rName)    { aName = rName; }
-	String&         GetName()                       { return aName; }
-};
-
 // ------------------
 // class XColorEntry
 // ------------------
@@ -206,59 +185,6 @@
     }
 };
 
-// ---------------------
-// class XPropertyTable
-// ---------------------
-
-class SVX_DLLPUBLIC XPropertyTable
-{
-protected:
-	String              aName; // nicht persistent !
-	String              aPath;
-	XOutdevItemPool*    pXPool;
-
-	Table               aTable;
-	Table*              pBmpTable;
-
-	sal_Bool                bTableDirty;
-	sal_Bool                bBitmapsDirty;
-	sal_Bool                bOwnPool;
-
-						XPropertyTable( const String& rPath,
-										XOutdevItemPool* pXPool = NULL,
-										sal_uInt16 nInitSize = 16,
-										sal_uInt16 nReSize = 16 );
-						XPropertyTable( SvStream& rIn );
-	void                Clear();
-
-public:
-	virtual				~XPropertyTable();
-
-	long                Count() const;
-
-	sal_Bool                Insert(long nIndex, XPropertyEntry* pEntry);
-	XPropertyEntry*     Replace(long nIndex, XPropertyEntry* pEntry);
-	XPropertyEntry*     Remove(long nIndex, sal_uInt16 nDummy);
-	XPropertyEntry*     Get( long nIndex, sal_uInt16 nDummy ) const;
-
-	long                Get(const String& rName);
-	Bitmap*             GetBitmap( long nIndex ) const;
-
-	const String&       GetName() const { return aName; }
-	void                SetName( const String& rString );
-	const String&       GetPath() const { return aPath; }
-	void                SetPath( const String& rString ) { aPath = rString; }
-	sal_Bool                IsDirty() const { return bTableDirty && bBitmapsDirty; }
-	void                SetDirty( sal_Bool bDirty = sal_True )
-							{ bTableDirty = bDirty; bBitmapsDirty = bDirty; }
-
-	virtual sal_Bool        Load() = 0;
-	virtual sal_Bool        Save() = 0;
-	virtual sal_Bool        Create() = 0;
-	virtual sal_Bool        CreateBitmapsForUI() = 0;
-	virtual Bitmap*     CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0;
-};
-
 // --------------------
 // class XPropertyList
 // --------------------
@@ -266,23 +192,18 @@
 class SVX_DLLPUBLIC XPropertyList
 {
 protected:
-	String              aName; // nicht persistent !
-	String              aPath;
-	XOutdevItemPool*    pXPool;
+	String              maName; // nicht persistent !
+	String              maPath;
+	XOutdevItemPool*    mpXPool;
 
-	List                aList;
-	List*               pBmpList;
+	List                maList;
 
-	sal_Bool                bListDirty;
-	sal_Bool                bBitmapsDirty;
-	sal_Bool                bOwnPool;
+    /// bitfield
+	bool                mbListDirty : 1;
 
-						XPropertyList(  const String& rPath,
-										XOutdevItemPool* pXPool = NULL,
-										sal_uInt16 nInitSize = 16,
-										sal_uInt16 nReSize = 16 );
-						XPropertyList( SvStream& rIn );
+    XPropertyList( const String& rPath, XOutdevItemPool* pXPool = 0 );
 	void                Clear();
+	virtual Bitmap      CreateBitmapForUI( long nIndex ) = 0;
 
 public:
 	virtual				~XPropertyList();
@@ -295,63 +216,35 @@
 	XPropertyEntry*     Get( long nIndex, sal_uInt16 nDummy ) const;
 
 	long                Get(const String& rName);
-	Bitmap*             GetBitmap( long nIndex ) const;
+	Bitmap              GetUiBitmap( long nIndex ) const;
 
-	const String&       GetName() const { return aName; }
+	const String&       GetName() const { return maName; }
 	void                SetName( const String& rString );
-	const String&       GetPath() const { return aPath; }
-	void                SetPath( const String& rString ) { aPath = rString; }
-	sal_Bool                IsDirty() const { return bListDirty && bBitmapsDirty; }
-	void                SetDirty( sal_Bool bDirty = sal_True )
-							{ bListDirty = bDirty; bBitmapsDirty = bDirty; }
+	const String&       GetPath() const { return maPath; }
+	void                SetPath( const String& rString ) { maPath = rString; }
+    bool                IsDirty() const { return mbListDirty; }
+	void                SetDirty( bool bDirty = true ) { mbListDirty = bDirty; }
 
 	virtual sal_Bool        Load() = 0;
 	virtual sal_Bool        Save() = 0;
 	virtual sal_Bool        Create() = 0;
-	virtual sal_Bool        CreateBitmapsForUI() = 0;
-	virtual Bitmap*     CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0;
-};
 
-// ------------------
-// class XColorTable
-// ------------------
-
-class SVX_DLLPUBLIC XColorTable : public XPropertyTable
-{
-public:
-					XColorTable( const String& rPath,
-								 XOutdevItemPool* pXPool = NULL,
-								 sal_uInt16 nInitSize = 16,
-								 sal_uInt16 nReSize = 16 );
-	virtual			~XColorTable();
-
-	using XPropertyTable::Replace;
-	XColorEntry*    Replace(long nIndex, XColorEntry* pEntry );
-	using XPropertyTable::Remove;
-	XColorEntry*    Remove(long nIndex);
-	using XPropertyTable::Get;
-	XColorEntry*    GetColor(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
-
-	static XColorTable*	GetStdColorTable();
+    sal_uInt32 getUiBitmapWidth() const;
+    sal_uInt32 getUiBitmapHeight() const;
+    sal_uInt32 getUiBitmapLineWidth() const;
 };
 
 // -------------------
 // class XColorList
 // -------------------
 
-class XColorList : public XPropertyList
+class SVX_DLLPUBLIC XColorList : public XPropertyList
 {
+protected:
+	virtual Bitmap  CreateBitmapForUI( long nIndex );
+
 public:
-					XColorList( const String& rPath,
-								XOutdevItemPool* pXPool = NULL,
-								sal_uInt16 nInitSize = 16,
-								sal_uInt16 nReSize = 16 );
+					XColorList( const String& rPath, XOutdevItemPool* pXPool = 0 );
 	virtual			~XColorList();
 
 	using XPropertyList::Replace;
@@ -364,35 +257,8 @@
 	virtual sal_Bool    Load();
 	virtual sal_Bool    Save();
 	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
-};
 
-// --------------------
-// class XLineEndTable
-// --------------------
-
-class XLineEndTable : public XPropertyTable
-{
-public:
-					XLineEndTable( const String& rPath,
-									XOutdevItemPool* pXPool = NULL,
-									sal_uInt16 nInitSize = 16,
-									sal_uInt16 nReSize = 16 );
-	virtual			~XLineEndTable();
-
-	using XPropertyTable::Replace;
-	XLineEndEntry*  Replace(long nIndex, XLineEndEntry* pEntry );
-	using XPropertyTable::Remove;
-	XLineEndEntry*  Remove(long nIndex);
-	using XPropertyTable::Get;
-	XLineEndEntry*  GetLineEnd(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+	static XColorList*	GetStdColorList();
 };
 
 // -------------------
@@ -408,8 +274,11 @@
     void impCreate();
     void impDestroy();
 
+protected:
+	virtual Bitmap CreateBitmapForUI(long nIndex);
+
 public:
-	XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+	XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0);
 	virtual ~XLineEndList();
 
 	using XPropertyList::Replace;
@@ -422,35 +291,6 @@
 	virtual sal_Bool Load();
 	virtual sal_Bool Save();
 	virtual sal_Bool Create();
-	virtual sal_Bool CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
-};
-
-// --------------------
-// class XDashTable
-// --------------------
-
-class XDashTable : public XPropertyTable
-{
-public:
-					XDashTable( const String& rPath,
-								XOutdevItemPool* pXPool = NULL,
-								sal_uInt16 nInitSize = 16,
-								sal_uInt16 nReSize = 16 );
-	virtual			~XDashTable();
-
-	using XPropertyTable::Replace;
-	XDashEntry*     Replace(long nIndex, XDashEntry* pEntry );
-	using XPropertyTable::Remove;
-	XDashEntry*     Remove(long nIndex);
-	using XPropertyTable::Get;
-	XDashEntry*     GetDash(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
 };
 
 // -------------------
@@ -462,12 +302,19 @@
 {
 private:
     impXDashList*       mpData;
+    Bitmap              maBitmapSolidLine;
+    String              maStringSolidLine;
+    String              maStringNoLine;
 
     void impCreate();
     void impDestroy();
 
+protected:
+    Bitmap ImpCreateBitmapForXDash(const XDash* pDash);
+	virtual Bitmap CreateBitmapForUI(long nIndex);
+
 public:
-    XDashList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+    XDashList(const String& rPath, XOutdevItemPool* pXPool = 0);
 	virtual ~XDashList();
 
 	using XPropertyList::Replace;
@@ -480,35 +327,16 @@
 	virtual sal_Bool Load();
 	virtual sal_Bool Save();
 	virtual sal_Bool Create();
-	virtual sal_Bool CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
-};
 
-// --------------------
-// class XHatchTable
-// --------------------
+    // Special call to get a bitmap for the solid line representation. It
+    // creates a bitmap fitting in size and style to the ones you get by
+    // using GetUiBitmap for existing entries.
+    Bitmap GetBitmapForUISolidLine() const;
 
-class XHatchTable : public XPropertyTable
-{
-public:
-					XHatchTable( const String& rPath,
-									XOutdevItemPool* pXPool = NULL,
-									sal_uInt16 nInitSize = 16,
-									sal_uInt16 nReSize = 16 );
-	virtual			~XHatchTable();
-
-	using XPropertyTable::Replace;
-	XHatchEntry*    Replace(long nIndex, XHatchEntry* pEntry );
-	using XPropertyTable::Remove;
-	XHatchEntry*    Remove(long nIndex);
-	using XPropertyTable::Get;
-	XHatchEntry*    GetHatch(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+    // Special calls to get the translated strings for the UI entry for no
+    // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs
+    String GetStringForUiSolidLine() const;
+    String GetStringForUiNoLine() const;
 };
 
 // -------------------
@@ -524,8 +352,11 @@
     void impCreate();
     void impDestroy();
 
+protected:
+	virtual Bitmap CreateBitmapForUI(long nIndex);
+
 public:
-    XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+    XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0);
 	~XHatchList();
 
 	using XPropertyList::Replace;
@@ -538,35 +369,6 @@
 	virtual sal_Bool Load();
 	virtual sal_Bool Save();
 	virtual sal_Bool Create();
-	virtual sal_Bool CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
-};
-
-// ---------------------
-// class XGradientTable
-// ---------------------
-
-class XGradientTable : public XPropertyTable
-{
-public:
-					XGradientTable( const String& rPath,
-									XOutdevItemPool* pXPool = NULL,
-									sal_uInt16 nInitSize = 16,
-									sal_uInt16 nReSize = 16 );
-	virtual			~XGradientTable();
-
-	using XPropertyTable::Replace;
-	XGradientEntry* Replace(long nIndex, XGradientEntry* pEntry );
-	using XPropertyTable::Remove;
-	XGradientEntry* Remove(long nIndex);
-	using XPropertyTable::Get;
-	XGradientEntry* GetGradient(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
 };
 
 // -------------------
@@ -582,8 +384,11 @@
     void impCreate();
     void impDestroy();
 
+protected:
+	virtual Bitmap CreateBitmapForUI(long nIndex);
+
 public:
-    XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+    XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0);
 	virtual ~XGradientList();
 
 	using XPropertyList::Replace;
@@ -596,35 +401,6 @@
 	virtual sal_Bool Load();
 	virtual sal_Bool Save();
 	virtual sal_Bool Create();
-	virtual sal_Bool CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
-};
-
-// ---------------------
-// class XBitmapTable
-// ---------------------
-
-class XBitmapTable : public XPropertyTable
-{
-public:
-					XBitmapTable( const String& rPath,
-									XOutdevItemPool* pXPool = NULL,
-									sal_uInt16 nInitSize = 16,
-									sal_uInt16 nReSize = 16 );
-	virtual			~XBitmapTable();
-
-	using XPropertyTable::Replace;
-	XBitmapEntry*   Replace(long nIndex, XBitmapEntry* pEntry );
-	using XPropertyTable::Remove;
-	XBitmapEntry*   Remove(long nIndex);
-	using XPropertyTable::Get;
-	XBitmapEntry*   GetBitmap(long nIndex) const;
-
-	virtual sal_Bool    Load();
-	virtual sal_Bool    Save();
-	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
 };
 
 // -------------------
@@ -633,11 +409,11 @@
 
 class SVX_DLLPUBLIC XBitmapList : public XPropertyList
 {
+protected:
+	virtual Bitmap CreateBitmapForUI( long nIndex );
+
 public:
-					XBitmapList( const String& rPath,
-									XOutdevItemPool* pXPool = NULL,
-									sal_uInt16 nInitSize = 16,
-									sal_uInt16 nReSize = 16 );
+					XBitmapList( const String& rPath, XOutdevItemPool* pXPool = 0);
 	virtual			~XBitmapList();
 
 	using XPropertyList::Replace;
@@ -650,8 +426,8 @@
 	virtual sal_Bool    Load();
 	virtual sal_Bool    Save();
 	virtual sal_Bool    Create();
-	virtual sal_Bool    CreateBitmapsForUI();
-	virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
 };
 
 #endif // _XTABLE_HXX
+
+// eof
diff --git a/main/svx/sdi/svx.sdi b/main/svx/sdi/svx.sdi
index 18c3e4a..228b460 100644
--- a/main/svx/sdi/svx.sdi
+++ b/main/svx/sdi/svx.sdi
@@ -3883,6 +3883,30 @@
 	GroupId = GID_FORMAT;
 ]
 
+SfxVoidItem FontDialogEff SID_CHAR_DLG_EFFECT
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerItem;
+	Asynchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
 //--------------------------------------------------------------------------
 SvxFontHeightItem  FontHeight SID_ATTR_CHAR_FONTHEIGHT
 
@@ -4315,6 +4339,55 @@
 	GroupId = GID_SPECIAL;
 ]
 
+SvxLRSpaceItem ParaOutlineLeft SID_ATTR_PARA_LEFT
+
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = TRUE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SvxLRSpaceItem ParaOutlineRight SID_ATTR_PARA_RIGHT
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = TRUE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_VIEW;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem FormatArea SID_ATTRIBUTES_AREA
 ()
@@ -6357,6 +6430,63 @@
 	GroupId = GID_ENUMERATION;
 ]
 
+SfxBoolItem CurrentBulNumRule FN_BUL_NUM_RULE_INDEX
+(SfxUInt16Item On FN_PARAM_1)
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = TRUE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	ImageRotation = TRUE;
+    ImageReflection = TRUE;
+    /* status: */
+	SlotType = SfxBoolItem
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_ENUMERATION;
+]
+SfxBoolItem CurrentNumNumRule FN_NUM_NUM_RULE_INDEX
+(SfxUInt16Item On FN_PARAM_1)
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = TRUE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	ImageRotation = TRUE;
+    ImageReflection = TRUE;
+    /* status: */
+	SlotType = SfxBoolItem
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_ENUMERATION;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem InsertObject SID_INSERT_OBJECT
 ( SfxGlobalNameItem ClassId SID_INSERT_OBJECT )
@@ -7228,6 +7358,32 @@
 	GroupId = GID_FORMAT;
 ]
 
+SvxULSpaceItem ULSpacing SID_ATTR_PARA_ULSPACE
+
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
 //--------------------------------------------------------------------------
 SvxLineItem LineStyle SID_FRAME_LINESTYLE
 
@@ -7681,6 +7837,57 @@
 	GroupId = GID_FORMAT;
 ]
 
+SfxUInt16Item SetNumber FN_SVX_SET_NUMBER
+[	
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item SetBullet FN_SVX_SET_BULLET
+[	
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem OutlineCollapse SID_OUTLINE_COLLAPSE
 ()
@@ -15132,3 +15339,669 @@
     GroupId = GID_EXPLORER;
 ]
 
+//--------------------------------------------------------------------------
+
+SfxUInt16Item FillTransparence SID_ATTR_FILL_TRANSPARENCE
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+XFillFloatTransparenceItem FillFloatTransparence SID_ATTR_FILL_FLOATTRANSPARENCE
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt16Item LineTransparence SID_ATTR_LINE_TRANSPARENCE
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------------
+
+XLineJointItem LineJoint SID_ATTR_LINE_JOINT
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+XLineCapItem LineCap SID_ATTR_LINE_CAP
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+XLineStartItem LineStart SID_ATTR_LINE_START
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+XLineEndItem LineEnd SID_ATTR_LINE_END
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item SvxTransFormPosX SID_ATTR_TRANSFORM_POS_X
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item SvxTransFormPosY SID_ATTR_TRANSFORM_POS_Y
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item SvxTransFormWidth SID_ATTR_TRANSFORM_WIDTH
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item SvxTransFormHeight SID_ATTR_TRANSFORM_HEIGHT
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item TransAngle SID_ATTR_TRANSFORM_ANGLE
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item TransRotX SID_ATTR_TRANSFORM_ROT_X
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxUInt32Item TransRotY SID_ATTR_TRANSFORM_ROT_Y
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem ProtectPos SID_ATTR_TRANSFORM_PROTECT_POS
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem ProtectSize SID_ATTR_TRANSFORM_PROTECT_SIZE
+[
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem SvxFlipHorizontal SID_FLIP_HORIZONTAL
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem SvxFlipVertical SID_FLIP_VERTICAL
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem SvxFlipVertical SID_FLIP_VERTICAL
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem SvxAutoHeight SID_ATTR_TRANSFORM_AUTOHEIGHT
+[
+	/* flags: */
+	AutoUpdate = TRUE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_SPECIAL;
+]
+
+//----------------------------------------------------------------------
+SvxLineItem BorderTLBR SID_ATTR_BORDER_DIAG_TLBR
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+SvxLineItem BorderBLTR SID_ATTR_BORDER_DIAG_BLTR
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem SCDialogBorder SID_CELL_FORMAT_BORDER
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerItem;
+	Asynchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+// eof
diff --git a/main/svx/sdi/xoitems.sdi b/main/svx/sdi/xoitems.sdi
index 75bfbb0..5cd389f 100644
--- a/main/svx/sdi/xoitems.sdi
+++ b/main/svx/sdi/xoitems.sdi
@@ -142,6 +142,28 @@
 
 item SvxLineStyle XLineStyleItem;
 
+enum SvxLineJoint
+{
+    // com::sun::star::drawing::LineJoint
+    SVX_LINEJOINT_NONE,     // no rounding
+    SVX_LINEJOINT_MIDDLE,   // calc middle value between joints
+    SVX_LINEJOINT_BEVEL,    // join edges with line
+    SVX_LINEJOINT_MITER,    // extend till cut
+    SVX_LINEJOINT_ROUND     // create arc
+};
+
+item SvxLineJoint XLineJointItem;
+
+enum SvxLineCap
+{
+    // com::sun::star::drawing::LineCap
+    SVX_LINECAP_BUTT,
+    SVX_LINECAP_ROUND,
+    SVX_LINECAP_SQUARE
+};
+
+item SvxLineCap XLineCapItem;
+
 item INT32	XLineWidthItem;
 item INT32	XFormTextStyleItem;
 item INT32	XFormTextAdjustItem;
@@ -157,3 +179,7 @@
 item INT32	XFormTextShadowColorItem;	// XColorItem
 item INT32	XFormTextShadowXValItem;	// SfxMetricItem/SfxInt32Item
 item INT32	XFormTextShadowYValItem;	// SfxMetricItem/SfxInt32Item
+
+item XFillGradient XFillFloatTransparenceItem;	// XFillGradient
+
+// eof
diff --git a/main/svx/source/dialog/_bmpmask.cxx b/main/svx/source/dialog/_bmpmask.cxx
index edbedc0..596bd12 100644
--- a/main/svx/source/dialog/_bmpmask.cxx
+++ b/main/svx/source/dialog/_bmpmask.cxx
@@ -605,7 +605,7 @@
 
 //-------------------------------------------------------------------------
 
-void SvxBmpMask::SetColorTable( const XColorTable* pTable )
+void SvxBmpMask::SetColorTable( const XColorList* pTable )
 {
 	if ( pTable && ( pTable != pColTab ) )
 	{
diff --git a/main/svx/source/dialog/dialcontrol.cxx b/main/svx/source/dialog/dialcontrol.cxx
index 56a6dbd..7ea7b75 100644
--- a/main/svx/source/dialog/dialcontrol.cxx
+++ b/main/svx/source/dialog/dialcontrol.cxx
@@ -24,7 +24,9 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 #include "svx/dialcontrol.hxx"
-
+#include "bmpmask.hrc"
+#include <svx/dialmgr.hxx>
+#include <tools/rcid.h>
 #include <math.h>
 #include <vcl/virdev.hxx>
 #include <vcl/svapp.hxx>
@@ -40,39 +42,13 @@
 
 // ============================================================================
 
-class DialControlBmp : public VirtualDevice
-{
-public:
-    explicit            DialControlBmp( Window& rParent );
-
-    void                InitBitmap( const Size& rSize, const Font& rFont );
-    void                CopyBackground( const DialControlBmp& rSrc );
-    void                DrawBackground( const Size& rSize, bool bEnabled );
-    void                DrawElements( const String& rText, sal_Int32 nAngle );
-
-private:
-    const Color&        GetBackgroundColor() const;
-    const Color&        GetTextColor() const;
-    const Color&        GetScaleLineColor() const;
-    const Color&        GetButtonLineColor() const;
-    const Color&        GetButtonFillColor( bool bMain ) const;
-
-    void                Init( const Size& rSize );
-    void                DrawBackground();
-
-    Window&             mrParent;
-    Rectangle           maRect;
-    long                mnCenterX;
-    long                mnCenterY;
-    bool                mbEnabled;
-};
 
 // ----------------------------------------------------------------------------
 
 DialControlBmp::DialControlBmp( Window& rParent ) :
     VirtualDevice( rParent, 0, 0 ),
-    mrParent( rParent ),
-    mbEnabled( true )
+    mbEnabled( true ),
+    mrParent( rParent )
 {
     EnableRTL( sal_False );
 }
@@ -232,40 +208,23 @@
         maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) );
 }
 
-// ============================================================================
 
-struct DialControl_Impl
-{
-    DialControlBmp      maBmpEnabled;
-    DialControlBmp      maBmpDisabled;
-    DialControlBmp      maBmpBuffered;
-    Link                maModifyHdl;
-    NumericField*       mpLinkField;
-    Size                maWinSize;
-    Font                maWinFont;
-    sal_Int32           mnAngle;
-    sal_Int32           mnOldAngle;
-    long                mnCenterX;
-    long                mnCenterY;
-    bool                mbNoRot;
 
-    explicit            DialControl_Impl( Window& rParent );
-    void                Init( const Size& rWinSize, const Font& rWinFont );
-};
 
 // ----------------------------------------------------------------------------
 
-DialControl_Impl::DialControl_Impl( Window& rParent ) :
-    maBmpEnabled( rParent ),
-    maBmpDisabled( rParent ),
-    maBmpBuffered( rParent ),
+DialControl::DialControl_Impl::DialControl_Impl (
+    Window& rParent ) :
+    mpBmpEnabled(new DialControlBmp(rParent)),
+    mpBmpDisabled(new DialControlBmp(rParent)),
+    mpBmpBuffered(new DialControlBmp(rParent)),
     mpLinkField( 0 ),
     mnAngle( 0 ),
     mbNoRot( false )
 {
 }
 
-void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
+void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
 {
     // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position
     maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 );
@@ -275,9 +234,9 @@
     mnCenterY = maWinSize.Height() / 2;
     maWinFont.SetTransparent( sal_True );
 
-    maBmpEnabled.DrawBackground( maWinSize, true );
-    maBmpDisabled.DrawBackground( maWinSize, false );
-    maBmpBuffered.InitBitmap( maWinSize, maWinFont );
+    mpBmpEnabled->DrawBackground( maWinSize, true );
+    mpBmpDisabled->DrawBackground( maWinSize, false );
+    mpBmpBuffered->InitBitmap( maWinSize, maWinFont );
 }
 
 // ============================================================================
@@ -313,7 +272,7 @@
 void DialControl::Paint( const Rectangle&  )
 {
     Point aPos;
-    DrawBitmapEx( aPos, mpImpl->maBmpBuffered.GetBitmapEx( aPos, mpImpl->maWinSize ) );
+    DrawBitmapEx( aPos, mpImpl->mpBmpBuffered->GetBitmapEx( aPos, mpImpl->maWinSize ) );
 }
 
 void DialControl::StateChanged( StateChangedType nStateChange )
@@ -414,7 +373,7 @@
 
 void DialControl::SetRotation( sal_Int32 nAngle )
 {
-    ImplSetRotation( nAngle, false );
+    SetRotation( nAngle, false );
 }
 
 void DialControl::SetLinkedField( NumericField* pField )
@@ -461,13 +420,13 @@
 
 void DialControl::InvalidateControl()
 {
-    mpImpl->maBmpBuffered.CopyBackground( IsEnabled() ? mpImpl->maBmpEnabled : mpImpl->maBmpDisabled );
+    mpImpl->mpBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mpBmpEnabled : *mpImpl->mpBmpDisabled );
     if( !mpImpl->mbNoRot )
-        mpImpl->maBmpBuffered.DrawElements( GetText(), mpImpl->mnAngle );
+        mpImpl->mpBmpBuffered->DrawElements( GetText(), mpImpl->mnAngle );
     Invalidate();
 }
 
-void DialControl::ImplSetRotation( sal_Int32 nAngle, bool bBroadcast )
+void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast )
 {
     bool bOldSel = mpImpl->mbNoRot;
     mpImpl->mbNoRot = false;
@@ -512,7 +471,7 @@
             nAngle = 36000 - nAngle;
         if( bInitial )  // round to entire 15 degrees
             nAngle = ((nAngle + 750) / 1500) * 1500;
-        ImplSetRotation( nAngle, true );
+        SetRotation( nAngle, true );
     }
 }
 
@@ -521,7 +480,7 @@
     if( IsMouseCaptured() )
     {
         ReleaseMouse();
-        ImplSetRotation( mpImpl->mnOldAngle, true );
+        SetRotation( mpImpl->mnOldAngle, true );
         if( mpImpl->mpLinkField )
             mpImpl->mpLinkField->GrabFocus();
     }
@@ -530,7 +489,7 @@
 IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField )
 {
     if( pField )
-        ImplSetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false );
+        SetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false );
     return 0;
 }
 
diff --git a/main/svx/source/dialog/dlgctrl.cxx b/main/svx/source/dialog/dlgctrl.cxx
index 17066fb..49800b3 100644
--- a/main/svx/source/dialog/dlgctrl.cxx
+++ b/main/svx/source/dialog/dlgctrl.cxx
@@ -47,7 +47,6 @@
 #include <svx/svdopath.hxx>
 #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
 #include <svx/sdr/contact/displayinfo.hxx>
-#include <linectrl.hrc>
 #include <vcl/bmpacc.hxx>
 #include <svx/xbtmpit.hxx>
 
@@ -1095,7 +1094,7 @@
 |*
 \************************************************************************/
 
-void ColorLB::Fill( const XColorTable* pColorTab )
+void ColorLB::Fill( const XColorList* pColorTab )
 {
 	long nCount = pColorTab->Count();
 	XColorEntry* pEntry;
@@ -1130,7 +1129,7 @@
 |*
 \************************************************************************/
 
-void FillAttrLB::Fill( const XColorTable* pColorTab )
+void FillAttrLB::Fill( const XColorList* pColorTab )
 {
 	long nCount = pColorTab->Count();
 	XColorEntry* pEntry;
@@ -1184,9 +1183,9 @@
 		for( long i = 0; i < nCount; i++ )
 		{
             pEntry = pList->GetHatch( i );
-			Bitmap* pBitmap = pList->GetBitmap( i );
-			if( pBitmap )
-				InsertEntry( pEntry->GetName(), *pBitmap );
+			const Bitmap aBitmap = pList->GetUiBitmap( i );
+			if( !aBitmap.IsEmpty() )
+				InsertEntry( pEntry->GetName(), aBitmap );
 			else
 				InsertEntry( pEntry->GetName() );
 		}
@@ -1294,9 +1293,9 @@
 	for( long i = 0; i < nCount; i++ )
 	{
         pEntry = pList->GetHatch( i );
-		Bitmap* pBitmap = pList->GetBitmap( i );
-		if( pBitmap )
-			ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+		const Bitmap aBitmap = pList->GetUiBitmap( i );
+		if( !aBitmap.IsEmpty() )
+			ListBox::InsertEntry( pEntry->GetName(), aBitmap );
 		else
 			InsertEntry( pEntry->GetName() );
 	}
@@ -1343,9 +1342,9 @@
 		for( long i = 0; i < nCount; i++ )
 		{
             pEntry = pList->GetGradient( i );
-			Bitmap* pBitmap = pList->GetBitmap( i );
-			if( pBitmap )
-				InsertEntry( pEntry->GetName(), *pBitmap );
+			const Bitmap aBitmap = pList->GetUiBitmap( i );
+			if( !aBitmap.IsEmpty() )
+				InsertEntry( pEntry->GetName(), aBitmap );
 			else
 				InsertEntry( pEntry->GetName() );
 		}
@@ -1466,9 +1465,9 @@
 	for( long i = 0; i < nCount; i++ )
 	{
         pEntry = pList->GetGradient( i );
-		Bitmap* pBitmap = pList->GetBitmap( i );
-		if( pBitmap )
-			ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+		const Bitmap aBitmap = pList->GetUiBitmap( i );
+		if( !aBitmap.IsEmpty() )
+			ListBox::InsertEntry( pEntry->GetName(), aBitmap );
 		else
 			InsertEntry( pEntry->GetName() );
 	}
@@ -1488,28 +1487,32 @@
     mpList(NULL),
     mbUserDraw(bUserDraw)
 {
-	maVD.SetOutputSizePixel(Size(32, 16));
 	EnableUserDraw(mbUserDraw);
 }
 
 /************************************************************************/
 
-void BitmapLB::SetVirtualDevice()
+void BitmapLB::SetVirtualDevice(const Size& rSize)
 {
+	maVD.SetOutputSizePixel(rSize);
+
 	if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8)
 	{
-		maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx);
+		maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx);
 	}
 	else
 	{
-		maVD.DrawBitmapEx(Point(0,  0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(8,  0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(16, 0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(24, 0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(0,  8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(8,  8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(16, 8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(24, 8), maBitmapEx);
+        const Size aBitmapSize(maBitmapEx.GetSizePixel());
+
+        for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height())
+        {
+            for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width())
+            {
+                maVD.DrawBitmapEx(
+                    Point(x, y),
+                    maBitmapEx);
+            }
+        }
 	}
 }
 
@@ -1536,8 +1539,12 @@
 		{
             pEntry = pList->GetBitmap(i);
 			maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-			SetVirtualDevice();
-			InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
+            const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight());
+			SetVirtualDevice(aSize);
+			InsertEntry(
+                pEntry->GetName(), 
+                maVD.GetBitmap(Point(0, 0), 
+                aSize));
 		}
 	}
 
@@ -1588,35 +1595,41 @@
 
 /************************************************************************/
 
-void BitmapLB::Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx)
+void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx)
 {
 	if(pBmpEx)
 	{
-		maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-		SetVirtualDevice();
-		InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
+		maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+		SetVirtualDevice(rSize);
+		InsertEntry(
+            rEntry.GetName(), 
+            maVD.GetBitmap(Point(0, 0), 
+            rSize));
 	}
 	else
     {
-		InsertEntry(pEntry->GetName());
+		InsertEntry(rEntry.GetName());
     }
 }
 
 /************************************************************************/
 
-void BitmapLB::Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx)
+void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx)
 {
 	RemoveEntry(nPos);
 
 	if(pBmpEx)
 	{
-		maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-		SetVirtualDevice();
-		InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)), nPos);
+		maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+		SetVirtualDevice(rSize);
+		InsertEntry(
+            rEntry.GetName(), 
+            maVD.GetBitmap(Point(0, 0), rSize), 
+            nPos);
 	}
 	else
     {
-		InsertEntry(pEntry->GetName());
+		InsertEntry(rEntry.GetName());
     }
 }
 
@@ -1657,7 +1670,6 @@
     maVD(),
     maBitmapEx()
 {
-	maVD.SetOutputSizePixel(Size(32, 16));
 }
 
 /************************************************************************/
@@ -1665,29 +1677,32 @@
 FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB) 
 :   ColorListBox(pParent, aWB)
 {
-	maVD.SetOutputSizePixel(Size(32, 16));
 }
 
 /************************************************************************/
 
-void FillAttrLB::SetVirtualDevice()
+void FillAttrLB::SetVirtualDevice(const Size& rSize)
 {
+	maVD.SetOutputSizePixel(rSize);
     maVD.Erase();
 
     if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8)
 	{
-		maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx);
+		maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx);
 	}
 	else
 	{
-		maVD.DrawBitmapEx(Point(0,  0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(8,  0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(16, 0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(24, 0), maBitmapEx);
-		maVD.DrawBitmapEx(Point(0,  8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(8,  8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(16, 8), maBitmapEx);
-		maVD.DrawBitmapEx(Point(24, 8), maBitmapEx);
+        const Size aBitmapSize(maBitmapEx.GetSizePixel());
+
+        for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height())
+        {
+            for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width())
+            {
+                maVD.DrawBitmapEx(
+                    Point(x, y),
+                    maBitmapEx);
+            }
+        }
 	}
 }
 
@@ -1704,8 +1719,12 @@
 	{
         pEntry = pList->GetBitmap( i );
 		maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-		SetVirtualDevice();
-		ListBox::InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)));
+        const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight());
+		SetVirtualDevice(aSize);
+		ListBox::InsertEntry(
+            pEntry->GetName(), 
+            maVD.GetBitmap(Point(0, 0), 
+            aSize));
 	}
 
     ListBox::SetUpdateMode(true);
@@ -1759,9 +1778,17 @@
 |*	Fuellt die Listbox (vorlaeufig) mit Strings
 |*
 \************************************************************************/
-
 void LineLB::Fill( const XDashList* pList )
 {
+	Clear();
+
+    // entry for 'none'
+    InsertEntry(pList->GetStringForUiNoLine());
+
+    // entry for solid line
+	InsertEntry(pList->GetStringForUiSolidLine(), pList->GetBitmapForUISolidLine());
+
+    // entries for dashed lines
 	long nCount = pList->Count();
 	XDashEntry* pEntry;
 	SetUpdateMode( sal_False );
@@ -1769,11 +1796,11 @@
 	for( long i = 0; i < nCount; i++ )
 	{
         pEntry = pList->GetDash( i );
-		Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i );
-		if( pBitmap )
+		const Bitmap aBitmap = const_cast< XDashList* >(pList)->GetUiBitmap( i );
+		if( !aBitmap.IsEmpty() )
 		{
-			InsertEntry( pEntry->GetName(), *pBitmap );
-			delete pBitmap;
+			InsertEntry( pEntry->GetName(), aBitmap );
+			//delete pBitmap;
 		}
 		else
 			InsertEntry( pEntry->GetName() );
@@ -1781,33 +1808,9 @@
 	SetUpdateMode( sal_True );
 }
 
-void LineLB::FillStyles()
-{
-	ResMgr& rMgr = DIALOG_MGR();
-
-	// Linienstile
-	Clear();
-	InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
-
-	const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
-	Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) );
-	Color aSourceColors[2];
-	Color aDestColors[2];
-
-	aSourceColors[0] = Color( COL_WHITE );
-	aSourceColors[1] = Color( COL_BLACK );
-
-	aDestColors[0] = rStyles.GetFieldColor();
-	aDestColors[1] = rStyles.GetFieldTextColor();
-
-	aBitmap.Replace ( aSourceColors, aDestColors, 2 );
-	Image aSolidLine ( aBitmap );
-	InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine );
-}
-
 /************************************************************************/
 
-void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp )
+void LineLB::Append( XDashEntry* pEntry, const Bitmap* pBmp )
 {
 	if( pBmp )
 		InsertEntry( pEntry->GetName(), *pBmp );
@@ -1817,7 +1820,7 @@
 
 /************************************************************************/
 
-void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp )
 {
 	RemoveEntry( nPos );
 
@@ -1858,6 +1861,20 @@
 |*	Fuellt die Listbox (vorlaeufig) mit Strings
 |*
 \************************************************************************/
+LineEndLB::LineEndLB( Window* pParent, ResId Id )
+    : ListBox( pParent, Id )
+{
+}
+
+LineEndLB::LineEndLB( Window* pParent, WinBits aWB )
+    : ListBox( pParent, aWB )
+{
+}
+
+LineEndLB::~LineEndLB(void)
+{
+}
+
 
 void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart )
 {
@@ -1869,17 +1886,16 @@
 	for( long i = 0; i < nCount; i++ )
 	{
         pEntry = pList->GetLineEnd( i );
-		Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i );
-		if( pBitmap )
+		const Bitmap aBitmap = const_cast< XLineEndList* >(pList)->GetUiBitmap( i );
+		if( !aBitmap.IsEmpty() )
 		{
-			Size aBmpSize( pBitmap->GetSizePixel() );
+			Size aBmpSize( aBitmap.GetSizePixel() );
 			aVD.SetOutputSizePixel( aBmpSize, sal_False );
-			aVD.DrawBitmap( Point(), *pBitmap );
+			aVD.DrawBitmap( Point(), aBitmap );
 			InsertEntry( pEntry->GetName(),
 				aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
 					Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
-
-			delete pBitmap;
+			//delete pBitmap;
 		}
 		else
 			InsertEntry( pEntry->GetName() );
@@ -1889,8 +1905,7 @@
 
 /************************************************************************/
 
-void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp,
-						sal_Bool bStart )
+void LineEndLB::Append( XLineEndEntry* pEntry, const Bitmap* pBmp, sal_Bool bStart )
 {
 	if( pBmp )
 	{
@@ -1909,8 +1924,7 @@
 
 /************************************************************************/
 
-void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp,
-						sal_Bool bStart )
+void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp, sal_Bool bStart )
 {
 	RemoveEntry( nPos );
 
diff --git a/main/svx/source/dialog/dlgutil.cxx b/main/svx/source/dialog/dlgutil.cxx
index d9941fb..6b6fad9 100644
--- a/main/svx/source/dialog/dlgutil.cxx
+++ b/main/svx/source/dialog/dlgutil.cxx
@@ -48,3 +48,12 @@
 	return eUnit;
 }
 
+// -----------------------------------------------------------------------
+
+FieldUnit GetModuleFieldUnit()
+{
+    return SfxModule::GetCurrentFieldUnit();
+}
+
+// -----------------------------------------------------------------------
+// eof
diff --git a/main/svx/source/dialog/fontwork.cxx b/main/svx/source/dialog/fontwork.cxx
index a79abc3..92ad153 100644
--- a/main/svx/source/dialog/fontwork.cxx
+++ b/main/svx/source/dialog/fontwork.cxx
@@ -966,7 +966,7 @@
 |*
 \************************************************************************/
 
-void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable)
+void SvxFontWorkDialog::SetColorTable(const XColorList* pTable)
 {
 	if ( pTable && pTable != pColorTable )
 	{
diff --git a/main/svx/source/dialog/sdstring.src b/main/svx/source/dialog/sdstring.src
index 605bae9..d62c3d3 100644
--- a/main/svx/source/dialog/sdstring.src
+++ b/main/svx/source/dialog/sdstring.src
@@ -45,7 +45,7 @@
 };
 String RID_SVXSTR_INVISIBLE
 {
-	Text [ en-US ] = "Invisible" ;
+	Text [ en-US ] = "None" ;
 };
 String RID_SVXSTR_COLOR
 {
diff --git a/main/svx/source/dialog/svxbmpnumvalueset.src b/main/svx/source/dialog/svxbmpnumvalueset.src
index 9a223d2..ae90c80 100644
--- a/main/svx/source/dialog/svxbmpnumvalueset.src
+++ b/main/svx/source/dialog/svxbmpnumvalueset.src
@@ -57,7 +57,8 @@
 };
 String RID_SVXSTR_SINGLENUM_DESCRIPTION_0
 {
-    Text [en-US] = "Number 1) 2) 3)";
+    //Text [en-US] = "Number 1) 2) 3)";
+    Text [en-US] = "Number %NUMBERINGSAMPLE";
 };
 String RID_SVXSTR_SINGLENUM_DESCRIPTION_1
 {
diff --git a/main/svx/source/gallery2/GalleryControl.cxx b/main/svx/source/gallery2/GalleryControl.cxx
new file mode 100644
index 0000000..31337c5
--- /dev/null
+++ b/main/svx/source/gallery2/GalleryControl.cxx
@@ -0,0 +1,302 @@
+/**************************************************************
+ * 
+ * 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 "sidebar/PanelFactory.hxx"
+
+#include "GalleryControl.hxx"
+
+#include "gallery.hrc"
+#include "svx/galmisc.hxx"
+#include "svx/gallery1.hxx"
+#include "galbrws1.hxx"
+#include "galbrws2.hxx"
+#include "GallerySplitter.hxx"
+#include <vcl/svapp.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+
+#include <boost/bind.hpp>
+
+namespace svx { namespace sidebar {
+
+static const sal_Int32 gnInitialVerticalSplitPosition (150);
+
+
+GalleryControl::GalleryControl (
+    SfxBindings* pBindings,
+    Window* pParentWindow)
+    : Window(pParentWindow, GAL_RESID(RID_SVXDLG_GALLERYBROWSER)),
+      mpGallery (Gallery::GetGalleryInstance()),
+      mpBrowser1(new GalleryBrowser1(
+              this,
+              GAL_RESID(GALLERY_BROWSER1),
+              mpGallery,
+              ::boost::bind(&GalleryControl::KeyInput,this,_1,_2),
+              ::boost::bind(&GalleryControl::ThemeSelectionHasChanged, this))),
+      mpSplitter(new GallerySplitter(
+              this,
+              GAL_RESID(GALLERY_SPLITTER),
+              ::boost::bind(&GalleryControl::InitSettings, this))),
+      mpBrowser2(new GalleryBrowser2(this, GAL_RESID(GALLERY_BROWSER2), mpGallery)),
+      maLastSize(GetOutputSizePixel()),
+      mbIsInitialResize(true)
+{
+    FreeResource();
+
+    mpBrowser1->SelectTheme(0);
+    mpBrowser1->Show(sal_True);
+
+    mpBrowser2->Show(sal_True);
+
+    mpSplitter->SetHorizontal(false);
+	mpSplitter->SetSplitHdl( LINK( this, GalleryControl, SplitHdl ) );
+	mpSplitter->Show( sal_True );
+
+    InitSettings();
+}
+
+
+
+
+GalleryControl::~GalleryControl (void)
+{
+}
+
+
+
+
+void GalleryControl::InitSettings (void)
+{
+	SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+	SetControlBackground( GALLERY_DLG_COLOR );
+	SetControlForeground( GALLERY_DLG_COLOR );
+
+	mpSplitter->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+	mpSplitter->SetControlBackground( GALLERY_DLG_COLOR );
+	mpSplitter->SetControlForeground( GALLERY_DLG_COLOR );
+
+	mpBrowser1->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+	mpBrowser1->SetControlBackground( GALLERY_DLG_COLOR );
+	mpBrowser1->SetControlForeground( GALLERY_DLG_COLOR );
+
+	mpBrowser2->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+	mpBrowser2->SetControlBackground( GALLERY_DLG_COLOR );
+	mpBrowser2->SetControlForeground( GALLERY_DLG_COLOR );
+
+    const Wallpaper aBackground (sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+	mpSplitter->SetBackground(aBackground);
+	SetBackground(aBackground);
+	mpBrowser2->SetBackground(aBackground);
+}
+
+
+
+
+void GalleryControl::Resize (void)
+{
+    // call parent
+    Window::Resize();
+
+    // update hor/ver
+    const Size aNewSize( GetOutputSizePixel() );
+    if (aNewSize.Width()<=0 || aNewSize.Height()<=0)
+        return;
+    
+    const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height());
+    const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal());
+    long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y());
+    const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height());
+
+    if(bNewLayoutHorizontal != bOldLayoutHorizontal)
+    {
+        mpSplitter->SetHorizontal(bNewLayoutHorizontal);
+    }
+    else
+    {
+        if (mbIsInitialResize)
+        {
+            nSplitPos = gnInitialVerticalSplitPosition;
+            if (nSplitPos > aNewSize.Height()/2)
+                nSplitPos = aNewSize.Height()/2;
+        }
+    }
+    mbIsInitialResize = false;
+
+    const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+    const long nFrameLen2 = nFrameLen << 1;
+
+    if(bNewLayoutHorizontal)
+    {
+        mpBrowser1->SetPosSizePixel( 
+            Point( nFrameLen, nFrameLen ),
+            Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) );
+
+        mpSplitter->SetPosSizePixel( 
+            Point( nSplitPos, 0),
+            Size( nSplitSize, aNewSize.Height() ) );
+
+        mpSplitter->SetDragRectPixel( 
+            Rectangle( 
+                Point( nFrameLen2, 0 ), 
+                Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) );
+
+        mpBrowser2->SetPosSizePixel( 
+            Point( nSplitPos + nSplitSize, nFrameLen ),
+            Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) );
+    }
+    else
+    {
+        mpBrowser1->SetPosSizePixel( 
+            Point( nFrameLen, nFrameLen ),
+            Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen));
+
+        mpSplitter->SetPosSizePixel( 
+            Point( 0, nSplitPos),
+            Size( aNewSize.Width(), nSplitSize ) );
+
+        mpSplitter->SetDragRectPixel( 
+            Rectangle( 
+                Point( 0, nFrameLen2 ), 
+                Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) ));
+
+        mpBrowser2->SetPosSizePixel( 
+            Point( nFrameLen, nSplitPos + nSplitSize ),
+            Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen ));
+    }
+
+    maLastSize = aNewSize;
+}
+
+
+
+
+sal_Bool GalleryControl::KeyInput( const KeyEvent& rKEvt, Window* )
+{
+    const sal_uInt16    nCode = rKEvt.GetKeyCode().GetCode();
+    sal_Bool            bRet = ( !rKEvt.GetKeyCode().IsMod1() &&
+                           ( ( KEY_TAB == nCode ) || ( KEY_F6 == nCode && rKEvt.GetKeyCode().IsMod2() ) ) );
+
+    if( bRet )
+    {
+        if( !rKEvt.GetKeyCode().IsShift() )
+        {
+            if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) )
+                mpBrowser2->GetViewWindow()->GrabFocus();
+            else if( mpBrowser2->GetViewWindow()->HasFocus() )
+                mpBrowser2->maViewBox.GrabFocus();
+            else if( mpBrowser2->maViewBox.HasFocus() )
+                mpBrowser1->maNewTheme.GrabFocus();
+            else
+                mpBrowser1->mpThemes->GrabFocus();
+        }
+        else
+        {
+            if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) )
+                mpBrowser1->maNewTheme.GrabFocus();
+            else if( mpBrowser1->maNewTheme.HasFocus() )
+                mpBrowser2->maViewBox.GrabFocus();
+            else if( mpBrowser2->maViewBox.HasFocus() )
+                mpBrowser2->GetViewWindow()->GrabFocus();
+            else
+                mpBrowser1->mpThemes->GrabFocus();
+        }
+    }
+
+    return bRet;
+}
+
+
+
+
+void GalleryControl::GetFocus (void)
+{
+	Window::GetFocus();
+	mpBrowser1->GrabFocus();
+}
+
+
+
+
+void GalleryControl::ThemeSelectionHasChanged (void)
+{
+	mpBrowser2->SelectTheme(mpBrowser1->GetSelectedTheme());
+}
+
+
+
+
+INetURLObject GalleryControl::GetURL (void) const
+{
+	return mpBrowser2->GetURL();
+}
+
+
+
+
+String GalleryControl::GetFilterName (void) const
+{
+	return mpBrowser2->GetFilterName();
+}
+
+
+
+
+Graphic GalleryControl::GetGraphic(void) const
+{
+	return mpBrowser2->GetGraphic();
+}
+
+
+
+
+sal_Bool GalleryControl::GetVCDrawModel( FmFormModel& rModel ) const
+{
+	return mpBrowser2->GetVCDrawModel( rModel );
+}
+
+
+
+
+sal_Bool GalleryControl::IsLinkage (void) const
+{
+	return mpBrowser2->IsLinkage();
+}
+
+
+
+
+IMPL_LINK( GalleryControl, SplitHdl, void*, EMPTYARG )
+{
+    if(mpSplitter->IsHorizontal())
+    {
+        mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
+    }
+    else
+    {
+        mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) );
+    }
+    
+    Resize();
+
+	return 0L;
+}
+
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/gallery2/GallerySplitter.cxx b/main/svx/source/gallery2/GallerySplitter.cxx
new file mode 100644
index 0000000..813108d
--- /dev/null
+++ b/main/svx/source/gallery2/GallerySplitter.cxx
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "GallerySplitter.hxx"
+
+
+DBG_NAME(GallerySplitter)
+
+GallerySplitter::GallerySplitter(
+    Window* pParent,
+    const ResId& rResId,
+    const ::boost::function<void(void)>& rDataChangeFunctor)
+    : Splitter( pParent, rResId ),
+      maDataChangeFunctor(rDataChangeFunctor)
+{
+    DBG_CTOR(GallerySplitter,NULL);
+}
+
+
+
+
+GallerySplitter::~GallerySplitter()
+{
+    DBG_DTOR(GallerySplitter,NULL);
+}
+
+
+
+
+void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt )
+{
+    Splitter::DataChanged( rDCEvt );
+    if (maDataChangeFunctor)
+        maDataChangeFunctor();
+}
diff --git a/main/svx/source/gallery2/GallerySplitter.hxx b/main/svx/source/gallery2/GallerySplitter.hxx
new file mode 100644
index 0000000..05426c2
--- /dev/null
+++ b/main/svx/source/gallery2/GallerySplitter.hxx
@@ -0,0 +1,45 @@
+/**************************************************************
+ * 
+ * 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 SVX_GALLERY_SPLITTER_HXX
+#define SVX_GALLERY_SPLITTER_HXX
+
+#include <vcl/split.hxx>
+#include <boost/function.hpp>
+
+class GallerySplitter : public Splitter
+{
+public:
+    GallerySplitter (
+        Window* pParent,
+        const ResId& rResId,
+        const ::boost::function<void(void)>& rDataChangeFunctor);
+    virtual ~GallerySplitter (void);
+
+protected:
+    virtual void    DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+    ::boost::function<void(void)> maDataChangeFunctor;
+};
+
+
+#endif
diff --git a/main/svx/source/gallery2/galbrws.cxx b/main/svx/source/gallery2/galbrws.cxx
index d611451..c5d6d64 100644
--- a/main/svx/source/gallery2/galbrws.cxx
+++ b/main/svx/source/gallery2/galbrws.cxx
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
@@ -35,48 +33,9 @@
 #include "galbrws1.hxx"
 #include "galbrws2.hxx"
 #include "svx/galbrws.hxx"
+#include "GallerySplitter.hxx"
 
-// -------------------
-// - GallerySplitter -
-// -------------------
-
-class GallerySplitter : public Splitter
-{
-protected:
-
-    virtual void    DataChanged( const DataChangedEvent& rDCEvt );
-
-public:
-
-                    GallerySplitter( Window* pParent, const ResId& rResId );
-    virtual         ~GallerySplitter();
-};
-
-// -----------------------------------------------------------------------------
-DBG_NAME(GallerySplitter)
-
-GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) :
-    Splitter( pParent, rResId )
-{
-    DBG_CTOR(GallerySplitter,NULL);
-
-}
-
-// -----------------------------------------------------------------------------
-
-GallerySplitter::~GallerySplitter()
-{
-
-    DBG_DTOR(GallerySplitter,NULL);
-}
-
-// -----------------------------------------------------------------------------
-
-void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt )
-{
-    Splitter::DataChanged( rDCEvt );
-    static_cast< GalleryBrowser* >( GetParent() )->InitSettings();
-}
+#include <boost/bind.hpp>
 
 // -------------------------
 // - SvxGalleryChildWindow -
@@ -110,24 +69,40 @@
 // ------------------
 DBG_NAME(GalleryBrowser)
 
-GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW,
-								Window* pParent, const ResId& rResId ) :
-	SfxDockingWindow( _pBindings, pCW, pParent, rResId )
+GalleryBrowser::GalleryBrowser(
+    SfxBindings* _pBindings, 
+    SfxChildWindow* pCW,
+    Window* pParent, 
+    const ResId& rResId) 
+:   SfxDockingWindow(_pBindings, pCW, pParent, rResId),
+    maLastSize(GetOutputSizePixel()),
+    mpSplitter(0),
+    mpBrowser1(0),
+    mpBrowser2(0),
+    mpGallery(0)
 {
     DBG_CTOR(GalleryBrowser,NULL);
 
 	mpGallery = Gallery::GetGalleryInstance();
-	mpBrowser1 = new GalleryBrowser1( this, GAL_RESID( GALLERY_BROWSER1 ), mpGallery );
-	mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ) );
+	mpBrowser1 = new GalleryBrowser1(
+        this,
+        GAL_RESID( GALLERY_BROWSER1 ),
+        mpGallery,
+        ::boost::bind(&GalleryBrowser::KeyInput,this,_1,_2),
+        ::boost::bind(&GalleryBrowser::ThemeSelectionHasChanged, this));
+	mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ),
+        ::boost::bind(&GalleryBrowser::InitSettings, this));
 	mpBrowser2 = new GalleryBrowser2( this, GAL_RESID( GALLERY_BROWSER2 ), mpGallery );
 
 	FreeResource();
-	SetMinOutputSizePixel( maLastSize = GetOutputSizePixel() );
+	SetMinOutputSizePixel(maLastSize);
 
 	mpBrowser1->SelectTheme( 0 );
 	mpBrowser1->Show( sal_True );
 	mpBrowser2->Show( sal_True );
 
+    const bool bLayoutHorizontal(maLastSize.Width() > maLastSize.Height());
+    mpSplitter->SetHorizontal(bLayoutHorizontal);
 	mpSplitter->SetSplitHdl( LINK( this, GalleryBrowser, SplitHdl ) );
 	mpSplitter->Show( sal_True );
 
@@ -170,25 +145,64 @@
 
 void GalleryBrowser::Resize()
 {
-	SfxDockingWindow::Resize();
+    // call parent
+    SfxDockingWindow::Resize();
 
-	const long	nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
-	const long	nFrameWidth2 = nFrameWidth << 1;
-	Size		aMinSize( GetMinOutputSizePixel() );
-	Size		aNewSize( GetOutputSizePixel() );
-	Point		aSplitPos( mpSplitter->GetPosPixel() );
-	const Size	aSplitSize( mpSplitter->GetOutputSizePixel() );
+    // update hor/ver
+    const Size aNewSize( GetOutputSizePixel() );
+    const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height());
+    const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal());
+    const long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y());
+    const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height());
 
-	mpBrowser1->SetPosSizePixel( Point( nFrameWidth, nFrameWidth ),
-								 Size( aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+    if(bNewLayoutHorizontal != bOldLayoutHorizontal)
+    {
+        mpSplitter->SetHorizontal(bNewLayoutHorizontal);
+    }
 
-	mpSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aNewSize.Height() ) );
-	mpSplitter->SetDragRectPixel( Rectangle( Point( nFrameWidth2, 0 ), Size( aNewSize.Width() - ( nFrameWidth2 << 1 ) - aSplitSize.Width(), aNewSize.Height() ) ) );
+    const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+    const long nFrameLen2 = nFrameLen << 1;
 
-	mpBrowser2->SetPosSizePixel( Point( aSplitPos.X() + aSplitSize.Width(), nFrameWidth ),
-								 Size( aNewSize.Width() - aSplitSize.Width() - aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+    if(bNewLayoutHorizontal)
+    {
+        mpBrowser1->SetPosSizePixel( 
+            Point( nFrameLen, nFrameLen ),
+            Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) );
 
-	maLastSize = aNewSize;
+        mpSplitter->SetPosSizePixel( 
+            Point( nSplitPos, 0),
+            Size( nSplitSize, aNewSize.Height() ) );
+
+        mpSplitter->SetDragRectPixel( 
+            Rectangle( 
+                Point( nFrameLen2, 0 ), 
+                Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) );
+
+        mpBrowser2->SetPosSizePixel( 
+            Point( nSplitPos + nSplitSize, nFrameLen ),
+            Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) );
+    }
+    else
+    {
+        mpBrowser1->SetPosSizePixel( 
+            Point( nFrameLen, nFrameLen ),
+            Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen));
+
+        mpSplitter->SetPosSizePixel( 
+            Point( 0, nSplitPos),
+            Size( aNewSize.Width(), nSplitSize ) );
+
+        mpSplitter->SetDragRectPixel( 
+            Rectangle( 
+                Point( 0, nFrameLen2 ), 
+                Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) ));
+
+        mpBrowser2->SetPosSizePixel( 
+            Point( nFrameLen, nSplitPos + nSplitSize ),
+            Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen ));
+    }
+
+    maLastSize = aNewSize;
 }
 
 // -----------------------------------------------------------------------------
@@ -289,8 +303,19 @@
 
 IMPL_LINK( GalleryBrowser, SplitHdl, void*, EMPTYARG )
 {
-	mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
-	Resize();
+    if(mpSplitter->IsHorizontal())
+    {
+        mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
+    }
+    else
+    {
+        mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) );
+    }
+    
+    Resize();
 
 	return 0L;
 }
+
+// -----------------------------------------------------------------------------
+// eof
diff --git a/main/svx/source/gallery2/galbrws1.cxx b/main/svx/source/gallery2/galbrws1.cxx
index 70e7982..2ead6c1 100644
--- a/main/svx/source/gallery2/galbrws1.cxx
+++ b/main/svx/source/gallery2/galbrws1.cxx
@@ -147,7 +147,13 @@
 // -------------------
 DBG_NAME(GalleryBrowser1)
 
-GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) :
+GalleryBrowser1::GalleryBrowser1(
+    Window* pParent,
+    const ResId& rResId,
+    Gallery* pGallery,
+    const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler,
+    const ::boost::function<void(void)>& rThemeSlectionHandler)
+    :
     Control               ( pParent, rResId ),
     maNewTheme            ( this, WB_3DLOOK ),
     mpThemes              ( new GalleryThemeListBox( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ),
@@ -157,7 +163,9 @@
     aImgNormal            ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ),
     aImgDefault           ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ),
     aImgReadOnly          ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ),
-    aImgImported          ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) )
+    aImgImported          ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) ),
+    maKeyInputHandler(rKeyInputHandler),
+    maThemeSlectionHandler(rThemeSlectionHandler)
 {
     DBG_CTOR(GalleryBrowser1,NULL);
 
@@ -591,7 +599,9 @@
 
 sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
 {
-    sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow );
+    sal_Bool bRet (sal_False);
+    if (maKeyInputHandler)
+        bRet = maKeyInputHandler(rKEvt, pWindow);
 
     if( !bRet )
     {
@@ -699,7 +709,8 @@
 
 IMPL_LINK( GalleryBrowser1, SelectThemeHdl, void*, EMPTYARG )
 {
-	( (GalleryBrowser*) GetParent() )->ThemeSelectionHasChanged();
+    if (maThemeSlectionHandler)
+        maThemeSlectionHandler();
 	return 0L;
 }
 
diff --git a/main/svx/source/gallery2/galbrws1.hxx b/main/svx/source/gallery2/galbrws1.hxx
index 0947b2f..1705457 100644
--- a/main/svx/source/gallery2/galbrws1.hxx
+++ b/main/svx/source/gallery2/galbrws1.hxx
@@ -28,6 +28,8 @@
 #include <vector>
 #include "svx/galbrws.hxx"
 
+#include <boost/function.hpp>
+
 // -----------------
 // - GalleryButton -
 // -----------------
@@ -74,9 +76,12 @@
 struct ExchangeData;
 class SfxItemSet;
 
+namespace svx { namespace sidebar { class GalleryControl; } }
+
 class GalleryBrowser1 : public Control, SfxListener
 {
 	friend class GalleryBrowser;
+	friend class svx::sidebar::GalleryControl;
 	friend class GalleryThemeListBox;
 	using Control::Notify;
 	using Window::KeyInput;
@@ -94,6 +99,9 @@
 	Image					aImgReadOnly;
 	Image					aImgImported;
 
+    ::boost::function<sal_Bool(const KeyEvent&,Window*)> maKeyInputHandler;
+    ::boost::function<void(void)> maThemeSlectionHandler;
+    
 	void					ImplAdjustControls();
 	sal_uIntPtr					ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
 	void					ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
@@ -119,8 +127,13 @@
 
 public:
 
-							GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
-							~GalleryBrowser1();
+							GalleryBrowser1(
+                                Window* pParent,
+                                const ResId& rResId,
+                                Gallery* pGallery,
+                                const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler,
+                                const ::boost::function<void(void)>& rThemeSlectionHandler);
+    						~GalleryBrowser1();
 
 	void					SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
 	void					SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
diff --git a/main/svx/source/gallery2/galbrws2.cxx b/main/svx/source/gallery2/galbrws2.cxx
index 5cd78e4..2397ad6 100644
--- a/main/svx/source/gallery2/galbrws2.cxx
+++ b/main/svx/source/gallery2/galbrws2.cxx
@@ -53,6 +53,7 @@
 #include <svx/dialmgr.hxx>
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
+#include "GalleryControl.hxx"
 
 // -----------
 // - Defines -
@@ -315,7 +316,7 @@
 // -------------------
 DBG_NAME(GalleryBrowser2)
 
-GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) :
+GalleryBrowser2::GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ) :
 	Control				( pParent, rResId ),
 	mpGallery			( pGallery ),
 	mpCurTheme			( NULL ),
@@ -331,7 +332,7 @@
 	mbCurActionIsLinkage( sal_False )
 {
     DBG_CTOR(GalleryBrowser2,NULL);
-
+    
     Image       aDummyImage;
     const Link  aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
     Font        aInfoFont( maInfoBar.GetControlFont() );
@@ -574,7 +575,16 @@
 {
     Point		aSelPos;
 	const sal_uIntPtr	nItemId = ImplGetSelectedItemId( NULL, aSelPos );
-    sal_Bool        bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow );
+    GalleryBrowser* pParentBrowser = dynamic_cast<GalleryBrowser*>(GetParent());
+    sal_Bool bRet = sal_False;
+    if (pParentBrowser != NULL)
+        bRet = pParentBrowser->KeyInput( rKEvt, pWindow );
+    else
+    {
+        svx::sidebar::GalleryControl* pParentControl = dynamic_cast<svx::sidebar::GalleryControl*>(GetParent());
+        if (pParentControl != NULL)
+            bRet = pParentControl->KeyInput(rKEvt, pWindow);
+    }
 
     if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme )
     {
diff --git a/main/svx/source/gallery2/gallery1.cxx b/main/svx/source/gallery2/gallery1.cxx
index c78c2a9..9a67804 100644
--- a/main/svx/source/gallery2/gallery1.cxx
+++ b/main/svx/source/gallery2/gallery1.cxx
@@ -77,7 +77,12 @@
 	SetModified( _bNewFile );
 
 	if( nId && bThemeNameFromResource )
-		aName = String( GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId ) );
+    {
+        const ResId aId (GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId));
+        if (aId.GetpResource() == NULL)
+            OSL_TRACE("");
+        aName = String(aId);
+    }
 
 	if( !aName.Len() )
 		aName = rName;
diff --git a/main/svx/source/inc/linectrl.hrc b/main/svx/source/inc/linectrl.hrc
deleted file mode 100644
index 9ca5d65..0000000
--- a/main/svx/source/inc/linectrl.hrc
+++ /dev/null
@@ -1,24 +0,0 @@
-/**************************************************************
- * 
- * 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.
- * 
- *************************************************************/
-
-
-#define RID_SVXCTRL_LINECTRL	257
-
diff --git a/main/svx/source/items/drawitem.cxx b/main/svx/source/items/drawitem.cxx
index 2b90c9d..5ec6167 100644
--- a/main/svx/source/items/drawitem.cxx
+++ b/main/svx/source/items/drawitem.cxx
@@ -55,7 +55,7 @@
 
 // -----------------------------------------------------------------------
 
-SvxColorTableItem::SvxColorTableItem( XColorTable* pTable, sal_uInt16 nW ) :
+SvxColorTableItem::SvxColorTableItem( XColorList* pTable, sal_uInt16 nW ) :
 	SfxPoolItem( nW ),
 	pColorTable( pTable )
 {
@@ -120,7 +120,7 @@
     sal_Int64 aValue = 0;
     if ( rVal >>= aValue )
     {
-        pColorTable = (XColorTable *)(sal_uLong)aValue;
+        pColorTable = (XColorList*)(sal_uLong)aValue;
         return sal_True;
     }
 
diff --git a/main/svx/source/items/svxitems.src b/main/svx/source/items/svxitems.src
index 53dafa9..f60428c 100644
--- a/main/svx/source/items/svxitems.src
+++ b/main/svx/source/items/svxitems.src
@@ -211,7 +211,12 @@
 {
 	Text [ en-US ] = "Image" ;
 };
- 
+// enum ColorName -----------------------------------------------------------
+String RID_SVXITEMS_COLOR_WHITE
+{
+	Text [ en-US ] = "White" ;
+};
+// end enum ColorName -----------------------------------------------------------
 String RID_SVXITEMS_HORJUST_STANDARD
 {
 	Text [ en-US ] = "Horizontal alignment default" ;
diff --git a/main/svx/source/sdr/attribute/sdrformtextattribute.cxx b/main/svx/source/sdr/attribute/sdrformtextattribute.cxx
index bcf6c16..2b47e24 100644
--- a/main/svx/source/sdr/attribute/sdrformtextattribute.cxx
+++ b/main/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -56,27 +56,27 @@
 
 namespace
 {
-	basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint)
+	basegfx::B2DLineJoin impGetB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)
 	{
 		switch(eLineJoint)
 		{
-			case XLINEJOINT_MIDDLE	: 
+			case com::sun::star::drawing::LineJoint_MIDDLE : 
 			{
 				return basegfx::B2DLINEJOIN_MIDDLE;	
 			}
-			case XLINEJOINT_BEVEL	: 
+			case com::sun::star::drawing::LineJoint_BEVEL : 
 			{
 				return basegfx::B2DLINEJOIN_BEVEL;	
 			}
-			case XLINEJOINT_MITER	: 
+			case com::sun::star::drawing::LineJoint_MITER : 
 			{
 				return basegfx::B2DLINEJOIN_MITER;	
 			}
-			case XLINEJOINT_ROUND	: 
+			case com::sun::star::drawing::LineJoint_ROUND : 
 			{
 				return basegfx::B2DLINEJOIN_ROUND;	
 			}
-			default : 
+			default : // com::sun::star::drawing::LineJoint_NONE
 			{
 				return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
 			}
@@ -115,7 +115,7 @@
 		}
 
 		const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
-		const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
+		const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue();
 		const com::sun::star::drawing::LineCap eLineCap = ((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue();
 
 		return drawinglayer::attribute::LineAttribute(
diff --git a/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 1bb96bf..67efa84 100644
--- a/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -137,29 +137,29 @@
 			}
 		}
 
-		basegfx::B2DLineJoin XLineJointtoB2DLineJoin(XLineJoint eLineJoint)
+		basegfx::B2DLineJoin LineJointToB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)
 		{
 			switch(eLineJoint)
 			{
-				case XLINEJOINT_MIDDLE : 
+				case com::sun::star::drawing::LineJoint_MIDDLE : 
 				{
 					return basegfx::B2DLINEJOIN_MIDDLE;
 				}
-				case XLINEJOINT_BEVEL : 
+				case com::sun::star::drawing::LineJoint_BEVEL : 
 				{
 					return basegfx::B2DLINEJOIN_BEVEL;
 				}
-				case XLINEJOINT_MITER : 
+				case com::sun::star::drawing::LineJoint_MITER : 
 				{
 					return basegfx::B2DLINEJOIN_MITER;	
 				}
-				case XLINEJOINT_ROUND : 
+				case com::sun::star::drawing::LineJoint_ROUND : 
 				{
 					return basegfx::B2DLINEJOIN_ROUND;	
 				}
-				default : 
+				default : // com::sun::star::drawing::LineJoint_NONE
 				{
-					return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE
+					return basegfx::B2DLINEJOIN_NONE;
 				}
 			}
 		}
@@ -238,7 +238,7 @@
 				{
 					const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue());
 					const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
-					const XLineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue());
+					const com::sun::star::drawing::LineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue());
 					const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue());
 					::std::vector< double > aDotDashArray;
 					double fFullDotDashLen(0.0);
@@ -254,7 +254,7 @@
 					}
 
 					return attribute::SdrLineAttribute(
-						XLineJointtoB2DLineJoin(eJoint),
+						LineJointToB2DLineJoin(eJoint),
 						(double)nWidth,
 						(double)nTransparence * 0.01,
 						aColor.getBColor(),
@@ -399,6 +399,26 @@
 
 				if(100 != nTransparence)
 				{
+                    // need to check XFillFloatTransparence, object fill may still be completely transparent
+                    const SfxPoolItem* pGradientItem;
+
+                    if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem) 
+                        && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
+                    {
+                        const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+                        const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
+                        const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
+                        const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+
+                        if(bCompletelyTransparent)
+                        {
+                            nTransparence = 100;
+                        }
+                    }
+                }
+
+				if(100 != nTransparence)
+				{
 					const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
 					attribute::FillGradientAttribute aGradient;
 					attribute::FillHatchAttribute aHatch;
@@ -569,8 +589,13 @@
 				const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
 				const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
 				const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+				const bool bNotTransparent(0x00 == nStartLuminance && 0x00 == nEndLuminance);
 
-				if(!bCompletelyTransparent)
+                // create nothing when completely transparent: This case is already checked for the
+                // normal fill attributes, XFILL_NONE will be used.
+                // create nothing when not transparent: use normal fill, no need t create a FillGradientAttribute.
+                // Both cases are optimizations, always creating FillGradientAttribute will work, too
+				if(!bNotTransparent && !bCompletelyTransparent)
 				{
 					const double fStartLum(nStartLuminance / 255.0);
 					const double fEndLum(nEndLuminance / 255.0);
diff --git a/main/svx/source/sidebar/ColorPanel.cxx b/main/svx/source/sidebar/ColorPanel.cxx
new file mode 100644
index 0000000..ffe59f3
--- /dev/null
+++ b/main/svx/source/sidebar/ColorPanel.cxx
@@ -0,0 +1,233 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "ColorPanel.hxx"
+
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+
+namespace svx { namespace sidebar {
+
+ColorPanel::ColorPanel (::Window* pParent)
+    : ValueSet(pParent),
+      mnPreferredColumnCount(2)
+{
+    WinBits aStyle = 
+        WB_ITEMBORDER 
+        | WB_DOUBLEBORDER 
+        | WB_NAMEFIELD 
+        | WB_FLATVALUESET
+        | WB_TABSTOP
+        | WB_VSCROLL;
+
+    SetStyle(GetStyle() | aStyle); 
+    SetExtraSpacing(2);
+
+    Fill ();
+    Show();
+}
+
+
+
+
+ColorPanel::~ColorPanel (void)
+{
+}
+
+
+
+
+sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth)
+{
+    sal_Int32 nPreferredHeight = 0;
+    if (GetItemCount()>0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        if (nWidth>0 && aItemSize.Width()>0)
+        {
+            int nColumnCount = nWidth / aItemSize.Width();
+            if (nColumnCount <= 0)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+            int nRowCount = (GetItemCount() + nColumnCount-1) 
+                / nColumnCount;
+            nPreferredHeight = nRowCount * aItemSize.Height();
+        }
+    }
+    return nPreferredHeight;
+}
+
+
+
+
+void ColorPanel::Resize (void)
+{
+    ::Window::Resize();
+    Size aWindowSize = GetOutputSizePixel();
+    SetPosSizePixel(Point(0,0), aWindowSize);
+    if (IsVisible() && aWindowSize.Width() > 0)
+    {
+        // Calculate the number of rows and columns.
+        if (GetItemCount() > 0)
+        {
+            Image aImage = GetItemImage(GetItemId(0));
+            Size aItemSize = CalcItemSizePixel (
+                aImage.GetSizePixel());
+            int nColumnCount = aWindowSize.Width() / 30;
+            if (nColumnCount < 1)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+
+            sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount);
+            
+            SetColCount((sal_uInt16)nColumnCount);
+            SetLineCount(nRowCount);
+        }
+    }
+
+}
+
+
+
+
+int ColorPanel::CalculateRowCount (const Size&, int nColumnCount)
+{
+    int nRowCount = 0;
+
+    if (GetItemCount()>0 && nColumnCount>0)
+    {
+        nRowCount = GetOutputSizePixel().Height() / 30;
+        if (nRowCount < 1)
+            nRowCount = 1;
+    }
+
+    return nRowCount;
+}
+
+
+
+
+void ColorPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+    Fill();
+}
+
+
+
+
+void ColorPanel::Fill (void)
+{
+    const StyleSettings& rSettings (
+        Application::GetSettings().GetStyleSettings());
+    Clear();
+    SetItemWidth (30);
+    SetItemHeight (30);
+    sal_uInt16 i = 0;
+    InsertItem (++i, rSettings.GetFaceColor());
+    SetItemText (i, String::CreateFromAscii("FaceColor"));
+    InsertItem (++i, rSettings.GetCheckedColor());
+    SetItemText (i, String::CreateFromAscii("CheckedColor"));
+    InsertItem (++i, rSettings.GetLightColor());
+    SetItemText (i, String::CreateFromAscii("LightColor"));
+    InsertItem (++i, rSettings.GetLightBorderColor());
+    SetItemText (i, String::CreateFromAscii("LightBorderColor"));
+    InsertItem (++i, rSettings.GetShadowColor());
+    SetItemText (i, String::CreateFromAscii("ShadowColor"));
+    InsertItem (++i, rSettings.GetDarkShadowColor());
+    SetItemText (i, String::CreateFromAscii("DarkShadowColor"));
+    InsertItem (++i, rSettings.GetButtonTextColor());
+    SetItemText (i, String::CreateFromAscii("ButtonTextColor"));
+    InsertItem (++i, rSettings.GetRadioCheckTextColor());
+    SetItemText (i, String::CreateFromAscii("RadioCheckTextColor"));
+    InsertItem (++i, rSettings.GetGroupTextColor());
+    SetItemText (i, String::CreateFromAscii("GroupTextColor"));
+    InsertItem (++i, rSettings.GetLabelTextColor());
+    SetItemText (i, String::CreateFromAscii("LabelTextColor"));
+    InsertItem (++i, rSettings.GetInfoTextColor());
+    SetItemText (i, String::CreateFromAscii("InfoTextColor"));
+    InsertItem (++i, rSettings.GetWindowColor());
+    SetItemText (i, String::CreateFromAscii("WindowColor"));
+    InsertItem (++i, rSettings.GetWindowTextColor());
+    SetItemText (i, String::CreateFromAscii("WindowTextColor"));
+    InsertItem (++i, rSettings.GetDialogColor());
+    SetItemText (i, String::CreateFromAscii("DialogColor"));
+    InsertItem (++i, rSettings.GetDialogTextColor());
+    SetItemText (i, String::CreateFromAscii("DialogTextColor"));
+    InsertItem (++i, rSettings.GetWorkspaceColor());
+    SetItemText (i, String::CreateFromAscii("WorkspaceColor"));
+    InsertItem (++i, rSettings.GetFieldColor());
+    SetItemText (i, String::CreateFromAscii("FieldColor"));
+    InsertItem (++i, rSettings.GetFieldTextColor());
+    SetItemText (i, String::CreateFromAscii("FieldTextColor"));
+    InsertItem (++i, rSettings.GetActiveColor());
+    SetItemText (i, String::CreateFromAscii("ActiveColor"));
+    InsertItem (++i, rSettings.GetActiveColor2());
+    SetItemText (i, String::CreateFromAscii("ActiveColor2"));
+    InsertItem (++i, rSettings.GetActiveTextColor());
+    SetItemText (i, String::CreateFromAscii("ActiveTextColor"));
+    InsertItem (++i, rSettings.GetActiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("ActiveBorderColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor2());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor2"));
+    InsertItem (++i, rSettings.GetDeactiveTextColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveTextColor"));
+    InsertItem (++i, rSettings.GetDeactiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveBorderColor"));
+    InsertItem (++i, rSettings.GetHighlightColor());
+    SetItemText (i, String::CreateFromAscii("HighlightColor"));
+    InsertItem (++i, rSettings.GetHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("HighlightTextColor"));
+    InsertItem (++i, rSettings.GetDisableColor());
+    SetItemText (i, String::CreateFromAscii("DisableColor"));
+    InsertItem (++i, rSettings.GetHelpColor());
+    SetItemText (i, String::CreateFromAscii("HelpColor"));
+    InsertItem (++i, rSettings.GetHelpTextColor());
+    SetItemText (i, String::CreateFromAscii("HelpTextColor"));
+    InsertItem (++i, rSettings.GetMenuColor());
+    SetItemText (i, String::CreateFromAscii("MenuColor"));
+    InsertItem (++i, rSettings.GetMenuBarColor());
+    SetItemText (i, String::CreateFromAscii("MenuBarColor"));
+    InsertItem (++i, rSettings.GetMenuBorderColor());
+    SetItemText (i, String::CreateFromAscii("MenuBorderColor"));
+    InsertItem (++i, rSettings.GetMenuTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuTextColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor"));
+    InsertItem (++i, rSettings.GetLinkColor());
+    SetItemText (i, String::CreateFromAscii("LinkColor"));
+    InsertItem (++i, rSettings.GetVisitedLinkColor());
+    SetItemText (i, String::CreateFromAscii("VisitedLinkColor"));
+    InsertItem (++i, rSettings.GetHighlightLinkColor());
+    SetItemText (i, String::CreateFromAscii("HighlightLinkColor"));
+    InsertItem (++i, rSettings.GetFontColor());
+    SetItemText (i, String::CreateFromAscii("FontColor"));
+}
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/ColorPanel.hxx b/main/svx/source/sidebar/ColorPanel.hxx
new file mode 100644
index 0000000..7fd05c5
--- /dev/null
+++ b/main/svx/source/sidebar/ColorPanel.hxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_COLOR_PANEL_HXX
+#define SVX_SIDEBAR_COLOR_PANEL_HXX
+
+#include <svtools/valueset.hxx>
+#include <vcl/window.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** This demo panel shows the colors that are available from the
+    StyleSettings.
+*/
+class ColorPanel
+    : public ValueSet
+{
+public:
+    ColorPanel (::Window* pParent);
+    virtual ~ColorPanel (void);
+
+    // From ::Window
+    virtual void Resize (void);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+    int mnPreferredColumnCount;
+
+    /** Depending on the given number of columns and the item size
+        calculate the number of rows that are necessary to display all
+        items.
+    */
+    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+    void Fill (void);
+
+    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
new file mode 100644
index 0000000..fa56a0b
--- /dev/null
+++ b/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
@@ -0,0 +1,91 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
+
+#include <com/sun/star/ui/ContextChangeEventObject.hpp>
+#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <sfx2/viewsh.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace css;
+using namespace cssu;
+
+
+void ContextChangeEventMultiplexer::NotifyContextChange (
+    const cssu::Reference<css::frame::XController>& rxController,
+    const ::sfx2::sidebar::EnumContext::Context eContext)
+{
+    if (rxController.is() && rxController->getFrame().is())
+    {
+        const css::ui::ContextChangeEventObject aEvent(
+            rxController,
+            GetModuleName(rxController->getFrame()),
+            ::sfx2::sidebar::EnumContext::GetContextName(eContext));
+    
+        cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
+            css::ui::ContextChangeEventMultiplexer::get(
+                ::comphelper::getProcessComponentContext()));
+        if (xMultiplexer.is())
+            xMultiplexer->broadcastContextChangeEvent(aEvent, rxController);
+    }
+}
+
+
+
+
+void ContextChangeEventMultiplexer::NotifyContextChange (
+    SfxViewShell* pViewShell,
+    const ::sfx2::sidebar::EnumContext::Context eContext)
+{
+    if (pViewShell != NULL)
+        NotifyContextChange(pViewShell->GetController(), eContext);    
+}
+
+
+
+
+::rtl::OUString ContextChangeEventMultiplexer::GetModuleName (
+    const cssu::Reference<css::frame::XFrame>& rxFrame)
+{
+    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&)
+    {
+        // An exception typically means that a context change is notified
+        // during initialization or destruction of a view.
+        // Ignore it.
+    }
+    return ::sfx2::sidebar::EnumContext::GetApplicationName(
+        ::sfx2::sidebar::EnumContext::Application_None);
+}
diff --git a/main/svx/source/sidebar/EmptyPanel.cxx b/main/svx/source/sidebar/EmptyPanel.cxx
new file mode 100644
index 0000000..d283a17
--- /dev/null
+++ b/main/svx/source/sidebar/EmptyPanel.cxx
@@ -0,0 +1,80 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "EmptyPanel.hxx"
+#include "EmptyPanel.hrc"
+#include "area/AreaPropertyPanel.hrc"
+#include "svx/dialogs.hrc"
+#include "svx/dialmgr.hxx"
+
+
+namespace svx { namespace sidebar {
+
+namespace
+{
+    class SidebarResource : public Resource
+    {
+    public:
+        SidebarResource (const ResId& rResId) : Resource(rResId) {}
+        ~SidebarResource (void) { FreeResource(); }
+    };
+}
+
+
+
+
+EmptyPanel::EmptyPanel (::Window* pParent)
+    : Control(pParent, SVX_RES(RID_SIDEBAR_EMPTY_PANEL)),
+      maMessageControl(this, SVX_RES(FT_MESSAGE))
+{
+    maMessageControl.SetPosSizePixel(5,5, 250,15);
+    maMessageControl.SetStyle(WB_WORDBREAK);// | WB_NOMNEMONICS);
+    //maMessageControl.GetStyle()
+    //        & ~(WB_NOMULTILINE | WB_PATHELLIPSIS)
+    //        | WB_WORDBREAK | WB_NOMNEMONICS);
+    FreeResource();
+
+    SetBackground(Wallpaper());
+    
+    maMessageControl.Show();
+    Show();
+}
+
+
+
+
+EmptyPanel::~EmptyPanel (void)
+{
+}
+
+
+
+
+void EmptyPanel::Resize (void)
+{
+    const Size aSize (GetSizePixel());
+    maMessageControl.SetSizePixel(aSize);
+}
+
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/EmptyPanel.hrc b/main/svx/source/sidebar/EmptyPanel.hrc
new file mode 100644
index 0000000..32f7751
--- /dev/null
+++ b/main/svx/source/sidebar/EmptyPanel.hrc
@@ -0,0 +1,26 @@
+/**************************************************************
+ * 
+ * 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 <svx/dialogs.hrc>
+
+// For RID_SIDEBAR_EMPTY_PANEL
+
+#define FT_MESSAGE 1
diff --git a/main/svx/source/sidebar/EmptyPanel.hxx b/main/svx/source/sidebar/EmptyPanel.hxx
new file mode 100644
index 0000000..8215afb
--- /dev/null
+++ b/main/svx/source/sidebar/EmptyPanel.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX
+#define SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/fixed.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** Display a panel that tells the user that the current deck is
+    intentionally empty.
+*/
+class EmptyPanel
+    : public Control
+{
+public:
+    EmptyPanel (::Window* pParent);
+    virtual ~EmptyPanel (void);
+
+    virtual void Resize (void);
+
+private:
+    FixedText maMessageControl;
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/EmptyPanel.src b/main/svx/source/sidebar/EmptyPanel.src
new file mode 100644
index 0000000..9977fdf
--- /dev/null
+++ b/main/svx/source/sidebar/EmptyPanel.src
@@ -0,0 +1,33 @@
+/**************************************************************
+ * 
+ * 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 "EmptyPanel.hrc"
+#include <svx/dialogs.hrc>
+
+Control RID_SIDEBAR_EMPTY_PANEL
+{
+    FixedText FT_MESSAGE
+	{
+        Pos = MAP_APPFONT(2,2);
+        Size = MAP_APPFONT(100,24);
+		Text [en-US] = "Properties for the task that you are performing are not available in the sidebar at this time.";
+	};
+};
diff --git a/main/svx/source/sidebar/PanelFactory.cxx b/main/svx/source/sidebar/PanelFactory.cxx
new file mode 100644
index 0000000..dfca7cc
--- /dev/null
+++ b/main/svx/source/sidebar/PanelFactory.cxx
@@ -0,0 +1,209 @@
+/**************************************************************
+ * 
+ * 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 "sidebar/PanelFactory.hxx"
+
+#include "text/TextPropertyPanel.hxx"
+#include "paragraph/ParaPropertyPanel.hxx"
+#include "area/AreaPropertyPanel.hxx"
+#include "graphic/GraphicPropertyPanel.hxx"
+#include "line/LinePropertyPanel.hxx"
+#include "possize/PosSizePropertyPanel.hxx"
+#include "GalleryControl.hxx"
+#include "debug/ColorPanel.hxx"
+#include "debug/ContextPanel.hxx"
+#include "debug/NotYetImplementedPanel.hxx"
+#include "EmptyPanel.hxx"
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/templdlg.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <rtl/ref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <boost/bind.hpp>
+
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+namespace svx { namespace sidebar {
+
+#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory"
+#define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
+
+
+::rtl::OUString SAL_CALL PanelFactory::getImplementationName (void)
+{
+    return A2S(IMPLEMENTATION_NAME);
+}
+
+
+
+
+cssu::Reference<cssu::XInterface> SAL_CALL PanelFactory::createInstance (
+    const uno::Reference<lang::XMultiServiceFactory>& rxFactory)
+{
+    (void)rxFactory;
+    
+    ::rtl::Reference<PanelFactory> pPanelFactory (new PanelFactory());
+    cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY);
+    return xService;
+}
+
+
+
+
+cssu::Sequence<OUString> SAL_CALL PanelFactory::getSupportedServiceNames (void)
+{
+    cssu::Sequence<OUString> aServiceNames (1);
+    aServiceNames[0] = A2S(SERVICE_NAME);
+    return aServiceNames;
+
+}
+
+
+
+
+PanelFactory::PanelFactory (void)
+    : PanelFactoryInterfaceBase(m_aMutex)
+{
+}
+
+
+
+
+PanelFactory::~PanelFactory (void)
+{
+}
+
+
+
+
+Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
+    const ::rtl::OUString& rsResourceURL,
+    const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        container::NoSuchElementException,
+        lang::IllegalArgumentException,
+        RuntimeException)
+{
+    const ::comphelper::NamedValueCollection aArguments (rArguments);
+    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+    Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
+    const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( ! xParentWindow.is() || pParentWindow==NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without ParentWindow"),
+            NULL);
+    if ( ! xFrame.is())
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without Frame"),
+            NULL);
+    if (pBindings == NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without SfxBindings"),
+            NULL);
+
+    Window* pControl = NULL;
+    ui::LayoutSize aLayoutSize (-1,-1,-1);
+
+#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
+    if (DoesResourceEndWith("/TextPropertyPanel"))
+    {
+        pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
+    }
+    else if (DoesResourceEndWith("/ParaPropertyPanel"))
+    {
+        pControl = ParaPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
+    }
+    else if (DoesResourceEndWith("/AreaPropertyPanel"))
+    {
+        pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings);
+    }
+    else if (DoesResourceEndWith("/GraphicPropertyPanel"))
+    {
+        pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings);
+    }
+    else if (DoesResourceEndWith("/LinePropertyPanel"))
+    {
+        pControl = LinePropertyPanel::Create(pParentWindow, xFrame, pBindings);
+    }
+    else if (DoesResourceEndWith("/PosSizePropertyPanel"))
+    {
+        pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
+    }
+    else if (DoesResourceEndWith("/GalleryPanel"))
+    {
+        pControl = new GalleryControl(pBindings, pParentWindow);
+        aLayoutSize = ui::LayoutSize(300,-1,400);
+    }
+    else if (DoesResourceEndWith("/StyleListPanel"))
+    {
+        pControl = new SfxTemplatePanelControl(pBindings, pParentWindow);
+        aLayoutSize = ui::LayoutSize(0,-1,-1);
+    }
+    else if (DoesResourceEndWith("/Debug_ColorPanel"))
+    {
+        pControl = new ColorPanel(pParentWindow);
+        aLayoutSize = ui::LayoutSize(300,-1,400);
+    }
+    else if (DoesResourceEndWith("/Debug_ContextPanel"))
+    {
+        pControl = new ContextPanel(pParentWindow);
+        aLayoutSize = ui::LayoutSize(45,45,45);
+    }
+    else if (DoesResourceEndWith("/Debug_NotYetImplementedPanel"))
+    {
+        pControl = new NotYetImplementedPanel(pParentWindow);
+        aLayoutSize = ui::LayoutSize(20,25,25);
+    }
+    else if (DoesResourceEndWith("/EmptyPanel"))
+    {
+        pControl = new EmptyPanel(pParentWindow);
+        aLayoutSize = ui::LayoutSize(20,-1, 50);
+    }
+#undef DoesResourceEndWith
+
+    if (pControl != NULL)
+    {
+        return sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pControl,
+            aLayoutSize);
+    }
+    else
+        return Reference<ui::XUIElement>();
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/SelectionAnalyzer.cxx b/main/svx/source/sidebar/SelectionAnalyzer.cxx
new file mode 100644
index 0000000..0de82e5
--- /dev/null
+++ b/main/svx/source/sidebar/SelectionAnalyzer.cxx
@@ -0,0 +1,461 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "svx/sidebar/SelectionAnalyzer.hxx"
+#include "svx/svdmrkv.hxx"
+#include "svx/svdobj.hxx"
+#include "svx/svdpage.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/globl3d.hxx"
+
+using sfx2::sidebar::EnumContext;
+
+
+namespace svx { namespace sidebar {
+
+EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMarkList& rMarkList)
+{
+    EnumContext::Context eContext = EnumContext::Context_Unknown;
+
+    switch (rMarkList.GetMarkCount())
+    {
+        case 0:
+            // Empty selection.  Return Context_Unknown to let the caller
+            // substitute it with the default context.
+            break;
+
+        case 1:
+        {
+            SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+            const sal_uInt32 nInv = pObj->GetObjInventor();
+            const sal_uInt16 nObjId = pObj->GetObjIdentifier();
+            if (nInv == SdrInventor)
+                eContext = GetContextForObjectId_SC(nObjId);
+            else if (nInv == FmFormInventor)
+                eContext = EnumContext::Context_Form;
+            break;
+        }
+        
+        default:
+        {
+            // Multi selection.
+            switch (GetInventorTypeFromMark(rMarkList))
+            {
+                case SdrInventor:
+                {
+                    const sal_uInt16 nObjId (GetObjectTypeFromMark(rMarkList));
+                    if (nObjId == 0)
+                        eContext = EnumContext::Context_MultiObject;
+                    else
+                        eContext = GetContextForObjectId_SC(nObjId);
+                    break;
+                }
+
+                case FmFormInventor:
+                    eContext = EnumContext::Context_Form;
+                    break;
+
+                case 0:
+                    eContext = EnumContext::Context_MultiObject;
+                    break;
+            }
+        }
+    }
+
+    return eContext;
+}
+
+
+
+
+EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD (
+    const SdrMarkList& rMarkList,
+    const bool bIsMasterPage,
+    const bool bIsHandoutPage,
+    const bool bIsNotesPage)
+{
+    EnumContext::Context eContext = EnumContext::Context_Unknown;
+
+    // Note that some cases are handled by the caller.  They rely on
+    // sd specific data.
+    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;
+            break;
+            
+        case 1:
+        {
+            SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+            const sal_uInt32 nInv = pObj->GetObjInventor();
+            sal_uInt16 nObjId = pObj->GetObjIdentifier();
+            if (nInv == SdrInventor)
+            {
+                if (nObjId == OBJ_GRUP)
+                {
+                    nObjId = GetObjectTypeFromGroup(pObj);
+                    if (nObjId == 0)
+                        nObjId = OBJ_GRUP;
+                }
+                eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage);
+            }
+            else if (nInv == E3dInventor)
+            {
+                eContext = EnumContext::Context_3DObject;
+            }
+            else if (nInv == FmFormInventor)
+            {
+                eContext = EnumContext::Context_Form;
+            }
+            break;
+        }
+        
+        default:
+        {
+            switch (GetInventorTypeFromMark(rMarkList))
+            {
+                case SdrInventor:
+                {
+                    const sal_uInt16 nObjId = GetObjectTypeFromMark(rMarkList);
+                    if (nObjId == 0)
+                        eContext = EnumContext::Context_MultiObject;
+                    else
+                        eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage);
+                    break;
+                }
+                
+                case E3dInventor:
+                    eContext = EnumContext::Context_3DObject;
+                    break;
+
+                case FmFormInventor:
+                    eContext = EnumContext::Context_Form;
+                    break;
+
+                case 0:
+                    eContext = EnumContext::Context_MultiObject;
+                    break;
+            }
+            break;
+        }
+    }
+
+	return eContext;
+}
+
+
+
+
+EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt16 nObjectId)
+{
+    switch (nObjectId)
+    {
+        case OBJ_CAPTION:
+        case OBJ_TITLETEXT:
+        case OBJ_OUTLINETEXT:
+        case OBJ_TEXT:
+        case OBJ_TEXTEXT:
+        case OBJ_PATHLINE:
+        case OBJ_PLIN:
+        case OBJ_FREELINE:
+        case OBJ_EDGE:
+        case OBJ_LINE:
+        case OBJ_MEASURE:
+        case OBJ_RECT:
+        case OBJ_CIRC:
+        case OBJ_FREEFILL:
+        case OBJ_PATHFILL:
+        case OBJ_POLY:
+        case OBJ_SECT:
+        case OBJ_CARC:
+        case OBJ_CCUT:
+        case OBJ_CUSTOMSHAPE:
+        case OBJ_GRUP:
+            return EnumContext::Context_Draw;
+            
+        case OBJ_GRAF:
+            return EnumContext::Context_Graphic;
+            
+        case OBJ_OLE2:
+            return EnumContext::Context_OLE;
+
+        case OBJ_MEDIA:
+            return EnumContext::Context_Media;
+            break;
+
+        default:
+            return EnumContext::Context_Unknown;
+    }
+}
+
+
+
+
+EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD (
+    const sal_uInt16 nObjectId,
+    const bool bIsHandoutPage,
+    const bool bIsNotesPage)
+{
+	switch (nObjectId)
+	{
+		case OBJ_CAPTION:		
+		case OBJ_PATHLINE:
+		case OBJ_PLIN:
+		case OBJ_FREELINE:
+		case OBJ_EDGE:
+		case OBJ_LINE:
+		case OBJ_MEASURE:
+		case OBJ_RECT:
+		case OBJ_CIRC:
+		case OBJ_FREEFILL:
+		case OBJ_PATHFILL:
+		case OBJ_POLY:
+		case OBJ_SECT:
+		case OBJ_CARC:
+		case OBJ_CCUT:
+		case OBJ_CUSTOMSHAPE:
+		case OBJ_GRUP:
+			return EnumContext::Context_Draw;
+
+		case OBJ_TITLETEXT:
+		case OBJ_OUTLINETEXT:
+		case OBJ_TEXT:
+		case OBJ_TEXTEXT:
+			return EnumContext::Context_TextObject;
+
+		case OBJ_GRAF:
+			return EnumContext::Context_Graphic;
+
+		case OBJ_OLE2:
+			return EnumContext::Context_OLE;
+
+		case OBJ_MEDIA:
+			return EnumContext::Context_Media;
+
+		case OBJ_TABLE:
+			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;
+
+        default:
+            return EnumContext::Context_Unknown;
+	}
+}
+
+
+
+
+sal_uInt32 SelectionAnalyzer::GetInventorTypeFromMark (const SdrMarkList& rMarkList)
+{
+    const sal_uLong nMarkCount (rMarkList.GetMarkCount());
+    
+    if (nMarkCount < 1)
+        return 0;
+
+    SdrMark* pMark = rMarkList.GetMark(0);
+    SdrObject* pObj = pMark->GetMarkedSdrObj();
+    const sal_uInt32 nFirstInv = pObj->GetObjInventor();
+        
+    for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex)
+    {
+        pMark = rMarkList.GetMark(nIndex);
+        pObj = pMark->GetMarkedSdrObj();
+        const sal_uInt32 nInv (pObj->GetObjInventor());
+        
+        if (nInv != nFirstInv)
+            return 0;
+    }
+
+    return nFirstInv;
+}
+
+
+
+
+sal_uInt16 SelectionAnalyzer::GetObjectTypeFromGroup (const SdrObject* pObj)
+{
+    SdrObjList* pObjList = pObj->GetSubList();
+    if (pObjList)
+    {
+        const sal_uLong nSubObjCount (pObjList->GetObjCount());
+        
+        if (nSubObjCount>0)
+        {
+            SdrObject* pObj = pObjList->GetObj(0);
+            sal_uInt16 nResultType = pObj->GetObjIdentifier();
+
+            if (nResultType == OBJ_GRUP)
+                nResultType = GetObjectTypeFromGroup(pObj);
+
+            if (IsShapeType(nResultType))
+                nResultType = OBJ_CUSTOMSHAPE;
+
+            if (IsTextObjType(nResultType))
+                nResultType = OBJ_TEXT;
+
+            for (sal_uInt16 nIndex=1; nIndex<nSubObjCount; ++nIndex)
+            {
+                pObj = pObjList->GetObj(nIndex);
+                sal_uInt16 nType (pObj->GetObjIdentifier());
+
+                if(nType == OBJ_GRUP)
+                    nType = GetObjectTypeFromGroup(pObj);
+
+                if (IsShapeType(nType))
+                    nType = OBJ_CUSTOMSHAPE;
+
+                if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT))
+                    nType = OBJ_TEXT;
+
+                if (IsTextObjType(nType))
+                    nType = OBJ_TEXT;
+
+                if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE))
+                    nResultType = OBJ_TEXT;
+                
+                if (nType != nResultType)
+                    return 0;
+            }
+
+            return nResultType;      
+        }
+    }
+    
+    return 0;
+}
+
+
+
+
+sal_uInt16  SelectionAnalyzer::GetObjectTypeFromMark (const SdrMarkList& rMarkList)
+{
+    const sal_uLong nMarkCount (rMarkList.GetMarkCount());
+    
+    if (nMarkCount < 1)
+        return 0;
+
+    SdrMark* pMark = rMarkList.GetMark(0);
+    SdrObject* pObj = pMark->GetMarkedSdrObj();
+    sal_uInt16 nResultType = pObj->GetObjIdentifier();
+    
+    if(nResultType == OBJ_GRUP)
+        nResultType = GetObjectTypeFromGroup(pObj);
+
+    if (IsShapeType(nResultType))
+        nResultType = OBJ_CUSTOMSHAPE;
+
+    if (IsTextObjType(nResultType))
+        nResultType = OBJ_TEXT;
+    
+    for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex)
+    {
+        pMark = rMarkList.GetMark(nIndex);
+        pObj = pMark->GetMarkedSdrObj();
+        sal_uInt16 nType = pObj->GetObjIdentifier();
+        
+        if(nType == OBJ_GRUP)
+            nType = GetObjectTypeFromGroup(pObj);
+
+        if (IsShapeType(nType))
+            nType = OBJ_CUSTOMSHAPE;
+
+        if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT))
+            nType = OBJ_TEXT;
+
+        if (IsTextObjType(nType))
+            nType = OBJ_TEXT;
+
+        if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE))
+            nResultType = OBJ_TEXT;
+
+        if (nType != nResultType)
+            return 0;
+    }
+        
+    return nResultType;
+}
+
+
+
+
+bool SelectionAnalyzer::IsShapeType (const sal_uInt16 nType)
+{
+	switch (nType)
+    {
+		case OBJ_LINE:
+		case OBJ_CARC:
+		case OBJ_PLIN:
+		case OBJ_PATHLINE:
+		case OBJ_RECT:
+		case OBJ_CIRC:
+		case OBJ_SECT: 
+		case OBJ_CCUT:
+		case OBJ_PATHFILL:
+		case OBJ_CUSTOMSHAPE:		
+		case OBJ_CAPTION:
+		case OBJ_MEASURE:
+		case OBJ_EDGE:   
+		case OBJ_POLY:
+		case OBJ_FREELINE:
+		case OBJ_FREEFILL:
+			return true;
+
+		default:
+            return false;
+	}
+}
+
+
+
+
+bool SelectionAnalyzer::IsTextObjType (const sal_uInt16 nType)
+{
+	switch(nType)
+    {
+		case OBJ_TEXT:
+		case OBJ_TEXTEXT:
+		case OBJ_TITLETEXT:
+		case OBJ_OUTLINETEXT:		
+			return true;
+            
+		default:
+            return false;
+	}
+}
+
+
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/SelectionChangeHandler.cxx b/main/svx/source/sidebar/SelectionChangeHandler.cxx
new file mode 100644
index 0000000..9bc56f3
--- /dev/null
+++ b/main/svx/source/sidebar/SelectionChangeHandler.cxx
@@ -0,0 +1,119 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/SelectionChangeHandler.hxx"
+#include "svx/sidebar/SelectionAnalyzer.hxx"
+#include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
+#include "svx/svdmrkv.hxx"
+
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <sfx2/shell.hxx>
+
+
+using namespace css;
+using namespace cssu;
+
+using namespace sfx2::sidebar;
+
+namespace svx { namespace sidebar {
+
+SelectionChangeHandler::SelectionChangeHandler (
+    const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback,
+    const Reference<frame::XController>& rxController,
+    const EnumContext::Context eDefaultContext)
+    : SelectionChangeHandlerInterfaceBase(m_aMutex),
+      maSelectionChangeCallback(rSelectionChangeCallback),
+      mxController(rxController),
+      meDefaultContext(eDefaultContext),
+      mbIsConnected(false)
+{
+}
+
+
+
+
+SelectionChangeHandler::~SelectionChangeHandler (void)
+{
+}
+
+
+
+
+void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&)
+    throw (uno::RuntimeException)
+{
+    if (maSelectionChangeCallback)
+    {
+        const EnumContext::Context eContext (maSelectionChangeCallback());
+        ContextChangeEventMultiplexer::NotifyContextChange(
+            mxController,
+            eContext==EnumContext::Context_Unknown
+                ? meDefaultContext
+                : eContext);
+    }
+}
+        
+
+
+
+void SAL_CALL SelectionChangeHandler::disposing (const lang::EventObject&)
+    throw (uno::RuntimeException)
+{
+}
+
+
+
+
+void SAL_CALL SelectionChangeHandler::disposing (void)
+    throw (uno::RuntimeException)
+{
+    if (mbIsConnected)
+        Disconnect();
+}
+
+
+
+
+void SelectionChangeHandler::Connect (void)
+{
+    uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY);
+    if (xSupplier.is())
+    {
+        mbIsConnected = true;
+        xSupplier->addSelectionChangeListener(this);
+    }
+}
+
+
+
+
+void SelectionChangeHandler::Disconnect (void)
+{
+    uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY);
+    if (xSupplier.is())
+    {
+        mbIsConnected = false;
+        xSupplier->removeSelectionChangeListener(this);
+    }
+}
+
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/area/AreaPropertyPanel.cxx b/main/svx/source/sidebar/area/AreaPropertyPanel.cxx
new file mode 100644
index 0000000..6cd53c1
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -0,0 +1,1373 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/PopupContainer.hxx"
+#include "AreaTransparencyGradientControl.hxx"
+
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <AreaPropertyPanel.hxx>
+#include <AreaPropertyPanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xtable.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <helpid.hrc>
+#include <svtools/valueset.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/svxitems.hrc>
+#include <vcl/toolbox.hxx>
+#include <svtools/toolbarmenu.hxx>
+#include <svx/sidebar/ColorControl.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+
+
+
+namespace svx { namespace sidebar {
+
+const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50;
+const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50;
+const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0;
+const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0;
+const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215;
+const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0;
+
+
+AreaPropertyPanel::AreaPropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+    : Control(pParent, SVX_RES(RID_SIDEBAR_AREA_PANEL)),
+      meLastXFS(-1),
+      maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)),
+      mnLastPosGradient(0),
+      mnLastPosHatch(0),
+      mnLastPosBitmap(0),
+      mnLastTransSolid(50),
+      maGradientLinear(),
+      maGradientAxial(),
+      maGradientRadial(),
+      maGradientElliptical(),
+      maGradientSquare(),
+      maGradientRect(),
+      mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))),
+      mpLbFillType(new SvxFillTypeBox(this)),
+      mpLbFillAttr(new SvxFillAttrBox(this)),
+      mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+      mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))),
+      mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))),
+      mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))),
+      mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
+      mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+      mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))),
+      mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
+      mpStyleItem(),
+      mpColorItem(),
+      mpFillGradientItem(),
+      mpHatchItem(),
+      mpBitmapItem(),
+      mpColorTableItem(),
+      mpGradientListItem(),
+      mpHatchListItem(),
+      mpBitmapListItem(),
+      maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this),
+      maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this),
+      maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this),
+      maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this),
+      maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this),
+      maColorTableControl(SID_COLOR_TABLE, *pBindings, *this),
+      maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this),
+      maHatchListControl(SID_HATCH_LIST, *pBindings, *this),
+      maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this),
+      maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this),
+      maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this),
+      maImgAxial(SVX_RES(IMG_AXIAL)),
+      maImgElli(SVX_RES(IMG_ELLI)),
+      maImgQuad(SVX_RES(IMG_QUAD)),
+      maImgRadial(SVX_RES(IMG_RADIAL)),
+      maImgSquare(SVX_RES(IMG_SQUARE)),
+      maImgLinear(SVX_RES(IMG_LINEAR)),
+      maImgColor(SVX_RES(IMG_COLOR)),
+      maImgAxialH(SVX_RES(IMG_AXIAL_H)),
+      maImgElliH(SVX_RES(IMG_ELLI_H)),
+      maImgQuadH(SVX_RES(IMG_QUAD_H)),
+      maImgRadialH(SVX_RES(IMG_RADIAL_H)),
+      maImgSquareH(SVX_RES(IMG_SQUARE_H)),
+      maImgLinearH(SVX_RES(IMG_LINEAR_H)),
+      maImgColorH(SVX_RES(IMG_COLOR_H)),
+      msHelpFillType(SVX_RES(STR_HELP_TYPE)),
+      msHelpFillAttr(SVX_RES(STR_HELP_ATTR)),
+      maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)),
+      maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)),
+      mpFloatTransparenceItem(),
+      mpTransparanceItem(),
+      mxFrame(rxFrame),
+      mpBindings(pBindings),
+      mbTBShow(true),
+      mbColorAvail(true)
+{
+    Initialize();
+    FreeResource();
+}
+
+
+
+AreaPropertyPanel::~AreaPropertyPanel()
+{
+    // Destroy the toolboxes, then their background windows.
+    mpToolBoxColor.reset();
+    mpBTNGradient.reset();
+    mpToolBoxColorBackground.reset();
+    mpBTNGradientBackground.reset();
+}
+
+
+
+void AreaPropertyPanel::Initialize()
+{
+    mpColorTextFT->SetBackground(Wallpaper());
+    mpTrspTextFT->SetBackground(Wallpaper());
+
+    maGradientLinear.SetXOffset(DEFAULT_CENTERX);
+    maGradientLinear.SetYOffset(DEFAULT_CENTERY);
+    maGradientLinear.SetAngle(DEFAULT_ANGLE);
+    maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE));
+    maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE));
+    maGradientLinear.SetBorder(DEFAULT_BORDER);
+    maGradientLinear.SetGradientStyle(XGRAD_LINEAR);
+
+    maGradientAxial = maGradientLinear;
+    maGradientAxial.SetGradientStyle(XGRAD_AXIAL);
+
+    maGradientRadial = maGradientLinear;
+    maGradientRadial.SetGradientStyle(XGRAD_RADIAL);
+
+    maGradientElliptical = maGradientLinear;
+    maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL);
+
+    maGradientSquare = maGradientLinear;
+    maGradientSquare.SetGradientStyle(XGRAD_SQUARE);
+
+    maGradientRect = maGradientLinear;
+    maGradientRect.SetGradientStyle(XGRAD_RECT);
+
+    Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT);
+    Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT);
+
+    Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL);
+    Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL);
+
+    Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
+    Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
+
+    Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT));
+    Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT));
+
+    mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize);
+    mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize);
+
+    mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES);
+    mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR);
+
+    mpLbFillType->SetQuickHelpText(msHelpFillType);
+    mpLbFillAttr->SetQuickHelpText(msHelpFillAttr);
+
+    mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill")));    //wj acc
+    mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill")));    //wj acc
+
+    Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl );
+    mpLbFillType->SetSelectHdl( aLink );
+
+    aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl );
+    mpLbFillAttr->SetSelectHdl( aLink );
+
+    //add  for new color picker
+    mpLbFillAttr->Hide();
+    mpToolBoxColor->SetItemImage(TBI_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgColorH : maImgColor);
+    Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() ); 
+    mpToolBoxColor->SetOutputSizePixel( aTbxSize );
+    mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY );
+    mpToolBoxColor->SetBackground(Wallpaper());
+    mpToolBoxColor->SetPaintTransparent(true);
+    mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR)));    //wj acc
+    //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr);
+
+    long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight();
+    long aLBPosY = mpLbFillType->GetPosPixel().getY();
+    long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight();
+    Point aPointTBAttr = mpToolBoxColor->GetPosPixel();
+    aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2);
+    mpToolBoxColor->SetPosPixel(aPointTBAttr);
+ 
+    aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl);
+    mpToolBoxColor->SetDropdownClickHdl ( aLink );
+    mpToolBoxColor->SetSelectHdl ( aLink );
+
+    //add end
+    mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl));
+    mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));    //wj acc
+
+    mpMTRTransparent->SetValue( 50 );
+    mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl));
+    mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));    //wj acc
+
+    mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY );
+    aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl );
+    mpBTNGradient->SetDropdownClickHdl( aLink );
+    mpBTNGradient->SetSelectHdl( aLink );
+    aTbxSize = mpBTNGradient->CalcWindowSizePixel();
+    mpBTNGradient->SetOutputSizePixel( aTbxSize );
+    mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear);
+    mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT)));    //wj acc
+    mpBTNGradient->Hide();
+
+    long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight();
+    Point aPointLB = mpLBTransType->GetPosPixel();
+    long aPosY = aPointLB.getY();
+
+    Point aPointMetric = mpMTRTransparent->GetPosPixel();
+    Point aPointTB = mpMTRTransparent->GetPosPixel();
+    long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight();
+    long aHeightTool = mpBTNGradient->GetSizePixel().getHeight();
+    aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2);
+    aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2);
+    aPointTB.setX(aPointTB.getX()+3);
+    mpMTRTransparent->SetPosPixel(aPointMetric);
+    mpBTNGradient->SetPosPixel(aPointTB);
+
+    mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get());
+    mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get());
+    mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get());
+    mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get());
+    mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get());
+    mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get());
+
+    SetupIcons();
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox )
+{
+	XFillStyle  eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos();
+
+	if( (XFillStyle) meLastXFS != eXFS )
+	{
+			mpLbFillAttr->Clear();
+			SfxObjectShell* pSh = SfxObjectShell::Current();
+			XFillStyleItem aXFillStyleItem( eXFS );
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); 
+
+			switch( eXFS )
+			{
+			case XFILL_NONE:
+				{
+					mpLbFillAttr->Show();	
+					mpToolBoxColor->Hide();	
+					mbTBShow = false;
+					mpLbFillType->Selected();
+					mpLbFillAttr->Disable();
+				}
+				break;
+
+			case XFILL_SOLID:
+				{
+					mpLbFillAttr->Hide();	
+					mpToolBoxColor->Show();	
+					mbTBShow = true;
+					String aTmpStr;
+					Color aColor = maLastColor;
+					XFillColorItem aXFillColorItem( aTmpStr, aColor );
+					GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+				}
+				break;
+
+			case XFILL_GRADIENT:
+				{
+					mpLbFillAttr->Show();	
+					mpToolBoxColor->Hide();	
+					mbTBShow = false;
+					if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+					{
+						if(mpLbFillAttr->GetEntryCount() == 0)
+						{
+							SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+							pSh->GetItem( SID_GRADIENT_LIST ) ) );
+							mpLbFillAttr->Enable();
+							mpLbFillAttr->Clear();
+							mpLbFillAttr->Fill( aItem.GetGradientList() );	
+						}
+
+                        mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+						if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND)
+						{
+							SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+							if ( mnLastPosGradient < aItem.GetGradientList()->Count() )  
+							{
+								XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient();
+								XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient );
+								GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L);
+								mpLbFillAttr->SelectEntryPos(mnLastPosGradient);	//add 
+							}
+						}
+					}
+					else
+						mpLbFillAttr->Disable();
+				}
+				break;
+
+			case XFILL_HATCH:
+				{
+					mpLbFillAttr->Show();	
+					mpToolBoxColor->Hide();	
+					mbTBShow = false;
+					if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+					{
+						if(mpLbFillAttr->GetEntryCount() == 0)
+						{
+							SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+								pSh->GetItem( SID_HATCH_LIST ) ) );
+							mpLbFillAttr->Enable();
+							mpLbFillAttr->Clear();
+							mpLbFillAttr->Fill( aItem.GetHatchList() );
+						}
+
+                        mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+						if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND )
+						{
+							SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+							if ( mnLastPosHatch < aItem.GetHatchList()->Count() )  
+							{
+								XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch();
+								XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch );
+								GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L);
+								mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add 
+							}
+						}
+					}
+					else
+						mpLbFillAttr->Disable();
+				}
+				break;
+
+			case XFILL_BITMAP:
+				{
+					mpLbFillAttr->Show();	
+					mpToolBoxColor->Hide();	
+					mbTBShow = false;
+					if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+					{
+						if(mpLbFillAttr->GetEntryCount() == 0)
+						{
+							SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+								pSh->GetItem( SID_BITMAP_LIST ) ) );
+							mpLbFillAttr->Enable();
+							mpLbFillAttr->Clear();
+							mpLbFillAttr->Fill( aItem.GetBitmapList() );
+						}
+
+                        mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount()));
+
+						if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND )
+						{
+							SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+							if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() ) 
+							{
+                                const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap);
+								XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() );
+								GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L);
+								mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add 
+							}
+						}
+					}
+					else
+						mpLbFillAttr->Disable();
+				}
+				break;
+			}
+			meLastXFS = (sal_uInt16)eXFS;
+			if( eXFS != XFILL_NONE )
+			{
+				if ( pToolBox )
+					mpLbFillType->Selected();
+			}
+	}
+	return 0;
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox )
+{
+    XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos();
+    XFillStyleItem aXFillStyleItem( eXFS );
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+
+    if(pToolBox)
+	{
+		if( (XFillStyle) meLastXFS != eXFS )
+        {
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added  20090909
+        }
+
+		switch( eXFS )
+		{
+		case XFILL_SOLID:
+			//{
+			//	//String aTmpStr = mpLbFillAttr->GetSelectEntry();
+			//	//Color aColor = mpLbFillAttr->GetSelectEntryColor();
+			//	//if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii("")))
+			//	String aTmpStr;
+			//	Color aColor = maLastColor;
+			//	XFillColorItem aXFillColorItem( aTmpStr, aColor );
+			//	GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+			//	maLastColor = aColor;
+			//}
+			break;
+
+		case XFILL_GRADIENT:
+			{
+				sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+				if( nPos == LISTBOX_ENTRY_NOTFOUND )
+					nPos = mnLastPosGradient;
+
+				if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+				{
+					SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+					if ( nPos < aItem.GetGradientList()->Count() )  
+					{
+						XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
+						XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient );
+						GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L);
+					}
+				}
+				if(nPos != LISTBOX_ENTRY_NOTFOUND)
+					mnLastPosGradient = nPos;
+			}
+			break;
+
+		case XFILL_HATCH:
+			{
+				sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+				if( nPos == LISTBOX_ENTRY_NOTFOUND )
+					nPos = mnLastPosHatch;
+				if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
+				{
+					SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+					if ( nPos < aItem.GetHatchList()->Count() )  
+					{
+						XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
+						XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch );
+						GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L);
+					}
+				}
+				if(nPos != LISTBOX_ENTRY_NOTFOUND)
+					mnLastPosHatch = nPos;
+			}
+			break;
+
+		case XFILL_BITMAP:
+			{
+				sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos();
+				if( nPos == LISTBOX_ENTRY_NOTFOUND )
+					nPos = mnLastPosBitmap;
+				if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+				{
+					SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+					if ( nPos < aItem.GetBitmapList()->Count() ) 
+					{
+                        const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
+						XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() );
+						GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L);
+					}
+				}
+				if(nPos != LISTBOX_ENTRY_NOTFOUND)
+					mnLastPosBitmap = nPos;
+			}
+			break;
+
+                    default:
+                        break;
+		}
+	}
+	return 0;
+}
+
+
+//add  for color picker
+
+IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox)
+{
+    sal_uInt16 nId = pToolBox->GetCurItemId();
+
+    if(nId == TBI_COLOR)
+    {
+        maColorPopup.Show(*pToolBox);
+	    if (mpColorItem)
+            maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail);
+		else
+			maColorPopup.SetCurrentColor(COL_WHITE, false);
+	}
+
+    return 0;
+}
+
+
+
+void AreaPropertyPanel::SetColor (
+    const String& rsColorName,
+    const Color aColor)
+{
+    XFillColorItem aXFillColorItem (rsColorName, aColor);
+    mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L);
+    maLastColor = aColor;
+}
+
+
+
+
+PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
+{
+    return new AreaTransparencyGradientControl(pParent, *this);
+}
+
+
+
+
+PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent)
+{
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR),
+        SVX_RES(VS_COLOR),
+        ::boost::bind(&AreaPropertyPanel::GetLastColor, this),
+        ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2),
+        pParent,
+        0);
+}
+
+
+
+
+void AreaPropertyPanel::SetupIcons(void)
+{
+    if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+        // todo
+    }
+    else
+    {
+        // todo
+    }
+}
+
+
+
+AreaPropertyPanel* AreaPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2);
+    
+    return new AreaPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+
+
+void AreaPropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+
+
+void AreaPropertyPanel::ImpUpdateTransparencies()
+{
+    if(mpTransparanceItem.get() || mpFloatTransparenceItem.get())
+    {
+        bool bZeroValue(false);
+
+        if(mpTransparanceItem.get())
+        {
+            const sal_uInt16 nValue(mpTransparanceItem->GetValue());
+
+            if(!nValue)
+            {
+                bZeroValue = true;
+            }
+            else if(nValue <= 100)
+            {
+                mpLBTransType->Enable();
+                mpLBTransType->SelectEntryPos(1);
+                mpBTNGradient->Hide();
+                mpMTRTransparent->Show();
+                mpMTRTransparent->Enable();
+                mpMTRTransparent->SetValue(nValue);
+            }
+
+            if(!bZeroValue)
+            {
+                maTrGrPopup.Hide();
+            }
+        }
+
+        if(bZeroValue && mpFloatTransparenceItem.get())
+        {
+            if(mpFloatTransparenceItem->IsEnabled())
+            {
+                const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue();
+                const bool bHighContrast(GetSettings().GetStyleSettings().GetHighContrastMode());
+                sal_uInt16 nEntryPos(0);
+                Image* pImage = 0;
+
+                mpLBTransType->Enable();
+                mpMTRTransparent->Hide();
+                mpBTNGradient->Enable();
+                mpBTNGradient->Show();
+
+                switch(rGradient.GetGradientStyle())
+                {
+                    case XGRAD_LINEAR:
+                    {
+                        nEntryPos = 2;
+                        pImage = bHighContrast ? &maImgLinearH : &maImgLinear;
+                        break;
+                    }
+                    case XGRAD_AXIAL:
+                    {
+                        nEntryPos = 3;
+                        pImage = bHighContrast ? &maImgAxialH : &maImgAxial;
+                        break;
+                    }
+                    case XGRAD_RADIAL:
+                    {
+                        nEntryPos = 4;
+                        pImage = bHighContrast ? &maImgRadialH : &maImgRadial;
+                        break;
+                    }
+                    case XGRAD_ELLIPTICAL:
+                    {
+                        nEntryPos = 5;
+                        pImage = bHighContrast ? &maImgElliH : &maImgElli;
+                        break;
+                    }
+                    case XGRAD_SQUARE:
+                    {
+                        nEntryPos = 6;
+                        pImage = bHighContrast ? &maImgQuadH : &maImgQuad;
+                        break;
+                    }
+                    case XGRAD_RECT:
+                    {
+                        nEntryPos = 7;
+                        pImage = bHighContrast ? &maImgSquareH : &maImgSquare;
+                        break;
+                    }
+                }
+
+                mpLBTransType->SelectEntryPos(nEntryPos);
+                mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, *pImage);
+                bZeroValue = false;
+            }
+            else
+            {
+                bZeroValue = true;
+            }
+        }
+
+        if(bZeroValue)
+        {
+            mpLBTransType->Enable();
+            mpLBTransType->SelectEntryPos(0);
+            mpBTNGradient->Hide();
+            mpMTRTransparent->Enable();
+            mpMTRTransparent->Show();
+            mpMTRTransparent->SetValue(0);
+        }
+    }
+    else
+    {
+        // no transparency at all
+        mpLBTransType->SetNoSelection();
+        mpMTRTransparent->Disable();
+        mpMTRTransparent->Show();
+        mpBTNGradient->Disable();
+        mpBTNGradient->Hide();
+    }
+}
+
+
+
+void AreaPropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{	
+	XFillStyle eXFS;
+	SfxObjectShell* pSh = SfxObjectShell::Current();
+    bool bFillTransparenceChanged(false);
+
+    if(SID_ATTR_FILL_TRANSPARENCE == nSID)
+    {
+        bFillTransparenceChanged = true;
+
+        if(eState >= SFX_ITEM_AVAILABLE)
+        {
+            const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
+
+            if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem))
+            {
+                mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone());
+            }
+            else
+            {
+                mpTransparanceItem.reset();
+            }
+        }
+        else
+        {
+            mpTransparanceItem.reset();
+        }
+    }
+    else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID)
+    {
+        bFillTransparenceChanged = true;
+
+        if(eState >= SFX_ITEM_AVAILABLE)
+        {
+            const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState);
+
+            if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem))
+            {
+                mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone());
+            }
+            else
+            {
+                mpFloatTransparenceItem.reset();
+            }
+        }
+        else
+        {
+            mpFloatTransparenceItem.reset();
+        }
+    }
+
+    if(bFillTransparenceChanged)
+    {
+        // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
+        ImpUpdateTransparencies();
+    }
+
+	if	(nSID == SID_ATTR_FILL_STYLE )
+	{
+		if( eState == SFX_ITEM_DISABLED )
+		{
+			mpLbFillType->Disable(); 
+			mpLbFillType->SetNoSelection();
+			mpLbFillAttr->Show();
+			mpLbFillAttr->Disable();
+			mpLbFillAttr->SetNoSelection();
+			mpToolBoxColor->Hide();
+			mbTBShow = false;
+			meLastXFS = -1; 
+            mpStyleItem.reset();
+		}
+		else if( SFX_ITEM_AVAILABLE == eState )
+		{
+			mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0);
+			mpLbFillType->Enable();
+
+			eXFS = (XFillStyle)mpStyleItem->GetValue();
+			meLastXFS = eXFS;  
+			mpLbFillType->SelectEntryPos(
+				sal::static_int_cast< sal_uInt16 >( eXFS ) );
+			//Added for select invisable
+			if(eXFS == XFILL_NONE)
+			{
+				mpLbFillAttr->SetNoSelection();
+				mpLbFillAttr->Disable();
+			}
+			//else
+			//	mpLbFillAttr->Enable();
+			Update();
+			//SelectFillTypeHdl( NULL );
+		}
+		else
+		{
+			mpLbFillType->SetNoSelection();
+			mpLbFillAttr->Show();
+			mpLbFillAttr->Disable();
+			mpLbFillAttr->SetNoSelection();
+			mpToolBoxColor->Hide();
+			mbTBShow = false;
+			meLastXFS = -1;  //Added 
+			mpStyleItem.reset();
+		}
+	}
+	else if(nSID == SID_ATTR_FILL_COLOR)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{	
+			mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0);
+		}
+		if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID)
+		{
+			mpLbFillAttr->Hide();
+			mpToolBoxColor->Show();
+			mbTBShow = true;
+			if( SFX_ITEM_AVAILABLE == eState)
+			{	
+				mpToolBoxColor->Enable();
+				mbColorAvail = true;	//
+			    // maLastColor = mpColorItem->GetColorValue();
+				Update();
+			}
+			else if(SFX_ITEM_DISABLED == eState )
+			{
+				mpToolBoxColor->Disable();
+				mbColorAvail = false;	//
+				mpColorUpdater->Update(COL_WHITE);
+			}
+			else
+			{
+				mbColorAvail = false;	//
+				mpColorUpdater->Update(COL_WHITE);
+			}
+		}
+	}
+	else if(nSID == SID_ATTR_FILL_GRADIENT)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0);
+		}
+		if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT )
+		{
+			mpLbFillAttr->Show();
+			mpToolBoxColor->Hide();
+			mbTBShow = false;
+			if( SFX_ITEM_AVAILABLE == eState)
+			{
+				mpLbFillAttr->Enable();
+				Update();
+			}
+			
+			else if(SFX_ITEM_DISABLED == eState )
+			{
+				mpLbFillAttr->Disable();
+				mpLbFillAttr->SetNoSelection();
+			}
+			else
+				mpLbFillAttr->SetNoSelection();
+		}
+	}
+	else if(nSID == SID_ATTR_FILL_HATCH)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{	
+			mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0);
+		}
+		if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH )
+		{
+			mpLbFillAttr->Show();
+			mpToolBoxColor->Hide();
+			mbTBShow = false;
+			if( SFX_ITEM_AVAILABLE == eState)
+			{	
+				mpLbFillAttr->Enable();
+				Update();
+			}
+			else if(SFX_ITEM_DISABLED == eState )
+			{
+				mpLbFillAttr->Disable();
+				mpLbFillAttr->SetNoSelection();
+			}
+			else
+				mpLbFillAttr->SetNoSelection();
+		}
+	}
+	else if(nSID == SID_ATTR_FILL_BITMAP)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0);
+		}
+		if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP )
+		{
+			mpLbFillAttr->Show();
+			mpToolBoxColor->Hide();
+			mbTBShow = false;
+			if( SFX_ITEM_AVAILABLE == eState)
+			{
+				mpLbFillAttr->Enable();
+				Update();
+			}
+			else if(SFX_ITEM_DISABLED == eState )
+			{
+				mpLbFillAttr->Disable();
+				mpLbFillAttr->SetNoSelection();
+			}
+			else
+				mpLbFillAttr->SetNoSelection();
+		}
+	}
+	else if(nSID == SID_COLOR_TABLE)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpColorTableItem.reset(pState ? (SvxColorTableItem*)pState->Clone() : 0);
+
+			if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID)
+			{
+				if ( mpColorItem )
+				{
+					String aString( mpColorItem->GetName() );
+					Color aColor = mpColorItem->GetColorValue();
+					mpLbFillAttr->Clear();
+					SvxColorTableItem aItem( *(const SvxColorTableItem*)(
+						pSh->GetItem( SID_COLOR_TABLE ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Fill( aItem.GetColorTable() );
+					mpLbFillAttr->SelectEntry( aColor );
+				}
+				else 
+					mpLbFillAttr->SetNoSelection();
+			}
+		}
+	}
+	else if(nSID == SID_GRADIENT_LIST)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0);
+
+			if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT)
+			{
+				if ( mpFillGradientItem )
+				{
+					String aString( mpFillGradientItem->GetName() );
+					mpLbFillAttr->Clear();
+					SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+						pSh->GetItem( SID_GRADIENT_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Fill( aItem.GetGradientList() );
+					mpLbFillAttr->SelectEntry( aString );
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+		}
+	}
+	else if(nSID == SID_HATCH_LIST)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0);
+
+			if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH )
+			{
+				if ( mpHatchItem)
+				{
+					String aString( mpHatchItem->GetName() );
+					mpLbFillAttr->Clear();
+					SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+						pSh->GetItem( SID_HATCH_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Fill( aItem.GetHatchList() );
+					mpLbFillAttr->SelectEntry( aString );
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+		}
+	}
+	else if(nSID == SID_BITMAP_LIST)
+	{
+		if( SFX_ITEM_AVAILABLE == eState)
+		{
+			mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0);
+
+			if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP )
+			{
+				if ( mpBitmapItem )
+				{
+					String aString( mpBitmapItem->GetName() );
+					mpLbFillAttr->Clear();
+					SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+						pSh->GetItem( SID_BITMAP_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Fill( aItem.GetBitmapList() );
+					mpLbFillAttr->SelectEntry( aString );
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+		}
+	}
+}
+
+
+
+SfxBindings* AreaPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+
+
+void AreaPropertyPanel::Update()
+{
+	if ( mpStyleItem )
+	{
+		XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue();
+		SfxObjectShell* pSh = SfxObjectShell::Current();
+
+		switch( eXFS )
+		{
+			case XFILL_NONE:
+			{
+				mpLbFillAttr->Show();	//wj for new color picker
+				mpToolBoxColor->Hide();	//wj for new color picker
+				mbTBShow = false;
+			}
+			break;
+
+			case XFILL_SOLID:
+			{
+				if ( mpColorItem )
+				{
+					mpLbFillAttr->Hide();	//wj for new color picker
+					mpToolBoxColor->Show();	//wj for new color picker
+					mbTBShow = true;					
+					mpColorUpdater->Update(mpColorItem->GetColorValue());
+				}
+				else
+					mpColorUpdater->Update(COL_WHITE);
+			}
+			break;
+
+			case XFILL_GRADIENT:
+			{
+				mpLbFillAttr->Show();	//wj for new color picker
+				mpToolBoxColor->Hide();	//wj for new color picker
+				mbTBShow = false;
+				if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+				{
+					SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+						pSh->GetItem( SID_GRADIENT_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Clear();
+					mpLbFillAttr->Fill( aItem.GetGradientList() );
+					if ( mpFillGradientItem )
+					{
+						String aString( mpFillGradientItem->GetName() );
+						mpLbFillAttr->SelectEntry( aString );
+					}
+					else
+						mpLbFillAttr->SetNoSelection();
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+			break;
+
+			case XFILL_HATCH:
+			{
+				mpLbFillAttr->Show();	//wj for new color picker
+				mpToolBoxColor->Hide();	//wj for new color picker
+				mbTBShow = false;
+				if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+				{
+					SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+						pSh->GetItem( SID_HATCH_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Clear();
+					mpLbFillAttr->Fill( aItem.GetHatchList() );
+					if ( mpHatchItem )
+					{
+						String aString( mpHatchItem->GetName() );
+						mpLbFillAttr->SelectEntry( aString );
+					}
+					else
+						mpLbFillAttr->SetNoSelection();
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+			break;
+
+			case XFILL_BITMAP:
+			{
+				mpLbFillAttr->Show();	//wj for new color picker
+				mpToolBoxColor->Hide();	//wj for new color picker
+				mbTBShow = false;
+				//mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() );
+				if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+				{
+					SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+						pSh->GetItem( SID_BITMAP_LIST ) ) );
+					mpLbFillAttr->Enable();
+					mpLbFillAttr->Clear();
+					mpLbFillAttr->Fill( aItem.GetBitmapList() );
+					if ( mpBitmapItem )
+					{
+						String aString( mpBitmapItem->GetName() );
+						mpLbFillAttr->SelectEntry( aString );
+					}
+					else
+						mpLbFillAttr->SetNoSelection();
+				}
+				else
+					mpLbFillAttr->SetNoSelection();
+			}
+			break;
+
+			default:
+				DBG_ERROR( "Nicht unterstuetzter Flaechentyp" );
+			break;
+		}
+	}
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{	
+	return 0;
+}
+
+
+
+IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox )
+{
+    maTrGrPopup.Rearrange(mpFloatTransparenceItem.get());
+
+    OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT);
+
+    maTrGrPopup.Show(*pToolBox);
+
+    return (0L);
+}
+
+
+
+IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG)
+{
+	sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos();
+	bool bGradient = false;
+	sal_uInt16 nTrans = 0;
+
+	if (nSelectType == 0)
+	{
+		mpBTNGradient->Hide();
+		mpMTRTransparent->Show();
+		mpMTRTransparent->Enable();
+		mpMTRTransparent->SetValue(0);
+	}
+	else if (nSelectType == 1)
+	{
+		mpBTNGradient->Hide();
+		mpMTRTransparent->Show();
+		nTrans = mnLastTransSolid;
+		mpMTRTransparent->SetValue(nTrans);
+		mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection
+		mpMTRTransparent->Enable();
+	}
+	else
+	{
+		mpBTNGradient->Show();
+		//for beta1
+		switch ( nSelectType )
+		{
+		case 2:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgLinearH : maImgLinear); // high contrast
+			break;
+		case 3:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgAxialH : maImgAxial);
+			break;
+		case 4:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgRadialH : maImgRadial);
+			break;
+		case 5:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgElliH : maImgElli );
+			break;
+		case 6:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgQuadH : maImgQuad );
+			break;
+		case 7:
+			mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSquareH : maImgSquare);
+			break;
+		}
+		//end of new code
+		mpMTRTransparent->Hide();
+		mpBTNGradient->Enable();
+		bGradient = true;
+	}
+
+	XFillTransparenceItem aLinearItem(nTrans);
+	GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L );
+
+	if (nSelectType > 1) nSelectType = nSelectType-2;
+
+	XGradient aTmpGradient;
+		
+	switch(nSelectType)
+	{
+	case XGRAD_LINEAR:
+		aTmpGradient = maGradientLinear;
+		break;
+	case XGRAD_AXIAL:
+		aTmpGradient = maGradientAxial;
+		break;
+	case XGRAD_RADIAL:
+		aTmpGradient = maGradientRadial;
+		break;
+	case XGRAD_ELLIPTICAL:
+		aTmpGradient = maGradientElliptical;
+		break;
+	case XGRAD_SQUARE:
+		aTmpGradient = maGradientSquare;
+		break;
+	case XGRAD_RECT:
+		aTmpGradient = maGradientRect;
+		break;
+	}
+	SfxItemPool* pPool = NULL;
+	bool bEnable = false;
+	if (bGradient) bEnable = true;		
+	XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
+
+	GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
+
+	return( 0L );
+}
+
+
+
+IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG)
+{
+	sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue();
+	mnLastTransSolid = nTrans;
+	sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos();
+	if (nTrans != 0 && nSelectType == 0)
+		mpLBTransType->SelectEntryPos(1);
+	XFillTransparenceItem aLinearItem(nTrans);
+	GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L );
+
+	return 0L;
+}
+
+
+Color AreaPropertyPanel::GetLastColor (void) const
+{
+    return maLastColor;
+}
+
+
+
+
+XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const
+{
+    switch (eStyle)
+    {
+        default:
+		case XGRAD_LINEAR:
+            return maGradientLinear;
+		case XGRAD_AXIAL:
+            return maGradientAxial;
+		case XGRAD_RADIAL:
+            return maGradientRadial;
+		case XGRAD_ELLIPTICAL:
+            return maGradientElliptical;
+		case XGRAD_SQUARE:
+            return maGradientSquare;
+		case XGRAD_RECT:
+            return maGradientRect;
+    }
+}
+
+
+
+
+void AreaPropertyPanel::SetGradient (const XGradient& rGradient)
+{
+    switch (rGradient.GetGradientStyle())
+    {
+        case XGRAD_LINEAR:
+			maGradientLinear = rGradient;
+            break;
+        case XGRAD_AXIAL:
+			maGradientAxial = rGradient;
+            break;
+        case XGRAD_RADIAL:
+			maGradientRadial = rGradient;
+            break;
+        case XGRAD_ELLIPTICAL:
+			maGradientElliptical = rGradient;
+            break;
+        case XGRAD_SQUARE:
+            maGradientSquare = rGradient;
+            break;
+        case XGRAD_RECT:
+            maGradientRect = rGradient;
+            break;
+	}
+}
+
+
+
+
+sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const
+{
+    return mpLBTransType->GetSelectEntryPos();
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaPropertyPanel.hrc b/main/svx/source/sidebar/area/AreaPropertyPanel.hrc
new file mode 100644
index 0000000..e6a29ba
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaPropertyPanel.hrc
@@ -0,0 +1,96 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+//  RID_SIDEBAR_AREA_PANEL--------------------------------------------------------------
+#define FT_COLOR_LIST                        1
+#define TB_COLOR			2
+#define TBI_COLOR			3
+#define IMG_COLOR			5
+
+#define VS_COLOR			1
+
+#define TBI_LEFT							1
+#define TBI_RIGHT							1
+#define TBI_BTX_GRADIENT					51
+#define FL_TRSP_TEXT                         4
+
+#define LB_TRGR_TYPES	6
+#define MTR_TRANSPARENT	7
+#define BTN_GRADIENT	8
+
+#define	FT_TRGR_CENTER_X	9
+#define	MTR_TRGR_CENTER_X	10
+#define	FT_TRGR_CENTER_Y 	11
+#define	MTR_TRGR_CENTER_Y	12
+#define	FT_TRGR_ANGLE		13
+#define	MTR_TRGR_ANGLE		14
+#define	FT_TRGR_START_VALUE 15
+#define	MTR_TRGR_START_VALUE 16
+#define	FT_TRGR_END_VALUE	17
+#define	MTR_TRGR_END_VALUE	18
+#define	FT_TRGR_BORDER		19
+#define	MTR_TRGR_BORDER		20
+#define STR_HELP_LEFT		24
+#define STR_HELP_RIGHT		25
+
+#define	BTN_LEFT_SECOND	    	22
+#define	BTN_RIGHT_FIRST	    	23
+
+#define	IMG_AXIAL              24
+#define	IMG_ELLI               25
+#define	IMG_QUAD               26
+#define	IMG_RADIAL              27
+#define	IMG_SQUARE              28
+#define	IMG_LINEAR              29
+#define IMG_ROT_LEFT			30
+#define IMG_ROT_RIGHT			31
+#define STR_HELP_TYPE			32
+#define STR_HELP_ATTR			33
+#define STR_HELP_COLOR			41
+#define STR_HELP_GRADIENT		42
+
+//high contrast
+#define	IMG_AXIAL_H              34
+#define	IMG_ELLI_H               35
+#define	IMG_QUAD_H               36
+#define	IMG_RADIAL_H              37
+#define	IMG_SQUARE_H              38
+#define	IMG_LINEAR_H              39
+#define IMG_COLOR_H				  40
+
+
+#define FIXED_TEXT_HEIGHT   9
+#define FIXED_TEXT_WIDTH   40
+#define MBOX_WIDTH		   50
+#define CONTROL_HEIGHT		12
+#define CONTROL_WIDTH			45
+#define LISTBOX_HEIGHT     80
+#define ROTATE_BUTTON_WIDTH        13
+#define ROTATE_BUTTON_SPACING      15
+#define POP_WIDTH   2*POPUPPANEL_MARGIN_HORIZONTAL+2*CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL 
+#define POP_HEIGHT  2*POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 3*CONTROL_SPACING_VERTICAL
+#define POP_HEIGHT2  2*POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 2*CONTROL_SPACING_VERTICAL
+#define LEFT_RIGHT_X1    POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + 1
+#define LEFT_RIGHT_Y1    POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL - 2
+#define LEFT_RIGHT_X2    POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + ROTATE_BUTTON_SPACING
+#define LEFT_RIGHT_Y2	 POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL - 2
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaPropertyPanel.hxx b/main/svx/source/sidebar/area/AreaPropertyPanel.hxx
new file mode 100644
index 0000000..15d82f6
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -0,0 +1,211 @@
+/**************************************************************
+ * 
+ * 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 SVX_PROPERTYPANEL_AREAPAGE_HXX
+#define SVX_PROPERTYPANEL_AREAPAGE_HXX
+
+#include <svx/sidebar/ColorPopup.hxx>
+#include "AreaTransparencyGradientPopup.hxx"
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/itemwin.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/drawitem.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <svl/intitem.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+class XFillFloatTransparenceItem;
+namespace svx { class ToolboxButtonColorUpdater; }
+
+
+namespace svx { namespace sidebar {
+
+class PopupContainer;
+class AreaTransparencyGradientControl;
+
+class AreaPropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static AreaPropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+    const static sal_Int32 DEFAULT_CENTERX;
+    const static sal_Int32 DEFAULT_CENTERY;
+    const static sal_Int32 DEFAULT_ANGLE;
+    const static sal_Int32 DEFAULT_STARTVALUE;
+    const static sal_Int32 DEFAULT_ENDVALUE;
+    const static sal_Int32 DEFAULT_BORDER;
+
+    XGradient GetGradient (const XGradientStyle eStyle) const;
+    void SetGradient (const XGradient& rGradient);
+    sal_Int32 GetSelectedTransparencyTypeIndex (void) const;
+
+private:
+    sal_uInt16                                          meLastXFS;
+    Color                                               maLastColor;
+
+    sal_uInt16                                          mnLastPosGradient;
+    sal_uInt16                                          mnLastPosHatch;
+    sal_uInt16                                          mnLastPosBitmap;
+    sal_uInt16                                          mnLastTransSolid;
+
+    XGradient                                           maGradientLinear;
+    XGradient                                           maGradientAxial;
+    XGradient                                           maGradientRadial;
+    XGradient                                           maGradientElliptical;
+    XGradient                                           maGradientSquare;
+    XGradient                                           maGradientRect;
+
+    //ui controls
+    ::boost::scoped_ptr< FixedText >                    mpColorTextFT;
+    ::boost::scoped_ptr< SvxFillTypeBox >               mpLbFillType;
+    ::boost::scoped_ptr< SvxFillAttrBox >               mpLbFillAttr;
+    ::boost::scoped_ptr< Window >                       mpToolBoxColorBackground;
+    ::boost::scoped_ptr< ToolBox >                      mpToolBoxColor; // for new color picker
+    ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
+    ::boost::scoped_ptr< ListBox >                      mpLBTransType;
+    ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
+    ::boost::scoped_ptr< Window >                       mpBTNGradientBackground;
+    ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
+
+    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
+
+    ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
+    ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
+    ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
+    ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
+    ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
+    ::boost::scoped_ptr< SvxColorTableItem >            mpColorTableItem;
+    ::boost::scoped_ptr< SvxGradientListItem >          mpGradientListItem;
+    ::boost::scoped_ptr< SvxHatchListItem >             mpHatchListItem;
+    ::boost::scoped_ptr< SvxBitmapListItem >            mpBitmapListItem;
+
+    ::sfx2::sidebar::ControllerItem                     maStyleControl;
+    ::sfx2::sidebar::ControllerItem                     maColorControl;
+    ::sfx2::sidebar::ControllerItem                     maGradientControl;
+    ::sfx2::sidebar::ControllerItem                     maHatchControl;
+    ::sfx2::sidebar::ControllerItem                     maBitmapControl;
+    ::sfx2::sidebar::ControllerItem                     maColorTableControl;
+    ::sfx2::sidebar::ControllerItem                     maGradientListControl;
+    ::sfx2::sidebar::ControllerItem                     maHatchListControl;
+    ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
+    ::sfx2::sidebar::ControllerItem                     maFillTransparenceController;
+    ::sfx2::sidebar::ControllerItem                     maFillFloatTransparenceController;
+
+    Image                                               maImgAxial;
+    Image                                               maImgElli;
+    Image                                               maImgQuad;
+    Image                                               maImgRadial;
+    Image                                               maImgSquare;
+    Image                                               maImgLinear;
+    Image                                               maImgColor;
+
+    //for high contract
+    Image                                               maImgAxialH;
+    Image                                               maImgElliH;
+    Image                                               maImgQuadH;
+    Image                                               maImgRadialH;
+    Image                                               maImgSquareH;
+    Image                                               maImgLinearH;
+    Image                                               maImgColorH;
+
+    String                                              msHelpFillType;
+    String                                              msHelpFillAttr;
+
+    AreaTransparencyGradientPopup maTrGrPopup;
+    ColorPopup maColorPopup; 
+
+    ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
+    ::boost::scoped_ptr< SfxUInt16Item >                mpTransparanceItem;
+
+    cssu::Reference<css::frame::XFrame>                 mxFrame;
+    SfxBindings*                                        mpBindings;
+
+    /// bitfield
+    bool                                                mbTBShow : 1;
+    bool                                                mbColorAvail : 1;
+
+    DECL_LINK(SelectFillTypeHdl, ListBox* );
+    DECL_LINK(SelectFillAttrHdl, ListBox* );
+    DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
+    DECL_LINK(ModifyTransparentHdl_Impl, void*);
+    DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
+
+    // for transparency gradient
+    PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
+    DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
+
+    // for color picker 
+    PopupControl* CreateColorPopupControl (PopupContainer* pParent);
+    DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker 
+
+    // constructor/destuctor
+    AreaPropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~AreaPropertyPanel(void);
+
+    void SetupIcons(void);
+    void Initialize();
+    void Update();
+    void ImpUpdateTransparencies();
+
+    Color GetLastColor (void) const;
+    void SetColor (
+        const String& rsColorName,
+        const Color aColor);
+};
+
+
+} } // end of namespace ::svx::sidebar
+
+
+
+#endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaPropertyPanel.src b/main/svx/source/sidebar/area/AreaPropertyPanel.src
new file mode 100644
index 0000000..7756af6
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaPropertyPanel.src
@@ -0,0 +1,423 @@
+/**************************************************************
+ * 
+ * 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 "AreaPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define TOOLBOX_WIDTH		50
+#define TOOLBOX_HEIGHT		17
+
+Control RID_SIDEBAR_AREA_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2*( FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT) + CONTROL_SPACING_VERTICAL );
+	HelpID = HID_PROPERTYPANEL_AREA_SECTION ;
+	Text [ en-US ] = "Area";
+
+	FixedText FT_COLOR_LIST
+	{
+		Pos		= MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP  ) ;
+        Size    = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Fill:";
+	};
+	FixedText FL_TRSP_TEXT
+	{
+		Pos  	= MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; 
+        Size    = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Transparency:";
+	};
+	ToolBox TB_COLOR
+	{
+		HelpID = HID_PPROPERTYPANEL_AREA_TBX_COLOR;
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		Text = "Color";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_COLOR ;
+				HelpID = HID_PPROPERTYPANEL_AREA_TBI_COLOR;
+				DropDown = TRUE ;
+				Text = "Color" ;
+			};
+		};
+	};
+	String STR_HELP_COLOR
+	{
+		Text [ en-US ] = "Select the color to apply." ;
+	};
+	String STR_HELP_TYPE
+	{
+		Text [en-US] = "Select the fill type to apply.";
+	};
+	String STR_HELP_ATTR
+	{
+		Text [en-US] = "Select the effect to apply.";
+	};
+	Image IMG_AXIAL
+	{
+	    ImageBitmap = Bitmap{File = "symphony/axial.png";};
+	};
+	Image IMG_ELLI
+	{
+	    ImageBitmap = Bitmap{File = "symphony/ellipsoid.png";};
+	};
+	Image IMG_QUAD
+	{
+	    ImageBitmap = Bitmap{File = "symphony/Quadratic.png";};
+	};
+	Image IMG_RADIAL
+	{
+	    ImageBitmap = Bitmap{File = "symphony/radial.png";};
+	};
+	Image IMG_SQUARE
+	{
+	    ImageBitmap = Bitmap{File = "symphony/Square.png";};
+	};
+	Image IMG_LINEAR
+	{
+	    ImageBitmap = Bitmap{File = "symphony/linear.png";};
+	};
+	Image IMG_COLOR
+	{
+	    ImageBitmap = Bitmap{File = "symphony/fill_color.png";};
+	};
+	
+	//high contract
+	Image IMG_AXIAL_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/axial_h.png";};
+	};
+	Image IMG_ELLI_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/ellipsoid_h.png";};
+	};
+	Image IMG_QUAD_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/Quadratic_h.png";};
+	};
+	Image IMG_RADIAL_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/radial_h.png";};
+	};
+	Image IMG_SQUARE_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/Square_h.png";};
+	};
+	Image IMG_LINEAR_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/linear_h.png";};
+	};
+	Image IMG_COLOR_H
+	{
+	    ImageBitmap = Bitmap{File = "symphony/fill_color_h.png";};
+	};
+	
+	//=====================================================================================================================================
+	ListBox LB_TRGR_TYPES
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH , LISTBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Select the type of transparence to apply." ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES ;
+        StringList [ en-US ] =
+        {
+			< "None" ; Default ; > ;
+			< "Solid" ; Default ; > ;
+			< "Linear" ; Default ; > ;
+            < "Axial" ; Default ; > ;
+            < "Radial" ; Default ; > ;
+            < "Ellipsoid" ; Default ; > ;
+            < "Quadratic" ; Default ; > ;
+            < "Square" ; Default ; > ;
+        };
+	};
+	
+	MetricField MTR_TRANSPARENT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH + 1 ,MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT ;
+        QuickHelpText [ en-US ] = "Specify 0% for fully opaque through 100% for fully transparent." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};
+	
+	ToolBox BTN_GRADIENT
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ;
+		HelpID = HID_PPROPERTYPANEL_AREA_TBX_GRADIENT ;		
+		SVLook = TRUE ;
+		Border = FALSE ;
+		TabStop = TRUE ;
+		Text = "Gradient";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BTX_GRADIENT ;
+				HelpID = HID_PPROPERTYPANEL_AREA_TBI_GRADIENT ;	
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/linear.png" ;
+				};
+				DropDown = TRUE;
+				Text = "Gradient" ;
+			};
+		};
+	};
+	String STR_HELP_GRADIENT
+	{
+		Text [ en-US ] = "Specify the variation of gradient transparency." ;
+	};
+};
+
+Control RID_POPUPPANEL_AREAPAGE_TRGR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+//	Size = MAP_APPFONT( POP_WIDTH, POP_HEIGHT );
+	
+	FixedText FT_TRGR_CENTER_X
+	{
+        Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
+		Text [ en-US ] = "Center ~X:";
+	};
+	MetricField MTR_TRGR_CENTER_X
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X ;
+        QuickHelpText [ en-US ] = "Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};
+	FixedText FT_TRGR_CENTER_Y
+	{
+        Size = MAP_APPFONT ( CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
+		Text [ en-US ] = "Center ~Y:";
+	};
+	MetricField MTR_TRGR_CENTER_Y
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y ;
+        QuickHelpText [ en-US ] = "Specify the vertical offset percentage from the center for the gradient shading style.  50% is the vertical center." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};
+	FixedText FT_TRGR_ANGLE
+	{
+        Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj
+		Text [ en-US ] = "~Angle:";
+	};
+	MetricField MTR_TRGR_ANGLE
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE ;
+        QuickHelpText [ en-US ] = "Specify the angle of rotation for the gradient shading style." ;
+		TabStop = FALSE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Minimum = -9999 ;
+		Maximum = 9999 ;
+		Unit = FUNIT_CUSTOM ;
+		SpinSize = 1 ;
+		CustomUnitText [ en-US ] = " degrees";
+	};	
+	FixedText FT_TRGR_START_VALUE
+	{
+        Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Start value:";
+	};
+	MetricField MTR_TRGR_START_VALUE
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE ;
+        QuickHelpText [ en-US ] = "Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};
+	FixedText FT_TRGR_END_VALUE
+	{
+        Size = MAP_APPFONT (CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //wj
+		Text [ en-US ] = "~End value:";
+	};
+	MetricField MTR_TRGR_END_VALUE
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE ;
+        QuickHelpText [ en-US ] = "Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};
+	FixedText FT_TRGR_BORDER
+	{
+        Size = MAP_APPFONT (  CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //
+		Text [ en-US ] = "~Border:";
+	};
+	MetricField MTR_TRGR_BORDER
+	{
+		Border = TRUE ;
+        Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER ;
+        QuickHelpText [ en-US ] = "Specify the border value of gradient transparence." ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+		CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+	};	
+	//=====================================================================================================================================
+
+	ToolBox BTN_LEFT_SECOND
+	{
+	    Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND ;
+		SVLook = TRUE ;
+		Border = FALSE ;
+		TabStop = TRUE ;
+		Text = "Rotate Left";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_LEFT ;
+				Text = "Rotate Left" ;
+				ItemBitmap = Bitmap
+				{
+		//			File = "symphony/rotate_left.png" ;
+				};
+			};
+		};		
+	};
+	ToolBox BTN_RIGHT_FIRST
+	{
+	    Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST ;
+		SVLook = TRUE ;
+		Border = FALSE ;
+		TabStop = TRUE ;
+		Text = "Rotate Right";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_RIGHT ;
+				Text = "Rotate Right" ;
+				ItemBitmap = Bitmap
+				{
+		//			File = "symphony/rotate_right.png" ;
+				};
+			};
+		};		
+	};
+	String STR_HELP_LEFT
+	{
+		Text [ en-US ] = "Rotate counterclockwise by 45 degrees." ;
+	};
+	String STR_HELP_RIGHT
+	{
+		Text [ en-US ] = "Rotate clockwise by 45 degrees." ;
+	};
+	Image IMG_ROT_LEFT
+	{
+	    ImageBitmap = Bitmap{File = "symphony/rotate_left.png";};
+	};
+	Image IMG_ROT_RIGHT
+	{
+	    ImageBitmap = Bitmap{File = "symphony/rotate_right.png";};
+	};
+};
+Control RID_POPUPPANEL_AERAPAGE_COLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
+	
+	Control VS_COLOR
+	{
+		HelpID = HID_PPROPERTYPANEL_AREA_COLOR_VS;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+		TabStop = TRUE ;
+		Text = "Color";
+	};
+};
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/main/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
new file mode 100644
index 0000000..f3e640f
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
@@ -0,0 +1,349 @@
+/**************************************************************
+ * 
+ * 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 "AreaTransparencyGradientControl.hxx"
+#include "AreaPropertyPanel.hxx"
+#include "AreaPropertyPanel.hrc"
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xflftrit.hxx>
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+namespace svx { namespace sidebar {
+
+// positioning helpers
+#define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
+#define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT))
+#define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT))
+#define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT))
+#define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT))
+#define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT))
+#define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT))
+#define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT))
+
+
+
+
+AreaTransparencyGradientControl::AreaTransparencyGradientControl (
+    Window* pParent,
+    AreaPropertyPanel& rPanel)
+    : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
+      maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
+      maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
+      maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
+      maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
+      maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
+      maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),	
+      maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
+      maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
+      maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
+      maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
+      maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
+      maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
+      maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
+      maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
+      maRotLeft( SVX_RES(IMG_ROT_LEFT)),
+      maRotRight( SVX_RES(IMG_ROT_RIGHT)),
+      mrAreaPropertyPanel(rPanel),
+      mpBindings(NULL)
+{
+	Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
+	maMtrTrgrCenterX.SetModifyHdl( aLink );
+	maMtrTrgrCenterY.SetModifyHdl( aLink );
+	maMtrTrgrAngle.SetModifyHdl( aLink );
+	maMtrTrgrBorder.SetModifyHdl( aLink );
+	maMtrTrgrStartValue.SetModifyHdl( aLink );
+	maMtrTrgrEndValue.SetModifyHdl( aLink );
+	aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl);
+	maBtnLeft45.SetSelectHdl( aLink );
+	aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl);
+	maBtnRight45.SetSelectHdl( aLink );
+	maBtnLeft45.SetItemImage(1,maRotLeft);
+	Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
+	maBtnLeft45.SetOutputSizePixel( aTbxSize );
+	maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT)));	//acc wj
+
+	maBtnRight45.SetItemImage(1,maRotRight);
+	aTbxSize = maBtnRight45.CalcWindowSizePixel();
+	maBtnRight45.SetOutputSizePixel( aTbxSize );
+	maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT)));	//acc wj
+
+	maBtnLeft45.SetBackground(Wallpaper());
+	maBtnLeft45.SetPaintTransparent(true);
+	maBtnRight45.SetBackground(Wallpaper());
+	maBtnRight45.SetPaintTransparent(true);
+
+	FreeResource();
+    mpBindings = mrAreaPropertyPanel.GetBindings();
+}
+
+
+
+
+AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void)
+{
+}
+
+
+
+
+void AreaTransparencyGradientControl::ToGetFocus()
+{
+	if(maMtrTrgrCenterX.IsVisible())
+		maMtrTrgrCenterX.GrabFocus();
+	else
+		maMtrTrgrAngle.GrabFocus();
+}
+
+
+
+
+void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
+{
+	InitStatus(pGradientItem);
+	const XGradient& rGradient = pGradientItem->GetGradientValue();	
+	XGradientStyle eXGS(rGradient.GetGradientStyle());
+	Size aSize(POP_WIDTH,POP_HEIGHT);
+	aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+	Size aSize2(POP_WIDTH,POP_HEIGHT2);
+	aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) );
+	long aPosY = 0;
+	Point aPointAngle;
+	Size aSizeAngle = maMtrTrgrAngle.GetSizePixel();
+	Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
+
+	switch(eXGS)
+	{
+	case XGRAD_LINEAR:
+	case XGRAD_AXIAL:
+		maFtTrgrCenterX.Hide();
+		maMtrTrgrCenterX.Hide();
+		maFtTrgrCenterY.Hide();
+		maMtrTrgrCenterY.Hide();
+		maFtTrgrAngle.Show();
+		maFtTrgrAngle.SetPosPixel(APOS1_1);
+		maMtrTrgrAngle.Show();
+		maMtrTrgrAngle.SetPosPixel(APOS2_1);
+		maFtTrgrStartValue.SetPosPixel(APOS1_3);
+		maMtrTrgrStartValue.SetPosPixel(APOS1_4);
+		maFtTrgrEndValue.SetPosPixel(APOS2_3);
+		maMtrTrgrEndValue.SetPosPixel(APOS2_4);
+		maFtTrgrBorder.SetPosPixel(APOS1_5);
+		maMtrTrgrBorder.SetPosPixel(APOS1_6);
+
+		maBtnLeft45.Show();
+		maBtnRight45.Show();
+
+		aPointAngle = maMtrTrgrAngle.GetPosPixel();
+		aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
+
+		maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
+		maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
+
+		SetSizePixel(aSize2);
+		break;
+
+	case XGRAD_RADIAL:
+		maFtTrgrCenterX.Show();
+		maFtTrgrCenterX.SetPosPixel(APOS1_1);
+		maMtrTrgrCenterX.Show();
+		maMtrTrgrCenterX.SetPosPixel(APOS2_1);
+		maFtTrgrCenterY.Show();
+		maFtTrgrCenterY.SetPosPixel(APOS1_2);
+		maMtrTrgrCenterY.Show();
+		maMtrTrgrCenterY.SetPosPixel(APOS2_2);
+		maFtTrgrAngle.Hide();
+		maMtrTrgrAngle.Hide();
+		maFtTrgrStartValue.SetPosPixel(APOS1_3);
+		maMtrTrgrStartValue.SetPosPixel(APOS1_4);
+		maFtTrgrEndValue.SetPosPixel(APOS2_3);
+		maMtrTrgrEndValue.SetPosPixel(APOS2_4);
+		maFtTrgrBorder.SetPosPixel(APOS1_5);
+		maMtrTrgrBorder.SetPosPixel(APOS1_6);
+
+		maBtnLeft45.Hide();
+		maBtnRight45.Hide();
+
+		SetSizePixel(aSize2);
+
+		break;
+
+	case XGRAD_ELLIPTICAL:
+	case XGRAD_SQUARE:
+	case XGRAD_RECT:
+		maFtTrgrCenterX.Show();
+		maFtTrgrCenterX.SetPosPixel(APOS1_1);
+		maMtrTrgrCenterX.Show();
+		maMtrTrgrCenterX.SetPosPixel(APOS2_1);
+		maFtTrgrCenterY.Show();
+		maFtTrgrCenterY.SetPosPixel(APOS1_2);
+		maMtrTrgrCenterY.Show();
+		maMtrTrgrCenterY.SetPosPixel(APOS2_2);
+		maFtTrgrAngle.Show();
+		maFtTrgrAngle.SetPosPixel(APOS1_3);
+		maMtrTrgrAngle.Show();
+		maMtrTrgrAngle.SetPosPixel(APOS1_4);
+
+		maFtTrgrStartValue.SetPosPixel(APOS1_5);
+		maMtrTrgrStartValue.SetPosPixel(APOS1_6);
+		maFtTrgrEndValue.SetPosPixel(APOS2_5);
+		maMtrTrgrEndValue.SetPosPixel(APOS2_6);
+		maFtTrgrBorder.SetPosPixel(APOS1_7);
+		maMtrTrgrBorder.SetPosPixel(APOS1_8);
+
+		maBtnLeft45.Show();
+		maBtnRight45.Show();
+
+		aPointAngle = maMtrTrgrAngle.GetPosPixel();
+		aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
+
+		maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
+		maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
+
+		SetSizePixel(aSize);
+
+		break;
+	}
+}
+
+
+
+
+void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem)
+{
+	const XGradient& rGradient = pGradientItem->GetGradientValue();
+
+	XGradient aGradient;
+
+	if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX
+        && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY
+        && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE
+        && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255))
+            == AreaPropertyPanel::DEFAULT_STARTVALUE
+        && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255))
+            == AreaPropertyPanel::DEFAULT_ENDVALUE
+        && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER)
+	{
+        aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle());
+	}
+	else
+    {
+		aGradient = rGradient;
+    }
+	maMtrTrgrCenterX.SetValue(aGradient.GetXOffset());
+	maMtrTrgrCenterY.SetValue(aGradient.GetYOffset());
+	maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10);
+	maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
+	maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
+	maMtrTrgrBorder.SetValue(aGradient.GetBorder());	
+}
+
+
+
+
+void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
+{
+	//Added 
+	sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue();
+	while(aMtrValue<0)
+		aMtrValue += 360;
+	sal_uInt16 nVal = aMtrValue/360;
+	nVal = aMtrValue - nVal*360;
+	maMtrTrgrAngle.SetValue(nVal);
+	//End of new code
+	XGradient aTmpGradient(
+		Color(nStartCol, nStartCol, nStartCol),
+		Color(nEndCol, nEndCol, nEndCol),
+		(XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
+		(sal_uInt16)maMtrTrgrAngle.GetValue() * 10,
+		(sal_uInt16)maMtrTrgrCenterX.GetValue(),
+		(sal_uInt16)maMtrTrgrCenterY.GetValue(),
+		(sal_uInt16)maMtrTrgrBorder.GetValue(),
+		100, 100);
+
+    mrAreaPropertyPanel.SetGradient(aTmpGradient);
+
+	SfxItemPool* pPool = NULL;
+	bool bEnable = true;		
+	XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable );
+
+	mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L );
+}
+
+
+
+
+IMPL_LINK(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, void *, pControl)
+{
+	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+	ExecuteValueModify( nStartCol, nEndCol );
+	return( 0L );
+}
+
+
+
+
+IMPL_LINK(AreaTransparencyGradientControl, Left_Click45_Impl, void *, pControl)
+{
+	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+	sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+	if(aTemp>=315)
+		aTemp -= 360;
+	aTemp += 45;
+	maMtrTrgrAngle.SetValue(aTemp);
+	ExecuteValueModify( nStartCol, nEndCol );
+	return( 0L );
+}
+
+
+
+
+IMPL_LINK(AreaTransparencyGradientControl, Right_Click45_Impl, void *, pControl)
+{
+	sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
+	sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+	sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+	if(aTemp<45)
+		aTemp += 360;
+	aTemp -= 45;
+	maMtrTrgrAngle.SetValue(aTemp);
+	ExecuteValueModify( nStartCol, nEndCol );
+	return( 0L );
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/main/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
new file mode 100644
index 0000000..7e2b03f
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/PopupControl.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/xenum.hxx>
+
+class XFillFloatTransparenceItem;
+class SfxBindings;
+
+namespace svx { namespace sidebar {
+
+class AreaPropertyPanel;
+
+class AreaTransparencyGradientControl : public PopupControl
+{
+public:
+	AreaTransparencyGradientControl (
+        Window* pParent,
+        AreaPropertyPanel& rPanel);
+    virtual ~AreaTransparencyGradientControl (void);
+
+	void ToGetFocus();
+	void Rearrange(XFillFloatTransparenceItem* pGradientItem);
+	void InitStatus(XFillFloatTransparenceItem* pGradientItem);
+	void ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol );
+	void SetControlState_Impl(XGradientStyle eXGS);
+
+private:	
+	FixedText           maFtTrgrCenterX;
+	MetricField         maMtrTrgrCenterX;
+	FixedText           maFtTrgrCenterY;
+	MetricField         maMtrTrgrCenterY;
+	FixedText           maFtTrgrAngle;
+	MetricField         maMtrTrgrAngle;	
+	ToolBox		 	    maBtnLeft45;
+	ToolBox		 	    maBtnRight45;
+	FixedText           maFtTrgrStartValue;
+	MetricField         maMtrTrgrStartValue;
+	FixedText           maFtTrgrEndValue;
+	MetricField         maMtrTrgrEndValue;
+	FixedText           maFtTrgrBorder;
+	MetricField         maMtrTrgrBorder;
+	Image				maRotLeft;
+	Image				maRotRight;
+
+	AreaPropertyPanel& mrAreaPropertyPanel;
+	SfxBindings*		mpBindings;
+	DECL_LINK( ModifiedTrgrHdl_Impl, void* );
+	DECL_LINK( Left_Click45_Impl, void* );
+	DECL_LINK( Right_Click45_Impl, void* );
+};
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
new file mode 100644
index 0000000..d2d1001
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
@@ -0,0 +1,60 @@
+/**************************************************************
+ * 
+ * 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 "AreaTransparencyGradientPopup.hxx"
+#include "AreaTransparencyGradientControl.hxx"
+
+
+namespace svx { namespace sidebar {
+
+AreaTransparencyGradientPopup::AreaTransparencyGradientPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency and Gradient")))
+{
+}
+
+
+
+
+AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup (void)
+{
+}
+
+
+
+
+void AreaTransparencyGradientPopup::Rearrange (XFillFloatTransparenceItem* pItem)
+{
+    ProvideContainerAndControl();
+
+    AreaTransparencyGradientControl* pControl = dynamic_cast<AreaTransparencyGradientControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(pItem);	
+}
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx b/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx
new file mode 100644
index 0000000..388d858
--- /dev/null
+++ b/main/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_
+#define _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+
+
+class XFillFloatTransparenceItem;
+
+
+namespace svx { namespace sidebar {
+
+class AreaTransparencyGradientPopup
+    : public Popup
+{
+public :
+    AreaTransparencyGradientPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~AreaTransparencyGradientPopup (void);
+
+    void Rearrange (XFillFloatTransparenceItem* pItem);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+// eof
diff --git a/main/svx/source/sidebar/debug/ColorPanel.cxx b/main/svx/source/sidebar/debug/ColorPanel.cxx
new file mode 100644
index 0000000..ffe59f3
--- /dev/null
+++ b/main/svx/source/sidebar/debug/ColorPanel.cxx
@@ -0,0 +1,233 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "ColorPanel.hxx"
+
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+
+namespace svx { namespace sidebar {
+
+ColorPanel::ColorPanel (::Window* pParent)
+    : ValueSet(pParent),
+      mnPreferredColumnCount(2)
+{
+    WinBits aStyle = 
+        WB_ITEMBORDER 
+        | WB_DOUBLEBORDER 
+        | WB_NAMEFIELD 
+        | WB_FLATVALUESET
+        | WB_TABSTOP
+        | WB_VSCROLL;
+
+    SetStyle(GetStyle() | aStyle); 
+    SetExtraSpacing(2);
+
+    Fill ();
+    Show();
+}
+
+
+
+
+ColorPanel::~ColorPanel (void)
+{
+}
+
+
+
+
+sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth)
+{
+    sal_Int32 nPreferredHeight = 0;
+    if (GetItemCount()>0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        if (nWidth>0 && aItemSize.Width()>0)
+        {
+            int nColumnCount = nWidth / aItemSize.Width();
+            if (nColumnCount <= 0)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+            int nRowCount = (GetItemCount() + nColumnCount-1) 
+                / nColumnCount;
+            nPreferredHeight = nRowCount * aItemSize.Height();
+        }
+    }
+    return nPreferredHeight;
+}
+
+
+
+
+void ColorPanel::Resize (void)
+{
+    ::Window::Resize();
+    Size aWindowSize = GetOutputSizePixel();
+    SetPosSizePixel(Point(0,0), aWindowSize);
+    if (IsVisible() && aWindowSize.Width() > 0)
+    {
+        // Calculate the number of rows and columns.
+        if (GetItemCount() > 0)
+        {
+            Image aImage = GetItemImage(GetItemId(0));
+            Size aItemSize = CalcItemSizePixel (
+                aImage.GetSizePixel());
+            int nColumnCount = aWindowSize.Width() / 30;
+            if (nColumnCount < 1)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+
+            sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount);
+            
+            SetColCount((sal_uInt16)nColumnCount);
+            SetLineCount(nRowCount);
+        }
+    }
+
+}
+
+
+
+
+int ColorPanel::CalculateRowCount (const Size&, int nColumnCount)
+{
+    int nRowCount = 0;
+
+    if (GetItemCount()>0 && nColumnCount>0)
+    {
+        nRowCount = GetOutputSizePixel().Height() / 30;
+        if (nRowCount < 1)
+            nRowCount = 1;
+    }
+
+    return nRowCount;
+}
+
+
+
+
+void ColorPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+    Fill();
+}
+
+
+
+
+void ColorPanel::Fill (void)
+{
+    const StyleSettings& rSettings (
+        Application::GetSettings().GetStyleSettings());
+    Clear();
+    SetItemWidth (30);
+    SetItemHeight (30);
+    sal_uInt16 i = 0;
+    InsertItem (++i, rSettings.GetFaceColor());
+    SetItemText (i, String::CreateFromAscii("FaceColor"));
+    InsertItem (++i, rSettings.GetCheckedColor());
+    SetItemText (i, String::CreateFromAscii("CheckedColor"));
+    InsertItem (++i, rSettings.GetLightColor());
+    SetItemText (i, String::CreateFromAscii("LightColor"));
+    InsertItem (++i, rSettings.GetLightBorderColor());
+    SetItemText (i, String::CreateFromAscii("LightBorderColor"));
+    InsertItem (++i, rSettings.GetShadowColor());
+    SetItemText (i, String::CreateFromAscii("ShadowColor"));
+    InsertItem (++i, rSettings.GetDarkShadowColor());
+    SetItemText (i, String::CreateFromAscii("DarkShadowColor"));
+    InsertItem (++i, rSettings.GetButtonTextColor());
+    SetItemText (i, String::CreateFromAscii("ButtonTextColor"));
+    InsertItem (++i, rSettings.GetRadioCheckTextColor());
+    SetItemText (i, String::CreateFromAscii("RadioCheckTextColor"));
+    InsertItem (++i, rSettings.GetGroupTextColor());
+    SetItemText (i, String::CreateFromAscii("GroupTextColor"));
+    InsertItem (++i, rSettings.GetLabelTextColor());
+    SetItemText (i, String::CreateFromAscii("LabelTextColor"));
+    InsertItem (++i, rSettings.GetInfoTextColor());
+    SetItemText (i, String::CreateFromAscii("InfoTextColor"));
+    InsertItem (++i, rSettings.GetWindowColor());
+    SetItemText (i, String::CreateFromAscii("WindowColor"));
+    InsertItem (++i, rSettings.GetWindowTextColor());
+    SetItemText (i, String::CreateFromAscii("WindowTextColor"));
+    InsertItem (++i, rSettings.GetDialogColor());
+    SetItemText (i, String::CreateFromAscii("DialogColor"));
+    InsertItem (++i, rSettings.GetDialogTextColor());
+    SetItemText (i, String::CreateFromAscii("DialogTextColor"));
+    InsertItem (++i, rSettings.GetWorkspaceColor());
+    SetItemText (i, String::CreateFromAscii("WorkspaceColor"));
+    InsertItem (++i, rSettings.GetFieldColor());
+    SetItemText (i, String::CreateFromAscii("FieldColor"));
+    InsertItem (++i, rSettings.GetFieldTextColor());
+    SetItemText (i, String::CreateFromAscii("FieldTextColor"));
+    InsertItem (++i, rSettings.GetActiveColor());
+    SetItemText (i, String::CreateFromAscii("ActiveColor"));
+    InsertItem (++i, rSettings.GetActiveColor2());
+    SetItemText (i, String::CreateFromAscii("ActiveColor2"));
+    InsertItem (++i, rSettings.GetActiveTextColor());
+    SetItemText (i, String::CreateFromAscii("ActiveTextColor"));
+    InsertItem (++i, rSettings.GetActiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("ActiveBorderColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor2());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor2"));
+    InsertItem (++i, rSettings.GetDeactiveTextColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveTextColor"));
+    InsertItem (++i, rSettings.GetDeactiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveBorderColor"));
+    InsertItem (++i, rSettings.GetHighlightColor());
+    SetItemText (i, String::CreateFromAscii("HighlightColor"));
+    InsertItem (++i, rSettings.GetHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("HighlightTextColor"));
+    InsertItem (++i, rSettings.GetDisableColor());
+    SetItemText (i, String::CreateFromAscii("DisableColor"));
+    InsertItem (++i, rSettings.GetHelpColor());
+    SetItemText (i, String::CreateFromAscii("HelpColor"));
+    InsertItem (++i, rSettings.GetHelpTextColor());
+    SetItemText (i, String::CreateFromAscii("HelpTextColor"));
+    InsertItem (++i, rSettings.GetMenuColor());
+    SetItemText (i, String::CreateFromAscii("MenuColor"));
+    InsertItem (++i, rSettings.GetMenuBarColor());
+    SetItemText (i, String::CreateFromAscii("MenuBarColor"));
+    InsertItem (++i, rSettings.GetMenuBorderColor());
+    SetItemText (i, String::CreateFromAscii("MenuBorderColor"));
+    InsertItem (++i, rSettings.GetMenuTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuTextColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor"));
+    InsertItem (++i, rSettings.GetLinkColor());
+    SetItemText (i, String::CreateFromAscii("LinkColor"));
+    InsertItem (++i, rSettings.GetVisitedLinkColor());
+    SetItemText (i, String::CreateFromAscii("VisitedLinkColor"));
+    InsertItem (++i, rSettings.GetHighlightLinkColor());
+    SetItemText (i, String::CreateFromAscii("HighlightLinkColor"));
+    InsertItem (++i, rSettings.GetFontColor());
+    SetItemText (i, String::CreateFromAscii("FontColor"));
+}
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/debug/ColorPanel.hxx b/main/svx/source/sidebar/debug/ColorPanel.hxx
new file mode 100644
index 0000000..7fd05c5
--- /dev/null
+++ b/main/svx/source/sidebar/debug/ColorPanel.hxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_COLOR_PANEL_HXX
+#define SVX_SIDEBAR_COLOR_PANEL_HXX
+
+#include <svtools/valueset.hxx>
+#include <vcl/window.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** This demo panel shows the colors that are available from the
+    StyleSettings.
+*/
+class ColorPanel
+    : public ValueSet
+{
+public:
+    ColorPanel (::Window* pParent);
+    virtual ~ColorPanel (void);
+
+    // From ::Window
+    virtual void Resize (void);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+    int mnPreferredColumnCount;
+
+    /** Depending on the given number of columns and the item size
+        calculate the number of rows that are necessary to display all
+        items.
+    */
+    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+    void Fill (void);
+
+    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/debug/ContextPanel.cxx b/main/svx/source/sidebar/debug/ContextPanel.cxx
new file mode 100644
index 0000000..5f8b3bf
--- /dev/null
+++ b/main/svx/source/sidebar/debug/ContextPanel.cxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "ContextPanel.hxx"
+
+namespace svx { namespace sidebar {
+
+ContextPanel::ContextPanel (::Window* pParent)
+    : Window(pParent, 0),
+      maApplicationName(this, 0),
+      maContextName(this, 0)
+{
+    maApplicationName.SetPosSizePixel(5,5, 250,15);
+    maContextName.SetPosSizePixel(5,25, 250,15);
+
+    maApplicationName.Show();
+    maContextName.Show();
+    Show();
+}
+
+
+
+
+ContextPanel::~ContextPanel (void)
+{
+}
+
+
+
+
+sal_Int32 ContextPanel::GetPreferredHeight (sal_Int32 nWidth)
+{
+    const sal_Int32 nHeight (maContextName.GetPosPixel().Y() + maContextName.GetSizePixel().Height() + 5);
+    return nHeight;
+}
+
+
+
+
+void ContextPanel::HandleContextChange (const sfx2::sidebar::EnumContext aContext)
+{
+    maApplicationName.SetText(aContext.GetApplicationName());
+    maContextName.SetText(aContext.GetContextName());
+}
+
+
+
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/debug/ContextPanel.hxx b/main/svx/source/sidebar/debug/ContextPanel.hxx
new file mode 100644
index 0000000..7e26ea5
--- /dev/null
+++ b/main/svx/source/sidebar/debug/ContextPanel.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX
+#define SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX
+
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <vcl/window.hxx>
+#include <vcl/fixed.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** Display the current context.
+*/
+class ContextPanel
+    : public Window,
+      public sfx2::sidebar::IContextChangeReceiver
+{
+public:
+    ContextPanel (::Window* pParent);
+    virtual ~ContextPanel (void);
+
+    // From Window
+    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+
+    // From IContextChangeReceiverInterface
+    virtual void HandleContextChange (const ::sfx2::sidebar::EnumContext aContext);
+
+private:
+    FixedText maApplicationName;
+    FixedText maContextName;
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/debug/NotYetImplementedPanel.cxx b/main/svx/source/sidebar/debug/NotYetImplementedPanel.cxx
new file mode 100644
index 0000000..62205f4
--- /dev/null
+++ b/main/svx/source/sidebar/debug/NotYetImplementedPanel.cxx
@@ -0,0 +1,49 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "NotYetImplementedPanel.hxx"
+
+namespace svx { namespace sidebar {
+
+NotYetImplementedPanel::NotYetImplementedPanel (::Window* pParent)
+    : Window(pParent, 0),
+      maMessageControl(this, 0)
+{
+    maMessageControl.SetPosSizePixel(5,5, 250,15);
+    maMessageControl.SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not yet implemented")));
+    
+    maMessageControl.Show();
+    Show();
+}
+
+
+
+
+NotYetImplementedPanel::~NotYetImplementedPanel (void)
+{
+}
+
+
+
+
+} } // end of namespace ::svx::sidebar
diff --git a/main/svx/source/sidebar/debug/NotYetImplementedPanel.hxx b/main/svx/source/sidebar/debug/NotYetImplementedPanel.hxx
new file mode 100644
index 0000000..b33406d
--- /dev/null
+++ b/main/svx/source/sidebar/debug/NotYetImplementedPanel.hxx
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX
+#define SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/fixed.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** Display a panel as placeholder for a not-yet-implemented panel.
+*/
+class NotYetImplementedPanel
+    : public Window
+{
+public:
+    NotYetImplementedPanel (::Window* pParent);
+    virtual ~NotYetImplementedPanel (void);
+
+private:
+    FixedText maMessageControl;
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/gallery/GalleryPanel.hxx b/main/svx/source/sidebar/gallery/GalleryPanel.hxx
new file mode 100644
index 0000000..af3226a
--- /dev/null
+++ b/main/svx/source/sidebar/gallery/GalleryPanel.hxx
@@ -0,0 +1,30 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_GALLERY_PANEL_HXX
+#define SVX_SIDEBAR_GALLERY_PANEL_HXX
+
+class GelleryPanel
+{
+};
+
+
+#endif
diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
new file mode 100644
index 0000000..eca51ea
--- /dev/null
+++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -0,0 +1,459 @@
+/**************************************************************
+ * 
+ * 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 <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <GraphicPropertyPanel.hxx>
+#include <GraphicPropertyPanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace open
+
+namespace svx { namespace sidebar {
+
+//////////////////////////////////////////////////////////////////////////////
+
+GraphicPropertyPanel::GraphicPropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+:   Control(
+        pParent, 
+        SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)),
+    mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))),
+    mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))),
+    mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))),
+    mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))),
+    mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))),
+    mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))),
+    mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
+    mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))),
+    mpMtrRed(new MetricField(this, SVX_RES(MF_RED))),
+    mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))),
+    mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))),
+    mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))),
+    maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this),
+    maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this),
+    maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this),
+    maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this),
+    maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this),
+    maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this),
+    maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this),
+    maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this),
+    maImgNormal(SVX_RES(IMG_NORMAL)),
+    maImgBW(SVX_RES(IMG_BW)),
+    maImgGray(SVX_RES(IMG_GRAY)),
+    maImgWater(SVX_RES(IMG_WATER)),
+    maImgRed(this, SVX_RES(IMG_RED)),
+    maImgGreen(this, SVX_RES(IMG_GREEN)),
+    maImgBlue(this, SVX_RES(IMG_BLUE)),
+    maImgGamma(this, SVX_RES(IMG_GAMMA)),
+    msNormal(SVX_RES(STR_NORMAL)),
+    msBW(SVX_RES(STR_BW)),
+    msGray(SVX_RES(STR_GRAY)),
+    msWater(SVX_RES(STR_WATER)),
+    mxFrame(rxFrame),
+    mpBindings(pBindings)
+{
+    Initialize();
+    FreeResource();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+GraphicPropertyPanel::~GraphicPropertyPanel()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GraphicPropertyPanel::Initialize()
+{
+    mpFtBrightness->SetBackground(Wallpaper());
+    mpFtContrast->SetBackground(Wallpaper());
+    mpFtColorMode->SetBackground(Wallpaper());
+    mpFtTrans->SetBackground(Wallpaper());
+
+    mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) );
+	mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness")));	//wj acc
+	mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) );
+	mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast")));	//wj acc
+	mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) );
+	mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));	//wj acc
+
+	mpLBColorMode->InsertEntry( msNormal, maImgNormal );
+	mpLBColorMode->InsertEntry( msGray, maImgGray );
+	mpLBColorMode->InsertEntry( msBW, maImgBW );
+	mpLBColorMode->InsertEntry( msWater, maImgWater );
+	mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl ));
+	mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode")));	//wj acc
+
+	mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) );
+	mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) );
+	mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) );
+	mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) );
+	mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText());	//wj acc
+	mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText());	//wj acc
+	mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText());		//wj acc
+	mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value")));	//wj acc
+
+    mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get());
+	mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get());
+	mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get());
+	mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get());
+	mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get());	//7874
+	mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get());	//7874
+	mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get());	//7874
+	mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get());	//7874
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG )
+{
+	sal_Int16 nBright = mpMtrBrightness->GetValue();
+	SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG )
+{
+	sal_Int16 nContrast = mpMtrContrast->GetValue();
+	SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG )
+{
+	sal_Int16 nTrans = mpMtrTrans->GetValue();
+	SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, pBox )
+{
+	sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos();
+	SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG )
+{
+	sal_Int16 nRed = mpMtrRed->GetValue();
+	SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG )
+{
+	sal_Int16 nGreen = mpMtrGreen->GetValue();
+	SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG)
+{
+	sal_Int16 nBlue = mpMtrBlue->GetValue();
+	SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG)
+{
+	sal_Int32 nGamma = mpMtrGamma->GetValue();
+	SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma );
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L);
+	return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GraphicPropertyPanel::SetupIcons(void)
+{
+    if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+        // todo
+    }
+    else
+    {
+        // todo
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+GraphicPropertyPanel* GraphicPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2);
+    
+    return new GraphicPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GraphicPropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GraphicPropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{
+	switch( nSID )
+	{
+	case SID_ATTR_GRAF_LUMINANCE:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrBrightness->Enable();
+            const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nBright = pItem->GetValue();
+				mpMtrBrightness->SetValue(nBright);
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrBrightness->Disable();
+		else
+		{
+			mpMtrBrightness->Enable();
+			mpMtrBrightness->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_CONTRAST:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrContrast->Enable();
+            const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
+
+            if(pItem)
+			{
+				sal_Int64 nContrast = pItem->GetValue();
+				mpMtrContrast->SetValue(nContrast);
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrContrast->Disable();
+		else
+		{
+			mpMtrContrast->Enable();
+			mpMtrContrast->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_TRANSPARENCE:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrTrans->Enable();
+            const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nTrans = pItem->GetValue();
+				mpMtrTrans->SetValue(nTrans);
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrTrans->Disable();
+		else
+		{
+			mpMtrTrans->Enable();
+			mpMtrTrans->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_MODE:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpLBColorMode->Enable();
+            const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nTrans = pItem->GetValue();
+				mpLBColorMode->SelectEntryPos(nTrans);
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpLBColorMode->Disable();
+		else
+		{
+			mpLBColorMode->Enable();
+			mpLBColorMode->SetNoSelection();
+		}
+		break;
+	case SID_ATTR_GRAF_RED:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrRed->Enable();
+            const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nRed = pItem->GetValue();
+				mpMtrRed->SetValue( nRed );
+			}
+		}			
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrRed->Disable();
+		else
+		{
+			mpMtrRed->Enable();
+			mpMtrRed->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_GREEN:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrGreen->Enable();
+            const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nGreen = pItem->GetValue();
+				mpMtrGreen->SetValue( nGreen );
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrGreen->Disable();
+		else
+		{
+			mpMtrGreen->Enable();
+			mpMtrGreen->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_BLUE:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrBlue->Enable();
+            const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nBlue = pItem->GetValue();
+				mpMtrBlue->SetValue( nBlue );
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrBlue->Disable();
+		else
+		{
+			mpMtrBlue->Enable();
+			mpMtrBlue->SetText( String());
+		}
+		break;
+	case SID_ATTR_GRAF_GAMMA:
+		if( eState >= SFX_ITEM_AVAILABLE)
+		{
+			mpMtrGamma->Enable();
+            const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState);
+
+			if(pItem)
+			{
+				sal_Int64 nGamma = pItem->GetValue();
+				mpMtrGamma->SetValue( nGamma );
+			}
+		}
+		else if( eState == SFX_ITEM_DISABLED )
+			mpMtrGamma->Disable();
+		else
+		{
+			mpMtrGamma->Enable();
+			mpMtrGamma->SetText( String());
+		}
+		break;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SfxBindings* GraphicPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// namespace close
+
+}} // end of namespace ::svx::sidebar
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc
new file mode 100644
index 0000000..f6548c0
--- /dev/null
+++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc
@@ -0,0 +1,82 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+// RID_SIDEBAR_GRAPHIC_PANEL--------------------------------------------------------------
+#define FT_BRIGHTNESS		1
+#define MTR_BRIGHTNESS		2
+#define FT_CONTRAST			3
+#define MTR_CONTRAST		4
+#define FT_TRANSPARENT		5
+#define MTR_TRANSPARENT		6
+#define FT_COLOR_MODE       10
+#define LB_COLOR_MODE		11
+#define MBOX_WIDTH			50
+
+#define IMG_NORMAL			13
+#define IMG_BW				14
+#define IMG_GRAY			15
+#define IMG_WATER			16
+#define STR_NORMAL			17
+#define STR_BW				18
+#define STR_GRAY			19
+#define STR_WATER			20
+#define MF_RED				21
+#define MF_GREEN			22
+#define MF_BLUE				23
+#define MF_GAMMA			24
+#define IMG_RED				25
+#define IMG_GREEN			26
+#define IMG_BLUE			27
+#define IMG_GAMMA           28
+
+//===========================location================================
+
+#define FT_BRIGHTNESS_X			SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_BRIGHTNESS_Y			SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define MTR_BRIGHTNESS_X		FT_BRIGHTNESS_X
+#define MTR_BRIGHTNESS_Y		FT_BRIGHTNESS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_CONTRAST_X			FT_BRIGHTNESS_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL
+#define FT_CONTRAST_Y			FT_BRIGHTNESS_Y
+#define MTR_CONTRAST_X			FT_CONTRAST_X
+#define MTR_CONTRAST_Y			MTR_BRIGHTNESS_Y
+
+#define FT_COLOR_MODE_X			FT_BRIGHTNESS_X
+#define FT_COLOR_MODE_Y			MTR_BRIGHTNESS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define LBX_COLOR_MODE_X		FT_COLOR_MODE_X
+#define LBX_COLOR_MODE_Y		FT_COLOR_MODE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define FT_TRANSPARENT_X		FT_CONTRAST_X
+#define FT_TRANSPARENT_Y		MTR_CONTRAST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define MTR_TRANS_X				FT_TRANSPARENT_X
+#define MTR_TRANS_Y				FT_TRANSPARENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define MF_RED_X				SECTIONPAGE_MARGIN_HORIZONTAL
+#define MF_RED_Y				MTR_TRANS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define MF_GREEN_X				MF_RED_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL
+#define MF_GREEN_Y				MF_RED_Y
+#define MF_BLUE_X				MF_RED_X
+#define MF_BLUE_Y				MF_RED_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define MF_GAMMA_X				MF_GREEN_X
+#define MF_GAMMA_Y				MF_BLUE_Y
+
+#define PAGE_HEIGHT				MF_GAMMA_Y + MBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT      
+
+// eof
diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
new file mode 100644
index 0000000..40fee9e
--- /dev/null
+++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -0,0 +1,127 @@
+/**************************************************************
+ * 
+ * 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 SVX_PROPERTYPANEL_GRAPHICPAGE_HXX
+#define SVX_PROPERTYPANEL_GRAPHICPAGE_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <vcl/fixed.hxx>
+#include <boost/scoped_ptr.hpp>
+
+class FixedText;
+class MetricField;
+class ListBox;
+class FloatingWindow;
+
+
+namespace svx { namespace sidebar {
+
+class GraphicPropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static GraphicPropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+private:
+    //ui controls
+    ::boost::scoped_ptr< FixedText >                    mpFtBrightness;
+    ::boost::scoped_ptr< MetricField >                  mpMtrBrightness;
+    ::boost::scoped_ptr< FixedText >                    mpFtContrast;
+    ::boost::scoped_ptr< MetricField >                  mpMtrContrast;
+    ::boost::scoped_ptr< FixedText >                    mpFtColorMode;
+    ::boost::scoped_ptr< ListBox >                      mpLBColorMode;
+    ::boost::scoped_ptr< FixedText >                    mpFtTrans;
+    ::boost::scoped_ptr< MetricField >                  mpMtrTrans;
+    ::boost::scoped_ptr< MetricField >                  mpMtrRed;
+    ::boost::scoped_ptr< MetricField >                  mpMtrGreen;
+    ::boost::scoped_ptr< MetricField >                  mpMtrBlue;
+    ::boost::scoped_ptr< MetricField >                  mpMtrGamma;
+
+    ::sfx2::sidebar::ControllerItem                     maBrightControl;
+    ::sfx2::sidebar::ControllerItem                     maContrastControl;
+    ::sfx2::sidebar::ControllerItem                     maTransparenceControl;
+    ::sfx2::sidebar::ControllerItem                     maRedControl;
+    ::sfx2::sidebar::ControllerItem                     maGreenControl;
+    ::sfx2::sidebar::ControllerItem                     maBlueControl;
+    ::sfx2::sidebar::ControllerItem                     maGammaControl;
+    ::sfx2::sidebar::ControllerItem                     maModeControl;
+
+    Image                                               maImgNormal;
+    Image                                               maImgBW;
+    Image                                               maImgGray;
+    Image                                               maImgWater;
+
+    FixedImage                                          maImgRed;
+    FixedImage                                          maImgGreen;
+    FixedImage                                          maImgBlue;
+    FixedImage                                          maImgGamma;
+
+    String                                              msNormal;
+    String                                              msBW;
+    String                                              msGray;
+    String                                              msWater;
+
+    cssu::Reference<css::frame::XFrame>                 mxFrame;
+    SfxBindings*                                        mpBindings;
+
+    DECL_LINK( ModifyBrightnessHdl, void * );
+    DECL_LINK( ModifyContrastHdl, void * );
+    DECL_LINK( ModifyTransHdl, void * );
+    DECL_LINK( ClickColorModeHdl, ToolBox * );
+    DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
+    DECL_LINK( RedHdl, void*);
+    DECL_LINK( GreenHdl, void*);
+    DECL_LINK( BlueHdl, void*);
+    DECL_LINK( GammaHdl, void*);
+
+    // constructor/destuctor
+    GraphicPropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~GraphicPropertyPanel();
+
+    void SetupIcons(void);
+    void Initialize();
+};
+
+
+} } // end of namespace ::svx::sidebar
+
+#endif
+
+// eof
diff --git a/main/svx/source/sidebar/graphic/GraphicPropertyPanel.src b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.src
new file mode 100644
index 0000000..62618db
--- /dev/null
+++ b/main/svx/source/sidebar/graphic/GraphicPropertyPanel.src
@@ -0,0 +1,257 @@
+/**************************************************************
+ * 
+ * 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 "GraphicPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+Control RID_SIDEBAR_GRAPHIC_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT );
+	HelpID = HID_PROPERTYPANEL_GRAPHIC_SECTION ;
+	Text = "Graphic";
+	
+	FixedText FT_BRIGHTNESS
+	{
+		Pos = MAP_APPFONT ( FT_BRIGHTNESS_X, FT_BRIGHTNESS_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Brightness:";
+	};
+	MetricField MTR_BRIGHTNESS
+	{
+		Border = TRUE ;
+		Pos = MAP_APPFONT ( MTR_BRIGHTNESS_X, MTR_BRIGHTNESS_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT;
+        QuickHelpText [ en-US ] = "Specify the luminance of the graphic.";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		Minimum = -100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};
+	FixedText FT_CONTRAST
+	{
+		Pos = MAP_APPFONT ( FT_CONTRAST_X, FT_CONTRAST_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Contrast:";
+	};
+	MetricField MTR_CONTRAST
+	{
+		Border = TRUE ;
+		Pos = MAP_APPFONT ( MTR_CONTRAST_X, MTR_CONTRAST_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST;
+        QuickHelpText [ en-US ] = "Specify the degree of difference between the lightest and darkest parts of the graphic.";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		Minimum = -100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};
+	FixedText FT_COLOR_MODE
+	{
+		Pos = MAP_APPFONT ( FT_COLOR_MODE_X, FT_COLOR_MODE_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ;
+		Text [ en-US ] = "Color ~mode:";
+	};
+	ListBox LB_COLOR_MODE
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( LBX_COLOR_MODE_X , LBX_COLOR_MODE_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH , 100 ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE;
+        QuickHelpText [ en-US ] = "Select the color mode of the graphic.";
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+	};
+	FixedText FT_TRANSPARENT
+	{
+		Pos = MAP_APPFONT ( FT_TRANSPARENT_X, FT_TRANSPARENT_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Transparency:";
+	};
+	MetricField MTR_TRANSPARENT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MTR_TRANS_X, MTR_TRANS_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH ,MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP;
+        QuickHelpText [ en-US ] = "Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent.";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};	
+	MetricField MF_RED
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MF_RED_X + 10, MF_RED_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH - 10,MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_RED;
+        QuickHelpText [ en-US ] = "Red";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		Minimum = -100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};
+	MetricField MF_GREEN
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MF_GREEN_X + 10, MF_GREEN_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN;
+        QuickHelpText [ en-US ] = "Green";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		Minimum = -100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};
+	MetricField MF_BLUE
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MF_BLUE_X + 10, MF_BLUE_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE;
+        QuickHelpText [ en-US ] = "Blue";
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		Minimum = -100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+        CustomUnitText = "%" ;
+		SpinSize = 1 ;
+	};
+	MetricField MF_GAMMA
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MF_GAMMA_X + 10, MF_GAMMA_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ;
+        HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA;
+        QuickHelpText [ en-US ] = "Specify the gamma value that affects the brightness of the midtone values.";
+		TabStop = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Minimum = 10;
+		Maximum = 1000;
+		DecimalDigits = 2;
+		SpinSize = 10;
+	};
+	Image IMG_NORMAL  
+    {
+	    ImageBitmap = Bitmap{File = "symphony/ColorModeNormal_16x16.png";};
+	}; 
+	Image IMG_BW
+    {
+	    ImageBitmap = Bitmap{File = "symphony/ColorModeBlackWhite_16x16.png";};
+	};
+	Image IMG_GRAY
+    {
+	    ImageBitmap = Bitmap{File = "symphony/ColorModeGrey_16x16.png";};
+	};
+	Image IMG_WATER
+    {
+	    ImageBitmap = Bitmap{File = "symphony/ColorModeWaterMark_16x16.png";};
+	};
+	FixedImage IMG_RED
+    {
+        Pos = MAP_APPFONT( MF_RED_X, MF_RED_Y );
+        Size = MAP_APPFONT( 10, 12 );
+        Fixed = Image
+        {
+            ImageBitmap = Bitmap { File = "symphony/AdjustColorRed_16x16.png"; };
+		};
+    };
+    FixedImage IMG_GREEN
+    {
+        Pos = MAP_APPFONT( MF_GREEN_X, MF_GREEN_Y );
+        Size = MAP_APPFONT( 10, 12 );
+        Fixed = Image
+        {
+            ImageBitmap = Bitmap { File = "symphony/AdjustColorGreen_16x16.png"; };
+		};
+    };
+	FixedImage IMG_BLUE
+    {
+        Pos = MAP_APPFONT( MF_BLUE_X, MF_BLUE_Y );
+        Size = MAP_APPFONT( 10, 12 );
+        Fixed = Image
+        {
+            ImageBitmap = Bitmap { File = "symphony/AdjustColorBlue_16x16.png"; };
+		};
+    };
+	FixedImage IMG_GAMMA
+    {
+        Pos = MAP_APPFONT( MF_GAMMA_X, MF_GAMMA_Y );
+        Size = MAP_APPFONT( 10, 12 );
+        Fixed = Image
+        {
+            ImageBitmap = Bitmap { File = "symphony/AdjustColorGamma_16x16.png"; };
+		};
+    };
+	String STR_NORMAL
+	{
+		Text [ en-US ] = "Normal";
+	};
+	String STR_BW
+	{
+		Text [ en-US ] = "Black/White";
+	};
+	String STR_GRAY
+	{
+		Text [ en-US ] = "Grayscale";
+	};
+	String STR_WATER
+	{
+		Text [ en-US ] = "Watermark";
+	};
+};
+
+// eof
diff --git a/main/svx/source/sidebar/line/LinePropertyPanel.cxx b/main/svx/source/sidebar/line/LinePropertyPanel.cxx
new file mode 100644
index 0000000..fc1675a
--- /dev/null
+++ b/main/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -0,0 +1,1161 @@
+/**************************************************************
+ * 
+ * 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 <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <LinePropertyPanel.hxx>
+#include <LinePropertyPanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xdash.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/svxitems.hrc>
+#include <svtools/valueset.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/viewoptions.hxx>
+#include <comphelper/processfactory.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlndsit.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/xlnwtit.hxx>
+#include <vcl/lstbox.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xlinjoit.hxx>
+#include "svx/sidebar/PopupContainer.hxx"
+#include "svx/sidebar/PopupControl.hxx"
+#include <svx/sidebar/ColorControl.hxx>
+#include "LineWidthControl.hxx"
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace {
+    short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol )
+    {
+        if(rCol == COL_AUTO)
+            return 0;
+
+        bool	bFound = false;
+        sal_uInt16 nCount = rValueSet.GetItemCount();
+        sal_uInt16	n	   = 1;
+
+        while ( !bFound && n <= nCount )
+        {
+            Color aValCol = rValueSet.GetItemColor(n);
+
+            bFound = (   aValCol.GetRed()   == rCol.GetRed()
+                && aValCol.GetGreen() == rCol.GetGreen()
+                && aValCol.GetBlue()  == rCol.GetBlue() );
+
+            if ( !bFound )
+                n++;
+        }
+        return bFound ? n : -1;
+    }
+
+    Color GetTransparentColor (void)
+    {
+        return COL_TRANSPARENT;
+    }
+
+    void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
+    {
+        const sal_uInt32 nCount(rList.Count());
+        const String sNone(SVX_RES(RID_SVXSTR_NONE));
+
+        rListBoxStart.SetUpdateMode(false);
+        rListBoxEnd.SetUpdateMode(false);
+
+        rListBoxStart.Clear();
+        rListBoxEnd.Clear();
+
+        // add 'none' entries
+        rListBoxStart.InsertEntry(sNone);
+        rListBoxEnd.InsertEntry(sNone);
+
+        for(sal_uInt32 i(0); i < nCount; i++)
+        {
+            XLineEndEntry* pEntry = rList.GetLineEnd(i);
+            const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i);
+
+            if(!aBitmap.IsEmpty())
+            {
+                Bitmap aCopyStart(aBitmap);
+                Bitmap aCopyEnd(aBitmap);
+                // delete pBitmap;
+                const Size aBmpSize(aCopyStart.GetSizePixel());
+                const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
+                const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
+
+                aCopyStart.Crop(aCropRectStart);
+                rListBoxStart.InsertEntry(
+                    pEntry->GetName(),
+                    aCopyStart);
+
+                aCopyEnd.Crop(aCropRectEnd);
+                rListBoxEnd.InsertEntry(
+                    pEntry->GetName(),
+                    aCopyEnd);
+            }
+            else
+            {
+                rListBoxStart.InsertEntry(pEntry->GetName());
+                rListBoxEnd.InsertEntry(pEntry->GetName());
+            }
+        }
+
+        rListBoxStart.SetUpdateMode(true);
+        rListBoxEnd.SetUpdateMode(true);
+    }
+
+    void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
+    {
+        const sal_uInt32 nCount(rList.Count());
+        rListBox.SetUpdateMode(false);
+
+        rListBox.Clear();
+
+        // entry for 'none'
+        rListBox.InsertEntry(rList.GetStringForUiNoLine());
+
+        // entry for solid line
+        rListBox.InsertEntry(rList.GetStringForUiSolidLine(), rList.GetBitmapForUISolidLine());
+
+        for(sal_uInt32 i(0); i < nCount; i++)
+        {
+            XDashEntry* pEntry = rList.GetDash(i);
+            const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i);
+
+            if(!aBitmap.IsEmpty())
+            {
+                rListBox.InsertEntry(
+                    pEntry->GetName(),
+                    aBitmap);
+                // delete pBitmap;
+            }
+            else
+            {
+                rListBox.InsertEntry(pEntry->GetName());
+            }
+        }
+
+        rListBox.SetUpdateMode(true);
+    }
+} // end of anonymous namespace
+
+// namespace open
+
+namespace svx { namespace sidebar {
+
+LinePropertyPanel::LinePropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+:   Control(
+        pParent, 
+        SVX_RES(RID_SIDEBAR_LINE_PANEL)),
+    mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))),
+    mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))),
+    mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))),
+    mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))),
+    mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))),
+    mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))),
+    mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
+    mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))),
+    mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))),
+    mpLBStart(new ListBox(this, SVX_RES(LB_START))),
+    mpLBEnd(new ListBox(this, SVX_RES(LB_END))),
+    mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))),
+    mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))),
+    mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))),
+    mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))),
+    maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
+    maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
+    maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
+    maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this),
+    maStartControl(SID_ATTR_LINE_START, *pBindings, *this),
+    maEndControl(SID_ATTR_LINE_END, *pBindings, *this),
+    maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this),
+    maLineStyleListControl(SID_DASH_LIST, *pBindings, *this),
+    maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
+    maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
+    maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
+    maColor(COL_BLACK),
+    mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
+    mpStyleItem(),
+    mpDashItem(),
+    mnTrans(0),
+    meMapUnit(SFX_MAPUNIT_MM),
+    mnWidthCoreValue(0),
+    mpLineEndList(0),
+    mpLineStyleList(0),
+    mpStartItem(0),
+    mpEndItem(0),
+    maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)),
+    maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)),
+    maIMGColor(SVX_RES(IMG_COLOR)),
+    maIMGNone(SVX_RES(IMG_NONE_ICON)),
+    mpIMGWidthIcon(),
+    mpIMGWidthIconH(),
+    mxFrame(rxFrame),
+    mpBindings(pBindings),
+    mbColorAvailable(true),
+    mbStyleAvailable(false),
+    mbDashAvailable(false),
+    mbTransAvailable(true),
+    mbWidthValuable(true),
+    mbStartAvailable(true),
+    mbEndAvailable(true)
+{
+    Initialize();
+    FreeResource();
+}
+
+
+
+LinePropertyPanel::~LinePropertyPanel()
+{
+    // Destroy the toolboxes, then their background windows.
+    mpTBWidth.reset();
+    mpTBColor.reset();
+
+    mpTBWidthBackground.reset();
+    mpTBColorBackground.reset();
+}
+
+
+
+void LinePropertyPanel::Initialize()
+{
+    mpFTWidth->SetBackground(Wallpaper());
+    mpFTColor->SetBackground(Wallpaper());
+    mpFTStyle->SetBackground(Wallpaper());
+    mpFTTrancparency->SetBackground(Wallpaper());
+    mpFTArrow->SetBackground(Wallpaper());
+    mpFTEdgeStyle->SetBackground(Wallpaper());
+    mpFTCapStyle->SetBackground(Wallpaper());
+
+    mpIMGWidthIcon.reset(new Image[8]);
+	mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON));
+	mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON));
+	mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON));
+	mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON));
+	mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON));
+	mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON));
+	mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
+	mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
+
+	//high contrast
+    mpIMGWidthIconH.reset(new Image[8]);
+	mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H));
+	mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H));
+	mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H));
+	mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H));
+	mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H));
+	mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H));
+	mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H));
+	mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H));
+
+	meMapUnit = maWidthControl.GetCoreMetric();
+
+	mpTBColor->SetItemImage(TBI_COLOR, maIMGColor);
+	Size aTbxSize( mpTBColor->CalcWindowSizePixel() );
+	mpTBColor->SetOutputSizePixel( aTbxSize );
+	mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY );
+	mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add
+	mpTBColor->SetBackground(Wallpaper());
+	mpTBColor->SetPaintTransparent(true);
+	Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl);
+	mpTBColor->SetDropdownClickHdl ( aLink );
+	mpTBColor->SetSelectHdl ( aLink );
+
+	FillLineStyleList();
+	SelectLineStyle();
+	aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl );
+	mpLBStyle->SetSelectHdl( aLink );
+	mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style")));
+    mpLBStyle->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStyle->GetEntryCount()));
+
+	mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]);
+	aTbxSize = mpTBWidth->CalcWindowSizePixel() ;
+	mpTBWidth->SetOutputSizePixel( aTbxSize );
+	mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY );
+	mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add
+	mpTBWidth->SetBackground(Wallpaper());
+	mpTBWidth->SetPaintTransparent(true);
+	aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl);
+	mpTBWidth->SetDropdownClickHdl ( aLink );
+	mpTBWidth->SetSelectHdl ( aLink );
+
+	FillLineEndList();
+	SelectEndStyle(true);
+	SelectEndStyle(false);
+	aLink = LINK( this, LinePropertyPanel, ChangeStartHdl );
+	mpLBStart->SetSelectHdl( aLink );
+	mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style")));	//wj acc
+    mpLBStart->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStart->GetEntryCount()));
+	aLink = LINK( this, LinePropertyPanel, ChangeEndHdl );
+	mpLBEnd->SetSelectHdl( aLink );
+	mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style")));	//wj acc
+    mpLBEnd->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBEnd->GetEntryCount()));
+
+	aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl);
+	mpMFTransparent->SetModifyHdl(aLink);
+	mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));	//wj acc
+	
+	mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get());
+	mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get());
+    mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get());
+	mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get());
+	mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get());
+	mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get());
+
+    aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl );
+    mpLBEdgeStyle->SetSelectHdl( aLink );
+    mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style")));
+
+    aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl );
+    mpLBCapStyle->SetSelectHdl( aLink );
+    mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style")));
+}
+
+
+
+void LinePropertyPanel::SetupIcons(void)
+{
+    if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+        // todo
+    }
+    else
+    {
+        // todo
+    }
+}
+
+
+
+LinePropertyPanel* LinePropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2);
+    
+    return new LinePropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+
+
+
+void LinePropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+
+
+
+void LinePropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{
+	switch(nSID)
+	{
+    	case SID_ATTR_LINE_COLOR:
+        {
+		    if( eState == SFX_ITEM_DISABLED)
+		    { 
+			    mpFTColor->Disable();
+			    mpTBColor->Disable();
+			    mbColorAvailable = false;
+			    mpColorUpdater->Update(COL_WHITE);
+		    }
+		    else
+		    {
+			    mpFTColor->Enable();
+			    mpTBColor->Enable();
+                const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState);
+
+			    if(eState >= SFX_ITEM_DEFAULT && pItem)
+			    {
+				    maColor = pItem->GetColorValue();
+				    mbColorAvailable = true;
+				    mpColorUpdater->Update(maColor);
+			    }
+			    else
+			    {
+				    mbColorAvailable = false;
+				    mpColorUpdater->Update(COL_WHITE);
+			    }	
+		    }
+		    break;
+        }
+	    case SID_ATTR_LINE_DASH:
+	    case SID_ATTR_LINE_STYLE:
+        {
+		    if( eState == SFX_ITEM_DISABLED)
+		    {
+			    mpFTStyle->Disable();
+                mpLBStyle->Disable();
+		    }
+		    else
+		    {
+			    mpFTStyle->Enable();
+                mpLBStyle->Enable();
+			    if( eState  >= SFX_ITEM_DEFAULT )
+			    {
+				    if(nSID == SID_ATTR_LINE_STYLE)
+				    {
+                        const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState);
+
+                        if(pItem)
+                        {
+					        mbStyleAvailable =true;
+    					    mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0);
+                        }
+				    }
+				    else if(nSID == SID_ATTR_LINE_DASH)
+				    {
+                        const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState);
+
+                        if(pItem)
+                        {
+    					    mbDashAvailable = true;
+	    				    mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0);
+                        }
+				    }
+			    }
+			    else
+			    {
+				    if(nSID == SID_ATTR_LINE_STYLE)
+					    mbStyleAvailable = false;
+				    else 
+					    mbDashAvailable = false;
+			    }
+
+                SelectLineStyle();
+		    }
+		    break;
+        }
+    	case SID_ATTR_LINE_TRANSPARENCE:
+        {
+		    if( eState == SFX_ITEM_DISABLED )
+		    {
+			    mpFTTrancparency->Disable();
+			    mpMFTransparent->Disable();
+			    mpMFTransparent->SetValue(0);//add 
+			    mpMFTransparent->SetText(String());
+			    mbTransAvailable = false;
+		    }
+		    else
+		    {
+			    mpFTTrancparency->Enable();
+			    mpMFTransparent->Enable();
+			    mbTransAvailable = true;
+                const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState);
+
+                if(eState != SFX_ITEM_DONTCARE && pItem)
+			    {
+				    mnTrans = pItem->GetValue();
+				    mpMFTransparent->SetValue(mnTrans);
+			    }
+			    else
+			    {
+				    mpMFTransparent->SetValue(0);//add 
+				    mpMFTransparent->SetText(String());
+			    }
+		    }
+		    break;
+        }
+    	case SID_ATTR_LINE_WIDTH:
+        {
+		    if(eState == SFX_ITEM_DISABLED)
+		    {
+			    mpTBWidth->Disable();
+			    mpFTWidth->Disable();
+		    }
+		    else
+		    {
+			    //enable
+			    mpTBWidth->Enable();
+			    mpFTWidth->Enable();
+                const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState);
+
+			    if(eState >= SFX_ITEM_AVAILABLE && pItem)
+			    {
+				    mnWidthCoreValue = pItem->GetValue();
+				    mbWidthValuable = true;
+			    }
+			    else
+			    {
+				    mbWidthValuable = false;
+			    }
+		    }
+		    SetWidthIcon();
+		    break;
+        }
+    	case SID_ATTR_LINE_START:
+        {
+		    mpFTArrow->Enable();
+		    mpLBStart->Enable();
+
+		    if(eState != SFX_ITEM_DONTCARE)
+		    {
+                const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
+
+                if(pItem)
+                {
+			        mbStartAvailable = true;	//add 
+			        mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0);
+			        SelectEndStyle(true);
+                    break;
+                }
+		    }
+
+            mpLBStart->SetNoSelection();
+			mbStartAvailable = false;	//add 
+		    break;
+        }
+    	case SID_ATTR_LINE_END:
+        {
+		    mpFTArrow->Enable();
+		    mpLBEnd->Enable();
+
+		    if(eState != SFX_ITEM_DONTCARE)
+		    {
+                const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
+
+                if(pItem)
+                {
+			        mbEndAvailable = true;		//add 
+			        mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0);
+			        SelectEndStyle(false);		
+                    break;
+                }
+		    }
+
+            mpLBEnd->SetNoSelection();
+			mbEndAvailable = false;		//add 
+		    break;
+        }
+    	case SID_LINEEND_LIST:
+        {
+		    FillLineEndList();
+		    SelectEndStyle(true);
+		    SelectEndStyle(false);
+		    break;
+        }
+    	case SID_DASH_LIST:
+        {
+		    FillLineStyleList();
+		    SelectLineStyle();
+		    break;
+        }
+        case SID_ATTR_LINE_JOINT:
+        {
+            if(eState == SFX_ITEM_DISABLED)
+            {
+                mpLBEdgeStyle->Disable();
+            }
+            else
+            {
+                mpLBEdgeStyle->Enable();
+                const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState);
+                sal_uInt16 nEntryPos(0);
+
+                if(eState >= SFX_ITEM_AVAILABLE && pItem)
+                {
+                    switch(pItem->GetValue())
+                    {
+                        case com::sun::star::drawing::LineJoint_MIDDLE:
+                        case com::sun::star::drawing::LineJoint_ROUND:
+                        {
+                            nEntryPos = 1;
+                            break;
+                        }
+                        case com::sun::star::drawing::LineJoint_NONE:
+                        {
+                            nEntryPos = 2;
+                            break;
+                        }
+                        case com::sun::star::drawing::LineJoint_MITER:
+                        {
+                            nEntryPos = 3;
+                            break;
+                        }
+                        case com::sun::star::drawing::LineJoint_BEVEL:
+                        {
+                            nEntryPos = 4;
+                            break;
+                        }
+
+                        default:
+                            break;
+                    }
+                }
+
+                if(nEntryPos)
+                {
+                    mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1);
+                }
+                else
+                {
+                    mpLBEdgeStyle->SetNoSelection();
+                }
+            }
+            break;
+        }
+        case SID_ATTR_LINE_CAP:
+        {
+            if(eState == SFX_ITEM_DISABLED)
+            {
+                mpLBCapStyle->Disable();
+            }
+            else
+            {
+                mpLBCapStyle->Enable();
+                const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState);
+                sal_uInt16 nEntryPos(0);
+
+                if(eState >= SFX_ITEM_AVAILABLE && pItem)
+                {
+                    switch(pItem->GetValue())
+                    {
+                        case com::sun::star::drawing::LineCap_BUTT:
+                        {
+                            nEntryPos = 1;
+                            break;
+                        }
+                        case com::sun::star::drawing::LineCap_ROUND:
+                        {
+                            nEntryPos = 2;
+                            break;
+                        }
+                        case com::sun::star::drawing::LineCap_SQUARE:
+                        {
+                            nEntryPos = 3;
+                            break;
+                        }
+
+                        default:
+                            break;
+                    }
+                }
+
+                if(nEntryPos)
+                {
+                    mpLBCapStyle->SelectEntryPos(nEntryPos - 1);
+                }
+                else
+                {
+                    mpLBCapStyle->SetNoSelection();
+                }
+            }
+            break;
+        }
+    }
+}
+
+
+
+SfxBindings* LinePropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+
+
+IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{	
+	return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_COLOR)
+	{
+        maColorPopup.Show(*pToolBox);
+        maColorPopup.SetCurrentColor(maColor, mbColorAvailable);
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, pToolBox)
+{
+    const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos());
+
+    if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue())
+    {
+        if(0 == nPos)
+        {
+            // XLINE_NONE
+            const XLineStyleItem aItem(XLINE_NONE);
+
+            GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
+        }
+        else if(1 == nPos)
+        {
+            // XLINE_SOLID
+            const XLineStyleItem aItem(XLINE_SOLID);
+
+            GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
+        }
+        else if(mpLineStyleList && mpLineStyleList->Count() > (long)(nPos - 2))
+        {
+            // XLINE_DASH
+            const XLineStyleItem aItemA(XLINE_DASH);
+            const XLineDashItem aItemB(mpLBStyle->GetSelectEntry(), mpLineStyleList->GetDash(nPos - 2)->GetDash());
+
+            GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L);
+            GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L);
+        }
+    }
+
+    return 0;
+}
+
+
+
+IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG)
+{
+	sal_uInt16	nPos = mpLBStart->GetSelectEntryPos();
+	if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() )
+	{
+		XLineStartItem* pItem = NULL;
+		if( nPos == 0 )
+			pItem = new XLineStartItem();
+		else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) )
+			pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
+		GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem,  0L);
+		delete pItem;
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG)
+{
+	sal_uInt16	nPos = mpLBEnd->GetSelectEntryPos();
+	if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() )
+	{
+		XLineEndItem* pItem = NULL;
+		if( nPos == 0 )
+			pItem = new XLineEndItem();
+		else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) )
+			pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
+		GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem,  0L);
+		delete pItem;
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
+{
+    const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos());
+
+    if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue())
+    {
+        XLineJointItem* pItem = 0;
+
+        switch(nPos)
+        {
+            case 0: // rounded
+            {
+                pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND);
+                break;
+            }
+            case 1: // none
+            {
+                pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE);
+                break;
+            }
+            case 2: // mitered
+            {
+                pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER);
+                break;
+            }
+            case 3: // beveled
+            {
+                pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL);
+                break;
+            }
+        }
+
+        GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem,  0L);
+        delete pItem;
+    }
+    return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
+{
+    const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos());
+
+    if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue())
+    {
+        XLineCapItem* pItem = 0;
+
+        switch(nPos)
+        {
+            case 0: // flat
+            {
+                pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT);
+                break;
+            }
+            case 1: // round
+            {
+                pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND);
+                break;
+            }
+            case 2: // square
+            {
+                pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE);
+                break;
+            }
+        }
+
+        GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem,  0L);
+        delete pItem;
+    }
+    return 0;
+}
+
+
+
+
+IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox)
+{
+	if (pToolBox->GetCurItemId() == TBI_WIDTH)
+	{
+		maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
+        maLineWidthPopup.Show(*pToolBox);
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
+{
+	sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
+	XLineTransparenceItem aItem( nVal );
+
+	GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
+	return( 0L );
+}
+
+
+
+
+PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent)
+{
+    const ResId aResId(SVX_RES(STR_AUTOMATICE));
+    
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR),
+        SVX_RES(VS_COLOR),
+        ::boost::bind(GetTransparentColor),
+        ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2),
+        pParent,
+        &aResId);
+}
+
+
+
+
+PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
+{
+    return new LineWidthControl(pParent, *this);
+}
+
+
+
+
+void LinePropertyPanel::EndLineWidthPopupMode (void)
+{
+    maLineWidthPopup.Hide();
+}
+
+
+
+
+void LinePropertyPanel::SetWidthIcon(int n)
+{
+	if(n==0)
+		mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
+	else
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]);
+}
+
+
+
+void LinePropertyPanel::SetWidthIcon()
+{
+	if(!mbWidthValuable)
+	{
+		mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
+		return;
+	}
+
+	long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT);
+
+	if(nVal <= 6)	
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]); 
+	else if(nVal > 6 && nVal <= 9)	
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]);  
+	else if(nVal > 9 && nVal <= 12)	
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]); 
+	else if(nVal > 12 && nVal <= 19)	
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]); 
+	else if(nVal > 19 && nVal <= 26)		
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]); 
+	else if(nVal > 26 && nVal <= 37)	
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]); 
+	else if(nVal > 37 && nVal <=52)		
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]); 
+	else if(nVal > 52)		
+		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]); 
+
+}
+
+
+
+void LinePropertyPanel::SetColor (
+    const String& rsColorName,
+    const Color aColor)
+{
+    XLineColorItem aColorItem(rsColorName, aColor);
+    mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+    maColor = aColor;
+}
+
+
+
+void LinePropertyPanel::SetWidth(long nWidth)
+{
+    mnWidthCoreValue = nWidth;
+    mbWidthValuable = true;
+}
+
+
+
+void  LinePropertyPanel::FillLineEndList()
+{
+	SfxObjectShell* pSh = SfxObjectShell::Current();
+	if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) )
+	{
+		mpLBStart->Enable();
+		SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) );		
+		mpLineEndList = aItem.GetLineEndList();
+
+        if(mpLineEndList)
+		{
+            FillLineEndListBox(*mpLBStart, *mpLBEnd, *mpLineEndList);
+		}
+
+		mpLBStart->SelectEntryPos(0);
+		mpLBEnd->SelectEntryPos(0);
+	}
+	else
+	{
+		mpLBStart->Disable();
+		mpLBEnd->Disable();
+	}
+}
+
+
+
+void  LinePropertyPanel::FillLineStyleList()
+{
+	SfxObjectShell* pSh = SfxObjectShell::Current();
+	if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
+	{
+		mpLBStyle->Enable();
+		SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) );		
+		mpLineStyleList = aItem.GetDashList();
+
+        if(mpLineStyleList)
+		{
+            FillLineStyleListBox(*mpLBStyle, *mpLineStyleList);
+		}
+
+		mpLBStyle->SelectEntryPos(0);
+	}
+	else
+	{
+		mpLBStyle->Disable();
+	}
+}
+
+
+
+void LinePropertyPanel::SelectLineStyle()
+{
+	if( !mbStyleAvailable || !mbDashAvailable )
+	{
+		mpLBStyle->SetNoSelection();
+		return;
+	}
+
+    const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE);
+	bool bSelected(false);
+
+    switch(eXLS)
+    {
+        case XLINE_NONE:
+            break;
+        case XLINE_SOLID:
+			mpLBStyle->SelectEntryPos(1);
+			bSelected = true;
+            break;
+        default:
+            if(mpDashItem && mpLineStyleList)
+	        {
+		        const XDash& rDash = mpDashItem->GetDashValue();
+		        for(sal_Int32 a(0);!bSelected &&  a < mpLineStyleList->Count(); a++)
+		        {
+			        XDashEntry* pEntry = mpLineStyleList->GetDash(a);
+			        const XDash& rEntry = pEntry->GetDash();
+			        if(rDash == rEntry)
+			        {
+				        mpLBStyle->SelectEntryPos((sal_uInt16)a + 2);
+				        bSelected = true;
+			        }
+		        }
+	        }
+            break;
+    }
+	
+    if(!bSelected)
+		mpLBStyle->SelectEntryPos( 0 );
+}
+
+void LinePropertyPanel::SelectEndStyle(bool bStart)
+{
+	sal_Bool bSelected(false);
+
+	if(bStart)
+	{
+		//<<add 
+		if( !mbStartAvailable )
+		{
+			mpLBStart->SetNoSelection();
+			return;
+		}
+		//add end>>
+		if(mpStartItem && mpLineEndList)
+		{
+			const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
+			for(sal_Int32 a(0);!bSelected &&  a < mpLineEndList->Count(); a++)
+			{
+				XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a);
+				const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+				if(rItemPolygon == rEntryPolygon)
+				{
+					mpLBStart->SelectEntryPos((sal_uInt16)a + 1);
+					bSelected = true;
+				}
+			}
+		}
+		if(!bSelected)
+			mpLBStart->SelectEntryPos( 0 );
+	}
+	else
+	{
+		//<<add 
+		if( !mbEndAvailable )
+		{
+			mpLBEnd->SetNoSelection();
+			return;
+		}
+		//add end>>
+		if(mpEndItem && mpLineEndList)
+		{
+			const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
+			for(sal_Int32 a(0);!bSelected &&  a < mpLineEndList->Count(); a++)
+			{
+				XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a);
+				const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
+				if(rItemPolygon == rEntryPolygon)
+				{
+					mpLBEnd->SelectEntryPos((sal_uInt16)a + 1);
+					bSelected = true;
+				}
+			}
+		}
+		if(!bSelected)
+			mpLBEnd->SelectEntryPos( 0 );
+	}
+}
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/line/LinePropertyPanel.hrc b/main/svx/source/sidebar/line/LinePropertyPanel.hrc
new file mode 100644
index 0000000..4fef535
--- /dev/null
+++ b/main/svx/source/sidebar/line/LinePropertyPanel.hrc
@@ -0,0 +1,140 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+//  RID_SIDEBAR_LINE_PANEL--------------------------------------------------------------
+#define CUSTOM_X	POPUPPANEL_MARGIN_LARGE + OFFSET_X 
+#define CUSTOM_Y	POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT
+#define CUSTOM_W	74  
+#define CUSTOM_H	POPUPPANEL_MARGIN_LARGE * 2 +  TEXT_HEIGHT + 12 +  TEXT_CONTROL_SPACING_VERTICAL
+
+#define FT_COLOR            1
+#define TB_COLOR            2
+#define FT_WIDTH            3
+#define TB_WIDTH            4
+#define FT_STYLE            5
+#define LB_STYLE            6
+#define FT_ARROW            7
+#define FT_TRANSPARENT      8
+#define MF_TRANSPARENT      9
+#define LB_START            10
+#define LB_END              11
+#define TBI_COLOR           12
+#define TBI_WIDTH           13
+#define TBI_STYLE           14
+#define STR_QH_TB_WIDTH     15
+#define STR_QH_TB_COLOR     16
+
+#define FT_EDGESTYLE        18
+#define LB_EDGESTYLE        19
+#define FT_CAPSTYLE         20
+#define LB_CAPSTYLE         21
+
+#define IMG_COLOR           23
+#define IMG_COLOR_NO        24
+#define IMG_NONE_ICON       36
+
+#define IMG_WIDTH1_ICON     41
+#define IMG_WIDTH2_ICON     42
+#define IMG_WIDTH3_ICON     43
+#define IMG_WIDTH4_ICON     44
+#define IMG_WIDTH5_ICON     45
+#define IMG_WIDTH6_ICON     46
+#define IMG_WIDTH7_ICON     47
+#define IMG_WIDTH8_ICON     48
+
+#define IMG_WIDTH1_ICON_H   61
+#define IMG_WIDTH2_ICON_H   62
+#define IMG_WIDTH3_ICON_H   63
+#define IMG_WIDTH4_ICON_H   64
+#define IMG_WIDTH5_ICON_H   65
+#define IMG_WIDTH6_ICON_H   66
+#define IMG_WIDTH7_ICON_H   67
+#define IMG_WIDTH8_ICON_H   68
+
+//color popup page
+#define VS_COLOR		1
+#define STR_AUTOMATICE	2
+
+//style popup page
+#define VS_STYLE				1
+#define PB_OPTIONS				2
+
+#define IMG_LINE1			5
+#define IMG_LINE1_S			6
+#define IMG_LINE2				7
+#define IMG_LINE2_S			8
+#define IMG_LINE3			9
+#define IMG_LINE3_S			10
+#define IMG_LINE4			11
+#define IMG_LINE4_S			12
+#define IMG_LINE5				13
+#define IMG_LINE5_S			14
+#define IMG_LINE6			15
+#define IMG_LINE6_S		16
+#define IMG_LINE7			17
+#define IMG_LINE7_S			18
+#define IMG_LINE8				19
+#define IMG_LINE8_S				20
+#define IMG_LINE9			21
+#define IMG_LINE9_S			22
+#define IMG_LINE10				23
+#define IMG_LINE10_S			24
+#define IMG_LINE11			25
+#define IMG_LINE11_S			26
+
+// #define STR_STYLE_NONE_TIP		30
+#define STR_STYLE_NONE			31
+#define STR_STYLE_LINE1			32
+#define STR_STYLE_LINE2			33
+#define STR_STYLE_LINE3			34	
+#define STR_STYLE_LINE4			35
+#define STR_STYLE_LINE5			36
+#define STR_STYLE_LINE6			37
+#define STR_STYLE_LINE7			38
+#define STR_STYLE_LINE8			39
+#define STR_STYLE_LINE9			40
+#define STR_STYLE_LINE10		41
+#define STR_STYLE_LINE11		42
+
+#define IMG_LINE1_H			43
+#define IMG_LINE2_H			44
+#define IMG_LINE3_H			45
+#define IMG_LINE4_H			46
+#define IMG_LINE5_H			47
+#define IMG_LINE6_H			48
+#define IMG_LINE7_H			49
+#define IMG_LINE8_H			50
+#define IMG_LINE9_H			51
+#define IMG_LINE10_H			52
+#define IMG_LINE11_H		53
+
+//width popup page
+#define VS_WIDTH		1
+#define MF_WIDTH		2
+#define FT_CUSTOME		3
+#define FT_LINE_WIDTH	4
+#define IMG_WIDTH_CUSTOM			5
+#define IMG_WIDTH_CUSTOM_GRAY		6
+#define CT_BORDER		7
+#define STR_WIDTH_LAST_CUSTOM		8
+#define STR_PT			9
+
+// eof
diff --git a/main/svx/source/sidebar/line/LinePropertyPanel.hxx b/main/svx/source/sidebar/line/LinePropertyPanel.hxx
new file mode 100644
index 0000000..26dc68b
--- /dev/null
+++ b/main/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -0,0 +1,198 @@
+/**************************************************************
+ * 
+ * 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 SVX_PROPERTYPANEL_LINEPAGE_HXX
+#define SVX_PROPERTYPANEL_LINEPAGE_HXX
+
+#include <svx/xdash.hxx>
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include <svx/sidebar/ColorPopup.hxx>
+#include "LineWidthPopup.hxx"
+
+
+namespace svx { class ToolboxButtonColorUpdater; }
+class SvxLineColorPage;
+class SvxLineStylePage;
+class SvxLineWidthPage;
+class XLineStyleItem;
+class XLineDashItem;
+class XLineStartItem;
+class XLineEndItem;
+class XLineEndList;
+class XDashList;
+class ListBox;
+class ToolBox;
+class FloatingWindow;
+
+namespace {
+    #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
+} //end of anonymous namespace
+
+namespace svx { namespace sidebar {
+
+class PopupContainer;
+class ColorPopup;
+class LineWidthControl;
+
+
+class LinePropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+private:
+    friend class ::SvxLineStylePage;
+    friend class ::SvxLineWidthPage;
+
+public:
+    static LinePropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+
+    void SetWidth(long nWidth);
+    void SetWidthIcon(int n);
+    void SetWidthIcon();
+
+    void EndLineWidthPopupMode (void);
+
+private:
+    //ui controls
+    ::boost::scoped_ptr< FixedText >                        mpFTWidth;
+    ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
+    ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
+    ::boost::scoped_ptr< FixedText >                        mpFTColor;
+    ::boost::scoped_ptr< Window >                           mpTBColorBackground;
+    ::boost::scoped_ptr< ToolBox >                          mpTBColor;
+    ::boost::scoped_ptr< FixedText >                        mpFTStyle;
+    ::boost::scoped_ptr< ListBox >                          mpLBStyle;
+    ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
+    ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
+    ::boost::scoped_ptr< FixedText >                        mpFTArrow;
+    ::boost::scoped_ptr< ListBox >                          mpLBStart;
+    ::boost::scoped_ptr< ListBox >                          mpLBEnd;
+    ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
+    ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
+    ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
+    ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
+
+    //ControllerItem
+    ::sfx2::sidebar::ControllerItem                         maStyleControl;
+    ::sfx2::sidebar::ControllerItem                         maDashControl;
+    ::sfx2::sidebar::ControllerItem                         maWidthControl;
+    ::sfx2::sidebar::ControllerItem                         maColorControl;
+    ::sfx2::sidebar::ControllerItem                         maStartControl;
+    ::sfx2::sidebar::ControllerItem                         maEndControl;
+    ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
+    ::sfx2::sidebar::ControllerItem                         maLineStyleListControl;
+    ::sfx2::sidebar::ControllerItem                         maTransControl;
+    ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
+    ::sfx2::sidebar::ControllerItem                         maCapStyle;
+
+    Color                                                   maColor;
+    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
+    ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
+    ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
+    sal_uInt16                                              mnTrans;
+    SfxMapUnit                                              meMapUnit;
+    sal_Int32                                               mnWidthCoreValue;
+    XLineEndList*                                           mpLineEndList;
+    XDashList*                                              mpLineStyleList;
+    ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
+    ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
+
+    //popup windows
+    ColorPopup maColorPopup;
+    LineWidthPopup maLineWidthPopup;
+
+    // images from ressource
+    Image                                                   maIMGColor;
+    Image                                                   maIMGNone;
+
+    // multi-images
+    ::boost::scoped_array<Image>                            mpIMGWidthIcon;
+    ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
+
+    cssu::Reference< css::frame::XFrame >                   mxFrame;
+    SfxBindings*                                            mpBindings;
+
+    /// bitfield
+	bool				mbColorAvailable : 1;
+	bool				mbStyleAvailable : 1;
+	bool				mbDashAvailable : 1;
+	bool				mbTransAvailable : 1;
+	bool				mbWidthValuable : 1;
+	bool				mbStartAvailable : 1;
+	bool				mbEndAvailable : 1;
+
+    void SetupIcons(void);
+	void Initialize();	
+	void FillLineEndList();
+	void FillLineStyleList();
+	void SelectEndStyle(bool bStart);
+	void SelectLineStyle();
+
+	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
+	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
+	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
+	DECL_LINK(ChangeLineStyleHdl, ToolBox*);
+	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
+	DECL_LINK(ChangeTransparentHdl , void *);
+	DECL_LINK(ChangeStartHdl, void *);
+	DECL_LINK(ChangeEndHdl, void *);
+	DECL_LINK(ChangeEdgeStyleHdl, void *);
+	DECL_LINK(ChangeCapStyleHdl, void *);
+
+    // constructor/destuctor
+    LinePropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings);
+    virtual ~LinePropertyPanel(void);
+
+    void SetColor(
+        const String& rsColorName,
+        const Color aColor);
+
+    PopupControl* CreateColorPopupControl (PopupContainer* pParent);
+    PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+// eof
diff --git a/main/svx/source/sidebar/line/LinePropertyPanel.src b/main/svx/source/sidebar/line/LinePropertyPanel.src
new file mode 100644
index 0000000..b45f34f
--- /dev/null
+++ b/main/svx/source/sidebar/line/LinePropertyPanel.src
@@ -0,0 +1,614 @@
+/**************************************************************
+ * 
+ * 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 "LinePropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define TOOLBOX_WIDTH		50
+#define TOOLBOX_HEIGHT		14
+#define LISTBOX_HEIGHT      99
+
+Control RID_SIDEBAR_LINE_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Text = "Line";
+
+    Size = MAP_APPFONT( 
+        PROPERTYPAGE_WIDTH, 
+        SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3  + CONTROL_SPACING_VERTICAL*3 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT );
+	HelpID = HID_PROPERTYPANEL_LINE_SECTION ;
+	
+	FixedText FT_WIDTH
+	{
+        Pos = MAP_APPFONT( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; 
+        Size = MAP_APPFONT (TOOLBOX_WIDTH  , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Width:" ;        
+	};
+	ToolBox TB_WIDTH 
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_TBX_WIDTH ;
+		Text = "Width";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_WIDTH ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Width" ;
+				HelpID = HID_PPROPERTYPANEL_LINE_TBI_WIDTH;
+			};
+		};
+	};
+	String STR_QH_TB_WIDTH
+	{
+		Text [ en-US ] = "Select the width of the line.";
+	};
+	
+	FixedText FT_COLOR
+	{
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP ) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH  , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Color:" ;        
+	};
+	ToolBox TB_COLOR
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 4, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_TBX_COLOR;
+		Text = "Color";
+		ItemList =
+		{
+			ToolBoxItem
+			{ 
+				Identifier = TBI_COLOR ;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Color" ;
+				HelpID = HID_PPROPERTYPANEL_LINE_TBI_COLOR;
+			};
+		};
+	};
+	String STR_QH_TB_COLOR
+	{
+		Text [ en-US ] = "Select the color of the line.";
+	};
+
+	FixedText FT_STYLE
+	{
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH  , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Style:" ;        
+	};
+	ListBox LB_STYLE
+	{
+		Border = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_TBX_STYLE;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH ,LISTBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		DDExtraWidth = TRUE ;
+		QuickHelpText [ en-US ] = "Select the style of the line.";
+	};
+	
+	FixedText FT_TRANSPARENT
+	{
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH  , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Transparency:" ;        
+	};
+	MetricField MF_TRANSPARENT
+	{
+		Border = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT  + CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1 , 12 ) ;
+		TabStop = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 100 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_CUSTOM ;
+		CustomUnitText = "%" ;
+		Last = 100 ;
+		SpinSize = 5 ;
+		QuickHelpText [ en-US ] = "Specify the transparency of the line.";
+	};
+	
+	FixedText FT_ARROW
+	{
+        Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT*2  + CONTROL_SPACING_VERTICAL*2) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "~Arrow:" ;        
+	};
+	ListBox LB_START
+	{
+		Border = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_LB_START;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2  + CONTROL_SPACING_VERTICAL*2 ) ;
+		Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		DDExtraWidth = TRUE ;
+		QuickHelpText [ en-US ] = "Select the style of the beginning arrowhead.";
+	};
+	ListBox LB_END
+	{
+		Border = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_LB_END;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2  + CONTROL_SPACING_VERTICAL*2 ) ;
+		Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1, LISTBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		DDExtraWidth = TRUE ;
+		QuickHelpText [ en-US ] = "Select the style of the ending arrowhead.";
+	};
+
+	FixedText FT_EDGESTYLE
+	{
+        Pos = MAP_APPFONT ( 
+            SECTIONPAGE_MARGIN_HORIZONTAL, 
+            SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3  + CONTROL_SPACING_VERTICAL*3) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ;
+		Text [ en-US ] = "~Corner style" ;
+	};
+	ListBox LB_EDGESTYLE
+	{
+		HelpID = HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE;
+		Border = TRUE ;
+		Pos = MAP_APPFONT ( 
+            SECTIONPAGE_MARGIN_HORIZONTAL , 
+            SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3  + CONTROL_SPACING_VERTICAL*3 ) ;
+		Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		DDExtraWidth = TRUE ;
+		QuickHelpText [ en-US ] = "Select the style of the edge connections.";
+		StringList [ en-US ] =
+		{
+			< "Rounded" ; Default ; > ;
+			< "- none -" ; > ;
+			< "Mitered" ; > ;
+			< "Beveled" ; > ;
+		};
+	};
+    FixedText FT_CAPSTYLE
+    {
+        Pos = MAP_APPFONT ( 
+            SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, 
+            SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3  + CONTROL_SPACING_VERTICAL*3) ;
+        Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "Ca~p style" ;
+    };
+    ListBox LB_CAPSTYLE
+    {
+		HelpID = HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE;
+        Border = TRUE ;
+		Pos = MAP_APPFONT ( 
+            SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, 
+            SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3  + CONTROL_SPACING_VERTICAL*3 ) ;
+		Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ;
+        TabStop = TRUE ;
+        DropDown = TRUE ;
+		DDExtraWidth = TRUE ;
+		QuickHelpText [ en-US ] = "Select the style of the line caps.";
+        StringList [ en-US ] =
+        {
+            < "Flat" ; Default ; > ; // Same string as in Excel
+            < "Round" ; > ;
+            < "Square" ; > ;
+        };
+    };
+
+	Image IMG_COLOR
+	{
+		ImageBitmap = Bitmap{File = "symphony/Line_color.png";};
+	};
+	Image IMG_COLOR_NO
+	{
+		ImageBitmap = Bitmap{File = "symphony/no color.png";};
+	};
+	
+	Image IMG_NONE_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/blank.png";};
+	};
+	
+	//WIDTH ICON
+	Image IMG_WIDTH1_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width1.png";};
+	};
+	Image IMG_WIDTH2_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width2.png";};
+	};
+	Image IMG_WIDTH3_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width3.png";};
+	};
+	Image IMG_WIDTH4_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width4.png";};
+	};
+	Image IMG_WIDTH5_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width5.png";};
+	};
+	Image IMG_WIDTH6_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width6.png";};
+	};
+	Image IMG_WIDTH7_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width7.png";};
+	};
+	Image IMG_WIDTH8_ICON
+	{
+		ImageBitmap = Bitmap{File = "symphony/width8.png";};
+	};	
+	
+	//high contrast for line width
+	//WIDTH ICON
+	Image IMG_WIDTH1_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width1_h.png";};
+	};
+	Image IMG_WIDTH2_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width2_h.png";};
+	};
+	Image IMG_WIDTH3_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width3_h.png";};
+	};
+	Image IMG_WIDTH4_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width4_h.png";};
+	};
+	Image IMG_WIDTH5_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width5_h.png";};
+	};
+	Image IMG_WIDTH6_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width6_h.png";};
+	};
+	Image IMG_WIDTH7_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width7_h.png";};
+	};
+	Image IMG_WIDTH8_ICON_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/width8_h.png";};
+	};	
+};
+Control RID_POPUPPANEL_LINEPAGE_COLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
+	
+	Control VS_COLOR
+	{
+		HelpId = HID_PPROPERTYPANEL_LINE_VS_COLOR ;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+		TabStop = TRUE ;
+		Text = "Color";
+	};
+	String STR_AUTOMATICE
+	{
+		Text [ en-US ] = "No Color";
+	};
+};
+Control RID_POPUPPANEL_LINEPAGE_STYLE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  
+        POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH ,  
+        13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE);
+	
+	Control VS_STYLE
+	{
+		HelpId = HID_PPROPERTYPANEL_LINE_VS_STYLE ;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( 93  , 13 * 12);
+		TabStop = TRUE ;
+		Text = "Style";
+	};
+
+	PushButton PB_OPTIONS
+	{
+		HelpId = HID_PPROPERTYPANEL_LINE_BTN_STYLE;
+		Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y  );
+		Size = MAP_APPFONT ( 93 , 13 );
+		TabStop = TRUE;
+		Text [ en-US ] = "~More Options...";
+	};
+	
+	String STR_STYLE_NONE
+	{
+		Text [ en-US ] = "None";
+	};
+	String STR_STYLE_LINE1
+	{
+		Text [ en-US ] = "Continuous";
+	};
+	String STR_STYLE_LINE2
+	{
+		Text [ en-US ] = "Ultrafine dashed";
+	};
+	String STR_STYLE_LINE3
+	{
+		Text [ en-US ] = "Dashed (variable)";
+	};
+	String STR_STYLE_LINE4
+	{
+		Text [ en-US ] = "Fine dashed (variable)";
+	};
+	String STR_STYLE_LINE5
+	{
+		Text [ en-US ] = "Fine dashed";
+	};
+	String STR_STYLE_LINE6
+	{
+		Text [ en-US ] = "Fine dotted";
+	};
+	String STR_STYLE_LINE7
+	{
+		Text [ en-US ] = "Ultrafine dotted (variable)";
+	};
+	String STR_STYLE_LINE8
+	{
+		Text [ en-US ] = "3 dashes 3 dots (variable)";
+	};
+	String STR_STYLE_LINE9
+	{
+		Text [ en-US ] = "2 dots 1 dash";
+	};
+	String STR_STYLE_LINE10
+	{
+		Text [ en-US ] = "Ultrafine 2 dots 3 dashes";
+	};
+	String STR_STYLE_LINE11
+	{
+		Text [ en-US ] = "Line with fine dots";
+	};
+	
+	Image IMG_LINE1
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line1.png";};
+	};
+	Image IMG_LINE1_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line1_h.png";};
+	};
+	Image IMG_LINE2
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line2.png";};
+	};
+	Image IMG_LINE2_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line2_h.png";};
+	};
+	Image IMG_LINE3
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line3.png";};
+	};
+	Image IMG_LINE3_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line3_h.png";};
+	};
+	Image IMG_LINE4
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line4.png";};
+	};
+	Image IMG_LINE4_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line4_h.png";};
+	};
+	Image IMG_LINE5
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line5.png";};
+	};
+	Image IMG_LINE5_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line5_h.png";};
+	};
+	Image IMG_LINE6
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line6.png";};
+	};
+	Image IMG_LINE6_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line6_h.png";};
+	};
+	Image IMG_LINE7
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line7.png";};
+	};
+	Image IMG_LINE7_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line7_h.png";};
+	};
+	Image IMG_LINE8
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line8.png";};
+	};
+	Image IMG_LINE8_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line8_h.png";};
+	};
+	Image IMG_LINE9
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line9.png";};
+	};
+	Image IMG_LINE9_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line9_h.png";};
+	};
+	Image IMG_LINE10
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line10.png";};
+	};
+	Image IMG_LINE10_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line10_h.png";};
+	};
+	Image IMG_LINE11
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line11.png";};
+	};
+	Image IMG_LINE11_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line11_h.png";};
+	};
+	
+	//high contrast
+	Image IMG_LINE1_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line1_hh.png";};
+	};
+	Image IMG_LINE2_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line2_hh.png";};
+	};
+	Image IMG_LINE3_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line3_hh.png";};
+	};
+	Image IMG_LINE4_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line4_hh.png";};
+	};
+	Image IMG_LINE5_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line5_hh.png";};
+	};
+	Image IMG_LINE6_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line6_hh.png";};
+	};
+	Image IMG_LINE7_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line7_hh.png";};
+	};
+	Image IMG_LINE8_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line8_hh.png";};
+	};
+	Image IMG_LINE9_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line9_hh.png";};
+	};
+	Image IMG_LINE10_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line10_hh.png";};
+	};
+	Image IMG_LINE11_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/style_line11_hh.png";};
+	};
+};
+Control RID_POPUPPANEL_LINEPAGE_WIDTH
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH  + 80,    POPUPPANEL_MARGIN_SMALL + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT + (POPUPPANEL_MARGIN_LARGE * 2 +  TEXT_HEIGHT + 12 +  TEXT_CONTROL_SPACING_VERTICAL));
+	
+	Control VS_WIDTH
+	{
+		HelpId = HID_PPROPERTYPANEL_LINE_VS_WIDTH ;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( 80  , 12 * 9);
+		TabStop = TRUE ;
+		Text = "Width";
+	};
+	FixedText FT_CUSTOME
+	{
+        Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL ) ;
+        Size = MAP_APPFONT ( 80  , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "Custom:" ;        
+	};
+	FixedText FT_LINE_WIDTH
+	{
+        Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE) ;
+        Size = MAP_APPFONT (  74 - POPUPPANEL_MARGIN_LARGE * 2   , TEXT_HEIGHT ) ;
+        Text [ en-US ] = "Line ~width:" ;        
+	};
+	MetricField MF_WIDTH
+	{
+		Border = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_LINE_MTR_WIDTH ;
+		Pos = MAP_APPFONT (  CUSTOM_X + POPUPPANEL_MARGIN_LARGE  , CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ;
+		Size = MAP_APPFONT ( 40 , 12 ) ;
+		TabStop = TRUE ;
+		Right = TRUE ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 5000 ;
+		StrictFormat = TRUE ;
+		DecimalDigits = 2 ;
+		Value = 1 ;
+		Unit = FUNIT_MM ;
+		Last = 5000 ;
+		SpinSize = 10 ;
+		QuickHelpText [ en-US ] = "Specify the width of the line.";
+	};
+
+	Image IMG_WIDTH_CUSTOM
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";};
+	};
+	Image IMG_WIDTH_CUSTOM_GRAY
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";};
+	};
+	String STR_WIDTH_LAST_CUSTOM
+	{
+		Text [ en-US ] = "Last Custom Value";
+	};
+	String STR_PT
+	{
+		Text [ en-US ] = "pt";
+	};
+};	
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineStyleValueSet.cxx b/main/svx/source/sidebar/line/LineStyleValueSet.cxx
new file mode 100644
index 0000000..26ae20a
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineStyleValueSet.cxx
@@ -0,0 +1,134 @@
+/**************************************************************
+ * 
+ * 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 "LineStyleValueSet.hxx"
+
+#include <i18npool/mslangid.hxx>
+
+
+namespace svx { namespace sidebar {
+
+LineStyleValueSet::LineStyleValueSet (
+    Window* pParent,
+    const ResId& rResId)
+    : ValueSet( pParent, rResId ),
+      pVDev(NULL),
+      mbSelectFirst(true)
+{
+	SetColCount( 1 );
+}
+
+
+
+
+LineStyleValueSet::~LineStyleValueSet (void)
+{	
+	delete pVDev;
+}
+
+
+
+
+void LineStyleValueSet::SetFirstString(XubString str)
+{
+	strNone = str;
+}
+
+
+
+
+void  LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+	Rectangle aRect = rUDEvt.GetRect();
+	OutputDevice*  pDev = rUDEvt.GetDevice();
+	sal_uInt16	nItemId = rUDEvt.GetItemId();
+	
+	long nRectHeight = aRect.GetHeight();
+	long nRectWidth = aRect.GetWidth();	
+	Point aBLPos = aRect.TopLeft();	
+	if(nItemId == 1)
+	{
+		const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+		Color aOldFillColor = pDev->GetFillColor();				
+		const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+		//draw back
+		if( mbSelectFirst )
+		{
+			Color aBackColor(50,107,197);
+			Rectangle aBackRect = aRect;
+			aBackRect.Top() += 3;
+			aBackRect.Bottom() -= 2;
+			pDev->SetFillColor(aBackColor);
+			pDev->DrawRect(aBackRect);
+		}
+		else
+		{
+			pDev->SetFillColor( COL_TRANSPARENT );
+			pDev->DrawRect(aRect);
+		}
+		pDev->SetFillColor(aOldFillColor);
+
+		//draw text
+		Font aOldFont = pDev->GetFont();
+		Color aOldColor = pDev->GetLineColor();
+		Font aFont(OutputDevice::GetDefaultFont(
+					DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+		Size aSize = aFont.GetSize();	
+		aSize.Height() = nRectHeight*3/5;
+		if( mbSelectFirst )
+			aFont.SetColor(COL_WHITE);
+		else
+			//aFont.SetColor(COL_BLACK);
+			aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast 
+		aFont.SetFillColor(COL_BLUE);
+		aFont.SetSize( aSize );
+		pDev->SetFont(aFont);			
+//		String sText("None", 9, RTL_TEXTENCODING_ASCII_US);
+		
+	//	Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6);  
+		Rectangle aStrRect = aRect;
+		aStrRect.Top() += nRectHeight/6;
+		aStrRect.Bottom() -= nRectHeight/6;
+		aStrRect.Left() += 8;
+		pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS);	
+				
+		pDev->SetFont(aOldFont);
+		pDev->SetLineColor(aOldColor);
+
+
+	}
+	Invalidate( aRect );
+}
+
+
+
+
+void  LineStyleValueSet::SetFirstSelect(bool bSel)
+{
+	mbSelectFirst = bSel;
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineStyleValueSet.hxx b/main/svx/source/sidebar/line/LineStyleValueSet.hxx
new file mode 100644
index 0000000..794b427
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineStyleValueSet.hxx
@@ -0,0 +1,51 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX
+#define SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX
+
+#include <svtools/valueset.hxx>
+
+namespace svx { namespace sidebar {
+
+class LineStyleValueSet
+    : public ValueSet
+{
+public:
+    LineStyleValueSet (Window* pParent, const ResId& rResId);
+    virtual ~LineStyleValueSet (void);
+    
+    void SetFirstSelect(bool bSel);
+    void SetFirstString(XubString str);
+    
+	virtual void	UserDraw( const UserDrawEvent& rUDEvt );	
+
+private:
+    VirtualDevice* 	pVDev;
+	bool			mbSelectFirst;
+	XubString		strNone;
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineWidthControl.cxx b/main/svx/source/sidebar/line/LineWidthControl.cxx
new file mode 100644
index 0000000..c7a1b34
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthControl.cxx
@@ -0,0 +1,376 @@
+/**************************************************************
+ * 
+ * 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 "LineWidthControl.hxx"
+#include "LinePropertyPanel.hrc"
+#include "LinePropertyPanel.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/viewoptions.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include "svx/sidebar/PopupContainer.hxx"
+
+
+namespace svx { namespace sidebar {
+
+LineWidthControl::LineWidthControl (
+    Window* pParent,
+    LinePropertyPanel& rPanel)
+    : svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)),
+      mrLinePropertyPanel(rPanel),
+      mpBindings(NULL),
+      maVSWidth( this, SVX_RES(VS_WIDTH)),
+      maFTCus( this, SVX_RES(FT_CUSTOME)),
+      maFTWidth( this, SVX_RES(FT_LINE_WIDTH)),
+      maMFWidth( this, SVX_RES(MF_WIDTH)),
+      meMapUnit(SFX_MAPUNIT_TWIP),
+      rStr(NULL),
+      mstrPT(SVX_RES(STR_PT)),
+      mnCustomWidth(0),
+      mbCustom(false),
+      mbColseByEdit(false),
+      mnTmpCusomWidth(0),
+      mbVSFocus(true),
+      maIMGCus(SVX_RES(IMG_WIDTH_CUSTOM)),
+      maIMGCusGray(SVX_RES(IMG_WIDTH_CUSTOM_GRAY))
+{
+	Initialize();
+	FreeResource();
+	mpBindings = mrLinePropertyPanel.GetBindings();
+}
+
+
+
+
+LineWidthControl::~LineWidthControl (void)
+{
+	delete[] rStr;
+}
+
+
+
+
+void LineWidthControl::Paint(const Rectangle& rect)
+{
+	svx::sidebar::PopupControl::Paint(rect);
+    
+	Color aOldLineColor = GetLineColor();
+	Color aOldFillColor = GetFillColor();
+
+	Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT ));
+	Size aSize( LogicToPixel( Size(  CUSTOM_W, CUSTOM_H ), MAP_APPFONT ));
+	Rectangle aRect( aPos, aSize );
+	aRect.Left() -= 1;
+	aRect.Top() -= 1;
+	aRect.Right() += 1;
+	aRect.Bottom() += 1;
+
+	Color aLineColor(189,201,219);
+	if(!GetSettings().GetStyleSettings().GetHighContrastMode())
+		SetLineColor(aLineColor);
+	else
+		SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+	SetFillColor(COL_TRANSPARENT);
+	DrawRect(aRect);
+
+	SetLineColor(aOldLineColor);
+	SetFillColor(aOldFillColor);
+}
+
+
+
+
+void LineWidthControl::Initialize()
+{
+	maVSWidth.SetStyle( maVSWidth.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
+	//for high contract wj
+	if(GetSettings().GetStyleSettings().GetHighContrastMode())
+	{
+		maVSWidth.SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+	//	maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+		maFTWidth.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	}
+	else
+	{
+		maVSWidth.SetColor(COL_WHITE);
+	//	maBorder.SetBackground(Wallpaper(COL_WHITE));
+		maFTWidth.SetBackground(Wallpaper(COL_WHITE));
+	}
+
+	sal_Int64 nFirst= maMFWidth.Denormalize( maMFWidth.GetFirst( FUNIT_TWIP ) );
+	sal_Int64 nLast = maMFWidth.Denormalize( maMFWidth.GetLast( FUNIT_TWIP ) );
+	sal_Int64 nMin = maMFWidth.Denormalize( maMFWidth.GetMin( FUNIT_TWIP ) );
+	sal_Int64 nMax = maMFWidth.Denormalize( maMFWidth.GetMax( FUNIT_TWIP ) );
+	maMFWidth.SetSpinSize( 10 );
+	maMFWidth.SetUnit( FUNIT_POINT );
+    if( maMFWidth.GetDecimalDigits() > 1 )
+		 maMFWidth.SetDecimalDigits( 1 );
+	maMFWidth.SetFirst( maMFWidth.Normalize( nFirst ), FUNIT_TWIP );
+	maMFWidth.SetLast( maMFWidth.Normalize( nLast ), FUNIT_TWIP );
+	maMFWidth.SetMin( maMFWidth.Normalize( nMin ), FUNIT_TWIP );
+	maMFWidth.SetMax( maMFWidth.Normalize( nMax ), FUNIT_TWIP );	
+
+	rStr = new XubString[9];
+	//modify,
+	rStr[0] = String("05", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[1] = String("08", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[2] = String("10", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[3] = String("15", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[4] = String("23", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[5] = String("30", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[6] = String("45", 2, RTL_TEXTENCODING_ASCII_US);
+	rStr[7] = String("60", 2, RTL_TEXTENCODING_ASCII_US);	
+	rStr[8] = String( SVX_RES(STR_WIDTH_LAST_CUSTOM) );
+
+	LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+	const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+	for(int i = 0; i <= 7 ; i++)
+	{
+		rStr[i] = rStr[i].Insert(cSep, 1);//Modify
+		rStr[i].Append(mstrPT);
+	}
+	//end
+
+	for(sal_uInt16 i = 1 ; i <= 9 ; i++)
+	{
+		maVSWidth.InsertItem(i);
+		maVSWidth.SetItemText(i, rStr[i-1]);
+	}
+	maVSWidth.SetUnit(rStr);
+	maVSWidth.SetItemData(1,(void*)5);
+	maVSWidth.SetItemData(2,(void*)8);
+	maVSWidth.SetItemData(3,(void*)10);
+	maVSWidth.SetItemData(4,(void*)15);
+	maVSWidth.SetItemData(5,(void*)23);
+	maVSWidth.SetItemData(6,(void*)30);
+	maVSWidth.SetItemData(7,(void*)45);
+	maVSWidth.SetItemData(8,(void*)60);
+	maVSWidth.SetImage(maIMGCusGray);
+
+	maVSWidth.SetSelItem(0);
+	Link aLink =  LINK( this, LineWidthControl, VSSelectHdl ) ;
+    maVSWidth.SetSelectHdl(aLink);
+	aLink = LINK(this, LineWidthControl, MFModifyHdl);
+	maMFWidth.SetModifyHdl(aLink);
+
+	maVSWidth.StartSelection();
+	maVSWidth.Show();
+}
+
+
+
+
+void LineWidthControl::GetFocus()
+{
+	if(!mbVSFocus)
+		maMFWidth.GrabFocus();
+	else
+		maVSWidth.GrabFocus();
+}
+
+
+
+
+ValueSet& LineWidthControl::GetValueSet()
+{
+	return maVSWidth;
+}
+
+
+
+
+void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit)
+{
+	mbVSFocus = true;
+	maVSWidth.SetSelItem(0);
+	mbColseByEdit = false;
+	meMapUnit = eMapUnit;
+	SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
+    if ( aWinOpt.Exists() )
+	{
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
+		::rtl::OUString aTmp;
+		if ( aSeq.getLength())
+			aSeq[0].Value >>= aTmp;
+
+		String aWinData( aTmp );
+		mnCustomWidth = aWinData.ToInt32();
+		mbCustom = true;
+		maVSWidth.SetImage(maIMGCus);
+		maVSWidth.SetCusEnable(true);
+
+		String aStrTip( String::CreateFromDouble( (double)mnCustomWidth / 10));
+		aStrTip.Append(mstrPT);		//		
+		maVSWidth.SetItemText(9, aStrTip);
+	}
+	else
+	{
+		mbCustom = false;
+		maVSWidth.SetImage(maIMGCusGray);
+		maVSWidth.SetCusEnable(false);
+		//modify 
+		//String aStrTip(String(SVX_RES(STR_WIDTH_LAST_CUSTOM)));	
+		//maVSWidth.SetItemText(9, aStrTip);
+		maVSWidth.SetItemText(9, rStr[8]);
+	}
+	
+	if(bValuable)
+    {
+        sal_Int64 nVal = OutputDevice::LogicToLogic( lValue, (MapUnit)eMapUnit, MAP_100TH_MM );
+        nVal = maMFWidth.Normalize( nVal );
+        maMFWidth.SetValue( nVal, FUNIT_100TH_MM );
+    }
+	else 
+    {
+		maMFWidth.SetText( String() );
+    }
+
+	MapUnit eOrgUnit = (MapUnit)eMapUnit;
+	MapUnit ePntUnit( MAP_TWIP );		
+	lValue = LogicToLogic( lValue , eOrgUnit, ePntUnit );
+
+	XubString strCurrValue = maMFWidth.GetText();
+	sal_uInt16 i = 0;
+	for(; i < 8; i++)
+		if(strCurrValue == rStr[i])
+		{
+			maVSWidth.SetSelItem(i+1);
+			break;
+		}
+	if (i>=8)
+	{
+		mbVSFocus = false;
+		maVSWidth.SetSelItem(0);
+	}
+	maVSWidth.Format();
+	maVSWidth.StartSelection();
+}
+
+
+
+
+IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
+{
+	if(pControl == &maVSWidth)  
+	{		
+		sal_uInt16 iPos = maVSWidth.GetSelectItemId();
+		if(iPos >= 1 && iPos <= 8)
+		{
+			long nVal = LogicToLogic((long)(unsigned long)maVSWidth.GetItemData( iPos ) , MAP_POINT, (MapUnit)meMapUnit);
+			nVal = maMFWidth.Denormalize(nVal);
+			XLineWidthItem aWidthItem( nVal );
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L);
+			mrLinePropertyPanel.SetWidthIcon(iPos);
+			mrLinePropertyPanel.SetWidth(nVal);
+			mbColseByEdit = false;
+			mnTmpCusomWidth = 0;
+		}
+		else if(iPos == 9)
+		{//last custom
+			//modified 
+			if(mbCustom)
+			{
+				long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit);
+				nVal = maMFWidth.Denormalize(nVal);
+				XLineWidthItem aWidthItem( nVal );
+				mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L);
+				mrLinePropertyPanel.SetWidth(nVal);
+				mbColseByEdit = false;
+				mnTmpCusomWidth = 0;
+			}
+			else
+			{
+				maVSWidth.SetNoSelection();		//add , set no selection and keep the last select item 
+				maVSWidth.Format();
+				Invalidate();
+				maVSWidth.StartSelection();
+			}
+			//modify end
+		}
+		if((iPos >= 1 && iPos <= 8) || (iPos == 9 && mbCustom)) //add 
+			mrLinePropertyPanel.EndLineWidthPopupMode();
+	}
+	return( 0L );
+}
+
+
+
+
+IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl)
+{
+	if(pControl == &maMFWidth)  
+	{
+		if(maVSWidth.GetSelItem())
+		{
+			maVSWidth.SetSelItem(0);
+			maVSWidth.Format();
+			Invalidate();
+			maVSWidth.StartSelection();
+		}
+		long nTmp = static_cast<long>(maMFWidth.GetValue());
+		long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit );
+		sal_Int32 nNewWidth = (short)maMFWidth.Denormalize( nVal );
+		XLineWidthItem aWidthItem(nNewWidth);
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L);
+		
+		mbColseByEdit = true;
+		mnTmpCusomWidth = nTmp;
+		/*for(sal_uInt16 i = 0; i < 8; i++)
+		{
+			if(nTmp == (sal_Int32)maVSWidth.GetItemData(i))
+			{
+				mbColseByEdit = false;
+				break;
+			}
+		}*/
+
+	}
+	return( 0L );
+}
+
+
+
+
+bool LineWidthControl::IsCloseByEdit()
+{
+	return mbColseByEdit;
+}
+
+
+
+
+long LineWidthControl::GetTmpCustomWidth()
+{
+	return mnTmpCusomWidth;
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineWidthControl.hxx b/main/svx/source/sidebar/line/LineWidthControl.hxx
new file mode 100644
index 0000000..b8a035a
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthControl.hxx
@@ -0,0 +1,75 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/PopupControl.hxx"
+#include "LineWidthValueSet.hxx"
+#include <svl/poolitem.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+
+class SfxBindings;
+
+namespace svx { namespace sidebar {
+
+class LinePropertyPanel;
+
+class LineWidthControl
+    : public svx::sidebar::PopupControl
+{
+public:
+	LineWidthControl (Window* pParent, LinePropertyPanel& rPanel);
+	virtual ~LineWidthControl (void);
+    
+	virtual void GetFocus();
+	virtual void Paint(const Rectangle& rect);
+
+	void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit);
+	ValueSet& GetValueSet();
+	bool IsCloseByEdit();
+	long GetTmpCustomWidth();
+
+private:	
+	LinePropertyPanel& mrLinePropertyPanel;
+	SfxBindings*		                mpBindings;
+	LineWidthValueSet maVSWidth;
+	FixedText			                maFTCus;
+	FixedText			                maFTWidth;
+	MetricField			                maMFWidth;
+	SfxMapUnit			                meMapUnit;
+	XubString*			                rStr;
+	XubString			                mstrPT;	//
+	long				                mnCustomWidth;
+	bool				                mbCustom;
+	bool				                mbColseByEdit;
+	long				                mnTmpCusomWidth;
+	bool				                mbVSFocus;
+
+	Image				                maIMGCus;
+	Image				                maIMGCusGray;
+
+    void Initialize();
+	DECL_LINK(VSSelectHdl, void *);
+	DECL_LINK(MFModifyHdl, void *);
+};
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineWidthPopup.cxx b/main/svx/source/sidebar/line/LineWidthPopup.cxx
new file mode 100644
index 0000000..2ce34a2
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * 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 "LineWidthPopup.hxx"
+#include "LineWidthControl.hxx"
+#include "LinePropertyPanel.hxx"
+
+#include <unotools/viewoptions.hxx>
+
+#include <boost/bind.hpp>
+
+
+namespace svx { namespace sidebar {
+
+LineWidthPopup::LineWidthPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")))
+{
+    SetPopupModeEndHandler(::boost::bind(&LineWidthPopup::PopupModeEndCallback, this));
+}
+
+
+
+
+LineWidthPopup::~LineWidthPopup (void)
+{
+}
+
+
+
+
+void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit)
+{
+    ProvideContainerAndControl();
+
+    LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->SetWidthSelect(lValue, bValuable, eMapUnit);
+}
+
+
+
+
+void LineWidthPopup::PopupModeEndCallback (void)
+{
+    LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
+	if (pControl != NULL)
+	{
+		if (pControl->IsCloseByEdit())
+		{
+			SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
+			::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+			aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineWidth") ); 
+			aSeq[0].Value <<= ::rtl::OUString(
+                String::CreateFromInt32(pControl->GetTmpCustomWidth()));
+			aWinOpt.SetUserData( aSeq );
+		}
+	}
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineWidthPopup.hxx b/main/svx/source/sidebar/line/LineWidthPopup.hxx
new file mode 100644
index 0000000..c20d119
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthPopup.hxx
@@ -0,0 +1,53 @@
+/**************************************************************

+ * 

+ * 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 _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_

+#define _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_

+

+#include "svx/sidebar/Popup.hxx"

+

+#include <svl/poolitem.hxx>

+

+#include <boost/function.hpp>

+

+

+namespace svx { namespace sidebar {

+

+class LineWidthPopup

+    : public Popup

+{

+public :

+    LineWidthPopup (

+        Window* pParent,

+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);

+    virtual ~LineWidthPopup (void);

+

+	void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit);

+

+private:

+    void PopupModeEndCallback (void);

+};

+

+} } // end of namespace svx::sidebar

+

+#endif

+

+// eof

diff --git a/main/svx/source/sidebar/line/LineWidthValueSet.cxx b/main/svx/source/sidebar/line/LineWidthValueSet.cxx
new file mode 100644
index 0000000..0f9cbea
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthValueSet.cxx
@@ -0,0 +1,196 @@
+/**************************************************************
+ * 
+ * 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 "LineWidthValueSet.hxx"
+
+#include <i18npool/mslangid.hxx>
+
+namespace svx { namespace sidebar {
+
+
+LineWidthValueSet::LineWidthValueSet (
+    Window* pParent, const ResId& rResId)
+    : ValueSet( pParent, rResId ),
+      pVDev(NULL),
+      nSelItem(0),
+      bCusEnable(false)
+{
+	strUnit = new XubString[9];
+	SetColCount( 1 );
+    SetLineCount( 9);
+}
+
+
+
+
+LineWidthValueSet::~LineWidthValueSet (void)
+{	
+	delete pVDev;
+	delete[] strUnit;
+}
+
+
+
+
+void LineWidthValueSet::SetUnit(XubString* str)
+{
+	for(int i = 0; i < 9; i++)
+	{
+		strUnit[i] = str[i];
+	}
+}
+
+
+
+void LineWidthValueSet::SetSelItem(sal_uInt16 nSel)
+{
+	nSelItem = nSel;
+	if(nSel == 0)
+	{
+		SelectItem(1); // ,false); // 'false' nut supported by AOO
+		SetNoSelection();
+	}
+	else
+	{
+		SelectItem(nSelItem);	
+		GrabFocus();
+	}
+}
+
+
+
+
+sal_uInt16 LineWidthValueSet::GetSelItem()
+{
+	return nSelItem;
+}
+
+
+
+
+void LineWidthValueSet::SetImage(Image img)
+{
+	imgCus = img;
+}
+
+
+
+
+void LineWidthValueSet::SetCusEnable(bool bEnable)
+{
+	bCusEnable = bEnable;
+}
+
+
+
+
+void  LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+	Rectangle aRect = rUDEvt.GetRect();
+	OutputDevice*  pDev = rUDEvt.GetDevice();
+	sal_uInt16	nItemId = rUDEvt.GetItemId();
+	
+	long nRectHeight = aRect.GetHeight();
+	long nRectWidth = aRect.GetWidth();	
+	Point aBLPos = aRect.TopLeft();	
+
+	//const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();	
+	//Color aBackColor(0,0,200);
+	//const Color aTextColor = rStyleSettings.GetFieldTextColor();
+	Font aOldFont = pDev->GetFont();
+	Color aOldColor = pDev->GetLineColor();
+	Color aOldFillColor = pDev->GetFillColor();	
+
+	Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+	Size aSize = aFont.GetSize();	
+	aSize.Height() = nRectHeight*3/5;
+	aFont.SetSize( aSize );
+
+	Point aLineStart(aBLPos.X() + 5,			aBLPos.Y() + ( nRectHeight - nItemId )/2);
+	Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 10, aBLPos.Y() + ( nRectHeight - nItemId )/2);
+	if(nItemId == 9)
+	{
+		Point aImgStart(aBLPos.X() + 5,			aBLPos.Y() + ( nRectHeight - 23 ) / 2);
+		pDev->DrawImage(aImgStart, imgCus);
+	//	Point aStart(aImgStart.X() + 14 + 20 , aBLPos.Y() + nRectHeight/6);
+		Rectangle aStrRect = aRect;
+		aStrRect.Top() += nRectHeight/6;
+		aStrRect.Bottom() -= nRectHeight/6;
+		aStrRect.Left() += imgCus.GetSizePixel().Width() + 20;
+		if(bCusEnable)
+			aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor());
+		else
+			aFont.SetColor(GetSettings().GetStyleSettings().GetDisableColor());
+
+		pDev->SetFont(aFont);			    
+		pDev->DrawText(aStrRect, strUnit[ nItemId - 1 ], TEXT_DRAW_ENDELLIPSIS);
+	}
+	else
+	{
+		if( nSelItem ==  nItemId )
+		{
+			Color aBackColor(50,107,197);
+			Rectangle aBackRect = aRect;
+			aBackRect.Top() += 3;
+			aBackRect.Bottom() -= 2;
+			pDev->SetFillColor(aBackColor);
+			pDev->DrawRect(aBackRect);
+		}
+		else
+		{
+			pDev->SetFillColor( COL_TRANSPARENT );
+			pDev->DrawRect(aRect);
+		}
+
+		//draw text	
+		if(nSelItem ==  nItemId )
+			aFont.SetColor(COL_WHITE);
+		else 
+			aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor());
+		pDev->SetFont(aFont);		
+		Point aStart(aBLPos.X() + nRectWidth * 7 / 9 , aBLPos.Y() + nRectHeight/6);
+		pDev->DrawText(aStart, strUnit[ nItemId - 1 ]);	 //can't set TEXT_DRAW_ENDELLIPSIS here ,or the text will disappear	
+
+		//draw line
+		if( nSelItem ==  nItemId )
+			pDev->SetLineColor(COL_WHITE);
+		else  
+			pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor());
+
+		for(sal_uInt16 i = 1; i <= nItemId; i++)
+		{	
+			pDev->DrawLine(aLineStart,aLineEnd );	
+			aLineStart.setY(aLineStart.getY() + 1);
+			aLineEnd.setY  (aLineEnd.getY() + 1);
+		}
+	}
+
+	Invalidate( aRect );
+	pDev->SetLineColor(aOldColor);
+	pDev->SetFillColor(aOldFillColor);
+	pDev->SetFont(aOldFont);
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/line/LineWidthValueSet.hxx b/main/svx/source/sidebar/line/LineWidthValueSet.hxx
new file mode 100644
index 0000000..5a3a26f
--- /dev/null
+++ b/main/svx/source/sidebar/line/LineWidthValueSet.hxx
@@ -0,0 +1,57 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX
+#define SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX
+
+#include <svtools/valueset.hxx>
+#include <vcl/image.hxx>
+
+namespace svx { namespace sidebar {
+
+class LineWidthValueSet
+    : public ValueSet
+{
+public:
+    LineWidthValueSet (Window* pParent, const ResId& rResId);
+    virtual ~LineWidthValueSet (void);
+    
+    void SetUnit(XubString* str);
+    void SetSelItem(sal_uInt16 nSel);
+    sal_uInt16 GetSelItem();
+    void SetImage(Image img);
+    void SetCusEnable(bool bEnable);
+
+	virtual void	UserDraw( const UserDrawEvent& rUDEvt );	
+	
+protected:
+	VirtualDevice* 	pVDev;
+	sal_uInt16			nSelItem;
+	XubString*		strUnit;
+	Image			imgCus;
+	bool			bCusEnable;
+};
+
+} } // end of namespace svx::sidebar
+
+#endif // SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX
+
+// eof
diff --git a/main/svx/source/sidebar/nbdtmg.cxx b/main/svx/source/sidebar/nbdtmg.cxx
new file mode 100755
index 0000000..878dc0a
--- /dev/null
+++ b/main/svx/source/sidebar/nbdtmg.cxx
@@ -0,0 +1,2101 @@
+/**************************************************************

+ * 

+ * 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_svx.hxx"

+#ifndef _NBDTMG_HXX

+#include <svx/nbdtmg.hxx>

+#endif

+#ifndef _SVX_SVXIDS_HRC

+#include <svx/svxids.hrc>

+#endif

+#ifndef _SV_SVAPP_HXX

+#include <vcl/svapp.hxx>

+#endif

+#ifndef _SFXITEMSET_HXX

+#include <svl/itemset.hxx>

+#endif

+#ifndef _SFXREQUEST_HXX

+#include <sfx2/request.hxx>

+#endif

+#ifndef _SFXSTRITEM_HXX

+#include <svl/stritem.hxx>

+#endif

+#ifndef _UNO_LINGU_HXX

+#include <editeng/unolingu.hxx>

+#endif

+#ifndef _CTRLTOOL_HXX

+#include <svtools/ctrltool.hxx>

+#endif

+#ifndef _SFX_OBJSH_HXX

+#include <sfx2/objsh.hxx>

+#endif

+#ifndef _SVX_FLSTITEM_HXX

+#include <editeng/flstitem.hxx>

+#endif

+#ifndef _SFXITEMPOOL_HXX

+#include <svl/itempool.hxx>

+#endif

+#ifndef _SV_OUTDEV_HXX

+#include <vcl/outdev.hxx>

+#endif

+#ifndef _GALLERY_HXX_

+#include <svx/gallery.hxx>

+#endif

+#ifndef _SVX_BRSHITEM_HXX

+#include <editeng/brshitem.hxx>

+#endif

+#include <svx/dialmgr.hxx>

+#ifndef _SVX_DIALOGS_HRC

+#include <svx/dialogs.hrc>

+#endif

+#ifndef _SV_GRAPH_HXX

+#include <vcl/graph.hxx>

+#endif

+

+#include <unotools/streamwrap.hxx>

+#include <unotools/ucbstreamhelper.hxx>

+#include <unotools/pathoptions.hxx>

+#include <editeng/eeitem.hxx>

+

+#include <com/sun/star/text/HoriOrientation.hpp>

+#include <com/sun/star/text/VertOrientation.hpp>

+#include <com/sun/star/text/RelOrientation.hpp>

+#include <com/sun/star/style/NumberingType.hpp>

+#include <com/sun/star/lang/XMultiServiceFactory.hpp>

+#include <com/sun/star/container/XIndexAccess.hpp>

+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>

+#include <com/sun/star/text/XNumberingFormatter.hpp>

+#include <com/sun/star/beans/PropertyValue.hpp>

+#include <comphelper/processfactory.hxx>

+#include <com/sun/star/text/XNumberingTypeInfo.hpp>

+

+using namespace com::sun::star;

+using namespace com::sun::star::uno;

+using namespace com::sun::star::beans;

+using namespace com::sun::star::lang;

+using namespace com::sun::star::text;

+using namespace com::sun::star::container;

+using namespace com::sun::star::style;

+using rtl::OUString;

+

+namespace svx { namespace sidebar {

+#define NUM_TYPE_MEMBER	4

+#define NUM_VALUSET_COUNT		16

+#define MAX_VALUESET_GRAPHIC	30

+

+typedef NumSettings_Impl* NumSettings_ImplPtr;

+SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4)

+SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr )

+

+typedef NumberSettings_Impl* NumberSettings_ImplPtr;

+SV_DECL_PTRARR_DEL(NumberSettingsArr_Impl,NumberSettings_ImplPtr,8,4)

+SV_IMPL_PTRARR( NumberSettingsArr_Impl, NumberSettings_ImplPtr )

+

+Font& lcl_GetDefaultBulletFont()

+{

+	static sal_Bool bInit = 0;

+	static Font aDefBulletFont( UniString::CreateFromAscii(

+		                        RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),

+								String(), Size( 0, 14 ) );

+	if(!bInit)

+	{

+        aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );

+		aDefBulletFont.SetFamily( FAMILY_DONTKNOW );

+		aDefBulletFont.SetPitch( PITCH_DONTKNOW );

+		aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );

+		aDefBulletFont.SetTransparent( sal_True );

+		bInit = sal_True;

+	}

+	return aDefBulletFont;

+}

+

+static const sal_Unicode aDefaultBulletTypes[] =

+{

+	0x2022,

+	0x25cf,

+	0xe00c,

+	0xe00a,

+	0x2794,

+	0x27a2,

+	0x2717,

+	0x2714

+};

+

+static const sal_Unicode aDefaultRTLBulletTypes[] =

+{

+	0x2022,

+	0x25cf,

+	0xe00c,

+	0xe00a,

+	0x25c4,

+	0x272b,

+	0x2717,

+	0x2714

+};

+

+static const sal_Char sNumberingType[] = "NumberingType";

+static const sal_Char sValue[] = "Value";

+static const sal_Char sParentNumbering[] = "ParentNumbering";

+static const sal_Char sPrefix[] = "Prefix";

+static const sal_Char sSuffix[] = "Suffix";

+static const sal_Char sBulletChar[] = "BulletChar";

+static const sal_Char sBulletFontName[] = "BulletFontName";

+

+NumSettings_ImplPtr lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps)

+{

+	const PropertyValue* pValues = rLevelProps.getConstArray();

+	NumSettings_ImplPtr pNew = new NumSettings_Impl;

+	for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)

+	{

+		if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNumberingType)))

+			pValues[j].Value >>= pNew->nNumberType;

+		else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPrefix)))

+			pValues[j].Value >>= pNew->sPrefix;

+		else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuffix)))

+			pValues[j].Value >>= pNew->sSuffix;

+		else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sParentNumbering)))

+			pValues[j].Value >>= pNew->nParentNumbering;

+		else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletChar)))

+			pValues[j].Value >>= pNew->sBulletChar;

+		else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletFontName)))

+			pValues[j].Value >>= pNew->sBulletFont;

+	}

+    const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix.getStr()[0] : 0;

+    const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix.getStr()[0] : 0;

+	String aEmptyStr;

+	if( cLocalPrefix == ' ') pNew->sPrefix=aEmptyStr;

+	if( cLocalSuffix == ' ') pNew->sSuffix=aEmptyStr;

+	return pNew;

+}

+

+sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel)

+{

+	sal_uInt16 nLv = (sal_uInt16)0xFFFF;

+	sal_uInt16 nCount = 0;

+	sal_uInt16 nMask = 1;

+	for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ )

+	{

+		if(nCurLevel & nMask)

+		{

+			nCount++;

+			nLv=i;

+		}

+		nMask <<= 1 ;

+	}

+

+	if ( nCount == 1)

+		return nLv;		

+	else

+		return (sal_uInt16)0xFFFF;

+}

+

+void NBOTypeMgrBase::StoreBulCharFmtName_impl() {

+		if ( pSet )

+		{	

+			SfxAllItemSet aSet(*pSet);

+			SFX_ITEMSET_ARG(&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);			

+				

+			if ( pBulletCharFmt )

+			{

+				aNumCharFmtName =  String(pBulletCharFmt->GetValue());

+			}

+		}

+}

+String NBOTypeMgrBase::GetBulCharFmtName()

+{

+	return aNumCharFmtName;

+}

+void NBOTypeMgrBase::ImplLoad(String filename)

+{

+	bIsLoading = true;

+	SfxMapUnit		eOldCoreUnit=eCoreUnit;

+	eCoreUnit = SFX_MAPUNIT_100TH_MM;	

+	INetURLObject aFile( SvtPathOptions().GetPalettePath() );

+	aFile.Append( filename);

+	SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );

+	if( pIStm ) {

+		sal_uInt32                      nVersion;

+		sal_Int32                   nNumIndex;

+		*pIStm >> nVersion;

+		if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version

+		{

+			*pIStm >> nNumIndex;

+			sal_uInt16 mLevel = 0x1;

+			while (nNumIndex>=0 && nNumIndex<DEFAULT_NUM_VALUSET_COUNT) {

+				SvxNumRule aNum(*pIStm);

+				//bullet color in font properties is not stored correctly. Need set tranparency bits manually

+				for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+				{

+					SvxNumberFormat aFmt(aNum.GetLevel(i));

+					if (aFmt.GetBulletFont()) {

+						Font aFont(*aFmt.GetBulletFont());

+						Color c=aFont.GetColor();

+						c.SetTransparency(0xFF);

+						aFont.SetColor(c);

+						aFmt.SetBulletFont(&aFont);       

+						aNum.SetLevel(i, aFmt);

+					}

+				}

+				RelplaceNumRule(aNum,nNumIndex,mLevel);

+				*pIStm >> nNumIndex;

+			}

+			delete pIStm;

+		}

+	}

+	eCoreUnit = eOldCoreUnit;

+	bIsLoading = false;

+}

+void NBOTypeMgrBase::ImplStore(String filename)

+{

+	if (bIsLoading) return;

+	SfxMapUnit		eOldCoreUnit=eCoreUnit;

+	eCoreUnit = SFX_MAPUNIT_100TH_MM;	

+	INetURLObject aFile( SvtPathOptions().GetPalettePath() );

+	aFile.Append( filename);

+    SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );

+	if( pOStm ) {

+		sal_uInt32                      nVersion;

+		sal_Int32                       nNumIndex;

+		nVersion = DEFAULT_NUMBERING_CACHE_FORMAT_VERSION;

+		*pOStm << nVersion;

+		for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT;	nItem++ ) {

+			if (IsCustomized(nItem)) {

+				SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False ,

+					SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT);

+				sal_uInt16 mLevel = 0x1;

+				*pOStm << nItem;

+				ApplyNumRule(aDefNumRule,nItem,mLevel,false,true);

+				aDefNumRule.Store(*pOStm);

+			}

+		}

+		nNumIndex = -1;

+		*pOStm << nNumIndex;  //write end flag

+		delete pOStm;

+	}

+	eCoreUnit = eOldCoreUnit;

+}

+

+void NBOTypeMgrBase::StoreMapUnit_impl() {

+	if ( pSet )

+	{

+		const SfxPoolItem* pItem;

+		SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);

+		if(eState == SFX_ITEM_SET)

+		{

+			eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));

+		} else {

+			//Sym3_2508 sd use different sid for numbering rule

+			eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem);

+			if(eState == SFX_ITEM_SET)

+			{

+				eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(EE_PARA_NUMBULLET));

+			}		

+		}

+	}

+}

+SfxMapUnit NBOTypeMgrBase::GetMapUnit()

+{

+	return eCoreUnit;

+}

+/***************************************************************************************************

+**********************Character Bullet Type lib**********************************************************

+****************************************************************************************************/

+BulletsTypeMgr* BulletsTypeMgr::_instance = 0;

+BulletsSettings_Impl* BulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0};

+sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '};

+sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '};

+ 

+BulletsTypeMgr::BulletsTypeMgr(const NBOType aType):

+	NBOTypeMgrBase(aType)

+{

+	Init();

+}

+

+BulletsTypeMgr::BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg):

+	NBOTypeMgrBase(aType,pArg)

+{

+	Init();

+}

+

+BulletsTypeMgr::BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr):

+	NBOTypeMgrBase(aTypeMgr)

+{

+	for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++)

+	{

+		pActualBullets[i]->bIsCustomized = aTypeMgr.pActualBullets[i]->bIsCustomized;

+		pActualBullets[i]->cBulletChar = aTypeMgr.pActualBullets[i]->cBulletChar;

+		pActualBullets[i]->aFont = aTypeMgr.pActualBullets[i]->aFont;

+		pActualBullets[i]->sDescription = aTypeMgr. pActualBullets[i]->sDescription;

+		pActualBullets[i]->eType = aTypeMgr. pActualBullets[i]->eType;

+	}

+}

+void BulletsTypeMgr::Init()

+{	

+	Font& rActBulletFont = lcl_GetDefaultBulletFont();

+	String sName = rActBulletFont.GetName();

+	if( Application::GetSettings().GetLayoutRTL() )

+	{

+		for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++)

+		{

+			pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS);

+			pActualBullets[i]->cBulletChar = aDefaultRTLBulletTypes[i];

+			pActualBullets[i]->aFont = rActBulletFont;

+			if (i==4 || i==5)

+				pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 - 4 + i );

+			else 

+				pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i );		

+		}

+	}else

+	{

+		for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++)

+		{

+			pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS);

+			pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i];

+			pActualBullets[i]->aFont =rActBulletFont;

+			pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i );		

+		}

+	}

+}

+sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex)

+{	

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0)

+		return (sal_uInt16)0xFFFF;

+	//if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF;

+

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return (sal_uInt16)0xFFFF;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	sal_Unicode cChar = aFmt.GetBulletChar();

+	const Font* pFont = aFmt.GetBulletFont();

+	//sal_uInt16 nLength = 0;

+	/*if( Application::GetSettings().GetLayoutRTL() )

+	{

+		nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode);

+		for(sal_uInt16 i = 0; i < nLength; i++)

+		{

+			if ( cChar == aDynamicRTLBulletTypes[i] ||

+				(cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) ||

+				(cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) )

+			{

+				return i+1;

+			}

+		}

+	} else

+	{

+		nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode);

+		for(sal_uInt16 i = 0; i < nLength; i++)

+		{

+			if ( cChar == aDynamicBulletTypes[i] ||

+				(cChar == 9830 && 57356 == aDynamicBulletTypes[i]) ||

+				(cChar == 9632 && 57354 == aDynamicBulletTypes[i]) )

+			{

+				return i+1;

+			}

+		}		

+	}*/

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+	for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++)

+	{

+		if ( (cChar == pActualBullets[i]->cBulletChar||

+			(cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) ||

+			(cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) 

+		{

+			return i+1;

+		}

+	}

+

+	return (sal_uInt16)0xFFFF;

+}

+

+sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel)

+{

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0)

+		return sal_False;

+

+	if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF )

+		return sal_False;

+	

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return sal_False;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	sal_Unicode cChar = aFmt.GetBulletChar();

+	const Font* pFont = aFmt.GetBulletFont();

+	//sal_uInt16 nLength = 0;

+	/*if( Application::GetSettings().GetLayoutRTL() )

+	{

+		nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength )

+			return sal_False;

+

+		aDynamicRTLBulletTypes[nIndex] = cChar;		

+	} else

+	{

+		nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength ) 

+			return sal_False;

+

+		aDynamicBulletTypes[nIndex] = cChar;

+	}*/

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+	if ( nIndex >= DEFAULT_BULLET_TYPES )

+		return sal_False;

+

+	pActualBullets[nIndex]->cBulletChar = cChar;

+	if ( pFont )

+		pActualBullets[nIndex]->aFont = *pFont;

+	pActualBullets[nIndex]->bIsCustomized = sal_True;

+

+	String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+	String aReplace = String::CreateFromAscii("%LIST_NUM");

+	String sNUM = String::CreateFromInt32( nIndex + 1 );

+	aStrFromRES.SearchAndReplace(aReplace,sNUM);

+	pActualBullets[nIndex]->sDescription = aStrFromRES;

+

+	return sal_True;

+}

+

+sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	sal_Unicode cChar;

+	//sal_uInt16 nLength = 0;

+	/*if( Application::GetSettings().GetLayoutRTL() )

+	{

+		nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength ) 

+			return sal_False;

+		

+		cChar = aDynamicRTLBulletTypes[nIndex];

+	}else

+	{

+		nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength ) 

+			return sal_False;

+

+		cChar = aDynamicBulletTypes[nIndex];

+	}*/

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+	if ( nIndex >= DEFAULT_BULLET_TYPES ) 

+		return sal_False;

+	cChar = pActualBullets[nIndex]->cBulletChar;

+	//Font& rActBulletFont = lcl_GetDefaultBulletFont();

+	Font rActBulletFont = pActualBullets[nIndex]->aFont;

+	

+	sal_uInt16 nMask = 1;

+	String sBulletCharFmtName = GetBulCharFmtName();

+	for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+	{

+		if(mLevel & nMask)

+		{

+			SvxNumberFormat aFmt(aNum.GetLevel(i));

+			aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );			

+			aFmt.SetBulletFont(&rActBulletFont);

+			aFmt.SetBulletChar(cChar );

+			aFmt.SetCharFmtName(sBulletCharFmtName);       

+            if (isResetSize) aFmt.SetBulletRelSize(45);

+			aNum.SetLevel(i, aFmt);

+		}

+		nMask <<= 1;

+	}

+	

+	return sal_True;

+}

+

+String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault)

+{

+	String sRet;

+	//sal_uInt16 nLength = 0;

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+

+	if ( nIndex >= DEFAULT_BULLET_TYPES )

+		return sRet;

+	else

+		sRet = pActualBullets[nIndex]->sDescription;

+

+	return sRet;

+}

+sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex)

+{

+	sal_Bool bRet = sal_False;

+	//sal_uInt16 nLength = 0;

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+

+	if ( nIndex >= DEFAULT_BULLET_TYPES )

+		bRet = sal_False;

+	else

+		bRet = pActualBullets[nIndex]->bIsCustomized;

+

+	return bRet;

+}

+		

+sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex)

+{	

+	sal_Unicode cChar;

+	//sal_uInt16 nLength = 0;

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+

+	if ( nIndex >= DEFAULT_BULLET_TYPES ) 

+		cChar = ' ';

+	else		

+		cChar = pActualBullets[nIndex]->cBulletChar;

+		

+	/*if( Application::GetSettings().GetLayoutRTL() )

+	{

+		nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength ) 

+			cChar = ' ';

+		else		

+			cChar = aDynamicRTLBulletTypes[nIndex];

+	}else

+	{

+		nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode);

+

+		if ( nIndex >= nLength ) 

+			cChar = ' ';

+		else

+			cChar = aDynamicBulletTypes[nIndex];

+	}*/

+

+	return cChar;

+}

+Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex)

+{

+	Font aRet;

+	if ( nIndex >= DEFAULT_BULLET_TYPES ) 

+		aRet = lcl_GetDefaultBulletFont();

+	else		

+		aRet = pActualBullets[nIndex]->aFont;	

+

+	return aRet;

+}

+/***************************************************************************************************

+**********************Graphic Bullet Type lib***********************************************************

+****************************************************************************************************/

+GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0;

+GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType):

+	NBOTypeMgrBase(aType)

+{

+	Init();

+}

+

+GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg):

+	NBOTypeMgrBase(aType,pArg)

+{

+	Init();

+}

+GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr):

+	NBOTypeMgrBase(aTypeMgr)

+{

+	for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.Count();i++)

+	{

+		GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS);

+		GrfBulDataRelation* pSrcEntry = (GrfBulDataRelation*)(aTypeMgr.aGrfDataLst.GetObject(i));

+		if ( pEntry && pSrcEntry)

+		{

+			pEntry->bIsCustomized = pSrcEntry->bIsCustomized;

+			pEntry->nTabIndex = pSrcEntry->nTabIndex;

+			pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex;

+			pEntry->sGrfName = pSrcEntry->sGrfName;

+			pEntry->sDescription = pSrcEntry->sDescription;

+			aGrfDataLst.Insert( pEntry, LIST_APPEND );

+		}

+	}

+}

+void GraphyicBulletsTypeMgr::Init()

+{

+	List aGrfNames;

+	GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);	

+	for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++)

+	{		

+		String* pGrfNm = (String*) aGrfNames.GetObject(i);

+        	INetURLObject aObj(*pGrfNm);

+        	if(aObj.GetProtocol() == INET_PROT_FILE)

+            		*pGrfNm = aObj.PathToFileName();

+

+		GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS);

+		pEntry->nTabIndex = i+1;

+		pEntry->nGallaryIndex = i;

+		pEntry->sGrfName = *pGrfNm;

+			

+		if( i < MAX_VALUESET_GRAPHIC )

+		{			

+			pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i );		

+		}else

+		{

+			pEntry->sDescription = *pGrfNm;

+		}

+

+		aGrfDataLst.Insert( pEntry, LIST_APPEND );

+	}

+}

+sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex)

+{	

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0)

+		return (sal_uInt16)0xFFFF;

+	

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return (sal_uInt16)0xFFFF;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));	

+	const SvxBrushItem* pBrsh = aFmt.GetBrush();

+	const Graphic* pGrf = 0;

+	if ( pBrsh )

+		pGrf = pBrsh->GetGraphic();

+

+	if ( pGrf )

+	{

+		const String* pGrfName = pBrsh->GetGraphicLink();

+		Graphic aGraphic;

+		for(sal_uInt16 i=0;i<aGrfDataLst.Count();i++)

+		{

+			GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(i);

+			sal_Bool bExist = sal_False;

+			if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL )

+				bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic);

+			if (bExist) {

+				Bitmap aSum=pGrf->GetBitmap();

+				Bitmap aSum1=aGraphic.GetBitmap();

+				if (aSum.IsEqual(aSum1))

+				return pEntry->nTabIndex;

+			}

+		}

+	}

+		

+	return (sal_uInt16)0xFFFF;

+}

+

+sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel)

+{

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0)

+		return sal_False;

+

+	if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF )

+		return sal_False;

+	

+	if ( nIndex >= aGrfDataLst.Count() )

+		return sal_False;

+

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return sal_False;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	const SvxBrushItem* pBrsh = aFmt.GetBrush();

+	const Graphic* pGrf = 0;

+	if ( pBrsh )

+		pGrf = pBrsh->GetGraphic();

+	else

+		return sal_False;

+

+	String sEmpty;

+	if ( pGrf )

+	{

+		const String* pGrfName = pBrsh->GetGraphicLink();

+		//String* pGrfName = (String*)(pBrsh->GetGraphicLink());

+		GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex);

+		if ( pGrfName )

+			pEntry->sGrfName = *pGrfName;

+		//pEntry->sDescription = sEmpty;

+		pEntry->nGallaryIndex = (sal_uInt16)0xFFFF;

+		pEntry->bIsCustomized = sal_True;	

+		String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+		String aReplace = String::CreateFromAscii("%LIST_NUM");

+		String sNUM = String::CreateFromInt32( nIndex + 1 );

+		aStrFromRES.SearchAndReplace(aReplace,sNUM);

+		pEntry->sDescription = aStrFromRES;

+	}else

+	{

+		return sal_False;

+	}

+	

+	return sal_True;

+}

+

+sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	if ( nIndex >= aGrfDataLst.Count() )

+		return sal_False;

+	

+	String sGrfName;

+	GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex);

+	sGrfName= pEntry->sGrfName;

+

+	sal_uInt16 nMask = 1;

+	String aEmptyStr;

+	sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;

+	String sNumCharFmtName = GetBulCharFmtName();

+	for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+	{

+		if(mLevel & nMask)

+		{

+			SvxNumberFormat aFmt(aNum.GetLevel(i));

+			aFmt.SetNumberingType(nSetNumberingType);

+			aFmt.SetPrefix( aEmptyStr );

+			aFmt.SetSuffix( aEmptyStr );

+			aFmt.SetCharFmtName( sNumCharFmtName );

+

+                	Graphic aGraphic;

+                	if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic))

+			{

+	                    Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);

+	                    sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;

+				aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit());

+	                    SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );

+	                    aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );

+			}

+			else// if(pGrfName)

+				aFmt.SetGraphic( sGrfName );

+

+			aNum.SetLevel(i, aFmt);

+		}

+		nMask <<= 1 ;

+	}

+		

+	return sal_True;

+}

+String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault)

+{

+	String sRet;

+	sal_uInt16 nLength = 0;

+	nLength = aGrfDataLst.Count() ;

+

+	if ( nIndex >= nLength )

+		return sRet;

+	else

+	{

+		GrfBulDataRelation* pEntry  = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex);

+		if ( pEntry )

+		{

+			sRet = pEntry->sDescription;

+		};

+	}

+	return sRet;

+}

+sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex)

+{

+	sal_Bool bRet = sal_False;

+	

+	sal_uInt16 nLength = 0;

+	nLength = aGrfDataLst.Count() ;

+

+	if ( nIndex >= nLength )

+		return bRet;

+	else

+	{

+		GrfBulDataRelation* pEntry  = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex);

+		if ( pEntry )

+		{

+			bRet = pEntry->bIsCustomized;

+		};

+	}

+		

+	return bRet;

+}

+String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex)

+{	

+	String sRet;

+	if ( nIndex < aGrfDataLst.Count() )

+	{

+		GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex);

+		if ( pEntry )

+		{

+			sRet = pEntry->sGrfName;

+		}		

+	}	

+	

+	return sRet;

+}

+/***************************************************************************************************

+**********************Mix Bullets Type lib**************************************************************

+****************************************************************************************************/

+MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0;

+MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0};

+MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0};

+ 

+MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType):

+	NBOTypeMgrBase(aType)

+{

+	Init();

+	for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ )

+	{

+		pDefaultActualBullets[nItem] = pActualBullets[nItem];

+	}

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.sya"));

+}

+

+MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg):

+	NBOTypeMgrBase(aType,pArg)

+{

+	Init();

+	for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ )

+	{

+		pDefaultActualBullets[nItem] = pActualBullets[nItem];

+	}

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.sya"));

+}

+

+MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr):

+	NBOTypeMgrBase(aTypeMgr)

+{

+	for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++)

+	{

+		if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS )

+		{

+			pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType;		

+			pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display

+			pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault;

+			pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+			((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar;

+			((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont;

+			((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription;

+			((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized;

+			((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType;

+		}else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS )

+		{

+			pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType;		

+			pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display

+			pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault;

+			pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ;

+			((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName;

+			((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription;

+			((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized;

+			((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType;

+			if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL)

+			{

+				((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj;

+			}

+		}

+	}

+	ImplLoad(String::CreateFromAscii("standard.sya"));

+}

+void MixBulletsTypeMgr::Init()

+{	

+	BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance();

+	if ( pBTMgr )

+	{

+		//Index 1

+		pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[0]->eType = eNBType::BULLETS;

+		pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[0]->nIndexDefault = 2;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS;

+

+		//Index 2

+		pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[1]->eType = eNBType::BULLETS;

+		pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[1]->nIndexDefault = 3;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS;

+

+		//Index 3

+		pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[2]->eType = eNBType::BULLETS;

+		pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[2]->nIndexDefault = 4;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS;

+

+		//Index 4

+		pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[3]->eType = eNBType::BULLETS;

+		pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[3]->nIndexDefault = 5;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS;

+

+		//Index 5

+		pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[4]->eType = eNBType::BULLETS;

+		pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[4]->nIndexDefault = 6;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS;

+

+		//Index 6

+		pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS);

+		pActualBullets[5]->eType = eNBType::BULLETS;

+		pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[5]->nIndexDefault = 8;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+		((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1);

+		((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS;

+	}

+

+	GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();

+	if ( mGrfTMgr )

+	{

+		//Index 7

+		pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS);

+		pActualBullets[6]->eType = eNBType::GRAPHICBULLETS;

+		pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[6]->nIndexDefault = 9;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ;

+		((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS;

+

+		//Index 8

+		pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS);

+		pActualBullets[7]->eType = eNBType::GRAPHICBULLETS;

+		pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[7]->nIndexDefault = 23;	 //index in the tab page display,decrease 1 to the index within arr

+		pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ;

+		((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault);

+		((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS;

+	}

+	

+}

+sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex)

+{	

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0)

+		return (sal_uInt16)0xFFFF;

+	//if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF;

+

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return (sal_uInt16)0xFFFF;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	sal_Int16 eNumType = aFmt.GetNumberingType();

+	if( eNumType == SVX_NUM_CHAR_SPECIAL)

+	{

+		sal_Unicode cChar = aFmt.GetBulletChar();

+		const Font* pFont = aFmt.GetBulletFont();

+		String sName = pFont?pFont->GetName():String();

+		

+		for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++)

+		{

+			if ( pActualBullets[i]->eType == eNBType::BULLETS )

+			{

+				String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName();

+				if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar||

+					(cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) ||

+					(cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&&

+					//(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) )

+				{		

+					return pActualBullets[i]->nIndex;

+				}

+			}

+		}

+	}else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP )

+	{

+		const SvxBrushItem* pBrsh = aFmt.GetBrush();

+		const Graphic* pGrf = 0;

+		if ( pBrsh )

+			pGrf = pBrsh->GetGraphic();

+

+		if ( pGrf )

+		{

+			const String* pGrfName = pBrsh->GetGraphicLink();

+			//String* pGrfName = (String*)(pBrsh->GetGraphicLink());

+			for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++)

+			{

+				if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS )

+				{

+					GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets);

+					//sal_Bool bExist = sal_False;

+					if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF  && pEntry->pGrfObj)

+					{

+						if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap()))

+						{

+							return pActualBullets[i]->nIndex;

+						}

+					}else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL )

+						//bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf);

+						Graphic aSrGrf;

+						if (pEntry)

+							GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf);

+						Bitmap aSum=pGrf->GetBitmap();

+						Bitmap aSum1=aSrGrf.GetBitmap();

+						if (aSum.IsEqual(aSum1))

+							return pActualBullets[i]->nIndex;

+					}

+				}

+			}

+		}

+	}

+

+	return (sal_uInt16)0xFFFF;

+}

+

+sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel)

+{

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES)

+		return sal_False;

+

+	//if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return sal_False;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	sal_Int16 eNumType = aFmt.GetNumberingType();

+	if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS )

+	{

+		sal_Unicode cChar = aFmt.GetBulletChar();

+		const Font* pFont = aFmt.GetBulletFont();

+		BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets);

+		pEntry->cBulletChar = cChar;

+		pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont();

+		pEntry->bIsCustomized = sal_True;

+		String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+		String aReplace = String::CreateFromAscii("%LIST_NUM");

+		String sNUM = String::CreateFromInt32( nIndex + 1 );

+		aStrFromRES.SearchAndReplace(aReplace,sNUM);

+		pEntry->sDescription = aStrFromRES;

+		

+	}else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS )

+	{

+		const SvxBrushItem* pBrsh = aFmt.GetBrush();

+		const Graphic* pGrf = 0;

+		if ( pBrsh )

+			pGrf = pBrsh->GetGraphic();

+		else

+			return sal_False;

+

+		String sEmpty;

+		if ( pGrf )

+		{

+			const String* pGrfName = pBrsh->GetGraphicLink();

+			//String* pGrfName = (String*)(pBrsh->GetGraphicLink());

+			GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets);

+			if ( pGrfName )

+				pEntry->sGrfName = *pGrfName;

+			GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();

+			if ( mGrfTMgr )

+			{

+				//sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel);

+				//if ( nDIndex != (sal_uInt16)0xFFFF)

+				//{

+				//	pActualBullets[nIndex]->nIndexDefault = nDIndex -1;

+				//	sEmpty = mGrfTMgr->GetDescription( nDIndex -1);

+				//}else

+				{

+					pActualBullets[nIndex]->nIndexDefault  = (sal_uInt16)0xFFFF;

+					sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+					String aReplace = String::CreateFromAscii("%LIST_NUM");

+					String sNUM = String::CreateFromInt32( nIndex + 1 );

+					sEmpty.SearchAndReplace(aReplace,sNUM);

+					//pEntry->pGrfObj = pGrf;

+					pEntry->pGrfObj = new Graphic(*pGrf);

+					pEntry->aSize = aFmt.GetGraphicSize();

+					pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM);

+					sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel);

+					if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0);

+				}

+			}

+			pEntry->sDescription = sEmpty;

+			pEntry->bIsCustomized = sal_True;		

+		}else

+		{

+			return sal_False;

+		}

+	}else

+	{

+		delete pActualBullets[nIndex]->pBullets;

+		pActualBullets[nIndex]->pBullets = 0;

+		if ( eNumType == SVX_NUM_CHAR_SPECIAL )

+		{

+			sal_Unicode cChar = aFmt.GetBulletChar();

+			const Font* pFont = aFmt.GetBulletFont();

+			pActualBullets[nIndex]->eType = eNBType::BULLETS;

+			pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr

+			pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ;

+			((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar;

+			((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont();

+			((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True;

+			((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS;

+			BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance();

+			if ( pBTMgr )

+			{

+				//sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel);

+				//if ( nDIndex != (sal_uInt16)0xFFFF)

+				//{

+				//	pActualBullets[nIndex]->nIndexDefault = nDIndex -1;

+				//	((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1);

+				//}else

+				{

+					pActualBullets[nIndex]->nIndexDefault  = (sal_uInt16)0xFFFF;

+					String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+					String aReplace = String::CreateFromAscii("%LIST_NUM");

+					String sNUM = String::CreateFromInt32( nIndex + 1 );

+					aStrFromRES.SearchAndReplace(aReplace,sNUM);

+					((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES;

+				}

+			}

+		}else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP )

+		{

+			const SvxBrushItem* pBrsh = aFmt.GetBrush();

+			const Graphic* pGrf = 0;

+			if ( pBrsh )

+				pGrf = pBrsh->GetGraphic();

+			else

+				return sal_False;

+

+			String sEmpty;

+			const String* pGrfName = 0;

+			if ( pGrf )

+			{

+				pGrfName = pBrsh->GetGraphicLink();			

+			

+				pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS;

+				pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr				

+				pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ;

+				if (pGrfName)

+					((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName;				

+				((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True;

+				((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS;

+				GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();

+				if ( mGrfTMgr )

+				{

+					//sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel);

+					//if ( nDIndex != (sal_uInt16)0xFFFF)

+					//{

+					//	pActualBullets[nIndex]->nIndexDefault = nDIndex - 1;

+					//	((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1);

+					//}else

+					{

+						pActualBullets[nIndex]->nIndexDefault  = (sal_uInt16)0xFFFF;

+						String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));

+						String aReplace = String::CreateFromAscii("%LIST_NUM");

+						String sNUM = String::CreateFromInt32( nIndex + 1 );

+						aStrFromRES.SearchAndReplace(aReplace,sNUM);

+						((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES;

+						//((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf;

+						((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf);

+						((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf);

+						Size aTmpSize = aFmt.GetGraphicSize();

+						aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM);

+						sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel);

+						if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0);

+						((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize;

+

+				}

+				}				

+			}

+		}

+	}

+	SvxNumRule aTmpRule1(aNum);

+	ApplyNumRule(aTmpRule1,nIndex,mLevel,true);

+	if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) {

+		if (pActualBullets[nIndex]->eType == eNBType::BULLETS) {

+			BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets);

+			pEntry->bIsCustomized = false;

+			pEntry->sDescription = GetDescription(nIndex,true);

+		} 

+		if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) {

+			GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets);

+			pEntry->bIsCustomized = false;

+			pEntry->sDescription = GetDescription(nIndex,true);

+		} 

+	}

+	ImplStore(String::CreateFromAscii("standard.sya"));

+	return sal_True;

+}

+

+sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES )

+	if ( nIndex>=DEFAULT_BULLET_TYPES )

+		return sal_False;

+	MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex];

+	if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex];

+	

+	if ( pCurrentBullets->eType == eNBType::BULLETS )

+	{

+		sal_Unicode cChar;

+		cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar;

+		

+		//Font& rActBulletFont = lcl_GetDefaultBulletFont();

+		Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont;

+		sal_uInt16 nMask = 1;

+		String sBulletCharFmtName = GetBulCharFmtName();

+		for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+		{

+			if(mLevel & nMask)

+			{

+				SvxNumberFormat aFmt(aNum.GetLevel(i));

+				if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true;

+				aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );

+				aFmt.SetBulletFont(&rActBulletFont);

+				aFmt.SetBulletChar(cChar );

+				aFmt.SetCharFmtName(sBulletCharFmtName);

+				String aEmptyStr;

+				aFmt.SetPrefix( aEmptyStr );					

+				aFmt.SetSuffix( aEmptyStr );

+	            if (isResetSize) aFmt.SetBulletRelSize(45);

+				aNum.SetLevel(i, aFmt);

+			}

+			nMask <<= 1;

+		}

+	}else if (  pCurrentBullets->eType == eNBType::GRAPHICBULLETS )

+	{

+		String sGrfName;

+		GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets);

+		sGrfName= pEntry->sGrfName;

+

+		sal_uInt16 nMask = 1;

+		String aEmptyStr;

+		sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;

+		String sNumCharFmtName = GetBulCharFmtName();

+		for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+		{

+			if(mLevel & nMask)

+			{

+				SvxNumberFormat aFmt(aNum.GetLevel(i));

+				if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true;

+				aFmt.SetNumberingType(nSetNumberingType);

+				aFmt.SetPrefix( aEmptyStr );

+				aFmt.SetSuffix( aEmptyStr );

+				aFmt.SetCharFmtName( sNumCharFmtName );

+				if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj )

+				{

+					Size aSize = pEntry->aSize;

+			        sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;

+  					if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize();

+					else {

+						if (aSize.Width()==0 && aSize.Height()==0) {

+							aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj );

+						}

+						aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit());

+					}

+			        SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH );

+			        aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );

+				}else

+				{

+		                	Graphic aGraphic;

+		                	if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic))

+					{

+								Size aSize = pEntry->aSize;

+								sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;

+								if (!isResetSize  && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize();

+								else {

+									if (aSize.Width()==0 && aSize.Height()==0) {

+							            aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);

+									}

+									aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit());

+								}

+			                    SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );

+			                    aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );

+					}else

+						aFmt.SetGraphic( sGrfName );

+				}					

+

+				aNum.SetLevel(i, aFmt);

+			}

+			nMask <<= 1 ;

+		}

+	}

+	

+	return sal_True;

+}

+

+String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault)

+{

+	String sRet;

+	//sal_uInt16 nLength = 0;

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+

+	if ( nIndex >= DEFAULT_BULLET_TYPES )

+		return sRet;

+	else

+		sRet = pActualBullets[nIndex]->pBullets->sDescription;

+	if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription;

+	return sRet;

+}

+sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex)

+{

+	sal_Bool bRet = sal_False;

+	//sal_uInt16 nLength = 0;

+	//nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl);

+

+	if ( nIndex >= DEFAULT_BULLET_TYPES )

+		bRet = sal_False;

+	else

+		bRet = pActualBullets[nIndex]->pBullets->bIsCustomized;

+

+	return bRet;

+}

+/***************************************************************************************************

+**********************Numbering Type lib**************************************************************

+****************************************************************************************************/

+NumberingTypeMgr* NumberingTypeMgr::_instance = 0;

+

+NumberingTypeMgr::NumberingTypeMgr(const NBOType aType):

+	NBOTypeMgrBase(aType),

+	//pNumSettingsArr( new NumSettingsArr_Impl ),

+	pNumberSettingsArr (new NumberSettingsArr_Impl)

+{

+	Init();

+	pDefaultNumberSettingsArr = pNumberSettingsArr;

+	pNumberSettingsArr = new NumberSettingsArr_Impl;

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.syb"));

+}

+

+NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg):

+	NBOTypeMgrBase(aType,pArg),

+	//pNumSettingsArr( new NumSettingsArr_Impl ),

+	pNumberSettingsArr (new NumberSettingsArr_Impl)

+{

+	Init();

+	pDefaultNumberSettingsArr = pNumberSettingsArr;

+	pNumberSettingsArr = new NumberSettingsArr_Impl;

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.syb"));

+}

+

+NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr):

+	NBOTypeMgrBase(aTypeMgr),

+	//pNumSettingsArr( new NumSettingsArr_Impl ),

+	pNumberSettingsArr (new NumberSettingsArr_Impl)

+{

+	/*

+	for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++)

+	{

+		NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i);

+		if ( _pSet )

+		{

+			pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex;

+			pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault;

+			pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription;

+			pNumberSettingsArr->GetObject(i)->bIsCustomized	= _pSet->bIsCustomized;

+			if ( _pSet->pNumSetting )

+			{

+				pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont;

+				

+				pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt;

+				pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt;

+			}			

+		}

+	}

+	*/

+	ImplLoad(String::CreateFromAscii("standard.syb"));

+}

+

+void NumberingTypeMgr::Init()

+{

+	Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();

+	Reference < XInterface > xI = xMSF->createInstance(

+		::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );

+	Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY);

+	

+	if(xDefNum.is())

+	{

+		Sequence< Sequence< PropertyValue > > aNumberings;

+        	LanguageType eLang = Application::GetSettings().GetLanguage();

+		Locale aLocale = SvxCreateLocale(eLang);

+		try

+		{

+			aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale );

+

+            		sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength();

+

+			const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();

+			for(sal_Int32 i = 0; i < nLength; i++)

+			{

+				NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]);

+				NumberSettings_Impl* pNumEntry = new NumberSettings_Impl;

+				pNumEntry->nIndex = i + 1;

+				pNumEntry->nIndexDefault = i;

+				pNumEntry->pNumSetting = pNew;

+                //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i ));

+				{

+					String sText;

+					//const OUString sValue(C2U("Value"));

+					Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY);

+					if(xFormatter.is() && aNumberings.getLength() > i)

+					{

+						

+						for (sal_uInt16 j=0;j<3;j++)

+						{

+							Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i];

+							try

+							{

+								aLevel.realloc(aLevel.getLength() + 1);

+								PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1];

+								rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));

+								rValue.Value <<= (sal_Int32)(j + 1);

+								

+								if (j!=0)

+									sText += String::CreateFromAscii(" ");

+								

+								sText+=String(xFormatter->makeNumberingString( aLevel, aLocale ));

+							}

+							catch(Exception&)

+							{

+								DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString");

+							}

+						}

+					}

+					String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS));

+					String aReplace = String::CreateFromAscii("%NUMBERINGSAMPLE");

+					aStrFromRES.SearchAndReplace(aReplace,sText);

+					pNumEntry->sDescription = aStrFromRES;

+            	}

+	    //End modification

+

+				//pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i );

+				pNumberSettingsArr->Insert(pNumEntry, pNumberSettingsArr->Count());

+			}

+		}

+		catch(Exception&)

+		{

+		}

+	}

+}

+

+sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex)

+{

+	if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0)

+		return (sal_uInt16)0xFFFF;

+	

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return (sal_uInt16)0xFFFF;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0];

+	sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0];

+	String sPreFix = aFmt.GetPrefix();

+	String sSuffix = aFmt.GetSuffix();

+	String sEmpty;

+    	sal_Int16 eNumType = aFmt.GetNumberingType();

+       

+	sal_uInt16 nCount = pNumberSettingsArr->Count();

+	for(sal_uInt16 i = nFromIndex; i < nCount; i++)

+	{

+		NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(i);

+		sal_Int16 eNType = _pSet->pNumSetting->nNumberType;

+		String sLocalPreFix = _pSet->pNumSetting->sPrefix.getStr();

+		String sLocalSuffix = _pSet->pNumSetting->sSuffix.getStr();

+		if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && 

+			sSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL &&

+			eNumType == eNType )

+		{

+			return i+1;

+		}		

+	}

+

+

+	return (sal_uInt16)0xFFFF;

+}

+

+sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0)	

+	//	return sal_False;

+

+	//if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	sal_uInt16 nActLv = IsSingleLevel(mLevel);

+

+	if ( nActLv == (sal_uInt16)0xFFFF ) 

+		return sal_False;

+

+	SvxNumberFormat aFmt(aNum.GetLevel(nActLv));

+	//sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0];

+	//sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0];

+	sal_Int16 eNumType = aFmt.GetNumberingType();

+

+	sal_uInt16 nCount = pNumberSettingsArr->Count();

+	if ( nIndex >= nCount )

+		return sal_False;

+

+	NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(nIndex);

+

+	_pSet->pNumSetting->sPrefix = aFmt.GetPrefix();

+	_pSet->pNumSetting->sSuffix = aFmt.GetSuffix();

+	 _pSet->pNumSetting->nNumberType = eNumType;

+	_pSet->bIsCustomized = sal_True;

+

+	SvxNumRule aTmpRule1(aNum);

+	SvxNumRule aTmpRule2(aNum);

+	ApplyNumRule(aTmpRule1,nIndex,mLevel,true);

+	ApplyNumRule(aTmpRule2,nIndex,mLevel,false);

+	if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false;

+	if (_pSet->bIsCustomized) {

+		String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION));

+		String aReplace = String::CreateFromAscii("%LIST_NUM");

+		String sNUM = String::CreateFromInt32( nIndex + 1 );

+		aStrFromRES.SearchAndReplace(aReplace,sNUM);

+		_pSet->sDescription = aStrFromRES;

+	} else {

+		_pSet->sDescription = GetDescription(nIndex,true);

+	}

+	ImplStore(String::CreateFromAscii("standard.syb"));

+	return sal_True;	

+}

+

+sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	//DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index");

+	if(pNumberSettingsArr->Count() <= nIndex)

+		return sal_False;

+	NumberSettingsArr_Impl*		pCurrentNumberSettingsArr=pNumberSettingsArr;

+	if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr;

+	NumberSettings_ImplPtr _pSet = pCurrentNumberSettingsArr->GetObject(nIndex);

+	sal_Int16 eNewType = _pSet->pNumSetting->nNumberType;

+

+	sal_uInt16 nMask = 1;

+	String sNumCharFmtName = GetBulCharFmtName();

+	for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+	{

+		if(mLevel & nMask)

+		{

+			SvxNumberFormat aFmt(aNum.GetLevel(i));

+			if (eNewType!=aFmt.GetNumberingType()) isResetSize=true;

+			aFmt.SetNumberingType(eNewType);

+			aFmt.SetPrefix(_pSet->pNumSetting->sPrefix);

+			aFmt.SetSuffix(_pSet->pNumSetting->sSuffix);

+

+			aFmt.SetCharFmtName(sNumCharFmtName);

+			if (isResetSize) aFmt.SetBulletRelSize(100);

+			aNum.SetLevel(i, aFmt);

+		}

+		nMask <<= 1 ;

+	}

+		

+	return sal_True;

+}

+String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault)

+{

+	String sRet;

+	sal_uInt16 nLength = 0;

+	nLength = pNumberSettingsArr->Count();

+

+	if ( nIndex >= nLength )

+		return sRet;

+	else

+		sRet = pNumberSettingsArr->GetObject(nIndex)->sDescription;

+	if (isDefault) sRet = pDefaultNumberSettingsArr->GetObject(nIndex)->sDescription;

+

+	return sRet;

+}

+sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex)

+{

+	sal_Bool bRet = sal_False;

+	sal_uInt16 nLength = 0;

+	nLength = pNumberSettingsArr->Count();

+

+	if ( nIndex >= nLength )

+		bRet = sal_False;

+	else

+		bRet = pNumberSettingsArr->GetObject(nIndex)->bIsCustomized;

+

+	return bRet;

+}

+sal_uInt16 NumberingTypeMgr::GetNumCount() const

+{

+	sal_uInt16 nRet = 0;

+	if ( pNumberSettingsArr )

+		nRet = pNumberSettingsArr->Count();

+

+	return nRet;

+}

+NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const

+{

+	NumberSettings_Impl* pRet = 0;

+	if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->Count() )

+	{

+		pRet = pNumberSettingsArr->GetObject(nIndex);

+	}

+

+	return pRet;

+}

+/***************************************************************************************************

+**********************Multi-level /Outline Type lib*******************************************************

+****************************************************************************************************/

+OutlineTypeMgr* OutlineTypeMgr::_instance = 0;

+

+OutlineTypeMgr::OutlineTypeMgr(const NBOType aType):

+	NBOTypeMgrBase(aType)//,

+	//pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] )

+{

+	Init();

+	for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ )

+	{

+		pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem];

+	}

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.syc"));

+}

+

+OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg):

+	NBOTypeMgrBase(aType,pArg)//,

+	//pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT])

+{

+	Init();

+	for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ )

+	{

+		pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem];

+	}

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.syc"));

+}

+	

+OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr):

+	NBOTypeMgrBase(aTypeMgr)//,

+	//pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT])

+{

+	Init();

+	for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ )

+	{

+		pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem];

+	}

+	//Initial the first time to store the default value. Then do it again for customized value

+	Init();

+	ImplLoad(String::CreateFromAscii("standard.syc"));

+}

+

+void OutlineTypeMgr::Init()

+{

+	Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();

+	Reference < XInterface > xI = xMSF->createInstance(

+		::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );

+	Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY);

+

+	if(xDefNum.is())

+	{

+		Sequence<Reference<XIndexAccess> > aOutlineAccess;

+        	LanguageType eLang = Application::GetSettings().GetLanguage();

+		Locale aLocale = SvxCreateLocale(eLang);

+		try

+		{

+			aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );

+

+			SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False ,

+				SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT);

+			

+			for(sal_Int32 nItem = 0;

+				nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT;

+				nItem++ )

+			{

+				pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl;

+				OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ];

+				pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem );

+				pItemArr->pNumSettingsArr = new NumSettingsArr_Impl;

+				Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];

+				for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)

+				{

+					Any aValueAny = xLevel->getByIndex(nLevel);

+					Sequence<PropertyValue> aLevelProps;

+					aValueAny >>= aLevelProps;

+					NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps);

+					SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) );

+					pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy();

+					pNew->nTabValue = aNumFmt.GetListtabPos();

+					pNew->eNumAlign = aNumFmt.GetNumAdjust();

+					pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent();

+					pNew->nNumIndentAt = aNumFmt.GetIndentAt();					

+					pItemArr->pNumSettingsArr->Insert( pNew, pItemArr->pNumSettingsArr->Count() );

+				}

+			}

+		}

+		catch(Exception&)

+		{

+		}

+	}

+}

+

+sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex)

+{	

+	sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*);

+	for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++)

+	{

+		sal_Bool bNotMatch = sal_False;

+		OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex];

+		sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count();

+		for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++)

+		{

+			NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel);

+			sal_Int16 eNType = _pSet->nNumberType;

+		    	const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0;       

+	       	const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0;

+			

+		    	SvxNumberFormat aFmt(aNum.GetLevel(iLevel));

+			sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0];

+			sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0];

+			String sPreFix = aFmt.GetPrefix();

+			String sSuffix = aFmt.GetSuffix();

+			String sEmpty;

+		     	sal_Int16 eNumType = aFmt.GetNumberingType();					

+		     	if( eNumType == SVX_NUM_CHAR_SPECIAL)

+			{

+				sal_Unicode cChar = aFmt.GetBulletChar();

+				const Font* pFont = aFmt.GetBulletFont();

+				sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0];

+				rtl::OUString sFont = _pSet->sBulletFont;

+				if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && 

+					_pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() &&

+					_pSet->nTabValue == aFmt.GetListtabPos() &&

+					_pSet->eNumAlign == aFmt.GetNumAdjust() &&

+					_pSet->nNumAlignAt == aFmt.GetFirstLineIndent() &&

+					_pSet->nNumIndentAt == aFmt.GetIndentAt()))

+				{

+					bNotMatch = sal_True;

+					break;

+				}

+				}else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) {

+				    	const SvxBrushItem* pBrsh1 = aFmt.GetBrush();

+						const SvxBrushItem* pBrsh2 = _pSet->pBrushItem;

+						sal_Bool bIsMatch = false;

+						if (pBrsh1==pBrsh2) bIsMatch = true;

+						if (pBrsh1 && pBrsh2) {

+							const Graphic* pGrf1 = pBrsh1->GetGraphic();;

+							const Graphic* pGrf2 = pBrsh2->GetGraphic();;

+							if (pGrf1==pGrf2) bIsMatch = true;

+							if (pGrf1 && pGrf2) {

+								if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) &&

+									 _pSet->aSize==aFmt.GetGraphicSize())

+									bIsMatch = true;

+							}

+						}

+						if (!bIsMatch) {

+							bNotMatch = sal_True;

+							break;

+						}

+				} else

+		     	{

+				if (!((sPreFix.CompareTo(_pSet->sPrefix.getStr())==COMPARE_EQUAL) &&  

+					( sSuffix.CompareTo(_pSet->sSuffix.getStr())==COMPARE_EQUAL ) &&

+					eNumType == eNType &&

+					_pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() &&

+					_pSet->nTabValue == aFmt.GetListtabPos() &&

+					_pSet->eNumAlign == aFmt.GetNumAdjust() &&

+					_pSet->nNumAlignAt == aFmt.GetFirstLineIndent() &&

+					_pSet->nNumIndentAt == aFmt.GetIndentAt()))			

+				{

+					bNotMatch = sal_True;

+					break;

+				}

+		     	}

+		}

+		if ( !bNotMatch )

+			return iDex+1;

+	}

+

+	

+	return (sal_uInt16)0xFFFF;

+}

+

+sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel)

+{

+	//if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF )

+	//	return sal_False;

+

+	sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*);

+	if ( nIndex >= nLength )

+		return sal_False;

+	

+	OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex];

+	sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count();

+	for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++)

+	{		 

+		SvxNumberFormat aFmt(aNum.GetLevel(iLevel));

+		sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0];

+		sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0];

+		sal_Int16 eNumType = aFmt.GetNumberingType();

+		

+		NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel);

+

+		_pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy();

+		_pSet->nTabValue = aFmt.GetListtabPos();

+		_pSet->eNumAlign = aFmt.GetNumAdjust();

+		_pSet->nNumAlignAt = aFmt.GetFirstLineIndent();

+		_pSet->nNumIndentAt = aFmt.GetIndentAt();

+					

+		if( eNumType == SVX_NUM_CHAR_SPECIAL)

+		{

+			sal_Unicode cChar = aFmt.GetBulletChar();

+			OUString sChar(cChar);

+			_pSet->sBulletChar = sChar;//OUString(cChar);

+			if ( aFmt.GetBulletFont() )

+				_pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName());

+			_pSet->nNumberType = eNumType;

+			pItemArr->bIsCustomized = sal_True;

+		}else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) {

+			if (_pSet->pBrushItem) {

+				delete (_pSet->pBrushItem);

+				_pSet->pBrushItem=NULL;

+			}

+			if (aFmt.GetBrush())

+				_pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush());

+			_pSet->aSize = aFmt.GetGraphicSize();

+			_pSet->nNumberType = eNumType;

+		} else

+	   	{

+			_pSet->sPrefix = aFmt.GetPrefix();

+			_pSet->sSuffix = aFmt.GetSuffix();

+			_pSet->nNumberType = eNumType;

+			if ( aFmt.GetBulletFont() )

+				_pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName());

+			pItemArr->bIsCustomized = sal_True;

+	     }

+	}

+	SvxNumRule aTmpRule1(aNum);

+	SvxNumRule aTmpRule2(aNum);

+	ApplyNumRule(aTmpRule1,nIndex,mLevel,true);

+	ApplyNumRule(aTmpRule2,nIndex,mLevel,false);

+	if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false;

+	if (pItemArr->bIsCustomized) {

+		String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION));

+		String aReplace = String::CreateFromAscii("%LIST_NUM");

+		String sNUM = String::CreateFromInt32( nIndex + 1 );

+		aStrFromRES.SearchAndReplace(aReplace,sNUM);

+		pItemArr->sDescription = aStrFromRES;

+	} else {

+		pItemArr->sDescription = GetDescription(nIndex,true);

+	}

+	ImplStore(String::CreateFromAscii("standard.syc"));

+	return sal_True;		

+}

+

+sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize)

+{

+	//if ( mLevel == (sal_uInt16)0xFFFF )

+	//	return sal_False;

+	

+	DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index");

+	if(DEFAULT_NUM_VALUSET_COUNT <= nIndex)

+		return sal_False;

+

+	const FontList* pList = 0;

+

+    OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex];

+	if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex];

+

+	//Font& rActBulletFont = lcl_GetDefaultBulletFont();

+	NumSettingsArr_Impl	*pNumSettingsArr=pItemArr->pNumSettingsArr;

+	

+	NumSettings_ImplPtr pLevelSettings = 0;

+	String sBulletCharFmtName = GetBulCharFmtName();

+	sal_uInt16 nMask = 1;

+	for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)

+	{

+		if(pNumSettingsArr->Count() > i)

+			pLevelSettings = pNumSettingsArr->GetObject(i);

+

+		if(!pLevelSettings)

+			break;

+

+		SvxNumberFormat aFmt(aNum.GetLevel(i));

+		//aFmt.SetBulletFont(&pLevelSettings->aFont);

+		Font& rActBulletFont = lcl_GetDefaultBulletFont();

+		if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true;

+		aFmt.SetNumberingType( pLevelSettings->nNumberType );

+		sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering;

+		if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)

+		{

+			if( pLevelSettings->sBulletFont.getLength() &&

+				pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName()))

+			{

+	                    //search for the font

+	                    if(!pList)

+	                    {

+	                        	SfxObjectShell* pCurDocShell = SfxObjectShell::Current();

+	                        	const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST );

+	                        	pList = pFontListItem ? pFontListItem->GetFontList() : 0;

+	                    }

+	                    if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )

+	                    {

+					FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);

+					Font aFont(aInfo);

+					aFmt.SetBulletFont(&aFont);

+	                    }

+	                    else

+	                    {

+			             //if it cannot be found then create a new one

+			             Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) );

+			             aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );

+			             aCreateFont.SetFamily( FAMILY_DONTKNOW );

+			             aCreateFont.SetPitch( PITCH_DONTKNOW );

+			             aCreateFont.SetWeight( WEIGHT_DONTKNOW );

+			             aCreateFont.SetTransparent( sal_True );

+			             aFmt.SetBulletFont( &aCreateFont );

+	                    }

+			}else

+			aFmt.SetBulletFont( &rActBulletFont );

+	

+			sal_Unicode cChar = 0;

+			if( pLevelSettings->sBulletChar.getLength() )

+				cChar = pLevelSettings->sBulletChar.getStr()[0];

+			if( Application::GetSettings().GetLayoutRTL() )

+			{	

+                    		if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] )

+					cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5];

+				else if( 1 == i )

+				{

+					const SvxNumberFormat& numberFmt = aNum.GetLevel(0);

+					if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] )

+						cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4];

+				}

+			}

+

+			aFmt.SetBulletChar(cChar);

+			aFmt.SetCharFmtName( sBulletCharFmtName );

+            if (isResetSize) aFmt.SetBulletRelSize(45);

+		}else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) {

+			if (pLevelSettings->pBrushItem) {

+					const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();;

+					Size aSize = pLevelSettings->aSize;

+					sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;

+					if (!isResetSize  && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize();

+					else {

+						if (aSize.Width()==0 && aSize.Height()==0 && pGrf) {

+							aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf );

+						}

+					}

+					aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit());

+					aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient );

+			}

+		} else

+		{

+			aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0));

+			aFmt.SetCharFmtName(sBulletCharFmtName);

+              	if (isResetSize) aFmt.SetBulletRelSize(100);

+       	}

+		if(pNumSettingsArr->Count() > i) {

+			aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy);

+			aFmt.SetListtabPos(pLevelSettings->nTabValue);

+			aFmt.SetNumAdjust(pLevelSettings->eNumAlign);

+			aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt);

+			aFmt.SetIndentAt(pLevelSettings->nNumIndentAt);

+		}

+		aFmt.SetPrefix(pLevelSettings->sPrefix);

+		aFmt.SetSuffix(pLevelSettings->sSuffix);

+		aNum.SetLevel(i, aFmt);

+	}

+

+	return sal_True;

+}

+String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault)

+{

+	String sRet;

+	sal_uInt16 nLength = 0;

+	nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*);

+		

+	if ( nIndex >= nLength )

+		return sRet;

+	else

+	{

+		OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex];

+		if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex];

+		if ( pItemArr )

+		{

+			sRet = pItemArr->sDescription;

+		};

+	}

+	return sRet;

+}

+sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex)

+{

+	sal_Bool bRet = sal_False;

+	

+	sal_uInt16 nLength = 0;

+	nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*);

+		

+	if ( nIndex >= nLength )

+		return bRet;

+	else

+	{

+		OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex];

+		if ( pItemArr )

+		{

+			bRet = pItemArr->bIsCustomized;

+		};

+	}

+	

+	return bRet;

+}

+

+

+}}

diff --git a/main/svx/source/sidebar/nbdtmgfact.cxx b/main/svx/source/sidebar/nbdtmgfact.cxx
new file mode 100755
index 0000000..e4afed1
--- /dev/null
+++ b/main/svx/source/sidebar/nbdtmgfact.cxx
@@ -0,0 +1,51 @@
+/**************************************************************

+ * 

+ * 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 _NBDTMGFACT_HXX

+#include <svx/nbdtmgfact.hxx>

+#endif

+namespace svx { namespace sidebar {

+NBOutlineTypeMgrFact::NBOutlineTypeMgrFact()

+{

+}

+

+NBOTypeMgrBase* NBOutlineTypeMgrFact::CreateInstance(const NBOType aType)

+{

+	//NBOTypeMgrBase* pRet= 0;

+	if ( aType == eNBOType::BULLETS )

+	{

+		return BulletsTypeMgr::GetInstance();

+	}else if ( aType == eNBOType::GRAPHICBULLETS )

+	{

+		return GraphyicBulletsTypeMgr::GetInstance();

+	}else if ( aType == eNBOType::MIXBULLETS )

+	{

+		return MixBulletsTypeMgr::GetInstance();

+	}else if ( aType == eNBOType::NUMBERING )

+	{

+		return NumberingTypeMgr::GetInstance();

+	}else if ( aType == eNBOType::OUTLINE )

+	{

+		return OutlineTypeMgr::GetInstance();

+	}		

+}

+}}

+

diff --git a/main/svx/source/sidebar/paragraph/ParaBulletsControl.cxx b/main/svx/source/sidebar/paragraph/ParaBulletsControl.cxx
new file mode 100755
index 0000000..1b4268b
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaBulletsControl.cxx
@@ -0,0 +1,145 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include "ParaBulletsControl.hxx"
+#include "ParaPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <svtools/unitconv.hxx>
+#include <svx/nbdtmg.hxx>
+#include <svx/nbdtmgfact.hxx>
+
+namespace svx { namespace sidebar {
+
+ParaBulletsControl::ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel):
+	PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS)),
+	mrParaPropertyPanel(rPanel),
+	mpBindings(NULL),
+	maBulletsVS(this,SVX_RES(VS_VALUES)),
+	maFISep(this,SVX_RES(IMG_SEPERATOR_BULLET)),
+	maMoreButton(this,SVX_RES(CB_BULLET_MORE)) 
+{
+	FreeResource();
+	mpBindings = mrParaPropertyPanel.GetBindings();
+	maBulletsVS.SetColCount(3);
+	maBulletsVS.SetLineCount(3);
+	maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT);
+	maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING);
+	if(GetSettings().GetStyleSettings().GetHighContrastMode())
+		maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	else
+		maBulletsVS.SetBackground(Color(244,245,249));
+
+	maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH);
+	maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT);
+ 	maBulletsVS.InsertItem( DEFAULT_NONE );
+ 	for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx )
+    	{
+       	maBulletsVS.InsertItem( nVSIdx );
+    	}
+	
+	maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE ));
+	NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);	
+	if ( pBullets )
+	{
+		for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex )
+		{
+			maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) );			
+		}
+	}
+
+    maBulletsVS.Show();
+	maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl));
+
+	/*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contract
+	maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 )
+	maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 )
+	maMoreButton.SetIcoPosX( 2);*/
+	maBulletsVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+
+	maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl));
+
+}
+
+ParaBulletsControl::~ParaBulletsControl()
+{
+	
+}
+
+void ParaBulletsControl::UpdateValueSet()
+{
+	maBulletsVS.StateChanged(STATE_CHANGE_STYLE);
+	maBulletsVS.StateChanged(STATE_CHANGE_INITSHOW);
+}
+void ParaBulletsControl::ToGetFocus()
+{
+	sal_uInt16 nTypeIndex = (sal_uInt16)0xFFFF;
+	mrParaPropertyPanel.GetBulletTypeIndex();
+	if ( nTypeIndex != (sal_uInt16)0xFFFF )
+		maBulletsVS.SelectItem( nTypeIndex );
+	else
+	{
+		maBulletsVS.SelectItem(0);
+	}
+	maMoreButton.GrabFocus();
+}
+
+IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+	sal_uInt16 nIdx = maBulletsVS.GetSelectItemId();
+	SfxUInt16Item aItem(FN_SVX_SET_BULLET, nIdx);
+	if (mpBindings)
+		mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L );
+
+	mrParaPropertyPanel.EndBulletsPopupMode();
+	
+	return 0;
+}
+
+IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG)
+{
+	if (mpBindings)
+		mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON );
+
+	mrParaPropertyPanel.EndBulletsPopupMode();
+
+	return 0;
+}
+
+}} // end of namespace sidebar
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaBulletsControl.hxx b/main/svx/source/sidebar/paragraph/ParaBulletsControl.hxx
new file mode 100755
index 0000000..67f0ad0
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaBulletsControl.hxx
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_BULLETS_CONTROL_HXX_
+#define _SVX_SIDEBAR_BULLETS_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "ParaPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/button.hxx>
+
+
+namespace svx { namespace sidebar {
+
+class ParaBulletsControl:public svx::sidebar::PopupControl
+{
+private:	
+	SvxNumValueSet3				maBulletsVS;
+	FixedImage					maFISep;
+	PushButton maMoreButton;
+	ParaPropertyPanel&     mrParaPropertyPanel;
+	SfxBindings*		mpBindings;
+
+	DECL_LINK(BulletSelectHdl_Impl, ValueSet*);
+	DECL_LINK(MoreButtonClickHdl_Impl, void*);
+
+public:
+	ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel);
+	~ParaBulletsControl();
+	void ToGetFocus();	
+	void UpdateValueSet();
+};
+
+}}
+
+#endif
+
diff --git a/main/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx b/main/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx
new file mode 100755
index 0000000..1b2a642
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ * 
+ * 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 "ParaBulletsPopup.hxx"
+#include "ParaBulletsControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+ParaBulletsPopup::ParaBulletsPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Bullets")))
+{
+}
+
+
+
+
+ParaBulletsPopup::~ParaBulletsPopup (void)
+{
+}
+
+
+
+
+void ParaBulletsPopup::UpdateValueSet ()
+{
+    ProvideContainerAndControl();
+
+    ParaBulletsControl* pControl = dynamic_cast<ParaBulletsControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->UpdateValueSet();	
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx b/main/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx
new file mode 100755
index 0000000..13a9f3d
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_BULLETS_POPUP_HXX_
+#define _SVX_SIDEBAR_BULLETS_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+namespace svx { namespace sidebar {
+
+class ParaBulletsPopup
+    : public Popup
+{
+public :
+    ParaBulletsPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~ParaBulletsPopup (void);
+
+    void UpdateValueSet ();
+//private:
+    //void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
new file mode 100755
index 0000000..824dd82
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -0,0 +1,819 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include "ParaLineSpacingControl.hxx"
+#include "ParaPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <svtools/unitconv.hxx>
+
+#define _DEFAULT_LINE_SPACING  200
+#define FIX_DIST_DEF           283
+#define LINESPACE_1            100
+#define LINESPACE_15           150
+#define LINESPACE_2            200
+#define LINESPACE_115          115
+
+#define LLINESPACE_1          0
+#define LLINESPACE_15         1
+#define LLINESPACE_2          2
+#define LLINESPACE_PROP       3
+#define LLINESPACE_MIN        4
+#define LLINESPACE_DURCH      5
+#define LLINESPACE_FIX        6
+
+#define DO_NOT_CUSTOM          0
+#define USE_CUSTOM             1
+
+namespace svx { namespace sidebar {
+
+
+ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel)
+:	PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING))
+,	mrParaPropertyPanel(rPanel)
+,	mpBindings(NULL)
+,aLineDist				( this, SVX_RES( LB_LINE_SPACING )),
+aLineDistAtPercentBox	( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ),
+aLineDistAtMetricBox	( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ),
+maCustomFT        ( this, SVX_RES( FT_CUSTOM ) ),
+maLSpacingFT      ( this, SVX_RES( FT_LINE_SPACING ) ),
+maOfFT            ( this, SVX_RES( FT_OF ) ),
+maSpacing1       (SVX_RES(IMG_SPACING1)),
+maSpacing115     (SVX_RES(IMG_SPACING115)),
+maSpacing15      (SVX_RES(IMG_SPACING15)),
+maSpacing2       (SVX_RES(IMG_SPACING2)),
+maLPCustom       (SVX_RES(IMG_SPACINGLCUSTOM)),
+maSelSpacing1    (SVX_RES(IMG_SEL_SPACING1)),
+maSelSpacing115  (SVX_RES(IMG_SEL_SPACING115)),
+maSelSpacing15   (SVX_RES(IMG_SEL_SPACING15)),
+maSelSpacing2    (SVX_RES(IMG_SEL_SPACING2)),
+maImgCusGrey	 (SVX_RES(IMG_CUSTOM_GRAY)),
+maImgCus		 (SVX_RES(IMG_CUSTOM)),
+maStrCus		 (SVX_RES(STR_LCVALUE)),
+pActLineDistFld 		( &aLineDistAtPercentBox ),
+nMinFixDist			    ( BEGIN_VALUE ),
+maValue                 ( 0 ),
+maPos                   ( 0 ),
+maLineSpacing		(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ),
+mpImg			(NULL),
+mpImgSel		(NULL),
+mpStr			(NULL),
+mpStrTip		(NULL),
+maLine			(SVX_RES(STR_LSPACING)),
+maOf			(SVX_RES(STR_LS_OF))
+, mbUseLineSPCustom             (0)
+, mbLineSPDisable               (0)
+{
+	initial();
+	FreeResource();
+	mpBindings = mrParaPropertyPanel.GetBindings();
+//	m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric();
+	m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM;
+}
+ParaLineSpacingControl::~ParaLineSpacingControl()
+{
+	delete[] mpImg;
+	delete[] mpImgSel;
+	delete[] mpStr;
+	delete[] mpStrTip;
+}
+
+void ParaLineSpacingControl::initial()
+{
+	//maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );
+	//maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	//maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+	//maLineSpacing.SetMinFont();
+
+	maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+	GetSettings().GetStyleSettings().GetMenuColor():
+	sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+	GetSettings().GetStyleSettings().GetMenuColor():
+	sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maLineSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+	GetSettings().GetStyleSettings().GetMenuColor():
+	sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	//maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+	//GetSettings().GetStyleSettings().GetMenuColor():
+	//sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	//maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+	//GetSettings().GetStyleSettings().GetMenuColor():
+	//sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+
+	mpImg = new Image[4];
+	mpImg[0] = maSpacing1;
+	mpImg[1] = maSpacing115;
+	mpImg[2] = maSpacing15;
+	mpImg[3] = maSpacing2;
+
+	mpImgSel = new Image[4];
+	mpImgSel[0] = maSelSpacing1;
+	mpImgSel[1] = maSelSpacing115;
+	mpImgSel[2] = maSelSpacing15;
+	mpImgSel[3] = maSelSpacing2;
+
+	mpStr = new XubString[4];
+	mpStr[0] = XubString(SVX_RES(STR_SPACING1));
+	mpStr[1] = XubString(SVX_RES(STR_SPACING115));
+	mpStr[2] = XubString(SVX_RES(STR_SPACING15));
+	mpStr[3] = XubString(SVX_RES(STR_SPACING2));
+
+	mpStrTip = new XubString[4];
+	mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE));
+	mpStrTip[1] = XubString(SVX_RES(STR_LS_115));
+	mpStrTip[2] = XubString(SVX_RES(STR_LS_15));
+	mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE));
+	for (int i=0;i<4;i++)
+		maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
+
+	maLineSpacing.AddItem( maImgCus, 0, maStrCus, 0 );
+
+	SetAllNoSel();
+	Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl );
+	maLineSpacing.SetSelectHdl(aLink);
+	maLineSpacing.StartSelection();
+	maLineSpacing.Show();
+
+	aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl );
+	aLineDist.SetSelectHdl(aLink);
+	aLineDist.SelectEntryPos( LLINESPACE_1 ) ;
+	aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl );
+	aLineDistAtPercentBox.SetModifyHdl( aLink );
+	aLineDistAtMetricBox.SetModifyHdl( aLink );
+}
+void ParaLineSpacingControl::ToGetFocus(bool bType)
+{
+	if(!bType)
+		aLineDist.GrabFocus();
+	else
+		maLineSpacing.GrabFocus();	//wj
+}
+
+void ParaLineSpacingControl::PopupModeEndCallback()
+{
+	if( mbUseLineSPCustom )
+	{
+		//maLinePos = mpLineSPPage->maPos;
+	    //maLineValue = mpLineSPPage->maValue;
+
+		SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE );
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") );
+		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maPos ));
+		aWinOpt.SetUserData( aSeq );
+
+		SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE );
+		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") );
+		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maValue ));
+		aWinOpt2.SetUserData( aSeq );
+	}	
+}
+
+void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
+{
+	SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE );
+    if ( aWinOpt.Exists() )
+	{
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
+		::rtl::OUString aTmp;
+		if ( aSeq.getLength())
+			aSeq[0].Value >>= aTmp;
+
+		String aWinData( aTmp );
+		maPos = (sal_uInt16)aWinData.ToInt32();
+	}
+
+	SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE );
+    if ( aWinOpt2.Exists() )
+	{
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
+		::rtl::OUString aTmp;
+		if ( aSeq.getLength())
+			aSeq[0].Value >>= aTmp;
+
+		String aWinData( aTmp );
+		maValue = (sal_uInt16)aWinData.ToInt32();
+	}
+	String sHelpText;
+	switch(maPos)
+	{
+		case LLINESPACE_1:
+			sHelpText += mpStrTip[0];
+			break;
+		case LLINESPACE_15:
+			sHelpText += mpStrTip[2];
+			break;
+		case LLINESPACE_2:
+			sHelpText += mpStrTip[3];
+			break;
+		case LLINESPACE_PROP:
+			sHelpText +=maLine;
+			sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US));
+			sHelpText += maOf;
+			sHelpText.Append( String::CreateFromInt64( maValue ));
+			break;
+		case LLINESPACE_MIN:
+			sHelpText += maLine;
+			sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US));
+			sHelpText += maOf;
+			sHelpText.Append( String::CreateFromInt64( maValue ));
+			break;
+		case LLINESPACE_DURCH:
+			sHelpText += maLine;
+			sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US));
+			sHelpText += maOf;
+			sHelpText.Append( String::CreateFromInt64( maValue ));
+			break;
+		case LLINESPACE_FIX:
+			sHelpText += maLine;
+			sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US));
+			sHelpText += maOf;
+			sHelpText.Append( String::CreateFromInt64( maValue ));
+			break;
+	}
+	if( !aWinOpt.Exists() && !aWinOpt2.Exists() )
+		mbLineSPDisable = sal_True;
+	else 
+		mbLineSPDisable = sal_False;
+
+	if( mbLineSPDisable )
+		maLineSpacing.ReplaceItemImages(5, maImgCusGrey,0);
+	else
+	{
+		maLineSpacing.ReplaceItemImages(5, maImgCus,0);
+		maLineSpacing.SetItemText(5,sHelpText);
+	}
+
+	SfxItemState eState = currSPState;
+
+	SetFieldUnit( aLineDistAtMetricBox, currMetricUnit );
+
+//	mpLineSPPage->SetAllNoSel();
+	aLineDist.Enable();
+	pActLineDistFld->Enable();
+	pActLineDistFld->SetText( String() );
+	bool bValueSetFocus = sal_False;		//wj
+
+	if( eState >= SFX_ITEM_AVAILABLE )
+	{
+	//	SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric();
+		SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM;
+		m_eLNSpaceUnit = eUnit;
+
+		switch( currSPItem->GetLineSpaceRule() )
+		{
+		case SVX_LINE_SPACE_AUTO:
+			{
+				SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule();
+
+				switch( eInter )
+				{
+				case SVX_INTER_LINE_SPACE_OFF:
+					{
+						aLineDist.SelectEntryPos( LLINESPACE_1 );	
+						pActLineDistFld->Disable();
+						pActLineDistFld->SetText( String() );
+						mbUseLineSPCustom = DO_NOT_CUSTOM;
+						if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
+						{
+							maLineSpacing.SelectItem(1);
+							bValueSetFocus = sal_True;	//wj
+						}
+					}
+					break;
+
+				case SVX_INTER_LINE_SPACE_PROP:
+					{
+						if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
+						{
+							aLineDist.SelectEntryPos( LLINESPACE_1 );
+							pActLineDistFld->Disable();
+							pActLineDistFld->SetText( String() );
+							mbUseLineSPCustom = DO_NOT_CUSTOM;
+							maLineSpacing.SelectItem(1);
+							bValueSetFocus = sal_True;	//wj
+							break;
+						}
+						if ( LINESPACE_15 == currSPItem->GetPropLineSpace() )
+						{
+							aLineDist.SelectEntryPos( LLINESPACE_15 );
+							pActLineDistFld->Disable();
+							pActLineDistFld->SetText( String() );
+
+							mbUseLineSPCustom = DO_NOT_CUSTOM;
+							maLineSpacing.SelectItem(3);
+							bValueSetFocus = sal_True;	//wj
+							break;
+						}
+						if ( LINESPACE_2 == currSPItem->GetPropLineSpace() )
+						{
+							aLineDist.SelectEntryPos( LLINESPACE_2 );
+							pActLineDistFld->Disable();
+							pActLineDistFld->SetText( String() );
+							
+							mbUseLineSPCustom = DO_NOT_CUSTOM;
+							maLineSpacing.SelectItem(4);							
+							bValueSetFocus = sal_True;	//wj
+							break;
+						}
+
+						aLineDist.SelectEntryPos( LLINESPACE_PROP );
+						if(pActLineDistFld != &(aLineDistAtPercentBox))
+						{
+							pActLineDistFld->Disable();
+							pActLineDistFld->Hide();
+							pActLineDistFld = &(aLineDistAtPercentBox);
+						}
+						else
+						{
+							pActLineDistFld = &(aLineDistAtMetricBox);
+							pActLineDistFld->Disable();
+							pActLineDistFld->Hide();
+							pActLineDistFld = &(aLineDistAtPercentBox);
+						}
+						pActLineDistFld->Enable();
+						pActLineDistFld->Show();
+						aLineDistAtPercentBox.
+							SetValue( aLineDistAtPercentBox.Normalize(
+							currSPItem->GetPropLineSpace() ) );
+
+						if( currSPItem->GetPropLineSpace() == LINESPACE_115 )
+						{
+							mbUseLineSPCustom = DO_NOT_CUSTOM;
+							maLineSpacing.SelectItem(2);
+							bValueSetFocus = sal_True;	//wj
+						}
+						else
+						{
+							mbUseLineSPCustom = USE_CUSTOM;
+							maLineSpacing.SetNoSelection();
+                                                 maLineSpacing.SelectItem(0);
+						}
+					}
+					break;
+
+				case SVX_INTER_LINE_SPACE_FIX:
+					{
+						if(pActLineDistFld != &(aLineDistAtMetricBox))
+						{
+							pActLineDistFld->Disable();
+							pActLineDistFld->Hide();
+							pActLineDistFld = &(aLineDistAtMetricBox);
+						}
+						else
+						{
+							pActLineDistFld = &(aLineDistAtPercentBox);
+							pActLineDistFld->Disable();
+							pActLineDistFld->Hide();
+							pActLineDistFld = &(aLineDistAtMetricBox);
+						}
+						pActLineDistFld->Enable();
+						pActLineDistFld->Show();
+						maLineSpacing.SetNoSelection();
+                                          maLineSpacing.SelectItem(0);
+
+						SetMetricValue( aLineDistAtMetricBox,
+							currSPItem->GetInterLineSpace(), eUnit );
+						aLineDist.SelectEntryPos( LLINESPACE_DURCH );
+
+						mbUseLineSPCustom = USE_CUSTOM;
+					}
+					break;
+				}
+			}
+			break;
+		case SVX_LINE_SPACE_FIX:
+			{
+				if(pActLineDistFld != &(aLineDistAtMetricBox))
+				{
+					pActLineDistFld->Disable();
+					pActLineDistFld->Hide();
+					pActLineDistFld = &(aLineDistAtMetricBox);
+				}
+				else
+				{
+					pActLineDistFld = &(aLineDistAtPercentBox);
+					pActLineDistFld->Disable();
+					pActLineDistFld->Hide();
+					pActLineDistFld = &(aLineDistAtMetricBox);
+				}
+				pActLineDistFld->Enable();
+				pActLineDistFld->Show();
+				maLineSpacing.SetNoSelection();
+                            maLineSpacing.SelectItem(0);
+
+				SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
+				aLineDist.SelectEntryPos( LLINESPACE_FIX );
+
+				mbUseLineSPCustom = USE_CUSTOM;
+			}
+			break;
+
+		case SVX_LINE_SPACE_MIN:
+			{
+				if(pActLineDistFld != &(aLineDistAtMetricBox))
+				{
+					pActLineDistFld->Disable();
+					pActLineDistFld->Hide();
+					pActLineDistFld = &(aLineDistAtMetricBox);
+				}
+				else
+				{
+					pActLineDistFld = &(aLineDistAtPercentBox);
+					pActLineDistFld->Disable();
+					pActLineDistFld->Hide();
+					pActLineDistFld = &(aLineDistAtMetricBox);
+				}
+				pActLineDistFld->Enable();
+				pActLineDistFld->Show();
+				maLineSpacing.SetNoSelection();
+                            maLineSpacing.SelectItem(0);
+
+				SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
+				aLineDist.SelectEntryPos( LLINESPACE_MIN );
+				mbUseLineSPCustom = USE_CUSTOM;
+			}
+			break;
+		}
+	}
+	else if( eState == SFX_ITEM_DISABLED )
+	{
+		aLineDist.Disable();
+		pActLineDistFld->Enable(sal_False);
+		pActLineDistFld->SetText( String() );
+		maLineSpacing.SetNoSelection();
+              maLineSpacing.SelectItem(0);
+	
+	    mbUseLineSPCustom = DO_NOT_CUSTOM;
+	}
+	else
+	{
+		pActLineDistFld->Enable(sal_False);
+		pActLineDistFld->SetText( String() );
+		aLineDist.SetNoSelection();
+		maLineSpacing.SetNoSelection();
+              maLineSpacing.SelectItem(0);
+		mbUseLineSPCustom = DO_NOT_CUSTOM;		
+	}
+
+	aLineDist.SaveValue();
+
+	/*sal_uInt16 nID = pBox->GetCurItemId();
+	pBox->SetItemDown(nID, sal_True);
+
+	Size aFloatSz = GetOutputSizePixel();
+
+	GetLineSPFloatWin()->SetSizePixel( aFloatSz );
+
+	Point aPos=maLineSPTbx->GetPosPixel();
+	aPos.setX(aPos.getX());
+	aPos = OutputToScreenPixel( aPos );
+	Size aSize = maLineSPTbx->GetSizePixel();
+	Rectangle aRect( aPos, aSize );
+
+	GetLineSPFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE);
+	GetLineSPFloatWin()->SetPopupModeFlags(GetLineSPFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
+
+	pLineSPPage->ToGetFocus(bValueSetFocus);
+	*/
+	sal_uInt16 uCount = aLineDist.GetEntryCount();
+	if( uCount == LLINESPACE_FIX + 1 )
+	{
+		switch (currentContext.GetCombinedContext())
+		{
+			case CombinedEnumContext(Application_Impress, Context_Table):
+        		case CombinedEnumContext(Application_Draw, Context_Table):
+			case CombinedEnumContext(Application_Writer, Context_DrawText):
+			case CombinedEnumContext(Application_Calc, Context_DrawText):
+			case CombinedEnumContext(Application_Draw, Context_DrawText):
+        		case CombinedEnumContext(Application_Impress, Context_DrawText):
+			case CombinedEnumContext(Application_Writer, Context_Annotation):
+			case CombinedEnumContext(Application_Draw, Context_Draw):
+		        case CombinedEnumContext(Application_Draw, Context_TextObject):
+		        case CombinedEnumContext(Application_Draw, Context_Graphic):
+		        case CombinedEnumContext(Application_Impress, Context_Draw):
+		        case CombinedEnumContext(Application_Impress, Context_TextObject):
+		        case CombinedEnumContext(Application_Impress, Context_Graphic):
+			{
+				aLineDist.RemoveEntry(LLINESPACE_FIX);
+			}
+		}
+	}
+	else if( uCount == LLINESPACE_FIX)
+	{
+		switch (currentContext.GetCombinedContext())
+		{
+			case CombinedEnumContext(Application_Writer, Context_Default):
+			case CombinedEnumContext(Application_Writer, Context_Text):
+			case CombinedEnumContext(Application_Writer, Context_Table):
+			{
+				aLineDist.InsertEntry(String::CreateFromAscii("Fixed"), LLINESPACE_FIX);
+			}
+		}
+	}
+	maLineSpacing.Format();
+	maLineSpacing.StartSelection();
+}
+
+void ParaLineSpacingControl::SetAllNoSel()
+{
+	maLineSpacing.SelectItem(1);
+	maLineSpacing.SetNoSelection();
+}
+
+IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox )
+{
+	maLineSpacing.SetNoSelection();
+       maLineSpacing.SelectItem(0);
+	maLineSpacing.Format();
+	maLineSpacing.StartSelection();
+
+	switch( pBox->GetSelectEntryPos() )
+	{
+		case LLINESPACE_1:
+		case LLINESPACE_15:
+		case LLINESPACE_2:
+			pActLineDistFld->Enable(sal_False);
+			pActLineDistFld->SetText( String() );
+			break;
+
+		case LLINESPACE_DURCH:
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld = &aLineDistAtMetricBox;
+			aLineDistAtMetricBox.SetMin(0);
+
+
+			if ( !aLineDistAtMetricBox.GetText().Len() )
+				aLineDistAtMetricBox.SetValue(
+					aLineDistAtMetricBox.Normalize( 0 ) );
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld->Show();
+			pActLineDistFld->Enable();
+			break;
+
+		case LLINESPACE_MIN:
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld = &aLineDistAtMetricBox;
+			aLineDistAtMetricBox.SetMin(0);
+
+			if ( !aLineDistAtMetricBox.GetText().Len() )
+				aLineDistAtMetricBox.SetValue(
+					aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP );
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld->Show();
+			pActLineDistFld->Enable();
+			break;
+
+		case LLINESPACE_PROP:
+			aLineDistAtMetricBox.Hide();
+			pActLineDistFld = &aLineDistAtPercentBox;
+
+			if ( !aLineDistAtPercentBox.GetText().Len() )
+				aLineDistAtPercentBox.SetValue(
+					aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
+			aLineDistAtMetricBox.Hide();
+			pActLineDistFld->Show();
+			pActLineDistFld->Enable();
+			break;
+		case LLINESPACE_FIX:
+		{
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld = &aLineDistAtMetricBox;
+			sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
+			aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
+
+			if ( aLineDistAtMetricBox.GetValue() != nTemp )
+				SetMetricValue( aLineDistAtMetricBox,
+									FIX_DIST_DEF, SFX_MAPUNIT_TWIP );
+			aLineDistAtPercentBox.Hide();
+			pActLineDistFld->Show();
+			pActLineDistFld->Enable();
+		}
+		break;
+	}
+	ExecuteLineSpace();
+	return 0;
+}
+
+IMPL_LINK( ParaLineSpacingControl, LineSPDistAtHdl_Impl, MetricField*, pBox )
+{
+	ExecuteLineSpace();
+	return (0L);
+}
+
+void ParaLineSpacingControl::ExecuteLineSpace()
+{		
+	aLineDist.SaveValue();
+	maLineSpacing.SetNoSelection();
+
+	SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+	sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
+
+	switch ( nPos )
+	{
+		case LLINESPACE_1:
+		case LLINESPACE_15:
+		case LLINESPACE_2:
+			{
+				SetLineSpace( aSpacing, nPos );
+				maPos = nPos;
+			}
+			break;
+
+		case LLINESPACE_PROP:
+			{
+				SetLineSpace( aSpacing, nPos,
+					aLineDistAtPercentBox.Denormalize(
+					(long)aLineDistAtPercentBox.GetValue() ) );
+				maPos = nPos;
+				maValue =aLineDistAtPercentBox.GetValue();
+			}
+			break;
+
+		case LLINESPACE_MIN:
+		case LLINESPACE_DURCH:
+		case LLINESPACE_FIX:
+			{
+				SetLineSpace( aSpacing, nPos,
+					GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) );
+				maPos = nPos;
+				maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit );
+			}
+		break;
+
+		default:
+			DBG_ERROR( "error!!" );
+			break;
+	}
+
+	mpBindings->GetDispatcher()->Execute(
+			SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+
+	mbUseLineSPCustom = USE_CUSTOM;
+}
+
+void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace,
+						int eSpace, long lValue )
+{
+	switch ( eSpace )
+	{
+		case LLINESPACE_1:
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+			rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+			break;
+
+		case LLINESPACE_15:
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+			rLineSpace.SetPropLineSpace( LINESPACE_15 );
+			break;
+
+		case LLINESPACE_2:
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+			rLineSpace.SetPropLineSpace( LINESPACE_2 );
+			break;
+
+		case LLINESPACE_PROP:
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+			rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
+			break;
+
+		case LLINESPACE_MIN:
+			rLineSpace.SetLineHeight( (sal_uInt16)lValue );
+			rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+			break;
+
+		case LLINESPACE_DURCH:
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+			rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
+			break;
+
+		case LLINESPACE_FIX:
+			rLineSpace.SetLineHeight((sal_uInt16)lValue);
+			rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
+			rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+		break;
+	}
+}
+
+IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl)
+{
+	maLineSpacing.SetNoSelection();
+	bool bClosePop = true;
+	if(pControl == &maLineSpacing)  
+	{		
+		sal_uInt16 iPos = maLineSpacing.GetSelectItemId();
+		short nKern = 0;
+		long nVal = 0;
+		switch ( iPos )
+		{
+			case 1:
+				ExecuteLineSpacing( 0, 0 );
+				break;
+			case 2:
+				ExecuteLineSpacing( 0, 3 );
+				break;
+			case 3:
+				ExecuteLineSpacing( 0, 1 );
+				break;
+			case 4:
+				ExecuteLineSpacing( 0, 2 );
+				break;
+			case 5:
+				{
+					if(!(mbLineSPDisable))
+					{
+						//maPos = mrParaPropertyPanel.maLinePos;
+						aLineDist.SelectEntryPos( maPos ) ;
+						aLineDist.SaveValue();
+						//maValue = mrParaPropertyPanel.maLineValue;
+
+						SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+						switch(maPos)
+						{
+						case LLINESPACE_1:
+						case LLINESPACE_15:
+						case LLINESPACE_2:
+							SetLineSpace( aSpacing, maPos );
+							break;
+
+						case LLINESPACE_PROP:
+							SetLineSpace( aSpacing, maPos,
+								aLineDistAtPercentBox.Denormalize( (long)maValue ) );
+							break;
+
+						case LLINESPACE_MIN:
+						case LLINESPACE_DURCH:
+						case LLINESPACE_FIX:
+							SetLineSpace( aSpacing, maPos, (long)maValue );
+							break;
+						}
+
+						mpBindings->GetDispatcher()->Execute(
+							SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+
+						ExecuteLineSpacing( USE_CUSTOM, 0 );
+					}
+					else
+						bClosePop = sal_False;
+				}
+				break;
+		}	
+	}
+	if(bClosePop)
+		mrParaPropertyPanel.EndSpacingPopupMode();
+	return 0;
+}
+
+void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry )
+{
+	if( !aIsCustom )
+	{
+		aLineDist.SelectEntryPos( aEntry ) ;
+		aLineDist.SaveValue();
+		SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+		sal_uInt16 nPos = aEntry;
+		if( aEntry == LLINESPACE_PROP )
+			SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) );
+		else
+			SetLineSpace( aSpacing, nPos );
+
+		mpBindings->GetDispatcher()->Execute(
+			SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+	}
+
+	if( !aIsCustom )
+	{
+		mbUseLineSPCustom = DO_NOT_CUSTOM;
+		mrParaPropertyPanel.EndSpacingPopupMode();
+	}
+	maLineSpacing.SetNoSelection();
+}
+
+}} // end of namespace sidebar
+
diff --git a/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
new file mode 100755
index 0000000..bfb5369
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
@@ -0,0 +1,116 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_
+#define _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "ParaPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+
+namespace svx { namespace sidebar {
+
+#define LSP_POS_GLOBAL_VALUE	String("Line_Spacing_Pos", 16, RTL_TEXTENCODING_ASCII_US)
+#define LSP_LV_GLOBAL_VALUE	    String("Line_Spacing_Lv", 15, RTL_TEXTENCODING_ASCII_US)
+#define BEGIN_VALUE            28
+class ParaLineSpacingControl:public svx::sidebar::PopupControl
+{
+public:
+	ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel);
+	~ParaLineSpacingControl();
+	void ToGetFocus(bool bType);
+	void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext);
+	//virtual void Paint(const Rectangle& rect);
+	
+	//add 
+	short GetLastCustomState();
+	long  GetLastCustomValue();
+	//add end
+
+	void ExecuteLineSpace();
+	void SetLineSpace( SvxLineSpacingItem& rLineSpace,
+						int eSpace, long lValue = 0 );
+
+	void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry );
+	void SetAllNoSel();
+	void PopupModeEndCallback();
+
+private:	
+	bool					mbUseLineSPCustom;
+	bool					mbLineSPDisable;
+	SfxMapUnit                      m_eLNSpaceUnit;
+	ParaPropertyPanel&     mrParaPropertyPanel;
+	SfxBindings*		mpBindings;
+
+	long 							nMinFixDist;
+	Edit*							pActLineDistFld;
+
+	ValueSetWithTextControl	maLineSpacing;
+
+	FixedText maCustomFT;	
+	FixedText maLSpacingFT;
+	ListBox					        aLineDist;
+	
+	FixedText maOfFT;
+	MetricField			        	aLineDistAtPercentBox;
+	MetricField	        			aLineDistAtMetricBox;
+
+	Image  maSpacing1;
+	Image  maSpacing115;
+	Image  maSpacing15;
+	Image  maSpacing2;
+	Image  maLPCustom;
+
+	Image  maSelSpacing1;
+	Image  maSelSpacing115;
+	Image  maSelSpacing15;
+	Image  maSelSpacing2;
+	Image  maSelSelHanging;
+	Image				maImgCus;
+	Image				maImgCusGrey;
+	XubString			maStrCus;
+
+	Image*				mpImg;
+	Image*				mpImgSel;
+	XubString*			mpStr;
+	XubString*			mpStrTip;
+	String				maLine;
+	String				maOf;
+
+	sal_Int64             maValue;
+	sal_uInt16                maPos;
+private:	
+	void initial();
+	DECL_LINK(LineSPDistHdl_Impl, ListBox*);
+	DECL_LINK(LineSPDistAtHdl_Impl, MetricField*);
+	DECL_LINK(VSSelHdl, void*);
+};
+}}
+
+#endif
+
diff --git a/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
new file mode 100755
index 0000000..4b46037
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
@@ -0,0 +1,82 @@
+/**************************************************************
+ * 
+ * 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 "ParaLineSpacingPopup.hxx"
+#include "ParaLineSpacingControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+ParaLineSpacingPopup::ParaLineSpacingPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Line Spacing")))
+{
+	SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this));
+}
+
+
+
+
+ParaLineSpacingPopup::~ParaLineSpacingPopup (void)
+{
+}
+
+
+
+
+void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
+{
+    ProvideContainerAndControl();
+
+    ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext);	
+}
+
+void ParaLineSpacingPopup::PopupModeEndCallback (void)
+{
+	ProvideContainerAndControl();
+	ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get());
+	if (pControl == NULL)
+		return;
+
+	pControl->PopupModeEndCallback();
+	
+	/*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
+	{
+		SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); 
+		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() ));
+		aWinOpt.SetUserData( aSeq );
+
+	}*/
+}
+
+
+} } // end of namespace svx::sidebar
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx b/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx
new file mode 100755
index 0000000..99b17f5
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_
+#define _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+namespace svx { namespace sidebar {
+
+class ParaLineSpacingPopup
+    : public Popup
+{
+public :
+    ParaLineSpacingPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~ParaLineSpacingPopup (void);
+
+    void Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem ,const ::sfx2::sidebar::EnumContext currentContext);
+private:
+    void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaNumberingControl.cxx b/main/svx/source/sidebar/paragraph/ParaNumberingControl.cxx
new file mode 100755
index 0000000..0cb8887
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaNumberingControl.cxx
@@ -0,0 +1,171 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include "ParaNumberingControl.hxx"
+#include "ParaPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <svtools/unitconv.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingFormatter.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svx/nbdtmg.hxx>
+#include <svx/nbdtmgfact.hxx>
+#include <editeng/unolingu.hxx>
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::text;
+
+namespace svx { namespace sidebar {
+
+Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
+{
+	Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+	Reference < XInterface > xI = xMSF->createInstance(
+		::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
+	Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY);
+//	DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"")
+
+	return xRet;
+}
+
+ParaNumberingControl::ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel):
+	PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_NUMBERING)),
+	maNumberVS(this,SVX_RES(VS_NUMBERING)),
+	maFISep(this,SVX_RES(IMG_SEPERATOR_NUMBERING)),
+	maMoreButton(this,SVX_RES(CB_NUMBERING_MORE) ),	
+	mrParaPropertyPanel(rPanel),
+	mpBindings(NULL)	
+{
+	FreeResource();
+	mpBindings = mrParaPropertyPanel.GetBindings();
+	
+	maNumberVS.SetStyle(maNumberVS.GetStyle() | WB_NO_DIRECTSELECT);
+	maNumberVS.SetExtraSpacing(NUM_IMAGE_SPACING);
+	//add by wj for sym2_7246 high contrast
+	if(GetSettings().GetStyleSettings().GetHighContrastMode())
+		maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	else
+		maNumberVS.SetBackground(Color(244,245,249));
+
+	maNumberVS.SetItemWidth(NUM_IMAGE_WIDTH);
+	maNumberVS.SetItemHeight(NUM_IMAGE_HEIGHT);
+
+	Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
+	if(xDefNum.is())
+	{
+		Sequence< Sequence< PropertyValue > > aNumberings;
+        LanguageType eLang = GetSettings().GetLanguage();
+		Locale aLocale = SvxCreateLocale(eLang);
+		try
+		{
+			aNumberings =
+				xDefNum->getDefaultContinuousNumberingLevels( aLocale );
+		}
+		catch(Exception&)
+		{
+		}
+		Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
+		maNumberVS.SetNumberingSettings(aNumberings, xFormat, aLocale);
+	}   
+    
+    maNumberVS.Show();
+	maNumberVS.SetSelectHdl(LINK(this, ParaNumberingControl, NumSelectHdl_Impl));
+
+	/*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contract
+	maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 )
+	maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 )
+	maMoreButton.SetIcoPosX( 2);*/
+	maNumberVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+
+	maMoreButton.SetClickHdl(LINK(this, ParaNumberingControl, MoreButtonClickHdl_Impl));
+
+}
+
+ParaNumberingControl::~ParaNumberingControl()
+{	
+}
+
+
+IMPL_LINK(ParaNumberingControl, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
+{
+	sal_uInt16 nIdx = maNumberVS.GetSelectItemId();
+	SfxUInt16Item aItem(FN_SVX_SET_NUMBER, nIdx);
+	if (mpBindings)
+		mpBindings->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L );
+
+	mrParaPropertyPanel.EndNumberingPopupMode();
+	
+	return 0;
+}
+
+IMPL_LINK(ParaNumberingControl, MoreButtonClickHdl_Impl, void*, EMPTYARG)
+{
+	if (mpBindings)
+		mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON );
+
+	mrParaPropertyPanel.EndNumberingPopupMode();
+
+	return 0;
+}
+
+void ParaNumberingControl::UpdateValueSet()
+{
+	maNumberVS.StateChanged(STATE_CHANGE_STYLE);
+	maNumberVS.StateChanged(STATE_CHANGE_INITSHOW);
+}
+
+void ParaNumberingControl::ToGetFocus()
+{
+	sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetNumTypeIndex();
+	if ( nTypeIndex != (sal_uInt16)0xFFFF )
+		maNumberVS.SelectItem( nTypeIndex );
+	else
+	{
+		maNumberVS.SelectItem(0);
+	}	
+	maMoreButton.GrabFocus();
+}
+
+}} // end of namespace sidebar
+
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaNumberingControl.hxx b/main/svx/source/sidebar/paragraph/ParaNumberingControl.hxx
new file mode 100755
index 0000000..5edbec0
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaNumberingControl.hxx
@@ -0,0 +1,65 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_
+#define _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_
+
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "ParaPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/button.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+class ParaNumberingControl:public svx::sidebar::PopupControl
+{
+private:
+	SvxNumValueSet2				maNumberVS;
+	FixedImage					maFISep;
+	PushButton maMoreButton;	
+	ParaPropertyPanel&     mrParaPropertyPanel;
+	SfxBindings*		mpBindings;
+	
+	DECL_LINK(NumSelectHdl_Impl, ValueSet*);
+	DECL_LINK(MoreButtonClickHdl_Impl, void*);
+
+public:
+	ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel);
+	~ParaNumberingControl();
+	void ToGetFocus();
+	void UpdateValueSet();
+	
+};
+
+
+}}
+
+#endif
+
diff --git a/main/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx b/main/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx
new file mode 100755
index 0000000..013d138
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx
@@ -0,0 +1,64 @@
+/**************************************************************
+ * 
+ * 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 "ParaNumberingPopup.hxx"
+#include "ParaNumberingControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+ParaNumberingPopup::ParaNumberingPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Numbering")))
+{
+}
+
+
+
+
+ParaNumberingPopup::~ParaNumberingPopup (void)
+{
+}
+
+
+
+
+void ParaNumberingPopup::UpdateValueSet ()
+{
+    ProvideContainerAndControl();
+
+    ParaNumberingControl* pControl = dynamic_cast<ParaNumberingControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->UpdateValueSet();	
+}
+
+
+
+} } // end of namespace svx::sidebar
+
+
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx b/main/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx
new file mode 100755
index 0000000..d7ff2ea
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_NUMBERING_POPUP_HXX_
+#define _SVX_SIDEBAR_NUMBERING_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+namespace svx { namespace sidebar {
+
+class ParaNumberingPopup
+    : public Popup
+{
+public :
+    ParaNumberingPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~ParaNumberingPopup (void);
+
+    void UpdateValueSet ();
+//private:
+    //void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+
+
+
diff --git a/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
new file mode 100755
index 0000000..d03ce9f
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -0,0 +1,1686 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include <svx/sidebar/ColorControl.hxx>
+
+#include "ParaPropertyPanel.hxx"
+#include "ParaPropertyPanel.hrc"
+
+#include "ParaLineSpacingPopup.hxx"
+#include "ParaLineSpacingControl.hxx"
+#include "ParaBulletsPopup.hxx"
+#include "ParaBulletsControl.hxx"
+#include "ParaNumberingPopup.hxx"
+#include "ParaNumberingControl.hxx"
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <svx/sidebar/PopupContainer.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svxids.hrc>
+#include <svl/intitem.hxx>
+#include "svx/dialmgr.hxx"
+#include <sfx2/objsh.hxx>
+#include <svtools/unitconv.hxx>
+#include <boost/bind.hpp>
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+using ::sfx2::sidebar::ControlFactory;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+
+namespace svx {namespace sidebar {
+#define DEFAULT_VALUE          0
+#define TOOLBOX_ITEM1          1
+#define TOOLBOX_ITEM2          2
+#define TOOLBOX_ITEM3          3
+#define TOOLBOX_ITEM4          4
+
+#define MAX_DURCH             5670
+
+#define INDENT_INCREMENT       1
+#define INDENT_DECREMENT       2
+#define INDENT_STEP            706
+#define UL_STEP                58
+#define UL_INCREMENT           1
+#define UL_DECREMENT           2
+
+#define NEGATIVE_MAX_VALUE              -9999
+#define BEGIN_VALUE            28
+#define MAX_SW                  1709400
+#define MAX_SC_SD				116220200
+#define NEGA_MAXVALUE          -10000000
+
+#define POS_FT_PARA_SPACE								Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT))
+#define POS_FT_PARA_SPACE2								Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT))
+#define POS_TBX_PARA_SPACE_INC_DEC						Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT))
+#define POS_TBX_PARA_SPACE_INC_DEC2						Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT))
+#define POS_FT_PARA_INDENT								Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT))
+#define POS_FT_PARA_INDENT2								Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT))
+#define POS_TBX_PARA_INDENT_INC_DEC						Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT))
+#define POS_TBX_PARA_INDENT_INC_DEC2					Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT))
+#define POS_MBX_TOP_DIST								Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT))
+#define POS_MBX_TOP_DIST2								Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT))
+#define POS_MBX_BOT_DIST								Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT))
+#define POS_MBX_BOT_DIST2								Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT))
+#define POS_MBX_LEFT_DIST								Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT))
+#define POS_MBX_LEFT_DIST2								Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT))
+#define POS_MBX_RIGHT_DIST								Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT))
+#define POS_MBX_RIGHT_DIST2								Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT))
+#define POS_MBX_FLINE_DIST								Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT))
+#define POS_MBX_FLINE_DIST2								Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT))
+#define POS_IMG_SPACE1									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT))
+#define POS_IMG_SPACE12									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT))
+#define POS_IMG_SPACE2									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT))
+#define POS_IMG_SPACE22									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT))
+#define POS_IMG_INDENT1									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT))
+#define POS_IMG_INDENT12								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT))
+#define POS_IMG_INDENT2									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT))
+#define POS_IMG_INDENT22								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT))
+#define POS_IMG_INDENT3									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT))
+#define POS_IMG_INDENT32								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT))
+#define TBX_LINE_SPACE									Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT))
+#define TBX_LINE_SPACE2									Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT))
+
+#define LINE_POINT1_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT))
+#define LINE_POINT2_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT))
+#define LINE_POINT3_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT))
+#define LINE_POINT4_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT))
+
+ParaPropertyPanel* ParaPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2);
+    
+    return new ParaPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings,
+        rxSidebar);
+}
+
+void ParaPropertyPanel::HandleContextChange (
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if (maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+    switch (maContext.GetCombinedContext_DI())
+    {
+        case CombinedEnumContext(Application_Calc, Context_DrawText):
+            maTBxVertAlign->Show();
+            maTBxVertAlignBackground->Show();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Hide();
+            maTBxNumBulletBackground->Hide();
+            ReSize(false);
+            maTbxIndent_IncDec->Show();
+            maTbxIndent_IncDecBackground->Show();
+            maTbxProDemote->Hide();
+            maTbxProDemoteBackground->Hide();
+            break;
+
+        case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+        case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
+            maTBxVertAlign->Hide();
+		    maTBxVertAlignBackground->Hide();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Show();
+            maTBxNumBulletBackground->Show();
+            ReSize(true);
+            maTbxIndent_IncDec->Hide();
+            maTbxIndent_IncDecBackground->Hide();
+            maTbxProDemote->Show();
+            maTbxProDemoteBackground->Show();
+            break;
+            
+        case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
+            maTBxVertAlign->Show();
+            maTBxVertAlignBackground->Show();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Show();
+            maTBxNumBulletBackground->Show();
+            ReSize(true);
+            maTbxIndent_IncDec->Hide();
+            maTbxIndent_IncDecBackground->Hide();
+            maTbxProDemote->Show();
+            maTbxProDemoteBackground->Show();
+            break;
+            
+        case CombinedEnumContext(Application_DrawImpress, Context_Table):
+            maTBxVertAlign->Show();
+            maTBxVertAlignBackground->Show();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Show();
+            maTBxNumBulletBackground->Show();
+            ReSize(true);
+            maTbxIndent_IncDec->Hide();
+            maTbxIndent_IncDecBackground->Hide();
+            maTbxProDemote->Show();
+            maTbxProDemoteBackground->Show();
+            break;
+
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Default):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Text):
+            maTBxVertAlign->Hide();
+            maTBxVertAlignBackground->Hide();
+            maTBxBackColor->Show();
+            maTBxBackColorBackground->Show();
+            maTBxNumBullet->Show();
+		
+            maTBxNumBulletBackground->Show();
+            ReSize(true);
+            maTbxIndent_IncDec->Show();
+            maTbxIndent_IncDecBackground->Show();
+            maTbxProDemote->Hide();
+            maTbxProDemoteBackground->Hide();
+            break;
+            
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Table):
+            maTBxVertAlign->Show();
+            maTBxVertAlignBackground->Show();
+            maTBxBackColor->Show();
+            maTBxBackColorBackground->Show();
+            maTBxNumBullet->Show();
+            maTBxNumBulletBackground->Show();
+            ReSize(true);
+            maTbxIndent_IncDec->Show();
+            maTbxIndent_IncDecBackground->Show();
+            maTbxProDemote->Hide();
+            maTbxProDemoteBackground->Hide();
+            break;
+            
+        case CombinedEnumContext(Application_WriterAndWeb, Context_DrawText):
+            maTBxVertAlign->Show();
+            maTBxVertAlignBackground->Show();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Hide();
+            maTBxNumBulletBackground->Hide();
+            ReSize(false);
+            maTbxIndent_IncDec->Show();
+            maTbxIndent_IncDecBackground->Show();
+            maTbxProDemote->Hide();
+            maTbxProDemoteBackground->Hide();
+            break;
+
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Annotation):
+            maTBxVertAlign->Hide();
+            maTBxVertAlignBackground->Hide();
+            maTBxBackColor->Hide();
+            maTBxBackColorBackground->Hide();
+            maTBxNumBullet->Hide();
+            maTBxNumBulletBackground->Hide();
+            ReSize(false);
+            maTbxIndent_IncDec->Show();
+            maTbxIndent_IncDecBackground->Show();
+            maTbxProDemote->Hide();
+            maTbxProDemoteBackground->Hide();
+            break;
+
+        case CombinedEnumContext(Application_Calc, Context_EditCell):
+        case CombinedEnumContext(Application_Calc, Context_Cell):
+        case CombinedEnumContext(Application_Calc, Context_Pivot):
+        case CombinedEnumContext(Application_DrawImpress, Context_Text):
+        case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
+        /*{
+            mpToolBoxScriptSw->Hide();
+            mpToolBoxScript->Show();
+            mpToolBoxSpacing->Show();
+            mpToolBoxHighlight->Hide();
+
+            Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
+            aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); 
+            aSize.setWidth(GetOutputSizePixel().Width());
+            SetSizePixel(aSize);
+        }*/
+            break;
+
+        default:
+            break;
+    }
+}
+
+SfxBindings* ParaPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+void ParaPropertyPanel::SetupIcons (void)
+{
+    if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+    }
+    else
+    {
+    }
+}
+
+void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+ParaPropertyPanel::~ParaPropertyPanel()
+{
+	delete mpLnSPItem;
+}
+
+void ParaPropertyPanel::ReSize(bool bSize)
+{
+	if(bSize)
+	{
+		//Paragraph spacing
+		maFTUL->SetPosPixel(POS_FT_PARA_SPACE);
+		maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC);
+		maTopDist->SetPosPixel(POS_MBX_TOP_DIST);
+		maBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
+		//Indent
+		maFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
+		maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
+		maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
+		maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
+		maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
+		maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST);
+		//Line spacing
+		maLineSPTbx->SetPosPixel(TBX_LINE_SPACE);
+		//image
+		maFISpace1.SetPosPixel(POS_IMG_SPACE1);
+		maFISpace2.SetPosPixel(POS_IMG_SPACE2);
+		maFIndent1.SetPosPixel(POS_IMG_INDENT1);
+		maFIndent2.SetPosPixel(POS_IMG_INDENT2);
+		maFIndent3.SetPosPixel(POS_IMG_INDENT3);
+		Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT);
+		aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+		aSize.setWidth(GetOutputSizePixel().Width());
+		SetSizePixel(aSize);
+	}
+	else
+	{
+		//Paragraph spacing
+		maFTUL->SetPosPixel(POS_FT_PARA_SPACE2);
+		maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2);
+		maTopDist->SetPosPixel(POS_MBX_TOP_DIST2);
+		maBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
+		//Indent
+		maFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
+		maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
+		maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
+		maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
+		maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
+		maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2);
+		//Line spacing
+		maLineSPTbx->SetPosPixel(TBX_LINE_SPACE2);
+		//image
+		maFISpace1.SetPosPixel(POS_IMG_SPACE12);
+		maFISpace2.SetPosPixel(POS_IMG_SPACE22);
+		maFIndent1.SetPosPixel(POS_IMG_INDENT12);
+		maFIndent2.SetPosPixel(POS_IMG_INDENT22);
+		maFIndent3.SetPosPixel(POS_IMG_INDENT32);
+		Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2);
+		aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+		aSize.setWidth(GetOutputSizePixel().Width());
+		SetSizePixel(aSize);
+	}
+
+    if (mxSidebar.is())
+        mxSidebar->requestLayout();
+}
+
+void ParaPropertyPanel::EndSpacingPopupMode (void)
+{
+    maLineSpacePopup.Hide();
+}
+
+void ParaPropertyPanel::EndBulletsPopupMode (void)
+{
+	//maUnderlinePopup.Hide();
+}
+
+void ParaPropertyPanel::EndNumberingPopupMode (void)
+{
+	//maUnderlinePopup.Hide();
+}
+
+
+void ParaPropertyPanel::InitToolBoxAlign()
+{
+	maAlignToolBox->SetItemImage(TOOLBOX_ITEM1,maLeftPara);
+	maAlignToolBox->SetItemImage(TOOLBOX_ITEM2,maCentPara);
+	maAlignToolBox->SetItemImage(TOOLBOX_ITEM3,maRightPara);
+	maAlignToolBox->SetItemImage(TOOLBOX_ITEM4,maJusPara);
+	Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
+	maAlignToolBox->SetSelectHdl( aLink );
+	Size aTbxSize (maAlignToolBox->CalcWindowSizePixel());
+	maAlignToolBox->SetOutputSizePixel( aTbxSize );
+}
+
+void ParaPropertyPanel::InitToolBoxVertAlign()
+{
+	InitImageList(maTBxVertAlign, maVertImageList, maVertImageListH);
+	maTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
+	Size aTbxSize (maTBxVertAlign->CalcWindowSizePixel());
+	maTBxVertAlign->SetOutputSizePixel( aTbxSize );
+}
+
+
+void ParaPropertyPanel::InitToolBoxIndent()
+{
+	Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
+	maLeftIndent->SetModifyHdl( aLink );
+	maRightIndent->SetModifyHdl( aLink );
+	maFLineIndent->SetModifyHdl( aLink );
+
+	if( Application::GetSettings().GetLayoutRTL())
+	{
+		maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD);
+		maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD);
+	}
+	else
+	{
+		maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc);
+		maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec);
+	}
+	maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang);
+	aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
+	maTbxIndent_IncDec->SetSelectHdl(aLink);    
+	m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
+	Size aTbxSize = maTbxIndent_IncDec->CalcWindowSizePixel();
+	maTbxIndent_IncDec->SetOutputSizePixel( aTbxSize );
+	
+	if( Application::GetSettings().GetLayoutRTL())
+	{
+		maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD);
+		maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD);
+	}
+	else
+	{
+		maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc);
+		maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec);
+	}
+	maTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang);
+	aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
+	maTbxProDemote->SetSelectHdl(aLink);    
+	m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
+	aTbxSize = maTbxProDemote->CalcWindowSizePixel();
+	maTbxProDemote->SetOutputSizePixel( aTbxSize );
+}
+
+void ParaPropertyPanel::InitToolBoxBGColor()
+{
+	mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, maTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ));
+
+	maTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
+	maTBxBackColor->SetItemBits( TBI_BACK_COLOR, maTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY );
+
+	Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
+	maTBxBackColor->SetDropdownClickHdl ( aLink );
+	maTBxBackColor->SetSelectHdl ( aLink );
+	Size aTbxSize (maTBxBackColor->CalcWindowSizePixel());
+	maTBxBackColor->SetOutputSizePixel( aTbxSize );
+}
+
+void ParaPropertyPanel::InitToolBoxBulletsNumbering()
+{
+	if( Application::GetSettings().GetLayoutRTL())
+	{
+		maTBxNumBullet->SetItemImage( IID_BULLET, maNumBImageListRTL.GetImage( IID_BULLET ) );
+		maTBxNumBullet->SetItemImage( IID_NUMBER, maNumBImageListRTL.GetImage( IID_NUMBER ) );
+	}
+	else
+		InitImageList(maTBxNumBullet, maNumBImageList, maNumBImageListH);
+
+	maTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
+	maTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
+	Size aTbxSize (maTBxNumBullet->CalcWindowSizePixel());
+	maTBxNumBullet->SetOutputSizePixel( aTbxSize );
+}
+void ParaPropertyPanel::InitToolBoxSpacing()
+{
+	Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
+	maTopDist->SetModifyHdl(aLink);
+	maBottomDist->SetModifyHdl( aLink );
+
+	maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM1,maParInc);
+	maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM2,maParDec);
+	aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
+	maTbxUL_IncDec->SetSelectHdl(aLink);
+	m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
+	Size aTbxSize = maTbxUL_IncDec->CalcWindowSizePixel();
+	maTbxUL_IncDec->SetOutputSizePixel( aTbxSize );
+}
+void ParaPropertyPanel::InitToolBoxLineSpacing()
+{
+	Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
+	maLineSPTbx->SetDropdownClickHdl( aLink );
+	maLineSPTbx->SetSelectHdl( aLink );		//support keyinput "ENTER"
+	maLineSPTbx->SetItemBits( TOOLBOX_ITEM1, maLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY );
+	maLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3);
+	Size aTbxSize = maLineSPTbx->CalcWindowSizePixel();
+	maLineSPTbx->SetOutputSizePixel( aTbxSize );
+}
+
+void ParaPropertyPanel::initial()
+{
+    maFTUL->SetBackground(Wallpaper());
+    maFTIndent->SetBackground(Wallpaper());
+    maFISpace1.SetBackground(Wallpaper());
+    maFISpace2.SetBackground(Wallpaper());
+    maFIndent1.SetBackground(Wallpaper());
+    maFIndent2.SetBackground(Wallpaper());
+    maFIndent3.SetBackground(Wallpaper());
+
+    maFISpace1.SetImage(maSpace1);
+	maFISpace2.SetImage(maSpace2);
+	maFIndent1.SetImage(maIndent3);
+	maFIndent2.SetImage(maIndent2);
+	maFIndent3.SetImage(maIndent1);
+
+	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
+	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
+	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
+	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
+
+	//toolbox
+	SetupIcons();
+	InitToolBoxAlign();
+	InitToolBoxVertAlign();
+	InitToolBoxIndent();
+	InitToolBoxBGColor();
+	InitToolBoxBulletsNumbering();
+	InitToolBoxSpacing();
+	InitToolBoxLineSpacing();
+
+#ifdef HAS_IA2
+	maAlignToolBox->SetAccRelationLabeledBy(&maAlignToolBox);
+	maTBxVertAlign->SetMpSubEditAccLableBy(&maTBxVertAlign);
+	maTBxNumBullet->SetAccRelationLabeledBy(&maTBxNumBullet);
+	maTBxBackColor->SetMpSubEditAccLableBy(&maTBxBackColor);
+	maFTUL->SetAccRelationLabeledBy(&maFTUL);
+	maTbxUL_IncDec->SetAccRelationLabeledBy(&maTbxUL_IncDec);
+	maTopDist->SetAccRelationLabeledBy(&maTopDist);
+	maBottomDist->SetAccRelationLabeledBy(&maBottomDist);
+	maLineSPTbx->SetAccRelationLabeledBy(&maLineSPTbx);
+	maFTIndent->SetAccRelationLabeledBy(&maFTIndent);
+	maTbxIndent_IncDec->SetAccRelationLabeledBy(&maTbxIndent_IncDec);
+	maTbxProDemote->SetAccRelationLabeledBy(&maTbxProDemote);
+	maLeftIndent->SetAccRelationLabeledBy(&maLeftIndent);
+	maRightIndent->SetAccRelationLabeledBy(&maRightIndent);
+	maFLineIndent->SetAccRelationLabeledBy(&maFLineIndent);
+	mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
+#endif	
+}
+
+void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
+{	
+	sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
+
+    ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
+
+	sal_uInt16 nCount = rTbx->GetItemCount();
+    for (sal_uInt16 i = 0; i < nCount; i++)
+    {
+    	sal_uInt16 nId = rTbx->GetItemId(i);
+		rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
+    }
+}
+
+//===========================for Numbering & Bullet================================================
+
+
+
+IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	
+	EndTracking();
+	pToolBox->SetItemDown( nId, sal_True ); 
+
+	if (nId == 1)
+    {
+		maBulletsPopup.UpdateValueSet();
+		maBulletsPopup.Show(*pToolBox);
+	}
+	else if (nId == 2)
+	{
+		maNumberingPopup.UpdateValueSet();
+		maNumberingPopup.Show(*pToolBox);
+	}
+	pToolBox->SetItemDown( nId, sal_False ); 
+	return 0;
+}
+
+IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	sal_uInt16 nSID = SID_TABLE_VERT_NONE;
+	
+	EndTracking();
+	if (nId == 1)
+    {
+		nSID = FN_NUM_BULLET_ON;
+	}
+	else if ( nId == 2)
+	{
+		nSID = FN_NUM_NUMBERING_ON;
+	}
+	SfxBoolItem aBoolItem(nSID, sal_True);
+	GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+
+	return 0;	
+}
+
+
+//================================for Vertical Alignment========================================
+
+
+
+IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	sal_uInt16 nSID = SID_TABLE_VERT_NONE;
+	EndTracking();
+	if (nId == 1)
+    {
+        nSID = SID_TABLE_VERT_NONE;
+		maTBxVertAlign->SetItemState(1, STATE_CHECK);
+		maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+	}
+	else if (nId == 2)
+	{
+		nSID = SID_TABLE_VERT_CENTER;
+		maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(2, STATE_CHECK);
+		maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+	}
+	else if (nId == 3)
+	{
+		nSID = SID_TABLE_VERT_BOTTOM;
+		maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(3, STATE_CHECK);
+	}
+	SfxBoolItem aBoolItem(nSID, sal_True);
+	GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+
+	return 0;
+}
+
+void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
+{	
+	if (eState < SFX_ITEM_DONTCARE)
+	{
+		maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+		maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+		maTBxVertAlign->EnableItem(1, sal_False);
+		maTBxVertAlign->EnableItem(2, sal_False);
+		maTBxVertAlign->EnableItem(3, sal_False);
+	}
+	else
+	{
+		maTBxVertAlign->EnableItem(1, sal_True);
+		maTBxVertAlign->EnableItem(2, sal_True);
+		maTBxVertAlign->EnableItem(3, sal_True);
+		if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
+		{
+			const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
+			sal_Bool aBool = (sal_Bool)pItem->GetValue();
+
+			if (aBool)
+			{
+				if (nSID == SID_TABLE_VERT_NONE)
+				{
+					maTBxVertAlign->SetItemState(1, STATE_CHECK);
+					maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+					maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+				}
+				else if (nSID == SID_TABLE_VERT_CENTER)
+				{
+					maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+					maTBxVertAlign->SetItemState(2, STATE_CHECK);
+					maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+				}
+				else if (nSID == SID_TABLE_VERT_BOTTOM)
+				{
+					maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+					maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+					maTBxVertAlign->SetItemState(3, STATE_CHECK);
+				}
+			}
+			else
+			{
+				if (nSID == SID_TABLE_VERT_NONE)
+				{
+					maTBxVertAlign->SetItemState(1, STATE_NOCHECK);					
+				}
+				else if (nSID == SID_TABLE_VERT_CENTER)
+				{					
+					maTBxVertAlign->SetItemState(2, STATE_NOCHECK);				
+				}
+				else if (nSID == SID_TABLE_VERT_BOTTOM)
+				{					
+					maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+				}
+			}
+		}
+		else
+		{
+			maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
+			maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
+			maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
+		}
+	}
+}
+//==================================for Background color=====================
+
+IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
+{
+	sal_uInt16 nId = pToolBox->GetCurItemId();
+	OSL_ASSERT(nId == TBI_BACK_COLOR);
+	if(nId == TBI_BACK_COLOR)
+	{
+		pToolBox->SetItemDown( nId, true );
+		maBGColorPopup.Show(*pToolBox);
+		maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
+	}
+	return 0;
+}
+
+IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{	
+	return 0;
+}
+
+void ParaPropertyPanel::ShowMenu (void)
+{
+    if (mpBindings != NULL)
+    {
+        SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
+        if (pDispatcher != NULL)
+            pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
+    }
+}
+
+void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
+{
+	if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
+	{
+		const SvxColorItem* pItem =  (const SvxColorItem*)pState;
+		maColor = pItem->GetValue();
+		mbColorAvailable = sal_True;
+		mpColorUpdater->Update(maColor);
+	}
+	else
+	{
+		mbColorAvailable = sal_False;
+		maColor.SetColor(COL_AUTO);
+		mpColorUpdater->Update(maColor);
+	}
+}
+
+Color ParaPropertyPanel::GetBGColor (void) const
+{
+    return maColor;
+}
+
+void ParaPropertyPanel::SetBGColor (
+    const String& rsColorName,
+    const Color aColor)
+{
+	SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
+	mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+	maColor = aColor;
+}
+
+//==================================for Paragraph Alignment=====================
+IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
+{
+	switch (pBox->GetCurItemId())
+	{
+	case BT_SUBSTLEFT:
+		{
+			pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
+			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT,  sal_True );
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+		}
+		break;
+	case BT_SUBSTCENTER:
+		{
+			pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
+			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+		}
+		break;
+	case BT_SUBSTRIGHT:
+		{
+			pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
+			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+		}
+		break;
+	case BT_SUBSTJUSTIFY:
+		{
+			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
+			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
+		}
+		break;
+	}
+
+	return 0;
+}
+//==================================for Paragraph Indent=====================
+IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, pBox )
+{
+	SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
+	aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) );
+	aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+	aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+	return 0;
+}
+
+IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
+{
+	switch (pControl->GetCurItemId())
+	{
+		case INDENT_INCREMENT:
+		{
+			switch (maContext.GetCombinedContext())
+			{
+				case CombinedEnumContext(Application_Writer, Context_Default):
+				case CombinedEnumContext(Application_Writer, Context_Text):
+				case CombinedEnumContext(Application_Writer, Context_Table):
+				{
+					SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
+					GetBindings()->GetDispatcher()->Execute(
+						SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
+				}
+				break;
+				default:
+				{
+					SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
+
+					maTxtLeft += INDENT_STEP;
+					sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+					aMargin.SetTxtLeft( (const long)nVal );
+					aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+					aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+
+					GetBindings()->GetDispatcher()->Execute(
+						SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+				}
+			}
+		}
+		break;
+		case INDENT_DECREMENT:
+		{
+			switch (maContext.GetCombinedContext())
+			{
+				case CombinedEnumContext(Application_Writer, Context_Default):
+				case CombinedEnumContext(Application_Writer, Context_Text):
+				case CombinedEnumContext(Application_Writer, Context_Table):
+				{
+					SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
+					GetBindings()->GetDispatcher()->Execute(
+						SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
+				}
+				break;
+				default:
+				{
+					if((maTxtLeft - INDENT_STEP) < 0)
+						maTxtLeft = DEFAULT_VALUE;
+					else
+						maTxtLeft -= INDENT_STEP;
+
+					SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
+					
+					sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+
+					aMargin.SetTxtLeft( (const long)nVal );
+					aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+					aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+
+					GetBindings()->GetDispatcher()->Execute(
+						SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+				}
+			}
+		}
+		break;
+		case ID_HANGING_INDENT:
+		{
+			SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
+			aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
+
+			GetBindings()->GetDispatcher()->Execute(
+				SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+		}
+		break;
+	}
+	return( 0L );
+}
+
+IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
+{
+	switch (pControl->GetCurItemId())
+	{
+		case BT_TBX_INDENT_PROMOTE:
+		{
+			SvxLRSpaceItem aMargin( SID_ATTR_PARA_RIGHT );
+
+			maTxtLeft += INDENT_STEP;
+			sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+			nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+			aMargin.SetTxtLeft( (const long)nVal );
+			aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+
+			GetBindings()->GetDispatcher()->Execute(
+				SID_ATTR_PARA_RIGHT, SFX_CALLMODE_RECORD, &aMargin, 0L);
+		}
+		break;
+		case BT_TBX_INDENT_DEMOTE:
+		{
+			if((maTxtLeft - INDENT_STEP) < 0)
+				maTxtLeft = DEFAULT_VALUE;
+			else
+				maTxtLeft -= INDENT_STEP;
+
+			SvxLRSpaceItem aMargin( SID_ATTR_PARA_LEFT );
+			
+			sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+			nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+
+			aMargin.SetTxtLeft( (const long)nVal );
+			aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+
+			GetBindings()->GetDispatcher()->Execute(
+				SID_ATTR_PARA_LEFT, SFX_CALLMODE_RECORD, &aMargin, 0L);
+		}
+		break;
+		case SD_HANGING_INDENT:
+		{
+			SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
+			aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
+			aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
+
+			GetBindings()->GetDispatcher()->Execute(
+				SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+		}
+		break;
+	}
+	return( 0L );
+}
+//==================================for Paragraph Line Spacing=====================
+
+IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
+{
+	
+	const sal_uInt16 nId = pBox->GetCurItemId();
+	OSL_ASSERT(nId == TOOLBOX_ITEM1);
+	if(nId == TOOLBOX_ITEM1)
+	{
+		pBox->SetItemDown( nId, true );
+		maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
+		maLineSpacePopup.Show(*pBox);
+
+	}
+	return (0L);
+}
+
+//==================================for Paragraph Spacing=====================
+IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, pBox )
+{
+	SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
+	aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) );
+	aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) );
+
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+	return 0L;
+}
+
+IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
+{
+	switch (pControl->GetCurItemId())
+		{
+	    case UL_INCREMENT:
+		     {
+				 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
+
+				 maUpper += UL_STEP;
+				 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+				 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+				 aMargin.SetUpper( (const sal_uInt16)nVal );
+
+				 maLower += UL_STEP;
+				 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+				 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+	             aMargin.SetLower( (const sal_uInt16)nVal );
+
+				 GetBindings()->GetDispatcher()->Execute(
+					 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+			 }
+			 break;
+		case UL_DECREMENT:
+			{
+				 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
+
+				 if( maUpper >= UL_STEP )
+				 {
+					maUpper -= UL_STEP;
+					sal_Int64	nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+					aMargin.SetUpper( (const sal_uInt16)nVal );
+				 }
+				 else
+					aMargin.SetUpper( DEFAULT_VALUE );
+				 if( maLower >= UL_STEP )
+				 {
+					maLower -= UL_STEP;
+					sal_Int64	nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
+					aMargin.SetLower( (const sal_uInt16)nVal );
+				 }
+				 else
+					aMargin.SetLower( DEFAULT_VALUE );
+
+				 GetBindings()->GetDispatcher()->Execute(
+					 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
+			}
+			break;
+		}
+	return( 0L );
+}
+
+//==================================for Paragraph State change=====================
+void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{	
+	if( nSID == SID_ATTR_METRIC )
+	{
+		m_eMetricUnit = GetCurrentUnit(eState,pState);
+		if( m_eMetricUnit!=m_last_eMetricUnit )
+		{
+			SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit );
+			SetFieldUnit( *maRightIndent.get(), m_eMetricUnit );
+			SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit );
+			SetFieldUnit( *maTopDist.get(), m_eMetricUnit );
+			SetFieldUnit( *maBottomDist.get(), m_eMetricUnit );
+		}
+		m_last_eMetricUnit = m_eMetricUnit;
+	}
+
+	if( nSID == SID_ATTR_PARA_LRSPACE )
+		StateChangedIndentImpl( nSID, eState, pState );		
+
+	if( nSID == SID_ATTR_PARA_LINESPACE )	
+		StateChangedLnSPImpl( nSID, eState, pState );	
+
+	if( nSID == SID_ATTR_PARA_ULSPACE)
+		StateChangedULImpl( nSID, eState, pState );
+
+	if (nSID==SID_ATTR_PARA_ADJUST_LEFT || nSID==SID_ATTR_PARA_ADJUST_CENTER || nSID==SID_ATTR_PARA_ADJUST_RIGHT || nSID==SID_ATTR_PARA_ADJUST_BLOCK)
+		StateChangedAlignmentImpl( nSID, eState, pState );
+
+	if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT)
+		StateChangeOutLineImpl( nSID, eState, pState );
+
+	if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT)
+		StateChangeIncDecImpl( nSID, eState, pState );
+	// Add toggle state for numbering and bullet icons
+	if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON) 
+		StateChangeBulletNumImpl( nSID, eState, pState );
+
+	//Get the num rule index data of the current selection
+	if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) 
+		StateChangeBulletNumRuleImpl( nSID, eState, pState );
+	
+	if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM))
+	{
+		VertStateChanged( nSID, eState, pState);
+	}
+	else if (nSID == SID_BACKGROUND_COLOR)
+	{
+		ParaBKGStateChanged(nSID, eState, pState);
+	}
+}
+
+void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	if( eState >= SFX_ITEM_AVAILABLE )
+	{
+		const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+		bool IsChecked = (bool)pItem->GetValue();
+		switch (nSID)
+		{
+		case SID_ATTR_PARA_ADJUST_LEFT:
+			{
+				if(IsChecked)
+				{
+					maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+				}
+				else
+					maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+			}
+			break;
+		case SID_ATTR_PARA_ADJUST_CENTER:
+			{
+				if(IsChecked)
+				{
+					maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+				}
+				else
+					maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+			}
+			break;
+		case SID_ATTR_PARA_ADJUST_RIGHT:
+			{
+				if(IsChecked)
+				{
+					maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+				}
+				else
+					maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+			}
+			break;
+		case SID_ATTR_PARA_ADJUST_BLOCK:
+			{
+				if(IsChecked)
+				{
+					maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+					maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
+				}
+				else
+					maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+			}
+			break;
+		}
+	}
+	else if( eState == SFX_ITEM_DISABLED )
+	{
+	}
+	else if ( eState == SFX_ITEM_DONTCARE )
+	{
+		switch (nSID)
+		{
+		case SID_ATTR_PARA_ADJUST_LEFT:
+			maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
+			break;
+		case SID_ATTR_PARA_ADJUST_CENTER:
+			maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
+			break;
+		case SID_ATTR_PARA_ADJUST_RIGHT:
+			maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);	
+			break;
+		case SID_ATTR_PARA_ADJUST_BLOCK:
+			maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
+			break;
+		}
+	}
+}
+
+void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	switch (maContext.GetCombinedContext())
+	{
+		
+		case CombinedEnumContext(Application_Writer, Context_DrawText):
+		case CombinedEnumContext(Application_Calc, Context_DrawText):
+		case CombinedEnumContext(Application_Writer, Context_Annotation):
+		{
+			maLeftIndent->SetMin( DEFAULT_VALUE );
+			maRightIndent->SetMin( DEFAULT_VALUE );
+			maFLineIndent->SetMin( DEFAULT_VALUE );
+			maTbxIndent_IncDec->Show();
+			maTbxProDemote->Hide();
+		}
+		break;
+		case CombinedEnumContext(Application_Draw, Context_DrawText):
+        	case CombinedEnumContext(Application_Impress, Context_DrawText):
+		case CombinedEnumContext(Application_Draw, Context_Draw):
+		case CombinedEnumContext(Application_Draw, Context_TextObject):
+		case CombinedEnumContext(Application_Draw, Context_Graphic):
+		case CombinedEnumContext(Application_Impress, Context_Draw):
+		case CombinedEnumContext(Application_Impress, Context_TextObject):
+		case CombinedEnumContext(Application_Impress, Context_Graphic):
+		case CombinedEnumContext(Application_Impress, Context_Table):
+        	case CombinedEnumContext(Application_Draw, Context_Table):
+		{
+    		maLeftIndent->SetMin( DEFAULT_VALUE );
+			maRightIndent->SetMin( DEFAULT_VALUE );
+			maFLineIndent->SetMin( DEFAULT_VALUE );
+			maTbxIndent_IncDec->Hide();
+			maTbxProDemote->Show();
+		}
+		break;
+		case CombinedEnumContext(Application_Writer, Context_Default):
+		case CombinedEnumContext(Application_Writer, Context_Text):
+		case CombinedEnumContext(Application_Writer, Context_Table):
+		{
+			maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
+			maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
+			maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
+			maTbxIndent_IncDec->Show();
+			maTbxProDemote->Hide();
+		}
+		break;
+	}
+
+	if( pState && eState >= SFX_ITEM_AVAILABLE )
+	{
+		SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
+		maTxtLeft = pSpace->GetTxtLeft();
+		maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
+		maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+
+		long aTxtRight = pSpace->GetRight();
+		aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
+		aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+
+		long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
+		aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
+		aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+
+		long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+		nVal = (long)maLeftIndent->Normalize( (long)nVal );
+		maLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
+
+		if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 
+			maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
+			maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table))
+		{
+			maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
+		}
+
+		long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+		nrVal = (long)maRightIndent->Normalize( (long)nrVal );
+	    maRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
+
+		long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+		nfVal = (long)maFLineIndent->Normalize( (long)nfVal );
+		maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );	
+
+		switch (maContext.GetCombinedContext())
+		{
+			case CombinedEnumContext(Application_Writer, Context_DrawText):
+			case CombinedEnumContext(Application_Writer, Context_Text):
+			case CombinedEnumContext(Application_Writer, Context_Default):
+			case CombinedEnumContext(Application_Writer, Context_Table):
+			case CombinedEnumContext(Application_Writer, Context_Annotation):
+			{
+				maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
+				maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
+				maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
+			}
+			break;
+			case CombinedEnumContext(Application_Draw, Context_DrawText):
+			case CombinedEnumContext(Application_Draw, Context_Draw):
+        		case CombinedEnumContext(Application_Draw, Context_Table):
+			case CombinedEnumContext(Application_Draw, Context_TextObject):
+			case CombinedEnumContext(Application_Draw, Context_Graphic):
+			case CombinedEnumContext(Application_Impress, Context_TextObject):
+        		case CombinedEnumContext(Application_Impress, Context_DrawText):
+			case CombinedEnumContext(Application_Impress, Context_Table):
+			case CombinedEnumContext(Application_Impress, Context_Draw):
+			case CombinedEnumContext(Application_Impress, Context_Graphic):
+			{
+				maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
+				maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
+				maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
+			}
+		}
+
+		maTbxIndent_IncDec->Enable();
+		maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
+		if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) 
+			&& maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default)
+			&& maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table))
+		{
+			maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
+			maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
+		}
+
+//		maTbxProDemote->Enable();
+//		if( !mbOutLineRight && !mbOutLineLeft )
+//			maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
+		maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
+	}
+	else if( eState == SFX_ITEM_DISABLED )
+	{
+		maLeftIndent-> Disable();
+		maRightIndent->Disable();
+		maFLineIndent->Disable();
+		maTbxIndent_IncDec->Disable();
+		if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  && 
+			maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
+			maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
+			maTbxIndent_IncDec->Disable();
+		else
+			maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
+
+//		maTbxProDemote->Disable();
+		maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
+	}
+	else
+	{
+		maLeftIndent->SetEmptyFieldValue();
+		maRightIndent->SetEmptyFieldValue();
+		maFLineIndent->SetEmptyFieldValue();
+		if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  && 
+			maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
+			maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
+			maTbxIndent_IncDec->Disable();
+		else
+			maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
+//		maTbxProDemote->Disable();
+		maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
+	}
+}
+
+void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	meLnSpState = eState;
+
+	if( pState && eState >= SFX_ITEM_AVAILABLE )
+	{
+		if(mpLnSPItem)
+			delete mpLnSPItem;
+		mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
+	}
+}
+
+void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
+	maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
+
+	if( pState && eState >= SFX_ITEM_AVAILABLE )
+	{
+		SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
+
+		maUpper = pOldItem->GetUpper();
+		maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
+		maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+
+		maLower = pOldItem->GetLower();
+		maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
+		maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+
+		sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+		nVal = maTopDist->Normalize( nVal );
+		maTopDist->SetValue( nVal, FUNIT_100TH_MM );
+
+		nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+		nVal = maBottomDist->Normalize( nVal );
+		maBottomDist->SetValue( nVal, FUNIT_100TH_MM );
+		maTbxUL_IncDec->Enable();
+	}
+	else if(eState == SFX_ITEM_DISABLED )
+	{
+		maTopDist->Disable();
+		maBottomDist->Disable();
+		maTbxUL_IncDec->Disable();
+	}
+	else
+	{
+		maTopDist->SetEmptyFieldValue();
+		maBottomDist->SetEmptyFieldValue();
+		maTbxUL_IncDec->Disable();
+	}
+}
+
+void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+    if (nSID==SID_OUTLINE_LEFT)
+	{
+		if( pState && eState == SFX_ITEM_UNKNOWN )
+			mbOutLineLeft = 1;
+		else 
+			mbOutLineLeft = 0;
+	}
+	if (nSID==SID_OUTLINE_RIGHT)
+	{
+		if( pState && eState == SFX_ITEM_UNKNOWN )
+			mbOutLineRight = 1;
+		else 
+			mbOutLineRight = 0;
+	}
+	if(mbOutLineLeft)
+		maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
+	else
+		maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False);
+
+	if(mbOutLineRight)
+		maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
+	else
+		maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False);
+
+//	if( !mbOutLineRight && !mbOutLineLeft )
+//	{
+//		maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
+//		maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
+//		maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
+//	}
+//	else 
+//		maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
+}
+
+void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	if (nSID==SID_INC_INDENT)
+	{
+		if( pState && eState == SFX_ITEM_UNKNOWN )
+			maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
+		else
+			if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  && 
+				maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
+			maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
+				maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False);
+	}
+	if (nSID==SID_DEC_INDENT)
+	{
+		if( pState && eState == SFX_ITEM_UNKNOWN )
+			maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
+		else
+			if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
+				maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
+			maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
+				maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False);
+	}
+}
+// Add toggle state for numbering and bullet icons
+void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	if (nSID==FN_NUM_NUMBERING_ON)
+	{
+		if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
+		{
+			const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
+			sal_Bool aBool = (sal_Bool)pItem->GetValue();
+			if (aBool) {
+				maTBxNumBullet->SetItemState(IID_NUMBER,	STATE_CHECK);
+			} else {
+				maTBxNumBullet->SetItemState(IID_NUMBER,	STATE_NOCHECK);
+			}
+		}
+	}
+	if (nSID==FN_NUM_BULLET_ON)
+	{
+		if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
+		{
+			const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
+			sal_Bool aBool = (sal_Bool)pItem->GetValue();
+			if (aBool) {
+				maTBxNumBullet->SetItemState(IID_BULLET,	STATE_CHECK);
+			} else {
+				maTBxNumBullet->SetItemState(IID_BULLET,	STATE_NOCHECK);
+			}
+		}
+	}
+}
+//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5
+//Handing the transferred the num rule index data of the current selection
+void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+	
+	const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
+	sal_uInt16 nValue = (sal_uInt16)0xFFFF;
+	if ( pIt )
+		nValue = pIt->GetValue();
+
+	if ( nSID == FN_BUL_NUM_RULE_INDEX ) 
+	{
+		mnBulletTypeIndex = nValue;
+	}else if ( nSID == FN_NUM_NUM_RULE_INDEX ) 
+	{
+		mnNumTypeIndex = nValue;
+	}
+}
+//End
+FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
+{
+	FieldUnit eUnit = FUNIT_NONE;
+
+	if ( pState && eState >= SFX_ITEM_DEFAULT )
+		eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
+	else
+	{
+		SfxViewFrame* pFrame = SfxViewFrame::Current();
+		SfxObjectShell* pSh = NULL;
+		if ( pFrame )
+			pSh = pFrame->GetObjectShell();
+		if ( pSh )  //the object shell is not always available during reload
+		{
+			SfxModule* pModule = pSh->GetModule();
+			if ( pModule )
+			{
+				const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
+				if ( pItem )
+					eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
+			}
+			else
+			{
+				DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
+			}
+		}
+	}
+	
+	return eUnit;
+}
+//new FixedText(this, SVX_RES(FT_COLOR))
+
+PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
+{
+	return new ParaLineSpacingControl(pParent, *this);
+}
+
+PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
+{
+	return new ParaBulletsControl(pParent, *this);
+}
+
+PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
+{
+	return new ParaNumberingControl(pParent, *this);
+}
+
+PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
+{
+	return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
+        SVX_RES(VS_FONT_COLOR),
+        ::boost::bind(&ParaPropertyPanel::GetBGColor, this),
+        ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
+        pParent,
+        0);
+}
+
+
+ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)),
+      maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))),
+      maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))),
+      maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))),
+      maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))),
+      maFTUL (new FixedText(this, SVX_RES(FT_SPACING))),
+      maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))),
+      maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))),
+      maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))),
+      maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))),
+      maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))),
+      maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))),
+      maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)),
+      maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))),
+      maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))),
+      maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))),
+      maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))),
+      mpColorUpdater (),
+      maFISpace1 ( this, SVX_RES( FI_SPACE1)),
+      maFISpace2 ( this, SVX_RES( FI_SPACE2)),
+      maFIndent1 ( this, SVX_RES( FI_INDENT1)),
+      maFIndent2 ( this, SVX_RES( FI_INDENT2)),
+      maFIndent3 ( this, SVX_RES( FI_INDENT3)),
+      maSpace1 (SVX_RES(IMG_SPACE1)),
+      maSpace2 (SVX_RES(IMG_SPACE2)),
+      maSpace3 (SVX_RES(IMG_SPACE3)),
+      maIndent1 (SVX_RES(IMG_INDENT1)),
+      maIndent2 (SVX_RES(IMG_INDENT2)),
+      maIndent3 (SVX_RES(IMG_INDENT3)),
+      maLeftPara (SVX_RES(IMG_LEFT_PARA)),
+      maCentPara (SVX_RES(IMG_CENTER_PARA)),
+      maRightPara (SVX_RES(IMG_RIGHT_PARA)),
+      maJusPara (SVX_RES(IMG_JUSTIFY_PARA)),
+      maIndInc (SVX_RES(IMG_INDENT_INC)),
+      maIndDec (SVX_RES(IMG_INDENT_DEC)),
+      maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)),
+      maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)),
+      maIndHang (SVX_RES(IMG_INDENT_HANG)),
+      maParInc (SVX_RES(IMG_PARA_INC)),
+      maParDec (SVX_RES(IMG_PARA_DEC)),
+      maVertImageList (SVX_RES(IL_VERT_ALIGN)),
+      maVertImageListH (SVX_RES(IL_VERT_ALIGN)),
+      maNumBImageList (SVX_RES(IL_NUM_BULLET)),
+      maNumBImageListH (SVX_RES(ILH_NUM_BULLET)),
+      maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
+      maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
+      maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
+      maTxtLeft (0),
+      mpLnSPItem (NULL),
+      meLnSpState (SFX_ITEM_DONTCARE),
+      mbOutLineLeft (false),
+      mbOutLineRight (false),
+      maUpper (0),
+      maLower (0),
+      mnBulletTypeIndex ((sal_uInt16)0xFFFF),
+      mnNumTypeIndex ((sal_uInt16)0xFFFF),
+      maColor (COL_AUTO),
+      mbColorAvailable (true),
+ //, m_eMetricUnit			  (FUNIT_INCH)
+//, m_last_eMetricUnit      (FUNIT_INCH)
+      m_eLRSpaceUnit(),
+      m_eULSpaceUnit(),
+      maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this),
+      maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this),
+      maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this),
+      maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this),
+      maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
+      maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
+      maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
+      maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this),
+      maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this),
+      maDecIndentControl (SID_DEC_INDENT, *pBindings,*this),
+      maIncIndentControl (SID_INC_INDENT, *pBindings,*this),
+      maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this),
+      maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this),
+      maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this),
+      maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this),
+      maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this),
+      maBackColorControl (SID_BACKGROUND_COLOR,	*pBindings,*this),
+      m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
+      maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
+      maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
+      maContext(),
+      mpBindings(pBindings),
+      maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
+      maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
+      maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
+      maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
+      mxSidebar(rxSidebar)
+{
+	initial();
+	FreeResource();	
+}
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc
new file mode 100755
index 0000000..a2c22c6
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc
@@ -0,0 +1,378 @@
+/**************************************************************
+ * 
+ * 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 "svx/dialogs.hrc"
+
+#define BT_SUBSTLEFT                                 1     
+#define BT_SUBSTCENTER                               2                  
+#define BT_SUBSTRIGHT                                3    
+#define BT_SUBSTJUSTIFY                              4   
+#define BT_BTX_LINESP                                1
+#define BT_TBX_INDENT_INC                            1
+#define BT_TBX_INDENT_DEC                            2
+#define BT_TBX_UL_INC                                1
+#define BT_TBX_UL_DEC                                2
+#define ID_HANGING_INDENT							 3
+#define BT_TBX_INDENT_PROMOTE					     1
+#define BT_TBX_INDENT_DEMOTE					     2
+#define SD_HANGING_INDENT						     3
+#define MF_BEFORE_INDENT						     2
+#define MF_AFTER_INDENT						         4
+#define MF_FL_INDENT							     6
+#define TBX_HORIZONTALALIGNMENT                      5    
+#define IMG_LEFT_PARA                                7
+#define IMG_CENTER_PARA                              8 
+#define IMG_RIGHT_PARA                               9
+#define IMG_JUSTIFY_PARA                             10
+#define IMG_INDENT_INC                               11
+#define IMG_INDENT_DEC                               12
+#define IMG_PARA_INC                                 13
+#define IMG_PARA_DEC                                 14
+#define IMG_INDENT_HANG								 15
+#define FT_INDENT                                    16 
+#define TBX_INDENT_INC_DEC                           17
+#define FI_SPACE1								     18
+#define FI_SPACE2								     19
+#define FI_INDENT1								     20
+#define FI_INDENT2								     21
+#define FI_INDENT3								     22
+#define IMG_SPACE3							         23
+#define TBX_LINESP                                   25
+#define IMG_SPACE1                                   26
+#define IMG_INDENT1                                  27
+#define IMG_INDENT2                                  28
+#define IMG_SPACE2                                   29
+#define IMG_INDENT3                                  30
+#define FT_SPACING                                   31
+#define TBX_UL_INC_DEC                               33
+#define MF_ABOVE_PARASPACING						 32
+#define MF_BELOW_PARASPACING						 34
+#define TBX_INDENT_PRO_DEMOTE						 35
+#define TBX_VERT_ALIGN		40
+#define IL_VERT_ALIGN		41
+#define	ILH_VERT_ALIGN		42
+#define TBX_NUM_BULLET		44
+#define IL_NUM_BULLET		45
+#define ILH_NUM_BULLET		46
+#define FT_BACK_COLOR		47
+#define TBX_BACK_COLOR		48
+#define TBI_BACK_COLOR		49
+#define IMG_BACK_COLOR		50
+#define	IMG_BACK_COLOR_H	51
+#define IL_NUM_BULLET_RTL		52	//sym2_7380
+#define TBI_VERT_ALIGN_TOP	    60
+#define TBI_VERT_ALIGN_CENTER	61
+#define TBI_VERT_ALIGN_BOT	    62
+#define TBI_NUMBERING	        63
+#define TBI_BULLET	            64
+#define TBI_HOR_ALIGN_LEFT	    65
+#define TBI_HOR_ALIGN_CENTER	66
+#define TBI_HOR_ALIGN_RIGHT	    67
+#define TBI_HOR_ALIGN_JUSTIFY	68
+#define TBI_INDENT_INC		    69
+#define TBI_INDENT_DEC		    70
+#define TBI_UL_INC			    71
+#define TBI_UL_DEC			    72
+#define IMG_INDENT_INC_BD		73
+#define IMG_INDENT_DEC_BD		74
+
+//for vertical alignment
+#define IID_VERT_TOP		1
+#define IID_VERT_CENTER		2
+#define IID_VERT_BOTTOM		3
+
+//for numbering and bullett
+#define IID_BULLET			1
+#define IID_NUMBER			2
+//============================== popup bullet and numbering & back color =========================
+#define VS_VALUES			1
+#define IL_BULLET_BITMAPS	2
+#define CB_BULLET_MORE		4
+#define BMP_BULLET_MORE		5
+#define BMP_BULLET_MORE_H	6
+#define IMG_SEPERATOR_BULLET	7
+
+#define VS_NUMBERING		10
+#define CB_NUMBERING_MORE	12
+#define BMP_NUMERING_MORE	13
+#define BMP_NUMERING_MORE_H	14
+#define IMG_SEPERATOR_NUMBERING	15
+#define VS_FONT_COLOR		1
+#define STR_NOFILL			2
+
+//============================== line space popup page ==============================
+
+#define LB_LINE_SPACING                    1
+#define ED_SBINDE_LINEDISTPERCENT          2
+#define ED_SBINDE_LINEDISTPOINT	           3
+
+#define FT_CUSTOM                          14
+#define FT_LINE_SPACING                    15
+#define FT_OF                              16 
+#define IMG_SPACING1                       18
+#define IMG_SPACING115                     19
+#define IMG_SPACING15                      20
+#define IMG_SPACING2                       21
+#define IMG_SPACINGLCUSTOM                 22
+#define IMG_SEL_SPACING1                   23
+#define IMG_SEL_SPACING115                 24
+#define IMG_SEL_SPACING15                  25
+#define IMG_SEL_SPACING2                   26
+#define IMG_LPCUSTOMNOBORDER               27
+#define FI_CUSTOM_NOBORDER_LSPACE          28
+#define LINE_SPACING					   29
+#define STR_SPACING1					   30
+#define STR_SPACING115                     31
+#define STR_SPACING15                      32
+#define STR_SPACING2                       33
+#define IMG_CUSTOM					       34
+#define IMG_CUSTOM_GRAY				       35
+#define STR_LCVALUE						   36
+#define STR_LS_SINGLE					   37
+#define STR_LS_115					       38
+#define STR_LS_15					       39
+#define STR_LS_DOUBLE					   40
+#define STR_LSPACING					   41
+#define STR_LS_OF					       42
+
+//============================== Help ID ==============================
+#define HID_TBX_HORIZONTALALIGNMENT	"HID_TBX_HORIZONTALALIGNMENT" 
+#define HID_TBI_HOR_ALIGN_LEFT		"HID_TBI_HOR_ALIGN_LEFT" 
+#define HID_TBI_HOR_ALIGN_CENTER	"HID_TBI_HOR_ALIGN_CENTER"
+#define HID_TBI_HOR_ALIGN_RIGHT		"HID_TBI_HOR_ALIGN_RIGHT"
+#define HID_TBI_HOR_ALIGN_JUSTIFY	"HID_TBI_HOR_ALIGN_JUSTIFY"
+
+#define HID_TBX_VERT_ALIGN			"HID_TBX_VERT_ALIGN"
+#define HID_TBI_VERT_ALIGN_TOP		"HID_TBI_VERT_ALIGN_TOP"
+#define HID_TBI_VERT_ALIGN_CENTER	"HID_TBI_VERT_ALIGN_CENTER"
+#define HID_TBI_VERT_ALIGN_BOT		"HID_TBI_VERT_ALIGN_BOT"
+
+#define HID_TBX_INDENT "HID_TBX_INDENT" 
+#define HID_TBI_INDENT "HID_TBI_INDENT"
+//#define HID_TBX_LINESP 705263129 
+//#define HID_TBI_LINESP 705262617
+#define HID_TBX_GRSPACE "HID_TBX_GRSPACE"
+#define HID_TBI_GRSPACE "HID_TBI_GRSPACE"
+#define HID_TBX_BACK_COLOR	"HID_TBX_BACK_COLOR"
+#define HID_TBI_BACK_COLOR	"HID_TBI_BACK_COLOR"
+
+//#define HID_TBX_INDENT_INC_DEC 705263121
+//#define HID_TBI_INDENT_DEC 705262662
+//#define HID_TBI_INDENT_INC 705262661
+//#define HID_TBX_UL_INC_DEC 705263137
+//#define HID_TBI_UL_INC 705262663
+//#define HID_TBI_UL_DEC 705262664
+
+//#define HID_TBX_NUM_BULLET 705263148
+//#define HID_TBI_NUMBERING 705262655
+//#define HID_TBI_BULLET	705262656
+
+#define HID_POPUP_BULLET_CB_BULLET_MORE	"HID_POPUP_BULLET_CB_BULLET_MORE"
+#define HID_POPUP_BULLET_VS_VALUES		"HID_POPUP_BULLET_VS_VALUES"
+#define HID_POPUP_NUM_CB_NUMBERING_MORE "HID_POPUP_NUM_CB_NUMBERING_MORE"
+#define HID_POPUP_NUM_VS_NUMBERING		"HID_POPUP_NUM_VS_NUMBERING"
+
+#define HID_POPUP_INDENT_ED_INDENT_LEFTINDENT	"HID_POPUP_INDENT_ED_INDENT_LEFTINDENT"
+#define HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT	"HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT"
+#define HID_POPUP_INDENT_ED_INDENT_FLINDENT		"HID_POPUP_INDENT_ED_INDENT_FLINDENT"
+#define HID_POPUP_INDENT_TBX_INDENT_NONE	"HID_POPUP_INDENT_TBX_INDENT_NONE"
+#define HID_POPUP_INDENT_TBI_INDENT_NONE	"HID_POPUP_INDENT_TBI_INDENT_NONE"
+#define HID_POPUP_INDENT_TBX_INDENT_BEFORE1	"HID_POPUP_INDENT_TBX_INDENT_BEFORE1"
+#define HID_POPUP_INDENT_TBI_INDENT_BEFORE1	"HID_POPUP_INDENT_TBI_INDENT_BEFORE1"
+#define HID_POPUP_INDENT_TBX_INDENT_BEFORE2 "HID_POPUP_INDENT_TBX_INDENT_BEFORE2"
+#define HID_POPUP_INDENT_TBI_INDENT_BEFORE2 "HID_POPUP_INDENT_TBI_INDENT_BEFORE2"
+#define HID_POPUP_INDENT_TBX_INDENT_FLINE	"HID_POPUP_INDENT_TBX_INDENT_FLINE"
+#define HID_POPUP_INDENT_TBI_INDENT_FLINE	"HID_POPUP_INDENT_TBI_INDENT_FLINE"
+#define HID_POPUP_INDENT_TBX_INDENT_HANGING	"HID_POPUP_INDENT_TBX_INDENT_HANGING"
+#define HID_POPUP_INDENT_TBI_INDENT_HANGING "HID_POPUP_INDENT_TBI_INDENT_HANGING"
+#define HID_POPUP_INDENT_TBX_INDENT_LCUSTOM "HID_POPUP_INDENT_TBX_INDENT_LCUSTOM"
+#define HID_POPUP_INDENT_TBI_INDENT_LCUSTOM "HID_POPUP_INDENT_TBI_INDENT_LCUSTOM"
+
+#define HID_POPUP_LS_LB_LINE_SPACING			"HID_POPUP_LS_LB_LINE_SPACING"
+#define HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT	"HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT"
+#define HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT	 "HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT"
+#define HID_POPUP_LS_TBX_LINESP_1				"HID_POPUP_LS_TBX_LINESP_1"
+#define HID_POPUP_LS_TBI_LINESP_1				"HID_POPUP_LS_TBI_LINESP_1"
+#define HID_POPUP_LS_TBX_LINESP_15				"HID_POPUP_LS_TBX_LINESP_15"
+#define HID_POPUP_LS_TBI_LINESP_15				"HID_POPUP_LS_TBI_LINESP_15"
+#define HID_POPUP_LS_TBX_LINESP_2				"HID_POPUP_LS_TBX_LINESP_2"
+#define HID_POPUP_LS_TBI_LINESP_2				"HID_POPUP_LS_TBI_LINESP_2"
+#define HID_POPUP_LS_TBX_LINESP_115				"HID_POPUP_LS_TBX_LINESP_115"
+#define HID_POPUP_LS_TBI_LINESP_115				"HID_POPUP_LS_TBI_LINESP_115"
+#define HID_POPUP_LS_TBX_LINESP_LCUSTOM			"HID_POPUP_LS_TBX_LINESP_LCUSTOM"
+#define HID_POPUP_LS_TBI_LINESP_LCUSTOM			"HID_POPUP_LS_TBI_LINESP_LCUSTOM"
+
+#define HID_POPUP_PS_ED_SBINDE_TOPDIST		"HID_POPUP_PS_ED_SBINDE_TOPDIST"
+#define HID_POPUP_PS_ED_SBINDE_BOTTOMDIST	"HID_POPUP_PS_ED_SBINDE_BOTTOMDIST"
+#define HID_POPUP_PS_TBX_NORMAL				"HID_POPUP_PS_TBX_NORMAL"
+#define HID_POPUP_PS_TBI_NORMAL				"HID_POPUP_PS_TBI_NORMAL"
+#define HID_POPUP_PS_TBX_NARROW				"HID_POPUP_PS_TBX_NARROW"
+#define HID_POPUP_PS_TBI_NARROW				"HID_POPUP_PS_TBI_NARROW"
+#define HID_POPUP_PS_TBX_WIDE				"HID_POPUP_PS_TBX_WIDE"
+#define HID_POPUP_PS_TBI_WIDE				"HID_POPUP_PS_TBI_WIDE"
+#define HID_POPUP_PS_TBX_LASTCUSTOM			"HID_POPUP_PS_TBX_LASTCUSTOM"
+#define HID_POPUP_PS_TBI_LASTCUSTOM			"HID_POPUP_PS_TBI_LASTCUSTOM"
+
+//============================== Property ==============================
+#define _FIXED_TEXT_HEIGHT          9
+#define _FIXED_TEXT_WIDTH           40
+#define CONTROL_HEIGHT		        15
+#define CONTROL_WIDTH		        45
+#define ALIGNMENT_TBX_HEIGHT        17
+#define ALIGNMENT_TBX_WIDTH         13
+#define LISTBOX_HEIGHT              80
+#define IMAGE_SIZE                  16
+#define POPUP_TOOLBOX_SIZE          32
+#define TOOLBOX_HEIGHT              22
+#define TOOLBOX_WIDTH               23
+#define TEXT_SPACING_VERTICAL       2
+#define BUTTON_SPACING              18
+//#define TOOLBOX_ITEM_HEIGHT			17
+#define VS_SPACING_WIDTH		    78
+
+//==============================Section page position==============================
+
+#define TBX_HORI_ALIGN_X	SECTIONPAGE_MARGIN_HORIZONTAL + TBX_OUT_BORDER_OFFSET_X/2
+#define TBX_HORI_ALIGN_Y	SECTIONPAGE_MARGIN_VERTICAL_TOP
+
+#define TBX_VERT_ALIGN_X	TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL
+#define TBX_VERT_ALIGN_Y	TBX_HORI_ALIGN_Y
+
+#define TBX_NUM_BULLET_X	TBX_HORI_ALIGN_X
+#define TBX_NUM_BULLET_Y	TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 1
+
+#define TBX_BACK_COLOR_X	TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 3 + CONTROL_SPACING_HORIZONTAL
+#define TBX_BACK_COLOR_Y	TBX_NUM_BULLET_Y
+
+#define FT_PARA_SPACE_X		SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_PARA_SPACE_Y		TBX_NUM_BULLET_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 3
+#define FT_PARA_SPACE_Y2	TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 2
+
+#define TBX_PARA_SPACE_INC_DEC_X	TBX_HORI_ALIGN_X
+#define TBX_PARA_SPACE_INC_DEC_Y	FT_PARA_SPACE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define TBX_PARA_SPACE_INC_DEC_Y2	FT_PARA_SPACE_Y2 + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define FT_PARA_INDENT_X	TBX_VERT_ALIGN_X
+#define FT_PARA_INDENT_Y	FT_PARA_SPACE_Y
+#define FT_PARA_INDENT_Y2	FT_PARA_SPACE_Y2
+
+#define TBX_PARA_INDENT_INC_DEC_X	TBX_VERT_ALIGN_X
+#define TBX_PARA_INDENT_INC_DEC_Y	TBX_PARA_SPACE_INC_DEC_Y
+#define TBX_PARA_INDENT_INC_DEC_Y2	TBX_PARA_SPACE_INC_DEC_Y2
+
+#define MBX_TOP_DIST_X		FT_PARA_SPACE_X + TOOLBOX_ITEM_WIDTH
+#define MBX_TOP_DIST_Y		TBX_PARA_SPACE_INC_DEC_Y + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1
+#define MBX_TOP_DIST_Y2		TBX_PARA_SPACE_INC_DEC_Y2 + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1
+#define MBX_BOT_DIST_X		MBX_TOP_DIST_X
+#define MBX_BOT_DIST_Y		MBX_TOP_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define MBX_BOT_DIST_Y2		MBX_TOP_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+
+#define IMG_SPACE_X		    FT_PARA_SPACE_X - 3
+#define IMG_SPACE1_Y		MBX_TOP_DIST_Y  - 1
+#define IMG_SPACE2_Y		MBX_BOT_DIST_Y  - 1
+#define IMG_SPACE1_Y2		MBX_TOP_DIST_Y2  - 1
+#define IMG_SPACE2_Y2		MBX_BOT_DIST_Y2  - 1
+
+#define MBX_LEFT_DIST_X		FT_PARA_INDENT_X + TOOLBOX_ITEM_WIDTH
+#define MBX_LEFT_DIST_Y		MBX_TOP_DIST_Y
+#define MBX_LEFT_DIST_Y2	MBX_TOP_DIST_Y2
+#define MBX_RIGHT_DIST_X	MBX_LEFT_DIST_X
+#define MBX_RIGHT_DIST_Y	MBX_BOT_DIST_Y
+#define MBX_RIGHT_DIST_Y2	MBX_BOT_DIST_Y2
+#define MBX_FLINE_DIST_X	MBX_LEFT_DIST_X
+#define MBX_FLINE_DIST_Y	MBX_RIGHT_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define MBX_FLINE_DIST_Y2	MBX_RIGHT_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+
+#define IMG_INDENT_X		FT_PARA_INDENT_X - 4
+#define IMG_INDENT1_Y		MBX_LEFT_DIST_Y - 1
+#define IMG_INDENT2_Y		MBX_RIGHT_DIST_Y - 1
+#define IMG_INDENT3_Y		MBX_FLINE_DIST_Y - 1
+#define IMG_INDENT1_Y2		MBX_LEFT_DIST_Y2 - 1
+#define IMG_INDENT2_Y2		MBX_RIGHT_DIST_Y2- 1
+#define IMG_INDENT3_Y2		MBX_FLINE_DIST_Y2- 1
+
+#define TBX_LINE_SPACE_X	TBX_HORI_ALIGN_X
+#define TBX_LINE_SPACE_Y	MBX_FLINE_DIST_Y
+#define TBX_LINE_SPACE_Y2	MBX_FLINE_DIST_Y2
+
+#define PARA_SECTIONPAGE_HEIGHT		MBX_FLINE_DIST_Y + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT
+#define PARA_SECTIONPAGE_HEIGHT_2	MBX_FLINE_DIST_Y2 + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT
+
+#define LINE_X_WHITE		FT_PARA_INDENT_X - 5
+#define LINE_TOP_Y			FT_PARA_INDENT_Y + 1
+#define LINE_TOP_Y2			FT_PARA_INDENT_Y2 + 1
+#define LINE_BOT_Y			TBX_LINE_SPACE_Y + TOOLBOX_ITEM_HEIGHT - 1
+#define LINE_BOT_Y2			TBX_LINE_SPACE_Y2 + TOOLBOX_ITEM_HEIGHT - 1
+
+//==============================numbering and bullet==============================
+#define NB_MARGIN_VERTICAL		POPUPPANEL_MARGIN_VERTICAL
+#define NB_MARGIN_HORIZONTAL	POPUPPANEL_MARGIN_HORIZONTAL
+#define SPACING_VERTICAL_S3		    8
+//#define SPACING_VERTICAL_S1		12
+#define POPUPPANEL_MARGIN_NB   4
+
+#define NB_IMAGE_WIDTH		25
+#define NB_IMAGE_HEIGHT		25
+#define NB_IMAGE_SPACING	5
+
+#define BULLET_IMAGE_WIDTH		NB_IMAGE_WIDTH
+#define BULLET_IMAGE_HEIGHT		NB_IMAGE_HEIGHT
+#define BULLET_IMAGE_SPACING	NB_IMAGE_SPACING
+
+#define NUM_IMAGE_WIDTH		25
+#define NUM_IMAGE_HEIGHT	35
+#define NUM_IMAGE_SPACING	NB_IMAGE_SPACING
+
+#define FIXED_TEXT_HEIGHT        13
+#define FIXED_TEXT_WIDTH         80
+#define CUST_MORE_BUTTON_HEIGHT	 15
+
+#define VS_WIDTH_BULLET		BULLET_IMAGE_WIDTH*3+BULLET_IMAGE_SPACING*2
+#define VS_HEIGHT_BULLET	BULLET_IMAGE_HEIGHT*4+BULLET_IMAGE_SPACING*3
+#define VS_WIDTH_NUM		NUM_IMAGE_WIDTH*3+NB_IMAGE_SPACING*2
+#define VS_HEIGHT_NUM		NUM_IMAGE_HEIGHT*3+NB_IMAGE_SPACING*2
+
+#define POPUP_WIDTH_BULLET	VS_WIDTH_BULLET + POPUPPANEL_MARGIN_NB * 2
+#define POPUP_HEIGHT_BULLET	VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT
+#define POPUP_WIDTH_NUM		VS_WIDTH_NUM + POPUPPANEL_MARGIN_NB * 2
+#define POPUP_HEIGHT_NUM	VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT
+
+#define CUST_MORE_BUTTON_X	1
+#define CUST_MORE_BUTTON_IMG_OFF_X		2	//NB_MARGIN_HORIZONTAL - CUST_MORE_BUTTON_X + OFFSET_X
+
+//==============================Line Spacing popup page=======================
+
+#define POPUP_PAGE_HEIGHT    POP_BORDER_Y + BD_HEIGHT + POPUPPANEL_MARGIN_NB + OFFSET_Y
+#define POP_FT_CUSTOM_X      POPUPPANEL_MARGIN_NB + OFFSET_X
+#define POP_FT_CUSTOM_Y      POPUPPANEL_MARGIN_SMALL * 2 + 17 * 5
+#define POP_BORDER_X         POPUPPANEL_MARGIN_NB + OFFSET_X + 1
+#define POP_BORDER_Y         POPUPPANEL_MARGIN_SMALL * 3 + 17 * 5 + TEXT_HEIGHT
+#define BD_WIDTH             VS_SPACING_WIDTH - 6
+#define BD_HEIGHT            TEXT_HEIGHT*2 + CONTROL_HEIGHT*2 + CONTROL_SPACING_VERTICAL*3 + TEXT_CONTROL_SPACING_VERTICAL*2 - 4
+
+#define FT_1_X               POP_BORDER_X + POPUPPANEL_MARGIN_LARGE
+#define FT_1_Y               POP_BORDER_Y + CONTROL_SPACING_VERTICAL
+#define EDIT_1_X             FT_1_X
+#define EDIT_1_Y             FT_1_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_2_X               FT_1_X
+#define FT_2_Y               EDIT_1_Y + CONTROL_HEIGHT + CONTROL_SPACING_VERTICAL - 3
+#define EDIT_2_X             FT_1_X
+#define EDIT_2_Y             FT_2_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
\ No newline at end of file
diff --git a/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
new file mode 100755
index 0000000..5ae4e5e
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -0,0 +1,290 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
+#define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <editeng/lspcitem.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <svx/relfld.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/fhgtitem.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+#include <svx/sidebar/ColorPopup.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+
+#include "ParaBulletsPopup.hxx"
+#include "ParaNumberingPopup.hxx"
+#include "ParaLineSpacingPopup.hxx"
+
+class FloatingWindow;
+class ToolBox;
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace svx { namespace sidebar {
+
+class PopupControl;
+class PopupContainer;
+
+class ParaPropertyPanel
+    : public Control,
+      public ::sfx2::sidebar::IContextChangeReceiver,
+      public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static ParaPropertyPanel* Create (
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+	virtual void DataChanged (const DataChangedEvent& rEvent);
+	SfxBindings* GetBindings();
+
+	virtual void HandleContextChange (
+	    const ::sfx2::sidebar::EnumContext aContext);
+
+	virtual void NotifyItemUpdate(
+	    const sal_uInt16 nSId,
+	    const SfxItemState eState,
+	    const SfxPoolItem* pState);
+
+	void ShowMenu (void);
+	sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; }
+	void SetBulletTypeIndex(sal_uInt16 nInd){ mnBulletTypeIndex = nInd; }
+	sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; }
+	void SetNumTypeIndex(sal_uInt16 nInd){ mnNumTypeIndex = nInd; }
+	FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
+
+	void EndSpacingPopupMode (void);
+	void EndBulletsPopupMode (void);
+	void EndNumberingPopupMode (void);
+
+private:
+	/**********************************************************
+	 **
+	 ** UI controls
+	 **
+	***********************************************************/
+	//Alignment
+	::boost::scoped_ptr<Window> 			maAlignToolBoxBackground;
+	::boost::scoped_ptr<ToolBox>			maAlignToolBox;
+	::boost::scoped_ptr<Window> 			maTBxVertAlignBackground;
+	::boost::scoped_ptr<ToolBox>			maTBxVertAlign;
+	//NumBullet&Backcolor
+	::boost::scoped_ptr<Window> 			maTBxNumBulletBackground;
+	::boost::scoped_ptr<ToolBox>			maTBxNumBullet;
+	::boost::scoped_ptr<Window> 			maTBxBackColorBackground;
+	::boost::scoped_ptr<ToolBox>			maTBxBackColor;
+	//Paragraph spacing
+	::boost::scoped_ptr<FixedText>			maFTUL;
+	::boost::scoped_ptr<Window> 			maTbxUL_IncDecBackground;
+	::boost::scoped_ptr<ToolBox>			maTbxUL_IncDec;
+	::boost::scoped_ptr<SvxRelativeField>	maTopDist;
+	::boost::scoped_ptr<SvxRelativeField>	maBottomDist;
+	//Line spacing
+	::boost::scoped_ptr<Window> 			maLineSPTbxBackground;
+	::boost::scoped_ptr<ToolBox>			maLineSPTbx;
+	//Indent
+	::boost::scoped_ptr<FixedText>			maFTIndent;
+	::boost::scoped_ptr<Window> 			maTbxIndent_IncDecBackground;
+	::boost::scoped_ptr<ToolBox>			maTbxIndent_IncDec;
+	::boost::scoped_ptr<Window> 			maTbxProDemoteBackground;
+	::boost::scoped_ptr<ToolBox>			maTbxProDemote;
+	::boost::scoped_ptr<SvxRelativeField>	maLeftIndent;
+	::boost::scoped_ptr<SvxRelativeField>	maRightIndent;
+	::boost::scoped_ptr<SvxRelativeField>	maFLineIndent;
+	::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
+	
+	/**********************************************************
+	 **
+	 ** Resources
+	 **
+	***********************************************************/
+	FixedImage  maFISpace1;
+	FixedImage  maFISpace2;
+	FixedImage  maFIndent1;
+	FixedImage  maFIndent2;
+	FixedImage  maFIndent3;
+
+	Image  maSpace1;
+	Image  maSpace2;
+	Image  maSpace3;
+	Image  maIndent1;
+	Image  maIndent2;
+	Image  maIndent3;
+
+	Image  maLeftPara;
+	Image  maCentPara;
+	Image  maRightPara;
+	Image  maJusPara;
+
+	Image  maIndInc;
+	Image  maIndDec;
+	Image  maIndInc_BD;
+	Image  maIndDec_BD;
+	Image  maIndHang;
+	Image  maParInc;
+	Image  maParDec;
+
+	ImageList	maVertImageList;
+	ImageList	maVertImageListH;	
+	ImageList	maNumBImageList;
+	ImageList	maNumBImageListH;
+	ImageList	maNumBImageListRTL;
+	Image		maImgBackColorHigh;
+	Image		maImgBackColor;
+
+	/****************************************************************
+	**
+	** Data Member
+	**
+	*****************************************************************/
+	long				maTxtLeft;
+	//Line spacing
+	SvxLineSpacingItem	*mpLnSPItem; 
+	SfxItemState			meLnSpState;
+	bool					mbOutLineLeft;
+	bool					mbOutLineRight;
+	long					maUpper;
+	long					maLower;
+
+	sal_uInt16			mnBulletTypeIndex;
+	sal_uInt16			mnNumTypeIndex;
+	Color				maColor;
+	bool					mbColorAvailable;
+	FieldUnit						m_eMetricUnit;
+	FieldUnit						m_last_eMetricUnit;
+	SfxMapUnit                      m_eLRSpaceUnit;
+	SfxMapUnit                      m_eULSpaceUnit;
+	/****************************************************************
+	**
+	** Controll Items
+	**
+	*****************************************************************/
+
+	::sfx2::sidebar::ControllerItem  maLeftAlignControl;
+	::sfx2::sidebar::ControllerItem  maCenterAlignControl;
+	::sfx2::sidebar::ControllerItem  maRightAlignControl;
+	::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
+	::sfx2::sidebar::ControllerItem  maLRSpaceControl;
+	::sfx2::sidebar::ControllerItem  maLNSpaceControl;
+	::sfx2::sidebar::ControllerItem  maULSpaceControl;
+	::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
+	::sfx2::sidebar::ControllerItem  maOutLineRightControl;
+	::sfx2::sidebar::ControllerItem  maDecIndentControl;
+	::sfx2::sidebar::ControllerItem  maIncIndentControl;
+	::sfx2::sidebar::ControllerItem  maVertTop;
+	::sfx2::sidebar::ControllerItem  maVertCenter;
+	::sfx2::sidebar::ControllerItem  maVertBottom;
+	::sfx2::sidebar::ControllerItem  maBulletOnOff;
+	::sfx2::sidebar::ControllerItem  maNumberOnOff;
+	::sfx2::sidebar::ControllerItem  maBackColorControl;
+	::sfx2::sidebar::ControllerItem  m_aMetricCtl;
+	::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
+	::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
+
+    ::sfx2::sidebar::EnumContext maContext;
+    SfxBindings* mpBindings;
+	ParaLineSpacingPopup maLineSpacePopup;
+	ParaBulletsPopup maBulletsPopup;
+	ParaNumberingPopup maNumberingPopup;
+	ColorPopup maBGColorPopup; 
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+
+    
+    ParaPropertyPanel (
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+	virtual ~ParaPropertyPanel (void);
+
+	void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
+
+	DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
+	DECL_LINK(VertTbxSelectHandler, ToolBox*);
+	DECL_LINK(NumBTbxSelectHandler, ToolBox*);
+	DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
+	DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
+	DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
+	DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
+	DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
+	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
+
+	void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
+	void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
+	void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	// Add toggle state for numbering and bullet icons
+	void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	//Modified for Numbering&Bullets Dialog UX Enh
+	//Handing the transferred the num rule index data of the current selection
+	void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+	
+	void initial();
+	void ReSize(bool bSize);
+
+	
+	PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
+	PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
+	PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
+	PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
+	DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
+	DECL_LINK(NumBTbxDDHandler, ToolBox*);
+	DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
+
+	void SetupIcons (void);
+	void InitToolBoxAlign();
+	void InitToolBoxVertAlign();
+	void InitToolBoxIndent();
+	void InitToolBoxBGColor();
+	void InitToolBoxBulletsNumbering();
+	void InitToolBoxSpacing();
+	void InitToolBoxLineSpacing();
+
+	Color GetBGColor (void) const;
+	void SetBGColor (const String& rsColorName, const Color aColor);
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
+
diff --git a/main/svx/source/sidebar/paragraph/ParaPropertyPanel.src b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.src
new file mode 100755
index 0000000..1c088f6
--- /dev/null
+++ b/main/svx/source/sidebar/paragraph/ParaPropertyPanel.src
@@ -0,0 +1,982 @@
+/**************************************************************
+ * 
+ * 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 "ParaPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include "helpid.hrc"
+
+#define MASKCOLOR	MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+#define SVX_PROPERTYPANEL_PARA_VERT_IDLIST \
+	IdList =			   \
+	{					   \
+		IID_VERT_TOP ;	   \
+		IID_VERT_CENTER ;   \
+		IID_VERT_BOTTOM ;   \
+	};					   \
+	IdCount = { 3 ; };
+
+#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST \
+	IdList =			   \
+	{					   \
+		IID_BULLET ;	   \
+		IID_NUMBER ;	   \
+	};					   \
+	IdCount = { 2 ; };
+
+//add by wj for sym2_7380	
+#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL \
+	IdList =			   \
+	{					   \
+		IID_BULLET ;	   \
+		IID_NUMBER ;	   \
+	};					   \
+	IdCount = { 2 ; };
+	
+Control RID_SIDEBAR_PARA_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PARA_SECTIONPAGE_HEIGHT );
+	HelpID = HID_PROPERTYPANEL_PARA_SECTION ;
+	Text = "Paragraph";	
+
+	ToolBox TBX_HORIZONTALALIGNMENT
+	{
+        Pos = MAP_APPFONT ( TBX_HORI_ALIGN_X , TBX_HORI_ALIGN_Y );
+        Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_HALIGN;
+		Text = "Horizontal Alignment";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = BT_SUBSTLEFT ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT;
+				Text [ en-US ] = "Align Left" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/AlignTextLeft_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_SUBSTCENTER ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER;
+				Text [ en-US ] = "Align Center" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/AlignTextCenter_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_SUBSTRIGHT ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT;
+				Text [ en-US ] = "Align Right" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/AlignTextRight_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_SUBSTJUSTIFY ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY;
+				Text [ en-US ] = "Align Justified" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/AlignTextJustified_16x16.png";
+				};
+			};
+		};
+	};
+	ToolBox TBX_VERT_ALIGN
+	{
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_VALIGN;
+		SVLook = TRUE ;
+		Border = FALSE ;
+		Pos = MAP_APPFONT ( TBX_VERT_ALIGN_X,  TBX_VERT_ALIGN_Y ) ;
+		Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 ,  TOOLBOX_ITEM_HEIGHT) ;
+		TabStop = TRUE ;
+		Text = "Vertical Alignment";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_TOP ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP;
+				Text [ en-US ] = "Align Top" ;
+			};
+			
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_CENTER ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER;
+				Text [ en-US ] = "Align Center Vertically" ;
+			};
+			
+			ToolBoxItem
+			{
+				Identifier = IID_VERT_BOTTOM ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT;
+				Text [ en-US ] = "Align Bottom" ;
+			};
+		};
+	};
+
+    ToolBox TBX_NUM_BULLET
+	{
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET;
+		Border = FALSE ;
+		Pos = MAP_APPFONT ( TBX_NUM_BULLET_X , TBX_NUM_BULLET_Y ) ;
+		Size = MAP_APPFONT ( TOOLBOX_ITEM_DD_WIDTH * 2 ,  TOOLBOX_ITEM_HEIGHT) ;
+		TabStop = TRUE ;
+		Text = "Bullets and Numbering";
+		ItemList =
+		{			
+			ToolBoxItem
+			{
+				Identifier = IID_BULLET ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_BULLET ;
+				Text [ en-US ] = "Bullets" ;
+				DropDown = TRUE ;
+			};			
+			ToolBoxItem
+			{
+				Identifier = IID_NUMBER ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_NUM ;
+				Text [ en-US ] = "Numbering" ;
+				DropDown = TRUE ;
+			};
+		};
+	};	
+	ToolBox TBX_BACK_COLOR
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (TBX_BACK_COLOR_X, TBX_BACK_COLOR_Y) ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH,TOOLBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR;
+		Text = "Paragraph Background Color" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BACK_COLOR ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Paragraph Background Color" ;
+			};
+		};
+	};
+	FixedText FT_SPACING
+	{
+	    Pos = MAP_APPFONT ( FT_PARA_SPACE_X, FT_PARA_SPACE_Y );
+        Size = MAP_APPFONT ( FT_PARA_INDENT_X - 7 - FT_PARA_SPACE_X, _FIXED_TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Spacing:"; 
+	};
+	ToolBox TBX_UL_INC_DEC
+	{
+		Pos = MAP_APPFONT ( TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y );
+		Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_INC_DEC ;
+		Text = "Spacing"; 
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_UL_INC ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INC ;
+				Text [ en-US ] = "Increase Spacing" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/IncreaseSpace_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_UL_DEC ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_DEC ;
+				Text [ en-US ] = "Decrease Spacing" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/DecreaseSpace_16x16.png";
+				};
+			};
+		};
+	};
+	MetricField MF_ABOVE_PARASPACING
+	{
+		HelpID = HID_POPUP_PS_ED_SBINDE_TOPDIST ;
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MBX_TOP_DIST_X, MBX_TOP_DIST_Y );
+        	Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ;
+        	QuickHelpText [ en-US ] = "Above Paragraph Spacing";
+        	TabStop = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 999;
+		Unit = FUNIT_INCH;
+		Last = 999;
+		SpinSize = 1;
+
+	};
+	MetricField MF_BELOW_PARASPACING
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MBX_BOT_DIST_X, MBX_BOT_DIST_Y );
+        Size = MAP_APPFONT ( CONTROL_WIDTH -10,MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Below Paragraph Spacing";
+        HelpID = HID_POPUP_PS_ED_SBINDE_BOTTOMDIST ;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 999;
+		Unit = FUNIT_INCH;
+		Last = 999;
+		SpinSize = 1;
+	};
+	FixedText FT_INDENT
+	{
+	    Pos = MAP_APPFONT ( FT_PARA_INDENT_X, FT_PARA_INDENT_Y );
+        Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50, _FIXED_TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Indent:";
+	};
+	ToolBox TBX_INDENT_INC_DEC
+	{
+		Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y );
+		Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC ;
+		Text = "Indent";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_INDENT_INC ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC ;
+				Text [ en-US ] = "Increase Indent" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Indent_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_INDENT_DEC ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC ;
+				Text [ en-US ] = "Decrease Indent" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Outdent_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = ID_HANGING_INDENT ;
+				Text [ en-US ] = "Switch to Hanging Indent" ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Indent_Hanging.png";
+				};
+			};
+		};		
+	};
+	ToolBox TBX_INDENT_PRO_DEMOTE
+	{
+		Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y );
+		Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC ;
+		Text = "Indent";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_INDENT_PROMOTE ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC ;
+				Text [ en-US ] = "Increase Indent" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Indent_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = BT_TBX_INDENT_DEMOTE ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC ;
+				Text [ en-US ] = "Decrease Indent" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Outdent_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = SD_HANGING_INDENT ;
+				Text [ en-US ] = "Switch to Hanging Indent" ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG ; 
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/Indent_Hanging.png";
+				};
+			};
+		};		
+	};
+	MetricField MF_BEFORE_INDENT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MBX_LEFT_DIST_X, MBX_LEFT_DIST_Y );
+        Size = MAP_APPFONT ( CONTROL_WIDTH - 10,MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Before Text Indent";
+        HelpID = HID_POPUP_INDENT_ED_INDENT_LEFTINDENT ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 9999 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_INCH;
+		Last = 9999 ;
+		SpinSize = 2 ;
+	};
+    MetricField MF_AFTER_INDENT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MBX_RIGHT_DIST_X, MBX_RIGHT_DIST_Y );
+        Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "After Text Indent";
+        HelpID = HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 9999 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_INCH;
+		Last = 9999 ;
+		SpinSize = 2 ;
+	};
+    MetricField MF_FL_INDENT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MBX_FLINE_DIST_X, MBX_FLINE_DIST_Y );
+        Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "First Line Indent";
+        HelpID = HID_POPUP_INDENT_ED_INDENT_FLINDENT ;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Minimum = -9999;
+		Maximum = 9999 ;
+		DecimalDigits = 2;
+		Unit = FUNIT_INCH;
+		First = -9999;
+		Last = 9999 ;
+		SpinSize = 2 ;
+	};
+	ToolBox TBX_LINESP
+	{
+	    Pos = MAP_APPFONT ( TBX_LINE_SPACE_X, TBX_LINE_SPACE_Y);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		Size = MAP_APPFONT (TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
+		HelpID = HID_PPROPERTYPANEL_PARA_TBX_LINESP ;
+		Text = "Line Spacing" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = BT_BTX_LINESP ;
+				HelpID = HID_PPROPERTYPANEL_PARA_TBI_LINESP ;
+				Text [ en-US ] = "Line Spacing" ;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/lpsmall-spacing-1.png" ;
+				};
+				DropDown = TRUE;
+			};
+		};
+	};
+	FixedImage FI_INDENT1
+    {
+        Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE1_Y );
+        Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE );
+    };
+    FixedImage FI_INDENT2
+    {
+        Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE2_Y );
+        Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE );
+    };
+    FixedImage FI_INDENT3
+    {
+        Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT1_Y );
+        Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE );
+    };
+    FixedImage FI_SPACE1
+    {
+        Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT2_Y );
+        Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE );
+    };
+    FixedImage FI_SPACE2
+    {
+        Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT3_Y );
+        Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE );
+    };
+	
+	ImageList IL_VERT_ALIGN
+	{
+        Prefix = "symphony/para_vert";
+		MaskColor = STD_MASKCOLOR ;
+        SVX_PROPERTYPANEL_PARA_VERT_IDLIST
+    };
+    ImageList ILH_VERT_ALIGN
+	{
+        Prefix = "symphony/para_verth";
+		MaskColor = STD_MASKCOLOR ;
+        SVX_PROPERTYPANEL_PARA_VERT_IDLIST
+    };
+    
+	ImageList IL_NUM_BULLET
+	{
+        Prefix = "symphony/para_numbullet";
+		MaskColor = STD_MASKCOLOR ;
+        SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST
+    };
+    ImageList ILH_NUM_BULLET
+	{
+        Prefix = "symphony/para_numbulleth";
+		MaskColor = STD_MASKCOLOR ;
+        SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST
+    };    
+    //for sym2_7380
+    ImageList IL_NUM_BULLET_RTL
+	{
+        Prefix = "symphony/para_numbullet_rtl";
+		MaskColor = STD_MASKCOLOR ;
+        SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL
+    };
+    //end
+    Image IMG_BACK_COLOR
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_backgroundcolor.bmp";};
+	};
+	Image IMG_BACK_COLOR_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sch_backgroundcolor.bmp";};
+	};	
+	Image IMG_SPACE1   
+	{
+	    ImageBitmap = Bitmap{File = "symphony/spacing1.png";};
+	};  
+	Image IMG_SPACE2   
+    {
+	    ImageBitmap = Bitmap{File = "symphony/spacing2.png";};
+	};    
+	Image IMG_SPACE3
+	{
+	    ImageBitmap = Bitmap{File = "symphony/spacing3.png";};
+	};  					
+    Image IMG_INDENT1 
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Indent2.png";};
+	};       
+    Image IMG_INDENT2  
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Indent3.png";};
+	};            
+    Image IMG_INDENT3
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Indent4.png";};
+	};
+	Image IMG_LEFT_PARA
+    { 
+        ImageBitmap = Bitmap{File = "symphony/AlignTextLeft_16x16.png";};
+	};
+	Image IMG_CENTER_PARA 
+    {
+		ImageBitmap = Bitmap{File = "symphony/AlignTextCenter_16x16.png";};
+	};
+	Image IMG_RIGHT_PARA 
+    {
+		ImageBitmap = Bitmap{File = "symphony/AlignTextRight_16x16.png";};
+	};
+	Image IMG_JUSTIFY_PARA 
+    {
+	    ImageBitmap = Bitmap{File = "symphony/AlignTextJustified_16x16.png";};
+	};
+	Image IMG_INDENT_INC 
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Indent_16x16.png";};
+	};
+	Image IMG_INDENT_DEC
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Outdent_16x16.png";};
+	};
+	Image IMG_INDENT_INC_BD 
+    {
+	    ImageBitmap = Bitmap{File = "symphony/rte_Indent_16x16.png";};
+	};
+	Image IMG_INDENT_DEC_BD
+    {
+	    ImageBitmap = Bitmap{File = "symphony/rte_Outdent_16x16.png";};
+	};
+	Image IMG_INDENT_HANG
+    {
+	    ImageBitmap = Bitmap{File = "symphony/Indent_Hanging.png";};
+	};
+	Image IMG_PARA_INC 
+    {
+	    ImageBitmap = Bitmap{File = "symphony/IncreaseSpace_16x16.png";};
+	};
+	Image IMG_PARA_DEC
+    {
+	    ImageBitmap = Bitmap{File = "symphony/DecreaseSpace_16x16.png";};
+	};	
+};
+
+//===========================================Back color page==============================
+/*
+Control RID_POPUPPANEL_PARAPAGE_BACK_COLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH + POPUP_BORDER_WIDTH , POPUP_COLOR_PICKER_HEIGHT +POPUP_BORDER_HEIGHT );
+	
+	Control VS_FONT_COLOR
+	{
+		HelpID = HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS ;
+	        Hide = TRUE ;
+	        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+	        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT );
+		TabStop = TRUE ;
+		Text = "Color Picker";
+	};
+
+	String STR_NOFILL
+	{
+		Text [ en-US ] = "No Color";
+	};
+		
+};*/
+
+//===========================================Bullet popup page==============================
+Control RID_POPUPPANEL_PARAPAGE_BULLETS
+{
+	DialogControl = TRUE;
+	OutputSize = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT ( POPUP_WIDTH_BULLET , POPUP_HEIGHT_BULLET) ;
+	Control VS_VALUES
+	{
+		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB , POPUPPANEL_MARGIN_NB ) ;
+		Size = MAP_APPFONT ( VS_WIDTH_BULLET ,  VS_HEIGHT_BULLET) ;
+		HelpID = HID_POPUP_BULLET_VS_VALUES ;
+		TabStop = TRUE ;
+		Text = "Bullet";
+	};
+	PushButton CB_BULLET_MORE
+	{
+		Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB, VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 2 ) ;
+		Size = MAP_APPFONT (POPUP_WIDTH_BULLET - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ;
+		HelpID = HID_POPUP_BULLET_CB_BULLET_MORE ;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~More Options";
+	};	
+    Bitmap	BMP_BULLET_MORE
+	{
+		File = "symphony/__morebutton.bmp";
+	};
+	Bitmap	BMP_BULLET_MORE_H
+	{
+		File = "symphony/__morebutton_h.bmp";
+	};	
+};
+
+String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0
+{
+    Text [en-US] = "large square bullets";
+};
+
+String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1
+{
+    Text [en-US] = "graphic bullets";
+};
+
+String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2
+{
+    Text [en-US] = "graphic bullets";
+};
+
+String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3
+{
+    Text [en-US] = "graphic bullets";
+};
+
+String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4
+{
+    Text [en-US] = "graphic bullets";
+};
+
+//===========================================Numbering popup page==============================
+Control RID_POPUPPANEL_PARAPAGE_NUMBERING
+{
+	SVLook = TRUE ;
+	DialogControl = TRUE;
+	OutputSize = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT ( POPUP_WIDTH_NUM , POPUP_HEIGHT_NUM) ;
+	Control VS_NUMBERING
+	{
+		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB, POPUPPANEL_MARGIN_NB ) ;
+		Size = MAP_APPFONT ( VS_WIDTH_NUM ,  VS_HEIGHT_NUM) ;
+		HelpID = HID_POPUP_NUM_VS_NUMBERING ;
+		TabStop = TRUE ;
+		Text = "Numbering";
+	};
+	PushButton CB_NUMBERING_MORE
+	{
+		Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB,  VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 2 ) ;
+		Size = MAP_APPFONT (POPUP_WIDTH_NUM - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ;
+		HelpID = HID_POPUP_NUM_CB_NUMBERING_MORE ;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~More Options";
+	};	
+    Bitmap	BMP_NUMERING_MORE
+	{
+		File = "symphony/__morebutton.bmp";
+	};
+	Bitmap	BMP_NUMERING_MORE_H
+	{
+		File = "symphony/__morebutton_h.bmp";
+	};	
+};
+
+//===========================================Line Space popup page==============================
+Control RID_POPUPPANEL_PARAPAGE_LINESPACING
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH, POPUP_PAGE_HEIGHT );
+	
+	Control LINE_SPACING
+	{
+		Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( VS_SPACING_WIDTH  , 17 * 5);
+		TabStop = TRUE ;
+		Text = "Line Spacing";
+	};
+	
+	FixedText FT_CUSTOM
+	{
+	    Pos = MAP_APPFONT ( POP_FT_CUSTOM_X, POP_FT_CUSTOM_Y );
+        Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50 , _FIXED_TEXT_HEIGHT) ;
+		Text [ en-US ] = "Custom:";
+	};
+    FixedText FT_LINE_SPACING
+	{
+	    Pos = MAP_APPFONT ( FT_1_X, FT_1_Y );
+        Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 10, _FIXED_TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Line Spacing:";
+	};
+
+	FixedText FT_OF
+	{
+	    Pos = MAP_APPFONT ( FT_2_X, FT_2_Y );
+        Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH , _FIXED_TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Of:";
+	};
+	
+	ListBox LB_LINE_SPACING
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( EDIT_1_X, EDIT_1_Y );
+        Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,LISTBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		HelpID = HID_POPUP_LS_LB_LINE_SPACING ;
+        StringList [ en-US ] =
+        {
+			< "Single" ; Default ; > ;
+			< "1.5 Lines" ; Default ; > ;
+			< "Double" ; Default ; > ;
+            < "Proportional" ; Default ; > ;
+            < "At least" ; Default ; > ;
+            < "Leading" ; Default ; > ;
+            < "Fixed" ; Default ; > ;
+        };
+	};
+	MetricField ED_SBINDE_LINEDISTPERCENT
+	{
+		Disable = TRUE;
+		Border = TRUE;
+		Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y );
+        Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,MBOX_HEIGHT ) ;
+        HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT ;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Minimum = 50;
+		Maximum = 200;
+		Value = 100;
+		StrictFormat = TRUE;
+		Unit = FUNIT_CUSTOM ;
+		CustomUnitText = "%";
+		First = 50;
+		Last = 200;
+		SpinSize = 1;
+	};
+	MetricField ED_SBINDE_LINEDISTPOINT
+	{
+		Disable = TRUE;
+		Border = TRUE;
+		Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y );
+        Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2, MBOX_HEIGHT ) ;
+        HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT ;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_INCH;
+		Last = 9999;
+		SpinSize = 2;
+	};
+	Image IMG_SPACING1
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpspacing-1.png";};
+	};
+	Image IMG_SPACING115
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpspacing-1_15.png";};
+	};
+	Image IMG_SPACING15
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpspacing-1_5.png";};
+	};
+	Image IMG_SPACING2
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpspacing-2.png";};
+	};
+	Image IMG_SEL_SPACING1
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1.png";};
+	};
+	Image IMG_SEL_SPACING115
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_15.png";};
+	};
+	Image IMG_SEL_SPACING15
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_5.png";};
+	};
+	Image IMG_SEL_SPACING2
+	{
+	    ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-2.png";};
+	};
+    Image IMG_CUSTOM
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";};
+	};
+	Image IMG_CUSTOM_GRAY
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";};
+	};
+	String STR_LS_SINGLE
+    {
+        Text [ en-US ] = "Line spacing: Single";
+    };
+    String STR_LS_115
+    {
+        Text [ en-US ] = "Line spacing: 1.15 Lines";
+    };
+    String STR_LS_15
+    {
+        Text [ en-US ] = "Line spacing: 1.5 Lines";
+    };
+    String STR_LS_DOUBLE
+    {
+        Text [ en-US ] = "Line spacing: Double";
+    };
+    String STR_LSPACING
+    {
+        Text [ en-US ] = "Line spacing:";
+    };
+    String STR_LS_OF
+    {
+        Text [ en-US ] = "of:";
+    };
+    String STR_SPACING1
+    {
+        Text [ en-US ] = "Spacing: 1";
+    };
+    String STR_SPACING115
+    {
+        Text [ en-US ] = "Spacing: 1.15";
+    };
+    String STR_SPACING15
+    {
+        Text [ en-US ] = "Spacing: 1.5";
+    };
+    String STR_SPACING2
+    {
+        Text [ en-US ] = "Spacing: 2";
+    };
+    String STR_LCVALUE
+    {
+        Text [ en-US ] = "Last Custom Value";
+    };
+
+};
+
+String RID_SVXSTR_NUMBULLET_NONE
+{
+    Text [en-US] = "None";
+};
+
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_0
+{
+    Text [en-US] = "Dark Red Circle";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_1
+{
+    Text [en-US] = "Blue Ball";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_2
+{
+    Text [en-US] = "Green Ball";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_3
+{
+    Text [en-US] = "Black Square";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_4
+{
+    Text [en-US] = "Orange";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_5
+{
+    Text [en-US] = "Purple Square";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_6
+{
+    Text [en-US] = "Diamond Blue";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_7
+{
+    Text [en-US] = "Light Blue Diamond";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_8
+{
+    Text [en-US] = "Red Diamond";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_9
+{
+    Text [en-US] = "Yellow Star";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_10
+{
+    Text [en-US] = "Blue Star";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_11
+{
+    Text [en-US] = "Blue Triangle";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_12
+{
+    Text [en-US] = "Dark Green Triangle";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_13
+{
+    Text [en-US] = "Red Arrow";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_14
+{
+    Text [en-US] = "Blue Arrow";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_15
+{
+    Text [en-US] = "Blue Box";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_16
+{
+    Text [en-US] = "Red Box";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_17
+{
+    Text [en-US] = "Light Blue Asterisk";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_18
+{
+    Text [en-US] = "Red Leaves";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_19
+{
+    Text [en-US] = "Blue Target";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_20
+{
+    Text [en-US] = "Blue Arrow";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_21
+{
+    Text [en-US] = "Dark Blue Arrow";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_22
+{
+    Text [en-US] = "Brown Arrow";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_23
+{
+    Text [en-US] = "Red Flag";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_24
+{
+    Text [en-US] = "Green Flag";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_25
+{
+    Text [en-US] = "Red X";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_26
+{
+    Text [en-US] = "Black X";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_27
+{
+    Text [en-US] = "Green Checkmark";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_28
+{
+    Text [en-US] = "Blue Checkmark";
+};
+String RID_SVXSTR_GRAPHICS_DESCRIPTION_29
+{
+    Text [en-US] = "Dark Red Square";
+};
\ No newline at end of file
diff --git a/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
new file mode 100644
index 0000000..1fb230f
--- /dev/null
+++ b/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -0,0 +1,1229 @@
+/**************************************************************
+ * 
+ * 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 <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include "PosSizePropertyPanel.hxx"
+#include "PosSizePropertyPanel.hrc"
+#include <svx/sidebar/SidebarDialControl.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/dlgutil.hxx>
+#include <unotools/viewoptions.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/svdview.hxx>
+#include <svl/aeitem.hxx>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+#define USERITEM_NAME rtl::OUString::createFromAscii("FitItem")
+#define NO_SELECT       (65535)
+
+
+
+namespace svx { namespace sidebar {
+
+
+
+PosSizePropertyPanel::PosSizePropertyPanel(
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+:   Control(
+        pParent, 
+        SVX_RES(RID_SIDEBAR_POSSIZE_PANEL)),
+    mpFtPosX(new FixedText(this, SVX_RES(FT_SBSHAPE_HORIZONTAL))),
+    mpMtrPosX(new MetricField(this, SVX_RES(MF_SBSHAPE_HORIZONTAL))),
+    mpFtPosY(new FixedText(this, SVX_RES(FT_SBSHAPE_VERTICAL))),
+    mpMtrPosY(new MetricField(this, SVX_RES(MF_SBSHAPE_VERTICAL))),
+    mpFtWidth(new FixedText(this, SVX_RES(FT_WIDTH))),
+    mpMtrWidth(new MetricField(this, SVX_RES(MTR_FLD_WIDTH))),
+    mpFtHeight(new FixedText(this, SVX_RES(FT_HEIGHT))),
+    mpMtrHeight(new MetricField(this, SVX_RES(MTR_FLD_HEIGHT))),
+    mpCbxScale(new CheckBox(this, SVX_RES(CBX_SCALE))),
+    mpFtAngle(new FixedText(this, SVX_RES(FT_ANGLE))),
+    mpMtrAngle(new MetricBox(this, SVX_RES(MTR_FLD_ANGLE))),
+    mpDial(new SidebarDialControl(this, SVX_RES(DIAL_CONTROL))),
+    mpFtFlip(new FixedText(this, SVX_RES(FT_FLIP))),
+    mpFlipTbxBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
+    mpFlipTbx(sfx2::sidebar::ControlFactory::CreateToolBox(mpFlipTbxBackground.get(), SVX_RES(TBX_FLIP))),
+    maRect(),
+    mpView(0),
+    mlOldWidth(1),
+    mlOldHeight(1),
+    meRP(RP_LT),
+    maAnchorPos(),
+    mlRotX(0),
+    mlRotY(0),
+    maUIScale(),
+    mePoolUnit(),
+    meDlgUnit(),
+    maTransfPosXControl(SID_ATTR_TRANSFORM_POS_X, *pBindings, *this),
+    maTransfPosYControl(SID_ATTR_TRANSFORM_POS_Y, *pBindings, *this),
+    maTransfWidthControl(SID_ATTR_TRANSFORM_WIDTH, *pBindings, *this),
+    maTransfHeightControl(SID_ATTR_TRANSFORM_HEIGHT, *pBindings, *this),
+    maSvxAngleControl( SID_ATTR_TRANSFORM_ANGLE, *pBindings, *this),
+    maRotXControl(SID_ATTR_TRANSFORM_ROT_X, *pBindings, *this),
+    maRotYControl(SID_ATTR_TRANSFORM_ROT_Y, *pBindings, *this),
+    maProPosControl(SID_ATTR_TRANSFORM_PROTECT_POS, *pBindings, *this),
+    maProSizeControl(SID_ATTR_TRANSFORM_PROTECT_SIZE, *pBindings, *this),
+    maAutoWidthControl(SID_ATTR_TRANSFORM_AUTOWIDTH, *pBindings, *this),
+    maAutoHeightControl(SID_ATTR_TRANSFORM_AUTOHEIGHT, *pBindings, *this),
+    m_aMetricCtl(SID_ATTR_METRIC, *pBindings, *this),
+    maImgFlipHori(SVX_RES(IMG_HORI_FLIP)),
+    maImgFlipVert(SVX_RES(IMG_VERT_FLIP)),
+    mxFrame(rxFrame),
+    maContext(),
+    mpBindings(pBindings),
+    mbMtrPosXMirror(false),
+    mbSizeProtected(false),
+    mbPositionProtected(false),
+    mbAutoWidth(false),
+    mbAutoHeight(false),
+    mbAdjustEnabled(false),
+    mbIsFlip(false),
+    mbInDestructor(false),
+    mxSidebar(rxSidebar)
+{
+	Initialize();
+	FreeResource();
+
+    mpBindings->Update( SID_ATTR_TRANSFORM_WIDTH );
+    mpBindings->Update( SID_ATTR_TRANSFORM_HEIGHT );
+    mpBindings->Update( SID_ATTR_TRANSFORM_PROTECT_SIZE );
+    mpBindings->Update( SID_ATTR_METRIC );
+}
+
+
+
+PosSizePropertyPanel::~PosSizePropertyPanel()
+{
+    mbInDestructor = true;
+
+    // Destroy the background windows of the toolboxes.
+    mpFlipTbx.reset();
+    mpFlipTbxBackground.reset();
+}
+
+
+
+void PosSizePropertyPanel::ShowMenu (void)
+{
+    if (mpBindings != NULL)
+    {
+        SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
+        if (pDispatcher != NULL)
+            pDispatcher->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON);
+    }
+}
+
+
+
+void PosSizePropertyPanel::Initialize()
+{
+    mpFtPosX->SetBackground(Wallpaper());
+    mpFtPosY->SetBackground(Wallpaper());
+    mpFtWidth->SetBackground(Wallpaper());
+    mpFtHeight->SetBackground(Wallpaper());
+    mpFtAngle->SetBackground(Wallpaper());
+    mpFtFlip->SetBackground(Wallpaper());
+
+        //Position : Horizontal / Vertical
+	mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) );
+	mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) );
+	mpMtrPosX->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Horizontal")));	//wj acc
+	mpMtrPosY->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Vertical")));		//wj acc
+	
+    //Size : Width / Height
+	mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) );
+	mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) );
+	mpMtrWidth->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")));	//wj acc
+	mpMtrHeight->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")));	//wj acc
+	
+    //Size : Keep ratio
+	mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) );
+	
+    //rotation:
+	mpMtrAngle->SetModifyHdl(LINK( this, PosSizePropertyPanel, AngleModifiedHdl));
+	mpMtrAngle->EnableAutocomplete( false );
+	mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rotation")));	//wj acc
+	
+    //rotation control
+	mpDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl));
+	
+    //flip:
+	mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) );
+	mpFlipTbx->SetItemImage(FLIP_HORIZONTAL,maImgFlipHori);
+    mpFlipTbx->SetItemImage(FLIP_VERTICAL,maImgFlipVert);
+	mpFlipTbx->SetQuickHelpText(FLIP_HORIZONTAL,String(SVX_RES(STR_QH_HORI_FLIP))); //Add
+	mpFlipTbx->SetQuickHelpText(FLIP_VERTICAL,String(SVX_RES(STR_QH_VERT_FLIP))); //Add
+	
+	mpMtrPosX->SetAccessibleRelationLabeledBy(mpFtPosX.get());	
+	mpMtrPosY->SetAccessibleRelationLabeledBy(mpFtPosY.get());	
+	mpMtrWidth->SetAccessibleRelationLabeledBy(mpFtWidth.get());	
+	mpMtrHeight->SetAccessibleRelationLabeledBy(mpFtHeight.get());	
+	mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtAngle.get());
+#ifdef HAS_IA2
+	mpMtrAngle->SetMpSubEditAccLableBy(mpFtAngle.get());
+#endif
+	mpFlipTbx->SetAccessibleRelationLabeledBy(mpFtFlip.get());
+
+    mpMtrAngle->InsertValue(0, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(4500, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(9000, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(13500, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(18000, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(22500, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(27000, FUNIT_CUSTOM);
+	mpMtrAngle->InsertValue(31500, FUNIT_CUSTOM);
+    mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
+
+    SfxViewShell* pCurSh = SfxViewShell::Current();
+	if ( pCurSh )
+		mpView = pCurSh->GetDrawView();
+	else
+		mpView = NULL;
+
+	if ( mpView != NULL )
+	{
+		maUIScale = mpView->GetModel()->GetUIScale();
+
+		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+		if(1 == rMarkList.GetMarkCount())
+		{
+			const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+			const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+			if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
+			{
+				mbAdjustEnabled = true;
+			}
+		}
+	}
+	
+    mePoolUnit = maTransfWidthControl.GetCoreMetric();
+	meDlgUnit = GetModuleFieldUnit();
+	SetFieldUnit( *mpMtrPosX, meDlgUnit, true );
+	SetFieldUnit( *mpMtrPosY, meDlgUnit, true );
+	SetFieldUnit( *mpMtrWidth, meDlgUnit, true );
+	SetFieldUnit( *mpMtrHeight, meDlgUnit, true );
+}
+
+
+
+void PosSizePropertyPanel::SetupIcons(void)
+{
+    if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+        // todo
+    }
+    else
+    {
+        // todo
+    }
+}
+
+
+
+PosSizePropertyPanel* PosSizePropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to PosSizePropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to PosSizePropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to PosSizePropertyPanel::Create"), NULL, 2);
+    
+    return new PosSizePropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings,
+        rxSidebar);
+}
+
+
+
+void PosSizePropertyPanel::DataChanged(
+    const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+
+
+void PosSizePropertyPanel::HandleContextChange(
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if(maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+
+    sal_Int32 nLayoutMode (0);
+    switch (maContext.GetCombinedContext_DI())
+    {
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Draw):
+            nLayoutMode = 0;
+            break;
+
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Graphic):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Media):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Frame):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_OLE):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Form):
+            nLayoutMode = 1;
+            break;
+
+        case CombinedEnumContext(Application_Calc, Context_Draw):
+        case CombinedEnumContext(Application_Calc, Context_Graphic):
+        case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+        case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
+            nLayoutMode = 2;
+            break;
+
+        case CombinedEnumContext(Application_Calc, Context_Chart):
+        case CombinedEnumContext(Application_Calc, Context_Form):
+        case CombinedEnumContext(Application_Calc, Context_Media):
+        case CombinedEnumContext(Application_Calc, Context_OLE):
+        case CombinedEnumContext(Application_Calc, Context_MultiObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Media):
+        case CombinedEnumContext(Application_DrawImpress, Context_Form):
+        case CombinedEnumContext(Application_DrawImpress, Context_OLE):
+        case CombinedEnumContext(Application_DrawImpress, Context_3DObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_MultiObject):
+            nLayoutMode = 3;
+            break;
+    }    
+    switch (nLayoutMode)
+    {
+        case 0:
+		{
+			mpMtrWidth->SetMin( 2 );
+			mpMtrHeight->SetMin( 2 );
+			mpFtPosX->Hide();
+			mpMtrPosX->Hide();
+			mpFtPosY->Hide();
+			mpMtrPosY->Hide();
+			
+            //rotation
+			mpFtAngle->Show();
+			mpMtrAngle->Show();
+			mpDial->Show();
+			
+            //flip
+			mpFtFlip->Show();
+			mpFlipTbx->Show();
+			Size aTbxSize = mpFlipTbx->CalcWindowSizePixel();
+			mpFlipTbx->SetOutputSizePixel( aTbxSize );
+			mbIsFlip = true;
+
+			mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT)));
+			mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT)));
+			mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT)));
+			mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT)));
+			mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT)));
+
+			mpFtAngle->SetPosPixel(Point(LogicToPixel(Point(FT_ANGLE_X,FT_ANGLE_Y), MAP_APPFONT)));
+			mpMtrAngle->SetPosPixel(Point(LogicToPixel(Point(MF_ANGLE_X2,MF_ANGLE_Y2), MAP_APPFONT)));
+			mpFlipTbx->SetPosPixel(Point(LogicToPixel(Point(FLIP_HORI_X2,FLIP_HORI_Y2), MAP_APPFONT)));
+			mpDial->SetPosPixel(Point(LogicToPixel(Point(ROTATE_CONTROL_X2,ROTATE_CONTROL_Y2), MAP_APPFONT)));
+			mpFtFlip->SetPosPixel(Point(LogicToPixel(Point(FT_FLIP_X2,FT_FLIP_Y2), MAP_APPFONT)));
+
+			Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT2);
+			aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+			SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+		}
+		break;
+
+        case 1:		
+		{
+			mpMtrWidth->SetMin( 2 );
+			mpMtrHeight->SetMin( 2 );
+			mpFtPosX->Hide();
+			mpMtrPosX->Hide();
+			mpFtPosY->Hide();
+			mpMtrPosY->Hide();
+        
+			//rotation
+			mpFtAngle->Hide();
+			mpMtrAngle->Hide();
+			mpDial->Hide();
+        
+			//flip
+			mpFlipTbx->Hide();
+			mpFtFlip->Hide();
+			mbIsFlip = false;
+        
+			mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT)));
+			mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT)));
+			mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT)));
+			mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT)));
+			mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT)));
+        
+			Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT3);
+			aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+			SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+		}
+		break;
+
+        case 2:
+		{
+			mpMtrWidth->SetMin( 1 );
+			mpMtrHeight->SetMin( 1 );
+			mpFtPosX->Show();
+			mpMtrPosX->Show();
+			mpFtPosY->Show();
+			mpMtrPosY->Show();
+        
+			//rotation
+			mpFtAngle->Show();
+			mpMtrAngle->Show();
+			mpDial->Show();
+        
+            //flip
+			mpFlipTbx->Show();
+			mpFtFlip->Show();
+			Size aTbxSize = mpFlipTbx->CalcWindowSizePixel();
+			mpFlipTbx->SetOutputSizePixel( aTbxSize );
+			mbIsFlip = true;
+        
+			Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT);
+			aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+			SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+		}
+		break;
+        
+		case 3:
+		{
+			mpMtrWidth->SetMin( 1 );
+			mpMtrHeight->SetMin( 1 );
+			mpFtPosX->Show();
+			mpMtrPosX->Show();
+			mpFtPosY->Show();
+			mpMtrPosY->Show();
+        
+			//rotation
+			mpFtAngle->Hide();
+			mpMtrAngle->Hide();
+			mpDial->Hide();
+        
+			//flip
+			mpFlipTbx->Hide();
+			mpFtFlip->Hide();
+			mbIsFlip = false;
+        
+			Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT4);
+			aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+			SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+		}
+		break;
+	}
+
+    //Added for windows classic theme
+	mpFlipTbx->SetBackground(Wallpaper());
+	mpFlipTbx->SetPaintTransparent(true);
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, ChangeWidthHdl, void*, /*pBox*/ )
+{
+	if( mpCbxScale->IsChecked() &&
+		mpCbxScale->IsEnabled() )
+	{
+		long nHeight = (long) ( ((double) mlOldHeight * (double) mpMtrWidth->GetValue()) / (double) mlOldWidth );
+		if( nHeight <= mpMtrHeight->GetMax( FUNIT_NONE ) )
+		{
+			mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE );
+		}
+		else
+		{
+			nHeight = (long)mpMtrHeight->GetMax( FUNIT_NONE );
+			mpMtrHeight->SetUserValue( nHeight );
+			const long nWidth = (long) ( ((double) mlOldWidth * (double) nHeight) / (double) mlOldHeight );
+			mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE );
+		}
+	}
+	executeSize();
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, ChangeHeightHdl, void *, EMPTYARG )
+{
+	if( mpCbxScale->IsChecked() &&
+		mpCbxScale->IsEnabled() )
+	{
+		long nWidth = (long) ( ((double)mlOldWidth * (double)mpMtrHeight->GetValue()) / (double)mlOldHeight );
+		if( nWidth <= mpMtrWidth->GetMax( FUNIT_NONE ) )
+		{
+			mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE );
+		}
+		else
+		{
+			nWidth = (long)mpMtrWidth->GetMax( FUNIT_NONE );
+			mpMtrWidth->SetUserValue( nWidth );
+			const long nHeight = (long) ( ((double)mlOldHeight * (double)nWidth) / (double)mlOldWidth );
+			mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE );
+		}
+	}
+	executeSize();
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, ChangePosXHdl, void *, EMPTYARG )
+{
+	executePosX();
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, ChangePosYHdl, void *, EMPTYARG )
+{
+	executePosY();
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, ClickAutoHdl, void *, EMPTYARG )
+{
+	if ( mpCbxScale->IsChecked() )
+	{
+		mlOldWidth  = Max( GetCoreValue( *mpMtrWidth,  mePoolUnit ), 1L );
+		mlOldHeight = Max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L );
+	}
+
+	// mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
+	SvtViewOptions	aPageOpt( E_TABPAGE, String::CreateFromInt32( RID_SVXPAGE_POSITION_SIZE ) );
+	aPageOpt.SetUserItem( USERITEM_NAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( String::CreateFromInt32( mpCbxScale->IsChecked() ) ) ) );
+
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG )
+{
+	String sTmp = mpMtrAngle->GetText();
+	bool    bNegative = 0;
+	sal_Unicode nChar = sTmp.GetChar( 0 );
+
+	if( nChar == '-' )
+	{
+		bNegative = 1;
+		nChar = sTmp.GetChar( 1 );
+	}
+
+	if( (nChar < '0') || (nChar > '9') )
+		return 0;
+	double dTmp = sTmp.ToDouble();
+	if(bNegative)
+	{
+		while(dTmp<0)
+			dTmp += 360;
+	}
+	sal_Int64 nTmp = dTmp*100;
+
+	SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp);
+	SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX);
+	SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY);
+	
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L );
+
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG )
+{
+	sal_Int32 nTmp = mpDial->GetRotation();
+
+	SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp);
+	SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX);
+	SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY);
+	
+	GetBindings()->GetDispatcher()->Execute(
+		SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L );
+
+	return 0;
+}
+
+
+
+IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox )
+{
+	switch (pBox->GetCurItemId())
+	{
+		case FLIP_HORIZONTAL:
+		{
+			SfxVoidItem aHoriItem (SID_FLIP_HORIZONTAL);
+			GetBindings()->GetDispatcher()->Execute(
+				SID_FLIP_HORIZONTAL, SFX_CALLMODE_RECORD, &aHoriItem, 0L );
+		}
+		break;
+		case FLIP_VERTICAL:
+		{
+			SfxVoidItem aVertItem (SID_FLIP_VERTICAL );
+			GetBindings()->GetDispatcher()->Execute(
+				SID_FLIP_VERTICAL, SFX_CALLMODE_RECORD, &aVertItem, 0L );
+		}
+		break;
+	}
+	return 0;
+}
+
+
+
+void PosSizePropertyPanel::NotifyItemUpdate( 
+    sal_uInt16 nSID, 
+    SfxItemState eState, 
+    const SfxPoolItem* pState)
+{  
+	mpFtAngle->Enable();
+	mpMtrAngle->Enable();
+	mpDial->Enable();
+	mpFtFlip->Enable();
+	mpFlipTbx->Enable();
+
+    const SfxUInt32Item*	pWidthItem;
+	const SfxUInt32Item*	pHeightItem;		
+	
+	SfxViewShell* pCurSh = SfxViewShell::Current();
+	if ( pCurSh )
+		mpView = pCurSh->GetDrawView();
+	else
+		mpView = NULL;
+
+	if ( mpView == NULL )
+		return;
+
+	const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+	if(1 == rMarkList.GetMarkCount())
+	{
+		const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+		const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+		if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
+			mbAdjustEnabled = true;
+		else
+			mbAdjustEnabled = false;
+	}
+	else
+		mbAdjustEnabled = false;
+
+	switch (nSID)
+    {
+        case SID_ATTR_TRANSFORM_WIDTH:
+            if ( SFX_ITEM_AVAILABLE == eState )
+            {
+                pWidthItem = dynamic_cast< const SfxUInt32Item* >(pState);
+
+                if(pWidthItem)
+                {
+                    long mlOldWidth1 = pWidthItem->GetValue();
+
+                    mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale;
+                    SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit );
+                    mlOldWidth = mlOldWidth1;
+                    break;
+                }
+            }
+
+            mpMtrWidth->SetText( String());
+            break;
+            
+        case SID_ATTR_TRANSFORM_HEIGHT:
+            if ( SFX_ITEM_AVAILABLE == eState )
+            {
+                pHeightItem = dynamic_cast< const SfxUInt32Item* >(pState);
+
+                if(pHeightItem)
+                {
+                    long mlOldHeight1 = pHeightItem->GetValue();
+
+                    mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale;
+                    SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit );
+                    mlOldHeight = mlOldHeight1;
+                    break;
+                }
+            }
+
+            mpMtrHeight->SetText( String());
+            break;
+
+        case SID_ATTR_TRANSFORM_POS_X:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState);
+
+                if(pItem)
+                {
+                    long nTmp = pItem->GetValue(); 
+                    nTmp = Fraction( nTmp ) / maUIScale;
+                    SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit );
+                    break;
+                }
+            }
+
+            mpMtrPosX->SetText( String());
+            break;
+
+        case SID_ATTR_TRANSFORM_POS_Y:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState);
+
+                if(pItem)
+                {
+                    long nTmp = pItem->GetValue(); 
+                    nTmp = Fraction( nTmp ) / maUIScale;
+                    SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit );
+                    break;
+                }
+            }
+
+            mpMtrPosY->SetText( String());
+            break;
+
+        case SID_ATTR_TRANSFORM_ROT_X:
+            if (SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState);
+
+                if(pItem)
+                {
+                    mlRotX = pItem->GetValue(); 
+                    mlRotX = Fraction( mlRotX ) / maUIScale;
+                }
+            }
+            break;
+
+        case SID_ATTR_TRANSFORM_ROT_Y:
+            if (SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState);
+
+                if(pItem)
+                {
+                    mlRotY = pItem->GetValue(); 
+                    mlRotY = Fraction( mlRotY ) / maUIScale;
+                }
+            }
+            break;
+
+        case SID_ATTR_TRANSFORM_PROTECT_POS:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState);
+
+                if(pItem)
+                {
+                    // record the state of position protect
+                    mbPositionProtected = pItem->GetValue();
+                    break;
+                }
+            }
+
+            mbPositionProtected = false;
+            break;
+
+        case SID_ATTR_TRANSFORM_PROTECT_SIZE:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState);
+
+                if(pItem)
+                {
+                    // record the state of size protect
+                    mbSizeProtected = pItem->GetValue();
+                    break;
+                }
+            }
+
+            mbSizeProtected = false;
+            break;
+
+        case SID_ATTR_TRANSFORM_AUTOWIDTH:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState);
+
+                if(pItem)
+                {
+                    mbAutoWidth = pItem->GetValue();
+                }
+            }
+            break;
+
+        case SID_ATTR_TRANSFORM_AUTOHEIGHT:
+            if(SFX_ITEM_AVAILABLE == eState)
+            {
+                const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState);
+
+                if(pItem)
+                {
+                    mbAutoHeight = pItem->GetValue();
+                }
+            }
+            break;
+
+        case SID_ATTR_TRANSFORM_ANGLE:
+            if (eState >= SFX_ITEM_AVAILABLE)
+            {
+                const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState);
+
+                if(pItem)
+                {
+                    long nTmp = pItem->GetValue(); 
+
+                    mpMtrAngle->SetValue( nTmp );
+                    mpDial->SetRotation( nTmp );
+
+                    switch(nTmp)
+                    {
+                        case 0:
+                            mpMtrAngle->SelectEntryPos(0);
+                            break;
+                        case 4500:
+                            mpMtrAngle->SelectEntryPos(1);
+                            break;
+                        case 9000:
+                            mpMtrAngle->SelectEntryPos(2);
+                            break;
+                        case 13500:
+                            mpMtrAngle->SelectEntryPos(3);
+                            break;
+                        case 18000:
+                            mpMtrAngle->SelectEntryPos(4);
+                            break;
+                        case 22500:
+                            mpMtrAngle->SelectEntryPos(5);
+                            break;
+                        case 27000:
+                            mpMtrAngle->SelectEntryPos(6);
+                            break;
+                        case 315000:
+                            mpMtrAngle->SelectEntryPos(7);
+                    }
+
+                    break;
+                }
+            }
+
+            mpMtrAngle->SetText( String() );
+            mpDial->SetRotation( 0 );
+            break;
+            
+        case SID_ATTR_METRIC:
+            MetricState( eState, pState );
+            break;
+
+        default:
+            break;
+    }
+
+    const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
+
+    switch (rMarkList.GetMarkCount())
+    {
+        case 0:
+            break;
+
+        case 1:
+        {
+            const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+            const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+            if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) 
+               || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject)
+                 ) && OBJ_EDGE == eKind)
+               || OBJ_CAPTION == eKind)
+            {
+                mpFtAngle->Disable();
+                mpMtrAngle->Disable();
+                mpDial->Disable();
+                mpFlipTbx->Disable();
+                mpFtFlip->Disable();
+            }
+            break;
+        }
+        
+        default:
+        {
+            sal_uInt16 nMarkObj = 0;
+            bool isNoEdge = true;
+            while(rMarkList.GetMark(nMarkObj))
+            {
+                const SdrObject* pObj = rMarkList.GetMark(nMarkObj)->GetMarkedSdrObj();
+                const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+                if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw)
+                  || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject)
+                     ) && OBJ_EDGE == eKind)
+                  || OBJ_CAPTION == eKind)
+                {
+                    isNoEdge = false;
+                    break;
+                }
+                nMarkObj++;
+            }
+            if(!isNoEdge)
+            {
+                mpFtAngle->Disable();
+                mpMtrAngle->Disable();
+                mpDial->Disable();
+                mpFlipTbx->Disable();
+                mpFtFlip->Disable();
+            }
+            break;
+        }
+    }
+
+    if(nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject))
+	{
+		mpFlipTbx->Disable();
+		mpFtFlip->Disable();
+	}
+
+    DisableControls();
+
+	// mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
+	SvtViewOptions	aPageOpt( E_TABPAGE, String::CreateFromInt32( RID_SVXPAGE_POSITION_SIZE ) );
+	String	sUserData;
+	::com::sun::star::uno::Any	aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
+	::rtl::OUString	aTemp;
+	if ( aUserItem >>= aTemp )
+		sUserData = String( aTemp );
+	mpCbxScale->Check( (bool)sUserData.ToInt32() );
+}
+
+
+
+SfxBindings* PosSizePropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+
+
+void PosSizePropertyPanel::executeSize()
+{
+	if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified())
+	{
+		Fraction aUIScale = mpView->GetModel()->GetUIScale();
+
+		// get Width
+		double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit );
+		nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+		long lWidth = (long)(nWidth * (double)aUIScale);
+		lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit );
+		lWidth = (long)mpMtrWidth->Denormalize( lWidth );
+
+		// get Height
+		double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit );
+		nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+		long lHeight = (long)(nHeight * (double)aUIScale);
+		lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit );
+		lHeight = (long)mpMtrWidth->Denormalize( lHeight );
+
+		// put Width & Height to itemset
+		SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth);
+		SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight);
+		SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)meRP);
+        const sal_Int32 nCombinedContext(maContext.GetCombinedContext());
+
+        if( nCombinedContext == CombinedEnumContext(Application_Writer, Context_Graphic) // mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC 
+            || nCombinedContext == CombinedEnumContext(Application_Writer, Context_OLE) //mnContextId == PROPERTY_CONTEXT_SW_OLE
+            )
+        // if( mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC || mnContextId == PROPERTY_CONTEXT_SW_OLE )
+        {
+			GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L );
+        }
+		else
+		{
+			if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified()))
+				GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L );
+			else if( mpMtrWidth->IsValueModified())
+				GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aPointItem, 0L );
+			else if ( mpMtrHeight->IsValueModified())
+				GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aHeightItem, &aPointItem, 0L );
+		}		
+	}
+}
+
+
+
+void PosSizePropertyPanel::executePosX()
+{
+	if ( mpMtrPosX->IsValueModified())
+	{
+		long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
+		if( mbMtrPosXMirror )
+			lX = -lX;
+		long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
+
+		Size aPageSize;
+		Rectangle aRect;
+		maRect = mpView->GetAllMarkedRect();	
+		aRect = mpView->GetAllMarkedRect();
+
+		Fraction aUIScale = mpView->GetModel()->GetUIScale();
+		lX += maAnchorPos.X();
+		lX = Fraction( lX ) * aUIScale;
+		lY += maAnchorPos.Y();
+		lY = Fraction( lY ) * aUIScale;
+		
+		SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
+		SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
+	
+		GetBindings()->GetDispatcher()->Execute(
+			SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosXItem, 0L );	
+	}
+}
+
+
+
+void PosSizePropertyPanel::executePosY()
+{
+	if ( mpMtrPosY->IsValueModified() )
+	{
+		long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
+		long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
+
+		Size aPageSize;
+		Rectangle aRect;
+		maRect = mpView->GetAllMarkedRect();	
+		aRect = mpView->GetAllMarkedRect();
+
+		Fraction aUIScale = mpView->GetModel()->GetUIScale();
+		lX += maAnchorPos.X();
+		lX = Fraction( lX ) * aUIScale;
+		lY += maAnchorPos.Y();
+		lY = Fraction( lY ) * aUIScale;
+		
+		SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
+		SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
+	
+		GetBindings()->GetDispatcher()->Execute(
+			SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosYItem, 0L );	
+	}
+}
+
+
+
+void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState )
+{
+	bool bPosXBlank = false;
+	bool bPosYBlank = false;
+	bool bWidthBlank = false;
+	bool bHeightBlank = false;
+	String sNull = String::CreateFromAscii("");
+	meDlgUnit = GetCurrentUnit(eState,pState);
+
+	if( mpMtrPosX->GetText() == sNull )
+		bPosXBlank = true;
+	SetFieldUnit( *mpMtrPosX, meDlgUnit, true );
+	if(bPosXBlank)
+		mpMtrPosX->SetText(String());
+
+	if( mpMtrPosY->GetText() == sNull )
+		bPosYBlank = true;
+	SetFieldUnit( *mpMtrPosY, meDlgUnit, true );
+	if(bPosYBlank)
+		mpMtrPosY->SetText(String());
+
+	if( mpMtrWidth->GetText() == sNull )
+		bWidthBlank = true;
+	SetFieldUnit( *mpMtrWidth, meDlgUnit, true );
+	if(bWidthBlank)
+		mpMtrWidth->SetText(String());
+
+	if( mpMtrHeight->GetText() == sNull )
+		bHeightBlank = true;
+	SetFieldUnit( *mpMtrHeight, meDlgUnit, true );
+	if(bHeightBlank)
+		mpMtrHeight->SetText(String());
+}
+
+
+
+FieldUnit PosSizePropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
+{
+	FieldUnit eUnit = FUNIT_NONE;
+
+	if ( pState && eState >= SFX_ITEM_DEFAULT )
+    {
+		eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
+    }
+	else
+	{
+		SfxViewFrame* pFrame = SfxViewFrame::Current();
+		SfxObjectShell* pSh = NULL;
+		if ( pFrame )
+			pSh = pFrame->GetObjectShell();
+		if ( pSh )
+		{
+			SfxModule* pModule = pSh->GetModule();
+			if ( pModule )
+			{
+				const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
+				if ( pItem )
+					eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
+			}
+			else
+			{
+				DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
+			}
+		}
+	}
+	
+	return eUnit;
+}
+
+
+
+void PosSizePropertyPanel::DisableControls()
+{
+    if( mbPositionProtected )
+	{	
+		// the position is protected("Position protect" option in modal dialog is checked),
+		// disable all the Position controls in sidebar
+		mpFtPosX->Disable();
+		mpMtrPosX->Disable();
+		mpFtPosY->Disable();
+		mpMtrPosY->Disable();
+		mpFtAngle->Disable();
+		mpMtrAngle->Disable();
+		mpDial->Disable();
+		mpFtFlip->Disable();
+		mpFlipTbx->Disable();
+
+		mpFtWidth->Disable();
+		mpMtrWidth->Disable();
+		mpFtHeight->Disable();
+		mpMtrHeight->Disable();
+        mpCbxScale->Disable();
+	}
+	else
+	{
+		mpFtPosX->Enable();
+		mpMtrPosX->Enable();
+		mpFtPosY->Enable();
+		mpMtrPosY->Enable();
+
+        //mpFtAngle->Enable();
+		//mpMtrAngle->Enable();
+		//mpDial->Enable();
+		//mpFtFlip->Enable();
+		//mpFlipTbx->Enable();
+
+		if( mbSizeProtected )
+		{
+			mpFtWidth->Disable();
+			mpMtrWidth->Disable();
+			mpFtHeight->Disable();
+			mpMtrHeight->Disable();
+			mpCbxScale->Disable();
+		}
+		else
+		{
+			if(	mbAdjustEnabled )
+			{
+				if( mbAutoWidth )
+				{
+					mpFtWidth->Disable();
+					mpMtrWidth->Disable();
+					mpCbxScale->Disable();
+				}
+				else
+				{
+					mpFtWidth->Enable();
+					mpMtrWidth->Enable();
+				}
+				if( mbAutoHeight )
+				{
+					mpFtHeight->Disable();
+					mpMtrHeight->Disable();
+					mpCbxScale->Disable();
+				}
+				else
+				{
+					mpFtHeight->Enable();
+					mpMtrHeight->Enable();
+				}
+				if( !mbAutoWidth && !mbAutoHeight )
+					mpCbxScale->Enable();
+			}
+			else
+			{
+				mpFtWidth->Enable();
+				mpMtrWidth->Enable();
+				mpFtHeight->Enable();
+				mpMtrHeight->Enable();
+				mpCbxScale->Enable();
+			}
+		}
+	}
+}
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/possize/PosSizePropertyPanel.hrc b/main/svx/source/sidebar/possize/PosSizePropertyPanel.hrc
new file mode 100644
index 0000000..89e66f5
--- /dev/null
+++ b/main/svx/source/sidebar/possize/PosSizePropertyPanel.hrc
@@ -0,0 +1,108 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+//  RID_SIDEBAR_POSSIZE_PANEL--------------------------------------------------------------
+#define FT_WIDTH                                            1
+#define MTR_FLD_WIDTH										2
+#define FT_HEIGHT                                           3
+#define MTR_FLD_HEIGHT										4
+#define CBX_SCALE										    5
+#define FT_SBSHAPE_HORIZONTAL                               7
+#define MF_SBSHAPE_HORIZONTAL                               8
+#define FT_SBSHAPE_VERTICAL                                 9
+#define MF_SBSHAPE_VERTICAL                                 10
+#define FT_SBSHAPE_POSREFERENCE                             11
+#define CTL_SBSHAPE_POSREFERENCE                            12
+#define FT_ANGLE											13
+#define MTR_FLD_ANGLE										14
+#define TBX_FLIP                                            15
+#define DIAL_CONTROL										17
+#define FLIP_HORIZONTAL										18
+#define FLIP_VERTICAL										19
+#define IMG_HORI_FLIP										20
+#define IMG_VERT_FLIP									    21
+#define FT_FLIP												22
+#define STR_QH_HORI_FLIP									23
+#define STR_QH_VERT_FLIP									24
+
+#define MBOX_WIDTH						50
+#define TEXT_WIDTH                      40
+#define FLIP_BUTTON_SIZE                13
+#define ALIGNMENT_TBX_HEIGHT  17
+#define ALIGNMENT_TBX_WIDTH   13
+
+#define FT_POSITION_X_X							SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_POSITION_X_Y							SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define MF_POSITION_X_X							FT_POSITION_X_X
+#define MF_POSITION_X_Y							FT_POSITION_X_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_POSITION_Y_X							FT_POSITION_X_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL
+#define FT_POSITION_Y_Y							FT_POSITION_X_Y
+#define MF_POSITION_Y_X							FT_POSITION_Y_X
+#define MF_POSITION_Y_Y							MF_POSITION_X_Y
+
+#define FT_WIDTH_X								SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_WIDTH_Y								MF_POSITION_X_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define FLD_WIDTH_X								FT_WIDTH_X
+#define FLD_WIDTH_Y								FT_WIDTH_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_HEIGHT_X								FT_WIDTH_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL				
+#define FT_HEIGHT_Y								FT_WIDTH_Y
+#define FLD_HEIGHT_X							FT_HEIGHT_X
+#define FLD_HEIGHT_Y							FLD_WIDTH_Y
+#define CBX_X                                   FT_WIDTH_X
+#define CBX_Y									FLD_WIDTH_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+/////////////////////
+#define FT_ROTATION_X							FT_WIDTH_X			
+#define FT_ROTATION_Y							CBX_Y + CONTROL_SPACING_VERTICAL + TEXT_HEIGHT
+
+#define MF_ROTATION_X							FT_ROTATION_X + 40 + CONTROL_SPACING_HORIZONTAL
+#define MF_ROTATION_Y							FT_ROTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define ROTATE_CONTROL_X						FT_ROTATION_X
+#define ROTATE_CONTROL_Y						MF_ROTATION_Y + 4
+
+#define FT_FLIP_X                               MF_ROTATION_X
+#define FT_FLIP_Y								MF_ROTATION_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5
+
+#define BTN_FLIP_HORI_X                         PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 - 1   // wj for 7926
+#define BTN_FLIP_HORI_Y							FT_FLIP_Y - 5
+////////////////////////////////
+
+#define FT_ANGLE_X                              FLD_WIDTH_X
+#define FT_ANGLE_Y								FLD_WIDTH_Y + 4
+
+#define MF_ANGLE_X2								MF_ROTATION_X
+#define MF_ANGLE_Y2								FT_ANGLE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+
+#define ROTATE_CONTROL_X2						FT_ANGLE_X
+#define ROTATE_CONTROL_Y2						MF_ANGLE_Y2 + 4
+
+#define FT_FLIP_X2                              MF_ANGLE_X2
+#define FT_FLIP_Y2								MF_ANGLE_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5
+
+#define FLIP_HORI_X2							PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2		//FT_FLIP_X2 + 22
+#define FLIP_HORI_Y2							FT_FLIP_Y2 - 5
+
+#define PS_SECTIONPAGE_HEIGHT                   BTN_FLIP_HORI_Y + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2
+#define PS_SECTIONPAGE_HEIGHT2                  FLIP_HORI_Y2 + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2
+#define PS_SECTIONPAGE_HEIGHT3                  FT_WIDTH_Y + TEXT_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT
+#define PS_SECTIONPAGE_HEIGHT4                  CBX_Y + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT
+
+// eof
diff --git a/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
new file mode 100644
index 0000000..2e6a9c9
--- /dev/null
+++ b/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -0,0 +1,182 @@
+/**************************************************************
+ * 
+ * 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 SVX_PROPERTYPANEL_POSIZEPAGE_HXX
+#define SVX_PROPERTYPANEL_POSIZEPAGE_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <svx/rectenum.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+class DialControl;
+class SdrView;
+class FixedText;
+class MetricField;
+class CheckBox;
+class MetricBox;
+
+
+namespace svx { namespace sidebar {
+
+class SidebarDialControl;
+
+class PosSizePropertyPanel
+:   public Control,
+    public ::sfx2::sidebar::IContextChangeReceiver,
+    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static PosSizePropertyPanel* Create(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+    virtual void DataChanged(
+        const DataChangedEvent& rEvent);
+
+    virtual void HandleContextChange(
+        const ::sfx2::sidebar::EnumContext aContext);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+    SfxBindings* GetBindings();
+    void ShowMenu (void);
+
+private:
+    //Position
+    ::boost::scoped_ptr< FixedText >        mpFtPosX;
+    ::boost::scoped_ptr< MetricField >      mpMtrPosX;
+    ::boost::scoped_ptr< FixedText >        mpFtPosY;
+    ::boost::scoped_ptr< MetricField >      mpMtrPosY;
+
+    // size
+    ::boost::scoped_ptr< FixedText >        mpFtWidth;
+    ::boost::scoped_ptr< MetricField >      mpMtrWidth;
+    ::boost::scoped_ptr< FixedText >        mpFtHeight;
+    ::boost::scoped_ptr< MetricField >      mpMtrHeight;
+    ::boost::scoped_ptr< CheckBox >         mpCbxScale;
+
+    //rotation
+    ::boost::scoped_ptr< FixedText >        mpFtAngle;
+    ::boost::scoped_ptr< MetricBox >        mpMtrAngle;
+
+    //rotation control
+    ::boost::scoped_ptr<SidebarDialControl> mpDial;
+
+    //flip
+    ::boost::scoped_ptr< FixedText >        mpFtFlip;
+    ::boost::scoped_ptr< Window >           mpFlipTbxBackground;
+    ::boost::scoped_ptr< ToolBox >          mpFlipTbx;
+
+    // Internal variables
+    Rectangle                               maRect;
+    const SdrView*                          mpView;
+    sal_uInt32                              mlOldWidth;
+    sal_uInt32                              mlOldHeight;
+    RECT_POINT                              meRP;
+    Point                                   maAnchorPos;    //anchor position
+    long                                    mlRotX;
+    long                                    mlRotY;
+    Fraction                                maUIScale;
+    SfxMapUnit                              mePoolUnit;
+    FieldUnit                               meDlgUnit;
+
+    // Controller Items
+    ::sfx2::sidebar::ControllerItem         maTransfPosXControl;
+    ::sfx2::sidebar::ControllerItem         maTransfPosYControl;
+    ::sfx2::sidebar::ControllerItem         maTransfWidthControl;
+    ::sfx2::sidebar::ControllerItem         maTransfHeightControl;
+
+    ::sfx2::sidebar::ControllerItem         maSvxAngleControl;
+    ::sfx2::sidebar::ControllerItem         maRotXControl;
+    ::sfx2::sidebar::ControllerItem         maRotYControl;
+    ::sfx2::sidebar::ControllerItem         maProPosControl;
+    ::sfx2::sidebar::ControllerItem         maProSizeControl;
+    ::sfx2::sidebar::ControllerItem         maAutoWidthControl;
+    ::sfx2::sidebar::ControllerItem         maAutoHeightControl;
+    ::sfx2::sidebar::ControllerItem         m_aMetricCtl;
+
+    // images from ressource
+    Image                                   maImgFlipHori;
+    Image                                   maImgFlipVert;
+
+    cssu::Reference< css::frame::XFrame >   mxFrame;
+    ::sfx2::sidebar::EnumContext            maContext;
+    SfxBindings*                            mpBindings;
+
+    /// bitfield
+    bool                                    mbMtrPosXMirror : 1;
+    bool                                    mbSizeProtected : 1;
+    bool                                    mbPositionProtected : 1;
+    bool                                    mbAutoWidth : 1;
+    bool                                    mbAutoHeight : 1;
+    bool                                    mbAdjustEnabled : 1;
+    bool                                    mbIsFlip : 1;
+    bool                                    mbInDestructor : 1;
+
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+
+    DECL_LINK( ChangePosXHdl, void * );
+    DECL_LINK( ChangePosYHdl, void * );
+    DECL_LINK( ChangeWidthHdl, void * );
+    DECL_LINK( ChangeHeightHdl, void * );
+    DECL_LINK( ClickAutoHdl, void * );
+    DECL_LINK( AngleModifiedHdl, void * );
+    DECL_LINK( RotationHdl, void * );
+    DECL_LINK( FlipHdl, ToolBox * );
+
+    void SetupIcons(void);
+    void Initialize();
+    void executePosX();
+    void executePosY();
+    void executeSize();
+
+    // constructor/destuctor
+    PosSizePropertyPanel(
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+    virtual ~PosSizePropertyPanel();
+
+    void MetricState( SfxItemState eState, const SfxPoolItem* pState );
+    FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
+    void DisableControls();
+};
+
+
+} } // end of namespace svx::sidebar
+
+
+
+#endif // SVX_PROPERTYPANEL_POSIZEPAGE_HXX
+
+// eof
diff --git a/main/svx/source/sidebar/possize/PosSizePropertyPanel.src b/main/svx/source/sidebar/possize/PosSizePropertyPanel.src
new file mode 100644
index 0000000..36ed5df
--- /dev/null
+++ b/main/svx/source/sidebar/possize/PosSizePropertyPanel.src
@@ -0,0 +1,227 @@
+/**************************************************************
+ * 
+ * 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 "PosSizePropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#define TOOLBOX_HEIGHT		14
+
+Control RID_SIDEBAR_POSSIZE_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT(
+         PROPERTYPAGE_WIDTH,
+         BTN_FLIP_HORI_Y + TOOLBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT);
+	HelpID = HID_PROPERTYPANEL_POSIZE_SECTION ;
+	Text  = "Position and Size";
+	
+	FixedText FT_WIDTH
+	{
+	    Pos = MAP_APPFONT ( FT_WIDTH_X, FT_WIDTH_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Width:";
+	};
+	MetricField MTR_FLD_WIDTH
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( FLD_WIDTH_X, FLD_WIDTH_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Enter a width for the selected object.";
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 9999 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_INCH;
+		Last = 9999 ;
+		SpinSize = 2 ;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH;
+	};
+	FixedText FT_HEIGHT
+	{
+	    Pos = MAP_APPFONT ( FT_HEIGHT_X, FT_HEIGHT_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ;
+		Text [ en-US ] = "H~eight:";
+	};
+	MetricField MTR_FLD_HEIGHT
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( FLD_HEIGHT_X, FLD_HEIGHT_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 1, MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Enter a height for the selected object.";
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 9999 ;
+		StrictFormat = TRUE ;
+		Unit = FUNIT_INCH;
+		Last = 9999 ;
+		SpinSize = 2 ;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT;
+	};
+	CheckBox CBX_SCALE
+	{
+		Pos = MAP_APPFONT ( CBX_X , CBX_Y ) ;
+        Size = MAP_APPFONT ( MBOX_WIDTH + 30 , CBOX_HEIGHT ) ;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~Keep ratio" ;
+		QuickHelpText [ en-US ] = "Maintain proportions when you resize the selected object.";
+		HelpID = HID_PROPERTY_PANEL_POSIZE_CBX_SCALE;
+	};
+	//------------ Position ------------
+	FixedText FT_SBSHAPE_HORIZONTAL
+	{
+		Pos = MAP_APPFONT ( FT_POSITION_X_X, FT_POSITION_X_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Horizontal:";
+	};
+	MetricField MF_SBSHAPE_HORIZONTAL
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_POSITION_X_X , MF_POSITION_X_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ;
+		QuickHelpText [ en-US ] = "Enter the value for the horizontal position.";
+		TabStop = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Minimum = -120000;
+		Maximum = 240000;
+		StrictFormat = TRUE;
+		DecimalDigits = 2;
+		Unit = FUNIT_MM;
+		SpinSize = 10;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL;
+	};
+	FixedText FT_SBSHAPE_VERTICAL
+	{
+		Pos = MAP_APPFONT ( FT_POSITION_Y_X , FT_POSITION_Y_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Vertical:";
+	};	
+	MetricField MF_SBSHAPE_VERTICAL
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_POSITION_Y_X , MF_POSITION_Y_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ;
+		QuickHelpText [ en-US ] = "Enter the value for the vertical position.";
+		TabStop = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Minimum = -120000;
+		Maximum = 240000;
+		StrictFormat = TRUE;
+		DecimalDigits = 2;
+		Unit = FUNIT_MM;
+		SpinSize = 10;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL;
+	};
+	FixedText FT_ANGLE
+	{
+		Pos = MAP_APPFONT ( FT_ROTATION_X , FT_ROTATION_Y );
+		Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Rotation:";
+	};	
+	
+	MetricBox MTR_FLD_ANGLE
+	{
+		Border = TRUE ;
+        Pos = MAP_APPFONT ( MF_ROTATION_X , MF_ROTATION_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 10, MBOX_HEIGHT ) ;
+        QuickHelpText [ en-US ] = "Select the angle for rotation.";
+		Unit = FUNIT_CUSTOM ;
+		CustomUnitText [ en-US ] = " degrees";
+		DecimalDigits = 2;
+		Minimum = -18000;		// set minmun value or it will be 0 as default
+		TabStop = TRUE ;
+		DropDown = TRUE ;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE;
+	};
+	
+	FixedText FT_FLIP
+	{
+		Pos = MAP_APPFONT ( FT_FLIP_X , FT_FLIP_Y );
+		Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL*2  - 40 - CONTROL_SPACING_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , TEXT_HEIGHT) ;//20     wj
+		Text [ en-US ] = "~Flip:";
+	};
+	
+	ToolBox TBX_FLIP
+	{
+        Pos = MAP_APPFONT ( BTN_FLIP_HORI_X , BTN_FLIP_HORI_Y );
+        Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2, TOOLBOX_HEIGHT);
+		SVLook = TRUE ;
+		Border = FALSE ;
+		HelpID = HID_PROPERTY_PANEL_POSIZE_TBX_FLIP;
+		Text = "Flip";
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = FLIP_VERTICAL ;
+				Text [ en-US ] = "Flip Vertically" ;
+				HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/FlipVertically_16x16.png";
+				};
+			};
+			ToolBoxItem
+			{
+				Identifier = FLIP_HORIZONTAL ;
+				Text [ en-US ] = "Flip Horizontally" ;
+				HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL;
+				ItemBitmap = Bitmap
+				{
+					File = "symphony/FlipHorizontally_16x16.png";
+				};
+			};
+		};
+	};
+	
+	String STR_QH_HORI_FLIP
+	{
+		Text [ en-US ] = "Flip the selected object horizontally.";
+	};
+	String STR_QH_VERT_FLIP
+	{
+		Text [ en-US ] = "Flip the selected object vertically.";
+	};
+	
+	Image IMG_HORI_FLIP
+	{
+		ImageBitmap = Bitmap{File = "symphony/FlipHorizontally_16x16.png";};
+	};
+	Image IMG_VERT_FLIP
+	{
+		ImageBitmap = Bitmap{File = "symphony/FlipVertically_16x16.png";};
+	};
+
+	Control	DIAL_CONTROL
+	{
+		Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y );
+		Size = MAP_PIXEL( 50, 50 );
+		HelpID = HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL;
+	};
+};
+
+// eof
diff --git a/main/svx/source/sidebar/possize/SidebarDialControl.cxx b/main/svx/source/sidebar/possize/SidebarDialControl.cxx
new file mode 100644
index 0000000..245bb51
--- /dev/null
+++ b/main/svx/source/sidebar/possize/SidebarDialControl.cxx
@@ -0,0 +1,86 @@
+/**************************************************************
+ * 
+ * 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 <svx/sidebar/SidebarDialControl.hxx>
+#include "SidebarDialControlBmp.hxx"
+
+#include <vcl/svapp.hxx>
+
+namespace svx { namespace sidebar {
+
+SidebarDialControl::SidebarDialControl (
+    Window* pParent,
+    const ResId& rResId)
+    : svx::DialControl(pParent, rResId)
+{
+    mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this));
+    mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this));
+    mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this));
+    Init(GetOutputSizePixel());
+}
+
+
+
+
+SidebarDialControl::~SidebarDialControl (void)
+{
+}
+
+
+
+
+void SidebarDialControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+    if( rMEvt.IsLeft() )
+    {
+        GrabFocus();
+        CaptureMouse();
+        mpImpl->mnOldAngle = mpImpl->mnAngle;
+        HandleMouseEvent( rMEvt.GetPosPixel(), true );
+    }
+}
+
+
+
+
+void SidebarDialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
+{
+    long nX = rPos.X() - mpImpl->mnCenterX;
+    long nY = mpImpl->mnCenterY - rPos.Y();
+    double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
+    if( fH != 0.0 )
+    {
+        double fAngle = acos( nX / fH );
+        sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 );
+        if( nY < 0 )
+            nAngle = 36000 - nAngle;
+        if( bInitial )  // round to entire 15 degrees
+            nAngle = ((nAngle + 750) / 1500) * 1500;
+
+		if (Application::GetSettings().GetLayoutRTL())
+			nAngle = 18000 - nAngle;
+        SetRotation( nAngle, true );
+    }
+}
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/possize/SidebarDialControlBmp.cxx b/main/svx/source/sidebar/possize/SidebarDialControlBmp.cxx
new file mode 100644
index 0000000..d415066
--- /dev/null
+++ b/main/svx/source/sidebar/possize/SidebarDialControlBmp.cxx
@@ -0,0 +1,94 @@
+/**************************************************************
+ * 
+ * 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 "SidebarDialControlBmp.hxx"
+
+#include <sfx2/sidebar/Theme.hxx>
+
+#include <vcl/svapp.hxx>
+
+#include "PosSizePropertyPanel.hrc"
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/svdstr.hrc>
+
+namespace svx { namespace sidebar {
+
+SidebarDialControlBmp::SidebarDialControlBmp (Window& rParent)
+    : DialControlBmp(rParent)
+{
+}
+
+
+
+
+SidebarDialControlBmp::~SidebarDialControlBmp (void)
+{
+}
+
+
+
+
+void SidebarDialControlBmp::DrawElements (
+    const String& /*rText*/,
+    sal_Int32 nAngle)
+{
+    if (Application::GetSettings().GetLayoutRTL())		
+        nAngle = 18000 - nAngle;
+    double fAngle = nAngle * F_PI180 / 100.0;
+    double fSin = sin( fAngle );
+    double fCos = cos( fAngle );
+    DrawText( maRect, String(), mbEnabled ? 0 : TEXT_DRAW_DISABLE );
+    const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2);
+    const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2); 
+    Point pt1( maRect.Center() );
+    Point pt2( pt1.X() + nDx, pt1.Y() + nDy);
+    if ( ! sfx2::sidebar::Theme::IsHighContrastMode())
+        SetLineColor( Color( 60, 93, 138 ) );
+    else
+        SetLineColor(COL_BLACK);//Application::GetSettings().GetStyleSettings().GetFieldTextColor()
+    DrawLine( pt1, pt2 );
+}
+
+
+
+
+void SidebarDialControlBmp::DrawBackground()
+{
+    SetLineColor();
+    SetFillColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
+    DrawRect(maRect);
+
+    const BitmapEx aBitmapEx(
+        sfx2::sidebar::Theme::IsHighContrastMode()
+            ? SVX_RES(IMG_DIACONTROL_H)
+            : SVX_RES(IMG_DIACONTROL_NORMAL));
+    // Size aImageSize(aBitmapEx.GetSizePixel());
+    //    aImageSize.Width() -= 1;
+    //    aImageSize.Height() -= 1;
+    SetAntialiasing(ANTIALIASING_ENABLE_B2DDRAW |  ANTIALIASING_PIXELSNAPHAIRLINE);
+    DrawBitmapEx(maRect.TopLeft(), /*aImageSize,*/ aBitmapEx);
+}
+
+
+} } // end of namespace svx::sidebar
+
+// eof
diff --git a/main/svx/source/sidebar/possize/SidebarDialControlBmp.hxx b/main/svx/source/sidebar/possize/SidebarDialControlBmp.hxx
new file mode 100644
index 0000000..44f51c1
--- /dev/null
+++ b/main/svx/source/sidebar/possize/SidebarDialControlBmp.hxx
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX
+#define SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX
+
+#include <svx/dialcontrol.hxx>
+
+namespace svx { namespace sidebar {
+
+
+class SidebarDialControlBmp
+    : public svx::DialControlBmp
+{
+public:
+    explicit SidebarDialControlBmp( Window& rParent);
+    virtual ~SidebarDialControlBmp (void);
+
+    virtual void DrawElements( const String& rText, sal_Int32 nAngle );
+    virtual void DrawBackground();
+
+private:
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+// eof
diff --git a/main/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/main/svx/source/sidebar/text/SvxSBFontNameBox.cxx
new file mode 100644
index 0000000..cce8f46
--- /dev/null
+++ b/main/svx/source/sidebar/text/SvxSBFontNameBox.cxx
@@ -0,0 +1,178 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "SvxSBFontNameBox.hxx"
+
+#include <unotools/fontoptions.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/editids.hrc>
+#include <editeng/fontitem.hxx>
+
+
+const static sal_uInt16 MAX_MRU_FONTNAME_ENTRIES = 5;
+
+
+namespace svx { namespace sidebar {
+
+namespace {
+    bool GetDocFontList_Impl( const FontList** ppFontList, SvxSBFontNameBox* pBox )
+    {
+        bool bChanged = false;
+        const SfxObjectShell* pDocSh = SfxObjectShell::Current();
+        SvxFontListItem* pFontListItem = NULL;
+
+        if ( pDocSh )
+            pFontListItem =
+                (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+
+        if ( pFontListItem )
+        {
+            const FontList*	pNewFontList = pFontListItem->GetFontList();
+            DBG_ASSERT( pNewFontList, "Doc-FontList not available!" );
+
+            if ( !*ppFontList )
+            {
+                *ppFontList = pNewFontList;
+                bChanged = true;
+            }
+            else
+            {
+                bChanged = ( *ppFontList != pNewFontList );
+                if( !bChanged && pBox!=NULL )
+                    bChanged = ( pBox->GetListCount() != pNewFontList->GetFontNameCount() );
+                HACK(vergleich ist unvollstaendig)
+
+                    if ( bChanged )
+                        *ppFontList = pNewFontList;
+            }
+
+            if ( pBox )
+                pBox->Enable();
+        }
+        else if ( pBox )
+            pBox->Disable();
+
+        // in die FontBox ggf. auch die neue Liste f"ullen
+        if ( pBox && bChanged )
+        {
+            if ( *ppFontList )
+                pBox->Fill( *ppFontList );
+            else
+                pBox->Clear();
+        }
+        return bChanged;
+    }
+}
+
+
+
+
+SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent,  const ResId& rResId  ) :
+	FontNameBox	( pParent, rResId )
+,	pFontList	( NULL )
+,	nFtCount	( 0 )
+,	bInput(false)
+,	pBindings(NULL)
+{
+    EnableControls_Impl();
+//	StartListening( *SFX_APP() );
+}
+
+void SvxSBFontNameBox::EnableControls_Impl()
+{
+	SvtFontOptions aFontOpt;
+	bool bEnable = aFontOpt.IsFontHistoryEnabled();
+	sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0;
+	if ( GetMaxMRUCount() != nEntries )
+	{
+		// refill in the next GetFocus-Handler
+		pFontList = NULL;
+		Clear();
+		SetMaxMRUCount( nEntries );
+	}
+
+	bEnable = aFontOpt.IsFontWYSIWYGEnabled();
+	EnableWYSIWYG( bEnable );
+	EnableSymbols( bEnable );
+}
+
+void SvxSBFontNameBox::FillList()
+{
+	Selection aOldSel = GetSelection();
+	GetDocFontList_Impl( &pFontList, this );
+	aCurText = GetText();
+	SetSelection( aOldSel );
+}
+
+long SvxSBFontNameBox::PreNotify( NotifyEvent& rNEvt )
+{
+	const sal_uInt16 nType (rNEvt.GetType());
+
+	if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+		FillList();
+    return FontNameBox::PreNotify( rNEvt );
+}
+//<<modify
+long SvxSBFontNameBox::Notify( NotifyEvent& rNEvt) //SfxBroadcaster& rBC, const SfxHint& rHint 
+{
+	//SfxItemSetHint* pHint = PTR_CAST(SfxItemSetHint, &rHint);
+	//if ( pHint )
+	//	EnableControls_Impl();
+	bool bHandle = 0;
+	if ( rNEvt.GetType() == EVENT_KEYINPUT )
+	{
+		const sal_uInt16 nCode (rNEvt.GetKeyEvent()->GetKeyCode().GetCode());
+
+		if( nCode == KEY_RETURN)
+		{
+			bHandle = 1;
+			Select();
+		}
+	}
+
+	return bHandle ? bHandle : FontNameBox::Notify( rNEvt );
+} 
+void SvxSBFontNameBox::Select()
+{
+	FontNameBox::Select();
+
+	if ( !IsTravelSelect() )
+	{
+		FillList();
+		FontInfo aInfo( pFontList->Get( GetText(),WEIGHT_NORMAL, ITALIC_NORMAL ) );//meWeight, meItalic 
+    
+		SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(),
+			aInfo.GetPitch(), aInfo.GetCharSet(), SID_ATTR_CHAR_FONT );
+
+		pBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONT, SFX_CALLMODE_RECORD, &aFontItem, 0L );
+		pBindings->Invalidate(SID_ATTR_CHAR_FONT,true,false);
+	}
+}
+void SvxSBFontNameBox::SetBindings(SfxBindings* pB)
+{
+	pBindings = pB;
+}
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/main/svx/source/sidebar/text/SvxSBFontNameBox.hxx
new file mode 100644
index 0000000..74b9707
--- /dev/null
+++ b/main/svx/source/sidebar/text/SvxSBFontNameBox.hxx
@@ -0,0 +1,80 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX
+#define SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX
+
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+
+/*
+#include <sfx2/sectionpage.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/fixed.hxx>
+
+#include <vcl/button.hxx>
+#include <svl/lstner.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <svx/tbxcolorupdate.hxx>
+#include <svx/svxenum.hxx>
+#include <svx/fhgtitem.hxx>
+
+#define FONT_COLOR			1
+#define BACK_COLOR			2
+*/
+namespace svx
+{
+    class ToolboxButtonColorUpdater;
+}
+
+namespace svx { namespace sidebar {
+
+class SvxSBFontNameBox : public FontNameBox//, public SfxListener
+{
+private:
+	const FontList*	pFontList;
+	Font			aCurFont;
+	String			aCurText;
+	sal_uInt16 nFtCount;
+   	bool bInput;
+	void			EnableControls_Impl();
+	SfxBindings*	pBindings;//
+protected:
+	virtual void 	Select();
+	
+public:
+    SvxSBFontNameBox( Window* pParent, const ResId& rResId  );
+	void			FillList();
+	sal_uInt16 GetListCount() { return nFtCount; }
+	void			Clear() { FontNameBox::Clear(); nFtCount = 0; }
+	void			Fill( const FontList* pList )
+						{ FontNameBox::Fill( pList );
+						  nFtCount = pList->GetFontNameCount(); }
+	void			SetBindings(SfxBindings* pBinding);//
+	virtual long	PreNotify( NotifyEvent& rNEvt );
+	virtual long	Notify(  NotifyEvent& rNEvt );//
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
new file mode 100644
index 0000000..2bfc960
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -0,0 +1,468 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include "TextCharacterSpacingControl.hxx"
+#include "TextPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+
+namespace svx { namespace sidebar {
+TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
+:	PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING))
+,	mrTextPropertyPanel(rPanel)
+,	mpBindings(NULL)
+,	maVSSpacing		(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING))
+,	maLastCus		(this, SVX_RES(FT_LASTCUSTOM))
+//,	maBorder		(this, SVX_RES(CT_BORDER))
+,	maFTSpacing		(this, SVX_RES(FT_SPACING))
+,	maLBKerning		(this, SVX_RES(LB_KERNING))
+,	maFTBy			(this, SVX_RES(FT_BY))
+,	maEditKerning	(this, SVX_RES(ED_KERNING))
+
+,	mpImg			(NULL)
+,	mpImgSel		(NULL)
+,	mpStr			(NULL)
+,	mpStrTip		(NULL)
+		
+,	maImgCus		(SVX_RES(IMG_CUSTOM))
+,	maImgCusGrey	(SVX_RES(IMG_CUSTOM_GRAY))
+,	maStrCus		(SVX_RES(STR_CUSTOM))
+,	maStrCusE		(SVX_RES(STR_CUSTOM_E_TIP))	//add 
+,	maStrCusC		(SVX_RES(STR_CUSTOM_C_TIP))	//add 
+,	maStrCusN		(SVX_RES(STR_NORMAL_TIP))	//add 
+,	maStrUnit		(SVX_RES(STR_PT))			//add 
+
+,	mnCustomKern(0)
+,	mnLastCus ( SPACING_NOCUSTOM )
+,	mbCusEnable(false)
+,	mbVS(true)
+{
+	initial();
+	FreeResource();
+	mpBindings = mrTextPropertyPanel.GetBindings();
+	Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl);
+	maLBKerning.SetSelectHdl(aLink);
+	aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl);
+	maEditKerning.SetModifyHdl(aLink);
+
+}
+TextCharacterSpacingControl::~TextCharacterSpacingControl()
+{
+	delete[] mpImg;
+	delete[] mpImgSel;
+	delete[] mpStr;
+	delete[] mpStrTip;
+}
+
+void TextCharacterSpacingControl::initial()
+{
+	maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );
+	{
+		maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	}
+	mpImg = new Image[5];
+	mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT));
+	mpImg[1] = Image(SVX_RES(IMG_TIGHT));
+	mpImg[2] = Image(SVX_RES(IMG_NORMAL));
+	mpImg[3] = Image(SVX_RES(IMG_LOOSE));
+	mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE));
+
+	mpImgSel = new Image[5];
+	mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S));
+	mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S));
+	mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S));
+	mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S));
+	mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S));
+
+	mpStr = new XubString[5];
+	mpStr[0] = XubString(SVX_RES(STR_VERY_TIGHT));
+	mpStr[1] = XubString(SVX_RES(STR_TIGHT));
+	mpStr[2] = XubString(SVX_RES(STR_NORMAL));
+	mpStr[3] = XubString(SVX_RES(STR_LOOSE));
+	mpStr[4] = XubString(SVX_RES(STR_VERY_LOOSE));
+	
+
+	mpStrTip = new XubString[5];
+	mpStrTip[0] = XubString(SVX_RES(STR_VERY_TIGHT_TIP));
+	mpStrTip[1] = XubString(SVX_RES(STR_TIGHT_TIP));
+	mpStrTip[2] = XubString(SVX_RES(STR_NORMAL_TIP));
+	mpStrTip[3] = XubString(SVX_RES(STR_LOOSE_TIP));
+	mpStrTip[4] = XubString(SVX_RES(STR_VERY_LOOSE_TIP));
+
+	for (int i=0;i<5;i++)
+		maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
+
+    maVSSpacing.AddItem( maImgCus, 0, maStrCus, 0 );
+
+    maVSSpacing.SetNoSelection();
+	Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl );
+	maVSSpacing.SetSelectHdl(aLink);
+	maVSSpacing.StartSelection();
+	maVSSpacing.Show();
+}
+void TextCharacterSpacingControl::ToGetFocus()
+{
+	if(!mbVS)
+		maLBKerning.GrabFocus();
+	else
+		maVSSpacing.GrabFocus();
+}
+
+void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning)
+{
+	mbVS = true;
+    maVSSpacing.SetNoSelection();
+	SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
+    if ( aWinOpt.Exists() )
+	{
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
+		::rtl::OUString aTmp;
+		if ( aSeq.getLength())
+			aSeq[0].Value >>= aTmp;
+
+		String aWinData( aTmp );
+		mnCustomKern = aWinData.ToInt32();
+		mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
+		mbCusEnable = true;
+	}
+	else
+	{
+		mnLastCus = SPACING_NOCUSTOM;
+		mbCusEnable = false;
+	}
+
+	if( !mnLastCus ) 
+	{
+		maVSSpacing.ReplaceItemImages(6, maImgCusGrey,0);
+	}
+	else
+	{
+		//set custom tips
+		maVSSpacing.ReplaceItemImages(6, maImgCus,0);
+		if(mnCustomKern > 0)
+		{	
+			String aStrTip( maStrCusE);   //LAST CUSTOM no tip defect //add 
+			aStrTip.Append( String::CreateFromDouble( (double)mnCustomKern / 10));
+			aStrTip.Append(maStrUnit);		// modify 
+			maVSSpacing.SetItemText(6,aStrTip);
+		}
+		else if(mnCustomKern < 0)
+		{	
+			String aStrTip(maStrCusC) ;		//LAST CUSTOM no tip defect //add 
+			aStrTip.Append( String::CreateFromDouble( (double)-mnCustomKern / 10));
+			aStrTip.Append(maStrUnit);		// modify 
+			maVSSpacing.SetItemText( 6, aStrTip );
+		}	
+		else
+		{	
+			String aStrTip(maStrCusN) ;		//LAST CUSTOM no tip defect //add 
+			maVSSpacing.SetItemText( 6, aStrTip );
+		}
+		
+	}
+
+	if(bLBAvailable && bAvailable)
+	{
+		maLBKerning.Enable();
+		maFTSpacing.Enable();
+		
+		SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+        MapUnit eOrgUnit = (MapUnit)eUnit;
+        MapUnit ePntUnit( MAP_POINT );			
+        long nBig = maEditKerning.Normalize(nKerning);
+        nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
+
+        if ( nKerning > 0 )
+        {
+            maFTBy.Enable();
+            maEditKerning.Enable();
+            maEditKerning.SetMax( 9999 );
+            maEditKerning.SetLast( 9999 );
+            maEditKerning.SetValue( nKerning );
+            maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND );
+			if(nKerning == 30)
+			{
+				maVSSpacing.SelectItem(4);
+			}
+			else if(nKerning == 60)
+			{
+				maVSSpacing.SelectItem(5);
+			}
+			else
+			{
+                maVSSpacing.SetNoSelection();
+                maVSSpacing.SelectItem(0);
+				mbVS = false;
+			}
+        }
+        else if ( nKerning < 0 )
+        {
+			maFTBy.Enable();
+            maEditKerning.Enable();
+            maEditKerning.SetValue( -nKerning );
+            maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED );
+            long nMax = mrTextPropertyPanel.GetSelFontSize()/6;
+            maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT );
+            maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
+			if( nKerning == -30 )
+			{
+				maVSSpacing.SelectItem(1);
+			}
+			else if( nKerning == -15 )
+			{
+				maVSSpacing.SelectItem(2);
+			}
+			else
+			{
+                maVSSpacing.SetNoSelection();
+                maVSSpacing.SelectItem(0);
+				mbVS = false;
+			}
+        }
+        else
+        {
+			maVSSpacing.SelectItem(3);
+			maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL );
+			maFTBy.Disable();
+            maEditKerning.Disable();
+            maEditKerning.SetValue( 0 );
+            maEditKerning.SetMax( 9999 );
+            maEditKerning.SetLast( 9999 );
+        }
+	}
+	else if(bLBAvailable && !bAvailable)
+	{	
+		//modified 
+        maVSSpacing.SetNoSelection();
+        maVSSpacing.SelectItem(0);
+		mbVS = false;
+		maLBKerning.Enable();
+		maFTSpacing.Enable();
+		maLBKerning.SetNoSelection();
+		maEditKerning.SetText(String());
+		maEditKerning.Disable();
+		maFTBy.Disable();
+	}
+	else
+	{
+        maVSSpacing.SetNoSelection();
+        maVSSpacing.SelectItem(0);
+		mbVS = false;
+		maEditKerning.SetText(String());
+        maLBKerning.SetNoSelection();
+		maLBKerning.Disable();
+		maFTSpacing.Disable();
+        maEditKerning.Disable();
+		maFTBy.Disable();
+	}
+	GetFocus();
+	maVSSpacing.Format();
+	maVSSpacing.StartSelection();
+}
+IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
+{
+	mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+
+	if(pControl == &maVSSpacing)  
+	{		
+		sal_uInt16 iPos = maVSSpacing.GetSelectItemId();
+		short nKern = 0;
+		SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+		long nVal = 0;
+		if(iPos == 1)
+		{
+			nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(-nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 2)
+		{
+			nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(-nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 3)
+		{
+			SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(0);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 4)
+		{
+			nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 5)
+		{
+			nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 6)
+		{
+			//modified 
+			if(mbCusEnable)
+			{
+				nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit);
+				nKern = (short)maEditKerning.Denormalize(nVal);
+				SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING);
+				mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+				mrTextPropertyPanel.SetSpacing(nKern);
+				mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+			}
+			else
+			{
+				maVSSpacing.SetNoSelection();		//add , set no selection and keep the last select item 
+				maVSSpacing.Format();
+				Invalidate();
+				maVSSpacing.StartSelection();
+			}
+			//modify end
+		}
+		
+		if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add 
+			mrTextPropertyPanel.EndSpacingPopupMode();
+	}
+
+
+		
+	return 0;
+}
+
+IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG)
+{
+	if ( maLBKerning.GetSelectEntryPos() > 0 )
+	{
+		maFTBy.Enable();
+		maEditKerning.Enable();
+	}
+	else
+	{
+		maEditKerning.SetValue( 0 );
+		maFTBy.Disable();
+		maEditKerning.Disable();
+	}
+
+    if ( maVSSpacing.GetSelectItemId() > 0 )
+	{
+        maVSSpacing.SetNoSelection();
+        maVSSpacing.SelectItem(0);
+		maVSSpacing.Format();
+		Invalidate();
+		maVSSpacing.StartSelection();
+	}
+	KerningModifyHdl( NULL );
+	return 0;
+}
+IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG)
+{
+    if ( maVSSpacing.GetSelectItemId() > 0 )
+	{
+        maVSSpacing.SetNoSelection();
+        maVSSpacing.SelectItem(0);
+		maVSSpacing.Format();
+		Invalidate();
+		maVSSpacing.StartSelection();
+	}
+	sal_uInt16 nPos = maLBKerning.GetSelectEntryPos();
+    short nKern = 0;
+    SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+	mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; 
+	if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED )
+    {
+        long nTmp = static_cast<long>(maEditKerning.GetValue());
+        if ( nPos == SIDEBAR_SPACE_CONDENSED )
+		{
+			long nMax =  mrTextPropertyPanel.GetSelFontSize()/6;
+			maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP );
+			maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
+			if(nTmp > maEditKerning.GetMax())
+				nTmp = maEditKerning.GetMax();
+			mnCustomKern = -nTmp;
+			long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+			nKern = (short)maEditKerning.Denormalize( nVal );
+            nKern *= - 1;		
+		}
+		else
+		{
+			maEditKerning.SetMax( 9999 );
+			maEditKerning.SetLast( 9999 );
+			if(nTmp > maEditKerning.GetMax(FUNIT_TWIP))
+				nTmp = maEditKerning.GetMax(FUNIT_TWIP);
+			mnCustomKern = nTmp;
+			long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+			nKern = (short)maEditKerning.Denormalize( nVal );	
+		}
+    }
+	else
+	{
+		mnCustomKern = 0;
+	}
+	SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+	mrTextPropertyPanel.SetSpacing(nKern);
+	return 0;
+}
+short  TextCharacterSpacingControl::GetLastCustomState()
+{
+	return mnLastCus;
+}
+long  TextCharacterSpacingControl::GetLastCustomValue()
+{
+	return mnCustomKern;
+}
+
+}} // end of namespace sidebar
diff --git a/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
new file mode 100644
index 0000000..fd4fe58
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -0,0 +1,96 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_
+#define _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "TextPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+
+
+namespace svx { namespace sidebar {
+#define SPACING_NOCUSTOM				0
+#define SPACING_CLOSE_BY_CLICK_ICON		-1
+#define SPACING_CLOSE_BY_CUS_EDIT		1
+
+#define SIDEBAR_SPACING_GLOBAL_VALUE	String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US)
+
+#define SIDEBAR_SPACE_NORMAL	0
+#define SIDEBAR_SPACE_EXPAND	1
+#define SIDEBAR_SPACE_CONDENSED	2
+class TextCharacterSpacingControl:public svx::sidebar::PopupControl
+{
+public:
+	TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
+	~TextCharacterSpacingControl();
+	void ToGetFocus();
+	void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning);
+	//virtual void Paint(const Rectangle& rect);
+	
+	//add 
+	short GetLastCustomState();
+	long  GetLastCustomValue();
+	//add end
+
+private:	
+	svx::sidebar::TextPropertyPanel&     mrTextPropertyPanel;
+	SfxBindings*		mpBindings;
+
+	ValueSetWithTextControl	maVSSpacing;
+
+	FixedText			maLastCus;
+//	Control				maBorder;
+
+	FixedText			maFTSpacing;
+	ListBox				maLBKerning;
+	FixedText			maFTBy;
+	MetricField			maEditKerning;
+
+	Image*				mpImg;
+	Image*				mpImgSel;
+	XubString*			mpStr;
+	XubString*			mpStrTip;
+
+	Image				maImgCus;
+	Image				maImgCusGrey;
+	XubString			maStrCus;
+	XubString			maStrCusE;		//add 
+	XubString			maStrCusC;		//add 
+	XubString			maStrCusN;		//add 
+	XubString			maStrUnit;		//add 
+
+	long				mnCustomKern;
+	short				mnLastCus;		
+	bool				mbCusEnable;
+	bool				mbVS;
+
+	void initial();
+	DECL_LINK(VSSelHdl, void*);
+	DECL_LINK(KerningSelectHdl, ListBox*);
+	DECL_LINK(KerningModifyHdl,  MetricField*);
+};
+}}
+
+#endif
diff --git a/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
new file mode 100644
index 0000000..862add4
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
@@ -0,0 +1,79 @@
+/**************************************************************
+ * 
+ * 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 "TextCharacterSpacingPopup.hxx"
+#include "TextCharacterSpacingControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+TextCharacterSpacingPopup::TextCharacterSpacingPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing")))
+{
+	SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this));
+}
+
+
+
+
+TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void)
+{
+}
+
+
+
+
+void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning)
+{
+    ProvideContainerAndControl();
+
+    TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(bLBAvailable,bAvailable,nKerning);	
+}
+
+void TextCharacterSpacingPopup::PopupModeEndCallback (void)
+{
+	ProvideContainerAndControl();
+	TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
+	if (pControl == NULL)
+		return;
+	
+	if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
+	{
+		SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); 
+		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() ));
+		aWinOpt.SetUserData( aSeq );
+
+	}
+}
+
+
+} } // end of namespace svx::sidebar
+
diff --git a/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
new file mode 100644
index 0000000..6cf5bdf
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
@@ -0,0 +1,48 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_
+#define _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+
+namespace svx { namespace sidebar {
+
+class TextCharacterSpacingPopup
+    : public Popup
+{
+public :
+    TextCharacterSpacingPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~TextCharacterSpacingPopup (void);
+
+    void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning);
+private:
+    void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
diff --git a/main/svx/source/sidebar/text/TextPropertyPanel.cxx b/main/svx/source/sidebar/text/TextPropertyPanel.cxx
new file mode 100644
index 0000000..e6781aa
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -0,0 +1,1591 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include "TextPropertyPanel.hrc"
+#include "TextPropertyPanel.hxx"
+#include "SvxSBFontNameBox.hxx"
+
+#include "svx/dialmgr.hxx"
+
+#include <editeng/brshitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <rtl/ref.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include "sfx2/imagemgr.hxx"
+#include <svtools/ctrltool.hxx>
+#include <svtools/unitconv.hxx>
+
+#include <vcl/gradient.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include "TextCharacterSpacingControl.hxx"
+#include "TextCharacterSpacingPopup.hxx"
+#include "TextUnderlineControl.hxx"
+#include "TextUnderlinePopup.hxx"
+#include <svx/sidebar/ColorControl.hxx>
+#include <svx/sidebar/PopupContainer.hxx>
+
+
+#include <boost/bind.hpp>
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+using ::sfx2::sidebar::ControlFactory;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace svx { namespace sidebar {
+
+#undef HAS_IA2
+
+
+#define FONT_CONTROL_WIDTH 		160
+#define SIZE_CONTROL_WIDTH 		80
+#define CONTROL_COMBOX_HEIGHT	20
+#define CONTROL_HEIGHT_5X  		120
+
+
+#define TEXT_SECTIONPAGE_HEIGHT_S   SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT
+#define TEXT_SECTIONPAGE_HEIGHT		SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT
+
+//
+
+//end
+PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
+{
+    return new TextCharacterSpacingControl(pParent, *this);
+}
+
+PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
+{
+	return new TextUnderlineControl(pParent, *this);
+}
+
+PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
+{
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
+        SVX_RES(VS_FONT_COLOR),
+        ::boost::bind(&TextPropertyPanel::GetFontColor, this),
+        ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
+        pParent,
+        0);
+}
+
+PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
+{
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
+        SVX_RES(VS_FONT_COLOR),
+        ::boost::bind(&TextPropertyPanel::GetBrushColor, this),
+        ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
+        pParent,
+        0);
+}
+
+long TextPropertyPanel::GetSelFontSize()
+{
+    long nH = 240;
+    SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
+    if (mpHeightItem)
+        nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
+    return nH;
+} 
+
+
+TextPropertyPanel* TextPropertyPanel::Create (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+{
+    if (pParent == NULL)
+        throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
+    
+    return new TextPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings,
+        rxSidebar);
+}
+
+
+::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
+{
+	return maSpacingControl;
+}
+
+TextPropertyPanel::TextPropertyPanel (
+    Window* pParent,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    SfxBindings* pBindings,
+    const cssu::Reference<css::ui::XSidebar>& rxSidebar)
+    :	Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
+        mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
+    	maFontSizeBox		(this, SVX_RES(MB_SBFONT_FONTSIZE)),
+    	mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
+    	mpToolBoxIncDec(ControlFactory::CreateToolBox(
+                mpToolBoxIncDecBackground.get(),
+                SVX_RES(TB_INCREASE_DECREASE))),
+        mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxFont(ControlFactory::CreateToolBox(
+                mpToolBoxFontBackground.get(),
+                SVX_RES(TB_FONT))),
+        mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxFontColor(ControlFactory::CreateToolBox(
+                mpToolBoxFontColorBackground.get(),
+                SVX_RES(TB_FONTCOLOR))),		
+        mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxScript(ControlFactory::CreateToolBox(
+                mpToolBoxScriptBackground.get(),
+                SVX_RES(TB_SCRIPT))),
+        mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxScriptSw(ControlFactory::CreateToolBox(
+                mpToolBoxScriptSwBackground.get(),
+                SVX_RES(TB_SCRIPT_SW))),
+        mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxSpacing(ControlFactory::CreateToolBox(
+                mpToolBoxSpacingBackground.get(),
+                SVX_RES(TB_SPACING))),
+        mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
+        mpToolBoxHighlight(ControlFactory::CreateToolBox(
+                mpToolBoxHighlightBackground.get(),
+                SVX_RES(TB_HIGHLIGHT))),
+	maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
+	maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
+	maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
+	maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
+        mpFontColorUpdater(),
+        mpHighlightUpdater(),
+
+        maFontNameControl	(SID_ATTR_CHAR_FONT,		*pBindings, *this),
+        maFontSizeControl	(SID_ATTR_CHAR_FONTHEIGHT,	*pBindings, *this),
+        maWeightControl		(SID_ATTR_CHAR_WEIGHT,		*pBindings, *this),
+        maItalicControl		(SID_ATTR_CHAR_POSTURE,		*pBindings, *this),
+        maUnderlineControl	(SID_ATTR_CHAR_UNDERLINE,	*pBindings, *this),
+        maStrikeControl		(SID_ATTR_CHAR_STRIKEOUT,	*pBindings, *this),
+        maShadowControl		(SID_ATTR_CHAR_SHADOWED,	*pBindings, *this),
+        maFontColorControl	(SID_ATTR_CHAR_COLOR,		*pBindings, *this),
+        maScriptControlSw	(SID_ATTR_CHAR_ESCAPEMENT,	*pBindings, *this),  //for sw
+        maSuperScriptControl (SID_SET_SUPER_SCRIPT,		*pBindings, *this),
+        maSubScriptControl	(SID_SET_SUB_SCRIPT,		*pBindings, *this),
+        maSpacingControl	(SID_ATTR_CHAR_KERNING,		*pBindings, *this),
+        maHighlightControl	(SID_ATTR_BRUSH_CHAR,		*pBindings, *this),
+        maSDFontGrow		(SID_GROW_FONT_SIZE,		*pBindings, *this),
+        maSDFontShrink		(SID_SHRINK_FONT_SIZE,		*pBindings, *this),
+
+        maImgIncrease		(SVX_RES( IMG_INCREASE)),
+        maImgDecrease		(SVX_RES( IMG_DECREASE)),
+        maImgBold			(SVX_RES( IMG_BOLD )),
+        maImgItalic			(SVX_RES( IMG_ITALIC )),
+        maImgUnderline		(SVX_RES( IMG_UNDERLINE )),
+        maImgStrike			(SVX_RES( IMG_STRIKEOUT )),
+        maImgShadow			(SVX_RES( IMG_SHADOWED )),
+        maImgFontColor		(SVX_RES( IMG_FONTCOLOR)),
+        maImgSupScript		(SVX_RES( IMG_SUPSCRIPT)),
+        maImgSubScript		(SVX_RES( IMG_SUBSCRIPT)),
+        maImgHighlight		(SVX_RES( IMG_HIGHLIGHT)),
+
+        maImgNormalIcon		(SVX_RES(IMG_SPACING_D)),
+
+        maImgIncreaseHigh	(SVX_RES( IMG_INCREASE_H )),
+        maImgDecreaseHigh	(SVX_RES( IMG_DECREASE_H )),
+        maImgBoldHigh		(SVX_RES( IMG_BOLD_H )),
+        maImgItalicHigh		(SVX_RES( IMG_ITALIC_H )),
+        maImgUnderlineHigh	(SVX_RES( IMG_UNDERLINE_H )),
+        maImgStrikeHigh		(SVX_RES( IMG_STRIKEOUT_H )),
+        maImgShadowHigh		(SVX_RES( IMG_SHADOWED_H )),
+        maImgFontColorHigh	(SVX_RES( IMG_FONTCOLOR_H)),
+        maImgSupScriptHigh	(SVX_RES( IMG_SUPSCRIPT_H)),
+        maImgSubScriptHigh	(SVX_RES( IMG_SUBSCRIPT_H)),
+        maImgHighlightHigh	(SVX_RES( IMG_HIGHLIGHT_H)),
+
+        mpFontList			(NULL),
+        mbMustDelete		(false),
+        mbFocusOnFontSizeCtrl(false),
+        mxFrame(rxFrame),
+        maContext(),
+        mpBindings(pBindings),
+        mxSidebar(rxSidebar)
+{
+	Initialize();
+	FreeResource();
+}
+
+
+
+
+TextPropertyPanel::~TextPropertyPanel (void)
+{
+    if(mbMustDelete)
+        delete mpFontList;
+
+    // Destroy the toolbox windows.
+    mpToolBoxIncDec.reset();
+    mpToolBoxFont.reset();
+    mpToolBoxFontColor.reset();
+    mpToolBoxScript.reset();
+    mpToolBoxScriptSw.reset();
+    mpToolBoxSpacing.reset();
+    mpToolBoxHighlight.reset();
+
+    // Destroy the background windows of the toolboxes.
+    mpToolBoxIncDecBackground.reset();
+    mpToolBoxFontBackground.reset();
+    mpToolBoxFontColorBackground.reset();
+    mpToolBoxScriptBackground.reset();
+    mpToolBoxScriptSwBackground.reset();
+    mpToolBoxSpacingBackground.reset();
+    mpToolBoxHighlightBackground.reset();
+}
+
+
+
+
+Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL)
+{
+    return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode());
+}
+
+
+void TextPropertyPanel::SetSpacing(long nKern)
+{
+	mlKerning = nKern;
+}
+
+
+void TextPropertyPanel::HandleContextChange (
+    const ::sfx2::sidebar::EnumContext aContext)
+{
+    if (maContext == aContext)
+    {
+        // Nothing to do.
+        return;
+    }
+
+    maContext = aContext;
+    switch (maContext.GetCombinedContext_DI())
+    {
+        case CombinedEnumContext(Application_Calc, Context_Cell):
+        case CombinedEnumContext(Application_Calc, Context_Pivot):
+        {
+            mpToolBoxScript->Hide();
+		    mpToolBoxScriptSw->Hide();
+            mpToolBoxSpacing->Hide();
+            mpToolBoxHighlight->Hide();
+			
+            Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S);
+            aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+            aSize.setWidth(GetOutputSizePixel().Width());
+            SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+            break;
+        }
+
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Text):
+        case CombinedEnumContext(Application_WriterAndWeb, Context_Table):
+        {
+            mpToolBoxScriptSw->Show();
+            mpToolBoxScript->Hide();
+            mpToolBoxHighlight->Show();
+            mpToolBoxSpacing->Show();
+
+            Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
+            aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+            aSize.setWidth(GetOutputSizePixel().Width());
+            SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+            break;
+        }
+
+        case CombinedEnumContext(Application_Writer, Context_DrawText):
+        case CombinedEnumContext(Application_Writer, Context_Annotation):
+        {
+            mpToolBoxScriptSw->Show();
+            mpToolBoxScript->Hide();
+            mpToolBoxSpacing->Show();
+            mpToolBoxHighlight->Hide();
+
+            Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
+            aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 
+            aSize.setWidth(GetOutputSizePixel().Width());
+            SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+            break;
+        }
+
+        case CombinedEnumContext(Application_Calc, Context_EditCell):
+        case CombinedEnumContext(Application_Calc, Context_DrawText):
+        case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
+        case CombinedEnumContext(Application_DrawImpress, Context_Text):
+        case CombinedEnumContext(Application_DrawImpress, Context_Table):
+        case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
+        case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+        case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
+        {
+            mpToolBoxScriptSw->Hide();
+            mpToolBoxScript->Show();
+            mpToolBoxSpacing->Show();
+            mpToolBoxHighlight->Hide();
+
+            Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
+            aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); 
+            aSize.setWidth(GetOutputSizePixel().Width());
+            SetSizePixel(aSize);
+            if (mxSidebar.is())
+                mxSidebar->requestLayout();
+            break;
+        }
+
+        default:
+            break;
+    }
+}
+
+SfxBindings* TextPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
+
+
+void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetupIcons();
+}
+
+
+
+void TextPropertyPanel::Initialize (void)
+{
+    //<<modify fill font list
+    SfxObjectShell* pDocSh = SfxObjectShell::Current();
+    const SfxPoolItem* pItem = NULL;
+    
+    if (pDocSh != NULL)
+        pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+    if (pItem != NULL)
+        mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
+    else
+    {
+        mpFontList = new FontList( Application::GetDefaultDevice() );
+        mbMustDelete = 1;
+    }
+
+    mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
+    const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )));
+    maFontSizeBox.Fill(&aFontInfo,mpFontList);
+    maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
+
+	//toolbox
+    SetupIcons();
+    InitToolBoxIncDec();
+    InitToolBoxFont();
+    InitToolBoxFontColor();
+    InitToolBoxScript();
+    InitToolBoxSpacing();
+    InitToolBoxHighlight();
+
+#ifdef HAS_IA2
+    mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
+    mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
+    maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
+    maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
+    mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
+    mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
+    mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
+    mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
+    mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
+    mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
+    mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
+#endif
+
+    //init state
+    mpHeightItem = NULL;
+    meWeight = WEIGHT_NORMAL;
+    meItalic = ITALIC_NONE;
+    mbShadow = false;
+    meStrike = STRIKEOUT_NONE;
+    mbPostureAvailable = true;
+    mbWeightAvailable = true;
+    meUnderline = UNDERLINE_NONE;
+    meUnderlineColor = COL_AUTO;   //
+    maColor = COL_BLACK;
+    mbColorAvailable = true;
+    maBackColor = COL_AUTO;
+    mbBackColorAvailable = true;
+    meColorType = FONT_COLOR;
+    meEscape = SVX_ESCAPEMENT_OFF;
+    mbSuper = false;
+    mbSub = false;
+    mbKernAvailable = true;
+    mbKernLBAvailable = true;
+    mlKerning = 0;
+    mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
+            SID_ATTR_CHAR_COLOR,
+            TBI_FONTCOLOR,
+            mpToolBoxFontColor.get(),
+            TBX_UPDATER_MODE_CHAR_COLOR_NEW));
+    mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
+            SID_ATTR_BRUSH_CHAR,
+            TBI_HIGHLIGHT,
+            mpToolBoxHighlight.get(),
+            TBX_UPDATER_MODE_CHAR_COLOR_NEW));
+
+    //set handler
+    mpFontNameBox->SetBindings(mpBindings);
+    //add 
+    Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
+    mpFontNameBox->SetSelectHdl(aLink);
+    //add end
+	
+    aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
+    maFontSizeBox.SetModifyHdl(aLink);
+    //add 
+    aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
+    maFontSizeBox.SetSelectHdl(aLink);
+    //add end
+    aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
+    maFontSizeBox.SetLoseFocusHdl(aLink);
+
+    // add
+    long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();;
+    Point aPosFontSize = maFontSizeBox.GetPosPixel();
+    long aPosY = aPosFontSize.getY();
+    Point pTBIncDec = mpToolBoxIncDec->GetPosPixel();
+    long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight();
+    pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2);
+    mpToolBoxIncDec->SetPosPixel(pTBIncDec);
+    //end
+}
+
+void TextPropertyPanel::EndSpacingPopupMode (void)
+{
+    maCharSpacePopup.Hide();
+}
+
+void TextPropertyPanel::EndUnderlinePopupMode (void)
+{
+	maUnderlinePopup.Hide();
+}
+
+
+void TextPropertyPanel::InitToolBoxFont()
+{
+	mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add
+	mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add
+	mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add
+	mpToolBoxFont->SetBackground(Wallpaper());
+	mpToolBoxFont->SetPaintTransparent(true);
+
+	Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
+	mpToolBoxFont->SetOutputSizePixel( aTbxSize );
+
+	Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
+	mpToolBoxFont->SetSelectHdl ( aLink );
+	aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
+	mpToolBoxFont->SetDropdownClickHdl(aLink);
+}
+
+
+
+
+void TextPropertyPanel::InitToolBoxIncDec()
+{
+	Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
+	mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
+
+	Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
+    mpToolBoxIncDec->SetSelectHdl ( aLink );
+}
+
+
+
+
+void TextPropertyPanel::InitToolBoxFontColor()
+{
+	Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
+	mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
+	mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
+	
+	Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
+    mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
+	mpToolBoxFontColor->SetSelectHdl ( aLink );
+
+}
+void TextPropertyPanel::InitToolBoxScript()
+{
+	Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
+	mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
+	
+	Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
+    mpToolBoxScriptSw->SetSelectHdl ( aLink );
+
+	aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
+	mpToolBoxScript->SetOutputSizePixel( aTbxSize );
+
+	aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
+    mpToolBoxScript->SetSelectHdl ( aLink );
+}
+void TextPropertyPanel::InitToolBoxSpacing()
+{
+	Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
+	mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
+	mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
+
+	Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
+    mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
+	mpToolBoxSpacing->SetSelectHdl( aLink );
+}
+void TextPropertyPanel::InitToolBoxHighlight()
+{
+	Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
+	mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
+	mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
+
+	Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
+    mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
+	mpToolBoxHighlight->SetSelectHdl( aLink );
+}
+
+
+
+
+void TextPropertyPanel::SetupIcons (void)
+{
+    if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+    {
+    	mpToolBoxIncDec->SetItemImage(TBI_INCREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease);
+        mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease);
+        mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold);
+        mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic);
+        mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline);
+        mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike);
+        mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow);
+
+    	mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor);
+        //for sw
+        mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
+        mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
+        //for sc and sd
+        mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
+        mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
+        mpToolBoxSpacing->SetItemImage(TBI_SPACING,  maImgNormalIcon);
+        mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : maImgHighlight);
+    }
+    else
+    {
+        mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow")));
+        mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink")));
+        mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold")));
+        mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic")));
+        mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline")));
+        mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout")));
+        mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed")));
+
+    	mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor")));
+        //for sw
+        mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript")));
+        mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript")));
+        //for sc and sd
+        mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript")));
+        mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript")));
+        mpToolBoxSpacing->SetItemImage(TBI_SPACING,  GetIcon(A2S(".uno:FontworkCharacterSpacingFloater")));
+        mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor")));
+    }
+}
+
+
+
+
+IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
+{
+	if ( !pBox->IsTravelSelect() )
+	{
+		if( SfxViewShell::Current() )
+		{
+			Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+			if ( pShellWnd )
+				pShellWnd->GrabFocus();
+		}
+	}
+	return 0;
+}
+//add end
+IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
+{
+	if (pSizeBox == &maFontSizeBox)
+	{	
+		long nSize = pSizeBox->GetValue();
+		mbFocusOnFontSizeCtrl = true;
+
+		float fSize = (float)nSize / 10;
+		SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+		SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+		mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+		mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+	}
+	return 0;
+}
+//add 
+IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
+{
+	if ( !pSizeBox->IsTravelSelect() )
+	{
+		if( SfxViewShell::Current() )
+		{
+			Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+			if ( pShellWnd )
+				pShellWnd->GrabFocus();
+		}
+	}
+	
+	return 0;
+}
+//add end
+IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
+{
+	if(pSizeBox == &maFontSizeBox)
+	{
+		mbFocusOnFontSizeCtrl = false;
+	}
+	return 0;
+}
+
+IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+
+	//Bold
+	if(nId == TBI_BOLD)
+	{
+		EndTracking();
+		if(meWeight != WEIGHT_BOLD)
+			meWeight = WEIGHT_BOLD;
+		else
+			meWeight = WEIGHT_NORMAL;
+		SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
+		UpdateFontBold();
+	}
+	//Italic
+	else if(nId == TBI_ITALIC)
+	{
+		EndTracking();
+		if(meItalic != ITALIC_NORMAL)
+			meItalic = ITALIC_NORMAL;
+		else
+			meItalic = ITALIC_NONE;
+		SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
+		UpdateFontItalic();
+	}
+	//underline
+	else if(nId == TBI_UNDERLINE)
+	{
+		EndTracking();
+		//add , keep underline's color
+		if(meUnderline == UNDERLINE_NONE)
+		{
+			//AF: meUnderline = GetDefaultUnderline();
+			meUnderline = UNDERLINE_SINGLE;
+			//<<modify 
+			//SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+			SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+			//modify end>>
+			aLineItem.SetColor(meUnderlineColor);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+		}
+		else
+		{
+			meUnderline = UNDERLINE_NONE;
+			//<<modify 
+			//SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+			SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+			//modify end>>
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+		}
+		UpdateFontUnderline();
+		//add end
+	}
+	//strike out
+	else if(nId == TBI_STRIKEOUT)
+	{
+		EndTracking();
+		if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
+			meStrike = STRIKEOUT_NONE;
+		else
+			meStrike = STRIKEOUT_SINGLE;
+		SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
+		UpdateFontStrikeOut();
+	}
+	//shadowed
+	else if(nId == TBI_SHADOWED)
+	{
+		EndTracking();
+		mbShadow = !mbShadow;
+		SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
+		UpdateFontShadowed();
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+
+	// font size +/- enhancement in sd
+    switch (maContext.GetCombinedContext())
+    {
+        case CombinedEnumContext(Application_Draw, Context_DrawText):
+        case CombinedEnumContext(Application_Draw, Context_Text):
+        case CombinedEnumContext(Application_Draw, Context_Table):
+        case CombinedEnumContext(Application_Draw, Context_OutlineText):
+        case CombinedEnumContext(Application_Draw, Context_Draw):
+        case CombinedEnumContext(Application_Draw, Context_TextObject):
+        case CombinedEnumContext(Application_Draw, Context_Graphic):
+        case CombinedEnumContext(Application_Impress, Context_DrawText):
+        case CombinedEnumContext(Application_Impress, Context_Text):
+        case CombinedEnumContext(Application_Impress, Context_Table):
+        case CombinedEnumContext(Application_Impress, Context_OutlineText):
+        case CombinedEnumContext(Application_Impress, Context_Draw):
+        case CombinedEnumContext(Application_Impress, Context_TextObject):
+        case CombinedEnumContext(Application_Impress, Context_Graphic):
+            if(nId == TBI_INCREASE)
+            {
+                EndTracking();
+                SfxVoidItem aItem(SID_GROW_FONT_SIZE);
+                mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
+            }
+            else if(nId == TBI_DECREASE)
+            {
+                EndTracking();
+                SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
+                mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
+            }
+            break;
+
+        default:
+            if(nId == TBI_INCREASE)
+            {
+                EndTracking();
+                mbFocusOnFontSizeCtrl = false;
+                sal_Int64 iValue = maFontSizeBox.GetValue();
+                int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+                long nSize = iValue;
+                if(iPos != LISTBOX_ENTRY_NOTFOUND)
+                    nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
+                else if(iValue >= 100 && iValue < 105)
+                    nSize = 105;
+                else if(iValue >= 105 && iValue < 110)
+                    nSize = 110;
+                else if(iValue < 960)
+                {	
+                    nSize = (nSize / 10) * 10 + 10;
+                    while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+                        nSize += 10;
+                }
+                else
+                {
+                    nSize = iValue;
+                }
+
+                float fSize = (float)nSize / 10;
+
+                SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+                SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+                mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+                mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+                //add  , update ASAP
+                maFontSizeBox.SetValue( nSize );
+                if(nSize >= 960)
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                }
+                else if(nSize <= 60)
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+                }
+                else
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                }
+                //add end
+            }
+            else if(nId == TBI_DECREASE)
+            {
+                EndTracking();
+                mbFocusOnFontSizeCtrl = false;
+                sal_Int64 iValue = maFontSizeBox.GetValue();
+                int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+                long nSize = iValue;
+                if(iPos != LISTBOX_ENTRY_NOTFOUND)
+                    nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
+                else if(iValue > 100 && iValue <= 105)
+                    nSize = 100;
+                else if(iValue > 105 && iValue <= 110)
+                    nSize = 105;
+                else if(iValue > 960)
+                {
+                    nSize = 960;
+                }
+                else if(iValue > 60)
+                {	
+                    nSize = (nSize / 10) * 10 ;
+                    while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+                        nSize -= 10;
+                }
+                else
+                {
+                    nSize = iValue;
+                }
+
+                float fSize = (float)nSize / 10;
+
+                SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+                SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+                mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+                mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+                //add 
+                maFontSizeBox.SetValue( nSize );
+                if(nSize >= 960)
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                }
+                else if(nSize <= 60)
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+                }
+                else
+                {
+                    mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                    mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                }
+                //add end
+            }
+	}
+	return 0;
+}
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	OSL_ASSERT(nId == TBI_UNDERLINE);
+	if(nId == TBI_UNDERLINE)
+	{
+		pToolBox->SetItemDown( nId, true );
+		maUnderlinePopup.Rearrange(meUnderline);
+		maUnderlinePopup.Show(*pToolBox);
+
+	}
+	return 0L;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_FONTCOLOR)
+	{
+		meColorType = FONT_COLOR;
+
+		pToolBox->SetItemDown( nId, true );
+
+		maFontColorPopup.Show(*pToolBox);
+		maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
+	}
+	return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	if( nId == TBI_SUPER_SW )
+	{
+		if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
+		{
+			meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
+			SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
+			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
+		}
+		else
+		{			
+			meEscape = SVX_ESCAPEMENT_OFF;
+			SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
+			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
+		}
+	}
+	else if(TBI_SUB_SW == nId)
+	{
+		if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
+		{
+			meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
+			SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
+			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
+		}
+		else
+		{
+			meEscape = SVX_ESCAPEMENT_OFF;
+			SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
+			mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
+		}
+	}
+	UpdateFontScript();
+
+	return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	if( nId == TBI_SUPER )
+	{
+		mbSuper = !mbSuper;
+		SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
+		mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
+	}
+	else if(TBI_SUB == nId)
+	{
+
+		mbSub = !mbSub;
+		SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
+		mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
+	}
+	UpdateFontScript();
+	return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	if(nId == TBI_HIGHLIGHT)
+	{
+		meColorType = BACK_COLOR;
+
+		pToolBox->SetItemDown( nId, true );
+		maBrushColorPopup.Show(*pToolBox);
+		maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
+
+	}
+	return 0;
+}
+
+
+
+IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
+{
+	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	OSL_ASSERT(nId == TBI_SPACING);
+	if(nId == TBI_SPACING)
+	{
+		pToolBox->SetItemDown( nId, true );
+		maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
+		maCharSpacePopup.Show(*pToolBox);
+
+	}
+	return 0L;
+}
+
+
+
+
+IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{	
+	return 0;
+}
+
+
+
+
+
+
+
+
+void TextPropertyPanel::NotifyItemUpdate (
+    const sal_uInt16 nSID,
+    const SfxItemState eState,
+    const SfxPoolItem* pState)
+{
+	switch(nSID)
+	{
+        case SID_ATTR_CHAR_FONT:
+            if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
+            {
+                mpFontNameBox->Enable();
+                const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
+                mpFontNameBox->SetText( pFontItem->GetFamilyName() );
+            }
+            else
+            {
+                mpFontNameBox->SetText( String() );
+                if (SFX_ITEM_DISABLED == eState)
+                {
+                    mpFontNameBox->Disable();
+                }
+            }
+            break;
+        case SID_ATTR_CHAR_FONTHEIGHT:
+            if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
+            {
+                mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* 
+                SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+                long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );	
+                mpToolBoxIncDec->Enable();
+
+                // font size +/- enhancement in sd
+                switch(maContext.GetCombinedContext())
+                {
+                    case CombinedEnumContext(Application_Draw, Context_DrawText):
+                    case CombinedEnumContext(Application_Draw, Context_Text):
+                    case CombinedEnumContext(Application_Draw, Context_Table):
+                    case CombinedEnumContext(Application_Draw, Context_OutlineText):
+                    case CombinedEnumContext(Application_Draw, Context_Draw):
+                    case CombinedEnumContext(Application_Draw, Context_TextObject):
+                    case CombinedEnumContext(Application_Draw, Context_Graphic):
+                    case CombinedEnumContext(Application_Impress, Context_DrawText):
+                    case CombinedEnumContext(Application_Impress, Context_Text):
+                    case CombinedEnumContext(Application_Impress, Context_Table):
+                    case CombinedEnumContext(Application_Impress, Context_OutlineText):
+                    case CombinedEnumContext(Application_Impress, Context_Draw):
+                    case CombinedEnumContext(Application_Impress, Context_TextObject):
+                    case CombinedEnumContext(Application_Impress, Context_Graphic):
+                        break;
+
+                    default:
+                        if(iValue > 60 && iValue < 960 )
+                        {
+                            mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                            mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                        }
+                        else if (iValue <= 60)
+                        {
+                            mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+                            mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+                        }
+                        else if (iValue >= 960)
+                        {
+                            mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+                            mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+                        }
+                }
+                mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
+                mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
+
+                if( mbFocusOnFontSizeCtrl )
+                    return;
+
+                maFontSizeBox.Enable( );
+                maFontSizeBox.SetValue( iValue );	
+                maFontSizeBox.LoseFocus();
+            }
+            else
+            {			
+                mpHeightItem = NULL;
+                maFontSizeBox.SetText( String() );
+                //increase decrease diabled when multi-seletion have different font size
+			
+                // font size +/- enhancement in sd
+                switch(maContext.GetCombinedContext())
+                {
+                    case CombinedEnumContext(Application_Draw, Context_DrawText):
+                    case CombinedEnumContext(Application_Draw, Context_Text):
+                    case CombinedEnumContext(Application_Draw, Context_Table):
+                    case CombinedEnumContext(Application_Draw, Context_OutlineText):
+                    case CombinedEnumContext(Application_Draw, Context_Draw):
+                    case CombinedEnumContext(Application_Draw, Context_TextObject):
+                    case CombinedEnumContext(Application_Draw, Context_Graphic):
+                    case CombinedEnumContext(Application_Impress, Context_DrawText):
+                    case CombinedEnumContext(Application_Impress, Context_Text):
+                    case CombinedEnumContext(Application_Impress, Context_Table):
+                    case CombinedEnumContext(Application_Impress, Context_OutlineText):
+                    case CombinedEnumContext(Application_Impress, Context_Draw):
+                    case CombinedEnumContext(Application_Impress, Context_TextObject):
+                    case CombinedEnumContext(Application_Impress, Context_Graphic):
+                        break;
+
+                    default:
+                        mpToolBoxIncDec->Disable();
+                }
+                if ( eState <= SFX_ITEM_READONLY )
+                {
+                    maFontSizeBox.Disable( );
+                }
+            }
+            break;	
+        case SID_ATTR_CHAR_WEIGHT:
+            mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
+            {
+                const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
+                meWeight = (FontWeight)pItem->GetValue();
+                TextStyleChanged();
+            }
+            else
+            {
+                meWeight = WEIGHT_NORMAL;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_POSTURE:
+            mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
+            {
+                const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
+                meItalic = (FontItalic)pItem->GetValue();
+                TextStyleChanged();
+            }
+            else
+            {
+                meItalic = ITALIC_NONE;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_UNDERLINE:
+            if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem
+            {
+                //<<delete 
+                //if(pState->ISA(SvxTextLineItem))
+                //{
+                //	const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState;
+                //	meUnderline = (FontUnderline)pItem->GetValue();
+                //	 //add , need to record the underline's color, if not the color will turn to auto
+                //	meUnderlineColor = pItem->GetColor(); 
+                //	//add end
+                //}
+                //else
+                //delete end>>
+                if(pState->ISA(SvxUnderlineItem))
+                {
+                    const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
+                    meUnderline = (FontUnderline)pItem->GetValue();
+                    //add 
+                    meUnderlineColor = pItem->GetColor(); 
+                    //add end
+                }
+                TextStyleChanged();
+            }
+            else
+            {
+                meUnderline = UNDERLINE_NONE;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_SHADOWED:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
+            {
+                const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
+                mbShadow = pItem->GetValue();
+                TextStyleChanged();
+            }
+            else
+            {
+                mbShadow = false;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_STRIKEOUT:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
+            {
+                const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
+                meStrike = (FontStrikeout)pItem->GetValue();
+
+                TextStyleChanged();
+            }
+            else
+            {
+                meStrike = STRIKEOUT_NONE;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_COLOR:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
+            {
+                const SvxColorItem* pItem =  (const SvxColorItem*)pState;
+                maColor = pItem->GetValue();
+                mbColorAvailable = true;
+				if (mpFontColorUpdater)
+	                mpFontColorUpdater->Update(maColor);
+            }
+            else
+            {
+                mbColorAvailable = false;
+                maColor.SetColor(COL_AUTO);
+				if (mpFontColorUpdater)
+					mpFontColorUpdater->Update(maColor);
+            }
+            break;
+        case SID_ATTR_BRUSH_CHAR:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
+            {
+                const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
+                maBackColor = pItem->GetColor();
+                mbBackColorAvailable = true;
+                if (mpHighlightUpdater)
+                    mpHighlightUpdater->Update(maBackColor);
+            }
+            else
+            {
+                mbBackColorAvailable = false;
+                maBackColor.SetColor(COL_AUTO);
+                if (mpHighlightUpdater)
+                    mpHighlightUpdater->Update(maBackColor);
+            }
+            break;
+        case SID_ATTR_CHAR_ESCAPEMENT:
+            if( eState == SFX_ITEM_AVAILABLE)
+            {
+                if( pState->ISA(SvxEscapementItem))
+                {
+                    const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
+                    short nEsc = pItem->GetEsc();
+                    if(nEsc == 0)
+                        meEscape = SVX_ESCAPEMENT_OFF;
+                    else if(nEsc > 0)
+                        meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
+                    else
+                        meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
+                }
+                else
+                {
+                    meEscape = SVX_ESCAPEMENT_OFF;
+                }
+                TextStyleChanged();
+            }
+            else if(eState == SFX_ITEM_DISABLED)
+            {
+                mpToolBoxScriptSw->EnableItem(TBI_SUPER,false);
+                mpToolBoxScriptSw->EnableItem(TBI_SUB,false);
+            }
+            else
+            {
+                meEscape = SVX_ESCAPEMENT_OFF;
+                TextStyleChanged();
+            }	
+            break;
+        case SID_SET_SUB_SCRIPT:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
+            {
+                const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+                mbSub = pItem->GetValue();
+                TextStyleChanged();
+            }
+            else
+            {
+                mbSub = false;
+                TextStyleChanged();
+            }
+            break;
+        case SID_SET_SUPER_SCRIPT:
+            if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
+            {
+                const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+                mbSuper = pItem->GetValue();
+                TextStyleChanged();
+            }
+            else
+            {
+                mbSuper = false;
+                TextStyleChanged();
+            }
+            break;
+        case SID_ATTR_CHAR_KERNING:     
+            if ( SFX_ITEM_AVAILABLE == eState )
+            {
+                mbKernLBAvailable = true;
+            
+                if(pState->ISA(SvxKerningItem))
+                {
+                    const SvxKerningItem* pKerningItem  = (const SvxKerningItem*)pState;      
+                    mlKerning = (long)pKerningItem->GetValue();			
+                    mbKernAvailable = true;
+                }
+                else
+                {
+                    mlKerning = 0;
+                    mbKernAvailable =false;
+                }
+            }
+            else if (SFX_ITEM_DISABLED == eState)
+            {
+                mbKernLBAvailable = false;
+                mbKernAvailable = false;
+                mlKerning = 0;
+            }
+            else
+            {
+                mbKernLBAvailable = true;
+                mbKernAvailable = false;	
+                mlKerning = 0;
+            }
+            break;
+
+            // font size +/- enhancement in sd
+        case SID_SHRINK_FONT_SIZE:
+        case SID_GROW_FONT_SIZE:
+                switch(maContext.GetCombinedContext())
+                {
+                    case CombinedEnumContext(Application_Draw, Context_DrawText):
+                    case CombinedEnumContext(Application_Draw, Context_Text):
+                    case CombinedEnumContext(Application_Draw, Context_Table):
+                    case CombinedEnumContext(Application_Draw, Context_OutlineText):
+                    case CombinedEnumContext(Application_Draw, Context_Draw):
+                    case CombinedEnumContext(Application_Draw, Context_TextObject):
+                    case CombinedEnumContext(Application_Draw, Context_Graphic):
+                    case CombinedEnumContext(Application_Impress, Context_DrawText):
+                    case CombinedEnumContext(Application_Impress, Context_Text):
+                    case CombinedEnumContext(Application_Impress, Context_Table):
+                    case CombinedEnumContext(Application_Impress, Context_OutlineText):
+                    case CombinedEnumContext(Application_Impress, Context_Draw):
+                    case CombinedEnumContext(Application_Impress, Context_TextObject):
+                    case CombinedEnumContext(Application_Impress, Context_Graphic):
+                        if(eState == SFX_ITEM_DISABLED)
+                        {
+                            mpToolBoxIncDec->Disable();
+                        }
+                        else
+                        {
+                            mpToolBoxIncDec->Enable();
+                        }
+                    break;
+                }
+                break;
+    }
+}
+
+
+
+
+void TextPropertyPanel::TextStyleChanged()
+{
+	if( !mbWeightAvailable )
+		mpToolBoxFont->EnableItem(TBI_BOLD,false);
+	else
+		mpToolBoxFont->EnableItem(TBI_BOLD,true);
+
+	if(!mbPostureAvailable )
+		mpToolBoxFont->EnableItem(TBI_ITALIC,false);
+	else
+		mpToolBoxFont->EnableItem(TBI_ITALIC,true);
+
+	UpdateFontBold();
+	UpdateFontItalic();
+	UpdateFontUnderline();
+	UpdateFontStrikeOut();
+	UpdateFontShadowed();
+	UpdateFontScript();
+}
+
+
+
+
+void TextPropertyPanel::UpdateFontBold()
+{
+	if( meWeight == WEIGHT_BOLD )
+	{	
+		mpToolBoxFont->SetItemState(TBI_BOLD,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxFont->SetItemState(TBI_BOLD,	STATE_NOCHECK);
+	}
+}
+void TextPropertyPanel::UpdateFontItalic()
+{
+	if(meItalic == ITALIC_NORMAL)
+	{
+		mpToolBoxFont->SetItemState(TBI_ITALIC,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxFont->SetItemState(TBI_ITALIC,	STATE_NOCHECK);
+	}
+}
+void TextPropertyPanel::UpdateFontUnderline()
+{
+	if(meUnderline == UNDERLINE_NONE)
+	{
+		mpToolBoxFont->SetItemState(TBI_UNDERLINE,	STATE_NOCHECK);
+	}
+	else
+	{
+		mpToolBoxFont->SetItemState(TBI_UNDERLINE,	STATE_CHECK);
+	}
+}
+void TextPropertyPanel::UpdateFontStrikeOut()
+{
+	if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
+	{
+		mpToolBoxFont->SetItemState(TBI_STRIKEOUT,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxFont->SetItemState(TBI_STRIKEOUT,	STATE_NOCHECK);
+	}
+}
+void TextPropertyPanel::UpdateFontShadowed()
+{
+	if(mbShadow)
+	{
+		mpToolBoxFont->SetItemState(TBI_SHADOWED,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxFont->SetItemState(TBI_SHADOWED,	STATE_NOCHECK);
+	}
+}
+void  TextPropertyPanel::UpdateFontScript()
+{
+	//script for sw
+	mpToolBoxScriptSw->EnableItem(TBI_SUPER,true);
+	mpToolBoxScriptSw->EnableItem(TBI_SUB,true);
+	if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
+	{
+		mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW,	STATE_CHECK);
+		mpToolBoxScriptSw->SetItemState(TBI_SUB_SW,	STATE_NOCHECK);
+	}
+	else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT)
+	{
+		mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW,	STATE_NOCHECK);
+		mpToolBoxScriptSw->SetItemState(TBI_SUB_SW,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW,	STATE_NOCHECK);
+		mpToolBoxScriptSw->SetItemState(TBI_SUB_SW,	STATE_NOCHECK);
+	}
+
+	//script for sc sd
+	mpToolBoxScript->EnableItem(TBI_SUPER,true);
+	mpToolBoxScript->EnableItem(TBI_SUB,true);
+	if(mbSuper)
+	{
+		mpToolBoxScript->SetItemState(TBI_SUPER,	STATE_CHECK);
+		mpToolBoxScript->SetItemState(TBI_SUB,	STATE_NOCHECK);
+	}
+	else if(mbSub)
+	{
+		mpToolBoxScript->SetItemState(TBI_SUPER,	STATE_NOCHECK);
+		mpToolBoxScript->SetItemState(TBI_SUB,	STATE_CHECK);
+	}
+	else
+	{
+		mpToolBoxScript->SetItemState(TBI_SUPER,	STATE_NOCHECK);
+		mpToolBoxScript->SetItemState(TBI_SUB,	STATE_NOCHECK);
+	}
+}
+
+Color TextPropertyPanel::GetFontColor (void) const
+{
+    return maColor;
+}
+
+void TextPropertyPanel::SetFontColor (
+    const String& rsColorName,
+    const Color aColor)
+{
+	SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+	maColor = aColor;
+}
+
+Color TextPropertyPanel::GetBrushColor (void) const
+{
+    return maBackColor;
+}
+
+void TextPropertyPanel::SetBrushColor (
+    const String& rsColorName,
+    const Color aColor)
+{
+	SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
+	maBackColor = aColor;
+}
+
+Color& TextPropertyPanel::GetUnderlineColor() 
+{
+	return meUnderlineColor;
+}
+
+void TextPropertyPanel::SetUnderline(FontUnderline	eUnderline)
+{
+	meUnderline = eUnderline;
+}
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/text/TextPropertyPanel.hrc b/main/svx/source/sidebar/text/TextPropertyPanel.hrc
new file mode 100644
index 0000000..b41b582
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -0,0 +1,227 @@
+/**************************************************************
+ * 
+ * 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 "svx/dialogs.hrc"
+
+#define VS_SPACING_WIDTH		80
+#define	CUSTOM_HEIGHT			CBOX_HEIGHT +  MBOX_HEIGHT + POPUPPANEL_MARGIN_LARGE * 3 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT * 2
+#define CUSTOM_WIDTH			VS_SPACING_WIDTH - 8
+#define CUSTOM_X				POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1
+#define CUSTOM_Y				OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT
+#define VS_UNDERLINE_WIDTH	57
+#define VS_UNDERLINE_HEIGHT	 12 * 10
+//#define FT_TEST					1
+#define CB_SBFONT_FONT			2
+#define MB_SBFONT_FONTSIZE		3
+#define TB_FONT					4
+#define	TB_INCREASE_DECREASE	5
+#define	TB_FONTCOLOR			6
+#define TB_SCRIPT_SW			7
+#define	TB_HIGHLIGHT			8
+#define TB_SPACING				9
+#define TB_SCRIPT				10
+
+
+#define IMG_INCREASE			11
+#define IMG_INCREASE_H			12
+#define IMG_DECREASE			13
+#define IMG_DECREASE_H			14
+#define IMG_BOLD 				15
+#define IMG_BOLD_H				16
+#define IMG_ITALIC				17
+#define IMG_ITALIC_H			18
+#define IMG_UNDERLINE			19
+#define IMG_UNDERLINE_H			20
+#define IMG_STRIKEOUT			21
+#define IMG_STRIKEOUT_H			22
+#define IMG_SHADOWED			23
+#define IMG_SHADOWED_H			24
+#define IMG_FONTCOLOR			25
+#define IMG_FONTCOLOR_H			26
+#define IMG_SUPSCRIPT			27
+#define IMG_SUPSCRIPT_H			28
+#define IMG_SUBSCRIPT			29
+#define IMG_SUBSCRIPT_H			30
+//#define IMG_SPACING				31
+//#define IMG_SPACING_H			32
+#define IMG_HIGHLIGHT			33
+#define IMG_HIGHLIGHT_H			34
+
+#define TBI_FONTCOLOR			50
+#define TBI_BOLD				51
+#define TBI_ITALIC				52
+#define TBI_UNDERLINE			53
+#define TBI_STRIKEOUT			54
+#define TBI_SHADOWED			55
+#define TBI_INCREASE			56
+#define TBI_DECREASE			57
+#define TBI_HIGHLIGHT			58
+#define TBI_SUPER				59
+#define TBI_SUB					60
+#define TBI_SUPER_SW			61
+#define TBI_SUB_SW				62
+#define TBI_SPACING				63
+
+#define IMG_SPACING_D				71
+
+//popup window underline
+#define	VS_UNDERLINE			1
+#define PB_OPTIONS				2
+#define BMP_UNDERLINE_MORE		3
+#define BMP_UNDERLINE_MORE_H	4	
+
+#define IMG_SINGLE				10
+#define IMG_DOUBLE				11
+#define IMG_BOLD2				12
+#define IMG_DOT					13
+#define IMG_DOT_BOLD			14
+#define IMG_DASH				15
+#define IMG_DASH_LONG			16
+#define IMG_DASH_DOT			17
+#define IMG_DASH_DOT_DOT		18
+#define IMG_WAVE				19
+
+#define STR_SINGLE				20
+#define STR_DOUBLE				21
+#define STR_BOLD				22
+#define STR_DOT					23
+#define STR_DOT_BOLD			24
+#define STR_DASH				25
+#define STR_DASH_LONG			26
+#define STR_DASH_DOT			27
+#define STR_DASH_DOT_DOT		28
+#define STR_WAVE				29
+
+#define IMG_SINGLE_H			30
+#define IMG_DOUBLE_H			31
+#define IMG_BOLD2_H				32
+#define IMG_DOT_H				33
+#define IMG_DOT_BOLD_H			34
+#define IMG_DASH_H				35
+#define IMG_DASH_LONG_H			36
+#define IMG_DASH_DOT_H			37
+#define IMG_DASH_DOT_DOT_H		38
+#define IMG_WAVE_H				39
+
+#define IMG_SINGLE_SEL			40
+#define IMG_DOUBLE_SEL			41
+#define IMG_BOLD2_SEL			42
+#define IMG_DOT_SEL				43
+#define IMG_DOT_BOLD_SEL		44
+#define IMG_DASH_SEL			45
+#define IMG_DASH_LONG_SEL		46
+#define IMG_DASH_DOT_SEL		47
+#define IMG_DASH_DOT_DOT_SEL	48
+#define IMG_WAVE_SEL			49
+
+//popup window font color
+#define VS_FONT_COLOR			1
+#define STR_AUTOMATICE			2
+
+//POPUP WINDOW OF SPACING
+#define VS_SPACING					1
+
+#define	CT_BORDER					7
+#define LB_KERNING					8
+#define ED_KERNING					9
+
+#define FT_SPACING					18
+#define FT_BY						19
+#define FT_LASTCUSTOM				20
+
+#define IMG_NORMAL					31
+#define IMG_VERY_TIGHT				32
+#define IMG_TIGHT					33
+#define IMG_LOOSE					34
+#define IMG_VERY_LOOSE				35
+#define IMG_CUSTOM					36
+#define IMG_CUSTOM_GRAY				37
+
+#define IMG_NORMAL_S				51
+#define IMG_VERY_TIGHT_S			52
+#define IMG_TIGHT_S					53
+#define IMG_LOOSE_S					54
+#define IMG_VERY_LOOSE_S			55
+
+#define STR_VERY_TIGHT				61
+#define STR_TIGHT					62
+#define STR_NORMAL					63
+#define STR_LOOSE					64
+#define STR_VERY_LOOSE				65
+#define STR_CUSTOM					66
+
+#define STR_VERY_TIGHT_TIP			67
+#define STR_TIGHT_TIP				68
+#define STR_NORMAL_TIP				69
+#define STR_LOOSE_TIP				70
+#define STR_VERY_LOOSE_TIP			71
+
+#define STR_CUSTOM_C_TIP			72
+#define STR_CUSTOM_E_TIP			73
+#define STR_PT						74
+#define STR_QH_BOLD				75
+#define STR_QH_ITALIC			76
+#define STR_QH_UNDERLINE		77
+
+//help ids
+#define	HID_COMBO_FONT_NAME				"SVX_HID_COMBO_FONT_NAME"
+#define HID_METRIC_FONT_SIZE            "SVX_HID_METRIC_FONT_SIZE"
+#define HID_TB_INCREASE_DECREASE		"SVX_HID_TB_INCREASE_DECREASE"
+#define HID_TBI_INCREASE				"SVX_HID_TBI_INCREASE"
+#define HID_TBI_DECREASE				"SVX_HID_TBI_DECREASE"
+#define HID_TB_FONT						"SVX_HID_TB_FONT"
+#define HID_TBI_FONT_BOLD				"SVX_HID_TBI_FONT_BOLD"
+#define HID_TBI_FONT_ITALIC				"SVX_HID_TBI_FONT_ITALIC"
+#define HID_TBI_FONT_UNDERLINE			"SVX_HID_TBI_FONT_UNDERLINE"
+#define HID_TBI_FONT_STRIKEOUT			"SVX_HID_TBI_FONT_STRIKEOUT"
+#define HID_TBI_FONT_SHADOWED			"SVX_HID_TBI_FONT_SHADOWED"
+#define HID_TB_COLOR					"SVX_HID_TB_COLOR"
+#define HID_TBI_COLOR					"SVX_HID_TBI_COLOR"
+#define HID_TB_SCRIPT					"SVX_HID_TB_SCRIPT"
+#define HID_TBI_SCRIPT_SUPER			"SVX_HID_TBI_SCRIPT_SUPER"
+#define HID_TBI_SCRIPT_SUB				"SVX_HID_TBI_SCRIPT_SUB"
+#define HID_TB_SCRIPT_SW				"SVX_HID_TB_SCRIPT_SW"
+#define HID_TBI_SCRIPT_SW_SUPER			"SVX_HID_TBI_SCRIPT_SW_SUPER"
+#define HID_TBI_SCRIPT_SW_SUB			"SVX_HID_TBI_SCRIPT_SW_SUB"
+#define HID_TB_SPACING					"SVX_HID_TB_SPACING"
+#define HID_TBI_SPACING					"SVX_HID_TBI_SPACING"
+#define HID_TB_HIGHLIGHT				"SVX_HID_TB_HIGHLIGHT"
+#define HID_TBI_HIGHLIGHT				"SVX_HID_TBI_HIGHLIGHT"
+
+#define HID_UNDERLINE_VS				"SVX_HID_UNDERLINE_VS"
+#define HID_UNDERLINE_BTN				"SVX_HID_UNDERLINE_BTN"
+
+#define HID_COLOR_VS					"SVX_HID_COLOR_VS"
+
+#define HID_SPACING_TB_VERY_LOOSE		"SVX_HID_SPACING_TB_VERY_LOOSE"
+#define HID_SPACING_TBI_VERY_LOOSE		"SVX_HID_SPACING_TBI_VERY_LOOSE"
+#define HID_SPACING_TB_LOOSE			"SVX_HID_SPACING_TB_LOOSE"
+#define HID_SPACING_TBI_LOOSE			"SVX_HID_SPACING_TBI_LOOSE"
+#define HID_SPACING_TB_NORMAL			"SVX_HID_SPACING_TB_NORMAL"
+#define HID_SPACING_TBI_NORMAL			"SVX_HID_SPACING_TBI_NORMAL"
+#define HID_SPACING_TB_TIGHT			"SVX_HID_SPACING_TB_TIGHT"
+#define HID_SPACING_TBI_TIGHT			"SVX_HID_SPACING_TBI_TIGHT"
+#define HID_SPACING_TB_VERY_TIGHT		"SVX_HID_SPACING_TB_VERY_TIGHT"
+#define HID_SPACING_TBI_VERY_TIGHT		"SVX_HID_SPACING_TBI_VERY_TIGHT"
+#define HID_SPACING_TB_CUSTOM			"SVX_HID_SPACING_TB_CUSTOM"
+#define HID_SPACING_TBI_CUSTOM			"SVX_HID_SPACING_TBI_CUSTOM"
+#define HID_SPACING_CB_KERN				"SVX_HID_SPACING_CB_KERN"
+#define HID_SPACING_MB_KERN				"SVX_HID_SPACING_MB_KERN"
diff --git a/main/svx/source/sidebar/text/TextPropertyPanel.hxx b/main/svx/source/sidebar/text/TextPropertyPanel.hxx
new file mode 100644
index 0000000..51fedc9
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -0,0 +1,246 @@
+/**************************************************************
+ * 
+ * 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 SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
+#define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+
+#include <svtools/ctrlbox.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/fhgtitem.hxx>
+
+//#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/ui/XSidebar.hpp>
+
+#include <boost/scoped_ptr.hpp>
+#include "TextCharacterSpacingPopup.hxx"
+#include "TextUnderlinePopup.hxx"
+#include <svx/sidebar/ColorPopup.hxx>
+#include <vcl/vclenum.hxx>
+
+class FloatingWindow;
+class ToolBox;
+
+namespace svx { namespace sidebar {
+
+class SvxSBFontNameBox;
+class PopupControl;
+class PopupContainer;
+
+class TextPropertyPanel
+    : public Control,
+       public ::sfx2::sidebar::IContextChangeReceiver,
+      public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+    static TextPropertyPanel* Create (
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+    SfxBindings* GetBindings();
+    ::sfx2::sidebar::ControllerItem& GetSpaceController();
+    long GetSelFontSize();
+    void SetSpacing(long nKern);
+    void EndSpacingPopupMode (void);
+    void EndUnderlinePopupMode (void);
+	Color GetFontColor (void) const;
+	void SetFontColor (const String& rsColorName,const Color aColor);
+	Color GetBrushColor (void) const;
+	void SetBrushColor (const String& rsColorName,const Color aColor);
+	void SetUnderline(FontUnderline	eUnderline);
+	Color& GetUnderlineColor(); 
+	void SetDefaultUnderline(FontUnderline eUnderline);
+
+
+    enum ColorType
+    {
+        FONT_COLOR = 1,
+        BACK_COLOR = 2
+    };
+
+    virtual void HandleContextChange (
+        const ::sfx2::sidebar::EnumContext aContext);
+
+    virtual void NotifyItemUpdate(
+        const sal_uInt16 nSId,
+        const SfxItemState eState,
+        const SfxPoolItem* pState);
+
+private:
+	//ui controls
+    ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
+	FontSizeBox maFontSizeBox;
+	::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
+	::boost::scoped_ptr<Window> mpToolBoxFontBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxFont;
+	::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;	
+	::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;	
+	::boost::scoped_ptr<Window> mpToolBoxScriptBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxScript;
+	::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
+	::boost::scoped_ptr<Window> mpToolBoxSpacingBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
+	::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
+	::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
+	::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
+    ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
+
+	//control items
+	::sfx2::sidebar::ControllerItem maFontNameControl;
+	::sfx2::sidebar::ControllerItem maFontSizeControl;
+	::sfx2::sidebar::ControllerItem maWeightControl;
+	::sfx2::sidebar::ControllerItem maItalicControl;
+	::sfx2::sidebar::ControllerItem maUnderlineControl;
+	::sfx2::sidebar::ControllerItem maStrikeControl;
+	::sfx2::sidebar::ControllerItem maShadowControl;
+	::sfx2::sidebar::ControllerItem maFontColorControl;
+	::sfx2::sidebar::ControllerItem maScriptControlSw;
+	::sfx2::sidebar::ControllerItem maSuperScriptControl;
+	::sfx2::sidebar::ControllerItem maSubScriptControl;
+	::sfx2::sidebar::ControllerItem maSpacingControl;
+	::sfx2::sidebar::ControllerItem maHighlightControl;
+	::sfx2::sidebar::ControllerItem maSDFontGrow;
+	::sfx2::sidebar::ControllerItem maSDFontShrink;
+
+	//Images
+	Image	maImgIncrease;
+	Image	maImgDecrease;
+	Image	maImgBold;
+	Image	maImgItalic;
+	Image	maImgUnderline;
+	Image	maImgStrike;
+	Image	maImgShadow;
+	Image	maImgFontColor;
+	Image	maImgSupScript;
+	Image	maImgSubScript;
+	Image   maImgHighlight;
+
+	Image				maImgNormalIcon;
+
+	Image	maImgIncreaseHigh;
+	Image	maImgDecreaseHigh;
+	Image	maImgBoldHigh;
+	Image	maImgItalicHigh;
+	Image	maImgUnderlineHigh;
+	Image	maImgStrikeHigh;
+	Image	maImgShadowHigh;
+	Image	maImgFontColorHigh;
+	Image	maImgSupScriptHigh;
+	Image	maImgSubScriptHigh;
+	Image   maImgHighlightHigh;
+
+	FontWeight					meWeight;
+	FontItalic					meItalic;
+	FontUnderline				meUnderline;
+	Color						meUnderlineColor;  //
+	bool						mbShadow;
+	FontStrikeout				meStrike;
+	bool mbWeightAvailable;
+	bool mbPostureAvailable;
+	Color						maColor;
+	bool mbColorAvailable;
+	Color						maBackColor;
+	bool mbBackColorAvailable;
+	ColorType meColorType;
+	SvxEscapement				meEscape;  //for sw
+	bool						mbSuper;
+	bool						mbSub;
+	bool						mbKernAvailable;
+	bool						mbKernLBAvailable;
+	long						mlKerning;
+	SvxFontHeightItem*			mpHeightItem;
+
+	const FontList* mpFontList;
+	bool mbMustDelete;
+	bool mbFocusOnFontSizeCtrl;
+	TextCharacterSpacingPopup maCharSpacePopup;
+	TextUnderlinePopup maUnderlinePopup;
+	ColorPopup maFontColorPopup; 
+	ColorPopup maBrushColorPopup; 
+
+    cssu::Reference<css::frame::XFrame> mxFrame;
+    ::sfx2::sidebar::EnumContext maContext;
+    SfxBindings* mpBindings;
+    cssu::Reference<css::ui::XSidebar> mxSidebar;
+        
+    TextPropertyPanel (
+        Window* pParent,
+        const cssu::Reference<css::frame::XFrame>& rxFrame,
+        SfxBindings* pBindings,
+        const cssu::Reference<css::ui::XSidebar>& rxSidebar);
+	virtual ~TextPropertyPanel (void);
+
+	
+	PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
+	PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
+	PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
+	PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
+	DECL_LINK(SpacingClickHdl, ToolBox*);
+	DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker 
+	DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
+	DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
+
+	void Initialize (void);
+    void SetupIcons (void);
+	void InitToolBoxFont();
+	void InitToolBoxIncDec();
+	void InitToolBoxFontColor();
+	void InitToolBoxScript();
+	void InitToolBoxHighlight();
+	void InitToolBoxSpacing();
+
+	void UpdateFontBold();
+	void UpdateFontItalic();
+	void UpdateFontUnderline();
+	void UpdateFontStrikeOut();
+	void UpdateFontShadowed();
+	void UpdateFontScript();
+
+	DECL_LINK(FontSelHdl, FontNameBox *);
+	DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
+	DECL_LINK(FontSizeSelHdl, FontSizeBox *);
+	DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
+	DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
+	DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
+	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
+	DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
+	DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
+	
+	
+
+	void TextStyleChanged();
+
+    Image GetIcon (const ::rtl::OUString& rsURL);
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif
diff --git a/main/svx/source/sidebar/text/TextPropertyPanel.src b/main/svx/source/sidebar/text/TextPropertyPanel.src
new file mode 100644
index 0000000..1e0b3d2
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextPropertyPanel.src
@@ -0,0 +1,801 @@
+/**************************************************************
+ * 
+ * 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 "TextPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include "helpid.hrc"
+
+#define CONTROL_HEIGHT_FONT_NAME  		250
+#define CONTROL_HEIGHT_FONT_SIZE		180
+#define FONTNAME_WIDTH					TOOLBOX_ITEM_WIDTH * 2 + TOOLBOX_ITEM_DD_WIDTH
+#define FONTSIZE_WIDTH					TOOLBOX_ITEM_WIDTH * 2
+
+#define TB_SPACE				18
+#define TB_SPACE_V				4
+#define TEXT_WIDTH				TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3
+
+#define FT_TB_SPACE				1
+#define BK_IMG					20
+
+Control RID_SIDEBAR_TEXT_PANEL
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + TOOLBOX_ITEM_HEIGHT * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT );
+	HelpID = HID_PROPERTYPANEL_TEXT_SECTION ;
+	Text = "Text";
+	
+	ComboBox CB_SBFONT_FONT
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ); 
+		Size = MAP_APPFONT ( FONTNAME_WIDTH , CONTROL_HEIGHT_FONT_NAME  );
+		TabStop = TRUE;
+		DropDown = TRUE;
+		HelpID = HID_COMBO_FONT_NAME ;
+		QuickHelpText [ en-US ] = "Font";
+	};
+	MetricBox MB_SBFONT_FONTSIZE
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + FONTNAME_WIDTH + 2, SECTIONPAGE_MARGIN_VERTICAL_TOP); 
+		Size = MAP_APPFONT ( FONTSIZE_WIDTH - 1, CONTROL_HEIGHT_FONT_SIZE );
+		TabStop = TRUE;
+		DropDown = TRUE;
+		HelpID = HID_METRIC_FONT_SIZE;
+		QuickHelpText [ en-US ] = "Font Size";
+	};
+	
+	ToolBox TB_INCREASE_DECREASE
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP) ;
+		Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+//		HelpID = HID_TB_INCREASE_DECREASE;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE;
+		Text = "Font Size Adjusting" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_INCREASE;
+				Text [ en-US ] = "Increase Font Size" ;
+//				HelpID = HID_TBI_INCREASE;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_DECREASE;
+				Text [ en-US ] = "Decrease Font Size" ;
+//				HelpID = HID_TBI_DECREASE;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE;
+			};
+		};
+	};
+	ToolBox TB_FONT
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL  + 1) ;
+		Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ; 
+		TabStop = TRUE ;
+//		HelpID = HID_TB_FONT;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT;
+		Text = "Font Effects" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_BOLD;
+				Text [ en-US ] = "Bold" ;
+//				HelpID = HID_TBI_FONT_BOLD;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_ITALIC;
+				Text [ en-US ] = "Italic" ;
+//				HelpID = HID_TBI_FONT_ITALIC;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_UNDERLINE;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Underline" ;
+//				HelpID = HID_TBI_FONT_UNDERLINE;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE;				
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_STRIKEOUT;
+				Text [ en-US ] = "Strikethrough" ;
+//				HelpID = HID_TBI_FONT_STRIKEOUT;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_SHADOWED;
+				Text [ en-US ] = "Shadow" ;
+//				HelpID = HID_TBI_FONT_SHADOWED;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED;
+			};		
+		};
+	};
+	
+	String STR_QH_BOLD
+	{
+		Text [ en-US ] = "Bold (Ctrl+B)";
+	};
+	String STR_QH_ITALIC
+	{
+		Text [ en-US ] = "Italic (Ctrl+I)";
+	};
+	String STR_QH_UNDERLINE
+	{
+		Text [ en-US ] = "Underline (Ctrl+U)";
+	};
+
+	
+	ToolBox TB_FONTCOLOR
+	{
+//		HelpID = HID_TB_COLOR;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL  + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+		Text = "Font Color" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_FONTCOLOR ;
+//				HelpID =  HID_TBI_COLOR;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Font Color" ;
+			};
+		};
+	};
+	
+	ToolBox TB_HIGHLIGHT
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL  - TOOLBOX_ITEM_WIDTH * 2 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + (TOOLBOX_ITEM_HEIGHT + 2) + CONTROL_SPACING_VERTICAL * 2 + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+//		HelpID = HID_TB_HIGHLIGHT;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR;
+		Text = "Highlight Color" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_HIGHLIGHT ;
+//				HelpID =  HID_TBI_HIGHLIGHT;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Highlight Color" ;
+			};
+		};
+	};
+	
+	ToolBox TB_SCRIPT_SW
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+//		HelpID = HID_TB_SCRIPT_SW;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW;
+		Text = "Font Position" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_SUPER_SW;
+				Text [ en-US ] = "Superscript" ;
+//				HelpID = HID_TBI_SCRIPT_SW_SUPER;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_SUB_SW;
+				Text [ en-US ] = "Subscript" ;
+//				HelpID = HID_TBI_SCRIPT_SW_SUB;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW;
+			};
+		};
+	};
+	ToolBox TB_SCRIPT
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+//		HelpID = HID_TB_SCRIPT;
+		HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT;
+		Text = "Font Position" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_SUPER;
+				Text [ en-US ] = "Superscript" ;
+//				HelpID = HID_TBI_SCRIPT_SUPER;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER;
+			};
+			ToolBoxItem
+			{
+				Identifier = TBI_SUB;
+				Text [ en-US ] = "Subscript" ;
+//				HelpID = HID_TBI_SCRIPT_SUB;
+				HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB;
+			};
+		};
+	};
+	
+	ToolBox TB_SPACING
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2  + 4 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ;
+		Size = MAP_APPFONT (TOOLBOX_24_16_ITEM_DD_WIDTH, TOOLBOX_24_16_ITEM_HEIGHT ) ;
+		TabStop = TRUE ;
+		HelpID = HID_TB_SPACING;
+		Text = "Character Spacing" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				Identifier = TBI_SPACING;
+				DropDown = TRUE ;
+				Text [ en-US ] = "Character Spacing" ;
+				HelpID = HID_TBI_SPACING;
+			};
+		};
+	};
+	
+	Image IMG_INCREASE
+	{
+		ImageBitmap = Bitmap{File = "symphony/enlarge font.png";};
+	//	MaskColor = IMAGE_MASK_COLOR;
+	};
+	Image IMG_INCREASE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/enlarge font.png";};
+	};
+	Image IMG_DECREASE
+	{
+		ImageBitmap = Bitmap{File = "symphony/decrease font.png";};
+	};
+	Image IMG_DECREASE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/decrease font.png";};
+	};
+	Image IMG_BOLD
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp
+	};
+	Image IMG_BOLD_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};
+	};
+	Image IMG_ITALIC
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp
+	};
+	Image IMG_ITALIC_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};
+	};
+	Image IMG_UNDERLINE
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png
+	};
+	Image IMG_UNDERLINE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};
+	};
+
+	Image IMG_STRIKEOUT
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png
+	};
+	Image IMG_STRIKEOUT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};
+	};
+	Image IMG_SHADOWED
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png
+	};
+	Image IMG_SHADOWED_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};
+	};
+	Image IMG_FONTCOLOR
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_color.png";};
+	};
+	Image IMG_FONTCOLOR_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_color.png";};
+	};
+	Image IMG_SUPSCRIPT
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";};
+	};
+	Image IMG_SUPSCRIPT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";};
+	};
+	Image IMG_SUBSCRIPT
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";};
+	};
+	Image IMG_SUBSCRIPT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";};
+	};
+//	Image IMG_SPACING
+//	{
+//		ImageBitmap = Bitmap{File = "symphony/icon_normal.png";};
+//	};
+//	Image IMG_SPACING_H
+//	{
+//		ImageBitmap = Bitmap{File = "symphony/icon_normal.png";};
+//	};
+	Image IMG_HIGHLIGHT
+	{
+		ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor
+	};
+	Image IMG_HIGHLIGHT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/Highlight.png";};
+	};
+	
+	//small icon for spacing
+	Image IMG_SPACING_D
+	{
+		ImageBitmap = Bitmap{File = "symphony/icon_normal.png";};
+	};
+};
+
+Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE  
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH,  13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE);
+	Control VS_UNDERLINE
+	{
+//		HelpID = HID_UNDERLINE_VS ;
+		HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH  ,VS_UNDERLINE_HEIGHT);
+		TabStop = TRUE ;
+		Text = "Underline";
+	};
+
+	PushButton PB_OPTIONS
+	{
+		HelpID = HID_UNDERLINE_BTN;
+		Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_SMALL + OFFSET_X  , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + VS_UNDERLINE_HEIGHT ); 
+		Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH, 13 );
+		TabStop = TRUE;
+		Text [ en-US ] = "~More Options...";
+	};
+	
+	
+	Image IMG_SINGLE
+	{
+		ImageBitmap = Bitmap{File = "symphony/line1.bmp";};
+	};
+	Image IMG_DOUBLE
+	{
+		ImageBitmap = Bitmap{File = "symphony/line2.bmp";};
+	};
+	Image IMG_BOLD2
+	{
+		ImageBitmap = Bitmap{File = "symphony/line3.bmp";};
+	};
+	Image IMG_DOT
+	{
+		ImageBitmap = Bitmap{File = "symphony/line4.bmp";};
+	};
+	Image IMG_DOT_BOLD
+	{
+		ImageBitmap = Bitmap{File = "symphony/line5.bmp";};
+	};
+	Image IMG_DASH
+	{
+		ImageBitmap = Bitmap{File = "symphony/line6.bmp";};
+	};
+	Image IMG_DASH_LONG
+	{
+		ImageBitmap = Bitmap{File = "symphony/line7.bmp";};
+	};
+	Image IMG_DASH_DOT
+	{
+		ImageBitmap = Bitmap{File = "symphony/line8.bmp";};
+	};
+	Image IMG_DASH_DOT_DOT
+	{
+		ImageBitmap = Bitmap{File = "symphony/line9.bmp";};
+	};
+	Image IMG_WAVE
+	{
+		ImageBitmap = Bitmap{File = "symphony/line10.bmp";};
+	};
+	
+	//high contract
+	Image IMG_SINGLE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line1_h.bmp";};
+	};
+	Image IMG_DOUBLE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line2_h.bmp";};
+	};
+	Image IMG_BOLD2_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line3_h.bmp";};
+	};
+	Image IMG_DOT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line4_h.bmp";};
+	};
+	Image IMG_DOT_BOLD_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line5_h.bmp";};
+	};
+	Image IMG_DASH_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line6_h.bmp";};
+	};
+	Image IMG_DASH_LONG_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line7_h.bmp";};
+	};
+	Image IMG_DASH_DOT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line8_h.bmp";};
+	};
+	Image IMG_DASH_DOT_DOT_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line9_h.bmp";};
+	};
+	Image IMG_WAVE_H
+	{
+		ImageBitmap = Bitmap{File = "symphony/line10_h.bmp";};
+	};
+	
+	//image when selected
+	Image IMG_SINGLE_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line1.bmp";};
+	};
+	Image IMG_DOUBLE_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line2.bmp";};
+	};
+	Image IMG_BOLD2_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line3.bmp";};
+	};
+	Image IMG_DOT_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line4.bmp";};
+	};
+	Image IMG_DOT_BOLD_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line5.bmp";};
+	};
+	Image IMG_DASH_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line6.bmp";};
+	};
+	Image IMG_DASH_LONG_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line7.bmp";};
+	};
+	Image IMG_DASH_DOT_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line8.bmp";};
+	};
+	Image IMG_DASH_DOT_DOT_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line9.bmp";};
+	};
+	Image IMG_WAVE_SEL
+	{
+		ImageBitmap = Bitmap{File = "symphony/selected-line10.bmp";};
+	};
+	
+//	//more button bmps
+//	Bitmap	BMP_UNDERLINE_MORE
+//	{
+//		File = "symphony/morebutton.bmp";
+//	};
+//	Bitmap	BMP_UNDERLINE_MORE_H
+//	{
+//		File = "symphony/morebutton_h.bmp";
+//	};	
+	
+	//tips 
+	String STR_SINGLE
+	{
+		Text [ en-US ] = "Single";
+	};
+	String STR_DOUBLE
+	{
+		Text [ en-US ] = "Double";
+	};
+	String STR_BOLD
+	{
+		Text [ en-US ] = "Bold";
+	};
+	String STR_DOT
+	{
+		Text [ en-US ] = "Dotted";
+	};
+	String STR_DOT_BOLD
+	{
+		Text [ en-US ] = "Dotted (Bold)";
+	};
+	String STR_DASH
+	{
+		Text [ en-US ] = "Dash";
+	};
+	String STR_DASH_LONG
+	{
+		Text [ en-US ] = "Long Dash";
+	};
+	String STR_DASH_DOT
+	{
+		Text [ en-US ] = "Dot Dash";
+	};
+	String STR_DASH_DOT_DOT
+	{
+		Text [ en-US ] = "Dot Dot Dash";
+	};
+	String STR_WAVE
+	{
+		Text [ en-US ] = "Wave";
+	};
+		
+};
+
+
+Control RID_POPUPPANEL_TEXTPAGE_FONT_COLOR
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
+	
+	Control VS_FONT_COLOR
+	{
+//		HelpID = HID_COLOR_VS ;
+		HelpID = HID_PPROPERTYPANEL_TEXT_COLOR_VS;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
+        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
+		TabStop = TRUE ;
+		Text = "Color Picker";
+	};
+	String STR_AUTOMATICE
+	{
+		Text [ en-US ] = "Automatic";
+	};
+
+};
+
+Control RID_POPUPPANEL_TEXTPAGE_SPACING
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	
+	Size = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH , POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + CUSTOM_HEIGHT + TEXT_HEIGHT + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 1);
+	
+	Control VS_SPACING
+	{
+		HelpId = HID_PPROPERTYPANEL_TEXT_SPACING_VS ;
+        Hide = TRUE ;
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( VS_SPACING_WIDTH  , 15 * 6);
+		TabStop = TRUE ;
+		Text  = "Character Spacing";
+	};
+    
+    FixedText FT_LASTCUSTOM
+    {
+		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X ,POPUPPANEL_MARGIN_SMALL + OFFSET_Y + POPUPPANEL_MARGIN_SMALL + 15 * 6) ;
+        Size = MAP_APPFONT ( CUSTOM_WIDTH , TEXT_HEIGHT );
+        Left = TRUE ;
+        Text [ en-US ] = "Custom:" ;
+    };
+    //custom area
+//	Control CT_BORDER
+//	{
+//		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 , OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT) ;
+//		Size = MAP_APPFONT (CUSTOM_WIDTH ,  CUSTOM_HEIGHT ) ;// TOOLBOX_42_42_ITEM_DD_WIDTH * 2 +  TB_SPACE * 2 - 5 + TEXT_WIDTH - 2
+//        DialogControl = TRUE;
+//	};
+	FixedText	FT_SPACING
+	{
+		Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE);
+        Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT );
+        Left = TRUE ;
+        Text [ en-US ] = "~Character spacing: " ;
+	};
+	ListBox LB_KERNING
+	{
+		Border = TRUE;
+        Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL);//20
+		Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , 80 ) ;
+		TabStop = TRUE;
+		DropDown = TRUE ;
+		HelpID = HID_SPACING_CB_KERN;
+		StringList [ en-US ] =
+		{
+			< "Default" ; Default ; > ;
+			< "Expanded" ; Default ; > ;
+			< "Condensed" ; Default ; > ;
+		};
+	};
+	FixedText	FT_BY
+	{
+		Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL + CBOX_HEIGHT );
+        Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT );
+        Left = TRUE ;
+        Text [ en-US ] = "Change ~by: " ;
+	};
+	MetricField ED_KERNING
+	{
+		HelpID = HID_SPACING_MB_KERN;
+		Border = TRUE;
+        Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT * 2 + POPUPPANEL_MARGIN_SMALL * 2 + CBOX_HEIGHT);//60
+        Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , MBOX_HEIGHT );
+		TabStop = TRUE;
+		Repeat = TRUE ;
+		Spin = TRUE ;
+		Maximum = 9999 ;
+		DecimalDigits = 1 ;
+		Unit = FUNIT_POINT ;
+		SpinSize = 10 ;
+	};
+	
+	Image IMG_NORMAL
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_normal.bmp" ;};//"spacing_normal.bmp"
+	};
+	Image IMG_VERY_TIGHT
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_very tight.bmp";};
+	};
+	Image IMG_TIGHT
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_tight.bmp";};
+	};
+	Image IMG_LOOSE
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_loose.bmp";};
+	};
+	Image IMG_VERY_LOOSE
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_very loose.bmp";};
+	};
+	
+	Image IMG_NORMAL_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_normal_s.bmp";};
+	};
+	Image IMG_VERY_TIGHT_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_very tight_s.bmp";};
+	};
+	Image IMG_TIGHT_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_tight_s.bmp";};
+	};
+	Image IMG_LOOSE_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_loose_s.bmp";};
+	};
+	Image IMG_VERY_LOOSE_S
+	{
+		ImageBitmap = Bitmap{File = "symphony/spacing_very loose_s.bmp";};
+	};
+	
+	Image IMG_CUSTOM
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";};
+	};
+	Image IMG_CUSTOM_GRAY
+	{
+		ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";};
+	};
+	
+	String STR_VERY_TIGHT
+	{
+		Text [ en-US ] = "Very Tight";
+	};
+	String STR_TIGHT
+	{
+		Text [ en-US ] = "Tight";
+	};
+	String STR_NORMAL
+	{
+		Text [ en-US ] = "Normal";
+	};
+	String STR_LOOSE
+	{
+		Text [ en-US ] = "Loose";
+	};
+	String STR_VERY_LOOSE
+	{
+		Text [ en-US ] = "Very Loose";
+	};
+	String STR_CUSTOM
+	{
+		Text [ en-US ] = "Last Custom Value";
+	};
+	
+	String STR_VERY_TIGHT_TIP
+	{
+		Text [ en-US ] = " Spacing: Condensed By: 3pt";
+	};
+	String STR_TIGHT_TIP
+	{
+		Text [ en-US ] = " Spacing: Condensed By: 1.5pt";
+	};
+	String STR_NORMAL_TIP
+	{
+		Text [ en-US ] = " Spacing: Normal";
+	};
+	String STR_LOOSE_TIP
+	{
+		Text [ en-US ] = " Spacing: Expanded By: 3pt";
+	};
+	String STR_VERY_LOOSE_TIP
+	{
+		Text [ en-US ] = " Spacing: Expanded By: 6pt";
+	};
+	String STR_CUSTOM_C_TIP
+	{
+		Text [ en-US ] = " Spacing: Condensed By: ";
+	};
+	String STR_CUSTOM_E_TIP
+	{
+		Text [ en-US ] = " Spacing: Expanded By: ";
+	};
+	String STR_PT
+	{
+		Text[ en-US ] = "pt";
+	};
+};
diff --git a/main/svx/source/sidebar/text/TextUnderlineControl.cxx b/main/svx/source/sidebar/text/TextUnderlineControl.cxx
new file mode 100644
index 0000000..feb18e6
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -0,0 +1,281 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+#include "TextUnderlineControl.hxx"
+#include "TextPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <editeng/udlnitem.hxx>
+
+namespace svx { namespace sidebar {
+
+TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
+:	svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE))
+,	mrTextPropertyPanel(rPanel)
+,	mpBindings(NULL)
+,	maVSUnderline( this, SVX_RES(VS_UNDERLINE))
+,	maPBOptions	(this, SVX_RES(PB_OPTIONS) )
+
+,	maIMGSingle		(SVX_RES(IMG_SINGLE))
+,	maIMGDouble		(SVX_RES(IMG_DOUBLE))
+,	maIMGBold		(SVX_RES(IMG_BOLD2))
+,	maIMGDot		(SVX_RES(IMG_DOT))
+,	maIMGDotBold	(SVX_RES(IMG_DOT_BOLD))
+,	maIMGDash		(SVX_RES(IMG_DASH))
+,	maIMGDashLong	(SVX_RES(IMG_DASH_LONG))
+,	maIMGDashDot	(SVX_RES(IMG_DASH_DOT))
+,	maIMGDashDotDot	(SVX_RES(IMG_DASH_DOT_DOT))
+,	maIMGWave		(SVX_RES(IMG_WAVE))
+
+// high contrast
+,	maIMGSingleH	(SVX_RES(IMG_SINGLE_H))
+,	maIMGDoubleH	(SVX_RES(IMG_DOUBLE_H))
+,	maIMGBoldH		(SVX_RES(IMG_BOLD2_H))
+,	maIMGDotH		(SVX_RES(IMG_DOT_H))
+,	maIMGDotBoldH	(SVX_RES(IMG_DOT_BOLD_H))
+,	maIMGDashH		(SVX_RES(IMG_DASH_H))
+,	maIMGDashLongH	(SVX_RES(IMG_DASH_LONG_H))
+,	maIMGDashDotH	(SVX_RES(IMG_DASH_DOT_H))
+,	maIMGDashDotDotH(SVX_RES(IMG_DASH_DOT_DOT_H))
+,	maIMGWaveH		(SVX_RES(IMG_WAVE_H))
+
+,	maIMGSingleSel		(SVX_RES(IMG_SINGLE_SEL))
+,	maIMGDoubleSel		(SVX_RES(IMG_DOUBLE_SEL))
+,	maIMGBoldSel		(SVX_RES(IMG_BOLD2_SEL))
+,	maIMGDotSel			(SVX_RES(IMG_DOT_SEL))
+,	maIMGDotBoldSel		(SVX_RES(IMG_DOT_BOLD_SEL))
+,	maIMGDashSel		(SVX_RES(IMG_DASH_SEL))
+,	maIMGDashLongSel	(SVX_RES(IMG_DASH_LONG_SEL))
+,	maIMGDashDotSel		(SVX_RES(IMG_DASH_DOT_SEL))
+,	maIMGDashDotDotSel	(SVX_RES(IMG_DASH_DOT_DOT_SEL))
+,	maIMGWaveSel		(SVX_RES(IMG_WAVE_SEL))
+
+{
+	initial();
+	FreeResource();
+	mpBindings = mrTextPropertyPanel.GetBindings();
+}
+
+void TextUnderlineControl::initial()
+{
+	/*maPBOptions.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contract
+	maPBOptions.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 )
+	maPBOptions.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 )
+	maPBOptions.SetIcoPosX( 2);*/
+	maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+
+	Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ;
+	maPBOptions.SetClickHdl(aLink);
+
+	maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
+
+	maVSUnderline.InsertItem(1, maIMGSingle ,String(SVX_RES(STR_SINGLE)));
+	maVSUnderline.SetItemData(1, (void*)(sal_uInt64)UNDERLINE_SINGLE);
+
+	maVSUnderline.InsertItem(2, maIMGDouble ,String(SVX_RES(STR_DOUBLE)));
+	maVSUnderline.SetItemData(2, (void*)(sal_uInt64)UNDERLINE_DOUBLE);
+
+	maVSUnderline.InsertItem(3, maIMGBold, String(SVX_RES(STR_BOLD)));
+	maVSUnderline.SetItemData(3,(void*)(sal_uInt64)UNDERLINE_BOLD);
+
+	maVSUnderline.InsertItem(4, maIMGDot, String(SVX_RES(STR_DOT)));
+	maVSUnderline.SetItemData(4,(void*)(sal_uInt64)UNDERLINE_DOTTED);
+
+	maVSUnderline.InsertItem(5, maIMGDotBold, String(SVX_RES(STR_DOT_BOLD)));
+	maVSUnderline.SetItemData(5,(void*)(sal_uInt64)UNDERLINE_BOLDDOTTED);
+
+	maVSUnderline.InsertItem(6, maIMGDash, String(SVX_RES(STR_DASH)));
+	maVSUnderline.SetItemData(6,(void*)(sal_uInt64)UNDERLINE_DASH);
+
+	maVSUnderline.InsertItem(7, maIMGDashLong,String(SVX_RES(STR_DASH_LONG)));
+	maVSUnderline.SetItemData(7,(void*)(sal_uInt64)UNDERLINE_LONGDASH);
+
+	maVSUnderline.InsertItem(8, maIMGDashDot, String(SVX_RES(STR_DASH_DOT)));
+	maVSUnderline.SetItemData(8,(void*)(sal_uInt64)UNDERLINE_DASHDOT);
+
+	maVSUnderline.InsertItem(9, maIMGDashDotDot, String(SVX_RES(STR_DASH_DOT_DOT)));
+	maVSUnderline.SetItemData(9,(void*)(sal_uInt64)UNDERLINE_DASHDOTDOT);
+
+	maVSUnderline.InsertItem(10, maIMGWave, String(SVX_RES(STR_WAVE)));
+	maVSUnderline.SetItemData(10,(void*)(sal_uInt64)UNDERLINE_WAVE);
+
+	maVSUnderline.SetColCount( 1 );
+	aLink =  LINK( this, TextUnderlineControl, VSSelectHdl ) ;
+    maVSUnderline.SetSelectHdl(aLink);
+
+	maVSUnderline.StartSelection();
+	maVSUnderline.Show();
+}
+
+void TextUnderlineControl::GetFocus()
+{
+	maVSUnderline.GrabFocus();
+}
+void TextUnderlineControl::Rearrange(FontUnderline eLine)
+{
+	// high contrast
+	maVSUnderline.SetItemImage(1,  GetDisplayBackground().GetColor().IsDark()? maIMGSingleH :maIMGSingle);
+	maVSUnderline.SetItemImage(2,  GetDisplayBackground().GetColor().IsDark()? maIMGDoubleH : maIMGDouble );
+	maVSUnderline.SetItemImage(3, GetDisplayBackground().GetColor().IsDark()? maIMGBoldH : maIMGBold);
+	maVSUnderline.SetItemImage(4, GetDisplayBackground().GetColor().IsDark()? maIMGDotH : maIMGDot);
+	maVSUnderline.SetItemImage(5, GetDisplayBackground().GetColor().IsDark()? maIMGDotBoldH :maIMGDotBold);
+	maVSUnderline.SetItemImage(6,  GetDisplayBackground().GetColor().IsDark()? maIMGDashH :maIMGDash);
+	maVSUnderline.SetItemImage(7, GetDisplayBackground().GetColor().IsDark()? maIMGDashLongH : maIMGDashLong);
+	maVSUnderline.SetItemImage(8, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotH : maIMGDashDot); 
+	maVSUnderline.SetItemImage(9, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotDotH : maIMGDashDotDot);
+	maVSUnderline.SetItemImage(10, GetDisplayBackground().GetColor().IsDark()? maIMGWaveH : maIMGWave);
+//	maVSUnderline.SelectItem(0);		//delete 
+//	maVSUnderline.SetNoSelection();
+
+	switch(eLine)
+	{
+	case UNDERLINE_SINGLE:
+		maVSUnderline.SetItemImage(1, maIMGSingleSel);
+		maVSUnderline.SelectItem(1);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DOUBLE:
+		maVSUnderline.SetItemImage(2, maIMGDoubleSel);
+		maVSUnderline.SelectItem(2);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_BOLD:
+		maVSUnderline.SetItemImage(3, maIMGBoldSel);
+		maVSUnderline.SelectItem(3);	//add 
+		maVSUnderline.GrabFocus();
+		break;	
+	case UNDERLINE_DOTTED:
+		maVSUnderline.SetItemImage(4, maIMGDotSel);
+		maVSUnderline.SelectItem(4);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_BOLDDOTTED:
+		maVSUnderline.SetItemImage(5, maIMGDotBoldSel);
+		maVSUnderline.SelectItem(5);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASH:
+		maVSUnderline.SetItemImage(6, maIMGDashSel);
+		maVSUnderline.SelectItem(6);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_LONGDASH:
+		maVSUnderline.SetItemImage(7, maIMGDashLongSel);
+		maVSUnderline.SelectItem(7);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASHDOT:
+		maVSUnderline.SetItemImage(8, maIMGDashDotSel);
+		maVSUnderline.SelectItem(8);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASHDOTDOT:
+		maVSUnderline.SetItemImage(9, maIMGDashDotDotSel);
+		maVSUnderline.SelectItem(9);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_WAVE:
+		maVSUnderline.SetItemImage(10, maIMGWaveSel);
+		maVSUnderline.SelectItem(10);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_NONE:
+	default:
+		maVSUnderline.SelectItem(1);
+		maVSUnderline.SetNoSelection();//add 
+		maPBOptions.GrabFocus();
+	}
+	maVSUnderline.StartSelection();
+	//removed 
+	//if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL)
+	//	maPBOptions.Disable();
+	//else
+	//	maPBOptions.Enable();
+	//removed end
+}
+ValueSet& TextUnderlineControl::GetValueSet()
+{
+	return maVSUnderline;
+}
+Control& TextUnderlineControl::GetPB()
+{
+	return maPBOptions;
+}
+IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
+{
+	if(pControl == &maVSUnderline)  
+	{
+		sal_uInt16 iPos = maVSUnderline.GetSelectItemId();
+		FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos );
+
+		//<<modified 
+		//SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
+		SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
+		//modify end>>
+
+		//<<add , this line of code will keep the new underline use pre-color
+		aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor());   
+		//add end>>
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+
+		//add , for the popup page not update immediately
+		mrTextPropertyPanel.SetUnderline(eUnderline);
+		//add end
+		//mrTextPropertyPanel.SetDefaultUnderline(eUnderline);
+
+		mrTextPropertyPanel.EndUnderlinePopupMode();
+	}
+	return( 0L );
+}
+
+IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn)
+{
+	if(pPBtn == &maPBOptions)  
+	{
+		if (mpBindings)
+		{
+			SfxDispatcher* pDisp = mpBindings->GetDispatcher();
+			pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON );
+		}
+		//add 
+		mrTextPropertyPanel.EndUnderlinePopupMode();
+		//add end
+	}
+	return 0;
+}
+
+}}
diff --git a/main/svx/source/sidebar/text/TextUnderlineControl.hxx b/main/svx/source/sidebar/text/TextUnderlineControl.hxx
new file mode 100644
index 0000000..11b0e67
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextUnderlineControl.hxx
@@ -0,0 +1,94 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
+#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "TextPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+
+#include <vcl/vclenum.hxx>
+#include <svtools/valueset.hxx>
+
+namespace svx{ namespace sidebar {
+
+class TextUnderlineControl:public svx::sidebar::PopupControl
+{
+public:
+	TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
+	void GetFocus();
+	void Rearrange(FontUnderline eLine);
+	ValueSet& GetValueSet();
+	Control& GetPB();
+private:	
+	svx::sidebar::TextPropertyPanel&     mrTextPropertyPanel;
+	SfxBindings*		mpBindings;
+	ValueSet			maVSUnderline;
+	PushButton			maPBOptions;
+
+	Image				maIMGSingle;
+	Image				maIMGDouble;
+	Image				maIMGBold;
+	Image				maIMGDot;
+	Image				maIMGDotBold;
+	Image				maIMGDash;
+	Image				maIMGDashLong;
+	Image				maIMGDashDot;
+	Image				maIMGDashDotDot;
+	Image				maIMGWave;
+
+	//add  for high contract
+	Image				maIMGSingleH;
+	Image				maIMGDoubleH;
+	Image				maIMGBoldH;
+	Image				maIMGDotH;
+	Image				maIMGDotBoldH;
+	Image				maIMGDashH;
+	Image				maIMGDashLongH;
+	Image				maIMGDashDotH;
+	Image				maIMGDashDotDotH;
+	Image				maIMGWaveH;
+
+	Image				maIMGSingleSel;
+	Image				maIMGDoubleSel;
+	Image				maIMGBoldSel;
+	Image				maIMGDotSel;
+	Image				maIMGDotBoldSel;
+	Image				maIMGDashSel;
+	Image				maIMGDashLongSel;
+	Image				maIMGDashDotSel;
+	Image				maIMGDashDotDotSel;
+	Image				maIMGWaveSel;
+
+	void initial();
+
+	DECL_LINK( PBClickHdl, PushButton *);
+	DECL_LINK(VSSelectHdl, void *);
+};
+}}
+
+
+#endif
+
diff --git a/main/svx/source/sidebar/text/TextUnderlinePopup.cxx b/main/svx/source/sidebar/text/TextUnderlinePopup.cxx
new file mode 100644
index 0000000..15040e7
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextUnderlinePopup.cxx
@@ -0,0 +1,60 @@
+/**************************************************************
+ * 
+ * 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 "TextUnderlinePopup.hxx"
+#include "TextUnderlineControl.hxx"
+
+
+namespace svx { namespace sidebar {
+
+TextUnderlinePopup::TextUnderlinePopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing")))
+{
+}
+
+
+
+
+TextUnderlinePopup::~TextUnderlinePopup (void)
+{
+}
+
+
+
+
+void TextUnderlinePopup::Rearrange (FontUnderline eLine)
+{
+    ProvideContainerAndControl();
+
+    TextUnderlineControl* pControl = dynamic_cast<TextUnderlineControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(eLine);	
+}
+
+
+} } // end of namespace svx::sidebar
+
+
diff --git a/main/svx/source/sidebar/text/TextUnderlinePopup.hxx b/main/svx/source/sidebar/text/TextUnderlinePopup.hxx
new file mode 100644
index 0000000..54e92d0
--- /dev/null
+++ b/main/svx/source/sidebar/text/TextUnderlinePopup.hxx
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * 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 _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_
+#define _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <vcl/vclenum.hxx>
+namespace svx { namespace sidebar {
+
+class TextUnderlinePopup
+    : public Popup
+{
+public :
+    TextUnderlinePopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~TextUnderlinePopup (void);
+
+    void Rearrange (FontUnderline eLine);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+
diff --git a/main/svx/source/sidebar/tools/ColorControl.cxx b/main/svx/source/sidebar/tools/ColorControl.cxx
new file mode 100644
index 0000000..a0c01fe
--- /dev/null
+++ b/main/svx/source/sidebar/tools/ColorControl.cxx
@@ -0,0 +1,228 @@
+/**************************************************************
+ * 
+ * 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_svx.hxx"
+
+#include <svx/sidebar/ColorControl.hxx>
+#include "svx/svxids.hrc"
+#include "svx/drawitem.hxx"
+#include "svx/xtable.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/xflclit.hxx"
+#include <tools/resid.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/floatwin.hxx>
+#include <unotools/pathoptions.hxx>
+#include <editeng/editrids.hrc>
+
+using ::sfx2::sidebar::Theme;
+
+namespace svx { namespace sidebar {
+
+namespace {
+    short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol )
+    {
+        if(rCol == COL_AUTO)
+            return 0;
+
+        bool	bFound = false;
+        sal_uInt16	nCount = rValueSet.GetItemCount();
+        sal_uInt16	n	   = 1;
+
+        while ( !bFound && n <= nCount )
+        {
+            Color aValCol = rValueSet.GetItemColor(n);
+
+            bFound = (   aValCol.GetRed()   == rCol.GetRed()
+                && aValCol.GetGreen() == rCol.GetGreen()
+                && aValCol.GetBlue()  == rCol.GetBlue() );
+
+            if ( !bFound )
+                n++;
+        }
+        return bFound ? n : -1;
+    }
+    class JustReleaseDeleter {public:
+            void operator() (XColorList*) const {/* release but don't delete pointer */}
+    };
+    ::boost::shared_ptr<XColorList> GetColorTable (void)
+    {
+        SfxObjectShell* pDocSh = SfxObjectShell::Current();
+        DBG_ASSERT(pDocSh!=NULL, "DocShell not found!");
+        if (pDocSh != NULL)
+        {
+            const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE);
+            if (pItem != NULL)
+            {
+                XColorList* pTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+                if (pTable != NULL)
+                    return ::boost::shared_ptr<XColorList>(pTable, JustReleaseDeleter());
+            }
+        }
+
+        return ::boost::shared_ptr<XColorList>(new XColorList(SvtPathOptions().GetPalettePath()));
+    }
+} // end of anonymous namespace
+
+
+
+
+ColorControl::ColorControl (
+    Window* pParent,
+    SfxBindings* pBindings,
+    const ResId& rControlResId,
+    const ResId& rValueSetResId,
+    const ::boost::function<Color(void)>& rNoColorGetter,
+    const ::boost::function<void(String&,Color)>& rColorSetter,
+    FloatingWindow* pFloatingWindow,
+    const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId)
+    : PopupControl(pParent, rControlResId),
+      mpBindings(pBindings),
+      maVSColor(this, rValueSetResId),
+      mpFloatingWindow(pFloatingWindow),
+      msNoColorString(
+          pNoColorStringResId
+              ? String(*pNoColorStringResId)
+              : String()),
+      maNoColorGetter(rNoColorGetter),
+      maColorSetter(rColorSetter)
+{
+	FreeResource();
+}
+
+
+
+ColorControl::~ColorControl (void)
+{
+}
+
+
+
+
+void ColorControl::FillColors (void)
+{
+	::boost::shared_ptr<XColorList> pColorTable (GetColorTable());
+
+	if (pColorTable)
+	{
+        const long nColorCount (pColorTable->Count());
+        if (nColorCount <= 0)
+            return;
+        const sal_Int32 nColumnCount (ceil(sqrt(double(nColorCount))));
+        const sal_Int32 nRowCount (ceil(double(nColorCount)/nColumnCount));
+        maVSColor.SetColCount(nColumnCount);
+        maVSColor.SetLineCount(nRowCount);
+        const sal_Int32 nItemSize (15*12 / ::std::max<sal_Int32>(nColumnCount, nRowCount));
+        maVSColor.CalcWindowSizePixel(Size(nItemSize,nItemSize));
+        Link aLink =  LINK(this, ColorControl, VSSelectHdl);
+        maVSColor.SetSelectHdl(aLink);
+        maVSColor.SetStyle(
+            (maVSColor.GetStyle()
+                | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD// | WB_FLATVALUESET
+                | WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT)
+                        & ~WB_VSCROLL);
+
+        if (msNoColorString.Len() > 0)
+        {
+            maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD);
+            maVSColor.SetText(msNoColorString);
+        }
+
+        // Now, after all calls to SetStyle, we can change the
+        // background color.
+        maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground));
+
+        maVSColor.Clear();
+        XColorEntry* pEntry	= NULL;
+        for (sal_Int32 nIndex=0; nIndex<nColorCount; ++nIndex)
+        {
+            pEntry = pColorTable->GetColor(nIndex);
+            maVSColor.InsertItem(nIndex+1, pEntry->GetColor(), pEntry->GetName() );
+        }
+	}
+
+	maVSColor.Show();
+}
+
+
+
+
+void ColorControl::GetFocus (void)
+{
+	maVSColor.GrabFocus();
+}
+
+
+
+
+void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable)
+{
+	FillColors();	
+	short nCol = GetItemId_Imp( maVSColor, aCol );
+	if(! bAvailable)
+	{
+		maVSColor.SetNoSelection();
+		return;
+	}
+
+	//if not found
+	if( nCol == -1)
+	{
+		maVSColor.SetNoSelection();
+	}
+	else
+	{
+		maVSColor.SelectItem( nCol );
+	}
+}
+
+
+
+
+IMPL_LINK(ColorControl, VSSelectHdl, void *, pControl)
+{
+    if(pControl == &maVSColor)
+    {
+        sal_uInt16 iPos = maVSColor.GetSelectItemId();
+        Color aColor = maVSColor.GetItemColor( iPos );
+        String aTmpStr = maVSColor.GetItemText( iPos );
+
+        // react when the WB_NONEFIELD created entry is selected
+        if (aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii("")))
+        {
+            if (maNoColorGetter)
+                aColor = maNoColorGetter();
+        }
+        if (maColorSetter)
+            maColorSetter(aTmpStr, aColor);
+
+        if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode())
+            mpFloatingWindow->EndPopupMode();
+    }
+
+    return 0;
+}
+
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/tools/ColorPopup.cxx b/main/svx/source/sidebar/tools/ColorPopup.cxx
new file mode 100644
index 0000000..dc3446f
--- /dev/null
+++ b/main/svx/source/sidebar/tools/ColorPopup.cxx
@@ -0,0 +1,60 @@
+/**************************************************************
+ * 
+ * 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 <svx/sidebar/ColorPopup.hxx>
+#include <svx/sidebar/ColorControl.hxx>
+
+
+namespace svx { namespace sidebar {
+
+ColorPopup::ColorPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color")))
+{
+}
+
+
+
+
+ColorPopup::~ColorPopup (void)
+{
+}
+
+
+
+
+void ColorPopup::SetCurrentColor (
+    const Color aCurrentColor,
+    const bool bIsColorAvailable)
+{
+    ProvideContainerAndControl();
+
+    ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get());
+    if (pColorControl != NULL)
+        pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable);	
+}
+
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/tools/Popup.cxx b/main/svx/source/sidebar/tools/Popup.cxx
new file mode 100644
index 0000000..9c93d3a
--- /dev/null
+++ b/main/svx/source/sidebar/tools/Popup.cxx
@@ -0,0 +1,148 @@
+/**************************************************************

+ * 

+ * 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 "svx/sidebar/Popup.hxx"

+#include "svx/sidebar/PopupContainer.hxx"

+#include "svx/sidebar/PopupControl.hxx"

+

+#include <vcl/toolbox.hxx>

+

+

+namespace svx { namespace sidebar {

+

+Popup::Popup (

+    Window* pParent,

+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator,

+    const ::rtl::OUString& rsAccessibleName)

+    : mpControl(),

+      mpParent(pParent),

+      maControlCreator(rControlCreator),

+      maPopupModeEndCallback(),

+      msAccessibleName(rsAccessibleName),

+      mpContainer()

+{

+    OSL_ASSERT(mpParent!=NULL);

+    OSL_ASSERT(maControlCreator);

+}

+

+

+

+

+Popup::~Popup (void)

+{

+    mpControl.reset();

+    mpContainer.reset();

+}

+

+

+

+

+void Popup::Show (ToolBox& rToolBox)

+{

+    rToolBox.SetItemDown(rToolBox.GetCurItemId(), true);

+

+    ProvideContainerAndControl();

+    if ( ! (mpContainer && mpControl))

+    {

+        OSL_ASSERT(mpContainer);

+        OSL_ASSERT(mpControl);

+        return;

+    }

+

+    if ( !mpContainer->IsInPopupMode() )

+    {

+        mpContainer->SetSizePixel(mpControl->GetOutputSizePixel());

+

+        const Point aPos (mpParent->OutputToScreenPixel(rToolBox.GetPosPixel()));

+        const Size aSize (rToolBox.GetSizePixel());

+        const Rectangle aRect (aPos, aSize);

+

+        mpContainer->StartPopupMode(

+            aRect,

+            FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN);

+        mpContainer->SetPopupModeFlags(

+            mpContainer->GetPopupModeFlags()

+                | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE);

+

+        mpControl->GetFocus();

+    }

+}

+

+

+

+

+void Popup::Hide (void)

+{

+    if (mpContainer)

+        if (mpContainer->IsInPopupMode())

+			mpContainer->EndPopupMode();

+}

+

+

+

+

+void Popup::SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback)

+{

+    maPopupModeEndCallback = rCallback;

+    if (mpContainer)

+        mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler));

+}

+

+

+

+

+void Popup::ProvideContainerAndControl (void)

+{

+    if ( ! (mpContainer && mpControl)

+        && mpParent!=NULL

+        && maControlCreator)

+    {

+        CreateContainerAndControl();

+    }

+}

+

+

+

+

+void Popup::CreateContainerAndControl (void)

+{

+    mpContainer.reset(new PopupContainer(mpParent));

+    mpContainer->SetAccessibleName(msAccessibleName);

+    if (maPopupModeEndCallback)

+        mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler));

+    mpContainer->SetBorderStyle(mpContainer->GetBorderStyle() | WINDOW_BORDER_MENU);

+    

+    mpControl.reset(maControlCreator(mpContainer.get()));

+}

+

+

+

+

+IMPL_LINK(Popup, PopupModeEndHandler, void*, EMPTYARG)

+{

+    if (maPopupModeEndCallback)

+        maPopupModeEndCallback();

+    return 0;

+}

+

+

+

+} } // end of namespace svx::sidebar

diff --git a/main/svx/source/sidebar/tools/PopupContainer.cxx b/main/svx/source/sidebar/tools/PopupContainer.cxx
new file mode 100644
index 0000000..da7a5b7
--- /dev/null
+++ b/main/svx/source/sidebar/tools/PopupContainer.cxx
@@ -0,0 +1,57 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/PopupContainer.hxx"
+#include <sfx2/sidebar/Theme.hxx>
+#include <vcl/gradient.hxx>
+
+namespace svx { namespace sidebar {
+
+PopupContainer::PopupContainer (Window* pParent)
+    : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) //  | WB_POPUP_FOCUSWIN)
+{
+}
+
+
+
+
+PopupContainer::~PopupContainer (void)
+{
+}
+
+
+
+
+long PopupContainer::Notify (NotifyEvent& rEvent)
+{
+    if (rEvent.GetType() == EVENT_LOSEFOCUS)
+    {
+        if ( ! HasChildPathFocus(true))
+        {
+            EndPopupMode();
+        }
+    }
+
+    return FloatingWindow::Notify(rEvent);
+}
+
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/tools/PopupControl.cxx b/main/svx/source/sidebar/tools/PopupControl.cxx
new file mode 100644
index 0000000..e7a433b
--- /dev/null
+++ b/main/svx/source/sidebar/tools/PopupControl.cxx
@@ -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.
+ * 
+ *************************************************************/
+
+#include "svx/sidebar/PopupControl.hxx"
+#include <sfx2/sidebar/Theme.hxx>
+#include <vcl/gradient.hxx>
+
+using ::sfx2::sidebar::Theme;
+
+namespace svx { namespace sidebar {
+
+PopupControl::PopupControl (
+    Window* pParent,
+    const ResId& rResId)
+    : Control( pParent,rResId)
+{
+	EnableChildTransparentMode(true);
+	SetControlBackground();
+
+    SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground));
+}
+
+
+
+
+PopupControl::~PopupControl (void)
+{
+}
+
+
+
+
+void PopupControl::Paint (const Rectangle& rBox)
+{
+    Control::Paint(rBox);
+
+    // The background is taken care of by setting the background color
+    // in the constructor.  Here we just paint the border.
+    SetFillColor();
+    SetLineColor(Theme::GetColor(Theme::Color_DropDownBorder));
+    DrawRect(Rectangle(Point(0,0), GetOutputSizePixel()));
+}
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/main/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
new file mode 100644
index 0000000..32be57c
--- /dev/null
+++ b/main/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -0,0 +1,529 @@
+/**************************************************************
+ * 
+ * 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 "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+
+#include <limits.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingFormatter.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <i18npool/mslangid.hxx>
+#include <svtools/valueset.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/graph.hxx>
+#include <svx/nbdtmg.hxx>
+#include <svx/nbdtmgfact.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::text;
+using namespace com::sun::star::container;
+using namespace com::sun::star::style;
+using rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+namespace svx { namespace sidebar {
+static const sal_Char cValue[] = "Value";
+
+static Font& lcl_GetDefaultBulletFont()
+{
+	static sal_Bool bInit = 0;
+	static Font aDefBulletFont( UniString::CreateFromAscii(
+		                        RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),
+								String(), Size( 0, 14 ) );
+	if(!bInit)
+	{
+        aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+		aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
+		aDefBulletFont.SetPitch( PITCH_DONTKNOW );
+		aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
+		aDefBulletFont.SetTransparent( sal_True );
+		bInit = sal_True;
+	}
+	return aDefBulletFont;
+}
+
+ValueSetWithTextControl::ValueSetWithTextControl(
+    const tControlType eControlType,
+    Window* pParent,
+    const ResId& rResId)
+    : ValueSet( pParent, rResId )
+    , meControlType( eControlType )
+    , maItems()
+{
+    SetColCount( 1 );
+}
+
+
+ValueSetWithTextControl::~ValueSetWithTextControl(void)
+{
+}
+
+
+void ValueSetWithTextControl::AddItem(
+    const Image& rItemImage,
+    const Image* pSelectedItemImage,
+    const XubString& rItemText,
+    const XubString* pItemHelpText )
+{
+    if ( meControlType != IMAGE_TEXT )
+    {
+        return;
+    }
+
+    ValueSetWithTextItem aItem;
+    aItem.maItemImage = rItemImage;
+    aItem.maSelectedItemImage = (pSelectedItemImage != 0)
+                                ? *pSelectedItemImage
+                                : rItemImage;
+    aItem.maItemText = rItemText;
+
+    maItems.push_back( aItem );
+
+    InsertItem( maItems.size() );
+    SetItemText( maItems.size(),
+                    (pItemHelpText != 0) ? *pItemHelpText : rItemText );
+}
+
+
+void ValueSetWithTextControl::AddItem(
+    const XubString& rItemText,
+    const XubString& rItemText2,
+    const XubString* pItemHelpText )
+{
+    if ( meControlType != TEXT_TEXT )
+    {
+        return;
+    }
+
+    ValueSetWithTextItem aItem;
+    aItem.maItemText = rItemText;
+    aItem.maItemText2 = rItemText2;
+
+    maItems.push_back( aItem );
+
+    InsertItem( maItems.size() );
+    SetItemText( maItems.size(),
+                    (pItemHelpText != 0) ? *pItemHelpText : rItemText );
+}
+
+
+void ValueSetWithTextControl::ReplaceItemImages(
+    const sal_uInt16 nItemId,
+    const Image& rItemImage,
+    const Image* pSelectedItemImage )
+{
+    if ( meControlType != IMAGE_TEXT )
+    {
+        return;
+    }
+
+    if ( nItemId == 0 ||
+         nItemId > maItems.size() )
+    {
+        return;
+    }
+
+    maItems[nItemId-1].maItemImage = rItemImage;
+    maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0)
+                                             ? *pSelectedItemImage
+                                             : rItemImage;
+}
+
+    
+void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt )
+{
+    const Rectangle aRect = rUDEvt.GetRect();
+    OutputDevice* pDev = rUDEvt.GetDevice();
+    pDev->Push( PUSH_ALL );
+    const sal_uInt16 nItemId = rUDEvt.GetItemId();
+
+    const long nRectHeight = aRect.GetHeight();
+    const Point aBLPos = aRect.TopLeft();
+
+    Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+    {
+        Size aSize = aFont.GetSize();
+        aSize.Height() = (nRectHeight*4)/9;
+        aFont.SetSize( aSize );
+    }
+
+    {
+        //draw backgroud
+        if ( GetSelectItemId() == nItemId )
+        {
+            Rectangle aBackRect = aRect;
+            aBackRect.Top() += 3;
+            aBackRect.Bottom() -= 2;
+            pDev->SetFillColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_Highlight ) );
+            pDev->DrawRect(aBackRect);
+        }
+        else
+        {
+            pDev->SetFillColor( COL_TRANSPARENT );
+            pDev->DrawRect(aRect);
+        }
+
+        //draw image + text resp. text + text
+        Image* pImage = 0;
+        if ( GetSelectItemId() == nItemId )
+        {
+            aFont.SetColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_HighlightText ) );
+            pImage = &maItems[nItemId-1].maSelectedItemImage;
+        }
+        else
+        {
+            aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
+            pImage = &maItems[nItemId-1].maItemImage;
+        }
+
+        Rectangle aStrRect = aRect;
+        aStrRect.Top() += nRectHeight/4;
+        aStrRect.Bottom() -= nRectHeight/4;
+
+        switch ( meControlType )
+        {
+        case IMAGE_TEXT:
+            {
+                Point aImgStart(
+                    aBLPos.X() + 4,
+                    aBLPos.Y() + ( ( nRectHeight - pImage->GetSizePixel().Height() ) / 2 ) );
+                pDev->DrawImage( aImgStart, *pImage );
+
+                aStrRect.Left() += pImage->GetSizePixel().Width() + 12;
+                pDev->SetFont(aFont);
+                pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS);
+            }
+            break;
+        case TEXT_TEXT:
+            {
+                const long nRectWidth = aRect.GetWidth();
+                aStrRect.Left() += 8;
+                aStrRect.Right() -= (nRectWidth*2)/3;
+                pDev->SetFont(aFont);
+                pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS);
+                aStrRect.Left() += nRectWidth/3;
+                aStrRect.Right() += (nRectWidth*2)/3;
+                pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, TEXT_DRAW_ENDELLIPSIS);
+            }
+            break;
+        }
+    }
+
+    Invalidate( aRect );
+    pDev->Pop();
+}
+
+SvxNumValueSet2::SvxNumValueSet2( Window* pParent, const ResId& rResId) :
+	ValueSet( pParent, rResId ),
+    aLineColor  ( COL_LIGHTGRAY ),    
+    pVDev       ( NULL )
+{
+	SetColCount( 3 );
+    SetLineCount( 3 );
+	SetStyle( GetStyle() | WB_ITEMBORDER );	
+}
+
+ SvxNumValueSet2::~SvxNumValueSet2()
+{
+	delete pVDev;
+}
+
+void SvxNumValueSet2::SetNumberingSettings(
+	const Sequence<Sequence<PropertyValue> >& aNum,
+	Reference<XNumberingFormatter>& xFormat,
+	const Locale& rLocale	)
+{
+	aNumSettings = aNum;
+	xFormatter = xFormat;
+	aLocale = rLocale;
+    	if(aNum.getLength() > 9)
+       	SetStyle( GetStyle()|WB_VSCROLL);
+	InsertItem( DEFAULT_NONE, DEFAULT_NONE - 1 );
+	SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE ));
+
+    	for ( sal_uInt32 i = 0; i < aNum.getLength(); i++ )
+    	{
+    		InsertItem( i + 1);
+            	if( i < 8 )
+            	{            		
+			NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);	
+			if ( pNumbering )
+			{
+				SetItemText( i + 1, pNumbering->GetDescription(i));
+			}
+            	}
+	}
+}
+
+void  SvxNumValueSet2::UserDraw( const UserDrawEvent& rUDEvt )
+{
+    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+    const Color aBackColor = rStyleSettings.GetFieldColor();
+    const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+    OutputDevice*  pDev = rUDEvt.GetDevice();
+	Rectangle aRect = rUDEvt.GetRect();
+	sal_uInt32	nItemId = rUDEvt.GetItemId();
+	long nRectWidth = aRect.GetWidth();
+	long nRectHeight = aRect.GetHeight();
+	Size aRectSize(nRectWidth, aRect.GetHeight());
+	Point aBLPos = aRect.TopLeft();
+	Font aOldFont = pDev->GetFont();
+	Color aOldColor = pDev->GetLineColor();
+    pDev->SetLineColor(aBackColor);
+    Font aFont(OutputDevice::GetDefaultFont(
+                DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+
+    Size aSize = aFont.GetSize();	
+	aSize.Height() = nRectHeight/5;
+	aFont.SetColor(aTextColor);
+	aFont.SetFillColor(aBackColor);
+	aFont.SetSize( aSize );
+	pDev->SetFont(aFont);
+	pDev->SetLineColor(aTextColor);
+	if(!pVDev)
+	{
+		// Die Linien werden nur einmalig in das VirtualDevice gepainted
+		// nur die Gliederungspage bekommt es aktuell
+		pVDev = new VirtualDevice(*pDev);
+		pVDev->SetMapMode(pDev->GetMapMode());
+		pVDev->EnableRTL( IsRTLEnabled() );
+ 		pVDev->SetOutputSize( aRectSize );
+		aOrgRect = aRect;
+	
+		pVDev->SetLineColor( aBackColor );
+		pVDev->SetFillColor( aBackColor );
+		pVDev->DrawRect(aOrgRect);		
+
+        if(aBackColor == aLineColor)
+            aLineColor.Invert();
+		if(GetSettings().GetStyleSettings().GetHighContrastMode())
+			pVDev->SetLineColor(aTextColor);
+		else
+			pVDev->SetLineColor(aLineColor);
+		// Linien nur einmalig Zeichnen
+		Point aStart(aBLPos.X() + nRectWidth *30 / 100,0);
+		Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
+		for( sal_uInt32 i = 11; i < 100; i += 33)
+		{
+			aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight  * i / 100;
+			pVDev->DrawLine(aStart, aEnd);
+			aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight  * (i + 11) / 100;
+			pVDev->DrawLine(aStart, aEnd);
+		}		
+	}
+	if ( nItemId != DEFAULT_NONE)
+		pDev->DrawOutDev(	aRect.TopLeft(), aRectSize,
+							aOrgRect.TopLeft(), aRectSize,
+							*pVDev );
+	const OUString sValue(C2U(cValue));
+   	
+	Point aStart(aBLPos.X() + nRectWidth / 9,0);
+	if ( nItemId == DEFAULT_NONE)
+	{				
+		String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE));
+		Font aFont = pDev->GetFont();	
+		Size aSize = aFont.GetSize();	
+		aSize.Height() = nRectHeight/4;
+		aFont.SetSize( aSize );
+		pDev->SetFont(aFont);
+		long nTextWidth = pDev->GetTextWidth(sText); 
+	    long nTextHeight = pDev->GetTextHeight();
+		//GVT refine
+		while (nTextWidth>nRectWidth && aSize.Height()>4) {
+			aSize.Height() = aSize.Height()*0.9;
+			aFont.SetSize( aSize );
+			pDev->SetFont(aFont);
+			nTextWidth = pDev->GetTextWidth(sText); 
+		}
+		Point aSStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
+		pDev->DrawText(aSStart, sText);	
+		pDev->SetFont(aOldFont);
+	}
+	else
+	{
+		NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
+		if ( pNumbering && nItemId <= DEFAULT_BULLET_TYPES ) 
+		{
+			for( sal_uInt32 i = 0; i < 3; i++ )
+			{
+				sal_uInt32 nY = 11 + i * 33;
+				aStart.Y() = aBLPos.Y() + nRectHeight  * nY / 100;
+				String sText;
+				sal_uInt16 nLvl = 0;
+				SvxNumRule aTempRule( 0, 10, false );
+				pNumbering->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl);
+				SvxNumberFormat aNumFmt(aTempRule.GetLevel(nLvl));
+				sText=aNumFmt.GetNumStr(i+1);
+				sText.Insert( aNumFmt.GetPrefix(), 0 );
+				sText += aNumFmt.GetSuffix();
+				aStart.X() = aBLPos.X() + 2;
+				aStart.Y() -= pDev->GetTextHeight()/2;
+				pDev->DrawText(aStart, sText);		
+			}
+		}
+		pDev->SetFont(aOldFont);
+		pDev->SetLineColor(aOldColor);
+	}
+	//End
+}
+
+//===============================================================================================
+
+static const long aOffsetX[] =
+{
+	-1,//1,
+	3,//4,
+	4,//5,
+	-3,//0,
+	-1,//0,
+	3
+};
+
+SvxNumValueSet3::SvxNumValueSet3( Window* pParent, const ResId& rResId) :
+	ValueSet( pParent, rResId )    
+{
+	SetColCount( 3 );
+    SetLineCount( 4 );
+	SetStyle( GetStyle() | WB_ITEMBORDER );	
+}
+
+ SvxNumValueSet3::~SvxNumValueSet3()
+{	
+}
+
+void  SvxNumValueSet3::UserDraw( const UserDrawEvent& rUDEvt )
+{
+	Rectangle aRect = rUDEvt.GetRect();
+	OutputDevice*  pDev = rUDEvt.GetDevice();
+	sal_uInt32	nItemId = rUDEvt.GetItemId();
+	
+	long nRectHeight = aRect.GetHeight();
+	long nRectWidth = aRect.GetWidth();	
+	Point aBLPos = aRect.TopLeft();	
+	NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);	
+	if ( pBullets )
+	{
+		if ( nItemId <= DEFAULT_BULLET_TYPES ) {
+			sal_uInt16 nLvl = 0;
+			SvxNumRule aTempRule( 0, 10, false );
+			pBullets->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl);
+			SvxNumberFormat aFmt(aTempRule.GetLevel(nLvl));
+			sal_Int16 eNumType = aFmt.GetNumberingType();
+			if( eNumType == SVX_NUM_CHAR_SPECIAL)
+			{
+				sal_Unicode cChar = aFmt.GetBulletChar();
+			//End
+				const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+				const Color aBackColor = rStyleSettings.GetFieldColor();	
+				const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+				Font aOldFont = pDev->GetFont();
+				Font aFont( lcl_GetDefaultBulletFont() );
+
+				Size aSize = aFont.GetSize();	
+				aSize.Height() = nRectHeight*3/6;
+				aFont.SetColor(aTextColor);
+				aFont.SetFillColor(aBackColor);
+				aFont.SetSize( aSize );
+				pDev->SetFont(aFont);
+				pDev->SetFillColor( aBackColor ); //wj
+					
+				String sText;
+				sText = cChar;
+				Font aOldBulletFont = pDev->GetFont();
+				Font aBulletFnt(aFmt.GetBulletFont() ? *aFmt.GetBulletFont() : aOldBulletFont);
+				Size aBulSize = aOldBulletFont.GetSize();	
+				aBulletFnt.SetSize(aBulSize);
+				pDev->SetFont(aBulletFnt);
+				long nTextWidth = pDev->GetTextWidth(sText); 
+	            long nTextHeight = pDev->GetTextHeight();
+				Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
+				pDev->DrawText(aStart, sText);	
+				pDev->SetFont(aOldFont);
+			}else if ( eNumType == SVX_NUM_BITMAP )
+			{
+				const SvxBrushItem* pBrushItem = aFmt.GetBrush();			
+				if(pBrushItem)
+				{
+					const Graphic* pGrf = pBrushItem->GetGraphic();
+					if(pGrf)
+					{			
+						Size aSize(nRectHeight*6/20, nRectHeight*6/20);
+						Point aStart(aBLPos.X() + nRectWidth*7/20, aBLPos.Y() + nRectHeight*7/20);    
+
+						pGrf->Draw( pDev, aStart, aSize );
+					}
+				}
+			}
+		}else if ( nItemId == DEFAULT_NONE)
+		{	
+			const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+			const Color aBackColor = rStyleSettings.GetFieldColor();	
+			const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+			Font aOldFont = pDev->GetFont();	
+			Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+			Size aSize = aFont.GetSize();	
+			//aSize.Height() = nRectHeight/5;
+			aSize.Height() = nRectHeight/4;
+			aFont.SetColor(aTextColor);
+			aFont.SetFillColor(aBackColor);
+			aFont.SetSize( aSize );
+			pDev->SetFont(aFont);
+			pDev->SetFillColor( aBackColor ); 
+					
+			String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE));
+			
+			long nTextWidth = pDev->GetTextWidth(sText); 
+	        long nTextHeight = pDev->GetTextHeight();
+			//GVT refine
+			while (nTextWidth>nRectWidth && aSize.Height()>4) {
+				aSize.Height() = aSize.Height()*0.9;
+				aFont.SetSize( aSize );
+				pDev->SetFont(aFont);
+				nTextWidth = pDev->GetTextWidth(sText); 
+			}
+			Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
+			pDev->DrawText(aStart, sText);	
+						
+			pDev->SetFont(aOldFont);
+		}
+	}
+	
+}
+
+} } // end of namespace svx::sidebar
diff --git a/main/svx/source/svdraw/svdedtv1.cxx b/main/svx/source/svdraw/svdedtv1.cxx
index 7231a5c..40a0ff1 100644
--- a/main/svx/source/svdraw/svdedtv1.cxx
+++ b/main/svx/source/svdraw/svdedtv1.cxx
@@ -55,6 +55,9 @@
 #include <svx/sdr/contact/viewcontact.hxx>
 #include <svx/e3dsceneupdater.hxx>
 #include <svx/obj3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/AffineMatrixItem.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -249,23 +252,77 @@
 	if( bUndo )
 		EndUndo();
 }
+void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
+    const Fraction& xFact,
+    const Fraction& yFact,
+    const bool bCopy,
+    const bool bWdh,
+    const bool bHgt)
+{
+	const bool bUndo = IsUndoEnabled();
+	if( bUndo )
+	{
+		XubString aStr;
+		ImpTakeDescriptionStr(STR_EditResize,aStr);
+		if (bCopy)
+			aStr+=ImpGetResStr(STR_EditWithCopy);
+		BegUndo(aStr);
+	}
+	
+	if (bCopy)
+		CopyMarkedObj();
+    
+	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+	{
+		SdrMark* pM=GetSdrMarkByIndex(nm);
+		SdrObject* pO=pM->GetMarkedSdrObj();
+		if( bUndo )
+		{
+			std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+			AddUndoActions( vConnectorUndoActions );
+			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+        }
+
+        Fraction aFrac(1,1);
+        if (bWdh && bHgt)
+            pO->Resize(rRef, xFact, yFact);
+        else if (bWdh)
+            pO->Resize(rRef, xFact, aFrac);
+        else if (bHgt)
+            pO->Resize(rRef, aFrac, yFact);
+    }
+	if( bUndo )
+		EndUndo();
+}
 
 long SdrEditView::GetMarkedObjRotate() const
 {
-	sal_Bool b1st=sal_True;
-	sal_Bool bOk=sal_True;
-	long nWink=0;
-	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
-	for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
-		SdrMark* pM=GetSdrMarkByIndex(nm);
-		SdrObject* pO=pM->GetMarkedSdrObj();
-		long nWink2=pO->GetRotateAngle();
-		if (b1st) nWink=nWink2;
-		else if (nWink2!=nWink) bOk=sal_False;
-		b1st=sal_False;
-	}
-	if (!bOk) nWink=0;
-	return nWink;
+    long nRetval(0);
+
+    if(GetMarkedObjectCount())
+    {
+        SdrMark* pM = GetSdrMarkByIndex(0);
+        SdrObject* pO = pM->GetMarkedSdrObj();
+
+        nRetval = pO->GetRotateAngle();
+    }
+
+    return nRetval;
+	//sal_Bool b1st=sal_True;
+	//sal_Bool bOk=sal_True;
+	//long nWink=0;
+	//sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+	//for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
+	//	SdrMark* pM=GetSdrMarkByIndex(nm);
+	//	SdrObject* pO=pM->GetMarkedSdrObj();
+	//	long nWink2=pO->GetRotateAngle();
+	//	if (b1st) nWink=nWink2;
+	//	else if (nWink2!=nWink) bOk=sal_False;
+	//	b1st=sal_False;
+	//}
+	//if (!bOk) nWink=0;
+	//return nWink;
 }
 
 void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy)
@@ -1196,15 +1253,17 @@
 SfxItemSet SdrEditView::GetGeoAttrFromMarked() const
 {
 	SfxItemSet aRetSet(pMod->GetItemPool(),   // SID_ATTR_TRANSFORM_... aus s:svxids.hrc
-					   SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE,
-					   SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT,
-					   SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS,
-					   0);
-	if (AreObjectsMarked()) {
+        SID_ATTR_TRANSFORM_POS_X,               SID_ATTR_TRANSFORM_ANGLE,
+        SID_ATTR_TRANSFORM_PROTECT_POS,         SID_ATTR_TRANSFORM_AUTOHEIGHT,
+        SDRATTR_ECKENRADIUS,                    SDRATTR_ECKENRADIUS,
+        0);
+
+    if (AreObjectsMarked()) 
+    {
 		SfxItemSet aMarkAttr(GetAttrFromMarked(sal_False)); // wg. AutoGrowHeight und Eckenradius
 		Rectangle aRect(GetMarkedObjRect());
-		
-		if(GetSdrPageView()) 
+
+        if(GetSdrPageView()) 
 		{
 			GetSdrPageView()->LogicToPagePos(aRect);
 		}
@@ -1262,12 +1321,13 @@
 		sal_Bool bSizProt=pObj->IsResizeProtect();
 		sal_Bool bPosProtDontCare=sal_False;
 		sal_Bool bSizProtDontCare=sal_False;
-		for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) {
+		for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++)
+        {
 			pObj=rMarkList.GetMark(i)->GetMarkedSdrObj();
 			if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=sal_True;
 			if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=sal_True;
-		}
-
+        }
+        
 		// InvalidateItem setzt das Item auf DONT_CARE
 		if (bPosProtDontCare) {
 			aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_POS);
@@ -1304,7 +1364,48 @@
 			aRetSet.Put(SdrEckenradiusItem(nRadius));
 		}
 
+        basegfx::B2DHomMatrix aTransformation;
+
+        if(nMarkCount > 1)
+        {
+            // multiple objects, range is collected in aRect
+            aTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(
+                aRect.Left(), aRect.Top(),
+                aRect.getWidth(), aRect.getHeight());
+        }
+        else if(pObj)
+        {
+            // single object, get homogen transformation
+            basegfx::B2DPolyPolygon aPolyPolygon;
+
+            pObj->TRGetBaseGeometry(aTransformation, aPolyPolygon);
+        }
+
+        if(aTransformation.isIdentity())
+        {
+            aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_MATRIX);
+        }
+        else
+        {
+            com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
+            Point aPageOffset(0, 0);
+
+            if(GetSdrPageView()) 
+            {
+                aPageOffset = GetSdrPageView()->GetPageOrigin();
+            }
+
+            aAffineMatrix2D.m00 = aTransformation.get(0, 0);
+            aAffineMatrix2D.m01 = aTransformation.get(0, 1);
+            aAffineMatrix2D.m02 = aTransformation.get(0, 2) - aPageOffset.X();
+            aAffineMatrix2D.m10 = aTransformation.get(1, 0);
+            aAffineMatrix2D.m11 = aTransformation.get(1, 1);
+            aAffineMatrix2D.m12 = aTransformation.get(1, 2) - aPageOffset.Y();
+
+            aRetSet.Put(AffineMatrixItem(&aAffineMatrix2D));
+        }
 	}
+
 	return aRetSet;
 }
 
@@ -1373,6 +1474,7 @@
 
 	sal_Bool bChgPos=sal_False;
 	sal_Bool bChgSiz=sal_False;
+	sal_Bool bChgWdh=sal_False;
 	sal_Bool bChgHgt=sal_False;
 	sal_Bool bRotate=sal_False;
 	sal_Bool bShear =sal_False;
@@ -1395,6 +1497,7 @@
 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) {
 		nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue();
 		bChgSiz=sal_True;
+        bChgWdh=sal_True;
 	}
 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) {
 		nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue();
@@ -1487,7 +1590,7 @@
 			GetSdrPageView()->PagePosToLogic(aRef);
 		}
 
-		ResizeMarkedObj(aRef,aWdt,aHgt);
+        ResizeMultMarkedObj(aRef, aWdt, aHgt, false, bChgWdh, bChgHgt);
 	}
 
 	// Rotieren
diff --git a/main/svx/source/svdraw/svdedxv.cxx b/main/svx/source/svdraw/svdedxv.cxx
index a63cffb..b503271 100644
--- a/main/svx/source/svdraw/svdedxv.cxx
+++ b/main/svx/source/svdraw/svdedxv.cxx
@@ -2035,6 +2035,38 @@
     // applications can derive from these virtual methods to do something before a drop or paste operation
 }
 
+sal_uInt16 SdrObjEditView::GetSelectionLevel() const
+{
+	sal_uInt16 nLevel = 0xFFFF;
+    if( IsTextEdit() )
+	{
+        DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
+        DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
+		if( pTextEditOutlinerView )
+		{
+			//start and end position
+			ESelection aSelect = pTextEditOutlinerView->GetSelection();
+			sal_uInt16 nStartPara = ::std::min( aSelect.nStartPara, aSelect.nEndPara );
+			sal_uInt16 nEndPara = ::std::max( aSelect.nStartPara, aSelect.nEndPara );
+			//get level from each paragraph
+			nLevel = 0;
+			for( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
+			{
+				sal_uInt16 nParaDepth = 1 << pTextEditOutliner->GetDepth( nPara );
+				if( !(nLevel & nParaDepth) )
+					nLevel += nParaDepth;
+			}
+			//reduce one level for Outliner Object
+			//if( nLevel > 0 && GetTextEditObject()->GetObjIdentifier() == OBJ_OUTLINETEXT )
+			//	nLevel = nLevel >> 1;
+			//no bullet paragraph selected
+			if( nLevel == 0)
+				nLevel = 0xFFFF;
+		}
+	}
+	return nLevel;
+}
+
 bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
 {
     if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor )
diff --git a/main/svx/source/svdraw/svdfmtf.cxx b/main/svx/source/svdraw/svdfmtf.cxx
index 09e61a2..1d9a251 100644
--- a/main/svx/source/svdraw/svdfmtf.cxx
+++ b/main/svx/source/svdraw/svdfmtf.cxx
@@ -351,19 +351,19 @@
 		switch(maLineJoin)
 		{
 			default : // basegfx::B2DLINEJOIN_NONE
-				mpLineAttr->Put(XLineJointItem(XLINEJOINT_NONE));
+				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE));
 				break;
 			case basegfx::B2DLINEJOIN_MIDDLE:
-				mpLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE));
+				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MIDDLE));
 				break;
 			case basegfx::B2DLINEJOIN_BEVEL:
-				mpLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL));
+				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL));
 				break;
 			case basegfx::B2DLINEJOIN_MITER:
-				mpLineAttr->Put(XLineJointItem(XLINEJOINT_MITER));
+				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER));
 				break;
 			case basegfx::B2DLINEJOIN_ROUND:
-				mpLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND));
+				mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND));
 				break;
 		}
 
diff --git a/main/svx/source/svdraw/svdmodel.cxx b/main/svx/source/svdraw/svdmodel.cxx
index b5d6a4e..a034012 100644
--- a/main/svx/source/svdraw/svdmodel.cxx
+++ b/main/svx/source/svdraw/svdmodel.cxx
@@ -762,7 +762,7 @@
 void SdrModel::ImpCreateTables()
 {
 	// der Writer hat seinen eigenen ColorTable
-	if (!bExtColorTable) pColorTable=new XColorTable(aTablePath,(XOutdevItemPool*)pItemPool);
+	if (!bExtColorTable) pColorTable=new XColorList(aTablePath,(XOutdevItemPool*)pItemPool);
 	pDashList    =new XDashList    (aTablePath,(XOutdevItemPool*)pItemPool);
 	pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool);
 	pHatchList   =new XHatchList   (aTablePath,(XOutdevItemPool*)pItemPool);
@@ -2173,7 +2173,7 @@
 //
 // i120668, move from the header files, add delete action
 //
-void            SdrModel::SetColorTable(XColorTable* pTable)       { delete pColorTable; pColorTable=pTable; }
+void            SdrModel::SetColorTable(XColorList* pTable)       { delete pColorTable; pColorTable=pTable; }
 void            SdrModel::SetDashList(XDashList* pList)            { delete pDashList; pDashList=pList; }
 void            SdrModel::SetLineEndList(XLineEndList* pList)      { delete pLineEndList; pLineEndList=pList; }
 void            SdrModel::SetHatchList(XHatchList* pList)          { delete pHatchList; pHatchList=pList; }
diff --git a/main/svx/source/svdraw/svdoashp.cxx b/main/svx/source/svdraw/svdoashp.cxx
index 087cfbc..001c023 100644
--- a/main/svx/source/svdraw/svdoashp.cxx
+++ b/main/svx/source/svdraw/svdoashp.cxx
@@ -3300,7 +3300,7 @@
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3447,7 +3447,7 @@
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
diff --git a/main/svx/source/svdraw/svdobj.cxx b/main/svx/source/svdraw/svdobj.cxx
index 25597cc..8eb6268 100644
--- a/main/svx/source/svdraw/svdobj.cxx
+++ b/main/svx/source/svdraw/svdobj.cxx
@@ -2030,6 +2030,23 @@
 	return GetObjectItemSet().Get(nWhich);
 }
 
+SfxMapUnit SdrObject::GetObjectMapUnit() const
+{
+    SfxMapUnit aRetval(SFX_MAPUNIT_100TH_MM);
+    SdrItemPool* pPool = GetObjectItemPool();
+
+    if(pPool)
+    {
+        aRetval = pPool->GetMetric(0);
+    }
+    else
+    {
+        OSL_ENSURE(pPool, "SdrObjects always need a pool (!)");
+    }
+
+    return aRetval;
+}
+
 const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
 {
 	return GetMergedItemSet().Get(nWhich);
@@ -3028,7 +3045,7 @@
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3079,7 +3096,7 @@
 	}
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
diff --git a/main/svx/source/svdraw/svdogrp.cxx b/main/svx/source/svdraw/svdogrp.cxx
index 308f6d9..abc23fc 100644
--- a/main/svx/source/svdraw/svdogrp.cxx
+++ b/main/svx/source/svdraw/svdogrp.cxx
@@ -97,8 +97,6 @@
 	pSub->SetOwnerObj(this);
 	pSub->SetListKind(SDROBJLIST_GROUPOBJ);
 	bRefPoint=sal_False;
-	nDrehWink=0;
-	nShearWink=0;
 	bClosedObj=sal_False;
 }
 
@@ -308,8 +306,6 @@
 		pSub->CopyObjects(*rObj.GetSubList());
 
 		// copy local paremeters
-		nDrehWink  =((SdrObjGroup&)rObj).nDrehWink;
-		nShearWink =((SdrObjGroup&)rObj).nShearWink;
 		aRefPoint  =((SdrObjGroup&)rObj).aRefPoint;
 		bRefPoint  =((SdrObjGroup&)rObj).bRefPoint;
 	}
@@ -388,13 +384,33 @@
 
 long SdrObjGroup::GetRotateAngle() const
 {
-	return nDrehWink;
+    const sal_uInt32 nObjCount(pSub->GetObjCount());
+    long nRetval(0);
+
+    if(nObjCount)
+    {
+        SdrObject* pObj = pSub->GetObj(0);
+
+        nRetval = pObj->GetRotateAngle();
+    }
+
+    return nRetval;
 }
 
 
 long SdrObjGroup::GetShearAngle(FASTBOOL /*bVertical*/) const
 {
-	return nShearWink;
+    const sal_uInt32 nObjCount(pSub->GetObjCount());
+    long nRetval(0);
+
+    if(nObjCount)
+    {
+        SdrObject* pObj = pSub->GetObj(0);
+
+        nRetval = pObj->GetShearAngle();
+    }
+
+    return nRetval;
 }
 
 
@@ -476,7 +492,6 @@
 void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
 {
 	SetGlueReallyAbsolute(sal_True);
-	nDrehWink=NormAngle360(nDrehWink+nWink);
 	RotatePoint(aRefPoint,rRef,sn,cs);
 	SdrObjList* pOL=pSub;
 	sal_uIntPtr nObjAnz=pOL->GetObjCount();
@@ -507,7 +522,6 @@
 void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
 {
 	SetGlueReallyAbsolute(sal_True);
-	nShearWink+=nWink;
 	ShearPoint(aRefPoint,rRef,tn);
 	SdrObjList* pOL=pSub;
 	sal_uIntPtr nObjAnz=pOL->GetObjCount();
@@ -647,7 +661,6 @@
 	if (nWink!=0) {
 		SetGlueReallyAbsolute(sal_True);
 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
-		nDrehWink=NormAngle360(nDrehWink+nWink);
 		RotatePoint(aRefPoint,rRef,sn,cs);
 		// #32383# Erst die Verbinder verschieben, dann den Rest
 		SdrObjList* pOL=pSub;
@@ -700,7 +713,6 @@
 	if (nWink!=0) {
 		SetGlueReallyAbsolute(sal_True);
 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
-		nShearWink+=nWink;
 		ShearPoint(aRefPoint,rRef,tn);
 		// #32383# Erst die Verbinder verschieben, dann den Rest
 		SdrObjList* pOL=pSub;
diff --git a/main/svx/source/svdraw/svdopath.cxx b/main/svx/source/svdraw/svdopath.cxx
index f82e34b..036048e 100644
--- a/main/svx/source/svdraw/svdopath.cxx
+++ b/main/svx/source/svdraw/svdopath.cxx
@@ -2962,7 +2962,7 @@
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3032,7 +3032,7 @@
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
diff --git a/main/svx/source/svdraw/svdotext.cxx b/main/svx/source/svdraw/svdotext.cxx
index 594afac..64e6c55 100644
--- a/main/svx/source/svdraw/svdotext.cxx
+++ b/main/svx/source/svdraw/svdotext.cxx
@@ -1710,7 +1710,7 @@
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -1772,7 +1772,7 @@
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
diff --git a/main/svx/source/svdraw/svdstr.src b/main/svx/source/svdraw/svdstr.src
index 498b2f7..44361ce 100644
--- a/main/svx/source/svdraw/svdstr.src
+++ b/main/svx/source/svdraw/svdstr.src
@@ -2875,6 +2875,16 @@
 	File = "cropmarkersACC.bmp";
 };
 
+// DialControl bitmaps
+Bitmap IMG_DIACONTROL_NORMAL
+{
+    File = "rotation.png";
+};
+Bitmap IMG_DIACONTROL_H
+{
+    File = "rotation_h.png";
+};
+
 //IAccessibility2 Implementation 2009-----
 String STR_ObjNameSingulFONTWORK
 {
diff --git a/main/svx/source/table/accessibletableshape.cxx b/main/svx/source/table/accessibletableshape.cxx
index 6d227b2..96548e9 100644
--- a/main/svx/source/table/accessibletableshape.cxx
+++ b/main/svx/source/table/accessibletableshape.cxx
@@ -34,7 +34,7 @@
 #include <vcl/svapp.hxx>
 
 #include <svx/AccessibleTableShape.hxx>
-#include "tablecontroller.hxx"
+#include <svx/sdr/table/tablecontroller.hxx>
 #include "accessiblecell.hxx"
 
 #include <algorithm>
diff --git a/main/svx/source/table/tablecontroller.cxx b/main/svx/source/table/tablecontroller.cxx
index 65049cf..2579cff 100644
--- a/main/svx/source/table/tablecontroller.cxx
+++ b/main/svx/source/table/tablecontroller.cxx
@@ -24,7 +24,8 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
-#include "tablecontroller.hxx"
+#include <svx/sdr/table/tablecontroller.hxx>
+#include <tablemodel.hxx>
 
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
diff --git a/main/svx/source/table/tablecontroller.hxx b/main/svx/source/table/tablecontroller.hxx
deleted file mode 100644
index 41dd66c..0000000
--- a/main/svx/source/table/tablecontroller.hxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/**************************************************************
- * 
- * 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 _SVX_TABLECONTROLLER_HXX_
-#define _SVX_TABLECONTROLLER_HXX_
-
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/table/XTable.hpp>
-#include <rtl/ref.hxx>
-
-#include <svx/sdr/overlay/overlayobjectlist.hxx>
-#include <svx/selectioncontroller.hxx>
-#include <svx/svdotable.hxx>
-#include <svx/svdview.hxx>
-#include <tablemodel.hxx>
-
-class SdrObjEditView;
-class SdrObject;
-class SfxItemSet;
-
-namespace sdr { namespace table {
-
-const sal_Int16 SELTYPE_NONE = 0;
-const sal_Int16 SELTYPE_MOUSE = 1;
-const sal_Int16 SELTYPE_KEYS = 2;
-
-class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
-{
-public:
-    SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
-    SVX_DLLPRIVATE virtual ~SvxTableController();
-
-    // from sdr::SelectionController
-    SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin);
-    SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
-    SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
-    SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin);
-
-    SVX_DLLPRIVATE virtual bool DeleteMarked();
-
-    SVX_DLLPRIVATE virtual void onSelectionHasChanged();
-
-    SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet );
-    SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq );
-
-    SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
-    SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
-
-	SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  );
-	SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );	
-
-	// slots
-    SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
-    SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
-    SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
-    SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
-    SVX_DLLPRIVATE void MergeMarkedCells();
-    SVX_DLLPRIVATE void SplitMarkedCells();
-    SVX_DLLPRIVATE void DistributeColumns();
-    SVX_DLLPRIVATE void DistributeRows();
-    SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
-
-    SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
-
-    SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
-    SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
-
-    SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
-    SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
-
-    SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage );
-    SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel );
-
-    SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); }
-
-	void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
-	void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
-	void clearSelection();
-	void selectAll();
-
-    SVX_DLLPRIVATE void onTableModified();
-
-private:
-    SvxTableController(SvxTableController &); // not defined
-    void operator =(SvxTableController &); // not defined
-
-	// internals
-    SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
-    SVX_DLLPRIVATE void UpdateTableShape();
-
-    SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
-    SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
-
-    SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
-
-    SVX_DLLPRIVATE bool checkTableObject();
-    SVX_DLLPRIVATE bool updateTableObject();
-    SVX_DLLPRIVATE const CellPos& getSelectionStart();
-    SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
-    SVX_DLLPRIVATE const CellPos& getSelectionEnd();
-    SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellCursor > getSelectionCursor();
-    SVX_DLLPRIVATE void checkCell( CellPos& rPos );
-
-    SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
-
-    SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
-    SVX_DLLPRIVATE bool StopTextEdit();
-
-    SVX_DLLPRIVATE void DeleteTable();
-
-    SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow );
-    SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow );
-    SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 );
-
-    SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
-    SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
-    SVX_DLLPRIVATE void RemoveSelection();
-    SVX_DLLPRIVATE void updateSelectionOverlay();
-    SVX_DLLPRIVATE void destroySelectionOverlay();
-
-    SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
-
-	DECL_LINK( UpdateHdl, void * );
-
-	TableModelRef mxTable;
-
-	CellPos maCursorFirstPos;
-	CellPos maCursorLastPos;
-	bool mbCellSelectionMode;
-	CellPos maMouseDownPos;
-	bool mbLeftButtonDown;
-	::sdr::overlay::OverlayObjectList*	mpSelectionOverlay;
-
-	SdrView* mpView;
-	SdrObjectWeakRef mxTableObj;
-	SdrModel* mpModel;
-
-	::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
-
-	sal_uLong mnUpdateEvent;
-};
-
-} }
-
-#endif // _SVX_TABLECONTROLLER_HXX_
-
diff --git a/main/svx/source/tbxctrls/fillctrl.cxx b/main/svx/source/tbxctrls/fillctrl.cxx
index 1fdee95..12a4e32 100644
--- a/main/svx/source/tbxctrls/fillctrl.cxx
+++ b/main/svx/source/tbxctrls/fillctrl.cxx
@@ -129,14 +129,6 @@
 				delete pStyleItem;
 				pStyleItem = (XFillStyleItem*) pState->Clone();
 				pFillTypeLB->Enable();
-
-				eLastXFS = pFillTypeLB->GetSelectEntryPos();
-				bUpdate = sal_True;
-
-				XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
-				pFillTypeLB->SelectEntryPos(
-                    sal::static_int_cast< sal_uInt16 >( eXFS ) );
-				pFillAttrLB->Enable();
 			}
 			else if( pStyleItem )
 			{
@@ -175,7 +167,28 @@
 						bEnableControls = sal_True;
 				}
 			}
-			if( bEnableControls )
+
+            if( pStyleItem )
+            {
+                // ensure that the correct entry is selected in pFillTypeLB. It
+                // might have been changed by nSID == SID_ATTR_FILL_STYLE, but
+                // it might also be in an in-between state when user had started to
+                // change fillstyle, but not yet changed fillvalue for new style
+                // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/
+                // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered
+                eLastXFS = pFillTypeLB->GetSelectEntryPos();
+                XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+
+                if(eLastXFS != eXFS)
+                {
+                    bUpdate = sal_True;
+                    pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) );
+                }
+
+                pFillAttrLB->Enable();
+            }
+
+            if( bEnableControls )
 			{
 				//pFillTypeLB->Enable();
 				pFillAttrLB->Enable();
@@ -320,13 +333,13 @@
  						XGradientList aGradientList( aEmptyString );
 						aGradientList.Insert( pEntry );
 						aGradientList.SetDirty( sal_False );
-						Bitmap* pBmp = aGradientList.CreateBitmapForUI( 0 );
+						const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
 
-						if( pBmp )
+						if( !aBmp.IsEmpty() )
 						{
-							( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp );
+							( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp );
 							pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
-							delete pBmp;
+							//delete pBmp;
 						}
 
 						aGradientList.Remove( 0 );
@@ -370,13 +383,13 @@
 						XHatchList aHatchList( aEmptyString );
 						aHatchList.Insert( pEntry );
 						aHatchList.SetDirty( sal_False );
-						Bitmap* pBmp = aHatchList.CreateBitmapForUI( 0 );
+						const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
 
-						if( pBmp )
+						if( !aBmp.IsEmpty() )
 						{
-							( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp );
+							( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp );
 							pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
-							delete pBmp;
+							//delete pBmp;
 						}
 
 						aHatchList.Remove( 0 );
diff --git a/main/svx/source/tbxctrls/itemwin.cxx b/main/svx/source/tbxctrls/itemwin.cxx
index 59ab047..d53611f 100644
--- a/main/svx/source/tbxctrls/itemwin.cxx
+++ b/main/svx/source/tbxctrls/itemwin.cxx
@@ -52,8 +52,6 @@
 #include "svx/linectrl.hxx"
 #include <svtools/colorcfg.hxx>
 
-#include "linectrl.hrc"
-
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::util;
@@ -272,7 +270,7 @@
 
 void SvxLineBox::FillControl()
 {
-	FillStyles();
+	// FillStyles();
     if ( !mpSh )
         mpSh = SfxObjectShell::Current();
 
diff --git a/main/svx/source/tbxctrls/linectrl.cxx b/main/svx/source/tbxctrls/linectrl.cxx
index b3a0889..22df986 100644
--- a/main/svx/source/tbxctrls/linectrl.cxx
+++ b/main/svx/source/tbxctrls/linectrl.cxx
@@ -525,7 +525,6 @@
 	if( pLineEndList )
 	{
 		XLineEndEntry*		pEntry	= NULL;
-		Bitmap*				pBmp	= NULL;
 		VirtualDevice		aVD;
 
 		long nCount = pLineEndList->Count();
@@ -535,16 +534,16 @@
 		basegfx::B2DPolyPolygon aNothing;
 		pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) );
 		pEntry = pLineEndList->GetLineEnd( nCount );
-		pBmp = pLineEndList->GetBitmap( nCount );
-		DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" );
+		Bitmap aBmp = pLineEndList->GetUiBitmap( nCount );
+		OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
 
-		aBmpSize = pBmp->GetSizePixel();
+		aBmpSize = aBmp.GetSizePixel();
 		aVD.SetOutputSizePixel( aBmpSize, sal_False );
 		aBmpSize.Width() = aBmpSize.Width() / 2;
 		Point aPt0( 0, 0 );
 		Point aPt1( aBmpSize.Width(), 0 );
 
-		aVD.DrawBitmap( Point(), *pBmp );
+		aVD.DrawBitmap( Point(), aBmp );
 		aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
 		aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
 
@@ -554,10 +553,10 @@
 		{
 			pEntry = pLineEndList->GetLineEnd( i );
 			DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" );
-			pBmp = pLineEndList->GetBitmap( i );
-			DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" );
+			aBmp = pLineEndList->GetUiBitmap( i );
+			OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
 
-			aVD.DrawBitmap( aPt0, *pBmp );
+			aVD.DrawBitmap( aPt0, aBmp );
 			aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
 			aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), 	aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
 		}
diff --git a/main/svx/source/tbxctrls/linectrl.src b/main/svx/source/tbxctrls/linectrl.src
deleted file mode 100644
index 99aa996..0000000
--- a/main/svx/source/tbxctrls/linectrl.src
+++ /dev/null
@@ -1,30 +0,0 @@
-/**************************************************************
- * 
- * 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 "linectrl.hrc"
-
-Bitmap RID_SVXCTRL_LINECTRL
-{
-	File = "soliline.bmp" ;
-};
-
diff --git a/main/svx/source/tbxctrls/tbcontrl.cxx b/main/svx/source/tbxctrls/tbcontrl.cxx
index e8fc5b1..37becb4 100644
--- a/main/svx/source/tbxctrls/tbcontrl.cxx
+++ b/main/svx/source/tbxctrls/tbcontrl.cxx
@@ -834,7 +834,7 @@
 {
 	SfxObjectShell* pDocSh = SfxObjectShell::Current();
 	const SfxPoolItem* pItem = NULL;
-	XColorTable* pColorTable = NULL;
+	XColorList* pColorTable = NULL;
 	sal_Bool bKillTable = sal_False;
     const Size aSize12( 13, 13 );
 
@@ -844,7 +844,7 @@
 
 	if ( !pColorTable )
 	{
-		pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+		pColorTable = new XColorList( SvtPathOptions().GetPalettePath() );
 		bKillTable = sal_True;
 	}
 
@@ -1014,7 +1014,7 @@
     {
         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorTableItem )))
         {
-	        XColorTable* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL;
+	        XColorList* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL;
 
 			if ( pColorTable )
 			{
diff --git a/main/svx/source/tbxctrls/tbxcolorupdate.cxx b/main/svx/source/tbxctrls/tbxcolorupdate.cxx
index 81fecbb..e9a84ce 100644
--- a/main/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/main/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -83,7 +83,7 @@
         {
             BitmapEx            aBmpEx( aImage.GetBitmapEx() );
             Bitmap              aBmp( aBmpEx.GetBitmap() );
-            BitmapWriteAccess*  pBmpAcc = aBmp.AcquireWriteAccess();
+            BitmapWriteAccess*  pBmpAcc = aBmp.IsEmpty() ? NULL : aBmp.AcquireWriteAccess();
 
             maBmpSize = aBmp.GetSizePixel();
 
@@ -117,6 +117,20 @@
                     {
                         if( maBmpSize.Width() <= 16 )
                             maUpdRect = Rectangle( Point( 0,12 ), Size( maBmpSize.Width(), 4 ) );
+                        else if(76 == maBmpSize.Width() && 12 == maBmpSize.Height())
+                        {
+                            maUpdRect.Left() = 22;
+                            maUpdRect.Top() = 2;
+                            maUpdRect.Right() = 73;
+                            maUpdRect.Bottom() = 9;
+                        }
+                        else if(30 == maBmpSize.Width() && 16 == maBmpSize.Height())
+                        {
+                            maUpdRect.Left() = 17;
+                            maUpdRect.Top() = 2;
+                            maUpdRect.Right() = 27;
+                            maUpdRect.Bottom() = 13;
+                        }
                         else
                             maUpdRect = Rectangle( Point( 1, maBmpSize.Height() - 7 ), Size( maBmpSize.Width() - 2 ,6 ) );
                     }
diff --git a/main/svx/source/unodraw/XPropertyTable.cxx b/main/svx/source/unodraw/XPropertyTable.cxx
index 3703985..720c0f0 100644
--- a/main/svx/source/unodraw/XPropertyTable.cxx
+++ b/main/svx/source/unodraw/XPropertyTable.cxx
@@ -50,15 +50,13 @@
 class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
 {
 private:
-	XPropertyTable*	mpTable;
 	XPropertyList*	mpList;
 	sal_Int16 mnWhich;
 
-	long getCount() const { return mpList ? mpList->Count() : (mpTable?mpTable->Count():0); }
+    long getCount() const { return mpList ? mpList->Count() : 0 ; }
 	XPropertyEntry* get( long index ) const;
 public:
 	SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw();
-	SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw();
 
 	virtual	~SvxUnoXPropertyTable() throw();
 
@@ -84,13 +82,8 @@
     virtual sal_Bool SAL_CALL hasElements(  ) throw( uno::RuntimeException);
 };
 
-SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw()
-: mpTable( pTable ), mpList( NULL ), mnWhich( nWhich )
-{
-}
-
 SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw()
-: mpTable( NULL ), mpList( pList ), mnWhich( nWhich )
+: mpList( pList ), mnWhich( nWhich )
 {
 }
 
@@ -100,9 +93,7 @@
 
 XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
 {
-	if( mpTable )
-		return mpTable->Get( index, 0 );
-	else if( mpList )
+    if( mpList )
 		return mpList->Get( index, 0 );
 	else
 		return NULL;
@@ -131,7 +122,7 @@
 {
 	OGuard aGuard( Application::GetSolarMutex() );
 
-	if( NULL == mpList && NULL == mpTable )
+	if( NULL == mpList )
 		throw lang::IllegalArgumentException();
 
 	if( hasByName( aName ) )
@@ -146,8 +137,6 @@
 
 	if( mpList )
 		mpList->Insert( pNewEntry );
-	else
-		mpTable->Insert( mpTable->Count(), pNewEntry );
 }
 
 void SAL_CALL SvxUnoXPropertyTable::removeByName( const  OUString& Name )
@@ -168,8 +157,6 @@
 		{
 			if( mpList )
 				delete mpList->Remove( i, 0 );
-			else
-				delete mpTable->Remove( i, 0 );
 			return;
 		}
 	}
@@ -200,8 +187,6 @@
 
 			if( mpList )
 				delete mpList->Replace( pNewEntry, i );
-			else
-				delete mpTable->Replace( i, pNewEntry );
 			return;
 		}
 	}
@@ -291,7 +276,7 @@
 class SvxUnoXColorTable : public SvxUnoXPropertyTable
 {
 public:
-	SvxUnoXColorTable( XPropertyTable* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {};
+	SvxUnoXColorTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {};
 
 	// SvxUnoXPropertyTable
 	virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
@@ -305,7 +290,7 @@
     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
 };
 
-uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw()
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pTable ) throw()
 {
 	return (OWeakObject*) new SvxUnoXColorTable( pTable );
 }
diff --git a/main/svx/source/unodraw/unoctabl.cxx b/main/svx/source/unodraw/unoctabl.cxx
index 9089f8a..5f1ee47 100644
--- a/main/svx/source/unodraw/unoctabl.cxx
+++ b/main/svx/source/unodraw/unoctabl.cxx
@@ -44,7 +44,7 @@
 class SvxUnoColorTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
 {
 private:
-	XColorTable*	pTable;
+	XColorList*	pTable;
 
 public:
 	SvxUnoColorTable() throw();
@@ -83,7 +83,7 @@
 
 SvxUnoColorTable::SvxUnoColorTable() throw()
 {
-	pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+	pTable = new XColorList( SvtPathOptions().GetPalettePath() );
 }
 
 SvxUnoColorTable::~SvxUnoColorTable() throw()
@@ -135,14 +135,14 @@
 	if( pTable )
 	{
 		XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName  );
-		pTable->Insert( pTable->Count(), pEntry );
+		pTable->Insert( pEntry, pTable->Count() );
 	}
 }
 
 void SAL_CALL SvxUnoColorTable::removeByName( const OUString& Name )
 	throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 {
-	long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( Name ) : -1;
+	long nIndex = pTable ? ((XPropertyList*)pTable)->Get( Name ) : -1;
 	if( nIndex == -1 )
 		throw container::NoSuchElementException();
 
@@ -157,23 +157,23 @@
 	if( !(aElement >>= nColor) )
 		throw lang::IllegalArgumentException();
 
-	long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+	long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
 	if( nIndex == -1  )
 		throw container::NoSuchElementException();
 
 	XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName );
-	delete pTable->Replace( nIndex, pEntry );
+	delete pTable->Replace( pEntry, nIndex );
 }
 
 // XNameAccess
 uno::Any SAL_CALL SvxUnoColorTable::getByName( const  OUString& aName )
 	throw( container::NoSuchElementException,  lang::WrappedTargetException, uno::RuntimeException)
 {
-	long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+	long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
 	if( nIndex == -1 )
 		throw container::NoSuchElementException();
 
-	XColorEntry* pEntry = ((XColorTable*)pTable)->GetColor( nIndex );
+	XColorEntry* pEntry = ((XColorList*)pTable)->GetColor( nIndex );
 	return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() );
 }
 
@@ -197,7 +197,7 @@
 sal_Bool SAL_CALL SvxUnoColorTable::hasByName( const OUString& aName )
 	throw( uno::RuntimeException )
 {
-	long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+	long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1;
 	return nIndex != -1;
 }
 
@@ -238,6 +238,8 @@
 #include "cppuhelper/factory.hxx"
 #include "uno/lbnames.h"
 #include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
+#include "sidebar/PanelFactory.hxx"
+
 
 /*
 namespace svx
@@ -366,16 +368,15 @@
                 ::svx::SvXMLGraphicExportHelper_createInstance,
                 ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() );
         }
-/*
-		else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) )
-		{
-			xFactory = ::cppu::createSingleFactory(
-				reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
-				::svx::ExtrusionDepthController_getImplementationName(),
-				::svx::ExtrusionDepthController_createInstance,
-				::svx::ExtrusionDepthController_getSupportedServiceNames() );
-		}
-*/
+        else if (::svx::sidebar::PanelFactory::getImplementationName().equalsAscii(pImplName))
+        {
+            xFactory = ::cppu::createSingleFactory(
+                reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
+                ::svx::sidebar::PanelFactory::getImplementationName(),
+                ::svx::sidebar::PanelFactory::createInstance,
+                ::svx::sidebar::PanelFactory::getSupportedServiceNames());
+        }
+
 		if( xFactory.is())
 		{
 			xFactory->acquire();
diff --git a/main/svx/source/xoutdev/XPropertyEntry.cxx b/main/svx/source/xoutdev/XPropertyEntry.cxx
new file mode 100755
index 0000000..21419d4
--- /dev/null
+++ b/main/svx/source/xoutdev/XPropertyEntry.cxx
@@ -0,0 +1,44 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/XPropertyEntry.hxx>
+// --------------------
+
+XPropertyEntry::XPropertyEntry(const String& rName) 
+:   maName(rName), 
+    maUiBitmap() 
+{
+}
+
+XPropertyEntry::XPropertyEntry(const XPropertyEntry& rOther)
+:   maName(rOther.maName), 
+    maUiBitmap(rOther.maUiBitmap) 
+{
+}
+
+XPropertyEntry::~XPropertyEntry() 
+{
+}
+
+// eof
diff --git a/main/svx/source/xoutdev/xattr.cxx b/main/svx/source/xoutdev/xattr.cxx
index c150449..dc7e5d5 100644
--- a/main/svx/source/xoutdev/xattr.cxx
+++ b/main/svx/source/xoutdev/xattr.cxx
@@ -471,11 +471,11 @@
 
 /*************************************************************************
 |*
-|*	  const XColor& XColorItem::GetColorValue(const XColorTable* pTable) const
+|*	  const XColor& XColorItem::GetColorValue(const XColorList* pTable) const
 |*
 \************************************************************************/
 
-const Color& XColorItem::GetColorValue(const XColorTable* pTable) const
+const Color& XColorItem::GetColorValue(const XColorList* pTable) const
 {
 	if (!IsIndex())
 		return aColor;
@@ -1047,7 +1047,7 @@
 
 /*************************************************************************
 |*
-|*	  const XDash& XLineDashItem::GetValue(const XDashTable* pTable) const
+|*	  const XDash& XLineDashItem::GetValue(const XDashList* pTable) const
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -1055,7 +1055,7 @@
 |*
 *************************************************************************/
 
-const XDash& XLineDashItem::GetDashValue(const XDashTable* pTable) const // GetValue -> GetDashValue
+const XDash& XLineDashItem::GetDashValue(const XDashList* pTable) const // GetValue -> GetDashValue
 {
 	if (!IsIndex())
 		return aDash;
@@ -1868,7 +1868,7 @@
 
 /*************************************************************************
 |*
-|*	  const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndTable* pTable)
+|*	  const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndList* pTable)
 |*											   const
 |*
 |*	  Beschreibung
@@ -1877,7 +1877,7 @@
 |*
 *************************************************************************/
 
-basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndTable* pTable) const
+basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndList* pTable) const
 {
 	if (!IsIndex())
 	{
@@ -2340,7 +2340,7 @@
 
 /*************************************************************************
 |*
-|*	  const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndTable* pTable) const
+|*	  const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndList* pTable) const
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -2348,7 +2348,7 @@
 |*
 *************************************************************************/
 
-basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndTable* pTable) const
+basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndList* pTable) const
 {
 	if (!IsIndex())
 	{
@@ -3713,7 +3713,7 @@
 
 /*************************************************************************
 |*
-|*	  const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable)
+|*	  const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable)
 |*																   const
 |*
 |*	  Beschreibung
@@ -3722,7 +3722,7 @@
 |*
 *************************************************************************/
 
-const XGradient& XFillGradientItem::GetGradientValue(const XGradientTable* pTable) const // GetValue -> GetGradientValue
+const XGradient& XFillGradientItem::GetGradientValue(const XGradientList* pTable) const // GetValue -> GetGradientValue
 {
 	if (!IsIndex())
 		return aGradient;
@@ -4423,7 +4423,7 @@
 
 /*************************************************************************
 |*
-|*	  const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const
+|*	  const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -4431,7 +4431,7 @@
 |*
 *************************************************************************/
 
-const XHatch& XFillHatchItem::GetHatchValue(const XHatchTable* pTable) const // GetValue -> GetHatchValue
+const XHatch& XFillHatchItem::GetHatchValue(const XHatchList* pTable) const // GetValue -> GetHatchValue
 {
 	if (!IsIndex())
 		return aHatch;
diff --git a/main/svx/source/xoutdev/xattr2.cxx b/main/svx/source/xoutdev/xattr2.cxx
index 198a970..d94aaf9 100644
--- a/main/svx/source/xoutdev/xattr2.cxx
+++ b/main/svx/source/xoutdev/xattr2.cxx
@@ -37,6 +37,7 @@
 #include <svx/dialmgr.hxx>
 #include <editeng/itemtype.hxx>
 #include <svx/xdef.hxx>
+#include <svx/AffineMatrixItem.hxx>
 
 #define GLOBALOVERFLOW
 
@@ -143,7 +144,7 @@
 
 // -----------------------------------------------------------------------------
 
-XLineJointItem::XLineJointItem( XLineJoint eLineJoint ) :
+XLineJointItem::XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint ) :
 	SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint))
 {
 }
@@ -169,7 +170,7 @@
 	XLineJointItem* pRet = new XLineJointItem( rIn );
 
 	if(nVer < 1)
-		pRet->SetValue(XLINEJOINT_ROUND);
+		pRet->SetValue(com::sun::star::drawing::LineJoint_ROUND);
 
 	return pRet;
 }
@@ -184,7 +185,7 @@
 // -----------------------------------------------------------------------------
 
 SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres,	SfxMapUnit /*eCoreUnit*/,
-                                                     SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const
+    SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const
 {
 	rText.Erase();
 
@@ -199,26 +200,26 @@
 
 			switch( GetValue() )
 			{
-				case( XLINEJOINT_NONE ):
+				case( com::sun::star::drawing::LineJoint_NONE ):
 					nId = RID_SVXSTR_LINEJOINT_NONE;
 				break;
 
-				case( XLINEJOINT_MIDDLE ):
+				case( com::sun::star::drawing::LineJoint_MIDDLE ):
 					nId = RID_SVXSTR_LINEJOINT_MIDDLE;
 				break;
 
 
-				case( XLINEJOINT_BEVEL ):
+				case( com::sun::star::drawing::LineJoint_BEVEL ):
 					nId = RID_SVXSTR_LINEJOINT_BEVEL;
 				break;
 
 
-				case( XLINEJOINT_MITER ):
+				case( com::sun::star::drawing::LineJoint_MITER ):
 					nId = RID_SVXSTR_LINEJOINT_MITER;
 				break;
 
 
-				case( XLINEJOINT_ROUND ):
+				case( com::sun::star::drawing::LineJoint_ROUND ):
 					nId = RID_SVXSTR_LINEJOINT_ROUND;
 				break;
 			}
@@ -237,28 +238,7 @@
 
 sal_Bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
 {
-	::com::sun::star::drawing::LineJoint eJoint = ::com::sun::star::drawing::LineJoint_NONE;
-
-	switch( GetValue() )
-	{
-	case XLINEJOINT_NONE:
-		break;
-	case XLINEJOINT_MIDDLE:
-		eJoint = ::com::sun::star::drawing::LineJoint_MIDDLE;
-		break;
-	case XLINEJOINT_BEVEL:
-		eJoint = ::com::sun::star::drawing::LineJoint_BEVEL;
-		break;
-	case XLINEJOINT_MITER:
-		eJoint = ::com::sun::star::drawing::LineJoint_MITER;
-		break;
-	case XLINEJOINT_ROUND:
-		eJoint = ::com::sun::star::drawing::LineJoint_ROUND;
-		break;
-	default:
-		DBG_ERROR( "Unknown LineJoint enum value!" );
-	}
-
+	const ::com::sun::star::drawing::LineJoint eJoint = GetValue();
 	rVal <<= eJoint;
 	return sal_True;
 }
@@ -267,7 +247,6 @@
 
 sal_Bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
 {
-	XLineJoint eJoint = XLINEJOINT_NONE;
 	::com::sun::star::drawing::LineJoint eUnoJoint;
 
 	if(!(rVal >>= eUnoJoint))
@@ -279,25 +258,7 @@
         eUnoJoint = (::com::sun::star::drawing::LineJoint)nLJ;
     }
 
-	switch( eUnoJoint )
-	{
-	case ::com::sun::star::drawing::LineJoint_MIDDLE:
-		eJoint = XLINEJOINT_MIDDLE;
-		break;
-	case ::com::sun::star::drawing::LineJoint_BEVEL:
-		eJoint = XLINEJOINT_BEVEL;
-		break;
-	case ::com::sun::star::drawing::LineJoint_MITER:
-		eJoint = XLINEJOINT_MITER;
-		break;
-	case ::com::sun::star::drawing::LineJoint_ROUND:
-		eJoint = XLINEJOINT_ROUND;
-		break;
-	default:
-		break;
-	}
-
-	SetValue( sal::static_int_cast< sal_uInt16 >( eJoint ) );
+	SetValue( sal::static_int_cast< sal_uInt16 >( eUnoJoint ) );
 
 	return sal_True;
 }
@@ -310,6 +271,116 @@
 	return 5;
 }
 
+//---------------------
+// class AffineMatrixItem
+//---------------------
+
+TYPEINIT1_AUTOFACTORY(AffineMatrixItem, SfxPoolItem);
+
+AffineMatrixItem::AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix)
+:   SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX)
+{
+    if(pMatrix)
+    {
+        maMatrix = *pMatrix;
+    }
+    else
+    {
+        maMatrix.m00 = 1.0;
+        maMatrix.m01 = 0.0;
+        maMatrix.m02 = 0.0;
+        maMatrix.m10 = 0.0;
+        maMatrix.m11 = 1.0;
+        maMatrix.m12 = 0.0;
+    }
+}
+
+AffineMatrixItem::AffineMatrixItem(SvStream& rIn)
+:   SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX)
+{
+    rIn >> maMatrix.m00;
+    rIn >> maMatrix.m01;
+    rIn >> maMatrix.m02;
+    rIn >> maMatrix.m10;
+    rIn >> maMatrix.m11;
+    rIn >> maMatrix.m12;
+}
+
+AffineMatrixItem::AffineMatrixItem(const AffineMatrixItem& rRef)
+:   SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX)
+{
+    maMatrix = rRef.maMatrix;
+}
+
+AffineMatrixItem::~AffineMatrixItem()
+{
+}
+
+int AffineMatrixItem::operator==(const SfxPoolItem& rRef) const
+{
+    if(!SfxPoolItem::operator==(rRef))
+    {
+        return 0;
+    }
+
+    const AffineMatrixItem* pRef = dynamic_cast< const AffineMatrixItem* >(&rRef);
+
+    if(!pRef)
+    {
+        return 0;
+    }
+
+    return (maMatrix.m00 == pRef->maMatrix.m00
+        && maMatrix.m01 == pRef->maMatrix.m01
+        && maMatrix.m02 == pRef->maMatrix.m02
+        && maMatrix.m10 == pRef->maMatrix.m10
+        && maMatrix.m11 == pRef->maMatrix.m11
+        && maMatrix.m12 == pRef->maMatrix.m12);
+}
+
+SfxPoolItem* AffineMatrixItem::Clone( SfxItemPool* /*pPool*/ ) const
+{
+    return new AffineMatrixItem(*this);
+}
+
+SfxPoolItem* AffineMatrixItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/ ) const
+{
+    return new AffineMatrixItem(rIn);
+}
+
+SvStream& AffineMatrixItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const
+{
+    rStream << maMatrix.m00;
+    rStream << maMatrix.m01;
+    rStream << maMatrix.m02;
+    rStream << maMatrix.m10;
+    rStream << maMatrix.m11;
+    rStream << maMatrix.m12;
+    return rStream;
+}
+
+sal_Bool AffineMatrixItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+    rVal <<= maMatrix;
+    return sal_True;
+}
+
+sal_Bool AffineMatrixItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+    if (rVal >>= maMatrix)
+    {
+        return sal_True;
+    }
+
+    DBG_ERROR( "AffineMatrixItem::PutValue - Wrong type!" );
+    return sal_False;
+}
+
+const com::sun::star::geometry::AffineMatrix2D& AffineMatrixItem::GetAffineMatrix2D() const
+{
+    return maMatrix;
+}
+
 //-----------------------
 // class XLineCapItem -
 //-----------------------
diff --git a/main/svx/source/xoutdev/xpool.cxx b/main/svx/source/xoutdev/xpool.cxx
index 446f91a..658b022 100644
--- a/main/svx/source/xoutdev/xpool.cxx
+++ b/main/svx/source/xoutdev/xpool.cxx
@@ -164,6 +164,13 @@
 	mpLocalItemInfos[XATTR_FORMTXTSTDFORM   -XATTR_START]._nSID = SID_FORMTEXT_STDFORM;
 	mpLocalItemInfos[XATTR_FORMTXTHIDEFORM  -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM;
 
+    // associate new slots for panels with known items
+    mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE;
+    mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE;
+    mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE;
+    mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT;
+    mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP;
+
 	// if it's my own creation level, set Defaults and ItemInfos
 	if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich())
 	{
diff --git a/main/svx/source/xoutdev/xtabbtmp.cxx b/main/svx/source/xoutdev/xtabbtmp.cxx
index bd55846..b8cc7e7 100644
--- a/main/svx/source/xoutdev/xtabbtmp.cxx
+++ b/main/svx/source/xoutdev/xtabbtmp.cxx
@@ -51,102 +51,13 @@
 static char const aChckBitmap1[] = { 0x04, 0x00, 'S','O','B','1'};	// = 5.2
 static char const aChckXML[]     = { 'P', 'K', 0x03, 0x04 };		// = 6.0
 
-// -------------------
-// class XBitmapTable
-// -------------------
-
-/*************************************************************************
-|*
-|* XBitmapTable::XBitmapTable()
-|*
-*************************************************************************/
-
-XBitmapTable::XBitmapTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
-{
-	pBmpTable = new Table( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XBitmapTable::~XBitmapTable()
-{
-}
-
-/************************************************************************/
-
-XBitmapEntry* XBitmapTable::Replace(long nIndex, XBitmapEntry* pEntry )
-{
-	return (XBitmapEntry*) XPropertyTable::Replace(nIndex, pEntry);
-}
-
-/************************************************************************/
-
-XBitmapEntry* XBitmapTable::Remove(long nIndex)
-{
-	return (XBitmapEntry*) XPropertyTable::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XBitmapEntry* XBitmapTable::GetBitmap(long nIndex) const
-{
-	return (XBitmapEntry*) XPropertyTable::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XBitmapTable::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XBitmapTable::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XBitmapTable::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XBitmapTable::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XBitmapTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
-}
-
 // ------------------
 // class XBitmapList
 // ------------------
 
-/*************************************************************************
-|*
-|* XBitmapList::XBitmapList()
-|*
-*************************************************************************/
-
-XBitmapList::XBitmapList( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyList( rPath, pInPool, nInitSize, nReSize)
+XBitmapList::XBitmapList( const String& rPath, XOutdevItemPool* pInPool ) :
+				XPropertyList( rPath, pInPool )
 {
-	// pBmpList = new List( nInitSize, nReSize );
 }
 
 /************************************************************************/
@@ -180,19 +91,19 @@
 
 sal_Bool XBitmapList::Load()
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
-		bListDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) );
@@ -207,15 +118,15 @@
 
 sal_Bool XBitmapList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) );
@@ -276,16 +187,9 @@
 
 /************************************************************************/
 
-sal_Bool XBitmapList::CreateBitmapsForUI()
+Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ )
 {
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XBitmapList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
+	return Bitmap();
 }
 
 // eof
diff --git a/main/svx/source/xoutdev/xtabcolr.cxx b/main/svx/source/xoutdev/xtabcolr.cxx
index a51ee0d..78de69f 100644
--- a/main/svx/source/xoutdev/xtabcolr.cxx
+++ b/main/svx/source/xoutdev/xtabcolr.cxx
@@ -55,78 +55,63 @@
 static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'};	// = 5.2
 static char const aChckXML[]    = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
-// ------------------
-// class XColorTable
-// ------------------
-
-static XColorTable* pTable=0;
-
 /*************************************************************************
 |*
-|* XColorTable::XColorTable()
+|* XColorList::XColorList()
 |*
 *************************************************************************/
 
-XColorTable::XColorTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+static XColorList* pStaticGlobalColorList = 0;
+
+XColorList::XColorList( const String& rPath, XOutdevItemPool* pInPool ) :
+				XPropertyList( rPath, pInPool )
 {
-	// ColorTable braucht keine eigene BmpTable
-	// pBmpTable = new Table( nInitSize, nReSize );
 }
 
 /************************************************************************/
 
-XColorTable::~XColorTable()
+XColorList::~XColorList()
 {
 }
 
-XColorTable* XColorTable::GetStdColorTable()
-{
-	if ( !pTable )
-		pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
-	return pTable;
-}
-
 /************************************************************************/
 
-XColorEntry* XColorTable::Replace(long nIndex, XColorEntry* pEntry )
+XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex )
 {
-	return (XColorEntry*) XPropertyTable::Replace(nIndex, pEntry);
+	return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex);
 }
 
 /************************************************************************/
 
-XColorEntry* XColorTable::Remove(long nIndex)
+XColorEntry* XColorList::Remove(long nIndex)
 {
-	return (XColorEntry*) XPropertyTable::Remove(nIndex, 0);
+	return (XColorEntry*) XPropertyList::Remove(nIndex, 0);
 }
 
 /************************************************************************/
 
-XColorEntry* XColorTable::GetColor(long nIndex) const
+XColorEntry* XColorList::GetColor(long nIndex) const
 {
-	return (XColorEntry*) XPropertyTable::Get(nIndex, 0);
+	return (XColorEntry*) XPropertyList::Get(nIndex, 0);
 }
 
 /************************************************************************/
 
-sal_Bool XColorTable::Load()
+sal_Bool XColorList::Load()
 {
-	if( bTableDirty )
+	if( mbListDirty )
 	{
-		bTableDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
@@ -139,17 +124,17 @@
 
 /************************************************************************/
 
-sal_Bool XColorTable::Save()
+sal_Bool XColorList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
@@ -160,7 +145,7 @@
 
 /************************************************************************/
 
-sal_Bool XColorTable::Create()
+sal_Bool XColorList::Create()
 {
 	XubString aStr;
 	xub_StrLen nLen;
@@ -217,328 +202,249 @@
 
 	for( sal_uInt16 n = 0; n < 16; ++n )
 	{
-		Insert( n, new XColorEntry( Color( aColTab[n] ),
-									String( ResId( aResId[ n ], rRes )) ) );
+		Insert( new XColorEntry( Color( aColTab[n] ), String( ResId( aResId[ n ], rRes )) ), n );
 	}
 
 	aStr = SVX_RESSTR( RID_SVXSTR_GREY );
 	aStr.AppendAscii(" 80%");
 	nLen = aStr.Len() - 3;
-	Insert(16, new XColorEntry( Color( 51, 51, 51 ), aStr ) );
+	Insert( new XColorEntry( Color( 51, 51, 51 ), aStr ) , 16);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(17, new XColorEntry( Color( 76, 76, 76 ), aStr ) );
+	Insert( new XColorEntry( Color( 76, 76, 76 ), aStr ) , 17);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(18, new XColorEntry( Color(102,102,102 ), aStr ) );
+	Insert( new XColorEntry( Color(102,102,102 ), aStr ) , 18);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(19, new XColorEntry( Color(153,153,153 ), aStr ) );
+	Insert( new XColorEntry( Color(153,153,153 ), aStr ) , 19);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(20, new XColorEntry( Color(179,179,179 ), aStr ) );
+	Insert( new XColorEntry( Color(179,179,179 ), aStr ) , 20);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(21, new XColorEntry( Color(204,204,204 ), aStr ) );
+	Insert( new XColorEntry( Color(204,204,204 ), aStr ) , 21);
 	// BM: new 15%
 	aStr.SetChar(nLen, sal_Unicode('1'));
 	aStr.SetChar(nLen + 1, sal_Unicode('5'));
-	Insert(22, new XColorEntry( Color(217,217,217 ), aStr ) );
+	Insert( new XColorEntry( Color(217,217,217 ), aStr ) , 22);
 	aStr.SetChar(nLen + 1, sal_Unicode('0'));
-	Insert(23, new XColorEntry( Color(230,230,230 ), aStr ) );
-	Insert(24, new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) );
+	Insert( new XColorEntry( Color(230,230,230 ), aStr ) , 23);
+	Insert( new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) , 24);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_RED );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(25, new XColorEntry( Color(255, 51,102 ), aStr ) );
+	Insert( new XColorEntry( Color(255, 51,102 ), aStr ) , 25);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(26, new XColorEntry( Color(220, 35,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(220, 35,  0 ), aStr ) , 26);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(27, new XColorEntry( Color(184, 71,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(184, 71,  0 ), aStr ) , 27);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(28, new XColorEntry( Color(255, 51, 51 ), aStr ) );
+	Insert( new XColorEntry( Color(255, 51, 51 ), aStr ) , 28);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(29, new XColorEntry( Color(235, 97, 61 ), aStr ) );
+	Insert( new XColorEntry( Color(235, 97, 61 ), aStr ) , 29);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(30, new XColorEntry( Color(184, 71, 71 ), aStr ) );
+	Insert( new XColorEntry( Color(184, 71, 71 ), aStr ) , 30);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(31, new XColorEntry( Color(184,  0, 71 ), aStr ) );
+	Insert( new XColorEntry( Color(184,  0, 71 ), aStr ) , 31);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(32, new XColorEntry( Color(153, 40, 76 ), aStr ) );
+	Insert( new XColorEntry( Color(153, 40, 76 ), aStr ) , 32);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(33, new XColorEntry( Color(148,  0,107 ), aStr ) );
+	Insert( new XColorEntry( Color(148,  0,107 ), aStr ) , 33);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(34, new XColorEntry( Color(148, 71,107 ), aStr ) );
+	Insert( new XColorEntry( Color(148, 71,107 ), aStr ) , 34);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(35, new XColorEntry( Color(148, 71,148 ), aStr ) );
+	Insert( new XColorEntry( Color(148, 71,148 ), aStr ) , 35);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(36, new XColorEntry( Color(153,102,204 ), aStr ) );
+	Insert( new XColorEntry( Color(153,102,204 ), aStr ) , 36);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(37, new XColorEntry( Color(107, 71,148 ), aStr ) );
+	Insert( new XColorEntry( Color(107, 71,148 ), aStr ) , 37);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(38, new XColorEntry( Color(107, 35,148 ), aStr ) );
+	Insert( new XColorEntry( Color(107, 35,148 ), aStr ) , 38);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(39, new XColorEntry( Color(107,  0,148 ), aStr ) );
+	Insert( new XColorEntry( Color(107,  0,148 ), aStr ) , 39);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(40, new XColorEntry( Color( 94, 17,166 ), aStr ) );
+	Insert( new XColorEntry( Color( 94, 17,166 ), aStr ) , 40);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_BLUE );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(41, new XColorEntry( Color( 40,  0,153 ), aStr ) );
+	Insert( new XColorEntry( Color( 40,  0,153 ), aStr ) , 41);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(42, new XColorEntry( Color( 71,  0,184 ), aStr ) );
+	Insert( new XColorEntry( Color( 71,  0,184 ), aStr ) , 42);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(43, new XColorEntry( Color( 35,  0,220 ), aStr ) );
+	Insert( new XColorEntry( Color( 35,  0,220 ), aStr ) , 43);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(44, new XColorEntry( Color( 35, 35,220 ), aStr ) );
+	Insert( new XColorEntry( Color( 35, 35,220 ), aStr ) , 44);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(45, new XColorEntry( Color(  0, 71,255 ), aStr ) );
+	Insert( new XColorEntry( Color(  0, 71,255 ), aStr ) , 45);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(46, new XColorEntry( Color(  0,153,255 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,153,255 ), aStr ) , 46);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(47, new XColorEntry( Color(  0,184,255 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,184,255 ), aStr ) , 47);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(48, new XColorEntry( Color(153,204,255 ), aStr ) );
+	Insert( new XColorEntry( Color(153,204,255 ), aStr ) , 48);
 	//Insert(48, new XColorEntry( Color( 46,215,255 ), aStr ) );
 
 	aStr = SVX_RESSTR( RID_SVXSTR_CYAN );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(49, new XColorEntry( Color(  0,220,255 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,220,255 ), aStr ) , 49);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(50, new XColorEntry( Color(  0,204,204 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,204,204 ), aStr ) , 50);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(51, new XColorEntry( Color( 35,184,220 ), aStr ) );
+	Insert( new XColorEntry( Color( 35,184,220 ), aStr ) , 51);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(52, new XColorEntry( Color( 71,184,184 ), aStr ) );
+	Insert( new XColorEntry( Color( 71,184,184 ), aStr ) , 52);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(53, new XColorEntry( Color( 51,163,163 ), aStr ) );
+	Insert( new XColorEntry( Color( 51,163,163 ), aStr ) , 53);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(54, new XColorEntry( Color( 25,138,138 ), aStr ) );
+	Insert( new XColorEntry( Color( 25,138,138 ), aStr ) , 54);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(55, new XColorEntry( Color(  0,107,107 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,107,107 ), aStr ) , 55);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(56, new XColorEntry( Color(  0, 74, 74 ), aStr ) );
+	Insert( new XColorEntry( Color(  0, 74, 74 ), aStr ) , 56);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_GREEN );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(57, new XColorEntry( Color( 53, 94,  0 ), aStr ) );
+	Insert( new XColorEntry( Color( 53, 94,  0 ), aStr ) , 57);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(58, new XColorEntry( Color( 92,133, 38 ), aStr ) );
+	Insert( new XColorEntry( Color( 92,133, 38 ), aStr ) , 58);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(59, new XColorEntry( Color(125,166, 71 ), aStr ) );
+	Insert( new XColorEntry( Color(125,166, 71 ), aStr ) , 59);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(60, new XColorEntry( Color(148,189, 94 ), aStr ) );
+	Insert( new XColorEntry( Color(148,189, 94 ), aStr ) , 60);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(61, new XColorEntry( Color(  0,174,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(  0,174,  0 ), aStr ) , 61);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(62, new XColorEntry( Color( 51,204,102 ), aStr ) );
+	Insert( new XColorEntry( Color( 51,204,102 ), aStr ) , 62);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(63, new XColorEntry( Color( 61,235, 61 ), aStr ) );
+	Insert( new XColorEntry( Color( 61,235, 61 ), aStr ) , 63);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(64, new XColorEntry( Color( 35,255, 35 ), aStr ) );
+	Insert( new XColorEntry( Color( 35,255, 35 ), aStr ) , 64);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_YELLOW );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(65, new XColorEntry( Color(230,255,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(230,255,  0 ), aStr ) , 65);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(66, new XColorEntry( Color(255,255,153 ), aStr ) );
+	Insert( new XColorEntry( Color(255,255,153 ), aStr ) , 66);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(67, new XColorEntry( Color(255,255,102 ), aStr ) );
+	Insert( new XColorEntry( Color(255,255,102 ), aStr ) , 67);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(68, new XColorEntry( Color(230,230, 76 ), aStr ) );
+	Insert( new XColorEntry( Color(230,230, 76 ), aStr ) , 68);
 	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert(69, new XColorEntry( Color(204,204,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(204,204,  0 ), aStr ) , 69);
 	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert(70, new XColorEntry( Color(179,179,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(179,179,  0 ), aStr ) , 70);
 	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert(71, new XColorEntry( Color(128,128, 25 ), aStr ) );
+	Insert( new XColorEntry( Color(128,128, 25 ), aStr ) , 71);
 	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert(72, new XColorEntry( Color(102,102,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(102,102,  0 ), aStr ) , 72);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_BROWN );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(73, new XColorEntry( Color( 76, 25,  0 ), aStr ) );
+	Insert( new XColorEntry( Color( 76, 25,  0 ), aStr ) , 73);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(74, new XColorEntry( Color(102, 51,  0 ), aStr ) );
+	Insert( new XColorEntry( Color(102, 51,  0 ), aStr ) , 74);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(75, new XColorEntry( Color(128, 76, 25 ), aStr ) );
+	Insert( new XColorEntry( Color(128, 76, 25 ), aStr ) , 75);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(76, new XColorEntry( Color(153,102, 51 ), aStr ) );
+	Insert( new XColorEntry( Color(153,102, 51 ), aStr ) , 76);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_ORANGE );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert(77, new XColorEntry( Color(204,102, 51 ), aStr ) );
+	Insert( new XColorEntry( Color(204,102, 51 ), aStr ) , 77);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert(78, new XColorEntry( Color(255,102, 51 ), aStr ) );
+	Insert( new XColorEntry( Color(255,102, 51 ), aStr ) , 78);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert(79, new XColorEntry( Color(255,153,102 ), aStr ) );
+	Insert( new XColorEntry( Color(255,153,102 ), aStr ) , 79);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert(80, new XColorEntry( Color(255,204,153 ), aStr ) );
+	Insert( new XColorEntry( Color(255,204,153 ), aStr ) , 80);
 
 	// new chart colors
 	aStr = SVX_RESSTR( RID_SVXSTR_VIOLET );
-	Insert( 81, new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) );
+	Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) , 81);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX );
-	Insert( 82, new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) );
+	Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) , 82);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW );
-	Insert( 83, new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) );
+	Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) , 83);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN );
-	Insert( 84, new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) );
+	Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) , 84);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET );
-	Insert( 85, new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) );
+	Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) , 85);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_SALMON );
-	Insert( 86, new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) );
+	Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) , 86);
 
 	aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE );
-	Insert( 87, new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) );
+	Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) , 87);
 
 	// Sun colors
 	aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN );
 	aStr.AppendAscii(" 1");
 	nLen = aStr.Len() - 1;
-	Insert( 88, new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) );
+	Insert( new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) , 88);
 	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( 89, new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) );
+	Insert( new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) , 89);
 	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( 90, new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) );
+	Insert( new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) , 90);
 	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( 91, new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) );
+	Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) , 91);
 
     // Chart default colors
     aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART );
     aStr.AppendAscii(" 1");
     nLen = aStr.Len() - 1;
-    Insert( 92, new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) );
+    Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) , 92);
     aStr.SetChar(nLen, sal_Unicode('2'));
-    Insert( 93, new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) );
+    Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) , 93);
     aStr.SetChar(nLen, sal_Unicode('3'));
-    Insert( 94, new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) );
+    Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) , 94);
     aStr.SetChar(nLen, sal_Unicode('4'));
-    Insert( 95, new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) );
+    Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) , 95);
     aStr.SetChar(nLen, sal_Unicode('5'));
-    Insert( 96, new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) );
+    Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) , 96);
     aStr.SetChar(nLen, sal_Unicode('6'));
-    Insert( 97, new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) );
+    Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) , 97);
     aStr.SetChar(nLen, sal_Unicode('7'));
-    Insert( 98, new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) );
+    Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) , 98);
     aStr.SetChar(nLen, sal_Unicode('8'));
-    Insert( 99, new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) );
+    Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) , 99);
     aStr.SetChar(nLen, sal_Unicode('9'));
-    Insert( 100, new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) );
+    Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) , 100);
     aStr.SetChar(nLen, sal_Unicode('1'));
     aStr.AppendAscii("0");
     nLen = aStr.Len() - 1;
-    Insert( 101, new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) );
+    Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) , 101);
     aStr.SetChar(nLen, sal_Unicode('1'));
-    Insert( 102, new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) );
+    Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) , 102);
     aStr.SetChar(nLen, sal_Unicode('2'));
-    Insert( 103, new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) );
+    Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) , 103);
 
 	return( Count() == 104 );
 }
 
 /************************************************************************/
 
-sal_Bool XColorTable::CreateBitmapsForUI()
+Bitmap XColorList::CreateBitmapForUI( long /*nIndex*/ )
 {
-	return( sal_False );
+	return Bitmap();
 }
 
 /************************************************************************/
 
-Bitmap* XColorTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+XColorList* XColorList::GetStdColorList()
 {
-	return( NULL );
-}
-
-// --------------------
-// class XColorList
-// --------------------
-
-/*************************************************************************
-|*
-|* XColorList::XColorList()
-|*
-*************************************************************************/
-
-XColorList::XColorList( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyList( rPath, pInPool, nInitSize, nReSize)
-{
-	// pBmpList = new List( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XColorList::~XColorList()
-{
-}
-
-/************************************************************************/
-
-XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex )
-{
-	return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex);
-}
-
-/************************************************************************/
-
-XColorEntry* XColorList::Remove(long nIndex)
-{
-	return (XColorEntry*) XPropertyList::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XColorEntry* XColorList::GetColor(long nIndex) const
-{
-	return (XColorEntry*) XPropertyList::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XColorList::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XColorList::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XColorList::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XColorList::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
+	if ( !pStaticGlobalColorList )
+		pStaticGlobalColorList = new XColorList( SvtPathOptions().GetPalettePath() );
+	return pStaticGlobalColorList;
 }
 
 // eof
diff --git a/main/svx/source/xoutdev/xtabdash.cxx b/main/svx/source/xoutdev/xtabdash.cxx
index 6c2383b..72c70d6 100644
--- a/main/svx/source/xoutdev/xtabdash.cxx
+++ b/main/svx/source/xoutdev/xtabdash.cxx
@@ -70,86 +70,6 @@
 char const aChckDash0[] = { 0x04, 0x00, 'S','O','D','0'};	// = 5.2
 char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
-// -----------------
-// class XDashTable
-// -----------------
-
-/*************************************************************************
-|*
-|* XDashTable::XDashTable()
-|*
-*************************************************************************/
-
-XDashTable::XDashTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
-{
-	pBmpTable = new Table( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XDashTable::~XDashTable()
-{
-}
-
-/************************************************************************/
-
-XDashEntry* XDashTable::Replace(long nIndex, XDashEntry* pEntry )
-{
-	return (XDashEntry*) XPropertyTable::Replace(nIndex, pEntry);
-}
-
-/************************************************************************/
-
-XDashEntry* XDashTable::Remove(long nIndex)
-{
-	return (XDashEntry*) XPropertyTable::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XDashEntry* XDashTable::GetDash(long nIndex) const
-{
-	return (XDashEntry*) XPropertyTable::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XDashTable::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XDashTable::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XDashTable::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XDashTable::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XDashTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
-}
-
 // ----------------
 // class XDashList
 // ----------------
@@ -193,13 +113,14 @@
         VirtualDevice* pVirDev = new VirtualDevice;
 		OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
 		pVirDev->SetMapMode(MAP_100TH_MM);
-		const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT)));
+		const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight())));
 		pVirDev->SetOutputSize(aSize);
         pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
             ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
             : DRAWMODE_DEFAULT);
-    
-	    SdrModel* pSdrModel = new SdrModel();
+        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
+
+        SdrModel* pSdrModel = new SdrModel();
 		OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
 	    pSdrModel->GetItemPool().FreezeIdRanges();
 
@@ -221,8 +142,8 @@
     	pLineObject->SetModel(pSdrModel);
         pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH));
         pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
-        pLineObject->SetMergedItem(XLineWidthItem(30));
-
+		const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0)));
+        pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth()));
         mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
 		OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" );
     }
@@ -237,11 +158,13 @@
     }
 }
 
-XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-:   XPropertyList(rPath, pInPool, nInitSize, nReSize),
-    mpData(0)
+XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool )
+:   XPropertyList(rPath, pInPool ),
+    mpData(0),
+    maBitmapSolidLine(),
+    maStringSolidLine(),
+    maStringNoLine()
 {
-	pBmpList = new List(nInitSize, nReSize);
 }
 
 XDashList::~XDashList()
@@ -266,19 +189,19 @@
 
 sal_Bool XDashList::Load()
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
-		bListDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtDash, 3 ) );
@@ -291,15 +214,15 @@
 
 sal_Bool XDashList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtDash, 3 ) );
@@ -324,32 +247,21 @@
 	return( sal_True );
 }
 
-sal_Bool XDashList::CreateBitmapsForUI()
-{
-    impCreate();
-
-    for( long i = 0; i < Count(); i++)
-	{
-		Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
-		DBG_ASSERT( pBmp, "XDashList: Bitmap(UI) konnte nicht erzeugt werden!" );
-
-		if( pBmp )
-			pBmpList->Insert( pBmp, i );
-	}
-
-    impDestroy();
-
-	return( sal_True );
-}
-
-Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
 {
     impCreate();
     VirtualDevice* pVD = mpData->getVirtualDevice();
     SdrObject* pLine = mpData->getLineObject();
 
-    pLine->SetMergedItem(XLineStyleItem(XLINE_DASH));
-    pLine->SetMergedItem(XLineDashItem(String(), GetDash(nIndex)->GetDash()));
+    if(pDash)
+    {
+        pLine->SetMergedItem(XLineStyleItem(XLINE_DASH));
+        pLine->SetMergedItem(XLineDashItem(String(), *pDash));
+    }
+    else
+    {
+        pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+    }
 
     sdr::contact::SdrObjectVector aObjectVector;
 	aObjectVector.push_back(mpData->getBackgroundObject());
@@ -357,17 +269,50 @@
 	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
 	sdr::contact::DisplayInfo aDisplayInfo;
 
+    pVD->Erase();
 	aPainter.ProcessDisplay(aDisplayInfo);
 
     const Point aZero(0, 0);
-	Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
+	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
+}
 
-	if(bDelete)
-	{
-        impDestroy();
-	}
+Bitmap XDashList::CreateBitmapForUI( long nIndex )
+{
+    const XDash& rDash = GetDash(nIndex)->GetDash();
 
-	return pBitmap;
+    return ImpCreateBitmapForXDash(&rDash);
+}
+
+Bitmap XDashList::GetBitmapForUISolidLine() const
+{
+    if(maBitmapSolidLine.IsEmpty())
+    {
+        const_cast< XDashList* >(this)->maBitmapSolidLine = const_cast< XDashList* >(this)->ImpCreateBitmapForXDash(0);
+    }
+
+    return maBitmapSolidLine;
+}
+
+String XDashList::GetStringForUiSolidLine() const
+{
+    if(!maStringSolidLine.Len())
+    {
+        const_cast< XDashList* >(this)->maStringSolidLine = String(ResId(RID_SVXSTR_SOLID, DIALOG_MGR()));
+    }
+
+    return maStringSolidLine;
+}
+
+String XDashList::GetStringForUiNoLine() const
+{
+    if(!maStringNoLine.Len())
+    {
+        // formally was RID_SVXSTR_INVISIBLE, but tomake equal 
+        // everywhere, use RID_SVXSTR_NONE
+        const_cast< XDashList* >(this)->maStringNoLine = String(ResId(RID_SVXSTR_NONE, DIALOG_MGR()));
+    }
+
+    return maStringNoLine;
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/main/svx/source/xoutdev/xtabgrdt.cxx b/main/svx/source/xoutdev/xtabgrdt.cxx
index ee40523..0e3ca8e 100644
--- a/main/svx/source/xoutdev/xtabgrdt.cxx
+++ b/main/svx/source/xoutdev/xtabgrdt.cxx
@@ -67,86 +67,6 @@
 char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'};	// = 5.2
 char const aChckXML[]       = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
-// ---------------------
-// class XGradientTable
-// ---------------------
-
-/*************************************************************************
-|*
-|* XGradientTable::XGradientTable()
-|*
-*************************************************************************/
-
-XGradientTable::XGradientTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
-{
-	pBmpTable = new Table( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XGradientTable::~XGradientTable()
-{
-}
-
-/************************************************************************/
-
-XGradientEntry* XGradientTable::Replace(long nIndex, XGradientEntry* pEntry )
-{
-	return (XGradientEntry*) XPropertyTable::Replace(nIndex, pEntry);
-}
-
-/************************************************************************/
-
-XGradientEntry* XGradientTable::Remove(long nIndex)
-{
-	return (XGradientEntry*) XPropertyTable::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XGradientEntry* XGradientTable::GetGradient(long nIndex) const
-{
-	return (XGradientEntry*) XPropertyTable::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XGradientTable::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XGradientTable::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XGradientTable::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XGradientTable::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XGradientTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
-}
-
 // --------------------
 // class XGradientList
 // --------------------
@@ -186,12 +106,13 @@
         VirtualDevice* pVirDev = new VirtualDevice;
 		OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" );
 		pVirDev->SetMapMode(MAP_100TH_MM);
-		const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT)));
+		const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight())));
 		pVirDev->SetOutputSize(aSize);
         pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
             ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
             : DRAWMODE_DEFAULT);
-    
+        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
+
 	    SdrModel* pSdrModel = new SdrModel();
 		OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" );
 	    pSdrModel->GetItemPool().FreezeIdRanges();
@@ -204,7 +125,7 @@
         pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
         pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
         pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
-        pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((BITMAP_WIDTH + BITMAP_HEIGHT) / 3)));
+        pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((getUiBitmapWidth() + getUiBitmapHeight()) / 3)));
 
         mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject);
 		OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" );
@@ -220,11 +141,10 @@
     }
 }
 
-XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-:   XPropertyList(rPath, pInPool, nInitSize, nReSize),
+XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool )
+:   XPropertyList(rPath, pInPool ),
     mpData(0)
 {
-	pBmpList = new List(nInitSize, nReSize);
 }
 
 XGradientList::~XGradientList()
@@ -253,19 +173,19 @@
 
 sal_Bool XGradientList::Load()
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
-		bListDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) );
@@ -279,15 +199,15 @@
 
 sal_Bool XGradientList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) );
@@ -318,25 +238,7 @@
 	return( sal_True );
 }
 
-sal_Bool XGradientList::CreateBitmapsForUI()
-{
-    impCreate();
-
-    for( long i = 0; i < Count(); i++)
-	{
-		Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
-		DBG_ASSERT( pBmp, "XGradientList: Bitmap(UI) konnte nicht erzeugt werden!" );
-
-		if( pBmp )
-			pBmpList->Insert( pBmp, i );
-	}
-
-    impDestroy();
-
-	return( sal_False );
-}
-
-Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+Bitmap XGradientList::CreateBitmapForUI( long nIndex )
 {
     impCreate();
     VirtualDevice* pVD = mpData->getVirtualDevice();
@@ -351,17 +253,11 @@
 	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
 	sdr::contact::DisplayInfo aDisplayInfo;
 
+    pVD->Erase();
 	aPainter.ProcessDisplay(aDisplayInfo);
 
     const Point aZero(0, 0);
-	Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
-
-	if(bDelete)
-	{
-        impDestroy();
-	}
-
-	return pBitmap;
+	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/main/svx/source/xoutdev/xtabhtch.cxx b/main/svx/source/xoutdev/xtabhtch.cxx
index 30bb7e9..2f69cb1 100644
--- a/main/svx/source/xoutdev/xtabhtch.cxx
+++ b/main/svx/source/xoutdev/xtabhtch.cxx
@@ -66,86 +66,6 @@
 char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'};	// = 5.2
 char const aChckXML[]    = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
-// ------------------
-// class XHatchTable
-// ------------------
-
-/*************************************************************************
-|*
-|* XHatchTable::XHatchTable()
-|*
-*************************************************************************/
-
-XHatchTable::XHatchTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
-{
-	pBmpTable = new Table( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XHatchTable::~XHatchTable()
-{
-}
-
-/************************************************************************/
-
-XHatchEntry* XHatchTable::Replace(long nIndex, XHatchEntry* pEntry )
-{
-	return (XHatchEntry*) XPropertyTable::Replace(nIndex, pEntry);
-}
-
-/************************************************************************/
-
-XHatchEntry* XHatchTable::Remove(long nIndex)
-{
-	return (XHatchEntry*) XPropertyTable::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XHatchEntry* XHatchTable::GetHatch(long nIndex) const
-{
-	return (XHatchEntry*) XPropertyTable::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XHatchTable::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XHatchTable::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XHatchTable::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XHatchTable::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XHatchTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
-}
-
 // -----------------
 // class XHatchList
 // -----------------
@@ -189,13 +109,14 @@
         VirtualDevice* pVirDev = new VirtualDevice;
 		OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
 		pVirDev->SetMapMode(MAP_100TH_MM);
-		const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT)));
+		const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight())));
 		pVirDev->SetOutputSize(aSize);
         pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
             ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
             : DRAWMODE_DEFAULT);
-    
-	    SdrModel* pSdrModel = new SdrModel();
+        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
+
+        SdrModel* pSdrModel = new SdrModel();
 		OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
 	    pSdrModel->GetItemPool().FreezeIdRanges();
 
@@ -229,11 +150,10 @@
     }
 }
 
-XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-:   XPropertyList(rPath, pInPool, nInitSize, nReSize),
+XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool)
+:   XPropertyList(rPath, pInPool),
     mpData(0)
 {
-	pBmpList = new List(nInitSize, nReSize);
 }
 
 XHatchList::~XHatchList()
@@ -262,19 +182,19 @@
 
 sal_Bool XHatchList::Load()
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
-		bListDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) );
@@ -287,15 +207,15 @@
 
 sal_Bool XHatchList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) );
@@ -320,25 +240,7 @@
 	return( sal_True );
 }
 
-sal_Bool XHatchList::CreateBitmapsForUI()
-{
-    impCreate();
-
-    for( long i = 0; i < Count(); i++)
-	{
-		Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
-		DBG_ASSERT( pBmp, "XHatchList: Bitmap(UI) konnte nicht erzeugt werden!" );
-
-		if( pBmp )
-			pBmpList->Insert( pBmp, i );
-	}
-
-    impDestroy();
-
-	return( sal_True );
-}
-
-Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+Bitmap XHatchList::CreateBitmapForUI( long nIndex )
 {
     impCreate();
     VirtualDevice* pVD = mpData->getVirtualDevice();
@@ -353,17 +255,11 @@
 	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
 	sdr::contact::DisplayInfo aDisplayInfo;
 
+    pVD->Erase();
 	aPainter.ProcessDisplay(aDisplayInfo);
 
     const Point aZero(0, 0);
-	Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
-
-	if(bDelete)
-	{
-        impDestroy();
-	}
-
-	return pBitmap;
+	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/main/svx/source/xoutdev/xtable.cxx b/main/svx/source/xoutdev/xtable.cxx
index 661a579..2a44d62 100644
--- a/main/svx/source/xoutdev/xtable.cxx
+++ b/main/svx/source/xoutdev/xtable.cxx
@@ -26,6 +26,8 @@
 
 #include <svx/xtable.hxx>
 #include <svx/xpool.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
 
 #define GLOBALOVERFLOW
 
@@ -41,311 +43,36 @@
 	return aRGBColor;
 }
 
-// ---------------------
-// class XPropertyTable
-// ---------------------
-
-/*************************************************************************
-|*
-|* XPropertyTable::XPropertyTable()
-|*
-*************************************************************************/
-
-XPropertyTable::XPropertyTable( const String& rPath,
-								XOutdevItemPool* pInPool,
-								sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-			aName			( pszStandard, 8 ),
-			aPath			( rPath ),
-			pXPool			( pInPool ),
-			aTable			( nInitSize, nReSize ),
-			pBmpTable		( NULL ),
-			bTableDirty		( sal_True ),
-			bBitmapsDirty	( sal_True ),
-			bOwnPool		( sal_False )
-{
-	if( !pXPool )
-	{
-		bOwnPool = sal_True;
-		pXPool = new XOutdevItemPool;
-		DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" );
-	}
-}
-
-/*************************************************************************
-|*
-|* XPropertyTable::XPropertyTable( SvStraem& )
-|*
-*************************************************************************/
-
-XPropertyTable::XPropertyTable( SvStream& /*rIn*/) :
-			pBmpTable	( NULL )
-{
-}
-
-/*************************************************************************
-|*
-|* XPropertyTable::~XPropertyTable()
-|*
-*************************************************************************/
-
-XPropertyTable::~XPropertyTable()
-{
-	XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First();
-	Bitmap* pBitmap = NULL;
-	for (sal_uIntPtr nIndex = 0; nIndex < aTable.Count(); nIndex++)
-	{
-		delete pEntry;
-		pEntry = (XPropertyEntry*)aTable.Next();
-	}
-	// Hier wird die Bitmaptabelle geloescht
-	if( pBmpTable )
-	{
-		pBitmap = (Bitmap*) pBmpTable->First();
-
-		for( sal_uIntPtr nIndex = 0; nIndex < pBmpTable->Count(); nIndex++ )
-		{
-			delete pBitmap;
-			pBitmap = (Bitmap*) pBmpTable->Next();
-		}
-		delete pBmpTable;
-		pBmpTable = NULL;
-	}
-	// Eigener Pool wird geloescht
-	if( bOwnPool && pXPool )
-	{
-        SfxItemPool::Free(pXPool);
-	}
-}
-
-/*************************************************************************
-|*
-|* XPropertyTable::Clear()
-|*
-*************************************************************************/
-
-void XPropertyTable::Clear()
-{
-	aTable.Clear();
-	if( pBmpTable )
-		pBmpTable->Clear();
-}
-
-/************************************************************************/
-
-long XPropertyTable::Count() const
-{
-	if( bTableDirty )
-	{
-		// ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load()
-		if( !( (XPropertyTable*) this )->Load() )
-			( (XPropertyTable*) this )->Create();
-	}
-	return( aTable.Count() );
-}
-
-/*************************************************************************
-|*
-|* XPropertyEntry* XPropertyTable::Get()
-|*
-*************************************************************************/
-
-XPropertyEntry* XPropertyTable::Get( long nIndex, sal_uInt16 /*nDummy*/) const
-{
-	if( bTableDirty )
-	{
-		// ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load()
-		if( !( (XPropertyTable*) this )->Load() )
-			( (XPropertyTable*) this )->Create();
-	}
-	return (XPropertyEntry*) aTable.GetObject( (sal_uIntPtr) nIndex );
-}
-
-/*************************************************************************
-|*
-|* long XPropertyTable::Get(const String& rName)
-|*
-*************************************************************************/
-
-long XPropertyTable::Get(const XubString& rName)
-{
-	if( bTableDirty )
-	{
-		// bTableDirty = sal_False;
-		if( !Load() )
-			Create();
-	}
-	long nPos = 0;
-	XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First();
-	while (pEntry && pEntry->GetName() != rName)
-	{
-		nPos++;
-		pEntry = (XPropertyEntry*)aTable.Next();
-	}
-	if (!pEntry) nPos = -1;
-	return nPos;
-}
-
-/*************************************************************************
-|*
-|* Bitmap* XPropertyTable::GetBitmap()
-|*
-*************************************************************************/
-
-Bitmap* XPropertyTable::GetBitmap( long nIndex ) const
-{
-	if( pBmpTable )
-	{
-		if( bBitmapsDirty )
-		{
-			( (XPropertyTable*) this )->bBitmapsDirty = sal_False;
-			( (XPropertyTable*) this )->CreateBitmapsForUI();
-		}
-
-		if( pBmpTable->Count() >= (sal_uIntPtr) nIndex )
-			return (Bitmap*) pBmpTable->GetObject( (sal_uIntPtr) nIndex );
-	}
-	return( NULL );
-}
-
-/*************************************************************************
-|*
-|* void XPropertyTable::Insert()
-|*
-*************************************************************************/
-
-sal_Bool XPropertyTable::Insert( long nIndex, XPropertyEntry* pEntry )
-{
-	sal_Bool bReturn = aTable.Insert( (sal_uIntPtr) nIndex, pEntry );
-
-	if( pBmpTable && !bBitmapsDirty )
-	{
-		Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
-		pBmpTable->Insert( (sal_uIntPtr) nIndex, pBmp );
-	}
-	return bReturn;
-}
-
-/*************************************************************************
-|*
-|* void XPropertyTable::Replace()
-|*
-*************************************************************************/
-
-XPropertyEntry* XPropertyTable::Replace( long nIndex, XPropertyEntry* pEntry )
-{
-	XPropertyEntry* pOldEntry = (XPropertyEntry*) aTable.Replace( (sal_uIntPtr) nIndex, pEntry );
-
-	if( pBmpTable && !bBitmapsDirty )
-	{
-		Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
-		Bitmap* pOldBmp = (Bitmap*) pBmpTable->Replace( (sal_uIntPtr) nIndex, pBmp );
-		if( pOldBmp )
-			delete pOldBmp;
-	}
-	return pOldEntry;
-}
-
-/*************************************************************************
-|*
-|* void XPropertyTable::Remove()
-|*
-*************************************************************************/
-
-XPropertyEntry* XPropertyTable::Remove( long nIndex, sal_uInt16 /*nDummy*/)
-{
-	if( pBmpTable && !bBitmapsDirty )
-	{
-		Bitmap* pOldBmp = (Bitmap*) pBmpTable->Remove( (sal_uIntPtr) nIndex );
-		if( pOldBmp )
-			delete pOldBmp;
-	}
-	return (XPropertyEntry*) aTable.Remove((sal_uIntPtr)nIndex);
-}
-
-/************************************************************************/
-
-void XPropertyTable::SetName( const String& rString )
-{
-	if(rString.Len())
-	{
-		aName = rString;
-	}
-}
-
 // --------------------
 // class XPropertyList
 // --------------------
 
-
-/*************************************************************************
-|*
-|* XPropertyList::XPropertyList()
-|*
-*************************************************************************/
-
-XPropertyList::XPropertyList( const String& rPath,
-								XOutdevItemPool* pInPool,
-								sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-			aName			( pszStandard, 8 ),
-			aPath			( rPath ),
-			pXPool			( pInPool ),
-			aList			( nInitSize, nReSize ),
-			pBmpList		( NULL ),
-			bListDirty		( sal_True ),
-			bBitmapsDirty	( sal_True ),
-			bOwnPool		( sal_False )
+XPropertyList::XPropertyList( const String& rPath, XOutdevItemPool* pInPool ) :
+			maName			( pszStandard, 8 ),
+			maPath			( rPath ),
+			mpXPool			( pInPool ),
+			maList			( 16, 16 ),
+			mbListDirty		(true)
 {
-	if( !pXPool )
+	if( !mpXPool )
 	{
-		bOwnPool = sal_True;
-		pXPool = new XOutdevItemPool;
-		DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" );
+		mpXPool = static_cast< XOutdevItemPool* >(&SdrObject::GetGlobalDrawObjectItemPool());
 	}
 }
 
 /*************************************************************************
 |*
-|* XPropertyList::XPropertyList( SvStraem& )
-|*
-*************************************************************************/
-
-XPropertyList::XPropertyList( SvStream& /*rIn*/) :
-			pBmpList	( NULL )
-{
-}
-
-/*************************************************************************
-|*
 |* XPropertyList::~XPropertyList()
 |*
 *************************************************************************/
 
 XPropertyList::~XPropertyList()
 {
-	XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
-	Bitmap* pBitmap = NULL;
-	for( sal_uIntPtr nIndex = 0; nIndex < aList.Count(); nIndex++ )
+	XPropertyEntry* pEntry = (XPropertyEntry*)maList.First();
+	for( sal_uIntPtr nIndex = 0; nIndex < maList.Count(); nIndex++ )
 	{
 		delete pEntry;
-		pEntry = (XPropertyEntry*)aList.Next();
-	}
-
-	if( pBmpList )
-	{
-		pBitmap = (Bitmap*) pBmpList->First();
-
-		for( sal_uIntPtr nIndex = 0; nIndex < pBmpList->Count(); nIndex++ )
-		{
-			delete pBitmap;
-			pBitmap = (Bitmap*) pBmpList->Next();
-		}
-		delete pBmpList;
-		pBmpList = NULL;
-	}
-
-	if( bOwnPool && pXPool )
-	{
-        SfxItemPool::Free(pXPool);
+		pEntry = (XPropertyEntry*)maList.Next();
 	}
 }
 
@@ -357,22 +84,20 @@
 
 void XPropertyList::Clear()
 {
-	aList.Clear();
-	if( pBmpList )
-		pBmpList->Clear();
+	maList.Clear();
 }
 
 /************************************************************************/
 
 long XPropertyList::Count() const
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
 		// ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
 		if( !( (XPropertyList*) this )->Load() )
 			( (XPropertyList*) this )->Create();
 	}
-	return( aList.Count() );
+	return( maList.Count() );
 }
 
 /*************************************************************************
@@ -383,13 +108,13 @@
 
 XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
 		// ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
 		if( !( (XPropertyList*) this )->Load() )
 			( (XPropertyList*) this )->Create();
 	}
-	return (XPropertyEntry*) aList.GetObject( (sal_uIntPtr) nIndex );
+	return (XPropertyEntry*) maList.GetObject( (sal_uIntPtr) nIndex );
 }
 
 /*************************************************************************
@@ -400,18 +125,18 @@
 
 long XPropertyList::Get(const XubString& rName)
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
 		//bListDirty = sal_False;
 		if( !Load() )
 			Create();
 	}
 	long nPos = 0;
-	XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
+	XPropertyEntry* pEntry = (XPropertyEntry*)maList.First();
 	while (pEntry && pEntry->GetName() != rName)
 	{
 		nPos++;
-		pEntry = (XPropertyEntry*)aList.Next();
+		pEntry = (XPropertyEntry*)maList.Next();
 	}
 	if (!pEntry) nPos = -1;
 	return nPos;
@@ -423,19 +148,23 @@
 |*
 *************************************************************************/
 
-Bitmap* XPropertyList::GetBitmap( long nIndex ) const
+Bitmap XPropertyList::GetUiBitmap( long nIndex ) const
 {
-	if( pBmpList )
-	{
-		if( bBitmapsDirty )
-		{
-			( (XPropertyList*) this )->bBitmapsDirty = sal_False;
-			( (XPropertyList*) this )->CreateBitmapsForUI();
-		}
-		if( pBmpList->Count() >= (sal_uIntPtr) nIndex )
-			return (Bitmap*) pBmpList->GetObject( (sal_uIntPtr) nIndex );
-	}
-	return( NULL );
+    Bitmap aRetval;
+    XPropertyEntry* pEntry = (XPropertyEntry*)maList.GetObject((sal_uIntPtr)nIndex);
+
+    if(pEntry)
+    {
+        aRetval = pEntry->GetUiBitmap();
+
+        if(aRetval.IsEmpty())
+        {
+            aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex);
+            pEntry->SetUiBitmap(aRetval);
+        }
+    }
+
+	return aRetval;
 }
 
 /*************************************************************************
@@ -446,14 +175,7 @@
 
 void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
 {
-	aList.Insert( pEntry, (sal_uIntPtr) nIndex );
-
-	if( pBmpList && !bBitmapsDirty )
-	{
-		Bitmap* pBmp = CreateBitmapForUI(
-				(sal_uIntPtr) nIndex < aList.Count() ? nIndex : aList.Count() - 1 );
-		pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex );
-	}
+	maList.Insert( pEntry, (sal_uIntPtr) nIndex );
 }
 
 /*************************************************************************
@@ -464,16 +186,7 @@
 
 XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
 {
-	XPropertyEntry* pOldEntry = (XPropertyEntry*) aList.Replace( pEntry, (sal_uIntPtr) nIndex );
-
-	if( pBmpList && !bBitmapsDirty )
-	{
-		Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
-		Bitmap* pOldBmp = (Bitmap*) pBmpList->Replace( pBmp, (sal_uIntPtr) nIndex );
-		if( pOldBmp )
-			delete pOldBmp;
-	}
-	return pOldEntry;
+	return  (XPropertyEntry*) maList.Replace( pEntry, (sal_uIntPtr) nIndex );
 }
 
 /*************************************************************************
@@ -484,13 +197,7 @@
 
 XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/)
 {
-	if( pBmpList && !bBitmapsDirty )
-	{
-		Bitmap* pOldBmp = (Bitmap*) pBmpList->Remove( (sal_uIntPtr) nIndex );
-		if( pOldBmp )
-			delete pOldBmp;
-	}
-	return (XPropertyEntry*) aList.Remove( (sal_uIntPtr) nIndex );
+	return (XPropertyEntry*) maList.Remove( (sal_uIntPtr) nIndex );
 }
 
 /************************************************************************/
@@ -499,9 +206,29 @@
 {
 	if(rString.Len())
 	{
-		aName = rString;
+		maName = rString;
 	}
 }
 
+sal_uInt32 XPropertyList::getUiBitmapWidth() const
+{
+    static sal_uInt32 nWidth = 32; // alternative: 42;
 
+    return nWidth;
+}
 
+sal_uInt32 XPropertyList::getUiBitmapHeight() const
+{
+    static sal_uInt32 nHeight = 12; // alternative: 16;
+
+    return nHeight;
+}
+
+sal_uInt32 XPropertyList::getUiBitmapLineWidth() const
+{
+    static sal_uInt32 nLineWidth = 3;
+
+    return nLineWidth;
+}
+
+// eof
diff --git a/main/svx/source/xoutdev/xtablend.cxx b/main/svx/source/xoutdev/xtablend.cxx
index 32da25b..bf879ce 100644
--- a/main/svx/source/xoutdev/xtablend.cxx
+++ b/main/svx/source/xoutdev/xtablend.cxx
@@ -67,6 +67,7 @@
 #include <svx/svdmodel.hxx>
 #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
 #include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/xlnwtit.hxx>
 
 #define GLOBALOVERFLOW
 
@@ -74,90 +75,9 @@
 using namespace rtl;
 
 sal_Unicode const pszExtLineEnd[]	= {'s','o','e'};
-
-static char const aChckLEnd[]  = { 0x04, 0x00, 'S','O','E','L'};	// < 5.2
-static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'};	// = 5.2
-static char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };		// = 6.0
-
-// --------------------
-// class XLineEndTable
-// --------------------
-
-/*************************************************************************
-|*
-|* XLineEndTable::XLineEndTable()
-|*
-*************************************************************************/
-
-XLineEndTable::XLineEndTable( const String& rPath,
-							XOutdevItemPool* pInPool,
-							sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
-				XPropertyTable( rPath, pInPool, nInitSize, nReSize)
-{
-	pBmpTable = new Table( nInitSize, nReSize );
-}
-
-/************************************************************************/
-
-XLineEndTable::~XLineEndTable()
-{
-}
-
-/************************************************************************/
-
-XLineEndEntry* XLineEndTable::Replace(long nIndex, XLineEndEntry* pEntry )
-{
-	return (XLineEndEntry*) XPropertyTable::Replace(nIndex, pEntry);
-}
-
-/************************************************************************/
-
-XLineEndEntry* XLineEndTable::Remove(long nIndex)
-{
-	return (XLineEndEntry*) XPropertyTable::Remove(nIndex, 0);
-}
-
-/************************************************************************/
-
-XLineEndEntry* XLineEndTable::GetLineEnd(long nIndex) const
-{
-	return (XLineEndEntry*) XPropertyTable::Get(nIndex, 0);
-}
-
-/************************************************************************/
-
-sal_Bool XLineEndTable::Load()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XLineEndTable::Save()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-sal_Bool XLineEndTable::Create()
-{
-	return( sal_False );
-}
-
-/************************************************************************/
-
-Bitmap* XLineEndTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
-{
-	return( NULL );
-}
-
-/************************************************************************/
-
-sal_Bool XLineEndTable::CreateBitmapsForUI()
-{
-	return( sal_False );
-}
+//static char const aChckLEnd[]  = { 0x04, 0x00, 'S','O','E','L'};	// < 5.2
+//static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'};	// = 5.2
+//static char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
 // --------------------
 // class XLineEndList
@@ -202,12 +122,13 @@
         VirtualDevice* pVirDev = new VirtualDevice;
 		OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" );
 		pVirDev->SetMapMode(MAP_100TH_MM);
-		const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT)));
+		const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight())));
 		pVirDev->SetOutputSize(aSize);
         pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
             ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
             : DRAWMODE_DEFAULT);
-    
+        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
+
 	    SdrModel* pSdrModel = new SdrModel();
 		OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" );
 	    pSdrModel->GetItemPool().FreezeIdRanges();
@@ -228,8 +149,11 @@
 	    SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
 		OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" );
     	pLineObject->SetModel(pSdrModel);
-        pLineObject->SetMergedItem(XLineStartWidthItem(aSize.Height()));
-        pLineObject->SetMergedItem(XLineEndWidthItem(aSize.Height()));
+		const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0)));
+        pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth()));
+        const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10);
+        pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight));
+        pLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight));
         pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
 
         mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
@@ -246,11 +170,10 @@
     }
 }
 
-XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
-:	XPropertyList(rPath, _pXPool, nInitSize, nReSize),
+XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool)
+:	XPropertyList(rPath, _pXPool),
 	mpData(0)
 {
-	pBmpList = new List(nInitSize, nReSize);
 }
 
 XLineEndList::~XLineEndList()
@@ -275,19 +198,19 @@
 
 sal_Bool XLineEndList::Load()
 {
-	if( bListDirty )
+	if( mbListDirty )
 	{
-		bListDirty = sal_False;
+		mbListDirty = false;
 
-		INetURLObject aURL( aPath );
+		INetURLObject aURL( maPath );
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !aPath.Len(), "invalid URL" );
+			DBG_ASSERT( !maPath.Len(), "invalid URL" );
 			return sal_False;
 		}
 
-		aURL.Append( aName );
+		aURL.Append( maName );
 
 		if( !aURL.getExtension().getLength() )
 			aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
@@ -300,15 +223,15 @@
 
 sal_Bool XLineEndList::Save()
 {
-	INetURLObject aURL( aPath );
+	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !aPath.Len(), "invalid URL" );
+		DBG_ASSERT( !maPath.Len(), "invalid URL" );
 		return sal_False;
 	}
 
-	aURL.Append( aName );
+	aURL.Append( maName );
 
 	if( !aURL.getExtension().getLength() )
 		aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
@@ -340,25 +263,7 @@
 	return( sal_True );
 }
 
-sal_Bool XLineEndList::CreateBitmapsForUI()
-{
-    impCreate();
-
-    for( long i = 0; i < Count(); i++)
-	{
-		Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
-		OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" );
-
-		if( pBmp )
-			pBmpList->Insert( pBmp, i );
-	}
-
-    impDestroy();
-
-	return( sal_True );
-}
-
-Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
 {
     impCreate();
     VirtualDevice* pVD = mpData->getVirtualDevice();
@@ -374,17 +279,11 @@
 	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
 	sdr::contact::DisplayInfo aDisplayInfo;
 
+    pVD->Erase();
 	aPainter.ProcessDisplay(aDisplayInfo);
 
     const Point aZero(0, 0);
-	Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
-
-	if(bDelete)
-	{
-        impDestroy();
-	}
-
-	return pBitmap;
+	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/main/svx/util/svx.component b/main/svx/util/svx.component
index e5c516a..a22f0d7 100644
--- a/main/svx/util/svx.component
+++ b/main/svx/util/svx.component
@@ -69,4 +69,7 @@
   <implementation name="com.sun.star.svx.UpSearchToolboxController">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
+  <implementation name="org.apache.openoffice.comp.svx.sidebar.PanelFactory">
+    <service name="com.sun.star.ui.UIElementFactory"/>
+  </implementation>
 </component>
diff --git a/main/sw/AllLangResTarget_sw.mk b/main/sw/AllLangResTarget_sw.mk
index 0d157d4..3ffaa98 100644
--- a/main/sw/AllLangResTarget_sw.mk
+++ b/main/sw/AllLangResTarget_sw.mk
@@ -156,6 +156,8 @@
 	sw/source/ui/ribbar/tbxanchr.src \
 	sw/source/ui/ribbar/workctrl.src \
 	sw/source/ui/shells/shells.src \
+	sw/source/ui/sidebar/PagePropertyPanel.src \
+	sw/source/ui/sidebar/WrapPropertyPanel.src \
 	sw/source/ui/smartmenu/stmenu.src \
 	sw/source/ui/table/chartins.src \
 	sw/source/ui/table/colwd.src \
diff --git a/main/sw/Library_sw.mk b/main/sw/Library_sw.mk
index d3d42f6..9f8358f 100644
--- a/main/sw/Library_sw.mk
+++ b/main/sw/Library_sw.mk
@@ -646,6 +646,13 @@
 	sw/source/ui/shells/txtattr \
 	sw/source/ui/shells/txtcrsr \
 	sw/source/ui/shells/txtnum \
+	sw/source/ui/sidebar/PageOrientationControl \
+	sw/source/ui/sidebar/PageMarginControl \
+	sw/source/ui/sidebar/PageSizeControl \
+	sw/source/ui/sidebar/PageColumnControl \
+	sw/source/ui/sidebar/PagePropertyPanel \
+	sw/source/ui/sidebar/WrapPropertyPanel \
+	sw/source/ui/sidebar/SwPanelFactory \
 	sw/source/ui/smartmenu/stmenu \
 	sw/source/ui/table/chartins \
 	sw/source/ui/table/swtablerep \
diff --git a/main/sw/inc/SwPanelFactory.hxx b/main/sw/inc/SwPanelFactory.hxx
new file mode 100644
index 0000000..fb5ca89
--- /dev/null
+++ b/main/sw/inc/SwPanelFactory.hxx
@@ -0,0 +1,74 @@
+/**************************************************************
+ * 
+ * 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 SW_SIDEBAR_PANEL_FACTORY_HXX
+#define SW_SIDEBAR_PANEL_FACTORY_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+
+#include <boost/noncopyable.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+
+namespace sw { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::ui::XUIElementFactory
+        > PanelFactoryInterfaceBase;
+}
+
+
+class SwPanelFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public PanelFactoryInterfaceBase
+{
+public:
+    static ::rtl::OUString SAL_CALL getImplementationName(void);
+    static cssu::Reference<cssu::XInterface> SAL_CALL createInstance(
+        const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+    static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames(void);
+
+    SwPanelFactory(void);
+    virtual ~SwPanelFactory(void);
+
+    // XUIElementFactory
+    cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement(
+        const ::rtl::OUString& rsResourceURL,
+        const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            cssu::RuntimeException );
+};
+
+
+} } // end of namespace sw::sidebar
+
+#endif
diff --git a/main/sw/inc/cmdid.h b/main/sw/inc/cmdid.h
index e7d70d8..f3fb3ee 100644
--- a/main/sw/inc/cmdid.h
+++ b/main/sw/inc/cmdid.h
@@ -64,6 +64,7 @@
 #define FN_EXTRA2		        (SID_SW_START + 2200)
 #define FN_PARAM2				(SID_SW_START + 2400)
 #define FN_NOTES				(SID_SW_START + 2500)
+#define FN_SIDEBAR              (SID_SW_START + 2550)
 
  /* More accurately, this range should be from FN_EXTRA2 to FN_PARAM2-1, but
  * FN_NUMBER_NEWSTART comes from FN_FORMAT2, and FN_PARAM_LINK_DISPLAY_NAME
@@ -480,7 +481,7 @@
 #define FN_SET_WIDOW			(FN_FORMAT + 36) /* Widows */
 #define FN_SET_ORPHAN			(FN_FORMAT + 37) /* Orphans */
 
-
+#define FN_FORMAT_PAGE_SETTING_DLG	(FN_FORMAT + 42)  /*  */
 #define FN_REGISTER_COLLECTION	(FN_FORMAT + 43)  /* Referenzvorlage an der Seite */
 #define FN_REGISTER_MODE		(FN_FORMAT + 44)  /* Registermodus an/aus */
 #define FN_NUM_FORMAT_TABLE_DLG 	(FN_FORMAT + 45)  /* Zahlenformat in Tabelle */
@@ -638,10 +639,9 @@
 
 #define FN_FRAME_WRAP_CONTOUR		(FN_FORMAT + 184)  /* Rahmen Kunturumlauf */
 
-#define FN_TABLE_VERT_NONE			(FN_FORMAT + 185)  /* vertikale Ausrichtung in Tabellenzellen */
-#define FN_TABLE_VERT_CENTER		(FN_FORMAT + 186)  /*  	-"-  */
-#define FN_TABLE_VERT_BOTTOM		(FN_FORMAT + 187)  /*  -"-  */
-#define FN_TABLE_SET_VERT_ALIGN		(FN_FORMAT + 188)  /*  -"-  */
+// +185..+187 removed in favor of corresponding globally available slot
+
+#define FN_TABLE_SET_VERT_ALIGN		(FN_FORMAT + 188)  /* vertical alignment in Writer table cells */
 #define FN_TABLE_MODE_FIX           (FN_FORMAT + 189)  /* Tabellenmodus */
 #define FN_TABLE_MODE_FIX_PROP      (FN_FORMAT + 190)  /*  -"-  */
 #define FN_TABLE_MODE_VARIABLE		(FN_FORMAT + 191)  /*  -"-  */
@@ -1258,10 +1258,13 @@
 #define FN_IID_COLRIGHT                 (FN_FRAME + 17)
 
 #define FN_SET_FRM_ALT_NAME             (FN_FRAME + 18)
-// --> OD 2009-07-13 #i73249#
 #define FN_UNO_TITLE                    (FN_FRAME + 19)
 #define FN_UNO_DESCRIPTION              (FN_FRAME + 20)
-// <--
+
+#define FN_PROPERTY_WRAP_DLG            (FN_SIDEBAR + 0)
+#define SID_ATTR_PAGE_COLUMN            (FN_SIDEBAR + 1)
+#define SID_ATTR_PAGE_ULSPACE           (FN_SIDEBAR + 2)
+#define SID_ATTR_PAGE_LRSPACE           (FN_SIDEBAR + 3)
 
 
 //Member-Ids fuer Fill/SetVariable an Items
diff --git a/main/sw/inc/docsh.hxx b/main/sw/inc/docsh.hxx
index 01738ff..7a0cd41 100644
--- a/main/sw/inc/docsh.hxx
+++ b/main/sw/inc/docsh.hxx
@@ -104,12 +104,21 @@
 	// OLE-Geraffel
 	SW_DLLPRIVATE virtual void			Draw( OutputDevice*, const JobSetup&, sal_uInt16);
 
-	// Methoden fuer StyleSheets
-	SW_DLLPRIVATE sal_uInt16					Edit( const String &rName, const String& rParent, sal_uInt16 nFamily,
-									sal_uInt16 nMask, sal_Bool bNew,
-									sal_Bool bColumn = sal_False,
-									SwWrtShell* pActShell = 0,
-									sal_Bool bBasic = sal_False );
+    // Methoden fuer StyleSheets
+
+    // @param nSlot
+    // Only used for nFamily == SFX_STYLE_FAMILY_PAGE. Identifies optional Slot by which the edit is triggered.
+    // Used to activate certain dialog pane
+    SW_DLLPRIVATE sal_uInt16 Edit(
+        const String &rName,
+        const String& rParent,
+        const sal_uInt16 nFamily,
+        sal_uInt16 nMask,
+        const sal_Bool bNew,
+        const sal_uInt16 nSlot = 0,
+        SwWrtShell* pActShell = 0,
+        const sal_Bool bBasic = sal_False );
+
 	SW_DLLPRIVATE sal_uInt16					Delete(const String &rName, sal_uInt16 nFamily);
 	SW_DLLPRIVATE sal_uInt16					ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
 										sal_uInt16 nMode = 0 );
@@ -245,10 +254,13 @@
 
     void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument );
 
-	// Seitenvorlagedialog anzeigen, ggf. auf Spaltenpage
-	void FormatPage( const String& rPage,
-						sal_Bool bColumn = sal_False,
-						SwWrtShell* 	pActShell = 0 );
+    // Show page style format dialog
+    // @param nSlot
+    // Identifies slot by which the dialog is triggered. Used to activate certain dialog pane
+    void FormatPage(
+        const String& rPage,
+        const sal_uInt16 nSlot,
+        SwWrtShell& rActShell );
 
     // --> OD 2006-11-07 #i59688#
     // linked graphics are now loaded on demand.
diff --git a/main/sw/inc/editsh.hxx b/main/sw/inc/editsh.hxx
index 33ce7bd..1a9ffc3 100644
--- a/main/sw/inc/editsh.hxx
+++ b/main/sw/inc/editsh.hxx
@@ -496,6 +496,9 @@
     sal_Bool HasBullet() const;
     // <- i29560
 
+    sal_Bool SelectionHasNumber() const;
+    sal_Bool SelectionHasBullet() const;
+
 	String GetUniqueNumRuleName( const String* pChkStr = 0, sal_Bool bAutoNum = sal_True ) const;
 	void ChgNumRuleFmts( const SwNumRule& rRule );
 	// setze und erfrage, ob an aktueller PointPos eine Numerierung mit
diff --git a/main/sw/inc/helpid.h b/main/sw/inc/helpid.h
index b3738c3..1d26695 100644
--- a/main/sw/inc/helpid.h
+++ b/main/sw/inc/helpid.h
@@ -305,6 +305,14 @@
 #define HID_OPTCOMPATIBILITY_PAGE                               "SW_HID_OPTCOMPATIBILITY_PAGE"
 #define HID_COMPATIBILITY_OPTIONS_BOX                           "SW_HID_COMPATIBILITY_OPTIONS_BOX"
 
+#define HID_PROPERTYPANEL_WRAP_SECTION          "SW_HID_PROPERTYPANEL_WRAP_SECTION"
+#define HID_PROPERTYPANEL_WRAP_RB_NO_WRAP       "SW_HID_PROPERTYPANEL_WRAP_RB_NO_WRAP"
+#define HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT     "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT"
+#define HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT    "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT"
+#define HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL"
+#define HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH  "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH"
+#define HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL    "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL"
+
 // AutoPilot Help-IDs *********************************************************
 
 #define HID_LETTER_PAGE1                                        "SW_HID_LETTER_PAGE1"
@@ -343,6 +351,27 @@
 #define HID_AUTOPILOT_PREV                                      "SW_HID_AUTOPILOT_PREV"
 #define HID_AUTOPILOT_OK                                        "SW_HID_AUTOPILOT_OK"
 
+// sw::sidebar::PagePropertyPanel
+#define HID_SWPAGE_ORIENTATION              "HID_SWPAGE_ORIENTATION"
+#define HID_SWPAGE_TBI_ORIENTATION          "HID_SWPAGE_TBI_ORIENTATION"
+#define HID_SWPAGE_MARGIN                   "HID_SWPAGE_MARGIN"
+#define HID_SWPAGE_TBI_MARGIN               "HID_SWPAGE_TBI_MARGIN"
+#define HID_SWPAGE_SIZE                     "HID_SWPAGE_SIZE"
+#define HID_SWPAGE_TBI_SIZE                 "HID_SWPAGE_TBI_SIZE"
+#define HID_SWPAGE_COLUMN                   "HID_SWPAGE_COLUMN"
+#define HID_SWPAGE_TBI_COLUMN               "HID_SWPAGE_TBI_COLUMN"
+#define HID_SWPAGE_LEFT_MARGIN              "HID_SWPAGE_LEFT_MARGIN"
+#define HID_SWPAGE_RIGHT_MARGIN             "HID_SWPAGE_RIGHT_MARGIN"
+#define HID_SWPAGE_TOP_MARGIN               "HID_SWPAGE_TOP_MARGIN"
+#define HID_SWPAGE_BOTTOM_MARGIN            "HID_SWPAGE_BOTTOM_MARGIN"
+#define HID_SWPAGE_SIZE_MORE                "HID_SWPAGE_SIZE_MORE"
+#define HID_SWPAGE_COLUMN_MORE              "HID_SWPAGE_COLUMN_MORE"
+#define HID_SWPAGE_VS_ORIENTATION           "HID_SWPAGE_VS_ORIENTATION"
+#define HID_SWPAGE_VS_MARGIN                "HID_SWPAGE_VS_MARGIN"
+#define HID_SWPAGE_VS_SIZE                  "HID_SWPAGE_VS_SIZE"
+#define HID_SWPAGE_VS_COLUMN                "HID_SWPAGE_VS_COLUMN"
+#define HID_PROPERTYPANEL_SWPAGE_SECTION    "HID_PROPERTYPANEL_SWPAGE_SECTION"
+
 // HelpIds fuers Menue *****************************************************
 
 #define HID_MN_SUB_TBLROW                                       "SW_HID_MN_SUB_TBLROW"
diff --git a/main/sw/inc/rcid.hrc b/main/sw/inc/rcid.hrc
index b772fef..75b5a26 100644
--- a/main/sw/inc/rcid.hrc
+++ b/main/sw/inc/rcid.hrc
@@ -74,6 +74,7 @@
 #define RC_UNDO                     (RC_BASE + 3750)
 #define RC_SMARTTAG                    (RC_BASE + 3950)  // SMARTTAGS
 #define RC_UNOCORE                  (RC_BASE + 4050)
+#define RC_PROPERTYPANEL			(RC_BASE + 4070)
 #define RC_ANNOTATION               (RC_BASE + 4150)
 
 /*--------------------------------------------------------------------
@@ -264,4 +265,7 @@
 #define RC_UNOCORE_BEGIN            RC_UNOCORE
 #define RC_UNOCORE_END              (RC_UNOCORE + 10)
 
+// property panel
+#define RC_PROPERTYPANEL_BEGIN            RC_PROPERTYPANEL
+#define RC_PROPERTYPANEL_END              (RC_PROPERTYPANEL + 10)
 #endif
diff --git a/main/sw/inc/swabstdlg.hxx b/main/sw/inc/swabstdlg.hxx
index dd6cb9d..43f16b8 100644
--- a/main/sw/inc/swabstdlg.hxx
+++ b/main/sw/inc/swabstdlg.hxx
@@ -420,14 +420,17 @@
 												sal_Bool			bFmt 	 = sal_False,
 												sal_uInt16			nDefPage = 0,
 												const String* 	pFmtStr  = 0) = 0;  //add for SwFrmDlg
-	virtual SfxAbstractTabDialog*		CreateTemplateDialog( int nResId,
-												Window*             pParent,
-												SfxStyleSheetBase&  rBase,
-												sal_uInt16              nRegion,
-												sal_Bool 				bColumn = sal_False,
-												SwWrtShell* 		pActShell = 0,
-												sal_Bool 				bNew = sal_False ) = 0; //add for SwTemplateDlg
-	virtual AbstractGlossaryDlg*		CreateGlossaryDlg( int nResId,
+    // @param nSlot
+    // Identifies optional Slot by which the creation of the Template (Style) dialog is triggered.
+    // Currently used, if nRegion == SFX_STYLE_FAMILY_PAGE in order to activate certain dialog pane
+    virtual SfxAbstractTabDialog*       CreateTemplateDialog( int nResId,
+                                                Window*             pParent,
+                                                SfxStyleSheetBase&  rBase,
+                                                sal_uInt16              nRegion,
+                                                const sal_uInt16 nSlot = 0,
+                                                SwWrtShell* 		pActShell = 0,
+                                                sal_Bool 				bNew = sal_False ) = 0; //add for SwTemplateDlg
+    virtual AbstractGlossaryDlg*		CreateGlossaryDlg( int nResId,
 												SfxViewFrame* pViewFrame,
 												SwGlossaryHdl* pGlosHdl,
 												SwWrtShell *pWrtShell) = 0; //add for SwGlossaryDlg
diff --git a/main/sw/inc/swcommands.h b/main/sw/inc/swcommands.h
index 4ba869b..1039e4f 100644
--- a/main/sw/inc/swcommands.h
+++ b/main/sw/inc/swcommands.h
@@ -50,9 +50,9 @@
 #define CMD_FN_NUMBER_BULLETS                       ".uno:BulletsAndNumberingDialog"
 #define CMD_FN_CALC_TABLE                           ".uno:Calc"
 #define CMD_FN_CALCULATE                            ".uno:CalculateSel"
-#define CMD_FN_TABLE_VERT_BOTTOM                    ".uno:CellVertBottom"
-#define CMD_FN_TABLE_VERT_CENTER                    ".uno:CellVertCenter"
-#define CMD_FN_TABLE_VERT_NONE                      ".uno:CellVertTop"
+#define CMD_SID_TABLE_VERT_BOTTOM                   ".uno:CellVertBottom"
+#define CMD_SID_TABLE_VERT_CENTER                   ".uno:CellVertCenter"
+#define CMD_SID_TABLE_VERT_NONE                     ".uno:CellVertTop"
 #define CMD_FN_FRAME_CHAIN                          ".uno:ChainFrames"
 #define CMD_FN_CHANGE_DBFIELD                       ".uno:ChangeDatabaseField"
 #define CMD_FN_NUMBERING_OUTLINE_DLG                ".uno:ChapterNumberingDialog"
diff --git a/main/sw/sdi/_annotsh.sdi b/main/sw/sdi/_annotsh.sdi
index f90e5d1..817adcb 100644
--- a/main/sw/sdi/_annotsh.sdi
+++ b/main/sw/sdi/_annotsh.sdi
@@ -179,6 +179,24 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
+	SID_ATTR_PARA_LRSPACE
+	[
+		ExecMethod = Exec;
+		StateMethod = GetState ;
+	]
+	
+	SID_ATTR_PARA_LINESPACE
+	[
+		ExecMethod = Exec;
+		StateMethod = GetState ;
+	]
+	
+	SID_ATTR_PARA_ULSPACE
+	[
+		ExecMethod = Exec;
+		StateMethod = GetState ;
+	]
+
 	FN_INSERT_STRING
 	[
 			ExecMethod = Exec ;
@@ -206,6 +224,13 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+
+	SID_CHAR_DLG_EFFECT
+	[
+		ExecMethod = Exec ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 	
 	SID_ATTR_CHAR_WEIGHT // api:
 	[
diff --git a/main/sw/sdi/_basesh.sdi b/main/sw/sdi/_basesh.sdi
index 2cc5560..fce2b24 100644
--- a/main/sw/sdi/_basesh.sdi
+++ b/main/sw/sdi/_basesh.sdi
@@ -237,17 +237,23 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
-	FN_FORMAT_PAGE_DLG  // status(final|play)
-	[
-		ExecMethod = ExecDlg ;
-		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-	]
+    FN_FORMAT_PAGE_DLG  // status(final|play)
+    [
+        ExecMethod = ExecDlg ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
 
-	FN_FORMAT_PAGE_COLUMN_DLG  // status(final|play)
-	[
-		ExecMethod = ExecDlg ;
-		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-	]
+    FN_FORMAT_PAGE_COLUMN_DLG  // status(final|play)
+    [
+        ExecMethod = ExecDlg ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
+
+    FN_FORMAT_PAGE_SETTING_DLG
+    [
+        ExecMethod = ExecDlg ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
 
     FN_CONVERT_TABLE_TO_TEXT
     [
diff --git a/main/sw/sdi/_frmsh.sdi b/main/sw/sdi/_frmsh.sdi
index 922b295..e186c73 100644
--- a/main/sw/sdi/_frmsh.sdi
+++ b/main/sw/sdi/_frmsh.sdi
@@ -147,6 +147,27 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
+	SID_ATTR_TRANSFORM
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+	]
+	SID_ATTR_TRANSFORM_WIDTH
+	[
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	SID_ATTR_TRANSFORM_HEIGHT
+	[
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	SID_ATTR_TRANSFORM_PROTECT_SIZE
+	[
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
 	SID_ATTR_ULSPACE // status(final|play)
 	[
 		ExecMethod = Execute ;
@@ -168,6 +189,12 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+	FN_PROPERTY_WRAP_DLG // status(final|play)
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 	SID_FRAME_LINESTYLE // status()
 	[
diff --git a/main/sw/sdi/_grfsh.sdi b/main/sw/sdi/_grfsh.sdi
index c4e5800..d694d40 100644
--- a/main/sw/sdi/_grfsh.sdi
+++ b/main/sw/sdi/_grfsh.sdi
@@ -32,6 +32,12 @@
 		StateMethod = GetAttrState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+    SID_FLIP_VERTICAL
+	[
+		ExecMethod = ExecAttr ;
+		StateMethod = GetAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 	FN_FLIP_HORZ_GRAFIC  // status(final|play)
 	[
@@ -39,6 +45,12 @@
 		StateMethod = GetAttrState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+    SID_FLIP_HORIZONTAL
+	[
+		ExecMethod = ExecAttr ;
+		StateMethod = GetAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 	FN_FORMAT_GRAFIC_DLG // status(final|play)
 	[
@@ -46,6 +58,12 @@
 		StateMethod = GetAttrState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+	FN_PROPERTY_WRAP_DLG // status(final|play)
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 
     FN_SAVE_GRAPHIC // status(final|play)
diff --git a/main/sw/sdi/_tabsh.sdi b/main/sw/sdi/_tabsh.sdi
index c195782..fbe39b4 100644
--- a/main/sw/sdi/_tabsh.sdi
+++ b/main/sw/sdi/_tabsh.sdi
@@ -63,26 +63,27 @@
 	]
 
 
-	FN_TABLE_VERT_NONE
+	SID_TABLE_VERT_NONE
 	[
 		ExecMethod = Execute ;
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
-	FN_TABLE_VERT_CENTER
+	SID_TABLE_VERT_CENTER
 	[
 		ExecMethod = Execute ;
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
-	FN_TABLE_VERT_BOTTOM
+	SID_TABLE_VERT_BOTTOM
 	[
 		ExecMethod = Execute ;
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+
 	FN_TABLE_SET_COL_WIDTH // status( final|play )
 	[
 		ExecMethod = Execute ;
diff --git a/main/sw/sdi/_textsh.sdi b/main/sw/sdi/_textsh.sdi
index 28c9c5e..3b0528e 100644
--- a/main/sw/sdi/_textsh.sdi
+++ b/main/sw/sdi/_textsh.sdi
@@ -59,6 +59,7 @@
     SID_ATTR_BRUSH_CHAR // status()
 	[
 		ExecMethod = Execute ;
+		StateMethod = GetTxtCtrlState ; 
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
@@ -732,6 +733,18 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+	FN_BUL_NUM_RULE_INDEX // status(final|play)
+	[
+		ExecMethod = ExecEnterNum ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	FN_NUM_NUM_RULE_INDEX // status(final|play)
+	[
+		ExecMethod = ExecEnterNum ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 	FN_NUMBER_BULLETS // status(final|play)
 	[
 		ExecMethod = ExecEnterNum ;
@@ -793,6 +806,21 @@
 		ExecMethod = ExecMoveMisc ;
 		StateMethod = NoState ;
 	]
+	FN_SVX_SET_NUMBER
+	[
+		ExecMethod = ExecSetNumber;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	FN_SVX_SET_BULLET
+	[
+		ExecMethod = ExecSetNumber;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	SID_OUTLINE_BULLET // status(final|play)
+	[
+		ExecMethod = ExecEnterNum ;		
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 	FN_INSERT_FOOTNOTE_DLG // status(final|play|rec)
 	[
@@ -1199,6 +1227,11 @@
 		ExecMethod = Execute ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+	SID_ATTR_PARA_LRSPACE
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetAttrState;
+	]
 	FN_SELECT_PARA // status(final|play)
 	[
 		ExecMethod = Execute ;
@@ -1446,6 +1479,12 @@
 		ExecMethod = Execute ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+
+	SID_CHAR_DLG_EFFECT
+	[
+		ExecMethod = Execute ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
     SID_CHAR_DLG_FOR_PARAGRAPH
     [
         ExecMethod = Execute ;
diff --git a/main/sw/sdi/_viewsh.sdi b/main/sw/sdi/_viewsh.sdi
index bbd9e40..e9defb2 100644
--- a/main/sw/sdi/_viewsh.sdi
+++ b/main/sw/sdi/_viewsh.sdi
@@ -404,6 +404,31 @@
 		ExecMethod = Execute ;
 		StateMethod = GetState ;
 	]
+
+	SID_ATTR_PARA_ULSPACE
+	[
+		ExecMethod = ExecTabWin ;
+    	StateMethod = StateTabWin ;
+	]
+		
+    SID_ATTR_PAGE_COLUMN
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_ULSPACE
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
+    SID_ATTR_PAGE_LRSPACE
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
+
     SID_THESAURUS // status(final|play)
 	[
 		ExecMethod = ExecLingu ;
diff --git a/main/sw/sdi/drawsh.sdi b/main/sw/sdi/drawsh.sdi
index df22fe5..bc31cbc 100644
--- a/main/sw/sdi/drawsh.sdi
+++ b/main/sw/sdi/drawsh.sdi
@@ -33,6 +33,20 @@
 		Export = FALSE;
 	]
 
+	SID_ATTR_LINE_START
+	[
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = DisableState ;
+		Export = FALSE;
+	]
+
+	SID_ATTR_LINE_END
+	[
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = DisableState ;
+		Export = FALSE;
+	]
+
 	SID_ATTR_LINE_STYLE
 	[
 		Export = FALSE;
@@ -48,6 +62,30 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 	
+	SID_ATTR_LINE_TRANSPARENCE
+	[
+		Export = FALSE;
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = GetDrawAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
+	SID_ATTR_LINE_JOINT
+	[
+		Export = FALSE;
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = GetDrawAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
+	SID_ATTR_LINE_CAP
+	[
+		Export = FALSE;
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = GetDrawAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
 	SID_DASH_LIST
 	[
 	    StateMethod = GetDrawAttrState ;
@@ -134,6 +172,22 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
+	SID_ATTR_FILL_TRANSPARENCE
+	[
+		Export = FALSE;
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = GetDrawAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
+	SID_ATTR_FILL_FLOATTRANSPARENCE
+	[
+		Export = FALSE;
+		ExecMethod = ExecDrawAttrArgs ;
+		StateMethod = GetDrawAttrState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+
 	SID_ATTRIBUTES_LINE
 	[
 		ExecMethod = ExecDrawDlg ;
@@ -158,6 +212,12 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+    SID_FLIP_VERTICAL
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
     FN_FLIP_HORZ_GRAFIC
 	[
@@ -165,6 +225,12 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+    SID_FLIP_HORIZONTAL
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 
 	SID_OBJECT_ROTATE
 	[
diff --git a/main/sw/sdi/drwbassh.sdi b/main/sw/sdi/drwbassh.sdi
index 4d36bf0..cfa5be6 100644
--- a/main/sw/sdi/drwbassh.sdi
+++ b/main/sw/sdi/drwbassh.sdi
@@ -32,6 +32,7 @@
 shell SwDrawBaseShell: SwBaseShell
 {
 		import TextDrawBase[Automation];
+        import Sidebar;
 
 	SID_OBJECT_ALIGN
 	[
diff --git a/main/sw/sdi/drwtxtsh.sdi b/main/sw/sdi/drwtxtsh.sdi
index a233e49..6244914 100644
--- a/main/sw/sdi/drwtxtsh.sdi
+++ b/main/sw/sdi/drwtxtsh.sdi
@@ -210,6 +210,24 @@
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
 
+	SID_ATTR_PARA_LRSPACE  //for indent
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+	]
+	
+	SID_ATTR_PARA_LINESPACE // api:
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+	]
+	
+	SID_ATTR_PARA_ULSPACE
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+	]
+
 	SID_ATTR_PARA_ADJUST_LEFT // api:
 	[
 		ExecMethod = Execute ;
@@ -299,6 +317,13 @@
 		StateMethod = GetState ;
 		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
 	]
+
+	SID_CHAR_DLG_EFFECT
+	[
+		ExecMethod = Execute ;
+		StateMethod = GetState ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
     SID_CHAR_DLG_FOR_PARAGRAPH
     [
         ExecMethod = Execute ;
@@ -576,6 +601,25 @@
 	[
 		StateMethod = StateDisableItems ;
 	]
+
+	SID_TABLE_VERT_NONE
+	[
+		ExecMethod = ExecDraw ;
+		StateMethod = GetStatePropPanelAttr ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	SID_TABLE_VERT_CENTER
+	[
+		ExecMethod = ExecDraw ;
+		StateMethod = GetStatePropPanelAttr ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
+	SID_TABLE_VERT_BOTTOM
+	[
+		ExecMethod = ExecDraw ;
+		StateMethod = GetStatePropPanelAttr ;
+		DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+	]
 }
 
 interface TextDrawFont
diff --git a/main/sw/sdi/sidebar.sdi b/main/sw/sdi/sidebar.sdi
new file mode 100644
index 0000000..a2fd90d
--- /dev/null
+++ b/main/sw/sdi/sidebar.sdi
@@ -0,0 +1,35 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+interface Sidebar [ Automation = FALSE; ]
+{
+    SID_ATTR_TRANSFORM_WIDTH	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_HEIGHT	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_POS_X	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_POS_Y	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_ANGLE	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_ROT_X	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_ROT_Y	[ StateMethod = GetDrawAttrStateForIFBX; ]
+	SID_ATTR_TRANSFORM_PROTECT_POS	[ StateMethod = GetDrawAttrStateForIFBX;]
+	SID_ATTR_TRANSFORM_PROTECT_SIZE	[ StateMethod = GetDrawAttrStateForIFBX;]
+}
+
+
diff --git a/main/sw/sdi/swriter.sdi b/main/sw/sdi/swriter.sdi
index 8aa6b56..411c6ae 100644
--- a/main/sw/sdi/swriter.sdi
+++ b/main/sw/sdi/swriter.sdi
@@ -729,87 +729,6 @@
 ]
 
 //--------------------------------------------------------------------------
-SfxBoolItem CellVertBottom FN_TABLE_VERT_BOTTOM
-
-[
-	/* flags: */
-	AutoUpdate = TRUE,
-	Cachable = Cachable,
-	FastCall = FALSE,
-	HasCoreId = FALSE,
-	HasDialog = FALSE,
-	ReadOnlyDoc = FALSE,
-	Toggle = FALSE,
-	Container = FALSE,
-	RecordAbsolute = FALSE,
-	RecordPerSet;
-	Synchron;
-
-	Readonly = FALSE,
-
-	/* config: */
-	AccelConfig = TRUE,
-	MenuConfig = TRUE,
-	StatusBarConfig = FALSE,
-	ToolBoxConfig = TRUE,
-	GroupId = GID_TABLE;
-]
-
-//--------------------------------------------------------------------------
-SfxBoolItem CellVertCenter FN_TABLE_VERT_CENTER
-
-[
-	/* flags: */
-	AutoUpdate = TRUE,
-	Cachable = Cachable,
-	FastCall = FALSE,
-	HasCoreId = FALSE,
-	HasDialog = FALSE,
-	ReadOnlyDoc = FALSE,
-	Toggle = FALSE,
-	Container = FALSE,
-	RecordAbsolute = FALSE,
-	RecordPerSet;
-	Synchron;
-
-	Readonly = FALSE,
-
-	/* config: */
-	AccelConfig = TRUE,
-	MenuConfig = TRUE,
-	StatusBarConfig = FALSE,
-	ToolBoxConfig = TRUE,
-	GroupId = GID_TABLE;
-]
-
-//--------------------------------------------------------------------------
-SfxBoolItem CellVertTop FN_TABLE_VERT_NONE
-
-[
-	/* flags: */
-	AutoUpdate = TRUE,
-	Cachable = Cachable,
-	FastCall = FALSE,
-	HasCoreId = FALSE,
-	HasDialog = FALSE,
-	ReadOnlyDoc = FALSE,
-	Toggle = FALSE,
-	Container = FALSE,
-	RecordAbsolute = FALSE,
-	RecordPerSet;
-	Synchron;
-
-	Readonly = FALSE,
-
-	/* config: */
-	AccelConfig = TRUE,
-	MenuConfig = TRUE,
-	StatusBarConfig = FALSE,
-	ToolBoxConfig = TRUE,
-	GroupId = GID_TABLE;
-]
-
-//--------------------------------------------------------------------------
 SfxBoolItem ChainFrames FN_FRAME_CHAIN
 
 [
@@ -3459,6 +3378,30 @@
 	GroupId = GID_GRAPHIC;
 ]
 //--------------------------------------------------------------------------
+SfxVoidItem ObjectWrapDialog FN_PROPERTY_WRAP_DLG
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerItem;
+	Asynchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_GRAPHIC;
+]
+//--------------------------------------------------------------------------
 SfxVoidItem SaveGraphic FN_SAVE_GRAPHIC
 ()
 [
@@ -6349,6 +6292,30 @@
 	GroupId = GID_FORMAT;
 ]
 
+SfxVoidItem PageSettingDialog FN_FORMAT_PAGE_SETTING_DLG
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerItem;
+	Asynchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem PageDown FN_PAGEDOWN
 ()
@@ -10287,3 +10254,83 @@
     ToolBoxConfig = TRUE,
     GroupId = GID_EDIT;
 ]
+
+
+SfxInt16Item SwPageColumn SID_ATTR_PAGE_COLUMN
+
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    Readonly = TRUE,
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_VIEW;
+]
+
+SvxLongULSpaceItem SwPageULMargin SID_ATTR_PAGE_ULSPACE
+
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
+SvxLongLRSpaceItem SwPageLRMargin SID_ATTR_PAGE_LRSPACE
+
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = FALSE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	Readonly = FALSE,
+
+	/* config: */
+	AccelConfig = FALSE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_FORMAT;
+]
+
diff --git a/main/sw/sdi/swslots.sdi b/main/sw/sdi/swslots.sdi
index 55172c1..c1d3024 100644
--- a/main/sw/sdi/swslots.sdi
+++ b/main/sw/sdi/swslots.sdi
@@ -74,7 +74,8 @@
 	include "wtextsh.sdi"
 
 	include "_drwbase.sdi"
-	include "drwbassh.sdi"
+    include "sidebar.sdi"
+    include "drwbassh.sdi"
 	include "wdrwbase.sdi"
 
 	include "_formsh.sdi"
diff --git a/main/sw/sdi/wdrwbase.sdi b/main/sw/sdi/wdrwbase.sdi
index 1a0390e..ddcffbe 100644
--- a/main/sw/sdi/wdrwbase.sdi
+++ b/main/sw/sdi/wdrwbase.sdi
@@ -31,6 +31,7 @@
 shell SwWebDrawBaseShell: SwBaseShell
 {
 		import WebDrawBase[Automation];
+        import Sidebar;
 
 	SID_OBJECT_ALIGN
 	[
diff --git a/main/sw/source/core/doc/docdesc.cxx b/main/sw/source/core/doc/docdesc.cxx
index 534b065..a302fda 100644
--- a/main/sw/source/core/doc/docdesc.cxx
+++ b/main/sw/source/core/doc/docdesc.cxx
@@ -24,6 +24,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
+#include <cmdid.h>
 #include <hintids.hxx>
 #include <vcl/virdev.hxx>
 #include <svx/svdmodel.hxx>
@@ -34,6 +35,8 @@
 #include <tools/urlobj.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/printer.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <fmtfsize.hxx>
@@ -424,6 +427,18 @@
     {
         GetIDocumentUndoRedo().DelAllUndoObj();
     }
+
+    SfxBindings* pBindings = 
+        ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? GetDocShell()->GetDispatcher()->GetBindings() : 0;
+    if ( pBindings )
+    {
+        pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
+        pBindings->Invalidate( SID_ATTR_PAGE );
+        pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
+        pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
+        pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
+    }
+
 }
 
 /*************************************************************************
diff --git a/main/sw/source/core/draw/drawdoc.cxx b/main/sw/source/core/draw/drawdoc.cxx
index df22ceb..5226083 100644
--- a/main/sw/source/core/draw/drawdoc.cxx
+++ b/main/sw/source/core/draw/drawdoc.cxx
@@ -76,8 +76,8 @@
 		SetObjectShell( pDocSh );
 		SvxColorTableItem* pColItem = ( SvxColorTableItem* )
                                 ( pDocSh->GetItem( SID_COLOR_TABLE ) );
-		XColorTable *pXCol = pColItem ? pColItem->GetColorTable() :
-										XColorTable::GetStdColorTable();
+		XColorList *pXCol = pColItem ? pColItem->GetColorTable() :
+										XColorList::GetStdColorList();
 		SetColorTable( pXCol );
 
 		if ( !pColItem )
@@ -92,7 +92,7 @@
 		SetObjectShell( pDocSh );
 	}
 	else
-		SetColorTable( XColorTable::GetStdColorTable() );
+		SetColorTable( XColorList::GetStdColorList() );
 
 	// copy all the default values to the SdrModel
 	SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();
diff --git a/main/sw/source/core/edit/ednumber.cxx b/main/sw/source/core/edit/ednumber.cxx
index 8105b82..a3cd6fe 100644
--- a/main/sw/source/core/edit/ednumber.cxx
+++ b/main/sw/source/core/edit/ednumber.cxx
@@ -164,7 +164,88 @@
 	return bRet;
 }
 // Loeschen, Splitten der Aufzaehlungsliste
+sal_Bool SwEditShell::SelectionHasNumber() const
+{
+    sal_Bool bResult = HasNumber();
+    const SwTxtNode * pTxtNd =
+        GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+	if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) {
+		SwPamRanges aRangeArr( *GetCrsr() );
+		SwPaM aPam( *GetCrsr()->GetPoint() );
+		for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+        {
+            aRangeArr.SetPam( n, aPam );
+			{
+					sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(),
+						  nEnd = aPam.GetMark()->nNode.GetIndex();
+					if( nStt > nEnd )
+					{
+						sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp;
+					}
+					for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) {
+						SwTxtNode * pTxtNd = pDoc->GetNodes()[nPos]->GetTxtNode();
+						if (pTxtNd && pTxtNd->Len()!=0)
+						{
+							bResult = pTxtNd->HasNumber();
 
+							// --> OD 2005-10-26 #b6340308#
+							// special case: outline numbered, not counted paragraph
+							if ( bResult &&
+								pTxtNd->GetNumRule() == GetDoc()->GetOutlineNumRule() &&
+								!pTxtNd->IsCountedInList() )
+							{
+								bResult = sal_False;
+							}
+							if (bResult==sal_False) {
+								break;
+							} 
+							// <--
+						}
+					}
+			}
+        }
+
+	}
+
+    return bResult;
+}
+//Sym3_879 add a new function to determine number on/off status
+sal_Bool SwEditShell::SelectionHasBullet() const
+{
+    sal_Bool bResult = HasBullet();
+    const SwTxtNode * pTxtNd =
+        GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+	if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) {
+		SwPamRanges aRangeArr( *GetCrsr() );
+		SwPaM aPam( *GetCrsr()->GetPoint() );
+		for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+        {
+            aRangeArr.SetPam( n, aPam );
+			{
+					sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(),
+						  nEnd = aPam.GetMark()->nNode.GetIndex();
+					if( nStt > nEnd )
+					{
+						sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp;
+					}
+					for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) {
+						SwTxtNode * pTxtNd = pDoc->GetNodes()[nPos]->GetTxtNode();
+						if (pTxtNd && pTxtNd->Len()!=0)
+						{
+					        bResult = pTxtNd->HasBullet();
+
+							if (bResult==sal_False) {
+								break;
+							} 
+						}
+					}
+			}
+        }
+
+	}
+
+    return bResult;
+}
 // -> #i29560#
 sal_Bool SwEditShell::HasNumber() const
 {
diff --git a/main/sw/source/core/frmedt/feshview.cxx b/main/sw/source/core/frmedt/feshview.cxx
index a45a274..af948ab 100644
--- a/main/sw/source/core/frmedt/feshview.cxx
+++ b/main/sw/source/core/frmedt/feshview.cxx
@@ -2486,10 +2486,10 @@
 						{
                             // TODO/LATER: use correct aspect
                             const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ));
-                            if ( (FLYPROTECT_CONTENT & eType) && bNeverResize )
-							{
-								nChk |= FLYPROTECT_SIZE;
-								nChk |= FLYPROTECT_FIXED;
+                            if ( ( (FLYPROTECT_CONTENT & eType) || (FLYPROTECT_SIZE & eType) ) && bNeverResize )
+                            {
+                                nChk |= FLYPROTECT_SIZE;
+                                nChk |= FLYPROTECT_FIXED;
                             }
 
                             // set FLYPROTECT_POS if it is a Math object anchored 'as char' and baseline alignment is activated
diff --git a/main/sw/source/ui/app/docsh2.cxx b/main/sw/source/ui/app/docsh2.cxx
index 0a0ecc0..22b3d64 100644
--- a/main/sw/source/ui/app/docsh2.cxx
+++ b/main/sw/source/ui/app/docsh2.cxx
@@ -1019,7 +1019,7 @@
 			case SID_GET_COLORTABLE:
 			{
 				SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
-				XColorTable* pTable = pColItem->GetColorTable();
+				XColorList* pTable = pColItem->GetColorTable();
 				rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable));
 			}
 			break;
diff --git a/main/sw/source/ui/app/docshdrw.cxx b/main/sw/source/ui/app/docshdrw.cxx
index 9ec88b3..9a39fc7 100644
--- a/main/sw/source/ui/app/docshdrw.cxx
+++ b/main/sw/source/ui/app/docshdrw.cxx
@@ -73,7 +73,7 @@
 		rOutliner.SetHyphenator( xHyphenator );
 	}
 	else
-        PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE ));
+        PutItem( SvxColorTableItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ));
 }
 
 
diff --git a/main/sw/source/ui/app/docshini.cxx b/main/sw/source/ui/app/docshini.cxx
index de766c7..1bec757 100644
--- a/main/sw/source/ui/app/docshini.cxx
+++ b/main/sw/source/ui/app/docshini.cxx
@@ -439,9 +439,9 @@
 	// wird nur die DocInfo fuer den Explorer gelesen, ist das Item nicht da
 	if(pColItem)
 	{
-		XColorTable* pTable = pColItem->GetColorTable();
+		XColorList* pTable = pColItem->GetColorTable();
 		// wurde eine neue Table angelegt, muss sie auch geloescht werden.
-		if((void*)pTable  != (void*)(XColorTable::GetStdColorTable()) )
+		if((void*)pTable  != (void*)(XColorList::GetStdColorList()) )
 			delete pTable;
 	}
 
diff --git a/main/sw/source/ui/app/docst.cxx b/main/sw/source/ui/app/docst.cxx
index 7b38fc7..702ea38 100644
--- a/main/sw/source/ui/app/docst.cxx
+++ b/main/sw/source/ui/app/docst.cxx
@@ -283,7 +283,7 @@
 		if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
 			sal_False, &pItem ))
 		{
-			sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
+			const sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
 
 			String sName;
 			sal_uInt16 nMask = 0;
@@ -298,7 +298,7 @@
 				sal_False, &pItem ))
 				sParent = ((const SfxStringItem*)pItem)->GetValue();
 
-			nRet = Edit( sName, sParent, nFamily, nMask, sal_True, sal_False, 0, rReq.IsAPI() );
+			nRet = Edit( sName, sParent, nFamily, nMask, sal_True, 0, 0, rReq.IsAPI() );
 		}
 		break;
 
@@ -458,7 +458,7 @@
 				switch(nSlot)
 				{
 					case SID_STYLE_EDIT:
-						nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, sal_False, pActShell );
+						nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, 0, pActShell );
 						break;
 					case SID_STYLE_DELETE:
 						nRet = Delete(aParam, nFamily);
@@ -509,9 +509,15 @@
  --------------------------------------------------------------------*/
 
 
-sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uInt16 nFamily, sal_uInt16 nMask,
-						 sal_Bool bNew, sal_Bool bColumn, SwWrtShell* pActShell,
-						 sal_Bool bBasic )
+sal_uInt16 SwDocShell::Edit(
+    const String &rName,
+    const String &rParent,
+    const sal_uInt16 nFamily,
+    sal_uInt16 nMask,
+    const sal_Bool bNew,
+    const sal_uInt16 nSlot,
+    SwWrtShell* pActShell,
+    const sal_Bool bBasic )
 {
 	ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
 	SfxStyleSheetBase *pStyle = 0;
@@ -671,14 +677,14 @@
             !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) )
             pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) );
 
-		PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
-		FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
+        PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
+        FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
         SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
-		SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+        SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");
         SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE,
-													0, *(xTmp.get()), nFamily, bColumn,
-													pActShell ? pActShell : pWrtShell, bNew);
+                                                    0, *(xTmp.get()), nFamily, nSlot,
+                                                    pActShell ? pActShell : pWrtShell, bNew);
         DBG_ASSERT(pDlg, "Dialogdiet fail!");
 		if(RET_OK == pDlg->Execute())
 		{
@@ -1286,9 +1292,12 @@
 }
 
 
-void SwDocShell::FormatPage( const String& rPage, sal_Bool bColumn, SwWrtShell* 	pActShell )
+void SwDocShell::FormatPage(
+    const String& rPage, 
+    const sal_uInt16 nSlot, 
+    SwWrtShell& rActShell )
 {
-	Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, bColumn, pActShell);
+    Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nSlot, &rActShell);
 }
 
 Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode )
diff --git a/main/sw/source/ui/app/mn.src b/main/sw/source/ui/app/mn.src
index 6ef7e4e..f521fff 100644
--- a/main/sw/source/ui/app/mn.src
+++ b/main/sw/source/ui/app/mn.src
@@ -430,20 +430,20 @@
                 SEPARATOR ; \
                 MenuItem\
                 {\
-                    Identifier = FN_TABLE_VERT_NONE ; \
-                    HelpId = CMD_FN_TABLE_VERT_NONE ; \
+                    Identifier = SID_TABLE_VERT_NONE ; \
+                    HelpId = CMD_SID_TABLE_VERT_NONE ; \
                     Text [ en-US ] = "~Top" ; \
                 };\
                 MenuItem\
                 {\
-                    Identifier = FN_TABLE_VERT_CENTER ; \
-                    HelpId = CMD_FN_TABLE_VERT_CENTER ; \
+                    Identifier = SID_TABLE_VERT_CENTER ; \
+                    HelpId = CMD_SID_TABLE_VERT_CENTER ; \
                     Text [ en-US ] = "C~enter" ; \
                 };\
                 MenuItem\
                 {\
-                    Identifier = FN_TABLE_VERT_BOTTOM ; \
-                    HelpId = CMD_FN_TABLE_VERT_BOTTOM ; \
+                    Identifier = SID_TABLE_VERT_BOTTOM ; \
+                    HelpId = CMD_SID_TABLE_VERT_BOTTOM ; \
                     Text [ en-US ] = "~Bottom" ; \
                 };\
                 SEPARATOR ; \
diff --git a/main/sw/source/ui/app/swmodule.cxx b/main/sw/source/ui/app/swmodule.cxx
index 450679d..c1d8440 100644
--- a/main/sw/source/ui/app/swmodule.cxx
+++ b/main/sw/source/ui/app/swmodule.cxx
@@ -134,6 +134,7 @@
 #include <mailmergechildwindow.hxx>
 #include <modcfg.hxx>
 #include <fontcfg.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <sfx2/taskpane.hxx>
 #include <sfx2/evntconf.hxx>
 #include <sfx2/appuno.hxx>
@@ -464,7 +465,8 @@
 	::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
 
     SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
-    ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod );
+    ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
+    ::sfx2::TaskPaneWrapper::RegisterChildWindow(NULL, pMod);
 }
 
 
diff --git a/main/sw/source/ui/config/optpage.cxx b/main/sw/source/ui/config/optpage.cxx
index 69dd19e..516e284 100644
--- a/main/sw/source/ui/config/optpage.cxx
+++ b/main/sw/source/ui/config/optpage.cxx
@@ -2133,7 +2133,7 @@
 	aDeletedColorLB.InsertEntry(sAuthor);
 	aChangedColorLB.InsertEntry(sAuthor);
 
-	XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+	XColorList* pColorTbl = XColorList::GetStdColorList();
 	sal_uInt16 i;
 	for( i = 0; i < pColorTbl->Count(); ++i )
 	{
diff --git a/main/sw/source/ui/dialog/swdlgfact.cxx b/main/sw/source/ui/dialog/swdlgfact.cxx
index 49de980..b08b362 100644
--- a/main/sw/source/ui/dialog/swdlgfact.cxx
+++ b/main/sw/source/ui/dialog/swdlgfact.cxx
@@ -1295,7 +1295,7 @@
 												Window*             pParent,
 												SfxStyleSheetBase&  rBase,
 												sal_uInt16              nRegion,
-												sal_Bool 				bColumn,
+												const sal_uInt16 nSlot,
 												SwWrtShell* 		pActShell,
 												sal_Bool 				bNew ) //add for SwTemplateDlg
 {
@@ -1303,7 +1303,7 @@
 	switch ( nResId )
 	{
 		case DLG_TEMPLATE_BASE :
-			pDlg = new SwTemplateDlg( pParent, rBase, nRegion, bColumn, pActShell, bNew );
+			pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nSlot, pActShell, bNew );
 			break;
 		default:
 			break;
diff --git a/main/sw/source/ui/dialog/swdlgfact.hxx b/main/sw/source/ui/dialog/swdlgfact.hxx
index ee2ab23..5d1554f 100644
--- a/main/sw/source/ui/dialog/swdlgfact.hxx
+++ b/main/sw/source/ui/dialog/swdlgfact.hxx
@@ -498,14 +498,14 @@
 												sal_Bool			bFmt 	 = sal_False,
 												sal_uInt16			nDefPage = 0,
 												const String* 	pFmtStr  = 0); //add for SwFrmDlg
-	virtual SfxAbstractTabDialog*		CreateTemplateDialog( int nResId,
-												Window*             pParent,
-												SfxStyleSheetBase&  rBase,
-												sal_uInt16              nRegion,
-												sal_Bool 				bColumn = sal_False,
-												SwWrtShell* 		pActShell = 0,
-												sal_Bool 				bNew = sal_False ); //add for SwTemplateDlg
-	virtual AbstractGlossaryDlg*		CreateGlossaryDlg( int nResId,
+    virtual SfxAbstractTabDialog*		CreateTemplateDialog( int nResId,
+                                                Window*             pParent,
+                                                SfxStyleSheetBase&  rBase,
+                                                sal_uInt16              nRegion,
+                                                const sal_uInt16 nSlot = 0,
+                                                SwWrtShell* 		pActShell = 0,
+                                                sal_Bool 				bNew = sal_False ); //add for SwTemplateDlg
+    virtual AbstractGlossaryDlg*		CreateGlossaryDlg( int nResId,
 												SfxViewFrame* pViewFrame, 
 												SwGlossaryHdl* pGlosHdl, 
 												SwWrtShell *pWrtShell); //add for SwGlossaryDlg
diff --git a/main/sw/source/ui/fmtui/tmpdlg.cxx b/main/sw/source/ui/fmtui/tmpdlg.cxx
index dd39cbc..840263e 100644
--- a/main/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/main/sw/source/ui/fmtui/tmpdlg.cxx
@@ -106,7 +106,7 @@
 SwTemplateDlg::SwTemplateDlg(Window*			pParent,
 							 SfxStyleSheetBase& rBase,
 							 sal_uInt16 			nRegion,
-							 sal_Bool 				bColumn,
+							 const sal_uInt16 nSlot,
 							 SwWrtShell* 		pActShell,
 							 sal_Bool 				bNew ) :
 	SfxStyleDialog(	pParent,
@@ -260,15 +260,6 @@
 
 			AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
 
-			// Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
-/*			SwFmtFrmSize aSize( (const SwFmtFrmSize&)rBase.
-											GetItemSet().Get(RES_FRM_SIZE));
-			if( !aSize.GetWidth() )
-			{
-				aSize.SetWidth( DFLT_WIDTH );
-				aSize.SetHeight( DFLT_HEIGHT );
-				rBase.GetItemSet().Put( aSize );
-			}*/
 		break;
 		}
 		// Seitenvorlagen
@@ -277,34 +268,40 @@
             DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
             DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
-			AddTabPage(TP_HEADER_PAGE,		String(SW_RES(STR_PAGE_HEADER)),
-											SvxHeaderPage::Create,
-											SvxHeaderPage::GetRanges );
-			AddTabPage(TP_FOOTER_PAGE,		String(SW_RES(STR_PAGE_FOOTER)),
-											SvxFooterPage::Create,
-											SvxFooterPage::GetRanges );
-			if(bColumn)
-				SetCurPageId(TP_COLUMN);
+            AddTabPage(TP_HEADER_PAGE,		String(SW_RES(STR_PAGE_HEADER)),
+                                            SvxHeaderPage::Create,
+                                            SvxHeaderPage::GetRanges );
+            AddTabPage(TP_FOOTER_PAGE,		String(SW_RES(STR_PAGE_FOOTER)),
+                                            SvxFooterPage::Create,
+                                            SvxFooterPage::GetRanges );
+            if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG )
+            {
+                SetCurPageId(TP_COLUMN);
+            }
+            else if ( nSlot == FN_FORMAT_PAGE_SETTING_DLG )
+            {
+                SetCurPageId(TP_PAGE_STD);
+            }
 
             DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
             DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
-			AddTabPage(TP_PAGE_STD,			String(SW_RES(STR_PAGE_STD)),
+            AddTabPage(TP_PAGE_STD,			String(SW_RES(STR_PAGE_STD)),
                                             pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
                                             pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ),
-											sal_False,
-											1 ); // nach der Verwalten-Page
-			if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
-			{
+                                            sal_False,
+                                            1 ); // nach der Verwalten-Page
+            if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
+            {
                 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
                 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
-				AddTabPage(TP_BORDER, 			String(SW_RES(STR_PAGE_BORDER)),
-								pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
-				AddTabPage(TP_COLUMN,			String(SW_RES(STR_PAGE_COLUMN)),
-												SwColumnPage::Create,
-												SwColumnPage::GetRanges );
-				AddTabPage(TP_FOOTNOTE_PAGE,	String(SW_RES(STR_PAGE_FOOTNOTE)),
-												SwFootNotePage::Create,
-												SwFootNotePage::GetRanges );
+                AddTabPage(TP_BORDER, 			String(SW_RES(STR_PAGE_BORDER)),
+                                pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+                AddTabPage(TP_COLUMN,			String(SW_RES(STR_PAGE_COLUMN)),
+                                                SwColumnPage::Create,
+                                                SwColumnPage::GetRanges );
+                AddTabPage(TP_FOOTNOTE_PAGE,	String(SW_RES(STR_PAGE_FOOTNOTE)),
+                                                SwFootNotePage::Create,
+                                                SwFootNotePage::GetRanges );
                 AddTabPage(TP_TEXTGRID_PAGE,    String(SW_RES(STR_PAGE_TEXTGRID)),
                                                 SwTextGridPage::Create,
                                                 SwTextGridPage::GetRanges );
@@ -314,9 +311,9 @@
             }
 
 
-		}
-		break;
-		// Numerierungsvorlagen
+        }
+        break;
+        // Numerierungsvorlagen
 		case SFX_STYLE_FAMILY_PSEUDO:
 		{
             AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
diff --git a/main/sw/source/ui/inc/drwbassh.hxx b/main/sw/source/ui/inc/drwbassh.hxx
index f7b267e..9d6053b 100644
--- a/main/sw/source/ui/inc/drwbassh.hxx
+++ b/main/sw/source/ui/inc/drwbassh.hxx
@@ -49,6 +49,7 @@
 
 	void		Execute(SfxRequest &);
 	void		GetState(SfxItemSet &);
+    void	    GetDrawAttrStateForIFBX( SfxItemSet& rSet );
 	void		DisableState(SfxItemSet &rSet)				 { Disable(rSet);}
 	sal_Bool		Disable(SfxItemSet& rSet, sal_uInt16 nWhich = 0);
 
diff --git a/main/sw/source/ui/inc/drwtxtsh.hxx b/main/sw/source/ui/inc/drwtxtsh.hxx
index 7ccbecd..e491a23 100644
--- a/main/sw/source/ui/inc/drwtxtsh.hxx
+++ b/main/sw/source/ui/inc/drwtxtsh.hxx
@@ -60,6 +60,7 @@
 
 	void		Execute(SfxRequest &);
 	void		ExecDraw(SfxRequest &);
+	void		GetStatePropPanelAttr(SfxItemSet &);
 	void		GetState(SfxItemSet &);
 	void		GetDrawTxtCtrlState(SfxItemSet&);
 
diff --git a/main/sw/source/ui/inc/textsh.hxx b/main/sw/source/ui/inc/textsh.hxx
index 8c0b8af..bf721e4 100644
--- a/main/sw/source/ui/inc/textsh.hxx
+++ b/main/sw/source/ui/inc/textsh.hxx
@@ -64,6 +64,7 @@
 	void	ExecMoveLingu(SfxRequest &);
 	void	ExecMoveMisc(SfxRequest &);
 	void	ExecField(SfxRequest &rReq);
+	void	ExecSetNumber(SfxRequest &);
 	void	StateField(SfxItemSet &);
 	void	ExecIdx(SfxRequest &);
 	void	GetIdxState(SfxItemSet &);
diff --git a/main/sw/source/ui/inc/tmpdlg.hxx b/main/sw/source/ui/inc/tmpdlg.hxx
index 721ed4f..813ce10 100644
--- a/main/sw/source/ui/inc/tmpdlg.hxx
+++ b/main/sw/source/ui/inc/tmpdlg.hxx
@@ -35,26 +35,29 @@
 class SwTemplateDlg: public SfxStyleDialog
 {
 
-	sal_uInt16      nType;
-	sal_uInt16      nHtmlMode;
-	SwWrtShell*	pWrtShell;
-	sal_Bool		bNewStyle;
+    sal_uInt16      nType;
+    sal_uInt16      nHtmlMode;
+    SwWrtShell*     pWrtShell;
+    sal_Bool        bNewStyle;
 
-	DECL_LINK( NumOptionsHdl, PushButton* );
+    DECL_LINK( NumOptionsHdl, PushButton* );
 
 public:
-	SwTemplateDlg(  Window*             pParent,
-					SfxStyleSheetBase&  rBase,
-					sal_uInt16              nRegion,
-					sal_Bool 				bColumn = sal_False,
-					SwWrtShell* 		pActShell = 0,
-					sal_Bool 				bNew = sal_False );
+    // @param nSlot
+    // Identifies optional Slot by which the creation of the Template (Style) dialog is triggered.
+    // Currently used, if nRegion == SFX_STYLE_FAMILY_PAGE in order to activate certain dialog pane
+    SwTemplateDlg(  Window*             pParent,
+                    SfxStyleSheetBase&  rBase,
+                    sal_uInt16          nRegion,
+                    const sal_uInt16    nSlot = 0,
+                    SwWrtShell*         pActShell = 0,
+                    sal_Bool            bNew = sal_False );
 
-	~SwTemplateDlg();
-	const SfxItemSet* GetRefreshedSet();
+    ~SwTemplateDlg();
+    const SfxItemSet* GetRefreshedSet();
 
-	virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
-	virtual short Ok();
+    virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+    virtual short Ok();
 };
 
 
diff --git a/main/sw/source/ui/misc/pggrid.cxx b/main/sw/source/ui/misc/pggrid.cxx
index c65860f..c1f8577 100644
--- a/main/sw/source/ui/misc/pggrid.cxx
+++ b/main/sw/source/ui/misc/pggrid.cxx
@@ -143,7 +143,7 @@
 
     aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
 
-    XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+    XColorList* pColorTbl = XColorList::GetStdColorList();
     aColorLB.InsertAutomaticEntry();
 	for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i )
 	{
diff --git a/main/sw/source/ui/shells/annotsh.cxx b/main/sw/source/ui/shells/annotsh.cxx
index c63c6cb..a2cfce5 100644
--- a/main/sw/source/ui/shells/annotsh.cxx
+++ b/main/sw/source/ui/shells/annotsh.cxx
@@ -40,6 +40,8 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/request.hxx>
 #include <editeng/spltitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
 #include <editeng/orphitem.hxx>
 #include <editeng/brkitem.hxx>
 #include <editeng/widwitem.hxx>
@@ -105,6 +107,7 @@
 #include <svx/dialogs.hrc>
 
 #include <svx/svxids.hrc>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/itempool.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/editeng.hxx>
@@ -151,6 +154,7 @@
 {
 	SwWrtShell &rSh = rView.GetWrtShell();
 	SetPool(rSh.GetAttrPool().GetSecondaryPool());
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation));
 }
 
 SwAnnotationShell::~SwAnnotationShell()
@@ -186,6 +190,35 @@
     sal_uInt16 nEEWhich = 0;
 	switch (nSlot)
 	{
+		case SID_ATTR_PARA_LRSPACE:
+			{
+				SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
+										GetArgs()->Get(nSlot));
+				aParaMargin.SetWhich( EE_PARA_LRSPACE );
+
+				aNewAttr.Put(aParaMargin);
+				rReq.Done();
+				break;
+			}
+		case SID_ATTR_PARA_LINESPACE:
+			{
+				SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get(
+															GetPool().GetWhich(nSlot));
+				aParaMargin.SetWhich( EE_PARA_SBL );
+
+				aNewAttr.Put(aParaMargin);
+				rReq.Done();
+				break;
+			}
+		case SID_ATTR_PARA_ULSPACE:
+			{
+				SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
+					GetPool().GetWhich(nSlot));
+				aULSpace.SetWhich( EE_PARA_ULSPACE );
+				aNewAttr.Put( aULSpace );
+				rReq.Done();
+			}
+			break;
 		case SID_ATTR_CHAR_FONT:
 		case SID_ATTR_CHAR_FONTHEIGHT:
 		case SID_ATTR_CHAR_WEIGHT:
@@ -203,8 +236,19 @@
 		case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
 		case SID_ATTR_CHAR_UNDERLINE:
 		{
-		 	FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
-			aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
+			if( rReq.GetArgs() )
+			{
+				SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
+				if (pItem)
+				{
+					aNewAttr.Put(*pItem);
+				}
+				else 
+				{
+					FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
+					aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE,  EE_CHAR_UNDERLINE ) );
+				}
+			}
 			break;
 		}
 		case SID_ATTR_CHAR_OVERLINE:
@@ -426,6 +470,7 @@
 			delete pDialog;
 		}
 		break;
+		case SID_CHAR_DLG_EFFECT:
 		case SID_CHAR_DLG:
 		{
 			const SfxItemSet* pArgs = rReq.GetArgs();
@@ -450,6 +495,10 @@
 
 				SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR,0, sal_True );
 				DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+				if (nSlot == SID_CHAR_DLG_EFFECT)
+				{
+					pDlg->SetCurPageId(TP_CHAR_EXT);
+				}
 				sal_uInt16 nRet = pDlg->Execute();
 				if(RET_OK == nRet )
                 {
@@ -592,6 +641,44 @@
         sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
 		switch( nSlotId )
 		{
+			case SID_ATTR_PARA_LRSPACE:
+			{
+				SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) );
+					aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
+					rSet.Put(aLR);
+				}
+				else
+					rSet.InvalidateItem(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_LINESPACE:
+			{
+				SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL );
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) );
+					rSet.Put(aLR);
+				}
+				else
+					rSet.InvalidateItem(nSlotId);
+			}
+			break;
+			case SID_ATTR_PARA_ULSPACE:
+				{
+					SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE );
+					if( eState >= SFX_ITEM_DEFAULT )
+					{
+						SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
+						aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
+						rSet.Put(aULSpace);
+					}
+					else
+						rSet.InvalidateItem(nSlotId);
+				}
+            		break;
 			case SID_ATTR_CHAR_FONT:
 			case SID_ATTR_CHAR_FONTHEIGHT:
 			case SID_ATTR_CHAR_WEIGHT:
@@ -622,6 +709,8 @@
             case SID_ATTR_CHAR_SHADOWED:  nEEWhich = EE_CHAR_SHADOW;break;
             case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
 			case SID_ATTR_CHAR_LANGUAGE    : nEEWhich = EE_CHAR_LANGUAGE;break;
+			case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break;
+			case SID_ATTR_CHAR_KERNING:	 nEEWhich = EE_CHAR_KERNING;break;
 			case FN_SET_SUPER_SCRIPT:
 			case FN_SET_SUB_SCRIPT:
 			{
@@ -763,7 +852,17 @@
 		}
 
         if(nEEWhich)
+        {
             rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
+		if(nEEWhich == EE_CHAR_KERNING)
+		{
+			SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING, sal_True );
+			if ( eState == SFX_ITEM_DONTCARE )
+			{
+				rSet.InvalidateItem(EE_CHAR_KERNING);
+			}
+		}
+        }
 
         if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
 			rSet.DisableItem( nWhich );
diff --git a/main/sw/source/ui/shells/basesh.cxx b/main/sw/source/ui/shells/basesh.cxx
index a7248ec..53f45ba 100644
--- a/main/sw/source/ui/shells/basesh.cxx
+++ b/main/sw/source/ui/shells/basesh.cxx
@@ -2450,26 +2450,28 @@
 	if(pArgs)
 		pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem );
 
-	switch ( nSlot )
-	{
-		case FN_FORMAT_PAGE_COLUMN_DLG:
-		case FN_FORMAT_PAGE_DLG:
-		{
-			if( !bBackground )
-			{
-				const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
-				const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
-				//temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
-				//z.B. Kopfzeile ausschalten
+    switch ( nSlot )
+    {
+        case FN_FORMAT_PAGE_DLG:
+        case FN_FORMAT_PAGE_COLUMN_DLG:
+        case FN_FORMAT_PAGE_SETTING_DLG:
+        {
+            if( !bBackground )
+            {
+                const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
+                const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
+                //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
+                //z.B. Kopfzeile ausschalten
                 SwView& rTempView = GetView();
-                rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(),
-									nSlot == FN_FORMAT_PAGE_COLUMN_DLG,
-									&rSh );
+                rTempView.GetDocShell()->FormatPage(
+                    rPageDesc.GetName(),
+                    nSlot,
+                    rSh );
                 rTempView.InvalidateRulerPos();
-			}
-		}
-		break;
-		case FN_FORMAT_BORDER_DLG:
+            }
+        }
+        break;
+        case FN_FORMAT_BORDER_DLG:
 		{
 			SfxItemSet	 aSet( rSh.GetAttrPool(),
 							   RES_BOX	  			, RES_SHADOW,
diff --git a/main/sw/source/ui/shells/beziersh.cxx b/main/sw/source/ui/shells/beziersh.cxx
index 565f965..666e455 100644
--- a/main/sw/source/ui/shells/beziersh.cxx
+++ b/main/sw/source/ui/shells/beziersh.cxx
@@ -31,6 +31,7 @@
 #include <svl/eitem.hxx>
 #include <svl/whiter.hxx>
 #include <svx/svdopath.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objface.hxx>
@@ -73,6 +74,8 @@
 	SwWrtShell *pSh = &GetShell();
 	SdrView*	pSdrView = pSh->GetDrawView();
 	pSdrView->SetEliminatePolyPointLimitAngle(1500L);
+
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
 }
 
 /*--------------------------------------------------------------------
@@ -347,6 +350,3 @@
 		nWhich = aIter.NextWhich();
 	}
 }
-
-
-
diff --git a/main/sw/source/ui/shells/drawdlg.cxx b/main/sw/source/ui/shells/drawdlg.cxx
index 5d48623..2f8b5cc 100644
--- a/main/sw/source/ui/shells/drawdlg.cxx
+++ b/main/sw/source/ui/shells/drawdlg.cxx
@@ -108,7 +108,7 @@
             DBG_ASSERT(pDlg, "Dialogdiet fail!");
 			const SvxColorTableItem* pColorItem = (const SvxColorTableItem*)
 									GetView().GetDocShell()->GetItem(SID_COLOR_TABLE);
-			if(pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+			if(pColorItem->GetColorTable() == XColorList::GetStdColorList())
 				pDlg->DontDeleteColorTable();
 			if (pDlg->Execute() == RET_OK)
 			{
@@ -121,12 +121,18 @@
 
 				static sal_uInt16 __READONLY_DATA aInval[] =
 				{
-					SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0
+					SID_ATTR_FILL_STYLE, 
+                    SID_ATTR_FILL_COLOR, 
+                    SID_ATTR_FILL_TRANSPARENCE,
+                    SID_ATTR_FILL_FLOATTRANSPARENCE,
+                    0
 				};
 				SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
 				rBnd.Invalidate(aInval);
 				rBnd.Update(SID_ATTR_FILL_STYLE);
 				rBnd.Update(SID_ATTR_FILL_COLOR);
+				rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
+				rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
 			}
 			delete pDlg;
 		}
@@ -160,8 +166,16 @@
 
 				static sal_uInt16 __READONLY_DATA aInval[] =
 				{
-					SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH,
-					SID_ATTR_LINE_COLOR, 0
+                    SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
+                    SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
+                    SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
+                    SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
+                    SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
+                    SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
+                    SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
+                    SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
+                    SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
+                    0
 				};
 
 				GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
@@ -214,12 +228,17 @@
 			case SID_ATTR_FILL_GRADIENT:
 			case SID_ATTR_FILL_HATCH:
 			case SID_ATTR_FILL_BITMAP:
+			case SID_ATTR_FILL_TRANSPARENCE:
+			case SID_ATTR_FILL_FLOATTRANSPARENCE:
 				pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
 				break;
 			case SID_ATTR_LINE_STYLE:
 			case SID_ATTR_LINE_DASH:
 			case SID_ATTR_LINE_WIDTH:
 			case SID_ATTR_LINE_COLOR:
+            case SID_ATTR_LINE_TRANSPARENCE:
+            case SID_ATTR_LINE_JOINT:
+            case SID_ATTR_LINE_CAP:
 				pDis->Execute(SID_ATTRIBUTES_LINE, sal_False);
 				break;
 		}
diff --git a/main/sw/source/ui/shells/drawsh.cxx b/main/sw/source/ui/shells/drawsh.cxx
index e75fca2..cade3f6 100644
--- a/main/sw/source/ui/shells/drawsh.cxx
+++ b/main/sw/source/ui/shells/drawsh.cxx
@@ -50,6 +50,7 @@
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 
 #include <svx/xtable.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/svdoashp.hxx>
 
 #include "swundo.hxx"
@@ -170,9 +171,11 @@
 			break;
 
         case FN_FLIP_HORZ_GRAFIC:
+        case SID_FLIP_HORIZONTAL:
 			bMirror = sal_False;
 			/* no break */
         case FN_FLIP_VERT_GRAFIC:
+        case SID_FLIP_VERTICAL:
 			rSh.MirrorSelection( bMirror );
 			break;
 
@@ -347,11 +350,13 @@
 			break;
 
 			case FN_FLIP_HORZ_GRAFIC:
+            case SID_FLIP_HORIZONTAL:
 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
 					rSet.DisableItem( nWhich );
 				break;
 
 			case FN_FLIP_VERT_GRAFIC:
+            case SID_FLIP_VERTICAL:
 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
 					rSet.DisableItem( nWhich );
 				break;
@@ -385,6 +390,8 @@
 {
 	SetHelpId(SW_DRAWSHELL);
 	SetName(String::CreateFromAscii("Draw"));
+
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
 }
 
 /*************************************************************************
@@ -491,12 +498,8 @@
 	else
 	{
 		if ( pDlg )
-			pDlg->SetColorTable(XColorTable::GetStdColorTable());
+			pDlg->SetColorTable(XColorList::GetStdColorList());
 
 		pDrView->GetAttributes( rSet );
 	}
 }
-
-
-
-
diff --git a/main/sw/source/ui/shells/drformsh.cxx b/main/sw/source/ui/shells/drformsh.cxx
index fc5bc63..dade571 100644
--- a/main/sw/source/ui/shells/drformsh.cxx
+++ b/main/sw/source/ui/shells/drformsh.cxx
@@ -35,6 +35,7 @@
 #include <sfx2/app.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/srchitem.hxx>
 #include <svx/fmglob.hxx>
 #include <svx/svdouno.hxx>
@@ -262,11 +263,9 @@
 	SetHelpId(SW_DRAWFORMSHELL);
 	GetShell().NoEdit(sal_True);
 	SetName(String::CreateFromAscii("DrawForm"));
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
 }
 
 SwDrawFormShell::~SwDrawFormShell()
 {
 }
-
-
-
diff --git a/main/sw/source/ui/shells/drwbassh.cxx b/main/sw/source/ui/shells/drwbassh.cxx
index 365ce78..2390a1a 100644
--- a/main/sw/source/ui/shells/drwbassh.cxx
+++ b/main/sw/source/ui/shells/drwbassh.cxx
@@ -382,6 +382,10 @@
 
 					}
 				}
+                else
+                {
+                    pSdrView->SetGeoAttrToMarked( *pArgs );
+                }
 			}
 		}
 		break;
@@ -770,9 +774,19 @@
 	}
 }
 
-/*--------------------------------------------------------------------
-	Beschreibung:
- --------------------------------------------------------------------*/
+
+void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
+{
+ 	SwWrtShell *pSh = &GetShell();
+ 	SdrView*	pSdrView = pSh->GetDrawView();
+ 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ 	if( rMarkList.GetMark(0) != 0 )
+ 	{
+ 		SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();//OST_IFBX@WL2
+ 		SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
+ 		rSet.Put(aNewAttr,false);
+ 	}
+}
 
 
 sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
@@ -990,7 +1004,3 @@
         pValidation->nHeight = pValidation->nMaxHeight;
     return 0;
 }
-
-
-
-
diff --git a/main/sw/source/ui/shells/drwtxtex.cxx b/main/sw/source/ui/shells/drwtxtex.cxx
index 48770f4..7642b97 100644
--- a/main/sw/source/ui/shells/drwtxtex.cxx
+++ b/main/sw/source/ui/shells/drwtxtex.cxx
@@ -34,6 +34,8 @@
 #include <tools/shl.hxx>
 #include <svx/svdview.hxx>
 #include <editeng/spltitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
 #include <editeng/orphitem.hxx>
 #include <editeng/brkitem.hxx>
 #include <editeng/widwitem.hxx>
@@ -236,6 +238,33 @@
 		case SID_ATTR_PARA_ADJUST_BLOCK:
 			aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
         break;
+		case SID_ATTR_PARA_LRSPACE:
+			{
+				SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
+										GetArgs()->Get(nSlot));
+				aParaMargin.SetWhich( EE_PARA_LRSPACE );
+				aNewAttr.Put(aParaMargin);
+				rReq.Done();
+			}
+			break;
+		case SID_ATTR_PARA_LINESPACE:
+			{
+				SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get(
+															GetPool().GetWhich(nSlot));
+				aLineSpace.SetWhich( EE_PARA_SBL );
+				aNewAttr.Put( aLineSpace );
+				rReq.Done();
+			}
+			break;
+		case SID_ATTR_PARA_ULSPACE:
+			{
+				SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
+					GetPool().GetWhich(nSlot));
+				aULSpace.SetWhich( EE_PARA_ULSPACE );
+				aNewAttr.Put( aULSpace );
+				rReq.Done();
+			}
+			break;
 
 		case SID_ATTR_PARA_LINESPACE_10:
 		{
@@ -286,6 +315,7 @@
 		}
 		break;
 
+		case SID_CHAR_DLG_EFFECT: 
 		case SID_CHAR_DLG:
 		case SID_CHAR_DLG_FOR_PARAGRAPH:
 		{
@@ -317,6 +347,10 @@
 
                 SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True );
                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
+				if (nSlot == SID_CHAR_DLG_EFFECT)
+				{
+					pDlg->SetCurPageId(TP_CHAR_EXT);
+				}
 				sal_uInt16 nRet = pDlg->Execute();
 				if(RET_OK == nRet )
                 {
@@ -635,6 +669,49 @@
 			}
 			break;
 
+		case SID_ATTR_PARA_LRSPACE:
+			{
+				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
+					aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
+					rSet.Put(aLR);
+				}
+				else
+					rSet.InvalidateItem(nSlotId);
+				nSlotId = 0;
+			}
+			break;
+		case SID_ATTR_PARA_LINESPACE:
+			{
+				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL );
+					rSet.Put(aLR);
+				}
+				else
+					rSet.InvalidateItem(nSlotId);
+				nSlotId = 0;
+			}
+			break;
+		case SID_ATTR_PARA_ULSPACE:
+			{
+				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
+					aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
+					rSet.Put(aULSpace);
+				}
+				else
+					rSet.InvalidateItem(nSlotId);
+				Invalidate(SID_ATTR_PARA_ULSPACE);
+				nSlotId = 0;
+			}
+			break;
+
 		case SID_ATTR_PARA_LINESPACE_10:	nLSpace = 100;	goto ASK_LINESPACE;
 		case SID_ATTR_PARA_LINESPACE_15:	nLSpace = 150;	goto ASK_LINESPACE;
 		case SID_ATTR_PARA_LINESPACE_20:	nLSpace = 200;	goto ASK_LINESPACE;
diff --git a/main/sw/source/ui/shells/drwtxtsh.cxx b/main/sw/source/ui/shells/drwtxtsh.cxx
index bd109fb..46beace 100644
--- a/main/sw/source/ui/shells/drwtxtsh.cxx
+++ b/main/sw/source/ui/shells/drwtxtsh.cxx
@@ -43,6 +43,7 @@
 #include <sfx2/bindings.hxx>
 #include <svx/fontwork.hxx>
 #include <sfx2/request.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/editstat.hxx>
@@ -156,6 +157,7 @@
 	rSh.NoEdit(sal_True);
 	SetName(String::CreateFromAscii("ObjectText"));
 	SetHelpId(SW_DRWTXTSHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText));
 }
 
 /*--------------------------------------------------------------------
@@ -375,7 +377,7 @@
 	else
 	{
 		if ( pDlg )
-			pDlg->SetColorTable(XColorTable::GetStdColorTable());
+			pDlg->SetColorTable(XColorList::GetStdColorList());
 
 		pDrView->GetAttributes( rSet );
 	}
@@ -589,6 +591,28 @@
 				}
 			}
 			break;
+		case SID_TABLE_VERT_NONE:
+		case SID_TABLE_VERT_CENTER:
+		case SID_TABLE_VERT_BOTTOM:
+			{
+				sal_uInt16 nSId = rReq.GetSlot();
+				if (pSdrView->AreObjectsMarked())
+				{
+					SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
+					if (nSId == SID_TABLE_VERT_CENTER)
+						eTVA = SDRTEXTVERTADJUST_CENTER;
+					else if (nSId == SID_TABLE_VERT_BOTTOM)
+						eTVA = SDRTEXTVERTADJUST_BOTTOM;
+
+					SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
+					pSdrView->GetAttributes( aNewAttr );
+					aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
+					pSdrView->SetAttributes(aNewAttr);
+					rReq.Done();
+				}
+	                    
+			}
+			break;
 
 		default:
 			ASSERT(!this, "unexpected slot-id");
@@ -910,5 +934,53 @@
     return &pOutliner->GetUndoManager();
 }
 
+void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet)
+{
+	SfxWhichIter	aIter( rSet );
+	sal_uInt16 nWhich = aIter.FirstWhich();
+	
+	SwWrtShell &rSh = GetShell();
+	pSdrView = rSh.GetDrawView();
 
+	SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() );
+	pSdrView->GetAttributes( aAttrs );
+	
+	while ( nWhich )
+	{
+		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
+			? GetPool().GetSlotId(nWhich)
+			: nWhich; 
+		switch ( nSlotId )
+		{
+			case SID_TABLE_VERT_NONE:
+			case SID_TABLE_VERT_CENTER:
+			case SID_TABLE_VERT_BOTTOM:
+				sal_Bool bContour = sal_False;
+				SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
+				if( eConState != SFX_ITEM_DONTCARE )
+				{
+					bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
+				}
+				if (bContour) break;
 
+				SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
+				//SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
+
+				//if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
+				if(SFX_ITEM_DONTCARE != eVState)
+				{					
+					SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
+					sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP||
+                            nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER ||
+                            nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM;
+					rSet.Put(SfxBoolItem(nSlotId, bSet));
+				}
+				else 
+				{
+					rSet.Put(SfxBoolItem(nSlotId, sal_False));
+				}
+				break;	
+		}
+		nWhich = aIter.NextWhich();
+	}	
+}
diff --git a/main/sw/source/ui/shells/frmsh.cxx b/main/sw/source/ui/shells/frmsh.cxx
index 6f6a420..adbab97 100644
--- a/main/sw/source/ui/shells/frmsh.cxx
+++ b/main/sw/source/ui/shells/frmsh.cxx
@@ -35,6 +35,8 @@
 #include <svl/rectitem.hxx>
 #include <svl/ptitem.hxx>
 #include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
 #include <editeng/colritem.hxx>
 #include <editeng/bolnitem.hxx>
 #include <editeng/boxitem.hxx>
@@ -42,6 +44,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/objface.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/hlnkitem.hxx>
 // --> OD 2009-07-07 #i73249#
 #include <svx/svdview.hxx>
@@ -382,7 +385,38 @@
 			}
 		}
 		break;
-		case FN_FORMAT_FRAME_DLG:
+
+        case SID_ATTR_TRANSFORM:
+        {
+            bool bApplyNewSize = false;
+
+            Size aNewSize = aMgr.GetSize();
+            if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, sal_False, &pItem ) )
+            {
+                aNewSize.setWidth( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
+                bApplyNewSize = true;
+            }
+
+            if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_HEIGHT, sal_False, &pItem ) )
+            {
+                aNewSize.setHeight( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
+                bApplyNewSize = true;
+            }
+
+            if ( bApplyNewSize )
+            {
+                aMgr.SetSize( aNewSize );
+            }
+            else
+            {
+                bUpdateMgr = sal_False;
+            }
+
+        }
+        break;
+
+        case FN_FORMAT_FRAME_DLG:
+        case FN_PROPERTY_WRAP_DLG:
 		{
 			const int nSel = rSh.GetSelectionType();
 			if (nSel & nsSelectionType::SEL_GRF)
@@ -392,34 +426,31 @@
 			}
 			else
 			{
-				SfxItemSet aSet(GetPool(), 	RES_FRMATR_BEGIN, 		RES_FRMATR_END-1,
-											SID_ATTR_BORDER_INNER, 	SID_ATTR_BORDER_INNER,
-											FN_GET_PRINT_AREA, 		FN_GET_PRINT_AREA,
-											SID_ATTR_PAGE_SIZE, 	SID_ATTR_PAGE_SIZE,
-											SID_ATTR_BRUSH, 		SID_ATTR_BRUSH,
-											SID_ATTR_LRSPACE,		SID_ATTR_ULSPACE,
-											FN_SURROUND, 			FN_HORI_ORIENT,
-											FN_SET_FRM_NAME, 		FN_SET_FRM_NAME,
-											FN_KEEP_ASPECT_RATIO, 	FN_KEEP_ASPECT_RATIO,
-											SID_DOCFRAME, 			SID_DOCFRAME,
-											SID_HTML_MODE, 			SID_HTML_MODE,
-											FN_SET_FRM_ALT_NAME, 	FN_SET_FRM_ALT_NAME,
+                SfxItemSet aSet(GetPool(), 	RES_FRMATR_BEGIN, 		RES_FRMATR_END-1,
+                                            SID_ATTR_BORDER_INNER, 	SID_ATTR_BORDER_INNER,
+                                            FN_GET_PRINT_AREA, 		FN_GET_PRINT_AREA,
+                                            SID_ATTR_PAGE_SIZE, 	SID_ATTR_PAGE_SIZE,
+                                            SID_ATTR_BRUSH, 		SID_ATTR_BRUSH,
+                                            SID_ATTR_LRSPACE,		SID_ATTR_ULSPACE,
+                                            FN_SURROUND, 			FN_HORI_ORIENT,
+                                            FN_SET_FRM_NAME, 		FN_SET_FRM_NAME,
+                                            FN_KEEP_ASPECT_RATIO, 	FN_KEEP_ASPECT_RATIO,
+                                            SID_DOCFRAME, 			SID_DOCFRAME,
+                                            SID_HTML_MODE, 			SID_HTML_MODE,
+                                            FN_SET_FRM_ALT_NAME, 	FN_SET_FRM_ALT_NAME,
                                             FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT,
                                             FN_OLE_IS_MATH,         FN_OLE_IS_MATH,
                                             FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT,
                                             0);
 
-				const SwViewOption* pVOpt = rSh.GetViewOptions();
-				if(nSel & nsSelectionType::SEL_OLE)
+                const SwViewOption* pVOpt = rSh.GetViewOptions();
+                if(nSel & nsSelectionType::SEL_OLE)
                     aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
-				aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
-				aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
+                aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+                aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
                 if( nSel & nsSelectionType::SEL_OLE )
                 {
-                    // --> OD 2009-07-13 #i73249#
-//                    aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
                     aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
-                    // <--
                 }
 
 				const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
@@ -468,6 +499,11 @@
 														nDefPage);
                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
 
+                if ( nSlot == FN_PROPERTY_WRAP_DLG )
+                {
+                    pDlg->SetCurPageId(TP_FRM_WRAP);
+                }
+
 				if ( pDlg->Execute() )
 				{
 					const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
@@ -634,21 +670,22 @@
         }
         break;
         // <--
-		default:
-			ASSERT( !this, "falscher Dispatcher" );
-			return;
-	}
-	// Vorlagen-AutoUpdate
-	SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
-	if ( bUpdateMgr )
-	{
-		if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt())
-		{
-			rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
-		}
-		else
-			aMgr.UpdateFlyFrm();
-	}
+        default:
+            ASSERT( !this, "falscher Dispatcher" );
+            return;
+    }
+    if ( bUpdateMgr )
+    {
+        SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+        if ( bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt() )
+        {
+            rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
+        }
+        else
+        {
+            aMgr.UpdateFlyFrm();
+        }
+    }
 
 }
 
@@ -862,14 +899,48 @@
                     if ( bParentCntProt )
                         rSet.DisableItem( nWhich );
                 break;
+
+                case SID_ATTR_TRANSFORM:
+                {
+                    rSet.DisableItem( nWhich );
+                }
+                break;
+
+                case SID_ATTR_TRANSFORM_PROTECT_SIZE:
+                {
+                    const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE );
+                    if ( ( eProtection & FLYPROTECT_CONTENT ) ||
+                         ( eProtection & FLYPROTECT_SIZE ) )
+                    {
+                        rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True ) );
+                    }
+                    else
+                    {
+                        rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_False ) );
+                    }
+                }
+                break;
+
+                case SID_ATTR_TRANSFORM_WIDTH:
+                {
+                    rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
+                }
+                break;
+
+                case SID_ATTR_TRANSFORM_HEIGHT:
+                {
+                    rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
+                }
+                break;
+
                 case FN_FORMAT_FRAME_DLG:
                 {
                     const int nSel = rSh.GetSelectionType();
                     if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF)
-						rSet.DisableItem( nWhich );
+                        rSet.DisableItem( nWhich );
                 }
                 break;
-                // --> OD 2009-07-07 #i73249#
+
                 case FN_TITLE_DESCRIPTION_SHAPE:
                 {
                     SwWrtShell &rWrtSh = GetShell();
@@ -882,14 +953,14 @@
 
                 }
                 break;
-                // <--
-				default:
-					/* do nothing */;
-					break;
-			}
-			nWhich = aIter.NextWhich();
-		}
-	}
+
+                default:
+                    /* do nothing */;
+                    break;
+            }
+            nWhich = aIter.NextWhich();
+        }
+    }
 }
 
 /*--------------------------------------------------------------------
@@ -906,6 +977,8 @@
 	/* #96392# Use this to announce it is the frame shell who creates the
        selection. */
     SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this );
+
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame));
 }
 
 SwFrameShell::~SwFrameShell()
@@ -1148,4 +1221,3 @@
 	if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE))
 		rSet.DisableItem(FN_INSERT_FRAME);
 }
-
diff --git a/main/sw/source/ui/shells/grfsh.cxx b/main/sw/source/ui/shells/grfsh.cxx
index f5a1145..3402359 100644
--- a/main/sw/source/ui/shells/grfsh.cxx
+++ b/main/sw/source/ui/shells/grfsh.cxx
@@ -43,6 +43,7 @@
 #include <editeng/sizeitem.hxx>
 #include <editeng/protitem.hxx>
 #include <sfx2/request.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svl/srchitem.hxx>
 #include <svx/htmlmode.hxx>
 #include <svx/sdgluitm.hxx>
@@ -113,6 +114,7 @@
         break;
 		case SID_INSERT_GRAPHIC:
 		case FN_FORMAT_GRAFIC_DLG:
+		case FN_PROPERTY_WRAP_DLG:
 		{
 			SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ?
 											   FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
@@ -149,10 +151,7 @@
 			aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
             if ( nSlot == FN_FORMAT_GRAFIC_DLG )
             {
-                // --> OD 2009-07-13 #i73249#
-//                aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
                 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
-                // <--
             }
 
 			pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
@@ -230,6 +229,10 @@
 													GetView().GetWindow(),
 													aSet, sal_False, DLG_FRM_GRF);
             DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+            if (nSlot == FN_PROPERTY_WRAP_DLG)
+                pDlg->SetCurPageId(TP_FRM_WRAP);
+            
 			if( pDlg->Execute() )
 			{
 				rSh.StartAllAction();
@@ -381,12 +384,14 @@
 		{
 			case FN_FLIP_VERT_GRAFIC:
 			case FN_FLIP_HORZ_GRAFIC:
+            case SID_FLIP_VERTICAL:
+            case SID_FLIP_HORIZONTAL:
 			{
                 GetShell().GetCurAttr( aGrfSet );
 				SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get(
 													RES_GRFATR_MIRRORGRF ) );
 				sal_uInt16 nMirror = aMirror.GetValue();
-				if( FN_FLIP_VERT_GRAFIC == nSlot )
+				if( FN_FLIP_VERT_GRAFIC == nSlot || nSlot==SID_FLIP_VERTICAL )
 					switch( nMirror )
 					{
                     case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT;
@@ -692,4 +697,5 @@
 {
 	SetName(String::CreateFromAscii("Graphic"));
 	SetHelpId(SW_GRFSHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
 }
diff --git a/main/sw/source/ui/shells/mediash.cxx b/main/sw/source/ui/shells/mediash.cxx
index bbacabe..610363a 100644
--- a/main/sw/source/ui/shells/mediash.cxx
+++ b/main/sw/source/ui/shells/mediash.cxx
@@ -75,6 +75,7 @@
 #endif
 
 #include <sfx2/objface.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
 #include <avmedia/mediaitem.hxx>
@@ -215,4 +216,5 @@
 {
 	SetName(String::CreateFromAscii("Media Playback"));
 	SetHelpId(SW_MEDIASHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
 }
diff --git a/main/sw/source/ui/shells/olesh.cxx b/main/sw/source/ui/shells/olesh.cxx
index b059d12..90afce3 100644
--- a/main/sw/source/ui/shells/olesh.cxx
+++ b/main/sw/source/ui/shells/olesh.cxx
@@ -29,6 +29,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/objitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <wrtsh.hxx>
 #include <view.hxx>
 #ifndef _HELPID_H
@@ -71,6 +72,5 @@
 {
 	SetName(String::CreateFromAscii("Object"));
 	SetHelpId(SW_OLESHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE));
 }
-
-
diff --git a/main/sw/source/ui/shells/slotadd.cxx b/main/sw/source/ui/shells/slotadd.cxx
index 345b517..7326f36 100644
--- a/main/sw/source/ui/shells/slotadd.cxx
+++ b/main/sw/source/ui/shells/slotadd.cxx
@@ -138,6 +138,11 @@
 #define SvxDrawBezierItem SfxAllEnumItem
 #define avmedia_MediaItem ::avmedia::MediaItem
 
+#include <svx/xflftrit.hxx>
+#include <svx/xlncapit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/AffineMatrixItem.hxx>
+
 #define SFX_TYPEMAP
 #include <sfx2/msg.hxx>
 #include "swslots.hxx"
diff --git a/main/sw/source/ui/shells/tabsh.cxx b/main/sw/source/ui/shells/tabsh.cxx
index 77e921f..f75ea5a 100644
--- a/main/sw/source/ui/shells/tabsh.cxx
+++ b/main/sw/source/ui/shells/tabsh.cxx
@@ -54,6 +54,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objface.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 
 
 #include <fmtornt.hxx>
@@ -1178,17 +1179,18 @@
 			aMgr.ColWidthDlg(GetView().GetWindow());
 		}
 		break;
-        case FN_TABLE_VERT_NONE:
-		case FN_TABLE_VERT_CENTER:
-		case FN_TABLE_VERT_BOTTOM:
+		case SID_TABLE_VERT_NONE:
+		case SID_TABLE_VERT_CENTER:
+		case SID_TABLE_VERT_BOTTOM:
 		{
-			sal_uInt16 nAlign = nSlot == FN_TABLE_VERT_NONE ?
+				sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
                                 text::VertOrientation::NONE :
-									nSlot == FN_TABLE_VERT_CENTER ?
+									nSlot == SID_TABLE_VERT_CENTER ?
                                         text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
 			rSh.SetBoxAlign(nAlign);
-            bCallDone = sal_True;
-        }
+			bCallDone = sal_True;
+
+		}
 		break;
 
 		case SID_ATTR_PARA_SPLIT:
@@ -1321,17 +1323,18 @@
 			case RES_UL_SPACE:
                 rSet.Put(pFmt->GetULSpace());
 			break;
-			case FN_TABLE_VERT_NONE:
-			case FN_TABLE_VERT_CENTER:
-			case FN_TABLE_VERT_BOTTOM:
-			{
-				sal_uInt16 nAlign = rSh.GetBoxAlign();
-                sal_Bool bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
-                            (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
-                            (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
-				rSet.Put(SfxBoolItem(nSlot, bSet));
-			}
-			break;
+
+            case SID_TABLE_VERT_NONE:
+            case SID_TABLE_VERT_CENTER:
+            case SID_TABLE_VERT_BOTTOM:
+            {
+                sal_uInt16 nAlign = rSh.GetBoxAlign();
+                sal_Bool bSet = nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE||
+                            nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER ||
+                            nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM;
+                rSet.Put(SfxBoolItem(nSlot, bSet));
+            }
+            break;
 
 			case FN_TABLE_MODE_FIX       :
 			case FN_TABLE_MODE_FIX_PROP  :
@@ -1433,6 +1436,7 @@
 {
 	SetName(String::CreateFromAscii("Table"));
 	SetHelpId(SW_TABSHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
 }
 
 /*--------------------------------------------------------------------
@@ -1591,4 +1595,3 @@
 	}
 
 }
-
diff --git a/main/sw/source/ui/shells/textsh.cxx b/main/sw/source/ui/shells/textsh.cxx
index 686b6f8..6481a41 100644
--- a/main/sw/source/ui/shells/textsh.cxx
+++ b/main/sw/source/ui/shells/textsh.cxx
@@ -108,6 +108,7 @@
 #define TextFont
 #define DropCap
 #include <sfx2/msg.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
 #include <swslots.hxx>
 #include <SwRewriter.hxx>
 #include <comcore.hrc>
@@ -1027,6 +1028,7 @@
 {
 	SetName(String::CreateFromAscii("Text"));
 	SetHelpId(SW_TEXTSHELL);
+    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text));
 }
 
 /*--------------------------------------------------------------------
@@ -1214,5 +1216,3 @@
         }
     }
 }
-
-
diff --git a/main/sw/source/ui/shells/textsh1.cxx b/main/sw/source/ui/shells/textsh1.cxx
index f28c6ea..2e4b2c1 100644
--- a/main/sw/source/ui/shells/textsh1.cxx
+++ b/main/sw/source/ui/shells/textsh1.cxx
@@ -126,7 +126,19 @@
 #include <sfx2/objface.hxx>
 #include <langhelper.hxx>
 
+#ifndef _NBDTMGFACT_HXX
+#include <svx/nbdtmgfact.hxx>
+#endif
+#ifndef _NBDTMG_HXX
+#include <svx/nbdtmg.hxx>
+#endif
+
+
+#include <numrule.hxx>
+
+
 using namespace ::com::sun::star;
+using namespace svx::sidebar;
 
 
 void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
@@ -185,6 +197,10 @@
 		if( FN_INSERT_HYPERLINK == nSlot )
 			pDlg->SetCurPageId(TP_CHAR_URL);
 	}
+	if (nSlot == SID_CHAR_DLG_EFFECT)
+	{
+		pDlg->SetCurPageId(TP_CHAR_EXT);
+	}
 
 	const SfxItemSet* pSet = NULL;
 	if ( !bUseDialog )
@@ -838,6 +854,7 @@
             // intentionally no break
         }
 		case SID_CHAR_DLG:
+		case SID_CHAR_DLG_EFFECT:
 		{
             lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
 		}
@@ -862,6 +879,7 @@
         case FN_NUMBER_NEWSTART_AT :
         case FN_FORMAT_DROPCAPS :
         case FN_DROP_TEXT:
+        case SID_ATTR_PARA_LRSPACE:
         {
             sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
             if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
@@ -952,7 +970,15 @@
             SfxItemSet* pSet = NULL;
             if ( !bUseDialog )
             {
-                pSet = (SfxItemSet*) pArgs;
+                if ( nSlot == SID_ATTR_PARA_LRSPACE)
+		{
+			SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot));
+			aParaMargin.SetWhich( RES_LR_SPACE);
+			aCoreSet.Put(aParaMargin);
+			pSet = &aCoreSet;
+
+		} else
+                    pSet = (SfxItemSet*) pArgs;
 
             }
             else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
@@ -1023,14 +1049,14 @@
                     //SetNumRuleStart(sal_True) restarts the numbering at the value
                     //that is defined at the starting point of the numbering level
                     //otherwise the SetNodeNumStart() value determines the start
-                    //if it's set to something different than USHRT_MAX
+                    //if it's set to something different than (sal_uInt16)0xFFFF
 
                     sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
                     // --> OD 2007-06-11 #b6560525#
-                    // Default value for restart value has to be USHRT_MAX
+                    // Default value for restart value has to be (sal_uInt16)0xFFFF
                     // in order to indicate that the restart value of the list
                     // style has to be used on restart.
-                    sal_uInt16 nNumStart = USHRT_MAX;
+                    sal_uInt16 nNumStart = (sal_uInt16)0xFFFF;
                     // <--
 					if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
                     {
@@ -1677,6 +1703,51 @@
                      rSet.DisableItem(nWhich);
             }
             break;
+            case FN_NUM_NUMBERING_ON:
+                rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
+            break;
+            case FN_NUM_BULLET_ON:
+                rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
+            break;
+            case FN_BUL_NUM_RULE_INDEX:
+            case FN_NUM_NUM_RULE_INDEX:
+		{				
+			SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule());	
+			sal_uInt16	nActNumLvl = (sal_uInt16)0xFFFF;
+			rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
+			rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
+			if( pCurRule )
+			{					
+				nActNumLvl = GetShell().GetNumLevel();
+				if( nActNumLvl < MAXLEVEL )
+				{
+					nActNumLvl = 1<<nActNumLvl;						
+				}
+				SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
+				if ( GetShell().HasBullet())
+				{
+					rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+					rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+					NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
+					if ( pBullets )
+					{
+						sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
+						rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
+					}
+				}else if ( GetShell().HasNumber() )
+				{
+					rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+					rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
+					NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
+					if ( pNumbering )
+					{
+						sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
+						rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
+					}
+				}
+			}
+		}
+            break;
             case FN_NUM_CONTINUE:
             {
                 // --> OD 2009-08-26 #i86492#
@@ -1775,7 +1846,7 @@
 
                 if( !bCrsrSet && bOn )
                     bCrsrSet = rSh.SetCrsrInHdFt(
-                            !rStyleName.Len() ? USHRT_MAX : nFrom,
+                            !rStyleName.Len() ? (sal_uInt16)0xFFFF : nFrom,
                             bHeader );
             }
         }
diff --git a/main/sw/source/ui/shells/txtattr.cxx b/main/sw/source/ui/shells/txtattr.cxx
index 09d4c85..229cf69 100644
--- a/main/sw/source/ui/shells/txtattr.cxx
+++ b/main/sw/source/ui/shells/txtattr.cxx
@@ -40,6 +40,7 @@
 #include <editeng/fhgtitem.hxx>
 #include <editeng/adjitem.hxx>
 #include <editeng/lspcitem.hxx>
+#include <editeng/lrspitem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/escpitem.hxx>
 #include <svx/htmlmode.hxx>
@@ -745,6 +746,19 @@
 					rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST ));
 				nSlot = 0;
 			break;
+			case SID_ATTR_PARA_LRSPACE:
+			{
+				eState = aCoreSet.GetItemState(RES_LR_SPACE);
+				if( eState >= SFX_ITEM_DEFAULT )
+				{
+					SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) );
+					aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
+					rSet.Put(aLR);					
+				}
+				else
+					rSet.InvalidateItem(nSlot);
+				nSlot = 0;
+			}
 
             case SID_ATTR_PARA_LEFT_TO_RIGHT :
             case SID_ATTR_PARA_RIGHT_TO_LEFT :
diff --git a/main/sw/source/ui/shells/txtnum.cxx b/main/sw/source/ui/shells/txtnum.cxx
index b4dee2a..f675c89 100644
--- a/main/sw/source/ui/shells/txtnum.cxx
+++ b/main/sw/source/ui/shells/txtnum.cxx
@@ -46,6 +46,11 @@
 #include "swabstdlg.hxx"
 #include <globals.hrc>
 #include <sfx2/tabdlg.hxx>
+#include <svx/nbdtmg.hxx>
+#include <svx/nbdtmgfact.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+using namespace svx::sidebar;
 
 void SwTextShell::ExecEnterNum(SfxRequest &rReq)
 {
@@ -54,43 +59,64 @@
 	{
 	case FN_NUM_NUMBERING_ON:
 	{
-        SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
-        sal_Bool bMode = !GetShell().HasNumber(); // #i29560#
-        if ( pItem )
-            bMode = pItem->GetValue();
-        else
-            rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
+		GetShell().StartAllAction();
+		SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
+		sal_Bool bMode = !GetShell().SelectionHasNumber(); // #i29560#
+		if ( pItem )
+			bMode = pItem->GetValue();
+		else
+			rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
 
-        if ( bMode != (GetShell().HasNumber()) ) // #i29560#
-        {
-            rReq.Done();
-            if( bMode )
-                GetShell().NumOn();
-            else
-                GetShell().NumOrBulletOff(); // #i29560#
-        }
+		if ( bMode != (GetShell().SelectionHasNumber()) ) // #i29560#
+		{
+			rReq.Done();
+			if( bMode )
+				GetShell().NumOn();
+			else
+				GetShell().NumOrBulletOff(); // #i29560#
+		}
+		sal_Bool bNewResult = GetShell().SelectionHasNumber();
+		if (bNewResult!=bMode) {
+			SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
+			SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult);
+			rBindings.SetState(aItem);
+			SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult);
+			rBindings.SetState(aNewItem);
+		}
+		GetShell().EndAllAction();
 	}
 	break;
 	case FN_NUM_BULLET_ON:
 	{
-        SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
-        sal_Bool bMode = !GetShell().HasBullet(); // #i29560#
-        if ( pItem )
-            bMode = pItem->GetValue();
-        else
-            rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
+		GetShell().StartAllAction();
+		SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
+		sal_Bool bMode = !GetShell().SelectionHasBullet(); // #i29560#
+		if ( pItem )
+			bMode = pItem->GetValue();
+		else
+			rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
 
-        if ( bMode != (GetShell().HasBullet()) ) // #i29560#
-        {
-            rReq.Done();
-            if( bMode )
-                GetShell().BulletOn();
-            else
-                GetShell().NumOrBulletOff(); // #i29560#
-        }
+		if ( bMode != (GetShell().SelectionHasBullet()) ) // #i29560#
+		{
+			rReq.Done();
+			if( bMode )
+				GetShell().BulletOn();
+			else
+				GetShell().NumOrBulletOff(); // #i29560#
+		}
+		sal_Bool bNewResult = GetShell().SelectionHasBullet();
+		if (bNewResult!=bMode) {
+			SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
+			SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult);
+			rBindings.SetState(aItem);
+			SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult);
+			rBindings.SetState(aNewItem);
+		}
+		GetShell().EndAllAction();
 	}
 	break;
 	case FN_NUMBER_BULLETS:
+	case SID_OUTLINE_BULLET:
 	{
         // --> OD 2008-02-29 #refactorlists#
 //        // per default sal_True, damit die Schleife im Dialog richtig arbeitet!
@@ -244,4 +270,179 @@
 	}
 }
 
+void SwTextShell::ExecSetNumber(SfxRequest &rReq)
+{	
+	SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
+						 // --> OD 2008-06-06 #i89178#
+						 numfunc::GetDefaultPositionAndSpaceMode() );
+						 // <--
+	
+	SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
+    const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
 
+    if( bRightToLeft )
+	{
+        for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+		{
+			SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
+           /* if ( n && bHtml )
+            {
+                // 1/2" fuer HTML
+                aFmt.SetLSpace(720);
+                aFmt.SetAbsLSpace(n * 720);
+            }*/
+            // --> FME 2005-01-21 #i38904#  Default alignment for
+            // numbering/bullet should be rtl in rtl paragraph:
+            if ( bRightToLeft )
+            {
+                aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+            }
+            // <--
+            aSvxRule.SetLevel( n, aFmt, sal_False );
+		}
+		aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False);
+	}	
+
+	const SwNumRule* pCurRule = GetShell().GetCurNumRule();	
+	sal_uInt16		nActNumLvl = (sal_uInt16)0xFFFF;
+	if( pCurRule )
+	{		
+		sal_uInt16 nLevel = GetShell().GetNumLevel();
+     	if( nLevel < MAXLEVEL )
+		{
+			nActNumLvl = 1<<nLevel;			
+		}
+		
+		aSvxRule = pCurRule->MakeSvxNumRule();
+
+		//convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
+		for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
+		{
+			SvxNumberFormat aFmt(aSvxRule.GetLevel(i));
+			if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
+			{
+				const SvxBrushItem* pBrush = aFmt.GetBrush();
+				const String* pLinkStr;
+				if(pBrush &&
+					0 != (pLinkStr = pBrush->GetGraphicLink()) &&
+						pLinkStr->Len())
+					aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
+				aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
+			}
+		}
+	}
+	
+
+	switch(rReq.GetSlot())
+	{
+	case FN_SVX_SET_NUMBER:
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False );
+			if (pItem)
+			{
+				sal_uInt16 nIdx = pItem->GetValue();
+				if (nIdx==DEFAULT_NONE) {
+					GetShell().DelNumRules();
+					break;
+				}
+				--nIdx;
+
+				NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
+				if ( pNumbering )
+				{
+					SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),						
+						 numfunc::GetDefaultPositionAndSpaceMode() );
+	
+					SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
+					//Sym3_2508, set unit attribute to NB Manager
+					SfxItemSet aSet(GetPool(),
+							SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
+							0 );
+					aSet.Put(SvxNumBulletItem(aTempRule));
+					pNumbering->SetItems(&aSet);
+					pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
+					
+					sal_uInt16 nMask = 1;
+					for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
+					{
+						if(nActNumLvl & nMask)
+						{
+							SvxNumberFormat aFmt(aTempRule.GetLevel(i));							
+							aSvxRule.SetLevel(i, aFmt);
+						}
+						nMask <<= 1 ;
+					}
+
+					aSvxRule.UnLinkGraphics();
+					SwNumRule aSetRule( pCurRule
+											? pCurRule->GetName()
+											: GetShell().GetUniqueNumRuleName(),
+										numfunc::GetDefaultPositionAndSpaceMode() );
+					aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
+
+					aSetRule.SetAutoRule( sal_True );
+					const bool bCreateList = (pCurRule == 0);
+					GetShell().SetCurNumRule( aSetRule, bCreateList );
+				}
+				//End
+			}
+			break;
+		}
+	case FN_SVX_SET_BULLET:
+		{
+			SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False );
+			if (pItem)
+			{
+				sal_uInt16 nIdx = pItem->GetValue();
+				if (nIdx==DEFAULT_NONE) {
+					GetShell().DelNumRules();
+					break;
+				}
+				nIdx--;
+				
+				NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
+				if ( pBullets )
+				{
+					SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),						
+						 numfunc::GetDefaultPositionAndSpaceMode() );
+	
+					SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
+					//Sym3_2508, set unit attribute to NB Manager
+					SfxItemSet aSet(GetPool(),
+							SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
+							0 );
+					aSet.Put(SvxNumBulletItem(aTempRule));
+					pBullets->SetItems(&aSet);
+					
+					//SvxNumRule aTempRule( 0, 10, false );
+					pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
+					sal_uInt16 nMask = 1;
+					for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
+					{
+						if(nActNumLvl & nMask)
+						{
+							SvxNumberFormat aFmt(aTempRule.GetLevel(i));							
+							aSvxRule.SetLevel(i, aFmt);
+						}
+						nMask <<= 1;
+					}					
+					aSvxRule.UnLinkGraphics();
+					
+					SwNumRule aSetRule( pCurRule
+											? pCurRule->GetName()
+											: GetShell().GetUniqueNumRuleName(),										
+										numfunc::GetDefaultPositionAndSpaceMode() );										
+					
+					aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
+
+					aSetRule.SetAutoRule( sal_True );
+					const bool bCreateList = (pCurRule == 0);
+					GetShell().SetCurNumRule( aSetRule, bCreateList );
+				}
+				//End
+			}
+
+		}
+		break;
+	}
+}
diff --git a/main/sw/source/ui/sidebar/PageColumnControl.cxx b/main/sw/source/ui/sidebar/PageColumnControl.cxx
new file mode 100644
index 0000000..06d34f4
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageColumnControl.cxx
@@ -0,0 +1,115 @@
+/**************************************************************
+ * 
+ * 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_sw.hxx"
+
+#include "PageColumnControl.hxx"
+#include "PagePropertyPanel.hxx"
+#include "PagePropertyPanel.hrc"
+
+#include <cmdid.h>
+#include <swtypes.hxx>
+
+#include <svx/sidebar/ValueSetWithTextControl.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+namespace sw { namespace sidebar {
+
+PageColumnControl::PageColumnControl(
+    Window* pParent,
+    PagePropertyPanel& rPanel,
+    const sal_uInt16 nColumnType,
+    const bool bLandscape )
+    : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) )
+    , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) )
+    , maMoreButton( this, SW_RES(CB_COLUMN_MORE) )
+    , mnColumnType( nColumnType )
+    , mrPagePropPanel(rPanel)
+{
+    mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
+    mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+
+    if ( bLandscape )
+    {
+        mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 );
+    }
+    else
+    {
+        mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 );
+        mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 );
+    }
+
+    mpColumnValueSet->SetNoSelection();
+    mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) );
+    mpColumnValueSet->Show();
+    mpColumnValueSet->SelectItem( mnColumnType );
+    mpColumnValueSet->Format();
+    mpColumnValueSet->StartSelection();
+
+    maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) );
+    maMoreButton.GrabFocus();
+
+    FreeResource();
+}
+
+
+PageColumnControl::~PageColumnControl(void)
+{
+    delete mpColumnValueSet;
+}
+
+
+IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl)
+{
+    mpColumnValueSet->SetNoSelection();
+    if ( pControl == mpColumnValueSet )
+    {
+        const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId();
+        if ( nColumnType != mnColumnType )
+        {
+            mnColumnType = nColumnType;
+            mrPagePropPanel.ExecuteColumnChange( mnColumnType );
+        }
+    }
+
+    mrPagePropPanel.ClosePageColumnPopup();
+    return 0;
+}
+
+IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG)
+{
+    mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON );
+
+    mrPagePropPanel.ClosePageColumnPopup();
+    return 0;
+}
+
+
+} } // end of namespace sw::sidebar
+
diff --git a/main/sw/source/ui/sidebar/PageColumnControl.hxx b/main/sw/source/ui/sidebar/PageColumnControl.hxx
new file mode 100644
index 0000000..aa0df8b
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageColumnControl.hxx
@@ -0,0 +1,67 @@
+/**************************************************************
+ * 
+ * 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 _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_
+#define _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_
+
+#include <svx/sidebar/PopupControl.hxx>
+
+#include <vcl/image.hxx>
+#include <vcl/button.hxx>
+
+#include <vector>
+
+namespace svx { namespace sidebar {
+    class ValueSetWithTextControl;
+} }
+
+namespace sw { namespace sidebar {
+
+class PagePropertyPanel;
+
+
+class PageColumnControl
+    : public ::svx::sidebar::PopupControl
+{
+public:
+    PageColumnControl(
+        Window* pParent,
+        PagePropertyPanel& rPanel,
+        const sal_uInt16 nColumnType,
+        const bool bLandscape );
+
+    ~PageColumnControl(void);
+
+private:
+    ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet;
+    PushButton maMoreButton;
+
+    sal_uInt16 mnColumnType;
+
+    PagePropertyPanel& mrPagePropPanel;
+
+    DECL_LINK(ImplColumnHdl, void*);
+    DECL_LINK(MoreButtonClickHdl_Impl, void*);
+};
+
+} } // end of namespace sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/PageMarginControl.cxx b/main/sw/source/ui/sidebar/PageMarginControl.cxx
new file mode 100644
index 0000000..b9cd4ce
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageMarginControl.cxx
@@ -0,0 +1,523 @@
+/**************************************************************
+ * 
+ * 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_sw.hxx"
+
+#include "PageMarginControl.hxx"
+#include "PagePropertyPanel.hxx"
+#include "PagePropertyPanel.hrc"
+
+#include <swtypes.hxx>
+
+#include <svx/sidebar/ValueSetWithTextControl.hxx>
+
+#define SWPAGE_LEFT_GVALUE      String("Sw_Page_Left", 12, RTL_TEXTENCODING_ASCII_US)
+#define SWPAGE_RIGHT_GVALUE     String("Sw_Page_Right", 13, RTL_TEXTENCODING_ASCII_US)
+#define SWPAGE_TOP_GVALUE       String("Sw_Page_Top", 11, RTL_TEXTENCODING_ASCII_US)
+#define SWPAGE_DOWN_GVALUE      String("Sw_Page_Down", 12, RTL_TEXTENCODING_ASCII_US)
+#define SWPAGE_MIRROR_GVALUE    String("Sw_Page_Mirrored", 16, RTL_TEXTENCODING_ASCII_US)
+
+
+namespace sw { namespace sidebar {
+
+PageMarginControl::PageMarginControl(
+    Window* pParent,
+    PagePropertyPanel& rPanel,
+    const SvxLongLRSpaceItem& aPageLRMargin,
+    const SvxLongULSpaceItem& aPageULMargin,
+    const bool bMirrored,
+    const Size aPageSize,
+    const sal_Bool bLandscape,
+    const FieldUnit eFUnit,
+    const SfxMapUnit eUnit )
+    : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) )
+    , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) )
+    , maCustom(this, SW_RES(FT_CUSTOM))
+    , maLeft(this, SW_RES(FT_LEFT))
+    , maInner(this, SW_RES(FT_INNER))
+    , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN))
+    , maRight(this, SW_RES(FT_RIGHT))
+    , maOuter(this, SW_RES(FT_OUTER))
+    , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN))
+    , maTop(this, SW_RES(FT_TOP))
+    , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN))
+    , maBottom(this, SW_RES(FT_BOTTOM))
+    , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN))
+    , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
+    , mnPageLeftMargin( aPageLRMargin.GetLeft() )
+    , mnPageRightMargin( aPageLRMargin.GetRight() )
+    , mnPageTopMargin( aPageULMargin.GetUpper() )
+    , mnPageBottomMargin( aPageULMargin.GetLower() )
+    , mbMirrored( bMirrored )
+    , meUnit( eUnit )
+    , mbUserCustomValuesAvailable(false)
+    , mnUserCustomPageLeftMargin(0)
+    , mnUserCustomPageRightMargin(0)
+    , mnUserCustomPageTopMargin(0)
+    , mnUserCustomPageBottomMargin(0)
+    , mbUserCustomMirrored(false)
+    , mbCustomValuesUsed( false )
+    , mrPagePropPanel(rPanel)
+{
+    maWidthHeightField.Hide();
+    SetFieldUnit( maWidthHeightField, eFUnit );
+
+    mbUserCustomValuesAvailable = GetUserCustomValues();
+
+    mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
+    mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+    FillValueSet( bLandscape, mbUserCustomValuesAvailable );
+
+    mpMarginValueSet->SetNoSelection();
+    mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) );
+    mpMarginValueSet->Show();
+
+    SelectValueSetItem();
+
+    SetFieldUnit( maLeftMarginEdit, eFUnit );
+    Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
+    maLeftMarginEdit.SetModifyHdl( aLinkLR );
+    SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit );
+
+    SetFieldUnit( maRightMarginEdit, eFUnit );
+    maRightMarginEdit.SetModifyHdl( aLinkLR );
+    SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit );
+
+    Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
+    SetFieldUnit( maTopMarginEdit, eFUnit );
+    maTopMarginEdit.SetModifyHdl( aLinkUL );
+    SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit );
+
+    SetFieldUnit( maBottomMarginEdit, eFUnit );
+    maBottomMarginEdit.SetModifyHdl( aLinkUL );
+    SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit );
+
+    SetMetricFieldMaxValues( aPageSize );
+
+    if ( mbMirrored )
+    {
+        maLeft.Hide();
+        maRight.Hide();
+        maInner.Show();
+        maOuter.Show();
+    }
+    else
+    {
+        maLeft.Show();
+        maRight.Show();
+        maInner.Hide();
+        maOuter.Hide();
+    }
+
+    FreeResource();
+}
+
+
+PageMarginControl::~PageMarginControl(void)
+{
+    delete mpMarginValueSet;
+
+    StoreUserCustomValues();
+}
+
+
+void PageMarginControl::SetMetricFieldMaxValues( const Size aPageSize )
+{
+    const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) );
+    const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) );
+    const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) );
+    const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) );
+
+    const long nPH  = LogicToLogic( aPageSize.Height(), (MapUnit)meUnit, MAP_TWIP );
+    const long nPW  = LogicToLogic( aPageSize.Width(),  (MapUnit)meUnit, MAP_TWIP );
+
+    // Left
+    long nMax = nPW - nMR - MINBODY;
+    maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+    // Right
+    nMax = nPW - nML - MINBODY;
+    maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+    //Top
+    nMax = nPH - nMB - MINBODY;
+    maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+
+    //Bottom
+    nMax = nPH - nMT -  MINBODY;
+    maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+}
+
+
+void PageMarginControl::FillValueSet( 
+    const bool bLandscape,
+    const bool bUserCustomValuesAvailable )
+{
+    const XubString aLeft = SW_RES(STR_MARGIN_TOOLTIP_LEFT);
+    const XubString aRight = SW_RES(STR_MARGIN_TOOLTIP_RIGHT);
+    const XubString aTop = SW_RES(STR_MARGIN_TOOLTIP_TOP);
+    const XubString aBottom = SW_RES(STR_MARGIN_TOOLTIP_BOT);
+
+    SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit );
+    const XubString aNarrowValText = maWidthHeightField.GetText();
+    XubString aHelpText = aLeft;
+    aHelpText += aNarrowValText;
+    aHelpText += aRight;
+    aHelpText += aNarrowValText;
+    aHelpText += aTop;
+    aHelpText += aNarrowValText;
+    aHelpText += aBottom;
+    aHelpText += aNarrowValText;
+    mpMarginValueSet->AddItem(
+        (bLandscape ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW) ), 0,
+        SW_RES(STR_NARROW), &aHelpText );
+
+    SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit );
+    const XubString aNormalValText = maWidthHeightField.GetText();
+    aHelpText = aLeft;
+    aHelpText += aNormalValText;
+    aHelpText += aRight;
+    aHelpText += aNormalValText;
+    aHelpText += aTop;
+    aHelpText += aNormalValText;
+    aHelpText += aBottom;
+    aHelpText += aNormalValText;
+    mpMarginValueSet->AddItem(
+        (bLandscape ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL) ), 0,
+        SW_RES(STR_NORMAL), &aHelpText );
+
+    SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit );
+    const XubString aWide1ValText = maWidthHeightField.GetText();
+    SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit );
+    const XubString aWide2ValText = maWidthHeightField.GetText();
+    aHelpText = aLeft;
+    aHelpText += aWide2ValText;
+    aHelpText += aRight;
+    aHelpText += aWide2ValText;
+    aHelpText += aTop;
+    aHelpText += aWide1ValText;
+    aHelpText += aBottom;
+    aHelpText += aWide1ValText;
+    mpMarginValueSet->AddItem(
+        (bLandscape ? SW_RES(IMG_WIDE_L) : SW_RES(IMG_WIDE) ), 0,
+        SW_RES(STR_WIDE), &aHelpText );
+
+    const XubString aInner = SW_RES(STR_MARGIN_TOOLTIP_INNER);
+    const XubString aOuter = SW_RES(STR_MARGIN_TOOLTIP_OUTER);
+
+    SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit );
+    const XubString aWide3ValText = maWidthHeightField.GetText();
+    aHelpText = aInner;
+    aHelpText += aWide3ValText;
+    aHelpText += aOuter;
+    aHelpText += aWide3ValText;
+    aHelpText += aTop;
+    aHelpText += aWide1ValText;
+    aHelpText += aBottom;
+    aHelpText += aWide1ValText;
+    mpMarginValueSet->AddItem( 
+        (bLandscape ? SW_RES(IMG_MIRRORED_L) : SW_RES(IMG_MIRRORED) ), 0,
+        SW_RES(STR_MIRRORED), &aHelpText );
+
+    if ( bUserCustomValuesAvailable )
+    {
+        aHelpText = mbUserCustomMirrored ? aInner : aLeft;
+        SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit );
+        aHelpText += maWidthHeightField.GetText();
+        aHelpText += mbUserCustomMirrored ? aOuter : aRight;
+        SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit );
+        aHelpText += maWidthHeightField.GetText();
+        aHelpText += aTop;
+        SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit );
+        aHelpText += maWidthHeightField.GetText();
+        aHelpText += aBottom;
+        SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit );
+        aHelpText += maWidthHeightField.GetText();
+    }
+    else
+    {
+        aHelpText = XubString();
+    }
+    mpMarginValueSet->AddItem(
+        (bUserCustomValuesAvailable ? SW_RES(IMG_CUSTOM) : SW_RES(IMG_CUSTOM_DIS) ), 0,
+        SW_RES(STR_LCVALUE), &aHelpText );
+}
+
+
+void PageMarginControl::SelectValueSetItem()
+{
+    const long cTolerance = 5;
+
+    if( abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        !mbMirrored )
+    {
+        mpMarginValueSet->SelectItem(1);
+    }
+    else if( abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&		
+        abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        !mbMirrored )
+    {
+        mpMarginValueSet->SelectItem(2);
+    }
+    else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance &&
+        abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance &&
+        abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&		
+        abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        !mbMirrored )
+    {
+        mpMarginValueSet->SelectItem(3);
+    }
+    else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance &&
+        abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        mbMirrored )
+    {
+        mpMarginValueSet->SelectItem(4);
+    }
+    else 
+    {
+        mpMarginValueSet->SelectItem(0);
+    }
+
+    mpMarginValueSet->Format();
+    mpMarginValueSet->StartSelection();
+};
+
+
+IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl)
+{
+    if ( pControl == mpMarginValueSet )
+    {
+        const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId();
+        bool bMirrored = false;
+        bool bApplyNewPageMargins = true;
+        switch ( iPos )
+        {
+        case 1:
+            mnPageLeftMargin = SWPAGE_NARROW_VALUE;
+            mnPageRightMargin = SWPAGE_NARROW_VALUE;
+            mnPageTopMargin = SWPAGE_NARROW_VALUE;
+            mnPageBottomMargin = SWPAGE_NARROW_VALUE;
+            bMirrored = false;
+            break;
+        case 2:
+            mnPageLeftMargin = SWPAGE_NORMAL_VALUE;
+            mnPageRightMargin = SWPAGE_NORMAL_VALUE;
+            mnPageTopMargin = SWPAGE_NORMAL_VALUE;
+            mnPageBottomMargin = SWPAGE_NORMAL_VALUE;
+            bMirrored = false;
+            break;
+        case 3:
+            mnPageLeftMargin = SWPAGE_WIDE_VALUE2;
+            mnPageRightMargin = SWPAGE_WIDE_VALUE2;
+            mnPageTopMargin = SWPAGE_WIDE_VALUE1;
+            mnPageBottomMargin = SWPAGE_WIDE_VALUE1;
+            bMirrored = false;
+            break;
+        case 4:
+            mnPageLeftMargin = SWPAGE_WIDE_VALUE3;
+            mnPageRightMargin = SWPAGE_WIDE_VALUE1;
+            mnPageTopMargin = SWPAGE_WIDE_VALUE1;
+            mnPageBottomMargin = SWPAGE_WIDE_VALUE1;
+            bMirrored = true;
+            break;
+        case 5:
+            if ( mbUserCustomValuesAvailable )
+            {
+                mnPageLeftMargin = mnUserCustomPageLeftMargin;
+                mnPageRightMargin = mnUserCustomPageRightMargin;
+                mnPageTopMargin = mnUserCustomPageTopMargin;
+                mnPageBottomMargin = mnUserCustomPageBottomMargin;
+                bMirrored = mbUserCustomMirrored;
+            }
+            else
+            {
+                bApplyNewPageMargins = false;
+            }
+            break;
+        }
+
+        if ( bApplyNewPageMargins )
+        {
+            mpMarginValueSet->SetNoSelection();
+            mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
+            mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
+            if ( mbMirrored != bMirrored )
+            {
+                mbMirrored = bMirrored;
+                mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
+            }
+
+            mbCustomValuesUsed = false;
+            mrPagePropPanel.ClosePageMarginPopup();
+        }
+        else
+        {
+            // back to initial selection
+            SelectValueSetItem();
+        }
+    }
+
+    return 0;
+}
+
+
+IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
+{
+    mpMarginValueSet->SetNoSelection();
+    mpMarginValueSet->SelectItem(0);
+    mpMarginValueSet->Format();
+    mpMarginValueSet->StartSelection();
+
+    mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit );
+    mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit );
+    mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
+    mbCustomValuesUsed = true;
+    return 0;
+}
+
+IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG )
+{
+    mpMarginValueSet->SetNoSelection();
+    mpMarginValueSet->SelectItem(0);
+    mpMarginValueSet->Format();
+    mpMarginValueSet->StartSelection();
+
+    mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit );
+    mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit );
+    mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
+    mbCustomValuesUsed = true;
+    return 0;
+}
+
+
+bool PageMarginControl::GetUserCustomValues()
+{
+    bool bUserCustomValuesAvailable = false;
+
+    SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
+    if ( aWinOpt.Exists() )
+    {
+        ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
+        ::rtl::OUString aTmp;
+        if ( aSeq.getLength())
+            aSeq[0].Value >>= aTmp;
+        String aWinData( aTmp );
+        mnUserCustomPageLeftMargin = aWinData.ToInt32();
+        bUserCustomValuesAvailable = true;
+    }
+
+    SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
+    if ( aWinOpt2.Exists() )
+    {
+        ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
+        ::rtl::OUString aTmp;
+        if ( aSeq.getLength())
+            aSeq[0].Value >>= aTmp;
+        String aWinData( aTmp );
+        mnUserCustomPageRightMargin = aWinData.ToInt32();
+        bUserCustomValuesAvailable = true;
+    }
+
+    SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
+    if ( aWinOpt3.Exists() )
+    {
+        ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
+        ::rtl::OUString aTmp;
+        if ( aSeq.getLength())
+            aSeq[0].Value >>= aTmp;
+        String aWinData( aTmp );
+        mnUserCustomPageTopMargin = aWinData.ToInt32();
+        bUserCustomValuesAvailable = true;
+    }
+
+    SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
+    if ( aWinOpt4.Exists() )
+    {
+        ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
+        ::rtl::OUString aTmp;
+        if ( aSeq.getLength())
+            aSeq[0].Value >>= aTmp;
+        String aWinData( aTmp );
+        mnUserCustomPageBottomMargin = aWinData.ToInt32();
+        bUserCustomValuesAvailable = true;
+    }
+
+    SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
+    if ( aWinOpt5.Exists() )
+    {
+        ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
+        ::rtl::OUString aTmp;
+        if ( aSeq.getLength())
+            aSeq[0].Value >>= aTmp;
+        String aWinData( aTmp );
+        mbUserCustomMirrored = aWinData.ToInt32() == 0 ? false : true;
+        bUserCustomValuesAvailable = true;
+    }
+
+    return bUserCustomValuesAvailable;
+}
+
+void PageMarginControl::StoreUserCustomValues()
+{
+    if ( !mbCustomValuesUsed )
+    {
+        return;
+    }
+
+    ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+    SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
+
+    aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageLeftMargin") );
+    aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageLeftMargin ));
+    aWinOpt.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
+    aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageRightMargin") );
+    aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageRightMargin ));
+    aWinOpt2.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
+    aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageTopMargin") );
+    aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageTopMargin ));
+    aWinOpt3.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
+    aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageBottomMargin") );
+    aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageBottomMargin ));
+    aWinOpt4.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
+    aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mbMirrored") );
+    aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( (mbMirrored ? 1 : 0) ));
+    aWinOpt5.SetUserData( aSeq );
+}
+
+
+} } // end of namespace sw::sidebar
+
diff --git a/main/sw/source/ui/sidebar/PageMarginControl.hxx b/main/sw/source/ui/sidebar/PageMarginControl.hxx
new file mode 100644
index 0000000..915e532
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageMarginControl.hxx
@@ -0,0 +1,124 @@
+/**************************************************************
+ * 
+ * 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 _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_
+#define _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_
+
+#include <svx/sidebar/PopupControl.hxx>
+
+#include <tools/fldunit.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/rulritem.hxx>
+#include <unotools/viewoptions.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <svtools/unitconv.hxx>
+#include <vector>
+
+#define SWPAGE_NARROW_VALUE    720
+#define SWPAGE_NORMAL_VALUE    1136
+#define SWPAGE_WIDE_VALUE1     1440
+#define SWPAGE_WIDE_VALUE2	   2880
+#define SWPAGE_WIDE_VALUE3	   1800
+
+
+namespace svx { namespace sidebar {
+    class ValueSetWithTextControl;
+} }
+
+static const long MINBODY = 284; //0.5 cm in twips
+
+namespace sw { namespace sidebar {
+
+class PagePropertyPanel;
+
+
+class PageMarginControl
+    : public ::svx::sidebar::PopupControl
+{
+public:
+    PageMarginControl(
+        Window* pParent,
+        PagePropertyPanel& rPanel,
+        const SvxLongLRSpaceItem& aPageLRMargin,
+        const SvxLongULSpaceItem& aPageULMargin,
+        const bool bMirrored,
+        const Size aPageSize,
+        const sal_Bool bLandscape,
+        const FieldUnit eFUnit,
+        const SfxMapUnit eUnit );
+    ~PageMarginControl(void);
+
+private:
+    ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet;
+
+    FixedText maCustom;
+    FixedText maLeft;
+    FixedText maInner;
+    MetricField maLeftMarginEdit;
+    FixedText maRight;
+    FixedText maOuter;
+    MetricField maRightMarginEdit;
+    FixedText maTop;
+    MetricField maTopMarginEdit;
+    FixedText maBottom;
+    MetricField maBottomMarginEdit;
+
+    // hidden metric field
+    MetricField maWidthHeightField;
+
+    long mnPageLeftMargin;
+    long mnPageRightMargin;
+    long mnPageTopMargin;
+    long mnPageBottomMargin;
+    bool mbMirrored;
+
+    const SfxMapUnit meUnit;
+
+    bool mbUserCustomValuesAvailable;
+    long mnUserCustomPageLeftMargin;
+    long mnUserCustomPageRightMargin;
+    long mnUserCustomPageTopMargin;
+    long mnUserCustomPageBottomMargin;
+    bool mbUserCustomMirrored;
+
+    bool mbCustomValuesUsed;
+
+    PagePropertyPanel& mrPagePropPanel;
+
+    DECL_LINK( ImplMarginHdl, void* );
+    DECL_LINK( ModifyLRMarginHdl, MetricField* );
+    DECL_LINK( ModifyULMarginHdl, MetricField* );
+
+    void SetMetricFieldMaxValues( const Size aPageSize );
+
+    bool GetUserCustomValues();
+    void StoreUserCustomValues();
+
+    void FillValueSet(
+        const bool bLandscape,
+        const bool bUserCustomValuesAvailable );
+    void SelectValueSetItem();
+};
+
+} } // end of namespace sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/PageOrientationControl.cxx b/main/sw/source/ui/sidebar/PageOrientationControl.cxx
new file mode 100644
index 0000000..192c30b
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageOrientationControl.cxx
@@ -0,0 +1,93 @@
+/**************************************************************
+ * 
+ * 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_sw.hxx"
+
+#include "PageOrientationControl.hxx"
+#include "PagePropertyPanel.hxx"
+#include "PagePropertyPanel.hrc"
+
+#include <swtypes.hxx>
+
+#include <svx/sidebar/ValueSetWithTextControl.hxx>
+
+namespace sw { namespace sidebar {
+
+PageOrientationControl::PageOrientationControl(
+    Window* pParent,
+    PagePropertyPanel& rPanel,
+    const sal_Bool bLandscape )
+    : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) )
+    , mpOrientationValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) )
+    , mbLandscape( bLandscape )
+    , mrPagePropPanel(rPanel)
+{
+    mpOrientationValueSet->SetStyle( mpOrientationValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
+    mpOrientationValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+
+    // initialize <ValueSetWithText> control
+    {
+        mpOrientationValueSet->AddItem( SW_RES(IMG_PORTRAIT), 0, SW_RES(STR_PORTRAIT), 0 );
+        mpOrientationValueSet->AddItem( SW_RES(IMG_LANDSCAPE), 0, SW_RES(STR_LANDSCAPE), 0 );
+    }
+
+    Link aLink = LINK(this, PageOrientationControl,ImplOrientationHdl );
+    mpOrientationValueSet->SetSelectHdl(aLink);
+    mpOrientationValueSet->SetNoSelection();
+    mpOrientationValueSet->StartSelection();
+    mpOrientationValueSet->Show();
+    mpOrientationValueSet->SelectItem( (mbLandscape == sal_True) ? 2 : 1 );
+    mpOrientationValueSet->GrabFocus();
+    mpOrientationValueSet->Format();
+    mpOrientationValueSet->StartSelection();
+
+    FreeResource();
+}
+
+
+PageOrientationControl::~PageOrientationControl(void)
+{
+    delete mpOrientationValueSet;
+}
+
+
+IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl)
+{
+    mpOrientationValueSet->SetNoSelection();
+    if ( pControl == mpOrientationValueSet )
+    {
+        const sal_uInt32 iPos = mpOrientationValueSet->GetSelectItemId();
+        const bool bChanged = ( ( iPos == 1 ) && mbLandscape ) ||
+                              ( ( iPos == 2 ) && !mbLandscape );
+        if ( bChanged )
+        {
+            mbLandscape = !mbLandscape;
+            mrPagePropPanel.ExecuteOrientationChange( mbLandscape );
+        }
+    }
+
+    mrPagePropPanel.ClosePageOrientationPopup();
+    return 0;
+}
+
+
+} } // end of namespace sw::sidebar
+
diff --git a/main/sw/source/ui/sidebar/PageOrientationControl.hxx b/main/sw/source/ui/sidebar/PageOrientationControl.hxx
new file mode 100644
index 0000000..3b01f14
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageOrientationControl.hxx
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * 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 _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_
+#define _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_
+
+#include <svx/sidebar/PopupControl.hxx>
+
+namespace svx { namespace sidebar {
+    class ValueSetWithTextControl;
+} }
+
+namespace sw { namespace sidebar {
+
+class PagePropertyPanel;
+
+
+class PageOrientationControl
+    : public ::svx::sidebar::PopupControl
+{
+public:
+    PageOrientationControl(
+        Window* pParent,
+        PagePropertyPanel& rPanel,
+        const sal_Bool bLandscape );
+    ~PageOrientationControl(void);
+
+private:
+    ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet;
+
+    sal_Bool mbLandscape;
+
+    PagePropertyPanel& mrPagePropPanel;
+
+    DECL_LINK(ImplOrientationHdl, void*);
+};
+
+} } // end of namespace sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/PagePropertyPanel.cxx b/main/sw/source/ui/sidebar/PagePropertyPanel.cxx
new file mode 100644
index 0000000..490c91c
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PagePropertyPanel.cxx
@@ -0,0 +1,766 @@
+/**************************************************************
+* 
+* 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_sw.hxx"
+
+#include "PagePropertyPanel.hxx"
+#include "PagePropertyPanel.hrc"
+
+#include "PropertyPanel.hrc"
+
+#include <svx/sidebar/PopupContainer.hxx>
+#include "PageOrientationControl.hxx"
+#include "PageMarginControl.hxx"
+#include "PageSizeControl.hxx"
+#include "PageColumnControl.hxx"
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <errhdl.hxx>
+
+#include <svl/intitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dlgutil.hxx>
+#include <svx/rulritem.hxx>
+
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <boost/bind.hpp>
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+#define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
+
+
+namespace sw { namespace sidebar {
+
+PagePropertyPanel* PagePropertyPanel::Create (
+    Window* pParent,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0);
+    if (pBindings == NULL)
+        throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2);
+    
+    return new PagePropertyPanel(
+        pParent,
+        pBindings);
+}
+
+PagePropertyPanel::PagePropertyPanel(
+            Window* pParent,
+            SfxBindings* pBindings)
+    : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWPAGE))
+    , mpBindings(pBindings)
+    // visible controls
+    , maFtOrientation( this, SW_RES(FT_ORIENTATION) )
+    , mpToolBoxOrientationBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) )
+    , mpToolBoxOrientation( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxOrientationBackground.get(), SW_RES(TB_ORIENTATION)) )
+    , maFtMargin( this, SW_RES(FT_MARGIN) )
+    , mpToolBoxMarginBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) )
+    , mpToolBoxMargin( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxMarginBackground.get(), SW_RES(TB_MARGIN)) )
+    , maFtSize( this, SW_RES(FT_SIZE) )
+    , mpToolBoxSizeBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) )
+    , mpToolBoxSize( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxSizeBackground.get(), SW_RES(TB_SIZE)) )
+    , maFtColumn( this, SW_RES(FT_COLUMN) )
+    , mpToolBoxColumnBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) )
+    , mpToolBoxColumn( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxColumnBackground.get(), SW_RES(TB_COLUMN)) )
+    // image resources
+    , maImgSize					(NULL)
+    , maImgSize_L					(NULL)
+    , mImgPortrait				(SW_RES(IMG_PAGE_PORTRAIT))
+    , mImgLandscape				(SW_RES(IMG_PAGE_LANDSCAPE))
+    , mImgNarrow					(SW_RES(IMG_PAGE_NARROW))
+    , mImgNormal					(SW_RES(IMG_PAGE_NORMAL))
+    , mImgWide					(SW_RES(IMG_PAGE_WIDE))
+    , mImgMirrored				(SW_RES(IMG_PAGE_MIRRORED))
+    , mImgMarginCustom			(SW_RES(IMG_PAGE_MARGIN_CUSTOM))
+    , mImgNarrow_L				(SW_RES(IMG_PAGE_NARROW_L))
+    , mImgNormal_L				(SW_RES(IMG_PAGE_NORMAL_L))
+    , mImgWide_L					(SW_RES(IMG_PAGE_WIDE_L))
+    , mImgMirrored_L				(SW_RES(IMG_PAGE_MIRRORED_L))
+    , mImgMarginCustom_L			(SW_RES(IMG_PAGE_MARGIN_CUSTOM_L))
+    , mImgA3						(SW_RES(IMG_PAGE_A3))
+    , mImgA4						(SW_RES(IMG_PAGE_A4))
+    , mImgA5						(SW_RES(IMG_PAGE_A5))
+    , mImgB4						(SW_RES(IMG_PAGE_B4))
+    , mImgB5						(SW_RES(IMG_PAGE_B5))
+    , mImgC5						(SW_RES(IMG_PAGE_C5))
+    , mImgLetter					(SW_RES(IMG_PAGE_LETTER))
+    , mImgLegal					(SW_RES(IMG_PAGE_LEGAL))
+    , mImgSizeNone				(SW_RES(IMG_PAGE_SIZE_NONE))
+    , mImgA3_L					(SW_RES(IMG_PAGE_A3_L))
+    , mImgA4_L					(SW_RES(IMG_PAGE_A4_L))
+    , mImgA5_L					(SW_RES(IMG_PAGE_A5_L))
+    , mImgB4_L					(SW_RES(IMG_PAGE_B4_L))
+    , mImgB5_L					(SW_RES(IMG_PAGE_B5_L))
+    , mImgC5_L					(SW_RES(IMG_PAGE_C5_L))
+    , mImgLetter_L				(SW_RES(IMG_PAGE_LETTER_L))
+    , mImgLegal_L					(SW_RES(IMG_PAGE_LEGAL_L))
+    , mImgSizeNone_L				(SW_RES(IMG_PAGE_SIZE_NONE_L))
+    , mImgColumn1					(SW_RES(IMG_PAGE_COLUMN_1))
+    , mImgColumn2					(SW_RES(IMG_PAGE_COLUMN_2))
+    , mImgColumn3					(SW_RES(IMG_PAGE_COLUMN_3))
+    , mImgLeft					(SW_RES(IMG_PAGE_COLUMN_LEFT))
+    , mImgRight					(SW_RES(IMG_PAGE_COLUMN_RIGHT))
+    , mImgColumnNone				(SW_RES(IMG_PAGE_COLUMN_NONE))
+    , mImgColumn1_L				(SW_RES(IMG_PAGE_COLUMN_1_L))
+    , mImgColumn2_L				(SW_RES(IMG_PAGE_COLUMN_2_L))
+    , mImgColumn3_L				(SW_RES(IMG_PAGE_COLUMN_3_L))
+    , mImgLeft_L					(SW_RES(IMG_PAGE_COLUMN_LEFT_L))
+    , mImgRight_L					(SW_RES(IMG_PAGE_COLUMN_RIGHT_L))
+    , mImgColumnNone_L			(SW_RES(IMG_PAGE_COLUMN_NONE_L))
+
+    , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) )
+    , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) )
+    , mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) )
+    , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) )
+    , mePaper( PAPER_USER )
+    , mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) )
+
+    , meFUnit()
+    , meUnit()
+
+    , m_aSwPagePgULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this)
+    , m_aSwPagePgLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this)
+    , m_aSwPagePgSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this)
+    , m_aSwPagePgControl(SID_ATTR_PAGE, *pBindings, *this)
+    , m_aSwPageColControl(SID_ATTR_PAGE_COLUMN, *pBindings, *this)
+    , m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this)
+
+    , mpOrientationPopup()
+    , mpMarginPopup()
+    , mpSizePopup()
+    , mpColumnPopup()
+
+    , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false )
+{
+    Initialize();
+    mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true;
+    FreeResource();
+}
+
+PagePropertyPanel::~PagePropertyPanel()
+{
+    delete[] maImgSize;
+    delete[] maImgSize_L;
+
+    // destroy the toolbox windows.
+    mpToolBoxOrientation.reset();
+    mpToolBoxMargin.reset();
+    mpToolBoxSize.reset();
+    mpToolBoxColumn.reset();
+
+    // destroy the background windows of the toolboxes.
+    mpToolBoxOrientationBackground.reset();
+    mpToolBoxMarginBackground.reset();
+    mpToolBoxSizeBackground.reset();
+    mpToolBoxColumnBackground.reset();
+}
+
+void PagePropertyPanel::Initialize()
+{
+    maFtOrientation.SetBackground(Wallpaper());
+    maFtMargin.SetBackground(Wallpaper());
+    maFtSize.SetBackground(Wallpaper());
+    maFtColumn.SetBackground(Wallpaper());
+
+    // popup for page orientation
+    Link aLink = LINK( this, PagePropertyPanel, ClickOrientationHdl );
+    mpToolBoxOrientation->SetDropdownClickHdl( aLink );
+    mpToolBoxOrientation->SetSelectHdl( aLink );
+    mpToolBoxOrientation->SetItemImage( TBI_ORIENTATION, mImgPortrait);
+    mpToolBoxOrientation->SetItemBits( TBI_ORIENTATION, mpToolBoxOrientation->GetItemBits( TBI_ORIENTATION ) | TIB_DROPDOWNONLY );
+    mpToolBoxOrientation->SetQuickHelpText(TBI_ORIENTATION,String(SW_RES(STR_QHELP_TB_ORIENTATION)));
+    mpToolBoxOrientation->SetOutputSizePixel( mpToolBoxOrientation->CalcWindowSizePixel() );
+    mpToolBoxOrientation->SetBackground( Wallpaper() );
+    mpToolBoxOrientation->SetPaintTransparent( sal_True );
+
+    // popup for page margins
+    aLink = LINK( this, PagePropertyPanel, ClickMarginHdl );
+    mpToolBoxMargin->SetDropdownClickHdl( aLink );
+    mpToolBoxMargin->SetSelectHdl( aLink );
+    mpToolBoxMargin->SetItemImage(TBI_MARGIN, mImgNormal);
+    mpToolBoxMargin->SetItemBits( TBI_MARGIN, mpToolBoxMargin->GetItemBits( TBI_MARGIN ) | TIB_DROPDOWNONLY );
+    mpToolBoxMargin->SetQuickHelpText(TBI_MARGIN,String(SW_RES(STR_QHELP_TB_MARGIN)));
+    mpToolBoxMargin->SetOutputSizePixel( mpToolBoxMargin->CalcWindowSizePixel() );
+    mpToolBoxMargin->SetBackground(Wallpaper());
+    mpToolBoxMargin->SetPaintTransparent( sal_True );
+
+    // popup for page size
+    aLink = LINK( this, PagePropertyPanel, ClickSizeHdl );
+    mpToolBoxSize->SetDropdownClickHdl( aLink );
+    mpToolBoxSize->SetSelectHdl( aLink );
+    mpToolBoxSize->SetItemImage(TBI_SIZE, mImgLetter);
+    mpToolBoxSize->SetItemBits( TBI_SIZE, mpToolBoxSize->GetItemBits( TBI_SIZE ) | TIB_DROPDOWNONLY );
+    mpToolBoxSize->SetQuickHelpText(TBI_SIZE,String(SW_RES(STR_QHELP_TB_SIZE)));
+    mpToolBoxSize->SetOutputSizePixel( mpToolBoxSize->CalcWindowSizePixel() );
+    mpToolBoxSize->SetBackground(Wallpaper());
+    mpToolBoxSize->SetPaintTransparent( sal_True );
+    maImgSize = new Image[8];
+    maImgSize[0] = mImgA3;
+    maImgSize[1] = mImgA4;
+    maImgSize[2] = mImgA5;
+    maImgSize[3] = mImgB4;
+    maImgSize[4] = mImgB5;
+    maImgSize[5] = mImgC5;
+    maImgSize[6] = mImgLetter;
+    maImgSize[7] = mImgLegal;
+    maImgSize_L = new Image[8];
+    maImgSize_L[0] = mImgA3_L;
+    maImgSize_L[1] = mImgA4_L;
+    maImgSize_L[2] = mImgA5_L;
+    maImgSize_L[3] = mImgB4_L;
+    maImgSize_L[4] = mImgB5_L;
+    maImgSize_L[5] = mImgC5_L;
+    maImgSize_L[6] = mImgLetter_L;
+    maImgSize_L[7] = mImgLegal_L;
+
+    // popup for page column property
+    aLink = LINK( this, PagePropertyPanel, ClickColumnHdl );
+    mpToolBoxColumn->SetDropdownClickHdl( aLink );
+    mpToolBoxColumn->SetSelectHdl( aLink );
+    mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1);
+    mpToolBoxColumn->SetItemBits( TBI_COLUMN, mpToolBoxColumn->GetItemBits( TBI_COLUMN ) | TIB_DROPDOWNONLY );
+    mpToolBoxColumn->SetQuickHelpText(TBI_COLUMN,String(SW_RES(STR_QHELP_TB_COLUMN)));
+    mpToolBoxColumn->SetOutputSizePixel( mpToolBoxColumn->CalcWindowSizePixel() );
+    mpToolBoxColumn->SetBackground(Wallpaper());
+    mpToolBoxColumn->SetPaintTransparent( sal_True );
+
+    meFUnit = GetModuleFieldUnit(); 
+    meUnit  = m_aSwPagePgSizeControl.GetCoreMetric();
+
+    // 'pull' for page style's attribute values
+    mpBindings->Update( SID_ATTR_PAGE_LRSPACE );
+    mpBindings->Update( SID_ATTR_PAGE_ULSPACE );
+    mpBindings->Update( SID_ATTR_PAGE );
+    mpBindings->Update( SID_ATTR_PAGE_SIZE );
+}
+
+
+::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent )
+{
+    return new PageOrientationControl( pParent, *this , mpPageItem->IsLandscape() );
+}
+
+
+IMPL_LINK( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox )
+{
+    if ( ! mpOrientationPopup)
+    {
+        mpOrientationPopup.reset(
+            new ::svx::sidebar::Popup(
+                this,
+                ::boost::bind(&PagePropertyPanel::CreatePageOrientationControl, this, _1),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page orientation")) ) );
+    }
+    mpOrientationPopup->Show( *pToolBox );
+    
+    return 0L;
+}
+
+
+void PagePropertyPanel::ExecuteOrientationChange( const sal_Bool bLandscape )
+{
+    {
+        // set new page orientation
+        mpPageItem->SetLandscape( bLandscape );
+
+        // swap the width and height of the page size
+        mpPageSizeItem->SetSize( Size( mpPageSizeItem->GetSize().Height(), mpPageSizeItem->GetSize().Width() ) );
+
+        // apply changed attributes
+        GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(), mpPageItem.get(), 0L );
+    }
+
+    // check, if margin values still fit to the changed page size.
+    // if not, adjust margin values
+    {
+        const long nML = mpPageLRMarginItem->GetLeft();
+        const long nMR = mpPageLRMarginItem->GetRight();
+        const long nTmpPW = nML + nMR + MINBODY;
+
+        const long nPW  = mpPageSizeItem->GetSize().Width();
+
+        if ( nTmpPW > nPW )
+        {
+            if ( nML <= nMR )
+            {
+                ExecuteMarginLRChange( mpPageLRMarginItem->GetLeft(), nMR - (nTmpPW - nPW ) );
+            }
+            else
+            {
+                ExecuteMarginLRChange( nML - (nTmpPW - nPW ), mpPageLRMarginItem->GetRight() );
+            }
+        }
+
+        const long nMT = mpPageULMarginItem->GetUpper();
+        const long nMB = mpPageULMarginItem->GetLower();
+        const long nTmpPH = nMT + nMB + MINBODY;
+
+        const long nPH  = mpPageSizeItem->GetSize().Height();
+
+        if ( nTmpPH > nPH )
+        {
+            if ( nMT <= nMB )
+            {
+                ExecuteMarginULChange( mpPageULMarginItem->GetUpper(), nMB - ( nTmpPH - nPH ) );
+            }
+            else
+            {
+                ExecuteMarginULChange( nMT - ( nTmpPH - nPH ), mpPageULMarginItem->GetLower() );
+            }
+        }
+    }
+}
+
+
+void PagePropertyPanel::ClosePageOrientationPopup()
+{
+    mpOrientationPopup->Hide();
+}
+
+
+
+
+::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent )
+{
+    return new PageMarginControl( 
+        pParent, 
+        *this,
+        *mpPageLRMarginItem.get(),
+        *mpPageULMarginItem.get(),
+        mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR,
+        mpPageSizeItem->GetSize(),
+        mpPageItem->IsLandscape(),
+        meFUnit,
+        meUnit );
+}
+
+
+void PagePropertyPanel::ExecuteMarginLRChange(
+    const long nPageLeftMargin,
+    const long nPageRightMargin )
+{
+    mpPageLRMarginItem->SetLeft( nPageLeftMargin );
+    mpPageLRMarginItem->SetRight( nPageRightMargin );
+    GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_LRSPACE, SFX_CALLMODE_RECORD, mpPageLRMarginItem.get(),  0L );	
+}
+
+void PagePropertyPanel::ExecuteMarginULChange(
+    const long nPageTopMargin,
+    const long nPageBottomMargin )
+{
+    mpPageULMarginItem->SetUpper( nPageTopMargin );
+    mpPageULMarginItem->SetLower( nPageBottomMargin );
+    GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_ULSPACE, SFX_CALLMODE_RECORD, mpPageULMarginItem.get(),  0L );
+}
+
+
+void PagePropertyPanel::ExecutePageLayoutChange( const bool bMirrored )
+{
+    mpPageItem->SetPageUsage( bMirrored ? SVX_PAGE_MIRROR : SVX_PAGE_ALL );
+    GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE, SFX_CALLMODE_RECORD, mpPageItem.get(),  0L );
+}
+
+
+IMPL_LINK( PagePropertyPanel, ClickMarginHdl, ToolBox*, pToolBox )
+{
+    if ( ! mpMarginPopup)
+        mpMarginPopup.reset(
+            new ::svx::sidebar::Popup(
+                this,
+                ::boost::bind(&PagePropertyPanel::CreatePageMarginControl, this, _1),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page margins")) ) );
+    mpMarginPopup->Show( *pToolBox );
+
+    return 0L;
+}
+
+
+void PagePropertyPanel::ClosePageMarginPopup()
+{
+    mpMarginPopup->Hide();
+}
+
+
+
+
+::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent )
+{
+    return new PageSizeControl( 
+        pParent, 
+        *this,
+        mePaper,
+        mpPageItem->IsLandscape(),
+        meFUnit );
+}
+
+
+void PagePropertyPanel::ExecuteSizeChange( const Paper ePaper )
+{
+    Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)(meUnit) );
+    if ( mpPageItem->IsLandscape() )
+    {
+        Swap( aPageSize );
+    }
+    mpPageSizeItem->SetSize( aPageSize );
+
+    mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(),  0L );	
+}
+
+
+IMPL_LINK( PagePropertyPanel, ClickSizeHdl, ToolBox*, pToolBox )
+{
+    if ( ! mpSizePopup)
+        mpSizePopup.reset(
+            new ::svx::sidebar::Popup(
+                this,
+                ::boost::bind(&PagePropertyPanel::CreatePageSizeControl, this, _1),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page size")) ) );
+    mpSizePopup->Show( *pToolBox );
+
+    return 0L;
+}
+
+
+void PagePropertyPanel::ClosePageSizePopup()
+{
+    mpSizePopup->Hide();
+}
+
+
+
+
+::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent )
+{
+    return new PageColumnControl(
+        pParent,
+        *this,
+        mpPageColumnTypeItem->GetValue(),
+        mpPageItem->IsLandscape() );
+}
+
+
+void PagePropertyPanel::ExecuteColumnChange( const sal_uInt16 nColumnType )
+{
+    mpPageColumnTypeItem->SetValue( nColumnType );
+    mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_COLUMN, SFX_CALLMODE_RECORD, mpPageColumnTypeItem.get(),  0L );
+}
+
+
+IMPL_LINK( PagePropertyPanel, ClickColumnHdl, ToolBox*, pToolBox )
+{
+    if ( ! mpColumnPopup)
+        mpColumnPopup.reset(
+            new ::svx::sidebar::Popup(
+                this,
+                ::boost::bind(&PagePropertyPanel::CreatePageColumnControl, this, _1),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page columns")) ) );
+    mpColumnPopup->Show( *pToolBox );
+
+    return 0L;
+}
+
+
+void PagePropertyPanel::ClosePageColumnPopup()
+{
+    mpColumnPopup->Hide();
+}
+
+
+
+
+void PagePropertyPanel::NotifyItemUpdate(
+    const sal_uInt16 nSId,
+    const SfxItemState eState,
+    const SfxPoolItem* pState)
+{
+    switch( nSId )
+    {
+    case SID_ATTR_PAGE_COLUMN:
+        {
+            if ( eState >= SFX_ITEM_AVAILABLE && 
+                 pState && pState->ISA(SfxInt16Item) )
+            {
+                mpPageColumnTypeItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) );
+                ChangeColumnImage( mpPageColumnTypeItem->GetValue() );
+            }
+        }
+        break;
+    case SID_ATTR_PAGE_LRSPACE:
+        if ( eState >= SFX_ITEM_AVAILABLE &&
+             pState && pState->ISA(SvxLongLRSpaceItem) )
+        {
+            mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
+            ChangeMarginImage();
+        }
+        break;
+
+    case SID_ATTR_PAGE_ULSPACE:
+        if ( eState >= SFX_ITEM_AVAILABLE &&
+             pState && pState->ISA(SvxLongULSpaceItem) )
+        {
+            mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
+            ChangeMarginImage();
+        }
+        break;
+
+    case SID_ATTR_PAGE:
+        if ( eState >= SFX_ITEM_AVAILABLE && 
+             pState && pState->ISA(SvxPageItem) )
+        {
+            mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) );
+            if ( mpPageItem->IsLandscape() )
+            {
+                mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgLandscape);
+            }
+            else
+            {
+                mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgPortrait);
+            }
+            ChangeMarginImage();
+            ChangeSizeImage();
+            ChangeColumnImage( mpPageColumnTypeItem->GetValue() );
+        }
+        break;
+
+    case SID_ATTR_PAGE_SIZE:
+        if ( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify )
+        {
+            mpBindings->Invalidate( SID_ATTR_PAGE, sal_True, sal_False );
+        }
+        if ( eState >= SFX_ITEM_AVAILABLE &&
+             pState && pState->ISA(SvxSizeItem) )
+        {
+            mpPageSizeItem.reset( static_cast<SvxSizeItem*>(pState->Clone()) );
+            ChangeSizeImage();
+        }
+        break;
+    case SID_ATTR_METRIC:
+        MetricState( eState, pState );
+        break;
+    }
+}
+
+
+void PagePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState )
+{
+    meFUnit = FUNIT_NONE;
+    if ( pState && eState >= SFX_ITEM_DEFAULT )
+    {
+        meFUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
+    }
+    else
+    {
+        SfxViewFrame* pFrame = SfxViewFrame::Current();
+        SfxObjectShell* pSh = NULL;
+        if ( pFrame )
+            pSh = pFrame->GetObjectShell();
+        if ( pSh )
+        {
+            SfxModule* pModule = pSh->GetModule();
+            if ( pModule )
+            {
+                const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
+                if ( pItem )
+                    meFUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
+            }
+            else
+            {
+                DBG_ERRORFILE( "<PagePropertyPanel::MetricState(..)>: no module found" );
+            }
+        }
+    }
+}
+
+
+
+
+void PagePropertyPanel::ChangeMarginImage()
+{
+    if ( mpPageLRMarginItem.get() == 0 ||
+         mpPageULMarginItem.get() == 0 ||
+         mpPageItem.get() == 0 )
+    {
+        return;
+    }
+
+    const long cTolerance = 5;
+
+    if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance &&
+        mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR )
+        mpToolBoxMargin->SetItemImage( TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNarrow_L : mImgNarrow );
+
+    else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance &&
+        mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR )
+        mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNormal_L : mImgNormal );
+
+    else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance &&
+        abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance &&
+        abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR )
+        mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgWide_L : mImgWide );
+
+    else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance &&
+        abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance &&
+        mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR )
+        mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMirrored_L : mImgMirrored );
+
+    else 
+        mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMarginCustom_L : mImgMarginCustom );
+}
+
+
+void PagePropertyPanel::ChangeSizeImage()
+{
+    if ( mpPageSizeItem.get() == 0 ||
+         mpPageItem.get() == 0 )
+    {
+        return;
+    }
+
+    Size aTmpPaperSize = mpPageSizeItem->GetSize();
+    if ( mpPageItem->IsLandscape() )
+    {
+        Swap( aTmpPaperSize ); // Swap(..) defined in editeng/paperinf.hxx
+    }
+
+    mePaper = SvxPaperInfo::GetSvxPaper( aTmpPaperSize, static_cast<MapUnit>(meUnit), sal_True );
+
+    sal_uInt16 nImageIdx = 0;
+    switch ( mePaper )
+    {
+    case PAPER_A3:
+        nImageIdx = 1;
+        break;
+    case PAPER_A4:
+        nImageIdx = 2;
+        break;
+    case PAPER_A5:
+        nImageIdx = 3;
+        break;
+    case PAPER_B4_ISO:
+        nImageIdx = 4;
+        break;
+    case PAPER_B5_ISO:
+        nImageIdx = 5;
+        break;
+    case PAPER_ENV_C5:
+        nImageIdx = 6;
+        break;
+    case PAPER_LETTER:
+        nImageIdx = 7;
+        break;
+    case PAPER_LEGAL:
+        nImageIdx = 8;
+        break;
+    default:
+        nImageIdx = 0;
+        mePaper = PAPER_USER;
+        break;
+    }
+
+    if ( nImageIdx == 0 )
+    {
+        mpToolBoxSize->SetItemImage( TBI_SIZE, 
+                                     ( mpPageItem->IsLandscape() ? mImgSizeNone_L : mImgSizeNone  ) );
+    }
+    else
+    {
+        mpToolBoxSize->SetItemImage( TBI_SIZE, 
+                                     ( mpPageItem->IsLandscape() ? maImgSize_L[nImageIdx-1] : maImgSize[nImageIdx-1] ) );
+    }
+}
+
+
+void PagePropertyPanel::ChangeColumnImage( const sal_uInt16 nColumnType )
+{
+    if ( mpPageItem.get() == 0 )
+    {
+        return;
+    }
+
+    if ( !mpPageItem->IsLandscape() )
+    {
+        switch( nColumnType )
+        {
+        case 1:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1);
+            break;
+        case 2:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2);
+            break;
+        case 3:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3);
+            break;
+        case 4:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft);
+            break;
+        case 5:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight);
+            break;
+        default:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone);
+        }
+    }
+    else
+    {
+        switch( nColumnType )
+        {
+        case 1:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1_L);
+            break;
+        case 2:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2_L);
+            break;
+        case 3:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3_L);
+            break;
+        case 4:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft_L);
+            break;
+        case 5:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight_L);
+            break;
+        default:
+            mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone_L);
+        }
+    }
+}
+
+} } // end of namespace ::sw::sidebar
diff --git a/main/sw/source/ui/sidebar/PagePropertyPanel.hrc b/main/sw/source/ui/sidebar/PagePropertyPanel.hrc
new file mode 100644
index 0000000..1f12b2b
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PagePropertyPanel.hrc
@@ -0,0 +1,200 @@
+/**************************************************************
+* 
+* 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 "PropertyPanel.hrc"
+	
+#define FT_ORIENTATION			1
+#define TB_ORIENTATION			2
+#define FT_MARGIN				3
+#define TB_MARGIN				4
+#define FT_SIZE					5
+#define TB_SIZE					6
+#define FT_COLUMN				7
+#define TB_COLUMN				8
+#define TBI_MARGIN				9
+#define IMG_PORTRAIT			10
+#define IMG_LANDSCAPE			11
+#define STR_PORTRAIT			12
+#define STR_LANDSCAPE			13
+#define ED_SWPAPER_WIDTH		14
+#define ED_SWPAPER_HEIGHT		15
+#define LB_SWPAPER_TRAY			16
+#define LB_SWPAPER_SIZE			17
+#define MF_SWLEFT_MARGIN		18
+#define MF_SWRIGHT_MARGIN		19
+#define MF_SWTOP_MARGIN			20
+#define MF_SWBOTTOM_MARGIN		21
+#define TBI_SIZE				22
+#define VS_SIZE					23
+#define STR_LCVALUE				24
+#define FT_CUSTOM				25
+#define FLD_WIDTH_HEIGHT		26
+
+#define TBI_ORIENTATION			28
+#define VS_ORIENTATION          29
+#define IMG_PAGE_PORTRAIT		30
+#define IMG_PAGE_LANDSCAPE		31
+#define IMG_NARROW			    32
+#define IMG_NORMAL			    33
+#define IMG_WIDE			    34
+#define IMG_MIRRORED			35
+#define STR_NARROW			    36
+#define STR_NORMAL			    37
+#define STR_WIDE			    38
+#define STR_MIRRORED			39
+#define VS_MARGIN				40
+#define	IMG_CUSTOM				41
+#define FT_LEFT					42
+#define FT_RIGHT				43
+#define FT_TOP					44
+#define FT_BOTTOM				45
+#define FT_INNER				46
+#define FT_OUTER				47
+#define	TBI_COLUMN				48
+#define VS_COLUMN				49
+#define MBOX_WIDTH				50
+#define IMG_ONE					51
+#define IMG_TWO					52
+#define IMG_THREE				53
+#define IMG_LEFT				54
+#define IMG_RIGHT				55
+#define STR_ONE					56
+#define STR_TWO					57
+#define STR_THREE				58
+#define STR_LEFT				59
+#define STR_RIGHT				60
+#define CB_COLUMN_MORE			61
+
+#define CB_SIZE_MORE			61
+
+#define IMG_PAGE_NARROW			64
+#define IMG_PAGE_NORMAL			65
+#define IMG_PAGE_WIDE			63
+#define IMG_PAGE_MIRRORED		67
+#define IMG_PAGE_MARGIN_CUSTOM	68
+#define IMG_PAGE_A3				69
+#define IMG_PAGE_A4				70
+#define IMG_PAGE_A5				71
+#define IMG_PAGE_B4				72
+#define IMG_PAGE_B5				73
+#define IMG_PAGE_C5				74
+#define IMG_PAGE_LETTER			75
+#define IMG_PAGE_LEGAL			76
+#define IMG_PAGE_COLUMN_1		77
+#define IMG_PAGE_COLUMN_2		78
+#define IMG_PAGE_COLUMN_3		79
+#define IMG_PAGE_COLUMN_LEFT	80
+#define IMG_PAGE_COLUMN_RIGHT   81
+#define IMG_PAGE_SIZE_NONE		82
+#define IMG_PAGE_COLUMN_NONE	83
+#define IMG_PAGE_COLUMN_1_L		84
+#define IMG_PAGE_COLUMN_2_L		85
+#define IMG_PAGE_COLUMN_3_L		86
+#define IMG_PAGE_COLUMN_LEFT_L	87
+#define IMG_PAGE_COLUMN_RIGHT_L 88
+#define IMG_PAGE_COLUMN_NONE_L	89
+#define IMG_ONE_L				90
+#define IMG_TWO_L				91
+#define IMG_THREE_L				92
+#define IMG_LEFT_L				93
+#define IMG_RIGHT_L				94
+#define IMG_PAGE_A3_L			95
+#define IMG_PAGE_A4_L			96
+#define IMG_PAGE_A5_L			97
+#define IMG_PAGE_B4_L			98
+#define IMG_PAGE_B5_L			99
+#define IMG_PAGE_C5_L			100
+#define IMG_PAGE_LETTER_L		101
+#define IMG_PAGE_LEGAL_L		102
+#define IMG_PAGE_SIZE_NONE_L	103
+#define IMG_PAGE_NARROW_L		104
+#define IMG_PAGE_NORMAL_L		105
+#define IMG_PAGE_WIDE_L			106
+#define IMG_PAGE_MIRRORED_L		107
+#define IMG_PAGE_MARGIN_CUSTOM_L	108
+#define IMG_NARROW_L			109
+#define IMG_NORMAL_L			110
+#define IMG_WIDE_L			    111
+#define IMG_MIRRORED_L			112
+#define FLD_LEFT_MARGIN			113
+#define FLD_RIGHT_MARGIN		114
+#define FLD_TOP_MARGIN			115
+#define FLD_BOTTOM_MARGIN		116
+
+#define STR_QHELP_TB_ORIENTATION	117
+#define STR_QHELP_TB_MARGIN			118
+#define STR_QHELP_TB_SIZE			119
+#define STR_QHELP_TB_COLUMN			120
+#define IMG_CUSTOM_DIS			121
+//
+#define STR_MARGIN_TOOLTIP_LEFT				122
+#define STR_MARGIN_TOOLTIP_RIGHT				123
+#define STR_MARGIN_TOOLTIP_INNER				124
+#define STR_MARGIN_TOOLTIP_OUTER				125
+#define STR_MARGIN_TOOLTIP_TOP					126
+#define STR_MARGIN_TOOLTIP_BOT					127
+
+#define POPUP_MARGIN            4
+#define VS_WIDTH				78
+#define ITEM_HEIGHT				17 
+#define ITEM_HEIGHT2			15 
+
+//========================================Position==============================================
+
+#define FT_ORIENTATION_X			SECTIONPAGE_MARGIN_HORIZONTAL
+#define FT_ORIENTATION_Y			SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define TBX_ORIENTATION_X			FT_ORIENTATION_X
+#define TBX_ORIENTATION_Y			FT_ORIENTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_MARGIN_X					FT_ORIENTATION_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL
+#define FT_MARGIN_Y					FT_ORIENTATION_Y
+#define TBX_MARGIN_X				FT_MARGIN_X
+#define TBX_MARGIN_Y				TBX_ORIENTATION_Y
+#define FT_SIZE_X					FT_ORIENTATION_X
+#define FT_SIZE_Y					TBX_ORIENTATION_Y + 20 + CONTROL_SPACING_VERTICAL
+#define TBX_SIZE_X					FT_SIZE_X
+#define TBX_SIZE_Y					FT_SIZE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
+#define FT_COLUMN_X					FT_MARGIN_X
+#define FT_COLUMN_Y					FT_SIZE_Y
+#define TBX_COLUMN_X				FT_COLUMN_X
+#define TBX_COLUMN_Y				TBX_SIZE_Y
+
+#define FT_CUSTOM_X					POPUP_MARGIN + OFFSET_X
+#define FT_CUSTOM_Y					POPUPPANEL_MARGIN_SMALL * 2 + ITEM_HEIGHT * 5
+
+#define POP_BORDER_X						POPUP_MARGIN + OFFSET_X + 1
+#define POP_BORDER_Y						POPUPPANEL_MARGIN_SMALL * 3 + ITEM_HEIGHT * 5 + TEXT_HEIGHT
+#define BD_WIDTH							VS_WIDTH - 6
+#define BD_HEIGHT							MBOX_HEIGHT*4 + CONTROL_SPACING_VERTICAL*5
+
+#define FT_X								POP_BORDER_X + 	CONTROL_SPACING_HORIZONTAL
+#define MF_X								FT_X + 25 +	CONTROL_SPACING_HORIZONTAL
+#define LEFT_MF_Y							POP_BORDER_Y + 	CONTROL_SPACING_VERTICAL
+#define RIGHT_MF_Y							LEFT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define TOP_MF_Y							RIGHT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define BOTTOM_MF_Y							TOP_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
+#define FT_LEFT_Y							LEFT_MF_Y + 1
+#define FT_RIGHT_Y							RIGHT_MF_Y + 1
+#define FT_TOP_Y							TOP_MF_Y + 1
+#define FT_BOTTOM_Y							BOTTOM_MF_Y + 1
+
+#define MARGIN_PANEL_HEIGHT					POP_BORDER_Y + 	BD_HEIGHT + POPUP_MARGIN + OFFSET_Y
+#define CUST_MORE_BUTTON_IMG_OFF_X			POPUPPANEL_MARGIN_HORIZONTAL + OFFSET_X
+#define PAGE_HEIGHT							TBX_COLUMN_Y + 20 + SECTIONPAGE_MARGIN_VERTICAL_BOT
\ No newline at end of file
diff --git a/main/sw/source/ui/sidebar/PagePropertyPanel.hxx b/main/sw/source/ui/sidebar/PagePropertyPanel.hxx
new file mode 100644
index 0000000..7b354fa
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PagePropertyPanel.hxx
@@ -0,0 +1,223 @@
+/**************************************************************
+* 
+* 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 SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
+#define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
+
+#include <svx/sidebar/Popup.hxx>
+
+#include <sfx2/sidebar/ControllerItem.hxx>
+
+namespace svx { namespace sidebar {
+    class PopupControl;
+} }
+
+#include <i18npool/paper.hxx>
+
+#include <svx/pageitem.hxx>
+#include <svx/rulritem.hxx>
+#include <editeng/sizeitem.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <svl/intitem.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sw { namespace sidebar {
+
+    class PagePropertyPanel 
+        : public Control,
+          public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+    {
+    public:
+        static PagePropertyPanel* Create(
+            Window* pParent,
+            SfxBindings* pBindings );
+
+        // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+        virtual void NotifyItemUpdate(
+            const sal_uInt16 nSId,
+            const SfxItemState eState,
+            const SfxPoolItem* pState );
+
+        SfxBindings* GetBindings() const
+        {
+            return mpBindings;
+        }
+
+
+        ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
+        void ExecuteOrientationChange( const sal_Bool bLandscape );
+        void ClosePageOrientationPopup();
+
+        ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
+        void ExecuteMarginLRChange( 
+            const long nPageLeftMargin,
+            const long nPageRightMargin );
+        void ExecuteMarginULChange(
+            const long nPageTopMargin,
+            const long nPageBottomMargin );
+        void ExecutePageLayoutChange( const bool bMirrored );
+        void ClosePageMarginPopup();
+
+        ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
+        void ExecuteSizeChange( const Paper ePaper );
+        void ClosePageSizePopup();
+
+        ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
+        void ExecuteColumnChange( const sal_uInt16 nColumnType );
+        void ClosePageColumnPopup();
+
+    private:
+        PagePropertyPanel(
+            Window* pParent,
+            SfxBindings* pBindings );
+        virtual ~PagePropertyPanel(void);
+
+        SfxBindings* mpBindings;
+
+        // toolboxes - on click open corresponding popup
+        FixedText   maFtOrientation;
+        ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground;
+        ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation;
+        FixedText				maFtMargin;
+        ::boost::scoped_ptr<Window> mpToolBoxMarginBackground;
+        ::boost::scoped_ptr<ToolBox> mpToolBoxMargin;
+        FixedText				maFtSize;
+        ::boost::scoped_ptr<Window> mpToolBoxSizeBackground;
+        ::boost::scoped_ptr<ToolBox> mpToolBoxSize;
+        FixedText				maFtColumn;
+        ::boost::scoped_ptr<Window> mpToolBoxColumnBackground;
+        ::boost::scoped_ptr<ToolBox> mpToolBoxColumn;
+
+        Image*					maImgSize;
+        Image*					maImgSize_L;
+        Image					mImgPortrait;
+        Image					mImgLandscape;
+        Image					mImgNarrow;
+        Image					mImgNormal;
+        Image					mImgWide;
+        Image					mImgMirrored;
+        Image					mImgMarginCustom;
+        Image					mImgNarrow_L;
+        Image					mImgNormal_L;
+        Image					mImgWide_L;
+        Image					mImgMirrored_L;
+        Image					mImgMarginCustom_L;
+        Image					mImgA3;
+        Image					mImgA4;
+        Image					mImgA5;
+        Image					mImgB4;
+        Image					mImgB5;
+        Image					mImgC5;
+        Image					mImgLetter;
+        Image					mImgLegal;
+        Image					mImgSizeNone;
+        Image					mImgA3_L;
+        Image					mImgA4_L;
+        Image					mImgA5_L;
+        Image					mImgB4_L;
+        Image					mImgB5_L;
+        Image					mImgC5_L;
+        Image					mImgLetter_L;
+        Image					mImgLegal_L;
+        Image					mImgSizeNone_L;
+        Image					mImgColumn1;
+        Image					mImgColumn2;
+        Image					mImgColumn3;
+        Image					mImgLeft;
+        Image					mImgRight;
+        Image					mImgColumnNone;
+        Image					mImgColumn1_L;
+        Image					mImgColumn2_L;
+        Image					mImgColumn3_L;
+        Image					mImgLeft_L;
+        Image					mImgRight_L;
+        Image					mImgColumnNone_L;
+
+        // item keeping the following page style attributes:
+        // - page orientation
+        // - page usage - only left, only right, both, mirrored
+        // item also hold the numbering type for the page style which should
+        // be kept stable.
+        ::boost::scoped_ptr<SvxPageItem> mpPageItem;
+
+        // item keeping the page style's left and right margins
+        ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
+        // item keeping the page style's top and bottom margins
+        ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
+
+        // item keeping the page style's page size
+        ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem;
+        // Paper corresponding to the page style's page size
+        Paper mePaper;
+
+        // item keeping the page column type
+        ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem;
+
+        FieldUnit 			meFUnit;
+        SfxMapUnit			meUnit;
+
+        // controller items
+        ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl;
+        ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl;
+        ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl;
+        ::sfx2::sidebar::ControllerItem m_aSwPagePgControl;
+        ::sfx2::sidebar::ControllerItem m_aSwPageColControl;
+        ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
+        
+        // popups
+        ::boost::scoped_ptr< ::svx::sidebar::Popup > mpOrientationPopup;
+        ::boost::scoped_ptr< ::svx::sidebar::Popup > mpMarginPopup;
+        ::boost::scoped_ptr< ::svx::sidebar::Popup > mpSizePopup;
+        ::boost::scoped_ptr< ::svx::sidebar::Popup > mpColumnPopup;
+
+        bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
+
+        // handler for popup toolboxes to show the popups
+        DECL_LINK(ClickOrientationHdl, ToolBox* );
+        DECL_LINK(ClickMarginHdl, ToolBox* );
+        DECL_LINK(ClickSizeHdl, ToolBox* );
+        DECL_LINK(ClickColumnHdl, ToolBox* );
+
+        void Initialize();
+
+        void MetricState( SfxItemState eState, const SfxPoolItem* pState );
+
+        // helper to adjust popup toolbox' images
+        void ChangeMarginImage();
+        void ChangeSizeImage();
+        void ChangeColumnImage( const sal_uInt16 nColumnType );
+
+    };
+
+} } // end of namespace ::sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/PagePropertyPanel.src b/main/sw/source/ui/sidebar/PagePropertyPanel.src
new file mode 100644
index 0000000..c9f57d4
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PagePropertyPanel.src
@@ -0,0 +1,698 @@
+/**************************************************************
+* 
+* 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 <sfx2/sidebar/propertypanel.hrc>
+#include "PropertyPanel.hrc"
+#include "PagePropertyPanel.hrc"
+#include "helpid.h"
+
+// page property panel control
+Control RID_PROPERTYPANEL_SWPAGE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT );
+	HelpID = HID_PROPERTYPANEL_SWPAGE_SECTION;
+	Text = "Page";
+	
+	FixedText FT_ORIENTATION
+	{
+	    Pos = MAP_APPFONT ( FT_ORIENTATION_X, FT_ORIENTATION_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Orientation:";
+	};
+	ToolBox TB_ORIENTATION
+	{
+		Pos = MAP_APPFONT (TBX_ORIENTATION_X, TBX_ORIENTATION_Y) ;
+		HelpID = HID_SWPAGE_ORIENTATION;
+		SVLook = TRUE ;
+		TabStop = TRUE ;
+		Text = "Orientation" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				HelpID = HID_SWPAGE_TBI_ORIENTATION;
+				Identifier = TBI_ORIENTATION ;
+				Text [ en-US ] = "Orientation" ;
+				DropDown = TRUE ;
+			};
+		};
+	};
+	String STR_QHELP_TB_ORIENTATION
+	{
+		Text [ en-US ] = "Select the paper orientation - vertically (portrait) or horizontally (landscape) - for the current page style.";
+	};
+
+	FixedText FT_MARGIN
+	{
+	    Pos = MAP_APPFONT ( FT_MARGIN_X, FT_MARGIN_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Margin:";
+	};
+	ToolBox TB_MARGIN
+	{
+		SVLook = TRUE ;
+		Pos = MAP_APPFONT (TBX_MARGIN_X, TBX_MARGIN_Y) ;
+		HelpID = HID_SWPAGE_MARGIN;
+		TabStop = TRUE ;
+		Text = "Margin" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				HelpID = HID_SWPAGE_TBI_MARGIN;
+				Identifier = TBI_MARGIN ;
+				Text [ en-US ] = "Margin" ;
+				DropDown = TRUE ;
+			};
+		};
+	};
+	String STR_QHELP_TB_MARGIN
+	{
+		Text [ en-US ] = "Select the margin values for the current page style.";
+	};
+
+	FixedText FT_SIZE
+	{
+	    Pos = MAP_APPFONT ( FT_SIZE_X, FT_SIZE_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Size:";
+	};
+	ToolBox TB_SIZE
+	{        
+        SVLook = TRUE ;
+		Pos = MAP_APPFONT ( TBX_SIZE_X , TBX_SIZE_Y ) ;
+		HelpID = HID_SWPAGE_SIZE;
+		TabStop = TRUE ;
+		Text = "Size" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				HelpID = HID_SWPAGE_TBI_SIZE;
+				Identifier = TBI_SIZE ;
+				Text [ en-US ] = "Size" ;
+				DropDown = TRUE ;
+			};
+		};
+	};
+	String STR_QHELP_TB_SIZE
+	{
+		Text [ en-US ] = "Select a predefined paper size for the current page style.";
+	};
+
+	FixedText FT_COLUMN
+	{
+	    Pos = MAP_APPFONT ( FT_COLUMN_X, FT_COLUMN_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Column:";
+	};
+	ToolBox TB_COLUMN
+	{        
+        SVLook = TRUE ;
+		Pos = MAP_APPFONT ( TBX_COLUMN_X , TBX_COLUMN_Y ) ;
+		HelpID = HID_SWPAGE_COLUMN;
+		TabStop = TRUE ;
+		Text = "Column" ;
+		ItemList =
+		{
+			ToolBoxItem
+			{
+				HelpID = HID_SWPAGE_TBI_COLUMN;
+				Identifier = TBI_COLUMN;
+				Text [ en-US ] = "Column" ;
+				DropDown = TRUE ;
+			};
+		};
+	};
+	String STR_QHELP_TB_COLUMN
+	{
+		Text [ en-US ] = "Select the layout and the number of columns for the current page style.";
+	};
+
+	Image IMG_PAGE_PORTRAIT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";};
+	};
+	Image IMG_PAGE_LANDSCAPE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";};
+	};
+	Image IMG_PAGE_NARROW
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";};
+	};
+	Image IMG_PAGE_NORMAL
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";};
+	};
+	Image IMG_PAGE_WIDE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";};
+	};
+	Image IMG_PAGE_MIRRORED
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";};
+	};
+	Image IMG_PAGE_MARGIN_CUSTOM
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_copy_24x24.png";};
+	};
+	Image IMG_PAGE_NARROW_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";};
+	};
+	Image IMG_PAGE_NORMAL_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";};
+	};
+	Image IMG_PAGE_WIDE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";};
+	};
+	Image IMG_PAGE_MIRRORED_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";};
+	};
+	Image IMG_PAGE_MARGIN_CUSTOM_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatcopy_24x24.png";};
+	};
+	Image IMG_PAGE_A3
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A3_24x24.png";};
+	};
+	Image IMG_PAGE_A4
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A4_24x24.png";};
+	};
+	Image IMG_PAGE_A5
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A5_24x24.png";};
+	};
+	Image IMG_PAGE_B4
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B4_24x24.png";};
+	};
+	Image IMG_PAGE_B5
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B5_24x24.png";};
+	};
+	Image IMG_PAGE_C5
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_C5_24x24.png";};
+	};
+	Image IMG_PAGE_LETTER
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";};
+	};
+	Image IMG_PAGE_LEGAL
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";};
+	};
+	Image IMG_PAGE_SIZE_NONE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";};
+	};
+	Image IMG_PAGE_A3_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA3_24x24.png";};
+	};
+	Image IMG_PAGE_A4_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA4_24x24.png";};
+	};
+	Image IMG_PAGE_A5_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA5_24x24.png";};
+	};
+	Image IMG_PAGE_B4_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB4_24x24.png";};
+	};
+	Image IMG_PAGE_B5_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB5_24x24.png";};
+	};
+	Image IMG_PAGE_C5_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeC5_24x24.png";};
+	};
+	Image IMG_PAGE_LETTER_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";};
+	};
+	Image IMG_PAGE_LEGAL_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";};
+	};
+	Image IMG_PAGE_SIZE_NONE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_1
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_2
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_3
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_LEFT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_RIGHT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_NONE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_copy_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_1_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_2_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_3_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_LEFT_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_RIGHT_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";};
+	};
+	Image IMG_PAGE_COLUMN_NONE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columncopy_24x24.png";};
+	};
+};
+
+// popup for page orientation attribute
+Control RID_POPUP_SWPAGE_ORIENTATION
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, ITEM_HEIGHT*2 + POPUPPANEL_MARGIN_SMALL*2 );
+	
+	Control VS_ORIENTATION
+	{
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); 
+        Size = MAP_APPFONT ( VS_WIDTH  , ITEM_HEIGHT*2);
+        HelpID = HID_SWPAGE_VS_ORIENTATION;
+		TabStop = TRUE ;
+		Text = "Orientation";
+	};
+	Image IMG_PORTRAIT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";};
+	};
+	Image IMG_LANDSCAPE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";};
+	};
+	String STR_PORTRAIT
+	{
+		Text [ en-US ] = "Portrait";
+	};
+	String STR_LANDSCAPE
+	{
+		Text [ en-US ] = "Landscape";
+	};
+};
+
+// popup for page style's margin attributes
+Control RID_POPUP_SWPAGE_MARGIN
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, MARGIN_PANEL_HEIGHT );
+	
+	Control VS_MARGIN
+	{
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
+        Size = MAP_APPFONT ( VS_WIDTH  , ITEM_HEIGHT*5);
+        HelpID = HID_SWPAGE_VS_MARGIN;
+		TabStop = TRUE ;
+		Text = "Margin";
+	};
+	FixedText FT_CUSTOM
+	{
+	    Pos = MAP_APPFONT ( FT_CUSTOM_X, FT_CUSTOM_Y );
+        Size = MAP_APPFONT ( MBOX_WIDTH + 30, TEXT_HEIGHT) ;
+		Text [ en-US ] = "Custom:";
+	};
+	FixedText FT_LEFT
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Left:";
+	};
+	FixedText FT_INNER
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "I~nner:";
+	};
+	MetricField MF_SWLEFT_MARGIN
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_X , LEFT_MF_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT );
+		HelpID = HID_SWPAGE_LEFT_MARGIN;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+	FixedText FT_RIGHT
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Right:";
+	};
+	FixedText FT_OUTER
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "O~uter:";
+	};
+	MetricField MF_SWRIGHT_MARGIN
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_X , RIGHT_MF_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT );
+		HelpID = HID_SWPAGE_RIGHT_MARGIN;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+	FixedText FT_TOP
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_TOP_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Top:";
+	};
+	MetricField MF_SWTOP_MARGIN
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_X , TOP_MF_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT );
+		HelpID = HID_SWPAGE_TOP_MARGIN;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+	FixedText FT_BOTTOM
+	{
+	    Pos = MAP_APPFONT ( FT_X, FT_BOTTOM_Y );
+        Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ;
+		Text [ en-US ] = "~Bottom:";
+	};
+	MetricField MF_SWBOTTOM_MARGIN
+	{
+		Border = TRUE;
+		Pos = MAP_APPFONT ( MF_X , BOTTOM_MF_Y );
+		Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT );
+		HelpID = HID_SWPAGE_BOTTOM_MARGIN;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+	MetricField FLD_WIDTH_HEIGHT
+	{
+		Border = TRUE;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+	
+	Image IMG_NARROW
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";};
+	};
+	Image IMG_NORMAL
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";};
+	};
+	Image IMG_WIDE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";};
+	};
+	Image IMG_MIRRORED
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";};
+	};
+	Image IMG_NARROW_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";};
+	};
+	Image IMG_NORMAL_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";};
+	};
+	Image IMG_WIDE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";};
+	};
+	Image IMG_MIRRORED_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";};
+	};
+	Image IMG_CUSTOM
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common.png";};
+	};
+	Image IMG_CUSTOM_DIS
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common_grey.png";};
+	};
+	String STR_LCVALUE
+	{
+		Text [ en-US ] = "Last Custom Values";
+	};
+	String STR_NARROW
+	{
+		Text [ en-US ] = "Narrow";
+	};
+	String STR_NORMAL
+	{
+		Text [ en-US ] = "Normal";
+	};
+	String STR_WIDE
+	{
+		Text [ en-US ] = "Wide";
+	};
+	String STR_MIRRORED
+	{
+		Text [ en-US ] = "Mirrored";
+	};
+	String STR_MARGIN_TOOLTIP_LEFT
+	{
+		Text [ en-US ] = "Left: ";
+	};
+	String STR_MARGIN_TOOLTIP_RIGHT
+	{
+		Text [ en-US ] = ". Right: ";
+	};
+	String STR_MARGIN_TOOLTIP_INNER
+	{
+		Text [ en-US ] = "Inner: ";
+	};
+	String STR_MARGIN_TOOLTIP_OUTER
+	{
+		Text [ en-US ] = ". Outer: ";
+	};
+	String STR_MARGIN_TOOLTIP_TOP
+	{
+		Text [ en-US ] = ". Top: ";
+	};
+	String STR_MARGIN_TOOLTIP_BOT
+	{
+		Text [ en-US ] = ". Bottom: ";
+	};
+};
+
+// popup for page style's page size
+Control RID_POPUP_SWPAGE_SIZE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH + 22, ITEM_HEIGHT2*8 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 );
+	
+	Control VS_SIZE
+	{
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); 
+        Size = MAP_APPFONT ( VS_WIDTH + 22 , ITEM_HEIGHT2*8);
+        HelpID = HID_SWPAGE_VS_SIZE;
+		TabStop = TRUE ;
+		Text = "Size";
+	};
+	PushButton CB_SIZE_MORE
+	{
+		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT2*8 ) ;
+		Size = MAP_APPFONT ( VS_WIDTH - 2 + 22, 15 ) ;
+		HelpID = HID_SWPAGE_SIZE_MORE;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~More Options";
+		QuickHelpText [ en-US ] = "More Options" ;		
+	};	
+	MetricField FLD_WIDTH_HEIGHT
+	{
+		Border = TRUE;
+		Left = TRUE;
+		Repeat = TRUE;
+		Spin = TRUE;
+		Maximum = 9999;
+		DecimalDigits = 2;
+		Unit = FUNIT_CM;
+		Last = 9999;
+		SpinSize = 10;
+	};
+};
+
+// popup for page style's column attribute
+Control RID_POPUP_SWPAGE_COLUMN
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+	Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH - 15, ITEM_HEIGHT*5 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 );
+	
+	Control VS_COLUMN
+	{
+        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); 
+        Size = MAP_APPFONT ( VS_WIDTH -15 , ITEM_HEIGHT*5);
+        HelpID = HID_SWPAGE_VS_COLUMN;
+		TabStop = TRUE ;
+		Text = "Column";
+	};
+	PushButton CB_COLUMN_MORE
+	{
+		Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT*5 ) ;
+		Size = MAP_APPFONT ( VS_WIDTH - 2 - 15, 15 ) ;
+		HelpID = HID_SWPAGE_COLUMN_MORE;
+		TabStop = TRUE ;
+		Text [ en-US ] = "~More Options";
+		QuickHelpText [ en-US ] = "More Options" ;		
+	};	
+	Image  IMG_ONE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";};
+	};			
+	Image  IMG_TWO
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";};
+	};
+	Image  IMG_THREE
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";};
+	};
+	Image  IMG_LEFT	
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";};
+	};
+	Image  IMG_RIGHT
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";};
+	};
+	Image  IMG_ONE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";};
+	};			
+	Image  IMG_TWO_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";};
+	};
+	Image  IMG_THREE_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";};
+	};
+	Image  IMG_LEFT_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";};
+	};
+	Image  IMG_RIGHT_L
+	{
+		ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";};
+	};
+	String STR_ONE			
+	{
+		Text [ en-US ] = "1 Column";
+	};
+	String STR_TWO	
+	{
+		Text [ en-US ] = "2 Columns";
+	};
+	String STR_THREE
+	{
+		Text [ en-US ] = "3 Columns";
+	};
+	String STR_LEFT	
+	{
+		Text [ en-US ] = "Left";
+	};
+	String STR_RIGHT
+	{
+		Text [ en-US ] = "Right";
+	};
+};
diff --git a/main/sw/source/ui/sidebar/PageSizeControl.cxx b/main/sw/source/ui/sidebar/PageSizeControl.cxx
new file mode 100644
index 0000000..1bf0cd7
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageSizeControl.cxx
@@ -0,0 +1,186 @@
+/**************************************************************
+ * 
+ * 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_sw.hxx"
+
+#include "PageSizeControl.hxx"
+#include "PagePropertyPanel.hxx"
+#include "PagePropertyPanel.hrc"
+
+#include <cmdid.h>
+#include <swtypes.hxx>
+
+#include <svx/sidebar/ValueSetWithTextControl.hxx>
+
+#include <tools/inetmime.hxx>
+#include <editeng/paperinf.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+
+namespace sw { namespace sidebar {
+
+PageSizeControl::PageSizeControl(
+    Window* pParent,
+    PagePropertyPanel& rPanel,
+    const Paper ePaper,
+    const sal_Bool bLandscape,
+    const FieldUnit eFUnit )
+    : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) )
+    , mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) )
+    , maMoreButton( this, SW_RES(CB_SIZE_MORE) )
+    , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
+    , mePaper( ePaper )
+    , maPaperList()
+    , mrPagePropPanel(rPanel)
+{
+    maWidthHeightField.Hide();
+    SetFieldUnit( maWidthHeightField, eFUnit );
+
+    maPaperList.push_back( PAPER_A3 );
+    maPaperList.push_back( PAPER_A4 );
+    maPaperList.push_back( PAPER_A5 );
+    maPaperList.push_back( PAPER_B4_ISO );
+    maPaperList.push_back( PAPER_B5_ISO );
+    maPaperList.push_back( PAPER_ENV_C5 );
+    maPaperList.push_back( PAPER_LETTER );
+    maPaperList.push_back( PAPER_LEGAL );
+
+    mpSizeValueSet->SetStyle( mpSizeValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
+    mpSizeValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+    sal_uInt16 nSelectedItem = 0;
+    {
+        XubString aMetricStr;
+        {
+            const XubString aText = maWidthHeightField.GetText();
+            for (short i = aText.Len() - 1; i >= 0; i--)
+            {
+                xub_Unicode c = aText.GetChar(i);
+                if ( INetMIME::isAlpha(c) || (c == '\'') || (c == '\"') || (c == '%') )
+                {
+                    aMetricStr.Insert(c, 0);
+                }
+                else
+                {
+                    if (aMetricStr.Len())
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+
+        const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper();
+        String WidthStr;
+        String HeightStr;
+        String ItemText2;
+        for ( ::std::vector< Paper >::size_type nPaperIdx = 0;
+              nPaperIdx < maPaperList.size();
+              ++nPaperIdx )
+        {
+            Size aPaperSize = SvxPaperInfo::GetPaperSize( maPaperList[ nPaperIdx ] );
+            if ( bLandscape )
+            {
+                Swap( aPaperSize );
+            }
+            maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP );
+            WidthStr = localeDataWrapper.getNum(
+                maWidthHeightField.GetValue(),
+                maWidthHeightField.GetDecimalDigits(),
+                maWidthHeightField.IsUseThousandSep(),
+                maWidthHeightField.IsShowTrailingZeros() );
+
+            maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP);
+            HeightStr = localeDataWrapper.getNum(
+                maWidthHeightField.GetValue(),
+                maWidthHeightField.GetDecimalDigits(),
+                maWidthHeightField.IsUseThousandSep(),
+                maWidthHeightField.IsShowTrailingZeros() );
+
+            ItemText2 = HeightStr;
+            ItemText2 += String::CreateFromAscii(" x ");
+            ItemText2 += WidthStr;
+            ItemText2 += String::CreateFromAscii(" ");
+            ItemText2 += aMetricStr;
+
+            mpSizeValueSet->AddItem( 
+                SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ),
+                ItemText2,
+                0 );
+
+            if ( maPaperList[ nPaperIdx ] == mePaper )
+            {
+                nSelectedItem = nPaperIdx + 1;
+            }
+        }
+    }
+
+    mpSizeValueSet->SetNoSelection();
+    mpSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl,ImplSizeHdl ) );
+    mpSizeValueSet->Show();
+
+    mpSizeValueSet->SelectItem( nSelectedItem );
+    mpSizeValueSet->Format();
+    mpSizeValueSet->StartSelection();
+
+    maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) );
+    maMoreButton.GrabFocus();
+
+    FreeResource();
+}
+
+
+PageSizeControl::~PageSizeControl(void)
+{
+    delete mpSizeValueSet;
+}
+
+
+IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl)
+{
+    mpSizeValueSet->SetNoSelection();
+    if ( pControl == mpSizeValueSet )
+    {
+        const sal_uInt16 nSelectedPaper = mpSizeValueSet->GetSelectItemId();
+        const Paper ePaper = maPaperList[nSelectedPaper - 1];
+        if ( ePaper != mePaper )
+        {
+            mePaper = ePaper;
+            mrPagePropPanel.ExecuteSizeChange( mePaper );
+        }
+    }
+
+    mrPagePropPanel.ClosePageSizePopup();
+    return 0;
+}
+
+IMPL_LINK(PageSizeControl, MoreButtonClickHdl_Impl, void *, EMPTYARG)
+{
+    mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_SETTING_DLG, SFX_CALLMODE_ASYNCHRON );
+
+    mrPagePropPanel.ClosePageSizePopup();
+    return 0;
+}
+
+
+} } // end of namespace sw::sidebar
+
diff --git a/main/sw/source/ui/sidebar/PageSizeControl.hxx b/main/sw/source/ui/sidebar/PageSizeControl.hxx
new file mode 100644
index 0000000..2d0dc82
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PageSizeControl.hxx
@@ -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 _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_
+#define _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_
+
+#include <svx/sidebar/PopupControl.hxx>
+
+#include <i18npool/paper.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svtools/unitconv.hxx>
+
+#include <vector>
+
+namespace svx { namespace sidebar {
+    class ValueSetWithTextControl;
+} }
+
+namespace sw { namespace sidebar {
+
+class PagePropertyPanel;
+
+
+class PageSizeControl
+    : public ::svx::sidebar::PopupControl
+{
+public:
+    PageSizeControl(
+        Window* pParent,
+        PagePropertyPanel& rPanel,
+        const Paper ePaper,
+        const sal_Bool bLandscape,
+        const FieldUnit eFUnit );
+    ~PageSizeControl(void);
+
+private:
+    ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet;
+    PushButton maMoreButton;
+    // hidden metric field
+    MetricField maWidthHeightField;
+
+    Paper mePaper;
+    ::std::vector< Paper > maPaperList;
+
+    PagePropertyPanel& mrPagePropPanel;
+
+    DECL_LINK(ImplSizeHdl, void*);
+    DECL_LINK(MoreButtonClickHdl_Impl, void*);
+};
+
+} } // end of namespace sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/PropertyPanel.hrc b/main/sw/source/ui/sidebar/PropertyPanel.hrc
new file mode 100644
index 0000000..33fcb07
--- /dev/null
+++ b/main/sw/source/ui/sidebar/PropertyPanel.hrc
@@ -0,0 +1,42 @@
+/**************************************************************
+* 
+* 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 _SW_PROPERTY_PANEL_HRC
+#define _SW_PROPERTY_PANEL_HRC
+
+#include "rcid.hrc"
+
+#define RID_PROPERTYPANEL_SWOBJWRAP_PAGE    (RC_PROPERTYPANEL_BEGIN + 1)
+#define RID_PROPERTYPANEL_SWPAGE            (RC_PROPERTYPANEL_BEGIN + 2)
+#define RID_POPUP_SWPAGE_MARGIN             (RC_PROPERTYPANEL_BEGIN + 3)
+#define RID_POPUP_SWPAGE_ORIENTATION        (RC_PROPERTYPANEL_BEGIN + 4) 
+#define RID_POPUP_SWPAGE_COLUMN             (RC_PROPERTYPANEL_BEGIN + 5) 
+#define RID_POPUP_SWPAGE_SIZE               (RC_PROPERTYPANEL_BEGIN + 6) 
+
+#define PROPERTY_PANEL_END                RID_POPUP_SWPAGE_SIZE
+
+#if PROPERTY_SECTION_END > RC_PROPERTYPANEL_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
+
+
diff --git a/main/sw/source/ui/sidebar/SwPanelFactory.cxx b/main/sw/source/ui/sidebar/SwPanelFactory.cxx
new file mode 100644
index 0000000..502eed2
--- /dev/null
+++ b/main/sw/source/ui/sidebar/SwPanelFactory.cxx
@@ -0,0 +1,152 @@
+/**************************************************************
+ * 
+ * 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_sw.hxx"
+
+#include "SwPanelFactory.hxx"
+
+#include <PagePropertyPanel.hxx>
+#include <WrapPropertyPanel.hxx>
+#include <navipi.hxx>
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <rtl/ref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <boost/bind.hpp>
+
+
+using namespace css;
+using namespace cssu;
+using ::rtl::OUString;
+
+
+namespace sw { namespace sidebar {
+
+#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sw.sidebar.SwPanelFactory"
+#define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
+
+
+::rtl::OUString SAL_CALL SwPanelFactory::getImplementationName (void)
+{
+    return A2S(IMPLEMENTATION_NAME);
+}
+
+
+cssu::Reference<cssu::XInterface> SAL_CALL SwPanelFactory::createInstance(
+    const uno::Reference<lang::XMultiServiceFactory>& )
+{
+    ::rtl::Reference<SwPanelFactory> pPanelFactory (new SwPanelFactory());
+    cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY);
+    return xService;
+}
+
+
+cssu::Sequence<OUString> SAL_CALL SwPanelFactory::getSupportedServiceNames (void)
+{
+    cssu::Sequence<OUString> aServiceNames (1);
+    aServiceNames[0] = A2S(SERVICE_NAME);
+    return aServiceNames;
+
+}
+
+
+SwPanelFactory::SwPanelFactory (void)
+    : PanelFactoryInterfaceBase(m_aMutex)
+{
+}
+
+
+SwPanelFactory::~SwPanelFactory (void)
+{
+}
+
+
+Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
+    const ::rtl::OUString& rsResourceURL,
+    const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        container::NoSuchElementException,
+        lang::IllegalArgumentException,
+        RuntimeException)
+{
+    Reference<ui::XUIElement> xElement;
+
+    const ::comphelper::NamedValueCollection aArguments (rArguments);
+    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+    const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( ! xParentWindow.is() || pParentWindow==NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without ParentWindow"),
+            NULL);
+    if ( ! xFrame.is())
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without Frame"),
+            NULL);
+    if (pBindings == NULL)
+        throw RuntimeException(
+            A2S("PanelFactory::createUIElement called without SfxBindings"),
+            NULL);
+
+#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
+    if (DoesResourceEndWith("/PagePropertyPanel"))
+    {
+        PagePropertyPanel* pPanel = PagePropertyPanel::Create( pParentWindow, pBindings );
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(-1,-1,-1));
+    }
+    else if (DoesResourceEndWith("/WrapPropertyPanel"))
+    {
+        WrapPropertyPanel* pPanel = WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(-1,-1,-1));
+    }
+    else if (DoesResourceEndWith("/NavigatorPanel"))
+    {
+        Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow);
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel,
+            ui::LayoutSize(0,-1,-1));
+    }
+#undef DoesResourceEndWith
+
+    return xElement;
+}
+
+} } // end of namespace sw::sidebar
+
+// eof
diff --git a/main/sw/source/ui/sidebar/WrapPropertyPanel.cxx b/main/sw/source/ui/sidebar/WrapPropertyPanel.cxx
new file mode 100644
index 0000000..18fae92
--- /dev/null
+++ b/main/sw/source/ui/sidebar/WrapPropertyPanel.cxx
@@ -0,0 +1,266 @@
+/**************************************************************
+* 
+* 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_sw.hxx"
+
+#include "WrapPropertyPanel.hxx"
+#include "WrapPropertyPanel.hrc"
+#include "PropertyPanel.hrc"
+
+#include <cmdid.h>
+#include <swtypes.hxx>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/svapp.hxx>
+
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+
+namespace sw { namespace sidebar {
+
+WrapPropertyPanel* WrapPropertyPanel::Create (
+    Window* pParent,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+    SfxBindings* pBindings)
+{
+    if (pParent == NULL)
+        throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0);
+    if ( ! rxFrame.is())
+        throw ::com::sun::star::lang::IllegalArgumentException(A2S("no XFrame given to PagePropertyPanel::Create"), NULL, 1);
+    if (pBindings == NULL)
+        throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2);
+    
+    return new WrapPropertyPanel(
+        pParent,
+        rxFrame,
+        pBindings);
+}
+
+
+WrapPropertyPanel::WrapPropertyPanel(
+    Window* pParent,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+    SfxBindings* pBindings )
+    : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWOBJWRAP_PAGE))
+    , mxFrame( rxFrame )
+    , mpBindings(pBindings)
+    // visible controls
+    , mpRBNoWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_NO_WRAP) ) )
+    , mpRBWrapLeft( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_LEFT) ) )
+    , mpRBWrapRight( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_RIGHT) ) )
+    , mpRBWrapParallel( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_PARALLEL) ) )
+    , mpRBWrapThrough( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_THROUGH) ) )
+    , mpRBIdealWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_IDEAL) ) )
+    // resources
+    , aWrapIL(6,2)
+    , aWrapILH(6,2)
+    // controller items
+    , maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this)
+    , maSwWrapLeftControl(FN_FRAME_WRAP, *pBindings, *this)
+    , maSwWrapRightControl(FN_FRAME_WRAP_RIGHT, *pBindings, *this)
+    , maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this)
+    , maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this)
+    , maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this)
+{
+    Initialize();
+    FreeResource();
+}
+
+
+WrapPropertyPanel::~WrapPropertyPanel()
+{
+}
+
+
+void WrapPropertyPanel::Initialize()
+{
+    Link aLink = LINK(this, WrapPropertyPanel, WrapTypeHdl);
+    mpRBNoWrap->SetClickHdl(aLink);
+    mpRBWrapLeft->SetClickHdl(aLink);
+    mpRBWrapRight->SetClickHdl(aLink);
+    mpRBWrapParallel->SetClickHdl(aLink);
+    mpRBWrapThrough->SetClickHdl(aLink);
+    mpRBIdealWrap->SetClickHdl(aLink);
+
+    aWrapIL.AddImage( IMG_NONE,
+                      ::GetImage( mxFrame, A2S(".uno:WrapOff"), sal_False, sal_False ) );
+    aWrapIL.AddImage( IMG_LEFT,
+                      ::GetImage( mxFrame, A2S(".uno:WrapLeft"), sal_False, sal_False ) );
+    aWrapIL.AddImage( IMG_RIGHT,
+                      ::GetImage( mxFrame, A2S(".uno:WrapRight"), sal_False, sal_False ) );
+    aWrapIL.AddImage( IMG_PARALLEL,
+                      ::GetImage( mxFrame, A2S(".uno:WrapOn"), sal_False, sal_False ) );
+    aWrapIL.AddImage( IMG_THROUGH,
+                      ::GetImage( mxFrame, A2S(".uno:WrapThrough"), sal_False, sal_False ) );
+    aWrapIL.AddImage( IMG_IDEAL,
+                      ::GetImage( mxFrame, A2S(".uno:WrapIdeal"), sal_False, sal_False ) );
+
+    aWrapILH.AddImage( IMG_NONE,
+                       ::GetImage( mxFrame, A2S(".uno:WrapOff"), sal_False, sal_True ) );
+    aWrapILH.AddImage( IMG_LEFT,
+                       ::GetImage( mxFrame, A2S(".uno:WrapLeft"), sal_False, sal_True ) );
+    aWrapILH.AddImage( IMG_RIGHT,
+                       ::GetImage( mxFrame, A2S(".uno:WrapRight"), sal_False, sal_True ) );
+    aWrapILH.AddImage( IMG_PARALLEL,
+                       ::GetImage( mxFrame, A2S(".uno:WrapOn"), sal_False, sal_True ) );
+    aWrapILH.AddImage( IMG_THROUGH,
+                       ::GetImage( mxFrame, A2S(".uno:WrapThrough"), sal_False, sal_True ) );
+    aWrapILH.AddImage( IMG_IDEAL,
+                       ::GetImage( mxFrame, A2S(".uno:WrapIdeal"), sal_False, sal_True ) );
+
+    mpRBNoWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_NONE) );
+    mpRBNoWrap->SetModeRadioImage( aWrapILH.GetImage(IMG_NONE) , BMP_COLOR_HIGHCONTRAST );
+    if ( Application::GetSettings().GetLayoutRTL() )
+    {
+        mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) );
+        mpRBWrapLeft->SetModeRadioImage( aWrapILH.GetImage(IMG_RIGHT) , BMP_COLOR_HIGHCONTRAST );
+        mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) );
+        mpRBWrapRight->SetModeRadioImage( aWrapILH.GetImage(IMG_LEFT) , BMP_COLOR_HIGHCONTRAST );
+    }
+    else
+    {
+        mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) );
+        mpRBWrapLeft->SetModeRadioImage( aWrapILH.GetImage(IMG_LEFT) , BMP_COLOR_HIGHCONTRAST );
+        mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) );
+        mpRBWrapRight->SetModeRadioImage( aWrapILH.GetImage(IMG_RIGHT) , BMP_COLOR_HIGHCONTRAST );
+    }
+    mpRBWrapParallel->SetModeRadioImage( aWrapIL.GetImage(IMG_PARALLEL) );
+    mpRBWrapParallel->SetModeRadioImage( aWrapILH.GetImage(IMG_PARALLEL) , BMP_COLOR_HIGHCONTRAST );
+    mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(IMG_THROUGH) );
+    mpRBWrapThrough->SetModeRadioImage( aWrapILH.GetImage(IMG_THROUGH) , BMP_COLOR_HIGHCONTRAST );
+    mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_IDEAL) );
+    mpRBIdealWrap->SetModeRadioImage( aWrapILH.GetImage(IMG_IDEAL) , BMP_COLOR_HIGHCONTRAST );
+
+    mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText());
+    mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText());
+    mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText());
+    mpRBWrapParallel->SetAccessibleName(mpRBWrapParallel->GetQuickHelpText());
+    mpRBWrapThrough->SetAccessibleName(mpRBWrapThrough->GetQuickHelpText());
+    mpRBIdealWrap->SetAccessibleName(mpRBIdealWrap->GetQuickHelpText());
+
+    mpBindings->Update( FN_FRAME_NOWRAP );
+    mpBindings->Update( FN_FRAME_WRAP );
+    mpBindings->Update( FN_FRAME_WRAP_RIGHT );
+    mpBindings->Update( FN_FRAME_WRAP_LEFT );
+    mpBindings->Update( FN_FRAME_WRAPTHRU );
+    mpBindings->Update( FN_FRAME_WRAP_IDEAL );
+}
+
+
+IMPL_LINK(WrapPropertyPanel, WrapTypeHdl, void *, EMPTYARG)
+{
+    sal_uInt16 nSlot = 0;
+    if ( mpRBWrapLeft->IsChecked() )
+    {
+        nSlot = FN_FRAME_WRAP_LEFT;
+    }
+    else if( mpRBWrapRight->IsChecked() )
+    {
+        nSlot = FN_FRAME_WRAP_RIGHT;
+    }
+    else if ( mpRBWrapParallel->IsChecked() )
+    {
+        nSlot = FN_FRAME_WRAP;
+    }
+    else if( mpRBWrapThrough->IsChecked() )
+    {
+        nSlot = FN_FRAME_WRAPTHRU;
+    }
+    else if( mpRBIdealWrap->IsChecked() )
+    {
+        nSlot = FN_FRAME_WRAP_IDEAL;
+    }
+    else
+    {
+        nSlot = FN_FRAME_NOWRAP;
+    }
+    SfxBoolItem bStateItem( nSlot, sal_True );
+    mpBindings->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_RECORD, &bStateItem, 0L );
+
+    return 0;
+}
+
+
+void WrapPropertyPanel::NotifyItemUpdate(
+    const sal_uInt16 nSId,
+    const SfxItemState eState,
+    const SfxPoolItem* pState )
+{
+    if ( eState == SFX_ITEM_AVAILABLE &&
+        pState->ISA(SfxBoolItem) )
+    {
+        //Set Radio Button enable
+        mpRBNoWrap->Enable(true);
+        mpRBWrapLeft->Enable(true);
+        mpRBWrapRight->Enable(true);
+        mpRBWrapParallel->Enable(true);
+        mpRBWrapThrough->Enable(true);
+        mpRBIdealWrap->Enable(true);
+
+        const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState );
+        switch( nSId )
+        {
+        case FN_FRAME_WRAP_RIGHT:
+            mpRBWrapRight->Check( pBoolItem->GetValue() );
+            break;
+        case FN_FRAME_WRAP_LEFT:
+            mpRBWrapLeft->Check( pBoolItem->GetValue() );
+            break;
+        case FN_FRAME_WRAPTHRU:
+            mpRBWrapThrough->Check( pBoolItem->GetValue() );
+            break;
+        case FN_FRAME_WRAP_IDEAL:
+            mpRBIdealWrap->Check( pBoolItem->GetValue() );
+            break;
+        case FN_FRAME_WRAP:
+            mpRBWrapParallel->Check( pBoolItem->GetValue() );
+            break;
+        case FN_FRAME_NOWRAP:
+        default:
+            mpRBNoWrap->Check( pBoolItem->GetValue() );
+            break;
+        }
+    }
+    else
+    {
+        mpRBNoWrap->Enable(false);
+        mpRBWrapLeft->Enable(false);
+        mpRBWrapRight->Enable(false);
+        mpRBWrapParallel->Enable(false);
+        mpRBWrapThrough->Enable(false);
+        mpRBIdealWrap->Enable(false);
+
+        mpRBNoWrap->Check( sal_False );
+        mpRBWrapLeft->Check( sal_False );
+        mpRBWrapRight->Check( sal_False );
+        mpRBWrapParallel->Check( sal_False );
+        mpRBWrapThrough->Check( sal_False );
+        mpRBIdealWrap->Check( sal_False );
+    }
+}
+
+} } // end of namespace ::sw::sidebar
diff --git a/main/sw/source/ui/sidebar/WrapPropertyPanel.hrc b/main/sw/source/ui/sidebar/WrapPropertyPanel.hrc
new file mode 100644
index 0000000..31edf27
--- /dev/null
+++ b/main/sw/source/ui/sidebar/WrapPropertyPanel.hrc
@@ -0,0 +1,42 @@
+/**************************************************************
+* 
+* 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 _SW_WRAPPROPERTYPANEL_HRC
+#define _SW_WRAPPROPERTYPANEL_HRC
+
+// RID_PROPERTYPANEL_SWOBJWRAP_PAGE
+#define	RB_NO_WRAP					1
+#define	RB_WRAP_LEFT				2
+#define RB_WRAP_RIGHT				3
+#define	RB_WRAP_PARALLEL			4
+#define RB_WRAP_THROUGH				5
+#define RB_WRAP_IDEAL				6
+
+// only for the ImageLists
+#define IMG_BEGIN       1
+#define IMG_NONE        (IMG_BEGIN)
+#define IMG_LEFT        (IMG_BEGIN + 1)
+#define IMG_RIGHT       (IMG_BEGIN + 2)
+#define IMG_PARALLEL    (IMG_BEGIN + 3)
+#define IMG_THROUGH     (IMG_BEGIN + 4)
+#define IMG_IDEAL       (IMG_BEGIN + 5)
+
+#endif
\ No newline at end of file
diff --git a/main/sw/source/ui/sidebar/WrapPropertyPanel.hxx b/main/sw/source/ui/sidebar/WrapPropertyPanel.hxx
new file mode 100644
index 0000000..611a57e
--- /dev/null
+++ b/main/sw/source/ui/sidebar/WrapPropertyPanel.hxx
@@ -0,0 +1,89 @@
+/**************************************************************
+* 
+* 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 SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX
+#define SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/image.hxx>
+
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace sw { namespace sidebar {
+
+    class WrapPropertyPanel
+        : public Control
+        , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+    {
+    public:
+        static WrapPropertyPanel* Create(
+            Window* pParent,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
+            SfxBindings* pBindings );
+
+        // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+        virtual void NotifyItemUpdate(
+            const sal_uInt16 nSId,
+            const SfxItemState eState,
+            const SfxPoolItem* pState );
+
+    private:
+        WrapPropertyPanel(
+            Window* pParent,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+            SfxBindings* pBindings );
+
+        virtual ~WrapPropertyPanel();
+
+        ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+        SfxBindings* mpBindings;
+
+        ::boost::scoped_ptr<ImageRadioButton> mpRBNoWrap;
+        ::boost::scoped_ptr<ImageRadioButton> mpRBWrapLeft;
+        ::boost::scoped_ptr<ImageRadioButton> mpRBWrapRight;
+        ::boost::scoped_ptr<ImageRadioButton> mpRBWrapParallel;
+        ::boost::scoped_ptr<ImageRadioButton> mpRBWrapThrough;
+        ::boost::scoped_ptr<ImageRadioButton> mpRBIdealWrap;
+
+        //Image resource.
+        ImageList aWrapIL;
+        ImageList aWrapILH;
+
+        //Controler Items==================================
+        ::sfx2::sidebar::ControllerItem maSwNoWrapControl;
+        ::sfx2::sidebar::ControllerItem maSwWrapLeftControl;
+        ::sfx2::sidebar::ControllerItem maSwWrapRightControl;
+        ::sfx2::sidebar::ControllerItem maSwWrapParallelControl;
+        ::sfx2::sidebar::ControllerItem maSwWrapThroughControl;
+        ::sfx2::sidebar::ControllerItem maSwWrapIdealControl;
+
+        void Initialize();
+
+        DECL_LINK(WrapTypeHdl, void*);
+    };
+
+} } // end of namespace ::sw::sidebar
+
+#endif
diff --git a/main/sw/source/ui/sidebar/WrapPropertyPanel.src b/main/sw/source/ui/sidebar/WrapPropertyPanel.src
new file mode 100644
index 0000000..4ce2d6f
--- /dev/null
+++ b/main/sw/source/ui/sidebar/WrapPropertyPanel.src
@@ -0,0 +1,90 @@
+/**************************************************************
+* 
+* 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 <sfx2/sidebar/propertypanel.hrc>
+#include "PropertyPanel.hrc"
+#include "WrapPropertyPanel.hrc"
+#include "helpid.h"
+
+#define IMAGEBUTTON_WIDTH 16
+#define IMAGEBUTTON_HEIGH 18
+#define IMAGEBUTTON_GAP 1
+
+Control RID_PROPERTYPANEL_SWOBJWRAP_PAGE
+{
+	OutputSize = TRUE;
+	DialogControl = TRUE;
+	Border = FALSE;
+
+	Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_BOT + SECTIONPAGE_MARGIN_VERTICAL_TOP +  IMAGEBUTTON_HEIGH );
+	HelpID = HID_PROPERTYPANEL_WRAP_SECTION ;
+	Text [ en-US ] = "Wrap";
+	
+	
+	ImageRadioButton RB_NO_WRAP
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_NO_WRAP ;
+		QuickHelpText [ en-US ] = "None";
+	};
+	ImageRadioButton RB_WRAP_LEFT
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP, SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT ;
+		QuickHelpText [ en-US ] = "Before";
+	};
+	ImageRadioButton RB_WRAP_RIGHT
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*2 , SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT ;
+		QuickHelpText [ en-US ] = "After";
+	};
+	ImageRadioButton RB_WRAP_PARALLEL
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*3  , SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL ;
+		QuickHelpText [ en-US ] = "Parallel";
+	};
+	ImageRadioButton RB_WRAP_THROUGH
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*4   , SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH ;
+		QuickHelpText [ en-US ] = "Through";
+	};
+	ImageRadioButton RB_WRAP_IDEAL
+	{
+		Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*5   , SECTIONPAGE_MARGIN_VERTICAL_TOP );
+		Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH );
+		TopImage = True;
+		HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL ;
+		QuickHelpText [ en-US ] = "Optimal";
+	};
+};
diff --git a/main/sw/source/ui/uiview/view0.cxx b/main/sw/source/ui/uiview/view0.cxx
index e7d76f6..4347841 100644
--- a/main/sw/source/ui/uiview/view0.cxx
+++ b/main/sw/source/ui/uiview/view0.cxx
@@ -43,6 +43,7 @@
 #include <sfx2/templdlg.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <uivwimp.hxx>
 #include <avmedia/mediaplayer.hxx>
 //#include <swlinguconfig.hxx>
@@ -109,6 +110,7 @@
 {
 	SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
 	SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
+	SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
 	SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
 	SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
     SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId());
diff --git a/main/sw/source/ui/uiview/view1.cxx b/main/sw/source/ui/uiview/view1.cxx
index 7a360a9..ce7b1ea 100644
--- a/main/sw/source/ui/uiview/view1.cxx
+++ b/main/sw/source/ui/uiview/view1.cxx
@@ -28,6 +28,7 @@
 #include <svx/svdpagv.hxx>
 #include <svx/svdview.hxx>
 #include <svx/ruler.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <idxmrk.hxx>
 #ifndef _VIEW_HXX
 #include <view.hxx>
diff --git a/main/sw/source/ui/uiview/view2.cxx b/main/sw/source/ui/uiview/view2.cxx
index 1c7b2ad..3434f49 100644
--- a/main/sw/source/ui/uiview/view2.cxx
+++ b/main/sw/source/ui/uiview/view2.cxx
@@ -1093,9 +1093,9 @@
                     case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
                     case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
                     case SID_ALIGN_ANY_JUSTIFIED:   nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
-                    case SID_ALIGN_ANY_TOP      :   nAlias = FN_TABLE_VERT_NONE; break;
-                    case SID_ALIGN_ANY_VCENTER  :   nAlias = FN_TABLE_VERT_CENTER; break;
-                    case SID_ALIGN_ANY_BOTTOM   :   nAlias = FN_TABLE_VERT_BOTTOM; break;
+                    case SID_ALIGN_ANY_TOP      :   nAlias = SID_TABLE_VERT_NONE; break;
+                    case SID_ALIGN_ANY_VCENTER  :   nAlias = SID_TABLE_VERT_CENTER; break;
+                    case SID_ALIGN_ANY_BOTTOM   :   nAlias = SID_TABLE_VERT_BOTTOM; break;
                 }
             }
             else
diff --git a/main/sw/source/ui/uiview/viewstat.cxx b/main/sw/source/ui/uiview/viewstat.cxx
index a87376e..7bd4bda 100644
--- a/main/sw/source/ui/uiview/viewstat.cxx
+++ b/main/sw/source/ui/uiview/viewstat.cxx
@@ -389,9 +389,9 @@
                         case SID_ALIGN_ANY_HCENTER  :   nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
                         case SID_ALIGN_ANY_RIGHT    :   nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
                         case SID_ALIGN_ANY_JUSTIFIED:   nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
-                        case SID_ALIGN_ANY_TOP      :   nAlias = FN_TABLE_VERT_NONE; break;
-                        case SID_ALIGN_ANY_VCENTER  :   nAlias = FN_TABLE_VERT_CENTER; break;
-                        case SID_ALIGN_ANY_BOTTOM   :   nAlias = FN_TABLE_VERT_BOTTOM; break;
+                        case SID_ALIGN_ANY_TOP      :   nAlias = SID_TABLE_VERT_NONE; break;
+                        case SID_ALIGN_ANY_VCENTER  :   nAlias = SID_TABLE_VERT_CENTER; break;
+                        case SID_ALIGN_ANY_BOTTOM   :   nAlias = SID_TABLE_VERT_BOTTOM; break;
                     }
                 }
                 else if(nSelectionType & (nsSelectionType::SEL_DRW))
diff --git a/main/sw/source/ui/uiview/viewtab.cxx b/main/sw/source/ui/uiview/viewtab.cxx
index 1e26a28..1ce71df 100644
--- a/main/sw/source/ui/uiview/viewtab.cxx
+++ b/main/sw/source/ui/uiview/viewtab.cxx
@@ -199,15 +199,15 @@
 
 void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
 {
-	sal_uInt16 nPhyPage, nVirPage;
-	GetWrtShell().GetPageNum( nPhyPage, nVirPage );
+    sal_uInt16 nPhyPage, nVirPage;
+    GetWrtShell().GetPageNum( nPhyPage, nVirPage );
 
-	if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 )
-	{
+    if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 )
+    {
         long nTmp = rLRSpace.GetRight();
-		rLRSpace.SetRight( rLRSpace.GetLeft() );
-		rLRSpace.SetLeft( nTmp );
-	}
+        rLRSpace.SetRight( rLRSpace.GetLeft() );
+        rLRSpace.SetLeft( nTmp );
+    }
 }
 
 /*--------------------------------------------------------------------
@@ -268,634 +268,753 @@
 
 void SwView::ExecTabWin( SfxRequest& rReq )
 {
-	SwWrtShell &rSh 		= GetWrtShell();
-	const sal_uInt16 nFrmType	= rSh.IsObjSelected() ?
-									FRMTYPE_DRAWOBJ :
-										rSh.GetFrmType(0,sal_True);
-	const sal_Bool bFrmSelection = rSh.IsFrmSelected();
-	const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
+    SwWrtShell &rSh 		= GetWrtShell();
+    const sal_uInt16 nFrmType	= rSh.IsObjSelected() ?
+                                    FRMTYPE_DRAWOBJ :
+                                        rSh.GetFrmType(0,sal_True);
+    const sal_Bool bFrmSelection = rSh.IsFrmSelected();
+    const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
 
-	const sal_uInt16 nSlot 	  	= rReq.GetSlot();
-	const sal_uInt16 nDescId  	= rSh.GetCurPageDesc();
-	const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId );
+    const sal_uInt16 nSlot 	  	= rReq.GetSlot();
+    const sal_uInt16 nDescId  	= rSh.GetCurPageDesc();
+    const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId );
 
     const sal_Bool bVerticalWriting = rSh.IsInVerticalText();
     const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader();
-	SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+    SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
 
-	const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter();
-	SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+    const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter();
+    SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
 
-	const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize();
+    const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize();
 
     const SwRect& rPageRect = rSh.GetAnyCurRect(RECT_PAGE);
     const long nPageWidth  = bBrowse ? rPageRect.Width() : rFrmSize.GetWidth();
     const long nPageHeight = bBrowse ? rPageRect.Height() : rFrmSize.GetHeight();
 
-	sal_Bool bUnlockView = sal_False;
-	rSh.StartAllAction();
-	sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT);
+    sal_Bool bUnlockView = sal_False;
+    rSh.StartAllAction();
+    sal_Bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT);
 
-	switch	( nSlot )
-	{
+    switch( nSlot )
+    {
     case SID_ATTR_LONG_LRSPACE:
-	{
-		SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()->
-													Get( SID_ATTR_LONG_LRSPACE ) );
-        SvxLRSpaceItem aLR(RES_LR_SPACE);
-        if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) )
-		{
-            SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
-			const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
-
-            sal_Bool bVerticalFrame(sal_False);
+        {
+            SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()->
+                Get( SID_ATTR_LONG_LRSPACE ) );
+            SvxLRSpaceItem aLR(RES_LR_SPACE);
+            if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) )
             {
+                SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+                const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
+
+                sal_Bool bVerticalFrame(sal_False);
+                {
+                    sal_Bool bRTL;
+                    sal_Bool bVertL2R;
+                    bVerticalFrame = ( bFrmSelection &&
+                        rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) ||
+                        ( !bFrmSelection && bVerticalWriting);
+                }
+                long nDeltaX = bVerticalFrame ?
+                    rRect.Right() - rPageRect.Right() + aLongLR.GetRight() :
+                    rPageRect.Left() + aLongLR.GetLeft() - rRect.Left();
+
+                SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+                    RES_VERT_ORIENT, RES_HORI_ORIENT,
+                    RES_COL, RES_COL, 0 );
+
+                if(bVerticalFrame)
+                {
+                    SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
+                    aVertOrient.SetVertOrient(text::VertOrientation::NONE);
+                    aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
+                    aSet.Put( aVertOrient );
+                }
+                else
+                {
+                    SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() );
+                    aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
+                    aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
+                    aSet.Put( aHoriOrient );
+                }
+
+                SwFmtFrmSize aSize( pFmt->GetFrmSize() );
+                long nOldWidth = (long) aSize.GetWidth();
+
+                if(aSize.GetWidthPercent())
+                {
+                    SwRect aRect;
+                    rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+                    long nPrtWidth = aRect.Width();
+                    aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
+                }
+                else
+                    aSize.SetWidth( nPageWidth -
+                    (aLongLR.GetLeft() + aLongLR.GetRight()));
+
+                if( nFrmType & FRMTYPE_COLUMN )
+                {
+                    SwFmtCol aCol(pFmt->GetCol());
+
+                    ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX );
+                    aSet.Put(aCol);
+                }
+
+                aSet.Put( aSize );
+
+                rSh.StartAction();
+                rSh.Push();
+                rSh.SetFlyFrmAttr( aSet );
+                //die Rahmenselektion wieder aufheben
+                if(!bFrmSelection && rSh.IsFrmSelected())
+                {
+                    rSh.UnSelectFrm();
+                    rSh.LeaveSelFrmMode();
+                }
+                rSh.Pop();
+                rSh.EndAction();
+            }
+            else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
+            {
+                // Seitenraender rausrechnen
+                long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
+                aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
+
+                nOld = rDesc.GetMaster().GetLRSpace().GetRight();
+                aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
+                aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
+                aLR.SetRight((sal_uInt16)aLongLR.GetRight());
+
+                if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt )
+                    pHeaderFmt->SetFmtAttr( aLR );
+                else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt )
+                    pFooterFmt->SetFmtAttr( aLR );
+            }
+            else if( nFrmType == FRMTYPE_DRAWOBJ)
+            {
+                SwRect aRect( rSh.GetObjRect() );
+                aRect.Left( aLongLR.GetLeft() + rPageRect.Left() );
+                aRect.Right( rPageRect.Right() - aLongLR.GetRight());
+                rSh.SetObjRect( aRect );
+            }
+            else if(bSect || rSh.IsDirectlyInSection())
+            {
+                //change the section indents and the columns if available
+                //at first determine the changes
+                SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
+                const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
+                aSectRect.Pos() += aTmpRect.Pos();
+                long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() );
+                long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right());
+                //change the LRSpaceItem of the section accordingly
+                const SwSection* pCurrSect = rSh.GetCurrSection();
+                const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
+                SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace();
+                aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff);
+                aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff);
+                SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
+                aSet.Put(aLRTmp);
+                //change the first/last column
+                if(bSect)
+                {
+                    SwFmtCol aCols( pSectFmt->GetCol() );
+                    long nDiffWidth = nLeftDiff + nRightDiff;
+                    ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
+                    aSet.Put( aCols );
+                }
+                SwSectionData aData(*pCurrSect);
+                rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
+            }
+            else
+            {	// Seitenraender einstellen
+                aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
+                aLR.SetRight((sal_uInt16)aLongLR.GetRight());
+                SwapPageMargin( rDesc, aLR );
+                SwPageDesc aDesc( rDesc );
+                aDesc.GetMaster().SetFmtAttr( aLR );
+                rSh.ChgPageDesc( nDescId, aDesc );
+            }
+        }
+        break;
+
+        // apply new left and right margins to current page style
+    case SID_ATTR_PAGE_LRSPACE:
+        {
+            const SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_LRSPACE )) );
+
+            SwPageDesc aDesc( rDesc );
+            {
+                SvxLRSpaceItem aLR( RES_LR_SPACE );
+                aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
+                aLR.SetRight((sal_uInt16)aLongLR.GetRight());
+                SwapPageMargin( rDesc, aLR );
+                aDesc.GetMaster().SetFmtAttr( aLR );
+            }
+            rSh.ChgPageDesc( nDescId, aDesc );
+        }
+        break;
+
+    case SID_ATTR_LONG_ULSPACE:
+        {
+            SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()->
+                Get( SID_ATTR_LONG_ULSPACE ));
+
+            if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+            {
+                SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+                const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
+                const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
+                const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
+
+                SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+                    RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
+                //which of the orientation attributes is to be put depends on the frame's environment
                 sal_Bool bRTL;
                 sal_Bool bVertL2R;
-                bVerticalFrame = ( bFrmSelection &&
-                                   rSh.IsFrmVertical(sal_True, bRTL, bVertL2R) ) ||
-                                 ( !bFrmSelection && bVerticalWriting);
+                if ( ( bFrmSelection &&
+                    rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) ||
+                    ( !bFrmSelection && bVerticalWriting ) )
+                {
+                    SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient());
+                    aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE);
+                    aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
+                    aSet.Put( aHoriOrient );
+                }
+                else
+                {
+                    SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
+                    aVertOrient.SetVertOrient(text::VertOrientation::NONE);
+                    aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
+                    aSet.Put( aVertOrient );
+                }
+                SwFmtFrmSize aSize(pFmt->GetFrmSize());
+                if(aSize.GetHeightPercent())
+                {
+                    SwRect aRect;
+                    rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+                    long nPrtHeight = aRect.Height();
+                    aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight));
+                }
+                else
+                    aSize.SetHeight(nHeight );
+
+                aSet.Put( aSize );
+                rSh.SetFlyFrmAttr( aSet );
             }
-            long nDeltaX = bVerticalFrame ?
-                rRect.Right() - rPageRect.Right() + aLongLR.GetRight() :
-				rPageRect.Left() + aLongLR.GetLeft() - rRect.Left();
-
-            SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
-                                        RES_VERT_ORIENT, RES_HORI_ORIENT,
-										RES_COL, RES_COL, 0 );
-
-            if(bVerticalFrame)
+            else if( nFrmType == FRMTYPE_DRAWOBJ )
             {
-                SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
-                aVertOrient.SetVertOrient(text::VertOrientation::NONE);
-                aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
-                aSet.Put( aVertOrient );
+                SwRect aRect( rSh.GetObjRect() );
+                aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() );
+                aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() );
+                rSh.SetObjRect( aRect ) ;
+            }
+            else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection()))
+            {
+                //change the section indents and the columns if available
+                //at first determine the changes
+                SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
+                const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
+                aSectRect.Pos() += aTmpRect.Pos();
+                const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top());
+                const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top());
+                //change the LRSpaceItem of the section accordingly
+                const SwSection* pCurrSect = rSh.GetCurrSection();
+                const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
+                SvxLRSpaceItem aLR = pSectFmt->GetLRSpace();
+                aLR.SetLeft(aLR.GetLeft() + nLeftDiff);
+                aLR.SetRight(aLR.GetRight() + nRightDiff);
+                SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
+                aSet.Put(aLR);
+                //change the first/last column
+                if(bSect)
+                {
+                    SwFmtCol aCols( pSectFmt->GetCol() );
+                    long nDiffWidth = nLeftDiff + nRightDiff;
+                    ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
+                    aSet.Put( aCols );
+                }
+                SwSectionData aData(*pCurrSect);
+                rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
             }
             else
+            {	SwPageDesc aDesc( rDesc );
+
+            if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
             {
-                SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() );
-                aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
-                aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
-                aSet.Put( aHoriOrient );
-            }
 
-			SwFmtFrmSize aSize( pFmt->GetFrmSize() );
-			long nOldWidth = (long) aSize.GetWidth();
-
-			if(aSize.GetWidthPercent())
-			{
-				SwRect aRect;
-                rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
-				long nPrtWidth = aRect.Width();
-				aSize.SetWidthPercent(sal_uInt8((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
-			}
-			else
-				aSize.SetWidth( nPageWidth -
-						(aLongLR.GetLeft() + aLongLR.GetRight()));
-
-			if( nFrmType & FRMTYPE_COLUMN )
-			{
-				SwFmtCol aCol(pFmt->GetCol());
-
-				::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX );
-				aSet.Put(aCol);
-			}
-
-			aSet.Put( aSize );
-
-			rSh.StartAction();
-			rSh.Push();
-			rSh.SetFlyFrmAttr( aSet );
-			//die Rahmenselektion wieder aufheben
-			if(!bFrmSelection && rSh.IsFrmSelected())
-			{
-				rSh.UnSelectFrm();
-				rSh.LeaveSelFrmMode();
-			}
-			rSh.Pop();
-			rSh.EndAction();
-		}
-		else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
-		{
-			// Seitenraender rausrechnen
-            long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
-            aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
-
-			nOld = rDesc.GetMaster().GetLRSpace().GetRight();
-			aLongLR.SetRight( nOld > (sal_uInt16)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
-			aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
-			aLR.SetRight((sal_uInt16)aLongLR.GetRight());
-
-			if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt )
-                pHeaderFmt->SetFmtAttr( aLR );
-			else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt )
-                pFooterFmt->SetFmtAttr( aLR );
-		}
-		else if( nFrmType == FRMTYPE_DRAWOBJ)
-		{
-			SwRect aRect( rSh.GetObjRect() );
-			aRect.Left( aLongLR.GetLeft() + rPageRect.Left() );
-			aRect.Right( rPageRect.Right() - aLongLR.GetRight());
-			rSh.SetObjRect( aRect );
-		}
-        else if(bSect || rSh.IsDirectlyInSection())
-		{
-			//change the section indents and the columns if available
-			//at first determine the changes
-            SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
-            const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
-            aSectRect.Pos() += aTmpRect.Pos();
-            long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() );
-            long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right());
-			//change the LRSpaceItem of the section accordingly
-            const SwSection* pCurrSect = rSh.GetCurrSection();
-            const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
-            SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace();
-            aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff);
-            aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff);
-            SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
-            aSet.Put(aLRTmp);
-			//change the first/last column
-			if(bSect)
-			{
-                SwFmtCol aCols( pSectFmt->GetCol() );
-                long nDiffWidth = nLeftDiff + nRightDiff;
-                ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
-                aSet.Put( aCols );
-			}
-            SwSectionData aData(*pCurrSect);
-            rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
-        }
-		else
-		{	// Seitenraender einstellen
-			aLR.SetLeft((sal_uInt16)aLongLR.GetLeft());
-			aLR.SetRight((sal_uInt16)aLongLR.GetRight());
-			SwapPageMargin( rDesc, aLR );
-			SwPageDesc aDesc( rDesc );
-            aDesc.GetMaster().SetFmtAttr( aLR );
-			rSh.ChgPageDesc( nDescId, aDesc );
-		}
-	}
-	break;
-    case SID_ATTR_LONG_ULSPACE:
-	{
-		SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()->
-														Get( SID_ATTR_LONG_ULSPACE ));
-
-		if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
-		{
-            SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
-			const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
-            const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
-			const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
-
-            SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
-                                        RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
-            //which of the orientation attributes is to be put depends on the frame's environment
-            sal_Bool bRTL;
-            sal_Bool bVertL2R;
-            if ( ( bFrmSelection &&
-                   rSh.IsFrmVertical(sal_True, bRTL, bVertL2R ) ) ||
-                 ( !bFrmSelection && bVerticalWriting ) )
-            {
-                SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient());
-                aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE);
-                aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
-                aSet.Put( aHoriOrient );
-            }
-            else
-            {
-                SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
-                aVertOrient.SetVertOrient(text::VertOrientation::NONE);
-                aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
-                aSet.Put( aVertOrient );
-            }
-			SwFmtFrmSize aSize(pFmt->GetFrmSize());
-			if(aSize.GetHeightPercent())
-			{
-				SwRect aRect;
-                rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
-				long nPrtHeight = aRect.Height();
-				aSize.SetHeightPercent(sal_uInt8(nHeight * 100 /nPrtHeight));
-			}
-			else
-				aSize.SetHeight(nHeight );
-
-            aSet.Put( aSize );
-            rSh.SetFlyFrmAttr( aSet );
-		}
-		else if( nFrmType == FRMTYPE_DRAWOBJ )
-		{
-			SwRect aRect( rSh.GetObjRect() );
-            aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() );
-			aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() );
-			rSh.SetObjRect( aRect ) ;
-		}
-        else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection()))
-		{
-			//change the section indents and the columns if available
-			//at first determine the changes
-            SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
-            const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
-            aSectRect.Pos() += aTmpRect.Pos();
-            const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top());
-            const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top());
-			//change the LRSpaceItem of the section accordingly
-            const SwSection* pCurrSect = rSh.GetCurrSection();
-            const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
-            SvxLRSpaceItem aLR = pSectFmt->GetLRSpace();
-            aLR.SetLeft(aLR.GetLeft() + nLeftDiff);
-            aLR.SetRight(aLR.GetRight() + nRightDiff);
-            SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
-            aSet.Put(aLR);
-			//change the first/last column
-			if(bSect)
-			{
-                SwFmtCol aCols( pSectFmt->GetCol() );
-                long nDiffWidth = nLeftDiff + nRightDiff;
-                ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
-                aSet.Put( aCols );
-			}
-            SwSectionData aData(*pCurrSect);
-            rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
-        }
-		else
-		{	SwPageDesc aDesc( rDesc );
-
-			if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
-			{
-
-				const sal_Bool bHead = nFrmType & FRMTYPE_HEADER ? sal_True : sal_False;
-				SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
-				if ( bHead )
-					aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() );
-				else
-					aUL.SetLower( (sal_uInt16)aLongULSpace.GetLower() );
+                const sal_Bool bHead = nFrmType & FRMTYPE_HEADER ? sal_True : sal_False;
+                SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
+                if ( bHead )
+                    aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() );
+                else
+                    aUL.SetLower( (sal_uInt16)aLongULSpace.GetLower() );
                 aDesc.GetMaster().SetFmtAttr( aUL );
 
-				if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) )
+                if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) )
                 {
                     SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() :
-										      pFooterFmt->GetFrmSize() );
+                        pFooterFmt->GetFrmSize() );
                     aSz.SetHeightSizeType( ATT_FIX_SIZE );
-				    aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
-											    aLongULSpace.GetUpper() );
-				    if ( bHead )
+                    aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
+                        aLongULSpace.GetUpper() );
+                    if ( bHead )
                         pHeaderFmt->SetFmtAttr( aSz );
-				    else
+                    else
                         pFooterFmt->SetFmtAttr( aSz );
                 }
-			}
-			else
-			{
+            }
+            else
+            {
                 SvxULSpaceItem aUL(RES_UL_SPACE);
-				aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper());
-				aUL.SetLower((sal_uInt16)aLongULSpace.GetLower());
+                aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper());
+                aUL.SetLower((sal_uInt16)aLongULSpace.GetLower());
                 aDesc.GetMaster().SetFmtAttr(aUL);
-			}
+            }
 
-			rSh.ChgPageDesc( nDescId, aDesc );
-		}
-	}
-	break;
+            rSh.ChgPageDesc( nDescId, aDesc );
+            }
+        }
+        break;
+
+        // apply new top and bottom margins to current page style
+    case SID_ATTR_PAGE_ULSPACE:
+        {
+            SvxLongULSpaceItem aLongULSpace(
+                static_cast<const SvxLongULSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_ULSPACE ) ) );
+
+            SwPageDesc aDesc( rDesc );
+            {
+                SvxULSpaceItem aUL(RES_UL_SPACE);
+                aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper());
+                aUL.SetLower((sal_uInt16)aLongULSpace.GetLower());
+                aDesc.GetMaster().SetFmtAttr(aUL);
+            }
+            rSh.ChgPageDesc( nDescId, aDesc );
+        }
+        break;
+
+    case SID_ATTR_PAGE_COLUMN:
+        {
+            const SfxInt16Item aColumnItem( (const SfxInt16Item&)rReq.GetArgs()->Get(nSlot) );
+            const sal_uInt16 nPageColumnType = aColumnItem.GetValue();
+
+            // nPageColumnType =
+            // 1 - single-columned page
+            // 2 - two-columned page
+            // 3 - three-columned page
+            // 4 - two-columned page with left column width of 2/3 of page width
+            // 5 - two-columned page with right column width of 2/3 of page width
+
+            sal_uInt16 nCount = 2;
+            if ( nPageColumnType == 1 )
+            {
+                nCount = 0;
+            }
+            else if ( nPageColumnType == 3 )
+            {
+                nCount = 3;
+            }
+
+            const sal_uInt16 nGutterWidth = 0;
+
+            const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() );
+            const long nLeft = aLR.GetLeft();
+            const long nRight = aLR.GetRight();
+            const long nWidth = nPageWidth - nLeft - nRight;
+
+            SwFmtCol aCols( rDesc.GetMaster().GetCol() );
+            aCols.Init( nCount, nGutterWidth, nWidth );
+            aCols.SetWishWidth( nWidth );
+            aCols.SetGutterWidth( nGutterWidth, nWidth );
+            aCols.SetOrtho( sal_False, nGutterWidth, nWidth );
+
+            long nColumnLeft = 0;
+            long nColumnRight = 0;
+            if ( nPageColumnType == 4 )
+            {
+                nColumnRight = (long)(nWidth/3);
+                nColumnLeft = nWidth - nColumnRight;
+                aCols.GetColumns()[0]->SetWishWidth( nColumnLeft );
+                aCols.GetColumns()[1]->SetWishWidth( nColumnRight );
+            }
+            else if ( nPageColumnType == 5 )
+            {
+                nColumnLeft = (long)(nWidth/3);
+                nColumnRight = nWidth - nColumnLeft;
+                aCols.GetColumns()[0]->SetWishWidth( nColumnLeft );
+                aCols.GetColumns()[1]->SetWishWidth( nColumnRight );
+            }
+
+            SwPageDesc aDesc( rDesc );
+            aDesc.GetMaster().SetFmtAttr( aCols );
+            rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
+        }
+        break;
+
     case SID_ATTR_TABSTOP_VERTICAL:
     case SID_ATTR_TABSTOP:
-    {
-		sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
-		SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()->
-                                                    Get( nWhich ));
-		aTabStops.SetWhich(RES_PARATR_TABSTOP);
- 		const SvxTabStopItem& rDefTabs =
-					(const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
+        {
+            sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
+            SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()->
+                Get( nWhich ));
+            aTabStops.SetWhich(RES_PARATR_TABSTOP);
+            const SvxTabStopItem& rDefTabs =
+                (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
 
-		// Default-Tab an Pos 0
-		SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
-        rSh.GetCurAttr( aSet );
-		const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE);
+            // Default-Tab an Pos 0
+            SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
+            rSh.GetCurAttr( aSet );
+            const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE);
 
-		if ( rLR.GetTxtFirstLineOfst() < 0 )
-		{
-			SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
-			aTabStops.Insert( aSwTabStop );
-		}
+            if ( rLR.GetTxtFirstLineOfst() < 0 )
+            {
+                SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
+                aTabStops.Insert( aSwTabStop );
+            }
 
-		// auffuellen mit Default-Tabs
-		sal_uInt16 nDef = ::GetTabDist( rDefTabs );
-		::MakeDefTabs( nDef, aTabStops );
+            // auffuellen mit Default-Tabs
+            sal_uInt16 nDef = ::GetTabDist( rDefTabs );
+            ::MakeDefTabs( nDef, aTabStops );
 
+            SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+            if(	pColl && pColl->IsAutoUpdateFmt() )
+            {
+                SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
+                aTmp.Put(aTabStops);
+                rSh.AutoUpdatePara( pColl, aTmp );
+            }
+            else
+                rSh.SetAttr( aTabStops );
+            break;
+        }
+
+    case SID_ATTR_PARA_LRSPACE_VERTICAL:
+    case SID_ATTR_PARA_LRSPACE:
+        {
+            SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
+                GetArgs()->Get(nSlot));
+            if(nFrmType & FRMTYPE_FLY_ANY)
+            {
+                sal_Bool bFirstColumn = sal_True;
+                sal_Bool bLastColumn = sal_True;
+                if(nFrmType & FRMTYPE_COLUMN)
+                {
+                    sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1;
+                    bFirstColumn = !nCurFrameCol;
+                    const SwFrmFmt* pFmt =  rSh.GetFlyFrmFmt();
+                    const SwFmtCol* pCols = &pFmt->GetCol();
+                    const SwColumns& rCols = pCols->GetColumns();
+                    sal_uInt16 nColumnCount = rCols.Count();
+                    bLastColumn = nColumnCount == nCurFrameCol + 1;
+                }
+            }
+            aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance );
+            aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance );
+
+            aParaMargin.SetWhich( RES_LR_SPACE );
+            SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+
+            // #i23726#
+            if (pNumRuleNodeFromDoc)
+            {
+                // --> FME 2005-02-22 #i42922# Mouse move of numbering label
+                // has to consider the left indent of the paragraph
+                SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
+                rSh.GetCurAttr( aSet );
+                const SvxLRSpaceItem& rLR =
+                    static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE));
+                // <--
+
+                SwPosition aPos(*pNumRuleNodeFromDoc);
+                // --> OD 2008-06-09 #i90078#
+                rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos);
+                // <--
+                // --> OD 2005-02-18 #i42921# - invalidate state of indent in order
+                // to get a ruler update.
+                aParaMargin.SetWhich( nSlot );
+                GetViewFrame()->GetBindings().SetState( aParaMargin );
+                // <--
+            }
+            else if( pColl && pColl->IsAutoUpdateFmt() )
+            {
+                SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
+                aSet.Put(aParaMargin);
+                rSh.AutoUpdatePara( pColl, aSet);
+            }
+            else
+                rSh.SetAttr( aParaMargin );
+
+            if ( aParaMargin.GetTxtFirstLineOfst() < 0 )
+            {
+                SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP );
+
+                rSh.GetCurAttr( aSet );
+                const SvxTabStopItem&  rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP);
+
+                // Haben wir einen Tab an Stelle Null
+                sal_uInt16 i;
+
+                for ( i = 0; i < rTabStops.Count(); ++i )
+                    if ( rTabStops[i].GetTabPos() == 0 )
+                        break;
+
+                if ( i >= rTabStops.Count() )
+                {
+                    // Kein DefTab
+                    SvxTabStopItem aTabStops( RES_PARATR_TABSTOP );
+                    aTabStops = rTabStops;
+
+                    ::lcl_EraseDefTabs(aTabStops);
+
+                    SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
+                    aTabStops.Insert(aSwTabStop);
+
+                    const SvxTabStopItem& rDefTabs =
+                        (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
+                    sal_uInt16 nDef = ::GetTabDist(rDefTabs);
+                    ::MakeDefTabs( nDef, aTabStops );
+
+                    if(	pColl && pColl->IsAutoUpdateFmt())
+                    {
+                        SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
+                        aSetTmp.Put(aTabStops);
+                        rSh.AutoUpdatePara( pColl, aSetTmp );
+                    }
+                    else
+                        rSh.SetAttr( aTabStops );
+                }
+            }
+        }
+        break;
+
+    case SID_ATTR_PARA_ULSPACE:
+	{
+		SvxULSpaceItem aParaMargin((const SvxULSpaceItem&)rReq.
+			GetArgs()->Get(nSlot));
+
+		long nUDist = 0;
+		long nLDist = 0;
+		aParaMargin.SetUpper( aParaMargin.GetUpper() - nUDist );
+		aParaMargin.SetLower(aParaMargin.GetLower() - nLDist);
+
+		aParaMargin.SetWhich( RES_UL_SPACE );
 		SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
 		if(	pColl && pColl->IsAutoUpdateFmt() )
 		{
-			SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
-			aTmp.Put(aTabStops);
-			rSh.AutoUpdatePara( pColl, aTmp );
-		}
-		else
-			rSh.SetAttr( aTabStops );
-		break;
-	}
-    case SID_ATTR_PARA_LRSPACE_VERTICAL:
-    case SID_ATTR_PARA_LRSPACE:
-	{
-		SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
-										GetArgs()->Get(nSlot));
-		if(nFrmType & FRMTYPE_FLY_ANY)
-		{
-            sal_Bool bFirstColumn = sal_True;
-            sal_Bool bLastColumn = sal_True;
-            if(nFrmType & FRMTYPE_COLUMN)
-            {
-                sal_uInt16 nCurFrameCol = rSh.GetCurColNum() - 1;
-                bFirstColumn = !nCurFrameCol;
-                const SwFrmFmt* pFmt =  rSh.GetFlyFrmFmt();
-                const SwFmtCol* pCols = &pFmt->GetCol();
-                const SwColumns& rCols = pCols->GetColumns();
-                sal_uInt16 nColumnCount = rCols.Count();
-                bLastColumn = nColumnCount == nCurFrameCol + 1;
-            }
-		}
-        aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance );
-        aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance );
-
-		aParaMargin.SetWhich( RES_LR_SPACE );
-		SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
-
-        // #i23726#
-        if (pNumRuleNodeFromDoc)
-        {
-            // --> FME 2005-02-22 #i42922# Mouse move of numbering label
-            // has to consider the left indent of the paragraph
-	        SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
-            rSh.GetCurAttr( aSet );
-            const SvxLRSpaceItem& rLR =
-                    static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE));
-            // <--
-
-            SwPosition aPos(*pNumRuleNodeFromDoc);
-            // --> OD 2008-06-09 #i90078#
-            rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos);
-            // <--
-            // --> OD 2005-02-18 #i42921# - invalidate state of indent in order
-            // to get a ruler update.
-            aParaMargin.SetWhich( nSlot );
-            GetViewFrame()->GetBindings().SetState( aParaMargin );
-            // <--
-        }
-		else if( pColl && pColl->IsAutoUpdateFmt() )
-		{
-			SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
+			SfxItemSet aSet(GetPool(), RES_UL_SPACE, RES_UL_SPACE);
 			aSet.Put(aParaMargin);
 			rSh.AutoUpdatePara( pColl, aSet);
 		}
 		else
 			rSh.SetAttr( aParaMargin );
-
-		if ( aParaMargin.GetTxtFirstLineOfst() < 0 )
-		{
-			SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP );
-
-            rSh.GetCurAttr( aSet );
-			const SvxTabStopItem&  rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP);
-
-			// Haben wir einen Tab an Stelle Null
-			sal_uInt16 i;
-
-			for ( i = 0; i < rTabStops.Count(); ++i )
-				if ( rTabStops[i].GetTabPos() == 0 )
-					break;
-
-			if ( i >= rTabStops.Count() )
-			{
-				// Kein DefTab
-                SvxTabStopItem aTabStops( RES_PARATR_TABSTOP );
-				aTabStops = rTabStops;
-
-				::lcl_EraseDefTabs(aTabStops);
-
-				SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
-				aTabStops.Insert(aSwTabStop);
-
-				const SvxTabStopItem& rDefTabs =
-					(const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
-				sal_uInt16 nDef = ::GetTabDist(rDefTabs);
-				::MakeDefTabs( nDef, aTabStops );
-
-				if(	pColl && pColl->IsAutoUpdateFmt())
-				{
-					SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
-					aSetTmp.Put(aTabStops);
-					rSh.AutoUpdatePara( pColl, aSetTmp );
-				}
-				else
-					rSh.SetAttr( aTabStops );
-			}
-		}
 	}
 	break;
+
     case SID_RULER_BORDERS_VERTICAL:
     case SID_RULER_BORDERS:
-	{
-		SvxColumnItem aColItem((const SvxColumnItem&)rReq.
-                                            GetArgs()->Get(nSlot));
+        {
+            SvxColumnItem aColItem((const SvxColumnItem&)rReq.
+                GetArgs()->Get(nSlot));
 
-		if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
-		{
-			ASSERT(aColItem.Count(), "ColDesc ist leer!!");
+            if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
+            {
+                ASSERT(aColItem.Count(), "ColDesc ist leer!!");
 
-			const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq.
-							GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue();
+                const sal_Bool bSingleLine = ((const SfxBoolItem&)rReq.
+                    GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue();
 
-			SwTabCols aTabCols;
-			if ( bSetTabColFromDoc )
-				rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
-			else
-				rSh.GetTabCols(aTabCols);
+                SwTabCols aTabCols;
+                if ( bSetTabColFromDoc )
+                    rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
+                else
+                    rSh.GetTabCols(aTabCols);
 
-			// linker Tabellenrand
-			long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin());
-			aTabCols.SetLeft( nBorder );
+                // linker Tabellenrand
+                long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin());
+                aTabCols.SetLeft( nBorder );
 
-            nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight();
+                nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight();
 
 #ifdef DEBUG
-            long nTmp1 = nPageWidth;
-            long nTmp2 = aTabCols.GetLeftMin() + nBorder;
-            (void)nTmp1;
-            (void)nTmp2;
+                long nTmp1 = nPageWidth;
+                long nTmp2 = aTabCols.GetLeftMin() + nBorder;
+                (void)nTmp1;
+                (void)nTmp2;
 #endif
 
-            if ( aColItem.GetRight() > 0 )
-        		aTabCols.SetRight( nBorder );
+                if ( aColItem.GetRight() > 0 )
+                    aTabCols.SetRight( nBorder );
 
-			// Tabcols der Reihe nach
-			// Die letzte Col wird durch den Rand definiert
-            //columns in right-to-left tables need to be mirrored
-            sal_Bool bIsTableRTL =
-                IsTabColFromDoc() ?
-                      rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+                // Tabcols der Reihe nach
+                // Die letzte Col wird durch den Rand definiert
+                //columns in right-to-left tables need to be mirrored
+                sal_Bool bIsTableRTL =
+                    IsTabColFromDoc() ?
+                    rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
                     : rSh.IsTableRightToLeft();
-            if(bIsTableRTL)
-			{
-				sal_uInt16 nColCount = aColItem.Count() - 1;
-				for ( sal_uInt16 i = 0; i < nColCount; ++i )
-				{
-					const SvxColumnDescription& rCol = aColItem[nColCount - i];
-					aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
-					aTabCols.SetHidden( i, !rCol.bVisible );
-				}
-			}
-			else
-			{
-				for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i )
-				{
-					const SvxColumnDescription& rCol = aColItem[i];
-					aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
-					aTabCols.SetHidden( i, !rCol.bVisible );
-				}
-			}
+                if(bIsTableRTL)
+                {
+                    sal_uInt16 nColCount = aColItem.Count() - 1;
+                    for ( sal_uInt16 i = 0; i < nColCount; ++i )
+                    {
+                        const SvxColumnDescription& rCol = aColItem[nColCount - i];
+                        aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
+                        aTabCols.SetHidden( i, !rCol.bVisible );
+                    }
+                }
+                else
+                {
+                    for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i )
+                    {
+                        const SvxColumnDescription& rCol = aColItem[i];
+                        aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
+                        aTabCols.SetHidden( i, !rCol.bVisible );
+                    }
+                }
 
-            if ( bSetTabColFromDoc )
-			{
-				if( !rSh.IsViewLocked() )
-				{
-					bUnlockView = sal_True;
-					rSh.LockView( sal_True );
-				}
-				rSh.SetMouseTabCols( aTabCols, bSingleLine,
-											   aTabColFromDocPos );
-			}
-			else
-				rSh.SetTabCols(aTabCols, bSingleLine);
+                if ( bSetTabColFromDoc )
+                {
+                    if( !rSh.IsViewLocked() )
+                    {
+                        bUnlockView = sal_True;
+                        rSh.LockView( sal_True );
+                    }
+                    rSh.SetMouseTabCols( aTabCols, bSingleLine,
+                        aTabColFromDocPos );
+                }
+                else
+                    rSh.SetTabCols(aTabCols, bSingleLine);
 
-		}
-		else
-		{
-			if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect)
-			{
-				SwSectionFmt *pSectFmt = 0;
-				SfxItemSet aSet( GetPool(), RES_COL, RES_COL );
-				if(bSect)
-				{
-					const SwSection *pSect = rSh.GetAnySection();
-					ASSERT( pSect, "Welcher Bereich?");
-					pSectFmt = pSect->GetFmt();
-				}
-				else
-				{
-					rSh.GetFlyFrmAttr( aSet );
-				}
-				SwFmtCol aCols(
-					bSect ?
-						pSectFmt->GetCol() :
-							(const SwFmtCol&)aSet.Get( RES_COL, sal_False ));
-				SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED);
-				const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width();
-				::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols );
-				aSet.Put( aCols );
-				if(bSect)
-					rSh.SetSectionAttr( aSet, pSectFmt );
-				else
-				{
-					rSh.StartAction();
-					rSh.Push();
-					rSh.SetFlyFrmAttr( aSet );
-					//die Rahmenselektion wieder aufheben
-					if(!bFrmSelection && rSh.IsFrmSelected())
-					{
-						rSh.UnSelectFrm();
-						rSh.LeaveSelFrmMode();
-					}
-					rSh.Pop();
-					rSh.EndAction();
-				}
-			}
-			else
-			{
-				SwFmtCol aCols( rDesc.GetMaster().GetCol() );
-                const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT);
-				::lcl_ConvertToCols( aColItem,
-					sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()),
-								aCols );
-				SwPageDesc aDesc( rDesc );
-                aDesc.GetMaster().SetFmtAttr( aCols );
-				rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
-			}
-		}
-	}
-	break;
+            }
+            else
+            {
+                if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect)
+                {
+                    SwSectionFmt *pSectFmt = 0;
+                    SfxItemSet aSet( GetPool(), RES_COL, RES_COL );
+                    if(bSect)
+                    {
+                        const SwSection *pSect = rSh.GetAnySection();
+                        ASSERT( pSect, "Welcher Bereich?");
+                        pSectFmt = pSect->GetFmt();
+                    }
+                    else
+                    {
+                        rSh.GetFlyFrmAttr( aSet );
+                    }
+                    SwFmtCol aCols(
+                        bSect ?
+                        pSectFmt->GetCol() :
+                        (const SwFmtCol&)aSet.Get( RES_COL, sal_False ));
+                    SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED);
+                    const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width();
+                    ::lcl_ConvertToCols( aColItem, sal_uInt16(lWidth), aCols );
+                    aSet.Put( aCols );
+                    if(bSect)
+                        rSh.SetSectionAttr( aSet, pSectFmt );
+                    else
+                    {
+                        rSh.StartAction();
+                        rSh.Push();
+                        rSh.SetFlyFrmAttr( aSet );
+                        //die Rahmenselektion wieder aufheben
+                        if(!bFrmSelection && rSh.IsFrmSelected())
+                        {
+                            rSh.UnSelectFrm();
+                            rSh.LeaveSelFrmMode();
+                        }
+                        rSh.Pop();
+                        rSh.EndAction();
+                    }
+                }
+                else
+                {
+                    SwFmtCol aCols( rDesc.GetMaster().GetCol() );
+                    const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT);
+                    ::lcl_ConvertToCols( aColItem,
+                        sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()),
+                        aCols );
+                    SwPageDesc aDesc( rDesc );
+                    aDesc.GetMaster().SetFmtAttr( aCols );
+                    rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
+                }
+            }
+        }
+        break;
 
-	case SID_RULER_ROWS :
-	case SID_RULER_ROWS_VERTICAL:
-	{
-		SvxColumnItem aColItem((const SvxColumnItem&)rReq.
-											GetArgs()->Get(nSlot));
+    case SID_RULER_ROWS :
+    case SID_RULER_ROWS_VERTICAL:
+        {
+            SvxColumnItem aColItem((const SvxColumnItem&)rReq.
+                GetArgs()->Get(nSlot));
 
-		if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
-		{
-			ASSERT(aColItem.Count(), "ColDesc ist leer!!");
+            if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
+            {
+                ASSERT(aColItem.Count(), "ColDesc ist leer!!");
 
-			SwTabCols aTabCols;
-			if ( bSetTabRowFromDoc )
-				rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
-			else
-				rSh.GetTabRows(aTabCols);
+                SwTabCols aTabCols;
+                if ( bSetTabRowFromDoc )
+                    rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
+                else
+                    rSh.GetTabRows(aTabCols);
 
-			if ( bVerticalWriting )
-			{
-				aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft());
-                aTabCols.SetLeftMin(aColItem.GetLeft());
-			}
-			else
-			{
-                long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight();
-				aTabCols.SetRight( nBorder );
-			}
+                if ( bVerticalWriting )
+                {
+                    aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft());
+                    aTabCols.SetLeftMin(aColItem.GetLeft());
+                }
+                else
+                {
+                    long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight();
+                    aTabCols.SetRight( nBorder );
+                }
 
-			if(bVerticalWriting)
-			{
-				for ( sal_uInt16 i = aColItem.Count() - 1; i; --i )
-				{
-					const SvxColumnDescription& rCol = aColItem[i - 1];
-					long nColumnPos = aTabCols.GetRight() - rCol.nEnd ;
-					aTabCols[i - 1] = nColumnPos;
-					aTabCols.SetHidden( i - 1, !rCol.bVisible );
-				}
-			}
-			else
-			{
-				for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i )
-				{
-					const SvxColumnDescription& rCol = aColItem[i];
-					aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
-					aTabCols.SetHidden( i, !rCol.bVisible );
-				}
-			}
-			sal_Bool bSingleLine = sal_False;
-			const SfxPoolItem* pSingleLine;
-			if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine))
-				bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue();
-			if ( bSetTabRowFromDoc )
-			{
-				if( !rSh.IsViewLocked() )
-				{
-					bUnlockView = sal_True;
-					rSh.LockView( sal_True );
-				}
-				rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos );
-			}
-			else
-				rSh.SetTabRows(aTabCols, bSingleLine);
-		}
-	}
-	break;
+                if(bVerticalWriting)
+                {
+                    for ( sal_uInt16 i = aColItem.Count() - 1; i; --i )
+                    {
+                        const SvxColumnDescription& rCol = aColItem[i - 1];
+                        long nColumnPos = aTabCols.GetRight() - rCol.nEnd ;
+                        aTabCols[i - 1] = nColumnPos;
+                        aTabCols.SetHidden( i - 1, !rCol.bVisible );
+                    }
+                }
+                else
+                {
+                    for ( sal_uInt16 i = 0; i < aColItem.Count()-1; ++i )
+                    {
+                        const SvxColumnDescription& rCol = aColItem[i];
+                        aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
+                        aTabCols.SetHidden( i, !rCol.bVisible );
+                    }
+                }
+                sal_Bool bSingleLine = sal_False;
+                const SfxPoolItem* pSingleLine;
+                if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, sal_False, &pSingleLine))
+                    bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue();
+                if ( bSetTabRowFromDoc )
+                {
+                    if( !rSh.IsViewLocked() )
+                    {
+                        bUnlockView = sal_True;
+                        rSh.LockView( sal_True );
+                    }
+                    rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos );
+                }
+                else
+                    rSh.SetTabRows(aTabCols, bSingleLine);
+            }
+        }
+        break;
 
     default:
-		ASSERT( !this, "Falsche SlotId");
-	}
-	rSh.EndAllAction();
+        ASSERT( !this, "Falsche SlotId");
+    }
+    rSh.EndAllAction();
 
-	if( bUnlockView )
-		rSh.LockView( sal_False );
+    if( bUnlockView )
+        rSh.LockView( sal_False );
 
     bSetTabColFromDoc = bSetTabRowFromDoc = bTabColFromDoc = bTabRowFromDoc = sal_False;
     SetNumRuleNodeFromDoc(NULL);
@@ -910,20 +1029,20 @@
 
 void SwView::StateTabWin(SfxItemSet& rSet)
 {
-	SwWrtShell &rSh 		= GetWrtShell();
+    SwWrtShell &rSh 		= GetWrtShell();
 
     const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos : 0;
-	const sal_uInt16 nFrmType	= rSh.IsObjSelected()
-				? FRMTYPE_DRAWOBJ
-				: rSh.GetFrmType( pPt, sal_True );
+    const sal_uInt16 nFrmType	= rSh.IsObjSelected()
+                ? FRMTYPE_DRAWOBJ
+                : rSh.GetFrmType( pPt, sal_True );
 
-	const sal_Bool 	bFrmSelection = rSh.IsFrmSelected();
-	const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
-	// PageOffset/Begrenzer
-	const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt );
-	const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt );
-	const long nPageWidth  = rPageRect.Width();
-	const long nPageHeight = rPageRect.Height();
+    const sal_Bool 	bFrmSelection = rSh.IsFrmSelected();
+    const sal_Bool bBrowse = rSh.GetViewOptions()->getBrowseMode();
+    // PageOffset/Begrenzer
+    const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt );
+    const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt );
+    const long nPageWidth  = rPageRect.Width();
+    const long nPageHeight = rPageRect.Height();
 
     const SwPageDesc& rDesc = rSh.GetPageDesc(
                 IsTabColFromDoc() || bTabRowFromDoc ?
@@ -944,912 +1063,991 @@
     pVRuler->SetTabsRelativeToIndent( bRelative );
 
     SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
-	SwapPageMargin( rDesc, aPageLRSpace );
+    SwapPageMargin( rDesc, aPageLRSpace );
 
-	SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
-									RES_LR_SPACE, 		 RES_UL_SPACE, 0 );
-    // --> OD 2008-01-17 #newlistlevelattrs#
+    SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
+                                    RES_LR_SPACE, 		 RES_UL_SPACE, 0 );
     // get also the list level indent values merged as LR-SPACE item, if needed.
     rSh.GetCurAttr( aCoreSet, true );
-    // <--
     SelectionType nSelType = rSh.GetSelectionType();
 
-	SfxWhichIter aIter( rSet );
-	sal_uInt16 nWhich = aIter.FirstWhich();
+    SfxWhichIter aIter( rSet );
+    sal_uInt16 nWhich = aIter.FirstWhich();
     sal_Bool bPutContentProtection = sal_False;
 
-	while ( nWhich )
-	{
-		switch ( nWhich )
-		{
-//        case RES_LR_SPACE:
-//        case SID_ATTR_LRSPACE:
-		case SID_ATTR_LONG_LRSPACE:
+    while ( nWhich )
+    {
+        switch ( nWhich )
         {
-			SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(),
-										(long)aPageLRSpace.GetRight(),
-										SID_ATTR_LONG_LRSPACE);
-			if(bBrowse)
-			{
-				aLongLR.SetLeft(rPagePrtRect.Left());
-				aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
-			}
-			if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) &&
-				 !(nFrmType & FRMTYPE_COLSECT) )
-			{
-				SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ?
-								rDesc.GetMaster().GetHeader().GetHeaderFmt() :
-								rDesc.GetMaster().GetFooter().GetFooterFmt());
-                if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+        case SID_ATTR_PAGE_COLUMN:
+            {
+                sal_uInt16 nColumnType = 0;
+
+                const SwFrmFmt& rMaster = rDesc.GetMaster();
+                SwFmtCol aCol(rMaster.GetCol());
+                const sal_uInt16 nCols = aCol.GetNumCols();
+                if ( nCols == 0 )
+                {
+                    nColumnType = 1;
+                }
+                else if ( nCols == 2 )
+                {
+                    const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth());
+                    const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth());
+
+                    if ( abs(nColLeft - nColRight) <= 10 )
+                    {
+                        nColumnType = 2;
+                    }
+                    else if( abs(nColLeft - nColRight*2) < 20 )
+                    {
+                        nColumnType = 4;
+                    }
+                    else if( abs(nColLeft*2 - nColRight) < 20 )
+                    {
+                        nColumnType = 5;
+                    }
+                }
+                else if( nCols == 3 )
+                {
+                    nColumnType = 3;
+                }
+
+                rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) );
+            }
+            break;
+
+        case SID_ATTR_LONG_LRSPACE:
+            {
+                SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(),
+                    (long)aPageLRSpace.GetRight(),
+                    SID_ATTR_LONG_LRSPACE);
+                if(bBrowse)
+                {
+                    aLongLR.SetLeft(rPagePrtRect.Left());
+                    aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
+                }
+                if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) &&
+                    !(nFrmType & FRMTYPE_COLSECT) )
+                {
+                    SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ?
+                        rDesc.GetMaster().GetHeader().GetHeaderFmt() :
+                        rDesc.GetMaster().GetFooter().GetFooterFmt());
+                    if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+                    {
+                        SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
+                        aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
+                        const SvxLRSpaceItem& aLR = pFmt->GetLRSpace();
+                        aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() );
+                        aLongLR.SetRight( (nPageWidth -
+                            (long)aRect.Right() + (long)aLR.GetRight()));
+                    }
+                }
+                else
+                {
+                    SwRect aRect;
+                    if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) )
+                    {
+                        aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
+                        const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
+                        aRect.Pos() += aTmpRect.Pos();
+                    }
+
+                    else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+                        aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+                    else if( nFrmType & FRMTYPE_DRAWOBJ)
+                        aRect = rSh.GetObjRect();
+
+                    if( aRect.Width() )
+                    {
+                        // PAGES01
+                        // make relative to page position:
+                        aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() ));
+                        aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right()));
+                    }
+                }
+                if( nWhich == SID_ATTR_LONG_LRSPACE )
+                    rSet.Put( aLongLR );
+                else
+                {
+                    SvxLRSpaceItem aLR( aLongLR.GetLeft(),
+                        aLongLR.GetRight(),
+                        0, 0,
+                        nWhich);
+                    rSet.Put(aLR);
+                }
+                break;
+            }
+
+        // provide left and right margins of current page style
+        case SID_ATTR_PAGE_LRSPACE:
+            {
+                SvxLongLRSpaceItem aLongLR(
+                    (long)aPageLRSpace.GetLeft(),
+                    (long)aPageLRSpace.GetRight(),
+                    SID_ATTR_PAGE_LRSPACE );
+                rSet.Put( aLongLR );
+            }
+            break;
+
+        case SID_ATTR_LONG_ULSPACE:
+            {
+                // Rand Seite Oben Unten
+                SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
+                SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(),
+                    (long)aUL.GetLower(),
+                    SID_ATTR_LONG_ULSPACE);
+
+                if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+                {
+                    // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen
+                    const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+                    aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() ));
+                    aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() ));
+                }
+                else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER )
                 {
                     SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
                     aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
-                    const SvxLRSpaceItem& aLR = pFmt->GetLRSpace();
-                    aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() );
-                    aLongLR.SetRight( (nPageWidth -
-                                        (long)aRect.Right() + (long)aLR.GetRight()));
+                    aLongUL.SetUpper( (sal_uInt16)aRect.Top() );
+                    aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) );
                 }
-			}
-			else
-			{
-				SwRect aRect;
-				if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) )
+                else if( nFrmType & FRMTYPE_DRAWOBJ)
                 {
-                    aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
-                    const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
-                    aRect.Pos() += aTmpRect.Pos();
+                    const SwRect &rRect = rSh.GetObjRect();
+                    aLongUL.SetUpper((rRect.Top() - rPageRect.Top()));
+                    aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom()));
                 }
+                else if(bBrowse)
+                {
+                    aLongUL.SetUpper(rPagePrtRect.Top());
+                    aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
+                }
+                if( nWhich == SID_ATTR_LONG_ULSPACE )
+                    rSet.Put( aLongUL );
+                else
+                {
+                    SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(),
+                        (sal_uInt16)aLongUL.GetLower(),
+                        nWhich);
+                    rSet.Put(aULTmp);
+                }
+                break;
+            }
 
-				else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
-					aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
-				else if( nFrmType & FRMTYPE_DRAWOBJ)
-					aRect = rSh.GetObjRect();
+        // provide top and bottom margins of current page style
+        case SID_ATTR_PAGE_ULSPACE:
+            {
+                const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
+                SvxLongULSpaceItem aLongUL(
+                    (long)aUL.GetUpper(),
+                    (long)aUL.GetLower(),
+                    SID_ATTR_PAGE_ULSPACE );
 
-				if( aRect.Width() )
-				{
-                    // PAGES01
-                    // make relative to page position:
-					aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() ));
-					aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right()));
-				}
-			}
-			if( nWhich == SID_ATTR_LONG_LRSPACE )
-				rSet.Put( aLongLR );
-            else
-			{
-				SvxLRSpaceItem aLR( aLongLR.GetLeft(),
-								    aLongLR.GetRight(),
-                                    0, 0,
-									nWhich);
-				rSet.Put(aLR);
-			}
-			break;
-		}
-		case SID_ATTR_LONG_ULSPACE:
-//        case SID_ATTR_ULSPACE:
-//        case RES_UL_SPACE:
-		{
-			// Rand Seite Oben Unten
-			SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
-			SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(),
-										(long)aUL.GetLower(),
-										SID_ATTR_LONG_ULSPACE);
+                rSet.Put( aLongUL );
+            }
+            break;
 
-			if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
-			{
-				// Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen
-				const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
-				aLongUL.SetUpper((sal_uInt16)(rRect.Top() - rPageRect.Top() ));
-				aLongUL.SetLower((sal_uInt16)(rPageRect.Bottom() - rRect.Bottom() ));
-			}
-			else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER )
-			{
-				SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
-				aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
-				aLongUL.SetUpper( (sal_uInt16)aRect.Top() );
-				aLongUL.SetLower( (sal_uInt16)(nPageHeight - aRect.Bottom()) );
-			}
-			else if( nFrmType & FRMTYPE_DRAWOBJ)
-			{
-				const SwRect &rRect = rSh.GetObjRect();
-				aLongUL.SetUpper((rRect.Top() - rPageRect.Top()));
-				aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom()));
-			}
-			else if(bBrowse)
-			{
-				aLongUL.SetUpper(rPagePrtRect.Top());
-				aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
-			}
-			if( nWhich == SID_ATTR_LONG_ULSPACE )
-				rSet.Put( aLongUL );
-			else
-			{
-				SvxULSpaceItem aULTmp((sal_uInt16)aLongUL.GetUpper(),
-									  (sal_uInt16)aLongUL.GetLower(),
-									  nWhich);
-				rSet.Put(aULTmp);
-			}
-			break;
-		}
         case SID_ATTR_TABSTOP_VERTICAL :
         case RES_PARATR_TABSTOP:
-		{
-			if ( ISA( SwWebView ) ||
-				 IsTabColFromDoc() ||
-                 IsTabRowFromDoc() ||
-				 ( nSelType & nsSelectionType::SEL_GRF) ||
-					(nSelType & nsSelectionType::SEL_FRM) ||
-					(nSelType & nsSelectionType::SEL_OLE) ||
+            {
+                if ( ISA( SwWebView ) ||
+                    IsTabColFromDoc() ||
+                    IsTabRowFromDoc() ||
+                    ( nSelType & nsSelectionType::SEL_GRF) ||
+                    (nSelType & nsSelectionType::SEL_FRM) ||
+                    (nSelType & nsSelectionType::SEL_OLE) ||
                     SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)||
                     (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))||
                     (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
-                 )
-                rSet.DisableItem( nWhich );
-			else
-            {
-                SvxTabStopItem aTabStops((const SvxTabStopItem&)
-											aCoreSet.Get( RES_PARATR_TABSTOP ));
+                    )
+                    rSet.DisableItem( nWhich );
+                else
+                {
+                    SvxTabStopItem aTabStops((const SvxTabStopItem&)
+                        aCoreSet.Get( RES_PARATR_TABSTOP ));
 
-				const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
-											rSh.GetDefault(RES_PARATR_TABSTOP);
+                    const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
+                        rSh.GetDefault(RES_PARATR_TABSTOP);
 
-                DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?");
-				long nDefTabDist = ::GetTabDist(rDefTabs);
-                pHRuler->SetDefTabDist( nDefTabDist );
-                pVRuler->SetDefTabDist( nDefTabDist );
-				::lcl_EraseDefTabs(aTabStops);
-                rSet.Put(aTabStops, nWhich);
-			}
-			break;
-		}
+                    DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?");
+                    long nDefTabDist = ::GetTabDist(rDefTabs);
+                    pHRuler->SetDefTabDist( nDefTabDist );
+                    pVRuler->SetDefTabDist( nDefTabDist );
+                    ::lcl_EraseDefTabs(aTabStops);
+                    rSet.Put(aTabStops, nWhich);
+                }
+                break;
+            }
+
         case SID_ATTR_PARA_LRSPACE_VERTICAL:
         case SID_ATTR_PARA_LRSPACE:
-		{
-			if ( nSelType & nsSelectionType::SEL_GRF ||
-					nSelType & nsSelectionType::SEL_FRM ||
-					nSelType & nsSelectionType::SEL_OLE ||
+            {
+                if ( nSelType & nsSelectionType::SEL_GRF ||
+                    nSelType & nsSelectionType::SEL_FRM ||
+                    nSelType & nsSelectionType::SEL_OLE ||
                     nFrmType == FRMTYPE_DRAWOBJ ||
                     (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))||
                     (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
                     )
-            {
-                rSet.DisableItem(nWhich);
-            }
-			else
-			{
-                SvxLRSpaceItem aLR( RES_LR_SPACE );
-				if ( !IsTabColFromDoc() )
                 {
-					aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE);
-
-                    // #i23726#
-                    if (pNumRuleNodeFromDoc)
-                    {
-                        short nOffset = static_cast< short >(aLR.GetTxtLeft() +
-                                        // --> FME 2005-02-22 #i42922# Mouse move of numbering label
-                                        // has to consider the left indent of the paragraph
-                                        pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) );
-                                       // <--
-
-                        short nFLOffset;
-                        pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset );
-
-                        aLR.SetLeft( nOffset + nFLOffset );
-                    }
+                    rSet.DisableItem(nWhich);
                 }
-				aLR.SetWhich(nWhich);
-				rSet.Put(aLR);
-			}
-        break;
-		}
+                else
+                {
+                    SvxLRSpaceItem aLR( RES_LR_SPACE );
+                    if ( !IsTabColFromDoc() )
+                    {
+                        aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE);
+
+                        // #i23726#
+                        if (pNumRuleNodeFromDoc)
+                        {
+                            short nOffset = static_cast< short >(aLR.GetTxtLeft() +
+                                // --> FME 2005-02-22 #i42922# Mouse move of numbering label
+                                // has to consider the left indent of the paragraph
+                                pNumRuleNodeFromDoc->GetLeftMarginWithNum( sal_True ) );
+                            // <--
+
+                            short nFLOffset;
+                            pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset );
+
+                            aLR.SetLeft( nOffset + nFLOffset );
+                        }
+                    }
+                    aLR.SetWhich(nWhich);
+                    rSet.Put(aLR);
+                }
+                break;
+            }
+
+	case SID_ATTR_PARA_ULSPACE:
+	{	
+		SvxULSpaceItem aUL = (const SvxULSpaceItem&)aCoreSet.Get(RES_UL_SPACE);
+		aUL.SetWhich(nWhich);
+
+		SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE);
+		if( e >= SFX_ITEM_AVAILABLE )
+			rSet.Put( aUL );
+		else
+			rSet.InvalidateItem(nWhich);
+	}
+	break;
+
         case SID_RULER_BORDER_DISTANCE:
-        {
-            nLeftBorderDistance = 0;
-            nRightBorderDistance = 0;
-            if ( nSelType & nsSelectionType::SEL_GRF ||
-					nSelType & nsSelectionType::SEL_FRM ||
-					nSelType & nsSelectionType::SEL_OLE ||
-					nFrmType == FRMTYPE_DRAWOBJ )
-                rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
-			else
-			{
-                SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
-                if(nFrmType & FRMTYPE_FLY_ANY)
-				{
-					if( IsTabColFromDoc() )
-					{
-                        const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt );
-                        aDistLR.SetLeft(rFlyPrtRect.Left());
-                        aDistLR.SetRight(rFlyPrtRect.Left());
-					}
-					else
-					{
-						SfxItemSet aCoreSet2( GetPool(),
-												RES_BOX, RES_BOX,
-												SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+            {
+                nLeftBorderDistance = 0;
+                nRightBorderDistance = 0;
+                if ( nSelType & nsSelectionType::SEL_GRF ||
+                    nSelType & nsSelectionType::SEL_FRM ||
+                    nSelType & nsSelectionType::SEL_OLE ||
+                    nFrmType == FRMTYPE_DRAWOBJ )
+                    rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
+                else
+                {
+                    SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
+                    if(nFrmType & FRMTYPE_FLY_ANY)
+                    {
+                        if( IsTabColFromDoc() )
+                        {
+                            const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt );
+                            aDistLR.SetLeft(rFlyPrtRect.Left());
+                            aDistLR.SetRight(rFlyPrtRect.Left());
+                        }
+                        else
+                        {
+                            SfxItemSet aCoreSet2( GetPool(),
+                                RES_BOX, RES_BOX,
+                                SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+                            SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+                            aCoreSet.Put( aBoxInfo );
+                            rSh.GetFlyFrmAttr( aCoreSet );
+                            const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX);
+                            aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
+                            aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
+
+                            //add the paragraph border distance
+                            SfxItemSet aCoreSet1( GetPool(),
+                                RES_BOX, RES_BOX,
+                                0 );
+                            rSh.GetCurAttr( aCoreSet1 );
+                            const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
+                            aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
+                            aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
+                        }
+                        rSet.Put(aDistLR);
+                        nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
+                        nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
+                    }
+                    else if ( IsTabColFromDoc() ||
+                        ( rSh.GetTableFmt() && !bFrmSelection &&
+                        !(nFrmType & FRMTYPE_COLSECT ) ) )
+                    {
+                        SfxItemSet aCoreSet2( GetPool(),
+                            RES_BOX, RES_BOX,
+                            SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
                         SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
-						aCoreSet.Put( aBoxInfo );
-						rSh.GetFlyFrmAttr( aCoreSet );
-						const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX);
+                        aBoxInfo.SetTable(sal_False);
+                        aBoxInfo.SetDist((sal_Bool) sal_True);
+                        aCoreSet2.Put(aBoxInfo);
+                        rSh.GetTabBorders( aCoreSet2 );
+                        const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX);
                         aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
                         aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
 
-						//add the paragraph border distance
+                        //add the border distance of the paragraph
                         SfxItemSet aCoreSet1( GetPool(),
-                                                RES_BOX, RES_BOX,
-                                                0 );
+                            RES_BOX, RES_BOX,
+                            0 );
                         rSh.GetCurAttr( aCoreSet1 );
                         const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
-						aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
-						aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
-					}
-                    rSet.Put(aDistLR);
-                    nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
-                    nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
-                }
-                else if ( IsTabColFromDoc() ||
-					( rSh.GetTableFmt() && !bFrmSelection &&
-					!(nFrmType & FRMTYPE_COLSECT ) ) )
-                {
-                    SfxItemSet aCoreSet2( GetPool(),
-                                            RES_BOX, RES_BOX,
-                                            SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
-                    SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
-                    aBoxInfo.SetTable(sal_False);
-                    aBoxInfo.SetDist((sal_Bool) sal_True);
-                    aCoreSet2.Put(aBoxInfo);
-                    rSh.GetTabBorders( aCoreSet2 );
-                    const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX);
-                    aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
-                    aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
-
-                    //add the border distance of the paragraph
-                    SfxItemSet aCoreSet1( GetPool(),
-                                            RES_BOX, RES_BOX,
-                                            0 );
-                    rSh.GetCurAttr( aCoreSet1 );
-                    const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
-                    aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
-                    aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
-                    rSet.Put(aDistLR);
-                    nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
-                    nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
-                }
-                else if ( !rSh.IsDirectlyInSection() )
-                {
-                    //get the page/header/footer border distance
-                    const SwFrmFmt& rMaster = rDesc.GetMaster();
-                    const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX);
-                    aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
-                    aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
-
-                    const SvxBoxItem* pBox = 0;
-                    if(nFrmType & FRMTYPE_HEADER)
-                    {
-                        rMaster.GetHeader();
-                        const SwFmtHeader& rHeaderFmt = rMaster.GetHeader();
-                        SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
-                        if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
-                            pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox();
+                        aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
+                        aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
+                        rSet.Put(aDistLR);
+                        nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
+                        nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
                     }
-                    else if(nFrmType & FRMTYPE_FOOTER )
+                    else if ( !rSh.IsDirectlyInSection() )
                     {
-                        const SwFmtFooter& rFooterFmt = rMaster.GetFooter();
-                        SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
-                        if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
-                            pBox = & (const SvxBoxItem&)pFooterFmt->GetBox();
-                    }
-                    if(pBox)
-                    {
-                        aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT ));
-                        aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT));
-                    }
+                        //get the page/header/footer border distance
+                        const SwFrmFmt& rMaster = rDesc.GetMaster();
+                        const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX);
+                        aDistLR.SetLeft((sal_uInt16)rBox.GetDistance(BOX_LINE_LEFT ));
+                        aDistLR.SetRight((sal_uInt16)rBox.GetDistance(BOX_LINE_RIGHT));
 
-                    //add the border distance of the paragraph
-                    SfxItemSet aCoreSetTmp( GetPool(),
-                                            RES_BOX, RES_BOX,
-                                            SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
-                    rSh.GetCurAttr( aCoreSetTmp );
-                    const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX);
-                    aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
-                    aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
-                    rSet.Put(aDistLR);
-                    nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
-                    nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
+                        const SvxBoxItem* pBox = 0;
+                        if(nFrmType & FRMTYPE_HEADER)
+                        {
+                            rMaster.GetHeader();
+                            const SwFmtHeader& rHeaderFmt = rMaster.GetHeader();
+                            SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+                            if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+                                pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox();
+                        }
+                        else if(nFrmType & FRMTYPE_FOOTER )
+                        {
+                            const SwFmtFooter& rFooterFmt = rMaster.GetFooter();
+                            SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+                            if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+                                pBox = & (const SvxBoxItem&)pFooterFmt->GetBox();
+                        }
+                        if(pBox)
+                        {
+                            aDistLR.SetLeft((sal_uInt16)pBox->GetDistance(BOX_LINE_LEFT ));
+                            aDistLR.SetRight((sal_uInt16)pBox->GetDistance(BOX_LINE_RIGHT));
+                        }
+
+                        //add the border distance of the paragraph
+                        SfxItemSet aCoreSetTmp( GetPool(),
+                            RES_BOX, RES_BOX,
+                            SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+                        rSh.GetCurAttr( aCoreSetTmp );
+                        const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX);
+                        aDistLR.SetLeft(aDistLR.GetLeft() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_LEFT ));
+                        aDistLR.SetRight(aDistLR.GetRight() + (sal_uInt16)rParaBox.GetDistance(BOX_LINE_RIGHT));
+                        rSet.Put(aDistLR);
+                        nLeftBorderDistance  = static_cast< sal_uInt16 >(aDistLR.GetLeft());
+                        nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
+                    }
                 }
             }
-        }
-        break;
+            break;
+
         case SID_RULER_TEXT_RIGHT_TO_LEFT:
-        {
-            if ( nSelType & nsSelectionType::SEL_GRF ||
-					nSelType & nsSelectionType::SEL_FRM ||
-					nSelType & nsSelectionType::SEL_OLE ||
-                    nFrmType == FRMTYPE_DRAWOBJ)
-                rSet.DisableItem(nWhich);
-            else
             {
-                sal_Bool bFlag = rSh.IsInRightToLeftText();
-                rSet.Put(SfxBoolItem(nWhich, bFlag));
+                if ( nSelType & nsSelectionType::SEL_GRF ||
+                    nSelType & nsSelectionType::SEL_FRM ||
+                    nSelType & nsSelectionType::SEL_OLE ||
+                    nFrmType == FRMTYPE_DRAWOBJ)
+                    rSet.DisableItem(nWhich);
+                else
+                {
+                    sal_Bool bFlag = rSh.IsInRightToLeftText();
+                    rSet.Put(SfxBoolItem(nWhich, bFlag));
+                }
             }
-        }
-        break;
+            break;
+
         case SID_RULER_BORDERS_VERTICAL:
         case SID_RULER_BORDERS:
-		{
-            sal_Bool bFrameHasVerticalColumns(sal_False);
             {
-                sal_Bool bFrameRTL;
-                sal_Bool bFrameVertL2R;
-                bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
-                                           bFrmSelection;
-            }
-            sal_Bool bHasTable = ( IsTabColFromDoc() ||
+                sal_Bool bFrameHasVerticalColumns(sal_False);
+                {
+                    sal_Bool bFrameRTL;
+                    sal_Bool bFrameVertL2R;
+                    bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
+                        bFrmSelection;
+                }
+                sal_Bool bHasTable = ( IsTabColFromDoc() ||
                     ( rSh.GetTableFmt() && !bFrmSelection &&
                     !(nFrmType & FRMTYPE_COLSECT ) ) );
 
-            sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical();
+                sal_Bool bTableVertical = bHasTable && rSh.IsTableVertical();
 
-            if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) &&
+                if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) &&
                     ((bHasTable && !bTableVertical)||
-                        (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
-                ((SID_RULER_BORDERS == nWhich) &&
+                    (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
+                    ((SID_RULER_BORDERS == nWhich) &&
                     ((bHasTable && bTableVertical)||
-                        (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns)))
-                rSet.DisableItem(nWhich);
-            else if ( bHasTable )
-			{
-				SwTabCols aTabCols;
-				sal_uInt16	  nNum;
-				if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) )
-				{
-					rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
-					nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos );
-				}
-				else
-				{
-					rSh.GetTabCols( aTabCols );
-					nNum = rSh.GetCurTabColNum();
-                    if(rSh.IsTableRightToLeft())
-                        nNum = aTabCols.Count() - nNum;
-				}
-
-				ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
-				const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
-                const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) -
-								  (aTabCols.GetLeftMin() +
-								  aTabCols.GetRight());
-
-                const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
-                const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
-
-				SvxColumnItem aColItem(nNum, nL, nR);
-
-				sal_uInt16 nStart = 0,
-					   nEnd;
-
-                //columns in right-to-left tables need to be mirrored
-                sal_Bool bIsTableRTL =
-                    IsTabColFromDoc() ?
-                          rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
-                        : rSh.IsTableRightToLeft();
-                if(bIsTableRTL)
+                    (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns)))
+                    rSet.DisableItem(nWhich);
+                else if ( bHasTable )
                 {
-                    for ( sal_uInt16 i = aTabCols.Count(); i ; --i )
+                    SwTabCols aTabCols;
+                    sal_uInt16	  nNum;
+                    if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) )
                     {
-                        const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
-                        nEnd  = (sal_uInt16)aTabCols.GetRight();
-                        nEnd  = nEnd - (sal_uInt16)rEntry.nPos;
-                        SvxColumnDescription aColDesc( nStart, nEnd,
-                                    (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)),
-                                    (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)),
-                                                    !aTabCols.IsHidden(i - 1) );
-                        aColItem.Append(aColDesc);
-                        nStart = nEnd;
+                        rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
+                        nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos );
                     }
-                    SvxColumnDescription aColDesc(nStart,
-                                    aTabCols.GetRight() - aTabCols.GetLeft(), sal_True);
-                    aColItem.Append(aColDesc);
-                }
-                else
-                {
-                    for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+                    else
                     {
-                        const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
-                        nEnd  = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft());
-                        SvxColumnDescription aColDesc( nStart, nEnd,
-                                rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
-                                                    !aTabCols.IsHidden(i) );
-                        aColItem.Append(aColDesc);
-                        nStart = nEnd;
+                        rSh.GetTabCols( aTabCols );
+                        nNum = rSh.GetCurTabColNum();
+                        if(rSh.IsTableRightToLeft())
+                            nNum = aTabCols.Count() - nNum;
                     }
-                    SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
-                                0, 0,
-                                    sal_True);
-                    aColItem.Append(aColDesc);
-                }
-				rSet.Put(aColItem, nWhich);
-			}
-			else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) )
-			{
-				// Aus Rahmen oder Seite ?
-				sal_uInt16 nNum = 0;
-				if(bFrmSelection)
-				{
-					const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
-					if(pFmt)
-						nNum = pFmt->GetCol().GetNumCols();
-				}
-				else
-					nNum = rSh.GetCurColNum();
 
-				if(
-					//eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist!
-					!bFrmSelection &&
- 					nFrmType & FRMTYPE_COLSECT )
-				{
-					const SwSection *pSect = rSh.GetAnySection(sal_False, pPt);
-					ASSERT( pSect, "Welcher Bereich?");
-					if( pSect )
-					{
-						SwSectionFmt *pFmt = pSect->GetFmt();
-                        const SwFmtCol& rCol = pFmt->GetCol();
-						if(rSh.IsInRightToLeftText())
-							nNum = rCol.GetColumns().Count() - nNum;
-						else
-							--nNum;
-						SvxColumnItem aColItem(nNum);
-						SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
-                        const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
-
-						::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0);
-
-						if(bVerticalWriting)
-						{
-							aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
-							aRect.Pos().Y() -= rPageRect.Top();
-							aColItem.SetLeft ((sal_uInt16)(aRect.Top()));
-                            aColItem.SetRight((sal_uInt16)(nPageHeight   - aRect.Bottom() ));
-						}
-						else
-						{
-							aRect.Pos() += aTmpRect.Pos();
-
-                            // PAGES01
-                            // make relative to page position:
-					        aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() ));
-					        aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right()));
-						}
-						aColItem.SetOrtho(aColItem.CalcOrtho());
-
-						rSet.Put(aColItem, nWhich);
-					}
-				}
-				else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
-				{
-					// Spalten in Rahmen
-					if ( nNum  )
-					{
-						const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ;
-
-						const SwFmtCol& rCol = pFmt->GetCol();
-						if(rSh.IsInRightToLeftText())
-							nNum = rCol.GetColumns().Count() - nNum;
-						else
-							nNum--;
-						SvxColumnItem aColItem(nNum);
-						const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt);
-
-                        sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting);
-                        const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
-						const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
-                        long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
-						::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2);
-
-						SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
-						rSh.GetFlyFrmAttr( aFrameSet );
-
-                        if(bUseVertical)
-						{
-                            aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top()));
-                            aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() ));
-						}
-						else
-						{
-							aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left()   ));
-							aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() ));
-						}
-
-						aColItem.SetOrtho(aColItem.CalcOrtho());
-
-						rSet.Put(aColItem, nWhich);
-					}
-					else
-                        rSet.DisableItem(nWhich);
-				}
-				else
-				{	// Spalten auf der Seite
-					const SwFrmFmt& rMaster = rDesc.GetMaster();
-					SwFmtCol aCol(rMaster.GetCol());
-					if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP)
-						nNum = aCol.GetColumns().Count() - nNum;
-					else
-						nNum--;
-
-					SvxColumnItem aColItem(nNum);
-                    const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt);
-                    const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX);
-					long nDist = rBox.GetDistance();
-                    ::lcl_FillSvxColumn(aCol,
-                        sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ),
-                        aColItem, nDist);
-
-					if(bBrowse)
-					{
-						aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left());
-						aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
-					}
-					else
-					{
-						aColItem.SetLeft (aPageLRSpace.GetLeft());
-						aColItem.SetRight(aPageLRSpace.GetRight());
-					}
-					aColItem.SetOrtho(aColItem.CalcOrtho());
-
-					rSet.Put(aColItem, nWhich);
-				}
-			}
-			else
-                rSet.DisableItem(nWhich);
-			break;
-		}
-        case SID_RULER_ROWS :
-        case SID_RULER_ROWS_VERTICAL:
-        {
-            sal_Bool bFrameHasVerticalColumns(sal_False);
-            {
-                sal_Bool bFrameRTL;
-                sal_Bool bFrameVertL2R;
-                bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
-                                           bFrmSelection;
-            }
-
-            if( ( (SID_RULER_ROWS == nWhich) &&
-                    ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
-                ((SID_RULER_ROWS_VERTICAL == nWhich) &&
-                    ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns)))
-                rSet.DisableItem(nWhich);
-            else if ( IsTabRowFromDoc() ||
-                    ( rSh.GetTableFmt() && !bFrmSelection &&
-                    !(nFrmType & FRMTYPE_COLSECT ) ) )
-            {
-                SwTabCols aTabCols;
-                //no current value necessary
-                sal_uInt16    nNum = 0;
-                if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) )
-                {
-                    rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
-                }
-                else
-                {
-                    rSh.GetTabRows( aTabCols );
-                }
-
-//                ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
-                const int nLft = aTabCols.GetLeftMin();
-                const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) -
-                                  (aTabCols.GetLeftMin() +
-                                  aTabCols.GetRight());
-
-                const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
-                const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
-
-                SvxColumnItem aColItem(nNum, nL, nR);
-
-                sal_uInt16 nStart = 0,
-                       nEnd;
-
-                for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
-                {
-                    const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
-                    if(bVerticalWriting)
-					{
-                        nEnd  = sal_uInt16(aTabCols.GetRight() - rEntry.nPos);
-                        SvxColumnDescription aColDesc( nStart, nEnd,
-                            aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin,
-													!aTabCols.IsHidden(i) );
-						aColItem.Append(aColDesc);
-					}
-					else
-					{
-                        nEnd  = sal_uInt16(rEntry.nPos - aTabCols.GetLeft());
-						SvxColumnDescription aColDesc( nStart, nEnd,
-                                sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()),
-													!aTabCols.IsHidden(i) );
-						aColItem.Append(aColDesc);
-					}
-                    nStart = nEnd;
-                }
-                if(bVerticalWriting)
-                    nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight());
-                else
-                    nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft());
-                // put a position protection when the last row cannot be moved
-                // due to a page break inside of a row
-                if(!aTabCols.IsLastRowAllowedToChange())
-					bPutContentProtection = sal_True;
-
-                SvxColumnDescription aColDesc( nStart, nEnd,
-                    aTabCols.GetRight(), aTabCols.GetRight(),
-                                            sal_False );
-                aColItem.Append(aColDesc);
-
-                rSet.Put(aColItem, nWhich);
-            }
-            else
-                rSet.DisableItem(nWhich);
-        }
-        break;
-		case SID_RULER_PAGE_POS:
-		{
-            // PAGES01
-            SvxPagePosSizeItem aPagePosSize(
-					Point( rPageRect.Left(), rPageRect.Top()) ,	nPageWidth, nPageHeight);
-
-			rSet.Put(aPagePosSize);
-			break;
-		}
-		case SID_RULER_LR_MIN_MAX:
-		{
-			Rectangle aRectangle;
-			if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() &&
-				( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) )
-			{
-				if( nFrmType & FRMTYPE_TABLE )
-				{
-					const sal_uInt16 nNum = rSh.GetCurTabColNum();
-					SwTabCols aTabCols;
-					rSh.GetTabCols( aTabCols );
-
+                    ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
                     const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
-					const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
+                    const int nRgt = (sal_uInt16)(bTableVertical ? nPageHeight : nPageWidth) -
+                        (aTabCols.GetLeftMin() +
+                        aTabCols.GetRight());
 
                     const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
                     const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
 
-					aRectangle.Left() = nL;
-					if(nNum > 1)
-						aRectangle.Left() += aTabCols[nNum - 2];
-					if(nNum)
-						aRectangle.Left() += MINLAY;
-					if(aTabCols.Count() <= nNum + 1 )
-						aRectangle.Right() = nR;
-					else
-						aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]);
+                    SvxColumnItem aColItem(nNum, nL, nR);
 
-					if(nNum < aTabCols.Count())
-						aRectangle.Right() += MINLAY;
-				}
-				else
-				{
-					const SwFrmFmt* pFmt =  rSh.GetFlyFrmFmt();
-					const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
-												   &rDesc.GetMaster().GetCol();
-					const SwColumns& rCols = pCols->GetColumns();
-					sal_uInt16 nNum = rSh.GetCurOutColNum();
-					sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count());
-					const SwRect aRect( rSh.GetAnyCurRect( pFmt
-													? RECT_FLY_PRT_EMBEDDED
-													: RECT_PAGE_PRT, pPt ));
-					const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt
-													? RECT_FLY_EMBEDDED
-													: RECT_PAGE, pPt ));
+                    sal_uInt16 nStart = 0,
+                        nEnd;
 
-					//die Breite im Rahmen bzw. innerhalbe der Seitenraender
-					const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
-					//die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand
-					const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width();
-					int nWidth = 0,
-						nStart = 0,
-						nEnd = 0;
-					aRectangle.Left() = 0;
-                    for ( sal_uInt16 i = 0; i < nCount; ++i )
-					{
-						SwColumn* pCol = rCols[i];
-						nStart = pCol->GetLeft() + nWidth;
-						if(i == nNum - 2)
-							aRectangle.Left() = nStart;
-						nWidth += pCols->CalcColWidth( i, nTotalWidth );
-						nEnd = nWidth - pCol->GetRight();
-					}
-					aRectangle.Right() = rPageRect.Right() - nEnd;
-					aRectangle.Left() -= rPageRect.Left();
+                    //columns in right-to-left tables need to be mirrored
+                    sal_Bool bIsTableRTL =
+                        IsTabColFromDoc() ?
+                        rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+                        : rSh.IsTableRightToLeft();
+                    if(bIsTableRTL)
+                    {
+                        for ( sal_uInt16 i = aTabCols.Count(); i ; --i )
+                        {
+                            const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
+                            nEnd  = (sal_uInt16)aTabCols.GetRight();
+                            nEnd  = nEnd - (sal_uInt16)rEntry.nPos;
+                            SvxColumnDescription aColDesc( nStart, nEnd,
+                                (sal_uInt16(aTabCols.GetRight() - rEntry.nMax)),
+                                (sal_uInt16(aTabCols.GetRight() - rEntry.nMin)),
+                                !aTabCols.IsHidden(i - 1) );
+                            aColItem.Append(aColDesc);
+                            nStart = nEnd;
+                        }
+                        SvxColumnDescription aColDesc(nStart,
+                            aTabCols.GetRight() - aTabCols.GetLeft(), sal_True);
+                        aColItem.Append(aColDesc);
+                    }
+                    else
+                    {
+                        for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+                        {
+                            const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
+                            nEnd  = static_cast< sal_uInt16 >(rEntry.nPos - aTabCols.GetLeft());
+                            SvxColumnDescription aColDesc( nStart, nEnd,
+                                rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
+                                !aTabCols.IsHidden(i) );
+                            aColItem.Append(aColDesc);
+                            nStart = nEnd;
+                        }
+                        SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
+                            0, 0,
+                            sal_True);
+                        aColItem.Append(aColDesc);
+                    }
+                    rSet.Put(aColItem, nWhich);
+                }
+                else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) )
+                {
+                    // Aus Rahmen oder Seite ?
+                    sal_uInt16 nNum = 0;
+                    if(bFrmSelection)
+                    {
+                        const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
+                        if(pFmt)
+                            nNum = pFmt->GetCol().GetNumCols();
+                    }
+                    else
+                        nNum = rSh.GetCurColNum();
 
-                    if(nNum > 1)
-					{
-						aRectangle.Left() += MINLAY;
-						aRectangle.Left() += aRect.Left();
-					}
-					if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand
-						aRectangle.Left()  = aRectangle.Right() = 0;
-					else
-					{
-						// das Rechteck an die richtige absolute Position verschieben
-						aRectangle.Left() += aAbsRect.Left();
-						aRectangle.Right() -= aAbsRect.Left();
-						// Abstand zur Umrandung mit einbeziehen
-						aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2;
-					}
+                    if(
+                        //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist!
+                            !bFrmSelection &&
+                            nFrmType & FRMTYPE_COLSECT )
+                    {
+                        const SwSection *pSect = rSh.GetAnySection(sal_False, pPt);
+                        ASSERT( pSect, "Welcher Bereich?");
+                        if( pSect )
+                        {
+                            SwSectionFmt *pFmt = pSect->GetFmt();
+                            const SwFmtCol& rCol = pFmt->GetCol();
+                            if(rSh.IsInRightToLeftText())
+                                nNum = rCol.GetColumns().Count() - nNum;
+                            else
+                                --nNum;
+                            SvxColumnItem aColItem(nNum);
+                            SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
+                            const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
 
-					if(nNum < rCols.Count())
-					{
-						aRectangle.Right() += MINLAY;
-					}
-					else
-						// rechts ist jetzt nur noch der Seitenrand
-						aRectangle.Right() = 0;
+                            ::lcl_FillSvxColumn(rCol, sal_uInt16(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0);
+
+                            if(bVerticalWriting)
+                            {
+                                aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
+                                aRect.Pos().Y() -= rPageRect.Top();
+                                aColItem.SetLeft ((sal_uInt16)(aRect.Top()));
+                                aColItem.SetRight((sal_uInt16)(nPageHeight   - aRect.Bottom() ));
+                            }
+                            else
+                            {
+                                aRect.Pos() += aTmpRect.Pos();
+
+                                // PAGES01
+                                // make relative to page position:
+                                aColItem.SetLeft ((sal_uInt16)( aRect.Left() - rPageRect.Left() ));
+                                aColItem.SetRight((sal_uInt16)( rPageRect.Right() - aRect.Right()));
+                            }
+                            aColItem.SetOrtho(aColItem.CalcOrtho());
+
+                            rSet.Put(aColItem, nWhich);
+                        }
+                    }
+                    else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+                    {
+                        // Spalten in Rahmen
+                        if ( nNum  )
+                        {
+                            const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ;
+
+                            const SwFmtCol& rCol = pFmt->GetCol();
+                            if(rSh.IsInRightToLeftText())
+                                nNum = rCol.GetColumns().Count() - nNum;
+                            else
+                                nNum--;
+                            SvxColumnItem aColItem(nNum);
+                            const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt);
+
+                            sal_Bool bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting);
+                            const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
+                            const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+                            long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
+                            ::lcl_FillSvxColumn(rCol, sal_uInt16(lWidth), aColItem, nDist2);
+
+                            SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
+                            rSh.GetFlyFrmAttr( aFrameSet );
+
+                            if(bUseVertical)
+                            {
+                                aColItem.SetLeft ((sal_uInt16)(rRect.Top()- rPageRect.Top()));
+                                aColItem.SetRight((sal_uInt16)(nPageHeight + rPageRect.Top() - rRect.Bottom() ));
+                            }
+                            else
+                            {
+                                aColItem.SetLeft ((sal_uInt16)(rRect.Left() - rPageRect.Left()   ));
+                                aColItem.SetRight((sal_uInt16)(rPageRect.Right() - rRect.Right() ));
+                            }
+
+                            aColItem.SetOrtho(aColItem.CalcOrtho());
+
+                            rSet.Put(aColItem, nWhich);
+                        }
+                        else
+                            rSet.DisableItem(nWhich);
+                    }
+                    else
+                    {	// Spalten auf der Seite
+                        const SwFrmFmt& rMaster = rDesc.GetMaster();
+                        SwFmtCol aCol(rMaster.GetCol());
+                        if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP)
+                            nNum = aCol.GetColumns().Count() - nNum;
+                        else
+                            nNum--;
+
+                        SvxColumnItem aColItem(nNum);
+                        const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt);
+                        const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX);
+                        long nDist = rBox.GetDistance();
+                        ::lcl_FillSvxColumn(aCol,
+                            sal_uInt16(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ),
+                            aColItem, nDist);
+
+                        if(bBrowse)
+                        {
+                            aColItem.SetLeft((sal_uInt16)rPagePrtRect.Left());
+                            aColItem.SetRight(sal_uInt16(nPageWidth - rPagePrtRect.Right()));
+                        }
+                        else
+                        {
+                            aColItem.SetLeft (aPageLRSpace.GetLeft());
+                            aColItem.SetRight(aPageLRSpace.GetRight());
+                        }
+                        aColItem.SetOrtho(aColItem.CalcOrtho());
+
+                        rSet.Put(aColItem, nWhich);
+                    }
+                }
+                else
+                    rSet.DisableItem(nWhich);
+                break;
+            }
+
+        case SID_RULER_ROWS :
+        case SID_RULER_ROWS_VERTICAL:
+            {
+                sal_Bool bFrameHasVerticalColumns(sal_False);
+                {
+                    sal_Bool bFrameRTL;
+                    sal_Bool bFrameVertL2R;
+                    bFrameHasVerticalColumns = rSh.IsFrmVertical(sal_False, bFrameRTL, bFrameVertL2R) &&
+                        bFrmSelection;
+                }
+
+                if( ( (SID_RULER_ROWS == nWhich) &&
+                    ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
+                    ((SID_RULER_ROWS_VERTICAL == nWhich) &&
+                    ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns)))
+                    rSet.DisableItem(nWhich);
+                else if ( IsTabRowFromDoc() ||
+                    ( rSh.GetTableFmt() && !bFrmSelection &&
+                    !(nFrmType & FRMTYPE_COLSECT ) ) )
+                {
+                    SwTabCols aTabCols;
+                    //no current value necessary
+                    sal_uInt16    nNum = 0;
+                    if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) )
+                    {
+                        rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
+                    }
+                    else
+                    {
+                        rSh.GetTabRows( aTabCols );
+                    }
+
+                    //                ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
+                    const int nLft = aTabCols.GetLeftMin();
+                    const int nRgt = (sal_uInt16)(bVerticalWriting ? nPageWidth : nPageHeight) -
+                        (aTabCols.GetLeftMin() +
+                        aTabCols.GetRight());
+
+                    const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
+                    const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
+
+                    SvxColumnItem aColItem(nNum, nL, nR);
+
+                    sal_uInt16 nStart = 0,
+                        nEnd;
+
+                    for ( sal_uInt16 i = 0; i < aTabCols.Count(); ++i )
+                    {
+                        const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
+                        if(bVerticalWriting)
+                        {
+                            nEnd  = sal_uInt16(aTabCols.GetRight() - rEntry.nPos);
+                            SvxColumnDescription aColDesc( nStart, nEnd,
+                                aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin,
+                                !aTabCols.IsHidden(i) );
+                            aColItem.Append(aColDesc);
+                        }
+                        else
+                        {
+                            nEnd  = sal_uInt16(rEntry.nPos - aTabCols.GetLeft());
+                            SvxColumnDescription aColDesc( nStart, nEnd,
+                                sal_uInt16(rEntry.nMin - aTabCols.GetLeft()), sal_uInt16(rEntry.nMax - aTabCols.GetLeft()),
+                                !aTabCols.IsHidden(i) );
+                            aColItem.Append(aColDesc);
+                        }
+                        nStart = nEnd;
+                    }
+                    if(bVerticalWriting)
+                        nEnd = static_cast< sal_uInt16 >(aTabCols.GetRight());
+                    else
+                        nEnd = static_cast< sal_uInt16 >(aTabCols.GetLeft());
+                    // put a position protection when the last row cannot be moved
+                    // due to a page break inside of a row
+                    if(!aTabCols.IsLastRowAllowedToChange())
+                        bPutContentProtection = sal_True;
+
+                    SvxColumnDescription aColDesc( nStart, nEnd,
+                        aTabCols.GetRight(), aTabCols.GetRight(),
+                        sal_False );
+                    aColItem.Append(aColDesc);
+
+                    rSet.Put(aColItem, nWhich);
+                }
+                else
+                    rSet.DisableItem(nWhich);
+            }
+            break;
+
+        case SID_RULER_PAGE_POS:
+            {
+                // PAGES01
+                SvxPagePosSizeItem aPagePosSize(
+                    Point( rPageRect.Left(), rPageRect.Top()) ,	nPageWidth, nPageHeight);
+
+                rSet.Put(aPagePosSize);
+                break;
+            }
+
+        case SID_RULER_LR_MIN_MAX:
+            {
+                Rectangle aRectangle;
+                if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() &&
+                    ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) )
+                {
+                    if( nFrmType & FRMTYPE_TABLE )
+                    {
+                        const sal_uInt16 nNum = rSh.GetCurTabColNum();
+                        SwTabCols aTabCols;
+                        rSh.GetTabCols( aTabCols );
+
+                        const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
+                        const int nRgt = (sal_uInt16)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
+
+                        const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
+                        const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
+
+                        aRectangle.Left() = nL;
+                        if(nNum > 1)
+                            aRectangle.Left() += aTabCols[nNum - 2];
+                        if(nNum)
+                            aRectangle.Left() += MINLAY;
+                        if(aTabCols.Count() <= nNum + 1 )
+                            aRectangle.Right() = nR;
+                        else
+                            aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]);
+
+                        if(nNum < aTabCols.Count())
+                            aRectangle.Right() += MINLAY;
+                    }
+                    else
+                    {
+                        const SwFrmFmt* pFmt =  rSh.GetFlyFrmFmt();
+                        const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
+                            &rDesc.GetMaster().GetCol();
+                        const SwColumns& rCols = pCols->GetColumns();
+                        sal_uInt16 nNum = rSh.GetCurOutColNum();
+                        sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count());
+                        const SwRect aRect( rSh.GetAnyCurRect( pFmt
+                            ? RECT_FLY_PRT_EMBEDDED
+                            : RECT_PAGE_PRT, pPt ));
+                        const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt
+                            ? RECT_FLY_EMBEDDED
+                            : RECT_PAGE, pPt ));
+
+                        //die Breite im Rahmen bzw. innerhalbe der Seitenraender
+                        const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
+                        //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand
+                        const sal_uInt16 nOuterWidth = (sal_uInt16)aAbsRect.Width();
+                        int nWidth = 0,
+                            nStart = 0,
+                            nEnd = 0;
+                        aRectangle.Left() = 0;
+                        for ( sal_uInt16 i = 0; i < nCount; ++i )
+                        {
+                            SwColumn* pCol = rCols[i];
+                            nStart = pCol->GetLeft() + nWidth;
+                            if(i == nNum - 2)
+                                aRectangle.Left() = nStart;
+                            nWidth += pCols->CalcColWidth( i, nTotalWidth );
+                            nEnd = nWidth - pCol->GetRight();
+                        }
+                        aRectangle.Right() = rPageRect.Right() - nEnd;
+                        aRectangle.Left() -= rPageRect.Left();
+
+                        if(nNum > 1)
+                        {
+                            aRectangle.Left() += MINLAY;
+                            aRectangle.Left() += aRect.Left();
+                        }
+                        if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand
+                            aRectangle.Left()  = aRectangle.Right() = 0;
+                        else
+                        {
+                            // das Rechteck an die richtige absolute Position verschieben
+                            aRectangle.Left() += aAbsRect.Left();
+                            aRectangle.Right() -= aAbsRect.Left();
+                            // Abstand zur Umrandung mit einbeziehen
+                            aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2;
+                        }
+
+                        if(nNum < rCols.Count())
+                        {
+                            aRectangle.Right() += MINLAY;
+                        }
+                        else
+                            // rechts ist jetzt nur noch der Seitenrand
+                            aRectangle.Right() = 0;
 
 
-				}
-			}
-			else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) &&
-				 !bFrmSelection )
-			{
-				sal_Bool bColumn;
-				if ( IsTabColFromDoc() )
-					bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0;
-				else
-					bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|
-											FRMTYPE_COLSECTOUTTAB)) ?
-											sal_True : sal_False;
-				if ( !bColumn )
-				{
-					if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() )
-					{
-						SwRect aRect( rSh.GetAnyCurRect(
-											RECT_FLY_PRT_EMBEDDED, pPt ) );
-						aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
-																pPt ).Pos();
+                    }
+                }
+                else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) &&
+                    !bFrmSelection )
+                {
+                    sal_Bool bColumn;
+                    if ( IsTabColFromDoc() )
+                        bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0;
+                    else
+                        bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) 
+                                  ? sal_True 
+                                  : sal_False;
+                    if ( !bColumn )
+                    {
+                        if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() )
+                        {
+                            SwRect aRect( rSh.GetAnyCurRect(
+                                RECT_FLY_PRT_EMBEDDED, pPt ) );
+                            aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
+                                pPt ).Pos();
 
-						aRectangle.Left()  = aRect.Left() - rPageRect.Left();
-						aRectangle.Right() = rPageRect.Right() - aRect.Right();
-					}
-					else if( bBrowse )
-					{
-						aRectangle.Left()  = rPagePrtRect.Left();
-						aRectangle.Right() = nPageWidth - rPagePrtRect.Right();
-					}
-					else
-					{
-						aRectangle.Left()  = aPageLRSpace.GetLeft();
-						aRectangle.Right() = aPageLRSpace.GetRight();
-					}
-				}
-				else
-				{	//hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen
-					sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False;
-					sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False;
-					sal_Bool bColSct = 	(nFrmType & ( bSectOutTbl
-													? FRMTYPE_COLSECTOUTTAB
-													: FRMTYPE_COLSECT )
-												) ? sal_True : sal_False;
-					//Damit man auch mit der Mouse ziehen kann,
-					//ohne in der Tabelle zu stehen
-					CurRectType eRecType = RECT_PAGE_PRT;
-                    sal_uInt16 nNum = IsTabColFromDoc() ?
-								rSh.GetCurMouseColNum( aTabColFromDocPos ):
-								rSh.GetCurOutColNum();
-					const SwFrmFmt* pFmt = NULL;
-					if( bColSct )
-					{
-						eRecType = bSectOutTbl ? RECT_OUTTABSECTION
-											   : RECT_SECTION;
-						const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt );
-						ASSERT( pSect, "Welcher Bereich?");
-						pFmt = pSect->GetFmt();
-					}
-					else if( bFrame )
-					{
-						pFmt = rSh.GetFlyFrmFmt();
-						eRecType = RECT_FLY_PRT_EMBEDDED;
-					}
+                            aRectangle.Left()  = aRect.Left() - rPageRect.Left();
+                            aRectangle.Right() = rPageRect.Right() - aRect.Right();
+                        }
+                        else if( bBrowse )
+                        {
+                            aRectangle.Left()  = rPagePrtRect.Left();
+                            aRectangle.Right() = nPageWidth - rPagePrtRect.Right();
+                        }
+                        else
+                        {
+                            aRectangle.Left()  = aPageLRSpace.GetLeft();
+                            aRectangle.Right() = aPageLRSpace.GetRight();
+                        }
+                    }
+                    else
+                    {	//hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen
+                        sal_Bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? sal_True : sal_False;
+                        sal_Bool bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? sal_True : sal_False;
+                        sal_Bool bColSct = 	(nFrmType & ( bSectOutTbl
+                            ? FRMTYPE_COLSECTOUTTAB
+                            : FRMTYPE_COLSECT )
+                            ) ? sal_True : sal_False;
+                        //Damit man auch mit der Mouse ziehen kann,
+                        //ohne in der Tabelle zu stehen
+                        CurRectType eRecType = RECT_PAGE_PRT;
+                        sal_uInt16 nNum = IsTabColFromDoc() ?
+                            rSh.GetCurMouseColNum( aTabColFromDocPos ):
+                            rSh.GetCurOutColNum();
+                        const SwFrmFmt* pFmt = NULL;
+                        if( bColSct )
+                        {
+                            eRecType = bSectOutTbl ? RECT_OUTTABSECTION
+                                : RECT_SECTION;
+                            const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt );
+                            ASSERT( pSect, "Welcher Bereich?");
+                            pFmt = pSect->GetFmt();
+                        }
+                        else if( bFrame )
+                        {
+                            pFmt = rSh.GetFlyFrmFmt();
+                            eRecType = RECT_FLY_PRT_EMBEDDED;
+                        }
 
-					const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
-												   &rDesc.GetMaster().GetCol();
-					const SwColumns& rCols = pCols->GetColumns();
-					const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() :
-												  rDesc.GetMaster().GetBox().GetDistance();
+                        const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
+                            &rDesc.GetMaster().GetCol();
+                        const SwColumns& rCols = pCols->GetColumns();
+                        const sal_uInt16 nBorder = pFmt ? pFmt->GetBox().GetDistance() :
+                            rDesc.GetMaster().GetBox().GetDistance();
 
-					/* RECT_FLY_PRT_EMBEDDED returns the relative position to
-						RECT_FLY_EMBEDDED
-						the absolute position must be added here
-					*/
-					SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
-					if(RECT_FLY_PRT_EMBEDDED == eRecType)
-						aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
-																pPt ).Pos();
+                        /* RECT_FLY_PRT_EMBEDDED returns the relative position to
+                        RECT_FLY_EMBEDDED
+                        the absolute position must be added here
+                        */
+                        SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
+                        if(RECT_FLY_PRT_EMBEDDED == eRecType)
+                            aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
+                            pPt ).Pos();
 
-					const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
-					//nStart und nEnd initialisieren fuer nNum == 0
-					int nWidth = 0,
-						nStart = 0,
-						nEnd = nTotalWidth;
+                        const sal_uInt16 nTotalWidth = (sal_uInt16)aRect.Width();
+                        //nStart und nEnd initialisieren fuer nNum == 0
+                        int nWidth = 0,
+                            nStart = 0,
+                            nEnd = nTotalWidth;
 
-					if( nNum > rCols.Count() )
-					{
-						ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" );
-						nNum = rCols.Count();
-					}
+                        if( nNum > rCols.Count() )
+                        {
+                            ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" );
+                            nNum = rCols.Count();
+                        }
 
-                    for( sal_uInt16 i = 0; i < nNum; ++i )
-					{
-						SwColumn* pCol = rCols[i];
-						nStart = pCol->GetLeft() + nWidth;
-						nWidth += pCols->CalcColWidth( i, nTotalWidth );
-						nEnd = nWidth - pCol->GetRight();
-					}
-					if( bFrame | bColSct )
-					{
-						aRectangle.Left()  = aRect.Left() - rPageRect.Left() + nStart;
-						aRectangle.Right() = nPageWidth	- aRectangle.Left() - nEnd + nStart;
-					}
-					else if(!bBrowse)
-					{
-						aRectangle.Left()  = aPageLRSpace.GetLeft() + nStart;
-						aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft();
-					}
-					else
-					{
-						long nLeft = rPagePrtRect.Left();
-						aRectangle.Left()  = nStart + nLeft;
-						aRectangle.Right() = nPageWidth - nEnd - nLeft;
-					}
-					if(!bFrame)
-					{
-						aRectangle.Left() += nBorder;
-						aRectangle.Right() -= nBorder;
-					}
-				}
-			}
-			else if ( nFrmType & ( FRMTYPE_HEADER  | FRMTYPE_FOOTER ))
-			{
-				aRectangle.Left()  = aPageLRSpace.GetLeft();
-				aRectangle.Right() = aPageLRSpace.GetRight();
-			}
-			else
-				aRectangle.Left()  = aRectangle.Right() = 0;
+                        for( sal_uInt16 i = 0; i < nNum; ++i )
+                        {
+                            SwColumn* pCol = rCols[i];
+                            nStart = pCol->GetLeft() + nWidth;
+                            nWidth += pCols->CalcColWidth( i, nTotalWidth );
+                            nEnd = nWidth - pCol->GetRight();
+                        }
+                        if( bFrame | bColSct )
+                        {
+                            aRectangle.Left()  = aRect.Left() - rPageRect.Left() + nStart;
+                            aRectangle.Right() = nPageWidth	- aRectangle.Left() - nEnd + nStart;
+                        }
+                        else if(!bBrowse)
+                        {
+                            aRectangle.Left()  = aPageLRSpace.GetLeft() + nStart;
+                            aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft();
+                        }
+                        else
+                        {
+                            long nLeft = rPagePrtRect.Left();
+                            aRectangle.Left()  = nStart + nLeft;
+                            aRectangle.Right() = nPageWidth - nEnd - nLeft;
+                        }
+                        if(!bFrame)
+                        {
+                            aRectangle.Left() += nBorder;
+                            aRectangle.Right() -= nBorder;
+                        }
+                    }
+                }
+                else if ( nFrmType & ( FRMTYPE_HEADER  | FRMTYPE_FOOTER ))
+                {
+                    aRectangle.Left()  = aPageLRSpace.GetLeft();
+                    aRectangle.Right() = aPageLRSpace.GetRight();
+                }
+                else
+                    aRectangle.Left()  = aRectangle.Right() = 0;
 
-			SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
-			rSet.Put(aLR);
-		}
-		break;
-		case SID_RULER_PROTECT:
-		{
-			if(bFrmSelection)
-			{
-				sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT );
+                SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
+                rSet.Put(aLR);
+            }
+            break;
 
-				SvxProtectItem aProt(SID_RULER_PROTECT);
-				aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT)	!= 0);
-				aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE)		!= 0);
-				aProt.SetPosProtect  ((nProtect & FLYPROTECT_POS)		!= 0);
-				rSet.Put(aProt);
-			}
-			else
-			{
-				SvxProtectItem aProtect(SID_RULER_PROTECT);
-				if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt())
-				{
-					aProtect.SetSizeProtect(sal_True);
-					aProtect.SetPosProtect(sal_True);
-				}
-				rSet.Put(aProtect);
-			}
-		}
-		break;
-		}
-		nWhich = aIter.NextWhich();
-	}
+        case SID_RULER_PROTECT:
+            {
+                if(bFrmSelection)
+                {
+                    sal_uInt8 nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT );
+
+                    SvxProtectItem aProt(SID_RULER_PROTECT);
+                    aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT)	!= 0);
+                    aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE)		!= 0);
+                    aProt.SetPosProtect  ((nProtect & FLYPROTECT_POS)		!= 0);
+                    rSet.Put(aProt);
+                }
+                else
+                {
+                    SvxProtectItem aProtect(SID_RULER_PROTECT);
+                    if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt())
+                    {
+                        aProtect.SetSizeProtect(sal_True);
+                        aProtect.SetPosProtect(sal_True);
+                    }
+                    rSet.Put(aProtect);
+                }
+            }
+            break;
+        }
+        nWhich = aIter.NextWhich();
+    }
     if(bPutContentProtection)
     {
         SvxProtectItem aProtect(SID_RULER_PROTECT);
diff --git a/main/sw/source/ui/uno/unofreg.cxx b/main/sw/source/ui/uno/unofreg.cxx
index a21e67c..3b682ce 100644
--- a/main/sw/source/ui/uno/unofreg.cxx
+++ b/main/sw/source/ui/uno/unofreg.cxx
@@ -124,7 +124,6 @@
 extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
 extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
 
-// --> OD 2007-05-24 #i73788#
 #include "cppuhelper/implementationentry.hxx"
 namespace comp_FinalThreadManager {
 
@@ -135,7 +134,8 @@
     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context );
 
 }
-// <--
+
+#include "SwPanelFactory.hxx"
 
 //
 #ifdef __cplusplus
@@ -144,10 +144,10 @@
 #endif
 
 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
-		const sal_Char ** ppEnvTypeName,
+        const sal_Char ** ppEnvTypeName,
         uno_Environment ** /*ppEnv*/ )
 {
-	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
 }
 
 static ::cppu::ImplementationEntry const entries[] = {
@@ -159,155 +159,155 @@
 };
 
 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
-	const sal_Char * pImplName,
-	void * pServiceManager,
+    const sal_Char * pImplName,
+    void * pServiceManager,
     void * pRegistryKey )
 {
-	void * pRet = 0;
-	if( pServiceManager )
-	{
-		uno::Reference< XMultiServiceFactory > xMSF(
-			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+    void * pRet = 0;
+    if( pServiceManager )
+    {
+        uno::Reference< XMultiServiceFactory > xMSF(
+            reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
 
-		uno::Reference< XSingleServiceFactory > xFactory;
+        uno::Reference< XSingleServiceFactory > xFactory;
 
-		const sal_Int32 nImplNameLen = strlen( pImplName );
-		if( SwXMLImport_getImplementationName().equalsAsciiL( pImplName,
-															  nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLImport_getImplementationName(),
-				SwXMLImport_createInstance,
-				SwXMLImport_getSupportedServiceNames() );
-		}
-		else if( SwXMLImportStyles_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLImportStyles_getImplementationName(),
-				SwXMLImportStyles_createInstance,
-				SwXMLImportStyles_getSupportedServiceNames() );
-		}
-		else if( SwXMLImportContent_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLImportContent_getImplementationName(),
-				SwXMLImportContent_createInstance,
-				SwXMLImportContent_getSupportedServiceNames() );
-		}
-		else if( SwXMLImportMeta_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLImportMeta_getImplementationName(),
-				SwXMLImportMeta_createInstance,
-				SwXMLImportMeta_getSupportedServiceNames() );
-		}
-		else if( SwXMLImportSettings_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLImportSettings_getImplementationName(),
-				SwXMLImportSettings_createInstance,
-				SwXMLImportSettings_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportOOO_getImplementationName().equalsAsciiL( pImplName,
-															nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportOOO_getImplementationName(),
-				SwXMLExportOOO_createInstance,
-				SwXMLExportOOO_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportStylesOOO_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportStylesOOO_getImplementationName(),
-				SwXMLExportStylesOOO_createInstance,
-				SwXMLExportStylesOOO_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportContentOOO_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportContentOOO_getImplementationName(),
-				SwXMLExportContentOOO_createInstance,
-				SwXMLExportContentOOO_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportMetaOOO_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportMetaOOO_getImplementationName(),
-				SwXMLExportMetaOOO_createInstance,
-				SwXMLExportMetaOOO_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportSettingsOOO_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportSettingsOOO_getImplementationName(),
-				SwXMLExportSettingsOOO_createInstance,
-				SwXMLExportSettingsOOO_getSupportedServiceNames() );
-		}
-		else if( SwXMLExport_getImplementationName().equalsAsciiL( pImplName,
-															nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExport_getImplementationName(),
-				SwXMLExport_createInstance,
-				SwXMLExport_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportStyles_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportStyles_getImplementationName(),
-				SwXMLExportStyles_createInstance,
-				SwXMLExportStyles_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportContent_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportContent_getImplementationName(),
-				SwXMLExportContent_createInstance,
-				SwXMLExportContent_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportMeta_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportMeta_getImplementationName(),
-				SwXMLExportMeta_createInstance,
-				SwXMLExportMeta_getSupportedServiceNames() );
-		}
-		else if( SwXMLExportSettings_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
-				SwXMLExportSettings_getImplementationName(),
-				SwXMLExportSettings_createInstance,
-				SwXMLExportSettings_getSupportedServiceNames() );
-		}
+        const sal_Int32 nImplNameLen = strlen( pImplName );
+        if( SwXMLImport_getImplementationName().equalsAsciiL( pImplName,
+                                                              nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLImport_getImplementationName(),
+                SwXMLImport_createInstance,
+                SwXMLImport_getSupportedServiceNames() );
+        }
+        else if( SwXMLImportStyles_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLImportStyles_getImplementationName(),
+                SwXMLImportStyles_createInstance,
+                SwXMLImportStyles_getSupportedServiceNames() );
+        }
+        else if( SwXMLImportContent_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLImportContent_getImplementationName(),
+                SwXMLImportContent_createInstance,
+                SwXMLImportContent_getSupportedServiceNames() );
+        }
+        else if( SwXMLImportMeta_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLImportMeta_getImplementationName(),
+                SwXMLImportMeta_createInstance,
+                SwXMLImportMeta_getSupportedServiceNames() );
+        }
+        else if( SwXMLImportSettings_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLImportSettings_getImplementationName(),
+                SwXMLImportSettings_createInstance,
+                SwXMLImportSettings_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportOOO_getImplementationName().equalsAsciiL( pImplName,
+                                                            nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportOOO_getImplementationName(),
+                SwXMLExportOOO_createInstance,
+                SwXMLExportOOO_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportStylesOOO_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportStylesOOO_getImplementationName(),
+                SwXMLExportStylesOOO_createInstance,
+                SwXMLExportStylesOOO_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportContentOOO_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportContentOOO_getImplementationName(),
+                SwXMLExportContentOOO_createInstance,
+                SwXMLExportContentOOO_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportMetaOOO_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportMetaOOO_getImplementationName(),
+                SwXMLExportMetaOOO_createInstance,
+                SwXMLExportMetaOOO_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportSettingsOOO_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportSettingsOOO_getImplementationName(),
+                SwXMLExportSettingsOOO_createInstance,
+                SwXMLExportSettingsOOO_getSupportedServiceNames() );
+        }
+        else if( SwXMLExport_getImplementationName().equalsAsciiL( pImplName,
+                                                            nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExport_getImplementationName(),
+                SwXMLExport_createInstance,
+                SwXMLExport_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportStyles_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportStyles_getImplementationName(),
+                SwXMLExportStyles_createInstance,
+                SwXMLExportStyles_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportContent_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportContent_getImplementationName(),
+                SwXMLExportContent_createInstance,
+                SwXMLExportContent_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportMeta_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportMeta_getImplementationName(),
+                SwXMLExportMeta_createInstance,
+                SwXMLExportMeta_getSupportedServiceNames() );
+        }
+        else if( SwXMLExportSettings_getImplementationName().equalsAsciiL(
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                SwXMLExportSettings_getImplementationName(),
+                SwXMLExportSettings_createInstance,
+                SwXMLExportSettings_getSupportedServiceNames() );
+        }
         else if( SwXAutoTextContainer_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwXAutoTextContainer_getImplementationName(),
                 SwXAutoTextContainer_createInstance,
                 SwXAutoTextContainer_getSupportedServiceNames() );
-		}
+        }
         else if( SwXModule_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwXModule_getImplementationName(),
                 SwXModule_createInstance,
                 SwXModule_getSupportedServiceNames() );
-		}
+        }
         else if( SwXMailMerge_getImplementationName().equalsAsciiL(
                                                     pImplName, nImplNameLen ) )
         {
@@ -317,61 +317,66 @@
                 SwXMailMerge_getSupportedServiceNames() );
         }
         else if( SwXFilterOptions::getImplementationName_Static().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwXFilterOptions::getImplementationName_Static(),
                 SwXFilterOptions_createInstance,
                 SwXFilterOptions::getSupportedServiceNames_Static() );
-		}
+        }
         else if( SwTextDocument_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::sfx2::createSfxModelFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::sfx2::createSfxModelFactory( xMSF,
                 SwTextDocument_getImplementationName(),
                 SwTextDocument_createInstance,
                 SwTextDocument_getSupportedServiceNames() );
-		}
+        }
         else if( SwWebDocument_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwWebDocument_getImplementationName(),
                 SwWebDocument_createInstance,
                 SwWebDocument_getSupportedServiceNames() );
-		}
+        }
         else if( SwGlobalDocument_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwGlobalDocument_getImplementationName(),
                 SwGlobalDocument_createInstance,
                 SwGlobalDocument_getSupportedServiceNames() );
-		}
+        }
         else if( SwUnoModule_getImplementationName().equalsAsciiL(
-													pImplName, nImplNameLen ) )
-		{
-			xFactory = ::cppu::createSingleFactory( xMSF,
+                                                    pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
                 SwUnoModule_getImplementationName(),
                 SwUnoModule_createInstance,
                 SwUnoModule_getSupportedServiceNames() );
-		}
-        // --> OD 2007-05-24 #i73788#
+        }
+        else if ( ::sw::sidebar::SwPanelFactory::getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+        {
+            xFactory = ::cppu::createSingleFactory( xMSF,
+                ::sw::sidebar::SwPanelFactory::getImplementationName(),
+                ::sw::sidebar::SwPanelFactory::createInstance,
+                ::sw::sidebar::SwPanelFactory::getSupportedServiceNames() );
+        }
         else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL(
                                                     pImplName, nImplNameLen ) )
         {
             pRet = ::cppu::component_getFactoryHelper(
                         pImplName, pServiceManager, pRegistryKey, entries);
         }
-        // <--
 
         if( xFactory.is())
-		{
-			xFactory->acquire();
-			pRet = xFactory.get();
-		}
-	}
-	return pRet;
+        {
+            xFactory->acquire();
+            pRet = xFactory.get();
+        }
+    }
+    return pRet;
 }
 
 #ifdef __cplusplus
diff --git a/main/sw/source/ui/utlui/navipi.cxx b/main/sw/source/ui/utlui/navipi.cxx
index 0ea121d..d214150 100644
--- a/main/sw/source/ui/utlui/navipi.cxx
+++ b/main/sw/source/ui/utlui/navipi.cxx
@@ -283,18 +283,18 @@
 		break;
 		case FN_SHOW_CONTENT_BOX:
 		case FN_SELECT_CONTENT:
-		if(pContextWin->GetFloatingWindow())
-		{
-			if(_IsZoomedIn() )
-			{
-				_ZoomOut();
-			}
-			else
-			{
-				_ZoomIn();
-			}
-		}
-		return sal_True;
+            if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL)
+            {
+                if(_IsZoomedIn() )
+                {
+                    _ZoomOut();
+                }
+                else
+                {
+                    _ZoomIn();
+                }
+            }
+            return sal_True;
 		//break;
 		// Funktionen, die eine direkte Aktion ausloesen
 
@@ -624,7 +624,7 @@
 
 void SwNavigationPI::GotoPage()
 {
-	if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
+	if (pContextWin && pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
 		_ZoomIn();
 	if(IsGlobalMode())
 		ToggleTree();
@@ -640,14 +640,15 @@
 {
 	if (_IsZoomedIn())
 	{
-		FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+		FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
 		bIsZoomedIn = sal_False;
 		Size aSz(GetOutputSizePixel());
 		aSz.Height() = nZoomOut;
 		Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
 		((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
 							aMinOutSizePixel.Width(),nZoomOutInit));
-		pFloat->SetOutputSizePixel(aSz);
+        if (pFloat != NULL)
+            pFloat->SetOutputSizePixel(aSz);
 		FillBox();
 		if(IsGlobalMode())
 		{
@@ -672,29 +673,32 @@
 
 void SwNavigationPI::_ZoomIn()
 {
-	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
-	if (pFloat &&
-		(!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
-	{
-		aContentTree.HideTree();
-		aDocListBox.Hide();
-		aGlobalTree.HideTree();
-		bIsZoomedIn = sal_True;
-		Size aSz(GetOutputSizePixel());
-		if( aSz.Height() > nZoomIn )
-			nZoomOut = ( short ) aSz.Height();
+    if (pContextWin != NULL)
+    {
+        FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+        if (pFloat &&
+            (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
+        {
+            aContentTree.HideTree();
+            aDocListBox.Hide();
+            aGlobalTree.HideTree();
+            bIsZoomedIn = sal_True;
+            Size aSz(GetOutputSizePixel());
+            if( aSz.Height() > nZoomIn )
+                nZoomOut = ( short ) aSz.Height();
 
-		aSz.Height() = nZoomIn;
-		Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
-		((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
-							aMinOutSizePixel.Width(), aSz.Height()));
-		pFloat->SetOutputSizePixel(aSz);
-		SvLBoxEntry* pFirst = aContentTree.FirstSelected();
-		if(pFirst)
-			aContentTree.Select(pFirst, sal_True); // toolbox enablen
-		pConfig->SetSmall( sal_True );
-		aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
-	}
+            aSz.Height() = nZoomIn;
+            Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
+            ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+                    aMinOutSizePixel.Width(), aSz.Height()));
+            pFloat->SetOutputSizePixel(aSz);
+            SvLBoxEntry* pFirst = aContentTree.FirstSelected();
+            if(pFirst)
+                aContentTree.Select(pFirst, sal_True); // toolbox enablen
+            pConfig->SetSmall( sal_True );
+            aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
+        }
+    }
 }
 /*------------------------------------------------------------------------
  Beschreibung:
@@ -703,48 +707,51 @@
 void SwNavigationPI::Resize()
 {
 	Window* pParent = GetParent();
-	FloatingWindow* pFloat =  ((DockingWindow*)pParent)->GetFloatingWindow();
-	Size aNewSize;
-	if( !_IsZoomedIn() )
-	{
-        //change the minimum width depending on the dock status
-        Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel();
-        if( pFloat)
-		{
-			aNewSize = pFloat->GetOutputSizePixel();
-            aMinOutSizePixel.Width() = nWishWidth;
-            aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
-        }
-		else
-		{
-			aNewSize = pParent->GetOutputSizePixel();
-            aMinOutSizePixel.Width() = 0;
-            aMinOutSizePixel.Height() = 0;
-        }
-        ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel);
+    if( !_IsZoomedIn() )
+    {
+        Size aNewSize (pParent->GetOutputSizePixel());
 
+        SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
+        if (pDockingParent != NULL)
+        {
+            FloatingWindow* pFloat =  pDockingParent->GetFloatingWindow();
+            //change the minimum width depending on the dock status
+            Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel();
+            if( pFloat)
+            {
+                aNewSize = pFloat->GetOutputSizePixel();
+                aMinOutSizePixel.Width() = nWishWidth;
+                aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
+            }
+            else
+            {
+                aMinOutSizePixel.Width() = 0;
+                aMinOutSizePixel.Height() = 0;
+            }
+            pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel);
+        }
+        
         const Point aPos = aContentTree.GetPosPixel();
-		Point aLBPos = aDocListBox.GetPosPixel();
-		long nDist = aPos.X();
-		aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
-		aNewSize.Width() -= 2 * nDist;
-		aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
-		aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
+        Point aLBPos = aDocListBox.GetPosPixel();
+        long nDist = aPos.X();
+        aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
+        aNewSize.Width() -= 2 * nDist;
+        aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
+        aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
 
-		Size aDocLBSz = aDocListBox.GetSizePixel();
-		aDocLBSz.Width() = aNewSize.Width();
-		if(aNewSize.Height() < 0)
-			aDocLBSz.Height() = 0;
-		else
-			aDocLBSz.Height() = nDocLBIniHeight;
-		aContentTree.SetSizePixel(aNewSize);
-		// GlobalTree faengt weiter oben an und reicht bis ganz unten
-		aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
-		aGlobalTree.SetSizePixel(aNewSize);
-		aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
-									 aDocLBSz.Width(), aDocLBSz.Height(),
-									  WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
-
+        Size aDocLBSz = aDocListBox.GetSizePixel();
+        aDocLBSz.Width() = aNewSize.Width();
+        if(aNewSize.Height() < 0)
+            aDocLBSz.Height() = 0;
+        else
+            aDocLBSz.Height() = nDocLBIniHeight;
+        aContentTree.SetSizePixel(aNewSize);
+        // GlobalTree faengt weiter oben an und reicht bis ganz unten
+        aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
+        aGlobalTree.SetSizePixel(aNewSize);
+        aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
+            aDocLBSz.Width(), aDocLBSz.Height(),
+            WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
 	}
 }
 
@@ -851,21 +858,29 @@
 	nWishWidth = aContentToolboxSize.Width();
 	nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
 
-    FloatingWindow* pFloat =  ((DockingWindow*)pParent)->GetFloatingWindow();
-    Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
-	((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize);
-	SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
-	Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel());
-	if(
-        (
-           aTmpParentSize.Width() < aMinSize.Width() ||
-           aTmpParentSize.Height() < aMinSize.Height() 
-        )
-        &&
-        ((SfxDockingWindow*)pParent)->GetFloatingWindow() &&
-        !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp()
-      )
-	    ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize);
+    DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent);
+    if (pDockingParent != NULL)
+    {
+        FloatingWindow* pFloat =  pDockingParent->GetFloatingWindow();
+        Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
+        pDockingParent->SetMinOutputSizePixel(aMinSize);
+        SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
+
+        SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
+        if (pSfxDockingParent != NULL)
+        {
+            Size aTmpParentSize(pSfxDockingParent->GetSizePixel());
+            if (aTmpParentSize.Width() < aMinSize.Width()
+                || aTmpParentSize.Height() < aMinSize.Height())
+            {
+                if (pSfxDockingParent->GetFloatingWindow()
+                    && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp())
+                {
+                    pSfxDockingParent->SetOutputSizePixel(aMinSize);
+                }
+            }
+        }
+    }
 
     aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
 	aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
@@ -937,6 +952,15 @@
 	aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
 	aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
 	aDocListBox.SetAccessibleName(aStatusArr[3]);
+
+    if (pContextWin == NULL)
+    {
+        // When the context window is missing then the navigator is
+        // displayed in the sidebar.  While the navigator could change
+        // its size, the sidebar can not, and the navigator would just
+        // waste space.  Therefore hide this button.
+        aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX));
+    }
 }
 
 /*------------------------------------------------------------------------
diff --git a/main/sw/source/ui/wrtsh/wrtsh3.cxx b/main/sw/source/ui/wrtsh/wrtsh3.cxx
index 39deb7d..47497eb 100644
--- a/main/sw/source/ui/wrtsh/wrtsh3.cxx
+++ b/main/sw/source/ui/wrtsh/wrtsh3.cxx
@@ -128,7 +128,12 @@
     static sal_uInt16 __READONLY_DATA aInval[] =
     {
         SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE,
-        SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0
+        SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR,
+        /*AF: these may be needed for the sidebar.
+        SID_SVX_AREA_TRANSPARENCY, SID_SVX_AREA_TRANSP_GRADIENT,
+        SID_SVX_AREA_TRANS_TYPE,
+        */
+        0
     };
 
     GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
diff --git a/main/sw/uiconfig/swriter/menubar/menubar.xml b/main/sw/uiconfig/swriter/menubar/menubar.xml
index fb6e724..3e18064 100644
--- a/main/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/main/sw/uiconfig/swriter/menubar/menubar.xml
@@ -144,6 +144,7 @@
       <menu:menuitem menu:id=".uno:ViewDataSourceBrowser"/>
       <menu:menuitem menu:id=".uno:Navigator"/>
       <menu:menuitem menu:id=".uno:TaskPane"/>
+      <menu:menuitem menu:id=".uno:Sidebar"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:FullScreen"/>
       <menu:menuitem menu:id=".uno:Zoom"/>
diff --git a/main/sw/util/sw.component b/main/sw/util/sw.component
index 8786f6c..0bb6c56 100644
--- a/main/sw/util/sw.component
+++ b/main/sw/util/sw.component
@@ -97,4 +97,7 @@
   <implementation name="com.sun.star.util.comp.FinalThreadManager">
     <service name="com.sun.star.util.JobManager"/>
   </implementation>
+  <implementation name="org.apache.openoffice.comp.sw.sidebar.SwPanelFactory">
+    <service name="com.sun.star.ui.UIElementFactory"/>
+  </implementation>
 </component>
diff --git a/main/vcl/inc/vcl/button.hxx b/main/vcl/inc/vcl/button.hxx
index 159ee7f..55712c4 100644
--- a/main/vcl/inc/vcl/button.hxx
+++ b/main/vcl/inc/vcl/button.hxx
@@ -437,13 +437,11 @@
     using Window::ImplInit;
     SAL_DLLPRIVATE void         ImplInit( Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void         ImplLoadRes( const ResId& rResId );
-    SAL_DLLPRIVATE virtual void FillLayoutData() const;
-    SAL_DLLPRIVATE virtual const Font&
-                                GetCanonicalFont( const StyleSettings& _rStyle ) const;
-    SAL_DLLPRIVATE virtual const Color&
-                                GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
+    virtual void FillLayoutData() const;
+    virtual const Font&         GetCanonicalFont( const StyleSettings& _rStyle ) const;
+    virtual const Color&        GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
 
-    SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
+    virtual void ImplDrawCheckBoxState();
     SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
 	SAL_DLLPRIVATE const Rectangle&	GetMouseRect() const { return maMouseRect; }
 public:
diff --git a/main/vcl/inc/vcl/split.hxx b/main/vcl/inc/vcl/split.hxx
index 65a6255..3be7b28 100644
--- a/main/vcl/inc/vcl/split.hxx
+++ b/main/vcl/inc/vcl/split.hxx
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef _SV_SPLIT_HXX
 #define _SV_SPLIT_HXX
 
@@ -60,6 +58,7 @@
     SAL_DLLPRIVATE sal_Bool      ImplSplitterActive();
     SAL_DLLPRIVATE Splitter* ImplFindSibling();
     SAL_DLLPRIVATE void      ImplRestoreSplitter();
+    SAL_DLLPRIVATE void      ImplInitHorVer(bool bNew);
 
     // Copy assignment is forbidden and not implemented.
 	SAL_DLLPRIVATE           Splitter (const Splitter &);
@@ -104,7 +103,8 @@
     void                SetLastSplitPosPixel( long nNewPos );
     long                GetLastSplitPosPixel() const { return mnLastSplitPos; }
 
-    sal_Bool                IsHorizontal() const { return mbHorzSplit; }
+    sal_Bool            IsHorizontal() const { return mbHorzSplit; }
+    void                SetHorizontal(bool bNew);
 
     // set the stepsize of the splitter for cursor movement
     // the default is 10% of the reference window's width/height
diff --git a/main/vcl/inc/vcl/window.hxx b/main/vcl/inc/vcl/window.hxx
index 9b39f5d..9d7002c 100644
--- a/main/vcl/inc/vcl/window.hxx
+++ b/main/vcl/inc/vcl/window.hxx
@@ -1176,7 +1176,15 @@
     /*
     */
     virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
-    
+
+
+    void EnableThemeSupport (void);
+    void DisableThemeSupport (void);
+
+    virtual ImplBorderWindow* CreateBorderWindow (
+        Window* pParent,
+        const WinBits nStyle,
+        const sal_uInt16 nTypeStyle);
 };
 
 
diff --git a/main/vcl/inc/window.h b/main/vcl/inc/window.h
index 42acceb..0209ce2 100644
--- a/main/vcl/inc/window.h
+++ b/main/vcl/inc/window.h
@@ -382,7 +382,8 @@
                         mbDisableAccessibleLabeledByRelation:1,
                         mbHelpTextDynamic:1,
                         mbFakeFocusSet:1,
-                        mbInterceptChildWindowKeyDown:1;
+                        mbInterceptChildWindowKeyDown:1,
+                        mbIsThemingEnabled;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
 };
diff --git a/main/vcl/source/window/split.cxx b/main/vcl/source/window/split.cxx
index 17e9468..b82d0b8 100644
--- a/main/vcl/source/window/split.cxx
+++ b/main/vcl/source/window/split.cxx
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
@@ -72,32 +70,39 @@
 
 // -----------------------------------------------------------------------
 
+void Splitter::ImplInitHorVer(bool bNew)
+{
+    if(bNew != (bool)mbHorzSplit)
+    {
+        mbHorzSplit = bNew;
+
+	    PointerStyle ePointerStyle;
+    	const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+
+	    if ( mbHorzSplit )
+	    {
+		    ePointerStyle = POINTER_HSPLIT;
+		    SetSizePixel( Size( rSettings.GetSplitSize(), rSettings.GetScrollBarSize() ) );
+	    }
+	    else
+	    {
+		    ePointerStyle = POINTER_VSPLIT;
+		    SetSizePixel( Size( rSettings.GetScrollBarSize(), rSettings.GetSplitSize() ) );
+	    }
+
+	    SetPointer( Pointer( ePointerStyle ) );
+    }
+}
+
+// -----------------------------------------------------------------------
+
 void Splitter::ImplInit( Window* pParent, WinBits nWinStyle )
 {
 	Window::ImplInit( pParent, nWinStyle, NULL );
 
 	mpRefWin = pParent;
 
-	const StyleSettings& rSettings = GetSettings().GetStyleSettings();
-	long nA = rSettings.GetScrollBarSize();
-	long nB = rSettings.GetSplitSize();
-
-	PointerStyle ePointerStyle;
-
-	if ( nWinStyle & WB_HSCROLL )
-	{
-		ePointerStyle = POINTER_HSPLIT;
-		mbHorzSplit = sal_True;
-		SetSizePixel( Size( nB, nA ) );
-	}
-	else
-	{
-		ePointerStyle = POINTER_VSPLIT;
-		mbHorzSplit = sal_False;
-		SetSizePixel( Size( nA, nB ) );
-	}
-
-	SetPointer( Pointer( ePointerStyle ) );
+    ImplInitHorVer(nWinStyle & WB_HSCROLL);
 
     if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() )
 	    SetBackground( ImplWhiteWall::get() );
@@ -182,6 +187,16 @@
 
 // -----------------------------------------------------------------------
 
+void Splitter::SetHorizontal(bool bNew)
+{
+    if(bNew != (bool)mbHorzSplit)
+    {
+        ImplInitHorVer(bNew);
+    }
+}
+
+// -----------------------------------------------------------------------
+
 void Splitter::SetKeyboardStepSize( long nStepSize )
 {
     mnKeyboardStepSize = nStepSize;
diff --git a/main/vcl/source/window/window.cxx b/main/vcl/source/window/window.cxx
index aeef2af..cf45c0a 100644
--- a/main/vcl/source/window/window.cxx
+++ b/main/vcl/source/window/window.cxx
@@ -277,7 +277,9 @@
 	mbDisableAccessibleLabelForRelation = sal_False; // sal_True: do not set LabelFor relation on accessible objects
 	mbDisableAccessibleLabeledByRelation = sal_False; // sal_True: do not set LabeledBy relation on accessible objects
 	mbHelpTextDynamic = sal_False;          // sal_True: append help id in HELP_DEBUG case
-	mbFakeFocusSet = sal_False; // sal_True: pretend as if the window has focus.
+	mbFakeFocusSet = sal_False; // sal_True: pretend as if the window
+                                // has focus.
+    mbIsThemingEnabled = sal_True;
 }
 
 WindowImpl::~WindowImpl()
@@ -756,7 +758,10 @@
             nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
             nStyle |= WB_BORDER;
         }
-        ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
+        ImplBorderWindow* pBorderWin =
+            mpWindowImpl->mbIsThemingEnabled
+            ? CreateBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle )
+            : new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
         ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
         pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
         mpWindowImpl->mpBorderWindow  = pBorderWin;
diff --git a/main/vcl/source/window/window4.cxx b/main/vcl/source/window/window4.cxx
index 403ce1a..f6b04b5 100644
--- a/main/vcl/source/window/window4.cxx
+++ b/main/vcl/source/window/window4.cxx
@@ -28,6 +28,7 @@
 
 #include "window.h"
 #include "svdata.hxx"
+#include "brdwin.hxx"
 
 #include "com/sun/star/beans/PropertyValue.hpp"
 
@@ -219,3 +220,29 @@
     return aProps;
 }
 
+
+
+
+void Window::EnableThemeSupport (void)
+{
+    mpWindowImpl->mbIsThemingEnabled = sal_True;
+}
+
+
+
+
+void Window::DisableThemeSupport (void)
+{
+    mpWindowImpl->mbIsThemingEnabled = sal_False;
+}
+
+
+
+
+ImplBorderWindow* Window::CreateBorderWindow (
+    Window* pParent,
+    const WinBits nStyle,
+    const sal_uInt16 nTypeStyle)
+{
+    return new ImplBorderWindow(pParent, nStyle, nTypeStyle);
+}