[Libreoffice-commits] core.git: sc/qa sc/source
Attila Szűcs (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 30 14:31:33 UTC 2021
sc/qa/extras/scpdfexport.cxx | 19 ++++++++++++++++
sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods |binary
sc/source/ui/view/printfun.cxx | 6 +++--
3 files changed, 23 insertions(+), 2 deletions(-)
New commits:
commit 8b2a2de2481843502f0566e773ed11532520bc70
Author: Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Thu Jul 15 15:50:09 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Jul 30 16:30:52 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)
Change-Id: I87858d36fc62b8a5952cfd5bc39dbe90f1452ac0
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>
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index 6dfa426fddc0..825c4e248403 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();
};
@@ -437,6 +439,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 e02e4badcab6..0fc79a76b397 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -3197,8 +3197,10 @@ void PrintPageRanges::calculate(ScDocument& rDoc,
nLastVisibleRow = nLastRow;
}
else
- // skip all hidden rows.
- nRow = nLastRow;
+ {
+ // Skip all hidden rows until next pagebreak.
+ nRow = std::min(nLastRow, nNextPageBreak - 1);
+ }
}
if (!bVisRow)
More information about the Libreoffice-commits
mailing list