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

Laurent Godard lgodard.libre at laposte.net
Mon Oct 7 01:27:05 PDT 2013


 sc/inc/column.hxx               |    6 ++++--
 sc/source/core/data/column.cxx  |   18 ++++++++++++------
 sc/source/core/data/column2.cxx |   11 ++++++-----
 sc/source/core/data/column3.cxx |   17 ++++++++++++-----
 sc/source/core/data/table2.cxx  |   13 -------------
 5 files changed, 34 insertions(+), 31 deletions(-)

New commits:
commit 2c5b3b77b1ef7585564f650dc50fae02f4bacb04
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Mon Oct 7 10:24:04 2013 +0200

    unify notes copy paste calls & honor options
    
    Change-Id: Id2a60f74bb00a68b93820cfd612f9a14dadebc4c

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 38808b1..d09900d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -497,8 +497,10 @@ public:
     SCROW GetCellNotesMaxRow() const;
     SCROW GetCellNotesMinRow() const;
 
-    void CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest=0) const;
-    void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol, sc::ColumnBlockPosition& maDestBlockPos, SCROW nRowOffsetDest=0 ) const;
+    void CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
+                                     SCROW nRowOffsetDest=0) const;
+    void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
+                            sc::ColumnBlockPosition& maDestBlockPos, bool bCloneCaption = true, SCROW nRowOffsetDest=0 ) const;
     void UpdateNoteCaptions();
 
     void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index dc75b99..25f4b66 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1653,9 +1653,9 @@ class CopyAsLinkHandler
         setDefaultAttrsToDest(nTopRow, nDataSize);
     }
 
-    void duplicateNotes(SCROW nStartRow, size_t nDataSize )
+    void duplicateNotes(SCROW nStartRow, size_t nDataSize, bool bCloneCaption )
     {
-        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestPos);
+        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestPos, bCloneCaption);
     }
 
 public:
@@ -1677,7 +1677,10 @@ public:
         size_t nRow = aNode.position + nOffset;
 
         if (mnCopyFlags & (IDF_NOTE|IDF_ADDNOTES))
-                duplicateNotes(nRow, nDataSize );
+        {
+            bool bCloneCaption = (mnCopyFlags & IDF_NOCAPTIONS) == 0;
+            duplicateNotes(nRow, nDataSize, bCloneCaption );
+        }
 
         switch (aNode.type)
         {
@@ -1838,9 +1841,9 @@ class CopyByCloneHandler
         }
     }
 
-    void duplicateNotes(SCROW nStartRow, size_t nDataSize )
+    void duplicateNotes(SCROW nStartRow, size_t nDataSize, bool bCloneCaption )
     {
-        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestPos);
+        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestPos, bCloneCaption);
     }
 
 public:
@@ -1862,7 +1865,10 @@ public:
         size_t nRow = aNode.position + nOffset;
 
         if (mnCopyFlags & (IDF_NOTE|IDF_ADDNOTES))
-                duplicateNotes(nRow, nDataSize );
+        {
+            bool bCloneCaption = (mnCopyFlags & IDF_NOCAPTIONS) == 0;
+            duplicateNotes(nRow, nDataSize, bCloneCaption );
+        }
 
         switch (aNode.type)
         {
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index cc845cf..0f97c50 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1633,7 +1633,7 @@ void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& r
     }
 }
 
-void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest) const
+void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption, SCROW nRowOffsetDest) const
 {
     SCCOL nDestCol = rDestCol.GetCol();
     SCTAB nDestTab = rDestCol.GetTab();
@@ -1689,7 +1689,7 @@ void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDest
                     ScPostIt* pSrcNote = *itData;
                     ScAddress aDestAddress = ScAddress(nDestCol, curRow + nRowOffsetDest, nDestTab);
                     ScAddress aSrcAddress = ScAddress(nCol, curRow, nTab );
-                    ScPostIt* pClonedNote = pSrcNote->Clone(aSrcAddress, rDestCol.GetDoc(), aDestAddress, true );
+                    ScPostIt* pClonedNote = pSrcNote->Clone(aSrcAddress, rDestCol.GetDoc(), aDestAddress, bCloneCaption );
                     vCloned.push_back(pClonedNote);
                 }
 
@@ -1705,7 +1705,7 @@ void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDest
                 ScPostIt* pSrcNote = *itData;
                 ScAddress aDestAddress = ScAddress(nDestCol, curRow + nRowOffsetDest, nDestTab);
                 ScAddress aSrcAddress = ScAddress(nCol, curRow, nTab );
-                ScPostIt* pClonedNote = pSrcNote->Clone(aSrcAddress, rDestCol.GetDoc(), aDestAddress, true );
+                ScPostIt* pClonedNote = pSrcNote->Clone(aSrcAddress, rDestCol.GetDoc(), aDestAddress, bCloneCaption );
                 vCloned.push_back(pClonedNote);
             }
             rDestCol.maCellNotes.set(rDestCol.maCellNotes.begin(), nBlockStart + nOffsetInBlock + nRowOffsetDest, vCloned.begin(), vCloned.end());
@@ -1714,9 +1714,10 @@ void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDest
     }
 }
 
-void ScColumn::DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol, sc::ColumnBlockPosition& maDestBlockPos, SCROW nRowOffsetDest ) const
+void ScColumn::DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol, sc::ColumnBlockPosition& maDestBlockPos,
+                              bool bCloneCaption, SCROW nRowOffsetDest ) const
 {
-        CopyCellNotesToDocument(nStartRow, nStartRow + nDataSize -1, rDestCol, nRowOffsetDest);
+        CopyCellNotesToDocument(nStartRow, nStartRow + nDataSize -1, rDestCol, bCloneCaption, nRowOffsetDest);
         maDestBlockPos.miCellNotePos = rDestCol.maCellNotes.begin();
 }
 
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index a7dee56..e638fa4 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -697,9 +697,9 @@ class CopyCellsFromClipHandler
             maDestBlockPos, nDestRow, new ScFormulaCell(&mrDestCol.GetDoc(), aDestPos, &aArr));
     }
 
-    void duplicateNotes(SCROW nStartRow, size_t nDataSize )
+    void duplicateNotes(SCROW nStartRow, size_t nDataSize, bool bCloneCaption )
     {
-        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestBlockPos, mnRowOffset);
+        mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestBlockPos, bCloneCaption, mnRowOffset);
     }
 
 public:
@@ -733,14 +733,18 @@ public:
         SCROW nSrcRow1 = node.position + nOffset;
         bool bCopyCellNotes = mrCxt.isCloneNotes();
 
+        sal_uInt16 nFlags = mrCxt.getInsertFlag();
+
         if (node.type == sc::element_type_empty)
         {
             if (bCopyCellNotes)
-                duplicateNotes(nSrcRow1, nDataSize );
+            {
+                bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
+                duplicateNotes(nSrcRow1, nDataSize, bCloneCaption );
+            }
             return;
         }
 
-        sal_uInt16 nFlags = mrCxt.getInsertFlag();
         bool bNumeric = (nFlags & IDF_VALUE) != 0;
         bool bDateTime = (nFlags & IDF_DATETIME) != 0;
         bool bString   = (nFlags & IDF_STRING) != 0;
@@ -903,7 +907,10 @@ public:
                 ;
         }
         if (bCopyCellNotes)
-            duplicateNotes(nSrcRow1, nDataSize );
+        {
+            bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
+            duplicateNotes(nSrcRow1, nDataSize, bCloneCaption );
+        }
     }
 };
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 1ed6ae1..e8004e2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1196,19 +1196,6 @@ void ScTable::UndoToTable(
                 aCol[i].CopyToColumn(rCxt, 0, MAXROW, IDF_FORMULA, false, pDestTab->aCol[i]);
         }
 
-/* TODO : notes copy - verifu undoToColumn and copyToColumn Flags
-        //remove old notes
-        if (nFlags & IDF_CONTENTS)
-            pDestTab->maNotes.erase(nCol1, nRow1, nCol2, nRow2);
-
-        bool bAddNotes = nFlags & (IDF_NOTE | IDF_ADDNOTES);
-        if (bAddNotes)
-        {
-            bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
-            pDestTab->maNotes.CopyFromClip(maNotes, pDocument, nCol1, nRow1, nCol2, nRow2, 0, 0, pDestTab->nTab, bCloneCaption);
-        }
-*/
-
         if (nFlags & IDF_ATTRIB)
             pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->pDocument, *mpCondFormatList));
 


More information about the Libreoffice-commits mailing list