[Libreoffice-commits] core.git: Branch 'feature/sc-notes-storage' - sc/source
Laurent Godard
lgodard.libre at laposte.net
Wed Sep 18 09:40:45 PDT 2013
Rebased ref, commits from common ancestor:
commit dc7c410e8a2ed4074cedd6beea4c134cc098c2dc
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Wed Sep 18 18:36:19 2013 +0200
clean table notes management
- partial
- move treatments to column
- Transpose clipboard
Change-Id: I59d36fcbc440605052cc50f342bf1d091c74ea18
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f8ef4c5..0a1127a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -705,14 +705,16 @@ class CopyCellsFromClipHandler
for (SCROW nRow = nStartRow; nRow < nRowMax; ++nRow)
{
+
+ ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nRow+mnRowOffset, mrDestCol.GetTab());
+ mrDestCol.GetDoc().ReleaseNote(aDestPos);
+
ScPostIt* pSrcNote = maSrcCellNotes.get<ScPostIt*>(nRow);
if (pSrcNote)
{
- ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nRow+mnRowOffset, mrDestCol.GetTab());
ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nRow, mrSrcCol.GetTab() ),
mrDestCol.GetDoc(),
aDestPos, true );
- mrDestCol.GetDoc().ReleaseNote(aDestPos);
mrDestCol.GetDoc().SetNote(aDestPos, pClonedNote);
}
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d4f2ece..433f61d 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -504,16 +504,10 @@ void ScTable::CopyToClip(
if (!pTable->mpRangeName && mpRangeName)
pTable->mpRangeName = new ScRangeName(*mpRangeName);
-/* TODO : notes --> move at column level
- // notes
- maNotes.clone(
- pTable->pDocument, nCol1, nRow1, nCol2, nRow2, rCxt.isCloneNotes(), nTab, pTable->maNotes);
-*/
-
SCCOL i;
for ( i = nCol1; i <= nCol2; i++)
- aCol[i].CopyToClip(rCxt, nRow1, nRow2, pTable->aCol[i]);
+ aCol[i].CopyToClip(rCxt, nRow1, nRow2, pTable->aCol[i]); // notes are handled at column level
// copy widths/heights, and only "hidden", "filtered" and "manual" flags
// also for all preceding columns/rows, to have valid positions for drawing objects
@@ -666,8 +660,7 @@ void ScTable::CopyFromClip(
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
for ( SCCOL i = nCol1; i <= nCol2; i++)
- aCol[i].CopyFromClip(rCxt, nRow1, nRow2, nDy, pTable->aCol[i - nDx]);
-
+ aCol[i].CopyFromClip(rCxt, nRow1, nRow2, nDy, pTable->aCol[i - nDx]); // notes are handles at column level
if (rCxt.getInsertFlag() == IDF_ATTRIB)
{
@@ -679,19 +672,6 @@ void ScTable::CopyFromClip(
aCol[i].ClearItems(nRow1, nRow2, nWhichArray);
}
-/* TODO : notes clipboard
- //remove old notes
- if (rCxt.getInsertFlag() & (IDF_NOTE|IDF_ADDNOTES))
- maNotes.erase(nCol1, nRow1, nCol2, nRow2);
-
- bool bAddNotes = rCxt.getInsertFlag() & (IDF_NOTE | IDF_ADDNOTES);
- if (bAddNotes)
- {
- bool bCloneCaption = (rCxt.getInsertFlag() & IDF_NOCAPTIONS) == 0;
- maNotes.CopyFromClip(pTable->maNotes, pDocument, nCol1, nRow1, nCol2, nRow2, nDx, nDy, nTab, bCloneCaption);
- }
-*/
-
if ((rCxt.getInsertFlag() & IDF_ATTRIB) != 0)
{
if (nRow1==0 && nRow2==MAXROW && pColWidth && pTable->pColWidth)
@@ -950,40 +930,23 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// Cell Notes - fdo#68381 paste cell notes on Transpose
bool bCloneCaption = true;
- if ( pDestDoc->HasColNotes(nCol, nTab) )
+ if ( pDocument->HasColNotes(nCol, nTab) )
{
- sc::CellNoteStoreType& maCellNotes = pDestDoc->GetColNotes(nCol, nTab);
+ sc::CellNoteStoreType& maCellNotes = pDocument->GetColNotes(nCol, nTab);
for (nRow=nRow1; nRow <= nRow2; nRow++) // TODO : notes suboptimal ?
{
- sc::CellNoteStoreType::position_type aPos = maCellNotes.position(nRow);
- sc::CellNoteStoreType::iterator it = aPos.first;
- ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nRow);
-
ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
- ScPostIt* pClonedNote = pNote->Clone( ScAddress(nCol, nRow, nTab), *pTransClip->pDocument, aDestPos, bCloneCaption );
-
pTransClip->pDocument->ReleaseNote(aDestPos);
- pTransClip->pDocument->SetNote(aDestPos, pClonedNote);
- }
- }
- }
-/*
-// TODO : notes clipboard
- // fdo#68381 paste cell notes on Transpose
- bool bCloneCaption = true;
- for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
- {
- SCCOL nCol = itr->first.first;
- SCROW nRow = itr->first.second;
- if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
- {
- ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
- pTransClip->maNotes.erase(aDestPos);
- pTransClip->maNotes.insert(aDestPos, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pTransClip->pDocument, aDestPos, bCloneCaption ));
+ ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nRow);
+ if (pNote)
+ {
+ ScPostIt* pClonedNote = pNote->Clone( ScAddress(nCol, nRow, nTab), *pDestDoc, aDestPos, bCloneCaption );
+ pTransClip->pDocument->SetNote(aDestPos, pClonedNote);
+ }
+ }
}
}
-*/
}
@@ -1161,7 +1124,7 @@ void ScTable::UndoToTable(
aCol[i].CopyToColumn(rCxt, 0, MAXROW, IDF_FORMULA, false, pDestTab->aCol[i]);
}
-/* TODO : notes clipboard
+/* TODO : notes copy - verifu undoToColumn and copyToColumn Flags
//remove old notes
if (nFlags & IDF_CONTENTS)
pDestTab->maNotes.erase(nCol1, nRow1, nCol2, nRow2);
@@ -1482,7 +1445,6 @@ void ScTable::InitializeNoteCaptions( bool bForced )
{
if ( pDocument->HasColNotes(nCol, nTab) )
{
- sc::CellNoteStoreType& maCellNotes = pDocument->GetColNotes(nCol, nTab);
for (SCROW nRow=0; nRow < MAXROWCOUNT; nRow++) // TODO : notes suboptimal ?
{
if (ScPostIt* pNote = GetNote(nCol, nRow))
More information about the Libreoffice-commits
mailing list