diff options
-rw-r--r-- | include/oox/drawingml/shape.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 5 | ||||
-rw-r--r-- | oox/source/drawingml/shapecontext.cxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/altdescription.pptx | bin | 0 -> 156788 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 18 |
5 files changed, 26 insertions, 0 deletions
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 9dd643b34ae8..28a5e2907494 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -148,6 +148,7 @@ public: const OUString& getInternalName() const { return msInternalName; } void setId( const OUString& rId ) { msId = rId; } const OUString& getId() { return msId; } + void setDescription( const OUString& rDescr ) { msDescription = rDescr; } void setHidden( bool bHidden ) { mbHidden = bHidden; } void setHiddenMasterShape( bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; } void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; } @@ -291,6 +292,7 @@ protected: OUString msName; OUString msInternalName; // used by diagram; not displayed in UI OUString msId; + OUString msDescription; sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder OptValue< sal_Int32 > moSubTypeIndex; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 09f828e8bfa8..b935bec0de96 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -832,6 +832,11 @@ Reference< XShape > const & Shape::createAndInsert( if( xNamed.is() ) xNamed->setName( msName ); } + if( !msDescription.isEmpty() ) + { + const OUString sDescription( "Description" ); + xSet->setPropertyValue( sDescription, Any( msDescription ) ); + } if (aServiceName != "com.sun.star.text.TextFrame") rxShapes->add( mxShape ); diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index eae01bfe5a6c..60feae99f656 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -74,6 +74,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const mpShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) ); mpShapePtr->setId( rAttribs.getString( XML_id ).get() ); mpShapePtr->setName( rAttribs.getString( XML_name ).get() ); + mpShapePtr->setDescription( rAttribs.getString( XML_descr ).get() ); break; } case XML_hlinkMouseOver: diff --git a/sd/qa/unit/data/pptx/altdescription.pptx b/sd/qa/unit/data/pptx/altdescription.pptx Binary files differnew file mode 100644 index 000000000000..f116efe41171 --- /dev/null +++ b/sd/qa/unit/data/pptx/altdescription.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 5cf40ad1f4cc..30d2f1aacefd 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -193,6 +193,7 @@ public: void testTdf120028(); void testTdf120028b(); void testTdf44223(); + void testDescriptionImport(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -277,6 +278,7 @@ public: CPPUNIT_TEST(testTdf120028); CPPUNIT_TEST(testTdf120028b); CPPUNIT_TEST(testTdf44223); + CPPUNIT_TEST(testDescriptionImport); CPPUNIT_TEST_SUITE_END(); }; @@ -2619,6 +2621,22 @@ void SdImportTest::testTdf44223() xDocShRef->DoClose(); } +void SdImportTest::testDescriptionImport() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/altdescription.pptx"), PPTX); + + uno::Reference<beans::XPropertySet> xPropertySet( + getShapeFromPage(/*nShape=*/2, /*nPage=*/0, xDocShRef)); + OUString sDesc; + + xPropertySet->getPropertyValue("Description") >>= sDesc; + + CPPUNIT_ASSERT_EQUAL(OUString("We Can Do It!"), sDesc); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |