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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2024-05-06 08:36:18 +02:00
parent 67dc0edb68
commit 2f79dc2bc2
6 changed files with 27 additions and 0 deletions

View File

@@ -152,6 +152,12 @@
</info> </info>
<value>false</value> <value>false</value>
</prop> </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> </group>
</templates> </templates>
<component> <component>

View File

@@ -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_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_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_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_AUTO NC_("sidebartableedit|alignautolabel", "Automatic")
#define STR_TABLE_PANEL_ALIGN_LEFT NC_("sidebartableedit|alignleftlabel", "Left") #define STR_TABLE_PANEL_ALIGN_LEFT NC_("sidebartableedit|alignleftlabel", "Left")

View File

@@ -451,6 +451,8 @@ public:
SW_DLLPUBLIC void SetTabOverMargin(bool bNew); SW_DLLPUBLIC void SetTabOverMargin(bool bNew);
SW_DLLPUBLIC void SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs);
// DOCUMENT COMPATIBILITY FLAGS END // DOCUMENT COMPATIBILITY FLAGS END
// Calls Idle-formatter of Layout. // Calls Idle-formatter of Layout.

View File

@@ -139,6 +139,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbNoGapAfterNoteNumber = aOptions.get(u"NoGapAfterNoteNumber"_ustr); mbNoGapAfterNoteNumber = aOptions.get(u"NoGapAfterNoteNumber"_ustr);
mbTabRelativeToIndent = aOptions.get(u"TabsRelativeToIndent"_ustr); mbTabRelativeToIndent = aOptions.get(u"TabsRelativeToIndent"_ustr);
mbTabOverMargin = aOptions.get(u"TabOverMargin"_ustr); mbTabOverMargin = aOptions.get(u"TabOverMargin"_ustr);
mbDoNotMirrorRtlDrawObjs = aOptions.get(u"DoNotMirrorRtlDrawObjs"_ustr);
} }
else else
{ {

View File

@@ -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() void SwViewShell::Reformat()
{ {
SwWait aWait( *GetDoc()->GetDocShell(), true ); SwWait aWait( *GetDoc()->GetDocShell(), true );

View File

@@ -62,6 +62,7 @@ constexpr std::pair<OUString, TranslateId> options_list[]{
{ u"NoGapAfterNoteNumber"_ustr, STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER }, { u"NoGapAfterNoteNumber"_ustr, STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER },
{ u"TabsRelativeToIndent"_ustr, STR_COMPAT_OPT_TABSRELATIVETOINDENT }, { u"TabsRelativeToIndent"_ustr, STR_COMPAT_OPT_TABSRELATIVETOINDENT },
{ u"TabOverMargin"_ustr, STR_COMPAT_OPT_TABOVERMARGIN }, { u"TabOverMargin"_ustr, STR_COMPAT_OPT_TABOVERMARGIN },
{ u"DoNotMirrorRtlDrawObjs"_ustr, STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS },
}; };
// DocumentSettingId, negate? // 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"NoGapAfterNoteNumber"_ustr, { DocumentSettingId::NO_GAP_AFTER_NOTE_NUMBER, false } },
{ u"TabsRelativeToIndent"_ustr, { DocumentSettingId::TABS_RELATIVE_TO_INDENT, false } }, { u"TabsRelativeToIndent"_ustr, { DocumentSettingId::TABS_RELATIVE_TO_INDENT, false } },
{ u"TabOverMargin"_ustr, { DocumentSettingId::TAB_OVER_MARGIN, 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 } }, // { u"AddTableLineSpacing"_ustr, { DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, false } },
}; };
return map.at(option); return map.at(option);
@@ -318,6 +320,10 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* )
m_pWrtShell->SetTabOverMargin(bChecked); m_pWrtShell->SetTabOverMargin(bChecked);
break; break;
case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
m_pWrtShell->SetDoNotMirrorRtlDrawObjs(bChecked);
break;
default: default:
break; break;
} }