[PATCH] export different first page header/footer to doc/docx

Luke Deller (via Code Review) gerrit at gerrit.libreoffice.org
Sat Feb 9 03:42:19 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2062

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/62/2062/1

export different first page header/footer to doc/docx

Change-Id: Iba39bf12c2419bb480e91ccb45851ec869c40e01
---
M sw/source/filter/ww8/wrtw8sty.cxx
M sw/source/filter/ww8/ww8atr.cxx
2 files changed, 11 insertions(+), 4 deletions(-)



diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index f002c1f..81e3ed7 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1525,7 +1525,6 @@
     sal_uInt8 nBreakCode = 2;            // default neue Seite beginnen
     bool bOutPgDscSet = true, bLeftRightPgChain = false;
     const SwFrmFmt* pPdFmt = &pPd->GetMaster();
-    const SwFrmFmt* pPdFirstPgFmt = pPdFmt;
     if ( rSepInfo.pSectionFmt )
     {
         // ist pSectionFmt gesetzt, dann gab es einen SectionNode
@@ -1584,7 +1583,15 @@
         }
     }
 
-    bool titlePage = false;
+    // Libreoffice 4.0+ introduces support for page styles (SwPageDesc) with
+    // a different header/footer for the first page.  The same effect can be
+    // achieved by chaining two page styles together (SwPageDesc::GetFollow)
+    // which are identical except for header/footer.
+    // The latter method is still used by the doc/docx import filter.
+    // In both of these cases, we emit a single Word section with different
+    // first page header/footer.
+    const SwFrmFmt* pPdFirstPgFmt = &pPd->GetFirst();
+    bool titlePage = pPdFmt != pPdFirstPgFmt;
     if ( bOutPgDscSet )
     {
         // es ist ein Follow gesetzt und dieser zeigt nicht auf sich
@@ -1600,7 +1607,7 @@
         {
             const SwPageDesc *pFollow = pPd->GetFollow();
             const SwFrmFmt& rFollowFmt = pFollow->GetMaster();
-            if ( sw::util::IsPlausableSingleWordSection( *pPdFmt, rFollowFmt ) )
+            if ( sw::util::IsPlausableSingleWordSection( *pPdFirstPgFmt, rFollowFmt ) )
             {
                 if (rSepInfo.pPDNd)
                     pPdFirstPgFmt = pPd->GetPageFmtOfNode( *rSepInfo.pPDNd );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 003bde1..096f012 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -364,7 +364,7 @@
                 bNewPageDesc = true;
             else
             {
-                const SwFrmFmt& rTitleFmt = pAktPageDesc->GetMaster();
+                const SwFrmFmt& rTitleFmt = pAktPageDesc->GetFirst();
                 const SwFrmFmt& rFollowFmt = pCurrent->GetMaster();
 
                 bNewPageDesc = !IsPlausableSingleWordSection(rTitleFmt,

-- 
To view, visit https://gerrit.libreoffice.org/2062
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba39bf12c2419bb480e91ccb45851ec869c40e01
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Luke Deller <luke at deller.id.au>


More information about the LibreOffice mailing list