diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-12 22:18:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-18 08:31:55 -0500 |
commit | 2030b9ac6c68ba6f15b0283e0b4e57ae49bd67b0 (patch) | |
tree | dc7ad2b2f890ea0ac614d7820c2e655c84327c3f /sc/inc | |
parent | 192f6a41444b62feae03185975c120f770e2938f (diff) |
Dedicated listener type tailored for formula groups.
Right now, it's only used when loading an xlsx file. But eventually
this one should be used everywhere.
Change-Id: I216c3a9a33c4b8040e8284d59299e0637471fb50
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/bulkdatahint.hxx | 43 | ||||
-rw-r--r-- | sc/inc/document.hxx | 7 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 12 | ||||
-rw-r--r-- | sc/inc/grouparealistener.hxx | 73 | ||||
-rw-r--r-- | sc/inc/simplehintids.hxx | 9 |
5 files changed, 135 insertions, 9 deletions
diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx new file mode 100644 index 000000000000..31c13fb9ea2c --- /dev/null +++ b/sc/inc/bulkdatahint.hxx @@ -0,0 +1,43 @@ +/* -*- 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 INCLUDED_SC_BULKDATAHINT_HXX +#define INCLUDED_SC_BULKDATAHINT_HXX + +#include <simplehintids.hxx> + +class ScDocument; + +namespace sc { + +class ColumnSpanSet; + +class BulkDataHint : public SfxSimpleHint +{ + struct Impl; + Impl* mpImpl; + + BulkDataHint( const BulkDataHint& ); + BulkDataHint& operator= ( const BulkDataHint& ); + +public: + BulkDataHint( ScDocument& rDoc, const ColumnSpanSet* pSpans ); + virtual ~BulkDataHint(); + + void setSpans( const ColumnSpanSet* pSpans ); + const ColumnSpanSet* getSpans() const; + + ScDocument& getDoc(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 3124a4cc9826..f766f5497e4a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1853,10 +1853,9 @@ private: static ScRecursionHelper* CreateRecursionHelperInstance(); public: - void StartListeningArea( const ScRange& rRange, - SvtListener* pListener ); - void EndListeningArea( const ScRange& rRange, - SvtListener* pListener ); + void StartListeningArea( const ScRange& rRange, bool bGroupListening, SvtListener* pListener ); + + void EndListeningArea( const ScRange& rRange, bool bGroupListening, SvtListener* pListener ); /** Broadcast wrapper, calls rHint.GetCell()->Broadcast() and AreaBroadcast() and TrackFormulas() and conditional format list diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index b65504e71fcc..67381a01a002 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -23,6 +23,7 @@ #include <set> #include <boost/noncopyable.hpp> +#include <boost/ptr_container/ptr_vector.hpp> #include <formula/tokenarray.hxx> #include <osl/conditn.hxx> @@ -47,16 +48,18 @@ struct RefUpdateInsertTabContext; struct RefUpdateDeleteTabContext; struct RefUpdateMoveTabContext; class CompileFormulaContext; +class FormulaGroupAreaListener; } class ScFormulaCell; class ScProgress; class ScTokenArray; -struct ScSimilarFormulaDelta; struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable { + typedef boost::ptr_vector<sc::FormulaGroupAreaListener> AreaListenersType; + mutable size_t mnRefCount; ScTokenArray* mpCode; @@ -70,6 +73,8 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable sal_uInt8 meCalcState; sal_uInt8 meKernelState; + AreaListenersType maAreaListeners; + ScFormulaCellGroup(); ~ScFormulaCellGroup(); @@ -81,6 +86,11 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable ScDocument& rDoc, const ScAddress& rPos, formula::FormulaGrammar::Grammar eGram ); void compileOpenCLKernel(); + sc::FormulaGroupAreaListener* getAreaListener( + ScFormulaCell** ppTopCell, const ScRange& rRange, bool bStartFixed, bool bEndFixed ); + + void endAllGroupListening( ScDocument& rDoc ); + #if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION static int snCount; static rtl::Reference<sc::CLBuildKernelThread> sxCompilationThread; diff --git a/sc/inc/grouparealistener.hxx b/sc/inc/grouparealistener.hxx new file mode 100644 index 000000000000..6301023d8093 --- /dev/null +++ b/sc/inc/grouparealistener.hxx @@ -0,0 +1,73 @@ +/* -*- 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 INCLUDED_SC_GROUPAREALISTENER_HXX +#define INCLUDED_SC_GROUPAREALISTENER_HXX + +#include <address.hxx> + +#include <svl/listener.hxx> + +class ScFormulaCell; + +namespace sc { + +class BulkDataHint; + +class FormulaGroupAreaListener : public SvtListener +{ + ScRange maRange; + ScFormulaCell** mppTopCell; + SCROW mnGroupLen; + bool mbStartFixed; + bool mbEndFixed; + + FormulaGroupAreaListener(); // disabled + +public: + FormulaGroupAreaListener( + const ScRange& rRange, ScFormulaCell** ppTopCell, SCROW nGroupLen, bool bStartFixed, bool bEndFixed ); + + ScRange getListeningRange() const; + + virtual void Notify( const SfxHint& rHint ) SAL_OVERRIDE; + + /** + * Given the position of a changed cell, collect all formula cells that + * need to be notified of the change. + * + * @param rPos position of changed cell. + * @param rCells all formula cells that need to be notified are put into + * this container. + */ + void collectFormulaCells( const ScAddress& rPos, std::vector<ScFormulaCell*>& rCells ) const; + + /** + * Given the row span of changed cells within a single column, collect all + * formula cells that need to be notified of the change. + * + * @param nTab sheet position of the changed cell span. + * @param nCol column position of the changed cell span. + * @param nRow1 top row position of the changed cell span. + * @param nRow2 bottom row position of the changed cell span. + * @param rCells all formula cells that need to be notified are put into + * this container. + */ + void collectFormulaCells( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScFormulaCell*>& rCells ) const; + +private: + void notifyCellChange( const SfxHint& rHint, const ScAddress& rPos ); + void notifyBulkChange( const BulkDataHint& rHint ); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/simplehintids.hxx b/sc/inc/simplehintids.hxx index 34900c07a51b..64d2b08c970b 100644 --- a/sc/inc/simplehintids.hxx +++ b/sc/inc/simplehintids.hxx @@ -12,10 +12,11 @@ #include <svl/smplhint.hxx> -#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED -#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 -#define SC_HINT_CALCALL SFX_HINT_USER01 -#define SC_HINT_REFERENCE SFX_HINT_USER02 +#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED +#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 +#define SC_HINT_CALCALL SFX_HINT_USER01 +#define SC_HINT_REFERENCE SFX_HINT_USER02 +#define SC_HINT_BULK_DATACHANGED SFX_HINT_USER03 #endif |