[Libreoffice-commits] core.git: 9 commits - include/sfx2 include/svx include/vcl offapi/com sfx2/source solenv/bin svx/Library_svx.mk svx/source svx/uiconfig svx/UIConfig_svx.mk vcl/source

Jan Holesovsky kendy at suse.cz
Sat Jun 1 20:10:48 PDT 2013


 include/sfx2/sidebar/SidebarPanelBase.hxx     |    2 
 include/sfx2/sidebar/SidebarToolBox.hxx       |    6 
 include/svx/sidebar/PanelLayout.hxx           |   34 +
 include/vcl/builder.hxx                       |    9 
 include/vcl/toolbox.hxx                       |   12 
 offapi/com/sun/star/ui/XSidebarPanel.idl      |    4 
 sfx2/source/sidebar/Deck.cxx                  |    4 
 sfx2/source/sidebar/Deck.hxx                  |    3 
 sfx2/source/sidebar/DeckLayouter.cxx          |   13 
 sfx2/source/sidebar/DeckLayouter.hxx          |    3 
 sfx2/source/sidebar/SidebarController.cxx     |   14 
 sfx2/source/sidebar/SidebarController.hxx     |    2 
 sfx2/source/sidebar/SidebarPanelBase.cxx      |   21 +
 sfx2/source/sidebar/SidebarToolBox.cxx        |   16 
 solenv/bin/linkoo                             |    2 
 svx/Library_svx.mk                            |    1 
 svx/UIConfig_svx.mk                           |    1 
 svx/source/sidebar/PanelLayout.cxx            |   39 ++
 svx/source/sidebar/text/SvxSBFontNameBox.cxx  |   16 
 svx/source/sidebar/text/SvxSBFontNameBox.hxx  |    3 
 svx/source/sidebar/text/TextPropertyPanel.cxx |  482 +++++++++++---------------
 svx/source/sidebar/text/TextPropertyPanel.hrc |   26 -
 svx/source/sidebar/text/TextPropertyPanel.hxx |   34 -
 svx/source/sidebar/text/TextPropertyPanel.src |  249 -------------
 svx/uiconfig/ui/sidebartextpanel.ui           |  341 ++++++++++++++++++
 vcl/source/window/builder.cxx                 |   39 ++
 vcl/source/window/toolbox.cxx                 |    5 
 vcl/source/window/toolbox2.cxx                |  136 +++++++
 28 files changed, 937 insertions(+), 580 deletions(-)

New commits:
commit e66be44b69ee2a1b99bda32af93ea453c669b319
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun Jun 2 04:46:58 2013 +0200

    sidebar: Restrict the minimal width of the sidebar.
    
    Change-Id: I99051830c4393b420125332e787c3abdc5a6aa61

diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
index 330533a..a7e8db1 100644
--- a/include/sfx2/sidebar/SidebarPanelBase.hxx
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -97,6 +97,8 @@ public:
     // XSidebarPanel
     virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth)
         throw(cssu::RuntimeException);
+    virtual sal_Int32 SAL_CALL getMinimalWidth ()
+        throw(cssu::RuntimeException);
 
 protected:
     cssu::Reference<css::frame::XFrame> mxFrame;
diff --git a/offapi/com/sun/star/ui/XSidebarPanel.idl b/offapi/com/sun/star/ui/XSidebarPanel.idl
index 1852c97..25d3f95 100644
--- a/offapi/com/sun/star/ui/XSidebarPanel.idl
+++ b/offapi/com/sun/star/ui/XSidebarPanel.idl
@@ -51,6 +51,10 @@ interface XSidebarPanel
         The height is set via the XWindow interface.
     */
     LayoutSize getHeightForWidth ( [in] long nWidth);
