tdf#161853 vcl: Simplify SvxIconChoiceCtrl_Impl::SetEntryTextMode

It never gets called with a null SvxIconChoiceCtrlEntry,
so change the param from pointer to reference
(also in `SvtIconChoiceCtrl::SetEntryTextMode`), and drop
the handling for the never-reached null case.

This also makes SvtIconChoiceCtrl::eTextMode become unused,
so drop it.

Change-Id: I428c47dcbc85568009be3454ffa7a8b977c6d095
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169836
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
diff --git a/include/vcl/toolkit/ivctrl.hxx b/include/vcl/toolkit/ivctrl.hxx
index 29ea93d..ad7aa62 100644
--- a/include/vcl/toolkit/ivctrl.hxx
+++ b/include/vcl/toolkit/ivctrl.hxx
@@ -223,7 +223,7 @@ public:
    SvxIconChoiceCtrlEntry* GetSelectedEntry() const;

#ifdef DBG_UTIL
    void                    SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry );
    void                    SetEntryTextMode(SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry& rEntry);
#endif

    tools::Rectangle           GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx
index 1ff043d..6f6030b 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -146,7 +146,6 @@ class SvxIconChoiceCtrl_Impl
    LocalFocus              aFocus;                             // Data for focusrect
    ::vcl::AccessibleFactoryAccess aAccFactory;

    SvxIconChoiceCtrlTextMode eTextMode;
    SelectionMode           eSelectionMode;
    sal_Int32               nSelectionCount;
    SvxIconChoiceCtrlPositionMode ePositionMode;
@@ -373,7 +372,7 @@ public:
#ifdef DBG_UTIL
    void                SetEntryTextMode(
                            SvxIconChoiceCtrlTextMode,
                            SvxIconChoiceCtrlEntry* pEntry
                            SvxIconChoiceCtrlEntry& rEntry
                        );
#endif
    size_t              GetEntryCount() const { return maEntries.size(); }
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 97d38a3..ed52e38 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -65,7 +65,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
    nFlags(IconChoiceFlags::NONE), nUserEventAdjustScrBars(nullptr),
    pCurHighlightFrame(nullptr), bHighlightFramePressed(false), pHead(nullptr), pCursor(nullptr),
    pHdlEntry(nullptr),
    pAnchor(nullptr), eTextMode(SvxIconChoiceCtrlTextMode::Short),
    pAnchor(nullptr),
    eSelectionMode(SelectionMode::Multiple), ePositionMode(SvxIconChoiceCtrlPositionMode::Free),
    bUpdateMode(true)
{
@@ -979,12 +979,12 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
            if( rKEvt.GetKeyCode().IsShift() )
            {
                if( pCursor )
                    pView->SetEntryTextMode( SvxIconChoiceCtrlTextMode::Full, pCursor );
                    pView->SetEntryTextMode(SvxIconChoiceCtrlTextMode::Full, *pCursor);
            }
            if( rKEvt.GetKeyCode().IsMod1() )
            {
                if( pCursor )
                    pView->SetEntryTextMode( SvxIconChoiceCtrlTextMode::Short, pCursor );
                    pView->SetEntryTextMode(SvxIconChoiceCtrlTextMode::Short, *pCursor);
            }
            break;
#endif
@@ -2401,25 +2401,14 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, DocRectChangedHdl, Timer *, void)
}

#ifdef DBG_UTIL
void SvxIconChoiceCtrl_Impl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry )
void SvxIconChoiceCtrl_Impl::SetEntryTextMode(SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry& rEntry)
{
    if( !pEntry )
    if (rEntry.eTextMode != eMode)
    {
        if( eTextMode != eMode )
        {
            eTextMode = eMode;
            Arrange( true, 0, 0 );
        }
    }
    else
    {
        if( pEntry->eTextMode != eMode )
        {
            pEntry->eTextMode = eMode;
            InvalidateEntry( pEntry );
            pView->Invalidate( GetEntryBoundRect( pEntry ) );
            AdjustVirtSize( pEntry->aRect );
        }
        rEntry.eTextMode = eMode;
        InvalidateEntry(&rEntry );
        pView->Invalidate(GetEntryBoundRect(&rEntry));
        AdjustVirtSize(rEntry.aRect);
    }
}
#endif
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index f8e0985..2afe55a 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -239,9 +239,9 @@ void SvtIconChoiceCtrl::Command(const CommandEvent& rCEvt)
}

#ifdef DBG_UTIL
void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry )
void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry& rEntry )
{
    _pImpl->SetEntryTextMode( eMode, pEntry );
    _pImpl->SetEntryTextMode(eMode, rEntry);
}
#endif