[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - svx/qa svx/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 11 15:27:07 UTC 2020


 svx/qa/unit/unodraw.cxx        |   26 ++++++++++++++++++++++++++
 svx/source/unodraw/unoprov.cxx |    1 +
 2 files changed, 27 insertions(+)

New commits:
commit cc53e7c2ee3d1fa2fb55c02e6f37ece316c7a6cd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Dec 1 15:16:13 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Dec 11 16:26:34 2020 +0100

    tdf#129961 svx: add UNO API for table shadow as direct format
    
    Adding it via a style was working already.
    
    (cherry picked from commit 55d4c6cfe5bd9b737698c6cd1f28ee8234abb5d0)
    
    Conflicts:
            svx/source/unodraw/unoprov.cxx
    
    Change-Id: I122c359716a404159d3521d63d44ef8bfe35c214
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107593
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index 6d3f23175b74..302dfcda1db7 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -109,6 +109,32 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTdf93998)
     xModelProps->getPropertyValue("Graphic") >>= xGraphic;
     CPPUNIT_ASSERT(xGraphic.is());
 }
+
+CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect)
+{
+    // Create an Impress document an insert a table shape.
+    mxComponent = loadFromDesktop("private:factory/simpress",
+                                  "com.sun.star.presentation.PresentationDocument");
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShape(
+        xFactory->createInstance("com.sun.star.drawing.TableShape"), uno::UNO_QUERY);
+    xShape->setPosition(awt::Point(1000, 1000));
+    xShape->setSize(awt::Size(10000, 10000));
+    uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPages> xDrawPages = xSupplier->getDrawPages();
+    uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY);
+    xDrawPage->add(xShape);
+
+    // Create a red shadow on it without touching its style.
+    uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+    // Without the accompanying fix in place, this test would have failed with throwing a
+    // beans.UnknownPropertyException, as shadow-as-direct-formatting on tables were not possible.
+    xShapeProps->setPropertyValue("Shadow", uno::makeAny(true));
+    sal_Int32 nRed = 0xff0000;
+    xShapeProps->setPropertyValue("ShadowColor", uno::makeAny(nRed));
+    CPPUNIT_ASSERT(xShapeProps->getPropertyValue("ShadowColor") >>= nRed);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xff0000), nRed);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 02c39a1b9362..09cffa464b1c 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -727,6 +727,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxTableShapePropertyMap()
 {
     static SfxItemPropertyMapEntry const  aTableShapePropertyMap_Impl[] =
     {
+        SHADOW_PROPERTIES
         { OUString(UNO_NAME_MISC_OBJ_ZORDER),       OWN_ATTR_ZORDER, cppu::UnoType<sal_Int32>::get(), 0, 0},
         { OUString(UNO_NAME_MISC_OBJ_LAYERID),      SDRATTR_LAYERID, cppu::UnoType<sal_Int16>::get(), 0,    0},
         { OUString(UNO_NAME_MISC_OBJ_LAYERNAME),    SDRATTR_LAYERNAME, cppu::UnoType<OUString>::get(), 0, 0},


More information about the Libreoffice-commits mailing list