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

Laurent Godard lgodard.libre at laposte.net
Mon Sep 30 05:22:41 PDT 2013


 sc/inc/postit.hxx              |    8 ++++++++
 sc/source/core/data/postit.cxx |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

New commits:
commit 98d104a399adf9825d0519d350e25957a640d60e
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Mon Sep 30 14:21:04 2013 +0200

    unify DuplicateNotes for clipboard handlers in ScNoteUtil
    
    - work in progress
    
    Change-Id: Ibe4b2e0f7184206137b756663b8017ff364f55b4

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index c632817..0fc1c2e 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -241,6 +241,14 @@ public:
                             ScDocument& rDoc, const ScAddress& rPos,
                             const OUString& rNoteText, bool bShown,
                             bool bAlwaysCreateCaption );
+
+    /** Duplicate notes using mdds - copy/paste manipulations
+    void                DuplicateNotes(
+                            const ScColumn& mrSrcCol, ScColumn& mrDestCol,
+                            SCROW nStartRow, size_t nDataSize,
+                            ColumnBlockPosition& maDestPos );
+
+*/
 };
 
 #endif
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 4d3f175..0278921 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -937,5 +937,43 @@ ScPostIt* ScNoteUtil::CreateNoteFromString(
     }
     return pNote;
 }
+/*
+void ScNoteUtil::DuplicateNotes(const ScColumn& mrSrcCol, ScColumn& mrDestCol, SCROW nStartRow, size_t nDataSize, sc::ColumnBlockPosition& maDestPos )
+{
+        SCCOL nDestCol = mrDestCol.GetCol();
+        SCTAB nDestTab = mrDestCol.GetTab();
+        SCCOL nSrcCol = mrSrcCol.GetCol();
+        SCTAB nSrcTab = mrSrcCol.GetTab();
+
+        SCROW nRowMax = nStartRow + nDataSize;
+
+        std::vector<ScPostIt*> vDestNotes(nDataSize);
 
+        sc::CellNoteStoreType maSrcCellNotes = mrSrcCol.GetCellNoteStore();
+        sc::CellNoteStoreType::iterator posSrc = maSrcCellNotes.begin();
+
+        for (SCROW nRow = nStartRow; nRow < nRowMax; ++nRow)
+        {
+            sc::CellNoteStoreType::position_type curPosObj = maSrcCellNotes.position(posSrc, nRow);
+            posSrc = curPosObj.first;
+            size_t offset = curPosObj.second;
+            if (posSrc->type == sc::element_type_cellnote)
+            {
+                ScAddress aDestAddress = ScAddress(nDestCol, nRow, nDestTab);
+                ScAddress aSrcAddress = ScAddress(nSrcCol, nRow, nSrcTab );
+
+                ScPostIt* pSrcNote = sc::cellnote_block::at(*posSrc->data, offset);
+                ScPostIt* pClonedNote = pSrcNote->Clone(aSrcAddress, mrDestCol.GetDoc(), aDestAddress, true );
+
+                vDestNotes[nRow-nStartRow] = pClonedNote;
+            }
+        }
+        // set the cloned notes vector in its dest position
+        sc::CellNoteStoreType maDestCellNotes = mrDestCol.GetCellNoteStore();
+        maDestCellNotes.set_empty(nStartRow, nRowMax-1);
+        maDestPos.miCellNotePos = maDestCellNotes.set(
+            maDestPos.miCellNotePos, nStartRow, vDestNotes.begin(), vDestNotes.end());
+
+}
+*/
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list