LibreOffice Module vcl (master)  1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GraphicFilter Class Reference

Class to import and export graphic formats. More...

#include <graphicfilter.hxx>

Collaboration diagram for GraphicFilter:
[legend]

Public Member Functions

 GraphicFilter (bool bUseConfig=true)
 
 ~GraphicFilter ()
 
sal_uInt16 GetImportFormatCount ()
 
sal_uInt16 GetImportFormatNumber (const OUString &rFormatName)
 
sal_uInt16 GetImportFormatNumberForShortName (const OUString &rShortName)
 
sal_uInt16 GetImportFormatNumberForTypeName (const OUString &rType)
 
OUString GetImportFormatName (sal_uInt16 nFormat)
 
OUString GetImportFormatTypeName (sal_uInt16 nFormat)
 
OUString GetImportFormatShortName (sal_uInt16 nFormat)
 
OUString GetImportWildcard (sal_uInt16 nFormat, sal_Int32 nEntry)
 
sal_uInt16 GetExportFormatCount ()
 
sal_uInt16 GetExportFormatNumber (const OUString &rFormatName)
 
sal_uInt16 GetExportFormatNumberForMediaType (const OUString &rShortName)
 
sal_uInt16 GetExportFormatNumberForShortName (const OUString &rShortName)
 
OUString GetExportInternalFilterName (sal_uInt16 nFormat)
 
sal_uInt16 GetExportFormatNumberForTypeName (const OUString &rType)
 
OUString GetExportFormatName (sal_uInt16 nFormat)
 
OUString GetExportFormatMediaType (sal_uInt16 nFormat)
 
OUString GetExportFormatShortName (sal_uInt16 nFormat)
 
OUString GetExportWildcard (sal_uInt16 nFormat)
 
bool IsExportPixelFormat (sal_uInt16 nFormat)
 
