summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-16 23:59:42 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-20 20:13:09 -0400
commit11a164f0ac81f4cff4b2698e1fc114ce7e4737df (patch)
tree93d747bd93c6c900e24dc11ae1420decd976d0cc /sc/inc
parent417120f946c27c040f8cbd98d621bf63b425f049 (diff)
Do the same optimization for CopyToClip.
The basic idea is the same as the one I did for CopyFromClip. This prevents the O(n^2) algorithm from being invoked during undo object creation. Change-Id: Iac46663b0c25db2f00ffa3ab95a4dcf2857252ce
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/clipcontext.hxx37
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/inc/table.hxx9
3 files changed, 33 insertions, 16 deletions
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx
index 53f2110e9c58..e28d265df47d 100644
--- a/sc/inc/clipcontext.hxx
+++ b/sc/inc/clipcontext.hxx
@@ -20,20 +20,34 @@ class ScDocument;
namespace sc {
-class CopyFromClipContext
+class ClipContextBase
{
typedef boost::unordered_map<SCCOL, ColumnBlockPosition> ColumnsType;
typedef std::vector<ColumnsType> TablesType;
+ ScDocument& mrDoc;
TablesType maTables;
+ SCTAB mnTabStart;
+ SCTAB mnTabEnd;
- ScDocument& mrDoc;
+public:
+ ClipContextBase(ScDocument& rDoc);
+ virtual ~ClipContextBase();
+
+ void setTabRange(SCTAB nStart, SCTAB nEnd);
+
+ SCTAB getTabStart() const;
+ SCTAB getTabEnd() const;
+
+ ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
+};
+
+class CopyFromClipContext : public ClipContextBase
+{
ScDocument* mpRefUndoDoc;
ScDocument* mpClipDoc;
sal_uInt16 mnInsertFlag;
- SCTAB mnTabStart;
- SCTAB mnTabEnd;
bool mbAsLink:1;
bool mbSkipAttrForEmptyCells:1;
@@ -44,21 +58,22 @@ public:
ScDocument* pRefUndoDoc, ScDocument* pClipDoc, sal_uInt16 nInsertFlag,
bool bAsLink, bool bSkipAttrForEmptyCells);
- ~CopyFromClipContext();
-
- void setTabRange(SCTAB nStart, SCTAB nEnd);
-
- ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
+ virtual ~CopyFromClipContext();
ScDocument* getUndoDoc();
ScDocument* getClipDoc();
sal_uInt16 getInsertFlag() const;
- SCTAB getTabStart() const;
- SCTAB getTabEnd() const;
bool isAsLink() const;
bool isSkipAttrForEmptyCells() const;
};
+class CopyToClipContext : public ClipContextBase
+{
+public:
+ CopyToClipContext(ScDocument& rDoc);
+ virtual ~CopyToClipContext();
+};
+
}
#endif
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index f1584b11f837..0eab575d6cb5 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -39,6 +39,7 @@ namespace sc {
struct FormulaGroupContext;
class EndListeningContext;
class CopyFromClipContext;
+ class CopyToClipContext;
struct ColumnBlockPosition;
}
@@ -215,7 +216,7 @@ public:
void InsertRow( SCROW nStartRow, SCSIZE nSize );
void DeleteRow( SCROW nStartRow, SCSIZE nSize );
void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
- void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const;
+ void CopyToClip( sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags ) const;
void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 333eb9ae7e87..2538a0b5822d 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -51,6 +51,7 @@ namespace sc {
struct FormulaGroupContext;
class EndListeningContext;
class CopyFromClipContext;
+ class CopyToClipContext;
struct ColumnBlockPosition;
}
@@ -379,10 +380,10 @@ public:
bool* pUndoOutline = NULL );
void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
- void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
- bool bKeepScenarioFlags, bool bCloneNoteCaptions);
- void CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
- bool bKeepScenarioFlags, bool bCloneNoteCaptions);
+ void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
+ bool bKeepScenarioFlags, bool bCloneNoteCaptions );
+ void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable,
+ bool bKeepScenarioFlags, bool bCloneNoteCaptions );
void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );