summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-01-03 10:56:40 -0500
committerJustin Luth <jluth@mail.com>2023-01-04 02:12:58 +0000
commitec2f1d73936c9d8cee83c0887170e9ecb8f044ba (patch)
tree677630dcb841b5be739a757d8fb1918beff97d47 /svx
parentd3a5a97f77378421f17b1fa43d0b88dde8bc686a (diff)
tdf#56258 svx: use last defined locale-outline for remaining levels
When applying an outline numbering choice (one of the 8 predefined per-locale definitions) the toolbar/sidebar would only affect the spacing of 0 - 5 of the defined locale-levels, and only changed the num type of the remainder. Well, that can easily look bad if the indenting and spacing is only partially modified. [The Bullets and Numbering dialog outline grid does not affect spacing at all. That can be better or much worse, depending on the situation.] This "Outline Format" button is normally turned off on Writer's Formatting toolbar. You need to go to Tools - Customize - Toolbars to turn it on. It only seems to work for Writer - it was grayed out/disabled in Draw even when I had it show up in the toolbar. So almost nobody has ever seen or used this I expect. However, I think it is important to get this working, because I want to use this grid-choice code path to be usable for the B&N dialog as well, although that could upset people who already have their spacing right and just want to change the digits. In any case, this nbdtimg DOES already change some spacing, so it should be either all or none. Change-Id: Ib54b6ffe3497f09f0c57ff2db1ec2a946f692fc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145022 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sidebar/nbdtmg.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 241b91673836..a4def326c80b 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -590,11 +590,14 @@ void OutlineTypeMgr::Init()
pItemArr->sDescription = SvxResId( TranslateId(RID_SVXSTR_OUTLINENUM_DESCRIPTION_0.mpContext, id.getStr()) );
pItemArr->pNumSettingsArr = new NumSettingsArr_Impl;
Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
- for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
+ for(sal_Int32 nLevel = 0; nLevel < SVX_MAX_NUM; nLevel++)
{
- Any aValueAny = xLevel->getByIndex(nLevel);
+ // use the last locale-defined level for all remaining levels.
+ sal_Int32 nLocaleLevel = std::min(nLevel, xLevel->getCount() - 1);
Sequence<PropertyValue> aLevelProps;
- aValueAny >>= aLevelProps;
+ if (nLocaleLevel >= 0)
+ xLevel->getByIndex(nLocaleLevel) >>= aLevelProps;
+
NumSettings_Impl* pNew = lcl_CreateNumberingSettingsPtr(aLevelProps);
const SvxNumberFormat& aNumFmt( aDefNumRule.GetLevel( nLevel) );
pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy();
@@ -618,7 +621,7 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m
{
bool bNotMatch = false;
OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex];
- sal_uInt16 nCount = pItemArr->pNumSettingsArr->size();
+ sal_uInt16 nCount = pItemArr ? pItemArr->pNumSettingsArr->size() : 0;
for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++)
{
NumSettings_Impl* _pSet = (*pItemArr->pNumSettingsArr)[iLevel].get();
@@ -633,7 +636,9 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m
sal_UCS4 cChar = aFmt.GetBulletChar();
sal_UCS4 ccChar
- = _pSet->sBulletChar.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
+ = _pSet->sBulletChar.isEmpty()
+ ? 0
+ : _pSet->sBulletChar.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
if ( !((cChar == ccChar) &&
_pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() &&