summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2019-02-04 11:54:27 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2019-02-05 13:16:26 +0100
commit35c1722b13bb2b4ab53588f3bfff69a8d40b7aed (patch)
tree18f0f0d60f3f1d7108eeb36d3d9c8de62a377415
parentExport background images provided by master page as artifacts (diff)
downloadcore-feature/taggedPDF.tar.gz
core-feature/taggedPDF.zip
PPTX import of shape description feature/taggedPDF
(cherry picked from commit dc1d26e5a3f0b75e729b58d5848493a48cb532bd) Change-Id: I7fcd5608a8cdbeea9ea15c9c9aa32c9020154750
-rw-r--r--include/oox/drawingml/shape.hxx2
-rw-r--r--oox/source/drawingml/shape.cxx5
-rw-r--r--oox/source/drawingml/shapecontext.cxx1
-rw-r--r--sd/qa/unit/data/pptx/altdescription.pptxbin0 -> 156788 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx18
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
new file mode 100644
index 000000000000..f116efe41171
--- /dev/null
+++ b/sd/qa/unit/data/pptx/altdescription.pptx
Binary files 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();