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 <jluth@mail.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e9bc243..7c2800b 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\n"), 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 4fdacfb..6e65750 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