summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVinaya Mandke <vinaya.mandke@synerzip.com>2014-01-24 19:29:47 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-13 11:51:50 +0100
commit8c6ee9360b3ffdc07335da0e3a2c6f05e5438909 (patch)
tree837b4dc7201ae9c59869673fa8b32450adbfedce /sw
parenta4cd841541a729d7b8126d27d91fa28e30b01403 (diff)
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
Diffstat (limited to 'sw')
-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
4 files changed, 27 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.