[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source
Michael Stahl
mstahl at redhat.com
Wed Jul 10 03:47:40 PDT 2013
sw/qa/extras/rtfimport/data/rhbz960019.rtf | 12 ++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 7 +++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 ++++++---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 ++++++++++++--
4 files changed, 37 insertions(+), 5 deletions(-)
New commits:
commit b3944f124ab3dc87332796a46387f837ad29e8d5
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 10 12:41:57 2013 +0200
rhbz#960019 : RTF import: handle extra groups in listoverride entry
This crashed because for a single listoverride entry 2 SPRMs were sent
to the domain-mapper, and the second one was empty.
Change-Id: Ic41ffd8bd4edcff065f49ecef3464efedd909d63
diff --git a/sw/qa/extras/rtfimport/data/rhbz960019.rtf b/sw/qa/extras/rtfimport/data/rhbz960019.rtf
new file mode 100644
index 0000000..869aa33
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/rhbz960019.rtf
@@ -0,0 +1,12 @@
+{\rtf1
+{\*\listtable
+{\list\listtemplateid-723955400\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent0\levelstartat1{\leveltext\'03\'00. ;}{\levelnumbers\'01;}\f0 }{\listname ;}\listid-1155484576}
+}
+{\*\listoverridetable
+{\*\listoverride{\listid-1155484576\listoverridecount0\ls1}}
+}
+\pard\plain \pvpg\phpg\posx1143\posy4743\absw9615\absh-2922\dfrmtxtx72\dfrmtxty72\nowrap
+Hello\par
+\pard\plain\par
+}
+
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bc8c7fc..4a861d5 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -153,6 +153,7 @@ public:
void testFdo39001();
void testGroupshape();
void testFdo66565();
+ void testRhbz960019();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -291,6 +292,7 @@ void Test::run()
{"fdo39001.rtf", &Test::testFdo39001},
{"groupshape.rtf", &Test::testGroupshape},
{"fdo66565.rtf", &Test::testFdo66565},
+ {"rhbz960019.rtf", &Test::testRhbz960019},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1419,6 +1421,11 @@ void Test::testFdo66565()
CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
}
+void Test::testRhbz960019()
+{
+ // used to crash due to extra group in listoverride entry
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 38dd6dc..18b3f96 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4563,8 +4563,18 @@ int RTFDocumentImpl::popState()
// list override table
case DESTINATION_LISTOVERRIDEENTRY:
{
- RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
- m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, false);
+ if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
+ { // copy properties upwards so upper popState inserts it
+ m_aStates.top().aTableAttributes = aState.aTableAttributes;
+ m_aStates.top().aTableSprms = aState.aTableSprms;
+ }
+ else
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(
+ aState.aTableAttributes, aState.aTableSprms));
+ m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num,
+ pValue, false);
+ }
}
break;
case DESTINATION_LEVELTEXT:
commit 1c90902cbccd4e4f5946dfc454da351c33c24f71
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 10 12:38:16 2013 +0200
writerfilter: not every field has a Content property
... so don't try to get it unconditionally (but SetExpression does
have it).
(regression from c7e4264bed4e77daccf2f72063e5e00f1008c3cf)
Change-Id: I14d24bd70f569ba0bc4f1e48d56ebf43c1441783
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f3fc0ee..badcb44 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3399,9 +3399,12 @@ void DomainMapper_Impl::SetFieldResult( OUString& rResult )
bool bIsSetExpression = xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression");
// If we already have content set, then use the current presentation
rtl::OUString sValue;
- uno::Any aValue = xFieldProperties->getPropertyValue(
- rPropNameSupplier.GetName(PROP_CONTENT));
- aValue >>= sValue;
+ if (bIsSetExpression)
+ { // this will throw for field types without Content
+ uno::Any aValue(xFieldProperties->getPropertyValue(
+ rPropNameSupplier.GetName(PROP_CONTENT)));
+ aValue >>= sValue;
+ }
xFieldProperties->setPropertyValue(
rPropNameSupplier.GetName(bIsSetExpression && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
uno::makeAny( rResult ));
More information about the Libreoffice-commits
mailing list