sw/qa/extras/ww8export/ww8export4.cxx |    7 ++++++-
 sw/source/filter/ww8/wrtww8.cxx       |    2 --
 sw/source/filter/ww8/ww8par.cxx       |    3 +--
 3 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 510cdadd6199c19406a021e1fb0cc29ce21b5e29
Author:     Jonathan Clark <[email protected]>
AuthorDate: Wed Jul 23 10:14:23 2025 -0600
Commit:     Jonathan Clark <[email protected]>
CommitDate: Wed Jul 23 22:52:30 2025 +0200

    tdf#167552 sw: Disable DOC handling of fDntBlnSbDbWid compat flag
    
    This change partially reverts the following commit:
    
    commit 6818bc55ff248c59f12b2e090139eff30fe949dd
        tdf#88908 sw: Add BalanceSpacesAndIdeographicSpaces compat option
    
    Specifically, this change disables the actual handling of the compat
    flag for DOC files. It continues to work correctly for DOCX files.
    
    We were parsing the compatibility flag correctly. However, there is some
    undocumented and as-yet unknown mechanism Word uses to control whether
    or not the fDntBlnSbDbWid value is effective for a particular document.
    I looked at all of the likely Dop fields across the sample documents I
    have available, but I couldn't see a pattern. Possibly this is based on
    a version field located elsewhere, or maybe it's even based on the size
    of the Dop structure itself.
    
    After spending time trying to reverse engineer this, I'm growing
    concerned that this hints at a general Copts masking mechanism built
    into Word that we don't implement, rather than something that affects
    this one compat flag in particular.
    
    Change-Id: I021c636c0a9c72c5489960221f5ecec7823bf566
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188247
    Reviewed-by: Jonathan Clark <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 059136cfa681..6658664118fa 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -693,6 +693,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf80596Hanging)
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf88908)
 {
+    // tdf#167552: There is some as-yet unknown mechanism Word uses to control 
whether or
+    // not the fDntBlnSbDbWid compat flag should be effective. Until this 
mechanism is
+    // understood, handling the flag as-written in DOC files is destructive to 
layout in
+    // many documents. Ignore it for now and default to unbalanced spaces.
+
     createSwDoc();
 
     {
@@ -716,7 +721,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88908)
     {
         SwDoc* pDoc = getSwDoc();
         IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess();
-        
CPPUNIT_ASSERT(rIDSA.get(DocumentSettingId::BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES));
+        
CPPUNIT_ASSERT(!rIDSA.get(DocumentSettingId::BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES));
     }
 }
 
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 48a1b24fdf12..c3408035f2e3 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -572,8 +572,6 @@ static void WriteDop( WW8Export& rWrt )
     rDop.fDontUseHTMLAutoSpacing = 
rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX);
 
     rDop.fExpShRtn = 
!rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK);
 // #i56856#
-    rDop.fDntBlnSbDbWid = !rWrt.m_rDoc.getIDocumentSettingAccess().get(
-        DocumentSettingId::BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES); // tdf#88908
     rDop.fDontAdjustLineHeightInTable = 
!rWrt.m_rDoc.getIDocumentSettingAccess().get(
         DocumentSettingId::ADJUST_TABLE_LINE_HEIGHTS_TO_GRID_HEIGHT);
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f10985d689c4..83a90939f3ca 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1938,8 +1938,7 @@ void SwWW8ImplReader::ImportDop()
     
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
 false); // #i47448#
     
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::NO_GAP_AFTER_NOTE_NUMBER,
 true); // tdf#159382
     
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
 !m_xWDop->fExpShRtn); // #i49277#, #i56856#
-    
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES,
-                                           !m_xWDop->fDntBlnSbDbWid); // 
tdf#88908
+    
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::BALANCE_SPACES_AND_IDEOGRAPHIC_SPACES,
 false); // tdf#167552
     
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
 false);  // #i53199#
     
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::OLD_LINE_SPACING, 
false);
 

Reply via email to