summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-07-04 10:43:56 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-07-04 10:54:20 +0200
commit37a5afbe98b8dad909f3a6dc7e815100835631ec (patch)
tree44e2b9260c876e75fbd49eca4909a5b043e117e6 /sw
parent5f4302c14772009a675d4b5b333f11c87c2e65c3 (diff)
sw: tell InsertNewPage() if that'll be a first page
And in that case we can unconditionally call GetFirstFmt(), as the SwPageDesc copying methods take care of the "shared first/right" setting already. With this, the layout handles HeaderIsSharedFirst and FooterIsSharedFirst correctly when the first page is the first physical page. Change-Id: Ib6d922aebaa1384856f79f2501dfbe087a74a20f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/frmtool.hxx2
-rw-r--r--sw/source/core/layout/frmtool.cxx8
-rw-r--r--sw/source/core/layout/ftnfrm.cxx4
-rw-r--r--sw/source/core/layout/laycache.cxx2
-rw-r--r--sw/source/core/layout/newfrm.cxx3
5 files changed, 12 insertions, 7 deletions
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 04d740cc7cf3..3444a1771316 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -101,7 +101,7 @@ long CalcRowRstHeight( SwLayoutFrm *pRow );
long CalcHeightWidthFlys( const SwFrm *pFrm );
SwPageFrm *InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
- sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn,
+ sal_Bool bOdd, bool bFirst, sal_Bool bInsertEmpty, sal_Bool bFtn,
SwFrm *pSibling );
// connect Flys with page
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 2c330680eb63..1f8576d0368a 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2695,12 +2695,16 @@ sal_uLong SqRt( BigInt nX )
/*************************************************************************/
SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
- sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn,
+ sal_Bool bOdd, bool bFirst, sal_Bool bInsertEmpty, sal_Bool bFtn,
SwFrm *pSibling )
{
SwPageFrm *pRet;
SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
- SwFrmFmt *pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
+ SwFrmFmt *pFmt = 0;
+ if (bFirst)
+ pFmt = rDesc.GetFirstFmt();
+ else
+ pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
//Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben
//eine Leerseite einfuegen.
if ( !pFmt )
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 5f78c91ee923..d469bd46947b 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1646,7 +1646,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
{
SwPageDesc *pDesc = pDoc->GetEndNoteInfo().GetPageDesc( *pDoc );
pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(),
- !pPage->OnRightPage(), sal_False, sal_True, 0 );
+ !pPage->OnRightPage(), false, sal_False, sal_True, 0 );
pPage->SetEndNotePage( sal_True );
bChgPage = sal_True;
}
@@ -1690,7 +1690,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
{
SwPageDesc *pDesc = pDoc->GetFtnInfo().GetPageDesc( *pDoc );
pPage = ::InsertNewPage( *pDesc, pPage->GetUpper(),
- !pPage->OnRightPage(), sal_False, sal_True, pPage->GetNext() );
+ !pPage->OnRightPage(), false, sal_False, sal_True, pPage->GetNext() );
bChgPage = sal_True;
}
else
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 835d58f891a3..8416c89d6d8f 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -652,7 +652,7 @@ sal_Bool SwLayHelper::CheckInsertPage()
bInsertEmpty = sal_True;
}
::InsertNewPage( (SwPageDesc&)*pDesc, rpPage->GetUpper(),
- bNextPageOdd, bInsertEmpty, sal_False, rpPage->GetNext() );
+ bNextPageOdd, nPgNum == 1, bInsertEmpty, sal_False, rpPage->GetNext() );
if ( bEnd )
{
OSL_ENSURE( rpPage->GetNext(), "No new page?" );
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 64755d591a04..96897edd16fb 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -555,9 +555,10 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
if ( !pDesc )
pDesc = &pDoc->GetPageDesc( 0 );
const sal_Bool bOdd = !nPgNum || 0 != ( nPgNum % 2 );
+ bool bFirst = !nPgNum || 1 == nPgNum;
// Create a page and put it in the layout
- SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, sal_False, sal_False, 0 );
+ SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, sal_False, sal_False, 0 );
// Find the first page in the Bodytext section.
SwLayoutFrm *pLay = pPage->FindBodyCont();