+
+    /** Minimal possible width of this panel.
+    */
+    long getMinimalWidth();
 } ;
 
 } ; } ; } ; } ;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 9a16ad5..52969b2 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -56,6 +56,7 @@ Deck::Deck (
       msIconURL(rDeckDescriptor.msIconURL),
       msHighContrastIconURL(rDeckDescriptor.msHighContrastIconURL),
       maPanels(),
+      mnMinimalWidth(0),
       mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
       mpScrollClipWindow(new Window(this)),
       mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
@@ -294,8 +295,11 @@ const SharedPanelContainer& Deck::GetPanels (void) const
 
 void Deck::RequestLayout (void)
 {
+    mnMinimalWidth = 0;
+
     DeckLayouter::LayoutDeck(
         GetContentArea(),
+        mnMinimalWidth,
         maPanels,
         *GetTitleBar(),
         *mpScrollClipWindow,
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index f49d38f..0dc86ff 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -75,6 +75,8 @@ public:
     void PrintWindowTree (const ::std::vector<Panel*>& rPanels);
     static void PrintWindowSubTree (Window* pRoot, int nIndentation);
 
+    sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
+
     class ScrollContainerWindow : public Window
     {
     public:
@@ -92,6 +94,7 @@ private:
     Image maIcon;
     const ::rtl::OUString msIconURL;
     const ::rtl::OUString msHighContrastIconURL;
+    sal_Int32 mnMinimalWidth;
     SharedPanelContainer maPanels;
     ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
     ::boost::scoped_ptr<Window> mpScrollClipWindow;
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index d68ae29..858fe93 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -47,6 +47,7 @@ namespace {
 
 void DeckLayouter::LayoutDeck (
     const Rectangle aContentArea,
+    sal_Int32& rMinimalWidth,
     SharedPanelContainer& rPanels,
     Window& rDeckTitleBar,
     Window& rScrollClipWindow,
@@ -70,6 +71,7 @@ void DeckLayouter::LayoutDeck (
         }
         aBox = LayoutPanels(
             aBox,
+            rMinimalWidth,
             aLayoutItems,
             rScrollClipWindow,
             rScrollContainer,
@@ -84,6 +86,7 @@ void DeckLayouter::LayoutDeck (
 
 Rectangle DeckLayouter::LayoutPanels (
     const Rectangle aContentArea,
+    sal_Int32& rMinimalWidth,
     ::std::vector<LayoutItem>& rLayoutItems,
     Window& rScrollClipWindow,
     Window& rScrollContainer,
@@ -98,7 +101,7 @@ Rectangle DeckLayouter::LayoutPanels (
     // height that is left when all panel titles and separators are
     // taken into account.
     sal_Int32 nAvailableHeight (aBox.GetHeight());
-    GetRequestedSizes(rLayoutItems, nAvailableHeight, aBox);
+    GetRequestedSizes(rLayoutItems, nAvailableHeight, rMinimalWidth, aBox);
     const sal_Int32 nTotalDecorationHeight (aBox.GetHeight() - nAvailableHeight);
 
     // Analyze the requested heights.
@@ -120,6 +123,7 @@ Rectangle DeckLayouter::LayoutPanels (
         // Show a vertical scrollbar.
         return LayoutPanels(
             aContentArea,
+            rMinimalWidth,
             rLayoutItems,
             rScrollClipWindow,
             rScrollContainer,
@@ -284,6 +288,7 @@ sal_Int32 DeckLayouter::PlacePanels (
 void DeckLayouter::GetRequestedSizes (
     ::std::vector<LayoutItem>& rLayoutItems,
     sal_Int32& rAvailableHeight,
+    sal_Int32& rMinimalWidth,
     const Rectangle& rContentBox)
 {
     rAvailableHeight = rContentBox.GetHeight();
@@ -316,7 +321,13 @@ void DeckLayouter::GetRequestedSizes (
             {
                 Reference<ui::XSidebarPanel> xPanel (iItem->mpPanel->GetPanelComponent());
                 if (xPanel.is())
+                {
                     aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
+
+                    sal_Int32 nWidth = xPanel->getMinimalWidth();
+                    if (nWidth > rMinimalWidth)
+                        rMinimalWidth = nWidth;
+                }
                 else
                     aLayoutSize = ui::LayoutSize(MinimalPanelHeight, -1, 0);
             }
diff --git a/sfx2/source/sidebar/DeckLayouter.hxx b/sfx2/source/sidebar/DeckLayouter.hxx
index e1df7f2..a284c08 100644
--- a/sfx2/source/sidebar/DeckLayouter.hxx
+++ b/sfx2/source/sidebar/DeckLayouter.hxx
@@ -44,6 +44,7 @@ class DeckLayouter
 public:
     static void LayoutDeck (
         const Rectangle aContentArea,
+        sal_Int32& rMinimalWidth,
         SharedPanelContainer& rPanels,
         Window& pDeckTitleBar,
         Window& pScrollClipWindow,
@@ -78,6 +79,7 @@ private:
     };
     static Rectangle LayoutPanels (
         const Rectangle aContentArea,
+        sal_Int32& rMinimalWidth,
         ::std::vector<LayoutItem>& rLayoutItems,
         Window& rScrollClipWindow,
         Window& rScrollContainer,
@@ -86,6 +88,7 @@ private:
     static void GetRequestedSizes (
         ::std::vector<LayoutItem>& rLayoutItem,
         sal_Int32& rAvailableHeight,
+        sal_Int32& rMinimalWidth,
         const Rectangle& rContentBox);
     static void DistributeHeights (
         ::std::vector<LayoutItem>& rLayoutItems,
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index bce2f6f..970e96a 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -272,9 +272,13 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
 void SAL_CALL SidebarController::requestLayout (void)
     throw(cssu::RuntimeException)
 {
+    sal_Int32 nMinimalWidth = 0;
     if (mpCurrentDeck)
+    {
         mpCurrentDeck->RequestLayout();
-    RestrictWidth();
+        nMinimalWidth = mpCurrentDeck->GetMinimalWidth();
+    }
+    RestrictWidth(nMinimalWidth);
 }
 
 
@@ -340,14 +344,16 @@ void SidebarController::NotifyResize (void)
     mpTabBar->Show();
 
     // Determine if the closer of the deck can be shown.
+    sal_Int32 nMinimalWidth = 0;
     if (mpCurrentDeck)
     {
         DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
         if (pTitleBar != NULL && pTitleBar->IsVisible())
             pTitleBar->SetCloserVisible(CanModifyChildWindowWidth());
+        nMinimalWidth = mpCurrentDeck->GetMinimalWidth();
     }
 
-    RestrictWidth();
+    RestrictWidth(nMinimalWidth);
 }
 
 
@@ -1050,7 +1056,7 @@ sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth)
 
 
 
-void SidebarController::RestrictWidth (void)
+void SidebarController::RestrictWidth (sal_Int32 nWidth)
 {
     SfxSplitWindow* pSplitWindow = GetSplitWindow();
     if (pSplitWindow != NULL)
@@ -1059,7 +1065,7 @@ void SidebarController::RestrictWidth (void)
         const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
         pSplitWindow->SetItemSizeRange(
             nSetId,
-            Range(TabBar::GetDefaultWidth(), gnMaximumSidebarWidth));
+            Range(TabBar::GetDefaultWidth() + nWidth, gnMaximumSidebarWidth));
     }
 }
 
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 5f2c82b..bdebeb8 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -213,7 +213,7 @@ private:
     void UpdateTitleBarIcons (void);
 
     void UpdateDeckOpenState (void);
-    void RestrictWidth (void);
+    void RestrictWidth (sal_Int32 nWidth);
     SfxSplitWindow* GetSplitWindow (void);
     void ProcessNewWidth (const sal_Int32 nNewWidth);
     void UpdateCloseIndicator (const bool bIsIndicatorVisible);
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index 263e970..a4e037a 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -248,4 +248,15 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
     return ui::LayoutSize(0,0,0);
 }
 
+sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth () throw(cssu::RuntimeException)
+{
+    if (isLayoutEnabled(mpControl))
+    {
+        // widget layout-based sidebar
+        Size aSize(mpControl->GetOptimalSize());
+        return aSize.Width();
+    }
+    return 0;
+}
+
 } } // end of namespace sfx2::sidebar
commit b441420e072a1f09098f89ed646e423c60e1895b
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun Jun 2 03:56:28 2013 +0200

    sidebar: Don't overlap widgets in the .ui based panels.
    
    Change-Id: I32c978188a38d54f2b05d40b5d47b9d5520f3cca

diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 03ff130..568f151 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -26,6 +26,10 @@ Size PanelLayout::GetOptimalSize() const
 
 void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
 {
+    Size aSize(GetOptimalSize());
+    nWidth = std::max(nWidth,aSize.Width());
+    nHeight = std::max(nHeight,aSize.Height());
+
     Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
 
     if (isLayoutEnabled(this) && (nFlags & WINDOW_POSSIZE_SIZE))
commit 415b70061036e67e00786836856f7eeda8cea938
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun Jun 2 02:10:34 2013 +0200

    sidebar: Convert TextPropertyPanel to .ui + adapt code.
    
    Change-Id: I1e446ca520b10f0fba4f79d2e840d10835850f66

diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 75d0e67..9e3c2cf 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/redlinecontrol \
 	svx/uiconfig/ui/redlinefilterpage \
 	svx/uiconfig/ui/redlineviewpage \
+	svx/uiconfig/ui/sidebartextpanel \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/svx/source/sidebar/text/SvxSBFontNameBox.cxx
index 1137617..f5ca5c3 100644
--- a/svx/source/sidebar/text/SvxSBFontNameBox.cxx
+++ b/svx/source/sidebar/text/SvxSBFontNameBox.cxx
@@ -93,6 +93,22 @@ SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent,  const ResId& rResId  ) :
 //  StartListening( *SFX_APP() );
 }
 
+SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent ) :
+    FontNameBox ( pParent, WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|WB_DROPDOWN )
+,   pFontList   ( NULL )
+,   nFtCount    ( 0 )
+,   pBindings(NULL)
+{
+    EnableControls_Impl();
+    EnableAutoSize(true);
+//  StartListening( *SFX_APP() );
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxSBFontNameBox(Window *pParent)
+{
+    return new SvxSBFontNameBox(pParent);
+}
+
 void SvxSBFontNameBox::EnableControls_Impl()
 {
     SvtFontOptions aFontOpt;
diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/svx/source/sidebar/text/SvxSBFontNameBox.hxx
index 82289e3..7470f06 100644
--- a/svx/source/sidebar/text/SvxSBFontNameBox.hxx
+++ b/svx/source/sidebar/text/SvxSBFontNameBox.hxx
@@ -58,7 +58,8 @@ protected:
     virtual void    Select();
 
 public:
-    SvxSBFontNameBox( Window* pParent, const ResId& rResId  );
+    SvxSBFontNameBox( Window* pParent, const ResId& rResId );
+    SvxSBFontNameBox( Window* pParent );
     void            FillList();
     sal_uInt16 GetListCount() { return nFtCount; }
     void            Clear() { FontNameBox::Clear(); nFtCount = 0; }
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 258a730..abb05a5 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -63,6 +63,20 @@ using namespace cssu;
 using ::sfx2::sidebar::Theme;
 using ::sfx2::sidebar::ControlFactory;
 
+const char UNO_BACKCOLOR[] = ".uno:BackColor";
+const char UNO_BOLD[] = ".uno:Bold";
+const char UNO_COLOR[] = ".uno:Color";
+const char UNO_FONTCOLOR[] = ".uno:FontColor";
+const char UNO_GROW[] = ".uno:Grow";
+const char UNO_ITALIC[] = ".uno:Italic";
+const char UNO_STRIKEOUT[] = ".uno:Strikeout";
+const char UNO_SHADOWED[] = ".uno:Shadowed";
+const char UNO_SHRINK[] = ".uno:Shrink";
+const char UNO_SPACING[] = ".uno:Spacing";
+const char UNO_SUBSCRIPT[] = ".uno:SubScript";
+const char UNO_SUPERSCRIPT[] = ".uno:SuperScript";
+const char UNO_UNDERLINE[] = ".uno:Underline";
+
 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
 
 namespace svx { namespace sidebar {
@@ -116,52 +130,8 @@ TextPropertyPanel* TextPropertyPanel::Create (
     return maSpacingControl;
 }
 
-TextPropertyPanel::TextPropertyPanel (
-    Window* pParent,
-    const cssu::Reference<css::frame::XFrame>& rxFrame,
-    SfxBindings* pBindings,
-    const ::sfx2::sidebar::EnumContext& rContext)
-    :   Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
-        mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
-        maFontSizeBox       (this, SVX_RES(MB_SBFONT_FONTSIZE)),
-        mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)),
-        mpToolBoxFont(ControlFactory::CreateToolBox(
-                mpToolBoxFontBackground.get(),
-                SVX_RES(TB_FONT))),
-        mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
-        mpToolBoxIncDec(ControlFactory::CreateToolBox(
-                mpToolBoxIncDecBackground.get(),
-                SVX_RES(TB_INCREASE_DECREASE))),
-        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))),
-        mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
-        mpToolBoxFontColor(ControlFactory::CreateToolBox(
-                mpToolBoxFontColorBackground.get(),
-                SVX_RES(TB_FONTCOLOR),
-                rxFrame)),
-        mpToolBoxFontColorBackgroundSW(ControlFactory::CreateToolBoxBackground(this)),
-        mpToolBoxFontColorSW(ControlFactory::CreateToolBox(
-                mpToolBoxFontColorBackgroundSW.get(),
-                SVX_RES(TB_FONTCOLOR_SW),
-                rxFrame)),
-        mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
-        mpToolBoxHighlight(ControlFactory::CreateToolBox(
-                mpToolBoxHighlightBackground.get(),
-                SVX_RES(TB_HIGHLIGHT),
-                rxFrame)),
-        mpFontColorUpdater(),
-        mpHighlightUpdater(),
-
+TextPropertyPanel::TextPropertyPanel ( Window* pParent, const cssu::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const ::sfx2::sidebar::EnumContext& rContext )
+    : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame),
         maFontNameControl   (SID_ATTR_CHAR_FONT,        *pBindings, *this, A2S("CharFontName"), rxFrame),
         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, A2S("FontHeight"),   rxFrame),
         maWeightControl     (SID_ATTR_CHAR_WEIGHT,      *pBindings, *this, A2S("Bold"),         rxFrame),
@@ -182,13 +152,18 @@ TextPropertyPanel::TextPropertyPanel (
 
         maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
         maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
-        mxFrame(rxFrame),
         maContext(),
         mpBindings(pBindings)
 {
-    Initialize();
+    get(mpFontNameBox, "font");
+    get(mpFontSizeBox, "fontsize");
+    get(mpToolBoxFont, "fonteffects");
+    get(mpToolBoxIncDec, "fontadjust");
+    get(mpToolBoxScript, "position");
+    get(mpToolBoxSpacing, "spacingbar");
+    get(mpToolBoxFontColor, "colorbar");
 
-    FreeResource();
+    Initialize();
 
     UpdateFontColorToolbox(rContext);
 }
@@ -200,26 +175,6 @@ TextPropertyPanel::~TextPropertyPanel (void)
 {
     if(mbMustDelete)
         delete mpFontList;
-
-    // Destroy the toolbox windows.
-    mpToolBoxIncDec.reset();
-    mpToolBoxFont.reset();
-    mpToolBoxFontColor.reset();
-    mpToolBoxFontColorSW.reset();
-    mpToolBoxScript.reset();
-    mpToolBoxScriptSw.reset();
-    mpToolBoxSpacing.reset();
-    mpToolBoxHighlight.reset();
-
-    // Destroy the background windows of the toolboxes.
-    mpToolBoxIncDecBackground.reset();
-    mpToolBoxFontBackground.reset();
-    mpToolBoxFontColorBackground.reset();
-    mpToolBoxFontColorBackgroundSW.reset();
-    mpToolBoxScriptBackground.reset();
-    mpToolBoxScriptSwBackground.reset();
-    mpToolBoxSpacingBackground.reset();
-    mpToolBoxHighlightBackground.reset();
 }
 
 
@@ -245,34 +200,30 @@ void TextPropertyPanel::HandleContextChange (
     {
         case CombinedEnumContext(Application_Calc, Context_Cell):
         case CombinedEnumContext(Application_Calc, Context_Pivot):
-            mpToolBoxScriptSw->Hide();
-            mpToolBoxHighlight->Hide();
+            mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
             mpToolBoxScript->Disable();
             mpToolBoxSpacing->Disable();
             break;
 
         case CombinedEnumContext(Application_Calc, Context_EditCell):
         case CombinedEnumContext(Application_Calc, Context_DrawText):
-            mpToolBoxScriptSw->Hide();
-            mpToolBoxHighlight->Hide();
+            mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
             mpToolBoxScript->Enable();
             mpToolBoxSpacing->Enable();
             break;
 
         case CombinedEnumContext(Application_WriterVariants, Context_Text):
         case CombinedEnumContext(Application_WriterVariants, Context_Table):
-            mpToolBoxScriptSw->Show();
-            mpToolBoxScript->Hide();
-            mpToolBoxHighlight->Show();
+            mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
+            mpToolBoxScript->Enable();
             mpToolBoxSpacing->Show();
             break;
 
         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
-            mpToolBoxScriptSw->Show();
-            mpToolBoxScript->Hide();
+            mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
+            mpToolBoxScript->Enable();
             mpToolBoxSpacing->Show();
-            mpToolBoxHighlight->Hide();
             break;
 
         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
@@ -282,10 +233,9 @@ void TextPropertyPanel::HandleContextChange (
         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
-            mpToolBoxScriptSw->Hide();
-            mpToolBoxScript->Show();
+            mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
+            mpToolBoxScript->Enable();
             mpToolBoxSpacing->Show();
-            mpToolBoxHighlight->Hide();
             break;
 
         default:
@@ -307,13 +257,13 @@ void TextPropertyPanel::UpdateFontColorToolbox (
             bIsWriterFontColor = true;
     if (bIsWriterFontColor)
     {
-        mpToolBoxFontColor->Hide();
-        mpToolBoxFontColorSW->Show();
+        mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_COLOR));
+        mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_FONTCOLOR));
     }
     else
     {
-        mpToolBoxFontColor->Show();
-        mpToolBoxFontColorSW->Hide();
+        mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_COLOR));
+        mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_FONTCOLOR));
     }
 }
 
@@ -348,8 +298,8 @@ void TextPropertyPanel::Initialize (void)
 
     mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
     const FontInfo aFontInfo (mpFontList->Get( OUString( "" ), OUString( "" )));
-    maFontSizeBox.Fill(&aFontInfo,mpFontList);
-    maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
+    mpFontSizeBox->Fill(&aFontInfo,mpFontList);
+    mpFontSizeBox->SetAccessibleName(mpFontSizeBox->GetQuickHelpText());
 
     //toolbox
     SetupToolboxItems();
@@ -359,17 +309,15 @@ void TextPropertyPanel::Initialize (void)
     InitToolBoxSpacing();
 
 #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);
+    mpFontNameBox->SetAccRelationLabeledBy(mpFontNameBox);
+    mpFontNameBox->SetMpSubEditAccLableBy(mpFontNameBox);
+    mpFontSizeBox->SetAccRelationLabeledBy(mpFontSizeBox);
+    mpFontSizeBox->SetMpSubEditAccLableBy(mpFontSizeBox);
+    mpToolBoxFont->SetAccRelationLabeledBy(mpToolBoxFont);
+    mpToolBoxIncDec->SetAccRelationLabeledBy(mpToolBoxIncDec);
+    mpToolBoxFontColor->SetAccRelationLabeledBy(mpToolBoxFontColor);
+    mpToolBoxScriptSetAccRelationLabeledBy(mpToolBoxScript);
+    mpToolBoxSpacing->SetAccRelationLabeledBy(mpToolBoxSpacing);
 #endif
 
     //init state
@@ -394,11 +342,11 @@ void TextPropertyPanel::Initialize (void)
     Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
     mpFontNameBox->SetSelectHdl(aLink);
     aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
-    maFontSizeBox.SetModifyHdl(aLink);
+    mpFontSizeBox->SetModifyHdl(aLink);
     aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
-    maFontSizeBox.SetSelectHdl(aLink);
+    mpFontSizeBox->SetSelectHdl(aLink);
     aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
-    maFontSizeBox.SetLoseFocusHdl(aLink);
+    mpFontSizeBox->SetLoseFocusHdl(aLink);
 }
 
 void TextPropertyPanel::EndSpacingPopupMode (void)
