summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/export/drawingml.cxx34
-rw-r--r--vcl/source/gdi/cvtgrf.cxx2
2 files changed, 28 insertions, 8 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index dd6605b5e133..847d21c21f83 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -495,14 +495,32 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
break;
default: {
GraphicType aType = rGraphic.GetType();
- if ( aType == GRAPHIC_BITMAP ) {
- GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
- sMediaType = "image/png";
- pExtension = ".png";
- } else if ( aType == GRAPHIC_GDIMETAFILE ) {
- GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
- sMediaType = "image/x-emf";
- pExtension = ".emf";
+ if ( aType == GRAPHIC_BITMAP || aType == GRAPHIC_GDIMETAFILE) {
+ bool bSwapped = rGraphic.IsSwapOut();
+
+ //Warn rather than just happily swap in because of the comments
+ //in the sw export filters about needing to go through the
+ //hairy SwGrfNode::SwapIn which we would subvert by swapping in
+ //without it knowing about it, so while those ones are fixed we
+ //probably have to assume that we should ideally be presented
+ //here with already swapped in graphics.
+ SAL_WARN_IF(bSwapped, "oox", "attempted to output swapped out graphic");
+
+ if (bSwapped)
+ const_cast<Graphic&>(rGraphic).SwapIn();
+
+ if ( aType == GRAPHIC_BITMAP ) {
+ GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
+ sMediaType = "image/png";
+ pExtension = ".png";
+ } else {
+ GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
+ sMediaType = "image/x-emf";
+ pExtension = ".emf";
+ }
+
+ if (bSwapped)
+ const_cast<Graphic&>(rGraphic).SwapOut();
} else {
OSL_TRACE( "unhandled graphic type" );
break;
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
index 02ca28869cd1..d3956707c349 100644
--- a/vcl/source/gdi/cvtgrf.cxx
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -57,6 +57,8 @@ sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLon
sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat )
{
+ SAL_WARN_IF(rGraphic.IsSwapOut(), "vcl.filter", "exporting a swapped out graphic!");
+
GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
sal_uLong nRet = ERRCODE_IO_GENERAL;