svx/source/sidebar/nbdtmg.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 312fd13f30e20c435370d8a11cf4123a25988f52
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Tue Jan 3 10:56:40 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Apr 21 00:03:15 2023 +0200

    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 have 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/+/150660
    Tested-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

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() &&

Reply via email to