sw/qa/extras/ooxmlimport/ooxmlimport.cxx             |    3 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   21 +++++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 00ef339bfc747897b8e4410fa0aa4397c4e45717
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Fri Apr 19 21:57:29 2024 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Apr 20 19:07:22 2024 +0200

    tdf#81956 vml import: put groupshape in foreground if positive z-index
    
    no interesting unit tests found, but this one at least lets you
    add text to the body and visibly see the effect of foreground/background.
    
    make CppunitTest_sw_ooxmlimport CPPUNIT_TEST_NAME=testN751077
    
    Change-Id: Ib03e6b429ad4ec6a38d1119f3720bc56a70b98eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166345
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e9bc24315d6b..7c2800b7aa72 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -175,6 +175,9 @@ xray ThisComponent.DrawPage(1).getByIndex(0).String
 xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
 */
     uno::Reference<drawing::XShapes> xShapes(getShape(2), uno::UNO_QUERY);
+    // The groupshape should be in the foreground, not the background.
+    CPPUNIT_ASSERT(getProperty<bool>(xShapes, "Opaque"));
+
     uno::Reference<text::XTextRange> xShape(xShapes->getByIndex(0), 
uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("TEXT1
"), xShape->getString());
     // we want to test the textbox is on the first page (it was put onto 
another page without the fix),
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 4fdacfb2f944..6e65750dec1e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4696,6 +4696,27 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
                 }
             }
 
+            uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, 
uno::UNO_QUERY);
+            uno::Sequence<beans::PropertyValue> aGrabBag;
+            xShapePropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+
+            for (const auto& rProp : aGrabBag)
+            {
+                if (rProp.Name == "VML-Z-ORDER")
+                {
+                    sal_Int64 zOrder(0);
+                    rProp.Value >>= zOrder;
+
+                    text::TextContentAnchorType nAnchorType
+                        = text::TextContentAnchorType_AT_PARAGRAPH;
+                    
xShapePropertySet->getPropertyValue(getPropertyName(PROP_ANCHOR_TYPE))
+                        >>= nAnchorType;
+
+                    const uno::Any aOpaque(nAnchorType == 
text::TextContentAnchorType_AS_CHARACTER
+                                           || (zOrder >= 0 && 
!IsInHeaderFooter()));
+                    
xShapePropertySet->setPropertyValue(getPropertyName(PROP_OPAQUE), aOpaque);
+                }
+            }
             // A GroupShape doesn't implement text::XTextRange, but appending
             // an empty reference to the stacks still makes sense, because this
             // way bToRemove can be set, and we won't end up with duplicated

Reply via email to