summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-01-17 12:41:11 +0000
committerMichael Stahl <mstahl@redhat.com>2013-01-18 00:44:00 +0100
commit7872f3d93f415c945c07f393380b60c7f584a244 (patch)
treec4b0b3cca889c784457144fe108edfa930396c52
parent08fe57d99c7bbf17b21ec14ced945f68f0a89a52 (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.cxx8
-rw-r--r--xmloff/source/text/txtimppr.cxx23
2 files changed, 30 insertions, 1 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index f281d579211d..51e53cdcc34f 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -455,6 +455,8 @@ void XMLTextExportPropertySetMapper::ContextFilter(
XMLPropertyState* pClip11State = NULL;
XMLPropertyState* pClipState = NULL;
+ // filter fo:margin
+ XMLPropertyState* pAllParaMarginRel = NULL;
XMLPropertyState* pAllParaMargin = NULL;
XMLPropertyState* pAllMargin = NULL;
@@ -572,6 +574,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;
}
@@ -625,6 +628,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 be8ef018da05..ef9758ae9147 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -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(
::std::vector< XMLPropertyState >& rProperties,
sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
@@ -425,7 +445,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(