diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-06-03 17:01:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-06-03 18:34:02 +0200 |
commit | b79b50c8f06a5c977451995b2d632e5738d7d335 (patch) | |
tree | 348ed57131c0d763ae36a86e17d9923e41ceb944 | |
parent | 04954ffee19bb2357dca69f929ac660f99d80f16 (diff) |
tdf#160984 sw continuous endnotes: add enable/disable option UI
Doing this via a macro was possible already, but that didn't invalidate
the endnote positions on the layout, so required a document reload,
which was ugly.
Implement the new SwViewShell::SetContinuousEndnotes() by removing the
endnote frames in the document, so they'll be re-created at the expected
place as the layout action ends.
Change-Id: If96e70ab29c5a6c95fce36775e9a9a61277fc8a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168383
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs | 6 | ||||
-rw-r--r-- | sw/inc/strings.hrc | 3 | ||||
-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 |
6 files changed, 31 insertions, 1 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs index 9bc722106070..c1fc01658ad3 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs @@ -158,6 +158,12 @@ </info> <value>false</value> </prop> + <prop oor:name="ContinuousEndnotes" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Render endnotes at the end of the document inline, rather than on a separate page</desc> + </info> + <value>false</value> + </prop> </group> </templates> <component> diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 6a36f4740926..298b861eecf6 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -1492,7 +1492,8 @@ #define STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER NC_("STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER", "Do not add an extra space after number in footnotes / endnotes with hanging first line") #define STR_COMPAT_OPT_TABSRELATIVETOINDENT NC_("STR_COMPAT_OPT_TABSRELATIVETOINDENT", "Set tabstops relative to indent of paragraph") #define STR_COMPAT_OPT_TABOVERMARGIN NC_("STR_COMPAT_OPT_TABOVERMARGIN", "Allow tabs to extend beyond the right margin") -#define STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS NC_("DO_NOT_MIRROR_RTL_DRAW_OBJS", "Do not mirror drawing objects anchored in paragraphs with an RTL writing direction") +#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_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 18d33266b627..b53a3ed7b719 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -453,6 +453,8 @@ public: SW_DLLPUBLIC void SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs); + SW_DLLPUBLIC void SetContinuousEndnotes(bool bContinuousEndnotes); + // 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 0a02eb5cb72f..52d609be2e78 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -141,6 +141,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbTabRelativeToIndent = aOptions.get(u"TabsRelativeToIndent"_ustr); mbTabOverMargin = aOptions.get(u"TabOverMargin"_ustr); mbDoNotMirrorRtlDrawObjs = aOptions.get(u"DoNotMirrorRtlDrawObjs"_ustr); + mbContinuousEndnotes = aOptions.get(u"ContinuousEndnotes"_ustr); } else { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index ec29a15874c0..c4d9a551807c 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1094,6 +1094,20 @@ void SwViewShell::SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs) } } +void SwViewShell::SetContinuousEndnotes(bool bContinuousEndnotes) +{ + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if (rIDSA.get(DocumentSettingId::CONTINUOUS_ENDNOTES) != bContinuousEndnotes) + { + SwWait aWait(*GetDoc()->GetDocShell(), true); + rIDSA.set(DocumentSettingId::CONTINUOUS_ENDNOTES, bContinuousEndnotes); + StartAction(); + GetLayout()->RemoveFootnotes(/*pPage=*/nullptr, /*pPageOnly=*/false, /*bEndNotes=*/true); + EndAction(); + GetDoc()->getIDocumentState().SetModified(); + } +} + 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 9d60a786ce8b..d95b5638a442 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -63,6 +63,7 @@ constexpr std::pair<OUString, TranslateId> options_list[]{ { u"TabsRelativeToIndent"_ustr, STR_COMPAT_OPT_TABSRELATIVETOINDENT }, { u"TabOverMargin"_ustr, STR_COMPAT_OPT_TABOVERMARGIN }, { u"DoNotMirrorRtlDrawObjs"_ustr, STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS }, + { u"ContinuousEndnotes"_ustr, STR_COMPAT_OPT_CONTINUOUS_ENDNOTES }, }; // DocumentSettingId, negate? @@ -88,6 +89,7 @@ std::pair<DocumentSettingId, bool> DocumentSettingForOption(const OUString& opti { u"TabsRelativeToIndent"_ustr, { DocumentSettingId::TABS_RELATIVE_TO_INDENT, false } }, { u"TabOverMargin"_ustr, { DocumentSettingId::TAB_OVER_MARGIN, false } }, { u"DoNotMirrorRtlDrawObjs"_ustr, { DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, false } }, + { u"ContinuousEndnotes"_ustr, { DocumentSettingId::CONTINUOUS_ENDNOTES, false } }, // { u"AddTableLineSpacing"_ustr, { DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, false } }, }; return map.at(option); @@ -324,6 +326,10 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) m_pWrtShell->SetDoNotMirrorRtlDrawObjs(bChecked); break; + case DocumentSettingId::CONTINUOUS_ENDNOTES: + m_pWrtShell->SetContinuousEndnotes(bChecked); + break; + default: break; } |