[Libreoffice-commits] core.git: include/svx svx/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 1 02:56:46 UTC 2021


 include/svx/selctrl.hxx         |    1 +
 svx/source/stbctrls/selctrl.cxx |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 6c897e5026a6819c2d706ccdc9720fb1b3f8bea2
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Sun Feb 21 21:01:57 2021 -0900
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Mon Mar 1 03:56:07 2021 +0100

    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 <raykowj at gmail.com>

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<const SfxUInt16Item*>(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: */


More information about the Libreoffice-commits mailing list