1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filter2.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
36 #include <tools/stream.hxx>
37 #include <tools/debug.hxx>
38 #include <vcl/outdev.hxx>
39 #include <tools/config.hxx>
40 #include <svtools/filter.hxx>
41 #include "FilterConfigCache.hxx"
42 #include <unotools/ucbstreamhelper.hxx>
46 BYTE
* ImplSearchEntry( BYTE
* , BYTE
* , ULONG
, ULONG
);
49 /*************************************************************************
53 \************************************************************************/
55 GraphicDescriptor::GraphicDescriptor( const String
* pPath
) :
62 INetURLObject
aURL( *pPath
, INET_PROT_FILE
);
63 aPathExt
= aURL
.GetFileExtension().toAsciiLowerCase();
71 /*************************************************************************
75 \************************************************************************/
77 GraphicDescriptor::GraphicDescriptor( const INetURLObject
& rPath
) :
78 pFileStm( ::utl::UcbStreamHelper::CreateStream( rPath
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
) ),
79 aPathExt( rPath
.GetFileExtension().toAsciiLowerCase() )
84 pFileStm
->Seek( nStmPos
);
90 if ( pFileStm
&& !pFileStm
->GetError() )
94 /*************************************************************************
98 \************************************************************************/
100 GraphicDescriptor::GraphicDescriptor( SvStream
& rInStream
, const String
* pPath
) :
107 INetURLObject
aURL( *pPath
);
108 aPathExt
= aURL
.GetFileExtension().toAsciiLowerCase();
110 nStmPos
= rInStream
.Tell();
111 pBaseStm
= &rInStream
;
114 if ( !pBaseStm
->GetError() )
119 /*************************************************************************
123 \************************************************************************/
125 GraphicDescriptor::~GraphicDescriptor()
131 /*************************************************************************
135 \************************************************************************/
137 BOOL
GraphicDescriptor::Detect( BOOL bExtendedInfo
)
141 // Link-Status ueberpruefen
142 if ( bLinked
&& bLinkChanged
)
144 DBG_ASSERT( aReqLink
.IsSet(), "Wo ist der RequestHandler???" );
145 pMemStm
= (SvStream
*) aReqLink
.Call( this );
148 nStmPos
= pMemStm
->Tell();
155 SvStream
& rStm
= GetSearchStream();
156 UINT16 nOldFormat
= rStm
.GetNumberFormatInt();
158 if ( ImpDetectGIF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
159 else if ( ImpDetectJPG( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
160 else if ( ImpDetectBMP( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
161 else if ( ImpDetectPNG( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
162 else if ( ImpDetectTIF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
163 else if ( ImpDetectPCX( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
164 else if ( ImpDetectDXF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
165 else if ( ImpDetectMET( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
166 else if ( ImpDetectSGF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
167 else if ( ImpDetectSGV( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
168 else if ( ImpDetectSVM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
169 else if ( ImpDetectWMF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
170 else if ( ImpDetectEMF( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
171 else if ( ImpDetectPCT( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
172 else if ( ImpDetectXBM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
173 else if ( ImpDetectXPM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
174 else if ( ImpDetectPBM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
175 else if ( ImpDetectPGM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
176 else if ( ImpDetectPPM( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
177 else if ( ImpDetectRAS( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
178 else if ( ImpDetectTGA( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
179 else if ( ImpDetectPSD( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
180 else if ( ImpDetectEPS( rStm
, bExtendedInfo
) ) bRet
= TRUE
;
182 // diese Formate lassen sich nur bei WideSearch im gesamten
184 else if ( bWideSearch
)
186 if ( ImpDetectPCD( rStm
, bExtendedInfo
) )
190 rStm
.SetNumberFormatInt( nOldFormat
);
191 rStm
.Seek( nStmPos
);
198 /*************************************************************************
202 \************************************************************************/
204 BOOL
GraphicDescriptor::IsDataReady() const
210 /*************************************************************************
214 \************************************************************************/
216 BOOL
GraphicDescriptor::IsWideSearch() const
222 /*************************************************************************
226 \************************************************************************/
228 SvStream
& GraphicDescriptor::GetSearchStream() const
230 DBG_ASSERT( bDataReady
, "Was laeuft hier falsch???" );
241 /*************************************************************************
245 \************************************************************************/
247 void GraphicDescriptor::SetRequestHdl( const Link
& rRequestLink
)
249 aReqLink
= rRequestLink
;
254 /*************************************************************************
258 \************************************************************************/
260 ULONG
GraphicDescriptor::GetRequestedByteCount() const
266 /******************************************************************************/
271 /*************************************************************************
275 \************************************************************************/
277 void GraphicDescriptor::ImpConstruct()
280 pFileStm
= new SvStream();
293 /*************************************************************************
297 \************************************************************************/
299 BOOL
GraphicDescriptor::ImpDetectBMP( SvStream
& rStm
, BOOL bExtendedInfo
)
304 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
305 rStm
.Seek( nStmPos
);
310 if ( nTemp16
== 0x4142 )
312 rStm
.SeekRel( 0x0c );
317 if ( nTemp16
== 0x4d42 )
327 // bis zur ersten Information
328 rStm
.SeekRel( 0x10 );
330 // PixelBreite auslesen
332 aPixSize
.Width() = nTemp32
;
334 // PixelHoehe auslesen
336 aPixSize
.Height() = nTemp32
;
344 nBitsPerPixel
= nTemp16
;
346 // Compression auslesen
348 bCompressed
= ( ( nCompression
= nTemp32
) > 0 );
354 aLogSize
.Width() = ( aPixSize
.Width() * 100000 ) / nTemp32
;
359 aLogSize
.Height() = ( aPixSize
.Height() * 100000 ) / nTemp32
;
361 // Wir wollen noch etwas feiner differenzieren und
362 // auf sinnvolle Werte ueberpruefen ( Bug-Id #29001 )
363 if ( ( nBitsPerPixel
> 24 ) || ( nCompression
> 3 ) )
375 /*************************************************************************
379 \************************************************************************/
381 BOOL
GraphicDescriptor::ImpDetectGIF( SvStream
& rStm
, BOOL bExtendedInfo
)
388 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
389 rStm
.Seek( nStmPos
);
392 if ( n32
== 0x38464947 )
395 if ( ( n16
== 0x6137 ) || ( n16
== 0x6139 ) )
404 // PixelBreite auslesen
406 aPixSize
.Width() = nTemp16
;
408 // PixelHoehe auslesen
410 aPixSize
.Height() = nTemp16
;
412 // Bits/Pixel auslesen
414 nBitsPerPixel
= ( ( cByte
& 112 ) >> 4 ) + 1;
423 /*************************************************************************
427 \************************************************************************/
429 BOOL
GraphicDescriptor::ImpDetectJPG( SvStream
& rStm
, BOOL bExtendedInfo
)
436 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
437 rStm
.Seek( nStmPos
);
441 // compare upper 28 bits
442 if( 0xffd8ff00 == ( nTemp32
& 0xffffff00 ) )
448 bM_COM
= ( nTemp32
== 0xffd8fffe );
449 if ( ( nTemp32
== 0xffd8ffe0 ) || bM_COM
)
457 if( bM_COM
|| ( nTemp32
== 0x4a464946 ) )
472 // Groesse des verbleibenden Puffers ermitteln
474 nMax
= ( (SvMemoryStream
&) rStm
).GetSize() - 16;
476 nMax
= DATA_SIZE
- 16;
479 nMax
= Min( nMax
, (ULONG
) 8192 );
481 // Res-Unit ermitteln
493 // SOF0/1-Marker finden, aber dabei
494 // nicht mehr als DATA_SIZE Pixel lesen, falls
498 while ( ( cByte
!= 0xff ) &&
499 ( bWideSearch
|| ( nCount
++ < nMax
) ) )
504 while ( ( cByte
== 0xff ) &&
505 ( bWideSearch
|| ( nCount
++ < nMax
) ) )
510 while ( ( cByte
!= 0xc0 ) &&
512 ( bWideSearch
|| ( nCount
< nMax
) ) );
514 // wir haben den SOF0/1-Marker
515 if ( ( cByte
== 0xc0 ) || ( cByte
== 0xc1 ) )
520 aPixSize
.Height() = nTemp16
;
524 aPixSize
.Width() = nTemp16
;
526 // Bit/Pixel einlesen
528 nBitsPerPixel
= ( cByte
== 3 ? 24 : cByte
== 1 ? 8 : 0 );
530 // logische Groesse setzen
531 if ( cUnit
&& nResX
&& nResY
)
533 aMap
.SetMapUnit( cUnit
== 1 ? MAP_INCH
: MAP_CM
);
534 aMap
.SetScaleX( Fraction( 1, nResX
) );
535 aMap
.SetScaleY( Fraction( 1, nResY
) );
536 aLogSize
= OutputDevice::LogicToLogic( aPixSize
, aMap
,
537 MapMode( MAP_100TH_MM
) );
551 /*************************************************************************
555 \************************************************************************/
557 BOOL
GraphicDescriptor::ImpDetectPCD( SvStream
& rStm
, BOOL
)
561 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
562 rStm
.Seek( nStmPos
);
570 rStm
.SeekRel( 2048 );
575 if ( ( nTemp32
== 0x5f444350 ) &&
576 ( nTemp16
== 0x5049 ) &&
585 bRet
= aPathExt
.CompareToAscii( "pcd", 3 ) == COMPARE_EQUAL
;
596 /*************************************************************************
600 \************************************************************************/
602 BOOL
GraphicDescriptor::ImpDetectPCX( SvStream
& rStm
, BOOL bExtendedInfo
)
604 // ! Because 0x0a can be interpreted as LF too ...
605 // we cant be shure that this special sign represent a PCX file only.
606 // Every Ascii file is possible here :-(
607 // We must detect the whole header.
608 bExtendedInfo
= TRUE
;
613 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
614 rStm
.Seek( nStmPos
);
637 bCompressed
= ( cByte
> 0 );
639 bRet
= (cByte
==0 || cByte
==1);
643 nBitsPerPixel
= cByte
;
655 aPixSize
.Width() = nXmax
- nXmin
+ 1;
656 aPixSize
.Height() = nYmax
- nYmin
+ 1;
664 // logische Groesse setzen
665 MapMode
aMap( MAP_INCH
, Point(),
666 Fraction( 1, nDPIx
), Fraction( 1, nDPIy
) );
667 aLogSize
= OutputDevice::LogicToLogic( aPixSize
, aMap
,
668 MapMode( MAP_100TH_MM
) );
684 /*************************************************************************
688 \************************************************************************/
690 BOOL
GraphicDescriptor::ImpDetectPNG( SvStream
& rStm
, BOOL bExtendedInfo
)
695 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
696 rStm
.Seek( nStmPos
);
699 if ( nTemp32
== 0x89504e47 )
702 if ( nTemp32
== 0x0d0a1a0a )
716 aPixSize
.Width() = nTemp32
;
720 aPixSize
.Height() = nTemp32
;
722 // Bits/Pixel einlesen
724 nBitsPerPixel
= cByte
;
737 // so lange ueberlesen, bis wir den pHYs-Chunk haben oder
738 // den Anfang der Bilddaten
741 while( ( nTemp32
!= 0x70485973 ) && ( nTemp32
!= 0x49444154 ) )
743 rStm
.SeekRel( 4 + nLen32
);
748 if ( nTemp32
== 0x70485973 )
753 // horizontale Aufloesung
757 // vertikale Aufloesung
767 aLogSize
.Width() = ( aPixSize
.Width() * 100000 ) /
771 aLogSize
.Height() = ( aPixSize
.Height() * 100000 ) /
784 /*************************************************************************
788 \************************************************************************/
790 BOOL
GraphicDescriptor::ImpDetectTIF( SvStream
& rStm
, BOOL bExtendedInfo
)
792 BOOL bDetectOk
= FALSE
;
797 rStm
.Seek( nStmPos
);
800 if ( cByte1
== cByte2
)
802 if ( cByte1
== 0x49 )
804 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
807 else if ( cByte1
== 0x4d )
809 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
818 if ( nTemp16
== 0x2a )
826 ULONG nMax
= DATA_SIZE
- 48;
830 // Offset des ersten IFD einlesen
832 rStm
.SeekRel( ( nCount
= ( nTemp32
+ 2 ) ) - 0x08 );
834 if ( bWideSearch
|| ( nCount
< nMax
) )
836 // Tag's lesen, bis wir auf Tag256 ( Width ) treffen
837 // nicht mehr Bytes als DATA_SIZE lesen
839 while ( nTemp16
!= 256 )
841 bOk
= bWideSearch
|| ( nCount
< nMax
);
859 aPixSize
.Width() = nTemp16
;
865 aPixSize
.Width() = nTemp32
;
876 aPixSize
.Height() = nTemp16
;
882 aPixSize
.Height() = nTemp32
;
886 // ggf. Bits/Pixel lesen
888 if ( nTemp16
== 258 )
892 nBitsPerPixel
= nTemp16
;
899 // ggf. Compression lesen
901 if ( nTemp16
== 259 )
905 bCompressed
= ( nTemp16
> 1 );
922 /*************************************************************************
926 \************************************************************************/
928 BOOL
GraphicDescriptor::ImpDetectXBM( SvStream
&, BOOL
)
930 BOOL bRet
= aPathExt
.CompareToAscii( "xbm", 3 ) == COMPARE_EQUAL
;
938 /*************************************************************************
942 \************************************************************************/
944 BOOL
GraphicDescriptor::ImpDetectXPM( SvStream
&, BOOL
)
946 BOOL bRet
= aPathExt
.CompareToAscii( "xpm", 3 ) == COMPARE_EQUAL
;
953 /*************************************************************************
957 \************************************************************************/
959 BOOL
GraphicDescriptor::ImpDetectPBM( SvStream
& rStm
, BOOL
)
963 // erst auf Datei Extension pruefen, da diese aussagekraeftiger ist
964 // als die 2 ID Bytes
966 if ( aPathExt
.CompareToAscii( "pbm", 3 ) == COMPARE_EQUAL
)
970 BYTE nFirst
, nSecond
;
971 rStm
.Seek( nStmPos
);
972 rStm
>> nFirst
>> nSecond
;
973 if ( nFirst
== 'P' && ( ( nSecond
== '1' ) || ( nSecond
== '4' ) ) )
983 /*************************************************************************
987 \************************************************************************/
989 BOOL
GraphicDescriptor::ImpDetectPGM( SvStream
& rStm
, BOOL
)
993 if ( aPathExt
.CompareToAscii( "pgm", 3 ) == COMPARE_EQUAL
)
997 BYTE nFirst
, nSecond
;
998 rStm
.Seek( nStmPos
);
999 rStm
>> nFirst
>> nSecond
;
1000 if ( nFirst
== 'P' && ( ( nSecond
== '2' ) || ( nSecond
== '5' ) ) )
1010 /*************************************************************************
1014 \************************************************************************/
1016 BOOL
GraphicDescriptor::ImpDetectPPM( SvStream
& rStm
, BOOL
)
1020 if ( aPathExt
.CompareToAscii( "ppm", 3 ) == COMPARE_EQUAL
)
1024 BYTE nFirst
, nSecond
;
1025 rStm
.Seek( nStmPos
);
1026 rStm
>> nFirst
>> nSecond
;
1027 if ( nFirst
== 'P' && ( ( nSecond
== '3' ) || ( nSecond
== '6' ) ) )
1037 /*************************************************************************
1041 \************************************************************************/
1043 BOOL
GraphicDescriptor::ImpDetectRAS( SvStream
& rStm
, BOOL
)
1045 UINT32 nMagicNumber
;
1046 rStm
.Seek( nStmPos
);
1047 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
1048 rStm
>> nMagicNumber
;
1049 if ( nMagicNumber
== 0x59a66a95 )
1058 /*************************************************************************
1062 \************************************************************************/
1064 BOOL
GraphicDescriptor::ImpDetectTGA( SvStream
&, BOOL
)
1066 BOOL bRet
= aPathExt
.CompareToAscii( "tga", 3 ) == COMPARE_EQUAL
;
1073 /*************************************************************************
1077 \************************************************************************/
1079 BOOL
GraphicDescriptor::ImpDetectPSD( SvStream
& rStm
, BOOL bExtendedInfo
)
1083 UINT32 nMagicNumber
;
1084 rStm
.Seek( nStmPos
);
1085 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
1086 rStm
>> nMagicNumber
;
1087 if ( nMagicNumber
== 0x38425053 )
1091 if ( nVersion
== 1 )
1094 if ( bExtendedInfo
)
1101 rStm
.SeekRel( 6 ); // Pad
1102 rStm
>> nChannels
>> nRows
>> nColumns
>> nDepth
>> nMode
;
1103 if ( ( nDepth
== 1 ) || ( nDepth
== 8 ) || ( nDepth
== 16 ) )
1105 nBitsPerPixel
= ( nDepth
== 16 ) ? 8 : nDepth
;
1106 switch ( nChannels
)
1113 aPixSize
.Width() = nColumns
;
1114 aPixSize
.Height() = nRows
;
1131 /*************************************************************************
1135 \************************************************************************/
1137 BOOL
GraphicDescriptor::ImpDetectEPS( SvStream
& rStm
, BOOL
)
1139 // es wird die EPS mit Vorschaubild Variante und die Extensionuebereinstimmung
1142 sal_uInt32 nFirstLong
;
1143 sal_uInt8 nFirstBytes
[20];
1145 rStm
.Seek( nStmPos
);
1146 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
1149 rStm
.Read( &nFirstBytes
, 20 );
1151 if ( ( nFirstLong
== 0xC5D0D3C6 ) || ( aPathExt
.CompareToAscii( "eps", 3 ) == COMPARE_EQUAL
) ||
1152 ( ImplSearchEntry( nFirstBytes
, (sal_uInt8
*)"%!PS-Adobe", 10, 10 )
1153 && ImplSearchEntry( &nFirstBytes
[15], (sal_uInt8
*)"EPS", 3, 3 ) ) )
1162 /*************************************************************************
1166 \************************************************************************/
1168 BOOL
GraphicDescriptor::ImpDetectDXF( SvStream
&, BOOL
)
1170 BOOL bRet
= aPathExt
.CompareToAscii( "dxf", 3 ) == COMPARE_EQUAL
;
1177 /*************************************************************************
1181 \************************************************************************/
1183 BOOL
GraphicDescriptor::ImpDetectMET( SvStream
&, BOOL
)
1185 BOOL bRet
= aPathExt
.CompareToAscii( "met", 3 ) == COMPARE_EQUAL
;
1193 /*************************************************************************
1197 \************************************************************************/
1199 BOOL
GraphicDescriptor::ImpDetectPCT( SvStream
& rStm
, BOOL
)
1201 BOOL bRet
= aPathExt
.CompareToAscii( "pct", 3 ) == COMPARE_EQUAL
;
1208 rStm
.Seek( nStmPos
+ 522 );
1209 rStm
.Read( sBuf
, 3 );
1211 if( !rStm
.GetError() )
1213 if ( ( sBuf
[0] == 0x00 ) && ( sBuf
[1] == 0x11 ) &&
1214 ( ( sBuf
[2] == 0x01 ) || ( sBuf
[2] == 0x02 ) ) )
1226 /*************************************************************************
1230 \************************************************************************/
1232 BOOL
GraphicDescriptor::ImpDetectSGF( SvStream
& rStm
, BOOL
)
1236 if( aPathExt
.CompareToAscii( "sgf", 3 ) == COMPARE_EQUAL
)
1240 BYTE nFirst
, nSecond
;
1242 rStm
.Seek( nStmPos
);
1243 rStm
>> nFirst
>> nSecond
;
1245 if( nFirst
== 'J' && nSecond
== 'J' )
1256 /*************************************************************************
1260 \************************************************************************/
1262 BOOL
GraphicDescriptor::ImpDetectSGV( SvStream
&, BOOL
)
1264 BOOL bRet
= aPathExt
.CompareToAscii( "sgv", 3 ) == COMPARE_EQUAL
;
1272 /*************************************************************************
1276 \************************************************************************/
1278 BOOL
GraphicDescriptor::ImpDetectSVM( SvStream
& rStm
, BOOL bExtendedInfo
)
1284 rStm
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
1285 rStm
.Seek( nStmPos
);
1288 if ( n32
== 0x44475653 )
1291 if ( cByte
== 0x49 )
1296 if ( bExtendedInfo
)
1301 rStm
.SeekRel( 0x04 );
1305 aLogSize
.Width() = nTemp32
;
1309 aLogSize
.Height() = nTemp32
;
1311 // Map-Unit auslesen und PrefSize ermitteln
1313 aLogSize
= OutputDevice::LogicToLogic( aLogSize
,
1314 MapMode( (MapUnit
) nTemp16
),
1315 MapMode( MAP_100TH_MM
) );
1321 rStm
.SeekRel( -4L );
1324 if( n32
== 0x4D4C4356 )
1330 if( nTmp16
== 0x4654 )
1339 rStm
.SeekRel( 0x06 );
1342 aLogSize
= OutputDevice::LogicToLogic( aLogSize
, aMapMode
, MapMode( MAP_100TH_MM
) );
1352 /*************************************************************************
1356 \************************************************************************/
1358 BOOL
GraphicDescriptor::ImpDetectWMF( SvStream
&, BOOL
)
1360 BOOL bRet
= aPathExt
.CompareToAscii( "wmf",3 ) == COMPARE_EQUAL
;
1367 /*************************************************************************
1371 \************************************************************************/
1373 BOOL
GraphicDescriptor::ImpDetectEMF( SvStream
&, BOOL
)
1375 BOOL bRet
= aPathExt
.CompareToAscii( "emf", 3 ) == COMPARE_EQUAL
;
1382 /*************************************************************************
1386 \************************************************************************/
1388 String
GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat
)
1390 ByteString aKeyName
;
1394 case( GFF_BMP
) : aKeyName
= "bmp"; break;
1395 case( GFF_GIF
) : aKeyName
= "gif"; break;
1396 case( GFF_JPG
) : aKeyName
= "jpg"; break;
1397 case( GFF_PCD
) : aKeyName
= "pcd"; break;
1398 case( GFF_PCX
) : aKeyName
= "pcx"; break;
1399 case( GFF_PNG
) : aKeyName
= "png"; break;
1400 case( GFF_XBM
) : aKeyName
= "xbm"; break;
1401 case( GFF_XPM
) : aKeyName
= "xpm"; break;
1402 case( GFF_PBM
) : aKeyName
= "pbm"; break;
1403 case( GFF_PGM
) : aKeyName
= "pgm"; break;
1404 case( GFF_PPM
) : aKeyName
= "ppm"; break;
1405 case( GFF_RAS
) : aKeyName
= "ras"; break;
1406 case( GFF_TGA
) : aKeyName
= "tga"; break;
1407 case( GFF_PSD
) : aKeyName
= "psd"; break;
1408 case( GFF_EPS
) : aKeyName
= "eps"; break;
1409 case( GFF_TIF
) : aKeyName
= "tif"; break;
1410 case( GFF_DXF
) : aKeyName
= "dxf"; break;
1411 case( GFF_MET
) : aKeyName
= "met"; break;
1412 case( GFF_PCT
) : aKeyName
= "pct"; break;
1413 case( GFF_SGF
) : aKeyName
= "sgf"; break;
1414 case( GFF_SGV
) : aKeyName
= "sgv"; break;
1415 case( GFF_SVM
) : aKeyName
= "svm"; break;
1416 case( GFF_WMF
) : aKeyName
= "wmf"; break;
1417 case( GFF_EMF
) : aKeyName
= "emf"; break;
1420 return String( aKeyName
, RTL_TEXTENCODING_ASCII_US
);