[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 18:58:03 UTC 2019


 sc/source/core/data/column3.cxx |   31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

New commits:
commit 46f879c60ebdbbb920fe34d216d58da2b88c3061
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu May 16 17:13:40 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Aug 13 20:57:25 2019 +0200

    cache mdds positions also in CopyTextAttrsFromClipHandler (tdf#112000)
    
    This is basically just a copy&paste from CopyCellsFromClipHandler.
    
    Reviewed-on: https://gerrit.libreoffice.org/72423
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 5d5e308331e7166726264c43545798b5fb833c8a)
    
    Change-Id: I4abd39923cb933e73d73938a8d38913b5e5382a0
    Reviewed-on: https://gerrit.libreoffice.org/77425
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 7b760b3daa48..6710c08dcc1f 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1090,13 +1090,32 @@ public:
 
 class CopyTextAttrsFromClipHandler
 {
+    sc::CopyFromClipContext& mrCxt;
     sc::CellTextAttrStoreType& mrAttrs;
-    sc::CellTextAttrStoreType::iterator miPos;
     size_t mnDelta;
+    sc::ColumnBlockPosition maDestBlockPos;
+    sc::ColumnBlockPosition* mpDestBlockPos; // to save it for next iteration.
 
 public:
-    CopyTextAttrsFromClipHandler( sc::CellTextAttrStoreType& rAttrs, size_t nDelta ) :
-        mrAttrs(rAttrs), miPos(mrAttrs.begin()), mnDelta(nDelta) {}
+    CopyTextAttrsFromClipHandler( sc::CopyFromClipContext& rCxt, sc::CellTextAttrStoreType& rAttrs,
+                                  ScColumn& rDestCol, SCTAB nDestTab, SCCOL nDestCol, size_t nDelta ) :
+        mrCxt( rCxt ),
+        mrAttrs(rAttrs),
+        mnDelta(nDelta),
+        mpDestBlockPos(mrCxt.getBlockPosition(nDestTab, nDestCol))
+    {
+        if (mpDestBlockPos)
+            maDestBlockPos = *mpDestBlockPos;
+        else
+            rDestCol.InitBlockPosition(maDestBlockPos);
+    }
+
+    ~CopyTextAttrsFromClipHandler()
+    {
+        if (mpDestBlockPos)
+            // Don't forget to save this to the context!
+            *mpDestBlockPos = maDestBlockPos;
+    }
 
     void operator() ( const sc::CellTextAttrStoreType::value_type& aNode, size_t nOffset, size_t nDataSize )
     {
@@ -1109,7 +1128,7 @@ public:
         std::advance(itEnd, nDataSize);
 
         size_t nPos = aNode.position + nOffset + mnDelta;
-        miPos = mrAttrs.set(miPos, nPos, it, itEnd);
+        maDestBlockPos.miCellTextAttrPos = mrAttrs.set(maDestBlockPos.miCellTextAttrPos, nPos, it, itEnd);
     }
 };
 
@@ -1166,7 +1185,7 @@ void ScColumn::CopyFromClip(
         }
 
         // Don't forget to copy the cell text attributes.
-        CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+        CopyTextAttrsFromClipHandler aFunc(rCxt, maCellTextAttrs, *this, nTab, nCol, nDy);
         sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
 
         return;
@@ -1186,7 +1205,7 @@ void ScColumn::CopyFromClip(
 
     {
         // Don't forget to copy the cell text attributes.
-        CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+        CopyTextAttrsFromClipHandler aFunc(rCxt, maCellTextAttrs, *this, nTab, nCol, nDy);
         sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
     }
 }


More information about the Libreoffice-commits mailing list