[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-5' - 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Sat Jun 7 07:40:17 PDT 2014


 sw/source/filter/ww8/ww8graf.cxx |   10 ++++++++--
 sw/source/ui/shells/txtattr.cxx  |    4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit a710e9307153885537ea3a0257b533bd6b8d2df3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 27 13:27:37 2014 +0200

    fdo#77454: sw: ww8 import: add heuristic to ignore mangled crop values
    
    Older versions of OOo/LO would mangle negative crop values on round-trip
    of WW8, which now (since the drawing-layer does not ignore them) causes
    the images to be rendered invisible; probably large factors don't make
    sense anyway, so ignore the crop if it's 50x the image size, which
    happens to work for the bugdoc.
    
    Change-Id: I9f36d37e3be27234554bc91e80bfe719b1ce86af
    (cherry picked from commit 7e91dd0a3885ac561aee9cf7907632677b9886c1)
    Reviewed-on: https://gerrit.libreoffice.org/9508
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit a1f385b74a542ab3caaa8abbefc39f14bf27ca72)
    Reviewed-on: https://gerrit.libreoffice.org/9531
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 8051810..6a29887 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1994,8 +1994,14 @@ void SwWW8ImplReader::MapWrapIntoFlyFmt(SvxMSDffImportRec* pRecord,
 static sal_Int32 lcl_ConvertCrop(sal_uInt32 const nCrop, sal_Int32 const nSize)
 {
     // cast to sal_Int32 to handle negative crop properly
-    return ((static_cast<sal_Int32>(nCrop) >> 16) * nSize)
-              + (((nCrop & 0xffff) * nSize) >> 16) ;
+    sal_Int32 const nIntegral(static_cast<sal_Int32>(nCrop) >> 16);
+    // fdo#77454: heuristic to detect mangled values written by old OOo/LO
+    if (abs(nIntegral) >= 50) // FIXME: what's a good cut-off?
+    {
+        SAL_INFO("sw.ww8", "ignoring suspiciously large crop: " << nIntegral);
+        return 0;
+    }
+    return (nIntegral * nSize) + (((nCrop & 0xffff) * nSize) >> 16);
 }
 
 void
commit c5607ee9ab4a55521c5a72a015c3c5f371fccfc3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed May 28 23:05:28 2014 +0200

    fdo#78737: sw: fix setting tab stops via ruler
    
    The SvxRuler binds the SID_ATTR_PARA_LRSPACE, and its indents and the
    positions of tab stops depend on the values it gets from there; in LO
    4.0 the value came from the SwView::StateTabWin() but now it comes from
    SwTextShell::GetAttrState(), and the difference is that the former does
    a special request to get the NumRule indents as LR-space.
    
    (regression from d02f75a8c36705924ddd6a5921fe3012fafce812)
    
    Change-Id: I548ce188655555f2473cb3973ce7aeb927d1a404
    (cherry picked from commit 7c8b2f10310f0f64b111afb3012e82e9c4a690ac)
    Reviewed-on: https://gerrit.libreoffice.org/9538
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit f9d5d1a7dabb73b16b6528217a26924feb08c1b7)
    Reviewed-on: https://gerrit.libreoffice.org/9562
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 706df62..7c71cde 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -506,7 +506,9 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
     SwWrtShell &rSh = GetShell();
     SfxItemPool& rPool = GetPool();
     SfxItemSet aCoreSet(rPool, aTxtFmtCollSetRange);
-    rSh.GetCurAttr(aCoreSet); // Request *all* text attributes from the core.
+    // Request *all* text attributes from the core.
+    // fdo#78737: this is called from SvxRuler, which requires the list indents!
+    rSh.GetCurAttr(aCoreSet, /* bMergeIndentValuesOfNumRule = */ true);
 
     SfxWhichIter aIter(rSet);
     sal_uInt16 nSlot = aIter.FirstWhich();


More information about the Libreoffice-commits mailing list