Kaydet (Commit) 483ea555 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i123405# Allow to not limit size to PageSize...

when creating Metafile content

(cherry picked from commit c4b76f04)

Change-Id: I8536f4d55e422ad5550c1aaa311789ad31647611
üst b506fcdf
...@@ -354,11 +354,15 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor ) ...@@ -354,11 +354,15 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
} }
else if ( nFormat == SOT_FORMAT_GDIMETAFILE ) else if ( nFormat == SOT_FORMAT_GDIMETAFILE )
{ {
InitDocShell(); // #i123405# Do not limit visual size calculation for metafile creation.
// It seems unlikely that removing the limitation causes problems since
// metafile creation means that no real pixel device in the needed size is
// created.
InitDocShell(false);
SfxObjectShell* pEmbObj = aDocShellRef; SfxObjectShell* pEmbObj = aDocShellRef;
// like SvEmbeddedTransfer::GetData: // like SvEmbeddedTransfer::GetData:
GDIMetaFile aMtf; GDIMetaFile aMtf;
VirtualDevice aVDev; VirtualDevice aVDev;
MapMode aMapMode( pEmbObj->GetMapUnit() ); MapMode aMapMode( pEmbObj->GetMapUnit() );
...@@ -380,7 +384,8 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor ) ...@@ -380,7 +384,8 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
else if ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ) else if ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE )
{ {
//TODO/LATER: differentiate between formats?! //TODO/LATER: differentiate between formats?!
InitDocShell(); // set aDocShellRef // #i123405# Do limit visual size calculation to PageSize
InitDocShell(true); // set aDocShellRef
SfxObjectShell* pEmbObj = aDocShellRef; SfxObjectShell* pEmbObj = aDocShellRef;
bOK = SetObject( pEmbObj, SCTRANS_TYPE_EMBOBJ, rFlavor ); bOK = SetObject( pEmbObj, SCTRANS_TYPE_EMBOBJ, rFlavor );
...@@ -582,8 +587,10 @@ ScMarkData ScTransferObj::GetSourceMarkData() ...@@ -582,8 +587,10 @@ ScMarkData ScTransferObj::GetSourceMarkData()
// //
// initialize aDocShellRef with a live document from the ClipDoc // initialize aDocShellRef with a live document from the ClipDoc
// //
// #i123405# added parameter to allow size calculation without limitation
// to PageSize, e.g. used for Metafile creation for clipboard.
void ScTransferObj::InitDocShell() void ScTransferObj::InitDocShell(bool bLimitToPageSize)
{ {
if ( !aDocShellRef.Is() ) if ( !aDocShellRef.Is() )
{ {
...@@ -700,14 +707,14 @@ void ScTransferObj::InitDocShell() ...@@ -700,14 +707,14 @@ void ScTransferObj::InitDocShell()
for (nCol=nStartX; nCol<=nEndX; nCol++) for (nCol=nStartX; nCol<=nEndX; nCol++)
{ {
long nAdd = pDestDoc->GetColWidth( nCol, 0 ); long nAdd = pDestDoc->GetColWidth( nCol, 0 );
if ( nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit? if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX ) // above limit?
break; break;
nSizeX += nAdd; nSizeX += nAdd;
} }
for (SCROW nRow=nStartY; nRow<=nEndY; nRow++) for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
{ {
long nAdd = pDestDoc->GetRowHeight( nRow, 0 ); long nAdd = pDestDoc->GetRowHeight( nRow, 0 );
if ( nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit? if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY ) // above limit?
break; break;
nSizeY += nAdd; nSizeY += nAdd;
} }
......
...@@ -56,7 +56,9 @@ private: ...@@ -56,7 +56,9 @@ private:
bool bHasFiltered; // if has filtered rows bool bHasFiltered; // if has filtered rows
bool bUseInApi; // to recognize clipboard content copied from API bool bUseInApi; // to recognize clipboard content copied from API
void InitDocShell(); // #i123405# added parameter to allow size calculation without limitation
// to PageSize, e.g. used for Metafile creation for clipboard.
void InitDocShell(bool bLimitToPageSize);
static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY, static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
SCCOL nEndX, SCROW nEndY, SCCOL nEndX, SCROW nEndY,
ScDocument* pDestDoc=0, ScDocument* pDestDoc=0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment