sw/qa/extras/ooxmlexport/data/fdo73541.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 ++++++++++ sw/source/filter/ww8/docxexport.cxx | 14 ++++++++++++++ sw/source/filter/ww8/docxexport.hxx | 3 +++ writerfilter/source/dmapper/PropertyMap.cxx | 4 ++++ writerfilter/source/dmapper/SettingsTable.cxx | 10 ++++++++++ writerfilter/source/dmapper/SettingsTable.hxx | 1 + 7 files changed, 42 insertions(+)
New commits: commit 8c6ee9360b3ffdc07335da0e3a2c6f05e5438909 Author: Vinaya Mandke <vinaya.man...@synerzip.com> Date: Fri Jan 24 19:29:47 2014 +0530 fdo#73541 "Page Margins : Mirrored" was not preserved on export to DOCX Mapped Property at import, so Page margins mirrored are imported correctly. Also exported the mirrorMargins in settings.xml Added export UT for the same. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7632 Change-Id: I2d90643f55e1dc1d96c809e28ce37dee4653bf57 diff --git a/sw/qa/extras/ooxmlexport/data/fdo73541.docx b/sw/qa/extras/ooxmlexport/data/fdo73541.docx new file mode 100644 index 0000000..469d025 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73541.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 06b881c..818569e 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 9a4d32d..e004cc5 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 5d37095..fe30393 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 8aec430..f90cb20 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 f66a2c2..d6ef721 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 6c619c9..2014eaf 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits