summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-11-15 10:37:42 +0100
committerLászló Németh <nemeth@numbertext.org>2019-11-18 15:06:40 +0100
commit28444a2cf7ac637a0161733121c59de82bc7e4db (patch)
tree1b7633a6708d66759a1edd453117db8b5348016b /writerfilter
parent3d57d82dc782588f7e2fa55a39a9d20ab23401cd (diff)
tdf#128752 DOCX: fix partial direct paragraph spacing in tables
When direct formatting of a table paragraph set only top margin, but not the bottom margin, also there was no paragraph style setting for the bottom margin, the paragraph was imported using docDefault bottom spacing instead of the table style bottom spacing. Change-Id: Ib7f5f80dd2485a0fd4ab8e0645b7d730a7ec3c5c Reviewed-on: https://gerrit.libreoffice.org/82771 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit d8f3f8ecd9e6304f3a98ab03fae6bc545893f782) Reviewed-on: https://gerrit.libreoffice.org/82789
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx13
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx5
3 files changed, 20 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index be87c2c3785f..efbaf3a0ffc3 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1099,6 +1099,10 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
uno::Reference<table::XCellRange> xCellRange(xTable, uno::UNO_QUERY);
uno::Any aBottomMargin = pTableProp->Value;
sal_Int32 nRows = aCellProperties.getLength();
+
+ for (const auto& rParaProp : m_rDMapper_Impl.m_aPendingParaProp )
+ rParaProp->setPropertyValue("ParaBottomMargin", aBottomMargin );
+
for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
{
const uno::Sequence< beans::PropertyValues > aCurrentRow = aCellProperties[nRow];
@@ -1184,6 +1188,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
m_aCellProperties.clear();
m_aRowProperties.clear();
m_bHadFootOrEndnote = false;
+ m_rDMapper_Impl.m_aPendingParaProp.clear();
#ifdef DBG_UTIL
TagLogger::getInstance().endElement();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0ba1c83673d1..52a0418abd92 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -792,9 +792,9 @@ OUString DomainMapper_Impl::GetDefaultParaStyleName()
return m_sDefaultParaStyleName;
}
-uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara)
+uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, const bool bStyles)
{
- while(pEntry.get( ) )
+ while( bStyles && pEntry.get( ) )
{
if(pEntry->pProperties)
{
@@ -1722,7 +1722,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
{
uno::Any aMargin = GetPropertyFromParaStyleSheet(PROP_PARA_BOTTOM_MARGIN);
if ( aMargin != uno::Any() )
+ {
xParaProps->setPropertyValue("ParaBottomMargin", aMargin);
+
+ // table style has got bigger precedence than docDefault style
+ // collect these pending paragraph properties to process in endTable()
+ // TODO check the case, when two parent styles modify the docDefault and the last one set back the docDefault value
+ uno::Any aMarginDocDefault = GetPropertyFromStyleSheet(PROP_PARA_BOTTOM_MARGIN, nullptr, true, true, false);
+ if ( m_nTableDepth > 0 && aMargin == aMarginDocDefault )
+ m_aPendingParaProp.push_back(xParaProps);
+ }
}
if ( !bContextSet )
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index b3b85cde08c2..e21ed16a2d52 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -726,7 +726,7 @@ public:
OUString GetDefaultParaStyleName();
// specified style - including inherited properties. Indicate whether paragraph defaults should be checked.
- css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara);
+ css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, const bool bStyles = true);
// current paragraph style - including inherited properties
css::uno::Any GetPropertyFromParaStyleSheet(PropertyIds eId);
// context's character style - including inherited properties
@@ -1035,6 +1035,9 @@ public:
bool m_bIsActualParagraphFramed;
std::vector<css::uno::Any> aFramedRedlines;
+ /// Table paragraph properties may need style update based on table style
+ std::vector<css::uno::Reference<css::beans::XPropertySet>> m_aPendingParaProp;
+
private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ;