diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-15 04:48:25 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-16 13:24:09 +0100 |
commit | f2993962fdac764026ec60239ad7229cbc1cbe85 (patch) | |
tree | b2a816003a796186aab40318b9347fc591e74bd8 | |
parent | 2c93ae21a3883bf23b867c7bbc0cbb742de183bf (diff) |
use SwIterator<>
Change-Id: I87c0385bba8de804c63dd5d908d9efb6959016c9
-rw-r--r-- | sw/source/core/docnode/section.cxx | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 37289e46c1b2..b101800029ea 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -951,58 +951,14 @@ void SwSectionFmt::UpdateParent() const SwFmtEditInReadonly* pEditInReadonly = 0; bool bIsHidden = false; - SwClientIter aIter( *this ); // TODO - ::SwClient * pLast = aIter.GoStart(); - if( pLast ) // Could we jump to the beginning? - do { - if( pLast->IsA( TYPE(SwSectionFmt) ) ) - { - if( !pSection ) - { - pSection = GetSection(); - if( GetRegisteredIn() ) - { - const SwSection* pPS = GetParentSection(); - pProtect = &pPS->GetFmt()->GetProtect(); - // edit in readonly sections - pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly(); - bIsHidden = pPS->IsHiddenFlag(); - } - else - { - pProtect = &GetProtect(); - // edit in readonly sections - pEditInReadonly = &GetEditInReadonly(); - bIsHidden = pSection->IsHidden(); - } - } - if (!pProtect->IsCntntProtected() != - !pSection->IsProtectFlag()) - { - pLast->ModifyNotification( (SfxPoolItem*)pProtect, - (SfxPoolItem*)pProtect ); - } - - // edit in readonly sections - if (!pEditInReadonly->GetValue() != - !pSection->IsEditInReadonlyFlag()) - { - pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly, - (SfxPoolItem*)pEditInReadonly ); - } - - if( bIsHidden == pSection->IsHiddenFlag() ) - { - SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden - ? RES_SECTION_HIDDEN - : RES_SECTION_NOT_HIDDEN ) ); - pLast->ModifyNotification( &aMsgItem, &aMsgItem ); - } - } - else if( !pSection && - pLast->IsA( TYPE(SwSection) ) ) + SwIterator<SwClient,SwSectionFmt> aIter(*this); + for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) + { + if( pLast->IsA( TYPE(SwSectionFmt) ) ) + { + if( !pSection ) { - pSection = static_cast<SwSection*>(pLast); + pSection = GetSection(); if( GetRegisteredIn() ) { const SwSection* pPS = GetParentSection(); @@ -1019,7 +975,50 @@ void SwSectionFmt::UpdateParent() bIsHidden = pSection->IsHidden(); } } - } while( 0 != ( pLast = ++aIter )); + if (!pProtect->IsCntntProtected() != + !pSection->IsProtectFlag()) + { + pLast->ModifyNotification( (SfxPoolItem*)pProtect, + (SfxPoolItem*)pProtect ); + } + + // edit in readonly sections + if (!pEditInReadonly->GetValue() != + !pSection->IsEditInReadonlyFlag()) + { + pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly, + (SfxPoolItem*)pEditInReadonly ); + } + + if( bIsHidden == pSection->IsHiddenFlag() ) + { + SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden + ? RES_SECTION_HIDDEN + : RES_SECTION_NOT_HIDDEN ) ); + pLast->ModifyNotification( &aMsgItem, &aMsgItem ); + } + } + else if( !pSection && + pLast->IsA( TYPE(SwSection) ) ) + { + pSection = static_cast<SwSection*>(pLast); + if( GetRegisteredIn() ) + { + const SwSection* pPS = GetParentSection(); + pProtect = &pPS->GetFmt()->GetProtect(); + // edit in readonly sections + pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly(); + bIsHidden = pPS->IsHiddenFlag(); + } + else + { + pProtect = &GetProtect(); + // edit in readonly sections + pEditInReadonly = &GetEditInReadonly(); + bIsHidden = pSection->IsHidden(); + } + } + } } SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways) |