summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-09-30 13:09:13 +0200
committerGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-10-01 21:25:02 +0200
commita8356ceb0f9345ebd5171439e3b882642f5fbad5 (patch)
tree811ef64b4acc458ddc3bae933d189d01c1af044f /oox
parent41ffa6179905a54acd144f8202a44edac35cc9b4 (diff)
SmartArt edit UI: fix crash on empty node text
Change-Id: Idacbbb50cbdd8ae4c78f3159bc362c7ee2137149 Reviewed-on: https://gerrit.libreoffice.org/79848 Tested-by: Jenkins Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/textbody.hxx1
-rw-r--r--oox/source/drawingml/diagram/datamodel.cxx9
-rw-r--r--oox/source/drawingml/textbody.cxx8
3 files changed, 13 insertions, 5 deletions
diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx
index 835f1c34b792..38996abe03ea 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -62,6 +62,7 @@ public:
const TextCharacterProperties& rTextStyleProperties,
const TextListStylePtr& pMasterTextListStyle ) const;
bool isEmpty() const;
+ OUString toString() const;
void ApplyStyleEmpty(
const ::oox::core::XmlFilterBase& rFilterBase,
diff --git a/oox/source/drawingml/diagram/datamodel.cxx b/oox/source/drawingml/diagram/datamodel.cxx
index bfbd67537171..fcad85bd3d6a 100644
--- a/oox/source/drawingml/diagram/datamodel.cxx
+++ b/oox/source/drawingml/diagram/datamodel.cxx
@@ -96,7 +96,7 @@ void DiagramData::getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoi
rBuf.append('\t');
rBuf.append('+');
rBuf.append(' ');
- rBuf.append(pPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText());
+ rBuf.append(pPoint->mpShape->getTextBody()->toString());
rBuf.append('\n');
}
@@ -136,7 +136,7 @@ std::vector<std::pair<OUString, OUString>> DiagramData::getChildren(const OUStri
if (pChild != maPointNameMap.end())
aChildren[rCxn.mnSourceOrder] = std::make_pair(
pChild->second->msModelId,
- pChild->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText());
+ pChild->second->mpShape->getTextBody()->toString());
}
// HACK: empty items shouldn't appear there
@@ -361,8 +361,7 @@ void DiagramData::build()
// does currpoint have any text set?
if( point.mpShape &&
point.mpShape->getTextBody() &&
- !point.mpShape->getTextBody()->getParagraphs().empty() &&
- !point.mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
+ !point.mpShape->getTextBody()->isEmpty() )
{
#ifdef DEBUG_OOX_DIAGRAM
static sal_Int32 nCount=0;
@@ -371,7 +370,7 @@ void DiagramData::build()
<< " ["
<< "label=\""
<< OUStringToOString(
- point.mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(),
+ point.mpShape->getTextBody()->toString(),
RTL_TEXTENCODING_UTF8).getStr()
<< "\"" << "];" << std::endl;
output << "\t"
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 55989a470a3f..80ebb4d2287d 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -96,6 +96,14 @@ bool TextBody::isEmpty() const
return aRuns[0]->getText().getLength() <= 0;
}
+OUString TextBody::toString() const
+{
+ if (!isEmpty())
+ return maParagraphs.front()->getRuns().front()->getText();
+ else
+ return OUString();
+}
+
void TextBody::ApplyStyleEmpty(
const ::oox::core::XmlFilterBase& rFilterBase,
const Reference < XText > & xText,