summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2012-05-09 12:51:10 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-04-02 10:39:13 +0100
commitf0d001a378c64ea457e722266e60c96522c72e9b (patch)
treea3f6890b6c130d7fa02841c45ff3aadd4249147f /sw/source/core/layout
parent641d8eaa980c00802964e07b0397ba3c2884bd7d (diff)
Resolves: #i119292# remove misusage of <SwDoc::Set|IsLoaded()>
...for the adjustments of certain AT_PAGE anchored objects Addresses the underlying problem of fdo#37024 fixed by 9d32497c01475f2b5e5bec756e4dd0ca9f9d4928 (cherry picked from commit b41eec25c2c6bc44eef55ae1c4ef57b9012fc8e6) Conflicts: sw/inc/doc.hxx sw/source/core/doc/doclay.cxx sw/source/core/doc/docnew.cxx sw/source/core/layout/frmtool.cxx Change-Id: I786eabdf84677e14c6f4b67d79e1e210e0532a21
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/frmtool.cxx61
1 files changed, 28 insertions, 33 deletions
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();
}
}
}