tdf#91920 sw page gutter margin, from top: add DOCX filter

ODF filter was already working as-is.

Change-Id: I71089a5d0171eba0cd4c2d14bdee6ca9b64193b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110455
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2021-02-05 10:03:04 +01:00
parent fb020d4ed9
commit 506bacb79a
6 changed files with 30 additions and 0 deletions

Binary file not shown.

View File

@@ -58,6 +58,20 @@ DECLARE_OOXMLEXPORT_TEST(testGutterLeft, "gutter-left.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
}
CPPUNIT_TEST_FIXTURE(Test, testGutterTop)
{
load(mpTestDocumentPath, "gutter-top.docx");
save("Office Open XML Text", maTempFile);
mbExported = true;
xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
CPPUNIT_ASSERT(pXmlSettings);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
// - Actual : 0
// i.e. <w:gutterAtTop> was lost.
assertXPath(pXmlSettings, "/w:settings/w:gutterAtTop", 1);
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc")
{
// Get the third paragraph's numbering style's 1st level's bullet size

View File

@@ -1039,6 +1039,11 @@ void DocxExport::WriteSettings()
if(isMirroredMargin())
pFS->singleElementNS(XML_w, XML_mirrorMargins);
if (m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP))
{
pFS->singleElementNS(XML_w, XML_gutterAtTop);
}
// Embed Fonts
if( m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS ))
pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts);

View File

@@ -7191,6 +7191,10 @@ void DomainMapper_Impl::ApplySettingsTable()
xSettings->setPropertyValue("ProtectForm", uno::makeAny( true ));
if( m_pSettingsTable->GetReadOnly() )
xSettings->setPropertyValue("LoadReadonly", uno::makeAny( true ));
if (m_pSettingsTable->GetGutterAtTop())
{
xSettings->setPropertyValue("GutterAtTop", uno::makeAny(true));
}
}
catch(const uno::Exception&)
{

View File

@@ -275,6 +275,7 @@ struct SettingsTable_Impl
OUString m_sCurrentDatabaseDataSource;
DocumentProtection_Impl m_DocumentProtection;
bool m_bGutterAtTop = false;
SettingsTable_Impl() :
m_nDefaultTabStop( 720 ) //default is 1/2 in
@@ -586,6 +587,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Compat_noLeading:
m_pImpl->m_bNoLeading = nIntValue != 0;
break;
case NS_ooxml::LN_CT_Settings_gutterAtTop:
m_pImpl->m_bGutterAtTop = nIntValue != 0;
break;
default:
{
#ifdef DBG_UTIL
@@ -885,6 +889,8 @@ bool SettingsTable::GetNoLeading() const
return m_pImpl->m_bNoLeading;
}
bool SettingsTable::GetGutterAtTop() const { return m_pImpl->m_bGutterAtTop; }
}//namespace dmapper
} //namespace writerfilter

View File

@@ -94,6 +94,7 @@ public:
sal_Int32 GetWordCompatibilityMode() const;
const OUString& GetCurrentDatabaseDataSource() const;
bool GetGutterAtTop() const;
private:
// Properties