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

Kohei Yoshida kohei.yoshida at gmail.com
Wed Jun 19 08:17:39 PDT 2013


 sc/inc/cellclonehandler.hxx              |   17 +++--
 sc/source/core/data/cellclonehandler.cxx |   47 +++++++++++---
 sc/source/core/data/column.cxx           |  101 +++++++++++++++++++------------
 sc/source/core/data/column2.cxx          |    4 +
 sc/source/core/data/column3.cxx          |   18 +----
 5 files changed, 120 insertions(+), 67 deletions(-)

New commits:
commit 854176b039e41ba12c56c311699b514b4e625784
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Jun 19 11:19:26 2013 -0400

    Have the clone handler handle the text attr array as well.
    
    In order to handle the special case of cell removal.
    
    Change-Id: I7782232ce0fe6c0248c40482ec62d909d2dfe621

diff --git a/sc/inc/cellclonehandler.hxx b/sc/inc/cellclonehandler.hxx
index a08383c..4ae8123 100644
--- a/sc/inc/cellclonehandler.hxx
+++ b/sc/inc/cellclonehandler.hxx
@@ -25,32 +25,39 @@ class CellBlockCloneHandler
     ScDocument& mrSrcDoc;
     ScDocument& mrDestDoc;
     CellStoreType& mrDestCellStore;
+    CellTextAttrStoreType& mrDestAttrStore;
 
 protected:
     ScDocument& getSrcDoc();
     ScDocument& getDestDoc();
     const ScDocument& getDestDoc() const;
     CellStoreType& getDestCellStore();
+    CellTextAttrStoreType& getDestAttrStore();
+
+    void setDefaultAttrToDest(ColumnBlockPosition& rPos, SCROW nRow);
+    void setDefaultAttrsToDest(ColumnBlockPosition& rPos, SCROW nRow, size_t nSize);
 
 public:
     CellBlockCloneHandler(
-        ScDocument& rSrcDoc, ScDocument& rDestDoc, CellStoreType& rDestCellStore);
+        ScDocument& rSrcDoc, ScDocument& rDestDoc,
+        CellStoreType& rDestCellStore, CellTextAttrStoreType& rDestAttrStore);
+
     virtual ~CellBlockCloneHandler();
 
     virtual void cloneDoubleBlock(
-        CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const numeric_block::const_iterator& itBegin, const numeric_block::const_iterator& itEnd);
 
     virtual void cloneStringBlock(
-        CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const string_block::const_iterator& itBegin, const string_block::const_iterator& itEnd);
 
     virtual void cloneEditTextBlock(
-        CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const edittext_block::const_iterator& itBegin, const edittext_block::const_iterator& itEnd);
 
     virtual void cloneFormulaBlock(
-        CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const formula_block::const_iterator& itBegin, const formula_block::const_iterator& itEnd);
 };
 
diff --git a/sc/source/core/data/cellclonehandler.cxx b/sc/source/core/data/cellclonehandler.cxx
index 1f1d75c..8f5bd17 100644
--- a/sc/source/core/data/cellclonehandler.cxx
+++ b/sc/source/core/data/cellclonehandler.cxx
@@ -14,8 +14,10 @@
 namespace sc {
 
 CellBlockCloneHandler::CellBlockCloneHandler(
-    ScDocument& rSrcDoc, ScDocument& rDestDoc, CellStoreType& rDestCellStore) :
-    mrSrcDoc(rSrcDoc), mrDestDoc(rDestDoc), mrDestCellStore(rDestCellStore) {}
+    ScDocument& rSrcDoc, ScDocument& rDestDoc,
+    CellStoreType& rDestCellStore, CellTextAttrStoreType& rDestAttrStore) :
+    mrSrcDoc(rSrcDoc), mrDestDoc(rDestDoc),
+    mrDestCellStore(rDestCellStore), mrDestAttrStore(rDestAttrStore) {}
 
 CellBlockCloneHandler::~CellBlockCloneHandler() {}
 
@@ -39,22 +41,41 @@ CellStoreType& CellBlockCloneHandler::getDestCellStore()
     return mrDestCellStore;
 }
 
