related tdf#157572 writerfilter framePr: no vAlign if w:y defined

Documentation suggests that vAlign overrides w:y
(as long as vAnchor is not equal to text).
However, testing proves the opposite.
Only when w:y is not defined does vAlign take effect.

make CppunitTest_sw_ooxmlexport5 \
    CPPUNIT_TEST_NAME=testTdf157572_defaultVAnchor

make CppunitTest_sw_ooxmlexport18 \
    CPPUNIT_TEST_NAME=testTdf154703_framePr2

Change-Id: I8a5366d9b6bde0ad838f9584836a85fe79ce8b1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157528
Tested-by: Justin Luth <jluth@mail.com>
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index ddf14cb..bf7eb22 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -285,6 +285,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePr2, "tdf154703_framePr2.rtf")
    assertXPath(pXmlDoc, "//w:body/w:p[1]/w:pPr/w:shd", "fill", "800000");
    assertXPath(pXmlDoc, "//w:body/w:p[2]/w:pPr/w:shd", "fill", "548DD4"); // was blue already, no change
    assertXPath(pXmlDoc, "//w:body/w:p[3]/w:pPr/w:shd", "fill", "800000");
    assertXPath(pXmlDoc, "//w:body/w:p[3]/w:pPr/w:framePr", "yAlign", "center");
    assertXPathNoAttribute(pXmlDoc, "//w:body/w:p[3]/w:pPr/w:framePr", "y");
}

DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePrWrapSpacing, "tdf154703_framePrWrapSpacing.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 71cea9f..2ee3e1e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1437,7 +1437,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157572_defaultVAnchor)
    // vAnchor wasn't defined on import. It should default to 'margin' when w:y=non-zero
    assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","vAnchor","margin");
    // yAlign=something is not compatible with w:y=non-zero" - don't write anything out
    // assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "yAlign");
    assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "yAlign");
}

CPPUNIT_TEST_FIXTURE(Test, testTdf112287B)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b809870..1b209d2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1050,7 +1050,6 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor
    attrList->add( FSNS( XML_w, XML_h), OString::number(rSize.Height()));

    attrList->add( FSNS( XML_w, XML_x), OString::number(aPos.X));
    attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y));

    OString aXAlign = convertToOOXMLHoriOrient(rHoriOrient.GetHoriOrient(), /*bIsPosToggle=*/false);
    OString aYAlign = convertToOOXMLVertOrient(rVertOrient.GetVertOrient());
@@ -1058,6 +1057,8 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor
        attrList->add(FSNS(XML_w, XML_xAlign), aXAlign);
    if (!aYAlign.isEmpty())
        attrList->add(FSNS(XML_w, XML_yAlign), aYAlign);
    else
        attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y));

    sal_Int16 nLeft = pFrameFormat->GetLRSpace().GetLeft();
    sal_Int16 nRight = pFrameFormat->GetLRSpace().GetRight();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 9c1b32a..77528bc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1863,12 +1863,16 @@ DomainMapper_Impl::MakeFrameProperties(const ParagraphProperties& rProps)
            comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_POSITION), nY));

        sal_Int16 nVertOrient = text::VertOrientation::NONE;
        for (const auto pProp : vProps)
        // Testing indicates that yAlign should be ignored if there is any specified w:y
        if (!bValidY)
        {
            if (pProp->GetyAlign() < 0)
                continue;
            nVertOrient = pProp->GetyAlign();
            break;
            for (const auto pProp : vProps)
            {
                if (pProp->GetyAlign() < 0)
                    continue;
                nVertOrient = pProp->GetyAlign();
                break;
            }
        }
        aFrameProperties.push_back(
            comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), nVertOrient));