[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 9 17:24:40 UTC 2021


 sc/qa/extras/scpdfexport.cxx                            |   19 ++++++++++++++++
 sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods |binary
 sc/source/ui/view/printfun.cxx                          |    7 ++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 81f4d72a827942ce482e381e55302a1e6700049e
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Thu Jul 15 15:50:09 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Aug 9 19:24:05 2021 +0200

    tdf#64703 sc: fix regression of printing page breaks
    
    After hidden rows or rows hidden by Autofilter,
    printing removed the page breaks between the visible
    rows, too. Now Calc supports WYSWYG: it prints all the
    visible page breaks, which includes the page breaks
    between the visible rows, and page breaks between the
    hidden rows (multiple page breaks of a hidden row
    sequence converted to a single page break).
    
    This was a regression since LO 3.6, introducing
    Autofilter with multichoice.
    
    Co-authored-by: Tibor Nagy (NISZ)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118984
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 8b2a2de2481843502f0566e773ed11532520bc70)
    
    Check nNextPageBreak for ScRowBreakIterator::NOT_FOUND, tdf#64703 follow-up
    
    Ifa0fd1b53da70018d8d14abd4f8ba347908d5ea9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119732
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    
    Change-Id: I87858d36fc62b8a5952cfd5bc39dbe90f1452ac0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119620
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index b98ee774b7ee..e06620827e4f 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -65,11 +65,13 @@ public:
     void testExportRange_Tdf120161();
     void testExportFitToPage_Tdf103516();
     void testUnoCommands_Tdf120161();
+    void testTdf64703_hiddenPageBreak();
 
     CPPUNIT_TEST_SUITE(ScPDFExportTest);
     CPPUNIT_TEST(testExportRange_Tdf120161);
     CPPUNIT_TEST(testExportFitToPage_Tdf103516);
     CPPUNIT_TEST(testUnoCommands_Tdf120161);
+    CPPUNIT_TEST(testTdf64703_hiddenPageBreak);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -438,6 +440,23 @@ void ScPDFExportTest::testUnoCommands_Tdf120161()
     }
 }
 
+void ScPDFExportTest::testTdf64703_hiddenPageBreak()
+{
+    mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
+                                      + "tdf64703_hiddenPageBreak.ods",
+                                  "com.sun.star.sheet.SpreadsheetDocument");
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+
+    // A1:A11: 4-page export
+    {
+        ScRange range1(0, 0, 0, 0, 10, 0);
+        std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1);
+        bool bFound = false;
+        CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 4>>", bFound));
+        CPPUNIT_ASSERT_EQUAL(true, bFound);
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPDFExportTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods b/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods
new file mode 100644
index 000000000000..87f110915d69
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods differ
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 950fa944a183..782af0a440bf 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -3197,8 +3197,11 @@ void PrintPageRanges::calculate(ScDocument& rDoc,
             nLastVisibleRow = nLastRow;
         }
         else
-            // skip all hidden rows.
-            nRow = nLastRow;
+        {
+            // Skip all hidden rows until next pagebreak.
+            nRow = ((nNextPageBreak == ScRowBreakIterator::NOT_FOUND) ? nLastRow :
+                    std::min(nLastRow, nNextPageBreak - 1));
+        }
     }
 
     if (!bVisRow)


More information about the Libreoffice-commits mailing list