diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-08 01:57:42 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-08 16:07:28 +0200 |
commit | e945999b3ef852faa237e028687b444668d9a703 (patch) | |
tree | d3e05213f4a15d3e81d2f2c164f1b60b717117fb /svx/source/sidebar | |
parent | a1f97ed2aa4b8f2c91d4b87fb59c8937523c2ba4 (diff) |
TextPropertyPanel cleanup
Change-Id: If9fe62643ad33c2d832b146a5dc7248dbba32f1a
Diffstat (limited to 'svx/source/sidebar')
-rw-r--r-- | svx/source/sidebar/PanelFactory.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.cxx | 77 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.hxx | 35 |
3 files changed, 9 insertions, 105 deletions
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index ebe0191dbf79..242f8b1ccb04 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -132,7 +132,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( if (rsResourceURL.endsWith("/TextPropertyPanel")) { - pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, aContext); + pControl = TextPropertyPanel::Create(pParentWindow, xFrame); } else if (rsResourceURL.endsWith("/StylesPropertyPanel")) { diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index cad648cbf3d6..12b909210587 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -17,57 +17,32 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TextPropertyPanel.hrc" #include "TextPropertyPanel.hxx" -#include <editeng/kernitem.hxx> -#include <editeng/udlnitem.hxx> -#include <rtl/ref.hxx> -#include <sfx2/dispatch.hxx> -#include <svtools/unitconv.hxx> - #include <vcl/toolbox.hxx> using namespace css; -using namespace css::uno; namespace svx { namespace sidebar { VclPtr<vcl::Window> TextPropertyPanel::Create ( vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings, - const vcl::EnumContext& rContext) + const css::uno::Reference<css::frame::XFrame>& rxFrame) { if (pParent == nullptr) throw lang::IllegalArgumentException("no parent Window given to TextPropertyPanel::Create", nullptr, 0); if ( ! rxFrame.is()) throw lang::IllegalArgumentException("no XFrame given to TextPropertyPanel::Create", nullptr, 1); - if (pBindings == nullptr) - throw lang::IllegalArgumentException("no SfxBindings given to TextPropertyPanel::Create", nullptr, 2); - - return VclPtr<TextPropertyPanel>::Create( - pParent, - rxFrame, - pBindings, - rContext); -} -TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const vcl::EnumContext& /*rContext*/ ) - : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame), - maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this, OUString("FontHeight"), rxFrame), + return VclPtr<TextPropertyPanel>::Create(pParent, rxFrame); +} - maContext() +TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame ) + : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame) { - get(mpToolBoxFont, "fonteffects"); - get(mpToolBoxIncDec, "fontadjust"); - get(mpToolBoxSpacing, "spacingbar"); get(mpToolBoxFontColorSw, "colorbar_writer"); get(mpToolBoxFontColor, "colorbar_others"); get(mpToolBoxBackgroundColor, "colorbar_background"); - - //init state - mpHeightItem = nullptr; } TextPropertyPanel::~TextPropertyPanel() @@ -77,15 +52,10 @@ TextPropertyPanel::~TextPropertyPanel() void TextPropertyPanel::dispose() { - mpToolBoxFont.clear(); - mpToolBoxIncDec.clear(); - mpToolBoxSpacing.clear(); mpToolBoxFontColorSw.clear(); mpToolBoxFontColor.clear(); mpToolBoxBackgroundColor.clear(); - maFontSizeControl.dispose(); - PanelLayout::dispose(); } @@ -99,19 +69,9 @@ void TextPropertyPanel::HandleContextChange ( bool bWriterText = false; bool bDrawText = false; - bool bNeedTextSpacing = false; switch (maContext.GetCombinedContext_DI()) { - case CombinedEnumContext(Application::Calc, Context::Cell): - case CombinedEnumContext(Application::Calc, Context::Pivot): - // bNeedTextSpacing = false; - break; - - case CombinedEnumContext(Application::Calc, Context::EditCell): - bNeedTextSpacing = true; - break; - case CombinedEnumContext(Application::Calc, Context::DrawText): case CombinedEnumContext(Application::WriterVariants, Context::DrawText): case CombinedEnumContext(Application::WriterVariants, Context::Annotation): @@ -122,13 +82,11 @@ void TextPropertyPanel::HandleContextChange ( case CombinedEnumContext(Application::DrawImpress, Context::Draw): case CombinedEnumContext(Application::DrawImpress, Context::TextObject): case CombinedEnumContext(Application::DrawImpress, Context::Graphic): - bNeedTextSpacing = true; bDrawText = true; break; case CombinedEnumContext(Application::WriterVariants, Context::Text): case CombinedEnumContext(Application::WriterVariants, Context::Table): - bNeedTextSpacing = true; bWriterText = true; break; @@ -136,36 +94,11 @@ void TextPropertyPanel::HandleContextChange ( break; } - mpToolBoxSpacing->Enable(bNeedTextSpacing); mpToolBoxFontColor->Show(!bWriterText); mpToolBoxFontColorSw->Show(bWriterText); mpToolBoxBackgroundColor->Show(bDrawText); } -void TextPropertyPanel::NotifyItemUpdate ( - const sal_uInt16 nSID, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) -{ - switch(nSID) - { - case SID_ATTR_CHAR_FONTHEIGHT: - { - if ( eState >= SfxItemState::DEFAULT && dynamic_cast<const SvxFontHeightItem*>( pState) != nullptr ) - mpHeightItem = const_cast<SvxFontHeightItem*>(static_cast<const SvxFontHeightItem*>(pState)); - else - mpHeightItem = nullptr; - } - break; - case SID_ATTR_CHAR_KERNING: - { - mpToolBoxSpacing->Enable(bIsEnabled); - } - break; - } -} - } } // end of namespace svx::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index e3d3b4ecf060..e75c6c5d61b6 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -19,16 +19,8 @@ #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_TEXT_TEXTPROPERTYPANEL_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_TEXT_TEXTPROPERTYPANEL_HXX -#include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <vcl/EnumContext.hxx> -#include <svtools/ctrlbox.hxx> -#include <editeng/fhgtitem.hxx> - -#include <com/sun/star/ui/XSidebar.hpp> -#include <com/sun/star/frame/XToolbarController.hpp> - #include <svx/sidebar/PanelLayout.hxx> class ToolBox; @@ -37,8 +29,7 @@ namespace svx { namespace sidebar { class TextPropertyPanel : public PanelLayout, - public ::sfx2::sidebar::IContextChangeReceiver, - public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + public ::sfx2::sidebar::IContextChangeReceiver { public: virtual ~TextPropertyPanel() override; @@ -46,41 +37,21 @@ public: static VclPtr<vcl::Window> Create ( vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings, - const vcl::EnumContext& rContext); - + const css::uno::Reference<css::frame::XFrame>& rxFrame); virtual void HandleContextChange ( const vcl::EnumContext& rContext) override; - - virtual void NotifyItemUpdate( - const sal_uInt16 nSId, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) override; - TextPropertyPanel ( vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings, - const vcl::EnumContext& rContext); + const css::uno::Reference<css::frame::XFrame>& rxFrame); private: - //ui controls - VclPtr<ToolBox> mpToolBoxFont; - VclPtr<ToolBox> mpToolBoxIncDec; VclPtr<ToolBox> mpToolBoxSpacing; VclPtr<ToolBox> mpToolBoxFontColorSw; VclPtr<ToolBox> mpToolBoxFontColor; VclPtr<ToolBox> mpToolBoxBackgroundColor; - //control items - ::sfx2::sidebar::ControllerItem maFontSizeControl; - - SvxFontHeightItem* mpHeightItem; - vcl::EnumContext maContext; }; |