1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <tools/stream.hxx>
24 #include <vcl/outdev.hxx>
25 #include <vcl/graphicfilter.hxx>
26 #include <unotools/ucbstreamhelper.hxx>
30 sal_uInt8
* ImplSearchEntry( sal_uInt8
* , sal_uInt8
* , sal_uLong
, sal_uLong
);
32 GraphicDescriptor::GraphicDescriptor( const INetURLObject
& rPath
) :
33 pFileStm( ::utl::UcbStreamHelper::CreateStream( rPath
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
) ),
34 aPathExt( rPath
.GetFileExtension().toAsciiLowerCase() ),
35 bOwnStream( sal_True
)
40 GraphicDescriptor::GraphicDescriptor( SvStream
& rInStream
, const String
* pPath
) :
41 pFileStm ( &rInStream
),
42 bOwnStream ( sal_False
)
48 INetURLObject
aURL( *pPath
);
49 aPathExt
= aURL
.GetFileExtension().toAsciiLowerCase();
53 GraphicDescriptor::~GraphicDescriptor()
59 sal_Bool
GraphicDescriptor::Detect( sal_Bool bExtendedInfo
)
61 sal_Bool bRet
= sal_False
;
62 if ( pFileStm
&& !pFileStm
->GetError() )
64 SvStream
& rStm
= *pFileStm
;
65 sal_uInt16 nOldFormat
= rStm
.GetNumberFormatInt();
67 if ( ImpDetectGIF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
68 else if ( ImpDetectJPG( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
69 else if ( ImpDetectBMP( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
70 else if ( ImpDetectPNG( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
71 else if ( ImpDetectTIF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
72 else if ( ImpDetectPCX( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
73 else if ( ImpDetectDXF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
74 else if ( ImpDetectMET( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
75 else if ( ImpDetectSGF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
76 else if ( ImpDetectSGV( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
77 else if ( ImpDetectSVM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
78 else if ( ImpDetectWMF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
79 else if ( ImpDetectEMF( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
80 else if ( ImpDetectSVG( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
81 else if ( ImpDetectPCT( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
82 else if ( ImpDetectXBM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
83 else if ( ImpDetectXPM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
84 else if ( ImpDetectPBM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
85 else if ( ImpDetectPGM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
86 else if ( ImpDetectPPM( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
87 else if ( ImpDetectRAS( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
88 else if ( ImpDetectTGA( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
89 else if ( ImpDetectPSD( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
90 else if ( ImpDetectEPS( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
91 else if ( ImpDetectPCD( rStm
, bExtendedInfo
) ) bRet
= sal_True
;
93 rStm
.SetNumberFormatInt( nOldFormat
);
98 void GraphicDescriptor::ImpConstruct()
103 bCompressed
= sal_False
;
106 sal_Bool
GraphicDescriptor::ImpDetectBMP( SvStream
& rStm
, sal_Bool bExtendedInfo
)
109 sal_Bool bRet
= sal_False
;
110 sal_Int32 nStmPos
= rStm
.Tell();
112 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
116 if ( nTemp16
== 0x4142 )
118 rStm
.SeekRel( 0x0c );
123 if ( nTemp16
== 0x4d42 )
131 sal_uInt32 nCompression
;
134 rStm
.SeekRel( 0x10 );
138 aPixSize
.Width() = nTemp32
;
142 aPixSize
.Height() = nTemp32
;
150 nBitsPerPixel
= nTemp16
;
154 bCompressed
= ( ( nCompression
= nTemp32
) > 0 );
160 aLogSize
.Width() = ( aPixSize
.Width() * 100000 ) / nTemp32
;
165 aLogSize
.Height() = ( aPixSize
.Height() * 100000 ) / nTemp32
;
167 // further validation, check for rational values
168 if ( ( nBitsPerPixel
> 24 ) || ( nCompression
> 3 ) )
175 rStm
.Seek( nStmPos
);
179 sal_Bool
GraphicDescriptor::ImpDetectGIF( SvStream
& rStm
, sal_Bool bExtendedInfo
)
183 sal_Bool bRet
= sal_False
;
186 sal_Int32 nStmPos
= rStm
.Tell();
187 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
190 if ( n32
== 0x38464947 )
193 if ( ( n16
== 0x6137 ) || ( n16
== 0x6139 ) )
204 aPixSize
.Width() = nTemp16
;
208 aPixSize
.Height() = nTemp16
;
212 nBitsPerPixel
= ( ( cByte
& 112 ) >> 4 ) + 1;
216 rStm
.Seek( nStmPos
);
220 // returns the next jpeg marker, a return value of 0 represents an error
221 sal_uInt8
ImpDetectJPG_GetNextMarker( SvStream
& rStm
)
229 if ( rStm
.IsEof() || rStm
.GetError() ) // as 0 is not allowed as marker,
230 return 0; // we can use it as errorcode
232 while ( nByte
!= 0xff );
236 if ( rStm
.IsEof() || rStm
.GetError() )
239 while( nByte
== 0xff );
241 while( nByte
== 0 ); // 0xff00 represents 0xff and not a marker,
242 // the marker detection has to be restartet.
246 sal_Bool
GraphicDescriptor::ImpDetectJPG( SvStream
& rStm
, sal_Bool bExtendedInfo
)
249 sal_Bool bRet
= sal_False
;
251 sal_Int32 nStmPos
= rStm
.Tell();
253 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
256 // compare upper 24 bits
257 if( 0xffd8ff00 == ( nTemp32
& 0xffffff00 ) )
266 sal_uInt32
nError( rStm
.GetError() );
268 sal_Bool bScanFailure
= sal_False
;
269 sal_Bool bScanFinished
= sal_False
;
271 while( !bScanFailure
&& !bScanFinished
&& !rStm
.IsEof() && !rStm
.GetError() )
273 sal_uInt8 nMarker
= ImpDetectJPG_GetNextMarker( rStm
);
276 // fixed size marker, not having a two byte length parameter
288 case 0xd8 : // SOI (has already been checked, there should not be a second one)
289 case 0x00 : // marker is invalid, we should stop now
290 bScanFailure
= sal_True
;
294 bScanFinished
= sal_True
;
297 // per default we assume marker segments conaining a length parameter
304 bScanFailure
= sal_True
;
307 sal_uInt32 nNextMarkerPos
= rStm
.Tell() + nLength
- 2;
310 case 0xe0 : // APP0 Marker
314 sal_Int32 nIdentifier
;
316 if ( nIdentifier
== 0x4a464946 ) // JFIF Identifier
318 sal_uInt8 nStringTerminator
;
319 sal_uInt8 nMajorRevision
;
320 sal_uInt8 nMinorRevision
;
322 sal_uInt16 nHorizontalResolution
;
323 sal_uInt16 nVerticalResolution
;
324 sal_uInt8 nHorzThumbnailPixelCount
;
325 sal_uInt8 nVertThumbnailPixelCount
;
327 rStm
>> nStringTerminator
331 >> nHorizontalResolution
332 >> nVerticalResolution
333 >> nHorzThumbnailPixelCount
334 >> nVertThumbnailPixelCount
;
336 // setting the logical size
337 if ( nUnits
&& nHorizontalResolution
&& nVerticalResolution
)
340 aMap
.SetMapUnit( nUnits
== 1 ? MAP_INCH
: MAP_CM
);
341 aMap
.SetScaleX( Fraction( 1, nHorizontalResolution
) );
342 aMap
.SetScaleY( Fraction( 1, nVerticalResolution
) );
343 aLogSize
= OutputDevice::LogicToLogic( aPixSize
, aMap
, MapMode( MAP_100TH_MM
) );
350 // Start of Frame Markers
365 sal_uInt8 nSamplePrecision
;
366 sal_uInt16 nNumberOfLines
;
367 sal_uInt16 nSamplesPerLine
;
368 sal_uInt8 nNumberOfImageComponents
;
369 sal_uInt8 nComponentsIdentifier
;
370 sal_uInt8 nHorizontalSamplingFactor
;
371 sal_uInt8 nQuantizationTableDestinationSelector
;
372 rStm
>> nSamplePrecision
375 >> nNumberOfImageComponents
376 >> nComponentsIdentifier
377 >> nHorizontalSamplingFactor
378 >> nQuantizationTableDestinationSelector
;
379 nHorizontalSamplingFactor
>>= 4;
381 aPixSize
.Height() = nNumberOfLines
;
382 aPixSize
.Width() = nSamplesPerLine
;
383 nBitsPerPixel
= ( nNumberOfImageComponents
== 3 ? 24 : nNumberOfImageComponents
== 1 ? 8 : 0 );
386 bScanFinished
= sal_True
;
390 rStm
.Seek( nNextMarkerPos
);
396 rStm
.SetError( nError
);
399 rStm
.Seek( nStmPos
);
403 sal_Bool
GraphicDescriptor::ImpDetectPCD( SvStream
& rStm
, sal_Bool
)
405 sal_Bool bRet
= sal_False
;
407 sal_Int32 nStmPos
= rStm
.Tell();
408 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
414 rStm
.SeekRel( 2048 );
419 if ( ( nTemp32
== 0x5f444350 ) &&
420 ( nTemp16
== 0x5049 ) &&
426 rStm
.Seek( nStmPos
);
430 sal_Bool
GraphicDescriptor::ImpDetectPCX( SvStream
& rStm
, sal_Bool bExtendedInfo
)
432 // ! Because 0x0a can be interpreted as LF too ...
433 // we cant be shure that this special sign represent a PCX file only.
434 // Every Ascii file is possible here :-(
435 // We must detect the whole header.
436 bExtendedInfo
= sal_True
;
438 sal_Bool bRet
= sal_False
;
441 sal_Int32 nStmPos
= rStm
.Tell();
442 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
465 bCompressed
= ( cByte
> 0 );
467 bRet
= (cByte
==0 || cByte
==1);
471 nBitsPerPixel
= cByte
;
483 aPixSize
.Width() = nXmax
- nXmin
+ 1;
484 aPixSize
.Height() = nYmax
- nYmin
+ 1;
493 MapMode
aMap( MAP_INCH
, Point(),
494 Fraction( 1, nDPIx
), Fraction( 1, nDPIy
) );
495 aLogSize
= OutputDevice::LogicToLogic( aPixSize
, aMap
,
496 MapMode( MAP_100TH_MM
) );
499 // number of color planes
508 rStm
.Seek( nStmPos
);
512 sal_Bool
GraphicDescriptor::ImpDetectPNG( SvStream
& rStm
, sal_Bool bExtendedInfo
)
515 sal_Bool bRet
= sal_False
;
517 sal_Int32 nStmPos
= rStm
.Tell();
518 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
521 if ( nTemp32
== 0x89504e47 )
524 if ( nTemp32
== 0x0d0a1a0a )
538 aPixSize
.Width() = nTemp32
;
542 aPixSize
.Height() = nTemp32
;
546 nBitsPerPixel
= cByte
;
549 // compression always
551 bCompressed
= sal_True
;
557 // read up to the pHYs-Chunk or the start of the image
560 while( ( nTemp32
!= 0x70485973 ) && ( nTemp32
!= 0x49444154 ) )
562 rStm
.SeekRel( 4 + nLen32
);
567 if ( nTemp32
== 0x70485973 )
572 // horizontal resolution
576 // vertical resolution
586 aLogSize
.Width() = ( aPixSize
.Width() * 100000 ) /
590 aLogSize
.Height() = ( aPixSize
.Height() * 100000 ) /
597 rStm
.Seek( nStmPos
);
601 sal_Bool
GraphicDescriptor::ImpDetectTIF( SvStream
& rStm
, sal_Bool bExtendedInfo
)
603 sal_Bool bDetectOk
= sal_False
;
604 sal_Bool bRet
= sal_False
;
608 sal_Int32 nStmPos
= rStm
.Tell();
611 if ( cByte1
== cByte2
)
613 if ( cByte1
== 0x49 )
615 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
616 bDetectOk
= sal_True
;
618 else if ( cByte1
== 0x4d )
620 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
621 bDetectOk
= sal_True
;
629 if ( nTemp16
== 0x2a )
637 sal_uLong nMax
= DATA_SIZE
- 48;
639 sal_Bool bOk
= sal_False
;
641 // Offset of the first IFD
643 rStm
.SeekRel( ( nCount
= ( nTemp32
+ 2 ) ) - 0x08 );
647 // read tags till we find Tag256 ( Width )
648 // do not read more bytes than DATA_SIZE
650 while ( nTemp16
!= 256 )
670 aPixSize
.Width() = nTemp16
;
676 aPixSize
.Width() = nTemp32
;
687 aPixSize
.Height() = nTemp16
;
693 aPixSize
.Height() = nTemp32
;
699 if ( nTemp16
== 258 )
703 nBitsPerPixel
= nTemp16
;
712 if ( nTemp16
== 259 )
716 bCompressed
= ( nTemp16
> 1 );
728 rStm
.Seek( nStmPos
);
732 sal_Bool
GraphicDescriptor::ImpDetectXBM( SvStream
&, sal_Bool
)
734 sal_Bool bRet
= aPathExt
.CompareToAscii( "xbm", 3 ) == COMPARE_EQUAL
;
741 sal_Bool
GraphicDescriptor::ImpDetectXPM( SvStream
&, sal_Bool
)
743 sal_Bool bRet
= aPathExt
.CompareToAscii( "xpm", 3 ) == COMPARE_EQUAL
;
750 sal_Bool
GraphicDescriptor::ImpDetectPBM( SvStream
& rStm
, sal_Bool
)
752 sal_Bool bRet
= sal_False
;
754 // check file extension first, as this trumps the 2 ID bytes
755 if ( aPathExt
.CompareToAscii( "pbm", 3 ) == COMPARE_EQUAL
)
759 sal_Int32 nStmPos
= rStm
.Tell();
760 sal_uInt8 nFirst
, nSecond
;
761 rStm
>> nFirst
>> nSecond
;
762 if ( nFirst
== 'P' && ( ( nSecond
== '1' ) || ( nSecond
== '4' ) ) )
764 rStm
.Seek( nStmPos
);
773 sal_Bool
GraphicDescriptor::ImpDetectPGM( SvStream
& rStm
, sal_Bool
)
775 sal_Bool bRet
= sal_False
;
777 if ( aPathExt
.CompareToAscii( "pgm", 3 ) == COMPARE_EQUAL
)
781 sal_uInt8 nFirst
, nSecond
;
782 sal_Int32 nStmPos
= rStm
.Tell();
783 rStm
>> nFirst
>> nSecond
;
784 if ( nFirst
== 'P' && ( ( nSecond
== '2' ) || ( nSecond
== '5' ) ) )
786 rStm
.Seek( nStmPos
);
795 sal_Bool
GraphicDescriptor::ImpDetectPPM( SvStream
& rStm
, sal_Bool
)
797 sal_Bool bRet
= sal_False
;
799 if ( aPathExt
.CompareToAscii( "ppm", 3 ) == COMPARE_EQUAL
)
803 sal_uInt8 nFirst
, nSecond
;
804 sal_Int32 nStmPos
= rStm
.Tell();
805 rStm
>> nFirst
>> nSecond
;
806 if ( nFirst
== 'P' && ( ( nSecond
== '3' ) || ( nSecond
== '6' ) ) )
808 rStm
.Seek( nStmPos
);
817 sal_Bool
GraphicDescriptor::ImpDetectRAS( SvStream
& rStm
, sal_Bool
)
819 sal_uInt32 nMagicNumber
;
820 sal_Bool bRet
= sal_False
;
821 sal_Int32 nStmPos
= rStm
.Tell();
822 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
823 rStm
>> nMagicNumber
;
824 if ( nMagicNumber
== 0x59a66a95 )
829 rStm
.Seek( nStmPos
);
833 sal_Bool
GraphicDescriptor::ImpDetectTGA( SvStream
&, sal_Bool
)
835 sal_Bool bRet
= aPathExt
.CompareToAscii( "tga", 3 ) == COMPARE_EQUAL
;
842 sal_Bool
GraphicDescriptor::ImpDetectPSD( SvStream
& rStm
, sal_Bool bExtendedInfo
)
844 sal_Bool bRet
= sal_False
;
846 sal_uInt32 nMagicNumber
;
847 sal_Int32 nStmPos
= rStm
.Tell();
848 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
849 rStm
>> nMagicNumber
;
850 if ( nMagicNumber
== 0x38425053 )
859 sal_uInt16 nChannels
;
864 rStm
.SeekRel( 6 ); // Pad
865 rStm
>> nChannels
>> nRows
>> nColumns
>> nDepth
>> nMode
;
866 if ( ( nDepth
== 1 ) || ( nDepth
== 8 ) || ( nDepth
== 16 ) )
868 nBitsPerPixel
= ( nDepth
== 16 ) ? 8 : nDepth
;
876 aPixSize
.Width() = nColumns
;
877 aPixSize
.Height() = nRows
;
891 rStm
.Seek( nStmPos
);
895 sal_Bool
GraphicDescriptor::ImpDetectEPS( SvStream
& rStm
, sal_Bool
)
897 // check the EPS preview and the file extension
898 sal_uInt32 nFirstLong
;
899 sal_uInt8 nFirstBytes
[20];
900 sal_Bool bRet
= sal_False
;
902 sal_Int32 nStmPos
= rStm
.Tell();
903 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
906 rStm
.Read( &nFirstBytes
, 20 );
908 if ( ( nFirstLong
== 0xC5D0D3C6 ) || ( aPathExt
.CompareToAscii( "eps", 3 ) == COMPARE_EQUAL
) ||
909 ( ImplSearchEntry( nFirstBytes
, (sal_uInt8
*)"%!PS-Adobe", 10, 10 )
910 && ImplSearchEntry( &nFirstBytes
[15], (sal_uInt8
*)"EPS", 3, 3 ) ) )
915 rStm
.Seek( nStmPos
);
919 sal_Bool
GraphicDescriptor::ImpDetectDXF( SvStream
&, sal_Bool
)
921 sal_Bool bRet
= aPathExt
.CompareToAscii( "dxf", 3 ) == COMPARE_EQUAL
;
928 sal_Bool
GraphicDescriptor::ImpDetectMET( SvStream
&, sal_Bool
)
930 sal_Bool bRet
= aPathExt
.CompareToAscii( "met", 3 ) == COMPARE_EQUAL
;
937 extern bool isPCT(SvStream
& rStream
, sal_uLong nStreamPos
, sal_uLong nStreamLen
);
939 sal_Bool
GraphicDescriptor::ImpDetectPCT( SvStream
& rStm
, sal_Bool
)
941 sal_Bool bRet
= aPathExt
.CompareToAscii( "pct", 3 ) == COMPARE_EQUAL
;
946 sal_Size nStreamPos
= rStm
.Tell();
947 sal_Size nStreamLen
= rStm
.remainingSize();
948 if (isPCT(rStm
, nStreamPos
, nStreamLen
))
953 rStm
.Seek(nStreamPos
);
959 sal_Bool
GraphicDescriptor::ImpDetectSGF( SvStream
& rStm
, sal_Bool
)
961 sal_Bool bRet
= sal_False
;
962 if( aPathExt
.CompareToAscii( "sgf", 3 ) == COMPARE_EQUAL
)
966 sal_Int32 nStmPos
= rStm
.Tell();
968 sal_uInt8 nFirst
, nSecond
;
970 rStm
>> nFirst
>> nSecond
;
972 if( nFirst
== 'J' && nSecond
== 'J' )
975 rStm
.Seek( nStmPos
);
984 sal_Bool
GraphicDescriptor::ImpDetectSGV( SvStream
&, sal_Bool
)
986 sal_Bool bRet
= aPathExt
.CompareToAscii( "sgv", 3 ) == COMPARE_EQUAL
;
993 sal_Bool
GraphicDescriptor::ImpDetectSVM( SvStream
& rStm
, sal_Bool bExtendedInfo
)
996 sal_Bool bRet
= sal_False
;
999 sal_Int32 nStmPos
= rStm
.Tell();
1000 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
1002 if ( n32
== 0x44475653 )
1005 if ( cByte
== 0x49 )
1010 if ( bExtendedInfo
)
1015 rStm
.SeekRel( 0x04 );
1019 aLogSize
.Width() = nTemp32
;
1023 aLogSize
.Height() = nTemp32
;
1025 // read MapUnit and determine PrefSize
1027 aLogSize
= OutputDevice::LogicToLogic( aLogSize
,
1028 MapMode( (MapUnit
) nTemp16
),
1029 MapMode( MAP_100TH_MM
) );
1035 rStm
.SeekRel( -4L );
1038 if( n32
== 0x4D4C4356 )
1044 if( nTmp16
== 0x4654 )
1053 rStm
.SeekRel( 0x06 );
1056 aLogSize
= OutputDevice::LogicToLogic( aLogSize
, aMapMode
, MapMode( MAP_100TH_MM
) );
1061 rStm
.Seek( nStmPos
);
1065 sal_Bool
GraphicDescriptor::ImpDetectWMF( SvStream
&, sal_Bool
)
1067 sal_Bool bRet
= aPathExt
.CompareToAscii( "wmf",3 ) == COMPARE_EQUAL
;
1074 sal_Bool
GraphicDescriptor::ImpDetectEMF( SvStream
&, sal_Bool
)
1076 sal_Bool bRet
= aPathExt
.CompareToAscii( "emf", 3 ) == COMPARE_EQUAL
;
1083 sal_Bool
GraphicDescriptor::ImpDetectSVG( SvStream
& /*rStm*/, sal_Bool
/*bExtendedInfo*/ )
1085 sal_Bool bRet
= aPathExt
.CompareToAscii( "svg", 3 ) == COMPARE_EQUAL
;
1092 String
GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat
)
1094 const char *pKeyName
= 0;
1098 case( GFF_BMP
) : pKeyName
= "bmp"; break;
1099 case( GFF_GIF
) : pKeyName
= "gif"; break;
1100 case( GFF_JPG
) : pKeyName
= "jpg"; break;
1101 case( GFF_PCD
) : pKeyName
= "pcd"; break;
1102 case( GFF_PCX
) : pKeyName
= "pcx"; break;
1103 case( GFF_PNG
) : pKeyName
= "png"; break;
1104 case( GFF_XBM
) : pKeyName
= "xbm"; break;
1105 case( GFF_XPM
) : pKeyName
= "xpm"; break;
1106 case( GFF_PBM
) : pKeyName
= "pbm"; break;
1107 case( GFF_PGM
) : pKeyName
= "pgm"; break;
1108 case( GFF_PPM
) : pKeyName
= "ppm"; break;
1109 case( GFF_RAS
) : pKeyName
= "ras"; break;
1110 case( GFF_TGA
) : pKeyName
= "tga"; break;
1111 case( GFF_PSD
) : pKeyName
= "psd"; break;
1112 case( GFF_EPS
) : pKeyName
= "eps"; break;
1113 case( GFF_TIF
) : pKeyName
= "tif"; break;
1114 case( GFF_DXF
) : pKeyName
= "dxf"; break;
1115 case( GFF_MET
) : pKeyName
= "met"; break;
1116 case( GFF_PCT
) : pKeyName
= "pct"; break;
1117 case( GFF_SGF
) : pKeyName
= "sgf"; break;
1118 case( GFF_SGV
) : pKeyName
= "sgv"; break;
1119 case( GFF_SVM
) : pKeyName
= "svm"; break;
1120 case( GFF_WMF
) : pKeyName
= "wmf"; break;
1121 case( GFF_EMF
) : pKeyName
= "emf"; break;
1122 case( GFF_SVG
) : pKeyName
= "svg"; break;
1125 return OUString::createFromAscii(pKeyName
);
1128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */