diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-01-17 12:41:11 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-01-18 00:49:03 +0100 |
commit | abb84c2cce54a903ef846cbfe297b2bbc62ff260 (patch) | |
tree | 8220813d18f1d83d42c94a7edd0ee2e6723c435e | |
parent | 598223e6f828f0e4bedf3f9840703d14f4316048 (diff) |
Resolves: fdo#58730 workaround [UL|LR]Space 100% problem
If all paragraph margins are 100% on import, ignore that as being the implicit
default. That avoids explicit 100% being set onto the awesome [UL|LR]Space
which takes a relative propsize of 100% as a flag that its value field is
absolute and so rejected by SwTxtFmtColl::Modify as a candidate for getting its
true value initialized relative to its parent, so it ends up as an absolute 0
Always elide the property on export because writing individual
margin-foos provides better backward compatibility with older versions
anyway.
Trigged by 3c5facfce42a0dbe362d6b9fa5ac374fd76f51a1
Change-Id: I55f6ceeae287b7d8e99befa4bd3cc06738a21299
(cherry picked from commit 23c099a0236062724430efb986251637095c8d4f)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 23 |
2 files changed, 30 insertions, 1 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 67341bd0fc7b..c84774eed16e 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -463,6 +463,8 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClipState = NULL; + // filter fo:margin + XMLPropertyState* pAllParaMarginRel = NULL; XMLPropertyState* pAllParaMargin = NULL; XMLPropertyState* pAllMargin = NULL; @@ -580,6 +582,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break; case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break; + case CTF_PARAMARGINALL_REL: pAllParaMarginRel = propertie; break; case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; case CTF_MARGINALL: pAllMargin = propertie; break; } @@ -633,6 +636,11 @@ void XMLTextExportPropertySetMapper::ContextFilter( lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); + if (pAllParaMarginRel) + { // because older OOo/LO versions can't read fo:margin: + pAllParaMarginRel->mnIndex = -1; // just export individual attributes... + pAllParaMarginRel->maValue.clear(); + } if (pAllParaMargin) { pAllParaMargin->mnIndex = -1; // just export individual attributes... diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 8c6d0aa635b1..49e8d925c023 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -266,6 +266,26 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( } } +//fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as +//a flag that the value is an absolute value so we can't truly handle an +//up/lower space property which wants to specify its 200% upper but 100% lower +//of its parent (try typing 100% vs 200% into the edit style dialog and revisit +//your style). So on xml load that ends up meaning 200%, 0 lower. This is a +//crock. +// +//On import clear 100% all-margins relative sizes. +static bool +isNotDefaultRelSize(const XMLPropertyState* pRelState, const UniReference<XMLPropertySetMapper>& rPrMap) +{ + if (rPrMap->GetEntryContextId(pRelState->mnIndex) == CTF_PARAMARGINALL_REL) + { + sal_Int32 nTemp = 0; + pRelState->maValue >>= nTemp; + return nTemp != 100; + } + return true; +} + void XMLTextImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& rProperties, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const @@ -434,7 +454,8 @@ void XMLTextImportPropertyMapper::finished( for (sal_uInt16 i = 0; i < 4; i++) { - if (pAllParaMargin && !pParaMargins[i]) + if (pAllParaMargin && !pParaMargins[i] + && isNotDefaultRelSize(pAllParaMargin, getPropertySetMapper())) { #if OSL_DEBUG_LEVEL > 0 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( |