summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-06-12 11:11:16 +0200
committerLászló Németh <nemeth@numbertext.org>2020-06-12 17:42:00 +0200
commit2128d59ab91da853652305390d56b3287bcb67b1 (patch)
treea770ca02c32e0eec92abe7b44aec2e73e498e275 /writerfilter
parenta7b12e23bf9ac8e394405a1de5835e18e40c27c2 (diff)
tdf#76817: DOCX import: fix chapter numbering
Imported headings got also redundant custom direct numbering, resulting broken automatic chapter numbering: applying standard Heading styles on paragraphs using the associated toolbar menu, Manage Styles dialog window or Ctrl-1–Ctrl-4 shortcut keys, it didn't result continuous numbering. Co-authored-by: Justin Luth <justin_luth@sil.org> Change-Id: Ic1ba5070fa4c387ad527aec05234a4da90fab751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96198 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 557b09fa5917..ba94dc430577 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1403,7 +1403,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
isNumberingViaStyle = true;
// Since LO7.0/tdf#131321 fixed the loss of numbering in styles, this OUGHT to be obsolete,
// but now other new/critical LO7.0 code expects it, and perhaps some corner cases still need it as well.
- pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(pList->GetStyleName()), true );
+ // So we skip it only for default outline styles, which are recognized by NumberingManager.
+ if (!GetCurrentParaStyleName().startsWith("Heading "))
+ pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(pList->GetStyleName()), true );
}
else if ( !pList->isOutlineNumbering(nListLevel) )
{
@@ -1758,11 +1760,13 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
{
OUString paraId;
m_xPreviousParagraph->getPropertyValue("ListId") >>= paraId;
- assert(!paraId.isEmpty()); // must be on some list?
- OUString const listId = pAbsList->MapListId(paraId);
- if (listId != paraId)
+ if (!paraId.isEmpty()) // must be on some list?
{
- m_xPreviousParagraph->setPropertyValue("ListId", uno::makeAny(listId));
+ OUString const listId = pAbsList->MapListId(paraId);
+ if (listId != paraId)
+ {
+ m_xPreviousParagraph->setPropertyValue("ListId", uno::makeAny(listId));
+ }
}
}
if (pList->GetCurrentLevel())