summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-05-05 14:00:12 +0200
committerLászló Németh <nemeth@numbertext.org>2020-05-06 09:01:19 +0200
commit38016653cb9b338d6287c06a49663252f636f548 (patch)
tree6ffdea78c17c1ea574dc504a625436d9118aeb60 /writerfilter/source
parentdadbdf6674154d2052f4ae14afed3bcee392010d (diff)
tdf#108493 DOCX import: fix hanging indent of lists
when its value comes from the numbering style, but the left indentation is overwritten by paragraph settings. The problem caused by that these settings are not independent in Writer core. Change-Id: I5d6759bb215b82dfcaa5cbd3e191ac7ea8a8bb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93478 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0465981ca6ba..bbef06695434 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1376,10 +1376,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
bool isNumberingViaStyle(false);
//apply numbering to paragraph if it was set at the style, but only if the paragraph itself
//does not specify the numbering
+ sal_Int32 nListId = -1;
if ( !bRemove && pStyleSheetProperties && pParaContext && !pParaContext->isSet(PROP_NUMBERING_RULES) )
{
bool bNumberingFromBaseStyle = false;
- sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, GetStyleSheetTable(), bNumberingFromBaseStyle) : -1;
+ nListId = pEntry ? lcl_getListId(pEntry, GetStyleSheetTable(), bNumberingFromBaseStyle) : -1;
auto const pList(GetListTable()->GetList(nListId));
if (pList && nListId >= 0 && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
{
@@ -1679,10 +1680,10 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
assert(dynamic_cast<ParagraphPropertyMap*>(pPropertyMap.get()));
// Use lcl_getListId(), so we find the list ID in parent styles as well.
bool bNumberingFromBaseStyle = false;
- sal_Int32 const nListId( isNumberingViaStyle
+ sal_Int32 const nListId2( isNumberingViaStyle
? lcl_getListId(pEntry, GetStyleSheetTable(), bNumberingFromBaseStyle)
: static_cast<ParagraphPropertyMap*>(pPropertyMap.get())->GetListId());
- if (ListDef::Pointer const& pList = m_pListTable->GetList(nListId))
+ if (ListDef::Pointer const& pList = m_pListTable->GetList(nListId2))
{ // styles could refer to non-existing lists...
AbstractListDef::Pointer const& pAbsList =
pList->GetAbstractDefinition();
@@ -1858,6 +1859,12 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
uno::Any aMargin = GetPropertyFromParaStyleSheet(PROP_PARA_LEFT_MARGIN);
if ( aMargin != uno::Any() )
xParaProps->setPropertyValue("ParaLeftMargin", aMargin);
+ else if (isNumberingViaStyle)
+ {
+ const sal_Int32 nParaLeftMargin = getNumberingProperty(nListId, pStyleSheetProperties->GetListLevel(), "IndentAt");
+ if (nParaLeftMargin != 0)
+ xParaProps->setPropertyValue("ParaLeftMargin", uno::makeAny(nParaLeftMargin));
+ }
}
if ( !bRightSet )
{
@@ -1870,6 +1877,12 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
uno::Any aMargin = GetPropertyFromParaStyleSheet(PROP_PARA_FIRST_LINE_INDENT);
if ( aMargin != uno::Any() )
xParaProps->setPropertyValue("ParaFirstLineIndent", aMargin);
+ else if (isNumberingViaStyle)
+ {
+ const sal_Int32 nFirstLineIndent = getNumberingProperty(nListId, pStyleSheetProperties->GetListLevel(), "FirstLineIndent");
+ if (nFirstLineIndent != 0)
+ xParaProps->setPropertyValue("ParaFirstLineIndent", uno::makeAny(nFirstLineIndent));
+ }
}
}
}