summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfun5.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/viewfun5.cxx')
-rw-r--r--sc/source/ui/view/viewfun5.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index facb25c9ddb1..588c81832ea8 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -51,6 +51,7 @@
#include <viewfunc.hxx>
#include <docsh.hxx>
+#include <drwlayer.hxx>
#include <drawview.hxx>
#include <impex.hxx>
#include <dbdata.hxx>
@@ -147,14 +148,39 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
SCCOL nFirstCol, nLastCol;
SCROW nFirstRow, nLastRow;
if ( rSrcDoc.GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
+ {
rSrcDoc.GetCellArea( nSrcTab, nLastCol, nLastRow );
+ if (nLastCol < nFirstCol)
+ nLastCol = nFirstCol;
+ if (nLastRow < nFirstRow)
+ nLastRow = nFirstRow;
+ }
else
{
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);
- rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSrcMark, false, false);
+ rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSrcMark, false, bIncludeObjects);
ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) );
SetCursor( nPosX, nPosY );