[libreoffice/f18] Resolves: fdo#58730 ODF fo:margin 100% bug
Michael Stahl
mstahl at fedoraproject.org
Fri Jan 18 11:24:57 UTC 2013
commit c93eaca2316fb7856e7fd53894eac508379a3504
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jan 18 12:24:43 2013 +0100
Resolves: fdo#58730 ODF fo:margin 100% bug
...o-58730-workaround-UL-LR-Space-100-proble.patch | 103 ++++++++++++++++++++
libreoffice.spec | 7 +-
2 files changed, 109 insertions(+), 1 deletions(-)
---
diff --git a/0001-Resolves-fdo-58730-workaround-UL-LR-Space-100-proble.patch b/0001-Resolves-fdo-58730-workaround-UL-LR-Space-100-proble.patch
new file mode 100644
index 0000000..731627b
--- /dev/null
+++ b/0001-Resolves-fdo-58730-workaround-UL-LR-Space-100-proble.patch
@@ -0,0 +1,103 @@
+From abb84c2cce54a903ef846cbfe297b2bbc62ff260 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Thu, 17 Jan 2013 12:41:11 +0000
+Subject: [PATCH] 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 at redhat.com>
+---
+ xmloff/source/text/txtexppr.cxx | 8 ++++++++
+ xmloff/source/text/txtimppr.cxx | 23 ++++++++++++++++++++++-
+ 2 files changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
+index 67341bd..c84774e 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 8c6d0aa..49e8d92 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(
+--
+1.7.11.7
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 8108eaa..82f6835 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -44,7 +44,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.3
-Release: 2%{?libo_prerelease}%{?dist}
+Release: 3%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity
URL: http://www.documentfoundation.org/develop
@@ -253,6 +253,7 @@ Patch32: libreoffice-rhel6poppler.patch
Patch33: libreoffice-rhel6langs.patch
Patch34: 0001-rhbz-891082-CMXDocument-isSupported-catch-exceptions.patch
%endif
+Patch35: 0001-Resolves-fdo-58730-workaround-UL-LR-Space-100-proble.patch
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define instdir %{_libdir}
@@ -999,6 +1000,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch33 -p1 -b .rhel6langs.patch
%patch34 -p1 -b .rhbz-891082-CMXDocument-isSupported-catch-exceptions.patch
%endif
+%patch35 -p1 -b .Resolves-fdo-58730-workaround-UL-LR-Space-100-proble.patch
# TODO: check this
# these are horribly incomplete--empty translations and copied english
@@ -2266,6 +2268,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
+* Fri Jan 18 2013 Michael Stahl <mstahl at redhat.com> - 1:3.6.4.3-3-UNBUILT
+- Resolves: fdo#58730 ODF fo:margin 100% bug
+
* Sat Jan 05 2013 Michael Stahl <mstahl at redhat.com> - 1:3.6.4.3-2
- Resolves: rhbz#891082 catch libcdr exceptions
- Resolves: rhbz#885156 lockup when opening file over SMB
More information about the scm-commits
mailing list