[Libreoffice-commits] core.git: sc/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Apr 4 14:24:36 UTC 2018


 sc/source/core/data/table7.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit 8e49269f794f6eae193fa9af8846a470baab0c1b
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Tue Apr 3 09:31:34 2018 +0200

    tdf#116510 Copy graphics too when copying cells/rows
    
    Before this worked only for columns
    
    Change-Id: I0e2c54aa85455d5fe3ec7ae78638e1b1157e4a9c
    Reviewed-on: https://gerrit.libreoffice.org/52380
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index 8ba58ccde185..aab7c47cf522 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -18,6 +18,7 @@
 #include <olinetab.hxx>
 #include <tabprotection.hxx>
 #include <columniterator.hxx>
+#include <drwlayer.hxx>
 
 bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
 {
@@ -140,6 +141,27 @@ void ScTable::CopyOneCellFromClip(
 
     if (nCol1 == 0 && nCol2 == MAXCOL && mpRowHeights)
         mpRowHeights->setValue(nRow1, nRow2, pSrcTab->GetOriginalHeight(nSrcRow));
+
+    // Copy graphics over too
+    bool bCopyGraphics
+        = (rCxt.getInsertFlag() & InsertDeleteFlags::OBJECTS) != InsertDeleteFlags::NONE;
+    if (bCopyGraphics && rCxt.getClipDoc()->mpDrawLayer)
+    {
+        ScDrawLayer* pDrawLayer = GetDoc().GetDrawLayer();
+        OSL_ENSURE(pDrawLayer, "No drawing layer");
+        if (pDrawLayer)
+        {
+            const ScAddress& rSrcStartPos
+                = rCxt.getClipDoc()->GetClipParam().getWholeRange().aStart;
+            const ScAddress& rSrcEndPos = rCxt.getClipDoc()->GetClipParam().getWholeRange().aEnd;
+            tools::Rectangle aSourceRect = rCxt.getClipDoc()->GetMMRect(
+                rSrcStartPos.Col(), rSrcStartPos.Row(), rSrcEndPos.Col(), rSrcEndPos.Row(),
+                rSrcStartPos.Tab());
+            tools::Rectangle aDestRect = GetDoc().GetMMRect(nCol1, nRow1, nCol2, nRow2, nTab);
+            pDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer, rSrcStartPos.Tab(),
+                                     aSourceRect, ScAddress(nCol1, nRow1, nTab), aDestRect);
+        }
+    }
 }
 
 void ScTable::SetValues( const SCCOL nCol, const SCROW nRow, const std::vector<double>& rVals )


More information about the Libreoffice-commits mailing list