From 6c897e5026a6819c2d706ccdc9720fb1b3f8bea2 Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Sun, 21 Feb 2021 21:01:57 -0900 Subject: [PATCH] tdf#116136 don't show statusbar selection mode control tooltip in print preview. This patch also sets the control image disabled when in print preview. Change-Id: I497af2a50621ed6611a31f9b17b682caa82fa260 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111294 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- include/svx/selctrl.hxx | 1 + svx/source/stbctrls/selctrl.cxx | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/svx/selctrl.hxx b/include/svx/selctrl.hxx index 2b32e56ede70..75d7f8cc3a84 100644 --- a/include/svx/selctrl.hxx +++ b/include/svx/selctrl.hxx @@ -39,6 +39,7 @@ public: private: sal_uInt16 mnState; Image maImage; + bool mbFeatureEnabled; }; #endif diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index 2b028e0d71d3..845df5a5d367 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -100,15 +100,18 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId, StatusBar& rStb ) : SfxStatusBarControl( _nSlotId, _nId, rStb ), mnState( 0 ), - maImage(StockImage::Yes, RID_SVXBMP_SELECTION) + maImage(StockImage::Yes, RID_SVXBMP_SELECTION), + mbFeatureEnabled(false) { GetStatusBar().SetItemText( GetId(), "" ); + GetStatusBar().SetQuickHelpText(GetId(), u""); } void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) { - if ( SfxItemState::DEFAULT == eState ) + mbFeatureEnabled = SfxItemState::DEFAULT == eState; + if (mbFeatureEnabled) { DBG_ASSERT( dynamic_cast< const SfxUInt16Item* >(pState) != nullptr, "invalid item type" ); const SfxUInt16Item* pItem = static_cast(pState); @@ -121,8 +124,8 @@ void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState, bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt ) { - if (!rEvt.IsMiddle()) - return false; + if (!mbFeatureEnabled || !rEvt.IsMiddle()) + return true; ::tools::Rectangle aRect(rEvt.GetPosPixel(), Size(1, 1)); weld::Window* pPopupParent = weld::GetPopupParent(GetStatusBar(), aRect); @@ -174,7 +177,7 @@ void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt ) Point aPos( aRect.Left() + ( aControlRect.GetWidth() - aImgSize.Width() ) / 2, aRect.Top() + ( aControlRect.GetHeight() - aImgSize.Height() ) / 2 ); - pDev->DrawImage( aPos, maImage ); + pDev->DrawImage(aPos, maImage, mbFeatureEnabled ? DrawImageFlags::NONE : DrawImageFlags::Disable); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- 2.11.4.GIT