[Libreoffice-commits] core.git: Branch 'feature/sc-notes-storage' - 2 commits - sc/source
Laurent Godard
lgodard.libre at laposte.net
Wed Sep 18 02:17:25 PDT 2013
sc/source/core/data/column.cxx | 25 ++++++++---------------
sc/source/core/data/column3.cxx | 43 +++++++++++++++++++++++++++++++++-------
2 files changed, 45 insertions(+), 23 deletions(-)
New commits:
commit ba1b6e1b8fad4cc0aec1a346498ff86608264809
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Wed Sep 18 11:15:48 2013 +0200
notes & clipboard : notes on empty cells are not copied
still not working
Change-Id: Ic377d4d8626a058508f0a2abf635f593f48adee4
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 18592fd..bbeafdc 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1322,7 +1322,7 @@ public:
{
size_t nTopRow = aNode.position + nOffset;
- bool isSupportedNodeType = false;
+ bool bSet = true;
switch (aNode.type)
{
@@ -1333,9 +1333,6 @@ public:
sc::numeric_block::const_iterator itEnd = it;
std::advance(itEnd, nDataSize);
maDestPos.miCellPos = mrDestCol.GetCellStore().set(maDestPos.miCellPos, nTopRow, it, itEnd);
-
- isSupportedNodeType = true;
-
}
break;
case sc::element_type_string:
@@ -1345,9 +1342,6 @@ public:
sc::string_block::const_iterator itEnd = it;
std::advance(itEnd, nDataSize);
maDestPos.miCellPos = mrDestCol.GetCellStore().set(maDestPos.miCellPos, nTopRow, it, itEnd);
-
- isSupportedNodeType = true;
-
}
break;
case sc::element_type_edittext:
@@ -1364,9 +1358,6 @@ public:
maDestPos.miCellPos = mrDestCol.GetCellStore().set(
maDestPos.miCellPos, nTopRow, aCloned.begin(), aCloned.end());
-
- isSupportedNodeType = true;
-
}
break;
case sc::element_type_formula:
@@ -1407,19 +1398,16 @@ public:
aPos = rDestCells.position(maDestPos.miCellPos, nLastRow+1);
sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
}
-
- isSupportedNodeType = true;
-
}
break;
default:
+ bSet = true;
;
}
- if (isSupportedNodeType)
+ if (bSet)
{
setDefaultAttrsToDest(nTopRow, nDataSize);
-
if (mbCopyNotes)
{
//maDestPos.miCellNotePos = mrDestCol.GetCellNoteStore().set(maDestPos.miCellNotePos, nTopRow, it, itEnd);
@@ -1439,8 +1427,9 @@ public:
mrDestCol.GetDoc().SetNote(aDestPos, pClonedNote);
}
}
- }
+ }
}
+
}
};
@@ -1605,6 +1594,10 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes
bSet = false;
}
+ // copy notes even on empty cells
+// ScPostIt* pPostIt = maCellNotes.get<ScPostIt*>(nSrcRow);
+// rDestCol.maCellNotes.set(nDestRow, pPostIt);
+
if (bSet)
{
rDestCol.maCellTextAttrs.set(nDestRow, maCellTextAttrs.get<sc::CellTextAttr>(nSrcRow));
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index d240970..ed3c382 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -972,7 +972,36 @@ public:
}
break;
default:
- ;
+ /* TODO : notes - notes of empty cell are note copied */
+ /* the following code does not solve it */
+ {
+ if (bCopyCellNotes)
+ {
+ sc::formula_block::const_iterator it = sc::formula_block::begin(*node.data);
+ std::advance(it, nOffset);
+ sc::formula_block::const_iterator itEnd = it;
+ std::advance(itEnd, nDataSize);
+ for (SCROW nSrcRow = nSrcRow1; it != itEnd; ++it, ++nSrcRow)
+ {
+ sc::CellNoteStoreType& maCellNotesSrc = mrSrcCol.GetCellNoteStore();
+ sc::CellNoteStoreType::position_type aPos = maCellNotesSrc.position(nSrcRow);
+ sc::CellNoteStoreType::iterator itNotes = aPos.first;
+ if (itNotes->type == sc::element_type_cellnote)
+ {
+ ScPostIt* pSrcNote = maCellNotesSrc.get<ScPostIt*>(nSrcRow);
+ if (pSrcNote)
+ {
+ ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow+mnRowOffset, mrDestCol.GetTab());
+ ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nSrcRow, mrSrcCol.GetTab() ),
+ mrDestCol.GetDoc(),
+ aDestPos, true );
+ mrDestCol.GetDoc().ReleaseNote(aDestPos);
+ mrDestCol.GetDoc().SetNote(aDestPos, pClonedNote);
+ }
+ }
+ }
+ }
+ }
}
}
};
commit f500329e756fad3f2dacbb1efa6498166f382e24
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Tue Sep 17 13:08:01 2013 +0200
notes & clipboard
notes is now copied at correct cell
Change-Id: Idaa336b01d9de9b3ee81dffc4ef235a9bd13fc4f
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 19f2aa7..d240970 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -770,7 +770,7 @@ public:
ScPostIt* pSrcNote = maCellNotesSrc.get<ScPostIt*>(nSrcRow);
if (pSrcNote)
{
- ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow, mrDestCol.GetTab());
+ ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow+mnRowOffset, mrDestCol.GetTab());
ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nSrcRow, mrSrcCol.GetTab() ),
mrDestCol.GetDoc(),
aDestPos, true );
@@ -809,7 +809,7 @@ public:
ScPostIt* pSrcNote = maCellNotesSrc.get<ScPostIt*>(nSrcRow);
if (pSrcNote)
{
- ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow, mrDestCol.GetTab());
+ ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow+mnRowOffset, mrDestCol.GetTab());
ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nSrcRow, mrSrcCol.GetTab() ),
mrDestCol.GetDoc(),
aDestPos, true );
@@ -848,7 +848,7 @@ public:
ScPostIt* pSrcNote = maCellNotesSrc.get<ScPostIt*>(nSrcRow);
if (pSrcNote)
{
- ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow, mrDestCol.GetTab());
+ ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow+mnRowOffset, mrDestCol.GetTab());
ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nSrcRow, mrSrcCol.GetTab() ),
mrDestCol.GetDoc(),
aDestPos, true );
@@ -959,12 +959,12 @@ public:
ScPostIt* pSrcNote = maCellNotesSrc.get<ScPostIt*>(nSrcRow);
if (pSrcNote)
{
- ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nSrcRow, mrDestCol.GetTab());
+ ScAddress aDestPosNotes = ScAddress(mrDestCol.GetCol(), nSrcRow+mnRowOffset, mrDestCol.GetTab());
ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nSrcRow, mrSrcCol.GetTab() ),
mrDestCol.GetDoc(),
- aDestPos, true );
- mrDestCol.GetDoc().ReleaseNote(aDestPos);
- mrDestCol.GetDoc().SetNote(aDestPos, pClonedNote);
+ aDestPosNotes, true );
+ mrDestCol.GetDoc().ReleaseNote(aDestPosNotes);
+ mrDestCol.GetDoc().SetNote(aDestPosNotes, pClonedNote);
}
}
}
More information about the Libreoffice-commits
mailing list