diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/sdr/properties/pageproperties.hxx | 3 | ||||
-rw-r--r-- | svx/inc/svx/sdr/properties/properties.hxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/properties/defaultproperties.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/properties/pageproperties.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/properties/properties.cxx | 30 |
5 files changed, 46 insertions, 1 deletions
diff --git a/svx/inc/svx/sdr/properties/pageproperties.hxx b/svx/inc/svx/sdr/properties/pageproperties.hxx index 592bc38612f5..0e87ccc543d8 100644 --- a/svx/inc/svx/sdr/properties/pageproperties.hxx +++ b/svx/inc/svx/sdr/properties/pageproperties.hxx @@ -46,6 +46,9 @@ namespace sdr // Do the ItemChange, may do special handling virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0); + // Called after ItemChange() is done for all items. + virtual void PostItemChange(const sal_uInt16 nWhich); + public: // basic constructor PageProperties(SdrObject& rObj); diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx index eb4cb69fb33a..a6a202f733df 100644 --- a/svx/inc/svx/sdr/properties/properties.hxx +++ b/svx/inc/svx/sdr/properties/properties.hxx @@ -188,6 +188,10 @@ namespace sdr // default implementation returns 0 (zero) virtual sal_uInt32 getVersion() const; }; + + // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items + void SVX_DLLPUBLIC CleanupFillProperties( SfxItemSet& rItemSet ); + } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index c03bf92928ef..aa6b10c1582e 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -203,8 +203,10 @@ namespace sdr { } - void DefaultProperties::PostItemChange(const sal_uInt16 /*nWhich*/) + void DefaultProperties::PostItemChange(const sal_uInt16 nWhich ) { + if( (nWhich == XATTR_FILLSTYLE) && (mpItemSet != NULL) ) + CleanupFillProperties(*mpItemSet); } void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/) diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx index 7db4cc365016..7ecaab9b2843 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -88,6 +88,12 @@ namespace sdr return 0L; } + void PageProperties::PostItemChange(const sal_uInt16 nWhich ) + { + if( (nWhich == XATTR_FILLSTYLE) && (mpEmptyItemSet != NULL) ) + CleanupFillProperties(*mpEmptyItemSet); + } + void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/) { // simply ignore item clearing on page objects diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 028440216e34..ce3b99968e65 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -31,6 +31,7 @@ #include <svl/itemset.hxx> #include <svx/svdogrp.hxx> #include <svx/svditer.hxx> +#include <svx/xfillit0.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -181,6 +182,35 @@ namespace sdr { return 0; } + + void CleanupFillProperties( SfxItemSet& rItemSet ) + { + const bool bFillBitmap = rItemSet.GetItemState(XATTR_FILLBITMAP, sal_False) == SFX_ITEM_SET; + const bool bFillGradient = rItemSet.GetItemState(XATTR_FILLGRADIENT, sal_False) == SFX_ITEM_SET; + const bool bFillHatch = rItemSet.GetItemState(XATTR_FILLHATCH, sal_False) == SFX_ITEM_SET; + if( bFillBitmap || bFillGradient || bFillHatch ) + { + const XFillStyleItem* pFillStyleItem = dynamic_cast< const XFillStyleItem* >( rItemSet.GetItem(XATTR_FILLSTYLE) ); + if( pFillStyleItem ) + { + if( bFillBitmap && (pFillStyleItem->GetValue() != XFILL_BITMAP) ) + { + rItemSet.ClearItem( XATTR_FILLBITMAP ); + } + + if( bFillGradient && (pFillStyleItem->GetValue() != XFILL_GRADIENT) ) + { + rItemSet.ClearItem( XATTR_FILLGRADIENT ); + } + + if( bFillHatch && (pFillStyleItem->GetValue() != XFILL_HATCH) ) + { + rItemSet.ClearItem( XATTR_FILLHATCH ); + } + } + } + } + } // end of namespace properties } // end of namespace sdr |