summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo73541.docxbin0 -> 16446 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
-rw-r--r--sw/source/filter/ww8/docxexport.cxx14
-rw-r--r--sw/source/filter/ww8/docxexport.hxx3
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx4
-rw-r--r--writerfilter/source/dmapper/SettingsTable.cxx10
-rw-r--r--writerfilter/source/dmapper/SettingsTable.hxx1
7 files changed, 42 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo73541.docx b/sw/qa/extras/ooxmlexport/data/fdo73541.docx
new file mode 100644
index 000000000000..469d025209d8
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo73541.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 06b881ccbf3f..818569e52291 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2985,6 +2985,16 @@ DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType_VML, "LineStyle_DashType_VML.doc
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash");
}
+DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
+{
+ // fdo#73541: The mirrored margins were not imported and mapped correctly in Page Layout
+ // Hence <w:mirrorMargins /> tag was not exported back in settings.xml
+ xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 9a4d32d7e925..e004cc5f3120 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -768,6 +768,10 @@ void DocxExport::WriteSettings()
if ( settings.trackRevisions )
pFS->singleElementNS( XML_w, XML_trackRevisions, FSEND );
+ // Mirror Margins
+ if(isMirroredMargin())
+ pFS->singleElementNS( XML_w, XML_mirrorMargins, FSEND );
+
// Embed Fonts
if( pDoc->get( IDocumentSettingAccess::EMBED_FONTS ))
pFS->singleElementNS( XML_w, XML_embedTrueTypeFonts, FSEND );
@@ -1176,6 +1180,16 @@ DocxSdrExport& DocxExport::SdrExporter()
return *m_pSdrExport;
}
+bool DocxExport::isMirroredMargin()
+{
+ bool bMirroredMargins = false;
+ if ( nsUseOnPage::PD_MIRROR == (nsUseOnPage::PD_MIRROR & pDoc->GetPageDesc(0).ReadUseOn()) )
+ {
+ bMirroredMargins = true;
+ }
+ return bMirroredMargins;
+}
+
boost::optional<const SvxBrushItem*> DocxExport::getBackground()
{
boost::optional<const SvxBrushItem*> oRet;
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 5d370954a1c9..fe303930cbf9 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -236,6 +236,9 @@ private:
/// Get background color of the document, if there is one.
boost::optional<const SvxBrushItem*> getBackground();
+ /// return true if Page Layout is set as Mirrored
+ bool isMirroredMargin();
+
public:
/// FIXME this is temporary, remotely reminding the method of the same
/// name in WW8Export.
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 8aec430bc963..f90cb204ada1 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1001,6 +1001,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
const OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX );
if( m_nPaperBin >= 0 )
xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) );
+ if ( rDM_Impl.GetSettingsTable()->GetMirrorMarginSettings() )
+ {
+ Insert(PROP_PAGE_STYLE_LAYOUT, uno::makeAny(style::PageStyleLayout_MIRRORED));
+ }
uno::Reference< text::XTextColumns > xColumns;
if( m_nColumnCount > 0 )
xColumns = ApplyColumnProperties( xFollowPageStyle );
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index f66a2c2ca9f1..d6ef7211444c 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -72,6 +72,7 @@ struct SettingsTable_Impl
bool embedSystemFonts;
bool m_bDoNotUseHTMLParagraphAutoSpacing;
bool m_bSplitPgBreakAndParaMark;
+ bool m_bMirrorMargin;
uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps;
SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
@@ -97,6 +98,7 @@ struct SettingsTable_Impl
, embedSystemFonts(false)
, m_bDoNotUseHTMLParagraphAutoSpacing(false)
, m_bSplitPgBreakAndParaMark(false)
+ , m_bMirrorMargin(false)
, m_pThemeFontLangProps(3)
{}
@@ -233,6 +235,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Compat_splitPgBreakAndParaMark:
m_pImpl->m_bSplitPgBreakAndParaMark = nIntValue;
break;
+ case NS_ooxml::LN_CT_Settings_mirrorMargins:
+ m_pImpl->m_bMirrorMargin = nIntValue;
+ break;
default:
{
#ifdef DEBUG_DMAPPER_SETTINGS_TABLE
@@ -295,6 +300,11 @@ bool SettingsTable::GetSplitPgBreakAndParaMark() const
return m_pImpl->m_bSplitPgBreakAndParaMark;
}
+bool SettingsTable::GetMirrorMarginSettings() const
+{
+ return m_pImpl->m_bMirrorMargin;
+}
+
uno::Sequence<beans::PropertyValue> SettingsTable::GetThemeFontLangProperties() const
{
return m_pImpl->m_pThemeFontLangProps;
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 6c619c9f79d6..2014eafab0e7 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -70,6 +70,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
bool GetDoNotUseHTMLParagraphAutoSpacing() const;
bool GetSplitPgBreakAndParaMark() const;
+ bool GetMirrorMarginSettings() const;
uno::Sequence<beans::PropertyValue> GetThemeFontLangProperties() const;