[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source writerfilter/source
Vasily Melenchuk (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 5 08:18:42 UTC 2021
sw/qa/extras/odfexport/odfexport2.cxx | 4 ++--
sw/source/core/doc/number.cxx | 9 +++++----
writerfilter/source/dmapper/NumberingManager.cxx | 8 ++++----
writerfilter/source/dmapper/NumberingManager.hxx | 5 +++--
4 files changed, 14 insertions(+), 12 deletions(-)
New commits:
commit a1692118d41a37282511c688b0062109c1b1e440
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Sat Sep 25 19:06:11 2021 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Oct 5 10:18:09 2021 +0200
tdf#144609: numbering "None" should still show prefix/suffix
Unlike it was implemented in tdf#143605, prefix and suffix
should be displayed anyway, we do not display only numbers.
Moreover tdf#143605 did accidentally fix tdf#135164
in a invalid way. So this patch is also providing a better
fix for it: untittest is already created and failing without it.
Problem in tdf#135164 is inability to distingush missing level
text (bullet char in given case) and empty ("") one. In first
case we should use abstract level definition. In second - not.
Change-Id: Ica3a714d22de4d2f14ebbcb12f0e1311dbc9b801
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122609
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123075
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 8ed38f7eb85a..3b1a7b8c527d 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -62,8 +62,8 @@ DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx")
DECLARE_ODFEXPORT_TEST(testTdf143605, "tdf143605.odt")
{
- // With numering type "none" there should be nothing
- CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(getParagraph(1), "ListLabelString"));
+ // With numbering type "none" there should be just prefix & suffix
+ CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(getParagraph(1), "ListLabelString"));
}
DECLARE_ODFEXPORT_TEST(testListFormatDocx, "listformat.docx")
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index a86668fa1936..5bc80fc99f3b 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -661,9 +661,6 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
const SwNumFormat& rMyNFormat = Get( o3tl::narrowing<sal_uInt16>(nLevel) );
- if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
- return OUString();
-
css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));
if (rMyNFormat.HasListFormat())
@@ -675,7 +672,11 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
for (SwNumberTree::tNumberVector::size_type i=0; i <= nLevel; ++i)
{
OUString sReplacement;
- if (rNumVector[i])
+ if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
+ {
+ // Numbering disabled - replacement is empty
+ }
+ else if (rNumVector[i])
{
if (bOnlyArabic)
sReplacement = OUString::number(rNumVector[i]);
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 764aace41808..9a3f372d7161 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -178,7 +178,7 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( )
uno::Sequence< beans::PropertyValue > vPropVals = PropertyMap::GetPropertyValues();
beans::PropertyValue* aValIter = vPropVals.begin();
beans::PropertyValue* aEndIter = vPropVals.end();
- const bool bIsSymbol(m_sBulletChar.getLength() <= 1);
+ const bool bIsSymbol(GetBulletChar().getLength() <= 1);
for( ; aValIter != aEndIter; ++aValIter )
if (! IgnoreForCharStyle(aValIter->Name, bIsSymbol))
rProperties.emplace_back(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE);
@@ -214,9 +214,9 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
// todo: this is not the bullet char
if( nNumberFormat == style::NumberingType::CHAR_SPECIAL )
{
- if (!m_sBulletChar.isEmpty())
+ if (!GetBulletChar().isEmpty())
{
- aNumberingProperties.push_back(lcl_makePropVal(PROP_BULLET_CHAR, m_sBulletChar.copy(0, 1)));
+ aNumberingProperties.push_back(lcl_makePropVal(PROP_BULLET_CHAR, m_sBulletChar->copy(0, 1)));
}
else
{
@@ -554,7 +554,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
? pAbsLevel->GetBulletChar()
: OUString();
// Inherit <w:lvlText> from the abstract level in case the override would be empty.
- if (pLevel && !pLevel->GetBulletChar().isEmpty())
+ if (pLevel && pLevel->HasBulletChar())
sText = pLevel->GetBulletChar( );
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PREFIX), OUString("")));
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 2a1e0204e02d..202e9fac57c4 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -46,7 +46,7 @@ class ListLevel : public PropertyMap
/// LN_CT_NumFmt_format, in case m_nNFC is custom.
OUString m_aCustomNumberFormat;
sal_Int16 m_nXChFollow; //LN_IXCHFOLLOW
- OUString m_sBulletChar;
+ std::optional<OUString> m_sBulletChar;
css::awt::Size m_aGraphicSize;
css::uno::Reference<css::awt::XBitmap> m_xGraphicBitmap;
std::optional<sal_Int32> m_nTabstop;
@@ -76,8 +76,9 @@ public:
{ m_xGraphicBitmap = xGraphicBitmap; }
void SetParaStyle( const tools::SvRef< StyleSheetEntry >& pStyle );
+ bool HasBulletChar() const { return m_sBulletChar.has_value(); };
// Getters
- const OUString& GetBulletChar( ) const { return m_sBulletChar; };
+ OUString GetBulletChar( ) const { return m_sBulletChar.has_value()? *m_sBulletChar : OUString(); };
const tools::SvRef< StyleSheetEntry >& GetParaStyle( ) const { return m_pParaStyle; };
bool isOutlineNumbering() const { return m_outline; }
sal_Int32 GetStartOverride() const { return m_nStartOverride; };
More information about the Libreoffice-commits
mailing list