sw/qa/extras/ww8export/data/tdf162542_notLayoutInCell_charLeft_wrapThrough.doc 
|binary
 sw/qa/extras/ww8export/ww8export4.cxx                                          
|   23 ++++++++++
 sw/source/filter/ww8/ww8graf.cxx                                               
|   17 ++++---
 3 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit 9af17e84ec12e279c81020c172a682c066aba8a5
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Thu Aug 22 10:20:44 2024 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Aug 24 14:32:05 2024 +0200

    NFC ww8graf.cxx: mark never-changing, important variables as "const"
    
    I'm trying not to polute my patches with NFC changes.
    
    Change-Id: I057c01b945e24cf85b633c694c34824ee786face
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172295
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 7b18ebdb7754..bdce9d5e340c 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2333,8 +2333,8 @@ RndStdIds 
SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
 
     const sal_uInt32 nCntRelTo  = 4;
 
-    sal_uInt32 nXAlign = nCntXAlign > rRecord.nXAlign ? rRecord.nXAlign : 1;
-    sal_uInt32 nYAlign = nCntYAlign > rRecord.nYAlign ? rRecord.nYAlign : 1;
+    const sal_uInt32 nXAlign = nCntXAlign > rRecord.nXAlign ? rRecord.nXAlign 
: 1;
+    const sal_uInt32 nYAlign = nCntYAlign > rRecord.nYAlign ? rRecord.nYAlign 
: 1;
 
     // #i52565# - try to handle special case for objects in tables regarding 
its X Rel
 
@@ -2347,10 +2347,13 @@ RndStdIds 
SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
             rRecord.nYRelTo = sal_uInt32(rFSPA.nby);
     }
 
-    sal_uInt32 nXRelTo = (rRecord.nXRelTo && nCntRelTo > rRecord.nXRelTo) ? 
*rRecord.nXRelTo : 1;
-    sal_uInt32 nYRelTo = (rRecord.nYRelTo && nCntRelTo > rRecord.nYRelTo) ? 
*rRecord.nYRelTo : 1;
+    const sal_uInt32 nXRelTo
+        = (rRecord.nXRelTo && nCntRelTo > rRecord.nXRelTo) ? *rRecord.nXRelTo 
: 1;
+    const sal_uInt32 nYRelTo
+        = (rRecord.nYRelTo && nCntRelTo > rRecord.nYRelTo) ? *rRecord.nYRelTo 
: 1;
 
-    RndStdIds eAnchor = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : 
RndStdIds::FLY_AT_CHAR; // #i43718#
+    const RndStdIds eAnchor
+        = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : 
RndStdIds::FLY_AT_CHAR; // #i43718#
 
     SwFormatAnchor aAnchor( eAnchor );
     aAnchor.SetAnchor( m_pPaM->GetPoint() );
commit 77bbf007cd9db81c141bb123b83aac72c13a436f
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Wed Aug 21 13:27:01 2024 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Aug 24 14:31:52 2024 +0200

    tdf#162542 doc import NOT-layoutInCell: do not change char into margin
    
    It was simply wrong to equate an char-orientation
    with a page margin orientation.
    
    make CppunitTest_sw_ww8export4 CPPUNIT_TEST_NAME=testTdf162542
    
    Change-Id: I08f1449bfbb8e24311bc77e164d3fa57f25ee35f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172217
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git 
a/sw/qa/extras/ww8export/data/tdf162542_notLayoutInCell_charLeft_wrapThrough.doc
 
b/sw/qa/extras/ww8export/data/tdf162542_notLayoutInCell_charLeft_wrapThrough.doc
new file mode 100644
index 000000000000..e6100c7eabcf
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf162542_notLayoutInCell_charLeft_wrapThrough.doc
 differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 2eb0584c1be6..1266a2a06977 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -191,6 +191,29 @@ DECLARE_WW8EXPORT_TEST(testTdf91632_layoutInCellD, 
"tdf91632_layoutInCellD.doc")
     CPPUNIT_ASSERT(getProperty<bool>(xShape2, u"IsFollowingTextFlow"_ustr));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf162542, 
"tdf162542_notLayoutInCell_charLeft_wrapThrough.doc")
+{
+    // given cell B2 with a char-oriented-left wrapThrough image that is NOT 
layoutInCell
+    xmlDocUniquePtr pDump = parseLayoutDump();
+    sal_Int32 nShapeLeft
+        = getXPath(pDump, 
"//tab/row[2]/cell[2]/txt[6]/anchored/fly/SwAnchoredObject/bounds"_ostr,
+                   "left"_ostr)
+              .toInt32();
+    sal_Int32 nPara6Left
+        = getXPath(pDump, "//tab/row[2]/cell[2]/txt[6]/infos/bounds"_ostr, 
"left"_ostr).toInt32();
+    CPPUNIT_ASSERT(nShapeLeft > nPara6Left); // nShapeLeft starts after the 
word "anchor"
+
+    // sal_Int32 nShapeTop
+    //     = getXPath(pDump, 
"//tab/row[2]/cell[2]/txt[6]/anchored/fly/SwAnchoredObject/bounds"_ostr,
+    //                "top"_ostr)
+    //           .toInt32();
+    // sal_Int32 nPara1Top
+    //     = getXPath(pDump, "//tab/row[2]/cell[2]/txt[1]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+    // CPPUNIT_ASSERT_EQUAL(nPara1Top, nShapeTop); // nShapeTop starts at the 
cell margin"
+
+    CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), 
u"IsFollowingTextFlow"_ustr));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEndDOC)
 {
     // Given a document, endnotes at collected at section end:
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 8e520c8a5ea1..7b18ebdb7754 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2463,13 +2463,13 @@ RndStdIds 
SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
     }
 
     // if the object is anchored inside a table cell, is horizontal aligned
-    // at frame|character and has wrap through, but its attribute
+    // at frame and has wrap through, but its attribute
     // 'layout in table cell' isn't set, convert its horizontal alignment to 
page text area.
     // #i84783# - use new method <IsObjectLayoutInTableCell()>
     const bool bIsObjectLayoutInTableCell
         = m_nInTable && 
IsObjectLayoutInTableCell(rRecord.nGroupShapeBooleanProperties);
     if (!bIsObjectLayoutInTableCell && m_nInTable &&
-            (eHoriRel == text::RelOrientation::FRAME || eHoriRel == 
text::RelOrientation::CHAR) &&
+            (eHoriRel == text::RelOrientation::FRAME) &&
             rFSPA.nwr == 3)
     {
         eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;

Reply via email to