diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-04 12:26:11 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-05-02 18:25:41 +0200 |
commit | c2064f99b97f9d7e3806c09d3eb0df8eae257c86 (patch) | |
tree | ae60407eedb978fbc95468bd1fc5c7c44c4cda42 /sw | |
parent | fdb04adc44fc1f1ff85390e55730f78d6c644e41 (diff) |
tdf#99074 DOCX import: handle <w:view w:val="web"/>
Instead of always using the Normal view, use the Web view when the DOCX
file contains Web Layout.
For this to work, expose sw's DocumentSettingId::BROWSE_MODE via
css.document.Settings.
Reviewed-on: https://gerrit.libreoffice.org/23806
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit e0f9bb795251d950b5dd960fcd030170c8eb67aa)
Change-Id: I7787ca058d8cb8a346b2001a2bd70c3df86d8673
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf99074.docx | bin | 0 -> 12608 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 16 |
3 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf99074.docx b/sw/qa/extras/ooxmlimport/data/tdf99074.docx Binary files differnew file mode 100644 index 000000000000..d7be418fb153 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf99074.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 0b1487a45f8d..4a362c3f2e8d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2938,6 +2938,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx") CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTableProperties, "HoriOrient")); } +DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx") +{ + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<uno::XInterface> xSettings = xFactory->createInstance("com.sun.star.document.Settings"); + // This was false, Web Layout was ignored on import. + CPPUNIT_ASSERT(getProperty<bool>(xSettings, "InBrowseMode")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index a6e454ef7be4..8b7083a19afc 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -131,6 +131,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, HANDLE_SUBTRACT_FLYS, + HANDLE_BROWSE_MODE, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -206,6 +207,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0, 0}, { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0, 0}, { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0, 0}, + { OUString("InBrowseMode"), HANDLE_BROWSE_MODE, cppu::UnoType<bool>::get(), 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -847,6 +849,15 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_BROWSE_MODE: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bTmp); + } + } + break; default: throw UnknownPropertyException(); } @@ -1253,6 +1264,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS); } break; + case HANDLE_BROWSE_MODE: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); + } + break; default: throw UnknownPropertyException(); } |