[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa sw/source

Miklos Vajna vmiklos at suse.cz
Fri Aug 9 02:52:47 PDT 2013


 sw/qa/extras/ww8import/data/n823651.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx    |   10 ++++++++++
 sw/source/filter/ww8/ww8par.cxx         |    6 ++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 032fcebe8db8ab0ad25153d1a62d43e56162f517
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Aug 8 12:04:36 2013 +0200

    bnc#823651 WW8 import: fix paragraph style in empty first page header
    
    The problem was that the first page SwFmtHeader / SwFmtFooter wasn't
    created in case the header/footer text was empty, even if fTitlePage was
    set.
    
    (cherry picked from commit 4bc063090c06f0c34980a3852f684b42ab25c501)
    
    Change-Id: I5e58419161bcc663e2beb0338b95877469e0fd3c
    Reviewed-on: https://gerrit.libreoffice.org/5314
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/sw/qa/extras/ww8import/data/n823651.doc b/sw/qa/extras/ww8import/data/n823651.doc
new file mode 100755
index 0000000..51b383c
Binary files /dev/null and b/sw/qa/extras/ww8import/data/n823651.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 0ded9f7..ef68da6 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -35,6 +35,7 @@ public:
     void testN816603();
     void testN816593();
     void testPageBorder();
+    void testN823651();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -61,6 +62,7 @@ void Test::run()
         {"n816603.doc", &Test::testN816603},
         {"n816593.doc", &Test::testN816593},
         {"page-border.doc", &Test::testPageBorder},
+        {"n823651.doc", &Test::testN823651},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -282,6 +284,14 @@ void Test::testPageBorder()
     CPPUNIT_ASSERT_EQUAL(sal_uInt32(TWIP_TO_MM100(6 * 20)), aBorder.LineWidth);
 }
 
+void Test::testN823651()
+{
+    // Character height was 10pt instead of 7.5pt in the header.
+    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    uno::Reference<text::XText> xText = getProperty< uno::Reference<text::XTextRange> >(xStyle, "HeaderTextFirst")->getText();
+    CPPUNIT_ASSERT_EQUAL(7.5f, getProperty<float>(getParagraphOfText(1, xText), "CharHeight"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 26c7889..bf5bea0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2005,6 +2005,8 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                     : pPD->GetMaster();
 
                 SwFrmFmt* pHdFtFmt;
+                // If we have empty first page header and footer.
+                bool bNoFirst = !(grpfIhdt & WW8_HEADER_FIRST) && !(grpfIhdt & WW8_FOOTER_FIRST);
                 if (bFooter)
                 {
                     bIsFooter = true;
@@ -2013,7 +2015,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                         pPD->GetMaster().SetFmtAttr(SwFmtFooter(true));
                     if (bUseLeft)
                         pPD->GetLeft().SetFmtAttr(SwFmtFooter(true));
-                    if (bUseFirst)
+                    if (bUseFirst || (rSection.maSep.fTitlePage && bNoFirst))
                         pPD->GetFirst().SetFmtAttr(SwFmtFooter(true));
                     pHdFtFmt = const_cast<SwFrmFmt*>(rFmt.GetFooter().GetFooterFmt());
                 }
@@ -2025,7 +2027,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                         pPD->GetMaster().SetFmtAttr(SwFmtHeader(true));
                     if (bUseLeft)
                         pPD->GetLeft().SetFmtAttr(SwFmtHeader(true));
-                    if (bUseFirst)
+                    if (bUseFirst || (rSection.maSep.fTitlePage && bNoFirst))
                         pPD->GetFirst().SetFmtAttr(SwFmtHeader(true));
                     pHdFtFmt = const_cast<SwFrmFmt*>(rFmt.GetHeader().GetHeaderFmt());
                 }


More information about the Libreoffice-commits mailing list