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@gmail.com>
diff --git a/include/svx/selctrl.hxx b/include/svx/selctrl.hxx
index 2b32e56..75d7f8c 100644
--- a/include/svx/selctrl.hxx
+++ b/include/svx/selctrl.hxx
@@ -39,6 +39,7 @@
private:
    sal_uInt16 mnState;
    Image maImage;
    bool mbFeatureEnabled;
};

#endif
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
index 2b028e0..845df5a 100644
--- a/svx/source/stbctrls/selctrl.cxx
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -100,15 +100,18 @@
                                                  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 @@

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 @@
    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: */