include/svl/broadcast.hxx | 3 +- sc/inc/calcmacros.hxx | 3 +- sc/inc/document.hxx | 4 ++ sc/source/core/data/bcaslot.cxx | 56 +++++++++++++++++++++++++++++++++++++++ sc/source/core/data/document.cxx | 8 +++++ sc/source/core/inc/bcaslot.hxx | 44 ++++++++++++++++++------------ svl/source/notify/broadcast.cxx | 9 ++++++ 7 files changed, 107 insertions(+), 20 deletions(-)
New commits: commit 0d15d80fe33edff7f71ce384ba03db702414b521 Author: Kohei Yoshida <[email protected]> Date: Tue Nov 11 21:53:57 2014 -0500 Add a means to dump the state of the area broadcaster slot machine. Change-Id: I158307de667dbe621376dfc01adeef89aa12faaa diff --git a/sc/inc/calcmacros.hxx b/sc/inc/calcmacros.hxx index e56712d..8810247 100644 --- a/sc/inc/calcmacros.hxx +++ b/sc/inc/calcmacros.hxx @@ -13,8 +13,9 @@ #define DEBUG_COLUMN_STORAGE 0 #define DEBUG_PIVOT_TABLE 0 #define DEBUG_FORMULA_COMPILER 0 +#define DEBUG_AREA_BROADCASTER 0 -#if DEBUG_PIVOT_TABLE || DEBUG_COLUMN_STORAGE || DEBUG_FORMULA_COMPILER +#if DEBUG_PIVOT_TABLE || DEBUG_COLUMN_STORAGE || DEBUG_FORMULA_COMPILER || DEBUG_AREA_BROADCASTER #include <iostream> #include <string> #include <cstdio> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 47387bd..3974b47 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2106,6 +2106,10 @@ public: SC_DLLPUBLIC void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const; #endif +#if DEBUG_AREA_BROADCASTER + SC_DLLPUBLIC void DumpAreaBroadcasters() const; +#endif + void SetCalcConfig( const ScCalcConfig& rConfig ); const ScCalcConfig& GetCalcConfig() const { return maCalcConfig; } diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index f2609a4..8229d68 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -28,6 +28,10 @@ #include "refupdat.hxx" #include "table.hxx" +#if DEBUG_AREA_BROADCASTER +#include <formulacell.hxx> +#endif + // Number of slots per dimension // must be integer divisors of MAXCOLCOUNT respectively MAXROWCOUNT #define BCA_SLOTS_COL ((MAXCOLCOUNT_DEFINE) / 16) @@ -489,6 +493,33 @@ void ScBroadcastAreaSlot::GetAllListeners( } } +#if DEBUG_AREA_BROADCASTER +void ScBroadcastAreaSlot::Dump() const +{ + ScBroadcastAreas::const_iterator it = aBroadcastAreaTbl.begin(), itEnd = aBroadcastAreaTbl.end(); + for (; it != itEnd; ++it) + { + const ScBroadcastAreaEntry& rEntry = *it; + const ScBroadcastArea* pArea = rEntry.mpArea; + cout << " * range: " << rtl::OUStringToOString(pArea->GetRange().Format(SCA_VALID|SCA_TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() << endl; + const SvtBroadcaster& rBC = pArea->GetBroadcaster(); + const SvtBroadcaster::ListenersType& rListeners = rBC.GetAllListeners(); + size_t n = rListeners.size(); + cout << " * listener count: " << n << endl; + for (size_t i = 0; i < n; ++i) + { + const ScFormulaCell* pFC = dynamic_cast<const ScFormulaCell*>(rListeners[i]); + if (!pFC) + continue; + + cout << " * listener: formula cell: " + << rtl::OUStringToOString(pFC->aPos.Format(SCA_VALID|SCA_TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() + << endl; + } + } +} +#endif + void ScBroadcastAreaSlot::FinallyEraseAreas() { pBASM->FinallyEraseAreas( this); @@ -1026,4 +1057,29 @@ std::vector<sc::AreaListener> ScBroadcastAreaSlotMachine::GetAllListeners( return aRet; } +#if DEBUG_AREA_BROADCASTER +void ScBroadcastAreaSlotMachine::Dump() const +{ + cout << "slot distribution count: " << nBcaSlots << endl; + TableSlotsMap::const_iterator it = aTableSlotsMap.begin(), itEnd = aTableSlotsMap.end(); + for (; it != itEnd; ++it) + { + cout << "-- sheet (index: " << it->first << ")" << endl; + + TableSlots* pTabSlots = it->second; + assert(pTabSlots); + ScBroadcastAreaSlot** ppSlots = pTabSlots->getSlots(); + for (SCSIZE i = 0; i < nBcaSlots; ++i) + { + const ScBroadcastAreaSlot* pSlot = ppSlots[i]; + if (pSlot) + { + cout << "* slot " << i << endl; + pSlot->Dump(); + } + } + } +} +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index c8c8af7..b3a3fc1 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2352,6 +2352,14 @@ void ScDocument::DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const } #endif +#if DEBUG_AREA_BROADCASTER +void ScDocument::DumpAreaBroadcasters() const +{ + if (pBASM) + pBASM->Dump(); +} +#endif + bool ScDocument::TableExists( SCTAB nTab ) const { return ValidTab(nTab) && static_cast<size_t>(nTab) < maTabs.size() && maTabs[nTab]; diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx index a790890..2f63207 100644 --- a/sc/source/core/inc/bcaslot.hxx +++ b/sc/source/core/inc/bcaslot.hxx @@ -225,6 +225,10 @@ public: void GetAllListeners( const ScRange& rRange, std::vector<sc::AreaListener>& rListeners, sc::AreaOverlapType eType ); + +#if DEBUG_AREA_BROADCASTER + void Dump() const; +#endif }; /** @@ -321,6 +325,10 @@ public: std::vector<sc::AreaListener> GetAllListeners( const ScRange& rRange, sc::AreaOverlapType eType ); + +#if DEBUG_AREA_BROADCASTER + void Dump() const; +#endif }; class ScBulkBroadcast commit d9e67908070db26b40e6dee05bf506c6043e3d99 Author: Kohei Yoshida <[email protected]> Date: Tue Nov 11 19:15:25 2014 -0500 Make these non-inline and add the const version of the getter. Change-Id: I8c175dcaaa51e2b05895226907697b070a2e2f77 diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx index 62e343f..5615255 100644 --- a/include/svl/broadcast.hxx +++ b/include/svl/broadcast.hxx @@ -56,7 +56,8 @@ public: void Broadcast( const SfxHint &rHint ); - ListenersType& GetAllListeners() { return maListeners;} + ListenersType& GetAllListeners(); + const ListenersType& GetAllListeners() const; bool HasListeners() const; diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index 30e7bd0..c0dfe4f 100644 --- a/svl/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -138,6 +138,15 @@ void SvtBroadcaster::Broadcast( const SfxHint &rHint ) void SvtBroadcaster::ListenersGone() {} +SvtBroadcaster::ListenersType& SvtBroadcaster::GetAllListeners() +{ + return maListeners; +} + +const SvtBroadcaster::ListenersType& SvtBroadcaster::GetAllListeners() const +{ + return maListeners; +} bool SvtBroadcaster::HasListeners() const { commit e2235454e1c160ba62d1b81b981db5ad9af02334 Author: Kohei Yoshida <[email protected]> Date: Tue Nov 11 18:10:21 2014 -0500 Unindent. Change-Id: I3c644b6ff9916f6ec99ff6208ea073dd1612b4b3 diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx index 830ddea..a790890 100644 --- a/sc/source/core/inc/bcaslot.hxx +++ b/sc/source/core/inc/bcaslot.hxx @@ -249,24 +249,24 @@ private: class TableSlots { - public: - TableSlots(); - ~TableSlots(); - inline ScBroadcastAreaSlot** getSlots() { return ppSlots; } - - /** - Obtain slot pointer, no check on validity! It is assumed that - all calls are made with the results of ComputeSlotOffset(), - ComputeAreaPoints() and ComputeNextSlot() - */ - inline ScBroadcastAreaSlot* getAreaSlot( SCSIZE nOff ) { return *(ppSlots + nOff); } - - private: - ScBroadcastAreaSlot** ppSlots; - - // prevent usage - TableSlots( const TableSlots& ); - TableSlots& operator=( const TableSlots& ); + public: + TableSlots(); + ~TableSlots(); + inline ScBroadcastAreaSlot** getSlots() { return ppSlots; } + + /** + Obtain slot pointer, no check on validity! It is assumed that + all calls are made with the results of ComputeSlotOffset(), + ComputeAreaPoints() and ComputeNextSlot() + */ + inline ScBroadcastAreaSlot* getAreaSlot( SCSIZE nOff ) { return *(ppSlots + nOff); } + + private: + ScBroadcastAreaSlot** ppSlots; + + // prevent usage + TableSlots( const TableSlots& ); + TableSlots& operator=( const TableSlots& ); }; typedef ::std::map< SCTAB, TableSlots* > TableSlotsMap; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
