You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Resolves-rhbz-1089377-...

119 lines
5.6 KiB

From 195e3a757e98c58ee9e0dd428cd3dbce58ed99b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 22 Apr 2014 17:23:26 +0100
Subject: [PATCH] Resolves: rhbz#1089377 crash on loading a specific rtf
(cherry picked from commit 5aeaba2e6592dab0404301dcef644144f82ffcbf)
Change-Id: I26864f3a2247f5d7184f395cfed91eaf92e36295
---
writerfilter/source/dmapper/NumberingManager.cxx | 5 ++-
writerfilter/source/rtftok/rtfsdrimport.cxx | 48 ++++++++++++++++++------
2 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 7a1787c..6038df6 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -531,6 +531,9 @@ OUString ListDef::GetStyleName( sal_Int32 nId )
uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValues( )
{
+ if (!m_pAbstractDef)
+ return uno::Sequence< uno::Sequence< beans::PropertyValue > >();
+
// [1] Call the same method on the abstract list
uno::Sequence< uno::Sequence< beans::PropertyValue > > aAbstract = m_pAbstractDef->GetPropertyValues( );
@@ -603,7 +606,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
uno::Sequence< uno::Sequence< beans::PropertyValue > > aProps = GetPropertyValues( );
- sal_Int32 nAbstLevels = m_pAbstractDef->Size( );
+ sal_Int32 nAbstLevels = m_pAbstractDef ? m_pAbstractDef->Size() : 0;
sal_Int16 nLevel = 0;
while ( nLevel < nAbstLevels )
{
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index fa147d7..7788414 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -194,16 +194,16 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(nRotation * -1))));
}
- if (nHoriOrient != 0)
+ if (nHoriOrient != 0 && xPropertySet.is())
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
- if (nVertOrient != 0)
+ if (nVertOrient != 0 && xPropertySet.is())
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
- if (obFitShapeToText)
+ if (obFitShapeToText && xPropertySet.is())
{
xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText));
}
- if (!bFilled)
+ if (!bFilled && xPropertySet.is())
{
if (m_bTextFrame)
xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
@@ -459,21 +459,45 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
}
// These are in EMU, convert to mm100.
else if (i->first == "dxTextLeft")
- xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dyTextTop")
- xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dxTextRight")
- xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dyTextBottom")
- xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dxWrapDistLeft")
- xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dyWrapDistTop")
- xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dxWrapDistRight")
- xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "dyWrapDistBottom")
- xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360));
+ {
+ if (xPropertySet.is())
+ xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360));
+ }
else if (i->first == "fillType")
{
switch (i->second.toInt32())
--
1.9.0