summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-06-05 17:49:13 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-06-06 09:45:55 +0200
commitf06cc552a0699f7c2c34db981e77d4c8efe5e9e7 (patch)
tree9aae289fab35bec1f5ec24ff08e490e2612d58b4
parent11c00f1fdd63a4c9a011f1f2d0ca66945013f39b (diff)
wwSectionManager: fix import of page borders
Regression from 1e113cb7604e1509e7d598a9be329f1f7b6e9322. According to the spec (see 2.9.181), the first bit disables border of "all but first" pages, the second bit disables the border of first pages. Change-Id: Ie49c9b7b76d34c2a93350481965790976f49d7df
-rwxr-xr-xsw/qa/extras/ww8import/data/page-border.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx11
-rw-r--r--sw/source/filter/ww8/ww8par.cxx6
3 files changed, 14 insertions, 3 deletions
diff --git a/sw/qa/extras/ww8import/data/page-border.doc b/sw/qa/extras/ww8import/data/page-border.doc
new file mode 100755
index 000000000000..c2dec4fede22
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/page-border.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index d924ef314da7..0ded9f7714b9 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -15,12 +15,14 @@
#include <vcl/svapp.hxx>
#include <swmodeltestbase.hxx>
#include <bordertest.hxx>
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+
class Test : public SwModelTestBase
{
public:
void testN757910();
void testN760294();
void testN750255();
@@ -29,12 +31,13 @@ public:
void testN757905();
void testAllGapsWord();
void testFdo59530();
void testI120158();
void testN816603();
void testN816593();
+ void testPageBorder();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -54,12 +57,13 @@ void Test::run()
{"n757905.doc", &Test::testN757905},
{"all_gaps_word.doc", &Test::testAllGapsWord},
{"fdo59530.doc", &Test::testFdo59530},
{"i120158.doc", &Test::testI120158},
{"n816603.doc", &Test::testN816603},
{"n816593.doc", &Test::testN816593},
+ {"page-border.doc", &Test::testPageBorder},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
load("/sw/qa/extras/ww8import/data/", rEntry.pName);
@@ -268,11 +272,18 @@ void Test::testN816593()
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
// Make sure that even if we import the two tables as non-floating, we
// still consider them different, and not merge them.
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
+void Test::testPageBorder()
+{
+ // Page border was missing (LineWidth was 0), due to wrong interpretation of pgbApplyTo.
+ table::BorderLine2 aBorder = getProperty<table::BorderLine2>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "TopBorder");
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(TWIP_TO_MM100(6 * 20)), aBorder.LineWidth);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 598385a879d5..907454f44349 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3845,16 +3845,16 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
wwULSpaceData aULData;
GetPageULData(rSection, aULData);
SetPageULSpaceItems(rFmt, aULData, rSection);
SetPage(rPage, rFmt, rSection, bIgnoreCols);
- if (rSection.maSep.pgbApplyTo & 1)
- mrReader.SetPageBorder(rPage.GetFirst(), rSection);
- if (rSection.maSep.pgbApplyTo & 2)
+ if (!(rSection.maSep.pgbApplyTo & 1))
mrReader.SetPageBorder(rFmt, rSection);
+ if (!(rSection.maSep.pgbApplyTo & 2))
+ mrReader.SetPageBorder(rPage.GetFirst(), rSection);
mrReader.SetDocumentGrid(rFmt, rSection);
}
void wwSectionManager::SetUseOn(wwSection &rSection)
{