sd: stop refreshing SlideTransitionPane on every shape change

SlideTransitionPane's EventMultiplexerListener default branch called
onSelectionChanged + onChangeCurrentPage on every non-Disposing event,
including ShapeChanged.

ShapeChanged fires for every text edit on any view, so with several
users editing the panel re-emitted its full notebookbar state hundreds
of times to every view, although the page-level transition properties
had not changed.

Sync SlideTransitionPane with CustomAnimationPane so SlideTransitionPane
handles only the same explicit cases. And use the same sort of setup
as that panel does, e.g. take the controller from the ViewShellBase directly like:

commit ec58f5e318
Date:   Thu Dec 16 09:12:41 2004 +0000

    2004/12/10 10:11:53 af 1.2.10.1: #i38630# Using the right controller after views have changed.

Transitions panel update sent on every shape edit since:

commit c4e0d6596d
Date:   Thu Jun 2 15:43:45 2016 +0200

    notebookbar: added slide transition tab

To reproduce: open the Slide Transition sidebar in Impress, click into
a text frame and type. updateControls() fires twice per keystroke via
the ShapeChanged -> default path. With this change it only fires on
actual slide selection changes.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I12a44e17e982f0502fe8fbf6b61f41cb3ac26e07
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3236
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 9a49d09e20b0687b30c9603d427ae2bd87d20638)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206639
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Caolán McNamara
2026-06-16 01:20:16 +02:00
committed by Xisco Fauli
parent 0447d0cc95
commit 64b1bf3a65
2 changed files with 17 additions and 35 deletions
+16 -31
View File
@@ -27,6 +27,7 @@
#include <DrawDocShell.hxx>
#include <SlideSorterViewShell.hxx>
#include <unomodel.hxx>
#include <DrawController.hxx>
#include <drawdoc.hxx>
#include <sdmod.hxx>
#include <sdpage.hxx>
@@ -376,10 +377,9 @@ SlideTransitionPane::SlideTransitionPane(
mxRepeatAutoFrame(m_xBuilder->weld_frame("repeat_after_frame")),
mbHasSelection( false ),
mbUpdatingControls( false ),
mbIsMainViewChangePending( false ),
maLateInitTimer("sd SlideTransitionPane maLateInitTimer")
{
Initialize(mpDrawDoc);
Initialize();
}
css::ui::LayoutSize SlideTransitionPane::GetHeightForWidth(const sal_Int32 /*nWidth*/)
@@ -388,7 +388,7 @@ css::ui::LayoutSize SlideTransitionPane::GetHeightForWidth(const sal_Int32 /*nWi
return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight);
}
void SlideTransitionPane::Initialize(SdDrawDocument* pDoc)
void SlideTransitionPane::Initialize()
{
mxLB_VARIANT = m_xBuilder->weld_combo_box(u"variant_list"_ustr);
mxCBX_duration = m_xBuilder->weld_metric_spin_button(u"transition_duration"_ustr, FieldUnit::SECOND);
@@ -414,11 +414,8 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc)
mxMF_REPEAT_AUTO_AFTER->set_width_chars(nWidthChars);
mxCBX_duration->set_width_chars(nWidthChars);
if( pDoc )
mxModel = pDoc->getUnoModel();
// TODO: get correct view
if( mxModel.is())
mxView.set( mxModel->getCurrentController(), uno::UNO_QUERY );
// Take the controller from the ViewShellBase directly.
mxView = mrBase.GetDrawController();
// set defaults
mxCB_AUTO_PREVIEW->set_active(true); // automatic preview on
@@ -982,39 +979,27 @@ IMPL_LINK(SlideTransitionPane,EventMultiplexerListener,
onChangeCurrentPage();
break;
case EventMultiplexerEventId::MainViewRemoved:
mxView.clear();
onSelectionChanged();
onChangeCurrentPage();
break;
case EventMultiplexerEventId::MainViewAdded:
mbIsMainViewChangePending = true;
break;
case EventMultiplexerEventId::ConfigurationUpdated:
if (mbIsMainViewChangePending)
// At this moment the controller may not yet been set at model
// or ViewShellBase. Take it from the view shell passed with
// the event.
if (auto pMainViewShell = mrBase.GetMainViewShell().get())
{
mbIsMainViewChangePending = false;
// At this moment the controller may not yet been set at
// model or ViewShellBase. Take it from the view shell
// passed with the event.
if (mrBase.GetMainViewShell() != nullptr)
if (pMainViewShell->GetShellType() == ViewShell::ST_IMPRESS)
{
mxView.set(mrBase.GetController(), css::uno::UNO_QUERY);
mxView = mrBase.GetDrawController();
onSelectionChanged();
onChangeCurrentPage();
break;
}
}
[[fallthrough]];
case EventMultiplexerEventId::MainViewRemoved:
mxView.clear();
updateControls();
break;
default:
if (rEvent.meEventId != EventMultiplexerEventId::Disposing)
{
onSelectionChanged();
onChangeCurrentPage();
}
break;
}
}
+1 -4
View File
@@ -37,7 +37,6 @@
#include <map>
class SdDrawDocument;
class SdXImpressDocument;
namespace com::sun::star::drawing { class XDrawView; }
namespace sdtools { class EventMultiplexerEvent; }
@@ -93,7 +92,7 @@ private:
::sd::slidesorter::SharedPageSelection getSelectedPages() const;
void Initialize(SdDrawDocument* pDoc);
void Initialize();
DECL_LINK( ApplyToAllButtonClicked, weld::Button&, void );
DECL_LINK( PlayButtonClicked, weld::Button&, void );
@@ -134,13 +133,11 @@ private:
std::unique_ptr<weld::CheckButton> mxCB_AUTO_PREVIEW;
css::uno::Reference< css::drawing::XDrawView > mxView;
rtl::Reference< SdXImpressDocument > mxModel;
std::unordered_map<OUString, std::unique_ptr<TransitionEntry>> maTranstionMap;
bool mbHasSelection;
bool mbUpdatingControls;
bool mbIsMainViewChangePending;
std::vector<OUString> maSoundList;
mutable OUString maCurrentSoundFile;