summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorChristian Lippka ORACLE <christian.lippka@oracle.com>2011-12-06 02:24:51 +0100
committerThorsten Behrens <tbehrens@suse.com>2011-12-06 09:39:11 +0100
commitb7540a2bfe424ff761f6bfd1e7264349c83e3f59 (patch)
tree669a489a806fc47623ae8fa55f217eccb67b4d4c /svx
parent416435e1dcbc175787a5a9e03142f7f766b6a648 (diff)
impress210: #i50899# clean up fill attributes if fill style changes
# HG changeset patch # User Christian Lippka ORACLE <christian.lippka@oracle.com> # Date 1299270680 -3600 # Node ID 69091b8fc77c9951fcdc52b800a37a92dc70bf84 # Parent 20c5c9384888da33596d864251881e6e46bdd339 impress210: #i50899# clean up fill attributes if fill style changes
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/sdr/properties/pageproperties.hxx3
-rw-r--r--svx/inc/svx/sdr/properties/properties.hxx4
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx4
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx6
-rw-r--r--svx/source/sdr/properties/properties.cxx30
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