[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 12 19:40:18 UTC 2021


 sd/source/ui/animations/SlideTransitionPane.cxx |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 57980fa601a868e50d6afd0ca5b5c2f15eeb9539
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 12 12:19:22 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 12 21:39:43 2021 +0200

    tdf#143291 the "none" item selected is distinct from nothing selected
    
    Change-Id: I2e012df85a5c28f462a6c643d7a9a88f8775e870
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118776
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 0fc198a9c316..b3c3d4b44863 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -411,6 +411,8 @@ css::ui::LayoutSize SlideTransitionPane::GetHeightForWidth(const sal_Int32 /*nWi
     return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight);
 }
 
+constexpr sal_uInt16 nNoneId = std::numeric_limits<sal_uInt16>::max();
+
 void SlideTransitionPane::Initialize(SdDrawDocument* pDoc)
 {
     mxFT_VARIANT = m_xBuilder->weld_label("variant_label");
@@ -445,7 +447,7 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc)
 
     // dummy list box of slide transitions for startup.
     mxVS_TRANSITION_ICONS->InsertItem(
-        0, Image( StockImage::Yes, "sd/cmd/transition-none.png" ),
+        nNoneId, Image( StockImage::Yes, "sd/cmd/transition-none.png" ),
         SdResId( STR_SLIDETRANSITION_NONE ),
         VALUESET_APPEND, /* show legend */ true );
     mxVS_TRANSITION_ICONS->Recalculate();
@@ -566,14 +568,14 @@ void SlideTransitionPane::updateControls()
     if( aEffect.mbEffectAmbiguous )
     {
         SAL_WARN( "sd.transitions", "Unusual, ambiguous transition effect" );
-        mxVS_TRANSITION_ICONS->SetNoSelection();
+        mxVS_TRANSITION_ICONS->SelectItem(nNoneId);
     }
     else
     {
         // ToDo: That 0 is "no transition" is documented nowhere except in the
         // CTOR of sdpage
         if( aEffect.mnType == 0 )
-            mxVS_TRANSITION_ICONS->SetNoSelection();
+            mxVS_TRANSITION_ICONS->SelectItem(nNoneId);
         else
             updateVariants( getPresetOffset( aEffect ) );
     }
@@ -757,9 +759,11 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
     impl::TransitionEffect aResult;
     aResult.setAllAmbiguous();
 
+    bool bNoneSelected = mxVS_TRANSITION_ICONS->IsNoSelection() || mxVS_TRANSITION_ICONS->GetSelectedItemId() == nNoneId;
+
     // check first (aResult might be overwritten)
     if(  mxVS_TRANSITION_ICONSWin->get_sensitive() &&
-        !mxVS_TRANSITION_ICONS->IsNoSelection() &&
+        !bNoneSelected &&
          mxVS_TRANSITION_ICONS->GetSelectedItemId() > 0 )
     {
         const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList();
@@ -800,7 +804,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
         }
         aResult.mbEffectAmbiguous = false;
     }
-    else if (mxVS_TRANSITION_ICONS->IsNoSelection())
+    else if (bNoneSelected)
     {
         aResult.mbEffectAmbiguous = false;
     }
@@ -1007,7 +1011,7 @@ void SlideTransitionPane::updateVariants( size_t nPresetOffset )
 {
     const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList();
     mxLB_VARIANT->clear();
-    mxVS_TRANSITION_ICONS->SetNoSelection();
+    mxVS_TRANSITION_ICONS->SelectItem(nNoneId);
 
     if( nPresetOffset >= rPresetList.size() )
     {


More information about the Libreoffice-commits mailing list