summaryrefslogtreecommitdiff
path: root/sc/inc/clipcontext.hxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-15 16:09:40 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-20 20:13:08 -0400
commitf3f0ae12f90af06f92b66017449ed4d7892a8ced (patch)
treea3ae1f32dfea00ef7f59afec77ee341d8b094d74 /sc/inc/clipcontext.hxx
parentf8ed5c3ffea38b75df0a6dc44f5ee3d6da68c5ff (diff)
Keep track of current block position when pasting a range of cells.
This avoids re-starting the search for insertion position in the cell text attribute array, on every single cell insertion. Instead of always searching from the first position, it starts the seaarch from the previous insertion position. This reduces the paste time from the previous 3.5 seconds to 1.7 seconds on my machine. Here is the scenario. 1) Put =A1 in B1, and leave B2 empty. 2) Select B1:B2 and copy it via Ctrl-C. 3) Select B3:B50000, and paste via Ctrl-V. Because of the empty cells interspersing the destination range, this makes the data array highly partitioned, which makes the position lookup very very expensive without the position hint. Still, I was hoping the duration would become a fraction of a second. 1.7 seconds still seems a bit too slow... Change-Id: I7742ce7e22935b6d0e082e4569d53dbd2072c4e5
Diffstat (limited to 'sc/inc/clipcontext.hxx')
-rw-r--r--sc/inc/clipcontext.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx
index ffe66b0f4951..8b1f26194316 100644
--- a/sc/inc/clipcontext.hxx
+++ b/sc/inc/clipcontext.hxx
@@ -13,12 +13,20 @@
#include "address.hxx"
#include "mtvelements.hxx"
+#include <vector>
+#include <boost/unordered_map.hpp>
+
class ScDocument;
namespace sc {
class CopyFromClipContext
{
+ typedef boost::unordered_map<SCCOL, ColumnBlockPosition> ColumnsType;
+ typedef std::vector<ColumnsType> TablesType;
+
+ TablesType maTables;
+
ScDocument* mpRefUndoDoc;
ScDocument* mpClipDoc;
sal_uInt16 mnInsertFlag;
@@ -33,10 +41,13 @@ public:
ScDocument* pRefUndoDoc, ScDocument* pClipDoc, sal_uInt16 nInsertFlag,
bool bAsLink, bool bSkipAttrForEmptyCells);
+ bool initBlockPositions(ScDocument& rDoc, SCCOL nCol1, SCCOL nCol2);
void setTabRange(SCTAB nStart, SCTAB nEnd);
~CopyFromClipContext();
+ ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
+
ScDocument* getUndoDoc();
ScDocument* getClipDoc();
sal_uInt16 getInsertFlag() const;