Rebased ref, commits from common ancestor: commit 27b22a546e60ce902455d0466ed97c0058d8adcb Author: Katarina Behrens <katarina.behr...@cib.de> AuthorDate: Mon Feb 4 11:54:27 2019 +0100 Commit: Katarina Behrens <katarina.behr...@cib.de> CommitDate: Mon Feb 4 13:49:46 2019 +0100
PPTX import of shape description (cherry picked from commit dc1d26e5a3f0b75e729b58d5848493a48cb532bd) Change-Id: I7fcd5608a8cdbeea9ea15c9c9aa32c9020154750 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 new file mode 100644 index 000000000000..5398f7a72d6d Binary files /dev/null and b/sd/qa/unit/data/pptx/altdescription.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 4a60ca586719..957d430a8e95 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -194,6 +194,7 @@ public: void testTdf120028b(); void testTdf94238(); void testTdf44223(); + void testDescriptionImport(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -279,6 +280,7 @@ public: CPPUNIT_TEST(testTdf120028b); CPPUNIT_TEST(testTdf94238); CPPUNIT_TEST(testTdf44223); + CPPUNIT_TEST(testDescriptionImport); CPPUNIT_TEST_SUITE_END(); }; @@ -2650,6 +2652,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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits