Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

Currently "Save as Picture" feature in Writer, Impress, or Draw
produces a broken EPS file when I save an image as EPS format.
# Export feature produces a correct file.

Here is a patch to fix this issue.
The patch is under the LGPLv3+ / MPL.

Cheers,
--
KUROSAWA Takeshi <taken.spc@gmail.com>
From d9b1a6593bc34cd074ae469f648c6926d30e52e4 Mon Sep 17 00:00:00 2001
From: Takeshi Kurosawa <taken.spc@gmail.com>
Date: Tue, 1 Feb 2011 13:30:33 +0900
Subject: [PATCH] [EPS Export] Fix "Save as Picture"

Currently "Save as Picture" produces a broken eps file.
---
 filter/source/graphicfilter/eps/eps.cxx |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index dd127e0..88c2b86 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -374,7 +374,16 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, 
Filter
     if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
         pMTF = &rGraphic.GetGDIMetaFile();
     else
-        pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+    {
+        Bitmap aBmp( rGraphic.GetBitmap() );
+        pAMTF = new GDIMetaFile();
+        VirtualDevice aTmpVDev;
+        pAMTF->Record( &aTmpVDev );
+        aTmpVDev.DrawBitmap( Point(), aBmp );
+        pAMTF->Stop();
+        pAMTF->SetPrefSize( aBmp.GetSizePixel() );
+        pMTF = pAMTF;
+    }
     aVDev.SetMapMode( pMTF->GetPrefMapMode() );
     nBoundingX1 = nBoundingY1 = 0;
     nBoundingX2 = pMTF->GetPrefSize().Width();
-- 
1.7.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.