tdf#159158 writerfilter: relativeHeight max allowed value

relativeHeight treats its content as unSigned values,
but it needs to share the zOrder with z-index
which is a signed value (negatives indicating the belowDoc position).

Thus, it is logical that relativeHeight would have a maximum
value, and based on trial and error it was determined
to be 1DFF FFFF for DOCX.

Change-Id: If3fc16061730fb034c187ce4f639e1b2e50e044f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162233
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 40c4a42..d83498b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -945,8 +945,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_max, "tdf159158_zOrder_max.docx")
    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(zOrder0, "ZOrder")); // lower
    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(zOrder1, "ZOrder")); // higher
    // while yellow is a higher value, last duplicate wins, so lower value blue must be the maximum
    // CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Yellow"), getProperty<OUString>(zOrder0, "Name"));
    // CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Blue"), getProperty<OUString>(zOrder1,"Name"));
    CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Yellow"), getProperty<OUString>(zOrder0, "Name"));
    CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Blue"), getProperty<OUString>(zOrder1,"Name"));
}

DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_zIndexMax, "tdf159158_zOrder_zIndexMax.docx")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index cacae80..93ef346 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -741,7 +741,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
        {
            // undocumented - based on testing: both 0 and 1 are equivalent to the maximum 503316479
            const sal_Int32 nMaxAllowed = 0x1DFFFFFF;
            if (nIntValue < 2/* || nIntValue > nMaxAllowed*/)
            if (nIntValue < 2 || nIntValue > nMaxAllowed)
                m_pImpl->m_zOrder = nMaxAllowed;
            else
                m_pImpl->m_zOrder = nIntValue;