Kaydet (Commit) 23c099a0 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Michael Stahl

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 3c5facfc

Change-Id: I55f6ceeae287b7d8e99befa4bd3cc06738a21299
üst 17b264b2
...@@ -455,6 +455,8 @@ void XMLTextExportPropertySetMapper::ContextFilter( ...@@ -455,6 +455,8 @@ void XMLTextExportPropertySetMapper::ContextFilter(
XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClip11State = NULL;
XMLPropertyState* pClipState = NULL; XMLPropertyState* pClipState = NULL;
// filter fo:margin
XMLPropertyState* pAllParaMarginRel = NULL;
XMLPropertyState* pAllParaMargin = NULL; XMLPropertyState* pAllParaMargin = NULL;
XMLPropertyState* pAllMargin = NULL; XMLPropertyState* pAllMargin = NULL;
...@@ -572,6 +574,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( ...@@ -572,6 +574,7 @@ void XMLTextExportPropertySetMapper::ContextFilter(
case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break; case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break;
case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP11: pClip11State = propertie; break;
case CTF_TEXT_CLIP: pClipState = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break;
case CTF_PARAMARGINALL_REL: pAllParaMarginRel = propertie; break;
case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; case CTF_PARAMARGINALL: pAllParaMargin = propertie; break;
case CTF_MARGINALL: pAllMargin = propertie; break; case CTF_MARGINALL: pAllMargin = propertie; break;
} }
...@@ -625,6 +628,11 @@ void XMLTextExportPropertySetMapper::ContextFilter( ...@@ -625,6 +628,11 @@ void XMLTextExportPropertySetMapper::ContextFilter(
lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); 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) if (pAllParaMargin)
{ {
pAllParaMargin->mnIndex = -1; // just export individual attributes... pAllParaMargin->mnIndex = -1; // just export individual attributes...
......
...@@ -257,6 +257,26 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( ...@@ -257,6 +257,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( void XMLTextImportPropertyMapper::finished(
::std::vector< XMLPropertyState >& rProperties, ::std::vector< XMLPropertyState >& rProperties,
sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
...@@ -425,7 +445,8 @@ void XMLTextImportPropertyMapper::finished( ...@@ -425,7 +445,8 @@ void XMLTextImportPropertyMapper::finished(
for (sal_uInt16 i = 0; i < 4; i++) for (sal_uInt16 i = 0; i < 4; i++)
{ {
if (pAllParaMargin && !pParaMargins[i]) if (pAllParaMargin && !pParaMargins[i]
&& isNotDefaultRelSize(pAllParaMargin, getPropertySetMapper()))
{ {
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment