From 693371d20886b750638b0f81205289c9f0f61716 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 8 Aug 2013 12:04:36 +0200 Subject: 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) Conflicts: sw/qa/extras/ww8import/ww8import.cxx Change-Id: I5e58419161bcc663e2beb0338b95877469e0fd3c --- sw/qa/extras/ww8import/data/n823651.doc | Bin 0 -> 30720 bytes sw/qa/extras/ww8import/ww8import.cxx | 10 ++++++++++ sw/source/filter/ww8/ww8par.cxx | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 sw/qa/extras/ww8import/data/n823651.doc diff --git a/sw/qa/extras/ww8import/data/n823651.doc b/sw/qa/extras/ww8import/data/n823651.doc new file mode 100755 index 000000000000..51b383c42d5d 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 b47e525af93e..8d3adc2a3b97 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -47,6 +47,7 @@ public: void testN757118(); void testN757905(); void testAllGapsWord(); + void testN823651(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -68,6 +69,7 @@ void Test::run() {"n757118.doc", &Test::testN757118}, {"n757905.doc", &Test::testN757905}, {"all_gaps_word.doc", &Test::testAllGapsWord}, + {"n823651.doc", &Test::testN823651}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -225,6 +227,14 @@ void Test::testAllGapsWord() } +void Test::testN823651() +{ + // Character height was 10pt instead of 7.5pt in the header. + uno::Reference xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); + uno::Reference xText = getProperty< uno::Reference >(xStyle, "HeaderTextFirst")->getText(); + CPPUNIT_ASSERT_EQUAL(7.5f, getProperty(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 6b131acba3ee..fa1295b90240 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1948,6 +1948,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; @@ -1956,7 +1958,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(rFmt.GetFooter().GetFooterFmt()); } @@ -1968,7 +1970,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(rFmt.GetHeader().GetHeaderFmt()); } -- cgit