summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-03-28 09:06:09 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-30 16:58:52 +0200
commit2c98939545d80198d37e2df23d5342105b50a557 (patch)
tree1019d5daeb4938dde61d8ca1f4c1efc7b28446dc /writerfilter
parent5a71e1e80def5bac7931e580ffc2203659802947 (diff)
tdf#106694 RTF import: fix missing paragraph tab position
The problem here was that while in general paragraph style / direct formatting deduplication is supposed to happen in the tokenizer, paragraph tab positions is an exception, and dmapper expects to see the duplicated tokens. Fix the problem by introducing a blacklist that contains tokens not to deduplicate. Change-Id: I1cca53e99cfdb082df389ff295f3447cc8f9d3b8 Reviewed-on: https://gerrit.libreoffice.org/35790 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit fea174753b1c6b0882aebb044bf1a1eef6fa50e0)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfsprm.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index da7bc815c6ca..7afee14a4189 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -153,6 +153,23 @@ static RTFValue::Pointer_t getDefaultSPRM(Id const id)
}
}
+/// Is it problematic to deduplicate this SPRM?
+static bool isSPRMDeduplicateBlacklist(Id nId)
+{
+ switch (nId)
+ {
+ case NS_ooxml::LN_CT_TabStop_val:
+ case NS_ooxml::LN_CT_TabStop_leader:
+ case NS_ooxml::LN_CT_TabStop_pos:
+ // See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
+ // deduplication is explicitly not wanted for these tokens.
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/// Does the clone / deduplication of a single sprm.
static void cloneAndDeduplicateSprm(std::pair<Id, RTFValue::Pointer_t>& rSprm, RTFSprms& ret)
{
@@ -161,7 +178,8 @@ static void cloneAndDeduplicateSprm(std::pair<Id, RTFValue::Pointer_t>& rSprm, R
{
if (rSprm.second->equals(*pValue))
{
- ret.erase(rSprm.first); // duplicate to style
+ if (!isSPRMDeduplicateBlacklist(rSprm.first))
+ ret.erase(rSprm.first); // duplicate to style
}
else if (!rSprm.second->getSprms().empty() || !rSprm.second->getAttributes().empty())
{