summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornikki <nikkic@epoq.co.uk>2017-04-12 16:52:49 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-10 16:07:31 +0200
commita59cf3ecab2f327801c2b580d20df9e8b643cc6c (patch)
tree0938074ca3c1f7544f4307f705e7d801f53a4292
parent884979ebe7d464e8b29d331a58ddf943bc9030df (diff)
Fix tdf#106029 - Add setting XML_doNotExpandShiftReturn when exporting to docx
Change-Id: Ie8ffb0f2d5444c6ead13bdc894715c5a2e6d0baa Reviewed-on: https://gerrit.libreoffice.org/36485 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 9ad9c5183f348384b62ec88459a3a5922e423d83) Reviewed-on: https://gerrit.libreoffice.org/39749
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo106029.docxbin0 -> 4336 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx8
-rw-r--r--sw/source/filter/ww8/docxexport.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx7
-rw-r--r--writerfilter/source/dmapper/SettingsTable.cxx10
-rw-r--r--writerfilter/source/dmapper/SettingsTable.hxx1
6 files changed, 33 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo106029.docx b/sw/qa/extras/ooxmlexport/data/fdo106029.docx
new file mode 100644
index 000000000000..b19d63d4c218
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo106029.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index d777cd528ece..aac74c777bb5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -337,6 +337,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");
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index c36139ca31ac..6470999120bf 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -865,7 +865,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);
@@ -949,7 +955,6 @@ void DocxExport::WriteSettings()
FSNS( XML_w, XML_val ), OUStringToOString(aValue, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
}
-
pFS->endElementNS( XML_w, XML_compat );
}
}
@@ -963,7 +968,6 @@ void DocxExport::WriteSettings()
FSNS( XML_w, XML_edit ), "forms",
FSEND );
}
-
pFS->endElementNS( XML_w, XML_settings );
}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d5348c8b0e6b..f2a2f2abc277 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -86,6 +86,10 @@
#include <comphelper/propertyvalue.hxx>
#include <unotools/mediadescriptor.hxx>
+
+
+
+
using namespace ::com::sun::star;
using namespace oox;
namespace writerfilter {
@@ -5115,6 +5119,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())
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 9a52c416f029..038723e6c1b4 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -65,6 +65,7 @@ struct SettingsTable_Impl
bool m_bWidowControl;
bool m_bSplitPgBreakAndParaMark;
bool m_bMirrorMargin;
+ bool m_bDoNotExpandShiftReturn;
bool m_bProtectForm;
bool m_bDisplayBackgroundShape;
@@ -92,6 +93,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)
@@ -279,6 +281,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;
@@ -362,6 +367,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;
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 75c0d76e490e..28db5c26fb73 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -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;