You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/06/11 11:38:24 UTC
svn commit: r1348774 - in /incubator/ooo/trunk/main:
filter/inc/filter/msfilter/ filter/source/graphicfilter/eos2met/
filter/source/graphicfilter/epict/ filter/source/msfilter/
filter/source/svg/ svtools/source/filter/ svx/source/svdraw/
svx/source/uno...
Author: alg
Date: Mon Jun 11 09:38:23 2012
New Revision: 1348774
URL: http://svn.apache.org/viewvc?rev=1348774&view=rev
Log:
#119735# Adapted patch provided by Sven Jacobi (thanks), added some ixes/cleanups to make it work with all kind of graphics (SVG, Bitmap, Metafile)
Modified:
incubator/ooo/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx
incubator/ooo/trunk/main/filter/source/graphicfilter/eos2met/eos2met.cxx
incubator/ooo/trunk/main/filter/source/graphicfilter/epict/epict.cxx
incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx
incubator/ooo/trunk/main/filter/source/svg/svgfilter.component
incubator/ooo/trunk/main/filter/source/svg/svgfilter.hxx
incubator/ooo/trunk/main/filter/source/svg/svguno.cxx
incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx
incubator/ooo/trunk/main/filter/source/svg/svgwriter.hxx
incubator/ooo/trunk/main/svtools/source/filter/filter.cxx
incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
incubator/ooo/trunk/main/svx/source/unodraw/unoshap4.cxx
incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx
incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
Modified: incubator/ooo/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx (original)
+++ incubator/ooo/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx Mon Jun 11 09:38:23 2012
@@ -456,7 +456,6 @@ protected :
sal_Int64 nAspect ) const;
// <--
SdrObject* GetAutoForm( MSO_SPT eTyp ) const;
- static const GDIMetaFile* lcl_GetMetaFileFromGrf_Impl( const Graphic& rGrf, GDIMetaFile& rMtf );
#ifndef SVX_LIGHT
static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj(
sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
Modified: incubator/ooo/trunk/main/filter/source/graphicfilter/eos2met/eos2met.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/graphicfilter/eos2met/eos2met.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/graphicfilter/eos2met/eos2met.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/graphicfilter/eos2met/eos2met.cxx Mon Jun 11 09:38:23 2012
@@ -2590,18 +2590,6 @@ sal_Bool METWriter::WriteMET( const GDIM
extern "C" sal_Bool __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, sal_Bool )
{ METWriter aMETWriter;
- if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
- return aMETWriter.WriteMET( rGraphic.GetGDIMetaFile(), rStream, pFilterConfigItem );
- else
- {
- Bitmap aBmp=rGraphic.GetBitmap();
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record(&aVirDev);
- aVirDev.DrawBitmap(Point(),aBmp);
- aMTF.Stop();
- aMTF.SetPrefSize(aBmp.GetSizePixel());
- return aMETWriter.WriteMET( aMTF, rStream, pFilterConfigItem );
- }
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ return aMETWriter.WriteMET( rGraphic.GetGDIMetaFile(), rStream, pFilterConfigItem );
}
Modified: incubator/ooo/trunk/main/filter/source/graphicfilter/epict/epict.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/graphicfilter/epict/epict.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/graphicfilter/epict/epict.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/graphicfilter/epict/epict.cxx Mon Jun 11 09:38:23 2012
@@ -2291,41 +2291,9 @@ extern "C" sal_Bool __LOADONCALLAPI Grap
{
PictWriter aPictWriter;
- if (rGraphic.GetType()==GRAPHIC_GDIMETAFILE)
- {
- GDIMetaFile aScaledMtf( rGraphic.GetGDIMetaFile() );
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ GDIMetaFile aScaledMtf( rGraphic.GetGDIMetaFile() );
-/*
- MapMode aMap72( MAP_INCH );
- Fraction aDPIFrac( 1, 72 );
- Size aOldSize = aScaledMtf.GetPrefSize();
-
- aMap72.SetScaleX( aDPIFrac );
- aMap72.SetScaleY( aDPIFrac );
-
- Size aNewSize = OutputDevice::LogicToLogic( aOldSize,
- aScaledMtf.GetPrefMapMode(),
- aMap72 );
-
- aScaledMtf.Scale( Fraction( aNewSize.Width(), aOldSize.Width() ),
- Fraction( aNewSize.Height(), aOldSize.Height() ) );
- aScaledMtf.SetPrefMapMode( aMap72 );
- aScaledMtf.SetPrefSize( aNewSize );
-*/
-
- return aPictWriter.WritePict( aScaledMtf, rStream, pFilterConfigItem );
- }
- else
- {
- Bitmap aBmp=rGraphic.GetBitmap();
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record(&aVirDev);
- aVirDev.DrawBitmap(Point(),aBmp);
- aMTF.Stop();
- aMTF.SetPrefSize(aBmp.GetSizePixel());
- return aPictWriter.WritePict( aMTF, rStream, pFilterConfigItem );
- }
+ return aPictWriter.WritePict( aScaledMtf, rStream, pFilterConfigItem );
}
Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Mon Jun 11 09:38:23 2012
@@ -6653,33 +6653,6 @@ SdrObject* SvxMSDffManager::ImportOLE( l
return pRet;
}
-const GDIMetaFile* SvxMSDffManager::lcl_GetMetaFileFromGrf_Impl( const Graphic& rGrf,
- GDIMetaFile& rMtf )
-{
- const GDIMetaFile* pMtf;
- if( GRAPHIC_BITMAP == rGrf.GetType() )
- {
- Point aPt;
- const Size aSz(lcl_GetPrefSize(rGrf, MAP_100TH_MM));
-
- VirtualDevice aVirtDev;
- aVirtDev.EnableOutput( sal_False );
- MapMode aMM(MAP_100TH_MM);
- aVirtDev.SetMapMode( aMM );
-
- rMtf.Record( &aVirtDev );
- rGrf.Draw( &aVirtDev, aPt, aSz );
- rMtf.Stop();
- rMtf.SetPrefMapMode(aMM);
- rMtf.SetPrefSize( aSz );
-
- pMtf = &rMtf;
- }
- else
- pMtf = &rGrf.GetGDIMetaFile();
- return pMtf;
-}
-
sal_Bool SvxMSDffManager::MakeContentStream( SotStorage * pStor, const GDIMetaFile & rMtf )
{
String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
Modified: incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx Mon Jun 11 09:38:23 2012
@@ -1247,3 +1247,45 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, Edit
return( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
}
+
+// -----------------------------------------------------------------------------
+
+void SVGExport::writeMtf( const GDIMetaFile& rMtf )
+{
+ const Size aSize( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_MM ) );
+ rtl::OUString aAttr;
+ REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
+
+ if( xExtDocHandler.is() )
+ xExtDocHandler->unknown( SVG_DTD_STRING );
+
+ aAttr = rtl::OUString::valueOf( aSize.Width() );
+ aAttr += B2UCONST( "mm" );
+ AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
+
+ aAttr = rtl::OUString::valueOf( aSize.Height() );
+ aAttr += B2UCONST( "mm" );
+ AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
+
+ aAttr = B2UCONST( "0 0 " );
+ aAttr += rtl::OUString::valueOf( aSize.Width() * 100L );
+ aAttr += B2UCONST( " " );
+ aAttr += rtl::OUString::valueOf( aSize.Height() * 100L );
+ AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
+
+ {
+ SvXMLElementExport aSVG( *this, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
+
+ std::vector< ObjectRepresentation > aObjects;
+
+ aObjects.push_back( ObjectRepresentation( Reference< XInterface >(), rMtf ) );
+ SVGFontExport aSVGFontExport( *this, aObjects );
+
+ Point aPoint100thmm( OutputDevice::LogicToLogic( rMtf.GetPrefMapMode().GetOrigin(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) );
+ Size aSize100thmm( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) );
+
+ SVGActionWriter aWriter( *this, aSVGFontExport );
+ aWriter.WriteMetaFile( aPoint100thmm, aSize100thmm, rMtf,
+ SVGWRITER_WRITE_FILL | SVGWRITER_WRITE_TEXT, NULL );
+ }
+}
Modified: incubator/ooo/trunk/main/filter/source/svg/svgfilter.component
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgfilter.component?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgfilter.component (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgfilter.component Mon Jun 11 09:38:23 2012
@@ -27,4 +27,7 @@
<implementation name="com.sun.star.comp.Draw.SVGFilter">
<service name="com.sun.star.document.SVGFilter"/>
</implementation>
+ <implementation name="com.sun.star.comp.Draw.SVGWriter">
+ <service name="com.sun.star.svg.SVGWriter"/>
+ </implementation>
</component>
Modified: incubator/ooo/trunk/main/filter/source/svg/svgfilter.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgfilter.hxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgfilter.hxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgfilter.hxx Mon Jun 11 09:38:23 2012
@@ -132,7 +132,9 @@ public:
void popClip();
sal_Bool hasClip() const;
const ::basegfx::B2DPolyPolygon* getCurClip() const;
-
+
+ void writeMtf( const GDIMetaFile& rMtf );
+
protected:
virtual void _ExportStyles( sal_Bool /* bUsed */ ) {}
Modified: incubator/ooo/trunk/main/filter/source/svg/svguno.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svguno.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svguno.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svguno.cxx Mon Jun 11 09:38:23 2012
@@ -32,6 +32,7 @@
#include <svgfilter.hxx>
#include <svgdialog.hxx>
+#include <svgwriter.hxx>
using ::rtl::OUString;
using namespace ::cppu;
@@ -73,7 +74,13 @@ extern "C"
OUString::createFromAscii( pImplName ),
SVGDialog_createInstance, SVGDialog_getSupportedServiceNames() ) );
}
-
+ else if( aImplName.equals( SVGWriter_getImplementationName() ) )
+ {
+ xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ SVGWriter_createInstance, SVGWriter_getSupportedServiceNames() ) );
+ }
if (xFactory.is())
{
xFactory->acquire();
Modified: incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx Mon Jun 11 09:38:23 2012
@@ -896,7 +896,10 @@ void SVGActionWriter::ImplWriteText( con
if( bCont )
{
// #118796# do NOT access pDXArray, it may be zero (!)
- nX = aPos.X() + pDX[ nCurPos - 1 ];
+ sal_Int32 nWidth = pDX[ nCurPos - 1 ];
+ if ( bApplyMapping )
+ nWidth = ImplMap( nWidth );
+ nX = aPos.X() + nWidth;
}
}
}
@@ -972,7 +975,13 @@ void SVGActionWriter::ImplWriteBmp( cons
{
Point aPt;
Size aSz;
- ::rtl::OUString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell(), RTL_TEXTENCODING_ASCII_US );
+
+ // #119735# Do not copy the stream data to a ::rtl::OUString any longer, this is not needed and
+ // (of course) throws many exceptions with the used RTL_TEXTENCODING_ASCII_US. Keeping that line
+ // to show what I'm talking about
+ // ::rtl::OUString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell(), RTL_TEXTENCODING_ASCII_US );
+ const sal_Char* pImageData = (sal_Char*)aOStm.GetData();
+ const sal_uInt32 nImageDataLength = aOStm.Tell();
REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
if( bApplyMapping )
@@ -1023,13 +1032,15 @@ void SVGActionWriter::ImplWriteBmp( cons
xExtDocHandler->unknown( aString );
- const sal_uInt32 nQuadCount = aImageData.getLength() / 3;
- const sal_uInt32 nRest = aImageData.getLength() % 3;
+ // #119735#
+ const sal_uInt32 nQuadCount = nImageDataLength / 3;
+ const sal_uInt32 nRest = nImageDataLength % 3;
if( nQuadCount || nRest )
{
sal_Int32 nBufLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
- const sal_Unicode* pSrc = (const sal_Unicode*) aImageData;
+ const sal_Char* pSrc = pImageData;
+
sal_Unicode* pBuffer = new sal_Unicode[ nBufLen * sizeof( sal_Unicode ) ];
sal_Unicode* pTmpDst = pBuffer;
@@ -1856,3 +1867,104 @@ void SVGActionWriter::WriteMetaFile( con
ImplReleaseContext();
mpVDev->Pop();
}
+
+// -------------
+// - SVGWriter -
+// -------------
+
+SVGWriter::SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ mxFact( rxMgr )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGWriter::~SVGWriter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+
+ANY SAL_CALL SVGWriter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
+{
+ const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGWriter* >( this ) ) );
+
+ return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::release() throw()
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
+ const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException )
+{
+ SvMemoryStream aMemStm( (char*) rMtfSeq.getConstArray(), rMtfSeq.getLength(), STREAM_READ );
+ GDIMetaFile aMtf;
+
+ aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+ aMemStm >> aMtf;
+
+ const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxDocHandler );
+ const Sequence< PropertyValue > aFilterData;
+
+ SVGExport* pWriter = new SVGExport( mxFact, xDocumentHandler, aFilterData );
+
+ pWriter->writeMtf( aMtf );
+ delete pWriter;
+}
+
+// -----------------------------------------------------------------------------
+
+#define SVG_WRITER_SERVICE_NAME "com.sun.star.svg.SVGWriter"
+#define SVG_WRITER_IMPLEMENTATION_NAME "com.sun.star.comp.Draw.SVGWriter"
+
+rtl::OUString SVGWriter_getImplementationName()
+ throw (RuntimeException)
+{
+ return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( SVG_WRITER_IMPLEMENTATION_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL SVGWriter_getImplementationId()
+ throw(RuntimeException)
+{
+ static const ::cppu::OImplementationId aId;
+
+ return( aId.getImplementationId() );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< rtl::OUString > SAL_CALL SVGWriter_getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ Sequence< rtl::OUString > aRet( 1 );
+
+ aRet.getArray()[ 0 ] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SVG_WRITER_SERVICE_NAME ) );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SVGWriter_createInstance( const Reference< XMultiServiceFactory > & rSMgr )
+ throw( Exception )
+{
+ return( static_cast< cppu::OWeakObject* >( new SVGWriter( rSMgr ) ) );
+}
+
Modified: incubator/ooo/trunk/main/filter/source/svg/svgwriter.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgwriter.hxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgwriter.hxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgwriter.hxx Mon Jun 11 09:38:23 2012
@@ -65,6 +65,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/svg/XSVGWriter.hpp>
// -----------------------------------------------------------------------------
@@ -108,7 +109,7 @@ private:
Font maCurFont;
Color maCurLineColor;
Color maCurFillColor;
- SVGExport& mrExport;
+ SVGExport& mrExport;
SVGFontExport& mrFontExport;
SvXMLElementExport* mpElemFont;
SvXMLElementExport* mpElemPaint;
@@ -166,7 +167,7 @@ struct SVGShapeDescriptor
// -------------------
class SVGAttributeWriter;
-class SvXMLExport;
+class SVGExport;
class GDIMetaFile;
class SVGActionWriter
@@ -175,7 +176,7 @@ private:
Stack maContextStack;
::std::auto_ptr< SVGShapeDescriptor > mapCurShape;
- SVGExport& mrExport;
+ SVGExport& mrExport;
SVGFontExport& mrFontExport;
SVGAttributeWriter* mpContext;
VirtualDevice* mpVDev;
@@ -233,4 +234,47 @@ public:
const ::rtl::OUString* pElementId = NULL );
};
+class SVGWriter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGWriter
+{
+private:
+
+ REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+
+ SVGWriter();
+
+public:
+
+ SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~SVGWriter();
+
+ // XInterface
+ virtual NMSP_UNO::Any SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XSVGWriter
+ virtual void SAL_CALL write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
+ const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException );
+};
+
+::rtl::OUString SVGWriter_getImplementationName ()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGWriter_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SVGWriter_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_CALL SVGWriter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+
#endif
Modified: incubator/ooo/trunk/main/svtools/source/filter/filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svtools/source/filter/filter.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svtools/source/filter/filter.cxx (original)
+++ incubator/ooo/trunk/main/svtools/source/filter/filter.cxx Mon Jun 11 09:38:23 2012
@@ -1943,70 +1943,31 @@ sal_uInt16 GraphicFilter::ExportGraphic(
sal_Int32 nVersion = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 0 ) ;
if ( nVersion )
rOStm.SetVersion( nVersion );
- GDIMetaFile aMTF;
- if ( eType != GRAPHIC_BITMAP )
- aMTF = aGraphic.GetGDIMetaFile();
- else
- {
- VirtualDevice aVirDev;
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ GDIMetaFile aMTF(aGraphic.GetGDIMetaFile());
- aMTF.Record( &aVirDev );
- aGraphic.Draw( &aVirDev, Point(), aGraphic.GetPrefSize() );
- aMTF.Stop();
- aMTF.SetPrefSize( aGraphic.GetPrefSize() );
- aMTF.SetPrefMapMode( aGraphic.GetPrefMapMode() );
- }
aMTF.Write( rOStm );
- if( rOStm.GetError() )
+
+ if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) )
{
- if( eType == GRAPHIC_GDIMETAFILE )
- {
- if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- else
- {
- Bitmap aBmp( aGraphic.GetBitmap() );
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record( &aVirDev );
- aVirDev.DrawBitmap( Point(), aBmp );
- aMTF.Stop();
- aMTF.SetPrefSize( aBmp.GetSizePixel() );
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
+ nStatus = GRFILTER_FORMATERROR;
- if( !ConvertGDIMetaFileToWMF( aMTF, rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- if( rOStm.GetError() )
+ if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) )
{
- if( eType == GRAPHIC_GDIMETAFILE )
- {
- if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- else
- {
- Bitmap aBmp( aGraphic.GetBitmap() );
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record( &aVirDev );
- aVirDev.DrawBitmap( Point(), aBmp );
- aMTF.Stop();
- aMTF.SetPrefSize( aBmp.GetSizePixel() );
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
+ nStatus = GRFILTER_FORMATERROR;
- if( !ConvertGDIMetaFileToEMF( aMTF, rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- if( rOStm.GetError() )
+ if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )
@@ -2121,6 +2082,8 @@ sal_uInt16 GraphicFilter::ExportGraphic(
SvMemoryStream aMemStm( 65535, 65535 );
aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm );
xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >(
Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx Mon Jun 11 09:38:23 2012
@@ -588,16 +588,8 @@ GDIMetaFile SdrExchangeView::GetMarkedOb
{
Graphic aGraphic( pGrafObj->GetTransformedGraphic() );
- if( aGraphic.GetType() == GRAPHIC_BITMAP )
- {
- const Point aPos;
-
- aMtf.AddAction( new MetaBmpExScaleAction( aPos, aBoundSize, aGraphic.GetBitmapEx() ) );
- aMtf.SetPrefMapMode( aMap );
- aMtf.SetPrefSize( aBoundSize );
- }
- else
- aMtf = aGraphic.GetGDIMetaFile();
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ aMtf = aGraphic.GetGDIMetaFile();
}
}
Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshap4.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshap4.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshap4.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshap4.cxx Mon Jun 11 09:38:23 2012
@@ -294,18 +294,8 @@ bool SvxOle2Shape::getPropertyValueImpl(
}
if ( !bIsWMF )
{
- GDIMetaFile aMtf;
- if ( pGraphic->GetType() != GRAPHIC_BITMAP )
- aMtf = pObj->GetGraphic()->GetGDIMetaFile();
- else
- {
- VirtualDevice aVirDev;
- aMtf.Record( &aVirDev );
- pGraphic->Draw( &aVirDev, Point(), pGraphic->GetPrefSize() );
- aMtf.Stop();
- aMtf.SetPrefSize( pGraphic->GetPrefSize() );
- aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
- }
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
SvMemoryStream aDestStrm( 65535, 65535 );
ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
const uno::Sequence<sal_Int8> aSeq(
Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx Mon Jun 11 09:38:23 2012
@@ -3029,18 +3029,8 @@ bool SvxShape::getPropertyValueImpl( con
}
if ( !bIsWMF )
{
- GDIMetaFile aMtf;
- if ( pGraphic->GetType() != GRAPHIC_BITMAP )
- aMtf = pObj->GetGraphic()->GetGDIMetaFile();
- else
- {
- VirtualDevice aVirDev;
- aMtf.Record( &aVirDev );
- pGraphic->Draw( &aVirDev, Point(), pGraphic->GetPrefSize() );
- aMtf.Stop();
- aMtf.SetPrefSize( pGraphic->GetPrefSize() );
- aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
- }
+ // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
SvMemoryStream aDestStrm( 65535, 65535 );
ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
const uno::Sequence<sal_Int8> aSeq(
Modified: incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx?rev=1348774&r1=1348773&r2=1348774&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx Mon Jun 11 09:38:23 2012
@@ -677,7 +677,41 @@ Animation ImpGraphic::ImplGetAnimation()
const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
{
- return maMetaFile;
+ if(GRAPHIC_BITMAP == meType && !maMetaFile.GetActionCount())
+ {
+ // #119735#
+ // Use the local maMetaFile as container for a metafile-representation
+ // of the bitmap graphic. This will be done only once, thus be buffered.
+ // I checked all usages of maMetaFile, it is only used when type is not
+ // GRAPHIC_BITMAP. In operator= it will get copied, thus buffering will
+ // survive copying (change this if not wanted)
+ ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
+
+ if(maSvgData.get() && !maEx)
+ {
+ // use maEx as local buffer for rendered svg
+ pThat->maEx = maSvgData->getReplacement();
+ }
+
+ VirtualDevice aVirDev;
+ const Size aSizePixel(maEx.GetSizePixel());
+
+ pThat->maMetaFile.Record(&aVirDev);
+
+ if(maEx.IsTransparent())
+ {
+ aVirDev.DrawBitmapEx(Point(), maEx);
+ }
+ else
+ {
+ aVirDev.DrawBitmap(Point(), maEx.GetBitmap());
+ }
+
+ pThat->maMetaFile.Stop();
+ pThat->maMetaFile.SetPrefSize(aSizePixel);
+ }
+
+ return maMetaFile;
}
// ------------------------------------------------------------------------