diff options
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 79 |
1 files changed, 23 insertions, 56 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4b07d253eb21..a85590baf5e7 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -646,54 +646,41 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // See SwWW8ImplReader::GetParagraphAutoSpace() on why these are 100 and 280 case NS_ooxml::LN_CT_Spacing_beforeAutospacing: { - sal_Int32 default_spacing = 100; - if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) + sal_Int32 default_spacing = -1; + if (nIntValue) { - // 49 is just the old value that should be removed, once the - // root cause in SwTabFrm::MakeAll() is fixed. - if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web) - default_spacing = 49; - else + m_pImpl->SetParaAutoBefore(true); + + default_spacing = 100; + if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) { - // tdf#104354 first paragraphs of table cells and shapes get zero top margin - if ((m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->m_nTableDepth > 0) || - m_pImpl->GetIsFirstParagraphInShape()) - default_spacing = 0; + // 49 is just the old value that should be removed, once the + // root cause in SwTabFrm::MakeAll() is fixed. + if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web) + default_spacing = 49; else default_spacing = 280; } - } - if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag - { - m_pImpl->SetParaAutoBefore(true); - m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); - } - else - { - default_spacing = -1; + // required at export (here mainly for StyleSheets) to determine if the setting has changed from grab_bag + m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny(ConversionHelper::convertTwipToMM100(default_spacing))); } m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG ); } break; case NS_ooxml::LN_CT_Spacing_afterAutospacing: { - sal_Int32 default_spacing = 100; - - if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) + sal_Int32 default_spacing = -1; + if (nIntValue) { - if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web) - default_spacing = 49; - else - default_spacing = 280; - } - if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag - { - m_pImpl->SetParaAutoAfter(true); - m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); - } - else - { - default_spacing = -1; + default_spacing = 100; + if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) + { + if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web) + default_spacing = 49; + else + default_spacing = 280; + } + m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny(ConversionHelper::convertTwipToMM100(default_spacing))); } m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG ); } @@ -2110,27 +2097,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true ); m_pImpl->SetCurrentParaStyleName( sConvertedStyleName ); if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION) - { m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::makeAny( sConvertedStyleName )); - - if (m_pImpl->GetIsFirstParagraphInShape()) - { - // First paragraph in shape: see if we need to disable - // paragraph top margin from style. - StyleSheetEntryPtr pEntry - = m_pImpl->GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( - sConvertedStyleName); - if (pEntry) - { - boost::optional<PropertyMap::Property> pParaAutoBefore - = pEntry->pProperties->getProperty( - PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING); - if (pParaAutoBefore) - m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, - uno::makeAny(static_cast<sal_Int32>(0))); - } - } - } } break; case NS_ooxml::LN_EG_RPrBase_rStyle: |