Convert GfxLinkType to scoped enum

Change-Id: Iae074ef0927a55f1fbf401cb66f4f183213f547c
Reviewed-on: https://gerrit.libreoffice.org/25656
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-30 10:24:32 +02:00 committed by Noel Grandin
parent 0b23eec200
commit fe6ac2d11a
21 changed files with 133 additions and 134 deletions

View File

@ -730,7 +730,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
aGraphic);
}
GfxLink aGfxLink( pBuf.get(), nPSSize, GFX_LINK_TYPE_EPS_BUFFER ) ;
GfxLink aGfxLink( pBuf.get(), nPSSize, GfxLinkType::EpsBuffer ) ;
pBuf.release();
aMtf.AddAction( static_cast<MetaAction*>( new MetaEPSAction( Point(), Size( nWidth, nHeight ),
aGfxLink, aGraphic.GetGDIMetaFile() ) ) );

View File

@ -4251,8 +4251,8 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
{
switch ( aGraphicLink.GetType() )
{
case GFX_LINK_TYPE_NATIVE_JPG : p_EscherBlibEntry->meBlibType = PEG; break;
case GFX_LINK_TYPE_NATIVE_PNG : p_EscherBlibEntry->meBlibType = PNG; break;
case GfxLinkType::NativeJpg : p_EscherBlibEntry->meBlibType = PEG; break;
case GfxLinkType::NativePng : p_EscherBlibEntry->meBlibType = PNG; break;
// #i15508# added BMP type for better exports; need to check this
// checked - does not work that way, so keep out for now. It may
@ -4260,9 +4260,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
// carefully
// for more comments please check RtfAttributeOutput::FlyFrameGraphic
//
// case GFX_LINK_TYPE_NATIVE_BMP : p_EscherBlibEntry->meBlibType = DIB; break;
// case GfxLinkType::NativeBmp : p_EscherBlibEntry->meBlibType = DIB; break;
case GFX_LINK_TYPE_NATIVE_WMF :
case GfxLinkType::NativeWmf :
{
if ( pGraphicAry && ( p_EscherBlibEntry->mnSize > 0x2c ) )
{

View File

@ -75,26 +75,25 @@ struct ImpGfxLink
//#endif // __PRIVATE
enum GfxLinkType
enum class GfxLinkType
{
GFX_LINK_TYPE_NONE = 0,
GFX_LINK_TYPE_EPS_BUFFER = 1,
GFX_LINK_TYPE_NATIVE_GIF = 2, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_JPG = 3, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_PNG = 4, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_TIF = 5, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_WMF = 6, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_MET = 7, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_PCT = 8, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_SVG = 9, // Don't forget to update the following defines
GFX_LINK_TYPE_NATIVE_MOV = 10, // Don't forget to update the following defines
NONE = 0,
EpsBuffer = 1,
NativeGif = 2, // Don't forget to update the following defines
NativeJpg = 3, // Don't forget to update the following defines
NativePng = 4, // Don't forget to update the following defines
NativeTif = 5, // Don't forget to update the following defines
NativeWmf = 6, // Don't forget to update the following defines
NativeMet = 7, // Don't forget to update the following defines
NativePct = 8, // Don't forget to update the following defines
NativeSvg = 9, // Don't forget to update the following defines
NativeMov = 10, // Don't forget to update the following defines
// #i15508# added BMP type support
GFX_LINK_TYPE_NATIVE_BMP = 11, // Don't forget to update the following defines
GFX_LINK_TYPE_USER = 0xffff
NativeBmp = 11 // Don't forget to update the following defines
};
#define GFX_LINK_FIRST_NATIVE_ID GFX_LINK_TYPE_NATIVE_GIF
#define GFX_LINK_LAST_NATIVE_ID GFX_LINK_TYPE_NATIVE_BMP
#define GFX_LINK_FIRST_NATIVE_ID GfxLinkType::NativeGif
#define GFX_LINK_LAST_NATIVE_ID GfxLinkType::NativeBmp
struct ImpBuffer;

View File

@ -841,43 +841,43 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
switch ( aLink.GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF:
case GfxLinkType::NativeGif:
sMediaType = "image/gif";
pExtension = ".gif";
break;
// #i15508# added BMP type for better exports
// export not yet active, so adding for reference (not checked)
case GFX_LINK_TYPE_NATIVE_BMP:
case GfxLinkType::NativeBmp:
sMediaType = "image/bmp";
pExtension = ".bmp";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
case GfxLinkType::NativeJpg:
sMediaType = "image/jpeg";
pExtension = ".jpeg";
break;
case GFX_LINK_TYPE_NATIVE_PNG:
case GfxLinkType::NativePng:
sMediaType = "image/png";
pExtension = ".png";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
case GfxLinkType::NativeTif:
sMediaType = "image/tiff";
pExtension = ".tif";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
case GfxLinkType::NativeWmf:
sMediaType = "image/x-wmf";
pExtension = ".wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
case GfxLinkType::NativeMet:
sMediaType = "image/x-met";
pExtension = ".met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
case GfxLinkType::NativePct:
sMediaType = "image/x-pict";
pExtension = ".pct";
break;
case GFX_LINK_TYPE_NATIVE_MOV:
case GfxLinkType::NativeMov:
sMediaType = "application/movie";
pExtension = ".MOV";
break;

View File

@ -324,19 +324,19 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry**
switch( mpGraphic->GetLink().GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF: pMimeType = MIMETYPE_GIF; break;
case GfxLinkType::NativeGif: pMimeType = MIMETYPE_GIF; break;
// #i15508# added BMP type for better exports (checked, works)
case GFX_LINK_TYPE_NATIVE_BMP: pMimeType = MIMETYPE_BMP; break;
case GfxLinkType::NativeBmp: pMimeType = MIMETYPE_BMP; break;
case GFX_LINK_TYPE_NATIVE_JPG: pMimeType = MIMETYPE_JPG; break;
case GFX_LINK_TYPE_NATIVE_PNG: pMimeType = MIMETYPE_PNG; break;
case GFX_LINK_TYPE_NATIVE_WMF: pMimeType = MIMETYPE_WMF; break;
case GFX_LINK_TYPE_NATIVE_MET: pMimeType = MIMETYPE_MET; break;
case GFX_LINK_TYPE_NATIVE_PCT: pMimeType = MIMETYPE_PCT; break;
case GfxLinkType::NativeJpg: pMimeType = MIMETYPE_JPG; break;
case GfxLinkType::NativePng: pMimeType = MIMETYPE_PNG; break;
case GfxLinkType::NativeWmf: pMimeType = MIMETYPE_WMF; break;
case GfxLinkType::NativeMet: pMimeType = MIMETYPE_MET; break;
case GfxLinkType::NativePct: pMimeType = MIMETYPE_PCT; break;
// added Svg mimetype support
case GFX_LINK_TYPE_NATIVE_SVG: pMimeType = MIMETYPE_SVG; break;
case GfxLinkType::NativeSvg: pMimeType = MIMETYPE_SVG; break;
default:
pMimeType = nullptr;

View File

@ -275,7 +275,7 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
const GraphicType eOldType = rSubstitute.GetType();
const bool bDefaultType = ( rSubstitute.GetType() == GraphicType::Default );
if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) )
if( rSubstitute.IsLink() && ( GfxLinkType::NONE == maGfxLink.GetType() ) )
maGfxLink = rSubstitute.GetLink();
if(maSvgData.get())
@ -306,7 +306,7 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
rSubstitute.SetAnimationNotifyHdl( aAnimationNotifyHdl );
}
if( GFX_LINK_TYPE_NONE != maGfxLink.GetType() )
if( GfxLinkType::NONE != maGfxLink.GetType() )
{
rSubstitute.SetLink( maGfxLink );
}

View File

@ -63,28 +63,28 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic&
OUString aExtension = "png";
switch( rGraphic.GetLink().GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF:
case GfxLinkType::NativeGif:
aExtension = "gif";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
case GfxLinkType::NativeTif:
aExtension = "tif";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
case GfxLinkType::NativeWmf:
aExtension = "wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
case GfxLinkType::NativeMet:
aExtension = "met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
case GfxLinkType::NativePct:
aExtension = "pct";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
case GfxLinkType::NativeJpg:
aExtension = "jpg";
break;
case GFX_LINK_TYPE_NATIVE_BMP:
case GfxLinkType::NativeBmp:
aExtension = "bmp";
break;
case GFX_LINK_TYPE_NATIVE_SVG:
case GfxLinkType::NativeSvg:
aExtension = "svg";
break;
default:

View File

@ -139,31 +139,31 @@ void CompressGraphicsDialog::Update()
OUString aGraphicTypeString;
switch(aLinkType)
{
case GFX_LINK_TYPE_NATIVE_GIF:
case GfxLinkType::NativeGif:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_GIF);
break;
case GFX_LINK_TYPE_NATIVE_JPG:
case GfxLinkType::NativeJpg:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_JPEG);
break;
case GFX_LINK_TYPE_NATIVE_PNG:
case GfxLinkType::NativePng:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_PNG);
break;
case GFX_LINK_TYPE_NATIVE_TIF:
case GfxLinkType::NativeTif:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_TIFF);
break;
case GFX_LINK_TYPE_NATIVE_WMF:
case GfxLinkType::NativeWmf:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_WMF);
break;
case GFX_LINK_TYPE_NATIVE_MET:
case GfxLinkType::NativeMet:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_MET);
break;
case GFX_LINK_TYPE_NATIVE_PCT:
case GfxLinkType::NativePct:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_PCT);
break;
case GFX_LINK_TYPE_NATIVE_SVG:
case GfxLinkType::NativeSvg:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_SVG);
break;
case GFX_LINK_TYPE_NATIVE_BMP:
case GfxLinkType::NativeBmp:
aGraphicTypeString = SVX_RESSTR(STR_IMAGE_BMP);
break;
default:

