[Libreoffice-commits] core.git: Branch 'feature/sc-notes-storage' - sc/source

Laurent Godard lgodard.libre at laposte.net
Fri Sep 20 06:17:52 PDT 2013


 sc/source/core/data/column.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 23b581c56f84824f07244107792d062b6b777cf2
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Fri Sep 20 15:16:57 2013 +0200

    Notes are hard copied on paste special "as link"
    
    Change-Id: Ie5fb136f151396faeb386ce40e9bee473f491841

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 08d1a6e..aea68e0 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1597,13 +1597,10 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes
     if (bSet)
     {
         rDestCol.maCellTextAttrs.set(nDestRow, maCellTextAttrs.get<sc::CellTextAttr>(nSrcRow));
-        ScPostIt* pPostIt = maCellNotes.get<ScPostIt*>(nSrcRow);
-        rDestCol.maCellNotes.set(nDestRow, pPostIt);
     }
     else
     {
         rDestCol.maCellTextAttrs.set_empty(nDestRow, nDestRow);
-        rDestCol.maCellNotes.set_empty(nDestRow, nDestRow);
     }
 
     rDestCol.CellStorageModified();
@@ -1666,8 +1663,9 @@ class CopyAsLinkHandler
         setDefaultAttrsToDest(nTopRow, nDataSize);
     }
 
-    void linkNotes(SCROW nStartRow, size_t nDataSize ) // TODO : notes suboptimal
+    void duplicateNotes(SCROW nStartRow, size_t nDataSize ) // TODO : notes suboptimal
     {
+        // the link status is only for cell content as it is not possible to un-link a note
         sc::CellNoteStoreType maSrcCellNotes = mrSrcCol.GetCellNoteStore();
         SCROW nRowMax = nStartRow + nDataSize;
 
@@ -1677,8 +1675,11 @@ class CopyAsLinkHandler
             if (pSrcNote)
             {
                 ScAddress aDestPos = ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab());
+                ScPostIt* pClonedNote = pSrcNote->Clone( ScAddress(mrSrcCol.GetCol(), nRow, mrSrcCol.GetTab() ),
+                                 mrDestCol.GetDoc(),
+                                 aDestPos, true );
                 mrDestCol.GetDoc().ReleaseNote(aDestPos);
-                mrDestCol.GetDoc().SetNote(aDestPos, pSrcNote);
+                mrDestCol.GetDoc().SetNote(aDestPos, pClonedNote);
             }
         }
     }
@@ -1701,8 +1702,8 @@ public:
     {
         size_t nRow = aNode.position + nOffset;
 
-        if (mnCopyFlags & (IDF_NOTE|IDF_ADDNOTES)) //
-                linkNotes(nRow, nDataSize ); // TODO : notes not actually working
+        if (mnCopyFlags & (IDF_NOTE|IDF_ADDNOTES))
+                duplicateNotes(nRow, nDataSize );
 
         switch (aNode.type)
         {


More information about the Libreoffice-commits mailing list