diff options
author | Christian Lippka ORACLE <christian.lippka@oracle.com> | 2011-03-04 21:31:20 +0100 |
---|---|---|
committer | Christian Lippka ORACLE <christian.lippka@oracle.com> | 2011-03-04 21:31:20 +0100 |
commit | 4dd279e328c9f21bc435a5da9b0bb77823faae46 (patch) | |
tree | 4198ea8791fb06289ea43ab9120a69df28e9f148 /svx | |
parent | cd0d6a5a6775f197fdb7e78b54c8133074a7a236 (diff) |
impress210: #i50899# clean up fill attributes if fill style changes
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 d85686b3bc5b..9dbbc645d9be 100644 --- a/svx/inc/svx/sdr/properties/pageproperties.hxx +++ b/svx/inc/svx/sdr/properties/pageproperties.hxx @@ -45,6 +45,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 311c2ccfd1a5..99ebdfbb1be9 100644 --- a/svx/inc/svx/sdr/properties/properties.hxx +++ b/svx/inc/svx/sdr/properties/properties.hxx @@ -187,6 +187,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 7d51b26a0051..41149a965248 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -204,8 +204,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 2fc92633b953..c1d0467b740e 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -89,6 +89,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 f8c307f26309..0439fd6baf4c 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -32,6 +32,7 @@ #include <svl/itemset.hxx> #include <svx/svdogrp.hxx> #include <svx/svditer.hxx> +#include <svx/xfillit0.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -182,6 +183,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 |