summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-02-28 03:21:10 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-02-29 23:37:52 +0100
commit33849f3fca52251eb7773802c78b6d8501921c37 (patch)
tree8b0ae42bfa8c93ff137e2258585deb9ebf79dd12
parentc06dbbe7594c2a0b5a5b19f8e183d9c421e6e094 (diff)
remove mpNote: fix copy/paste
-rw-r--r--sc/inc/postit.hxx2
-rw-r--r--sc/source/core/data/postit.cxx17
-rw-r--r--sc/source/core/data/table2.cxx6
-rw-r--r--sc/source/ui/view/output.cxx1
4 files changed, 23 insertions, 3 deletions
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index fb40347a56a7..16746d6b2838 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -311,6 +311,8 @@ public:
ScNotes* clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab);
void CopyFromClip(const ScNotes& maNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption);
+ void erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
+
};
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index a76f9f5de65d..8ecacfad145e 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1085,7 +1085,7 @@ void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1,
{
SCCOL nCol = itr->first.first;
SCROW nRow = itr->first.second;
- if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+ if (nCol+nDx >= nCol1 && nCol+nDx <= nCol2 && nRow+nDy >= nRow1 && nRow+nDy <= nRow2)
{
erase(nCol+nDx, nRow+nDy);
insert(nCol+nDx, nRow+nDy, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneCaption ));
@@ -1093,5 +1093,20 @@ void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1,
}
}
+void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
+{
+ ScNotes::iterator itr = maNoteMap.begin();
+ while(itr != maNoteMap.end())
+ {
+ SCCOL nCol = itr->first.first;
+ SCROW nRow = itr->first.second;
+ ++itr;
+ if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+ {
+ erase(nCol, nRow);
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index aef1446ada0f..50608c8ad24b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -598,7 +598,11 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
for ( i = nCol1; i <= nCol2; i++)
aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
- bool bAddNotes = (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES);
+ //remove old notes
+ if (nInsFlag & IDF_CONTENTS)
+ maNotes.erase(nCol1, nRow1, nCol2, nRow2);
+
+ bool bAddNotes = nInsFlag & (IDF_NOTE | IDF_ADDNOTES);
if (bAddNotes)
{
bool bCloneCaption = (nInsFlag & IDF_NOCAPTIONS) == 0;
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 346a60083e88..b080ac045989 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2112,7 +2112,6 @@ void ScOutputData::DrawNoteMarks()
SCCOL nMergeX = nX;
SCROW nMergeY = nY;
pDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
- pCell = pDoc->GetCell( ScAddress(nMergeX,nMergeY,nTab) );
// use origin's pCell for NotePtr test below
}