[Libreoffice-commits] .: 2 commits - sw/inc sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Jul 4 01:53:05 PDT 2012


 sw/inc/pagedesc.hxx                |    4 ++--
 sw/source/core/inc/frmtool.hxx     |    2 +-
 sw/source/core/layout/frmtool.cxx  |    8 ++++++--
 sw/source/core/layout/ftnfrm.cxx   |    4 ++--
 sw/source/core/layout/laycache.cxx |    2 +-
 sw/source/core/layout/newfrm.cxx   |    3 ++-
 6 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 37a5afbe98b8dad909f3a6dc7e815100835631ec
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jul 4 10:43:56 2012 +0200

    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

diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 04d740c..3444a17 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 2c33068..1f8576d 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 5f78c91..d469bd4 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 835d58f..8416c89 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 64755d5..96897ed 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();
commit 5f4302c14772009a675d4b5b333f11c87c2e65c3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jul 4 10:22:42 2012 +0200

    SwPageDesc: let IsHeaderShared() not affect IsHeaderSharedFirst()
    
    Change-Id: I23224f4b408e36a858cd8ce6b1cfbdaac2bf4b60

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index be9073c..e529c12 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -132,8 +132,8 @@ namespace nsUseOnPage
     const UseOnPage PD_MIRROR         = 0x000F;
     const UseOnPage PD_HEADERSHARE    = 0x0040;
     const UseOnPage PD_FOOTERSHARE    = 0x0080;
-    const UseOnPage PD_NOHEADERSHARE  = 0x00BF; // For internal use only.
-    const UseOnPage PD_NOFOOTERSHARE  = 0x007F; // For internal use only.
+    const UseOnPage PD_NOHEADERSHARE  = 0xFFBF; // For internal use only.
+    const UseOnPage PD_NOFOOTERSHARE  = 0xFF7F; // For internal use only.
     const UseOnPage PD_HEADERSHAREFIRST = 0x0100;
     const UseOnPage PD_NOHEADERSHAREFIRST = 0xFEFF;
     const UseOnPage PD_FOOTERSHAREFIRST = 0x0200;


More information about the Libreoffice-commits mailing list