[Libreoffice-commits] core.git: Branch 'feature/cib_contract139' - include/oox oox/source sd/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 4 11:07:30 UTC 2019


 include/oox/drawingml/shape.hxx          |    2 ++
 oox/source/drawingml/shape.cxx           |    5 +++++
 oox/source/drawingml/shapecontext.cxx    |    1 +
 sd/qa/unit/data/pptx/altdescription.pptx |binary
 sd/qa/unit/import-tests.cxx              |   19 +++++++++++++++++++
 5 files changed, 27 insertions(+)

New commits:
commit dc1d26e5a3f0b75e729b58d5848493a48cb532bd
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Mon Feb 4 11:54:27 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon Feb 4 12:03:33 2019 +0100

    PPTX import of shape description
    
    Change-Id: I7fcd5608a8cdbeea9ea15c9c9aa32c9020154750

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index e04a58beb4a6..958f135ab8e1 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; }
@@ -293,6 +294,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 16bc511743b1..a3689aede13d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -849,6 +849,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 3abe2dee0adf..03b33cb685b4 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -73,6 +73,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 2ef5faebe78b..4fbb1d26e419 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -190,6 +190,7 @@ public:
     void testTdf119015();
     void testTdf120028();
     void testTdf120028b();
+    void testDescriptionImport();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -274,6 +275,7 @@ public:
     CPPUNIT_TEST(testTdf119015);
     CPPUNIT_TEST(testTdf120028);
     CPPUNIT_TEST(testTdf120028b);
+    CPPUNIT_TEST(testDescriptionImport);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2634,6 +2636,23 @@ void SdImportTest::testTdf120028b()
     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();


More information about the Libreoffice-commits mailing list