diff options
Diffstat (limited to 'sw/source/core/layout/sectfrm.cxx')
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index da6ed20bf45d..5d82ba9e13ee 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <svl/smplhint.hxx> #include <svl/itemiter.hxx> #include <hints.hxx> #include <txtftn.hxx> @@ -54,6 +54,7 @@ #include "layouter.hxx" // SwLayouter #include "dbg_lay.hxx" #include "viewsh.hxx" +#include "viewopt.hxx" #include "viewimp.hxx" #include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> @@ -74,8 +75,8 @@ SV_IMPL_PTRARR_SORT( SwDestroyList, SwSectionFrmPtr ) |* Letzte Aenderung AMA 26. Nov. 97 |* |*************************************************************************/ -SwSectionFrm::SwSectionFrm( SwSection &rSect ) : - SwLayoutFrm( rSect.GetFmt() ), +SwSectionFrm::SwSectionFrm( SwSection &rSect, SwFrm* pSib ) : + SwLayoutFrm( rSect.GetFmt(), pSib ), SwFlowFrm( (SwFrm&)*this ), pSection( &rSect ) { @@ -86,7 +87,7 @@ SwSectionFrm::SwSectionFrm( SwSection &rSect ) : } SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, sal_Bool bMaster ) : - SwLayoutFrm( rSect.GetFmt() ), + SwLayoutFrm( rSect.GetFmt(), rSect.getRootFrm() ), SwFlowFrm( (SwFrm&)*this ), pSection( rSect.GetSection() ) { @@ -152,9 +153,9 @@ SwSectionFrm::~SwSectionFrm() { if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() ) { - SwRootFrm *pRootFrm = GetFmt()->GetDoc()->GetRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm ) - pRootFrm->RemoveFromList( this ); + pRootFrm->RemoveFromList( this ); //swmod 071108//swmod 071225 if( IsFollow() ) { SwSectionFrm *pMaster = FindMaster(); @@ -202,7 +203,7 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove ) // Relation CONTENT_FLOWS_FROM for current next paragraph will change // and relation CONTENT_FLOWS_TO for current previous paragraph will change. { - ViewShell* pViewShell( GetShell() ); + ViewShell* pViewShell( getRootFrm()->GetCurrShell() ); if ( pViewShell && pViewShell->GetLayout() && pViewShell->GetLayout()->IsAnyShellAccessible() ) { @@ -237,11 +238,11 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove ) { // Wenn wir bereits halbtot waren vor diesem DelEmpty, so // stehen wir vermutlich auch in der Liste und muessen uns // dort austragen - if( !pSection ) - GetFmt()->GetDoc()->GetRootFrm()->RemoveFromList( this ); + if( !pSection && getRootFrm() ) + getRootFrm()->RemoveFromList( this ); } - else - GetFmt()->GetDoc()->GetRootFrm()->InsertEmptySct( this ); + else if( getRootFrm() ) + getRootFrm()->InsertEmptySct( this ); //swmod 071108//swmod 071225 pSection = NULL; // damit ist allerdings eine Reanimierung quasi ausgeschlossen } } @@ -398,7 +399,7 @@ void SwSectionFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) } } pParent = pSect; - pSect = new SwSectionFrm( *((SwSectionFrm*)pParent)->GetSection() ); + pSect = new SwSectionFrm( *((SwSectionFrm*)pParent)->GetSection(), pParent ); // Wenn pParent in zwei Teile zerlegt wird, so muss sein Follow am // neuen, zweiten Teil angebracht werden. pSect->SetFollow( ((SwSectionFrm*)pParent)->GetFollow() ); @@ -558,7 +559,7 @@ sal_Bool SwSectionFrm::SplitSect( SwFrm* pFrm, sal_Bool bApres ) ASSERT( pSav, "SplitSect: What's on?" ); if( pSav ) // Robust { // Einen neuen SctFrm anlegen, nicht als Follow/Master - SwSectionFrm* pNew = new SwSectionFrm( *pSect->GetSection() ); + SwSectionFrm* pNew = new SwSectionFrm( *pSect->GetSection(), pSect ); pNew->InsertBehind( pSect->GetUpper(), pSect ); pNew->Init(); SWRECTFN( this ) @@ -752,7 +753,7 @@ void SwSectionFrm::MoveCntntAndDelete( SwSectionFrm* pDel, sal_Bool bSave ) // vom gleichen Parent abgeleitet ist. // Dann gibt es (noch) keinen Teil unseres Parents, der den Inhalt // aufnehmen kann,also bauen wir ihn uns. - pPrvSct = new SwSectionFrm( *pParent->GetSection() ); + pPrvSct = new SwSectionFrm( *pParent->GetSection(), pUp ); pPrvSct->InsertBehind( pUp, pPrv ); pPrvSct->Init(); SWRECTFN( pUp ) @@ -786,7 +787,7 @@ void SwSectionFrm::MakeAll() return; if( !pSection ) // Durch DelEmpty { - ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); + ASSERT( getRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); if( !bValidPos ) { if( GetUpper() ) @@ -810,7 +811,8 @@ void SwSectionFrm::MakeAll() // OD 2004-03-15 #116561# - In online layout join the follows, if section // can grow. - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() && ( Grow( LONG_MAX, true ) > 0 ) ) { while( GetFollow() ) @@ -1332,8 +1334,7 @@ void SwSectionFrm::Format( const SwBorderAttrs *pAttr ) { if( !pSection ) // Durch DelEmpty { - ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), - "SectionFrm without Section" ); + ASSERT( getRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); bValidSize = bValidPos = bValidPrtArea = sal_True; return; } @@ -1409,7 +1410,8 @@ void SwSectionFrm::Format( const SwBorderAttrs *pAttr ) // OD 15.10.2002 #103517# - allow grow in online layout // Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling // method <_CheckClipping(..)>. - _CheckClipping( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE), bMaximize ); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + _CheckClipping( pSh && pSh->GetViewOptions()->getBrowseMode(), bMaximize ); bMaximize = ToMaximize( sal_False ); bValidSize = sal_True; } @@ -2041,9 +2043,14 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, sal_Bool bTst ) sal_Bool bInCalcCntnt = GetUpper() && IsInFly() && FindFlyFrm()->IsLocked(); // OD 2004-03-15 #116561# - allow grow in online layout - if ( !Lower() || !Lower()->IsColumnFrm() || !Lower()->GetNext() || - GetSection()->GetFmt()->GetBalancedColumns().GetValue() || - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + sal_Bool bGrow = !Lower() || !Lower()->IsColumnFrm() || !Lower()->GetNext() || + GetSection()->GetFmt()->GetBalancedColumns().GetValue(); + if( !bGrow ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + bGrow = pSh && pSh->GetViewOptions()->getBrowseMode(); + } + if( bGrow ) { SwTwips nGrow; if( IsInFtn() ) @@ -2435,7 +2442,7 @@ void SwSectionFrm::CalcEndAtEndFlag() |* |*************************************************************************/ -void SwSectionFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwSectionFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; @@ -2470,7 +2477,16 @@ void SwSectionFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) } } -void SwSectionFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, +void SwSectionFrm::SwClientNotify( const SwModify& rMod, const SfxHint& rHint ) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING && &rMod == GetRegisteredIn() ) + { + SwSectionFrm::MoveCntntAndDelete( this, sal_True ); + } +} + +void SwSectionFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) { @@ -2561,7 +2577,7 @@ void SwSectionFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, case RES_PROTECT: { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this ); } @@ -2755,7 +2771,7 @@ void SwRootFrm::_DeleteEmptySct() if( pUp && !pUp->Lower() ) { if( pUp->IsPageBodyFrm() ) - pUp->FindRootFrm()->SetSuperfluous(); + pUp->getRootFrm()->SetSuperfluous(); else if( pUp->IsFtnFrm() && !pUp->IsColLocked() && pUp->GetUpper() ) { |