summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfsprm.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-04-05 19:30:45 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-04-10 10:51:51 +0200
commit3d74ddd190a5087e0a54ef7b14d0a43006745ec3 (patch)
treec8af061ae29bc376e1df749d4b730863b3d2a3e4 /writerfilter/source/rtftok/rtfsprm.cxx
parentc602bbaa89784681025ae487ad230ed0e86e9acb (diff)
writerfilter: implement RTF derived styles defaulting
It turns out that the situation fixed in commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 also applies to the definition of the styles themselves. To implement the same style import as Word, the style definitions need to be stored twice: once as read from the file, and another time with attributes defaulted and deduplicated vs. the parent style; the second representation is then sent to the domain mapper. To make this easier, add a bool parameter to cloneAndDeduplicate() to disable the implicit pPr dereferencing that happens when creating the hard formatted paragraph properties (this could potentially be cleaned up further if those paragraph properties would use pPr wrapper themselves). Also implement defaulting of line spacing in getDefaultSPRM(). Change-Id: I4810e917697b3af244e5dbdd7f5a45b4767c93fc Reviewed-on: https://gerrit.libreoffice.org/70320 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/rtftok/rtfsprm.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfsprm.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index 3526476249d4..410a1264ca8d 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -160,6 +160,12 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id, Id nStyleType)
case NS_ooxml::LN_CT_Ind_firstLine:
return new RTFValue(0);
+ case NS_ooxml::LN_CT_Spacing_lineRule:
+ return new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto);
+ case NS_ooxml::LN_CT_Spacing_line:
+ // presumably this means 100%, cf. static const int nSingleLineSpacing = 240;
+ return new RTFValue(240);
+
default:
break;
}
@@ -338,7 +344,8 @@ void RTFSprms::duplicateList(const RTFValue::Pointer_t& pAbstract)
}
}
-RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id nStyleType) const
+RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id const nStyleType,
+ bool const bImplicitPPr) const
{
RTFSprms ret(*this);
ret.ensureCopyBeforeWrite();
@@ -351,7 +358,7 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id nStyleType) cons
// paragraphs, but they are below NS_ooxml::LN_CT_Style_pPr in case of
// styles. So handle those children directly, to avoid unexpected
// addition of direct formatting sprms at the paragraph level.
- if (rSprm.first == NS_ooxml::LN_CT_Style_pPr)
+ if (bImplicitPPr && rSprm.first == NS_ooxml::LN_CT_Style_pPr)
{
for (auto& i : rSprm.second->getSprms())
cloneAndDeduplicateSprm(i, ret, nStyleType);