@@ -414,14 +362,9 @@ void TextPropertyPanel::EndUnderlinePopupMode (void)
 
 void TextPropertyPanel::InitToolBoxFont()
 {
-    mpToolBoxFont->SetBackground(Wallpaper());
-    mpToolBoxFont->SetPaintTransparent(true);
-
-    Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
-    mpToolBoxFont->SetOutputSizePixel( aTbxSize );
-
-    Link aLink  = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
+    Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
     mpToolBoxFont->SetSelectHdl ( aLink );
+
     aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
     mpToolBoxFont->SetDropdownClickHdl(aLink);
 }
@@ -431,9 +374,6 @@ void TextPropertyPanel::InitToolBoxFont()
 
 void TextPropertyPanel::InitToolBoxIncDec()
 {
-    Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
-    mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
-
     Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
     mpToolBoxIncDec->SetSelectHdl ( aLink );
 }
@@ -443,23 +383,14 @@ void TextPropertyPanel::InitToolBoxIncDec()
 
 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);
+    Link 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 );
+    const sal_uInt16 nId = mpToolBoxSpacing->GetItemId(UNO_SPACING);
+    mpToolBoxSpacing->SetItemBits(nId, mpToolBoxSpacing->GetItemBits(nId) | TIB_DROPDOWNONLY);
 
     Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
     mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