ErrCode ExportGraphic (const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
 
ErrCode ExportGraphic (const Graphic &rGraphic, const OUString &rPath, SvStream &rOStm, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
 
ErrCode CanImportGraphic (const INetURLObject &rPath, sal_uInt16 nFormat, sal_uInt16 *pDeterminedFormat)
 
ErrCode ImportGraphic (Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
 
ErrCode CanImportGraphic (const OUString &rPath, SvStream &rStream, sal_uInt16 nFormat, sal_uInt16 *pDeterminedFormat)
 
ErrCode ImportGraphic (Graphic &rGraphic, const OUString &rPath, SvStream &rStream, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE, WmfExternal const *pExtHeader=nullptr)
 
void ImportGraphics (std::vector< std::shared_ptr< Graphic > > &rGraphics, std::vector< std::unique_ptr< SvStream > > vStreams)
 Imports multiple graphics. More...
 
ErrCode ImportGraphic (Graphic &rGraphic, const OUString &rPath, SvStream &rStream, sal_uInt16 nFormat, sal_uInt16 *pDeterminedFormat, GraphicFilterImportFlags nImportFlags, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData, WmfExternal const *pExtHeader=nullptr)
 
Graphic ImportUnloadedGraphic (SvStream &rIStream, sal_uInt64 sizeLimit=0, Size *pSizeHint=nullptr)
 
const FilterErrorExGetLastError () const
 
void ResetLastError ()
 
const Link< ConvertData &, bool > GetFilterCallback () const
 
ErrCode compressAsPNG (const Graphic &rGraphic, SvStream &rOutputStream)
 
void preload ()
 

Static Public Member Functions

static GraphicFilterGetGraphicFilter ()
 
static ErrCode LoadGraphic (const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
 

Private Member Functions

void ImplInit ()
 
ErrCode ImplSetError (ErrCode nError, const SvStream *pStm=nullptr)
 
ErrCode ImpTestOrFindFormat (const OUString &rPath, SvStream &rStream, sal_uInt16 &rFormat)
 
 DECL_LINK (FilterCallback, ConvertData &, bool)
 

Private Attributes

OUString aFilterPath
 
FilterConfigCachepConfig
 
std::unique_ptr< FilterErrorExpErrorEx
 
bool const bUseConfig
 

Detailed Description

Class to import and export graphic formats.

Definition at line 230 of file graphicfilter.hxx.

Constructor & Destructor Documentation

GraphicFilter::GraphicFilter ( bool  bUseConfig = true)

Definition at line 815 of file graphicfilter.cxx.

References ImplInit().

GraphicFilter::~GraphicFilter ( )

Definition at line 821 of file graphicfilter.cxx.

References getListMutex(), pConfig, pErrorEx, and pFilterHdlList.

Member Function Documentation

ErrCode GraphicFilter::CanImportGraphic ( const INetURLObject rPath,
sal_uInt16  nFormat,
sal_uInt16 *  pDeterminedFormat 
)
ErrCode GraphicFilter::CanImportGraphic ( const OUString &  rPath,
SvStream rStream,
sal_uInt16  nFormat,
sal_uInt16 *  pDeterminedFormat 
)
ErrCode GraphicFilter::compressAsPNG ( const Graphic rGraphic,
SvStream rOutputStream 
)

Definition at line 2364 of file graphicfilter.cxx.

References ExportGraphic(), and GetExportFormatNumberForShortName().

GraphicFilter::DECL_LINK ( FilterCallback  ,
ConvertData ,
bool   
)
private
ErrCode GraphicFilter::ExportGraphic ( const Graphic rGraphic,
const INetURLObject rPath,
sal_uInt16  nFormat,
const css::uno::Sequence< css::beans::PropertyValue > *  pFilterData = nullptr 
)
ErrCode GraphicFilter::ExportGraphic ( const Graphic rGraphic,
const OUString &  rPath,
SvStream rOStm,
sal_uInt16  nFormat,
const css::uno::Sequence< css::beans::PropertyValue > *  pFilterData = nullptr 
)

Definition at line 1890 of file graphicfilter.cxx.

References vcl::PNGWriter::ChunkData::aData, aFilterPath, Bitmap, ConvertGDIMetaFileToEMF(), ConvertGDIMetaFileToWMF(), Graphic::Draw(), egiGraphicExport(), Emf, epsGraphicExport(), ERRCODE_GRFILTER_FILTERERROR, ERRCODE_GRFILTER_FORMATERROR, ERRCODE_GRFILTER_IOERROR, ERRCODE_NONE, etiGraphicExport(), eType, EXP_BMP, EXP_EMF, EXP_JPEG, EXP_PNG, EXP_SVG, EXP_SVMETAFILE, EXP_WMF, ExportJPEG(), VclPtr< reference_type >::get(), Graphic::GetBitmapEx(), vcl::PNGWriter::GetChunks(), SvMemoryStream::GetData(), SvStream::GetError(), FilterConfigCache::GetExportFilterName(), GetExportFormatCount(), FilterConfigCache::GetExportFormatExtension(), FilterConfigCache::GetExternalFilterName(), INetURLObject::GetFileExtension(), FilterConfigItem::GetFilterData(), Graphic::GetGDIMetaFile(), Graphic::GetPrefMapMode(), Graphic::GetPrefSize(), comphelper::getProcessComponentContext(), Graphic::GetType(), Graphic::getVectorGraphicData(), GRFILTER_FORMAT_DONTKNOW, Size::Height(), i, ImpCreateFullFilterPath(), ImpGetScaledGraphic(), ImplSetError(), FilterConfigCache::IsExportInternalFilter(), FilterConfigCache::IsExportPixelFormat(), MapMode, N24Bit, NNONE, vcl::PNGWriter::ChunkData::nType, NULL, pConfig, FilterConfigItem::ReadBool(), FilterConfigItem::ReadInt32(), ResetLastError(), SAL_INFO, Size::setHeight(), SvStream::SetVersion(), Size::setWidth(), Svg, SvStream::Tell(), Size::Width(), Wmf, Write, GDIMetaFile::Write(), SvStream::WriteBytes(), and WriteDIB().

sal_uInt16 GraphicFilter::GetExportFormatCount ( )

Definition at line 919 of file graphicfilter.cxx.

References FilterConfigCache::GetExportFormatCount(), and pConfig.

Referenced by ExportGraphic().

OUString GraphicFilter::GetExportFormatMediaType ( sal_uInt16  nFormat)

Definition at line 954 of file graphicfilter.cxx.

References FilterConfigCache::GetExportFormatMediaType(), and pConfig.

OUString GraphicFilter::GetExportFormatName ( sal_uInt16  nFormat)

Definition at line 949 of file graphicfilter.cxx.

References FilterConfigCache::GetExportFormatName(), and pConfig.

sal_uInt16 GraphicFilter::GetExportFormatNumber ( const OUString &  rFormatName)

Definition at line 924 of file graphicfilter.cxx.

References FilterConfigCache::GetExportFormatNumber(), and pConfig.

sal_uInt16 GraphicFilter::GetExportFormatNumberForMediaType ( const OUString &  rShortName)
sal_uInt16 GraphicFilter::GetExportFormatNumberForShortName ( const OUString &  rShortName)
sal_uInt16 GraphicFilter::GetExportFormatNumberForTypeName ( const OUString &  rType)
OUString GraphicFilter::GetExportFormatShortName ( sal_uInt16  nFormat)

Definition at line 959 of file graphicfilter.cxx.

References FilterConfigCache::GetExportFormatShortName(), and pConfig.

OUString GraphicFilter::GetExportInternalFilterName ( sal_uInt16  nFormat)

Definition at line 939 of file graphicfilter.cxx.

References FilterConfigCache::GetExportInternalFilterName(), and pConfig.

OUString GraphicFilter::GetExportWildcard ( sal_uInt16  nFormat)

Definition at line 964 of file graphicfilter.cxx.

References FilterConfigCache::GetExportWildcard(), and pConfig.

const Link< ConvertData &, bool > GraphicFilter::GetFilterCallback ( ) const

Definition at line 2239 of file graphicfilter.cxx.

References LINK.

GraphicFilter & GraphicFilter::GetGraphicFilter ( )
static
sal_uInt16 GraphicFilter::GetImportFormatCount ( )

Definition at line 872 of file graphicfilter.cxx.

References FilterConfigCache::GetImportFormatCount(), and pConfig.

Referenced by LoadGraphic().

OUString GraphicFilter::GetImportFormatName ( sal_uInt16  nFormat)

Definition at line 892 of file graphicfilter.cxx.

References FilterConfigCache::GetImportFormatName(), and pConfig.

sal_uInt16 GraphicFilter::GetImportFormatNumber ( const OUString &  rFormatName)

Definition at line 877 of file graphicfilter.cxx.

References FilterConfigCache::GetImportFormatNumber(), and pConfig.

Referenced by LoadGraphic().

sal_uInt16 GraphicFilter::GetImportFormatNumberForShortName ( const OUString &  rShortName)
sal_uInt16 GraphicFilter::GetImportFormatNumberForTypeName ( const OUString &  rType)
OUString GraphicFilter::GetImportFormatShortName ( sal_uInt16  nFormat)
OUString GraphicFilter::GetImportFormatTypeName ( sal_uInt16  nFormat)

Definition at line 897 of file graphicfilter.cxx.

References FilterConfigCache::GetImportFilterTypeName(), and pConfig.

OUString GraphicFilter::GetImportWildcard ( sal_uInt16  nFormat,
sal_Int32  nEntry 
)

Definition at line 914 of file graphicfilter.cxx.

References FilterConfigCache::GetImportWildcard(), and pConfig.

const FilterErrorEx& GraphicFilter::GetLastError ( ) const
inline

Definition at line 300 of file graphicfilter.hxx.

void GraphicFilter::ImplInit ( )
private

Definition at line 840 of file graphicfilter.cxx.

References aFilterPath, bUseConfig, getListMutex(), pConfig, pErrorEx, and pFilterHdlList.

Referenced by GraphicFilter().

ErrCode GraphicFilter::ImplSetError ( ErrCode  nError,
const SvStream pStm = nullptr 
)
private
ErrCode GraphicFilter::ImportGraphic ( Graphic rGraphic,
const INetURLObject rPath,
sal_uInt16  nFormat = GRFILTER_FORMAT_DONTKNOW,
sal_uInt16 *  pDeterminedFormat = nullptr,
GraphicFilterImportFlags  nImportFlags = GraphicFilterImportFlags::NONE 
)
ErrCode GraphicFilter::ImportGraphic ( Graphic rGraphic,
const OUString &  rPath,
SvStream rStream,
sal_uInt16  nFormat = GRFILTER_FORMAT_DONTKNOW,
sal_uInt16 *  pDeterminedFormat = nullptr,
GraphicFilterImportFlags  nImportFlags = GraphicFilterImportFlags::NONE,
WmfExternal const *  pExtHeader = nullptr 
)

Definition at line 1019 of file graphicfilter.cxx.

References ImportGraphic().

ErrCode GraphicFilter::ImportGraphic ( Graphic rGraphic,
const OUString &  rPath,
SvStream rStream,
sal_uInt16  nFormat,
sal_uInt16 *  pDeterminedFormat,
GraphicFilterImportFlags  nImportFlags,
const css::uno::Sequence< css::beans::PropertyValue > *  pFilterData,
WmfExternal const *  pExtHeader = nullptr 
)

Definition at line 1441 of file graphicfilter.cxx.

References aFilterPath, ZCodec::BeginCompression(), Graphic::Clear(), ZCodec::Decompress(), DontSetLogsizeForJpeg, Emf, ZCodec::EndCompression(), ERRCODE_GRFILTER_FILTERERROR, ERRCODE_GRFILTER_FORMATERROR, ERRCODE_GRFILTER_OPENERROR, ERRCODE_GRFILTER_TOOBIG, ERRCODE_IO_PENDING, ERRCODE_NONE, ForPreview, Graphic::GetBitmapExRef(), BitmapEx::GetBitmapRef(), vcl::PNGReader::GetChunks(), Graphic::GetContext(), SvStream::GetError(), FilterConfigCache::GetExternalFilterName(), ImpFilterLibCache::GetFilter(), FilterConfigCache::GetImportFilterName(), GetImportFormatShortName(), ImpFilterLibCacheEntry::GetImportFunction(), GRFILTER_FORMAT_DONTKNOW, Size::Height(), IMP_BMP, IMP_EMF, IMP_GIF, IMP_JPEG, IMP_MOV, IMP_PDF, IMP_PNG, IMP_SVG, IMP_SVMETAFILE, IMP_WMF, IMP_XBM, IMP_XPM, ImplSetError(), ImportGIF(), ImportJPEG(), vcl::ImportPDF(), ImportXBM(), ImportXPM(), ImpTestOrFindFormat(), Graphic::IsDummyContext(), utl::ConfigManager::IsFuzzing(), Graphic::IsGfxLink(), FilterConfigCache::IsImportInternalFilter(), MET_SHORTNAME, NativeBmp, NativeGif, NativeJpg, NativeMet, NativeMov, NativePct, NativePdf, NativePng, NativeSvg, NativeTif, NativeWmf, NONE, OnlyCreateBitmap, pConfig, PCT_SHORTNAME, PMGCHUNG_msOG, vcl::PNGReader::Read(), SvStream::ReadBytes(), ReadGraphic(), SvStream::remainingSize(), SvStream::ResetError(), ResetLastError(), SvStream::Seek(), Graphic::SetDefaultType(), Graphic::SetDummyContext(), Graphic::SetGfxLink(), SetLogsizeForJpeg, STREAM_SEEK_TO_BEGIN, STREAM_SEEK_TO_END, Svg, SvStream::Tell(), TIF_SHORTNAME, UseExistingBitmap, Size::Width(), Wmf, and ZCODEC_DEFAULT_COMPRESSION.

void GraphicFilter::ImportGraphics ( std::vector< std::shared_ptr< Graphic > > &  rGraphics,
std::vector< std::unique_ptr< SvStream > >  vStreams 
)
Graphic GraphicFilter::ImportUnloadedGraphic ( SvStream rIStream,
sal_uInt64  sizeLimit = 0,
Size pSizeHint = nullptr 
)
ErrCode GraphicFilter::ImpTestOrFindFormat ( const OUString &  rPath,
SvStream rStream,
sal_uInt16 &  rFormat 
)
private
bool GraphicFilter::IsExportPixelFormat ( sal_uInt16  nFormat)

Definition at line 969 of file graphicfilter.cxx.

References FilterConfigCache::IsExportPixelFormat(), and pConfig.

ErrCode GraphicFilter::LoadGraphic ( const OUString &  rPath,
const OUString &  rFilter,
Graphic rGraphic,
GraphicFilter pFilter = nullptr,
sal_uInt16 *  pDeterminedFormat = nullptr 
)
static
void GraphicFilter::preload ( )
void GraphicFilter::ResetLastError ( )

Definition at line 2234 of file graphicfilter.cxx.

References ERRCODE_NONE, and pErrorEx.

Referenced by ExportGraphic(), ImportGraphic(), ImportGraphics(), and ImportUnloadedGraphic().

Member Data Documentation

OUString GraphicFilter::aFilterPath
private
bool const GraphicFilter::bUseConfig
private

Definition at line 325 of file graphicfilter.hxx.

Referenced by ImplInit().

FilterConfigCache* GraphicFilter::pConfig
private
std::unique_ptr<FilterErrorEx> GraphicFilter::pErrorEx
private

Definition at line 324 of file graphicfilter.hxx.

Referenced by ImplInit(), ImplSetError(), ResetLastError(), and ~GraphicFilter().


The documentation for this class was generated from the following files: