filter.cxx (9333066c) | filter.cxx (cb0a2370) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1929 unchanged lines hidden (view full) --- 1938 if( rOStm.GetError() ) 1939 nStatus = GRFILTER_IOERROR; 1940 } 1941 else if( aFilterName.EqualsIgnoreCaseAscii( EXP_SVMETAFILE ) ) 1942 { 1943 sal_Int32 nVersion = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 0 ) ; 1944 if ( nVersion ) 1945 rOStm.SetVersion( nVersion ); | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1929 unchanged lines hidden (view full) --- 1938 if( rOStm.GetError() ) 1939 nStatus = GRFILTER_IOERROR; 1940 } 1941 else if( aFilterName.EqualsIgnoreCaseAscii( EXP_SVMETAFILE ) ) 1942 { 1943 sal_Int32 nVersion = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 0 ) ; 1944 if ( nVersion ) 1945 rOStm.SetVersion( nVersion ); |
1946 GDIMetaFile aMTF; | |
1947 | 1946 |
1948 if ( eType != GRAPHIC_BITMAP ) 1949 aMTF = aGraphic.GetGDIMetaFile(); 1950 else 1951 { 1952 VirtualDevice aVirDev; | 1947 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically 1948 GDIMetaFile aMTF(aGraphic.GetGDIMetaFile()); |
1953 | 1949 |
1954 aMTF.Record( &aVirDev ); 1955 aGraphic.Draw( &aVirDev, Point(), aGraphic.GetPrefSize() ); 1956 aMTF.Stop(); 1957 aMTF.SetPrefSize( aGraphic.GetPrefSize() ); 1958 aMTF.SetPrefMapMode( aGraphic.GetPrefMapMode() ); 1959 } | |
1960 aMTF.Write( rOStm ); | 1950 aMTF.Write( rOStm ); |
1961 if( rOStm.GetError() ) | 1951 1952 if( rOStm.GetError() ) |
1962 nStatus = GRFILTER_IOERROR; 1963 } 1964 else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) ) 1965 { | 1953 nStatus = GRFILTER_IOERROR; 1954 } 1955 else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) ) 1956 { |
1966 if( eType == GRAPHIC_GDIMETAFILE ) 1967 { 1968 if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) ) 1969 nStatus = GRFILTER_FORMATERROR; 1970 } 1971 else 1972 { 1973 Bitmap aBmp( aGraphic.GetBitmap() ); 1974 GDIMetaFile aMTF; 1975 VirtualDevice aVirDev; | 1957 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically 1958 if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) ) 1959 nStatus = GRFILTER_FORMATERROR; |
1976 | 1960 |
1977 aMTF.Record( &aVirDev ); 1978 aVirDev.DrawBitmap( Point(), aBmp ); 1979 aMTF.Stop(); 1980 aMTF.SetPrefSize( aBmp.GetSizePixel() ); 1981 1982 if( !ConvertGDIMetaFileToWMF( aMTF, rOStm, &aConfigItem ) ) 1983 nStatus = GRFILTER_FORMATERROR; 1984 } 1985 if( rOStm.GetError() ) | 1961 if( rOStm.GetError() ) |
1986 nStatus = GRFILTER_IOERROR; 1987 } 1988 else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) ) 1989 { | 1962 nStatus = GRFILTER_IOERROR; 1963 } 1964 else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) ) 1965 { |
1990 if( eType == GRAPHIC_GDIMETAFILE ) 1991 { 1992 if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) ) 1993 nStatus = GRFILTER_FORMATERROR; 1994 } 1995 else 1996 { 1997 Bitmap aBmp( aGraphic.GetBitmap() ); 1998 GDIMetaFile aMTF; 1999 VirtualDevice aVirDev; | 1966 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically 1967 if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) ) 1968 nStatus = GRFILTER_FORMATERROR; |
2000 | 1969 |
2001 aMTF.Record( &aVirDev ); 2002 aVirDev.DrawBitmap( Point(), aBmp ); 2003 aMTF.Stop(); 2004 aMTF.SetPrefSize( aBmp.GetSizePixel() ); 2005 2006 if( !ConvertGDIMetaFileToEMF( aMTF, rOStm, &aConfigItem ) ) 2007 nStatus = GRFILTER_FORMATERROR; 2008 } 2009 if( rOStm.GetError() ) | 1970 if( rOStm.GetError() ) |
2010 nStatus = GRFILTER_IOERROR; 2011 } 2012 else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) 2013 { 2014 bool bExportedGrayJPEG = false; 2015 if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) ) 2016 nStatus = GRFILTER_FORMATERROR; 2017 nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0; --- 98 unchanged lines hidden (view full) --- 2116 if( xActiveDataSource.is() ) 2117 { 2118 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xStmIf( 2119 static_cast< ::cppu::OWeakObject* >( new ImpFilterOutputStream( rOStm ) ) ); 2120 2121 SvMemoryStream aMemStm( 65535, 65535 ); 2122 2123 aMemStm.SetCompressMode( COMPRESSMODE_FULL ); | 1971 nStatus = GRFILTER_IOERROR; 1972 } 1973 else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) 1974 { 1975 bool bExportedGrayJPEG = false; 1976 if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) ) 1977 nStatus = GRFILTER_FORMATERROR; 1978 nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0; --- 98 unchanged lines hidden (view full) --- 2077 if( xActiveDataSource.is() ) 2078 { 2079 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xStmIf( 2080 static_cast< ::cppu::OWeakObject* >( new ImpFilterOutputStream( rOStm ) ) ); 2081 2082 SvMemoryStream aMemStm( 65535, 65535 ); 2083 2084 aMemStm.SetCompressMode( COMPRESSMODE_FULL ); |
2085 2086 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically |
|
2124 ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm ); 2125 2126 xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >( 2127 xStmIf, ::com::sun::star::uno::UNO_QUERY ) ); 2128 ::com::sun::star::uno::Sequence< sal_Int8 > aMtfSeq( (sal_Int8*) aMemStm.GetData(), aMemStm.Tell() ); 2129 xSVGWriter->write( xSaxWriter, aMtfSeq ); 2130 } 2131 } --- 222 unchanged lines hidden --- | 2087 ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm ); 2088 2089 xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >( 2090 xStmIf, ::com::sun::star::uno::UNO_QUERY ) ); 2091 ::com::sun::star::uno::Sequence< sal_Int8 > aMtfSeq( (sal_Int8*) aMemStm.GetData(), aMemStm.Tell() ); 2092 xSVGWriter->write( xSaxWriter, aMtfSeq ); 2093 } 2094 } --- 222 unchanged lines hidden --- |