33#include <com/sun/star/beans/XPropertySet.hpp>
53 if( bHMirr || bVMirr )
59 nMirrorFlags |= BmpMirrorFlags::Horizontal;
62 nMirrorFlags |= BmpMirrorFlags::Vertical;
80 aNewAnim.
Replace(aAnimationFrame,
i);
91 if( nMirrorFlags != BmpMirrorFlags::NONE )
96 bool( nMirrorFlags & BmpMirrorFlags::Horizontal ),
97 bool( nMirrorFlags & BmpMirrorFlags::Vertical ) );
102 aBmp.
Mirror( nMirrorFlags );
107 aRetGraphic = rGraphic;
112static OUString
match(std::u16string_view
filter,
const OUString& expected,
bool matchEmpty =
true)
114 return (matchEmpty &&
filter.empty()) || expected.equalsIgnoreAsciiCase(
filter) ? expected
121 if (!
pData ||
pData->getBinaryDataContainer().getSize() == 0)
125 switch (
pData->getType())
127 case VectorGraphicDataType::Svg:
129 case VectorGraphicDataType::Wmf:
131 case VectorGraphicDataType::Emf:
133 case VectorGraphicDataType::Pdf:
150 case GfxLinkType::NativeGif:
154 case GfxLinkType::NativeBmp:
157 case GfxLinkType::NativeJpg:
159 case GfxLinkType::NativePng:
161 case GfxLinkType::NativeTif:
163 case GfxLinkType::NativeWebp:
171 const OUString& rFilterName,
const XOutFlags nFlags,
172 const Size* pMtfSize_100TH_MM,
173 const css::uno::Sequence< css::beans::PropertyValue >* pFilterData,
174 OUString* pMediaType )
176 if( rGraphic.
GetType() == GraphicType::NONE )
182 DBG_ASSERT(
aURL.GetProtocol() != INetProtocol::NotValid,
"XOutBitmap::WriteGraphic(...): invalid URL" );
188 if (
aStr[0] ==
'-' )
189 aStr = OUString::Concat(
"m") +
aStr.subView(1);
198 aURL.setExtension(aExt);
203 xGraphic->getPropertyValue(
"MimeType") >>= *pMediaType;
221 ( rGraphic.
GetType() != GraphicType::GdiMetafile ) && rGraphic.
IsGfxLink() )
228 aURL.setExtension( aExt );
232 xGraphic->getPropertyValue(
"MimeType") >>= *pMediaType;
248 OUString aFilter( rFilterName );
250 bool bWriteTransGrf = ( aFilter.equalsIgnoreAsciiCase(
"transgrf" ) ) ||
251 ( aFilter.equalsIgnoreAsciiCase(
"gif" ) ) ||
280 if( pMtfSize_100TH_MM && ( rGraphic.
GetType() != GraphicType::Bitmap ) )
283 const Size aSize(pVDev->LogicToPixel(*pMtfSize_100TH_MM,
MapMode(MapUnit::Map100thMM)));
285 if( pVDev->SetOutputSizePixel( aSize ) )
287 const Wallpaper aWallpaper( pVDev->GetBackground() );
292 rGraphic.
Draw(*pVDev, aPt, aSize);
294 const Bitmap aBitmap( pVDev->GetBitmap( aPt, aSize ) );
296 pVDev->SetBackground( aWallpaper );
298 rGraphic.
Draw(*pVDev, aPt, aSize);
300 pVDev->SetRasterOp( RasterOp::Xor );
301 pVDev->DrawBitmap( aPt, aSize, aBitmap );
302 aGraphic =
BitmapEx( aBitmap, pVDev->GetBitmap( aPt, aSize ) );
313 if( pMtfSize_100TH_MM && ( rGraphic.
GetType() != GraphicType::Bitmap ) )
316 const Size aSize(pVDev->LogicToPixel(*pMtfSize_100TH_MM,
MapMode(MapUnit::Map100thMM)));
318 if( pVDev->SetOutputSizePixel( aSize ) )
335 nBmpMirrorFlags |= BmpMirrorFlags::Horizontal;
337 nBmpMirrorFlags |= BmpMirrorFlags::Vertical;
341 if (aGraphic.
GetType() != GraphicType::NONE)
344 aURL.setExtension( aExt );
361 if (aTargetFormat == ConvertDataFormat::Unknown)
365 case GfxLinkType::NativeJpg:
366 aTargetFormat = ConvertDataFormat::JPG;
368 case GfxLinkType::NativePng:
369 aTargetFormat = ConvertDataFormat::PNG;
371 case GfxLinkType::NativeSvg:
372 aTargetFormat = ConvertDataFormat::SVG;
376 aTargetFormat = ConvertDataFormat::PNG;
384 SAL_WARN(
"svx",
"XOutBitmap::GraphicToBase64() invalid Graphic? error: " << nErr );
388 OUStringBuffer aStrBuffer;
390 rOUString = aStrBuffer.makeStringAndClear();
396 rOUString =
aMimeType +
";base64," + rOUString;
404 const css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
406 DBG_ASSERT( rURL.
GetProtocol() != INetProtocol::NotValid,
"XOutBitmap::ExportGraphic(...): invalid URL" );
constexpr OUStringLiteral FORMAT_BMP
constexpr OUStringLiteral FORMAT_SVG
static OUString match(std::u16string_view filter, const OUString &expected, bool matchEmpty=true)
constexpr OUStringLiteral FORMAT_PDF
constexpr OUStringLiteral FORMAT_EMF
static OUString isKnownVectorFormat(const Graphic &rGraphic, std::u16string_view rFilter)
constexpr OUStringLiteral FORMAT_PNG
constexpr OUStringLiteral FORMAT_GIF
constexpr OUStringLiteral FORMAT_TIF
constexpr OUStringLiteral FORMAT_WMF
constexpr OUStringLiteral FORMAT_WEBP
static OUString isKnownRasterFormat(const GfxLink &rLink, std::u16string_view rFilter)
constexpr OUStringLiteral FORMAT_JPG
void Replace(const AnimationFrame &rNewAnimationBmp, sal_uInt16 nAnimation)
const Size & GetDisplaySizePixel() const
const AnimationFrame & Get(sal_uInt16 nAnimation) const
bool Mirror(BmpMirrorFlags nMirrorFlags)
const sal_uInt8 * GetData() const
sal_uInt32 GetDataSize() const
GfxLinkType GetType() const
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
static GraphicFilter & GetGraphicFilter()
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
OUString GetExportFormatShortName(sal_uInt16 nFormat)
OUString GetExportFormatMediaType(sal_uInt16 nFormat)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
Animation GetAnimation() const
GraphicType GetType() const
GfxLink GetGfxLink() const
BitmapChecksum GetChecksum() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
const std::shared_ptr< VectorGraphicData > & getVectorGraphicData() const
bool IsTransparent() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
SvStream * GetOutStream()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual sal_uInt64 TellEnd() override
std::size_t WriteBytes(const void *pData, std::size_t nSize)
static ErrCode WriteGraphic(const Graphic &rGraphic, OUString &rFileName, const OUString &rFilterName, const XOutFlags nFlags, const Size *pMtfSize_100TH_MM=nullptr, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr, OUString *pMediaType=nullptr)
static bool GraphicToBase64(const Graphic &rGraphic, OUString &rOUString, bool bAddPrefix=true, ConvertDataFormat aTargetFormat=ConvertDataFormat::Unknown)
static Animation MirrorAnimation(const Animation &rAnimation, bool bHMirr, bool bVMirr)
static Graphic MirrorGraphic(const Graphic &rGraphic, const BmpMirrorFlags nMirrorFlags)
static ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rURL, GraphicFilter &rFilter, const sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData)
static void encode(OUStringBuffer &aStrBuffer, const css::uno::Sequence< sal_Int8 > &aPass)
static OUString GetMimeTypeForConvertDataFormat(ConvertDataFormat convertDataFormat)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
#define GRFILTER_FORMAT_NOTFOUND
#define ERRCODE_GRFILTER_FILTERERROR
#define ERRCODE_GRFILTER_IOERROR
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
class SAL_NO_VTABLE XPropertySet
const sal_Unicode *const aMimeType[]