[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - sw/qa sw/source vcl/quartz

Bartosz Kosiorek gang65 at poczta.onet.pl
Mon Jul 9 14:47:55 UTC 2018


 sw/qa/extras/ww8export/data/tdf117885.doc |binary
 sw/qa/extras/ww8export/data/tdf118412.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx     |   29 +++++++++++++++++++++++++++++
 sw/source/filter/ww8/ww8par6.cxx          |   16 +++++++++++-----
 vcl/quartz/salbmp.cxx                     |   12 ++++++------
 5 files changed, 46 insertions(+), 11 deletions(-)

New commits:
commit 066917dcb517f114742dac602d3b7c290ab90999
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Thu Jun 28 09:52:50 2018 +0200

    tdf#117335 Fix displaying GIF images
    
    To fix regression the sal_uInt16 was used instead of sal_uInt8.
    Verified on macOS High Sierra 10.13.5.
    I also checked if with this fix, there is no issue with displaying EMF (tdf#113197)
    Sample document from tdf#113197 is displaying correctly.
    
    Change-Id: I6504717d831a193b0a878ced2f335d34a993aed6
    Reviewed-on: https://gerrit.libreoffice.org/56578
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
    (cherry picked from commit 054a3586bb4808728a5cd58ea8a867539c08e55c)
    Reviewed-on: https://gerrit.libreoffice.org/56668
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 34bba6eaa404f5a081dcc28f9cca7fd55a10fe0c)

diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index a74f6096bf5a..60a16503f3d2 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -451,13 +451,13 @@ class ImplPixelFormat8 : public ImplPixelFormat
 private:
     sal_uInt8* pData;
     const BitmapPalette& mrPalette;
-    const sal_uInt8 mnPaletteCount;
+    const sal_uInt16 mnPaletteCount;
 
 public:
     explicit ImplPixelFormat8( const BitmapPalette& rPalette )
         : pData(nullptr)
         , mrPalette(rPalette)
-        , mnPaletteCount(static_cast< sal_uInt8 >(rPalette.GetEntryCount()))
+        , mnPaletteCount(rPalette.GetEntryCount())
         {
         }
     virtual void StartLine( sal_uInt8* pLine ) override { pData = pLine; }
@@ -489,7 +489,7 @@ class ImplPixelFormat4 : public ImplPixelFormat
 private:
     sal_uInt8* pData;
     const BitmapPalette& mrPalette;
-    const sal_uInt8 mnPaletteCount;
+    const sal_uInt16 mnPaletteCount;
     sal_uInt32 mnX;
     sal_uInt32 mnShift;
 
@@ -497,7 +497,7 @@ public:
     explicit ImplPixelFormat4( const BitmapPalette& rPalette )
         : pData(nullptr)
         , mrPalette(rPalette)
-        , mnPaletteCount(static_cast< sal_uInt8 >(rPalette.GetEntryCount()))
+        , mnPaletteCount(rPalette.GetEntryCount())
         , mnX(0)
         , mnShift(0)
         {
@@ -545,14 +545,14 @@ class ImplPixelFormat1 : public ImplPixelFormat
 private:
     sal_uInt8* pData;
     const BitmapPalette& mrPalette;
-    const sal_uInt8 mnPaletteCount;
+    const sal_uInt16 mnPaletteCount;
     sal_uInt32 mnX;
 
 public:
     explicit ImplPixelFormat1( const BitmapPalette& rPalette )
         : pData(nullptr)
         , mrPalette(rPalette)
-        , mnPaletteCount(static_cast< sal_uInt8 >(rPalette.GetEntryCount()))
+        , mnPaletteCount(rPalette.GetEntryCount())
         , mnX(0)
         {
         }
commit ff05c6b3b589e408fd77508021ae27310d23dff2
Author: Luke Deller <luke at deller.id.au>
Date:   Thu May 31 23:16:26 2018 +1000

    Fix top margin in DOC import for tdf#117885
    
    When calculating the height of the top/bottom margin, we take into
    account whether the DOC section has a header/footer enabled.
    
    If the DOC section contains only a first-page header/footer, and the
    display of first-page header/footer in this section is not enabled,
    then we must consider the section to have no header/footer.
    
    (Also add a test case using the doc supplied by the reporter in
     tdf#117885)
    
    Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e
    Reviewed-on: https://gerrit.libreoffice.org/55135
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 6c68e52532d45c97a83b2396bd40c98ade9b5bb4)
    
    Squashed with fixup commit from https://gerrit.libreoffice.org/56602
    for tdf#118412: DOC incorrect bottom page margin
    
    Change-Id: I8040298a2953b3f3fe8dd80bfd62db2304db938e
    Reviewed-on: https://gerrit.libreoffice.org/55466
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 3db1874044c24dadfb2f273d0e57e15bdcada1f5)

diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc
new file mode 100644
index 000000000000..bf8d0ef03d61
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117885.doc differ
diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc
new file mode 100644
index 000000000000..ef9b26cb3af8
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118412.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 7a7dcf7e8db1..6dc7d16cd989 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -764,6 +764,35 @@ DECLARE_OOXMLEXPORT_TEST( testObjectCrossReference, "object_cross_reference.odt"
     }
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc")
+{
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+
+    /* Get the vertical position of the paragraph containing the text "Start" */
+    sal_Int32 nParaA_Top = getXPath(pXmlDoc,
+        "/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", "top"
+        ).toInt32();
+
+    /* Get the vertical position of the paragraph containing the text "Top B" */
+    sal_Int32 nParaB_Top = getXPath(pXmlDoc,
+        "/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", "top"
+        ).toInt32();
+
+    /* These two paragraphs are supposed to be at the top of the left
+     * and right columns respectively.  Check that they actually line up: */
+    CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top);
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc")
+{
+    /* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */
+    OUString sPageStyleName = getProperty<OUString>(getParagraph(1), "PageStyleName");
+    uno::Reference<style::XStyle> xPageStyle(
+        getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY);
+    sal_Int32 nBottomMargin = getProperty<sal_Int32>(xPageStyle, "BottomMargin");
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1251), nBottomMargin);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e8b228060a51..b7bb004805ee 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -532,8 +532,17 @@ void wwSectionManager::GetPageULData(const wwSection &rSection,
         nWWUp += rSection.maSep.dzaGutter;
     }
 
-    rData.bHasHeader = (rSection.maSep.grpfIhdt &
-        (WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0;
+    /* Check whether this section has headers / footers */
+    sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD;
+    sal_uInt16 nFooterMask = WW8_FOOTER_EVEN | WW8_FOOTER_ODD;
+    /* Ignore the presence of a first-page header/footer unless it is enabled */
+    if( rSection.HasTitlePage() )
+    {
+        nHeaderMask |= WW8_HEADER_FIRST;
+        nFooterMask |= WW8_FOOTER_FIRST;
+    }
+    rData.bHasHeader = (rSection.maSep.grpfIhdt & nHeaderMask) != 0;
+    rData.bHasFooter = (rSection.maSep.grpfIhdt & nFooterMask) != 0;
 
     if( rData.bHasHeader )
     {
@@ -554,9 +563,6 @@ void wwSectionManager::GetPageULData(const wwSection &rSection,
     else // no header -> just use Up as-is
         rData.nSwUp = std::abs(nWWUp);
 
-    rData.bHasFooter = (rSection.maSep.grpfIhdt &
-        (WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST)) != 0;
-
     if( rData.bHasFooter )
     {
         rData.nSwLo = nWWFBot;              // footer -> convert


More information about the Libreoffice-commits mailing list