summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2001-04-19 17:49:33 +0000
committerNiklas Nebel <nn@openoffice.org>2001-04-19 17:49:33 +0000
commit48e17cb04d83b6b50522503f849555ff289544ed (patch)
tree0b67fd1592cd94a4931d90fd5a862ef54af2dee8 /sc
parenta8b65dc45b0b43f3417b4974c00fff9c5b09be6f (diff)
DeleteUnchanged: handle default items
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/patattr.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 9ea5f34e51b9..5a20c4ba2ae8 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: patattr.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: nn $ $Date: 2000-11-30 20:27:25 $
+ * last change: $Author: nn $ $Date: 2001-04-19 18:49:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -670,15 +670,30 @@ void ScPatternAttr::FillEditParaItems( SfxItemSet* pEditSet ) const
void ScPatternAttr::DeleteUnchanged( const ScPatternAttr* pOldAttrs )
{
- SfxItemSet* pSet = &GetItemSet();
- const SfxItemSet* pOldSet = &pOldAttrs->GetItemSet();
+ SfxItemSet& rThisSet = GetItemSet();
+ const SfxItemSet& rOldSet = pOldAttrs->GetItemSet();
+
+ const SfxPoolItem* pThisItem;
+ const SfxPoolItem* pOldItem;
for ( USHORT nWhich=ATTR_PATTERN_START; nWhich<=ATTR_PATTERN_END; nWhich++ )
{
- const SfxPoolItem* pItem1 = &pSet->Get( nWhich );
- const SfxPoolItem* pItem2 = &pOldSet->Get( nWhich );
- if ( pItem1 == pItem2 )
- pSet->ClearItem( nWhich );
+ // only items that are set are interesting
+ if ( rThisSet.GetItemState( nWhich, FALSE, &pThisItem ) == SFX_ITEM_SET )
+ {
+ if ( rOldSet.GetItemState( nWhich, TRUE, &pOldItem ) == SFX_ITEM_SET )
+ {
+ // item is set in OldAttrs (or its parent) -> compare pointers
+ if ( pThisItem == pOldItem )
+ rThisSet.ClearItem( nWhich );
+ }
+ else
+ {
+ // not set in OldAttrs -> compare item value to default item
+ if ( *pThisItem == rThisSet.GetPool()->GetDefaultItem( nWhich ) )
+ rThisSet.ClearItem( nWhich );
+ }
+ }
}
}