[Libreoffice-commits] core.git: writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 06:55:23 UTC 2018


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Tue Jul 17 19:46:22 2018 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jul 18 08:55:01 2018 +0200

    tdf#118521 DOCX import: fix paragraph margin from paragraph style
    
    when the other (top or bottom) margin was set by direct formatting.
    
    Change-Id: Ic4038397329374fb2d6cf974751310f7dd8e8b31
    Reviewed-on: https://gerrit.libreoffice.org/57585
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 00effcd10081..e89417e99468 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1415,6 +1415,31 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
                                  uno::makeAny( ConversionHelper::convertTwipToMM100(nSize)));
                     }
                 }
+
+                // tdf#118521 set paragraph top or bottom margin based on the paragraph style
+                // if we already set the other margin with direct formatting
+                if (pParaContext && m_xPreviousParagraph.is() &&
+                        pParaContext->isSet(PROP_PARA_TOP_MARGIN) != pParaContext->isSet(PROP_PARA_BOTTOM_MARGIN))
+                {
+                    const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( GetCurrentParaStyleName() );
+                    OSL_ENSURE( pEntry.get(), "no style sheet found" );
+                    const StyleSheetPropertyMap* pStyleSheetProperties =
+                            dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr);
+                    if (pStyleSheetProperties) {
+                        boost::optional<PropertyMap::Property> oProperty;
+                        if (pParaContext->isSet(PROP_PARA_TOP_MARGIN))
+                        {
+                            if ( (oProperty = pStyleSheetProperties->getProperty(PROP_PARA_BOTTOM_MARGIN)) )
+                                m_xPreviousParagraph->setPropertyValue("ParaBottomMargin", oProperty->second);
+                        }
+                        else
+                        {
+                            if ( (oProperty = pStyleSheetProperties->getProperty(PROP_PARA_TOP_MARGIN)) )
+                                m_xPreviousParagraph->setPropertyValue("ParaTopMargin", oProperty->second);
+                        }
+                    }
+                }
+
             }
             if( !bKeepLastParagraphProperties )
                 rAppendContext.pLastParagraphProperties = pToBeSavedProperties;


More information about the Libreoffice-commits mailing list