summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf135187.docxbin0 -> 19696 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx17
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx12
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx4
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx2
5 files changed, 33 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135187.docx b/sw/qa/extras/ooxmlexport/data/tdf135187.docx
new file mode 100644
index 000000000000..98a151048f08
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135187.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index bc80088f7a94..a80b76a21223 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1222,6 +1222,23 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105215, "tdf105215.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[5]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135187, "tdf135187.docx")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:p/w:pPr/w:rPr/w:b", 0);
+ // FIXME: remove duplicate
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[1]/w:p/w:pPr/w:rPr/w:b", 2);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:p/w:pPr/w:rPr/w:b", 2);
+
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", 1);
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", "val");
+ // This was 0
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", 1);
+ assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", "val");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:p/w:r[1]/w:rPr/w:b", "val", "false");
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index b44325fa06d3..02baba345d58 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1094,7 +1094,8 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
{
// apply paragraph and character properties of the table style on table paragraphs
// if there is no direct paragraph formatting
- if ( !rParaProp.m_pPropertyMap->isSet(eId) )
+ bool bIsParaLevel = rParaProp.m_pPropertyMap->isSet(eId);
+ if ( !bIsParaLevel || isCharacterProperty(eId) )
{
if ( (eId == PROP_PARA_LEFT_MARGIN || eId == PROP_PARA_FIRST_LINE_INDENT) &&
rParaProp.m_pPropertyMap->isSet(PROP_NUMBERING_RULES) )
@@ -1104,6 +1105,15 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag
}
OUString sPropertyName = getPropertyName(eId);
+
+ if ( bIsParaLevel && ( rParaProp.m_aParaOverrideApplied.find(sPropertyName) != rParaProp.m_aParaOverrideApplied.end() ||
+ sPropertyName.startsWith("CharFontName") ) )
+ {
+ // don't apply table style, if this character property was applied on paragraph level
+ // (or in the case of paragraph level font name settings to avoid regressions)
+ continue;
+ }
+
auto pCellProp = std::find_if(rCellProperties.begin(), rCellProperties.end(),
[&](const beans::PropertyValue& rProp) { return rProp.Name == sPropertyName; });
// this cell applies the table style property
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 333f1170ea09..d720e53a2a53 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1877,7 +1877,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
xParaCursor->gotoStartOfParagraph(false);
if (m_nTableDepth > 0)
{
- TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps};
+ TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps, std::set<OUString>()};
getTableManager().getCurrentParagraphs()->push_back(aPending);
}
@@ -1995,6 +1995,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
{
uno::Reference<beans::XPropertySet> xRunPropertySet(xCur, uno::UNO_QUERY);
xParaProps->setPropertyValue( rParaProp.Name, xRunPropertySet->getPropertyValue(rParaProp.Name) );
+ // remember this for table style handling
+ getTableManager().getCurrentParagraphs()->back().m_aParaOverrideApplied.insert(rParaProp.Name);
}
}
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 0ac658f7674d..c48d52803ee1 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -33,6 +33,7 @@
#include <optional>
#include <map>
#include <vector>
+#include <set>
namespace com::sun::star {
namespace beans {
@@ -594,6 +595,7 @@ struct TableParagraph
css::uno::Reference<css::text::XTextRange> m_rEndParagraph;
PropertyMapPtr m_pPropertyMap;
css::uno::Reference<css::beans::XPropertySet> m_rPropertySet;
+ std::set<OUString> m_aParaOverrideApplied;
};
typedef std::shared_ptr< std::vector<TableParagraph> > TableParagraphVectorPtr;