+CellTextAttrStoreType& CellBlockCloneHandler::getDestAttrStore()
+{
+    return mrDestAttrStore;
+}
+
+void CellBlockCloneHandler::setDefaultAttrToDest(ColumnBlockPosition& rPos, SCROW nRow)
+{
+    rPos.miCellTextAttrPos = mrDestAttrStore.set(rPos.miCellTextAttrPos, nRow, CellTextAttr());
+}
+
+void CellBlockCloneHandler::setDefaultAttrsToDest(ColumnBlockPosition& rPos, SCROW nRow, size_t nSize)
+{
+    std::vector<sc::CellTextAttr> aAttrs(nSize); // default values
+    rPos.miCellTextAttrPos = mrDestAttrStore.set(
+        rPos.miCellTextAttrPos, nRow, aAttrs.begin(), aAttrs.end());
+}
+
 void CellBlockCloneHandler::cloneDoubleBlock(
-    CellStoreType::iterator& itPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
+    ColumnBlockPosition& rPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
     const numeric_block::const_iterator& itBegin, const numeric_block::const_iterator& itEnd)
 {
-    itPos = mrDestCellStore.set(itPos, rDestPos.Row(), itBegin, itEnd);
+    rPos.miCellPos = mrDestCellStore.set(rPos.miCellPos, rDestPos.Row(), itBegin, itEnd);
+    setDefaultAttrsToDest(rPos, rDestPos.Row(), std::distance(itBegin, itEnd));
 }
 
 void CellBlockCloneHandler::cloneStringBlock(
-    CellStoreType::iterator& itPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
+    ColumnBlockPosition& rPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
     const string_block::const_iterator& itBegin, const string_block::const_iterator& itEnd)
 {
-    itPos = mrDestCellStore.set(itPos, rDestPos.Row(), itBegin, itEnd);
+    rPos.miCellPos = mrDestCellStore.set(rPos.miCellPos, rDestPos.Row(), itBegin, itEnd);
+    setDefaultAttrsToDest(rPos, rDestPos.Row(), std::distance(itBegin, itEnd));
 }
 
 void CellBlockCloneHandler::cloneEditTextBlock(
-    CellStoreType::iterator& itPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
+    ColumnBlockPosition& rPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
     const edittext_block::const_iterator& itBegin, const edittext_block::const_iterator& itEnd)
 {
     std::vector<EditTextObject*> aCloned;
@@ -62,11 +83,14 @@ void CellBlockCloneHandler::cloneEditTextBlock(
     for (edittext_block::const_iterator it = itBegin; it != itEnd; ++it)
         aCloned.push_back(ScEditUtil::Clone(**it, getDestDoc()));
 
-    itPos = getDestCellStore().set(itPos, rDestPos.Row(), aCloned.begin(), aCloned.end());
+    rPos.miCellPos = getDestCellStore().set(
+        rPos.miCellPos, rDestPos.Row(), aCloned.begin(), aCloned.end());
+
+    setDefaultAttrsToDest(rPos, rDestPos.Row(), std::distance(itBegin, itEnd));
 }
 
 void CellBlockCloneHandler::cloneFormulaBlock(
-    CellStoreType::iterator& itPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
+    ColumnBlockPosition& rPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
     const formula_block::const_iterator& itBegin, const formula_block::const_iterator& itEnd)
 {
     std::vector<ScFormulaCell*> aCloned;
@@ -81,7 +105,10 @@ void CellBlockCloneHandler::cloneFormulaBlock(
         aCloned.push_back(new ScFormulaCell(rOld, getDestDoc(), aDestPos));
     }
 
-    itPos = getDestCellStore().set(itPos, rDestPos.Row(), aCloned.begin(), aCloned.end());
+    rPos.miCellPos = getDestCellStore().set(
+        rPos.miCellPos, rDestPos.Row(), aCloned.begin(), aCloned.end());
+
+    setDefaultAttrsToDest(rPos, rDestPos.Row(), std::distance(itBegin, itEnd));
 }
 
 }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ea9570e..a239a0f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1286,8 +1286,9 @@ namespace {
 class CopyToClipHandler : public sc::CellBlockCloneHandler
 {
 public:
-    CopyToClipHandler(ScDocument& rSrcDoc, ScDocument& rDestDoc, sc::CellStoreType& rDestCellStore) :
-        sc::CellBlockCloneHandler(rSrcDoc, rDestDoc, rDestCellStore) {}
+    CopyToClipHandler(ScDocument& rSrcDoc, ScDocument& rDestDoc,
+                      sc::CellStoreType& rDestCellStore, sc::CellTextAttrStoreType& rDestAttrStore) :
+        sc::CellBlockCloneHandler(rSrcDoc, rDestDoc, rDestCellStore, rDestAttrStore) {}
 };
 
 }
@@ -1298,7 +1299,7 @@ void ScColumn::CopyToClip(
     pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray,
                           rCxt.isKeepScenarioFlags() ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL );
 
-    CopyToClipHandler aHdl(*pDocument, *rColumn.pDocument, rColumn.maCells);
+    CopyToClipHandler aHdl(*pDocument, *rColumn.pDocument, rColumn.maCells, rColumn.maCellTextAttrs);
     CopyCellsInRangeToColumn(NULL, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), aHdl, nRow1, nRow2, rColumn);
 }
 
@@ -1483,27 +1484,29 @@ class CopyAsLinkHandler : public sc::CellBlockCloneHandler
 
     template<typename _DataBlock>
     void createRefBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const typename _DataBlock::const_iterator& itBegin, const typename _DataBlock::const_iterator& itEnd)
     {
+        size_t nSize = std::distance(itBegin, itEnd);
         maCellBuffer.clear();
-        maCellBuffer.reserve(std::distance(itBegin, itEnd));
+        maCellBuffer.reserve(nSize);
         ScAddress aSrcPos = rSrcPos;
         ScAddress aDestPos = rDestPos;
         for (typename _DataBlock::const_iterator it = itBegin; it != itEnd; ++it, aSrcPos.IncRow(), aDestPos.IncRow())
             maCellBuffer.push_back(createRefCell(aSrcPos, aDestPos));
 
-        itPos = getDestCellStore().set(itPos, rDestPos.Row(), maCellBuffer.begin(), maCellBuffer.end());
+        rPos.miCellPos = getDestCellStore().set(rPos.miCellPos, rDestPos.Row(), maCellBuffer.begin(), maCellBuffer.end());
+        setDefaultAttrsToDest(rPos, rDestPos.Row(), nSize);
     }
 
 public:
     CopyAsLinkHandler(
-        ScDocument& rSrcDoc, ScDocument& rDestDoc, sc::CellStoreType& rDestCellStore, sal_uInt16 nCopyFlags) :
-        sc::CellBlockCloneHandler(rSrcDoc, rDestDoc, rDestCellStore),
+        ScDocument& rSrcDoc, ScDocument& rDestDoc, sc::CellStoreType& rDestCellStore, sc::CellTextAttrStoreType& rDestAttrStore, sal_uInt16 nCopyFlags) :
+        sc::CellBlockCloneHandler(rSrcDoc, rDestDoc, rDestCellStore, rDestAttrStore),
         mnCopyFlags(nCopyFlags) {}
 
     virtual void cloneDoubleBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::numeric_block::const_iterator& itBegin, const sc::numeric_block::const_iterator& itEnd)
     {
         if ((mnCopyFlags & (IDF_DATETIME|IDF_VALUE)) == 0)
@@ -1516,39 +1519,39 @@ public:
             if (!canCopyValue(getSrcDoc(), aSrcPos, mnCopyFlags))
                 continue;
 
-            itPos = getDestCellStore().set(itPos, aDestPos.Row(), createRefCell(aSrcPos, aDestPos));
+            rPos.miCellPos = getDestCellStore().set(rPos.miCellPos, aDestPos.Row(), createRefCell(aSrcPos, aDestPos));
+            setDefaultAttrToDest(rPos, aDestPos.Row());
         }
-
     }
 
     virtual void cloneStringBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::string_block::const_iterator& itBegin, const sc::string_block::const_iterator& itEnd)
     {
         if (!(mnCopyFlags & IDF_STRING))
             return;
 
-        createRefBlock<sc::string_block>(itPos, rSrcPos, rDestPos, itBegin, itEnd);
+        createRefBlock<sc::string_block>(rPos, rSrcPos, rDestPos, itBegin, itEnd);
     }
 
     virtual void cloneEditTextBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::edittext_block::const_iterator& itBegin, const sc::edittext_block::const_iterator& itEnd)
     {
         if (!(mnCopyFlags & IDF_STRING))
             return;
 
-        createRefBlock<sc::edittext_block>(itPos, rSrcPos, rDestPos, itBegin, itEnd);
+        createRefBlock<sc::edittext_block>(rPos, rSrcPos, rDestPos, itBegin, itEnd);
     }
 
     virtual void cloneFormulaBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::formula_block::const_iterator& itBegin, const sc::formula_block::const_iterator& itEnd)
     {
         if (!(mnCopyFlags & IDF_FORMULA))
             return;
 
-        createRefBlock<sc::formula_block>(itPos, rSrcPos, rDestPos, itBegin, itEnd);
+        createRefBlock<sc::formula_block>(rPos, rSrcPos, rDestPos, itBegin, itEnd);
     }
 };
 
