summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/ppt/pptshape.hxx2
-rw-r--r--oox/source/ppt/pptshape.cxx34
-rw-r--r--sd/qa/unit/data/pptx/pass/ofz35597-1.pptxbin0 -> 23316 bytes
3 files changed, 23 insertions, 13 deletions
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
index d27a116e2783..ead382b52685 100644
--- a/include/oox/ppt/pptshape.hxx
+++ b/include/oox/ppt/pptshape.hxx
@@ -54,6 +54,8 @@ class PPTShape final : public oox::drawingml::Shape
/// Set if spPr tag is non empty for the shape
bool mbHasNoninheritedShapeProperties;
+ bool IsPlaceHolderCandidate(const SlidePersist& rSlidePersist) const;
+
public:
PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index f1c4a892ac14..7f3786c41992 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -92,7 +92,7 @@ static const char* lclDebugSubType( sal_Int32 nType )
namespace
{
-bool ShapeHasNoVisualPropertiesOnImport(oox::ppt::PPTShape& rPPTShape)
+bool ShapeHasNoVisualPropertiesOnImport(const oox::ppt::PPTShape& rPPTShape)
{
return !rPPTShape.hasNonInheritedShapeProperties()
&& !rPPTShape.hasShapeStyleRefs()
@@ -128,6 +128,23 @@ oox::drawingml::TextListStylePtr PPTShape::getSubTypeTextListStyle( const SlideP
return pTextListStyle;
}
+bool PPTShape::IsPlaceHolderCandidate(const SlidePersist& rSlidePersist) const
+{
+ if (meShapeLocation != Slide)
+ return false;
+ if (rSlidePersist.isNotesPage())
+ return false;
+ auto pTextBody = getTextBody();
+ if (!pTextBody)
+ return false;
+ auto rParagraphs = pTextBody->getParagraphs();
+ if (rParagraphs.size() != 1)
+ return false;
+ if (rParagraphs.front()->getRuns().size() != 1)
+ return false;
+ return ShapeHasNoVisualPropertiesOnImport(*this);
+}
+
void PPTShape::addShape(
oox::core::XmlFilterBase& rFilterBase,
const SlidePersist& rSlidePersist,
@@ -195,10 +212,7 @@ void PPTShape::addShape(
}
break;
case XML_dt :
- if ( meShapeLocation == Slide && !rSlidePersist.isNotesPage()
- && getTextBody()->getParagraphs().size() == 1
- && getTextBody()->getParagraphs().front()->getRuns().size() == 1
- && ShapeHasNoVisualPropertiesOnImport(*this) )
+ if (IsPlaceHolderCandidate(rSlidePersist))
{
TextRunPtr& pTextRun = getTextBody()->getParagraphs().front()->getRuns().front();
oox::drawingml::TextField* pTextField = dynamic_cast<oox::drawingml::TextField*>(pTextRun.get());
@@ -234,10 +248,7 @@ void PPTShape::addShape(
bClearText = true;
break;
case XML_ftr :
- if ( meShapeLocation == Slide && !rSlidePersist.isNotesPage()
- && getTextBody()->getParagraphs().size() == 1
- && getTextBody()->getParagraphs().front()->getRuns().size() == 1
- && ShapeHasNoVisualPropertiesOnImport(*this) )
+ if (IsPlaceHolderCandidate(rSlidePersist))
{
const OUString& rFooterText = getTextBody()->toString();
@@ -255,10 +266,7 @@ void PPTShape::addShape(
bClearText = true;
break;
case XML_sldNum :
- if (meShapeLocation == Slide && !rSlidePersist.isNotesPage()
- && getTextBody()->getParagraphs().size() == 1
- && getTextBody()->getParagraphs().front()->getRuns().size() == 1
- && ShapeHasNoVisualPropertiesOnImport(*this))
+ if (IsPlaceHolderCandidate(rSlidePersist))
{
TextRunPtr& pTextRun
= getTextBody()->getParagraphs().front()->getRuns().front();
diff --git a/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx b/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx
new file mode 100644
index 000000000000..e7fcacc25482
--- /dev/null
+++ b/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx
Binary files differ