diff options
author | Adesola Samuel <adesolasamuel2022@outlook.com> | 2024-10-30 16:05:15 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-10-31 14:46:30 +0100 |
commit | 71d2849bf62c21672626cc5fa9729677ef5ef292 (patch) | |
tree | 0b337b61d75e53ccaff8101460fd9a5abe8dc938 /sw | |
parent | 50a0bb366da12eab4ac673609c8335102915171c (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/strings.hrc | 1 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/config/optcomp.cxx | 6 |
5 files changed, 24 insertions, 0 deletions
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; } |