summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-01-17 13:18:09 -0500
committerMiklos Vajna <vmiklos@collabora.com>2024-01-19 09:03:03 +0100
commit3f50503a69bc92e3a0c6c36686d8ff37d77188bf (patch)
tree9b4f92afb563e2c2b5975f3181d75b9c6f59938a /writerfilter
parent2bc1c113a4b37e97d9faf9c88aec01d5a0af7dae (diff)
tdf#159158 DOCX import: relativeHeights of 0/1 are highest zOrder #2
I thought I had removed all fallback stuff from the unit tests, but I was wrong. So do some general clean-up and simplification. I also needed to fix the maximum value for relativeHeight. Sadly, even my my unit test was wrong - since MS Word 2010 clearly showed the yellow star on the top for tdf159158_zOrder_max.docx. FIXED. I can't put my finger on why sometimes 0F00 0000 is a maximum... More testing suggests that generally the max is 01dff ffff. Again, this is based on testing since documentation makes no reference at all to a maximum. I also wonder if the last 10 bits aren't magical somehow... The previous max didn't sound right because there are so many unit tests with relativeHeights above 0F00 0000 (and the values jump by 0400). RTF almost never uses GraphicImport, and no unit tests access relativeHeight, only behindDoc. It is used for IMPORT_AS_DETECTED_INLINE and passing arbitrary property-names and values to a shape (via \sp \sv). Thus, this change is DOCX only (effectively). Change-Id: I18c0e129a078abe5987b998b15697f4ae1a50a96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162232 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index c8a1e166d472..cacae807b48d 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -739,9 +739,10 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
break;
case NS_ooxml::LN_CT_Anchor_relativeHeight: // unsigned content
{
- // undocumented - based on testing: both 0 and 1 are equivalent to the maximum 251658240
- if (nIntValue < 2/* || nIntValue > 0x0F000000*/)
- m_pImpl->m_zOrder = 0x0F000000;
+ // undocumented - based on testing: both 0 and 1 are equivalent to the maximum 503316479
+ const sal_Int32 nMaxAllowed = 0x1DFFFFFF;
+ if (nIntValue < 2/* || nIntValue > nMaxAllowed*/)
+ m_pImpl->m_zOrder = nMaxAllowed;
else
m_pImpl->m_zOrder = nIntValue;
}