[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 6 14:16:59 UTC 2021
sw/qa/extras/ww8export/data/gutter-top.doc |binary
sw/qa/extras/ww8export/ww8export3.cxx | 14 ++++++++++++++
sw/source/filter/ww8/wrtww8.cxx | 5 +++++
sw/source/filter/ww8/ww8par.cxx | 5 +++++
sw/source/filter/ww8/ww8par.hxx | 2 +-
sw/source/filter/ww8/ww8par6.cxx | 4 ----
sw/source/filter/ww8/ww8scan.cxx | 5 +++++
7 files changed, 30 insertions(+), 5 deletions(-)
New commits:
commit e1d217b086e8c47efc5ced4c490062956d564e3f
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 5 17:03:08 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Sat Feb 6 15:16:13 2021 +0100
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.
Change-Id: I1d97e85308aa13892f50c0fcd3680cec514ef566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110471
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
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
Binary files /dev/null and b/sw/qa/extras/ww8export/data/gutter-top.doc 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 )
More information about the Libreoffice-commits
mailing list