From 4df450c276a7895c24ed022a23d236cd88dbad1c Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Tue, 6 Jun 2017 23:10:02 +0200 Subject: tdf#99074: export Web view to DOCX ...so document saved in Web view shows in Web Layout in Word. Change-Id: If39d566be02966fe5d22f74aee46e6d5452a9451 Reviewed-on: https://gerrit.libreoffice.org/38469 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/ooxmlexport/data/tdf99074.docx | Bin 0 -> 12608 bytes sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 12 ++++++++++++ sw/qa/extras/ooxmlimport/data/tdf99074.docx | Bin 12608 -> 0 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 ------------ sw/source/filter/ww8/docxexport.cxx | 6 ++++++ 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf99074.docx delete mode 100644 sw/qa/extras/ooxmlimport/data/tdf99074.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf99074.docx b/sw/qa/extras/ooxmlexport/data/tdf99074.docx new file mode 100644 index 000000000000..d7be418fb153 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf99074.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 24092d620263..c7ef31f8d02d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -568,6 +569,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106001_2, "tdf106001-2.odt") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:w","val","600"); } +DECLARE_OOXMLEXPORT_TEST(testTdf99074, "tdf99074.docx") +{ + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference const xController( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference const xViewSettings( + xController->getViewSettings()); + // This was false, Web Layout was ignored on import. + CPPUNIT_ASSERT(getProperty(xViewSettings, "ShowOnlineLayout")); +} + DECLARE_OOXMLEXPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx") { // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns. diff --git a/sw/qa/extras/ooxmlimport/data/tdf99074.docx b/sw/qa/extras/ooxmlimport/data/tdf99074.docx deleted file mode 100644 index d7be418fb153..000000000000 Binary files a/sw/qa/extras/ooxmlimport/data/tdf99074.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 08d292b05196..9c61378ae245 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -1137,17 +1136,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx") CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight); } -DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx") -{ - uno::Reference xModel(mxComponent, uno::UNO_QUERY); - uno::Reference const xController( - xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference const xViewSettings( - xController->getViewSettings()); - // This was false, Web Layout was ignored on import. - CPPUNIT_ASSERT(getProperty(xViewSettings, "ShowOnlineLayout")); -} - DECLARE_OOXMLIMPORT_TEST(testTdf100830, "tdf100830.docx") { // FillTransparence wasn't imported, this was 0. diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index e434e670378e..7943383a5994 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -839,6 +839,12 @@ void DocxExport::WriteSettings() FSNS( XML_xmlns, XML_w ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), RTL_TEXTENCODING_UTF8).getStr(), FSEND ); + // View + if (pViewShell && pViewShell->GetViewOptions()->getBrowseMode()) + { + pFS->singleElementNS(XML_w, XML_view, FSNS(XML_w, XML_val), "web", FSEND); + } + // Zoom if (pViewShell) { -- cgit