@@ -471,22 +402,19 @@ void TextPropertyPanel::InitToolBoxSpacing()
 
 void TextPropertyPanel::SetupToolboxItems (void)
 {
-    maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, TBI_INCREASE);
-    maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, TBI_DECREASE);
-
-    maWeightControl.SetupToolBoxItem(*mpToolBoxFont, TBI_BOLD);
-    maItalicControl.SetupToolBoxItem(*mpToolBoxFont, TBI_ITALIC);
-    maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, TBI_UNDERLINE);
-    maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, TBI_STRIKEOUT);
-    maShadowControl.SetupToolBoxItem(*mpToolBoxFont, TBI_SHADOWED);
-
-    //for sw
-    maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUPER_SW);
-    maSubScriptControl.SetupToolBoxItem(*mpToolBoxScriptSw, TBI_SUB_SW);
-    //for sc and sd
-    maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUPER);
-    maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, TBI_SUB);
-    maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, TBI_SPACING);
+    maSDFontGrow.SetupToolBoxItem(*mpToolBoxIncDec, mpToolBoxIncDec->GetItemId(UNO_GROW));
+    maSDFontShrink.SetupToolBoxItem(*mpToolBoxIncDec, mpToolBoxIncDec->GetItemId(UNO_SHRINK));
+
+    maWeightControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_BOLD));
+    maItalicControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_ITALIC));
+    maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_UNDERLINE));
+    maStrikeControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_STRIKEOUT));
+    maShadowControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_SHADOWED));
+
+    maSuperScriptControl.SetupToolBoxItem(*mpToolBoxScript, mpToolBoxScript->GetItemId(UNO_SUPERSCRIPT));
+    maSubScriptControl.SetupToolBoxItem(*mpToolBoxScript, mpToolBoxScript->GetItemId(UNO_SUBSCRIPT));
+
+    maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, mpToolBoxSpacing->GetItemId(UNO_SPACING));
 }
 
 
@@ -509,7 +437,7 @@ IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
 
 IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
 {
-    if (pSizeBox == &maFontSizeBox)
+    if (pSizeBox == mpFontSizeBox)
     {
         long nSize = pSizeBox->GetValue();
         mbFocusOnFontSizeCtrl = true;
@@ -542,7 +470,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
 
 IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
 {
-    if(pSizeBox == &maFontSizeBox)
+    if(pSizeBox == mpFontSizeBox)
     {
         mbFocusOnFontSizeCtrl = false;
     }
@@ -552,10 +480,9 @@ IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
 IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
+    const OUString aCommand(pToolBox->GetItemCommand(nId));
 
-    switch (nId)
-    {
-        case TBI_BOLD:
+        if (aCommand == UNO_BOLD)
         {
             EndTracking();
             if(meWeight != WEIGHT_BOLD)
@@ -565,9 +492,8 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
             SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
             UpdateItem(SID_ATTR_CHAR_WEIGHT);
-            break;
         }
-        case TBI_ITALIC:
+        else if (aCommand == UNO_ITALIC)
         {
             EndTracking();
             if(meItalic != ITALIC_NORMAL)
@@ -577,9 +503,8 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
             SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
             UpdateItem(SID_ATTR_CHAR_POSTURE);
-            break;
         }
-        case TBI_UNDERLINE:
+        else if (aCommand == UNO_UNDERLINE)
         {
             EndTracking();
             if(meUnderline == UNDERLINE_NONE)
@@ -596,9 +521,8 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
             }
             UpdateItem(SID_ATTR_CHAR_UNDERLINE);
-            break;
         }
-        case TBI_STRIKEOUT:
+        else if (aCommand == UNO_STRIKEOUT)
         {
             EndTracking();
             if(meStrike !=  STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
@@ -608,18 +532,16 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
             SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
             UpdateItem(SID_ATTR_CHAR_STRIKEOUT);
-            break;
         }
-        case TBI_SHADOWED:
+        else if (aCommand == UNO_SHADOWED)
         {
             EndTracking();
             mbShadow = !mbShadow;
             SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
             UpdateItem(SID_ATTR_CHAR_SHADOWED);
-            break;
         }
-    }
+
     return 0;
 }
 
@@ -629,6 +551,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
 IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
+    const OUString aCommand(pToolBox->GetItemCommand(nId));
 
     // font size +/- enhancement in sd
     switch (maContext.GetCombinedContext_DI())
@@ -640,13 +563,13 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
-            if(nId == TBI_INCREASE)
+            if(aCommand == UNO_GROW)
             {
                 EndTracking();
                 SfxVoidItem aItem(SID_GROW_FONT_SIZE);
                 mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
             }
-            else if(nId == TBI_DECREASE)
+            else if(aCommand == UNO_SHRINK)
             {
                 EndTracking();
                 SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
@@ -655,15 +578,15 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
             break;
 
         default:
-            if(nId == TBI_INCREASE)
+            if(aCommand == UNO_GROW)
             {
                 EndTracking();
                 mbFocusOnFontSizeCtrl = false;
-                sal_Int64 iValue = maFontSizeBox.GetValue();
-                int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+                sal_Int64 iValue = mpFontSizeBox->GetValue();
+                int iPos = mpFontSizeBox->GetValuePos(iValue, FUNIT_NONE);
                 long nSize = iValue;
                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
-                    nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
+                    nSize = mpFontSizeBox->GetValue(iPos+1 , FUNIT_NONE);
                 else if(iValue >= 100 && iValue < 105)
                     nSize = 105;
                 else if(iValue >= 105 && iValue < 110)
@@ -671,7 +594,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
                 else if(iValue < 960)
                 {
                     nSize = (nSize / 10) * 10 + 10;
-                    while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+                    while(nSize < 960 && mpFontSizeBox->GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
                         nSize += 10;
                 }
                 else
@@ -686,17 +609,17 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
 
                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
-                maFontSizeBox.SetValue( nSize );
+                mpFontSizeBox->SetValue( nSize );
             }
-            else if(nId == TBI_DECREASE)
+            else if(aCommand == UNO_SHRINK)
             {
                 EndTracking();
                 mbFocusOnFontSizeCtrl = false;
-                sal_Int64 iValue = maFontSizeBox.GetValue();
-                int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+                sal_Int64 iValue = mpFontSizeBox->GetValue();
+                int iPos = mpFontSizeBox->GetValuePos(iValue, FUNIT_NONE);
                 long nSize = iValue;
                 if(iPos != LISTBOX_ENTRY_NOTFOUND)
-                    nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
+                    nSize = mpFontSizeBox->GetValue(iPos-1, FUNIT_NONE);
                 else if(iValue > 100 && iValue <= 105)
                     nSize = 100;
                 else if(iValue > 105 && iValue <= 110)
@@ -708,7 +631,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
                 else if(iValue > 60)
                 {
                     nSize = (nSize / 10) * 10 ;
-                    while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+                    while(nSize > 60 && mpFontSizeBox->GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
                         nSize -= 10;
                 }
                 else
@@ -723,7 +646,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
 
                 mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
                 mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
-                maFontSizeBox.SetValue( nSize );
+                mpFontSizeBox->SetValue( nSize );
             }
     }
     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
@@ -736,24 +659,27 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
 IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
-    OSL_ASSERT(nId == TBI_UNDERLINE);
-    if(nId == TBI_UNDERLINE)
+    const OUString aCommand(pToolBox->GetItemCommand(nId));
+
+    if (aCommand == UNO_UNDERLINE)
     {
         pToolBox->SetItemDown( nId, true );
         maUnderlinePopup.Rearrange(meUnderline);
         maUnderlinePopup.Show(*pToolBox);
-
     }
+
     return 0L;
 }
 
 
 
 
-IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
+IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
-    if( nId == TBI_SUPER_SW )
+    const OUString aCommand(pToolBox->GetItemCommand(nId));
+
+    if (isWriter() && aCommand == UNO_SUPERSCRIPT)
     {
         if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
         {
@@ -767,8 +693,9 @@ IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
         }
+        UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
     }
-    else if(TBI_SUB_SW == nId)
+    else if (isWriter() && aCommand == UNO_SUBSCRIPT)
     {
         if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
         {
@@ -782,26 +709,16 @@ IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
             SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
             mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
         }
+        UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
     }
-    UpdateItem(SID_ATTR_CHAR_ESCAPEMENT);
-
-    return 0;
-}
-
-
-
-
-IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
-{
-    const sal_uInt16 nId = pToolBox->GetCurItemId();
-    if( nId == TBI_SUPER )
+    else if (!isWriter() && aCommand == UNO_SUPERSCRIPT)
     {
         mbSuper = !mbSuper;
         SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
         mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
         UpdateItem(SID_SET_SUPER_SCRIPT);
     }
-    else if(TBI_SUB == nId)
+    else if (!isWriter() && aCommand == UNO_SUBSCRIPT)
     {
 
         mbSub = !mbSub;
@@ -809,6 +726,7 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
         mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
         UpdateItem(SID_SET_SUB_SCRIPT);
     }
+
     return 0;
 }
 
@@ -818,14 +736,15 @@ IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
 IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
 {
     const sal_uInt16 nId = pToolBox->GetCurItemId();
-    OSL_ASSERT(nId == TBI_SPACING);
-    if(nId == TBI_SPACING)
+    const OUString aCommand(pToolBox->GetItemCommand(nId));
+
+    if (aCommand == UNO_SPACING)
     {
         pToolBox->SetItemDown( nId, true );
         maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
         maCharSpacePopup.Show(*pToolBox);
-
     }
+
     return 0L;
 }
 
@@ -840,7 +759,7 @@ void TextPropertyPanel::NotifyItemUpdate (
 {
     switch(nSID)
     {
-        case SID_ATTR_CHAR_FONT:
+    case SID_ATTR_CHAR_FONT:
         {
             bool bIsControlEnabled (bIsEnabled);
             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
@@ -855,10 +774,12 @@ void TextPropertyPanel::NotifyItemUpdate (
                     bIsControlEnabled = false;
             }
             mpFontNameBox->Enable(bIsControlEnabled);
-            break;
         }
-        case SID_ATTR_CHAR_FONTHEIGHT:
+        break;
+    case SID_ATTR_CHAR_FONTHEIGHT:
         {
+            const sal_uInt16 nIncreaseId = mpToolBoxIncDec->GetItemId(UNO_GROW);
+            const sal_uInt16 nDecreaseId = mpToolBoxIncDec->GetItemId(UNO_SHRINK);
             bool bIsControlEnabled (bIsEnabled);
             if (  eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
             {
@@ -867,8 +788,8 @@ void TextPropertyPanel::NotifyItemUpdate (
                 const sal_Int64 nValue (CalcToPoint(mpHeightItem->GetHeight(), eUnit, 10 ));
                 mpToolBoxIncDec->Enable();
 
-                mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
-                mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
+                mpToolBoxIncDec->SetItemState(nIncreaseId, STATE_NOCHECK);
+                mpToolBoxIncDec->SetItemState(nDecreaseId, STATE_NOCHECK);
 
                 // For Writer we have to update the states of the
                 // increase and decrease buttons here, because we have
@@ -886,8 +807,8 @@ void TextPropertyPanel::NotifyItemUpdate (
 
                     default:
                     {
-                        mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nValue<960);
-                        mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nValue>60);
+                        mpToolBoxIncDec->EnableItem(nIncreaseId, bIsEnabled && nValue<960);
+                        mpToolBoxIncDec->EnableItem(nDecreaseId, bIsEnabled && nValue>60);
                         break;
                     }
                 }
@@ -895,8 +816,8 @@ void TextPropertyPanel::NotifyItemUpdate (
                 if( mbFocusOnFontSizeCtrl )
                     return;
 
-                maFontSizeBox.SetValue(nValue);
-                maFontSizeBox.LoseFocus();
+                mpFontSizeBox->SetValue(nValue);
+                mpFontSizeBox->LoseFocus();
 
                 UpdateItem(SID_SHRINK_FONT_SIZE);
                 UpdateItem(SID_GROW_FONT_SIZE);
@@ -904,7 +825,7 @@ void TextPropertyPanel::NotifyItemUpdate (
             else
             {
                 mpHeightItem = NULL;
-                maFontSizeBox.SetText( String() );
+                mpFontSizeBox->SetText( String() );
                 //increase decrease diabled when multi-seletion have different font size
 
                 // font size +/- enhancement in sd
@@ -925,11 +846,11 @@ void TextPropertyPanel::NotifyItemUpdate (
                 if ( eState <= SFX_ITEM_READONLY )
                     bIsControlEnabled = false;
             }
-            maFontSizeBox.Enable(bIsControlEnabled);
-            break;
+            mpFontSizeBox->Enable(bIsControlEnabled);
         }
-
-        case SID_ATTR_CHAR_WEIGHT:
+        break;
+    case SID_ATTR_CHAR_WEIGHT:
+        {
             mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
             {
@@ -940,11 +861,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 meWeight = WEIGHT_NORMAL;
             }
-            mpToolBoxFont->EnableItem(TBI_BOLD, mbWeightAvailable && bIsEnabled);
-            mpToolBoxFont->SetItemState(TBI_BOLD, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
-            break;
-
-        case SID_ATTR_CHAR_POSTURE:
+            const sal_uInt16 nId = mpToolBoxFont->GetItemId(UNO_BOLD);
+            mpToolBoxFont->EnableItem(nId, mbWeightAvailable && bIsEnabled);
+            mpToolBoxFont->SetItemState(nId, meWeight==WEIGHT_BOLD ? STATE_CHECK : STATE_NOCHECK);
+        }
+        break;
+    case SID_ATTR_CHAR_POSTURE:
+        {
             mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
             {
@@ -955,11 +878,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 meItalic = ITALIC_NONE;
             }
-            mpToolBoxFont->EnableItem(TBI_ITALIC, mbPostureAvailable && bIsEnabled);
-            mpToolBoxFont->SetItemState(TBI_ITALIC, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
-            break;
-
-        case SID_ATTR_CHAR_UNDERLINE:
+            const sal_uInt16 nId = mpToolBoxFont->GetItemId(UNO_ITALIC);
+            mpToolBoxFont->EnableItem(nId, mbPostureAvailable && bIsEnabled);
+            mpToolBoxFont->SetItemState(nId, meItalic==ITALIC_NORMAL ? STATE_CHECK : STATE_NOCHECK);
+        }
+        break;
+    case SID_ATTR_CHAR_UNDERLINE:
+        {
             if( eState >= SFX_ITEM_DEFAULT)
             {
                 if(pState->ISA(SvxUnderlineItem))
@@ -973,11 +898,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 meUnderline = UNDERLINE_NONE;
             }
-            mpToolBoxFont->EnableItem(TBI_UNDERLINE, bIsEnabled);
-            mpToolBoxFont->SetItemState(TBI_UNDERLINE, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
-            break;
-
-        case SID_ATTR_CHAR_SHADOWED:
+            const sal_uInt16 nId = mpToolBoxFont->GetItemId(UNO_UNDERLINE);
+            mpToolBoxFont->EnableItem(nId, bIsEnabled);
+            mpToolBoxFont->SetItemState(nId, meUnderline==UNDERLINE_NONE ? STATE_NOCHECK : STATE_CHECK);
+        }
+        break;
+    case SID_ATTR_CHAR_SHADOWED:
+        {
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
             {
                 const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
@@ -987,11 +914,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 mbShadow = false;
             }
-            mpToolBoxFont->EnableItem(TBI_SHADOWED, bIsEnabled);
-            mpToolBoxFont->SetItemState(TBI_SHADOWED, mbShadow ? STATE_CHECK : STATE_NOCHECK);
-            break;
-
-        case SID_ATTR_CHAR_STRIKEOUT:
+            const sal_uInt16 nId = mpToolBoxFont->GetItemId(UNO_SHADOWED);
+            mpToolBoxFont->EnableItem(nId, bIsEnabled);
+            mpToolBoxFont->SetItemState(nId, mbShadow ? STATE_CHECK : STATE_NOCHECK);
+        }
+        break;
+    case SID_ATTR_CHAR_STRIKEOUT:
+        {
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
             {
                 const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
@@ -1001,16 +930,20 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 meStrike = STRIKEOUT_NONE;
             }
-            mpToolBoxFont->EnableItem(TBI_STRIKEOUT, bIsEnabled);
-            mpToolBoxFont->SetItemState(TBI_STRIKEOUT,
+            const sal_uInt16 nId = mpToolBoxFont->GetItemId(UNO_STRIKEOUT);
+            mpToolBoxFont->EnableItem(nId, bIsEnabled);
+            mpToolBoxFont->SetItemState(nId,
                 meStrike!=STRIKEOUT_NONE && meStrike!=STRIKEOUT_DONTKNOW
                     ? STATE_CHECK
                     : STATE_NOCHECK);
-            break;
-
-        case SID_ATTR_CHAR_ESCAPEMENT:
+        }
+        break;
+    case SID_ATTR_CHAR_ESCAPEMENT:
+        if (isWriter())
         {
             bool bIsItemEnabled (true);
+            const sal_uInt16 nSuperscriptId = mpToolBoxScript->GetItemId(UNO_SUPERSCRIPT);
+            const sal_uInt16 nSubscriptId = mpToolBoxScript->GetItemId(UNO_SUBSCRIPT);
             if (eState == SFX_ITEM_AVAILABLE)
             {
                 if (pState->ISA(SvxEscapementItem))
@@ -1020,27 +953,27 @@ void TextPropertyPanel::NotifyItemUpdate (
                     if(nEsc == 0)
                     {
                         meEscape = SVX_ESCAPEMENT_OFF;
-                        mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
-                        mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+                        mpToolBoxScript->SetItemState(nSuperscriptId, STATE_NOCHECK);
+                        mpToolBoxScript->SetItemState(nSubscriptId, STATE_NOCHECK);
                     }
                     else if(nEsc > 0)
                     {
                         meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
-                        mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
-                        mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+                        mpToolBoxScript->SetItemState(nSuperscriptId, STATE_CHECK);
+                        mpToolBoxScript->SetItemState(nSubscriptId, STATE_NOCHECK);
                     }
                     else
                     {
                         meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
-                        mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
-                        mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
+                        mpToolBoxScript->SetItemState(nSuperscriptId, STATE_NOCHECK);
+                        mpToolBoxScript->SetItemState(nSubscriptId, STATE_CHECK);
                     }
                 }
                 else
                 {
                     meEscape = SVX_ESCAPEMENT_OFF;
-                    mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
-                    mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+                    mpToolBoxScript->SetItemState(nSuperscriptId, STATE_NOCHECK);
+                    mpToolBoxScript->SetItemState(nSubscriptId, STATE_NOCHECK);
                 }
             }
             else if (eState == SFX_ITEM_DISABLED)
@@ -1051,12 +984,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 meEscape = SVX_ESCAPEMENT_OFF;
             }
-            mpToolBoxScriptSw->EnableItem(TBI_SUPER_SW, bIsItemEnabled && bIsEnabled);
-            mpToolBoxScriptSw->EnableItem(TBI_SUB_SW, bIsItemEnabled && bIsEnabled);
-            break;
+            mpToolBoxScript->EnableItem(nSuperscriptId, bIsItemEnabled && bIsEnabled);
+            mpToolBoxScript->EnableItem(nSubscriptId, bIsItemEnabled && bIsEnabled);
         }
-
-        case SID_SET_SUB_SCRIPT:
+        break;
+    case SID_SET_SUB_SCRIPT:
+        if (!isWriter())
+        {
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
             {
                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
@@ -1066,11 +1000,14 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 mbSub = false;
             }
-            mpToolBoxScript->EnableItem(TBI_SUB, bIsEnabled);
-            mpToolBoxScript->SetItemState(TBI_SUB, mbSub ? STATE_CHECK : STATE_NOCHECK);
-            break;
-
-        case SID_SET_SUPER_SCRIPT:
+            const sal_uInt16 nSubscriptId = mpToolBoxScript->GetItemId(UNO_SUBSCRIPT);
+            mpToolBoxScript->EnableItem(nSubscriptId, bIsEnabled);
+            mpToolBoxScript->SetItemState(nSubscriptId, mbSub ? STATE_CHECK : STATE_NOCHECK);
+        }
+        break;
+    case SID_SET_SUPER_SCRIPT:
+        if (!isWriter())
+        {
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
             {
                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
@@ -1080,11 +1017,13 @@ void TextPropertyPanel::NotifyItemUpdate (
             {
                 mbSuper = false;
             }
-            mpToolBoxScript->EnableItem(TBI_SUPER, bIsEnabled);
-            mpToolBoxScript->SetItemState(TBI_SUPER, mbSuper ? STATE_CHECK : STATE_NOCHECK);
-            break;
-
-        case SID_ATTR_CHAR_KERNING:
+            const sal_uInt16 nSuperscriptId = mpToolBoxScript->GetItemId(UNO_SUPERSCRIPT);
+            mpToolBoxScript->EnableItem(nSuperscriptId, bIsEnabled);
+            mpToolBoxScript->SetItemState(nSuperscriptId, mbSuper ? STATE_CHECK : STATE_NOCHECK);
+        }
+        break;
+    case SID_ATTR_CHAR_KERNING:
+        {
             if ( SFX_ITEM_AVAILABLE == eState )
             {
                 mbKernLBAvailable = true;
@@ -1113,12 +1052,12 @@ void TextPropertyPanel::NotifyItemUpdate (
                 mbKernAvailable = false;
                 mlKerning = 0;
             }
-            mpToolBoxSpacing->EnableItem(TBI_SPACING, bIsEnabled);
-            break;
-
-            // font size +/- enhancement in sd
-        case SID_SHRINK_FONT_SIZE:
-        case SID_GROW_FONT_SIZE:
+            mpToolBoxSpacing->EnableItem(mpToolBoxSpacing->GetItemId(UNO_SPACING), bIsEnabled);
+        }
+        break;
+    case SID_SHRINK_FONT_SIZE:
+    case SID_GROW_FONT_SIZE:
+        {
             switch(maContext.GetCombinedContext_DI())
             {
                 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
@@ -1133,15 +1072,15 @@ void TextPropertyPanel::NotifyItemUpdate (
                         mpToolBoxIncDec->Disable();
                     else
                         mpToolBoxIncDec->Enable();
-                    const sal_Int64 nSize (maFontSizeBox.GetValue());
+                    const sal_Int64 nSize (mpFontSizeBox->GetValue());
                     switch(nSID)
                     {
                         case SID_GROW_FONT_SIZE:
-                            mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960);
+                            mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_GROW), bIsEnabled && nSize<960);
                             break;
 
                         case SID_SHRINK_FONT_SIZE:
-                            mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60);
+                            mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_SHRINK), bIsEnabled && nSize>60);
                             break;
 
                         default:
@@ -1149,7 +1088,8 @@ void TextPropertyPanel::NotifyItemUpdate (
                     }
                 }
             }
-            break;
+        }
+        break;
     }
 }
 
@@ -1216,6 +1156,18 @@ void TextPropertyPanel::SetUnderline(FontUnderline  eUnderline)
     meUnderline = eUnderline;
 }
 
-
+bool TextPropertyPanel::isWriter()
+{
+    switch (maContext.GetCombinedContext_DI())
+    {
+        case CombinedEnumContext(Application_WriterVariants, Context_Text):
+        case CombinedEnumContext(Application_WriterVariants, Context_Table):
+        case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
+        case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
+            return true;
+        default:
+            return false;
+    }
+}
 
 } } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc
index 36fc250..38baa07 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hrc
+++ b/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -24,32 +24,6 @@
 #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_FONTCOLOR_SW         7
-#define TB_HIGHLIGHT            8
-#define TB_SPACING              9
-#define TB_SCRIPT               10
-#define TB_SCRIPT_SW            11
-
-#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
 
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index 7f2f641..342b9a9 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -36,6 +36,7 @@
 #include "TextCharacterSpacingPopup.hxx"
 #include "TextUnderlinePopup.hxx"
 #include <svx/sidebar/ColorPopup.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
 #include <vcl/vclenum.hxx>
 
 class FloatingWindow;
@@ -48,7 +49,7 @@ class PopupControl;
 class PopupContainer;
 
 class TextPropertyPanel
-    : public Control,
+    : public PanelLayout,
       public ::sfx2::sidebar::IContextChangeReceiver,
       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
 {
@@ -83,26 +84,13 @@ public:
 
 private:
     //ui controls
-    ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
-    FontSizeBox maFontSizeBox;
-    ::boost::scoped_ptr<Window> mpToolBoxFontBackground;
-    ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
-    ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground;
-    ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
-    ::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> mpToolBoxFontColorBackground;
-    ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
-    ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
-    ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
-    ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
-    ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
-    ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
-    ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
+    SvxSBFontNameBox* mpFontNameBox;
+    FontSizeBox* mpFontSizeBox;
+    ToolBox* mpToolBoxFont;
+    ToolBox* mpToolBoxIncDec;
+    ToolBox* mpToolBoxScript;
+    ToolBox* mpToolBoxSpacing;
+    ToolBox* mpToolBoxFontColor;
 
     //control items
     ::sfx2::sidebar::ControllerItem maFontNameControl;
@@ -141,7 +129,6 @@ private:
     TextCharacterSpacingPopup maCharSpacePopup;
     TextUnderlinePopup maUnderlinePopup;
 
-    cssu::Reference<css::frame::XFrame> mxFrame;
     ::sfx2::sidebar::EnumContext maContext;
     SfxBindings* mpBindings;
 
@@ -171,7 +158,6 @@ private:
     DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
     DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
     DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
-    DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
     DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
 
     void UpdateItem (const sal_uInt16 nSlotId);
@@ -182,6 +168,8 @@ private:
     */
     void UpdateFontColorToolbox (
         const ::sfx2::sidebar::EnumContext aContext);
+
+    bool isWriter();
 };
 
 } } // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src
index fcd10da..f22a899 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.src
+++ b/svx/source/sidebar/text/TextPropertyPanel.src
@@ -19,255 +19,6 @@
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include "helpid.hrc"
 
-#define CONTROL_HEIGHT_FONT_NAME        250
-#define CONTROL_HEIGHT_FONT_SIZE        180
-#define FONTSIZE_WIDTH                  (TOOLBOX_ITEM_WIDTH * 2 - 1)
-#define FONTNAME_WIDTH                  (PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH) - 6)
-
-#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
-
-#define X0                      SECTIONPAGE_MARGIN_HORIZONTAL
-#define X1                      SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2  + 4
-#define X2                      (PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH))
-#define X3                      (X2 - (TOOLBOX_ITEM_DD_WIDTH) - 2)
-
-#define FIRST_LINE_Y            SECTIONPAGE_MARGIN_VERTICAL_TOP
-#define SECOND_LINE_Y           FIRST_LINE_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL  + 1
-#define THIRD_LINE_Y            SECOND_LINE_Y + CONTROL_SPACING_VERTICAL + (TOOLBOX_ITEM_HEIGHT + 2)
-
-
-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 (X0 , FIRST_LINE_Y);
-        Size = MAP_APPFONT (FONTNAME_WIDTH , CONTROL_HEIGHT_FONT_NAME);
-        TabStop = TRUE;
-        DropDown = TRUE;
-        HelpID = HID_COMBO_FONT_NAME ;
-        QuickHelpText [ en-US ] = "Font";
-//        Command = ".uno:CharFontName";
-    };
-    MetricBox MB_SBFONT_FONTSIZE
-    {
-        Border = TRUE;
-        Pos = MAP_APPFONT (X2, FIRST_LINE_Y);
-        Size = MAP_APPFONT (FONTSIZE_WIDTH, CONTROL_HEIGHT_FONT_SIZE);
-        TabStop = TRUE;
-        DropDown = TRUE;
-        HelpID = HID_METRIC_FONT_SIZE;
-        QuickHelpText [ en-US ] = "Font Size";
-//        Command = ".uno:FontHeight";
-    };
-
-    ToolBox TB_INCREASE_DECREASE
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X2, SECOND_LINE_Y) ;
-        Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE;
-        Text = "Font Size Adjusting" ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_INCREASE;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE;
-                Command = ".uno:Grow";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_DECREASE;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE;
-                Command = ".uno:Shrink";
-            };
-        };
-    };
-    ToolBox TB_FONT
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X0 + 1, SECOND_LINE_Y) ;
-        Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT;
-        Text = "Font Effects" ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_BOLD;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD;
-                Command = ".uno:Bold";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_ITALIC;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC;
-                Command = ".uno:Italic";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_UNDERLINE;
-                DropDown = TRUE ;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE;
-                Command = ".uno:Underline";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_STRIKEOUT;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT;
-                Command = ".uno:Strikeout";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_SHADOWED;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED;
-                Command = ".uno:Shadowed";
-            };
-        };
-    };
-
-    ToolBox TB_FONTCOLOR
-    {
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
-        Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_FONTCOLOR ;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
-                DropDown = TRUE ;
-                Command = ".uno:Color";
-            };
-        };
-    };
-    ToolBox TB_FONTCOLOR_SW
-    {
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR;
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X3, THIRD_LINE_Y) ;
-        Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_FONTCOLOR ;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
-                DropDown = TRUE ;
-                Command = ".uno:FontColor";
-            };
-        };
-    };
-
-    ToolBox TB_HIGHLIGHT
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X2, THIRD_LINE_Y) ;
-        Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR;
-        Text = "Highlight Color" ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_HIGHLIGHT ;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
-                DropDown = TRUE ;
-                Command = ".uno:BackColor";
-            };
-        };
-    };
-
-    ToolBox TB_SCRIPT_SW
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X0 + 1 , THIRD_LINE_Y) ;
-        Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW;
-        Text = "Font Position" ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_SUPER_SW;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW;
-                Command = ".uno:SuperScript";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_SUB_SW;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW;
-                Command = ".uno:SubScript";
-            };
-        };
-    };
-    ToolBox TB_SCRIPT
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X0 + 1 , THIRD_LINE_Y) ;
-        Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ;
-        TabStop = TRUE ;
-        HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT;
-        Text = "Font Position" ;
-        ItemList =
-        {
-            ToolBoxItem
-            {
-                Identifier = TBI_SUPER;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER;
-                Command = ".uno:SuperScript";
-            };
-            ToolBoxItem
-            {
-                Identifier = TBI_SUB;
-                HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB;
-                Command = ".uno:SubScript";
-            };
-        };
-    };
-
-    ToolBox TB_SPACING
-    {
-        SVLook = TRUE ;
-        Pos = MAP_APPFONT (X1, THIRD_LINE_Y) ;
-        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 ;
-                HelpID = HID_TBI_SPACING;
-                Command = ".uno:Spacing";
-            };
-        };
-    };
-};
 
 Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE
 {
diff --git a/svx/uiconfig/ui/sidebartextpanel.ui b/svx/uiconfig/ui/sidebartextpanel.ui
new file mode 100644
index 0000000..4f76438
--- /dev/null
+++ b/svx/uiconfig/ui/sidebartextpanel.ui
@@ -0,0 +1,341 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkGrid" id="SidebarTextPanel">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="row_homogeneous">True</property>
+    <property name="column_homogeneous">True</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">6</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkBox" id="box2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="svxlo-SvxSBFontNameBox" id="font">
+                <property name="width_request">150</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="svtlo-FontSizeBox" id="fontsize">
+                <property name="width_request">50</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="fonteffects">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+                <child>
+                  <object class="GtkToolButton" id="bold">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Bold</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="italic">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Italic</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuToolButton" id="underline">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Underline</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="strikeout">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Strikeout</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="shadowed">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Shadowed</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="fontadjust">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+                <child>
+                  <object class="GtkToolButton" id="grow">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Grow</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="shrink">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Shrink</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="colorbar">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+                <child>
+                  <object class="GtkMenuToolButton" id="color">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Color</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuToolButton" id="fontcolor">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:FontColor</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuToolButton" id="highlight">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:BackColor</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="position">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+                <child>
+                  <object class="GtkToolButton" id="superscript">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="action_name">.uno:SuperScript</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="subscript">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="action_name">.uno:SubScript</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="spacingbar">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkToolButton" id="spacing">
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:Spacing</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
commit 0e81c49f49a58efdd69f8072b8d3df235753a847
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun Jun 2 02:08:45 2013 +0200

    sidebar: Try harder to find the command's image.
    
    Change-Id: I14d2a3887c36937be44e151409a851f923262a62

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 7c671fb..6634361 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -40,12 +40,15 @@
 
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/UICommandDescription.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XModuleManager2.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/ui/ImageType.hpp>
 #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XImageManager.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
 
 using namespace vcl;
@@ -697,11 +700,41 @@ static OUString getCommandLabel(const OUString& rCommand, const uno::Reference<u
 
 
 /// Get label of the command (like of .uno:Save) from the description service.
-static Image getCommandImage(const OUString& rCommand, bool bLarge, const uno::Reference<uno::XComponentContext>& rContext, const OUString& rModuleId)
+static Image getCommandImage(const OUString& rCommand, bool bLarge,
+        const uno::Reference<uno::XComponentContext>& rContext, const uno::Reference<frame::XFrame>& rFrame,
+        const OUString& rModuleId)
 {
     if (rCommand.isEmpty())
         return Image();
 
+    sal_Int16 nImageType(ui::ImageType::COLOR_NORMAL | ui::ImageType::SIZE_DEFAULT);
+    if (bLarge)
+        nImageType |= ui::ImageType::SIZE_LARGE;
+
+    try
+    {
+        uno::Reference<frame::XController> xController(rFrame->getController());
+        uno::Reference<frame::XModel> xModel(xController->getModel());
+
+        uno::Reference<ui::XUIConfigurationManagerSupplier> xSupplier(xModel, uno::UNO_QUERY);
+        uno::Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), uno::UNO_QUERY);
+        uno::Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), uno::UNO_QUERY);
+
+        uno::Sequence< uno::Reference<graphic::XGraphic> > aGraphicSeq;
+        uno::Sequence<OUString> aImageCmdSeq(1);
+        aImageCmdSeq[0] = rCommand;
+
+        aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq );
+        uno::Reference<graphic::XGraphic> xGraphic = aGraphicSeq[0];
+        Image aImage(xGraphic);
+
+        if (!!aImage)
+            return aImage;
+    }
+    catch (uno::Exception&)
+    {
+    }
+
     try {
         uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::ModuleUIConfigurationManagerSupplier::create(rContext));
         uno::Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(rModuleId));
@@ -712,10 +745,6 @@ static Image getCommandImage(const OUString& rCommand, bool bLarge, const uno::R
         uno::Sequence<OUString> aImageCmdSeq(1);
         aImageCmdSeq[0] = rCommand;
 
-        sal_Int16 nImageType(ui::ImageType::COLOR_NORMAL | ui::ImageType::SIZE_DEFAULT);
-        if (bLarge)
-            nImageType |= ui::ImageType::SIZE_LARGE;
-
         aGraphicSeq = xModuleImageManager->getImages(nImageType, aImageCmdSeq);
 
         uno::Reference<graphic::XGraphic> xGraphic(aGraphicSeq[0]);
@@ -736,7 +765,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::X
     OUString aModuleId(xModuleManager->identify(rFrame));
 
     OUString aLabel(getCommandLabel(rCommand, xContext, aModuleId));
-    Image aImage(getCommandImage(rCommand, false /*FIXME large or small?*/, xContext, aModuleId));
+    Image aImage(getCommandImage(rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), xContext, rFrame, aModuleId));
 
     // let's invent an ItemId
     const sal_uInt16 COMMAND_ITEMID_START = 30000;
commit 7ccbfa7cc6d30d2b9c4e2ad4c26e8e4e92703c7f
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sat Jun 1 23:54:23 2013 +0200

    sidebar: Support for dropdown toolbar items in .ui.
    
    Change-Id: I964f82321e26cc8c9a0b6ec9d9d3f28dc5fc935b

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 380c5e6..3824497 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1229,14 +1229,19 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
     {
         pWindow = new ToolBox(pParent, WB_3DLOOK | WB_TABSTOP);
     }
