[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Apr 4 13:34:04 UTC 2016
sw/qa/extras/ooxmlimport/data/tdf99074.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 ++++++++
sw/source/uibase/uno/SwXDocumentSettings.cxx | 16 ++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++++
4 files changed, 28 insertions(+)
New commits:
commit e0f9bb795251d950b5dd960fcd030170c8eb67aa
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Apr 4 12:26:11 2016 +0200
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.
Change-Id: I7787ca058d8cb8a346b2001a2bd70c3df86d8673
Reviewed-on: https://gerrit.libreoffice.org/23806
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlimport/data/tdf99074.docx b/sw/qa/extras/ooxmlimport/data/tdf99074.docx
new file mode 100644
index 0000000..d7be418
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf99074.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 39b5efb..25008a3 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3216,6 +3216,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx")
CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight);
}
+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"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 0ef134d..d5168c1 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()
@@ -205,6 +206,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
{ OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
{ OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 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
@@ -844,6 +846,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();
}
@@ -1248,6 +1259,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();
}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bfa18c4..8eee359 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5028,6 +5028,10 @@ void DomainMapper_Impl::ApplySettingsTable()
if( m_pSettingsTable->GetEmbedSystemFonts())
xSettings->setPropertyValue( getPropertyName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) );
xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
+
+ // Web Layout.
+ if (m_pSettingsTable->GetView() == NS_ooxml::LN_Value_doc_ST_View_web)
+ xSettings->setPropertyValue("InBrowseMode", uno::makeAny(true));
}
catch(const uno::Exception&)
{
More information about the Libreoffice-commits
mailing list