summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-05-28 15:24:45 +0200
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-05-28 15:24:45 +0200
commit8f5ff4a4cbe7d33417a7b884e1c3093168738581 (patch)
tree86d6142ba4017261541dc45766b30dbcba110e45 /svtools
parent1f8a320a9caec6354f3a2f6bbc38ba8f85e7f16c (diff)
vcl111: #i108490# fix handling of greyscale jpeg images in PDF export
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/filter.hxx5
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx8
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.cxx15
-rw-r--r--svtools/source/inc/jpeg.hxx11
4 files changed, 30 insertions, 9 deletions
diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx
index 770e81b00551..49ec77adfea5 100644
--- a/svtools/inc/svtools/filter.hxx
+++ b/svtools/inc/svtools/filter.hxx
@@ -62,6 +62,8 @@ class Graphic;
#define GRFILTER_ABORT 6
#define GRFILTER_TOOBIG 7
+#define GRFILTER_OUTHINT_GREY 1
+
#define GRFILTER_FORMAT_NOTFOUND ((USHORT)0xFFFF)
#define GRFILTER_FORMAT_DONTKNOW ((USHORT)0xFFFF)
@@ -323,7 +325,7 @@ protected:
sal_Bool bDummy2;
sal_Bool bDummy3;
sal_Bool bDummy4;
- long nDummy1;
+ long nExpGraphHint;
long nDummy2;
void* pDummy1;
void* pDummy2;
@@ -374,6 +376,7 @@ public:
USHORT ExportGraphic( const Graphic& rGraphic, const String& rPath,
SvStream& rOStm, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
+ long GetExportGraphicHint() const { return nExpGraphHint; }
USHORT CanImportGraphic( const INetURLObject& rPath,
USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index e8121f1d7e94..c8a79d3a35cd 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -992,7 +992,8 @@ namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }
// -----------------
GraphicFilter::GraphicFilter( sal_Bool bConfig ) :
- bUseConfig ( bConfig )
+ bUseConfig ( bConfig ),
+ nExpGraphHint ( 0 )
{
ImplInit();
}
@@ -1678,6 +1679,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
USHORT nFormatCount = GetExportFormatCount();
ResetLastError();
+ nExpGraphHint = 0;
if( nFormat == GRFILTER_FORMAT_DONTKNOW )
{
@@ -1850,8 +1852,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat
}
else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )
{
- if( !ExportJPEG( rOStm, aGraphic, pFilterData ) )
+ bool bExportedGrayJPEG = false;
+ if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) )
nStatus = GRFILTER_FORMATERROR;
+ nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0;
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx
index 7fd2e09a82dd..a2de92171af3 100644
--- a/svtools/source/filter.vcl/jpeg/jpeg.cxx
+++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx
@@ -590,10 +590,11 @@ ReadState JPEGReader::Read( Graphic& rGraphic )
// - JPEGWriter -
// --------------
-JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData ) :
+JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) :
rOStm ( rStm ),
pAcc ( NULL ),
- pBuffer ( NULL )
+ pBuffer ( NULL ),
+ pExpWasGrey ( pExportWasGrey )
{
FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData );
bGreys = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ) != 0;
@@ -704,6 +705,9 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic )
bGreys = sal_True;
}
+ if( pExpWasGrey )
+ *pExpWasGrey = bGreys;
+
if( pAcc )
{
bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB );
@@ -765,8 +769,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32
// - ExportJPEG -
// --------------
-BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData )
+BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey
+ )
{
- JPEGWriter aJPEGWriter( rOStm, pFilterData );
+ JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey );
return aJPEGWriter.Write( rGraphic );
}
diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx
index 906bcd9ea2de..9923190c5e21 100644
--- a/svtools/source/inc/jpeg.hxx
+++ b/svtools/source/inc/jpeg.hxx
@@ -99,13 +99,16 @@ class JPEGWriter
sal_Bool bGreys;
sal_Int32 nQuality;
+ bool* pExpWasGrey;
+
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
public:
void* GetScanline( long nY );
- JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+ JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL );
~JPEGWriter() {};
BOOL Write( const Graphic& rGraphic );
@@ -119,6 +122,10 @@ public:
BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
-BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+BOOL ExportJPEG( SvStream& rStream,
+ const Graphic& rGraphic,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
+ bool* pExportWasGrey = NULL
+ );
#endif // _JPEG_HXX