From 9987b518fca1476bd0ce8c86bcf6ac7c81f7b580 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Mon, 14 Jun 2021 14:27:56 +0300 Subject: new ODF numbered list parameter loext:num-list-format Instead of style:num-prefix and style:num-suffix new list format is much more flexible for storing list multilevel numberings. Now it is possible to have not just prefix/suffix but any random separators between levels, arbitrary levels order, etc. Internal LO format for list format is changed: instead of placeholders like %1, %2, etc we right now use %1%, %2%... Reason: for ODT documents, having more than 9 levels there is ambiguity in "%10": it is "%1" followed by "0" suffix, or "%10"? Aux changes: * removed zero width space hack: since format string is always defined this hack is interfering with standard list numbers printing (see changes in ooxmlexport14.cxx, ww8export3.cxx tests) * changed cross-references values to lists: they are now including full list label string: previously this was bit self-contradictory (see changes in odfexport.cxx and check_cross_references.py tests) Conflicts: sw/qa/extras/odfexport/odfexport.cxx Change-Id: I9696cc4846375c5f6222539aeaadbca5ae58ce27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117156 Tested-by: Jenkins Reviewed-by: Michael Stahl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118040 Reviewed-by: Vasily Melenchuk --- cui/source/tabpages/numpages.cxx | 41 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'cui') diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index fbeb40aa4b3d..32063c6f1c5d 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -314,14 +314,8 @@ IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void) { SvxNumberFormat aFmt(pActNum->GetLevel(i)); aFmt.SetNumberingType(eNewType); - if(cLocalPrefix == ' ') - aFmt.SetPrefix( "" ); - else - aFmt.SetPrefix(_pSet->sPrefix); - if(cLocalSuffix == ' ') - aFmt.SetSuffix( "" ); - else - aFmt.SetSuffix(_pSet->sSuffix); + aFmt.SetListFormat(cLocalPrefix == ' ' ? "" : _pSet->sPrefix, + cLocalSuffix == ' ' ? "" : _pSet->sSuffix, i); aFmt.SetCharFormatName(""); aFmt.SetBulletRelSize(100); pActNum->SetLevel(i, aFmt); @@ -459,8 +453,7 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, void) SvxNumberFormat aFmt(pActNum->GetLevel(i)); aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); // #i93908# clear suffix for bullet lists - aFmt.SetPrefix( OUString() ); - aFmt.SetSuffix( OUString() ); + aFmt.SetListFormat("", "", i); aFmt.SetBulletFont(&rActBulletFont); aFmt.SetBulletChar(cChar ); aFmt.SetCharFormatName(sBulletCharFormatName); @@ -652,8 +645,7 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void) if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) { // #i93908# clear suffix for bullet lists - aFmt.SetPrefix(OUString()); - aFmt.SetSuffix(OUString()); + aFmt.SetListFormat("", "", i); if( !pLevelSettings->sBulletFont.isEmpty() && pLevelSettings->sBulletFont != rActBulletFont.GetFamilyName()) { @@ -702,8 +694,7 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void) aFmt.SetCharFormatName(sNumCharFmtName); aFmt.SetBulletRelSize(100); // #i93908# - aFmt.SetPrefix(pLevelSettings->sPrefix); - aFmt.SetSuffix(pLevelSettings->sSuffix); + aFmt.SetListFormat(pLevelSettings->sPrefix, pLevelSettings->sSuffix, i); } pActNum->SetLevel(i, aFmt); } @@ -885,8 +876,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void) { SvxNumberFormat aFmt(pActNum->GetLevel(i)); aFmt.SetNumberingType(SVX_NUM_BITMAP); - aFmt.SetPrefix( "" ); - aFmt.SetSuffix( "" ); + aFmt.SetListFormat("", "", i); aFmt.SetCharFormatName( "" ); Graphic aGraphic; @@ -1644,8 +1634,7 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, { bBmp |= nullptr != aNumFmt.GetBrush(); aNumFmt.SetIncludeUpperLevels( 0 ); - aNumFmt.SetSuffix( "" ); - aNumFmt.SetPrefix( "" ); + aNumFmt.SetListFormat("", "", i); if(!bBmp) aNumFmt.SetGraphic(""); pActNum->SetLevel(i, aNumFmt); @@ -1655,8 +1644,7 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, else if( SVX_NUM_CHAR_SPECIAL == nNumberingType ) { aNumFmt.SetIncludeUpperLevels( 0 ); - aNumFmt.SetSuffix( "" ); - aNumFmt.SetPrefix( "" ); + aNumFmt.SetListFormat("", "", i); if( !aNumFmt.GetBulletFont() ) aNumFmt.SetBulletFont(&aActBulletFont); if( !aNumFmt.GetBulletChar() ) @@ -1671,8 +1659,8 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, } else { - aNumFmt.SetPrefix( m_xPrefixED->get_text() ); - aNumFmt.SetSuffix( m_xSuffixED->get_text() ); + aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i); + SwitchNumberType(SHOW_NUMBERING); pActNum->SetLevel(i, aNumFmt); CheckForStartValue_Impl(nNumberingType); @@ -2098,8 +2086,7 @@ IMPL_LINK(SvxNumOptionsTabPage, SpinModifyHdl_Impl, weld::SpinButton&, rSpinButt void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit) { - bool bPrefix = pEdit == m_xPrefixED.get(); - bool bSuffix = pEdit == m_xSuffixED.get(); + bool bPrefixSuffix = (pEdit == m_xPrefixED.get())|| (pEdit == m_xSuffixED.get()); bool bStart = pEdit == m_xStartED.get(); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) @@ -2107,10 +2094,8 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit) if(nActNumLvl & nMask) { SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if(bPrefix) - aNumFmt.SetPrefix(m_xPrefixED->get_text()); - else if(bSuffix) - aNumFmt.SetSuffix(m_xSuffixED->get_text()); + if (bPrefixSuffix) + aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i); else if(bStart) aNumFmt.SetStart(m_xStartED->get_value()); pActNum->SetLevel(i, aNumFmt); -- cgit