View File

@ -852,20 +852,20 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo
{
switch( aGfxLink.GetType() )
{
case GFX_LINK_TYPE_EPS_BUFFER: nExportFormat = ConvertDataFormat::SVM; break;
case GFX_LINK_TYPE_NATIVE_GIF: nExportFormat = ConvertDataFormat::GIF; break;
case GfxLinkType::EpsBuffer: nExportFormat = ConvertDataFormat::SVM; break;
case GfxLinkType::NativeGif: nExportFormat = ConvertDataFormat::GIF; break;
// #i15508# added BMP type
// could not find/trigger a call to this, but should do no harm
case GFX_LINK_TYPE_NATIVE_BMP: nExportFormat = ConvertDataFormat::BMP; break;
case GfxLinkType::NativeBmp: nExportFormat = ConvertDataFormat::BMP; break;
case GFX_LINK_TYPE_NATIVE_JPG: nExportFormat = ConvertDataFormat::JPG; break;
case GFX_LINK_TYPE_NATIVE_PNG: nExportFormat = ConvertDataFormat::PNG; break;
case GFX_LINK_TYPE_NATIVE_TIF: nExportFormat = ConvertDataFormat::TIF; break;
case GFX_LINK_TYPE_NATIVE_WMF: nExportFormat = ConvertDataFormat::WMF; break;
case GFX_LINK_TYPE_NATIVE_MET: nExportFormat = ConvertDataFormat::MET; break;
case GFX_LINK_TYPE_NATIVE_PCT: nExportFormat = ConvertDataFormat::PCT; break;
case GFX_LINK_TYPE_NATIVE_SVG: nExportFormat = ConvertDataFormat::SVG; break;
case GfxLinkType::NativeJpg: nExportFormat = ConvertDataFormat::JPG; break;
case GfxLinkType::NativePng: nExportFormat = ConvertDataFormat::PNG; break;
case GfxLinkType::NativeTif: nExportFormat = ConvertDataFormat::TIF; break;
case GfxLinkType::NativeWmf: nExportFormat = ConvertDataFormat::WMF; break;
case GfxLinkType::NativeMet: nExportFormat = ConvertDataFormat::MET; break;
case GfxLinkType::NativePct: nExportFormat = ConvertDataFormat::PCT; break;
case GfxLinkType::NativeSvg: nExportFormat = ConvertDataFormat::SVG; break;
default:
break;
}

View File

@ -234,7 +234,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
if ( pGraphic->IsLink() )
{
GfxLink aLnk = pGraphic->GetLink();
if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
if ( aLnk.GetType() == GfxLinkType::NativeWmf )
{
bIsWMF = true;
uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), (sal_Int32) aLnk.GetDataSize());

View File

@ -2873,7 +2873,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
if ( pGraphic->IsLink() )
{
GfxLink aLnk = pGraphic->GetLink();
if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
if ( aLnk.GetType() == GfxLinkType::NativeWmf )
{
bIsWMF = true;
uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), (sal_Int32) aLnk.GetDataSize());

View File

@ -667,17 +667,17 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
{
switch( aGfxLink.GetType() )
{
case GFX_LINK_TYPE_EPS_BUFFER: aExtension = ".eps"; break;
case GFX_LINK_TYPE_NATIVE_GIF: aExtension = ".gif"; break;
case GfxLinkType::EpsBuffer: aExtension = ".eps"; break;
case GfxLinkType::NativeGif: aExtension = ".gif"; break;
// #i15508# added BMP type for better exports (checked, works)
case GFX_LINK_TYPE_NATIVE_BMP: aExtension = ".bmp"; break;
case GFX_LINK_TYPE_NATIVE_JPG: aExtension = ".jpg"; break;
case GFX_LINK_TYPE_NATIVE_PNG: aExtension = ".png"; break;
case GFX_LINK_TYPE_NATIVE_TIF: aExtension = ".tif"; break;
case GFX_LINK_TYPE_NATIVE_WMF: aExtension = ".wmf"; break;
case GFX_LINK_TYPE_NATIVE_MET: aExtension = ".met"; break;
case GFX_LINK_TYPE_NATIVE_PCT: aExtension = ".pct"; break;
case GFX_LINK_TYPE_NATIVE_SVG:
case GfxLinkType::NativeBmp: aExtension = ".bmp"; break;
case GfxLinkType::NativeJpg: aExtension = ".jpg"; break;
case GfxLinkType::NativePng: aExtension = ".png"; break;
case GfxLinkType::NativeTif: aExtension = ".tif"; break;
case GfxLinkType::NativeWmf: aExtension = ".wmf"; break;
case GfxLinkType::NativeMet: aExtension = ".met"; break;
case GfxLinkType::NativePct: aExtension = ".pct"; break;
case GfxLinkType::NativeSvg:
// backward-compat kludge: since no released OOo
// version to date can handle svg properly, wrap it up
// into an svm. slight catch22 here, since strict ODF

View File

@ -184,13 +184,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
switch( aGfxLink.GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF: aExt = FORMAT_GIF; break;
case GfxLinkType::NativeGif: aExt = FORMAT_GIF; break;
// #i15508# added BMP type for better exports (no call/trigger found, prob used in HTML export)
case GFX_LINK_TYPE_NATIVE_BMP: aExt = FORMAT_BMP; break;
case GfxLinkType::NativeBmp: aExt = FORMAT_BMP; break;
case GFX_LINK_TYPE_NATIVE_JPG: aExt = FORMAT_JPG; break;
case GFX_LINK_TYPE_NATIVE_PNG: aExt = FORMAT_PNG; break;
case GfxLinkType::NativeJpg: aExt = FORMAT_JPG; break;
case GfxLinkType::NativePng: aExt = FORMAT_PNG; break;
default:
break;
@ -336,15 +336,15 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
ConvertDataFormat aCvtType;
switch( aLink.GetType() )
{
case GFX_LINK_TYPE_NATIVE_JPG:
case GfxLinkType::NativeJpg:
aCvtType = ConvertDataFormat::JPG;
aMimeType = "image/jpeg";
break;
case GFX_LINK_TYPE_NATIVE_PNG:
case GfxLinkType::NativePng:
aCvtType = ConvertDataFormat::PNG;
aMimeType = "image/png";
break;
case GFX_LINK_TYPE_NATIVE_SVG:
case GfxLinkType::NativeSvg:
aCvtType = ConvertDataFormat::SVG;
aMimeType = "image/svg+xml";
break;
@ -365,7 +365,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
OUStringBuffer aStrBuffer;
::sax::Converter::encodeBase64(aStrBuffer,aOStmSeq);
OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear();
if( aLink.GetType() == GFX_LINK_TYPE_NATIVE_SVG )
if( aLink.GetType() == GfxLinkType::NativeSvg )
{
sal_Int32 ite(8);
sal_Int32 nBufferLength(aOStmSeq.getLength());

View File

@ -796,7 +796,7 @@ void paintGraphicUsingPrimitivesHelper(vcl::RenderContext & rOutputDevice,
if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aTempGraphic, aURL))
{
if(aTempGraphic.IsLink() && GFX_LINK_TYPE_NATIVE_JPG == aTempGraphic.GetLink().GetType())
if(aTempGraphic.IsLink() && GfxLinkType::NativeJpg == aTempGraphic.GetLink().GetType())
{
aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
aTargetTransform,

View File

@ -3853,25 +3853,25 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
// to PNG, else the BMP array will be used.
// It may work using direct DIB data, but that needs to be checked eventually
//
// #i15508# before GFX_LINK_TYPE_NATIVE_BMP was added the graphic data
// #i15508# before GfxLinkType::NativeBmp was added the graphic data
// (to be hold in pGraphicAry) was not available; thus for now to stay
// compatible, keep it that way by assigning NULL value to pGraphicAry
case GFX_LINK_TYPE_NATIVE_BMP:
case GfxLinkType::NativeBmp:
// pBLIPType = OOO_STRING_SVTOOLS_RTF_WBITMAP;
pGraphicAry = nullptr;
break;
case GFX_LINK_TYPE_NATIVE_JPG:
case GfxLinkType::NativeJpg:
pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP;
break;
case GFX_LINK_TYPE_NATIVE_PNG:
case GfxLinkType::NativePng:
pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP;
break;
case GFX_LINK_TYPE_NATIVE_WMF:
case GfxLinkType::NativeWmf:
pBLIPType =
IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE;
break;
case GFX_LINK_TYPE_NATIVE_GIF:
case GfxLinkType::NativeGif:
// GIF is not supported by RTF, but we override default conversion to WMF, PNG seems fits better here.
aConvertDestinationFormat = ConvertDataFormat::PNG;
pConvertDestinationBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP;

View File

@ -35,7 +35,7 @@ GraphicNativeMetadata::~GraphicNativeMetadata()
bool GraphicNativeMetadata::read(Graphic& rGraphic)
{
GfxLink aLink = rGraphic.GetLink();
if ( aLink.GetType() != GFX_LINK_TYPE_NATIVE_JPG )
if ( aLink.GetType() != GfxLinkType::NativeJpg )
return false;
sal_uInt32 aDataSize = aLink.GetDataSize();
std::unique_ptr<sal_uInt8[]> aBuffer(new sal_uInt8[aDataSize]);

View File

@ -44,10 +44,10 @@ bool GraphicNativeTransform::canBeRotated()
return false;
}
if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG
|| aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG
|| aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF
|| aLink.GetType() == GFX_LINK_TYPE_NONE)
if ( aLink.GetType() == GfxLinkType::NativeJpg
|| aLink.GetType() == GfxLinkType::NativePng
|| aLink.GetType() == GfxLinkType::NativeGif
|| aLink.GetType() == GfxLinkType::NONE)
{
return true;
}
@ -70,19 +70,19 @@ bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
}
GfxLink aLink = mrGraphic.GetLink();
if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG )
if ( aLink.GetType() == GfxLinkType::NativeJpg )
{
return rotateJPEG(aRotation);
}
else if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG )
else if ( aLink.GetType() == GfxLinkType::NativePng )
{
return rotateGeneric(aRotation, "png");
}
else if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF )
else if ( aLink.GetType() == GfxLinkType::NativeGif )
{
return rotateGeneric(aRotation, "gif");
}
else if ( aLink.GetType() == GFX_LINK_TYPE_NONE )
else if ( aLink.GetType() == GfxLinkType::NONE )
{
return rotateBitmapOnly(aRotation);
}

View File

@ -1325,7 +1325,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
sal_uLong nStreamBegin;
sal_uInt16 nStatus;
GraphicReader* pContext = rGraphic.GetContext();
GfxLinkType eLinkType = GFX_LINK_TYPE_NONE;
GfxLinkType eLinkType = GfxLinkType::NONE;
bool bDummyContext = rGraphic.IsDummyContext();
const bool bLinkSet = rGraphic.IsLink();
FilterConfigItem* pFilterConfigItem = nullptr;
@ -1424,7 +1424,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
if( !ImportGIF( rIStream, rGraphic ) )
nStatus = GRFILTER_FILTERERROR;
else
eLinkType = GFX_LINK_TYPE_NATIVE_GIF;
eLinkType = GfxLinkType::NativeGif;
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_PNG ) )
{
@ -1464,7 +1464,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
aIStrm.Read(pGraphicContent, nGraphicContentSize);
aIStrm.Seek(aCurrentPosition);
ImportGIF(aIStrm, rGraphic);
eLinkType = GFX_LINK_TYPE_NATIVE_GIF;
eLinkType = GfxLinkType::NativeGif;
break;
}
}
@ -1472,7 +1472,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
}
}
if ( eLinkType == GFX_LINK_TYPE_NONE )
if ( eLinkType == GfxLinkType::NONE )
{
BitmapEx aBmpEx( aPNGReader.Read( aPreviewSizeHint ) );
if ( aBmpEx.IsEmpty() )
@ -1480,7 +1480,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
else
{
rGraphic = aBmpEx;
eLinkType = GFX_LINK_TYPE_NATIVE_PNG;
eLinkType = GfxLinkType::NativePng;
}
}
}
@ -1497,7 +1497,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
if( !ImportJPEG( rIStream, rGraphic, nullptr, nImportFlags ) )
nStatus = GRFILTER_FILTERERROR;
else
eLinkType = GFX_LINK_TYPE_NATIVE_JPG;
eLinkType = GfxLinkType::NativeJpg;
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVG ) )
{
@ -1562,7 +1562,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
if (bOkay)
{
eLinkType = GFX_LINK_TYPE_NATIVE_SVG;
eLinkType = GfxLinkType::NativeSvg;
}
else
{
@ -1597,7 +1597,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
else if (aFilterName.equalsIgnoreAsciiCase(IMP_BMP))
{
// #i15508# added BMP type (checked, works)
eLinkType = GFX_LINK_TYPE_NATIVE_BMP;
eLinkType = GfxLinkType::NativeBmp;
}
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_MOV ) )
@ -1609,7 +1609,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
{
rGraphic.SetDefaultType();
rIStream.Seek( STREAM_SEEK_TO_END );
eLinkType = GFX_LINK_TYPE_NATIVE_MOV;
eLinkType = GfxLinkType::NativeMov;
}
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_WMF ) ||
@ -1621,7 +1621,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
else
{
rGraphic = aMtf;
eLinkType = GFX_LINK_TYPE_NATIVE_WMF;
eLinkType = GfxLinkType::NativeWmf;
}
}
else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVSGF )
@ -1726,18 +1726,18 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
if( nFormat != GRFILTER_FORMAT_DONTKNOW )
{
if( aShortName.startsWith( TIF_SHORTNAME ) )
eLinkType = GFX_LINK_TYPE_NATIVE_TIF;
eLinkType = GfxLinkType::NativeTif;
else if( aShortName.startsWith( MET_SHORTNAME ) )
eLinkType = GFX_LINK_TYPE_NATIVE_MET;
eLinkType = GfxLinkType::NativeMet;
else if( aShortName.startsWith( PCT_SHORTNAME ) )
eLinkType = GFX_LINK_TYPE_NATIVE_PCT;
eLinkType = GfxLinkType::NativePct;
}
}
}
}
}
if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GFX_LINK_TYPE_NONE ) && !rGraphic.GetContext() && !bLinkSet )
if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetContext() && !bLinkSet )
{
if (pGraphicContent == nullptr)
{

View File

@ -31,7 +31,7 @@
#include <memory>
GfxLink::GfxLink() :
meType ( GFX_LINK_TYPE_NONE ),
meType ( GfxLinkType::NONE ),
mpBuf ( nullptr ),
mpSwap ( nullptr ),
mnBufSize ( 0 ),
@ -169,18 +169,18 @@ bool GfxLink::LoadNative( Graphic& rGraphic )
switch( meType )
{
case GFX_LINK_TYPE_NATIVE_GIF: nCvtType = ConvertDataFormat::GIF; break;
case GfxLinkType::NativeGif: nCvtType = ConvertDataFormat::GIF; break;
// #i15508# added BMP type for better exports (reload when swapped - checked, works)
case GFX_LINK_TYPE_NATIVE_BMP: nCvtType = ConvertDataFormat::BMP; break;
case GfxLinkType::NativeBmp: nCvtType = ConvertDataFormat::BMP; break;
case GFX_LINK_TYPE_NATIVE_JPG: nCvtType = ConvertDataFormat::JPG; break;
case GFX_LINK_TYPE_NATIVE_PNG: nCvtType = ConvertDataFormat::PNG; break;
case GFX_LINK_TYPE_NATIVE_TIF: nCvtType = ConvertDataFormat::TIF; break;
case GFX_LINK_TYPE_NATIVE_WMF: nCvtType = ConvertDataFormat::WMF; break;
case GFX_LINK_TYPE_NATIVE_MET: nCvtType = ConvertDataFormat::MET; break;
case GFX_LINK_TYPE_NATIVE_PCT: nCvtType = ConvertDataFormat::PCT; break;
case GFX_LINK_TYPE_NATIVE_SVG: nCvtType = ConvertDataFormat::SVG; break;
case GfxLinkType::NativeJpg: nCvtType = ConvertDataFormat::JPG; break;
case GfxLinkType::NativePng: nCvtType = ConvertDataFormat::PNG; break;
case GfxLinkType::NativeTif: nCvtType = ConvertDataFormat::TIF; break;
case GfxLinkType::NativeWmf: nCvtType = ConvertDataFormat::WMF; break;
case GfxLinkType::NativeMet: nCvtType = ConvertDataFormat::MET; break;
case GfxLinkType::NativePct: nCvtType = ConvertDataFormat::PCT; break;
case GfxLinkType::NativeSvg: nCvtType = ConvertDataFormat::SVG; break;
default: nCvtType = ConvertDataFormat::Unknown; break;
}
@ -245,7 +245,7 @@ SvStream& WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink )
std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStream, StreamMode::WRITE, 2 ));
// Version 1
rOStream.WriteUInt16( rGfxLink.GetType() ).WriteUInt32( rGfxLink.GetDataSize() ).WriteUInt32( rGfxLink.GetUserId() );
rOStream.WriteUInt16( (sal_uInt16)rGfxLink.GetType() ).WriteUInt32( rGfxLink.GetDataSize() ).WriteUInt32( rGfxLink.GetUserId() );
// Version 2
WritePair( rOStream, rGfxLink.GetPrefSize() );

