diff options
-rw-r--r-- | include/svl/poolitem.hxx | 1 | ||||
-rw-r--r-- | include/svx/xflgrit.hxx | 22 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 14 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 30 |
4 files changed, 46 insertions, 21 deletions
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 17ab04f32166..8e86d43dae6f 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -486,6 +486,7 @@ enum class SfxItemType : sal_uInt16 { XFillBmpTileOffsetXItemType, XFillBmpTileOffsetYItemType, XFillColorItemType, + XFillFloatTransparenceItemType, XFillGradientItemType, XFillHatchItemType, XFillStyleItemType, diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx index 0e02813d968d..90d5bb3eabef 100644 --- a/include/svx/xflgrit.hxx +++ b/include/svx/xflgrit.hxx @@ -33,12 +33,22 @@ class SVXCORE_DLLPUBLIC XFillGradientItem : public NameOrIndex basegfx::BGradient m_aGradient; public: - static SfxPoolItem* CreateDefault(); - XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1, SfxItemType::XFillGradientItemType) {} - XFillGradientItem(sal_Int32 nIndex, const basegfx::BGradient& rTheGradient); - XFillGradientItem(const OUString& rName, const basegfx::BGradient& rTheGradient, TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT); - XFillGradientItem(const basegfx::BGradient& rTheGradient); - XFillGradientItem(const XFillGradientItem& rItem); + static SfxPoolItem* CreateDefault(); + XFillGradientItem(TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT, + SfxItemType eItemType = SfxItemType::XFillGradientItemType) + : NameOrIndex(nWhich, -1, eItemType) {} + XFillGradientItem(sal_Int32 nIndex, + const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT, + SfxItemType eItemType = SfxItemType::XFillGradientItemType); + XFillGradientItem(const OUString& rName, + const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT, + SfxItemType eItemType = SfxItemType::XFillGradientItemType); + XFillGradientItem(const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich = XATTR_FILLGRADIENT, + SfxItemType eItemType = SfxItemType::XFillGradientItemType); + XFillGradientItem(const XFillGradientItem& rItem); virtual bool operator==(const SfxPoolItem& rItem) const override; virtual XFillGradientItem* Clone(SfxItemPool* pPool = nullptr) const override; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 22998fc08feb..09513fe6ddc9 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1425,8 +1425,20 @@ bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItem return false; } + SfxItemType eItemType; + switch (nWID) + { + case XATTR_FILLBITMAP: eItemType = SfxItemType::XFillBitmapItemType; break; + case XATTR_FILLGRADIENT: eItemType = SfxItemType::XFillGradientItemType; break; + case XATTR_FILLHATCH: eItemType = SfxItemType::XFillHatchItemType; break; + case XATTR_FILLFLOATTRANSPARENCE: eItemType = SfxItemType::XFillFloatTransparenceItemType; break; + case XATTR_LINEEND: eItemType = SfxItemType::XLineEndItemType; break; + case XATTR_LINESTART: eItemType = SfxItemType::XLineStartItemType; break; + case XATTR_LINEDASH: eItemType = SfxItemType::XLineDashItemType; break; + default: assert(false); abort(); + } ItemSurrogates aSurrogates; - rSet.GetPool()->GetItemSurrogates(aSurrogates, nWID); + rSet.GetPool()->GetItemSurrogatesForItem(aSurrogates, eItemType); for (const SfxPoolItem* p : aSurrogates) { const NameOrIndex* pItem = static_cast<const NameOrIndex*>(p); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 79b38289d65f..631eea814f9b 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2208,15 +2208,19 @@ bool XSecondaryFillColorItem::GetPresentation SfxPoolItem* XFillGradientItem::CreateDefault() { return new XFillGradientItem; } XFillGradientItem::XFillGradientItem(sal_Int32 nIndex, - const basegfx::BGradient& rTheGradient) : - NameOrIndex(XATTR_FILLGRADIENT, nIndex, SfxItemType::XFillGradientItemType), + const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich, + SfxItemType eItemType) : + NameOrIndex(nWhich, nIndex, eItemType), m_aGradient(rTheGradient) { } XFillGradientItem::XFillGradientItem(const OUString& rName, - const basegfx::BGradient& rTheGradient, TypedWhichId<XFillGradientItem> nWhich) - : NameOrIndex(nWhich, rName, SfxItemType::XFillGradientItemType) + const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich, + SfxItemType eItemType) + : NameOrIndex(nWhich, rName, eItemType) , m_aGradient(rTheGradient) { } @@ -2227,8 +2231,10 @@ XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) : { } -XFillGradientItem::XFillGradientItem( const basegfx::BGradient& rTheGradient ) -: NameOrIndex( XATTR_FILLGRADIENT, -1, SfxItemType::XFillGradientItemType ), +XFillGradientItem::XFillGradientItem( const basegfx::BGradient& rTheGradient, + TypedWhichId<XFillGradientItem> nWhich, + SfxItemType eItemType ) +: NameOrIndex( nWhich, -1, eItemType ), m_aGradient(rTheGradient) { } @@ -2502,36 +2508,32 @@ boost::property_tree::ptree XFillGradientItem::dumpAsJSON() const SfxPoolItem* XFillFloatTransparenceItem::CreateDefault() { return new XFillFloatTransparenceItem; } XFillFloatTransparenceItem::XFillFloatTransparenceItem() : + XFillGradientItem(XATTR_FILLFLOATTRANSPARENCE, SfxItemType::XFillFloatTransparenceItemType), bEnabled( false ) { - SetWhich( XATTR_FILLFLOATTRANSPARENCE ); } XFillFloatTransparenceItem::XFillFloatTransparenceItem(const OUString& rName, const basegfx::BGradient& rGradient, bool bEnable ) : - XFillGradientItem ( rName, rGradient ), + XFillGradientItem ( rName, rGradient, XATTR_FILLFLOATTRANSPARENCE, SfxItemType::XFillFloatTransparenceItemType ), bEnabled ( bEnable ) { - SetWhich( XATTR_FILLFLOATTRANSPARENCE ); } XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) : XFillGradientItem ( rItem ), bEnabled ( rItem.bEnabled ) { - SetWhich( XATTR_FILLFLOATTRANSPARENCE ); } XFillFloatTransparenceItem::XFillFloatTransparenceItem(const basegfx::BGradient& rTheGradient, bool bEnable ) -: XFillGradientItem ( -1, rTheGradient ), +: XFillGradientItem ( -1, rTheGradient, XATTR_FILLFLOATTRANSPARENCE, SfxItemType::XFillFloatTransparenceItemType ), bEnabled ( bEnable ) { - SetWhich( XATTR_FILLFLOATTRANSPARENCE ); } bool XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const { - return ( NameOrIndex::operator==(rItem) ) && - ( GetGradientValue() == static_cast<const XFillGradientItem&>(rItem).GetGradientValue() ) && + return ( XFillGradientItem::operator==(rItem) ) && ( bEnabled == static_cast<const XFillFloatTransparenceItem&>(rItem).bEnabled ); } |