Kaydet (Commit) 9ad9c518 authored tarafından nikki's avatar nikki Kaydeden (comit) Miklos Vajna

Fix tdf#106029 - Add setting XML_doNotExpandShiftReturn when exporting to docx

Change-Id: Ie8ffb0f2d5444c6ead13bdc894715c5a2e6d0baa
Reviewed-on: https://gerrit.libreoffice.org/36485Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 46907631
......@@ -336,6 +336,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
}
DECLARE_OOXMLEXPORT_TEST(testFdo106029,"fdo106029.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotExpandShiftReturn");
}
DECLARE_OOXMLEXPORT_TEST(testFDO74106, "FDO74106.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
......
......@@ -885,7 +885,13 @@ void DocxExport::WriteSettings()
{
pFS->singleElementNS( XML_w, XML_documentProtection, FSNS(XML_w, XML_edit), "forms", FSNS(XML_w, XML_enforcement), "1", FSEND );
}
// Do not justify lines with manual break
if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK ))
{
pFS->startElementNS( XML_w, XML_compat, FSEND );
pFS->singleElementNS( XML_w, XML_doNotExpandShiftReturn, FSEND );
pFS->endElementNS( XML_w, XML_compat );
}
// Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer.
// Use the setting from the default style.
SwTextFormatColl* pColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false);
......@@ -969,7 +975,6 @@ void DocxExport::WriteSettings()
FSNS( XML_w, XML_val ), OUStringToOString(aValue, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
}
pFS->endElementNS( XML_w, XML_compat );
}
}
......@@ -983,7 +988,6 @@ void DocxExport::WriteSettings()
FSNS( XML_w, XML_edit ), "forms",
FSEND );
}
pFS->endElementNS( XML_w, XML_settings );
}
......
......@@ -89,6 +89,10 @@
#include <comphelper/propertysequence.hxx>
#include <unotools/mediadescriptor.hxx>
using namespace ::com::sun::star;
using namespace oox;
namespace writerfilter {
......@@ -5236,6 +5240,9 @@ void DomainMapper_Impl::ApplySettingsTable()
}
uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
if (m_pSettingsTable->GetDoNotExpandShiftReturn())
xSettings->setPropertyValue( "DoNotJustifyLinesWithManualBreak", uno::makeAny(true) );
if (m_pSettingsTable->GetUsePrinterMetrics())
xSettings->setPropertyValue("PrinterIndependentLayout", uno::makeAny(document::PrinterIndependentLayout::DISABLED));
if( m_pSettingsTable->GetEmbedTrueTypeFonts())
......
......@@ -62,6 +62,7 @@ struct SettingsTable_Impl
bool m_bWidowControl;
bool m_bSplitPgBreakAndParaMark;
bool m_bMirrorMargin;
bool m_bDoNotExpandShiftReturn;
bool m_bProtectForm;
bool m_bDisplayBackgroundShape;
......@@ -86,6 +87,7 @@ struct SettingsTable_Impl
, m_bWidowControl(false)
, m_bSplitPgBreakAndParaMark(false)
, m_bMirrorMargin(false)
, m_bDoNotExpandShiftReturn(false)
, m_bProtectForm(false)
, m_bDisplayBackgroundShape(false)
, m_pThemeFontLangProps(3)
......@@ -269,6 +271,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Settings_widowControl:
m_pImpl->m_bWidowControl = nIntValue;
break;
case NS_ooxml::LN_CT_Compat_doNotExpandShiftReturn:
m_pImpl->m_bDoNotExpandShiftReturn = true;
break;
case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
m_pImpl->m_bDisplayBackgroundShape = nIntValue;
break;
......@@ -352,6 +357,11 @@ bool SettingsTable::GetDisplayBackgroundShape() const
return m_pImpl->m_bDisplayBackgroundShape;
}
bool SettingsTable::GetDoNotExpandShiftReturn() const
{
return m_pImpl->m_bDoNotExpandShiftReturn;
}
bool SettingsTable::GetProtectForm() const
{
return m_pImpl->m_bProtectForm;
......
......@@ -71,6 +71,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
bool GetSplitPgBreakAndParaMark() const;
bool GetMirrorMarginSettings() const;
bool GetDisplayBackgroundShape() const;
bool GetDoNotExpandShiftReturn() const;
bool GetNoColumnBalance() const;
bool GetProtectForm() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment