officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |    6 ++++
 sw/inc/strings.hrc                                                |    1 
 sw/inc/viewsh.hxx                                                 |    2 +
 sw/source/core/doc/DocumentSettingManager.cxx                     |    1 
 sw/source/core/view/viewsh.cxx                                    |   14 
++++++++++
 sw/source/ui/config/optcomp.cxx                                   |    6 ++++
 6 files changed, 30 insertions(+)

New commits:
commit 71d2849bf62c21672626cc5fa9729677ef5ef292
Author:     Adesola Samuel <adesolasamuel2...@outlook.com>
AuthorDate: Wed Oct 30 16:05:15 2024 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Oct 31 14:46:30 2024 +0100

    tdf#153138 Add IgnoreTabsAndBlanksForLineCalculation compat opt to dialog
    
    IgnoreTabsAndBlanksForLineCalculation was added to the option->
    writer->compatibility options with the label "Make whitespace
    character height not affect line height"
    
    Change-Id: I8b99409b01ba2af635018d15cde2e549dff92732
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175831
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index a421f1f347ae..47760b0921f9 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -170,6 +170,12 @@
         </info>
         <value>false</value>
       </prop>
+      <prop oor:name="IgnoreTabsAndBlanksForLineCalculation" 
oor:type="xs:boolean" oor:nillable="false">
+        <info>
+          <desc>Make whitespace character height not affect line height</desc>
+        </info>
+        <value>false</value>
+      </prop>
     </group>
   </templates>
   <component>
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index ae2b24845615..b14c7ab5daf3 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1530,6 +1530,7 @@
 #define STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS 
NC_("STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS", "Do not mirror drawing 
objects anchored in paragraphs with an RTL writing direction")
 #define STR_COMPAT_OPT_CONTINUOUS_ENDNOTES 
NC_("STR_COMPAT_OPT_CONTINUOUS_ENDNOTES", "Render endnotes at the end of 
document inline, rather than on a separate page")
 #define STR_COMPAT_OPT_MSWORDCOMPGRIDMETRICS 
NC_("STR_COMPAT_OPT_MSWORDCOMPGRIDMETRICS", "Use Word-compatible font metrics 
for text grid")
+#define STR_COMPAT_OPT_IGNORETABSANDBLANKSFORLINECALCULATION 
NC_("STR_COMPAT_OPT_IGNORETABSANDBLANKSFORLINECALCULATION", "Make whitespace 
character height not affect line height")
 
 #define STR_TABLE_PANEL_ALIGN_AUTO              
NC_("sidebartableedit|alignautolabel", "Automatic")
 #define STR_TABLE_PANEL_ALIGN_LEFT              
NC_("sidebartableedit|alignleftlabel", "Left")
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 1752a167d149..eaa1630cd084 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -456,6 +456,8 @@ public:
 
     SW_DLLPUBLIC void SetMsWordCompGridMetrics(bool bMsWordCompGridMetrics);
 
+    SW_DLLPUBLIC void SetIgnoreTabsAndBlanksForLineCalculation(bool 
bIgnoreTabsAndBlanksForLineCalculation);
+
     // DOCUMENT COMPATIBILITY FLAGS END
 
     // Calls Idle-formatter of Layout.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 9f3858f8c0b6..2d9e2c389724 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -146,6 +146,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
&rDoc)
         mbDoNotMirrorRtlDrawObjs            = 
aOptions.get(u"DoNotMirrorRtlDrawObjs"_ustr);
         mbContinuousEndnotes                = 
aOptions.get(u"ContinuousEndnotes"_ustr);
         mbMsWordCompGridMetrics             = 
aOptions.get(u"MsWordCompGridMetrics"_ustr);
+        mbIgnoreTabsAndBlanksForLineCalculation = 
aOptions.get(u"IgnoreTabsAndBlanksForLineCalculation"_ustr);
     }
     else
     {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index dccebd31546f..eadb0ed8e8c0 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1127,6 +1127,20 @@ void SwViewShell::SetMsWordCompGridMetrics(bool 
_bMsWordCompGridMetrics)
     }
 }
 
+void SwViewShell::SetIgnoreTabsAndBlanksForLineCalculation(bool val)
+{
+    IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess();
+    if 
(rIDSA.get(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION) != 
val)
+    {
+        SwWait aWait(*GetDoc()->GetDocShell(), true);
+        
rIDSA.set(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, val);
+        const SwInvalidateFlags nInv = SwInvalidateFlags::Size | 
SwInvalidateFlags::Section
+                                        | SwInvalidateFlags::PrtArea | 
SwInvalidateFlags::Table
+                                        | SwInvalidateFlags::Pos;
+        lcl_InvalidateAllContent(*this, nInv);
+    }
+}
+
 void SwViewShell::Reformat()
 {
     SwWait aWait( *GetDoc()->GetDocShell(), true );
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 61617a82ed6e..f296dbc9f6d4 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -65,6 +65,7 @@ constexpr std::pair<OUString, TranslateId> options_list[]{
     { u"DoNotMirrorRtlDrawObjs"_ustr, 
STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS },
     { u"ContinuousEndnotes"_ustr, STR_COMPAT_OPT_CONTINUOUS_ENDNOTES },
     { u"MsWordCompGridMetrics"_ustr, STR_COMPAT_OPT_MSWORDCOMPGRIDMETRICS },
+    { u"IgnoreTabsAndBlanksForLineCalculation"_ustr, 
STR_COMPAT_OPT_IGNORETABSANDBLANKSFORLINECALCULATION },
 };
 
 // DocumentSettingId, negate?
@@ -93,6 +94,7 @@ std::pair<DocumentSettingId, bool> 
DocumentSettingForOption(const OUString& opti
         { u"ContinuousEndnotes"_ustr, { 
DocumentSettingId::CONTINUOUS_ENDNOTES, false } },
 //        { u"AddTableLineSpacing"_ustr, { 
DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, false } },
         { u"MsWordCompGridMetrics"_ustr, { 
DocumentSettingId::MS_WORD_COMP_GRID_METRICS, false } },
+        { u"IgnoreTabsAndBlanksForLineCalculation"_ustr, { 
DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, false } },
     };
     return map.at(option);
 }
@@ -336,6 +338,10 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet*  )
                         m_pWrtShell->SetMsWordCompGridMetrics(bChecked);
                         break;
 
+                    case 
DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
+                        
m_pWrtShell->SetIgnoreTabsAndBlanksForLineCalculation(bChecked);
+                        break;
+
                     default:
                         break;
                 }

Reply via email to