sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt |binary
 sw/qa/extras/ww8export/ww8export3.cxx                   |    8 ++++++++
 sw/source/filter/ww8/escher.hxx                         |    1 +
 sw/source/filter/ww8/wrtw8esh.cxx                       |   16 ++++++++++++++--
 4 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 98ecef56d0f87cd922ca560fead4e2533b30d57c
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Feb 7 20:41:19 2022 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Feb 10 09:11:49 2022 +0100

    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 <jl...@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 000000000000..e512f09072ce
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 8e894c711457..feb759312d15 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 91f90685a18e..c11fda1ebf16 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 60c8e9f4c352..6325e691c2ec 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();
 

Reply via email to