summaryrefslogtreecommitdiffstats
path: root/sc/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-08-22 11:43:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-25 15:27:58 +0200
commitc47eb8afd1b941a4dca832cfad85ba750c76635d (patch)
tree283e513b21840c9e8c5b82f9b71a5fcd0f143b21 /sc/inc
parentDrop gratuitous initial :: from comphelper::ProfileZone (diff)
downloadcore-c47eb8afd1b941a4dca832cfad85ba750c76635d.tar.gz
core-c47eb8afd1b941a4dca832cfad85ba750c76635d.zip
dynamic column container: more efficient loops over all cols
Create an ScColumnsRange class that returns a pair of (start,end) iterators to go through the list of currently allocated columns. This is a fairly thing wrapper around the underlying std::vector, so it should be fairly efficient (two pointers, and pointer increment for iteration). If this style of iteration is acceptable, I'll go through the rest of the code that does: for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++) type stuff, and change it to use ScColumnsRange. Change-Id: I81501c69b7f5566c6204dde0d87a6fe0deb9743c Reviewed-on: https://gerrit.libreoffice.org/41413 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/colcontainer.hxx3
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/inc/table.hxx13
3 files changed, 20 insertions, 0 deletions
diff --git a/sc/inc/colcontainer.hxx b/sc/inc/colcontainer.hxx
index 3e97ed048f4d..bf2bd206850f 100644
--- a/sc/inc/colcontainer.hxx
+++ b/sc/inc/colcontainer.hxx
@@ -72,6 +72,9 @@ public:
assert(aCols.size() > 0);
return *aCols.back();
}
+
+ ScColumnVector::const_iterator begin() const { return aCols.begin(); }
+ ScColumnVector::const_iterator end() const { return aCols.end(); }
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6650c2e111ee..bc1f4ea2f5cf 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -198,6 +198,7 @@ class SvtBroadcaster;
enum class ScDBDataPortion;
enum class ScSheetEventId;
class BitmapEx;
+class ScColumnsRange;
namespace sc {
@@ -295,6 +296,7 @@ friend class sc::ColumnSpanSet;
friend class sc::EditTextIterator;
friend class sc::FormulaGroupAreaListener;
friend class sc::TableColumnBlockPositionSet;
+friend class ScDrawLayer;
typedef std::vector<ScTable*> TableContainer;
@@ -2383,6 +2385,8 @@ private:
void EndListeningGroups( const std::vector<ScAddress>& rPosArray );
void SetNeedsListeningGroups( const std::vector<ScAddress>& rPosArray );
+
+ ScColumnsRange GetColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd) const;
};
#endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index d64bc90b4f3b..d41d67d10a1c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -117,6 +117,17 @@ class ScDBData;
class ScDocumentImport;
class ScHint;
+class ScColumnsRange final
+{
+ typedef std::vector<ScColumn*>::const_iterator const_iterator;
+ const const_iterator maBegin;
+ const const_iterator maEnd;
+public:
+ ScColumnsRange(const_iterator nBegin, const_iterator nEnd) : maBegin(nBegin), maEnd(nEnd) {}
+ const const_iterator & begin() { return maBegin; }
+ const const_iterator & end() { return maEnd; }
+};
+
class ScTable
{
private:
@@ -1024,6 +1035,8 @@ public:
*/
static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
+ ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const;
+
private:
void FillFormulaVertical(