diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-13 16:13:46 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-20 20:13:05 -0400 |
commit | 410154e76c229a862b43a9eee6ffc44b845f6ffd (patch) | |
tree | 4388480966555309163b17d51d5d0a4c743d68eb /sc/inc | |
parent | 180c2fe7432f444fcf8f933c413c63c56dd5c27a (diff) |
Collect all empty broadcasters and remove them in one go later.
This is to avoid repeated calls to set_empty() on the broadcaster array
which causes array reallocation on each call. Instead, we can store the
segments of broadcasters to be deleted later, and call set_empty() on
those segments to reduce the number of calls to set_empty().
The meat of this is not implemented yet, as EndListeningContext is still
empty.
Change-Id: I914bc2881acee3902c4fec0f6c21aaf4d2489df8
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/column.hxx | 2 | ||||
-rw-r--r-- | sc/inc/document.hxx | 3 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 7 | ||||
-rw-r--r-- | sc/inc/listenercontext.hxx | 34 | ||||
-rw-r--r-- | sc/inc/refdata.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 |
6 files changed, 50 insertions, 0 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 1fe289099577..88950318af23 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -48,6 +48,7 @@ namespace editeng { class SvxBorderLine; } namespace sc { struct FormulaGroupContext; + class EndListeningContext; } class Fraction; @@ -439,6 +440,7 @@ public: void StartListening( SvtListener& rLst, SCROW nRow ); void EndListening( SvtListener& rLst, SCROW nRow ); + void EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener ); void MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow ); void StartAllListeners(); void StartNeededListeners(); // only for cells where NeedsListening()==true diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 454cca8c1e01..eeec34935a81 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -49,6 +49,7 @@ namespace editeng { class SvxBorderLine; } namespace sc { struct FormulaGroupContext; + class EndListeningContext; } class SvxFontItem; @@ -1754,6 +1755,8 @@ public: void EndListeningCell( const ScAddress& rAddress, SvtListener* pListener ); + void EndListeningCell( sc::EndListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener ); + void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells ); void PutInFormulaTree( ScFormulaCell* pCell ); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 2d0d04cc7de8..e081353632de 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -28,6 +28,12 @@ #include <set> +namespace sc { + +class EndListeningContext; + +} + class ScTokenArray; struct ScSimilarFormulaDelta; @@ -309,6 +315,7 @@ public: void StartListeningTo( ScDocument* pDoc ); void EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr = NULL, ScAddress aPos = ScAddress() ); + void EndListeningTo( sc::EndListeningContext& rCxt ); }; #endif diff --git a/sc/inc/listenercontext.hxx b/sc/inc/listenercontext.hxx new file mode 100644 index 000000000000..584671342444 --- /dev/null +++ b/sc/inc/listenercontext.hxx @@ -0,0 +1,34 @@ +/* -*- 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/. + */ + +#ifndef SC_LISTENERCONTEXT_HXX +#define SC_LISTENERCONTEXT_HXX + +#include "address.hxx" + +class ScDocument; + +namespace sc { + +class EndListeningContext +{ + ScDocument& mrDoc; +public: + EndListeningContext(ScDocument& rDoc); + ScDocument& getDoc(); + + void addEmptyBroadcasterPosition(SCCOL nCol, SCROW nRow, SCTAB nTab); + void purgeEmptyBroadcasters(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index a19f1df5e51b..6d6fe79bdfb0 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -91,6 +91,8 @@ struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) int /// In external references nTab is -1 inline bool ValidExternal() const; + ScAddress toAbs( const ScAddress& rPos ) const; + void SmartRelAbs( const ScAddress& rPos ); void CalcRelFromAbs( const ScAddress& rPos ); void CalcAbsIfRel( const ScAddress& rPos ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index c58122898e0f..f805cf43f294 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -49,6 +49,7 @@ namespace com { namespace sun { namespace star { namespace sc { struct FormulaGroupContext; + class EndListeningContext; } class SfxItemSet; @@ -932,6 +933,7 @@ private: void StartListening( const ScAddress& rAddress, SvtListener* pListener ); void EndListening( const ScAddress& rAddress, SvtListener* pListener ); + void EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener ); void StartAllListeners(); void StartNeededListeners(); // only for cells where NeedsListening()==TRUE void SetRelNameDirty(); |