summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-04-03 09:31:34 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-04-04 16:24:14 +0200
commit8e49269f794f6eae193fa9af8846a470baab0c1b (patch)
treeeffdd81766cfcabbf20d82bfd396841625f5d601
parentcdc0d49ea70570ae71e19ebbf5bd24fc0f5083eb (diff)
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@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sc/source/core/data/table7.cxx22
1 files changed, 22 insertions, 0 deletions
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 )