sw/qa/extras/rtfimport/data/fdo79959.rtf | 4 ++++ sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++ writerfilter/CustomTarget_source.mk | 2 +- writerfilter/documentation/ooxml/model.rng | 3 --- writerfilter/source/ooxml/model.xml | 2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 +++-- 6 files changed, 15 insertions(+), 7 deletions(-)
New commits: commit 305ecd1848a802a6c43ecc6e76f4c6bc36a03418 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Aug 29 17:40:51 2014 +0200 fdo#79959 RTF import: trim whitespace around style names Change-Id: Id23cbd62b057442c577fef124a5705e4d551076f diff --git a/sw/qa/extras/rtfimport/data/fdo79959.rtf b/sw/qa/extras/rtfimport/data/fdo79959.rtf new file mode 100644 index 0000000..231f39a --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo79959.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}} +{\stylesheet{\s0 Test;}} +\viewkind4\uc1\pard\s0\slmult1\lang9\f0\fs22 Hello world!\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2231e1f..64e2b04 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1928,6 +1928,12 @@ DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), getProperty<sal_Int32>(xCell, "RightBorderDistance")); } +DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf") +{ + // This was false, as the style was imported as " Test", i.e. no whitespace stripping. + CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test"))); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d0f88ec..2441762 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1162,8 +1162,9 @@ void RTFDocumentImpl::text(OUString& rString) case DESTINATION_STYLEENTRY: if (m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type)) { - m_aStyleNames[m_nCurrentStyleIndex] = aName; - RTFValue::Pointer_t pValue(new RTFValue(aName)); + // Word strips whitespace around style names. + m_aStyleNames[m_nCurrentStyleIndex] = aName.trim(); + RTFValue::Pointer_t pValue(new RTFValue(aName.trim())); m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue); m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue); commit 9f05a8709232bdce78760636c6f6f03bf588a1ec Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Aug 29 16:58:03 2014 +0200 Remove unused url attribute And also make sure that the model is re-checked when the schema changes. Change-Id: I348d11aa770255329cd47535dff4b15a95e4bd8e diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk index 09b2610..8d7b3d2 100644 --- a/writerfilter/CustomTarget_source.mk +++ b/writerfilter/CustomTarget_source.mk @@ -76,7 +76,7 @@ $(writerfilter_GEN_ooxml_Factory_hxx) : $(writerfilter_SRC)/ooxml/factoryinc.py $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1) $(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_GEN_ooxml_Model_processed)) > $@ -$(writerfilter_GEN_ooxml_Model_validated) : $(writerfilter_SRC_ooxml_Model) +$(writerfilter_GEN_ooxml_Model_validated) : $(writerfilter_SRC)/../documentation/ooxml/model.rng $(writerfilter_SRC_ooxml_Model) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,VAL,1) $(call gb_Helper_abbreviate_dirs,\ $(writerfilter_XMLLINTCOMMAND) --noout --relaxng $(writerfilter_SRC)/../documentation/ooxml/model.rng $(writerfilter_SRC_ooxml_Model) > $@ 2>&1 \ diff --git a/writerfilter/documentation/ooxml/model.rng b/writerfilter/documentation/ooxml/model.rng index 6f365ff..3c9c402 100644 --- a/writerfilter/documentation/ooxml/model.rng +++ b/writerfilter/documentation/ooxml/model.rng @@ -259,9 +259,6 @@ documentation for that file. The schema has two parts: <optional> <attribute name="file"/> </optional> - <optional> - <attribute name="url"/> - </optional> <zeroOrMore> <ref name="start-element"/> </zeroOrMore> diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 42559b8..6d639c6 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -44,7 +44,7 @@ <token tokenid="ooxml:footerl"/> <token tokenid="ooxml:footerr"/> <token tokenid="ooxml:footerf"/> - <namespace name="dml-stylesheet" url="http://schemas.openxmlformats.org/drawingml/2006/main" file="dml-stylesheet.rng"> + <namespace name="dml-stylesheet" file="dml-stylesheet.rng"> <start name="theme"/> <start name="themeOverride"/> <start name="themeManager"/> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits