sc/inc/column.hxx | 2 +- sc/inc/postit.hxx | 4 ++-- sc/source/core/data/column.cxx | 5 ++--- sc/source/core/data/postit.cxx | 11 +++++++---- sc/source/core/data/table2.cxx | 6 +++--- 5 files changed, 15 insertions(+), 13 deletions(-)
New commits: commit 921fb226d2836673c1d3ef0f254708a5c5c0b313 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Mar 2 01:59:01 2012 +0100 fix crashs in undo/redo realted to note captions diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 16746d6..1b370ce 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -297,7 +297,7 @@ public: bool insert( SCCOL nCol, SCROW nRow, ScPostIt* ); bool insert( const ScAddress& rPos, ScPostIt* ); - void erase(SCCOL, SCROW); + void erase(SCCOL, SCROW, bool bForgetCaption = false); void erase(const ScAddress& rPos); /** Returns and forgets the cell note object at the passed cell address. */ @@ -311,7 +311,7 @@ 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); + void erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bForgetCaption = false); }; diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 8ecacfa..8a0677f 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1009,11 +1009,14 @@ bool ScNotes::insert(const ScAddress& rPos, ScPostIt* pPostIt) return insert(rPos.Col(), rPos.Row(), pPostIt); } -void ScNotes::erase(SCCOL nCol, SCROW nRow) +void ScNotes::erase(SCCOL nCol, SCROW nRow, bool bForgetCaption) { iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow)); if (itr != maNoteMap.end()) { + if (bForgetCaption) + itr->second->ForgetCaption(); + delete itr->second; maNoteMap.erase(itr); } @@ -1088,12 +1091,12 @@ void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1, 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 )); + insert(nCol+nDx, nRow+nDy, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol+nDx, nRow+nDy, nTab), bCloneCaption )); } } } -void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) +void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bForgetCaption) { ScNotes::iterator itr = maNoteMap.begin(); while(itr != maNoteMap.end()) @@ -1103,7 +1106,7 @@ void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) ++itr; if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2) { - erase(nCol, nRow); + erase(nCol, nRow, bForgetCaption); } } } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4cc42f6..19fa547 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -537,7 +537,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal } if (nDelFlag & IDF_NOTE) - maNotes.erase( nCol1, nRow1, nCol2, nRow2); + maNotes.erase( nCol1, nRow1, nCol2, nRow2, true ); if (IsStreamValid()) // TODO: In the future we may want to check if the table has been @@ -561,7 +561,7 @@ void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ) { ScRange* pRange = aRangeList[i]; if (nDelFlag & IDF_NOTE && pRange) - maNotes.erase(pRange->aStart.Col(), pRange->aStart.Row(), pRange->aEnd.Col(), pRange->aEnd.Row()); + maNotes.erase(pRange->aStart.Col(), pRange->aStart.Row(), pRange->aEnd.Col(), pRange->aEnd.Row(), true); } // commit 1d1141cd06fcdbadd008744a28674d4b50457923 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Mar 2 01:09:56 2012 +0100 remove unnecessary parameter diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 8d715fb..e503005 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -194,7 +194,7 @@ public: void DeleteRow( SCROW nStartRow, SCSIZE nSize ); void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag ); void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag ); - void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags, bool bCloneNoteCaptions); + void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags); void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn); void StartListeningInArea( SCROW nRow1, SCROW nRow2 ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index c0becb6..10c3e5d 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1182,7 +1182,7 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) } -void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags, bool bCloneNoteCaptions) +void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) { pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray, bKeepScenarioFlags ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL ); @@ -1211,7 +1211,6 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKee if (nBlockCount) { - int nCloneFlags = bCloneNoteCaptions ? SC_CLONECELL_DEFAULT : SC_CLONECELL_NOCAPTION; rColumn.Resize( rColumn.GetCellCount() + nBlockCount ); ScAddress aOwnPos( nCol, 0, nTab ); ScAddress aDestPos( rColumn.nCol, 0, rColumn.nTab ); @@ -1219,7 +1218,7 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKee { aOwnPos.SetRow( maItems[i].nRow ); aDestPos.SetRow( maItems[i].nRow ); - ScBaseCell* pNewCell = maItems[i].pCell->Clone( *rColumn.pDocument, aDestPos, nCloneFlags ); + ScBaseCell* pNewCell = maItems[i].pCell->Clone( *rColumn.pDocument, aDestPos, SC_CLONECELL_DEFAULT ); rColumn.Append( aDestPos.Row(), pNewCell ); } } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c2597f1..4cc42f6 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -601,7 +601,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL i; for ( i = nCol1; i <= nCol2; i++) - aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags, bCloneNoteCaptions); + aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags); // copy widths/heights, and only "hidden", "filtered" and "manual" flags // also for all preceding columns/rows, to have valid positions for drawing objects _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits