diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-06-11 12:07:44 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-06-13 19:23:28 +0200 |
commit | 8aaa28ed43978a9a4a20d62368410a57ec05c23f (patch) | |
tree | 16706bd93e2af74db7220a099a1391bf7cdd1bd4 /starmath | |
parent | f7c7e4c63f5479de66d2fbed9db34972a5bd05aa (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>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/unomodel.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 5d4d73b879ad..f66f9a3a7648 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -603,20 +603,16 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* sal_uInt32 nSize = aSequence.getLength(); SvMemoryStream aStream ( aSequence.getArray(), nSize, StreamMode::READ ); aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - static sal_uInt16 const nRange[] = - { - SID_PRINTSIZE, SID_PRINTSIZE, - SID_PRINTZOOM, SID_PRINTZOOM, + auto pItemSet = std::make_unique<SfxItemSet>( SmDocShell::GetPool(), svl::Items< SID_PRINTTITLE, SID_PRINTTITLE, SID_PRINTTEXT, SID_PRINTTEXT, SID_PRINTFRAME, SID_PRINTFRAME, + SID_PRINTSIZE, SID_PRINTSIZE, + SID_PRINTZOOM, SID_PRINTZOOM, SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS, SID_AUTO_CLOSE_BRACKETS, SID_AUTO_CLOSE_BRACKETS, - SID_SMEDITWINDOWZOOM, SID_SMEDITWINDOWZOOM, - 0 - }; - auto pItemSet = std::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange ); + SID_SMEDITWINDOWZOOM, SID_SMEDITWINDOWZOOM>{} ); SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pItemSet); VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) ); |