summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
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)
{