-    else if (name == "GtkToolButton")
+    else if (name == "GtkToolButton" || name == "GtkMenuToolButton")
     {
         ToolBox *pToolBox = dynamic_cast<ToolBox*>(pParent);
         if (pToolBox)
         {
             OUString aCommand(OStringToOUString(extractActionName(rMap), RTL_TEXTENCODING_UTF8));
+
+            ToolBoxItemBits nBits = 0;
+            if (name == "GtkMenuToolButton")
+                nBits |= TIB_DROPDOWN;
+
             if (!aCommand.isEmpty())
-                pToolBox->InsertItem(aCommand, m_xFrame);
+                pToolBox->InsertItem(aCommand, m_xFrame, nBits);
 
             return NULL; // no widget to be created
         }
commit 74221eb249f8c4aaf15c2e1f23651f3fde954767
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sat Jun 1 23:09:26 2013 +0200

    sidebar: Allow creation of SidebarToolBoxes via .ui.
    
    Change-Id: If8789fd423a609a18514e5a798df5b5992dac34f

diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index b22bbc8..c5bbc14 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -52,6 +52,12 @@ public:
         Window* pParentWindow);
     virtual ~SidebarToolBox (void);
 
+    using ToolBox::InsertItem;
+    virtual void InsertItem(const OUString& rCommand,
+            const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
+            ToolBoxItemBits nBits = 0,
+            sal_uInt16 nPos = TOOLBOX_APPEND);
+
     void SetBorderWindow (const Window* pBorderWindow);
     virtual void Paint (const Rectangle& rRect);
 
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 501eeed..702f819 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -340,7 +340,7 @@ public:
     void                InsertItem( const ResId& rResId,
                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     /// Insert a command (like '.uno:Save').
-    void                InsertItem( const OUString& rCommand,
+    virtual void        InsertItem( const OUString& rCommand,
                                     const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
                                     ToolBoxItemBits nBits = 0,
                                     sal_uInt16 nPos = TOOLBOX_APPEND );
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 291b82f..5039a1a 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -87,14 +87,17 @@ SidebarToolBox::SidebarToolBox (Window* pParentWindow)
 {
     SetBackground(Wallpaper());
     SetPaintTransparent(true);
+    SetToolboxButtonSize( TOOLBOX_BUTTONSIZE_SMALL );
 
 #ifdef DEBUG
     SetText(A2S("SidebarToolBox"));
 #endif
 }
 
-
-
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSidebarToolBox(Window *pParent)
+{
+    return new SidebarToolBox(pParent);
+}
 
 SidebarToolBox::~SidebarToolBox (void)
 {
@@ -120,8 +123,15 @@ SidebarToolBox::~SidebarToolBox (void)
     }
 }
 
+void SidebarToolBox::InsertItem(const OUString& rCommand,
+        const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
+        ToolBoxItemBits nBits, sal_uInt16 nPos)
+{
+    ToolBox::InsertItem(rCommand, rFrame, nBits, nPos);
 
-
+    CreateController(GetItemId(rCommand), rFrame, 0);
+    RegisterHandlers();
+}
 
 void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow)
 {
commit 5414cab2219c46be6bd8e51feaf92a6fec41f318
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sat Jun 1 23:07:08 2013 +0200

    linkoo: Link .ui files correctly.
    
    Change-Id: Ie8e1c1a39238a2bc97b96a1a9dfef34b27f019e7

diff --git a/solenv/bin/linkoo b/solenv/bin/linkoo
index 297ad5f..bda2132 100755
--- a/solenv/bin/linkoo
+++ b/solenv/bin/linkoo
@@ -572,11 +572,11 @@ evilness ('undo');
 my $installed_files = build_installed_list ($OOO_INSTALL);
 
 scan_and_link_files ($OOO_BUILD, $installed_files, $TARGET);
+link_instdir("$OOO_BUILD/instdir/$TARGET", $OOO_INSTALL);
 link_gdb_py();
 link_pagein_files();
 link_ui_files();
 link_rdb_files();
-link_instdir("$OOO_BUILD/instdir/$TARGET", $OOO_INSTALL);
 
 if (!-f "$OOO_INSTALL/" . $brand_program_dir . "/ooenv") {
     my $ooenv;
commit 6fe1ff54c667a4f669feee6954dd9b859fd442b2
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Thu May 30 18:25:09 2013 +0200

    sidebar: Allow creation of toolboxes using Widget layout / .ui.
    
    Change-Id: Idc07614005a00401a51007b1a0aef00e17507daa

diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index c29f6b9..3395e7f 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -15,11 +15,14 @@
 #include <vcl/builder.hxx>
 #include <vcl/ctrl.hxx>
 
+#include <com/sun/star/frame/XFrame.hpp>
+
 /// This class is the base for the Widget Layout-based sidebar panels.
 class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
 {
 public:
-    PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
+    PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+            const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
     virtual ~PanelLayout() {}
 
     virtual Size GetOptimalSize() const;
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 31a8241..d699d50 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -23,6 +23,8 @@
 #include <boost/noncopyable.hpp>
 #include <boost/ptr_container/ptr_map.hpp>
 
+#include <com/sun/star/frame/XFrame.hpp>
+
 class ListBox;
 class NumericFormatter;
 class PopupMenu;
@@ -235,8 +237,13 @@ private:
         }
         bool operator()(const Window *pA, const Window *pB) const;
     };
+
+    /// XFrame to be able to extract labels and other properties of the UNO commands (like of .uno:Bold).
+    com::sun::star::uno::Reference<com::sun::star::frame::XFrame> m_xFrame;
+
 public:
-    VclBuilder(Window *pParent, OUString sUIRootDir, OUString sUIFile, OString sID = OString());
+    VclBuilder(Window *pParent, OUString sUIRootDir, OUString sUIFile, OString sID = OString(),
+            const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame = com::sun::star::uno::Reference<com::sun::star::frame::XFrame>());
     ~VclBuilder();
     Window *get_widget_root();
     //sID must exist and be of type T
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 3b1f69e..501eeed 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -28,6 +28,8 @@
 #include <vcl/timer.hxx>
 #include <vector>
 
+#include <com/sun/star/frame/XFrame.hpp>
+
 class UserDrawEvent;
 
 struct ImplToolItem;
@@ -333,9 +335,15 @@ public:
     virtual sal_Bool        Docking( const Point& rPos, Rectangle& rRect );
     virtual void        EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
     virtual void        Resizing( Size& rSize );
+    virtual Size        GetOptimalSize() const;
 
     void                InsertItem( const ResId& rResId,
                                     sal_uInt16 nPos = TOOLBOX_APPEND );
+    /// Insert a command (like '.uno:Save').
+    void                InsertItem( const OUString& rCommand,
+                                    const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
+                                    ToolBoxItemBits nBits = 0,
+                                    sal_uInt16 nPos = TOOLBOX_APPEND );
     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
                                     ToolBoxItemBits nBits = 0,
                                     sal_uInt16 nPos = TOOLBOX_APPEND );