@@ -1557,7 +1560,7 @@ class CopyByCloneHandler : public sc::CellBlockCloneHandler
     sal_uInt16 mnCopyFlags;
 
     void cloneFormulaCell(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         ScFormulaCell& rSrcCell)
     {
         bool bCloneValue          = (mnCopyFlags & IDF_VALUE) != 0;
@@ -1584,8 +1587,9 @@ class CopyByCloneHandler : public sc::CellBlockCloneHandler
         if (bForceFormula || bCloneFormula)
         {
             // Clone as formula cell.
-            itPos = getDestCellStore().set(
-                itPos, rDestPos.Row(), new ScFormulaCell(rSrcCell, getDestDoc(), rDestPos));
+            rPos.miCellPos = getDestCellStore().set(
+                rPos.miCellPos, rDestPos.Row(), new ScFormulaCell(rSrcCell, getDestDoc(), rDestPos));
+            setDefaultAttrToDest(rPos, rDestPos.Row());
 
             return;
         }
@@ -1601,8 +1605,9 @@ class CopyByCloneHandler : public sc::CellBlockCloneHandler
                 // error codes are cloned with values
                 ScFormulaCell* pErrCell = new ScFormulaCell(&getDestDoc(), rDestPos);
                 pErrCell->SetErrCode(nErr);
-                itPos = getDestCellStore().set(
-                    itPos, rDestPos.Row(), new ScFormulaCell(rSrcCell, getDestDoc(), rDestPos));
+                rPos.miCellPos = getDestCellStore().set(
+                    rPos.miCellPos, rDestPos.Row(), new ScFormulaCell(rSrcCell, getDestDoc(), rDestPos));
+                setDefaultAttrToDest(rPos, rDestPos.Row());
                 return;
             }
         }
@@ -1612,7 +1617,11 @@ class CopyByCloneHandler : public sc::CellBlockCloneHandler
             if (rSrcCell.IsValue())
             {
                 if (canCopyValue(getSrcDoc(), rSrcPos, mnCopyFlags))
-                    itPos = getDestCellStore().set(itPos, rDestPos.Row(), rSrcCell.GetValue());
+                {
+                    rPos.miCellPos = getDestCellStore().set(
+                        rPos.miCellPos, rDestPos.Row(), rSrcCell.GetValue());
+                    setDefaultAttrToDest(rPos, rDestPos.Row());
+                }
 
                 return;
             }
@@ -1630,22 +1639,29 @@ class CopyByCloneHandler : public sc::CellBlockCloneHandler
                 // Clone as an edit text object.
                 EditEngine& rEngine = getDestDoc().GetEditEngine();
                 rEngine.SetText(aStr);
-                itPos = getDestCellStore().set(itPos, rDestPos.Row(), rEngine.CreateTextObject());
+                rPos.miCellPos =
+                    getDestCellStore().set(rPos.miCellPos, rDestPos.Row(), rEngine.CreateTextObject());
             }
             else
-                itPos = getDestCellStore().set(itPos, rDestPos.Row(), aStr);
+            {
+                rPos.miCellPos =
+                    getDestCellStore().set(rPos.miCellPos, rDestPos.Row(), aStr);
+            }
+
+            setDefaultAttrToDest(rPos, rDestPos.Row());
         }
     }
 
 public:
-    CopyByCloneHandler(ScDocument& rSrcDoc, ScDocument& rDestDoc, sc::CellStoreType& rDestCellStore, sal_uInt16 nCopyFlags) :
-        sc::CellBlockCloneHandler(rSrcDoc,rDestDoc,rDestCellStore),
+    CopyByCloneHandler(ScDocument& rSrcDoc, ScDocument& rDestDoc,
+                       sc::CellStoreType& rDestCellStore, sc::CellTextAttrStoreType& rDestAttrStore, sal_uInt16 nCopyFlags) :
+        sc::CellBlockCloneHandler(rSrcDoc, rDestDoc, rDestCellStore, rDestAttrStore),
         mnCopyFlags(nCopyFlags)
     {
     }
 
     virtual void cloneDoubleBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::numeric_block::const_iterator& itBegin, const sc::numeric_block::const_iterator& itEnd)
     {
         if ((mnCopyFlags & (IDF_DATETIME|IDF_VALUE)) == 0)
@@ -1658,12 +1674,13 @@ public:
             if (!canCopyValue(getSrcDoc(), aSrcPos, mnCopyFlags))
                 continue;
 
-            itPos = getDestCellStore().set(itPos, aDestPos.Row(), *it);
+            rPos.miCellPos = getDestCellStore().set(rPos.miCellPos, aDestPos.Row(), *it);
+            setDefaultAttrToDest(rPos, aDestPos.Row());
         }
     }
 
     virtual void cloneStringBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& /*rSrcPos*/, const ScAddress& rDestPos,
         const sc::string_block::const_iterator& itBegin, const sc::string_block::const_iterator& itEnd)
     {
         if (!(mnCopyFlags & IDF_STRING))
@@ -1674,31 +1691,37 @@ public:
         {
             const OUString& rStr = *it;
             if (rStr.isEmpty())
+            {
                 // String cell with empty value is used to special-case cell value removal.
-                itPos = getDestCellStore().set_empty(itPos, aDestPos.Row(), aDestPos.Row());
+                rPos.miCellPos = getDestCellStore().set_empty(rPos.miCellPos, aDestPos.Row(), aDestPos.Row());
+                rPos.miCellTextAttrPos = getDestAttrStore().set_empty(rPos.miCellTextAttrPos, aDestPos.Row(), aDestPos.Row());
+            }
             else
-                itPos = getDestCellStore().set(itPos, aDestPos.Row(), rStr);
+            {
+                rPos.miCellPos = getDestCellStore().set(rPos.miCellPos, aDestPos.Row(), rStr);
+                setDefaultAttrToDest(rPos, aDestPos.Row());
+            }
         }
     }
 
     virtual void cloneEditTextBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::edittext_block::const_iterator& itBegin, const sc::edittext_block::const_iterator& itEnd)
     {
         if (!(mnCopyFlags & IDF_STRING))
             return;
 
-        sc::CellBlockCloneHandler::cloneEditTextBlock(itPos, rSrcPos, rDestPos, itBegin, itEnd);
+        sc::CellBlockCloneHandler::cloneEditTextBlock(rPos, rSrcPos, rDestPos, itBegin, itEnd);
     }
 
     virtual void cloneFormulaBlock(
-        sc::CellStoreType::iterator& itPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
+        sc::ColumnBlockPosition& rPos, const ScAddress& rSrcPos, const ScAddress& rDestPos,
         const sc::formula_block::const_iterator& itBegin, const sc::formula_block::const_iterator& itEnd)
     {
         ScAddress aSrcPos = rSrcPos;
         ScAddress aDestPos = rDestPos;
         for (sc::formula_block::const_iterator it = itBegin; it != itEnd; ++it, aSrcPos.IncRow(), aDestPos.IncRow())
-            cloneFormulaCell(itPos, aSrcPos, aDestPos, const_cast<ScFormulaCell&>(**it));
+            cloneFormulaCell(rPos, aSrcPos, aDestPos, const_cast<ScFormulaCell&>(**it));
     }
 };
 
@@ -1756,9 +1779,9 @@ void ScColumn::CopyToColumn(
         boost::scoped_ptr<sc::CellBlockCloneHandler> pHdl(NULL);
 
         if (bAsLink)
-            pHdl.reset(new CopyAsLinkHandler(*pDocument, *rColumn.pDocument, rColumn.maCells, nFlags));
+            pHdl.reset(new CopyAsLinkHandler(*pDocument, *rColumn.pDocument, rColumn.maCells, rColumn.maCellTextAttrs, nFlags));
         else
-            pHdl.reset(new CopyByCloneHandler(*pDocument, *rColumn.pDocument, rColumn.maCells, nFlags));
+            pHdl.reset(new CopyByCloneHandler(*pDocument, *rColumn.pDocument, rColumn.maCells, rColumn.maCellTextAttrs, nFlags));
 
         CopyCellsInRangeToColumn(NULL, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), *pHdl, nRow1, nRow2, rColumn);
     }
@@ -1784,7 +1807,7 @@ void ScColumn::CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const
     // Copy cells from this column to the destination column only for those
     // rows that are present in the position column.
 
