diff options
Diffstat (limited to 'sw/source/core/layout')
26 files changed, 983 insertions, 1010 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index e56c34c4bff1..d95185064f6b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -99,22 +99,17 @@ #include <unoframe.hxx> #include <unotextbodyhf.hxx> #include <SwStyleNameMapper.hxx> -/// OD 22.08.2002 #99657# -/// include definition of class SvxBrushItem and GraphicObject -/// in order to determine, if background is transparent. #include <editeng/brshitem.hxx> #include <svtools/grfmgr.hxx> - #include <cmdid.h> #include <unomid.h> #include <comcore.hrc> #include <svx/svdundo.hxx> // #111827# -// OD 2004-05-24 #i28701# #include <sortedobjs.hxx> -// --> OD 2006-03-06 #125892# #include <HandleAnchorNodeChg.hxx> -// <-- #include <svl/cjkoptions.hxx> +#include <switerator.hxx> +#include <pagedeschint.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -190,7 +185,7 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) { // Klammer, weil im DTOR SwClientIter das Flag bTreeChg zurueck // gesetzt wird. Unguenstig, wenn das Format vorher zerstoert wird. - SwClientIter aIter( *pFmt ); + SwClientIter aIter( *pFmt ); // TODO SwClient *pLast = aIter.GoStart(); if( pLast ) do { @@ -224,16 +219,12 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) if ( pNode->IsCntntNode() && ((SwCntntNode*)pNode)->GetDepends() ) { - SwClientIter aIter( *(SwCntntNode*)pNode ); - do + SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>::FirstElement( *(SwCntntNode*)pNode ); + if( pShell ) { - if( aIter()->ISA( SwCrsrShell ) ) - { - ((SwCrsrShell*)aIter())->ParkCrsr( aIdx ); + pShell->ParkCrsr( aIdx ); aIdx = nEnd-1; - break; - } - } while ( aIter++ ); + } } aIdx++; pNode = & aIdx.GetNode(); @@ -533,7 +524,7 @@ SwFmtHeader::SwFmtHeader( sal_Bool bOn ) int SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const { ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); - return ( pRegisteredIn == ((SwFmtHeader&)rAttr).GetRegisteredIn() && + return ( GetRegisteredIn() == ((SwFmtHeader&)rAttr).GetRegisteredIn() && bActive == ((SwFmtHeader&)rAttr).IsActive() ); } @@ -542,6 +533,11 @@ SfxPoolItem* SwFmtHeader::Clone( SfxItemPool* ) const return new SwFmtHeader( *this ); } +void SwFmtHeader::RegisterToFormat( SwFmt& rFmt ) +{ + rFmt.Add(this); +} + // class SwFmtFooter // Implementierung teilweise inline im hxx @@ -572,10 +568,15 @@ SwFmtFooter::SwFmtFooter( sal_Bool bOn ) DelHFFormat( this, GetFooterFmt() ); } +void SwFmtFooter::RegisterToFormat( SwFmt& rFmt ) +{ + rFmt.Add(this); +} + int SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const { ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); - return ( pRegisteredIn == ((SwFmtFooter&)rAttr).GetRegisteredIn() && + return ( GetRegisteredIn() == ((SwFmtFooter&)rAttr).GetRegisteredIn() && bActive == ((SwFmtFooter&)rAttr).IsActive() ); } @@ -649,6 +650,11 @@ SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc ) SwFmtPageDesc::~SwFmtPageDesc() {} +bool SwFmtPageDesc::KnowsPageDesc() const +{ + return (GetRegisteredIn() != 0); +} + int SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const { ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); @@ -662,7 +668,39 @@ SfxPoolItem* SwFmtPageDesc::Clone( SfxItemPool* ) const return new SwFmtPageDesc( *this ); } -void SwFmtPageDesc::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) +void SwFmtPageDesc::SwClientNotify( const SwModify&, const SfxHint& rHint ) +{ + const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint); + if ( pHint ) + { + // mba: shouldn't that be broadcasted also? + SwFmtPageDesc aDfltDesc( pHint->GetPageDesc() ); + SwPageDesc* pDesc = pHint->GetPageDesc(); + const SwModify* pMod = GetDefinedIn(); + if ( pMod ) + { + if( pMod->ISA( SwCntntNode ) ) + ((SwCntntNode*)pMod)->SetAttr( aDfltDesc ); + else if( pMod->ISA( SwFmt )) + ((SwFmt*)pMod)->SetFmtAttr( aDfltDesc ); + else + { + DBG_ERROR( "What kind of SwModify is this?" ); + RegisterToPageDesc( *pDesc ); + } + } + else + // there could be an Undo-copy + RegisterToPageDesc( *pDesc ); + } +} + +void SwFmtPageDesc::RegisterToPageDesc( SwPageDesc& rDesc ) +{ + rDesc.Add( this ); +} + +void SwFmtPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { if( !pDefinedIn ) return; @@ -2438,7 +2476,7 @@ SfxPoolItem* SwHeaderAndFooterEatSpacingItem::Clone( SfxItemPool* ) const TYPEINIT1( SwFrmFmt, SwFmt ); IMPL_FIXEDMEMPOOL_NEWDEL_DLL( SwFrmFmt, 20, 20 ) -void SwFrmFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) +void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { SwFmtHeader *pH = 0; SwFmtFooter *pF = 0; @@ -2460,13 +2498,13 @@ void SwFrmFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) if( pH && pH->IsActive() && !pH->GetHeaderFmt() ) { //Hat er keinen, mach ich ihm einen SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_HEADER, 0 ); - pFmt->Add( pH ); + pH->RegisterToFormat( *pFmt ); } if( pF && pF->IsActive() && !pF->GetFooterFmt() ) { //Hat er keinen, mach ich ihm einen SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_FOOTER, 0 ); - pFmt->Add( pF ); + pF->RegisterToFormat( *pFmt ); } // MIB 24.3.98: Modify der Basisklasse muss immer gerufen werden, z.B. @@ -2480,20 +2518,22 @@ void SwFrmFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } } +void SwFrmFmt::RegisterToFormat( SwFmt& rFmt ) +{ + rFmt.Add( this ); +} + //Vernichtet alle Frms, die in aDepend angemeldet sind. void SwFrmFmt::DelFrms() { - SwClientIter aIter( *this ); - SwClient * pLast = aIter.GoStart(); + SwIterator<SwFrm,SwFmt> aIter( *this ); + SwFrm * pLast = aIter.First(); if( pLast ) do { - if ( pLast->ISA(SwFrm) ) - { - ((SwFrm*)pLast)->Cut(); + pLast->Cut(); delete pLast; - } - } while( 0 != ( pLast = aIter++ )); + } while( 0 != ( pLast = aIter.Next() )); } void SwFrmFmt::MakeFrms() @@ -2517,7 +2557,7 @@ SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint, SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 ); pFrm = aTmp.NextFrm(); - if( pFrm && pFrm->GetRegisteredIn() != this ) + if( pFrm && !pFrm->KnowsFormat(*this) ) { // die Section hat keinen eigenen frame::Frame, also falls // jemand die tatsaechliche Groe?e braucht, so muss das @@ -2539,7 +2579,7 @@ SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint, else { sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; - pFrm = ::GetFrmOfModify( *(SwModify*)this, nFrmType, pPoint, + pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, nFrmType, pPoint, 0, bCalcFrm ); } @@ -2555,8 +2595,7 @@ SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint, SwContact* SwFrmFmt::FindContactObj() { - SwClientIter aIter( *this ); - return (SwContact*)aIter.First( TYPE( SwContact ) ); + return SwIterator<SwContact,SwFmt>::FirstElement( *this ); } SdrObject* SwFrmFmt::FindSdrObject() @@ -2573,7 +2612,7 @@ SdrObject* SwFrmFmt::FindRealSdrObject() if( RES_FLYFRMFMT == Which() ) { Point aNullPt; - SwFlyFrm* pFly = (SwFlyFrm*)::GetFrmOfModify( *this, FRM_FLY, + SwFlyFrm* pFly = (SwFlyFrm*)::GetFrmOfModify( 0, *this, FRM_FLY, &aNullPt, 0, sal_False ); return pFly ? pFly->GetVirtDrawObj() : 0; } @@ -2585,12 +2624,10 @@ sal_Bool SwFrmFmt::IsLowerOf( const SwFrmFmt& rFmt ) const { //Auch eine Verkettung von Innen nach aussen oder von aussen //nach innen ist nicht zulaessig. - SwClientIter aIter( *(SwModify*)this ); - SwFlyFrm *pSFly = (SwFlyFrm*)aIter.First( TYPE(SwFlyFrm) ); + SwFlyFrm *pSFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(*this); if( pSFly ) { - SwClientIter aOtherIter( (SwModify&)rFmt ); - SwFlyFrm *pAskFly = (SwFlyFrm*)aOtherIter.First( TYPE(SwFlyFrm) ); + SwFlyFrm *pAskFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(rFmt); if( pAskFly ) return pSFly->IsLowerOf( pAskFly ); } @@ -2672,22 +2709,20 @@ IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrmFmt, 10, 10 ) SwFlyFrmFmt::~SwFlyFrmFmt() { - SwClientIter aIter( *this ); - SwClient * pLast = aIter.GoStart(); + SwIterator<SwFlyFrm,SwFmt> aIter( *this ); + SwFlyFrm * pLast = aIter.First(); if( pLast ) do { - if ( pLast->ISA( SwFlyFrm ) ) delete pLast; + } while( 0 != ( pLast = aIter.Next() )); - } while( 0 != ( pLast = aIter++ )); - - pLast = aIter.GoStart(); - if( pLast ) + SwIterator<SwFlyDrawContact,SwFmt> a2ndIter( *this ); + SwFlyDrawContact* pC = a2ndIter.First(); + if( pC ) do { - if ( pLast->ISA( SwFlyDrawContact ) ) - delete pLast; + delete pC; - } while( 0 != ( pLast = aIter++ )); + } while( 0 != ( pC = a2ndIter.Next() )); } //Erzeugen der Frms wenn das Format einen Absatzgebundenen Rahmen beschreibt. @@ -2696,8 +2731,8 @@ SwFlyFrmFmt::~SwFlyFrmFmt() void SwFlyFrmFmt::MakeFrms() { // gibts ueberhaupt ein Layout ?? - if( !GetDoc()->GetRootFrm() ) - return; + if( !GetDoc()->GetCurrentViewShell() ) + return; //swmod 071108//swmod 071225 SwModify *pModify = 0; // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes. @@ -2730,8 +2765,7 @@ void SwFlyFrmFmt::MakeFrms() if ( pCNd ) // <-- { - SwClientIter aIter( *pCNd ); - if ( aIter.First( TYPE(SwFrm) ) ) + if( SwIterator<SwFrm,SwCntntNode>::FirstElement( *pCNd ) ) { pModify = pCNd; } @@ -2759,17 +2793,15 @@ void SwFlyFrmFmt::MakeFrms() case FLY_AT_PAGE: { sal_uInt16 nPgNum = aAnchorAttr.GetPageNum(); - SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetRootFrm()->Lower(); + SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetCurrentLayout()->Lower(); //swmod 080218 if( !nPgNum && aAnchorAttr.GetCntntAnchor() ) { SwCntntNode *pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); - SwClientIter aIter( *pCNd ); - do + SwIterator<SwFrm,SwCntntNode> aIter( *pCNd ); + for (SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { - if( aIter()->ISA( SwFrm ) ) - { - pPage = ((SwFrm*)aIter())->FindPageFrm(); + pPage = pFrm->FindPageFrm(); if( pPage ) { nPgNum = pPage->GetPhyPageNum(); @@ -2780,7 +2812,6 @@ void SwFlyFrmFmt::MakeFrms() } break; } - } while ( aIter++ ); } while ( pPage ) { @@ -2801,10 +2832,8 @@ void SwFlyFrmFmt::MakeFrms() if( pModify ) { - SwClientIter aIter( *pModify ); - for( SwFrm *pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) ); - pFrm; - pFrm = (SwFrm*)aIter.Next() ) + SwIterator<SwFrm,SwModify> aIter( *pModify ); + for( SwFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { sal_Bool bAdd = !pFrm->IsCntntFrm() || !((SwCntntFrm*)pFrm)->IsFollow(); @@ -2853,16 +2882,16 @@ void SwFlyFrmFmt::MakeFrms() switch( aAnchorAttr.GetAnchorId() ) { case FLY_AT_FLY: - pFly = new SwFlyLayFrm( this, pFrm ); + pFly = new SwFlyLayFrm( this, pFrm, pFrm ); break; case FLY_AT_PARA: case FLY_AT_CHAR: - pFly = new SwFlyAtCntFrm( this, pFrm ); + pFly = new SwFlyAtCntFrm( this, pFrm, pFrm ); break; case FLY_AS_CHAR: - pFly = new SwFlyInCntFrm( this, pFrm ); + pFly = new SwFlyInCntFrm( this, pFrm, pFrm ); break; default: ASSERT( !this, "Neuer Ankertyp" ) @@ -2879,7 +2908,7 @@ void SwFlyFrmFmt::MakeFrms() SwFlyFrm* SwFlyFrmFmt::GetFrm( const Point* pPoint, const sal_Bool bCalcFrm ) const { - return (SwFlyFrm*)::GetFrmOfModify( *(SwModify*)this, FRM_FLY, + return (SwFlyFrm*)::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY, pPoint, 0, bCalcFrm ); } @@ -2903,8 +2932,7 @@ sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const { case RES_CONTENT_VISIBLE: { - ((SwPtrMsgPoolItem&)rInfo).pObject = - SwClientIter( *(SwFlyFrmFmt*)this ).First( TYPE(SwFrm) ); + ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this ); } return sal_False; @@ -2930,7 +2958,7 @@ void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast ) SwStringMsgPoolItem aOld( RES_TITLE_CHANGED, pMasterObject->GetTitle() ); SwStringMsgPoolItem aNew( RES_TITLE_CHANGED, rTitle ); pMasterObject->SetTitle( rTitle ); - Modify( &aOld, &aNew ); + ModifyNotification( &aOld, &aNew ); } else { @@ -2966,7 +2994,7 @@ void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast SwStringMsgPoolItem aOld( RES_DESCRIPTION_CHANGED, pMasterObject->GetDescription() ); SwStringMsgPoolItem aNew( RES_DESCRIPTION_CHANGED, rDescription ); pMasterObject->SetDescription( rDescription ); - Modify( &aOld, &aNew ); + ModifyNotification( &aOld, &aNew ); } else { @@ -3074,33 +3102,32 @@ SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt, { // determine 'old' number of anchor frames sal_uInt32 nOldNumOfAnchFrm( 0L ); - SwClientIter aOldIter( *(aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) ); - for( aOldIter.First( TYPE(SwFrm) ); aOldIter(); aOldIter.Next() ) + SwIterator<SwFrm,SwCntntNode> aOldIter( *(aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) ); + for( SwFrm* pOld = aOldIter.First(); pOld; pOld = aOldIter.Next() ) { ++nOldNumOfAnchFrm; } // determine 'new' number of anchor frames sal_uInt32 nNewNumOfAnchFrm( 0L ); - SwClientIter aNewIter( *(_rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) ); - for( aNewIter.First( TYPE(SwFrm) ); aNewIter(); aNewIter.Next() ) + SwIterator<SwFrm,SwCntntNode> aNewIter( *(_rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) ); + for( SwFrm* pNew = aNewIter.First(); pNew; pNew = aNewIter.Next() ) { ++nNewNumOfAnchFrm; } if ( nOldNumOfAnchFrm != nNewNumOfAnchFrm ) { // delete existing fly frames except <_pKeepThisFlyFrm> - SwClientIter aIter( mrFlyFrmFmt ); - SwClient* pLast = aIter.GoStart(); - if ( pLast ) + SwIterator<SwFrm,SwFmt> aIter( mrFlyFrmFmt ); + SwFrm* pFrm = aIter.First(); + if ( pFrm ) { do { - SwFrm* pFrm( dynamic_cast<SwFrm*>(pLast) ); - if ( pFrm && pFrm != _pKeepThisFlyFrm ) + if ( pFrm != _pKeepThisFlyFrm ) { pFrm->Cut(); delete pFrm; } - } while( 0 != ( pLast = aIter++ )); + } while( 0 != ( pFrm = aIter.Next() )); } // indicate, that re-creation of fly frames necessary mbAnchorNodeChanged = true; @@ -3214,7 +3241,7 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint, if( !pFly ) { - pFly = (SwFlyFrm*) SwClientIter( *(SwFrmFmt*)this ).First( TYPE( SwFlyFrm )); + pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *this ); if( !pFly ) return 0; } diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 08c9f9d11e36..1a81cb07a27d 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -33,6 +33,7 @@ #include "viewsh.hxx" #include "doc.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "swtypes.hxx" #include "dflyobj.hxx" #include "dcontact.hxx" @@ -179,9 +180,9 @@ sal_Bool SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool //determine space left in new upper frame nSpace = (aRect.*fnRectX->fnGetHeight)(); - + const ViewShell *pSh = pNewUpper->getRootFrm()->GetCurrShell(); if ( IsInFtn() || - pIDSA->get(IDocumentSettingAccess::BROWSE_MODE) || + (pSh && pSh->GetViewOptions()->getBrowseMode()) || pNewUpper->IsCellFrm() || ( pNewUpper->IsInSct() && ( pNewUpper->IsSctFrm() || ( pNewUpper->IsColBodyFrm() && @@ -740,8 +741,8 @@ void SwPageFrm::MakeAll() pAttrs = pAccess->Get(); } //Bei der BrowseView gelten feste Einstellungen. - ViewShell *pSh = GetShell(); - if ( pSh && GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if ( pSh && pSh->GetViewOptions()->getBrowseMode() ) { const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() ); const long nTop = pAttrs->CalcTopLine() + aBorder.Height(); @@ -995,11 +996,11 @@ sal_Bool SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) const long nRight = ((SwBorderAttrs&)rAttrs).CalcRight( this ); (this->*fnRect->fnSetXMargins)( nLeft, nRight ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); SwTwips nWidthArea; if( pSh && 0!=(nWidthArea=(pSh->VisArea().*fnRect->fnGetWidth)()) && GetUpper()->IsPageBodyFrm() && // nicht dagegen bei BodyFrms in Columns - pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + pSh->GetViewOptions()->getBrowseMode() ) { //Nicht ueber die Kante des sichbaren Bereiches hinausragen. //Die Seite kann breiter sein, weil es Objekte mit "ueberbreite" diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index df076ca751de..48047b9436b2 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -45,6 +45,7 @@ #include "bodyfrm.hxx" // ColumnFrms jetzt mit BodyFrm #include "rootfrm.hxx" // wg. RemoveFtns #include "sectfrm.hxx" // wg. FtnAtEnd-Flag +#include "switerator.hxx" // ftnfrm.cxx: void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes ); @@ -58,11 +59,11 @@ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes |* Letzte Aenderung AMA 30. Oct 98 |* |*************************************************************************/ -SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt ): - SwFtnBossFrm( pFmt ) +SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt, SwFrm* pSib ): + SwFtnBossFrm( pFmt, pSib ) { nType = FRMC_COLUMN; - SwBodyFrm* pColBody = new SwBodyFrm( pFmt->GetDoc()->GetDfltFrmFmt() ); + SwBodyFrm* pColBody = new SwBodyFrm( pFmt->GetDoc()->GetDfltFrmFmt(), pSib ); pColBody->InsertBehind( this, 0 ); // ColumnFrms jetzt mit BodyFrm SetMaxFtnHeight( LONG_MAX ); } @@ -143,8 +144,8 @@ static sal_Bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) if ( pCont->IsBodyFrm() ) pAttrOwner = pCont->FindPageFrm(); SwLayoutFrm *pNeighbourCol = 0; - SwClientIter aIter( *pAttrOwner->GetFmt() ); - SwLayoutFrm *pNeighbour = (SwLayoutFrm*)aIter.First( TYPE(SwLayoutFrm) ); + SwIterator<SwLayoutFrm,SwFmt> aIter( *pAttrOwner->GetFmt() ); + SwLayoutFrm *pNeighbour = aIter.First(); sal_uInt16 nAdd = 0; SwFrm *pCol = pCont->Lower(); @@ -157,7 +158,7 @@ static sal_Bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) pNeighbourCol != pCont ) break; pNeighbourCol = 0; - pNeighbour = (SwLayoutFrm*)aIter.Next(); + pNeighbour = aIter.Next(); } sal_Bool bRet; @@ -174,7 +175,7 @@ static sal_Bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) } for ( sal_uInt16 i = 0; i < nCount; ++i ) { - SwColumnFrm *pTmpCol = new SwColumnFrm( pNeighbourCol->GetFmt() ); + SwColumnFrm *pTmpCol = new SwColumnFrm( pNeighbourCol->GetFmt(), pCont ); pTmpCol->SetMaxFtnHeight( nMax ); pTmpCol->InsertBefore( pCont, NULL ); pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext(); @@ -186,7 +187,7 @@ static sal_Bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) for ( sal_uInt16 i = 0; i < nCount; ++i ) { SwFrmFmt *pFmt = pDoc->MakeFrmFmt( aEmptyStr, pDoc->GetDfltFrmFmt()); - SwColumnFrm *pTmp = new SwColumnFrm( pFmt ); + SwColumnFrm *pTmp = new SwColumnFrm( pFmt, pCont ); pTmp->SetMaxFtnHeight( nMax ); pTmp->Paste( pCont ); } @@ -248,7 +249,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, // SaveCntnt wuerde auch den Inhalt der Fussnotencontainer aufsaugen // und im normalen Textfluss unterbringen. if( IsPageBodyFrm() ) - pDoc->GetRootFrm()->RemoveFtns( (SwPageFrm*)GetUpper(), sal_True, sal_False ); + pDoc->GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), sal_True, sal_False ); //swmod 080218 pSave = ::SaveCntnt( this ); //Wenn Spalten existieren, jetzt aber eine Spaltenanzahl von diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index c6e8f4d823d8..530d4e2cee01 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -47,8 +47,8 @@ #include "ftnfrm.hxx" #include "txtftn.hxx" #include "fmtftn.hxx" -// OD 09.01.2004 #i11859# #include <txtfrm.hxx> // SwTxtFrm +#include <switerator.hxx> /************************************************************************* |* @@ -468,22 +468,6 @@ const SwCntntFrm* SwCntntFrm::ImplGetNextCntntFrm( bool bFwd ) const |* Letzte Aenderung MA 05. Sep. 93 |* |*************************************************************************/ -SwRootFrm* SwFrm::FindRootFrm() -{ - // MIB: A layout frame is always registerd at a SwFrmFmt and a content - // frame alyways at a SwCntntNode. For any other case we won't find - // a root frame. - // Casting the GetDep() result instead of the frame itself (that has - // been done before) makes it save to use that method in constructors - // and destructors. - ASSERT( GetDep(), "frame is not registered any longer" ); - ASSERT( IsLayoutFrm() || IsCntntFrm(), "invalid frame type" ); - SwDoc *pDoc = IsLayoutFrm() - ? static_cast < SwFrmFmt * >( GetDep() )->GetDoc() - : static_cast < SwCntntNode * >( GetDep() )->GetDoc(); - return pDoc->GetRootFrm(); -} - SwPageFrm* SwFrm::FindPageFrm() { SwFrm *pRet = this; @@ -1702,13 +1686,10 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren GetTabBox()->FindStartOfRowSpan( *pTable, nMax ) : GetTabBox()->FindEndOfRowSpan( *pTable, nMax ); - SwClientIter aIter( const_cast<SwFrmFmt&>( *rMasterBox.GetFrmFmt()) ); + SwIterator<SwCellFrm,SwFmt> aIter( *rMasterBox.GetFrmFmt() ); - for ( SwClient* pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() ) + for ( SwCellFrm* pMasterCell = aIter.First(); pMasterCell; pMasterCell = aIter.Next() ) { - ASSERT( ((SwFrm*)pLast)->IsCellFrm(), "Non-row frame registered in table line" ) - const SwCellFrm* pMasterCell = static_cast<const SwCellFrm*>(pLast); - if ( pMasterCell->GetTabBox() == &rMasterBox ) { const SwTabFrm* pMasterTable = static_cast<const SwTabFrm*>(pMasterCell->GetUpper()->GetUpper()); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index f5edaf5bbab4..d76961e0f02b 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -30,11 +30,13 @@ #include "pam.hxx" #include "swtable.hxx" #include "frame.hxx" +#include "rootfrm.hxx" #include "pagefrm.hxx" #include "flyfrm.hxx" #include "viewsh.hxx" #include "doc.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "dflyobj.hxx" #include "frmtool.hxx" #include "dcontact.hxx" @@ -49,7 +51,6 @@ #include <fmtftn.hxx> #include <editeng/pgrditem.hxx> #include <paratr.hxx> - #include "ftnfrm.hxx" #include "txtfrm.hxx" #include "tabfrm.hxx" @@ -61,15 +62,11 @@ #include "section.hxx" #include "dbg_lay.hxx" #include "lineinfo.hxx" -// OD 2004-03-02 #106629# #include <fmtclbl.hxx> -// --> OD 2004-06-23 #i28701# #include <sortedobjs.hxx> #include <layouter.hxx> -// <-- -// --> OD 2004-10-15 #i26945# #include <fmtfollowtextflow.hxx> -// <-- +#include <switerator.hxx> sal_Bool SwFlowFrm::bMoveBwdJump = sal_False; @@ -604,7 +601,7 @@ void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling ) ASSERT( rThis.GetUpper(), "Wo kommen wir denn her?" ); //Sparsamer benachrichtigen wenn eine Action laeuft. - ViewShell *pSh = rThis.GetShell(); + ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); const SwViewImp *pImp = pSh ? pSh->Imp() : 0; const sal_Bool bComplete = pImp && pImp->IsAction() && pImp->GetLayAction().IsComplete(); @@ -737,20 +734,13 @@ SwSectionFrm* SwSectionFrm::FindMaster() const { ASSERT( IsFollow(), "SwSectionFrm::FindMaster(): !IsFollow" ); - SwClientIter aIter( *pSection->GetFmt() ); - SwClient *pLast = aIter.GoStart(); - - while ( pLast ) + SwIterator<SwSectionFrm,SwFmt> aIter( *pSection->GetFmt() ); + SwSectionFrm* pSect = aIter.First(); + while ( pSect ) { - if ( pLast->ISA( SwFrm ) ) - { - ASSERT( ((SwFrm*)pLast)->IsSctFrm(), - "Non-section frame registered in section format" ) - SwSectionFrm* pSect = (SwSectionFrm*)pLast; if( pSect->GetFollow() == this ) return pSect; - } - pLast = aIter++; + pSect = aIter.Next(); } ASSERT( sal_False, "Follow ist lost in Space." ); @@ -761,17 +751,10 @@ SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const { ASSERT( IsFollow(), "SwTabFrm::FindMaster(): !IsFollow" ); - SwClientIter aIter( *GetTable()->GetFrmFmt() ); - SwClient* pLast = aIter.GoStart(); - - while ( pLast ) + SwIterator<SwTabFrm,SwFmt> aIter( *GetTable()->GetFrmFmt() ); + SwTabFrm* pTab = aIter.First(); + while ( pTab ) { - if ( pLast->ISA( SwFrm ) ) - { - ASSERT( ((SwFrm*)pLast)->IsTabFrm(), - "Non-table frame registered in table format" ) - SwTabFrm* pTab = (SwTabFrm*)pLast; - if ( bFirstMaster ) { // @@ -795,8 +778,8 @@ SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const if ( pTab->GetFollow() == this ) return pTab; } - } - pLast = aIter++; + + pTab = aIter.Next(); } ASSERT( sal_False, "Follow ist lost in Space." ); @@ -1042,12 +1025,13 @@ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) return pLayLeaf; SwPageFrm *pNew = pLayLeaf->FindPageFrm(); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); // #111704# The pagedesc check does not make sense for frames in fly frames if ( pNew != FindPageFrm() && !bNewPg && !IsInFly() && // --> FME 2005-05-10 #i46683# // Do not consider page descriptions in browse mode (since // MoveBwd ignored them) - !pNew->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + !(pSh && pSh->GetViewOptions()->getBrowseMode() ) ) // <-- { if( WrongPageDesc( pNew ) ) @@ -1173,7 +1157,8 @@ sal_Bool SwFlowFrm::IsPrevObjMove() const // und fuer diesen ggf. Umbrechen. //!!!!!!!!!!!Hack!!!!!!!!!!! - if ( rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) return sal_False; SwFrm *pPre = rThis.FindPrev(); @@ -1252,9 +1237,11 @@ sal_Bool SwFlowFrm::IsPrevObjMove() const sal_Bool SwFlowFrm::IsPageBreak( sal_Bool bAct ) const { if ( !IsFollow() && rThis.IsInDocBody() && - ( !rThis.IsInTab() || ( rThis.IsTabFrm() && !rThis.GetUpper()->IsInTab() ) ) && // i66968 - !rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + ( !rThis.IsInTab() || ( rThis.IsTabFrm() && !rThis.GetUpper()->IsInTab() ) ) ) // i66968 { + const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + return sal_False; const SwAttrSet *pSet = rThis.GetAttrSet(); //Vorgaenger ermitteln @@ -2113,7 +2100,7 @@ sal_Bool SwFlowFrm::MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool b rThis.Prepare( PREP_BOSS_CHGD, 0, sal_False ); if( !bSamePage ) { - ViewShell *pSh = rThis.GetShell(); + ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); if ( pSh && !pSh->Imp()->IsUpdateExpFlds() ) pSh->GetDoc()->SetNewFldLst(true); //Wird von CalcLayout() hinterher erledigt! @@ -2125,7 +2112,9 @@ sal_Bool SwFlowFrm::MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool b } } // OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout - if ( !pNewPage->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); + + if ( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) ) { // --> OD 2009-12-31 #i106452# // check page description not only in situation with sections. @@ -2593,7 +2582,7 @@ sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat ) { //Kann sein, dass ich einen Container bekam. SwFtnFrm *pOld = rThis.FindFtnFrm(); - SwFtnFrm *pNew = new SwFtnFrm( pOld->GetFmt(), + SwFtnFrm *pNew = new SwFtnFrm( pOld->GetFmt(), pOld, pOld->GetRef(), pOld->GetAttr() ); if ( pOld->GetMaster() ) { @@ -2674,7 +2663,7 @@ sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat ) if( pNewPage != pOldPage ) { rThis.Prepare( PREP_BOSS_CHGD, (const void*)pOldPage, sal_False ); - ViewShell *pSh = rThis.GetShell(); + ViewShell *pSh = rThis.getRootFrm()->GetCurrShell(); if ( pSh && !pSh->Imp()->IsUpdateExpFlds() ) pSh->GetDoc()->SetNewFldLst(true); //Wird von CalcLayout() hinterher eledigt! @@ -2684,7 +2673,7 @@ sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat ) pNewPage->InvalidateWordCount(); // OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout - if ( !pNewPage->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + if ( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) ) { if ( bCheckPageDescs && pNewPage->GetNext() ) { diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 8cd4253f6ddc..544082e93335 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -50,27 +50,16 @@ #include <fmtcnct.hxx> #include <layhelp.hxx> #include <ndtxt.hxx> - -// --> OD 2010-09-14 #i113730# #include <svx/svdogrp.hxx> -// <-- -// OD 16.04.2003 #i13147# - for <SwFlyFrm::GetContour(..)> #include <ndgrf.hxx> -// OD 29.10.2003 #113049# #include <tolayoutanchoredobjectposition.hxx> -// OD 06.11.2003 #i22305# #include <fmtfollowtextflow.hxx> -// --> OD 2004-06-28 #i28701# #include <sortedobjs.hxx> #include <objectformatter.hxx> -// <-- -// OD 2004-04-06 #i26791# #include <anchoredobject.hxx> -// --> OD 2006-01-31 #i53298# #include <ndole.hxx> -// <-- #include <swtable.hxx> - +#include <svx/svdpage.hxx> #include "doc.hxx" #include "viewsh.hxx" #include "layouter.hxx" @@ -80,6 +69,7 @@ #include "pam.hxx" #include "frmatr.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "errhdl.hxx" #include "dcontact.hxx" #include "dflyobj.hxx" @@ -98,6 +88,7 @@ #include "sectfrm.hxx" #include <vcl/svapp.hxx> #include <vcl/salbtype.hxx> // FRound +#include "switerator.hxx" using namespace ::com::sun::star; @@ -114,8 +105,8 @@ TYPEINIT2(SwFlyFrm,SwLayoutFrm,SwAnchoredObject); |* |*************************************************************************/ -SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : - SwLayoutFrm( pFmt ), +SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : + SwLayoutFrm( pFmt, pSib ), // OD 2004-03-22 #i26791# SwAnchoredObject(), // OD 2004-05-27 #i26791# - moved to <SwAnchoredObject> @@ -152,21 +143,30 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : bInvalidVert = 0; bDerivedVert = 0; bDerivedR2L = 0; - if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir - || pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) - //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir ) { - bVertical = 0; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin bVertLR = 0; + bVertical = 0; } else - //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin { - bVertical = 1; - if ( FRMDIR_VERT_TOP_LEFT == nDir ) - bVertLR = 1; - else + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + { + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin bVertLR = 0; + bVertical = 0; + } + else + { + bVertical = 1; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( FRMDIR_VERT_TOP_LEFT == nDir ) + bVertLR = 1; + else + bVertLR = 0; + } } bVert = bVertical; @@ -303,7 +303,7 @@ SwFlyFrm::~SwFlyFrm() // anchor will do that. if( IsAccessibleFrm() && GetFmt() && (IsFlyInCntFrm() || !GetAnchorFrm()) ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell *pVSh = pRootFrm->GetCurrShell(); @@ -394,15 +394,81 @@ void SwFlyFrm::DeleteCnt() |* Letzte Aenderung MA 30. Nov. 95 |* |*************************************************************************/ + +sal_uInt32 SwFlyFrm::_GetOrdNumForNewRef( const SwFlyDrawContact* pContact ) +{ + sal_uInt32 nOrdNum( 0L ); + + // search for another Writer fly frame registered at same frame format + SwIterator<SwFlyFrm,SwFmt> aIter( *pContact->GetFmt() ); + const SwFlyFrm* pFlyFrm( 0L ); + for ( pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() ) + { + if ( pFlyFrm != this ) + { + break; + } + } + + if ( pFlyFrm ) + { + // another Writer fly frame found. Take its order number + nOrdNum = pFlyFrm->GetVirtDrawObj()->GetOrdNum(); + } + else + { + // no other Writer fly frame found. Take order number of 'master' object + // --> OD 2004-11-11 #i35748# - use method <GetOrdNumDirect()> instead + // of method <GetOrdNum()> to avoid a recalculation of the order number, + // which isn't intended. + nOrdNum = pContact->GetMaster()->GetOrdNumDirect(); + // <-- + } + + return nOrdNum; +} + +SwVirtFlyDrawObj* SwFlyFrm::CreateNewRef( SwFlyDrawContact *pContact ) +{ + SwVirtFlyDrawObj *pDrawObj = new SwVirtFlyDrawObj( *pContact->GetMaster(), this ); + pDrawObj->SetModel( pContact->GetMaster()->GetModel() ); + pDrawObj->SetUserCall( pContact ); + + //Der Reader erzeugt die Master und setzt diese, um die Z-Order zu + //transportieren, in die Page ein. Beim erzeugen der ersten Referenz werden + //die Master aus der Liste entfernt und fuehren von da an ein + //Schattendasein. + SdrPage* pPg( 0L ); + if ( 0 != ( pPg = pContact->GetMaster()->GetPage() ) ) + { + const sal_uInt32 nOrdNum = pContact->GetMaster()->GetOrdNum(); + pPg->ReplaceObject( pDrawObj, nOrdNum ); + } + // --> OD 2004-08-16 #i27030# - insert new <SwVirtFlyDrawObj> instance + // into drawing page with correct order number + else + { + pContact->GetFmt()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 )-> + InsertObject( pDrawObj, _GetOrdNumForNewRef( pContact ) ); + } + // <-- + // --> OD 2004-12-13 #i38889# - assure, that new <SwVirtFlyDrawObj> instance + // is in a visible layer. + pContact->MoveObjToVisibleLayer( pDrawObj ); + // <-- + return pDrawObj; +} + + + void SwFlyFrm::InitDrawObj( sal_Bool bNotify ) { //ContactObject aus dem Format suchen. Wenn bereits eines existiert, so //braucht nur eine neue Ref erzeugt werden, anderfalls ist es jetzt an //der Zeit das Contact zu erzeugen. - SwClientIter aIter( *GetFmt() ); - SwFlyDrawContact *pContact = (SwFlyDrawContact*) - aIter.First( TYPE(SwFlyDrawContact) ); + IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess(); + SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() ); if ( !pContact ) { // --> OD 2005-08-08 #i52858# - method name changed @@ -412,7 +478,7 @@ void SwFlyFrm::InitDrawObj( sal_Bool bNotify ) } ASSERT( pContact, "InitDrawObj failed" ); // OD 2004-03-22 #i26791# - SetDrawObj( *(pContact->CreateNewRef( this )) ); + SetDrawObj( *(CreateNewRef( pContact )) ); //Den richtigen Layer setzen. // OD 2004-01-19 #110582# @@ -443,7 +509,7 @@ void SwFlyFrm::FinitDrawObj() //Bei den SdrPageViews abmelden falls das Objekt dort noch selektiert ist. if ( !GetFmt()->GetDoc()->IsInDtor() ) { - ViewShell *p1St = GetShell(); + ViewShell *p1St = getRootFrm()->GetCurrShell(); if ( p1St ) { ViewShell *pSh = p1St; @@ -464,18 +530,19 @@ void SwFlyFrm::FinitDrawObj() SwFlyDrawContact *pMyContact = 0; if ( GetFmt() ) { - SwClientIter aIter( *GetFmt() ); - aIter.GoStart(); - do { - if ( aIter()->ISA(SwFrm) && (SwFrm*)aIter() != this ) + bool bContinue = true; + SwIterator<SwFrm,SwFmt> aFrmIter( *GetFmt() ); + for ( SwFrm* pFrm = aFrmIter.First(); pFrm; pFrm = aFrmIter.Next() ) + if ( pFrm != this ) { - pMyContact = 0; + // don't delete Contact if there is still a Frm + bContinue = false; break; } - if( !pMyContact && aIter()->ISA(SwFlyDrawContact) ) - pMyContact = (SwFlyDrawContact*)aIter(); - aIter++; - } while( aIter() ); + + if ( bContinue ) + // no Frm left, find Contact object to destroy + pMyContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() ); } // OD, OS 2004-03-31 #116203# - clear user call of Writer fly frame 'master' @@ -539,10 +606,13 @@ void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) } // invalidate accessible relation set (accessibility wrapper) - ViewShell* pSh = pMaster->GetShell(); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell(); + if( pSh ) + { + SwRootFrm* pLayout = pMaster->getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow ); - + } } void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) @@ -582,10 +652,14 @@ void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) pFollow->GetFmt()->GetDoc(), ++nIndex ); // invalidate accessible relation set (accessibility wrapper) - ViewShell* pSh = pMaster->GetShell(); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell(); + if( pSh ) + { + SwRootFrm* pLayout = pMaster->getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow ); } +} /************************************************************************* |* @@ -616,8 +690,8 @@ SwFlyFrm *SwFlyFrm::FindChainNeighbour( SwFrmFmt &rChain, SwFrm *pAnch ) pLay = pLay->GetUpper(); } - SwClientIter aIter( rChain ); - SwFlyFrm *pFly = (SwFlyFrm*)aIter.First( TYPE(SwFlyFrm ) ); + SwIterator<SwFlyFrm,SwFmt> aIter( rChain ); + SwFlyFrm *pFly = aIter.First(); if ( pLay ) { while ( pFly ) @@ -632,7 +706,7 @@ SwFlyFrm *SwFlyFrm::FindChainNeighbour( SwFrmFmt &rChain, SwFrm *pAnch ) else if ( pLay == pFly->FindFooterOrHeader() ) break; } - pFly = (SwFlyFrm*)aIter.Next(); + pFly = aIter.Next(); } } else if ( pFly ) @@ -735,7 +809,7 @@ sal_Bool SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize ) |* |*************************************************************************/ -void SwFlyFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; @@ -787,7 +861,7 @@ void SwFlyFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTxtFrm() ) ClrContourCache( GetVirtDrawObj() ); SwRootFrm *pRoot; - if ( nInvFlags & 0x20 && 0 != (pRoot = FindRootFrm()) ) + if ( nInvFlags & 0x20 && 0 != (pRoot = getRootFrm()) ) pRoot->InvalidateBrowseWidth(); // --> OD 2004-06-28 #i28701# if ( nInvFlags & 0x80 ) @@ -803,13 +877,13 @@ void SwFlyFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) // <-- } -void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, +void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) { sal_Bool bClear = sal_True; const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); switch( nWhich ) { case RES_VERT_ORIENT: @@ -861,8 +935,12 @@ void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, const SvxProtectItem *pP = (SvxProtectItem*)pNew; GetVirtDrawObj()->SetMoveProtect( pP->IsPosProtected() ); GetVirtDrawObj()->SetResizeProtect( pP->IsSizeProtected() ); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + if( pSh ) + { + SwRootFrm* pLayout = getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this ); + } break; } @@ -973,8 +1051,8 @@ void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, case RES_LR_SPACE: { rInvFlags |= 0x41; - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) - GetFmt()->GetDoc()->GetRootFrm()->InvalidateBrowseWidth(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + getRootFrm()->InvalidateBrowseWidth(); SwRect aNew( GetObjRectWithSpaces() ); SwRect aOld( aFrm ); if ( RES_UL_SPACE == nWhich ) @@ -1015,11 +1093,15 @@ void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, pIDDMA->GetHeavenId() : pIDDMA->GetHellId(); GetVirtDrawObj()->SetLayer( nId ); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + if( pSh ) + { + SwRootFrm* pLayout = getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) { pSh->Imp()->DisposeAccessibleFrm( this ); pSh->Imp()->AddAccessibleFrm( this ); } + } // --> OD 2004-06-28 #i28701# - perform reorder of object lists // at anchor frame and at page frame. rInvFlags |= 0x80; @@ -2210,7 +2292,7 @@ void SwFrm::RemoveFly( SwFlyFrm *pToRemove ) pToRemove->GetFmt() && !pToRemove->IsFlyInCntFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell *pVSh = pRootFrm->GetCurrShell(); @@ -2301,9 +2383,11 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) } // Notify accessible layout. - ViewShell* pSh = GetShell(); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + ViewShell* pSh = getRootFrm()->GetCurrShell(); + if( pSh ) { + SwRootFrm* pLayout = getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) pSh->Imp()->AddAccessibleObj( _rNewObj.GetDrawObj() ); } } @@ -2311,9 +2395,11 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) void SwFrm::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj ) { // Notify accessible layout. - ViewShell* pSh = GetShell(); - if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) + ViewShell* pSh = getRootFrm()->GetCurrShell(); + if( pSh ) { + SwRootFrm* pLayout = getRootFrm(); + if( pLayout && pLayout->IsAnyShellAccessible() ) pSh->Imp()->DisposeAccessibleObj( _rToRemoveObj.GetDrawObj() ); } @@ -2533,10 +2619,10 @@ Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const if( pRel ) // LAYER_IMPL { long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX; - const ViewShell *pSh = GetShell(); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( ( pRel->IsBodyFrm() || pRel->IsPageFrm() ) && - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - pSh && pSh->VisArea().HasArea() ) + pSh && pSh->GetViewOptions()->getBrowseMode() && + pSh->VisArea().HasArea() ) { nRelWidth = pSh->GetBrowseWidth(); nRelHeight = pSh->VisArea().Height(); @@ -2865,6 +2951,13 @@ bool SwFlyFrm::IsFormatPossible() const !IsLocked() && !IsColLocked(); } +void SwFlyFrm::GetAnchoredObjects( std::list<SwAnchoredObject*>& aList, const SwFmt& rFmt ) +{ + SwIterator<SwFlyFrm,SwFmt> aIter( rFmt ); + for( SwFlyFrm* pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() ) + aList.push_back( pFlyFrm ); +} + const SwFlyFrmFmt * SwFlyFrm::GetFmt() const { return static_cast< const SwFlyFrmFmt * >( GetDep() ); diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 2a5b688e7110..75157d64dcc4 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -30,7 +30,6 @@ #include <tools/bigint.hxx> #include "pagefrm.hxx" -#include "rootfrm.hxx" #include "cntfrm.hxx" #include "flyfrm.hxx" #include "txtfrm.hxx" @@ -85,8 +84,8 @@ using namespace ::com::sun::star; |* |*************************************************************************/ -SwFlyAtCntFrm::SwFlyAtCntFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : - SwFlyFreeFrm( pFmt, pAnch ) +SwFlyAtCntFrm::SwFlyAtCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : + SwFlyFreeFrm( pFmt, pSib, pAnch ) { bAtCnt = sal_True; bAutoPosition = (FLY_AT_CHAR == pFmt->GetAnchor().GetAnchorId()); @@ -104,7 +103,7 @@ TYPEINIT1(SwFlyAtCntFrm,SwFlyFreeFrm); |* |*************************************************************************/ -void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) +void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { sal_uInt16 nWhich = pNew ? pNew->Which() : 0; const SwFmtAnchor *pAnch = 0; @@ -196,7 +195,7 @@ void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if ( !pCntnt ) { SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode(); - pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, sal_False ); + pCntnt = pNode->getLayoutFrm( getRootFrm(), &pOldAnchor->Frm().Pos(), 0, sal_False ); ASSERT( pCntnt, "Neuen Anker nicht gefunden" ); } //Flys haengen niemals an einem Follow sondern immer am diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 1ff29c582696..f0b3a5995a5c 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -52,8 +52,8 @@ void DeepCalc( const SwFrm *pFrm ); |* Letzte Aenderung MA 09. Apr. 99 |* |*************************************************************************/ -SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : - SwFlyFrm( pFmt, pAnch ) +SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : + SwFlyFrm( pFmt, pSib, pAnch ) { bInCnt = bInvalidLayout = bInvalidCntnt = sal_True; SwTwips nRel = pFmt->GetVertOrient().GetPos(); @@ -123,7 +123,7 @@ void SwFlyInCntFrm::SetRefPoint( const Point& rPoint, |* Letzte Aenderung MA 02. Sep. 93 |* |*************************************************************************/ -void SwFlyInCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) +void SwFlyInCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { sal_Bool bCallPrepare = sal_False; sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 4a240b9d256d..8a9ef192e902 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -74,8 +74,8 @@ using namespace ::com::sun::star; |* |*************************************************************************/ -SwFlyFreeFrm::SwFlyFreeFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : - SwFlyFrm( pFmt, pAnch ), +SwFlyFreeFrm::SwFlyFreeFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : + SwFlyFrm( pFmt, pSib, pAnch ), pPage( 0 ), // --> OD 2004-11-15 #i34753# mbNoMakePos( false ), @@ -548,8 +548,8 @@ bool SwFlyFreeFrm::IsFormatPossible() const |* |*************************************************************************/ -SwFlyLayFrm::SwFlyLayFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : - SwFlyFreeFrm( pFmt, pAnch ) +SwFlyLayFrm::SwFlyLayFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : + SwFlyFreeFrm( pFmt, pSib, pAnch ) { bLayout = sal_True; } @@ -566,7 +566,7 @@ TYPEINIT1(SwFlyLayFrm,SwFlyFreeFrm); |* |*************************************************************************/ -void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) +void SwFlyLayFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { sal_uInt16 nWhich = pNew ? pNew->Which() : 0; @@ -600,7 +600,7 @@ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if ( FLY_AT_PAGE == pAnch->GetAnchorId() ) { sal_uInt16 nPgNum = pAnch->GetPageNum(); - SwRootFrm *pRoot = FindRootFrm(); + SwRootFrm *pRoot = getRootFrm(); SwPageFrm *pTmpPage = (SwPageFrm*)pRoot->Lower(); for ( sal_uInt16 i = 1; (i <= nPgNum) && pTmpPage; ++i, pTmpPage = (SwPageFrm*)pTmpPage->GetNext() ) @@ -622,7 +622,7 @@ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode ); SwCntntFrm *pCntnt = GetFmt()->GetDoc()->GetNodes().GoNext( &aIdx )-> - GetCntntNode()->GetFrm( 0, 0, sal_False ); + GetCntntNode()->getLayoutFrm( getRootFrm(), 0, 0, sal_False ); if( pCntnt ) { SwFlyFrm *pTmp = pCntnt->FindFlyFrm(); @@ -653,7 +653,7 @@ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) { if ( !pNew->GetVirtDrawObj()->IsInserted() ) - FindRootFrm()->GetDrawPage()->InsertObject( + getRootFrm()->GetDrawPage()->InsertObject( (SdrObject*)pNew->GetVirtDrawObj(), pNew->GetVirtDrawObj()->GetReferencedObj().GetOrdNumDirect() ); @@ -765,7 +765,7 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) void SwPageFrm::RemoveFlyFromPage( SwFlyFrm *pToRemove ) { const sal_uInt32 nOrdNum = pToRemove->GetVirtDrawObj()->GetOrdNum(); - FindRootFrm()->GetDrawPage()->RemoveObject( nOrdNum ); + getRootFrm()->GetDrawPage()->RemoveObject( nOrdNum ); pToRemove->GetVirtDrawObj()->ReferencedObj().SetOrdNum( nOrdNum ); if ( GetUpper() ) @@ -1036,7 +1036,7 @@ void SwPageFrm::PlaceFly( SwFlyFrm* pFly, SwFlyFrmFmt* pFmt ) AppendFly( pFly ); else { ASSERT( pFmt, ":-( kein Format fuer Fly uebergeben." ); - pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, this ); + pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, this, this ); AppendFly( pFly ); ::RegistFlys( this, pFly ); } diff --git a/sw/source/core/layout/flypos.cxx b/sw/source/core/layout/flypos.cxx index 8d3b517c2efc..83712d597a51 100644 --- a/sw/source/core/layout/flypos.cxx +++ b/sw/source/core/layout/flypos.cxx @@ -28,13 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - - #include "doc.hxx" #include "node.hxx" #include <docary.hxx> - - #include <fmtanchr.hxx> #include "flypos.hxx" #include "frmfmt.hxx" @@ -43,8 +39,7 @@ #include "flyfrm.hxx" #include "dflyobj.hxx" #include "ndindex.hxx" - - +#include "switerator.hxx" SV_IMPL_OP_PTRARR_SORT( SwPosFlyFrms, SwPosFlyFrmPtr ) @@ -52,28 +47,33 @@ SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt, sal_uInt16 nArrPos ) : pFrmFmt( pFmt ), pNdIdx( (SwNodeIndex*) &rIdx ) { - sal_Bool bFnd = sal_False; + bool bFnd = false; const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); if (FLY_AT_PAGE == rAnchor.GetAnchorId()) { pNdIdx = new SwNodeIndex( rIdx ); } - else if( pFmt->GetDoc()->GetRootFrm() ) + else if( pFmt->GetDoc()->GetCurrentViewShell() ) //swmod 071108//swmod 071225 { - SwClientIter aIter( (SwFmt&)*pFmt ); if( RES_FLYFRMFMT == pFmt->Which() ) { // Schauen, ob es ein SdrObject dafuer gibt - if( aIter.First( TYPE( SwFlyFrm) ) ) - nOrdNum = ((SwFlyFrm*)aIter())->GetVirtDrawObj()->GetOrdNum(), - bFnd = sal_True; + SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(*pFmt); + if( pFly ) + { + nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum(); + bFnd = true; + } } else if( RES_DRAWFRMFMT == pFmt->Which() ) { // Schauen, ob es ein SdrObject dafuer gibt - if( aIter.First( TYPE(SwDrawContact) ) ) - nOrdNum = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum(), - bFnd = sal_True; + SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement(*pFmt); + if( pContact ) + { + nOrdNum = pContact->GetMaster()->GetOrdNum(); + bFnd = true; + } } } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 3d820e7a1e69..aa4f6e9921a6 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -38,10 +38,8 @@ #include <editeng/lrspitem.hxx> #include <editeng/boxitem.hxx> #include <sfx2/printer.hxx> -// OD 08.01.2004 #i11859# #include <editeng/lspcitem.hxx> - #include <fmtornt.hxx> #include <fmtanchr.hxx> #include <fmthdft.hxx> @@ -56,6 +54,7 @@ #include "doc.hxx" #include "fesh.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "pam.hxx" #include "dflyobj.hxx" #include "dcontact.hxx" @@ -78,18 +77,13 @@ #include "hints.hxx" #include <layhelp.hxx> #include <laycache.hxx> - #include <rootfrm.hxx> - #include "mdiexp.hxx" #include "statstr.hrc" -// OD 21.05.2003 #108789# #include <paratr.hxx> -// OD 2004-05-24 #i28701# #include <sortedobjs.hxx> -// --> OD 2005-03-04 #b6234250# #include <objectformatter.hxx> -// <-- +#include <switerator.hxx> // ftnfrm.cxx: void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes ); @@ -106,14 +100,7 @@ sal_Bool StackHack::bLocked = sal_False; -/************************************************************************* -|* -|* SwFrmNotify::SwFrmNotify() -|* -|* Ersterstellung MA 27. Nov. 92 -|* Letzte Aenderung MA 09. Apr. 97 -|* -|*************************************************************************/ +/*************************************************************************/ SwFrmNotify::SwFrmNotify( SwFrm *pF ) : pFrm( pF ), @@ -121,9 +108,7 @@ SwFrmNotify::SwFrmNotify( SwFrm *pF ) : aPrt( pF->Prt() ), bInvaKeep( sal_False ), bValidSize( pF->GetValidSizeFlag() ), - // --> OD 2005-07-29 #i49383# - mbFrmDeleted( false ) - // <-- + mbFrmDeleted( false ) // #i49383# { if ( pF->IsTxtFrm() ) { @@ -141,23 +126,15 @@ SwFrmNotify::SwFrmNotify( SwFrm *pF ) : sal_False; } -/************************************************************************* -|* -|* SwFrmNotify::~SwFrmNotify() -|* -|* Ersterstellung MA 27. Nov. 92 -|* Letzte Aenderung MA 09. Apr. 97 -|* -|*************************************************************************/ +/*************************************************************************/ SwFrmNotify::~SwFrmNotify() { - // --> OD 2005-07-29 #i49383# + // #i49383# if ( mbFrmDeleted ) { return; } - // <-- SWRECTFN( pFrm ) const sal_Bool bAbsP = POS_DIFF( aFrm, pFrm->Frm() ); @@ -217,19 +194,18 @@ SwFrmNotify::~SwFrmNotify() pFrm->SetCompletePaint(); SwFrm* pNxt = pFrm->GetIndNext(); - // --> OD 2005-05-20 #121888# - skip empty section frames + // #121888# - skip empty section frames while ( pNxt && pNxt->IsSctFrm() && !static_cast<SwSectionFrm*>(pNxt)->GetSection() ) { pNxt = pNxt->GetIndNext(); } - // <-- if ( pNxt ) pNxt->InvalidatePos(); else { - // OD 04.11.2002 #104100# - correct condition for setting retouche + // #104100# - correct condition for setting retouche // flag for vertical layout. if( pFrm->IsRetoucheFrm() && (aFrm.*fnRect->fnTopDist)( (pFrm->Frm().*fnRect->fnGetTop)() ) > 0 ) @@ -260,7 +236,7 @@ SwFrmNotify::~SwFrmNotify() } else { - // OD 13.11.2002 #97597# - consider case that *only* margins between + // #97597# - consider case that *only* margins between // frame and printing area has changed. Then, frame has to be repainted, // in order to force paint of the margin areas. if ( !bAbsP && (bChgWidth || bChgHeight) ) @@ -275,7 +251,7 @@ SwFrmNotify::~SwFrmNotify() { if( pFrm->IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + SwRootFrm *pRootFrm = pFrm->getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -410,7 +386,7 @@ SwFrmNotify::~SwFrmNotify() } else if( pFrm->IsTxtFrm() && bValidSize != pFrm->GetValidSizeFlag() ) { - SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + SwRootFrm *pRootFrm = pFrm->getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -456,15 +432,7 @@ SwFrmNotify::~SwFrmNotify() } } -/************************************************************************* -|* -|* SwLayNotify::SwLayNotify() -|* -|* Ersterstellung MA 17. Nov. 92 -|* Letzte Aenderung MA 03. Jun. 93 -|* -|*************************************************************************/ - +/*************************************************************************/ SwLayNotify::SwLayNotify( SwLayoutFrm *pLayFrm ) : SwFrmNotify( pLayFrm ), @@ -472,14 +440,7 @@ SwLayNotify::SwLayNotify( SwLayoutFrm *pLayFrm ) : { } -/************************************************************************* -|* -|* SwLayNotify::~SwLayNotify() -|* -|* Ersterstellung MA 17. Nov. 92 -|* Letzte Aenderung MA 13. Jun. 96 -|* -|*************************************************************************/ +/*************************************************************************/ // OD 2004-05-11 #i28701# - local method to invalidate the position of all // frames inclusive its floating screen objects, which are lowers of the given @@ -607,13 +568,16 @@ SwLayNotify::~SwLayNotify() if ( pLay->IsTabFrm() ) //Damit _nur_ der Shatten bei Groessenaenderungen gemalt wird. ((SwTabFrm*)pLay)->SetComplete(); - else if ( !pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) || + else + { + const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell(); + if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) || !(pLay->GetType() & (FRM_BODY | FRM_PAGE)) ) //Damit die untergeordneten sauber retouchiert werden. //Problembsp: Flys an den Henkeln packen und verkleinern. //Nicht fuer Body und Page, sonst flackerts beim HTML-Laden. pLay->SetCompletePaint(); - + } } //Lower benachrichtigen wenn sich die Position veraendert hat. const sal_Bool bPrtPos = POS_DIFF( aPrt, pLay->Prt() ); @@ -688,14 +652,7 @@ SwLayNotify::~SwLayNotify() ((SwFlyFrm*)pLay)->AnchorFrm()->InvalidateSize(); } -/************************************************************************* -|* -|* SwFlyNotify::SwFlyNotify() -|* -|* Ersterstellung MA 17. Nov. 92 -|* Letzte Aenderung MA 26. Aug. 93 -|* -|*************************************************************************/ +/*************************************************************************/ SwFlyNotify::SwFlyNotify( SwFlyFrm *pFlyFrm ) : SwLayNotify( pFlyFrm ), @@ -707,14 +664,7 @@ SwFlyNotify::SwFlyNotify( SwFlyFrm *pFlyFrm ) : { } -/************************************************************************* -|* -|* SwFlyNotify::~SwFlyNotify() -|* -|* Ersterstellung MA 17. Nov. 92 -|* Letzte Aenderung MA 09. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwFlyNotify::~SwFlyNotify() { @@ -728,7 +678,7 @@ SwFlyNotify::~SwFlyNotify() SwFlyFrm *pFly = GetFly(); if ( pFly->IsNotifyBack() ) { - ViewShell *pSh = pFly->GetShell(); + ViewShell *pSh = pFly->getRootFrm()->GetCurrShell(); SwViewImp *pImp = pSh ? pSh->Imp() : 0; if ( !pImp || !pImp->IsAction() || !pImp->GetLayAction().IsAgain() ) { @@ -823,14 +773,7 @@ SwFlyNotify::~SwFlyNotify() } } -/************************************************************************* -|* -|* SwCntntNotify::SwCntntNotify() -|* -|* Ersterstellung MA 24. Nov. 92 -|* Letzte Aenderung MA 16. May. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwCntntNotify::SwCntntNotify( SwCntntFrm *pCntntFrm ) : SwFrmNotify( pCntntFrm ), @@ -858,14 +801,7 @@ SwCntntNotify::SwCntntNotify( SwCntntFrm *pCntntFrm ) : } } -/************************************************************************* -|* -|* SwCntntNotify::~SwCntntNotify() -|* -|* Ersterstellung MA 24. Nov. 92 -|* Letzte Aenderung MA 09. Apr. 97 -|* -|*************************************************************************/ +/*************************************************************************/ SwCntntNotify::~SwCntntNotify() { @@ -945,7 +881,7 @@ SwCntntNotify::~SwCntntNotify() { //Aktive PlugIn's oder OLE-Objekte sollten etwas von der Veraenderung //mitbekommen, damit sie Ihr Window entsprechend verschieben. - ViewShell *pSh = pCnt->GetShell(); + ViewShell *pSh = pCnt->getRootFrm()->GetCurrShell(); if ( pSh ) { SwOLENode *pNd; @@ -1106,17 +1042,7 @@ SwCntntNotify::~SwCntntNotify() // <-- } -/************************************************************************* -|* -|* InsertCnt -|* -|* Beschreibung Hilfsfunktionen, die friend von irgendwem sind, damit -|* nicht immer gleich 'ne ganze Klasse befreundet werden -|* muss. -|* Ersterstellung MA 13. Apr. 93 -|* Letzte Aenderung MA 11. May. 95 -|* -|*************************************************************************/ +/*************************************************************************/ void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex, SwFrm *pFrm, SwPageFrm *pPage ) @@ -1182,9 +1108,9 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex, { SwFlyFrm *pFly; if( bFlyAtFly ) - pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pFrm ); + pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pFrm, pFrm ); else - pFly = new SwFlyAtCntFrm( (SwFlyFrmFmt*)pFmt, pFrm ); + pFly = new SwFlyAtCntFrm( (SwFlyFrmFmt*)pFmt, pFrm, pFrm ); pFly->Lock(); pFrm->AppendFly( pFly ); pFly->Unlock(); @@ -1196,18 +1122,26 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex, } } -sal_Bool MA_FASTCALL lcl_ObjConnected( SwFrmFmt *pFmt ) +bool lcl_ObjConnected( SwFrmFmt *pFmt, const SwFrm* pSib ) { - SwClientIter aIter( *pFmt ); + SwIterator<SwFlyFrm,SwFmt> aIter( *pFmt ); if ( RES_FLYFRMFMT == pFmt->Which() ) - return 0 != aIter.First( TYPE(SwFlyFrm) ); + { + const SwRootFrm* pRoot = pSib ? pSib->getRootFrm() : 0; + const SwFlyFrm* pTmpFrm; + for( pTmpFrm = aIter.First(); pTmpFrm; pTmpFrm = aIter.Next() ) + { + if(! pRoot || pRoot == pTmpFrm->getRootFrm() ) + return true; + } + } else { - SwDrawContact *pContact; - if ( 0 != (pContact = (SwDrawContact*)aIter.First( TYPE(SwDrawContact)))) + SwDrawContact *pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement(*pFmt); + if ( pContact ) return pContact->GetAnchorFrm() != 0; } - return sal_False; + return false; } /** helper method to determine, if a <SwFrmFmt>, which has an object connected, @@ -1219,9 +1153,6 @@ sal_Bool MA_FASTCALL lcl_ObjConnected( SwFrmFmt *pFmt ) */ bool lcl_InHeaderOrFooter( SwFrmFmt& _rFmt ) { - ASSERT( lcl_ObjConnected( &_rFmt ), - "::lcl_InHeaderOrFooter(..) - <SwFrmFmt> has no connected object" ); - bool bRetVal = false; const SwFmtAnchor& rAnch = _rFmt.GetAnchor(); @@ -1234,7 +1165,7 @@ bool lcl_InHeaderOrFooter( SwFrmFmt& _rFmt ) return bRetVal; } -void AppendAllObjs( const SwSpzFrmFmts *pTbl ) +void AppendAllObjs( const SwSpzFrmFmts *pTbl, const SwFrm* pSib ) { //Verbinden aller Objekte, die in der SpzTbl beschrieben sind mit dem //Layout. @@ -1262,7 +1193,7 @@ void AppendAllObjs( const SwSpzFrmFmts *pTbl ) //will ich hier nicht. bRemove = sal_True; } - else if ( sal_False == (bRemove = ::lcl_ObjConnected( pFmt )) || + else if ( sal_False == (bRemove = ::lcl_ObjConnected( pFmt, pSib )) || ::lcl_InHeaderOrFooter( *pFmt ) ) { // OD 23.06.2003 #108784# - correction: for objects in header @@ -1272,7 +1203,7 @@ void AppendAllObjs( const SwSpzFrmFmts *pTbl ) //keine abhaengigen Existieren, andernfalls, oder wenn das //MakeFrms keine abhaengigen erzeugt, entfernen. pFmt->MakeFrms(); - bRemove = ::lcl_ObjConnected( pFmt ); + bRemove = ::lcl_ObjConnected( pFmt, pSib ); } if ( bRemove ) { @@ -1308,9 +1239,9 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, SwFrm *pPrv ) { pDoc->BlockIdling(); - SwRootFrm* pLayout = pDoc->GetRootFrm(); + SwRootFrm* pLayout = pLay->getRootFrm(); const sal_Bool bOldCallbackActionEnabled = pLayout ? pLayout->IsCallbackActionEnabled() : sal_False; - if(pLayout) + if( bOldCallbackActionEnabled ) pLayout->SetCallbackActionEnabled( sal_False ); //Bei der Erzeugung des Layouts wird bPages mit sal_True uebergeben. Dann @@ -1390,8 +1321,8 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, if ( pNd->IsCntntNode() ) { SwCntntNode* pNode = (SwCntntNode*)pNd; - pFrm = pNode->IsTxtNode() ? new SwTxtFrm( (SwTxtNode*)pNode ) : - pNode->MakeFrm(); + pFrm = pNode->IsTxtNode() ? new SwTxtFrm( (SwTxtNode*)pNode, pLay ) : + pNode->MakeFrm( pLay ); if( pPageMaker ) pPageMaker->CheckInsert( nIndex ); @@ -1403,7 +1334,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, // and relation CONTENT_FLOWS_TO for previous paragraph will change. if ( pFrm->IsTxtFrm() ) { - ViewShell* pViewShell( pFrm->GetShell() ); + ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() ); // no notification, if <ViewShell> is in construction if ( pViewShell && !pViewShell->IsInConstructor() && pViewShell->GetLayout() && @@ -1443,7 +1374,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, pDoc->UpdateTblFlds( &aMsgHnt ); pTblNode->GetTable().GCLines(); - pFrm = pTblNode->MakeFrm(); + pFrm = pTblNode->MakeFrm( pLay ); if( pPageMaker ) pPageMaker->CheckInsert( nIndex ); @@ -1455,7 +1386,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, // Relation CONTENT_FLOWS_FROM for next paragraph will change // and relation CONTENT_FLOWS_TO for previous paragraph will change. { - ViewShell* pViewShell( pFrm->GetShell() ); + ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() ); // no notification, if <ViewShell> is in construction if ( pViewShell && !pViewShell->IsInConstructor() && pViewShell->GetLayout() && @@ -1493,7 +1424,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, nIndex = pNode->EndOfSectionIndex(); else { - pFrm = pNode->MakeFrm(); + pFrm = pNode->MakeFrm( pLay ); pActualSection = new SwActualSection( pActualSection, (SwSectionFrm*)pFrm, pNode ); if ( pActualSection->GetUpper() ) @@ -1532,7 +1463,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, // Relation CONTENT_FLOWS_FROM for next paragraph will change // and relation CONTENT_FLOWS_TO for previous paragraph will change. { - ViewShell* pViewShell( pFrm->GetShell() ); + ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() ); // no notification, if <ViewShell> is in construction if ( pViewShell && !pViewShell->IsInConstructor() && pViewShell->GetLayout() && @@ -1604,7 +1535,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, } // new section frame - pFrm = pActualSection->GetSectionNode()->MakeFrm(); + pFrm = pActualSection->GetSectionNode()->MakeFrm( pLay ); pFrm->InsertBehind( pLay, pPrv ); static_cast<SwSectionFrm*>(pFrm)->Init(); @@ -1682,7 +1613,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, if ( bPages ) //Jetzt noch die Flys verbinden lassen. { if ( !bDontCreateObjects ) - AppendAllObjs( pTbl ); + AppendAllObjs( pTbl, pLayout ); bObjsDirect = sal_True; } @@ -1702,7 +1633,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, } pDoc->UnblockIdling(); - if(pLayout) + if( bOldCallbackActionEnabled ) pLayout->SetCallbackActionEnabled( bOldCallbackActionEnabled ); } @@ -1885,7 +1816,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, { const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts(); if( pTbl->Count() ) - AppendAllObjs( pTbl ); + AppendAllObjs( pTbl, pUpper ); } // Wenn nichts eingefuegt wurde, z.B. ein ausgeblendeter Bereich, @@ -1912,7 +1843,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, if( !pSct->ContainsCntnt() ) { pSct->DelEmpty( sal_True ); - pDoc->GetRootFrm()->RemoveFromList( pSct ); + pUpper->getRootFrm()->RemoveFromList( pSct ); delete pSct; } } @@ -1923,14 +1854,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, } -/************************************************************************* -|* -|* SwBorderAttrs::Ctor, DTor -|* -|* Ersterstellung MA 19. May. 93 -|* Letzte Aenderung MA 25. Jan. 97 -|* -|*************************************************************************/ +/*************************************************************************/ SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor ) : SwCacheObj( pMod ), @@ -1983,8 +1907,6 @@ SwBorderAttrs::~SwBorderAttrs() |* der Sicherheitsabstand wird nur einkalkuliert, wenn Umrandung und/oder |* Schatten im Spiel sind; er soll vermeiden, dass aufgrund der |* groben physikalischen Gegebenheiten Raender usw. uebermalt werden. -|* Ersterstellung MA 19. May. 93 -|* Letzte Aenderung MA 08. Jul. 93 |* |*************************************************************************/ @@ -2066,8 +1988,6 @@ long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const |* Es kann auch ohne Linien ein Abstand erwuenscht sein, |* dieser wird dann nicht vom Attribut sondern hier |* beruecksichtigt (bBorderDist, z.B. fuer Zellen). -|* Ersterstellung MA 21. May. 93 -|* Letzte Aenderung MA 07. Jun. 99 |* |*************************************************************************/ @@ -2107,14 +2027,7 @@ void SwBorderAttrs::_CalcRightLine() bRightLine = sal_False; } -/************************************************************************* -|* -|* SwBorderAttrs::_IsLine() -|* -|* Ersterstellung MA 29. Sep. 94 -|* Letzte Aenderung MA 29. Sep. 94 -|* -|*************************************************************************/ +/*************************************************************************/ void SwBorderAttrs::_IsLine() { @@ -2141,9 +2054,6 @@ void SwBorderAttrs::_IsLine() |* 3. Die Umrandungen links und rechts vor Vorgaenger bzw. Nachfolger |* sind identisch. |* -|* Ersterstellung MA 22. Mar. 95 -|* Letzte Aenderung MA 22. May. 95 -|* |*************************************************************************/ inline int CmpLines( const SvxBorderLine *pL1, const SvxBorderLine *pL2 ) { @@ -2309,14 +2219,7 @@ void SwBorderAttrs::_GetBottomLine( const SwFrm& _rFrm ) nGetBottomLine = nRet; } -/************************************************************************* -|* -|* SwBorderAttrAccess::CTor -|* -|* Ersterstellung MA 20. Mar. 95 -|* Letzte Aenderung MA 29. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwBorderAttrAccess::SwBorderAttrAccess( SwCache &rCach, const SwFrm *pFrm ) : SwCacheAccess( rCach, (pFrm->IsCntntFrm() ? @@ -2329,14 +2232,7 @@ SwBorderAttrAccess::SwBorderAttrAccess( SwCache &rCach, const SwFrm *pFrm ) : { } -/************************************************************************* -|* -|* SwBorderAttrAccess::NewObj, Get -|* -|* Ersterstellung MA 20. Mar. 95 -|* Letzte Aenderung MA 20. Mar. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwCacheObj *SwBorderAttrAccess::NewObj() { @@ -2349,14 +2245,7 @@ SwBorderAttrs *SwBorderAttrAccess::Get() return (SwBorderAttrs*)SwCacheAccess::Get(); } -/************************************************************************* -|* -|* SwOrderIter::Ctor -|* -|* Ersterstellung MA 06. Jan. 95 -|* Letzte Aenderung MA 22. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwOrderIter::SwOrderIter( const SwPageFrm *pPg, sal_Bool bFlys ) : pPage( pPg ), @@ -2365,14 +2254,7 @@ SwOrderIter::SwOrderIter( const SwPageFrm *pPg, sal_Bool bFlys ) : { } -/************************************************************************* -|* -|* SwOrderIter::Top() -|* -|* Ersterstellung MA 06. Jan. 95 -|* Letzte Aenderung MA 22. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ const SdrObject *SwOrderIter::Top() { @@ -2401,14 +2283,7 @@ const SdrObject *SwOrderIter::Top() return pCurrent; } -/************************************************************************* -|* -|* SwOrderIter::Bottom() -|* -|* Ersterstellung MA 06. Jan. 95 -|* Letzte Aenderung MA 22. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ const SdrObject *SwOrderIter::Bottom() { @@ -2437,14 +2312,7 @@ const SdrObject *SwOrderIter::Bottom() return pCurrent; } -/************************************************************************* -|* -|* SwOrderIter::Next() -|* -|* Ersterstellung MA 06. Jan. 95 -|* Letzte Aenderung MA 22. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ const SdrObject *SwOrderIter::Next() { @@ -2474,14 +2342,7 @@ const SdrObject *SwOrderIter::Next() return pCurrent; } -/************************************************************************* -|* -|* SwOrderIter::Prev() -|* -|* Ersterstellung MA 06. Jan. 95 -|* Letzte Aenderung MA 22. Nov. 95 -|* -|*************************************************************************/ +/*************************************************************************/ const SdrObject *SwOrderIter::Prev() { @@ -2511,14 +2372,7 @@ const SdrObject *SwOrderIter::Prev() return pCurrent; } -/************************************************************************* -|* -|* SaveCntnt(), RestoreCntnt() -|* -|* Ersterstellung MA 10. Jun. 93 -|* Letzte Aenderung MA 07. Mar. 95 -|* -|*************************************************************************/ +/*************************************************************************/ //Unterstruktur eines LayoutFrms fuer eine Aktion aufheben und wieder //restaurieren. @@ -2854,9 +2708,6 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro |* SqRt() Berechnung der Quadratwurzel, damit die math.lib |* nicht auch noch dazugelinkt werden muss. |* -|* Ersterstellung OK ?? -|* Letzte Aenderung MA 09. Jan. 97 -|* |*************************************************************************/ sal_uLong MA_FASTCALL SqRt( BigInt nX ) @@ -2875,14 +2726,7 @@ sal_uLong MA_FASTCALL SqRt( BigInt nX ) return nErg >= BigInt(SAL_MAX_UINT32) ? ULONG_MAX : (sal_uLong)nErg; } -/************************************************************************* -|* -|* InsertNewPage() Einsetzen einer neuen Seite. -|* -|* Ersterstellung MA 01. Jul. 93 -|* Letzte Aenderung MA 31. Jul. 95 -|* -|*************************************************************************/ +/*************************************************************************/ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn, @@ -2903,11 +2747,11 @@ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, { SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ? ((SwPageFrm*)pSibling->GetPrev())->GetPageDesc() : &rDesc; - pRet = new SwPageFrm( pDoc->GetEmptyPageFmt(), pTmpDesc ); + pRet = new SwPageFrm( pDoc->GetEmptyPageFmt(), pUpper, pTmpDesc ); pRet->Paste( pUpper, pSibling ); pRet->PreparePage( bFtn ); } - pRet = new SwPageFrm( pFmt, &rDesc ); + pRet = new SwPageFrm( pFmt, pUpper, &rDesc ); pRet->Paste( pUpper, pSibling ); pRet->PreparePage( bFtn ); if ( pRet->GetNext() ) @@ -2922,9 +2766,6 @@ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, |* eine Layoutstruktur und melden alle FlyFrms, die einen beliebigen Frm |* innerhalb der Struktur als Anker haben bei der Seite an. |* -|* Ersterstellung MA 08. Jul. 93 -|* Letzte Aenderung MA 07. Jul. 95 -|* |*************************************************************************/ void MA_FASTCALL lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch ) @@ -2995,8 +2836,6 @@ void RegistFlys( SwPageFrm *pPage, const SwLayoutFrm *pLay ) |* |* Beschreibung Benachrichtigt den Hintergrund je nach der |* Veraenderung zwischen altem und neuem Rechteckt. -|* Ersterstellung MA 18. Jun. 93 -|* Letzte Aenderung MA 06. Jun. 96 |* |*************************************************************************/ @@ -3019,7 +2858,7 @@ void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld, //Der Einfachheit halber wird hier bewusst jeweils ein Twip //unnoetig invalidiert. - ViewShell *pSh = pFly->GetShell(); + ViewShell *pSh = pFly->getRootFrm()->GetCurrShell(); if( pSh && rOld.HasArea() ) pSh->InvalidateWindows( rOld ); @@ -3077,11 +2916,7 @@ void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld, } } -/************************************************************************* -|* -|* NotifyBackground() -|* -|*************************************************************************/ +/*************************************************************************/ void lcl_CheckFlowBack( SwFrm* pFrm, const SwRect &rRect ) { @@ -3317,7 +3152,7 @@ void Notify_Background( const SdrObject* pObj, // --> OD 2008-01-30 #i82258# - make code robust ViewShell* pSh = 0; if ( bInva && pPage && - 0 != (pSh = pPage->GetShell()) ) + 0 != (pSh = pPage->getRootFrm()->GetCurrShell()) ) { pSh->InvalidateWindows( rRect ); } @@ -3364,11 +3199,7 @@ const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos ) return pFrm; } -/************************************************************************* -|* -|* IsLowerOf() -|* -|*************************************************************************/ +/*************************************************************************/ sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) { @@ -3382,7 +3213,7 @@ sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) } else { - pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchorFrm(); + pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchorFrm(pObj); aPos = pObj->GetCurrentBoundRect().TopLeft(); } ASSERT( pFrm, "8-( Fly is lost in Space." ); @@ -3516,35 +3347,73 @@ const SwFrm* MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage ) return pPage; } -SwFrm* GetFrmOfModify( SwModify const& rMod, sal_uInt16 const nFrmType, +#include <svl/smplhint.hxx> +class SwFrmHolder : private SfxListener +{ + SwFrm* pFrm; + bool bSet; + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +public: + SwFrmHolder() : pFrm(0), bSet(false) {} + void SetFrm( SwFrm* pHold ); + SwFrm* GetFrm() { return pFrm; } + void Reset(); + bool IsSet() { return bSet; } +}; + +void SwFrmHolder::SetFrm( SwFrm* pHold ) +{ + bSet = true; + pFrm = pHold; + StartListening(*pHold); +} + +void SwFrmHolder::Reset() +{ + if (pFrm) + EndListening(*pFrm); + bSet = false; + pFrm = 0; +} + +void SwFrmHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + if ( ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DYING && &rBC == pFrm ) + pFrm = 0; + } +} + +SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const& rMod, sal_uInt16 const nFrmType, const Point* pPoint, const SwPosition *pPos, const sal_Bool bCalcFrm ) { SwFrm *pMinFrm = 0, *pTmpFrm; + SwFrmHolder aHolder; SwRect aCalcRect; bool bClientIterChanged = false; - SwClientIter aIter( rMod ); + SwIterator<SwFrm,SwModify> aIter( rMod ); do { pMinFrm = 0; + aHolder.Reset(); sal_uInt64 nMinDist = 0; bClientIterChanged = false; - for( pTmpFrm = (SwFrm*)aIter.First( TYPE( SwFrm )); pTmpFrm; - pTmpFrm = (SwFrm*)aIter.Next() ) + for( pTmpFrm = aIter.First(); pTmpFrm; pTmpFrm = aIter.Next() ) { if( pTmpFrm->GetType() & nFrmType && + ( !pLayout || pLayout == pTmpFrm->getRootFrm() ) && (!pTmpFrm->IsFlowFrm() || !SwFlowFrm::CastFlowFrm( pTmpFrm )->IsFollow() )) { if( pPoint ) { - // --> FME 2006-02-03 #127369# - // Set pointer to be watched. If a client is removed from - // rMod (e.g., by deleting a frame), the bWatchDeleted flag - // is set at the SwClientIter. - const bool bWatchClientSet = pMinFrm != 0; - aIter.SetWatchClient( pMinFrm ); - // <-- + // watch for Frm being deleted + if ( pMinFrm ) + aHolder.SetFrm( pMinFrm ); + else + aHolder.Reset(); if( bCalcFrm ) { @@ -3562,14 +3431,13 @@ SwFrm* GetFrmOfModify( SwModify const& rMod, sal_uInt16 const nFrmType, pTmpFrm->Calc(); } - // --> FME 2006-02-03 #127369# - // The SwClientIter list has changed. Restart. - // aIter.IsChanged basically checks if pTmpFrm has been - // deleted. bWatchClientSet && aIter.GetWatchClient() - // checks if pMinFrm has been deleted. - // <-- - if( aIter.IsChanged() || ( bWatchClientSet && !aIter.GetWatchClient() ) ) + // #127369# + // aIter.IsChanged checks if the current pTmpFrm has been deleted while + // it is the current iterator + // FrmHolder watches for deletion of the current pMinFrm + if( aIter.IsChanged() || ( aHolder.IsSet() && !aHolder.GetFrm() ) ) { + // restart iteration bClientIterChanged = true; break; } @@ -3723,15 +3591,13 @@ bool SwDeletionChecker::HasBeenDeleted() if ( !mpFrm || !mpRegIn ) return false; - SwClientIter aIter( const_cast<SwModify&>(*mpRegIn) ); - const SwClient* pLast = aIter.GoStart(); - + SwIterator<SwFrm,SwModify> aIter(*mpRegIn); + SwFrm* pLast = aIter.First(); while ( pLast ) { - if ( pLast->ISA( SwFrm ) && pLast == mpFrm ) + if ( pLast == mpFrm ) return false; - - pLast = aIter++; + pLast = aIter.Next(); } return true; diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 08dee8d2e40e..ccdf4035d569 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -48,9 +48,10 @@ #include <ndindex.hxx> #include <sectfrm.hxx> #include <pam.hxx> -// --> OD 2005-05-17 #i49383# #include <objectformatter.hxx> -// <-- +#include "viewopt.hxx" +#include "viewsh.hxx" +#include <switerator.hxx> /************************************************************************* |* @@ -58,9 +59,6 @@ |* Dokument, dort stehen die Fussnoten gluecklicherweise nach ihrem |* Index sortiert. |* -|* Ersterstellung MA 29. Jun. 93 -|* Letzte Aenderung MA 13. Dec. 93 -|* |*************************************************************************/ #define ENDNOTE 0x80000000 @@ -119,9 +117,6 @@ sal_Bool SwFtnFrm::operator<( const SwTxtFtn* pTxtFtn ) const |* oder eine Seite (ohne Spalten) sein. Wenn die Seite dabei gewechselt wird |* enthaelt pPage die neue Seite und die Funktion liefert sal_True. |* -|* Ersterstellung AMA 06. Nov. 98 -|* Letzte Aenderung AMA 06. Nov. 98 -|* |*************************************************************************/ sal_Bool lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage, @@ -171,9 +166,6 @@ sal_Bool lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage, |* liefert die Spaltennummer, wenn pBoss eine Spalte ist, |* sonst eine Null (bei Seiten). |* -|* Ersterstellung AMA 06. Nov. 98 -|* Letzte Aenderung AMA 06. Nov. 98 -|* |*************************************************************************/ sal_uInt16 lcl_ColumnNum( const SwFrm* pBoss ) @@ -208,14 +200,11 @@ sal_uInt16 lcl_ColumnNum( const SwFrm* pBoss ) |* |* SwFtnContFrm::SwFtnContFrm() |* -|* Ersterstellung MA 24. Feb. 93 -|* Letzte Aenderung MA 02. Mar. 93 -|* |*************************************************************************/ -SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt ): - SwLayoutFrm( pFmt ) +SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt, SwFrm* pSib ): + SwLayoutFrm( pFmt, pSib ) { nType = FRMC_FTNCONT; } @@ -257,8 +246,6 @@ long lcl_Undersize( const SwFrm* pFrm ) |* |* Beschreibung: "Formatiert" den Frame; |* Die Fixsize wird hier nicht eingestellt. -|* Ersterstellung MA 01. Mar. 93 -|* Letzte Aenderung MA 17. Nov. 98 |* |*************************************************************************/ @@ -283,7 +270,14 @@ void SwFtnContFrm::Format( const SwBorderAttrs * ) if ( !bValidSize ) { - if ( pPage->IsFtnPage() && !GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + bool bGrow = pPage->IsFtnPage(); + if( bGrow ) + { + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + bGrow = false; + } + if( bGrow ) Grow( LONG_MAX, sal_False ); else { @@ -340,9 +334,6 @@ void SwFtnContFrm::Format( const SwBorderAttrs * ) |* |* SwFtnContFrm::GrowFrm(), ShrinkFrm() |* -|* Ersterstellung MA 24. Feb. 93 -|* Letzte Aenderung AMA 05. Nov. 98 -|* |*************************************************************************/ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool ) @@ -379,7 +370,8 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool ) return 0; } } - const bool bBrowseMode = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); SwPageFrm *pPage = pBoss->FindPageFrm(); if ( bBrowseMode || !pPage->IsFtnPage() ) { @@ -485,9 +477,19 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool ) SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, sal_Bool bTst, sal_Bool bInfo ) { SwPageFrm *pPage = FindPageFrm(); - if ( pPage && - ( !pPage->IsFtnPage() || - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) ) + bool bShrink = false; + if ( pPage ) + { + if( !pPage->IsFtnPage() ) + bShrink = true; + else + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + bShrink = true; + } + } + if( bShrink ) { SwTwips nRet = SwLayoutFrm::ShrinkFrm( nDiff, bTst, bInfo ); if( IsInSct() && !bTst ) @@ -507,14 +509,11 @@ SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, sal_Bool bTst, sal_Bool bInfo ) |* |* SwFtnFrm::SwFtnFrm() |* -|* Ersterstellung MA 24. Feb. 93 -|* Letzte Aenderung MA 11. Oct. 93 -|* |*************************************************************************/ -SwFtnFrm::SwFtnFrm( SwFrmFmt *pFmt, SwCntntFrm *pCnt, SwTxtFtn *pAt ): - SwLayoutFrm( pFmt ), +SwFtnFrm::SwFtnFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwCntntFrm *pCnt, SwTxtFtn *pAt ): + SwLayoutFrm( pFmt, pSib ), pFollow( 0 ), pMaster( 0 ), pRef( pCnt ), @@ -531,9 +530,6 @@ SwFtnFrm::SwFtnFrm( SwFrmFmt *pFmt, SwCntntFrm *pCnt, SwTxtFtn *pAt ): |* |* SwFtnFrm::InvalidateNxtFtnCnts() |* -|* Ersterstellung MA 29. Jun. 93 -|* Letzte Aenderung MA 29. Jun. 93 -|* |*************************************************************************/ @@ -601,9 +597,6 @@ SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) |* |* SwFtnFrm::Cut() |* -|* Ersterstellung MA 23. Feb. 94 -|* Letzte Aenderung MA 24. Jul. 95 -|* |*************************************************************************/ @@ -638,8 +631,8 @@ void SwFtnFrm::Cut() if ( pPage ) { SwLayoutFrm *pBody = pPage->FindBodyCont(); - if ( !pBody->ContainsCntnt() ) - pPage->FindRootFrm()->SetSuperfluous(); + if( pBody && !pBody->ContainsCntnt() ) + pPage->getRootFrm()->SetSuperfluous(); } SwSectionFrm* pSect = pUp->FindSctFrm(); pUp->Cut(); @@ -662,9 +655,6 @@ void SwFtnFrm::Cut() |* |* SwFtnFrm::Paste() |* -|* Ersterstellung MA 23. Feb. 94 -|* Letzte Aenderung MA 23. Feb. 94 -|* |*************************************************************************/ @@ -734,8 +724,6 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) |* Beschreibung Liefert das naechste LayoutBlatt in den das |* Frame gemoved werden kann. |* Neue Seiten werden nur dann erzeugt, wenn der Parameter sal_True ist. -|* Ersterstellung MA 16. Nov. 92 -|* Letzte Aenderung AMA 09. Nov. 98 |* |*************************************************************************/ @@ -829,8 +817,6 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage ) |* |* Beschreibung Liefert das vorhergehende LayoutBlatt in das der |* Frame gemoved werden kann. -|* Ersterstellung MA 16. Nov. 92 -|* Letzte Aenderung AMA 06. Nov. 98 |* |*************************************************************************/ @@ -962,9 +948,6 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn ) |* |* SwFrm::IsFtnAllowed() |* -|* Ersterstellung MA 22. Mar. 94 -|* Letzte Aenderung MA 01. Dec. 94 -|* |*************************************************************************/ @@ -987,9 +970,6 @@ sal_Bool SwFrm::IsFtnAllowed() const |* |* SwRootFrm::UpdateFtnNums() |* -|* Ersterstellung MA 02. Mar. 93 -|* Letzte Aenderung MA 09. Dec. 97 -|* |*************************************************************************/ @@ -1012,9 +992,6 @@ void SwRootFrm::UpdateFtnNums() |* RemoveFtns() Entfernen aller Fussnoten (nicht etwa die Referenzen) |* und Entfernen aller Fussnotenseiten. |* -|* Ersterstellung MA 05. Dec. 97 -|* Letzte Aenderung AMA 06. Nov. 98 -|* |*************************************************************************/ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes ) @@ -1108,9 +1085,6 @@ void SwRootFrm::RemoveFtns( SwPageFrm *pPage, sal_Bool bPageOnly, sal_Bool bEndN |* |* SetFtnPageDescs() Seitenvorlagen der Fussnotenseiten aendern |* -|* Ersterstellung MA 11. Dec. 97 -|* Letzte Aenderung MA 11. Dec. 97 -|* |*************************************************************************/ void SwRootFrm::CheckFtnPageDescs( sal_Bool bEndNote ) @@ -1129,9 +1103,6 @@ void SwRootFrm::CheckFtnPageDescs( sal_Bool bEndNote ) |* |* SwFtnBossFrm::MakeFtnCont() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1148,7 +1119,7 @@ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont() } #endif - SwFtnContFrm *pNew = new SwFtnContFrm( GetFmt()->GetDoc()->GetDfltFrmFmt()); + SwFtnContFrm *pNew = new SwFtnContFrm( GetFmt()->GetDoc()->GetDfltFrmFmt(), this ); SwLayoutFrm *pLay = FindBodyCont(); pNew->Paste( this, pLay->GetNext() ); return pNew; @@ -1158,9 +1129,6 @@ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont() |* |* SwFtnBossFrm::FindFtnCont() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1190,9 +1158,6 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont() |* |* SwFtnBossFrm::FindNearestFtnCont() Sucht den naechst greifbaren Fussnotencontainer. |* -|* Ersterstellung MA 02. Aug. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( sal_Bool bDontLeave ) @@ -1225,8 +1190,6 @@ SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( sal_Bool bDontLeave ) |* SwFtnBossFrm::FindFirstFtn() |* |* Beschreibung Erste Fussnote des Fussnotenbosses suchen. -|* Ersterstellung MA 26. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 99 |* |*************************************************************************/ @@ -1314,8 +1277,6 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn() |* SwFtnBossFrm::FindFirstFtn() |* |* Beschreibunt Erste Fussnote zum Cnt suchen. -|* Ersterstellung MA 04. Mar. 93 -|* Letzte Aenderung AMA 28. Oct. 98 |* |*************************************************************************/ @@ -1357,9 +1318,6 @@ const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const |* |* SwFtnBossFrm::ResetFtn() |* -|* Ersterstellung MA 11. May. 95 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1374,13 +1332,12 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) if ( !pNd ) pNd = pCheck->GetFmt()->GetDoc()-> GetNodes().GoNextSection( &aIdx, sal_True, sal_False ); - SwClientIter aIter( *pNd ); - SwClient* pLast = aIter.GoStart(); - while( pLast ) + SwIterator<SwFrm,SwCntntNode> aIter( *pNd ); + SwFrm* pFrm = aIter.First(); + while( pFrm ) { - if ( pLast->ISA(SwFrm) ) - { - SwFrm *pFrm = (SwFrm*)pLast; + if( pFrm->getRootFrm() == pCheck->getRootFrm() ) + { SwFrm *pTmp = pFrm->GetUpper(); while ( pTmp && !pTmp->IsFtnFrm() ) pTmp = pTmp->GetUpper(); @@ -1399,7 +1356,8 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) } } } - pLast = ++aIter; + + pFrm = aIter.Next(); } } @@ -1407,9 +1365,6 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) |* |* SwFtnBossFrm::InsertFtn() |* -|* Ersterstellung MA 26. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1685,9 +1640,6 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) |* |* SwFtnBossFrm::AppendFtn() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1832,7 +1784,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) } } - SwFtnFrm *pNew = new SwFtnFrm( pDoc->GetDfltFrmFmt(), pRef, pAttr ); + SwFtnFrm *pNew = new SwFtnFrm( pDoc->GetDfltFrmFmt(), this, pRef, pAttr ); { SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 ); ::_InsertCnt( pNew, pDoc, aIdx.GetIndex() ); @@ -1920,9 +1872,6 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) |* |* SwFtnBossFrm::FindFtn() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -1937,14 +1886,12 @@ SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr ) GetNodes().GoNextSection( &aIdx, sal_True, sal_False ); if ( !pNd ) return 0; - SwClientIter aIter( *pNd ); - SwClient *pClient; - if ( 0 != (pClient = aIter.GoStart()) ) + SwIterator<SwFrm,SwCntntNode> aIter( *pNd ); + SwFrm* pFrm = aIter.First(); + if( pFrm ) do { - if ( pClient->IsA( TYPE(SwFrm) ) ) - { - SwFrm *pFrm = ((SwFrm*)pClient)->GetUpper(); + pFrm = pFrm->GetUpper(); // #i28500#, #i27243# Due to the endnode collector, there are // SwFtnFrms, which are not in the layout. Therefore the // bInfFtn flags are not set correctly, and a cell of FindFtnFrm @@ -1962,8 +1909,8 @@ SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr ) pFtn = pFtn->GetMaster(); return pFtn; } - } - } while ( 0 != (pClient = aIter++) ); + + } while ( 0 != (pFrm = aIter.Next()) ); return 0; } @@ -1971,9 +1918,6 @@ SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr ) |* |* SwFtnBossFrm::RemoveFtn() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2005,9 +1949,6 @@ void SwFtnBossFrm::RemoveFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr, |* |* SwFtnBossFrm::ChangeFtnRef() |* -|* Ersterstellung MA 25. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2026,9 +1967,6 @@ void SwFtnBossFrm::ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *pAttr, |* |* SwFtnBossFrm::CollectFtns() |* -|* Ersterstellung MA 24. Jul. 95 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2094,9 +2032,6 @@ void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef, |* |* SwFtnBossFrm::_CollectFtns() |* -|* Ersterstellung MA 24. Jul. 95 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ inline void FtnInArr( SvPtrarr& rFtnArr, SwFtnFrm* pFtn ) { @@ -2256,9 +2191,6 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, |* |* SwFtnBossFrm::_MoveFtns() |* -|* Ersterstellung MA 26. Feb. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2474,9 +2406,6 @@ void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc ) |* |* SwFtnBossFrm::MoveFtns() |* -|* Ersterstellung BP 05. Aug. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2522,9 +2451,6 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, |* |* SwFtnBossFrm::RearrangeFtns() |* -|* Ersterstellung MA 20. Jan. 94 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ @@ -2766,9 +2692,6 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock, |* |* SwPageFrm::UpdateFtnNum() |* -|* Ersterstellung MA 02. Mar. 93 -|* Letzte Aenderung AMA 29. Oct. 98 -|* |*************************************************************************/ void SwPageFrm::UpdateFtnNum() @@ -2831,9 +2754,6 @@ void SwPageFrm::UpdateFtnNum() |* |* SwFtnBossFrm::SetFtnDeadLine() |* -|* Ersterstellung MA 02. Aug. 93 -|* Letzte Aenderung MA 16. Nov. 98 -|* |*************************************************************************/ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine ) @@ -2852,7 +2772,8 @@ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine ) else nMaxFtnHeight = -(pBody->Frm().*fnRect->fnBottomDist)( nDeadLine ); - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nMaxFtnHeight += pBody->Grow( LONG_MAX, sal_True ); if ( IsInSct() ) nMaxFtnHeight += FindSctFrm()->Grow( LONG_MAX, sal_True ); @@ -2867,9 +2788,6 @@ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine ) |* |* SwFtnBossFrm::GetVarSpace() |* -|* Ersterstellung MA 03. Apr. 95 -|* Letzte Aenderung MA 16. Nov. 98 -|* |*************************************************************************/ SwTwips SwFtnBossFrm::GetVarSpace() const { @@ -2934,9 +2852,12 @@ SwTwips SwFtnBossFrm::GetVarSpace() const } else nRet = 0; - if ( IsPageFrm() && - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + if ( IsPageFrm() ) + { + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nRet += BROWSE_HEIGHT - Frm().Height(); + } return nRet; } @@ -2952,9 +2873,6 @@ SwTwips SwFtnBossFrm::GetVarSpace() const |* gibt und die Fussnoten nicht vom Bereich eingesammelt werden, ist ein Adjust.., |* ansonsten ein Grow/Shrink notwendig. |* -|* Ersterstellung AMA 09. Dec 98 -|* Letzte Aenderung AMA 09. Dec 98 -|* |*************************************************************************/ sal_uInt8 SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* ) const @@ -2990,9 +2908,6 @@ sal_uInt8 SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* ) const |* |* SwPageFrm::SetColMaxFtnHeight() |* -|* Ersterstellung AMA 29. Oct 98 -|* Letzte Aenderung AMA 29. Oct 98 -|* |*************************************************************************/ void SwPageFrm::SetColMaxFtnHeight() { @@ -3012,9 +2927,6 @@ void SwPageFrm::SetColMaxFtnHeight() |* |* SwLayoutFrm::MoveLowerFtns |* -|* Ersterstellung MA 01. Sep. 94 -|* Letzte Aenderung MA 05. Sep. 95 -|* |*************************************************************************/ @@ -3110,9 +3022,6 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, |* |* SwLayoutFrm::MoveFtnCntFwd() |* -|* Ersterstellung MA 24. Nov. 94 -|* Letzte Aenderung MA 15. Jun. 95 -|* |*************************************************************************/ @@ -3183,7 +3092,7 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) //Fussnote erzeugen. SwFtnFrm *pOld = FindFtnFrm(); pTmpFtn = new SwFtnFrm( pOld->GetFmt()->GetDoc()->GetDfltFrmFmt(), - pOld->GetRef(), pOld->GetAttr() ); + pOld, pOld->GetRef(), pOld->GetAttr() ); //Verkettung der Fussnoten. if ( pOld->GetFollow() ) { @@ -3252,9 +3161,6 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) |* |* class SwSaveFtnHeight |* -|* Ersterstellung MA 19. Jan. 94 -|* Letzte Aenderung MA 19. Jan. 94 -|* |*************************************************************************/ @@ -3317,7 +3223,7 @@ SwCntntFrm* SwFtnFrm::GetRefFromAttr() ASSERT( pAttr, "invalid Attribute" ); SwTxtNode& rTNd = (SwTxtNode&)pAttr->GetTxtNode(); SwPosition aPos( rTNd, SwIndex( &rTNd, *pAttr->GetStart() )); - SwCntntFrm* pCFrm = rTNd.GetFrm( 0, &aPos, sal_False ); + SwCntntFrm* pCFrm = rTNd.getLayoutFrm( getRootFrm(), 0, &aPos, sal_False ); return pCFrm; } diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 57790fbb3eb3..519ca072ed59 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -35,7 +35,9 @@ #include <fmtcntnt.hxx> #include <fmthdft.hxx> #include <fmtfsize.hxx> +#include "viewopt.hxx" #include "hffrm.hxx" +#include "rootfrm.hxx" #include "txtfrm.hxx" #include "sectfrm.hxx" #include "flyfrm.hxx" @@ -117,8 +119,8 @@ static void lcl_LayoutFrmEnsureMinHeight(SwLayoutFrm & rFrm, } } -SwHeadFootFrm::SwHeadFootFrm( SwFrmFmt * pFmt, sal_uInt16 nTypeIn) - : SwLayoutFrm(pFmt) +SwHeadFootFrm::SwHeadFootFrm( SwFrmFmt * pFmt, SwFrm* pSib, sal_uInt16 nTypeIn) + : SwLayoutFrm( pFmt, pSib ) { nType = nTypeIn; SetDerivedVert( sal_False ); @@ -708,9 +710,10 @@ void SwPageFrm::PrepareHeader() if ( !pLay ) return; - const SwFmtHeader &rH = ((SwFrmFmt*)pRegisteredIn)->GetHeader(); + const SwFmtHeader &rH = ((SwFrmFmt*)GetRegisteredIn())->GetHeader(); - const sal_Bool bOn = !((SwFrmFmt*)pRegisteredIn)->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bOn = !(pSh && pSh->GetViewOptions()->getBrowseMode()); if ( bOn && rH.IsActive() ) { //Header einsetzen, vorher entfernen falls vorhanden. @@ -727,7 +730,7 @@ void SwPageFrm::PrepareHeader() delete pDel; } ASSERT( pLay, "Wohin mit dem Header?" ); - SwHeaderFrm *pH = new SwHeaderFrm( (SwFrmFmt*)rH.GetHeaderFmt() ); + SwHeaderFrm *pH = new SwHeaderFrm( (SwFrmFmt*)rH.GetHeaderFmt(), this ); pH->Paste( this, pLay ); if ( GetUpper() ) ::RegistFlys( this, pH ); @@ -756,11 +759,12 @@ void SwPageFrm::PrepareFooter() if ( !pLay ) return; - const SwFmtFooter &rF = ((SwFrmFmt*)pRegisteredIn)->GetFooter(); + const SwFmtFooter &rF = ((SwFrmFmt*)GetRegisteredIn())->GetFooter(); while ( pLay->GetNext() ) pLay = (SwLayoutFrm*)pLay->GetNext(); - const sal_Bool bOn = !((SwFrmFmt*)pRegisteredIn)->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bOn = !(pSh && pSh->GetViewOptions()->getBrowseMode()); if ( bOn && rF.IsActive() ) { //Footer einsetzen, vorher entfernen falls vorhanden. @@ -774,7 +778,7 @@ void SwPageFrm::PrepareFooter() pLay->Cut(); delete pLay; } - SwFooterFrm *pF = new SwFooterFrm( (SwFrmFmt*)rF.GetFooterFmt() ); + SwFooterFrm *pF = new SwFooterFrm( (SwFrmFmt*)rF.GetFooterFmt(), this ); pF->Paste( this ); if ( GetUpper() ) ::RegistFlys( this, pF ); @@ -782,10 +786,10 @@ void SwPageFrm::PrepareFooter() else if ( pLay && pLay->IsFooterFrm() ) { //Footer entfernen falls vorhanden. ::DelFlys( pLay, this ); - ViewShell *pSh; - if ( pLay->GetPrev() && 0 != (pSh = GetShell()) && - pSh->VisArea().HasArea() ) - pSh->InvalidateWindows( pSh->VisArea() ); + ViewShell *pShell; + if ( pLay->GetPrev() && 0 != (pShell = getRootFrm()->GetCurrShell()) && + pShell->VisArea().HasArea() ) + pShell->InvalidateWindows( pShell->VisArea() ); pLay->Cut(); delete pLay; } diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 1608425d94ab..c2e064d31e0f 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -438,7 +438,8 @@ sal_Bool SwLayAction::RemoveEmptyBrowserPages() //Beim umschalten vom normalen in den Browsermodus bleiben u.U. einige //unangenehm lange stehen. Diese beseiten wir mal schnell. sal_Bool bRet = sal_False; - if ( pRoot->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = pRoot->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) { SwPageFrm *pPage = (SwPageFrm*)pRoot->Lower(); do @@ -1191,7 +1192,8 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrm* _pPage, sal_Bool SwLayAction::IsShortCut( SwPageFrm *&prPage ) { sal_Bool bRet = sal_False; - const sal_Bool bBrowse = pRoot->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = pRoot->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); //Wenn die Seite nicht Gueltig ist wird sie schnell formatiert, sonst //gibts nix als Aerger. @@ -1440,18 +1442,13 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect ) sal_Bool bNoPaint = sal_False; if ( pLay->IsPageBodyFrm() && pLay->Frm().Pos() == aOldRect.Pos() && - pLay->Lower() && - pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + pLay->Lower() ) { - //HotFix: Vobis Homepage, nicht so genau hinsehen, sonst - //rpaints - + const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell(); //Einschraenkungen wegen Kopf-/Fusszeilen - if ( !( pLay->IsCompletePaint() && - pLay->FindPageFrm()->FindFtnCont() ) ) - { + if( pSh && pSh->GetViewOptions()->getBrowseMode() && + !( pLay->IsCompletePaint() && pLay->FindPageFrm()->FindFtnCont() ) ) bNoPaint = sal_True; - } } if ( !bNoPaint && IsPaint() && bAddRect && (pLay->IsCompletePaint() || bChanged) ) @@ -1492,8 +1489,14 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect ) aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth); } - if ( pLay->IsPageFrm() && - pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + sal_Bool bPageInBrowseMode = pLay->IsPageFrm(); + if( bPageInBrowseMode ) + { + const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell(); + if( !pSh || !pSh->GetViewOptions()->getBrowseMode() ) + bPageInBrowseMode = sal_False; + } + if( bPageInBrowseMode ) { // NOTE: no vertical layout in online layout //Ist die Aenderung ueberhaupt sichtbar? @@ -1848,7 +1851,8 @@ sal_Bool SwLayAction::FormatLayoutTab( SwTabFrm *pTab, sal_Bool bAddRect ) sal_Bool SwLayAction::FormatCntnt( const SwPageFrm *pPage ) { const SwCntntFrm *pCntnt = pPage->ContainsCntnt(); - const sal_Bool bBrowse = pRoot->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = pRoot->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); while ( pCntnt && pPage->IsAnLower( pCntnt ) ) { diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index bab2154bc7a9..dbc59bc25fa5 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -55,6 +55,8 @@ #include <frmtool.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> +#include "viewopt.hxx" +#include "viewsh.hxx" #include <flyfrm.hxx> // OD 2004-05-24 #i28701# #include <sortedobjs.hxx> @@ -186,7 +188,7 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream ) void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) { - if( rDoc.GetRootFrm() ) // the layout itself .. + if( rDoc.GetCurrentLayout() ) // the layout itself .. //swmod 080218 { SwLayCacheIoImpl aIo( rStream, sal_True ); // We want to save the relative index, so we need the index @@ -194,7 +196,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent(). StartOfSectionNode()->GetIndex(); // The first page.. - SwPageFrm* pPage = (SwPageFrm*)rDoc.GetRootFrm()->Lower(); + SwPageFrm* pPage = (SwPageFrm*)rDoc.GetCurrentLayout()->Lower(); //swmod 080218 aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES ); aIo.OpenFlagRec( 0, 0 ); @@ -347,13 +349,16 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) #ifdef DBG_UTIL sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const { + if( !pImpl ) + return sal_True; + const SwRootFrm *pRootFrm = rDoc.GetCurrentLayout(); sal_Bool bRet = sal_True; - if( pImpl && rDoc.GetRootFrm() ) + if( pRootFrm ) { sal_uInt16 nIndex = 0; sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent(). StartOfSectionNode()->GetIndex(); - SwPageFrm* pPage = (SwPageFrm*)rDoc.GetRootFrm()->Lower(); + SwPageFrm* pPage = (SwPageFrm*)pRootFrm->Lower(); if( pPage ) pPage = (SwPageFrm*)pPage->GetNext(); while( pPage ) @@ -597,7 +602,10 @@ sal_uLong SwLayHelper::CalcPageCount() } if ( nNdCount < 1000 ) nPgCount = 0;// no progress bar for small documents - if ( pDoc->get(IDocumentSettingAccess::BROWSE_MODE) ) + ViewShell *pSh = 0; + if( rpLay && rpLay->getRootFrm() ) + pSh = rpLay->getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nMaxParaPerPage *= 6; } } @@ -892,7 +900,7 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) { ASSERT( pTab->GetTable()->GetTabLines()[ nRowIdx ], "Table ohne Zeilen?" ); pHeadline = - new SwRowFrm( *pTab->GetTable()->GetTabLines()[ nRowIdx ] ); + new SwRowFrm( *pTab->GetTable()->GetTabLines()[ nRowIdx ], pTab ); pHeadline->SetRepeatedHeadline( true ); pHeadline->InsertBefore( pFoll, 0 ); pHeadline->RegistFlys(); @@ -924,7 +932,7 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) else { SwTxtFrm *pNew = new SwTxtFrm( ((SwTxtFrm*)rpFrm)-> - GetTxtNode() ); + GetTxtNode(), rpFrm ); pNew->_SetIsFollow( sal_True ); pNew->ManipOfst( nOfst ); pNew->SetFollow( ((SwTxtFrm*)rpFrm)->GetFollow() ); diff --git a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx index 2b980612a98c..7ad0464a75c8 100644 --- a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx +++ b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx @@ -29,11 +29,10 @@ #include "precompiled_sw.hxx" #include <movedfwdfrmsbyobjpos.hxx> #include <txtfrm.hxx> -// --> OD 2004-10-05 #i26945# #include <rowfrm.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> -// <-- +#include <switerator.hxx> SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos() { @@ -86,10 +85,8 @@ bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm const NodeMapEntry& rEntry = *(aIter); if ( rEntry.second >= nPageNumOfRow ) { - SwClientIter aFrmIter( *const_cast<SwTxtNode*>( rEntry.first ) ); - for( SwTxtFrm* pTxtFrm = (SwTxtFrm*)aFrmIter.First( TYPE(SwTxtFrm) ); - pTxtFrm; - pTxtFrm = (SwTxtFrm*)aFrmIter.Next() ) + SwIterator<SwTxtFrm,SwTxtNode> aFrmIter( *rEntry.first ); + for( SwTxtFrm* pTxtFrm = aFrmIter.First(); pTxtFrm; pTxtFrm = (SwTxtFrm*)aFrmIter.Next() ) { // --> OD 2004-12-03 #115759# - assure that found text frame // is the first one. diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 9da088849559..4014f37231ec 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -482,7 +482,7 @@ void InitCurrShells( SwRootFrm *pRoot ) SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : SwLayoutFrm( pFmt->GetDoc()->MakeFrmFmt( - XubString( "Root", RTL_TEXTENCODING_MS_1252 ), pFmt ) ), + XubString( "Root", RTL_TEXTENCODING_MS_1252 ), pFmt ), 0 ), // --> PAGES01 maPagesArea(), mnViewWidth( -1 ), @@ -504,7 +504,11 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : nType = FRMC_ROOT; bIdleFormat = bTurboAllowed = bAssertFlyPages = bIsNewLayout = sal_True; bCheckSuperfluous = bBrowseWidthValid = sal_False; + setRootFrm( this ); +} +void SwRootFrm::Init( SwFrmFmt* pFmt ) +{ InitCurrShells( this ); IDocumentTimerAccess *pTimerAccess = pFmt->getIDocumentTimerAccess(); @@ -512,14 +516,17 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : IDocumentFieldsAccess *pFieldsAccess = pFmt->getIDocumentFieldsAccess(); const IDocumentSettingAccess *pSettingAccess = pFmt->getIDocumentSettingAccess(); pTimerAccess->StopIdling(); - pLayoutAccess->SetRootFrm( this ); //Fuer das Erzeugen der Flys durch MakeFrms() + pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() ); //Fuer das Erzeugen der Flys durch MakeFrms() //swmod 071108//swmod 071225 bCallbackActionEnabled = sal_False; //vor Verlassen auf sal_True setzen! SdrModel *pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel(); - if ( pMd ) { - pDrawPage = pMd->GetPage( 0 ); + // Disable "multiple layout" + pDrawPage = pMd->GetPage(0); //pMd->AllocPage( FALSE ); + //pMd->InsertPage( pDrawPage ); + // end of disabling + pDrawPage->SetSize( Frm().SSize() ); } @@ -609,8 +616,9 @@ SwRootFrm::~SwRootFrm() pTurbo = 0; if(pBlink) pBlink->FrmDelete( this ); - ((SwFrmFmt*)pRegisteredIn)->GetDoc()->DelFrmFmt( (SwFrmFmt*)pRegisteredIn ); + static_cast<SwFrmFmt*>(GetRegisteredInNonConst())->GetDoc()->DelFrmFmt( static_cast<SwFrmFmt*>(GetRegisteredInNonConst()) ); delete pDestroy; + pDestroy = 0; //Referenzen entfernen. for ( sal_uInt16 i = 0; i < pCurrShells->Count(); ++i ) @@ -643,5 +651,38 @@ void SwRootFrm::RemoveMasterObjs( SdrPage *pPg ) } +void SwRootFrm::AllCheckPageDescs() const +{ + CheckPageDescs( (SwPageFrm*)this->Lower() ); +} +//swmod 080226 +void SwRootFrm::AllInvalidateAutoCompleteWords() const +{ + SwPageFrm *pPage = (SwPageFrm*)this->Lower(); + while ( pPage ) + { + pPage->InvalidateAutoCompleteWords(); + pPage = (SwPageFrm*)pPage->GetNext(); + } +}//swmod 080305 +void SwRootFrm::AllAddPaintRect() const +{ + GetCurrShell()->AddPaintRect( this->Frm() ); +}//swmod 080305 +void SwRootFrm::AllRemoveFtns() +{ + RemoveFtns(); +} +void SwRootFrm::AllInvalidateSmartTagsOrSpelling(sal_Bool bSmartTags) const +{ + SwPageFrm *pPage = (SwPageFrm*)this->Lower(); + while ( pPage ) + { + if ( bSmartTags ) + pPage->InvalidateSmartTags(); + pPage->InvalidateSpelling(); + pPage = (SwPageFrm*)pPage->GetNext(); + } //swmod 080218 +} diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 9792fc09ed42..8ee7d7a35ee8 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -46,6 +46,7 @@ #include <docsh.hxx> #include "viewimp.hxx" +#include "viewopt.hxx" #include "pagefrm.hxx" #include "rootfrm.hxx" #include "cntfrm.hxx" @@ -73,9 +74,8 @@ #include "poolfmt.hxx" #include <editeng/frmdiritem.hxx> #include <swfntcch.hxx> // SwFontAccess -// OD 2004-05-24 #i28701# #include <sortedobjs.hxx> - +#include <switerator.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star; @@ -89,8 +89,8 @@ using namespace ::com::sun::star; |* Letzte Aenderung MA 01. Aug. 93 |* |*************************************************************************/ -SwBodyFrm::SwBodyFrm( SwFrmFmt *pFmt ): - SwLayoutFrm( pFmt ) +SwBodyFrm::SwBodyFrm( SwFrmFmt *pFmt, SwFrm* pSib ): + SwLayoutFrm( pFmt, pSib ) { nType = FRMC_BODY; } @@ -197,8 +197,8 @@ void SwBodyFrm::Format( const SwBorderAttrs * ) |* Letzte Aenderung MA 08. Dec. 97 |* |*************************************************************************/ -SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) : - SwFtnBossFrm( pFmt ), +SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) : + SwFtnBossFrm( pFmt, pSib ), pSortedObjs( 0 ), pDesc( pPgDsc ), nPhyPageNum( 0 ), @@ -222,12 +222,12 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) : bInvalidLayout = bInvalidCntnt = bInvalidSpelling = bInvalidSmartTags = bInvalidAutoCmplWrds = bInvalidWordCount = sal_True; bInvalidFlyLayout = bInvalidFlyCntnt = bInvalidFlyInCnt = bFtnPage = bEndNotePage = sal_False; - const bool bBrowseMode = pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + ViewShell *pSh = getRootFrm()->GetCurrShell(); + const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); if ( bBrowseMode ) { Frm().Height( 0 ); - ViewShell *pSh = GetShell(); - long nWidth = pSh ? pSh->VisArea().Width():0; + long nWidth = pSh->VisArea().Width(); if ( !nWidth ) nWidth = 5000L; //aendert sich sowieso Frm().Width ( nWidth ); @@ -242,7 +242,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) : { bEmptyPage = sal_False; Calc(); //Damit die PrtArea stimmt. - SwBodyFrm *pBodyFrm = new SwBodyFrm( pDoc->GetDfltFrmFmt() ); + SwBodyFrm *pBodyFrm = new SwBodyFrm( pDoc->GetDfltFrmFmt(), this ); pBodyFrm->ChgSize( Prt().SSize() ); pBodyFrm->Paste( this ); pBodyFrm->Calc(); //Damit die Spalten korrekt @@ -292,7 +292,7 @@ SwPageFrm::~SwPageFrm() SwDoc *pDoc = GetFmt()->GetDoc(); if( pDoc && !pDoc->IsInDtor() ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( pSh ) { SwViewImp *pImp = pSh->Imp(); @@ -341,27 +341,33 @@ void SwPageFrm::CheckDirection( sal_Bool bVert ) ((SvxFrameDirectionItem&)GetFmt()->GetFmtAttr( RES_FRAMEDIR )).GetValue(); if( bVert ) { - if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir || - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) - //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir ) { - bVertical = 0; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin bVertLR = 0; + bVertical = 0; } else { - bVertical = 1; - if(FRMDIR_VERT_TOP_RIGHT == nDir) + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + { + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin bVertLR = 0; - else if(FRMDIR_VERT_TOP_LEFT==nDir) - bVertLR = 1; + bVertical = 0; + } + else + { + bVertical = 1; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if(FRMDIR_VERT_TOP_RIGHT == nDir) + bVertLR = 0; + else if(FRMDIR_VERT_TOP_LEFT==nDir) + bVertLR = 1; + } } -/* - if( pDesc && pDesc->GetName().GetChar(0)=='x') - bReverse = 1; - else - */ - bReverse = 0; + + bReverse = 0; bInvalidVert = 0; } else @@ -466,17 +472,15 @@ void MA_FASTCALL lcl_MakeObjs( const SwSpzFrmFmts &rTbl, SwPageFrm *pPage ) } else { - SwClientIter aIter( *pFmt ); - SwClient *pTmp = aIter.First( TYPE(SwFrm) ); - SwFlyFrm *pFly; - if ( pTmp ) + SwIterator<SwFlyFrm,SwFmt> aIter( *pFmt ); + SwFlyFrm *pFly = aIter.First(); + if ( pFly) { - pFly = (SwFlyFrm*)pTmp; if( pFly->GetAnchorFrm() ) pFly->AnchorFrm()->RemoveFly( pFly ); } else - pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pPg ); + pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pPg, pPg ); pPg->AppendFly( pFly ); ::RegistFlys( pPg, pFly ); } @@ -541,9 +545,9 @@ void SwPageFrm::PreparePage( sal_Bool bFtn ) |* Letzte Aenderung MA 03. Mar. 96 |* |*************************************************************************/ -void SwPageFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwPageFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( pSh ) pSh->SetFirstVisPageInvalid(); sal_uInt8 nInvFlags = 0; @@ -588,7 +592,7 @@ void SwPageFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) } } -void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, +void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) { @@ -633,7 +637,8 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, case RES_FRM_SIZE: { const SwRect aOldPageFrmRect( Frm() ); - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) { bValidSize = sal_False; // OD 28.10.2002 #97265# - Don't call <SwPageFrm::MakeAll()> @@ -661,8 +666,7 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 ); } //Window aufraeumen. - ViewShell *pSh; - if ( 0 != (pSh = GetShell()) && pSh->GetWin() && aOldPageFrmRect.HasArea() ) + if( pSh && pSh->GetWin() && aOldPageFrmRect.HasArea() ) { // OD 12.02.2003 #i9719#, #105645# - consider border and shadow of // page frame for determine 'old' rectangle - it's used for invalidating. @@ -801,7 +805,8 @@ SwPageDesc *SwPageFrm::FindPageDesc() SwPageDesc *pRet = 0; //5. - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) { SwCntntFrm *pFrm = GetUpper()->ContainsCntnt(); while ( !pFrm->IsInDocBody() ) @@ -858,10 +863,13 @@ void AdjustSizeChgNotify( SwRootFrm *pRoot ) ViewShell *pSh = pRoot->GetCurrShell(); if ( pSh ) { - pSh->Imp()->NotifySizeChg( pRoot->Frm().SSize() );//Einmal fuer das Drawing. do { - pSh->SizeChgNotify(); //Einmal fuer jede Sicht. + if( pRoot == pSh->GetLayout() ) + { + pSh->SizeChgNotify(); + pSh->Imp()->NotifySizeChg( pRoot->Frm().SSize() ); + } pSh = (ViewShell*)pSh->GetNext(); } while ( pSh != pRoot->GetCurrShell() ); } @@ -887,7 +895,7 @@ void SwPageFrm::Cut() // PAGES01 //AdjustRootSize( CHG_CUTPAGE, 0 ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( !IsEmptyPage() ) { if ( GetNext() ) @@ -993,9 +1001,11 @@ void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) InvalidatePos(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if ( pSh ) + pSh->SetFirstVisPageInvalid(); // PAGES01 - if ( GetUpper() ) - static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 ); + getRootFrm()->CheckViewLayout( 0, 0 ); } /************************************************************************* @@ -1077,7 +1087,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields ) { ASSERT( pStart, "Keine Startpage." ); - ViewShell *pSh = pStart->GetShell(); + ViewShell *pSh = pStart->getRootFrm()->GetCurrShell(); SwViewImp *pImp = pSh ? pSh->Imp() : 0; if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() ) @@ -1168,7 +1178,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields ) { if ( pPage->GetPrev() ) pDesc = ((SwPageFrm*)pPage->GetPrev())->GetPageDesc(); - SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFmt(),pDesc); + SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFmt(),pRoot,pDesc); pTmp->Paste( pRoot, pPage ); pTmp->PreparePage( sal_False ); pPage = pTmp; @@ -1327,7 +1337,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) if( bWishedOdd != bNextOdd ) { pFmt = pDoc->GetEmptyPageFmt(); SwPageDesc *pTmpDesc = pPrevPage->GetPageDesc(); - SwPageFrm *pPage = new SwPageFrm( pFmt, pTmpDesc ); + SwPageFrm *pPage = new SwPageFrm( pFmt, pRoot, pTmpDesc ); pPage->Paste( pRoot, pSibling ); pPage->PreparePage( bFtn ); //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten @@ -1347,7 +1357,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) } pFmt = bWishedOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt(); ASSERT( pFmt, "Descriptor without format." ); - SwPageFrm *pPage = new SwPageFrm( pFmt, pDesc ); + SwPageFrm *pPage = new SwPageFrm( pFmt, pRoot, pDesc ); pPage->Paste( pRoot, pSibling ); pPage->PreparePage( bFtn ); //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten @@ -1370,7 +1380,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) if ( bCheckPages ) { CheckPageDescs( pSibling, sal_False ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); SwViewImp *pImp = pSh ? pSh->Imp() : 0; if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() ) { @@ -1387,7 +1397,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) //Fuer das Aktualisieren der Seitennummern-Felder gibt nDocPos //die Seitenposition an, _ab_ der invalidiert werden soll. - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( !pSh || !pSh->Imp()->IsUpdateExpFlds() ) { SwDocPosUpdate aMsgHnt( pPrevPage->Frm().Top() ); @@ -1398,17 +1408,15 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const { - if ( !GetShell() || - GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( !pSh || pSh->GetViewOptions()->getBrowseMode() ) { - // --> OD 2010-06-03 #i111964# - provide default sidebar position return sw::sidebarwindows::SIDEBAR_RIGHT; - // <-- } else { - const bool bLTR = GetUpper() ? static_cast<const SwRootFrm*>(GetUpper())->IsLeftToRightViewLayout() : true; - const bool bBookMode = GetShell()->GetViewOptions()->IsViewLayoutBookMode(); + const bool bLTR = getRootFrm()->IsLeftToRightViewLayout(); + const bool bBookMode = pSh->GetViewOptions()->IsViewLayoutBookMode(); const bool bRightSidebar = bLTR ? (!bBookMode || OnRightPage()) : (bBookMode && !OnRightPage()); return bRightSidebar @@ -1549,7 +1557,7 @@ void SwRootFrm::RemoveSuperfluous() } } while ( pPage ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( nDocPos != LONG_MAX && (!pSh || !pSh->Imp()->IsUpdateExpFlds()) ) { @@ -1610,7 +1618,7 @@ void SwRootFrm::AssertFlyPages() { //Leerseite einfuegen, die Flys werden aber erst von //der naechsten Seite aufgenommen! - pPage = new SwPageFrm( pDoc->GetEmptyPageFmt(), pDesc ); + pPage = new SwPageFrm( pDoc->GetEmptyPageFmt(), this, pDesc ); pPage->Paste( this, pSibling ); pPage->PreparePage( sal_False ); bOdd = bOdd ? sal_False : sal_True; @@ -1618,7 +1626,7 @@ void SwRootFrm::AssertFlyPages() } pPage = new SwPageFrm( (bOdd ? pDesc->GetRightFmt() : - pDesc->GetLeftFmt()), pDesc ); + pDesc->GetLeftFmt()), this, pDesc ); pPage->Paste( this, pSibling ); pPage->PreparePage( sal_False ); bOdd = bOdd ? sal_False : sal_True; @@ -1683,13 +1691,13 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage ) //Umhaengen kann er sich selbst, indem wir ihm //einfach ein Modify mit seinem AnkerAttr schicken. #ifndef DBG_UTIL - rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); + rFmt.NotifyClients( 0, (SwFmtAnchor*)&rAnch ); #else const sal_uInt32 nCnt = pPage->GetSortedObjs()->Count(); - rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); + rFmt.NotifyClients( 0, (SwFmtAnchor*)&rAnch ); ASSERT( !pPage->GetSortedObjs() || nCnt != pPage->GetSortedObjs()->Count(), - "Kann das Obj nicht umhaengen." ); + "Object couldn't be reattached!" ); #endif --i; } @@ -1769,8 +1777,8 @@ void SwRootFrm::ImplInvalidateBrowseWidth() |*************************************************************************/ void SwRootFrm::ImplCalcBrowseWidth() { - ASSERT( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE), - "CalcBrowseWidth and not in BrowseView" ); + ASSERT( GetCurrShell() && GetCurrShell()->GetViewOptions()->getBrowseMode(), + "CalcBrowseWidth and not in BrowseView" ) //Die (minimale) Breite wird von Rahmen, Tabellen und Zeichenobjekten //bestimmt. Die Breite wird nicht anhand ihrer aktuellen Groessen bestimmt, @@ -1787,7 +1795,7 @@ void SwRootFrm::ImplCalcBrowseWidth() return; bBrowseWidthValid = sal_True; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); nBrowseWidth = pSh ? MINLAY + 2 * pSh->GetOut()-> PixelToLogic( pSh->GetBrowseBorder() ).Width() @@ -2037,7 +2045,8 @@ void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset ) if ( pFlyFrm->Lower()->IsNoTxtFrm() ) { SwCntntFrm* pCntntFrm = static_cast<SwCntntFrm*>(pFlyFrm->Lower()); - ViewShell *pSh = pFlyFrm->Lower()->GetShell(); + SwRootFrm* pRoot = pFlyFrm->Lower()->getRootFrm(); + ViewShell *pSh = pRoot ? pRoot->GetCurrShell() : 0; if ( pSh ) { SwOLENode* pNode = pCntntFrm->GetNode()->GetOLENode(); @@ -2092,7 +2101,7 @@ void lcl_MoveAllLowers( SwFrm* pFrm, const Point& rOffset ) // Don't forget accessibility: if( pFrm->IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + SwRootFrm *pRootFrm = pFrm->getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -2191,7 +2200,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi bool bPageChanged = false; const bool bRTL = !IsLeftToRightViewLayout(); - const SwTwips nSidebarWidth = SwPageFrm::GetSidebarBorderWidth( GetShell() ); + const SwTwips nSidebarWidth = SwPageFrm::GetSidebarBorderWidth( GetCurrShell() ); while ( pPageFrm ) { @@ -2431,7 +2440,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi ::AdjustSizeChgNotify( this ); Calc(); - ViewShell* pSh = GetShell(); + ViewShell* pSh = GetCurrShell(); if ( pSh && pSh->GetDoc()->GetDocShell() ) { diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 71eaebf14893..0614a2c7c654 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -50,6 +50,7 @@ #include <frmtool.hxx> #include <doc.hxx> // fuer GetAttrPool #include <poolfmt.hxx> +#include <switerator.hxx> /************************************************************************* |* @@ -257,20 +258,18 @@ void SwPageDesc::RegisterChange() nRegHeight = 0; { - SwClientIter aIter( GetMaster() ); - for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast; - pLast = aIter.Next() ) + SwIterator<SwFrm,SwFmt> aIter( GetMaster() ); + for( SwFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() ) { - if( ((SwFrm*)pLast)->IsPageFrm() ) + if( pLast->IsPageFrm() ) ((SwPageFrm*)pLast)->PrepareRegisterChg(); } } { - SwClientIter aIter( GetLeft() ); - for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast; - pLast = aIter.Next() ) + SwIterator<SwFrm,SwFmt> aIter( GetLeft() ); + for( SwFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() ) { - if( ((SwFrm*)pLast)->IsPageFrm() ) + if( pLast->IsPageFrm() ) ((SwPageFrm*)pLast)->PrepareRegisterChg(); } } @@ -288,10 +287,10 @@ void SwPageDesc::RegisterChange() *************************************************************************/ -void SwPageDesc::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) +void SwPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - SwModify::Modify( pOld, pNew ); + NotifyClients( pOld, pNew ); if ( (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich) || isCHRATR(nWhich) || (RES_PARATR_LINESPACING == nWhich) ) @@ -318,7 +317,7 @@ static const SwFrm* lcl_GetFrmOfNode( const SwNode& rNd ) pMod = 0; Point aNullPt; - return pMod ? ::GetFrmOfModify( *pMod, nFrmType, &aNullPt, 0, sal_False ) + return pMod ? ::GetFrmOfModify( 0, *pMod, nFrmType, &aNullPt, 0, sal_False ) : 0; } @@ -343,14 +342,12 @@ const SwFrmFmt* SwPageDesc::GetPageFmtOfNode( const SwNode& rNd, const SwPageDesc* pPd = bCheckForThisPgDc ? this : ((SwPageFrm*)pChkFrm)->GetPageDesc(); pRet = &pPd->GetMaster(); - ASSERT( ((SwPageFrm*)pChkFrm)->GetPageDesc() == pPd, - "Falcher Node fuers erkennen des Seitenformats" ); + ASSERT( ((SwPageFrm*)pChkFrm)->GetPageDesc() == pPd, "Wrong node for detection of page format!" ); // an welchem Format haengt diese Seite? - if( pRet != pChkFrm->GetRegisteredIn() ) + if( !pChkFrm->KnowsFormat(*pRet) ) { pRet = &pPd->GetLeft(); - ASSERT( pRet == pChkFrm->GetRegisteredIn(), - "Falcher Node fuers erkennen des Seitenformats" ); + ASSERT( pChkFrm->KnowsFormat(*pRet), "Wrong node for detection of page format!" ); } } else diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index e0f4914da529..3a7b31e101fa 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -29,7 +29,7 @@ #include "precompiled_sw.hxx" #include <com/sun/star/text/HoriOrientation.hpp> - +#include <hintids.hxx> #include <vcl/sound.hxx> #include <tools/poly.hxx> #define _SVSTDARR_LONGS @@ -41,14 +41,12 @@ #include <editeng/prntitem.hxx> #include <editeng/boxitem.hxx> #include <editeng/shaditem.hxx> -// --> collapsing borders FME 2005-05-27 #i29550# #include <svx/framelink.hxx> -// <-- #include <vcl/graph.hxx> #include <svx/svdpagv.hxx> - #include <hintids.hxx> #include <tgrditem.hxx> +#include <switerator.hxx> #include <fmtsrnd.hxx> #include <fmtclds.hxx> #include <tools/shl.hxx> @@ -83,28 +81,20 @@ #include <lineinfo.hxx> #include <dbg_lay.hxx> #include <accessibilityoptions.hxx> -// OD 20.12.2002 #94627# #include <docsh.hxx> -// OD 28.02.2003 #b4779636#, #107692# #include <swtable.hxx> -// OD 02.07.2003 #108784# #include <svx/svdogrp.hxx> -// OD 2004-05-24 #i28701# #include <sortedobjs.hxx> - -// --> FME 2004-06-08 #i12836# enhanced pdf export #include <EnhancedPDFExportHelper.hxx> -// <-- - #include <ndole.hxx> #include <svtools/chartprettypainter.hxx> - #include <PostItMgr.hxx> #include <tools/color.hxx> +#include <vcl/svapp.hxx> + #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230) #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200) #define COL_NOTES_SIDEPANE_SCROLLAREA RGB_COLORDATA(230,230,220) -#include <vcl/svapp.hxx> using namespace ::com::sun::star; @@ -3098,14 +3088,14 @@ void SwRootFrm::HackPrepareLongTblPaint( int nMode ) case HACK_TABLEMODE_INIT : ASSERT( !pLines, "HackPrepare: already prepared" ); pLines = new SwLineRects; ASSERT( !pGlobalShell, "old GlobalShell lost" ); - pGlobalShell = GetShell(); + pGlobalShell = GetCurrShell(); bTableHack = sal_True; break; case HACK_TABLEMODE_LOCKLINES : pLines->LockLines( sal_True ); break; case HACK_TABLEMODE_PAINTLINES : pLines->PaintLines( GetShell()->GetOut() ); break; case HACK_TABLEMODE_UNLOCKLINES: pLines->LockLines( sal_False ); break; - case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetShell()->GetOut() ); + case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetCurrShell()->GetOut() ); DELETEZ( pLines ); pGlobalShell = 0; bTableHack = sal_False; @@ -3186,7 +3176,7 @@ SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect ) void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); // --> FME 2004-06-24 #i16816# tagged pdf support Frm_Info aFrmInfo( *this ); @@ -3629,8 +3619,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const // for painting the graphic/OLE. Thus, the clip region is // also applied for the PDF export. // if ( !pOut->GetConnectMetaFile() || pOut->GetOutDevType() == OUTDEV_PRINTER ) - ViewShell *pSh = GetShell(); - if ( !pOut->GetConnectMetaFile() || !pSh->GetWin() ) + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if ( !pOut->GetConnectMetaFile() || !pSh || !pSh->GetWin() ) // <-- { pOut->SetClipRegion( aPoly ); @@ -4290,7 +4280,7 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, // OD 29.04.2003 #107169# - paint SwAligned-rectangle { SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.GetShell() ); + ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); // if <SwAlignRect> reveals rectangle with no width, adjust rectangle // to the prior left postion with width of one twip. if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 ) @@ -4330,7 +4320,7 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, // OD 29.04.2003 #107169# - paint SwAligned-rectangle { SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.GetShell() ); + ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); // if <SwAlignRect> reveals rectangle with no width, adjust // rectangle to the prior left postion with width of one twip. if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 ) @@ -4394,7 +4384,7 @@ void lcl_PaintTopBottomLine( const sal_Bool _bTop, // OD 29.04.2003 #107169# - paint SwAligned-rectangle { SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.GetShell() ); + ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); // if <SwAlignRect> reveals rectangle with no width, adjust rectangle // to the prior top postion with width of one twip. if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 ) @@ -4433,7 +4423,7 @@ void lcl_PaintTopBottomLine( const sal_Bool _bTop, // OD 29.04.2003 #107169# - paint SwAligned-rectangle { SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.GetShell() ); + ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); // if <SwAlignRect> reveals rectangle with no width, adjust // rectangle to the prior top postion with width of one twip. if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 ) @@ -5252,7 +5242,7 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, ViewShell* _pViewShell ) const { if ( _pViewShell->GetWin() && - !_pViewShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + !_pViewShell->GetViewOptions()->getBrowseMode() ) { SwRect aPgPrtRect( Prt() ); aPgPrtRect.Pos() += Frm().Pos(); @@ -5740,8 +5730,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, { if ( bBack || bPageFrm || !bLowerMode ) { - const sal_Bool bBrowse = pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); - + const sal_Bool bBrowse = pSh->GetViewOptions()->getBrowseMode(); SwRect aRect; if ( (bPageFrm && bBrowse) || (IsTxtFrm() && Prt().SSize() == Frm().SSize()) ) @@ -6393,7 +6382,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const return; ASSERT( GetUpper(), "Retoucheversuch ohne Upper." ); - ASSERT( GetShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); + ASSERT( getRootFrm()->GetCurrShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); SwRect aRetouche( GetUpper()->PaintArea() ); aRetouche.Top( Frm().Top() + Frm().Height() ); @@ -6405,7 +6394,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const //zum ausstanzen. SwRegionRects aRegion( aRetouche ); aRegion -= rRect; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); // --> FME 2004-06-24 #i16816# tagged pdf support SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() ); @@ -6502,7 +6491,7 @@ sal_Bool SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, sal_Bool bLowerMode ) const { const SwFrm *pFrm = this; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); const SwViewOption *pOpt = pSh->GetViewOptions(); rpBrush = 0; rpCol = NULL; @@ -6558,7 +6547,7 @@ sal_Bool SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, { rpBrush = &rBack; if ( pFrm->IsPageFrm() && - pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + pSh->GetViewOptions()->getBrowseMode() ) rOrigRect = pFrm->Frm(); else { @@ -6620,10 +6609,10 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) { Graphic aRet; //irgendeinen Fly suchen! - SwClientIter aIter( *this ); - SwClient *pFirst = aIter.First( TYPE(SwFrm) ); + SwIterator<SwFrm,SwFmt> aIter( *this ); + SwFrm *pFirst = aIter.First(); ViewShell *pSh; - if ( pFirst && 0 != ( pSh = ((SwFrm*)pFirst)->GetShell()) ) + if ( pFirst && 0 != ( pSh = pFirst->getRootFrm()->GetCurrShell()) ) { ViewShell *pOldGlobal = pGlobalShell; pGlobalShell = pSh; 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() ) { diff --git a/sw/source/core/layout/softpagebreak.cxx b/sw/source/core/layout/softpagebreak.cxx index 898581d3d870..5289fb860b56 100644 --- a/sw/source/core/layout/softpagebreak.cxx +++ b/sw/source/core/layout/softpagebreak.cxx @@ -35,12 +35,12 @@ #include "frmfmt.hxx" #include "rowfrm.hxx" #include "tabfrm.hxx" +#include "switerator.hxx" void SwTxtNode::fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const { - SwClientIter aIter( const_cast<SwTxtNode&>(*this) ); - for( const SwTxtFrm *pFrm = (const SwTxtFrm*)aIter.First( TYPE(SwTxtFrm) ); - pFrm; pFrm = (const SwTxtFrm*)aIter.Next() ) + SwIterator<SwTxtFrm,SwTxtNode> aIter( *this ); + for( const SwTxtFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) { // No soft page break in header or footer if( pFrm->FindFooterOrHeader() || pFrm->IsInFly() ) @@ -110,13 +110,12 @@ bool SwTableLine::hasSoftPageBreak() const // No soft page break for sub tables if( GetUpper() || !GetFrmFmt() ) return false; - SwClientIter aIter( *GetFrmFmt() ); - for( SwClient* pLast = aIter.First( TYPE( SwFrm ) ); pLast; - pLast = aIter.Next() ) + SwIterator<SwRowFrm,SwFmt> aIter( *GetFrmFmt() ); + for( SwRowFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() ) { - if( ((SwRowFrm*)pLast)->GetTabLine() == this ) + if( pLast->GetTabLine() == this ) { - const SwTabFrm* pTab = static_cast<SwRowFrm*>(pLast)->FindTabFrm(); + const SwTabFrm* pTab = pLast->FindTabFrm(); // No soft page break for // tables with prevs, i.e. if the frame is not the first in its layout frame // tables in footer or header diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 512c45a67b41..72954fc5aa34 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - +#include <ftnfrm.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <cntfrm.hxx> @@ -53,10 +53,9 @@ #include <fmtclds.hxx> #include <viewsh.hxx> #include <viewimp.hxx> - -// OD 2004-05-24 #i28701# #include <sortedobjs.hxx> #include <hints.hxx> +#include <switerator.hxx> // No inline cause we need the function pointers long SwFrm::GetTopMargin() const @@ -216,7 +215,7 @@ void SwFrm::SetRightLeftMargins( long nRight, long nLeft) const sal_uInt16 nMinVertCellHeight = 1135; -/*-----------------11.9.2001 11:11------------------ +/*----------------------------------- * SwFrm::CheckDirChange(..) * checks the layout direction and * invalidates the lower frames rekursivly, if necessary. @@ -317,7 +316,7 @@ void SwFrm::CheckDirChange() } } -/*-----------------13.9.2002 11:11------------------ +/*----------------------------------- * SwFrm::GetFrmAnchorPos(..) * returns the position for anchors based on frame direction * --------------------------------------------------*/ @@ -363,19 +362,15 @@ Point SwFrm::GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const |* |* SwFrm::~SwFrm() |* -|* Ersterstellung MA 02. Mar. 94 -|* Letzte Aenderung MA 25. Jun. 95 -|* |*************************************************************************/ - SwFrm::~SwFrm() { // accessible objects for fly and cell frames have been already disposed // by the destructors of the derived classes. if( IsAccessibleFrm() && !(IsFlyFrm() || IsCellFrm()) && GetDep() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell *pVSh = pRootFrm->GetCurrShell(); @@ -433,8 +428,6 @@ SwFrmFmt * SwLayoutFrm::GetFmt() /************************************************************************* |* |* SwLayoutFrm::SetFrmFmt() -|* Ersterstellung MA 22. Apr. 93 -|* Letzte Aenderung MA 02. Nov. 94 |* |*************************************************************************/ @@ -446,15 +439,15 @@ void SwLayoutFrm::SetFrmFmt( SwFrmFmt *pNew ) SwFmtChg aOldFmt( GetFmt() ); pNew->Add( this ); SwFmtChg aNewFmt( pNew ); - Modify( &aOldFmt, &aNewFmt ); + ModifyNotification( &aOldFmt, &aNewFmt ); } } /************************************************************************* |* SwCntntFrm::SwCntntFrm() |*************************************************************************/ -SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt ) : - SwFrm( pCntnt ), +SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt, SwFrm* pSib ) : + SwFrm( pCntnt, pSib ), SwFlowFrm( (SwFrm&)*this ) { } @@ -465,11 +458,11 @@ SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt ) : SwCntntFrm::~SwCntntFrm() { SwCntntNode* pCNd; - if( 0 != ( pCNd = PTR_CAST( SwCntntNode, pRegisteredIn )) && + if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) && !pCNd->GetDoc()->IsInDtor() ) { //Bei der Root abmelden wenn ich dort noch im Turbo stehe. - SwRootFrm *pRoot = FindRootFrm(); + SwRootFrm *pRoot = getRootFrm(); if( pRoot && pRoot->GetTurbo() == this ) { pRoot->DisallowTurbo(); @@ -495,20 +488,77 @@ SwCntntFrm::~SwCntntFrm() pTxtFtn = rFtnIdxs[ nPos ]; if( pTxtFtn->GetTxtNode().GetIndex() > nIndex ) break; - pTxtFtn->DelFrms(); + pTxtFtn->DelFrms( this ); ++nPos; } } } } +void SwCntntFrm::RegisterToNode( SwCntntNode& rNode ) +{ + rNode.Add( this ); +} + +void SwCntntFrm::DelFrms( const SwCntntNode& rNode ) +{ + SwIterator<SwCntntFrm,SwCntntNode> aIter( rNode ); + for( SwCntntFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) + { + // --> OD 2005-12-01 #i27138# + // notify accessibility paragraphs objects about changed + // CONTENT_FLOWS_FROM/_TO relation. + // Relation CONTENT_FLOWS_FROM for current next paragraph will change + // and relation CONTENT_FLOWS_TO for current previous paragraph will change. + if ( pFrm->IsTxtFrm() ) + { + ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() ); + if ( pViewShell && pViewShell->GetLayout() && + pViewShell->GetLayout()->IsAnyShellAccessible() ) + { + pViewShell->InvalidateAccessibleParaFlowRelation( + dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )), + dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) ); + } + } + // <-- + if( pFrm->HasFollow() ) + pFrm->GetFollow()->_SetIsFollow( pFrm->IsFollow() ); + if( pFrm->IsFollow() ) + { + SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster(); + pMaster->SetFollow( pFrm->GetFollow() ); + pFrm->_SetIsFollow( sal_False ); + } + pFrm->SetFollow( 0 );//Damit er nicht auf dumme Gedanken kommt. + //Andernfalls kann es sein, dass ein Follow + //vor seinem Master zerstoert wird, der Master + //greift dann ueber den ungueltigen + //Follow-Pointer auf fremdes Memory zu. + //Die Kette darf hier zerknauscht werden, weil + //sowieso alle zerstoert werden. + if( pFrm->GetUpper() && pFrm->IsInFtn() && !pFrm->GetIndNext() && + !pFrm->GetIndPrev() ) + { + SwFtnFrm *pFtn = pFrm->FindFtnFrm(); + ASSERT( pFtn, "You promised a FtnFrm?" ); + SwCntntFrm* pCFrm; + if( !pFtn->GetFollow() && !pFtn->GetMaster() && + 0 != ( pCFrm = pFtn->GetRefFromAttr()) && pCFrm->IsFollow() ) + { + ASSERT( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" ); + ((SwTxtFrm*)pCFrm->FindMaster())->Prepare( PREP_FTN_GONE ); + } + } + pFrm->Cut(); + delete pFrm; + } +} + /************************************************************************* |* |* SwLayoutFrm::~SwLayoutFrm |* -|* Ersterstellung AK 28-Feb-1991 -|* Letzte Aenderung MA 11. Jan. 95 -|* |*************************************************************************/ @@ -600,9 +650,6 @@ SwLayoutFrm::~SwLayoutFrm() |* |* SwFrm::PaintArea() |* -|* Created AMA 08/22/2000 -|* Last change AMA 08/23/2000 -|* |* The paintarea is the area, in which the content of a frame is allowed |* to be displayed. This region could be larger than the printarea (Prt()) |* of the upper, it includes e.g. often the margin of the page. @@ -704,9 +751,6 @@ const SwRect SwFrm::PaintArea() const |* |* SwFrm::UnionFrm() |* -|* Created AMA 08/22/2000 -|* Last change AMA 08/23/2000 -|* |* The unionframe is the framearea (Frm()) of a frame expanded by the |* printarea, if there's a negative margin at the left or right side. |* diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 90a3656d1ab7..7e612650766e 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -40,10 +40,11 @@ #include "frmtool.hxx" #include "frmfmt.hxx" #include "dcontact.hxx" +#include <anchoreddrawobject.hxx> +#include <fmtanchr.hxx> #include "viewopt.hxx" #include "hints.hxx" #include "dbg_lay.hxx" - #include <ftnidx.hxx> #include <svl/itemiter.hxx> #include <docary.hxx> @@ -51,9 +52,7 @@ #include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/brshitem.hxx> -// --> collapsing borders FME 2005-05-27 #i29550# #include <editeng/boxitem.hxx> -// <-- #include <vcl/outdev.hxx> #include <fmtlsplt.hxx> #include <fmtrowsplt.hxx> @@ -63,7 +62,6 @@ #include <fmtfsize.hxx> #include <swtblfmt.hxx> #include <ndtxt.hxx> - #include "tabfrm.hxx" #include "rowfrm.hxx" #include "cellfrm.hxx" @@ -71,15 +69,11 @@ #include "txtfrm.hxx" //HasFtn() #include "htmltbl.hxx" #include "sectfrm.hxx" //SwSectionFrm -// OD 30.09.2003 #i18732# #include <fmtfollowtextflow.hxx> -// --> OD 2004-06-28 #i28701# #include <sortedobjs.hxx> #include <objectformatter.hxx> -// <-- -// --> OD 2004-10-05 #i26945# #include <layouter.hxx> -// <-- +#include <switerator.hxx> extern void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex, SwFrm *pFrm, SwPageFrm *pPage ); @@ -95,8 +89,8 @@ using namespace ::com::sun::star; |* Letzte Aenderung MA 30. May. 96 |* |*************************************************************************/ -SwTabFrm::SwTabFrm( SwTable &rTab ): - SwLayoutFrm( rTab.GetFrmFmt() ), +SwTabFrm::SwTabFrm( SwTable &rTab, SwFrm* pSib ): + SwLayoutFrm( rTab.GetFrmFmt(), pSib ), SwFlowFrm( (SwFrm&)*this ), pTable( &rTab ) { @@ -115,7 +109,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): SwFrm *pTmpPrev = 0; for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { - SwRowFrm *pNew = new SwRowFrm( *rLines[i] ); + SwRowFrm *pNew = new SwRowFrm( *rLines[i], this ); if( pNew->Lower() ) { pNew->InsertBehind( this, pTmpPrev ); @@ -128,7 +122,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): } SwTabFrm::SwTabFrm( SwTabFrm &rTab ) : - SwLayoutFrm( rTab.GetFmt() ), + SwLayoutFrm( rTab.GetFmt(), &rTab ), SwFlowFrm( (SwFrm&)*this ), pTable( rTab.GetTable() ) { @@ -217,8 +211,6 @@ void SwTabFrm::RegistFlys() |* Some prototypes |*************************************************************************/ void MA_FASTCALL SwInvalidateAll( SwFrm *pFrm, long nBottom ); -bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm *pLay, const SwLayoutFrm* pDontLeave, - long nBottom, bool bSkipRowSpanCells ); void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ); sal_Bool lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, sal_Bool bInva ); // --> OD 2004-10-15 #i26945# - add parameter <_bOnlyRowsAndCells> to control @@ -274,7 +266,7 @@ SwRowFrm* lcl_InsertNewFollowFlowLine( SwTabFrm& rTab, const SwFrm& rTmpRow, boo const SwRowFrm& rRow = (SwRowFrm&)rTmpRow; rTab.SetFollowFlowLine( sal_True ); - SwRowFrm *pFollowFlowLine = new SwRowFrm(*rRow.GetTabLine(), false ); + SwRowFrm *pFollowFlowLine = new SwRowFrm(*rRow.GetTabLine(), &rTab, false ); pFollowFlowLine->SetRowSpanLine( bRowSpanLine ); SwFrm* pFirstRow = rTab.GetFollow()->GetFirstNonHeadlineRow(); pFollowFlowLine->InsertBefore( rTab.GetFollow(), pFirstRow ); @@ -605,7 +597,7 @@ void lcl_PreprocessRowsInCells( SwTabFrm& rTab, SwRowFrm& rLastLine, !bTableLayoutToComplex && nMinHeight < nTmpCut ) ) { // The line has to be split: - SwRowFrm* pNewRow = new SwRowFrm( *pTmpLastLineRow->GetTabLine(), false ); + SwRowFrm* pNewRow = new SwRowFrm( *pTmpLastLineRow->GetTabLine(), &rTab, false ); pNewRow->SetFollowFlowRow( true ); pNewRow->SetFollowRow( pTmpLastLineRow->GetFollowRow() ); pTmpLastLineRow->SetFollowRow( pNewRow ); @@ -1277,7 +1269,7 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee // Insert new headlines: bDontCreateObjects = sal_True; //frmtool SwRowFrm* pHeadline = new SwRowFrm( - *GetTable()->GetTabLines()[ nRowCount ] ); + *GetTable()->GetTabLines()[ nRowCount ], this ); pHeadline->SetRepeatedHeadline( true ); bDontCreateObjects = sal_False; pHeadline->InsertBefore( pFoll, 0 ); @@ -1541,7 +1533,7 @@ void lcl_InvalidateAllLowersPrt( SwLayoutFrm* pLayFrm ) } // <-- collapsing -bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, +bool SwCntntFrm::CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells ) { if ( !pLay ) @@ -1594,7 +1586,7 @@ bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeav ASSERT( !pCnt->IsTxtFrm() || pCnt->IsValid() || static_cast<SwTxtFrm*>(pCnt)->IsJoinLocked(), - "<lcl_CalcLowers(..)> - text frame invalid and not locked." ); + "<SwCntntFrm::CalcLowers(..)> - text frame invalid and not locked." ); if ( pCnt->IsTxtFrm() && pCnt->IsValid() ) { // --> OD 2004-11-02 #i23129#, #i36347# - pass correct page frame to @@ -1619,7 +1611,7 @@ bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeav } #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl in lcl_CalcLowers" ) + ASSERT( false, "LoopControl in SwCntntFrm::CalcLowers" ) #endif } } @@ -1726,7 +1718,7 @@ void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) { // --> OD 2004-11-23 #115759# - force another format of the // lowers, if at least one of it was invalid. - bCheck = lcl_CalcLowers( &rRow, rRow.GetUpper(), nBottom, true ); + bCheck = SwCntntFrm::CalcLowers( &rRow, rRow.GetUpper(), nBottom, true ); // <-- // NEW TABLES @@ -1746,7 +1738,7 @@ void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) SwCellFrm& rToRecalc = 0 == i ? const_cast<SwCellFrm&>(pCellFrm->FindStartEndOfRowSpanCell( true, true )) : *pCellFrm; - bCheck |= lcl_CalcLowers( &rToRecalc, &rToRecalc, nBottom, false ); + bCheck |= SwCntntFrm::CalcLowers( &rToRecalc, &rToRecalc, nBottom, false ); } pCellFrm = static_cast<SwCellFrm*>(pCellFrm->GetNext()); @@ -2211,7 +2203,8 @@ void SwTabFrm::MakeAll() /// OD 23.10.2002 #103517# - In online layout try to grow upper of table /// frame, if table frame doesn't fit in its upper. - const bool bBrowseMode = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); if ( nDistanceToUpperPrtBottom < 0 && bBrowseMode ) { if ( GetUpper()->Grow( -nDistanceToUpperPrtBottom ) ) @@ -3132,11 +3125,11 @@ void SwTabFrm::Format( const SwBorderAttrs *pAttrs ) else (this->*fnRect->fnSetXMargins)( nLeftSpacing, nRightSpacing ); - ViewShell *pSh; + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( bCheckBrowseWidth && - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && + pSh && pSh->GetViewOptions()->getBrowseMode() && GetUpper()->IsPageBodyFrm() && // nur PageBodyFrms, nicht etwa ColBodyFrms - 0 != (pSh = GetShell()) && pSh->VisArea().Width() ) + pSh->VisArea().Width() ) { //Nicht ueber die Kante des sichbaren Bereiches hinausragen. //Die Seite kann breiter sein, weil es Objekte mit "ueberbreite" @@ -3221,7 +3214,7 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) { (Frm().*fnRect->fnAddBottom)( nDist ); - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -3268,7 +3261,7 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) |* Letzte Aenderung MA 06. Dec. 96 |* |*************************************************************************/ -void SwTabFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwTabFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; sal_Bool bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which(); @@ -3333,7 +3326,7 @@ void SwTabFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) } } -void SwTabFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, +void SwTabFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) { @@ -3357,7 +3350,7 @@ void SwTabFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, for ( sal_uInt16 nIdx = 0; nIdx < nNewRepeat; ++nIdx ) { bDontCreateObjects = sal_True; //frmtool - SwRowFrm* pHeadline = new SwRowFrm( *GetTable()->GetTabLines()[ nIdx ] ); + SwRowFrm* pHeadline = new SwRowFrm( *GetTable()->GetTabLines()[ nIdx ], this ); pHeadline->SetRepeatedHeadline( true ); bDontCreateObjects = sal_False; pHeadline->Paste( this, pLowerRow ); @@ -3629,7 +3622,8 @@ sal_Bool SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool &r nSpace = nTmpSpace; // <-- - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nSpace += pNewUpper->Grow( LONG_MAX, sal_True ); } } @@ -3857,8 +3851,8 @@ void SwTabFrm::Prepare( const PrepareHint eHint, const void *, sal_Bool ) |* Letzte Aenderung MA 30. May. 96 |* |*************************************************************************/ -SwRowFrm::SwRowFrm( const SwTableLine &rLine, bool bInsertContent ): - SwLayoutFrm( rLine.GetFrmFmt() ), +SwRowFrm::SwRowFrm( const SwTableLine &rLine, SwFrm* pSib, bool bInsertContent ): + SwLayoutFrm( rLine.GetFrmFmt(), pSib ), pTabLine( &rLine ), pFollowRow( 0 ), // --> collapsing borders FME 2005-05-27 #i29550# @@ -3879,7 +3873,7 @@ SwRowFrm::SwRowFrm( const SwTableLine &rLine, bool bInsertContent ): SwFrm *pTmpPrev = 0; for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) { - SwCellFrm *pNew = new SwCellFrm( *rBoxes[i], bInsertContent ); + SwCellFrm *pNew = new SwCellFrm( *rBoxes[i], this, bInsertContent ); pNew->InsertBehind( this, pTmpPrev ); pTmpPrev = pNew; } @@ -3917,7 +3911,7 @@ void SwRowFrm::RegistFlys( SwPageFrm *pPage ) |* Letzte Aenderung MA 12. Nov. 97 |* |*************************************************************************/ -void SwRowFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwRowFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_Bool bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which(); const SfxPoolItem *pItem = 0; @@ -4397,13 +4391,9 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) // If we found a 'previous' row, we look for the appropriate row frame: if ( pPrevTabLine ) { - SwClientIter aIter( *pPrevTabLine->GetFrmFmt() ); - SwClient* pLast; - for ( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() ) + SwIterator<SwRowFrm,SwFmt> aIter( *pPrevTabLine->GetFrmFmt() ); + for ( SwRowFrm* pRow = aIter.First(); pRow; pRow = aIter.Next() ) { - ASSERT( ((SwFrm*)pLast)->IsRowFrm(), - "Non-row frame registered in table line" ) - SwRowFrm* pRow = (SwRowFrm*)pLast; // --> OD 2004-11-23 #115759# - do *not* take repeated // headlines, because during split of table it can be // invalid and thus can't provide correct border values. @@ -4515,7 +4505,7 @@ void SwRowFrm::AdjustCells( const SwTwips nHeight, const sal_Bool bHeight ) SwFrm *pFrm = Lower(); if ( bHeight ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); SWRECTFN( this ) SwRect aOldFrm; @@ -4625,7 +4615,7 @@ void SwRowFrm::Cut() // --> OD 2010-02-17 #i103961# // notification for accessibility { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell* pVSh = pRootFrm->GetCurrShell(); @@ -4877,8 +4867,8 @@ bool SwRowFrm::ShouldRowKeepWithNext() const |* Letzte Aenderung MA 30. May. 96 |* |*************************************************************************/ -SwCellFrm::SwCellFrm( const SwTableBox &rBox, bool bInsertContent ) : - SwLayoutFrm( rBox.GetFrmFmt() ), +SwCellFrm::SwCellFrm( const SwTableBox &rBox, SwFrm* pSib, bool bInsertContent ) : + SwLayoutFrm( rBox.GetFrmFmt(), pSib ), pTabBox( &rBox ) { nType = FRMC_CELL; @@ -4900,7 +4890,7 @@ SwCellFrm::SwCellFrm( const SwTableBox &rBox, bool bInsertContent ) : SwFrm *pTmpPrev = 0; for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) { - SwRowFrm *pNew = new SwRowFrm( *rLines[i], bInsertContent ); + SwRowFrm *pNew = new SwRowFrm( *rLines[i], this, bInsertContent ); pNew->InsertBehind( this, pTmpPrev ); pTmpPrev = pNew; } @@ -4914,7 +4904,7 @@ SwCellFrm::~SwCellFrm() { // At this stage the lower frames aren't destroyed already, // therfor we have to do a recursive dispose. - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -5439,7 +5429,7 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) |* |*************************************************************************/ -void SwCellFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwCellFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_Bool bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which(); const SfxPoolItem *pItem = 0; @@ -5471,7 +5461,7 @@ void SwCellFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_PROTECT, sal_False ) ) || RES_PROTECT == pNew->Which() ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this ); } @@ -5531,7 +5521,7 @@ void SwCellFrm::Cut() { // notification for accessibility { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell* pVSh = pRootFrm->GetCurrShell(); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index c04b13e3c3e5..bd965379d0cc 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -893,7 +893,7 @@ sal_uInt16 SwRootFrm::GetCurrPage( const SwPaM *pActualCrsr ) const { ASSERT( pActualCrsr, "Welche Seite soll's denn sein?" ); SwFrm const*const pActFrm = pActualCrsr->GetPoint()->nNode.GetNode(). - GetCntntNode()->GetFrm( 0, + GetCntntNode()->getLayoutFrm( this, 0, pActualCrsr->GetPoint(), sal_False ); return pActFrm->FindPageFrm()->GetPhyPageNum(); @@ -1878,8 +1878,8 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) const SwCntntNode* pTmpStartNode = rTblCrsr.GetCntntNode(); const SwCntntNode* pTmpEndNode = rTblCrsr.GetCntntNode(sal_False); - const SwFrm* pTmpStartFrm = pTmpStartNode ? pTmpStartNode->GetFrm( &aPtPt, 0, sal_False ) : 0; - const SwFrm* pTmpEndFrm = pTmpEndNode ? pTmpEndNode->GetFrm( &aMkPt, 0, sal_False ) : 0; + const SwFrm* pTmpStartFrm = pTmpStartNode ? pTmpStartNode->getLayoutFrm( this, &aPtPt, 0, sal_False ) : 0; + const SwFrm* pTmpEndFrm = pTmpEndNode ? pTmpEndNode->getLayoutFrm( this, &aMkPt, 0, sal_False ) : 0; const SwLayoutFrm* pStart = pTmpStartFrm ? pTmpStartFrm->GetUpper() : 0; const SwLayoutFrm* pEnd = pTmpEndFrm ? pTmpEndFrm->GetUpper() : 0; @@ -2015,7 +2015,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode ) *pEndPos = rCrsr.GetPoint() == pStartPos ? rCrsr.GetMark() : rCrsr.GetPoint(); - ViewShell *pSh = GetShell(); + ViewShell *pSh = GetCurrShell(); // --> FME 2004-06-08 #i12836# enhanced pdf SwRegionRects aRegion( pSh && !pSh->GetViewOptions()->IsPDFExport() ? @@ -2023,10 +2023,10 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode ) Frm() ); // <-- if( !pStartPos->nNode.GetNode().IsCntntNode() || - !pStartPos->nNode.GetNode().GetCntntNode()->GetFrm() || + !pStartPos->nNode.GetNode().GetCntntNode()->getLayoutFrm(this) || ( pStartPos->nNode != pEndPos->nNode && ( !pEndPos->nNode.GetNode().IsCntntNode() || - !pEndPos->nNode.GetNode().GetCntntNode()->GetFrm() ) ) ) + !pEndPos->nNode.GetNode().GetCntntNode()->getLayoutFrm(this) ) ) ) { /* For SelectAll we will need something like this later on... const SwFrm* pPageFrm = GetLower(); @@ -2047,10 +2047,10 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode ) //Erstmal die CntntFrms zum Start und End besorgen, die brauch ich auf //jedenfall. SwCntntFrm const* pStartFrm = pStartPos->nNode.GetNode(). - GetCntntNode()->GetFrm( &rCrsr.GetSttPos(), pStartPos ); + GetCntntNode()->getLayoutFrm( this, &rCrsr.GetSttPos(), pStartPos ); SwCntntFrm const* pEndFrm = pEndPos->nNode.GetNode(). - GetCntntNode()->GetFrm( &rCrsr.GetEndPos(), pEndPos ); + GetCntntNode()->getLayoutFrm( this, &rCrsr.GetEndPos(), pEndPos ); ASSERT( (pStartFrm && pEndFrm), "Keine CntntFrms gefunden." ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 4ebca620e4e2..6a375f09b914 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -43,8 +43,11 @@ #include <rootfrm.hxx> #include <cntfrm.hxx> #include <dcontact.hxx> +#include <anchoreddrawobject.hxx> +#include <fmtanchr.hxx> #include <viewsh.hxx> #include <viewimp.hxx> +#include "viewopt.hxx" #include <doc.hxx> #include <fesh.hxx> #include <docsh.hxx> @@ -87,11 +90,12 @@ using namespace ::com::sun::star; |* |*************************************************************************/ -SwFrm::SwFrm( SwModify *pMod ) : +SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) : SwClient( pMod ), // --> OD 2006-05-10 #i65250# mnFrmId( SwFrm::mnLastFrmId++ ), // <-- + mpRoot( pSib ? pSib->getRootFrm() : 0 ), pUpper( 0 ), pNext( 0 ), pPrev( 0 ), @@ -116,15 +120,15 @@ SwFrm::SwFrm( SwModify *pMod ) : bCompletePaint = bInfInvalid = sal_True; } - -ViewShell * SwFrm::GetShell() const +bool SwFrm::KnowsFormat( const SwFmt& rFmt ) const { - const SwRootFrm *pRoot; - if ( 0 != (pRoot = FindRootFrm()) ) - return pRoot->GetCurrShell(); - return 0; + return GetRegisteredIn() == &rFmt; } +void SwFrm::RegisterToFormat( SwFmt& rFmt ) +{ + rFmt.Add( this ); +} void SwFrm::CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse ) { @@ -185,9 +189,12 @@ void SwSectionFrm::CheckDirection( sal_Bool bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(), - bVert, sal_True, - pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + bVert, sal_True, bBrowseMode ); + } else SwFrm::CheckDirection( bVert ); } @@ -196,9 +203,12 @@ void SwFlyFrm::CheckDirection( sal_Bool bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(), - bVert, sal_False, - pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + bVert, sal_False, bBrowseMode ); + } else SwFrm::CheckDirection( bVert ); } @@ -207,9 +217,12 @@ void SwTabFrm::CheckDirection( sal_Bool bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(), - bVert, sal_True, - pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + bVert, sal_True, bBrowseMode ); + } else SwFrm::CheckDirection( bVert ); } @@ -225,8 +238,9 @@ void SwCellFrm::CheckDirection( sal_Bool bVert ) if( pFmt && SFX_ITEM_SET == pFmt->GetItemState( RES_FRAMEDIR, sal_True, &pItem ) ) { const SvxFrameDirectionItem* pFrmDirItem = static_cast<const SvxFrameDirectionItem*>(pItem); - CheckDir( pFrmDirItem->GetValue(), bVert, sal_False, - pFmt->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); + CheckDir( pFrmDirItem->GetValue(), bVert, sal_False, bBrowseMode ); } else SwFrm::CheckDirection( bVert ); @@ -234,20 +248,14 @@ void SwCellFrm::CheckDirection( sal_Bool bVert ) void SwTxtFrm::CheckDirection( sal_Bool bVert ) { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); CheckDir( GetTxtNode()->GetSwAttrSet().GetFrmDir().GetValue(), bVert, - sal_True, - GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + sal_True, bBrowseMode ); } -/************************************************************************* -|* -|* SwFrm::Modify() -|* -|* Ersterstellung AK 01-Mar-1991 -|* Letzte Aenderung MA 20. Jun. 96 -|* -|*************************************************************************/ -void SwFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +/*************************************************************************/ +void SwFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; @@ -296,7 +304,7 @@ void SwFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) } } -void SwFrm::_UpdateAttrFrm( SfxPoolItem *pOld, SfxPoolItem *pNew, +void SwFrm::_UpdateAttrFrm( const SfxPoolItem *pOld, const SfxPoolItem *pNew, sal_uInt8 &rInvFlags ) { sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; @@ -995,7 +1003,7 @@ void SwCntntFrm::Cut() //er die Retouche uebernehmen. //Ausserdem kann eine Leerseite entstanden sein. else - { SwRootFrm *pRoot = FindRootFrm(); + { SwRootFrm *pRoot = getRootFrm(); if ( pRoot ) { pRoot->SetSuperfluous(); @@ -1407,7 +1415,8 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) if ( !nDiff || !GetUpper()->IsFtnBossFrm() ) // nur innerhalb von Seiten/Spalten return 0L; - sal_Bool bBrowse = GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); //Der (Page)Body veraendert sich nur im BrowseMode, aber nicht wenn er //Spalten enthaelt. @@ -1421,16 +1430,16 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) long nBrowseAdd = 0; if ( bBrowse && GetUpper()->IsPageFrm() ) // nur (Page)BodyFrms { - ViewShell *pSh = GetShell(); + ViewShell *pViewShell = getRootFrm()->GetCurrShell(); SwLayoutFrm *pUp = GetUpper(); long nChg; const long nUpPrtBottom = pUp->Frm().Height() - pUp->Prt().Height() - pUp->Prt().Top(); SwRect aInva( pUp->Frm() ); - if ( pSh ) + if ( pViewShell ) { - aInva.Pos().X() = pSh->VisArea().Left(); - aInva.Width( pSh->VisArea().Width() ); + aInva.Pos().X() = pViewShell->VisArea().Left(); + aInva.Width( pViewShell->VisArea().Width() ); } if ( nDiff > 0 ) { @@ -1440,7 +1449,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) if ( !IsBodyFrm() ) { SetCompletePaint(); - if ( !pSh || pSh->VisArea().Height() >= pUp->Frm().Height() ) + if ( !pViewShell || pViewShell->VisArea().Height() >= pUp->Frm().Height() ) { //Ersteinmal den Body verkleinern. Der waechst dann schon //wieder. @@ -1470,12 +1479,12 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) //mindestens so gross wie die VisArea. nChg = nDiff; long nInvaAdd = 0; - if ( pSh && !pUp->GetPrev() && - pUp->Frm().Height() + nDiff < pSh->VisArea().Height() ) + if ( pViewShell && !pUp->GetPrev() && + pUp->Frm().Height() + nDiff < pViewShell->VisArea().Height() ) { //Das heisst aber wiederum trotzdem, das wir geeignet invalidieren //muessen. - nChg = pSh->VisArea().Height() - pUp->Frm().Height(); + nChg = pViewShell->VisArea().Height() - pUp->Frm().Height(); nInvaAdd = -(nDiff - nChg); } @@ -1498,16 +1507,16 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) if ( !bTst ) { //Unabhaengig von nChg - if ( pSh && aInva.HasArea() && pUp->GetUpper() ) - pSh->InvalidateWindows( aInva ); + if ( pViewShell && aInva.HasArea() && pUp->GetUpper() ) + pViewShell->InvalidateWindows( aInva ); } if ( !bTst && nChg ) { const SwRect aOldRect( pUp->Frm() ); pUp->Frm().SSize().Height() += nChg; pUp->Prt().SSize().Height() += nChg; - if ( pSh ) - pSh->Imp()->SetFirstVisPageInvalid(); + if ( pViewShell ) + pViewShell->Imp()->SetFirstVisPageInvalid(); if ( GetNext() ) GetNext()->_InvalidatePos(); @@ -1515,7 +1524,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst ) //Ggf. noch ein Repaint ausloesen. const SvxGraphicPosition ePos = pUp->GetFmt()->GetBackground().GetGraphicPos(); if ( ePos != GPOS_NONE && ePos != GPOS_TILED ) - pSh->InvalidateWindows( pUp->Frm() ); + pViewShell->InvalidateWindows( pUp->Frm() ); if ( pUp->GetUpper() ) { @@ -1906,7 +1915,8 @@ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) nDist > (LONG_MAX - nFrmHeight ) ) nDist = LONG_MAX - nFrmHeight; - const sal_Bool bBrowse = GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() ) { @@ -2135,7 +2145,7 @@ SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) |* Letzte Aenderung MA 13. Oct. 95 |* |*************************************************************************/ -void SwCntntFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) +void SwCntntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; @@ -2208,7 +2218,7 @@ void SwCntntFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) } } -void SwCntntFrm::_UpdateAttr( SfxPoolItem* pOld, SfxPoolItem* pNew, +void SwCntntFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew, sal_uInt8 &rInvFlags, SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet ) { @@ -2367,8 +2377,8 @@ void SwCntntFrm::_UpdateAttr( SfxPoolItem* pOld, SfxPoolItem* pNew, |* Letzte Aenderung MA 12. May. 95 |* |*************************************************************************/ -SwLayoutFrm::SwLayoutFrm( SwFrmFmt* pFmt ): - SwFrm( pFmt ), +SwLayoutFrm::SwLayoutFrm( SwFrmFmt* pFmt, SwFrm* pSib ): + SwFrm( pFmt, pSib ), pLower( 0 ) { const SwFmtFrmSize &rFmtSize = pFmt->GetFrmSize(); @@ -2431,7 +2441,8 @@ SwTwips SwLayoutFrm::InnerHeight() const |*************************************************************************/ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) { - const sal_Bool bBrowse = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2579,7 +2590,7 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) if( bMoveAccFrm && IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -2599,7 +2610,8 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) |*************************************************************************/ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) { - const sal_Bool bBrowse = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2700,7 +2712,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) if( bMoveAccFrm && IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -3356,10 +3368,9 @@ long SwLayoutFrm::CalcRel( const SwFmtFrmSize &rSz, sal_Bool ) const { const SwFrm *pRel = GetUpper(); long nRel = LONG_MAX; - const ViewShell *pSh = GetShell(); - if ( pRel->IsPageBodyFrm() && - GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - pSh && pSh->VisArea().Width()) + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); + if( pRel->IsPageBodyFrm() && pSh && bBrowseMode && pSh->VisArea().Width() ) { nRel = pSh->GetBrowseWidth(); long nDiff = nRel - pRel->Prt().Width(); @@ -3460,7 +3471,8 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs, sal_Bool bEnd = sal_False; sal_Bool bBackLock = sal_False; - SwViewImp *pImp = GetShell() ? GetShell()->Imp() : 0; + ViewShell *pSh = getRootFrm()->GetCurrShell(); + SwViewImp *pImp = pSh ? pSh->Imp() : 0; { // Zugrunde liegender Algorithmus // Es wird versucht, eine optimale Hoehe fuer die Spalten zu finden. @@ -3975,7 +3987,7 @@ void SwRootFrm::InvalidateAllCntnt( sal_uInt8 nInv ) if( nInv & INV_PRTAREA ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if( pSh ) pSh->InvalidateWindows( Frm() ); } |