View File

@ -412,7 +412,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
if ( rGraphic.IsLink() )
{
GfxLinkType eType = rGraphic.GetLink().GetType();
if ( eType == GFX_LINK_TYPE_NATIVE_JPG && mParaRects.size() >= 2 )
if ( eType == GfxLinkType::NativeJpg && mParaRects.size() >= 2 )
{
mbGroupIgnoreGDIMtfActions =
rOutDevData.HasAdequateCompression(
@ -420,7 +420,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
if ( !mbGroupIgnoreGDIMtfActions )
mCurrentGraphic = rGraphic;
}
else if ( eType == GFX_LINK_TYPE_NATIVE_PNG )
else if ( eType == GfxLinkType::NativePng )
{
mCurrentGraphic = rGraphic;
}
@ -453,7 +453,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
bool bClippingNeeded = ( aOutputRect != aVisibleOutputRect ) && !aVisibleOutputRect.IsEmpty();
GfxLink aGfxLink( aGraphic.GetLink() );
if ( aGfxLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG )
if ( aGfxLink.GetType() == GfxLinkType::NativeJpg )
{
if ( bClippingNeeded )
{
@ -796,7 +796,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
{
bool bReduceResolution = false;
assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG );
assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GfxLinkType::NativeJpg );
// small items better off as PNG anyway
if ( rGraphic.GetSizePixel().Width() < 32 &&

View File

@ -100,8 +100,8 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
if( i_Graphic.GetType() != GraphicType::NONE && i_Graphic.GetBitmapEx() == aBitmapEx )
{
GfxLinkType eType = i_Graphic.GetLink().GetType();
bIsJpeg = (eType == GFX_LINK_TYPE_NATIVE_JPG);
bIsPng = (eType == GFX_LINK_TYPE_NATIVE_PNG);
bIsJpeg = (eType == GfxLinkType::NativeJpg);
bIsPng = (eType == GfxLinkType::NativePng);
}
if( i_rContext.m_nMaxImageResolution > 50 )