LibreOffice Module vcl (master) 1
|
#include <GraphicFormatDetector.hxx>
Public Member Functions | |
GraphicFormatDetector (SvStream &rStream, OUString aFormatExtension, bool bExtendedInfo=false) | |
bool | detect () |
bool | checkMET () |
bool | checkBMP () |
bool | checkWMF () |
bool | checkEMF () |
bool | checkPCX () |
bool | checkTIF () |
bool | checkGIF () |
bool | checkPNG () |
bool | checkAPNG () |
bool | checkJPG () |
bool | checkSVM () |
bool | checkPCD () |
bool | checkPSD () |
bool | checkEPS () |
bool | checkDXF () |
bool | checkPCT () |
bool | checkPBM () |
bool | checkPGM () |
bool | checkPPM () |
bool | checkRAS () |
bool | checkXPM () |
bool | checkXBM () |
bool | checkSVG () |
bool | checkTGA () |
bool | checkMOV () |
bool | checkPDF () |
bool | checkWEBP () |
const GraphicMetadata & | getMetadata () |
Public Attributes | |
SvStream & | mrStream |
OUString | maExtension |
std::vector< sal_uInt8 > | maFirstBytes |
sal_uInt32 | mnFirstLong |
sal_uInt32 | mnSecondLong |
sal_uInt64 | mnStreamPosition |
sal_uInt64 | mnStreamLength |
Private Member Functions | |
sal_uInt8 * | checkAndUncompressBuffer (sal_uInt8 *aUncompressedBuffer, sal_uInt32 nSize, sal_uInt64 &nDecompressedSize) |
Checks whether mrStream needs to be uncompressed and returns a pointer to the to aUncompressedBuffer or a pointer to maFirstBytes if it doesn't need to be uncompressed. More... | |
Private Attributes | |
bool | mbExtendedInfo |
bool | mbWasCompressed |
GraphicMetadata | maMetadata |
Definition at line 144 of file GraphicFormatDetector.hxx.
vcl::GraphicFormatDetector::GraphicFormatDetector | ( | SvStream & | rStream, |
OUString | aFormatExtension, | ||
bool | bExtendedInfo = false |
||
) |
Definition at line 375 of file GraphicFormatDetector.cxx.
|
private |
Checks whether mrStream needs to be uncompressed and returns a pointer to the to aUncompressedBuffer or a pointer to maFirstBytes if it doesn't need to be uncompressed.
aUncompressedBuffer | the buffer to hold the uncompressed data |
nSize | the amount of bytes to uncompress |
nRetSize | the amount of bytes actually uncompressed |
Definition at line 1404 of file GraphicFormatDetector.cxx.
References ZCodec::BeginCompression(), ZCodec::EndCompression(), i, ZCodec::IsZCompressed(), maFirstBytes, mbWasCompressed, mnFirstLong, mnSecondLong, mnStreamPosition, mrStream, ZCodec::Read(), SvStream::Seek(), and ZCODEC_DEFAULT_COMPRESSION.
Referenced by checkEMF(), checkSVG(), and checkWMF().
bool vcl::GraphicFormatDetector::checkAPNG | ( | ) |
Definition at line 957 of file GraphicFormatDetector.cxx.
References APNG, vcl::PngImageReader::isAPng(), maMetadata, GraphicMetadata::mnFormat, mnStreamPosition, mrStream, and SvStream::Seek().
Referenced by vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkBMP | ( | ) |
Definition at line 467 of file GraphicFormatDetector.cxx.
References BMP, Size::getHeight(), Size::getWidth(), Size::Height(), maFirstBytes, GraphicMetadata::maLogSize, maMetadata, GraphicMetadata::maPixSize, GraphicMetadata::maPreferredLogSize, GraphicMetadata::maPreferredMapMode, mbExtendedInfo, GraphicMetadata::mnBitsPerPixel, GraphicMetadata::mnFormat, GraphicMetadata::mnPlanes, mnStreamPosition, mrStream, NOT, SvStream::ReadUInt16(), SvStream::ReadUInt32(), SvStream::Seek(), SvStream::SeekRel(), SvStream::SetEndian(), Size::setHeight(), Size::setWidth(), and Size::Width().
Referenced by GraphicDescriptor::ImpDetectBMP(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkDXF | ( | ) |
Definition at line 1137 of file GraphicFormatDetector.cxx.
References DXF, i, maFirstBytes, maMetadata, and GraphicMetadata::mnFormat.
Referenced by GraphicDescriptor::ImpDetectDXF(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkEMF | ( | ) |
Definition at line 587 of file GraphicFormatDetector.cxx.
References checkAndUncompressBuffer(), EMF, EMZ, GraphicMetadata::maLogSize, maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, mbWasCompressed, mnFirstLong, GraphicMetadata::mnFormat, mnStreamLength, Size::setHeight(), Size::setWidth(), and WMF_EMF_CHECK_SIZE.
Referenced by GraphicDescriptor::ImpDetectEMF(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkEPS | ( | ) |
Definition at line 1119 of file GraphicFormatDetector.cxx.
References vcl::checkArrayForMatchingStrings(), EPS, maFirstBytes, maMetadata, mnFirstLong, and GraphicMetadata::mnFormat.
Referenced by GraphicDescriptor::ImpDetectEPS(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkGIF | ( | ) |
Definition at line 831 of file GraphicFormatDetector.cxx.
References GIF, maFirstBytes, maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, GraphicMetadata::mnBitsPerPixel, mnFirstLong, and GraphicMetadata::mnFormat.
Referenced by GraphicDescriptor::ImpDetectGIF(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkJPG | ( | ) |
Definition at line 968 of file GraphicFormatDetector.cxx.
References JPG, maFirstBytes, maMetadata, mnFirstLong, and GraphicMetadata::mnFormat.
Referenced by vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkMET | ( | ) |
Definition at line 436 of file GraphicFormatDetector.cxx.
References SvStream::GetError(), i, maFirstBytes, maMetadata, MET, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, nMagic, SvStream::ReadUChar(), SvStream::ReadUInt16(), SvStream::Seek(), SvStream::SeekRel(), SvStream::SetEndian(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectMET(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkMOV | ( | ) |
Definition at line 1359 of file GraphicFormatDetector.cxx.
References maFirstBytes, maMetadata, GraphicMetadata::mnFormat, and MOV.
Referenced by vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPBM | ( | ) |
Definition at line 1185 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::mnFormat, mrStream, PBM, SvStream::ReadUChar(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectPBM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPCD | ( | ) |
Definition at line 1055 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, PCD, SvStream::ReadBytes(), and SvStream::Seek().
Referenced by GraphicDescriptor::ImpDetectPCD(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPCT | ( | ) |
Definition at line 1174 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, and PCT.
Referenced by GraphicDescriptor::ImpDetectPCT(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPCX | ( | ) |
Definition at line 634 of file GraphicFormatDetector.cxx.
References aMap, OutputDevice::LogicToLogic(), GraphicMetadata::maLogSize, maMetadata, GraphicMetadata::maPixSize, GraphicMetadata::mnBitsPerPixel, GraphicMetadata::mnFormat, GraphicMetadata::mnPlanes, mrStream, PCX, SvStream::ReadUChar(), SvStream::ReadUInt16(), SvStream::SeekRel(), SvStream::SetEndian(), Size::setHeight(), Size::setWidth(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectPCX(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPDF | ( | ) |
Definition at line 1372 of file GraphicFormatDetector.cxx.
References maFirstBytes, maMetadata, GraphicMetadata::mnFormat, and PDF.
Referenced by vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPGM | ( | ) |
Definition at line 1198 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::mnFormat, mrStream, PGM, SvStream::ReadUChar(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectPGM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPNG | ( | ) |
Definition at line 849 of file GraphicFormatDetector.cxx.
References SvStream::good(), Size::Height(), GraphicMetadata::maLogSize, maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, GraphicMetadata::mbIsAlpha, GraphicMetadata::mbIsTransparent, GraphicMetadata::mnBitsPerPixel, mnFirstLong, GraphicMetadata::mnFormat, GraphicMetadata::mnPlanes, mnSecondLong, mnStreamPosition, mrStream, PNG, PNG_IDAT_SIGNATURE, PNG_PHYS_SIGNATURE, PNG_SIGNATURE, PNG_SIGNATURE_SIZE, PNG_TRNS_SIGNATURE, SvStream::ReadUChar(), SvStream::ReadUInt32(), SvStream::Seek(), SvStream::SeekRel(), Size::setHeight(), Size::setWidth(), and Size::Width().
Referenced by GraphicDescriptor::ImpDetectPNG(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPPM | ( | ) |
Definition at line 1211 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::mnFormat, mrStream, PPM, SvStream::ReadUChar(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectPPM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkPSD | ( | ) |
Definition at line 1072 of file GraphicFormatDetector.cxx.
References maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, GraphicMetadata::mnBitsPerPixel, mnFirstLong, GraphicMetadata::mnFormat, mnSecondLong, mnStreamPosition, mrStream, PSD, SvStream::ReadUInt16(), SvStream::ReadUInt32(), SvStream::Seek(), SvStream::SeekRel(), Size::setHeight(), and Size::setWidth().
Referenced by GraphicDescriptor::ImpDetectPSD(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkRAS | ( | ) |
Definition at line 1224 of file GraphicFormatDetector.cxx.
References maMetadata, mnFirstLong, GraphicMetadata::mnFormat, and RAS.
Referenced by GraphicDescriptor::ImpDetectRAS(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkSVG | ( | ) |
Definition at line 1264 of file GraphicFormatDetector.cxx.
References checkAndUncompressBuffer(), vcl::checkArrayForMatchingStrings(), maMetadata, mbWasCompressed, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, SvStream::ReadBytes(), SvStream::Seek(), SVG, SVG_CHECK_SIZE, and SVGZ.
Referenced by GraphicDescriptor::ImpDetectSVG(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkSVM | ( | ) |
Definition at line 980 of file GraphicFormatDetector.cxx.
References OutputDevice::LogicToLogic(), GraphicMetadata::maLogSize, maMetadata, mbExtendedInfo, GraphicMetadata::mnFormat, mrStream, TypeSerializer::readMapMode(), tools::GenericTypeSerializer::readSize(), SvStream::ReadUChar(), SvStream::ReadUInt16(), SvStream::ReadUInt32(), SvStream::SeekRel(), SvStream::SetEndian(), Size::setHeight(), Size::setWidth(), SVM, and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectSVM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkTGA | ( | ) |
Definition at line 1332 of file GraphicFormatDetector.cxx.
References maExtension, maMetadata, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, SvStream::ReadBytes(), SAL_N_ELEMENTS, SvStream::Seek(), SvStream::SeekRel(), STREAM_SEEK_TO_END, and TGA.
Referenced by GraphicDescriptor::ImpDetectTGA(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkTIF | ( | ) |
Definition at line 702 of file GraphicFormatDetector.cxx.
References DATA_SIZE, maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, GraphicMetadata::mnBitsPerPixel, GraphicMetadata::mnFormat, mnStreamPosition, mrStream, nCount, SvStream::ReadUChar(), SvStream::ReadUInt16(), SvStream::ReadUInt32(), SvStream::Seek(), SvStream::SeekRel(), SvStream::SetEndian(), Size::setHeight(), Size::setWidth(), SvStream::Tell(), and TIF.
Referenced by GraphicDescriptor::ImpDetectTIF(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkWEBP | ( | ) |
Definition at line 1383 of file GraphicFormatDetector.cxx.
References maFirstBytes, maMetadata, GraphicMetadata::maPixSize, mbExtendedInfo, GraphicMetadata::mbIsAlpha, GraphicMetadata::mbIsTransparent, GraphicMetadata::mnBitsPerPixel, GraphicMetadata::mnFormat, mnStreamPosition, mrStream, ReadWebpInfo(), SvStream::Seek(), and WEBP.
Referenced by GraphicDescriptor::ImpDetectWEBP(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkWMF | ( | ) |
Definition at line 568 of file GraphicFormatDetector.cxx.
References checkAndUncompressBuffer(), maMetadata, mbWasCompressed, mnFirstLong, GraphicMetadata::mnFormat, mnStreamLength, WMF, WMF_EMF_CHECK_SIZE, and WMZ.
Referenced by GraphicDescriptor::ImpDetectWMF(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkXBM | ( | ) |
Definition at line 1245 of file GraphicFormatDetector.cxx.
References vcl::checkArrayForMatchingStrings(), maMetadata, GraphicMetadata::mnFormat, mnStreamLength, mnStreamPosition, mrStream, SvStream::ReadBytes(), SvStream::Seek(), and XBM.
Referenced by GraphicDescriptor::ImpDetectXBM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::checkXPM | ( | ) |
Definition at line 1234 of file GraphicFormatDetector.cxx.
References maFirstBytes, maMetadata, vcl::matchArrayWithString(), GraphicMetadata::mnFormat, and XPM.
Referenced by GraphicDescriptor::ImpDetectXPM(), and vcl::peekGraphicFormat().
bool vcl::GraphicFormatDetector::detect | ( | ) |
Definition at line 389 of file GraphicFormatDetector.cxx.
References SvStream::GetError(), SvStream::GetLockBytes(), i, maFirstBytes, mnFirstLong, mnSecondLong, mnStreamLength, mnStreamPosition, mrStream, SvStream::ReadBytes(), SvStream::remainingSize(), SvLockBytes::SetSynchronMode(), and SvStream::Tell().
Referenced by GraphicDescriptor::ImpDetectBMP(), GraphicDescriptor::ImpDetectDXF(), GraphicDescriptor::ImpDetectEMF(), GraphicDescriptor::ImpDetectEPS(), GraphicDescriptor::ImpDetectGIF(), GraphicDescriptor::ImpDetectMET(), GraphicDescriptor::ImpDetectPBM(), GraphicDescriptor::ImpDetectPCD(), GraphicDescriptor::ImpDetectPCT(), GraphicDescriptor::ImpDetectPCX(), GraphicDescriptor::ImpDetectPGM(), GraphicDescriptor::ImpDetectPNG(), GraphicDescriptor::ImpDetectPPM(), GraphicDescriptor::ImpDetectPSD(), GraphicDescriptor::ImpDetectRAS(), GraphicDescriptor::ImpDetectSVG(), GraphicDescriptor::ImpDetectSVM(), GraphicDescriptor::ImpDetectTGA(), GraphicDescriptor::ImpDetectTIF(), GraphicDescriptor::ImpDetectWEBP(), GraphicDescriptor::ImpDetectWMF(), GraphicDescriptor::ImpDetectXBM(), GraphicDescriptor::ImpDetectXPM(), and vcl::peekGraphicFormat().
const GraphicMetadata & vcl::GraphicFormatDetector::getMetadata | ( | ) |
Definition at line 1402 of file GraphicFormatDetector.cxx.
References maMetadata.
Referenced by GraphicDescriptor::ImpDetectBMP(), GraphicDescriptor::ImpDetectDXF(), GraphicDescriptor::ImpDetectEMF(), GraphicDescriptor::ImpDetectEPS(), GraphicDescriptor::ImpDetectGIF(), GraphicDescriptor::ImpDetectMET(), GraphicDescriptor::ImpDetectPBM(), GraphicDescriptor::ImpDetectPCD(), GraphicDescriptor::ImpDetectPCT(), GraphicDescriptor::ImpDetectPCX(), GraphicDescriptor::ImpDetectPGM(), GraphicDescriptor::ImpDetectPNG(), GraphicDescriptor::ImpDetectPPM(), GraphicDescriptor::ImpDetectPSD(), GraphicDescriptor::ImpDetectRAS(), GraphicDescriptor::ImpDetectSVG(), GraphicDescriptor::ImpDetectSVM(), GraphicDescriptor::ImpDetectTGA(), GraphicDescriptor::ImpDetectTIF(), GraphicDescriptor::ImpDetectWEBP(), GraphicDescriptor::ImpDetectWMF(), GraphicDescriptor::ImpDetectXBM(), GraphicDescriptor::ImpDetectXPM(), and vcl::peekGraphicFormat().
OUString vcl::GraphicFormatDetector::maExtension |
Definition at line 148 of file GraphicFormatDetector.hxx.
Referenced by checkTGA().
std::vector<sal_uInt8> vcl::GraphicFormatDetector::maFirstBytes |
Definition at line 150 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkBMP(), checkDXF(), checkEPS(), checkGIF(), checkJPG(), checkMET(), checkMOV(), checkPDF(), checkWEBP(), checkXPM(), and detect().
|
private |
Definition at line 204 of file GraphicFormatDetector.hxx.
Referenced by checkAPNG(), checkBMP(), checkDXF(), checkEMF(), checkEPS(), checkGIF(), checkJPG(), checkMET(), checkMOV(), checkPBM(), checkPCD(), checkPCT(), checkPCX(), checkPDF(), checkPGM(), checkPNG(), checkPPM(), checkPSD(), checkRAS(), checkSVG(), checkSVM(), checkTGA(), checkTIF(), checkWEBP(), checkWMF(), checkXBM(), checkXPM(), and getMetadata().
|
private |
Definition at line 202 of file GraphicFormatDetector.hxx.
Referenced by checkBMP(), checkEMF(), checkGIF(), checkPNG(), checkPSD(), checkSVM(), checkTIF(), and checkWEBP().
|
private |
Definition at line 203 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkEMF(), checkSVG(), and checkWMF().
sal_uInt32 vcl::GraphicFormatDetector::mnFirstLong |
Definition at line 151 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkEMF(), checkEPS(), checkGIF(), checkJPG(), checkPNG(), checkPSD(), checkRAS(), checkWMF(), and detect().
sal_uInt32 vcl::GraphicFormatDetector::mnSecondLong |
Definition at line 152 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkPNG(), checkPSD(), and detect().
sal_uInt64 vcl::GraphicFormatDetector::mnStreamLength |
Definition at line 155 of file GraphicFormatDetector.hxx.
Referenced by checkEMF(), checkMET(), checkPCD(), checkPCT(), checkSVG(), checkTGA(), checkWMF(), checkXBM(), and detect().
sal_uInt64 vcl::GraphicFormatDetector::mnStreamPosition |
Definition at line 154 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkAPNG(), checkBMP(), checkMET(), checkPCD(), checkPCT(), checkPNG(), checkPSD(), checkSVG(), checkTGA(), checkTIF(), checkWEBP(), checkXBM(), and detect().
SvStream& vcl::GraphicFormatDetector::mrStream |
Definition at line 147 of file GraphicFormatDetector.hxx.
Referenced by checkAndUncompressBuffer(), checkAPNG(), checkBMP(), checkMET(), checkPBM(), checkPCD(), checkPCT(), checkPCX(), checkPGM(), checkPNG(), checkPPM(), checkPSD(), checkSVG(), checkSVM(), checkTGA(), checkTIF(), checkWEBP(), checkXBM(), and detect().