diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-06-13 15:22:56 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-06-13 15:22:56 +0200 |
commit | ebc5777548dea42ed966a16c66d879b1485bbfb4 (patch) | |
tree | bbba6f44a8ddd5c25683de28f8c56331589a3bc1 /sw/source/core/layout | |
parent | a572c2e12be5c2c40088269f3dc96e75e5912398 (diff) |
CWS swlayoutrefactoring: #i81480#: enable sw code to use multiple layouts
Diffstat (limited to 'sw/source/core/layout')
24 files changed, 493 insertions, 359 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 37ec80632153..cc645e674e70 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2544,7 +2544,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 ); } @@ -2578,7 +2578,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; } @@ -2701,8 +2701,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. @@ -2764,7 +2764,7 @@ 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 = @@ -2858,16 +2858,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" ) @@ -2884,7 +2884,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 ); } diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 28287c957ad1..4db476eab8b6 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 @@ BOOL SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, 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() && @@ -732,8 +733,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(); @@ -986,11 +987,11 @@ 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 f64752a18708..3a295a80cbb0 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -58,11 +58,11 @@ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, BOOL bPageOnly, 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 ); } @@ -174,7 +174,7 @@ static BOOL lcl_AddColumns( SwLayoutFrm *pCont, USHORT nCount ) } for ( USHORT 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 +186,7 @@ static BOOL lcl_AddColumns( SwLayoutFrm *pCont, USHORT nCount ) for ( USHORT 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 +248,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(), TRUE, FALSE ); + pDoc->GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), TRUE, 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 8a1e8fe9ea7a..dfdc76263efc 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -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; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index d0015b12114d..4c35ff65ea27 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" @@ -604,7 +606,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 BOOL bComplete = pImp && pImp->IsAction() && pImp->GetLayAction().IsComplete(); @@ -1042,12 +1044,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 +1176,8 @@ 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 FALSE; SwFrm *pPre = rThis.FindPrev(); @@ -1252,9 +1256,11 @@ BOOL SwFlowFrm::IsPrevObjMove() const BOOL SwFlowFrm::IsPageBreak( 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 FALSE; const SwAttrSet *pSet = rThis.GetAttrSet(); //Vorgaenger ermitteln @@ -2113,7 +2119,7 @@ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways ) rThis.Prepare( PREP_BOSS_CHGD, 0, 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 +2131,9 @@ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways ) } } // 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 +2601,7 @@ BOOL SwFlowFrm::MoveBwd( 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 +2682,7 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat ) if( pNewPage != pOldPage ) { rThis.Prepare( PREP_BOSS_CHGD, (const void*)pOldPage, 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 +2692,7 @@ BOOL SwFlowFrm::MoveBwd( 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 cd590d73ddcc..79ea87a6aef8 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -77,6 +77,7 @@ #include "pam.hxx" #include "frmatr.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "errhdl.hxx" #include "dcontact.hxx" #include "dflyobj.hxx" @@ -111,8 +112,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> @@ -149,11 +150,16 @@ 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) ) + if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir ) + bVertical = 0; + else + { + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) bVertical = 0; else bVertical = 1; + } bVert = bVertical; bInvalidR2L = 0; if( FRMDIR_HORI_RIGHT_TOP == nDir ) @@ -288,7 +294,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(); @@ -428,7 +434,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; @@ -524,10 +530,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 ) @@ -567,10 +576,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 ); } +} /************************************************************************* |* @@ -772,7 +785,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 ) @@ -794,7 +807,7 @@ void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, { BOOL bClear = TRUE; const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); switch( nWhich ) { case RES_VERT_ORIENT: @@ -846,8 +859,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; } @@ -958,8 +975,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 ) @@ -1000,11 +1017,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; @@ -2194,7 +2215,7 @@ void SwFrm::RemoveFly( SwFlyFrm *pToRemove ) pToRemove->GetFmt() && !pToRemove->IsFlyInCntFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) { ViewShell *pVSh = pRootFrm->GetCurrShell(); @@ -2261,9 +2282,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() ); } } @@ -2271,9 +2294,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() ); } @@ -2493,10 +2518,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(); diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 4d9b654fb79c..7f3dc5e2a027 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -29,7 +29,6 @@ #include "precompiled_sw.hxx" #include <tools/bigint.hxx> #include "pagefrm.hxx" -#include "rootfrm.hxx" #include "cntfrm.hxx" #include "flyfrm.hxx" #include "txtfrm.hxx" @@ -83,8 +82,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 = TRUE; bAutoPosition = (FLY_AT_CHAR == pFmt->GetAnchor().GetAnchorId()); @@ -194,7 +193,7 @@ void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if ( !pCntnt ) { SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode(); - pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, FALSE ); + pCntnt = pNode->getLayoutFrm( getRootFrm(), &pOldAnchor->Frm().Pos(), 0, 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 61fb9163c6f1..2d64357e0e20 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 = TRUE; SwTwips nRel = pFmt->GetVertOrient().GetPos(); diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 63d067c175b4..26445d82a9e0 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 = TRUE; } @@ -600,7 +600,7 @@ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if ( FLY_AT_PAGE == pAnch->GetAnchorId() ) { USHORT nPgNum = pAnch->GetPageNum(); - SwRootFrm *pRoot = FindRootFrm(); + SwRootFrm *pRoot = getRootFrm(); SwPageFrm *pTmpPage = (SwPageFrm*)pRoot->Lower(); for ( USHORT 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, FALSE ); + GetCntntNode()->getLayoutFrm( getRootFrm(), 0, 0, 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 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 c724ad8779db..ae27eb8ed805 100644 --- a/sw/source/core/layout/flypos.cxx +++ b/sw/source/core/layout/flypos.cxx @@ -58,7 +58,7 @@ SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt, { 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() ) diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 395009122063..7da50d2d0dae 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -56,6 +56,7 @@ #include "doc.hxx" #include "fesh.hxx" #include "viewimp.hxx" +#include "viewopt.hxx" #include "pam.hxx" #include "dflyobj.hxx" #include "dcontact.hxx" @@ -275,7 +276,7 @@ SwFrmNotify::~SwFrmNotify() { if( pFrm->IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + SwRootFrm *pRootFrm = pFrm->getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -410,7 +411,7 @@ SwFrmNotify::~SwFrmNotify() } else if( pFrm->IsTxtFrm() && bValidSize != pFrm->GetValidSizeFlag() ) { - SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + SwRootFrm *pRootFrm = pFrm->getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -607,13 +608,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 BOOL bPrtPos = POS_DIFF( aPrt, pLay->Prt() ); @@ -728,7 +732,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() ) { @@ -945,7 +949,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; @@ -1182,9 +1186,9 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, 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 +1200,27 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, ULONG nIndex, } } -BOOL MA_FASTCALL lcl_ObjConnected( SwFrmFmt *pFmt ) +bool lcl_ObjConnected( SwFrmFmt *pFmt, const SwFrm* pSib ) { SwClientIter 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 = (SwFlyFrm*)aIter.First( TYPE( SwFlyFrm )); pTmpFrm; + pTmpFrm = (SwFlyFrm*)aIter.Next() ) + { + if(! pRoot || pRoot == pTmpFrm->getRootFrm() ) + return true; + } + } else { SwDrawContact *pContact; if ( 0 != (pContact = (SwDrawContact*)aIter.First( TYPE(SwDrawContact)))) return pContact->GetAnchorFrm() != 0; } - return FALSE; + return false; } /** helper method to determine, if a <SwFrmFmt>, which has an object connected, @@ -1219,9 +1232,6 @@ 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 +1244,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 +1272,7 @@ void AppendAllObjs( const SwSpzFrmFmts *pTbl ) //will ich hier nicht. bRemove = TRUE; } - else if ( FALSE == (bRemove = ::lcl_ObjConnected( pFmt )) || + else if ( FALSE == (bRemove = ::lcl_ObjConnected( pFmt, pSib )) || ::lcl_InHeaderOrFooter( *pFmt ) ) { // OD 23.06.2003 #108784# - correction: for objects in header @@ -1272,7 +1282,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 +1318,9 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, SwFrm *pPrv ) { pDoc->BlockIdling(); - SwRootFrm* pLayout = pDoc->GetRootFrm(); - const BOOL bOldCallbackActionEnabled = pLayout ? pLayout->IsCallbackActionEnabled() : sal_False; - if(pLayout) + SwRootFrm* pLayout = pLay->getRootFrm(); + const BOOL bOldCallbackActionEnabled = pLayout ? pLayout->IsCallbackActionEnabled() : FALSE; + if( bOldCallbackActionEnabled ) pLayout->SetCallbackActionEnabled( FALSE ); //Bei der Erzeugung des Layouts wird bPages mit TRUE uebergeben. Dann @@ -1390,8 +1400,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 +1413,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 +1453,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 +1465,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 +1503,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 +1542,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 +1614,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 +1692,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 = TRUE; } @@ -1702,7 +1712,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, } pDoc->UnblockIdling(); - if(pLayout) + if( bOldCallbackActionEnabled ) pLayout->SetCallbackActionEnabled( bOldCallbackActionEnabled ); } @@ -1885,7 +1895,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 +1922,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, if( !pSct->ContainsCntnt() ) { pSct->DelEmpty( TRUE ); - pDoc->GetRootFrm()->RemoveFromList( pSct ); + pUpper->getRootFrm()->RemoveFromList( pSct ); delete pSct; } } @@ -2903,11 +2913,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() ) @@ -3019,7 +3029,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 ); @@ -3317,7 +3327,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 ); } @@ -3382,7 +3392,7 @@ 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,7 +3526,7 @@ const SwFrm* MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage ) return pPage; } -SwFrm* GetFrmOfModify( SwModify const& rMod, USHORT const nFrmType, +SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const& rMod, USHORT const nFrmType, const Point* pPoint, const SwPosition *pPos, const BOOL bCalcFrm ) { SwFrm *pMinFrm = 0, *pTmpFrm; @@ -3533,6 +3543,7 @@ SwFrm* GetFrmOfModify( SwModify const& rMod, USHORT const nFrmType, pTmpFrm = (SwFrm*)aIter.Next() ) { if( pTmpFrm->GetType() & nFrmType && + ( !pLayout || pLayout == pTmpFrm->getRootFrm() ) && (!pTmpFrm->IsFlowFrm() || !SwFlowFrm::CastFlowFrm( pTmpFrm )->IsFollow() )) { diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 3dc03053a23f..b808f22452af 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -51,6 +51,8 @@ // --> OD 2005-05-17 #i49383# #include <objectformatter.hxx> // <-- +#include "viewopt.hxx" +#include "viewsh.hxx" /************************************************************************* |* @@ -214,8 +216,8 @@ USHORT lcl_ColumnNum( const SwFrm* pBoss ) |*************************************************************************/ -SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt ): - SwLayoutFrm( pFmt ) +SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt, SwFrm* pSib ): + SwLayoutFrm( pFmt, pSib ) { nType = FRMC_FTNCONT; } @@ -283,7 +285,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, FALSE ); else { @@ -379,7 +388,8 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) return 0; } } - const bool bBrowseMode = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; + const BOOL bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); SwPageFrm *pPage = pBoss->FindPageFrm(); if ( bBrowseMode || !pPage->IsFtnPage() ) { @@ -483,9 +493,19 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, BOOL bTst, 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 ) @@ -511,8 +531,8 @@ SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, BOOL bTst, BOOL bInfo ) |*************************************************************************/ -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 ), @@ -636,8 +656,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(); @@ -1146,7 +1166,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; @@ -1379,6 +1399,8 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) if ( pLast->ISA(SwFrm) ) { SwFrm *pFrm = (SwFrm*)pLast; + if( pFrm->getRootFrm() == pCheck->getRootFrm() ) + { SwFrm *pTmp = pFrm->GetUpper(); while ( pTmp && !pTmp->IsFtnFrm() ) pTmp = pTmp->GetUpper(); @@ -1397,6 +1419,7 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) } } } + } pLast = ++aIter; } } @@ -1830,7 +1853,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() ); @@ -2850,7 +2873,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, TRUE ); if ( IsInSct() ) nMaxFtnHeight += FindSctFrm()->Grow( LONG_MAX, TRUE ); @@ -2932,9 +2956,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; } @@ -3181,7 +3208,7 @@ BOOL SwCntntFrm::MoveFtnCntFwd( 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() ) { @@ -3315,7 +3342,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, FALSE ); + SwCntntFrm* pCFrm = rTNd.getLayoutFrm( getRootFrm(), 0, &aPos, FALSE ); return pCFrm; } diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 79348f01d1e2..8155c7503cc8 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, USHORT nTypeIn) - : SwLayoutFrm(pFmt) +SwHeadFootFrm::SwHeadFootFrm( SwFrmFmt * pFmt, SwFrm* pSib, USHORT nTypeIn) + : SwLayoutFrm( pFmt, pSib ) { nType = nTypeIn; SetDerivedVert( FALSE ); @@ -710,7 +712,8 @@ void SwPageFrm::PrepareHeader() const SwFmtHeader &rH = ((SwFrmFmt*)pRegisteredIn)->GetHeader(); - const BOOL bOn = !((SwFrmFmt*)pRegisteredIn)->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const 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 ); @@ -760,7 +763,8 @@ void SwPageFrm::PrepareFooter() while ( pLay->GetNext() ) pLay = (SwLayoutFrm*)pLay->GetNext(); - const BOOL bOn = !((SwFrmFmt*)pRegisteredIn)->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const 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 1475a3909220..ded3f568fa04 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -438,7 +438,8 @@ BOOL SwLayAction::RemoveEmptyBrowserPages() //Beim umschalten vom normalen in den Browsermodus bleiben u.U. einige //unangenehm lange stehen. Diese beseiten wir mal schnell. BOOL bRet = 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 @@ -1181,7 +1182,8 @@ const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrm* _pPage, BOOL SwLayAction::IsShortCut( SwPageFrm *&prPage ) { BOOL bRet = FALSE; - const BOOL bBrowse = pRoot->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = pRoot->GetCurrShell(); + const BOOL bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); //Wenn die Seite nicht Gueltig ist wird sie schnell formatiert, sonst //gibts nix als Aerger. @@ -1430,19 +1432,14 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) BOOL bNoPaint = 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 = TRUE; } - } if ( !bNoPaint && IsPaint() && bAddRect && (pLay->IsCompletePaint() || bChanged) ) { @@ -1482,8 +1479,14 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth); } - if ( pLay->IsPageFrm() && - pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + BOOL bPageInBrowseMode = pLay->IsPageFrm(); + if( bPageInBrowseMode ) + { + const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell(); + if( !pSh || !pSh->GetViewOptions()->getBrowseMode() ) + bPageInBrowseMode = FALSE; + } + if( bPageInBrowseMode ) { // NOTE: no vertical layout in online layout //Ist die Aenderung ueberhaupt sichtbar? @@ -1848,7 +1851,8 @@ BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) BOOL SwLayAction::FormatCntnt( const SwPageFrm *pPage ) { const SwCntntFrm *pCntnt = pPage->ContainsCntnt(); - const BOOL bBrowse = pRoot->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = pRoot->GetCurrShell(); + const 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 39b8a60ef695..670d606fbc23 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 @@ 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, 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 ) 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 ) { USHORT nIndex = 0; 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 ) @@ -598,7 +603,10 @@ 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; } } @@ -893,7 +901,7 @@ BOOL SwLayHelper::CheckInsert( 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(); @@ -925,7 +933,7 @@ BOOL SwLayHelper::CheckInsert( 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/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 1f9c92220bfa..697f4abfaa96 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -424,7 +424,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 ), @@ -446,6 +446,7 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : nType = FRMC_ROOT; bIdleFormat = bTurboAllowed = bAssertFlyPages = bIsNewLayout = TRUE; bCheckSuperfluous = bBrowseWidthValid = FALSE; + setRootFrm( this ); InitCurrShells( this ); @@ -454,14 +455,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 = FALSE; //vor Verlassen auf 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() ); } @@ -553,6 +557,7 @@ SwRootFrm::~SwRootFrm() pBlink->FrmDelete( this ); ((SwFrmFmt*)pRegisteredIn)->GetDoc()->DelFrmFmt( (SwFrmFmt*)pRegisteredIn ); delete pDestroy; + pDestroy = 0; //Referenzen entfernen. for ( USHORT i = 0; i < pCurrShells->Count(); ++i ) @@ -585,5 +590,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(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 72976a786fa1..188eb9abb5e6 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" @@ -89,8 +90,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; } @@ -196,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 ), @@ -221,12 +222,12 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) : bInvalidLayout = bInvalidCntnt = bInvalidSpelling = bInvalidSmartTags = bInvalidAutoCmplWrds = bInvalidWordCount = TRUE; bInvalidFlyLayout = bInvalidFlyCntnt = bInvalidFlyInCnt = bFtnPage = bEndNotePage = 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 ); @@ -241,7 +242,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) : { bEmptyPage = 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 @@ -291,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(); @@ -340,16 +341,16 @@ void SwPageFrm::CheckDirection( 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) ) + if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir ) bVertical = 0; else - bVertical = 1; -/* - if( pDesc && pDesc->GetName().GetChar(0)=='x') - bReverse = 1; + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) + bVertical = 0; else - */ + bVertical = 1; + } bReverse = 0; bInvalidVert = 0; } @@ -465,7 +466,7 @@ void MA_FASTCALL lcl_MakeObjs( const SwSpzFrmFmts &rTbl, SwPageFrm *pPage ) pFly->AnchorFrm()->RemoveFly( pFly ); } else - pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pPg ); + pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pPg, pPg ); pPg->AppendFly( pFly ); ::RegistFlys( pPg, pFly ); } @@ -532,7 +533,7 @@ void SwPageFrm::PreparePage( BOOL bFtn ) |*************************************************************************/ void SwPageFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( pSh ) pSh->SetFirstVisPageInvalid(); BYTE nInvFlags = 0; @@ -622,7 +623,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 = FALSE; // OD 28.10.2002 #97265# - Don't call <SwPageFrm::MakeAll()> @@ -650,8 +652,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. @@ -790,7 +791,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() ) @@ -847,10 +849,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() ); } @@ -876,7 +881,7 @@ void SwPageFrm::Cut() // PAGES01 //AdjustRootSize( CHG_CUTPAGE, 0 ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( !IsEmptyPage() ) { if ( GetNext() ) @@ -982,9 +987,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 ); } /************************************************************************* @@ -1066,7 +1073,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, 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() ) @@ -1157,7 +1164,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, 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( FALSE ); pPage = pTmp; @@ -1316,7 +1323,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, 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 @@ -1336,7 +1343,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, 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 @@ -1359,7 +1366,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) if ( bCheckPages ) { CheckPageDescs( pSibling, FALSE ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); SwViewImp *pImp = pSh ? pSh->Imp() : 0; if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() ) { @@ -1376,7 +1383,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, 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() ); @@ -1388,12 +1395,13 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) // false = right, true = left sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const { - if (!GetShell() || GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)) + ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( !pSh || pSh->GetViewOptions()->getBrowseMode() ) return sw::sidebarwindows::SIDEBAR_NONE; 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 @@ -1534,7 +1542,7 @@ void SwRootFrm::RemoveSuperfluous() } } while ( pPage ); - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( nDocPos != LONG_MAX && (!pSh || !pSh->Imp()->IsUpdateExpFlds()) ) { @@ -1595,7 +1603,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( FALSE ); bOdd = bOdd ? FALSE : TRUE; @@ -1603,7 +1611,7 @@ void SwRootFrm::AssertFlyPages() } pPage = new SwPageFrm( (bOdd ? pDesc->GetRightFmt() : - pDesc->GetLeftFmt()), pDesc ); + pDesc->GetLeftFmt()), this, pDesc ); pPage->Paste( this, pSibling ); pPage->PreparePage( FALSE ); bOdd = bOdd ? FALSE : TRUE; @@ -1754,8 +1762,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, @@ -1772,7 +1780,7 @@ void SwRootFrm::ImplCalcBrowseWidth() return; bBrowseWidthValid = TRUE; - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); nBrowseWidth = pSh ? MINLAY + 2 * pSh->GetOut()-> PixelToLogic( pSh->GetBrowseBorder() ).Width() @@ -2021,7 +2029,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(); @@ -2076,7 +2085,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() ) { @@ -2175,7 +2184,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 ) { @@ -2415,7 +2424,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 b838c8163837..0120fb8fb990 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -318,7 +318,7 @@ static const SwFrm* lcl_GetFrmOfNode( const SwNode& rNd ) pMod = 0; Point aNullPt; - return pMod ? ::GetFrmOfModify( *pMod, nFrmType, &aNullPt, 0, FALSE ) + return pMod ? ::GetFrmOfModify( 0, *pMod, nFrmType, &aNullPt, 0, FALSE ) : 0; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 09fc6b00e03d..2b1a1a5373bb 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -33,9 +33,7 @@ #include <hintids.hxx> -#ifndef _SOUND_HXX //autogen #include <vcl/sound.hxx> -#endif #include <tools/poly.hxx> #define _SVSTDARR_LONGS #include <svl/svstdarr.hxx> @@ -49,9 +47,7 @@ // --> collapsing borders FME 2005-05-27 #i29550# #include <svx/framelink.hxx> // <-- -#ifndef _GRAPH_HXX //autogen #include <vcl/graph.hxx> -#endif #include <svx/svdpagv.hxx> #include <tgrditem.hxx> @@ -59,9 +55,7 @@ #include <fmtsrnd.hxx> #include <fmtclds.hxx> #include <tools/shl.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <swmodule.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> @@ -3108,14 +3102,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 = TRUE; break; case HACK_TABLEMODE_LOCKLINES : pLines->LockLines( TRUE ); break; case HACK_TABLEMODE_PAINTLINES : pLines->PaintLines( GetShell()->GetOut() ); break; case HACK_TABLEMODE_UNLOCKLINES: pLines->LockLines( FALSE ); break; - case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetShell()->GetOut() ); + case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetCurrShell()->GetOut() ); DELETEZ( pLines ); pGlobalShell = 0; bTableHack = FALSE; @@ -3187,7 +3181,7 @@ SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect ) void SwLayoutFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ ) const { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); // --> FME 2004-06-24 #i16816# tagged pdf support Frm_Info aFrmInfo( *this ); @@ -3630,8 +3624,8 @@ void SwFlyFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ // 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 ); @@ -4291,7 +4285,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 ) @@ -4331,7 +4325,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 ) @@ -4395,7 +4389,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 ) @@ -4434,7 +4428,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 +5246,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,7 +5734,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, { if ( bBack || bPageFrm || !bLowerMode ) { - const BOOL bBrowse = pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const BOOL bBrowse = pSh->GetViewOptions()->getBrowseMode(); SwRect aRect; if ( (bPageFrm && bBrowse) || @@ -6393,7 +6387,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 +6399,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 +6496,7 @@ BOOL SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, 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 +6552,7 @@ BOOL SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, { rpBrush = &rBack; if ( pFrm->IsPageFrm() && - pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + pSh->GetViewOptions()->getBrowseMode() ) rOrigRect = pFrm->Frm(); else { @@ -6623,7 +6617,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) SwClientIter aIter( *this ); SwClient *pFirst = aIter.First( TYPE(SwFrm) ); ViewShell *pSh; - if ( pFirst && 0 != ( pSh = ((SwFrm*)pFirst)->GetShell()) ) + if ( pFirst && 0 != ( pSh = ((SwFrm*)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 7a1a51deb8eb..b64ab79a3e37 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -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, 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( 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( 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 @@ BOOL SwSectionFrm::SplitSect( SwFrm* pFrm, 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, 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 = 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( FALSE ); bValidSize = TRUE; } @@ -2041,9 +2043,14 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, BOOL bTst ) 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) ) + 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() ) @@ -2561,7 +2568,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 +2762,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/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 9b3ff15666f9..33e971b63e85 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -372,7 +372,7 @@ SwFrm::~SwFrm() // 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(); @@ -437,8 +437,8 @@ void SwLayoutFrm::SetFrmFmt( SwFrmFmt *pNew ) /************************************************************************* |* SwCntntFrm::SwCntntFrm() |*************************************************************************/ -SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt ) : - SwFrm( pCntnt ), +SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt, SwFrm* pSib ) : + SwFrm( pCntnt, pSib ), SwFlowFrm( (SwFrm&)*this ) { } @@ -453,7 +453,7 @@ SwCntntFrm::~SwCntntFrm() !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(); @@ -479,7 +479,7 @@ SwCntntFrm::~SwCntntFrm() pTxtFtn = rFtnIdxs[ nPos ]; if( pTxtFtn->GetTxtNode().GetIndex() > nIndex ) break; - pTxtFtn->DelFrms(); + pTxtFtn->DelFrms( this ); ++nPos; } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index f912be5cb9b1..9ae9e3178f37 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -40,6 +40,8 @@ #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" @@ -95,8 +97,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 +117,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): SwFrm *pTmpPrev = 0; for ( USHORT 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 +130,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): } SwTabFrm::SwTabFrm( SwTabFrm &rTab ) : - SwLayoutFrm( rTab.GetFmt() ), + SwLayoutFrm( rTab.GetFmt(), &rTab ), SwFlowFrm( (SwFrm&)*this ), pTable( rTab.GetTable() ) { @@ -274,7 +276,7 @@ SwRowFrm* lcl_InsertNewFollowFlowLine( SwTabFrm& rTab, const SwFrm& rTmpRow, boo const SwRowFrm& rRow = (SwRowFrm&)rTmpRow; rTab.SetFollowFlowLine( 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 +607,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 +1279,7 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee // Insert new headlines: bDontCreateObjects = TRUE; //frmtool SwRowFrm* pHeadline = new SwRowFrm( - *GetTable()->GetTabLines()[ nRowCount ] ); + *GetTable()->GetTabLines()[ nRowCount ], this ); pHeadline->SetRepeatedHeadline( true ); bDontCreateObjects = FALSE; pHeadline->InsertBefore( pFoll, 0 ); @@ -1731,7 +1733,8 @@ void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab ) } SwFrm *pUp = pTab->GetUpper(); long nBottom = (pUp->*fnRect->fnGetPrtBottom)(); - if ( pTab->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = pTab->getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nBottom += pUp->Grow( LONG_MAX, TRUE ); lcl_CalcLowers( (SwLayoutFrm*)pTab->Lower(), pTab, LONG_MAX, false ); } @@ -2363,7 +2366,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 ) ) @@ -3284,11 +3288,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" @@ -3373,7 +3377,7 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { (Frm().*fnRect->fnAddBottom)( nDist ); - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -3509,7 +3513,7 @@ void SwTabFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, for ( USHORT nIdx = 0; nIdx < nNewRepeat; ++nIdx ) { bDontCreateObjects = TRUE; //frmtool - SwRowFrm* pHeadline = new SwRowFrm( *GetTable()->GetTabLines()[ nIdx ] ); + SwRowFrm* pHeadline = new SwRowFrm( *GetTable()->GetTabLines()[ nIdx ], this ); pHeadline->SetRepeatedHeadline( true ); bDontCreateObjects = FALSE; pHeadline->Paste( this, pLowerRow ); @@ -3781,7 +3785,8 @@ BOOL SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL &rReformat ) nSpace = nTmpSpace; // <-- - if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + if( pSh && pSh->GetViewOptions()->getBrowseMode() ) nSpace += pNewUpper->Grow( LONG_MAX, TRUE ); } } @@ -4009,8 +4014,8 @@ void SwTabFrm::Prepare( const PrepareHint eHint, const void *, 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# @@ -4031,7 +4036,7 @@ SwRowFrm::SwRowFrm( const SwTableLine &rLine, bool bInsertContent ): SwFrm *pTmpPrev = 0; for ( USHORT 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; } @@ -4667,7 +4672,7 @@ void SwRowFrm::AdjustCells( const SwTwips nHeight, const BOOL bHeight ) SwFrm *pFrm = Lower(); if ( bHeight ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); SWRECTFN( this ) SwRect aOldFrm; @@ -4777,7 +4782,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(); @@ -5027,8 +5032,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; @@ -5050,7 +5055,7 @@ SwCellFrm::SwCellFrm( const SwTableBox &rBox, bool bInsertContent ) : SwFrm *pTmpPrev = 0; for ( USHORT 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; } @@ -5064,7 +5069,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() ) { @@ -5621,7 +5626,7 @@ void SwCellFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew ) SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_PROTECT, FALSE ) ) || RES_PROTECT == pNew->Which() ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if( pSh && pSh->GetLayout()->IsAnyShellAccessible() ) pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this ); } @@ -5681,7 +5686,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 018e48440b59..034387978ed7 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -893,7 +893,7 @@ USHORT SwRootFrm::GetCurrPage( const SwPaM *pActualCrsr ) const { ASSERT( pActualCrsr, "Welche Seite soll's denn sein?" ); const SwFrm *pActFrm = GetFmt()->GetDoc()->GetNodes()[pActualCrsr->GetPoint()->nNode]-> - GetCntntNode()->GetFrm( 0, + GetCntntNode()->getLayoutFrm( this, 0, pActualCrsr->GetPoint(), FALSE ); return pActFrm->FindPageFrm()->GetPhyPageNum(); @@ -1878,8 +1878,8 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) const SwCntntNode* pTmpStartNode = rTblCrsr.GetCntntNode(); const SwCntntNode* pTmpEndNode = rTblCrsr.GetCntntNode(FALSE); - const SwFrm* pTmpStartFrm = pTmpStartNode ? pTmpStartNode->GetFrm( &aPtPt, 0, FALSE ) : 0; - const SwFrm* pTmpEndFrm = pTmpEndNode ? pTmpEndNode->GetFrm( &aMkPt, 0, FALSE ) : 0; + const SwFrm* pTmpStartFrm = pTmpStartNode ? pTmpStartNode->getLayoutFrm( this, &aPtPt, 0, FALSE ) : 0; + const SwFrm* pTmpEndFrm = pTmpEndNode ? pTmpEndNode->getLayoutFrm( this, &aMkPt, 0, FALSE ) : 0; const SwLayoutFrm* pStart = pTmpStartFrm ? pTmpStartFrm->GetUpper() : 0; const SwLayoutFrm* pEnd = pTmpEndFrm ? pTmpEndFrm->GetUpper() : 0; @@ -2016,7 +2016,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, 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() ? @@ -2024,10 +2024,10 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, 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(); @@ -2048,10 +2048,10 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) //Erstmal die CntntFrms zum Start und End besorgen, die brauch ich auf //jedenfall. const SwCntntFrm *pStartFrm = rNds[ pStartPos->nNode ]-> - GetCntntNode()->GetFrm( &rCrsr.GetSttPos(), pStartPos ); + GetCntntNode()->getLayoutFrm( this, &rCrsr.GetSttPos(), pStartPos ); const SwCntntFrm *pEndFrm = rNds[ pEndPos->nNode ]-> - 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 ade3efd4e70d..5a8c8b00d7c9 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 ), @@ -114,16 +118,6 @@ SwFrm::SwFrm( SwModify *pMod ) : bCompletePaint = bInfInvalid = TRUE; } - -ViewShell * SwFrm::GetShell() const -{ - const SwRootFrm *pRoot; - if ( 0 != (pRoot = FindRootFrm()) ) - return pRoot->GetCurrShell(); - return 0; -} - - void SwFrm::CheckDir( UINT16 nDir, BOOL bVert, BOOL bOnlyBiDi, BOOL bBrowse ) { if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) ) @@ -173,9 +167,12 @@ void SwSectionFrm::CheckDirection( BOOL bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const 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 ); } @@ -184,9 +181,12 @@ void SwFlyFrm::CheckDirection( BOOL bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const 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 ); } @@ -195,9 +195,12 @@ void SwTabFrm::CheckDirection( BOOL bVert ) { const SwFrmFmt* pFmt = GetFmt(); if( pFmt ) + { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const 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 ); } @@ -213,8 +216,9 @@ void SwCellFrm::CheckDirection( BOOL bVert ) if( pFmt && SFX_ITEM_SET == pFmt->GetItemState( RES_FRAMEDIR, 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 BOOL bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); + CheckDir( pFrmDirItem->GetValue(), bVert, sal_False, bBrowseMode ); } else SwFrm::CheckDirection( bVert ); @@ -222,9 +226,10 @@ void SwCellFrm::CheckDirection( BOOL bVert ) void SwTxtFrm::CheckDirection( BOOL bVert ) { + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const BOOL bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); CheckDir( GetTxtNode()->GetSwAttrSet().GetFrmDir().GetValue(), bVert, - sal_True, - GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ); + sal_True, bBrowseMode ); } /************************************************************************* @@ -983,7 +988,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(); @@ -1392,7 +1397,8 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, BOOL bTst ) if ( !nDiff || !GetUpper()->IsFtnBossFrm() ) // nur innerhalb von Seiten/Spalten return 0L; - BOOL bBrowse = GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const BOOL bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); //Der (Page)Body veraendert sich nur im BrowseMode, aber nicht wenn er //Spalten enthaelt. @@ -1406,16 +1412,16 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, 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 ) { @@ -1425,7 +1431,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, 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. @@ -1455,12 +1461,12 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, 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); } @@ -1483,16 +1489,16 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, 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(); @@ -1500,7 +1506,7 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, 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() ) { @@ -1889,7 +1895,8 @@ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) nDist > (LONG_MAX - nFrmHeight ) ) nDist = LONG_MAX - nFrmHeight; - const BOOL bBrowse = GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const BOOL bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const USHORT nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() ) { @@ -2347,8 +2354,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(); @@ -2411,7 +2418,8 @@ SwTwips SwLayoutFrm::InnerHeight() const |*************************************************************************/ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { - const BOOL bBrowse = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const BOOL bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const USHORT nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2557,7 +2565,7 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) if( bMoveAccFrm && IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -2577,7 +2585,8 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) |*************************************************************************/ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { - const BOOL bBrowse = GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); + const ViewShell *pSh = getRootFrm()->GetCurrShell(); + const BOOL bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); const USHORT nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2675,7 +2684,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) if( bMoveAccFrm && IsAccessibleFrm() ) { - SwRootFrm *pRootFrm = FindRootFrm(); + SwRootFrm *pRootFrm = getRootFrm(); if( pRootFrm && pRootFrm->IsAnyShellAccessible() && pRootFrm->GetCurrShell() ) { @@ -3330,10 +3339,9 @@ long SwLayoutFrm::CalcRel( const SwFmtFrmSize &rSz, 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 BOOL bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); + if( pRel->IsPageBodyFrm() && pSh && bBrowseMode && pSh->VisArea().Width() ) { nRel = pSh->GetBrowseWidth(); long nDiff = nRel - pRel->Prt().Width(); @@ -3434,7 +3442,9 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs, BOOL bEnd = FALSE; BOOL bBackLock = 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. @@ -3949,7 +3959,7 @@ void SwRootFrm::InvalidateAllCntnt( BYTE nInv ) if( nInv & INV_PRTAREA ) { - ViewShell *pSh = GetShell(); + ViewShell *pSh = getRootFrm()->GetCurrShell(); if( pSh ) pSh->InvalidateWindows( Frm() ); } |