@@ -386,10 +394,12 @@ public:
     sal_uInt16              GetItemPos( const Point& rPos ) const;
     sal_uInt16              GetItemId( sal_uInt16 nPos ) const;
     sal_uInt16              GetItemId( const Point& rPos ) const;
+    /// Map the command name (like .uno:Save) back to item id.
+    sal_uInt16          GetItemId( const OUString& rCommand ) const;
     Rectangle           GetItemRect( sal_uInt16 nItemId ) const;
     Rectangle           GetItemPosRect( sal_uInt16 nPos ) const;
 
-    // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
+    /// Retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
     Point               GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const;
 
     Rectangle           GetScrollRect() const;
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 17c1e30..03ff130 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -10,10 +10,10 @@
 #include <svx/sidebar/PanelLayout.hxx>
 #include <vcl/layout.hxx>
 
-PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
+PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame)
     : Control(pParent)
 {
-    m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID);
+    m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame);
 }
 
 Size PanelLayout::GetOptimalSize() const
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 3a58408..380c5e6 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -26,11 +26,14 @@
 #include <vcl/svapp.hxx>
 #include <vcl/tabctrl.hxx>
 #include <vcl/tabpage.hxx>
+#include <vcl/toolbox.hxx>
 #include <vcl/vclmedit.hxx>
 #include <svdata.hxx>
 #include <svids.hrc>
 #include <window.h>
 
+using namespace com::sun::star;
+
 #ifdef DISABLE_DYNLOADING
 #include <dlfcn.h>              //  For RTLD_DEFAULT
 #endif
@@ -135,13 +138,14 @@ namespace
 }
 #endif
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list