22#include <com/sun/star/graphic/XEmfParser.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
49 uno::Reference< uno::XComponentContext >
context_;
54 uno::Reference< uno::XComponentContext > context);
55 XEmfParser(
const XEmfParser&) =
delete;
56 XEmfParser& operator=(
const XEmfParser&) =
delete;
59 virtual uno::Sequence< uno::Reference< ::graphic::XPrimitive2D > > SAL_CALL getDecomposition(
60 const uno::Reference< ::io::XInputStream >& xEmfStream,
61 const OUString& aAbsolutePath,
62 const uno::Sequence< ::beans::PropertyValue >& rProperties)
override;
63 void SAL_CALL setSizeHint(
const geometry::RealPoint2D& rSize)
override;
73 XEmfParser::XEmfParser(
74 uno::Reference< uno::XComponentContext > context):
79 uno::Sequence< uno::Reference< ::graphic::XPrimitive2D > > XEmfParser::getDecomposition(
80 const uno::Reference< ::io::XInputStream >& xEmfStream,
82 const uno::Sequence< ::beans::PropertyValue >& rProperties)
89 const bool bExternalHeaderUsed(aExternalHeader.
setSequence(rProperties));
90 bool bEnableEMFPlus =
true;
92 auto it =
aMap.find(
"EMFPlusEnable");
96 if (it->second >>= bValue)
98 bEnableEMFPlus = bValue;
105 sal_uInt32 nOrgPos = pStream->Tell();
108 pStream->SetEndian(SvStreamEndian::LITTLE);
110 sal_uInt32 nMetaType(0);
112 pStream->ReadUInt32(nMetaType);
113 pStream->Seek(nOrgPos);
115 bool bReadError(
false);
119 if (nMetaType == 0x464d4520)
126 aReader.SetEnableEMFPlus(bEnableEMFPlus);
128 bReadError = !aReader.ReadEnhWMF();
132 emfio::WmfReader aReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader :
nullptr);
134 aReader.SetEnableEMFPlus(bEnableEMFPlus);
140 ErrCode aErrCode(pStream->GetError());
142 bReadError = aErrCode.IsError();
150 pStream->SetEndian(nOrigNumberFormat);
201 SAL_WARN(
"emfio",
"Invalid stream (!)");
207 void XEmfParser::setSizeHint(
const geometry::RealPoint2D& rSize)
213 OUString SAL_CALL XEmfParser::getImplementationName()
215 return "emfio::emfreader::XEmfParser";
218 sal_Bool SAL_CALL XEmfParser::supportsService(
const OUString& rServiceName)
223 uno::Sequence< OUString > SAL_CALL XEmfParser::getSupportedServiceNames()
225 return {
"com.sun.star.graphic.EmfTools" };
232extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
234 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
236 return cppu::acquire(
new emfio::emfreader::XEmfParser(context));
static OutputDevice * GetDefaultDevice()
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > toSequence() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define SAL_WARN(area, stream)
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
HashMap_OWString_Interface aMap
TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
bool setSequence(const css::uno::Sequence< css::beans::PropertyValue > &rSequence)
basegfx::B2DTuple maSizeHint
uno::Reference< uno::XComponentContext > context_
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * emfio_emfreader_XEmfParser_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)