summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-09-06 19:36:48 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-09-17 10:45:40 +0200
commit5ba30f588d6e41a13d68b1461345fca7a7ca61ac (patch)
tree6f098ffd0fb2c75a2c1cbda4e7b82bd65fb8e7dd /writerfilter
parent6e1cb2e9dd406fb2883460cefaa4660622996005 (diff)
tdf#64222 sw: better DOCX import/export of paragraph marker formatting
The problem here is that Word allows formatting the paragraph end marker, and applies the same formatting to the generated numbering string; Writer has no such marker thing. This is currently represented by an empty AUTOFMT hint at the end of the paragraph, which is created almost by accident in SwXText::finishParagraph(), because the paragraph properties are set on a SwPaM that doesn't select the whole paragraph but sits at the end. This is a bit fragile and the hint may have unfortunate accidents such as being merged into a preceding AUTOFMT hint if it happens to have the same items in it. It ought to work better to have an item in SwTextNode's SwAttrSet to store these special items; has the advantage that the items will also be copied when you split the paragraph, like in Word. Add a RES_PARATR_LIST_AUTOFMT and UNO property "ListAutoFormat" (which should be considered a first draft...) and use it in preference (where possible) or in addition to (where necessary due to other missing pieces) the empty hint. Also revert the change in checkApplyParagraphMarkFormatToNumbering() to consider hints that start before the end of the paragraph, as it has unintended side effects as pointed out by Mike Kaganski. Change-Id: Ic1d5dd9db2bab0c5e4594712bb45973aa1442da3 Reviewed-on: https://gerrit.libreoffice.org/78729 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 42521e06e228..192b5ab70130 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1408,7 +1408,37 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
}
std::vector<beans::PropertyValue> aProperties;
if (pPropertyMap.get())
+ {
aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues());
+ }
+ // TODO: this *should* work for RTF but there are test failures, maybe rtftok doesn't distinguish between formatting for the paragraph marker and for the paragraph as a whole; needs investigation
+ if (pPropertyMap.get() && IsOOXMLImport())
+ {
+ // tdf#64222 filter out the "paragraph marker" formatting and
+ // set it as a separate paragraph property, not a empty hint at
+ // end of paragraph
+ std::vector<beans::NamedValue> charProperties;
+ for (auto it = aProperties.begin(); it != aProperties.end(); )
+ {
+ // this condition isn't ideal but as it happens all
+ // RES_CHRATR_* have names that start with "Char"
+ if (it->Name.startsWith("Char")
+// TODO testParagraphMark *wants* this but it's some effort to create a real SwFormatCharFormat...
+ && !it->Name.startsWith("CharStyleName"))
+ {
+ charProperties.emplace_back(it->Name, it->Value);
+ // as testN793262 demonstrates, font size in rPr must
+ // affect the paragraph size => also insert empty hint!
+// it = aProperties.erase(it);
+ }
+ ++it;
+ }
+ if (!charProperties.empty())
+ {
+ aProperties.push_back(beans::PropertyValue("ListAutoFormat",
+ 0, uno::makeAny(comphelper::containerToSequence(charProperties)), beans::PropertyState_DIRECT_VALUE));
+ }
+ }
if( !bIsDropCap )
{
if( aDrop.Lines > 1 )