[Libreoffice-commits] core.git: sw/qa writerfilter/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 15 06:29:03 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx              |    9 +++++++++
 writerfilter/source/dmapper/DomainMapper.cxx            |    5 +++++
 writerfilter/source/dmapper/DomainMapper.hxx            |    2 ++
 writerfilter/source/dmapper/GraphicImport.cxx           |    4 +++-
 5 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 7cc353df4f0993228984fcda3efb2c9181dddafb
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Thu Aug 13 12:02:39 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Sat Aug 15 08:28:20 2020 +0200

    tdf#77794 writerfilter: compat15 - always bLayoutInCell
    
    Based on observation (no documentation found),
    MS Word 2013 ignores the actual value of LayoutInCell
    and always considers it to be true. The UI shows it,
    but it is grayed out when CompatibilityMode == 15.
    
    The code's default value of bLayoutInCell is also true,
    so compatMode only needs to be checked if the property
    is actually set in the document.
    
    I probably could have left off the IsInTable() check,
    but decided to just be as safe as possible.
    I assume it doesn't apply, but LayoutInCell sets
    a IsFollowingTextFlow property - which might have
    meaning outside of a table in SW - I don't know.
    
    Change-Id: Ief073ea96c6c61efb3bcbbc11d114d739b04c3af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100651
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap.odt b/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap.odt
new file mode 100644
index 000000000000..145a6af8da34
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 129b93882c68..3e415e25da18 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -102,6 +102,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128197)
     CPPUNIT_ASSERT_LESS(nHeight15, nHeight14);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf135595_HFtableWrap, "tdf135595_HFtableWrap.odt")
+{
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    sal_Int32 nRowHeight = getXPath(pXmlDoc, "//page[1]/header/tab/row/infos/bounds", "height").toInt32();
+    // tdf#77794: always force bLayoutInCell from false to true for MSO2013+
+    // The fly is supposed to be inside the cell. Before, height was 998. Now it is 2839.
+    CPPUNIT_ASSERT_MESSAGE("Image must be contained inside the table cell", nRowHeight > 2000);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf123622, "tdf123622.docx")
 {
     uno::Reference<beans::XPropertySet> XPropsRight(getShape(1),uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 1fa3d39a9b9b..b3cae27dd228 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3901,6 +3901,11 @@ StyleSheetTablePtr const & DomainMapper::GetStyleSheetTable( )
     return m_pImpl->GetStyleSheetTable( );
 }
 
+SettingsTablePtr const & DomainMapper::GetSettingsTable()
+{
+    return m_pImpl->GetSettingsTable();
+}
+
 GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
 {
     if (zOrderHelper == nullptr)
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index d84638f75840..34066b95cff1 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -22,6 +22,7 @@
 #include <dmapper/DomainMapperFactory.hxx>
 #include "LoggedResources.hxx"
 #include "PropertyMap.hxx"
+#include "SettingsTable.hxx"
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/style/TabAlign.hpp>
 
@@ -103,6 +104,7 @@ public:
 
     OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
     StyleSheetTablePtr const & GetStyleSheetTable( );
+    SettingsTablePtr const & GetSettingsTable();
     GraphicZOrderHelper* graphicZOrderHelper();
     GraphicNamingHelper& GetGraphicNamingHelper();
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index cf27a30c49f3..dde3e1adb3b7 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -625,7 +625,9 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
         case NS_ooxml::LN_CT_Anchor_locked: // 90990; - ignored
         break;
         case NS_ooxml::LN_CT_Anchor_layoutInCell: // 90991; - ignored
-            m_pImpl->bLayoutInCell = nIntValue != 0;
+            // Starting in MSO 2013, anchors are ALWAYS considered to be laid out in table cell.
+            m_pImpl->bLayoutInCell = nIntValue != 0 ||
+                (m_pImpl->rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() > 14 && m_pImpl->rDomainMapper.IsInTable());
         break;
         case NS_ooxml::LN_CT_Anchor_hidden: // 90992; - ignored
         break;


More information about the Libreoffice-commits mailing list