tdf#79186 ww8export: save LayoutInCell property

This property was saved in DOCX, but not in DOC format.
The field can hold 16 values, even though we only handle
this one on import.

This patch depends on the previous patch which re-worked
the import side to default to "true".

Since the default is to LayoutInCell, I don't see
any reason to add this property when true.
The only reason would be if this property can be
inherited from somewhere else, and a true needs
to override the inheritance, but I'm not aware
that such an inheritance exists in this case.

Change-Id: If42f7b1dc49c69a69552e841b93576f638b6d1d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129658
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt b/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt
new file mode 100644
index 0000000..e512f09
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 8e894c71..feb7593 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -987,6 +987,14 @@ DECLARE_WW8EXPORT_TEST(testTdf136814, "tdf136814.odt")
    CPPUNIT_ASSERT_EQUAL(nBorderDistance, getProperty<sal_Int32>(xStyle, "LeftBorderDistance"));
}

DECLARE_WW8EXPORT_TEST(testTdf79186_noLayoutInCell, "tdf79186_noLayoutInCell.odt")
{
    CPPUNIT_ASSERT_EQUAL(1, getShapes());
    CPPUNIT_ASSERT_EQUAL(1, getPages());

    CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow"));
}


CPPUNIT_PLUGIN_IMPLEMENT();

diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx
index 91f9068..c11fda1 100644
--- a/sw/source/filter/ww8/escher.hxx
+++ b/sw/source/filter/ww8/escher.hxx
@@ -68,6 +68,7 @@ public:

private:
    bool mbInline;
    sal_uInt32 mnGroupShapeBooleanProperties;
    sal_uInt32 mnXAlign;
    sal_uInt32 mnYAlign;
    sal_uInt32 mnXRelTo;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 60c8e9f..6325e69 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1431,9 +1431,11 @@ void WinwordAnchoring::WriteData( EscherEx& rEx ) const

    SvStream& rSt = rEx.GetStream();
    //The last argument denotes the number of sub properties in this atom
    int nSubProps = mnGroupShapeBooleanProperties ? 1 : 0;
    if (mbInline)
    {
        rEx.AddAtom(18, DFF_msofbtUDefProp, 3, 3); //Prop id is 0xF122
        nSubProps += 3;
        rEx.AddAtom(6 * nSubProps, DFF_msofbtUDefProp, 3, nSubProps); // Prop id is 0xF122
        rSt.WriteUInt16( 0x0390 ).WriteUInt32( 3 );
        rSt.WriteUInt16( 0x0392 ).WriteUInt32( 3 );
        //This sub property is required to be in the dummy inline frame as
@@ -1442,12 +1444,15 @@ void WinwordAnchoring::WriteData( EscherEx& rEx ) const
    }
    else
    {
        rEx.AddAtom(24, DFF_msofbtUDefProp, 3, 4 ); //Prop id is 0xF122
        nSubProps += 4;
        rEx.AddAtom(6 * nSubProps, DFF_msofbtUDefProp, 3, nSubProps); // Prop id is 0xF122
        rSt.WriteUInt16( 0x038F ).WriteUInt32( mnXAlign );
        rSt.WriteUInt16( 0x0390 ).WriteUInt32( mnXRelTo );
        rSt.WriteUInt16( 0x0391 ).WriteUInt32( mnYAlign );
        rSt.WriteUInt16( 0x0392 ).WriteUInt32( mnYRelTo );
    }
    if (mnGroupShapeBooleanProperties)
        rSt.WriteUInt16(0x03BF).WriteUInt32(mnGroupShapeBooleanProperties);
}

void WW8Export::CreateEscher()
@@ -2595,6 +2600,13 @@ void WinwordAnchoring::SetAnchoring(const SwFrameFormat& rFormat)
    const RndStdIds eAnchor = rFormat.GetAnchor().GetAnchorId();
    mbInline = (eAnchor == RndStdIds::FLY_AS_CHAR);

    mnGroupShapeBooleanProperties = 0;
    if (!rFormat.GetFollowTextFlow().GetValue())
    {
        // bit32: fUseLayoutInCell, bit16: fLayoutInCell
        mnGroupShapeBooleanProperties |= 0x80000000;
    }

    SwFormatHoriOrient rHoriOri = rFormat.GetHoriOrient();
    SwFormatVertOrient rVertOri = rFormat.GetVertOrient();