summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-11-02 15:37:17 +0530
committerDennis Francis <dennis.francis@collabora.com>2021-11-10 07:56:34 +0100
commitc8af39955e2210c81882ae0676ec32a42fff7898 (patch)
tree9978509b5e05b76a32f3d8ab015d1a9ffd4efa10 /sc
parent3b229856b2f09c496dc0800f8a4efac9fcebda91 (diff)
sc: EMBED_SOURCE: extend copy to clip area...
to include the draw objects in the sheet read from system clipboard. This is needed because GetCellArea() computes the "last row" and "last column" only based on the cell contents and not the drawing layer contents. So copying a "empty cells" range that has images in it and pasting it will not include any images without this fix. Change-Id: I56ffb14e881a1aecc5b43590ea4fb3fc1c35ace8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124629 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com> (cherry picked from commit 789d19776ab451a6118b938830d488961b42dae5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124673 Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/viewfun5.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 5c6d89671da4..ef92193ad3e4 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -161,8 +161,26 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
nFirstCol = nLastCol = 0;
nFirstRow = nLastRow = 0;
}
+
+ bool bIncludeObjects = false; // include drawing layer objects in CopyToClip ?
+
+ if (nFormatId == SotClipboardFormatId::EMBED_SOURCE)
+ {
+ const ScDrawLayer* pDraw = rSrcDoc.GetDrawLayer();
+ SCCOL nPrintEndCol = nFirstCol;
+ SCROW nPrintEndRow = nFirstRow;
+ bool bHasObjects = pDraw && pDraw->HasObjects();
+ // Extend the range to include the drawing layer objects.
+ if (bHasObjects && rSrcDoc.GetPrintArea(nSrcTab, nPrintEndCol, nPrintEndRow, true))
+ {
+ nLastCol = std::max<SCCOL>(nLastCol, nPrintEndCol);
+ nLastRow = std::max<SCROW>(nLastRow, nPrintEndRow);
+ }
+
+ bIncludeObjects = bHasObjects;
+ }
+
ScClipParam aClipParam(ScRange(nFirstCol, nFirstRow, nSrcTab, nLastCol, nLastRow, nSrcTab), false);
- bool bIncludeObjects = (nFormatId == SotClipboardFormatId::EMBED_SOURCE);
rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSrcMark, false, bIncludeObjects);
ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) );