37#include <com/sun/star/beans/XPropertyState.hpp>
38#include <com/sun/star/beans/XPropertySet.hpp>
39#include <com/sun/star/drawing/BitmapMode.hpp>
40#include <com/sun/star/container/XNameAccess.hpp>
41#include <com/sun/star/lang/XMultiServiceFactory.hpp>
68 return aDataPointPropertyFilledMap;
77 return aDataPointPropertyLineMap;
87 return aLinePropertyMap;
103 return aFillPropertyMap;
108 return ( eType == ::chart::wrapper::GraphicObjectType::FilledDataPoint ||
109 eType == ::chart::wrapper::GraphicObjectType::LineAndFillProperties );
112bool lcl_SetContentForNamedProperty(
113 const uno::Reference< lang::XMultiServiceFactory > & xFactory,
114 const OUString & rTableName,
117 bool bResult =
false;
120 OUString aPropertyValue( rItem.
GetName());
121 uno::Reference< container::XNameAccess > xNameAcc(
122 xFactory->createInstance( rTableName ),
125 xNameAcc->hasByName( aPropertyValue ))
127 rItem.PutValue( xNameAcc->getByName( aPropertyValue ), nMemberId );
138 beans::XPropertySet > & rPropertySet,
144 m_GraphicObjectType( eObjectType ),
145 m_rDrawModel( rDrawModel ),
146 m_xNamedPropertyTableFactory(
std::move( xNamedPropertyContainerFactory ))
171 ItemPropertyMapType::const_iterator aEndIt;
172 ItemPropertyMapType::const_iterator aIt;
177 aEndIt = lcl_GetDataPointLinePropertyMap().end();
178 aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId );
181 aEndIt = lcl_GetDataPointFilledPropertyMap().end();
182 aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId );
185 aEndIt = lcl_GetLinePropertyMap().end();
186 aIt = lcl_GetLinePropertyMap().find( nWhichId );
191 aEndIt = lcl_GetLinePropertyMap().end();
192 aIt = lcl_GetLinePropertyMap().find( nWhichId );
197 aEndIt = lcl_GetFillPropertyMap().end();
198 aIt = lcl_GetFillPropertyMap().find( nWhichId );
206 rOutProperty =(*aIt).second;
211 sal_uInt16 nWhichId,
SfxItemSet & rOutItemSet )
const
219 drawing::BitmapMode aMode = drawing::BitmapMode_REPEAT;
235 ? OUString(
"TransparencyGradientName" )
236 : OUString(
"FillTransparenceGradientName" );
244 lcl_SetContentForNamedProperty(
250 if( (aValue >>=
aName) &&
254 rOutItemSet.
Put( aItem );
259 catch(
const beans::UnknownPropertyException & )
270 ? OUString(
"GradientStepCount" )
271 : OUString(
"FillGradientStepCount" );
286 ? OUString(
"BorderDashName" )
287 : OUString(
"LineDashName" );
292 lcl_SetContentForNamedProperty(
301 rOutItemSet.
Put( std::move(pItemToPut) );
303 rOutItemSet.
Put(aItem);
312 ? OUString(
"GradientName" )
313 : OUString(
"FillGradientName" );
318 lcl_SetContentForNamedProperty(
327 rOutItemSet.
Put(std::move(pItemToPut) );
329 rOutItemSet.
Put(aItem);
338 ? OUString(
"HatchName" )
339 : OUString(
"FillHatchName" );
344 lcl_SetContentForNamedProperty(
353 rOutItemSet.
Put( std::move(pItemToPut) );
355 rOutItemSet.
Put(aItem);
365 lcl_SetContentForNamedProperty(
374 rOutItemSet.
Put( std::move(pItemToPut) );
376 rOutItemSet.
Put(aItem);
386 ? OUString(
"BorderTransparency" )
388 ? OUString(
"Transparency" )
389 : OUString(
"LineTransparence" );
394 rOutItemSet.
Put( aItem );
405 ? OUString(
"Transparency" )
406 : OUString(
"FillTransparence" );
411 rOutItemSet.
Put( aItem );
418 sal_uInt16 nWhichId,
const SfxItemSet & rItemSet )
420 bool bChanged =
false;
429 static constexpr OUStringLiteral aModePropName(
u"FillBitmapMode");
431 drawing::BitmapMode aMode =
432 (bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
433 drawing::BitmapMode aOtherMode = drawing::BitmapMode_NO_REPEAT;
436 GetPropertySet()->getPropertyValue( aModePropName ) >>= aOtherMode;
440 if( aMode != aOtherMode && aOtherMode != drawing::BitmapMode_REPEAT )
451 static constexpr OUStringLiteral aModePropName(
u"FillBitmapMode");
453 drawing::BitmapMode aMode =
454 (bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
457 if( aValue !=
GetPropertySet()->getPropertyValue( aModePropName ))
472 ? OUString(
"TransparencyGradientName" )
473 : OUString(
"FillTransparenceGradientName" );
477 rItemSet.
Get( nWhichId ));
486 OUString aPreferredName;
487 aValue >>= aPreferredName;
501 && !
aName.isEmpty() )
505 xState->setPropertyToDefault(
aPropName );
511 catch(
const beans::UnknownPropertyException & )
523 ? OUString(
"GradientStepCount" )
524 : OUString(
"FillGradientStepCount" );
529 aValue <<= nStepCount;
543 ? OUString(
"BorderDashName" )
544 : OUString(
"LineDashName" );
548 rItemSet.
Get( nWhichId ));
557 OUString aPreferredName;
558 aValue >>= aPreferredName;
575 ? OUString(
"GradientName" )
576 : OUString(
"FillGradientName" );
580 rItemSet.
Get( nWhichId ));
589 OUString aPreferredName;
590 aValue >>= aPreferredName;
608 ? OUString(
"HatchName" )
609 : OUString(
"FillHatchName" );
613 rItemSet.
Get( nWhichId ));
622 OUString aPreferredName;
623 aValue >>= aPreferredName;
641 rItemSet.
Get( nWhichId ));
645 if( aValue !=
GetPropertySet()->getPropertyValue(
"FillBitmapName" ))
650 OUString aPreferredName;
651 aValue >>= aPreferredName;
669 ? OUString(
"BorderTransparency" )
671 ? OUString(
"Transparency" )
672 : OUString(
"LineTransparence" );
676 rItemSet.
Get( nWhichId ));
678 if( rItem.QueryValue( aValue ))
680 OSL_ENSURE( ! aValue.isExtractableTo(
682 "TransparenceItem QueryValue bug is fixed. Remove hack." );
687 sal_Int16 nValueToSet(
static_cast< sal_Int16
>(
nValue ));
688 aValue <<= nValueToSet;
695 OSL_FAIL(
"Wrong type in Transparency Any" );
708 ? OUString(
"Transparency" )
709 : OUString(
"FillTransparence" );
713 rItemSet.
Get( nWhichId ));
715 if( rItem.QueryValue( aValue ))
717 OSL_ENSURE( ! aValue.isExtractableTo(
719 "TransparenceItem QueryValue bug is fixed. Remove hack." );
724 sal_Int16 nValueToSet(
static_cast< sal_Int16
>(
nValue ));
725 aValue <<= nValueToSet;
729 OUString aTransGradPropName =
731 ? OUString(
"TransparencyGradientName" )
732 : OUString(
"FillTransparenceGradientName" );
734 aTransGradPropName,
uno::Any( OUString() ));
740 OSL_FAIL(
"Wrong type in Transparency Any" );
const WhichRangesContainer nLineAndFillPropertyWhichPairs(svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST >)
const WhichRangesContainer nLinePropertyWhichPairs(svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST >)
const WhichRangesContainer nRowWhichPairs(svl::Items< SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, SCHATTR_STYLE_START, SCHATTR_STYLE_END, SCHATTR_AXIS, SCHATTR_AXIS, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_SIZE, SCHATTR_SYMBOL_SIZE, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_BAR_OVERLAP, SCHATTR_BAR_CONNECT, SCHATTR_GROUP_BARS_PER_AXIS, SCHATTR_AXIS_FOR_ALL_SERIES, XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, SDRATTR_3D_FIRST, SDRATTR_3D_LAST, EE_ITEMS_START, EE_ITEMS_END, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING >)
OUString const & GetName() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XFillBitmapItem > checkForUniqueItem(SdrModel *pModel) const
void SetEnabled(bool bEnable)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
std::unique_ptr< XFillGradientItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XFillHatchItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XLineDashItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory
GraphicObjectType m_GraphicObjectType
virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const override
for items that can not be mapped directly to a property.
virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet &rItemSet) override
for items that can not be mapped directly to a property.
virtual ~GraphicPropertyItemConverter() override
virtual const WhichRangesContainer & GetWhichPairs() const override
implement this method to provide an array of which-ranges
virtual bool GetItemProperty(tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const override
implement this method to return a Property object for a given which id.
GraphicPropertyItemConverter(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet, SfxItemPool &rItemPool, SdrModel &rDrawModel, css::uno::Reference< css::lang::XMultiServiceFactory > xNamedPropertyContainerFactory, GraphicObjectType eObjectType)
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets.
std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet().
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XSingleServiceFactory > xFactory
OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a gradient with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a line dash with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a bitmap with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addTransparencyGradientUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a transparency gradient with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a hatch with a unique name to the gradient obtained by the given factory.
std::map< ItemConverter::tWhichIdType, std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > ItemPropertyMapType
OOO_DLLPUBLIC_CHARTTOOLS bool hasLongOrShortValue(const css::uno::Any &rAny)
OOO_DLLPUBLIC_CHARTTOOLS sal_Int16 getShortForLongAlso(const css::uno::Any &rAny)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
constexpr TypedWhichId< XFillBmpPosOffsetYItem > XATTR_FILLBMP_POSOFFSETY(XATTR_FILL_FIRST+18)
constexpr TypedWhichId< XGradientStepCountItem > XATTR_GRADIENTSTEPCOUNT(XATTR_FILL_FIRST+6)
constexpr TypedWhichId< XFillBmpPosItem > XATTR_FILLBMP_POS(XATTR_FILL_FIRST+8)
constexpr TypedWhichId< XLineJointItem > XATTR_LINEJOINT(XATTR_LINE_FIRST+11)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillBmpTileOffsetXItem > XATTR_FILLBMP_TILEOFFSETX(XATTR_FILL_FIRST+14)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
constexpr TypedWhichId< XLineCapItem > XATTR_LINECAP(XATTR_LINE_FIRST+12)
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XFillBmpPosOffsetXItem > XATTR_FILLBMP_POSOFFSETX(XATTR_FILL_FIRST+17)
constexpr TypedWhichId< XFillBmpTileOffsetYItem > XATTR_FILLBMP_TILEOFFSETY(XATTR_FILL_FIRST+15)
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBmpSizeLogItem > XATTR_FILLBMP_SIZELOG(XATTR_FILL_FIRST+13)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)