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 | 11 ++++++++++ sw/source/ui/config/optcomp.cxx | 6 +++++ 6 files changed, 27 insertions(+)
New commits: commit 2f79dc2bc2ddf4006646f235f228b61e3f9ffde0 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon May 6 08:36:18 2024 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon May 6 10:36:33 2024 +0200 Related: tdf#160833 sw DoNotMirrorRtlDrawObjs: add enable/disable option UI Doing this via a macro was possible already, but that didn't invalidate the object positions on the layout, so required a document reload, which was ugly. Change-Id: I65dec046727588952f8e41a89eae25f81feb7f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167182 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs index 085a380cbd41..9bc722106070 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs @@ -152,6 +152,12 @@ </info> <value>false</value> </prop> + <prop oor:name="DoNotMirrorRtlDrawObjs" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Do not mirror drawing objects anchored in paragraphs with an RTL writing direction</desc> + </info> + <value>false</value> + </prop> </group> </templates> <component> diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index a0d04e35ba29..6a36f4740926 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -1492,6 +1492,7 @@ #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_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 9417702f5b86..18d33266b627 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -451,6 +451,8 @@ public: SW_DLLPUBLIC void SetTabOverMargin(bool bNew); + SW_DLLPUBLIC void SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs); + // 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 55b625932efb..501344ca8108 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -139,6 +139,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbNoGapAfterNoteNumber = aOptions.get(u"NoGapAfterNoteNumber"_ustr); mbTabRelativeToIndent = aOptions.get(u"TabsRelativeToIndent"_ustr); mbTabOverMargin = aOptions.get(u"TabOverMargin"_ustr); + mbDoNotMirrorRtlDrawObjs = aOptions.get(u"DoNotMirrorRtlDrawObjs"_ustr); } else { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 5ec658a9cd14..f20eb694e8f4 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1083,6 +1083,17 @@ void SwViewShell::SetTabOverMargin(bool bNew) } } +void SwViewShell::SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs) +{ + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if (rIDSA.get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS) != bDoNotMirrorRtlDrawObjs) + { + SwWait aWait(*GetDoc()->GetDocShell(), true); + rIDSA.set(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, bDoNotMirrorRtlDrawObjs); + lcl_InvalidateAllObjPos(*this); + } +} + 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 9ed4c850bd4d..9d60a786ce8b 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -62,6 +62,7 @@ constexpr std::pair<OUString, TranslateId> options_list[]{ { u"NoGapAfterNoteNumber"_ustr, STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER }, { 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 }, }; // DocumentSettingId, negate? @@ -86,6 +87,7 @@ std::pair<DocumentSettingId, bool> DocumentSettingForOption(const OUString& opti { u"NoGapAfterNoteNumber"_ustr, { DocumentSettingId::NO_GAP_AFTER_NOTE_NUMBER, false } }, { 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"AddTableLineSpacing"_ustr, { DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, false } }, }; return map.at(option); @@ -318,6 +320,10 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) m_pWrtShell->SetTabOverMargin(bChecked); break; + case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS: + m_pWrtShell->SetDoNotMirrorRtlDrawObjs(bChecked); + break; + default: break; }