summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-07-14 10:27:24 +0200
committerJustin Luth <justin_luth@sil.org>2021-07-14 17:29:54 +0200
commit6d81084e4f5100b1c8204f30a91d7a5b79998508 (patch)
tree2d23be5b8ba2d2b1180ce97d47fe97cb53a31453 /writerfilter/source
parent9a55b97e980bbf2a0ce12841f6168f1f7545ac96 (diff)
tdf#141964 writerfilter CN: numId0 has different meaning for RTF
For DOCX, numId means turn off numbering. RTF probably doesn't have numbering as part of paragraph styles, so it doesn't need a numId 0 to cancel existing numbering. This numbering is applied directly to the paragraph during import. So, for RTF, numId 0 needs to be treated just like any other numId (except for -1 through -5 although currently we only import positive numbers). The statement "if pList and numId > 0" is basically redundant. pList will not be exist for an invalid numId. Since numId can be zero for RTF, just get rid of the clause to avoid any misleading conclusions. And that is all that this patch is doing. It doesn't really fix anything, it just changes code that gives out the wrong impression. AFAICT, RTF never uses styles, and therefore it is always isNumberingViaRule and so is almost untouched by finishParagraph. Change-Id: Ibc89d00ce69ad09208254ed85710f1f1aed18074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118910 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx8
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx2
2 files changed, 5 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ae10911d5eaa..78f7dbc16b24 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1584,16 +1584,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
//does not specify the numbering
sal_Int16 nListLevel = GetListLevel(pEntry, pParaContext);
// Undefined listLevel with a valid numId is treated as a first level numbering.
- if (nListLevel == -1 && nListId > 0)
+ if (nListLevel == -1 && nListId > (IsOOXMLImport() ? 0 : -1))
nListLevel = 0;
if (!bNoNumbering && nListLevel >= 0 && nListLevel < 9)
pParaContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny(nListLevel), false );
auto const pList(GetListTable()->GetList(nListId));
- if (pList && nListId > 0 && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
+ if (pList && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
{
- // ListLevel 9 means Body Level/no numbering. numId 0 means no numbering.
+ // ListLevel 9 means Body Level/no numbering.
if (bNoNumbering || nListLevel == 9)
pParaContext->Insert(PROP_NUMBERING_STYLE_NAME, uno::makeAny(OUString()), true);
else if ( !isNumberingViaRule )
@@ -1672,7 +1672,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
if (nListId == 0 && !pList)
{
- // Seems situation with listid=0 and missing list definition is used by MS Word
+ // Seems situation with listid=0 and missing list definition is used by DOCX
// to remove numbering defined previously. But some default numbering attributes
// are still applied. This is first line indent, probably something more?
if (!pParaContext->isSet(PROP_PARA_FIRST_LINE_INDENT))
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index f312d7080dcb..1d4c70f613a1 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -1177,7 +1177,7 @@ ListDef::Pointer ListsManager::GetList( sal_Int32 nId )
}
// nId 0 is only valid for abstractNum, not numId (which has an abstract definition)
- assert(nId || !pList || !pList->GetAbstractDefinition());
+ assert(!pList || nId || !pList->GetAbstractDefinition() || m_rDMapper.IsRTFImport());
return pList;
}