summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-05 17:03:08 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-10 12:11:25 +0100
commit6afcf92af0b7589911eb011a373ea23970a481e6 (patch)
treea23e50f55a4625face4a26a366e04e48dc3cd520
parent6fa5ce6cb9d121329bf1056c471bf522fc50d3fc (diff)
tdf#91920 sw page gutter margin, from top: add DOC filter
But leave the fRTLGutter case alone for now, I can't find the Word UI for that. (cherry picked from commit e1d217b086e8c47efc5ced4c490062956d564e3f) Change-Id: I1d97e85308aa13892f50c0fcd3680cec514ef566 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110669 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-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 eca50addbe46..df108531118d 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -70,6 +70,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 107c8e2e1edb..361bb213a57c 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -528,6 +528,11 @@ static void WriteDop( WW8Export& rWrt )
rDop.fProtEnabled = false;
}
+ if (rWrt.m_pDoc->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 7fc65b6598e5..39b75dc8c4a4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1949,6 +1949,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 b2f4a12db1b9..7759951e6805 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -866,7 +866,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 4a8821f678f8..be0c2145763a 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -481,10 +481,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 f64859171dc6..35fa751c37f0 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -8187,6 +8187,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 )