[Libreoffice-commits] core.git: Branch 'libreoffice-7-1-5' - sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 13 09:51:51 UTC 2021


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

New commits:
commit 312f9e1339d7925614a59ab08f0e65d2b5a9d87d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 12 12:19:22 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Jul 13 11:51:19 2021 +0200

    tdf#143291 the "none" item selected is distinct from nothing selected
    
    Change-Id: I2e012df85a5c28f462a6c643d7a9a88f8775e870
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118730
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index f3b1f2a1f5ec..f20e1016835a 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -407,6 +407,8 @@ SlideTransitionPane::SlideTransitionPane(
     Initialize(pDoc);
 }
 
+constexpr sal_uInt16 nNoneId = std::numeric_limits<sal_uInt16>::max();
+
 void SlideTransitionPane::Initialize(SdDrawDocument* pDoc)
 {
     mxFT_VARIANT = m_xBuilder->weld_label("variant_label");
@@ -442,7 +444,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();
@@ -581,14 +583,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 ) );
     }
@@ -772,9 +774,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();
@@ -815,7 +819,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
         }
         aResult.mbEffectAmbiguous = false;
     }
-    else if (mxVS_TRANSITION_ICONS->IsNoSelection())
+    else if (bNoneSelected)
     {
         aResult.mbEffectAmbiguous = false;
     }
@@ -1022,7 +1026,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