26#include <com/sun/star/beans/PropertyAttribute.hpp>
27#include <com/sun/star/awt/Size.hpp>
28#include <com/sun/star/graphic/GraphicType.hpp>
29#include <com/sun/star/io/XInputStream.hpp>
38enum class UnoGraphicProperty
60 ::
comphelper::PropertySetHelper( createPropertySetInfo() ),
64 mbTransparent ( false )
110 const char* pMimeType =
nullptr;
111 sal_uInt8 cType = graphic::GraphicType::EMPTY;
148 if( graphic::GraphicType::EMPTY != cType )
151 maMimeType = OUString( pMimeType, strlen(pMimeType), RTL_TEXTENCODING_ASCII_US );
165 aAny <<= uno::Reference< lang::XServiceInfo >(
this);
167 aAny <<= uno::Reference< lang::XTypeProvider >(
this);
169 aAny <<= uno::Reference< beans::XPropertySet >(
this);
171 aAny <<= uno::Reference< beans::XPropertyState >(
this);
173 aAny <<= uno::Reference< beans::XMultiPropertySet >(
this);
175 aAny = OWeakObject::queryInterface( rType );
184 OWeakObject::acquire();
191 OWeakObject::release();
197 return "com.sun.star.comp.graphic.GraphicDescriptor";
208 return {
"com.sun.star.graphic.GraphicDescriptor" };
214 static const uno::Sequence< uno::Type >
aTypes {
226 return css::uno::Sequence<sal_Int8>();
232 static ::comphelper::PropertyMapEntry
const aEntries[] =
235 { OUString(
"MimeType" ),
static_cast< sal_Int32
>( UnoGraphicProperty::MimeType ),
cppu::UnoType< OUString >::get(), beans::PropertyAttribute::READONLY, 0 },
236 { OUString(
"SizePixel" ),
static_cast< sal_Int32
>( UnoGraphicProperty::SizePixel ),
cppu::UnoType< awt::Size >::get(), beans::PropertyAttribute::READONLY, 0 },
237 { OUString(
"Size100thMM" ),
static_cast< sal_Int32
>( UnoGraphicProperty::Size100thMM ),
cppu::UnoType< awt::Size >::get(), beans::PropertyAttribute::READONLY, 0 },
238 { OUString(
"BitsPerPixel" ),
static_cast< sal_Int32
>( UnoGraphicProperty::BitsPerPixel ),
cppu::UnoType< sal_uInt8 >::get(), beans::PropertyAttribute::READONLY, 0 },
239 { OUString(
"Transparent" ),
static_cast< sal_Int32
>( UnoGraphicProperty::Transparent ),
cppu::UnoType< sal_Bool >::get(), beans::PropertyAttribute::READONLY, 0 },
240 { OUString(
"Alpha" ),
static_cast< sal_Int32
>( UnoGraphicProperty::Alpha ),
cppu::UnoType< sal_Bool >::get(), beans::PropertyAttribute::READONLY, 0 },
241 { OUString(
"Animated" ),
static_cast< sal_Int32
>( UnoGraphicProperty::Animated ),
cppu::UnoType< sal_Bool >::get(), beans::PropertyAttribute::READONLY, 0 },
243 { OUString(
"OriginURL"), sal_Int32(UnoGraphicProperty::OriginURL),
cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
262 UnoGraphicProperty theProperty =
static_cast< UnoGraphicProperty
>( (*ppEntries)->mnHandle );
263 switch( theProperty )
271 graphic::GraphicType::EMPTY ) );
275 case UnoGraphicProperty::MimeType:
283 const char* pMimeType;
285 switch(
mpGraphic->GetGfxLink().GetType() )
309 aMimeType = OUString::createFromAscii( pMimeType );
322 case UnoGraphicProperty::SizePixel:
324 awt::Size aAWTSize( 0, 0 );
331 aAWTSize = awt::Size( aSizePix.
Width(), aSizePix.
Height() );
341 case UnoGraphicProperty::Size100thMM:
343 awt::Size aAWTSize( 0, 0 );
347 if(
mpGraphic->GetPrefMapMode().GetMapUnit() != MapUnit::MapPixel )
352 MapMode(MapUnit::Map100thMM)) );
353 aAWTSize = awt::Size( aSizeLog.
Width(), aSizeLog.
Height() );
363 case UnoGraphicProperty::BitsPerPixel:
365 sal_uInt16 nBitsPerPixel = 0;
371 auto ePixelFormat =
mpGraphic->GetBitmapEx().GetBitmap().getPixelFormat();
378 *pValues <<= sal::static_int_cast< sal_Int8 >(nBitsPerPixel);
382 case UnoGraphicProperty::Transparent:
388 case UnoGraphicProperty::Alpha:
394 case UnoGraphicProperty::Animated:
400 case UnoGraphicProperty::Linked:
406 case UnoGraphicProperty::OriginURL:
const PropertyValue * pValues
constexpr OUStringLiteral MIMETYPE_VCLGRAPHIC
sal_uInt16 GetBitsPerPixel() const
bool Detect(bool bExtendedInfo=false)
starts the detection
const Size & GetSize_100TH_MM() const
GraphicFileFormat GetFileFormat() const
const Size & GetSizePixel() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
css::uno::Type const & get()
virtual void _setPropertyValues(const comphelper::PropertyMapEntry **ppEntries, const css::uno::Any *pValues) override
static rtl::Reference<::comphelper::PropertySetInfo > createPropertySetInfo()
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL release() noexcept override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
const ::Graphic * mpGraphic
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
sal_uInt16 mnBitsPerPixel
virtual ~GraphicDescriptor() noexcept override
void init(const ::Graphic &rGraphic)
virtual void _getPropertyValues(const comphelper::PropertyMapEntry **ppEntries, css::uno::Any *pValue) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() noexcept override
void implCreate(SvStream &rIStm, const OUString *pPath)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
ScXMLEditAttributeMap::Entry const aEntries[]
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr sal_uInt16 pixelFormatBitCount(PixelFormat ePixelFormat)
const sal_Unicode *const aMimeType[]