office-gobmx/sc/inc/scopetools.hxx
Luboš Luňák 648a4b30b3 do not destroy broadcasters and then recreate again (tdf#134268)
Sorting ends tells all listeners on all the sorted cells to end
listening to stop updates, then sorts the cells and starts
listening again. This will cause all broadcasters for the sorted
cells to temporarily stop having any listeners, so they'll be
deleted and removed from the mdds vector (which may additionally
cause moving large parts of the mdds vector repeatedly). And
since all listeners will want to listen again after the sort,
this will all need to be reconstructed. To avoid this,
temporarily block this removal and then later just checks
and remove any possibly left-over broadcasters that ended up
with no listeners.

Change-Id: Ie2d41d9acd7b657cf31a445870ce7f18d28d5ebb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131069
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-06 08:19:51 +01:00

109 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "scdllapi.h"
class ScDocument;
class ScColumn;
namespace vcl
{
class Window;
}
namespace sc
{
/**
* Temporarily switch on/off auto calculation mode.
*/
class SC_DLLPUBLIC AutoCalcSwitch
{
ScDocument& mrDoc;
bool mbOldValue;
AutoCalcSwitch(AutoCalcSwitch const&) = delete;
AutoCalcSwitch(AutoCalcSwitch&&) = delete;
AutoCalcSwitch& operator=(AutoCalcSwitch const&) = delete;
AutoCalcSwitch& operator=(AutoCalcSwitch&&) = delete;
public:
AutoCalcSwitch(ScDocument& rDoc, bool bAutoCalc);
~AutoCalcSwitch();
};
class ExpandRefsSwitch
{
ScDocument& mrDoc;
bool mbOldValue;
public:
ExpandRefsSwitch(ScDocument& rDoc, bool bExpandRefs);
~ExpandRefsSwitch();
};
class SC_DLLPUBLIC UndoSwitch
{
ScDocument& mrDoc;
bool mbOldValue;
public:
UndoSwitch(ScDocument& rDoc, bool bUndo);
~UndoSwitch();
};
class IdleSwitch
{
ScDocument& mrDoc;
bool mbOldValue;
public:
IdleSwitch(ScDocument& rDoc, bool bEnableIdle);
~IdleSwitch();
};
/// Wrapper for ScDocument::DelayFormulaGrouping()
class DelayFormulaGroupingSwitch
{
ScDocument& mrDoc;
bool const mbOldValue;
public:
DelayFormulaGroupingSwitch(ScDocument& rDoc, bool delay);
~DelayFormulaGroupingSwitch() COVERITY_NOEXCEPT_FALSE;
void reset();
};
/// Wrapper for ScDocument::EnableDelayStartListeningFormulaCells()
class DelayStartListeningFormulaCells
{
ScColumn& mColumn;
bool const mbOldValue;
public:
DelayStartListeningFormulaCells(ScColumn& column, bool delay);
DelayStartListeningFormulaCells(ScColumn& column);
DelayStartListeningFormulaCells(const DelayStartListeningFormulaCells&) = delete;
~DelayStartListeningFormulaCells();
void set();
};
/// Wrapper for ScDocument::EnableDelayDeletingBroadcasters()
class DelayDeletingBroadcasters
{
ScDocument& mDoc;
const bool mOldValue;
public:
DelayDeletingBroadcasters(ScDocument& doc);
~DelayDeletingBroadcasters();
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */