[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/Library_sc.mk sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue May 14 20:39:24 PDT 2013


 sc/Library_sc.mk                    |    1 
 sc/inc/clipcontext.hxx              |   26 ++++++++++++++++++++++
 sc/inc/column.hxx                   |    7 ++++--
 sc/inc/document.hxx                 |   16 +++++++-------
 sc/inc/table.hxx                    |    7 ++++--
 sc/source/core/data/clipcontext.cxx |   19 ++++++++++++++++
 sc/source/core/data/column3.cxx     |    6 ++---
 sc/source/core/data/document.cxx    |   41 ++++++++++++++++++------------------
 sc/source/core/data/table2.cxx      |    8 +++----
 9 files changed, 93 insertions(+), 38 deletions(-)

New commits:
commit c7fec34b4c60564212036ef5cd77636686689646
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 14 23:39:50 2013 -0400

    Introduce copy-from-clip context for copy handling code.
    
    It's not used yet, and is currently empty.
    
    Change-Id: Ia377994ae042fc8b19d269adc2f94830422770f1

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 6f322ee..f4ed57d 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -90,6 +90,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/data/cell \
 	sc/source/core/data/cell2 \
 	sc/source/core/data/cellvalue \
+	sc/source/core/data/clipcontext \
 	sc/source/core/data/clipparam \
 	sc/source/core/data/column \
 	sc/source/core/data/column2 \
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx
new file mode 100644
index 0000000..00049f1
--- /dev/null
+++ b/sc/inc/clipcontext.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_CLIPCONTEXT_HXX
+#define SC_CLIPCONTEXT_HXX
+
+namespace sc {
+
+class CopyFromClipContext
+{
+public:
+    CopyFromClipContext();
+    ~CopyFromClipContext();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index b7539c6..9d810e1 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -50,6 +50,7 @@ namespace editeng { class SvxBorderLine; }
 namespace sc {
     struct FormulaGroupContext;
     class EndListeningContext;
+    class CopyFromClipContext;
 }
 
 class Fraction;
@@ -234,8 +235,10 @@ public:
     void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const;
     void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
     void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
-    void        CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
-                                sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn);
+    void CopyFromClip(
+        sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy,
+        sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn );
+
     void        StartListeningInArea( SCROW nRow1, SCROW nRow2 );
     void        BroadcastInArea( SCROW nRow1, SCROW nRow2 );
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0c59a67..7b7ea40 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -50,6 +50,7 @@ namespace editeng { class SvxBorderLine; }
 namespace sc {
     struct FormulaGroupContext;
     class EndListeningContext;
+    class CopyFromClipContext;
 }
 class SvxFontItem;
 
@@ -1140,13 +1141,14 @@ public:
 
     void            CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                 SCTAB nTab, ScDocument* pClipDoc = NULL);
-    void            CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-                                    const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
-                                    const ScCopyBlockFromClipParams* pCBFCP );
-    void            CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-                                    const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
-                                    const ScCopyBlockFromClipParams* pCBFCP,
-                                    SCROW & rClipStartRow );
+    void CopyBlockFromClip(
+        sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+        const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP );
+    void CopyNonFilteredFromClip(
+        sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+        const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP,
+        SCROW & rClipStartRow );
+
     void            StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
                                         SCCOL nCol2, SCROW nRow2,
                                         const ScMarkData& rMark, sal_uInt16 nInsFlag );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 543bdc9..ac2b2bf 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -50,6 +50,7 @@ namespace com { namespace sun { namespace star {
 namespace sc {
     struct FormulaGroupContext;
     class EndListeningContext;
+    class CopyFromClipContext;
 }
 
 class SfxItemSet;
@@ -383,8 +384,10 @@ public:
                            bool bKeepScenarioFlags, bool bCloneNoteCaptions);
     void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
     void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
-    void        CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
-                                sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable);
+    void CopyFromClip(
+        sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+        SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable );
+
     void        StartListeningInArea( SCCOL nCol1, SCROW nRow1,
                                         SCCOL nCol2, SCROW nRow2 );
     void        BroadcastInArea( SCCOL nCol1, SCROW nRow1,
diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx
new file mode 100644
index 0000000..adfbfbb
--- /dev/null
+++ b/sc/source/core/data/clipcontext.cxx
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "clipcontext.hxx"
+
+namespace sc {
+
+CopyFromClipContext::CopyFromClipContext() {}
+CopyFromClipContext::~CopyFromClipContext() {}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 1d5d146..2939be0 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -564,9 +564,9 @@ ScFormulaCell* ScColumn::CreateRefCell( ScDocument* pDestDoc, const ScAddress& r
 //  rColumn = source
 //  nRow1, nRow2 = target position
 
-void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
-                                sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty,
-                                ScColumn& rColumn)
+void ScColumn::CopyFromClip(
+    sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy,
+    sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn )
 {
     if ((nInsFlag & IDF_ATTRIB) != 0)
     {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c51804a..7245efb 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -90,6 +90,7 @@
 #include "stringutil.hxx"
 #include "formulaiter.hxx"
 #include "formulacell.hxx"
+#include "clipcontext.hxx"
 
 #include <map>
 #include <limits>
@@ -2295,11 +2296,9 @@ void ScDocument::BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
     }
 }
 
-void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
-                                    SCCOL nCol2, SCROW nRow2,
-                                    const ScMarkData& rMark,
-                                    SCsCOL nDx, SCsROW nDy,
-                                    const ScCopyBlockFromClipParams* pCBFCP )
+void ScDocument::CopyBlockFromClip(
+    sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+    const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP )
 {
     TableContainer& rClipTabs = pCBFCP->pClipDoc->maTabs;
     SCTAB nTabEnd = pCBFCP->nTabEnd;
@@ -2310,8 +2309,8 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
         {
             while (!rClipTabs[nClipTab]) nClipTab = (nClipTab+1) % (static_cast<SCTAB>(rClipTabs.size()));
 
-            maTabs[i]->CopyFromClip( nCol1, nRow1, nCol2, nRow2, nDx, nDy,
-                pCBFCP->nInsFlag, pCBFCP->bAsLink, pCBFCP->bSkipAttrForEmpty, rClipTabs[nClipTab] );
+            maTabs[i]->CopyFromClip(rCxt, nCol1, nRow1, nCol2, nRow2, nDx, nDy,
+                pCBFCP->nInsFlag, pCBFCP->bAsLink, pCBFCP->bSkipAttrForEmpty, rClipTabs[nClipTab]);
 
             if ( pCBFCP->pClipDoc->pDrawLayer && ( pCBFCP->nInsFlag & IDF_OBJECTS ) )
             {
@@ -2378,12 +2377,10 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
 }
 
 
-void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
-                                    SCCOL nCol2, SCROW nRow2,
-                                    const ScMarkData& rMark,
-                                    SCsCOL nDx, SCsROW /* nDy */,
-                                    const ScCopyBlockFromClipParams* pCBFCP,
-                                    SCROW & rClipStartRow )
+void ScDocument::CopyNonFilteredFromClip(
+    sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+    const ScMarkData& rMark, SCsCOL nDx, SCsROW /*nDy*/, const ScCopyBlockFromClipParams* pCBFCP,
+    SCROW & rClipStartRow )
 {
     //  call CopyBlockFromClip for ranges of consecutive non-filtered rows
     //  nCol1/nRow1 etc. is in target doc
@@ -2418,7 +2415,8 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
                 nFollow = nRow2 - nDestRow;
 
             SCsROW nNewDy = ((SCsROW)nDestRow) - nSourceRow;
-            CopyBlockFromClip( nCol1, nDestRow, nCol2, nDestRow + nFollow, rMark, nDx, nNewDy, pCBFCP );
+            CopyBlockFromClip(
+                rCxt, nCol1, nDestRow, nCol2, nDestRow + nFollow, rMark, nDx, nNewDy, pCBFCP);
 
             nSourceRow += nFollow + 1;
             nDestRow += nFollow + 1;
@@ -2531,6 +2529,8 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
 
     bInsertingFromOtherDoc = true;  // kein Broadcast/Listener aufbauen bei Insert
 
+    sc::CopyFromClipContext aCxt;
+
     SCCOL nClipStartCol = aClipRange.aStart.Col();
     SCROW nClipStartRow = aClipRange.aStart.Row();
     SCROW nClipEndRow = aClipRange.aEnd.Row();
@@ -2568,14 +2568,14 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
                 SCsROW nDy = ((SCsROW)nR1) - nClipStartRow;
                 if ( bIncludeFiltered )
                 {
-                    CopyBlockFromClip( nC1, nR1, nC2, nR2, rMark, nDx,
-                            nDy, &aCBFCP );
+                    CopyBlockFromClip(
+                        aCxt, nC1, nR1, nC2, nR2, rMark, nDx, nDy, &aCBFCP);
                     nClipStartRow += nR2 - nR1 + 1;
                 }
                 else
                 {
-                    CopyNonFilteredFromClip( nC1, nR1, nC2, nR2, rMark,
-                            nDx, nDy, &aCBFCP, nClipStartRow );
+                    CopyNonFilteredFromClip(
+                        aCxt, nC1, nR1, nC2, nR2, rMark, nDx, nDy, &aCBFCP, nClipStartRow);
                 }
                 nC1 = nC2 + 1;
                 nC2 = std::min((SCCOL)(nC1 + nXw), nCol2);
@@ -2670,6 +2670,7 @@ void ScDocument::CopyMultiRangeFromClip(
     sal_uInt16 nDelFlag = IDF_CONTENTS;
     const ScBitMaskCompressedArray<SCROW, sal_uInt8>& rFlags = GetRowFlagsArray(aCBFCP.nTabStart);
 
+    sc::CopyFromClipContext aCxt;
     for ( size_t i = 0, n = rClipParam.maRanges.size(); i < n; ++i )
     {
         ScRange* p = rClipParam.maRanges[ i ];
@@ -2686,7 +2687,7 @@ void ScDocument::CopyMultiRangeFromClip(
         if (!bSkipAttrForEmpty)
             DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
 
-        CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
+        CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
         nRowCount -= nEndRow - nBegRow + 1;
 
         while (nRowCount > 0)
@@ -2705,7 +2706,7 @@ void ScDocument::CopyMultiRangeFromClip(
             if (!bSkipAttrForEmpty)
                 DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
 
-            CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
+            CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
             nRowCount -= nEndRow - nBegRow + 1;
         }
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 5af802f..7e9b4c0 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -745,9 +745,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
     }
 }
 
-void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-                            SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag,
-                            bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable)
+void ScTable::CopyFromClip(
+    sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+    SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable )
 {
 
     if (nCol2 > MAXCOL)
@@ -758,7 +758,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
     {
         for ( SCCOL i = nCol1; i <= nCol2; i++)
-            aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
+            aCol[i].CopyFromClip(rCxt, nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
 
 
         if(nInsFlag != IDF_OBJECTS)


More information about the Libreoffice-commits mailing list