summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ww8export/data/gutter-top.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx14
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx4
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx5
7 files changed, 30 insertions, 5 deletions
diff --git a/sw/qa/extras/ww8export/data/gutter-top.doc b/sw/qa/extras/ww8export/data/gutter-top.doc
new file mode 100644
index 000000000000..07ffa3945ac5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/gutter-top.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 2eb5c361f8ac..a4e4c552a93a 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -106,6 +106,20 @@ DECLARE_WW8EXPORT_TEST(testGutterLeft, "gutter-left.doc")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
}
+CPPUNIT_TEST_FIXTURE(Test, testGutterTop)
+{
+ load(mpTestDocumentPath, "gutter-top.doc");
+ reload(mpFilter, "gutter-top.doc");
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+ bool bGutterAtTop{};
+ xSettings->getPropertyValue("GutterAtTop") >>= bGutterAtTop;
+ // Without the accompanying fix in place, this test would have failed, becase the gutter was
+ // at the left.
+ CPPUNIT_ASSERT(bGutterAtTop);
+}
+
DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
{
auto xNumberingRules
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 26ef68865bda..bab71c2cff39 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -523,6 +523,11 @@ static void WriteDop( WW8Export& rWrt )
rDop.fProtEnabled = false;
}
+ if (rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP))
+ {
+ rDop.iGutterPos = true;
+ }
+
if (!xDocProps.is())
{
rDop.dttmCreated = rDop.dttmRevised = rDop.dttmLastPrint = 0x45FBAC69;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index ea9e4a42d728..10430ebdefc1 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1957,6 +1957,11 @@ void SwWW8ImplReader::ImportDop()
const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
if (rOpt.IsUseEnhancedFields())
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, m_xWDop->fProtEnabled );
+
+ if (m_xWDop->iGutterPos)
+ {
+ m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::GUTTER_AT_TOP, true);
+ }
}
void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index a8370dd84f41..c4c60f30f586 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -870,7 +870,7 @@ private:
static bool SetCols(SwFrameFormat &rFormat, const wwSection &rSection,
sal_uInt32 nNetWidth);
bool SectionIsProtected(const wwSection &rSection) const;
- void SetLeftRight(wwSection &rSection);
+ static void SetLeftRight(wwSection &rSection);
/*
The segment we're inserting, the start of the segments container, and the
nodeindex of where we want the page break to (normally the segments start
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e7b2ba75d8b2..44acfec4b3fb 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -486,10 +486,6 @@ void wwSectionManager::SetLeftRight(wwSection &rSection)
nWWRi += nWWGu;
nWWGu = 0;
}
- else if (mrReader.m_xWDop->iGutterPos)
- {
- nWWGu = 0;
- }
// Left / Right
if ((rSection.nPgWidth - nWWLe - nWWRi) < MINLAY)
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 302c6c62318d..fcd932afb62d 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -8211,6 +8211,11 @@ void WW8Dop::Write(SvStream& rStrm, WW8Fib& rFib) const
a16Bit |= 0x0007;
a16Bit |= (0x0ff8 & (wScaleSaved << 3));
a16Bit |= (0x3000 & (zkSaved << 12));
+ if (iGutterPos)
+ {
+ // Last bit: gutter at top.
+ a16Bit |= 0x8000;
+ }
Set_UInt16( pData, a16Bit );
if( 8 == rFib.m_nVersion )