-    sc::CellBlockCloneHandler aHdl(*pDocument, *rDestCol.pDocument, rDestCol.maCells);
+    sc::CellBlockCloneHandler aHdl(*pDocument, *rDestCol.pDocument, rDestCol.maCells, rDestCol.maCellTextAttrs);
     sc::ColumnBlockConstPosition aSrcPos;
     sc::ColumnBlockPosition aDestPos;
     InitBlockPosition(aSrcPos);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 0a7deac..6ac4a17 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1506,6 +1506,10 @@ void ScColumn::CellStorageModified()
         if (itCell->position != itAttr->position || itCell->size != itAttr->size)
         {
             cout << "ScColumn::CellStorageModified: Cell array and cell text attribute array are out of sync." << endl;
+            cout << "-- cell array" << endl;
+            maCells.dump_blocks(cout);
+            cout << "-- attribute array" << endl;
+            maCellTextAttrs.dump_blocks(cout);
             cout.flush();
             abort();
         }
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 6edafee..6559ca3 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -338,7 +338,6 @@ void ScColumn::CopyCellsInRangeToColumn(
             bLastBlock = true;
         }
 
-        bool bHasCells = true;
         switch (it->type)
         {
             case sc::element_type_numeric:
@@ -349,7 +348,7 @@ void ScColumn::CopyCellsInRangeToColumn(
                 std::advance(itDataEnd, nDataSize);
                 ScAddress aSrcPos(nCol, nCurRow, nTab);
                 ScAddress aDestPos(rColumn.nCol, nCurRow, rColumn.nTab);
-                rHdl.cloneDoubleBlock(aDestColPos.miCellPos, aSrcPos, aDestPos, itData, itDataEnd);
+                rHdl.cloneDoubleBlock(aDestColPos, aSrcPos, aDestPos, itData, itDataEnd);
             }
             break;
             case sc::element_type_string:
@@ -360,7 +359,7 @@ void ScColumn::CopyCellsInRangeToColumn(
                 std::advance(itDataEnd, nDataSize);
                 ScAddress aSrcPos(nCol, nCurRow, nTab);
                 ScAddress aDestPos(rColumn.nCol, nCurRow, rColumn.nTab);
-                rHdl.cloneStringBlock(aDestColPos.miCellPos, aSrcPos, aDestPos, itData, itDataEnd);
+                rHdl.cloneStringBlock(aDestColPos, aSrcPos, aDestPos, itData, itDataEnd);
             }
             break;
             case sc::element_type_edittext:
@@ -371,7 +370,7 @@ void ScColumn::CopyCellsInRangeToColumn(
                 std::advance(itDataEnd, nDataSize);
                 ScAddress aSrcPos(nCol, nCurRow, nTab);
                 ScAddress aDestPos(rColumn.nCol, nCurRow, rColumn.nTab);
-                rHdl.cloneEditTextBlock(aDestColPos.miCellPos, aSrcPos, aDestPos, itData, itDataEnd);
+                rHdl.cloneEditTextBlock(aDestColPos, aSrcPos, aDestPos, itData, itDataEnd);
             }
             break;
             case sc::element_type_formula:
@@ -382,20 +381,13 @@ void ScColumn::CopyCellsInRangeToColumn(
                 std::advance(itDataEnd, nDataSize);
                 ScAddress aSrcPos(nCol, nCurRow, nTab);
                 ScAddress aDestPos(rColumn.nCol, nCurRow, rColumn.nTab);
-                rHdl.cloneFormulaBlock(aDestColPos.miCellPos, aSrcPos, aDestPos, itData, itDataEnd);
+                rHdl.cloneFormulaBlock(aDestColPos, aSrcPos, aDestPos, itData, itDataEnd);
             }
             break;
             default:
-                bHasCells = false;
+                ;
         }
 
-        if (bHasCells)
-        {
-            // Set default text attribute values for the new cells in the clip doc.
-            std::vector<sc::CellTextAttr> aTextAttrs(nDataSize, sc::CellTextAttr());
-            aDestColPos.miCellTextAttrPos = rColumn.maCellTextAttrs.set(
-                aDestColPos.miCellTextAttrPos, nCurRow, aTextAttrs.begin(), aTextAttrs.end());
-        }
 
         if (bLastBlock)
             break;


More information about the Libreoffice-commits mailing list