diff options
author | Christian Lippka <cl@openoffice.org> | 2000-09-29 11:52:40 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2000-09-29 11:52:40 +0000 |
commit | 18c26c91727ee408f67674be38396d1ab4290f9f (patch) | |
tree | d60d50220a6d05e3355f4212188ba20b42ca5fc1 /sd | |
parent | 7fed2adbfc3ac17fa926b6c9407795c8eaf845b2 (diff) |
#78600# invalidate page background when document is gone
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 35 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.hxx | 11 |
3 files changed, 47 insertions, 19 deletions
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 534936cccb98..c50733b260bd 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unopage.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:48:42 $ + * last change: $Author: cl $ $Date: 2000-09-29 12:52:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -565,11 +565,11 @@ uno::Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyN break; case WID_PAGE_PREVIEW : { - SdDrawDocShell* pDocShell = ((SdDrawDocument*)mpPage->GetModel())->GetDocSh(); - if ( pDocShell ) + SdDrawDocument* pDoc = (SdDrawDocument*)mpPage->GetModel(); + if ( pDoc ) { - SdDrawDocument* pDoc = pDocShell->GetDoc(); - if ( pDoc ) + SdDrawDocShell* pDocShell = pDoc->GetDocSh(); + if ( pDocShell ) { sal_uInt16 nPgNum = 0; sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD ); @@ -1297,7 +1297,7 @@ void SdDrawPage::setBackground( const uno::Any& rValue ) if( pBack ) { - pBack->fillItemSet( aSet ); + pBack->fillItemSet( (SdDrawDocument*)mpPage->GetModel(), aSet ); } else { @@ -1321,7 +1321,7 @@ void SdDrawPage::setBackground( const uno::Any& rValue ) pProp++; } - pBackground->fillItemSet( aSet ); + pBackground->fillItemSet( (SdDrawDocument*)mpPage->GetModel(), aSet ); } pObj->NbcSetAttributes( aSet, sal_False ); @@ -1599,7 +1599,7 @@ void SdMasterPage::setBackground( const uno::Any& rValue ) if( pBack ) { - pBack->fillItemSet( aSet ); + pBack->fillItemSet( (SdDrawDocument*)mpPage->GetModel(), aSet ); } else { @@ -1623,7 +1623,7 @@ void SdMasterPage::setBackground( const uno::Any& rValue ) pProp++; } - pBackground->fillItemSet( aSet ); + pBackground->fillItemSet( (SdDrawDocument*)mpPage->GetModel(), aSet ); } pObj->NbcSetAttributes( aSet, sal_False ); diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 63c34f28650e..bb762d09c268 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unopback.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:48:43 $ + * last change: $Author: cl $ $Date: 2000-09-29 12:52:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,10 +102,11 @@ const SfxItemPropertyMap* ImplGetPageBackgroundPropertyMap() UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground ); SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc /* = NULL */, SdrObject* pObj /* = NULL */ ) throw() -: maPropSet( ImplGetPageBackgroundPropertyMap() ), mpSet( NULL ) +: maPropSet( ImplGetPageBackgroundPropertyMap() ), mpSet( NULL ), mpDoc( pDoc ) { - if( pObj ) + if( pObj && pDoc ) { + StartListening( *pDoc ); mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILLRESERVED_LAST ); pObj->TakeAttributes( *mpSet, sal_False, sal_False ); } @@ -113,16 +114,40 @@ SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc /* = NULL */, Sdr SdUnoPageBackground::~SdUnoPageBackground() throw() { + if( mpDoc ) + EndListening( *mpDoc ); + if( mpSet ) delete mpSet; } -void SdUnoPageBackground::fillItemSet( SfxItemSet& rSet ) throw() +void SdUnoPageBackground::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); + + if( pSdrHint ) + { + // delete item set if document is dying because then the pool + // will also die + if( pSdrHint->GetKind() == HINT_MODELCLEARED ) + { + delete mpSet; + mpSet = NULL; + mpDoc = NULL; + } + } + +} + +void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw() { rSet.ClearItem(); if( mpSet == NULL ) { + StartListening( *pDoc ); + mpDoc = pDoc; + mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); if( maPropSet.AreThereOwnUsrAnys() ) diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx index dee5e614858d..37ee7e70eb14 100644 --- a/sd/source/ui/unoidl/unopback.hxx +++ b/sd/source/ui/unoidl/unopback.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unopback.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:48:43 $ + * last change: $Author: cl $ $Date: 2000-09-29 12:52:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,11 +91,13 @@ class SdUnoPageBackground : public ::cppu::WeakImplHelper4< ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::beans::XPropertyState, - ::com::sun::star::lang::XUnoTunnel> + ::com::sun::star::lang::XUnoTunnel>, + public SfxListener { protected: SvxItemPropertySet maPropSet; SfxItemSet* mpSet; + SdrModel* mpDoc; const SfxItemPropertyMap* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw(); public: @@ -103,7 +105,8 @@ public: ~SdUnoPageBackground() throw(); // internal - void fillItemSet( SfxItemSet& rSet ) throw(); + void fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); // uno helper UNO3_GETIMPLEMENTATION_DECL( SdUnoPageBackground ) |