summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/gfxlink.hxx1
-rw-r--r--svx/source/xml/xmlgrhlp.cxx7
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx19
-rw-r--r--vcl/source/gdi/gfxlink.cxx16
4 files changed, 25 insertions, 18 deletions
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 2d84fd293e4f..473acd9265f7 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -111,6 +111,7 @@ public:
void SwapIn();
bool IsSwappedOut() const { return( bool(mpSwapOutData) ); }
+ bool IsEMF() const; // WMF & EMF stored under the same type (NativeWmf)
public:
friend VCL_DLLPUBLIC SvStream& WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink );
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index ff7e4043d519..fd80affeaf33 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -667,7 +667,12 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
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::NativeWmf:
+ if (aGfxLink.IsEMF())
+ aExtension = ".emf";
+ else
+ aExtension = ".wmf";
+ break;
case GfxLinkType::NativeMet: aExtension = ".met"; break;
case GfxLinkType::NativePct: aExtension = ".pct"; break;
case GfxLinkType::NativeSvg:
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 400e4049f298..ccc5188f1661 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3785,21 +3785,6 @@ void RtfAttributeOutput::FontPitchType(FontPitch ePitch) const
m_rExport.OutULong(nVal);
}
-static bool IsEMF(const sal_uInt8* pGraphicAry, unsigned long nSize)
-{
- if (pGraphicAry && (nSize > 0x2c))
- {
- // check the magic number
- if ((pGraphicAry[0x28] == 0x20) && (pGraphicAry[0x29] == 0x45)
- && (pGraphicAry[0x2a] == 0x4d) && (pGraphicAry[0x2b] == 0x46))
- {
- //emf detected
- return true;
- }
- }
- return false;
-}
-
static bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, unsigned long& rSize)
{
if (rpGraphicAry && (rSize > 0x22))
@@ -4065,8 +4050,8 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP;
break;
case GfxLinkType::NativeWmf:
- pBLIPType = IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP
- : OOO_STRING_SVTOOLS_RTF_WMETAFILE;
+ pBLIPType = aGraphicLink.IsEMF() ? OOO_STRING_SVTOOLS_RTF_EMFBLIP
+ : OOO_STRING_SVTOOLS_RTF_WMETAFILE;
break;
case GfxLinkType::NativeGif:
// GIF is not supported by RTF, but we override default conversion to WMF, PNG seems fits better here.
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index a7a33ad1c862..c1acb0a60957 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -277,4 +277,20 @@ std::shared_ptr<sal_uInt8> GfxLink::GetSwapInData() const
return pData;
}
+bool GfxLink::IsEMF() const
+{
+ const sal_uInt8* pGraphicAry = GetData();
+ if ((GetType() == GfxLinkType::NativeWmf) && pGraphicAry && (GetDataSize() > 0x2c))
+ {
+ // check the magic number
+ if ((pGraphicAry[0x28] == 0x20) && (pGraphicAry[0x29] == 0x45)
+ && (pGraphicAry[0x2a] == 0x4d) && (pGraphicAry[0x2b] == 0x46))
+ {
+ //emf detected
+ return true;
+ }
+ }
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */