sw/source/core/doc/DocumentStylePoolManager.cxx |   30 ++++++++++++------------
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 64318c884eac13baa3012c8da3e5feb3c1369933
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Tue Dec 27 11:25:28 2022 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Dec 29 02:09:04 2022 +0000

    tdf#56258 tdf#106988 sw numbering ivx: make style useable
    
    In the current state, the style was basically unusable.
    The first two levels had numbering at the same indent,
    the third level started with a c),
    and the fourth level started earlier than the 3rd level.
    
    I took my formatting queues from Numbering IVX.
    These right-aligned roman-numerals can grow very wide
    when getting to number 7 and 8, so I designed the
    style with a wide indent theme.
    
    Now the first two levels have the same width as
    ROMAN_UPPER. Since this style is a mixed bag,
    I changed the second level to use ROMAN_UPPER,
    which keeps the roman theme, but fits better with
    the following character and bullet sublevels.
    The third level switches back to left-aligned
    with similar indents to CHAR_LOWER_LETTER,
    (and starts with letter "a" - good grief)
    while the bullet levels are a nice, breezy half-indent width
    (which is 50%-100% wider than the bullet styles).
    
    Change-Id: Ie3ac386c360e804dde6c295dd39a3c02d3ba9b79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144841
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Vernon, Stuart Foote <vsfo...@libreoffice.org>

diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx 
b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 600709e339b2..06a614318d44 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -2105,9 +2105,9 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( 
sal_uInt16 nId )
             // [ First, LSpace ]
             static const sal_uInt16 aAbsSpace0to2[] =
                 {
-                    174,  754,      // 0.33, 1.33,
-                    567,  1151,      // 1.03, 2.03,
-                    397,  1548       // 2.03, 2.73
+                    174,  754,  // 0.33, 1.33cm
+                    174,  1508, // 0.33, 2.66cm
+                    397,  2262  // 0.70, 4.00cm
                 };
 
             const sal_uInt16* pArr0to2 = aAbsSpace0to2;
@@ -2127,8 +2127,8 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( 
sal_uInt16 nId )
 
             if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
             {
-                aFormat.SetFirstLineOffset( -pArr0to2[0] );    // == 0.33 cm
-                aFormat.SetAbsLSpace( pArr0to2[1] );           // == 1.33 cm
+                aFormat.SetFirstLineOffset(- pArr0to2[0]); // num ends at 1.00 
cm
+                aFormat.SetAbsLSpace(pArr0to2[1]);         // text starts at 
1.33 cm
             }
             else if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_ALIGNMENT )
             {
@@ -2140,14 +2140,14 @@ SwNumRule* 
DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId )
             aFormat.SetCharFormat( pNumCFormat );
             pNewRule->Set( 0, aFormat );
 
+            aFormat.SetNumberingType(SVX_NUM_ROMAN_UPPER);
             aFormat.SetIncludeUpperLevels( 1 );
-            aFormat.SetStart( 1 );
             aFormat.SetListFormat("", ".", 1);
 
             if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
             {
-                aFormat.SetFirstLineOffset( -pArr0to2[2] );    // == 1.03 cm
-                aFormat.SetAbsLSpace( pArr0to2[3] );           // == 2.03 cm
+                aFormat.SetFirstLineOffset(- pArr0to2[2]); // num ends at 2.33 
cm
+                aFormat.SetAbsLSpace(pArr0to2[3]);         // text starts at 
2.66 cm
             }
             else if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_ALIGNMENT )
             {
@@ -2160,13 +2160,13 @@ SwNumRule* 
DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId )
 
             aFormat.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
             aFormat.SetIncludeUpperLevels( 1 );
-            aFormat.SetStart( 3 );
             aFormat.SetListFormat("", u")", 2);
+            aFormat.SetNumAdjust( SvxAdjust::Left );
 
             if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
             {
-                aFormat.SetFirstLineOffset( - pArr0to2[4] );   // == 2.03 cm
-                aFormat.SetAbsLSpace( pArr0to2[5] );           // == 2.73 cm
+                aFormat.SetFirstLineOffset(- pArr0to2[4]); // num starts at 
3.30 cm
+                aFormat.SetAbsLSpace(pArr0to2[5]);         // text starts at 
4.00 cm
             }
             else if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_ALIGNMENT )
             {
@@ -2181,8 +2181,8 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( 
sal_uInt16 nId )
             aFormat.SetCharFormat( pBullCFormat );
             aFormat.SetBulletFont(  &numfunc::GetDefBulletFont() );
             aFormat.SetBulletChar( cBulletChar );
-            sal_Int16 nOffs = o3tl::convert(4, o3tl::Length::mm, 
o3tl::Length::twip),
-                      nOffs2 = o3tl::convert(2, o3tl::Length::cm, 
o3tl::Length::twip);
+            sal_Int16 nOffs = o3tl::convert(660, o3tl::Length::mm100, 
o3tl::Length::twip),
+                      nOffs2 = o3tl::convert(4000, o3tl::Length::mm100, 
o3tl::Length::twip);
 
             if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
             {
@@ -2200,11 +2200,11 @@ SwNumRule* 
DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId )
 
                 if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
                 {
-                    aFormat.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
+                    aFormat.SetAbsLSpace(nOffs2 + ((n - 2) * 
static_cast<tools::Long>(nOffs)));
                 }
                 else if ( eNumberFormatPositionAndSpaceMode == 
SvxNumberFormat::LABEL_ALIGNMENT )
                 {
-                    tools::Long nPos = nOffs2 + ((n-3) * 
static_cast<tools::Long>(nOffs));
+                    tools::Long nPos = nOffs2 + ((n - 2) * 
static_cast<tools::Long>(nOffs));
                     aFormat.SetListtabPos(nPos);
                     aFormat.SetIndentAt(nPos);
                 }

Reply via email to