summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-06-11 12:07:44 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-06-14 19:32:07 +0200
commitd8bb5bb58ef62bc0e32d17f00f5fe695c81b5606 (patch)
treebfdaa5de9ce71a4cfb8a1b91881236a8ae4fc6bb /sd
parentf1f0c101109bcf9b54a47bf1010376fd8736e56c (diff)
Assert on valid order of which ids in ranges on SfxItemSet creation
This allows to make sure we actually use sorted which ranges, and then it's safe to call SfxItemSet::MergeRange when needed. Also this change relaxes the previous requirement that ranges must be separated by at least one; this allows to have adjacent ranges, like in RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, where RES_FRMATR_END is equal to RES_GRFATR_BEGIN. Allowing this makes possible to (1) self-document the ranges, so it's clear which ranges are included; and (2) be safe in case when these constants would change, so that the one merged range would not unexpectedly contain everything inserted between RES_FRMATR_END and RES_GRFATR_BEGIN. Change-Id: Iaad0f099b85059b3aa318a347aa7fbd3f6d455c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116909 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117106 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/func/fupage.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 6d44b70d5a9d..6adf302d5607 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -200,15 +200,17 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
if (!mpDrawViewShell)
return nullptr;
- SfxItemSet aNewAttr(mpDoc->GetPool(),
- {{mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
- mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE)},
- {SID_ATTR_PAGE, SID_ATTR_PAGE_SHARED},
- {SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER},
- {SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW},
- {XATTR_FILL_FIRST, XATTR_FILL_LAST},
- {SID_ATTR_PAGE_COLOR,SID_ATTR_PAGE_FILLSTYLE},
- {EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR}});
+ SfxItemSet aNewAttr(mpDoc->GetPool(), {
+ { XATTR_FILL_FIRST, XATTR_FILL_LAST },
+ { EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR },
+ { SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER },
+ { SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW },
+ { SID_ATTR_PAGE, SID_ATTR_PAGE_SHARED },
+ { SID_ATTR_PAGE_COLOR, SID_ATTR_PAGE_FILLSTYLE },
+ });
+ // Keep it sorted
+ aNewAttr.MergeRange(mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
+ mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
// Retrieve additional data for dialog