diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 13 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 61 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 6 |
5 files changed, 50 insertions, 53 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a4bfb58d0b79..7c79c097b03e 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -475,6 +475,10 @@ private: bool mbXMLExport : 1; ///< sal_True: during XML export #endif + // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position. + // Thus, certain adjustment needed during formatting for these kind of anchored objects. + bool mbContainsAtPageObjWithContentAnchor : 1; + // // COMPATIBILITY FLAGS START // @@ -1030,6 +1034,15 @@ public: void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; } #endif + void SetContainsAtPageObjWithContentAnchor( const bool bFlag ) + { + mbContainsAtPageObjWithContentAnchor = bFlag; + } + bool DoesContainAtPageObjWithContentAnchor() + { + return mbContainsAtPageObjWithContentAnchor; + } + /** Returns positions of all FlyFrames in the document. If a Pam-Pointer is passed the FlyFrames attached to paragraphes have to be surrounded completely by ::com::sun::star::awt::Selection. diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 251ff0ee34fe..3759b6eb6207 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -2068,7 +2068,7 @@ void SwDoc::SetAllUniqueFlyNames() SwFrmFmts aArr; aArr.reserve( n ); SwFrmFmt* pFlyFmt; - bool bLoadedFlag = true; // something for the Layout + bool bContainsAtPageObjWithContentAnchor = false; for( n = GetSpzFrmFmts()->size(); n; ) { @@ -2094,22 +2094,17 @@ void SwDoc::SetAllUniqueFlyNames() aArr.push_back( pFlyFmt ); } - if( bLoadedFlag ) + if ( !bContainsAtPageObjWithContentAnchor ) { const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor(); - if (((FLY_AT_PAGE == rAnchor.GetAnchorId()) && - rAnchor.GetCntntAnchor()) || - // Or are DrawObjects adjusted relatively to something? - ( RES_DRAWFRMFMT == pFlyFmt->Which() && ( - SFX_ITEM_SET == pFlyFmt->GetItemState( - RES_VERT_ORIENT )|| - SFX_ITEM_SET == pFlyFmt->GetItemState( - RES_HORI_ORIENT ))) ) + if ( (FLY_AT_PAGE == rAnchor.GetAnchorId()) && + rAnchor.GetCntntAnchor() ) { - bLoadedFlag = false; + bContainsAtPageObjWithContentAnchor = true; } } } + SetContainsAtPageObjWithContentAnchor( bContainsAtPageObjWithContentAnchor ); const SwNodeIndex* pIdx; @@ -2154,11 +2149,6 @@ void SwDoc::SetAllUniqueFlyNames() GetFtnIdxs().UpdateFtn( aTmp ); } } - - // Found a new document, but not a page anchored Frame/DrawObjects - // that are anchored to another Node. - if( bLoadedFlag ) - SetLoaded( sal_True ); } bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index c978716d4f1b..44428daa386d 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -282,6 +282,7 @@ SwDoc::SwDoc() #ifdef DBG_UTIL mbXMLExport(false), #endif + mbContainsAtPageObjWithContentAnchor(false), //#i119292#, fdo#37024 // COMPATIBILITY FLAGS START diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index e6a443382ba6..51ab0afe3b6e 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -835,7 +835,7 @@ SwCntntNotify::~SwCntntNotify() } } - bool bFirst = (aFrm.*fnRect->fnGetWidth)() == 0; + const bool bFirst = (aFrm.*fnRect->fnGetWidth)() == 0; if ( pCnt->IsNoTxtFrm() ) { @@ -909,53 +909,48 @@ SwCntntNotify::~SwCntntNotify() SwDoc *pDoc = pCnt->GetNode()->GetDoc(); if ( !pDoc->GetSpzFrmFmts()->empty() && - !pDoc->IsLoaded() && !pDoc->IsNewDoc() ) - { - //The Frm has been formatted probably for the first time. - //If a filter read Flys or Drawingobjects and these - //are bound to the page, he has a problem, because he typically - //does not know the number of the page. He knows only wich is the - //content (CntntNode) at this position. - //The filter provides the anchor attribut of the objects so, that - //they are side bound type, but the index of the anchor points - //to this CntntNode. - //Here these preliminary connections are dissolved. + pDoc->DoesContainAtPageObjWithContentAnchor() && !pDoc->IsNewDoc() ) + { + // If certain import filters for foreign file format import + // AT_PAGE anchored objects, the corresponding page number is + // typically not known. In this case the content position is + // stored at which the anchored object is found in the + // imported document. + // When this content is formatted it is the time at which + // the page is known. Thus, this data can be corrected now. const SwPageFrm *pPage = 0; - SwNodeIndex *pIdx = 0; + SwNodeIndex *pIdx = 0; SwFrmFmts *pTbl = pDoc->GetSpzFrmFmts(); for ( sal_uInt16 i = 0; i < pTbl->size(); ++i ) { - if ( !pPage ) - pPage = pCnt->FindPageFrm(); SwFrmFmt *pFmt = (*pTbl)[i]; const SwFmtAnchor &rAnch = pFmt->GetAnchor(); - - if ((FLY_AT_PAGE != rAnch.GetAnchorId()) && - (FLY_AT_PARA != rAnch.GetAnchorId())) + if ( FLY_AT_PAGE != rAnch.GetAnchorId() || + rAnch.GetCntntAnchor() == 0 ) { - continue; //#60878# It's not that character bound. + continue; } - if ( rAnch.GetCntntAnchor() ) + if ( !pIdx ) { - if ( !pIdx ) + pIdx = new SwNodeIndex( *pCnt->GetNode() ); + } + if ( rAnch.GetCntntAnchor()->nNode == *pIdx ) + { + OSL_FAIL( "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); + if ( !pPage ) { - pIdx = new SwNodeIndex( *pCnt->GetNode() ); + pPage = pCnt->FindPageFrm(); } - if ( rAnch.GetCntntAnchor()->nNode == *pIdx ) + SwFmtAnchor aAnch( rAnch ); + aAnch.SetAnchor( 0 ); + aAnch.SetPageNum( pPage->GetPhyPageNum() ); + pFmt->SetFmtAttr( aAnch ); + if ( RES_DRAWFRMFMT != pFmt->Which() ) { - if (FLY_AT_PAGE == rAnch.GetAnchorId()) - { - OSL_FAIL( "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); - SwFmtAnchor aAnch( rAnch ); - aAnch.SetAnchor( 0 ); - aAnch.SetPageNum( pPage->GetPhyPageNum() ); - pFmt->SetFmtAttr( aAnch ); - if ( RES_DRAWFRMFMT != pFmt->Which() ) - pFmt->MakeFrms(); - } + pFmt->MakeFrms(); } } } diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 023a37380c6d..a17f91d54094 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -288,10 +288,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) } else if( pCrsr ) { - // seitengebundene Flys eingefuegt, dann schalte - // die Optimierungs-Flags vom SwDoc ab. Sonst - // werden die Flys nicht an der Position erzeugt. - pDoc->SetLoaded( sal_False ); + pDoc->SetContainsAtPageObjWithContentAnchor( true ); } } else @@ -350,6 +347,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) pDoc->UpdateNumRule(); pDoc->ChkCondColls(); pDoc->SetAllUniqueFlyNames(); + pDoc->SetLoaded( true ); pDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo); if (!bReadPageDescs) |