20#include <com/sun/star/awt/XBitmap.hpp>
21#include <com/sun/star/graphic/XGraphic.hpp>
29#include <svx/strings.hrc>
37#include <com/sun/star/beans/PropertyValue.hpp>
41#include <libxml/xmlwriter.h>
47 bGraphicDirty ( false )
71 bool bPixelColor =
false;
73 const sal_Int32 nLines = 8;
76 pPixelArray.reset(
new sal_uInt16[ nLines * nLines ] );
79 pVDev->DrawBitmapEx(
Point(), aBitmap );
83 for (sal_Int32
i = 0;
i < nLines; ++
i)
85 for (sal_Int32 j = 0; j < nLines; ++j)
109 const sal_Int32 nLines = 8;
111 pVDev->SetOutputSizePixel(
Size( nLines, nLines ) );
114 for (sal_Int32
i = 0;
i < nLines; ++
i)
116 for (sal_Int32 j = 0; j < nLines; ++j)
134 maGraphicObject(rGraphicObject)
140 maGraphicObject(rItem.maGraphicObject)
146 , maGraphicObject(rGraphicObject)
157 return (NameOrIndex::operator==(rItem)
181 nMemberId &= ~CONVERT_TWIPS;
186 OUString aInternalName;
188 css::uno::Reference< css::awt::XBitmap > xBmp;
194 else if( nMemberId == 0 )
212 DBG_ASSERT( nMemberId == 0,
"invalid member-id" );
213 uno::Sequence< beans::PropertyValue > aPropSeq{
226 nMemberId &= ~CONVERT_TWIPS;
230 css::uno::Reference< css::awt::XBitmap > xBmp;
231 css::uno::Reference< css::graphic::XGraphic > xGraphic;
233 bool bSetURL =
false;
234 bool bSetName =
false;
235 bool bSetBitmap =
false;
238 bSetName = (rVal >>=
aName);
241 if (rVal.has<OUString>())
244 aURL = rVal.get<OUString>();
246 else if (rVal.has<uno::Reference<awt::XBitmap>>())
249 xBmp = rVal.get<uno::Reference<awt::XBitmap>>();
251 else if (rVal.has<uno::Reference<graphic::XGraphic>>())
254 xGraphic = rVal.get<uno::Reference<graphic::XGraphic>>();
259 DBG_ASSERT( nMemberId == 0,
"invalid member-id" );
260 uno::Sequence< beans::PropertyValue > aPropSeq;
261 if( rVal >>= aPropSeq )
263 for (
const auto& rProp : std::as_const(aPropSeq) )
265 if ( rProp.Name ==
"Name" )
266 bSetName = (rProp.Value >>=
aName);
267 else if ( rProp.Name ==
"Bitmap" )
268 bSetBitmap = (rProp.Value >>= xBmp);
269 else if ( rProp.Name ==
"FillBitmapURL" )
270 bSetURL = (rProp.Value >>=
aURL);
279 if (bSetURL && !
aURL.isEmpty())
287 else if( bSetBitmap )
291 xGraphic.set(xBmp, uno::UNO_QUERY);
299 return (bSetURL || bSetName || bSetBitmap);
307 return aGraphicObjectA == aGraphicObjectB;
325 return std::make_unique<XFillBitmapItem>(aUniqueName,
maGraphicObject);
334 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"XFillBitmapItem"));
335 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"whichId"), BAD_CAST(OString::number(
Which()).getStr()));
339 (void)xmlTextWriterEndElement(pWriter);
const Size & GetSizePixel() const
void SetGraphic(const Graphic &rGraphic)
const Graphic & GetGraphic() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
OUString const & GetName() const
void SetName(const OUString &rName)
void dumpAsXml(xmlTextWriterPtr pWriter) const override
static OUString CheckNamedItem(const NameOrIndex *pCheckItem, const sal_uInt16 nWhich, const SfxItemPool *pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults)
this static checks if the given NameOrIndex item has a unique name for its value.
const SfxItemPool & GetItemPool() const
const XPropertyListRef & GetPropertyList(XPropertyListType t) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
static SfxPoolItem * CreateDefault()
GraphicObject maGraphicObject
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual XFillBitmapItem * Clone(SfxItemPool *pPool=nullptr) const override
std::unique_ptr< XFillBitmapItem > checkForUniqueItem(SdrModel *pModel) const
static bool CompareValueFunc(const NameOrIndex *p1, const NameOrIndex *p2)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual bool operator==(const SfxPoolItem &rItem) const override
const GraphicObject & GetGraphicObject() const
std::unique_ptr< sal_uInt16[]> pPixelArray
BitmapEx GetBitmap() const
XOBitmap(const XOBitmap &rXBmp)=delete
void Array2Bitmap()
convert array, fore- and background color into a bitmap
const GraphicObject & GetGraphicObject() const
std::unique_ptr< GraphicObject > xGraphicObject
#define DBG_ASSERT(sCon, aError)
struct _xmlTextWriter * xmlTextWriterPtr
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool isHistorical8x8(const BitmapEx &rBitmapEx, Color &o_rBack, Color &o_rFront)
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)
Graphic loadFromURL(OUString const &rURL, weld::Window *pParentWin)
OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString &rInternalName)
if the given name is a predefined name for the current language it is replaced by the corresponding a...
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)