include/sfx2/tbxctrl.hxx | 12 --- include/svx/tbcontrl.hxx | 5 + reportdesign/source/ui/inc/toolboxcontroller.hxx | 4 - sfx2/source/toolbox/tbxitem.cxx | 21 ------ svx/source/sidebar/PanelFactory.cxx | 2 svx/source/sidebar/text/TextPropertyPanel.cxx | 77 +---------------------- svx/source/sidebar/text/TextPropertyPanel.hxx | 35 ---------- svx/source/tbxctrls/tbcontrl.cxx | 13 +++ sw/source/uibase/docvw/edtwin.cxx | 6 - sw/source/uibase/inc/edtwin.hxx | 14 +--- sw/source/uibase/shells/textsh1.cxx | 12 +-- 11 files changed, 40 insertions(+), 161 deletions(-)
New commits: commit e945999b3ef852faa237e028687b444668d9a703 Author: Maxim Monastirsky <[email protected]> Date: Sun Jan 8 01:57:42 2017 +0200 TextPropertyPanel cleanup Change-Id: If9fe62643ad33c2d832b146a5dc7248dbba32f1a diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index ebe0191..242f8b1 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 cad648c..12b9092 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 e3d3b4e..e75c6c5 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; }; commit a1f97ed2aa4b8f2c91d4b87fb59c8937523c2ba4 Author: Maxim Monastirsky <[email protected]> Date: Fri Jan 6 15:09:55 2017 +0200 XSubToolbarController is only used by SvxColorToolBoxControl Change-Id: I10c31aa9c773649c99b52c2d34cb648a37bf42ac diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index f6373c3..96b45af 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -27,7 +27,6 @@ #include <vcl/fixed.hxx> #include <vcl/floatwin.hxx> #include <comphelper/processfactory.hxx> -#include <cppuhelper/implbase.hxx> #include <sfx2/ctrlitem.hxx> #include <sfx2/sfxstatuslistener.hxx> #include <svtools/toolboxcontroller.hxx> @@ -135,9 +134,7 @@ public: */ struct SfxToolBoxControl_Impl; -class SFX2_DLLPUBLIC SfxToolBoxControl: - public cppu::ImplInheritanceHelper< - svt::ToolboxController, css::frame::XSubToolbarController> +class SFX2_DLLPUBLIC SfxToolBoxControl: public svt::ToolboxController { friend class SfxPopupWindow; friend struct SfxTbxCtrlFactory; @@ -184,12 +181,6 @@ public: virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& rParent ) throw (css::uno::RuntimeException, std::exception) override; - // XSubToolbarController - virtual sal_Bool SAL_CALL opensSubToolbar( ) throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getSubToolbarName( ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL functionSelected( const OUString& aCommand ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL updateImage( ) throw (css::uno::RuntimeException, std::exception) override; - public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index bf80838..3d923e1 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -206,7 +206,8 @@ friend class SfxStyleControllerItem_Impl; typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; -class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl +class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< SfxToolBoxControl, + css::frame::XSubToolbarController > { std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater; PaletteManager m_aPaletteManager; @@ -227,6 +228,8 @@ public: // XSubToolbarController virtual sal_Bool SAL_CALL opensSubToolbar() throw (css::uno::RuntimeException, std::exception) override; + virtual OUString SAL_CALL getSubToolbarName() throw (css::uno::RuntimeException, std::exception) override; + virtual void SAL_CALL functionSelected( const OUString& rCommand ) throw (css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL updateImage() throw (css::uno::RuntimeException, std::exception) override; void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction); diff --git a/reportdesign/source/ui/inc/toolboxcontroller.hxx b/reportdesign/source/ui/inc/toolboxcontroller.hxx index 74e597d..288811a 100644 --- a/reportdesign/source/ui/inc/toolboxcontroller.hxx +++ b/reportdesign/source/ui/inc/toolboxcontroller.hxx @@ -30,12 +30,12 @@ #include <com/sun/star/frame/XSubToolbarController.hpp> #include <cppuhelper/implbase2.hxx> -class SfxToolBoxControl; +class SvxColorToolBoxControl; namespace rptui { typedef ::cppu::ImplHelper2 < css::lang::XServiceInfo, css::frame::XSubToolbarController> TToolboxController_BASE; - typedef rtl::Reference<SfxToolBoxControl> TToolbarHelper; + typedef rtl::Reference<SvxColorToolBoxControl> TToolbarHelper; class OToolboxController : public ::svt::ToolboxController ,public TToolboxController_BASE diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index ab32b92..1378d0f 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -538,27 +538,6 @@ throw ( css::uno::RuntimeException, std::exception ) } } -// XSubToolbarController -sal_Bool SAL_CALL SfxToolBoxControl::opensSubToolbar() throw (css::uno::RuntimeException, std::exception) -{ - return false; -} - -OUString SAL_CALL SfxToolBoxControl::getSubToolbarName() throw (css::uno::RuntimeException, std::exception) -{ - return OUString(); -} - -void SAL_CALL SfxToolBoxControl::functionSelected( const OUString& /*aCommand*/ ) throw (css::uno::RuntimeException, std::exception) -{ - // must be implemented by sub-class -} - -void SAL_CALL SfxToolBoxControl::updateImage() throw (css::uno::RuntimeException, std::exception) -{ - // must be implemented by sub-class -} - // XToolbarController void SAL_CALL SfxToolBoxControl::execute( sal_Int16 KeyModifier ) throw (css::uno::RuntimeException, std::exception) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 3362174b..cf449f9 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2766,7 +2766,7 @@ SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ): - SfxToolBoxControl( nSlotId, nId, rTbx ), + ImplInheritanceHelper( nSlotId, nId, rTbx ), m_bSplitButton(dynamic_cast< sfx2::sidebar::SidebarToolBox* >(&rTbx) == nullptr), m_aColorSelectFunction(PaletteManager::DispatchColorCommand) { @@ -2909,6 +2909,17 @@ void SvxColorToolBoxControl::updateImage() } } +OUString SvxColorToolBoxControl::getSubToolbarName() + throw (css::uno::RuntimeException, std::exception) +{ + return OUString(); +} + +void SvxColorToolBoxControl::functionSelected( const OUString& /*rCommand*/ ) + throw (css::uno::RuntimeException, std::exception) +{ +} + SfxToolBoxControl* SvxColorToolBoxControl::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) { return new SvxColorToolBoxControl( nSlotId, nId, rTbx ); commit 215953f9814f43d51a610fde9d3ee966a2981063 Author: Maxim Monastirsky <[email protected]> Date: Fri Jan 6 14:48:00 2017 +0200 There is no SfxToolbox class Change-Id: I30dd797921420a4009455841052f5c5436f4a93b diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index 6de923d..f6373c3 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -139,7 +139,6 @@ class SFX2_DLLPUBLIC SfxToolBoxControl: public cppu::ImplInheritanceHelper< svt::ToolboxController, css::frame::XSubToolbarController> { -friend class SfxToolbox; friend class SfxPopupWindow; friend struct SfxTbxCtrlFactory; commit b5b4ad78a455efcb3a810016b33293deed5e145d Author: Maxim Monastirsky <[email protected]> Date: Fri Jan 6 14:33:59 2017 +0200 These don't have to be static Change-Id: I448d1f2f292ce379cbce0083dc2c5230a7f6ce1b diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 26e5014..17b60d9 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -185,12 +185,6 @@ QuickHelpData* SwEditWin::m_pQuickHlpData = nullptr; long SwEditWin::m_nDDStartPosY = 0; long SwEditWin::m_nDDStartPosX = 0; -/** - * The actual color used by the button is set in svx/source/tbxctrls/tbxcolorupdate.cxx - * (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) . - */ -Color SwEditWin::m_aWaterCanTextBackColor(COL_YELLOW); -Color SwEditWin::m_aWaterCanTextColor(COL_RED); extern bool g_bExecuteDrag; diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index bc39060..a6596b9 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -73,8 +73,8 @@ friend void PageNumNotify( SwViewShell* pVwSh, static long m_nDDStartPosX, m_nDDStartPosY; - static Color m_aWaterCanTextColor; // text color; for the watering can - static Color m_aWaterCanTextBackColor; // text background; for the watering can + Color m_aWaterCanTextColor; // text color; for the watering can + Color m_aWaterCanTextBackColor; // text background; for the watering can /* * timer and handler for scrolling on when the mousepointer @@ -249,14 +249,12 @@ public: void StartExecuteDrag(); void DragFinished(); - static const Color& GetWaterCanTextColor() { return m_aWaterCanTextColor; } + const Color& GetWaterCanTextColor() { return m_aWaterCanTextColor; } + void SetWaterCanTextColor(const Color& rCol ) { m_aWaterCanTextColor = rCol; } - static void SetWaterCanTextColor(const Color& rCol ) { m_aWaterCanTextColor = rCol; } + const Color& GetWaterCanTextBackColor() { return m_aWaterCanTextBackColor; } + void SetWaterCanTextBackColor(const Color& rCol ) { m_aWaterCanTextBackColor = rCol; } - static const Color& GetWaterCanTextBackColor() - { return m_aWaterCanTextBackColor; } - static void SetWaterCanTextBackColor(const Color& rCol ) - { m_aWaterCanTextBackColor = rCol; } void LockKeyInput(bool bSet){m_bLockInput = bSet;} const SwView &GetView() const { return m_rView; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 3216125..081b3c3 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1177,7 +1177,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { Color aSet = static_cast<const SvxColorItem*>(pItem)->GetValue(); SwEditWin& rEditWin = GetView().GetEditWin(); - SwEditWin::SetWaterCanTextColor(aSet); + rEditWin.SetWaterCanTextColor(aSet); SwApplyTemplate* pApply = rEditWin.GetApplyTemplate(); // If there is a selection, then set the color on it @@ -1200,7 +1200,7 @@ void SwTextShell::Execute(SfxRequest &rReq) aSet = COL_TRANSPARENT; SwEditWin& rEdtWin = GetView().GetEditWin(); - SwEditWin::SetWaterCanTextBackColor(aSet); + rEdtWin.SetWaterCanTextBackColor(aSet); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) @@ -1249,9 +1249,9 @@ void SwTextShell::Execute(SfxRequest &rReq) // and reopened, its color resets, while SwEditWin still holds the old one. Color aSet = static_cast<const SvxColorItem*>(pItem)->GetValue(); if( nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) - SwEditWin::SetWaterCanTextBackColor(aSet); + rEdtWin.SetWaterCanTextBackColor(aSet); else - SwEditWin::SetWaterCanTextColor(aSet); + rEdtWin.SetWaterCanTextColor(aSet); } SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); @@ -1262,7 +1262,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { rWrtSh.StartUndo( UNDO_INSATTR ); rWrtSh.SetAttrItem( - SvxBrushItem( SwEditWin::GetWaterCanTextBackColor(), RES_CHRATR_BACKGROUND) ); + SvxBrushItem( rEdtWin.GetWaterCanTextBackColor(), RES_CHRATR_BACKGROUND) ); // Remove MS specific highlight when background is set rWrtSh.SetAttrItem( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); @@ -1287,7 +1287,7 @@ void SwTextShell::Execute(SfxRequest &rReq) } else rWrtSh.SetAttrItem( - SvxColorItem( SwEditWin::GetWaterCanTextColor(), RES_CHRATR_COLOR) ); + SvxColorItem( rEdtWin.GetWaterCanTextColor(), RES_CHRATR_COLOR) ); } else { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
