summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-05-15 13:32:07 +0200
committerLászló Németh <nemeth@numbertext.org>2020-05-18 17:57:43 +0200
commitfb001eab98934c5a4d0a8c6b9563f91337561b87 (patch)
tree6a34134f2d7b0def729b8002bbe6d9be4cedeb05 /sw/source/core/unocore
parent92289c5f121499959b6f5edf859e5f34b5b96a78 (diff)
tdf#127616 DOCX import: fix char style of empty paragraph
When direct character formatting defined in w:pPr/w:rPr overwrites some character style properties (character style defined by w:pPr/w:rPr/w:rStyle), empty paragraphs lost such direct formatting, resulting for example, different page layout by different height of empty paragraphs. Also text of that originally empty paragraphs got different formatting during typing. Co-authored-by: Justin Luth <justin_luth@sil.org> Change-Id: Ic7b3a73d4d7364993cc58073c9e1a09a2711d1b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94308 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unotext.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 9ef0f55dc08c..ee5185b12f2b 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1275,6 +1275,26 @@ SwXText::Impl::finishOrAppendParagraph(
aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH);
SwUnoCursorHelper::SetPropertyValues(aPam, *pParaPropSet, rProperties);
+
+ // tdf#127616 keep direct character formatting of empty paragraphs,
+ // if character style of the paragraph sets also the same attributes
+ if (aPam.Start()->nNode.GetNode().GetTextNode()->Len() == 0)
+ {
+ auto itCharStyle = std::find_if(rProperties.begin(), rProperties.end(), [](const beans::PropertyValue& rValue)
+ {
+ return rValue.Name == "CharStyleName";
+ });
+ if ( itCharStyle != rProperties.end() )
+ {
+ for (const auto& rValue : rProperties)
+ {
+ if ( rValue != *itCharStyle && rValue.Name.startsWith("Char") )
+ {
+ SwUnoCursorHelper::SetPropertyValue(aPam, *pParaPropSet, rValue.Name, rValue.Value);
+ }
+ }
+ }
+ }
}
catch (const lang::IllegalArgumentException& rIllegal)
{