diff options
-rw-r--r-- | include/oox/drawingml/shape.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shapecontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 4 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/shape-master-text.pptx | bin | 0 -> 32645 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests2.cxx | 11 |
6 files changed, 22 insertions, 0 deletions
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index ccf477bef805..4c8be792e7f6 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -237,6 +237,8 @@ public: void setTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; }; const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return maLinkedTxbxAttr; }; bool isLinkedTxbx() const { return mbHasLinkedTxbx; }; + void setHasCustomPrompt(bool bValue) { mbHasCustomPrompt = bValue; } + bool hasCustomPrompt() { return mbHasCustomPrompt; } void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; } @@ -393,6 +395,7 @@ private: bool mbTextBox; ///< This shape has a textbox. LinkedTxbxAttr maLinkedTxbxAttr; bool mbHasLinkedTxbx; // this text box has linked text box ? + bool mbHasCustomPrompt; // indicates that it's not a generic placeholder css::uno::Sequence<css::beans::PropertyValue> maDiagramDoms; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 0fca9c0e1ac3..78a20b46861b 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -150,6 +150,7 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight ) , mbWps( false ) , mbTextBox( false ) , mbHasLinkedTxbx( false ) +, mbHasCustomPrompt( false ) , maDiagramDoms( 0 ) , mpDiagramHelper( nullptr ) { @@ -194,6 +195,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbWps( pSourceShape->mbWps ) , mbTextBox( pSourceShape->mbTextBox ) , mbHasLinkedTxbx(false) +, mbHasCustomPrompt( pSourceShape->mbHasCustomPrompt ) , maDiagramDoms( pSourceShape->maDiagramDoms ) , mnZOrder(pSourceShape->mnZOrder) , mnZOrderOff(pSourceShape->mnZOrderOff) diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 73fdab79508e..6407fb58a1f3 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -89,6 +89,8 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) ); if( rAttribs.hasAttribute( XML_idx ) ) mpShapePtr->setSubTypeIndex( rAttribs.getInteger( XML_idx, 0 ) ); + if( rAttribs.hasAttribute( XML_hasCustomPrompt ) ) + mpShapePtr->setHasCustomPrompt( rAttribs.getBool( XML_hasCustomPrompt, false ) ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index b6dd0f1c4603..a68ad18cf5b2 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -455,6 +455,10 @@ void PPTShape::addShape( Reference < XText > xText(mxShape, UNO_QUERY); if (xText.is()) { + if (mpPlaceholder && mpPlaceholder->getTextBody() && !mpPlaceholder->getTextBody()->isEmpty() + && mpPlaceholder->hasCustomPrompt()) + xText->setString(mpPlaceholder->getTextBody()->toString()); + TextCharacterProperties aCharStyleProperties; getTextBody()->ApplyStyleEmpty(rFilterBase, xText, aCharStyleProperties, mpMasterTextListStyle); } diff --git a/sd/qa/unit/data/pptx/shape-master-text.pptx b/sd/qa/unit/data/pptx/shape-master-text.pptx Binary files differnew file mode 100644 index 000000000000..ca056b852d3a --- /dev/null +++ b/sd/qa/unit/data/pptx/shape-master-text.pptx diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 55ab505fc603..0b168ef2bd91 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1889,6 +1889,17 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testOverflowBehaviorClip) } } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText) +{ + createSdImpressDoc("pptx/shape-master-text.pptx"); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0)); + + uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape)); + + uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph)); + CPPUNIT_ASSERT_EQUAL(OUString("Custom"), xRun->getString()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |