tdf#156893: in ScPrintFunc::DrawToDev, row count is not a hint
Before this, the function created at most 1024 rows in ScTableInfo, which is OK for notmal pages, but is limiting whole sheet export. Change-Id: Ie1663147476f56e879673a7532ec9ae8bb28ac68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201204 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <com/sun/star/table/XCellRange.hpp>
|
||||
#include <com/sun/star/view/XSelectionSupplier.hpp>
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <docsh.hxx>
|
||||
#include <editutil.hxx>
|
||||
@@ -47,7 +48,8 @@ public:
|
||||
|
||||
// helpers
|
||||
private:
|
||||
void exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range);
|
||||
void exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range,
|
||||
const std::initializer_list<css::beans::PropertyValue>& params = {});
|
||||
|
||||
void exportToPDFWithUnoCommands(const OUString& rRange);
|
||||
|
||||
@@ -74,6 +76,7 @@ public:
|
||||
void testTdf84012();
|
||||
void testTdf78897();
|
||||
void testForcepoint97();
|
||||
void testTdf156893();
|
||||
|
||||
CPPUNIT_TEST_SUITE(ScPDFExportTest);
|
||||
CPPUNIT_TEST(testPopupRectangleSize_Tdf162955);
|
||||
@@ -92,6 +95,7 @@ public:
|
||||
CPPUNIT_TEST(testTdf84012);
|
||||
CPPUNIT_TEST(testTdf78897);
|
||||
CPPUNIT_TEST(testForcepoint97);
|
||||
CPPUNIT_TEST(testTdf156893);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
|
||||
@@ -136,7 +140,8 @@ bool ScPDFExportTest::hasTextInPdf(const char* sText, bool& bFound)
|
||||
return (nRead == nFileSize);
|
||||
}
|
||||
|
||||
void ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range)
|
||||
void ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range,
|
||||
const std::initializer_list<css::beans::PropertyValue>& params)
|
||||
{
|
||||
// get XSpreadsheet
|
||||
uno::Reference<sheet::XSpreadsheetDocument> xDoc(xModel, uno::UNO_QUERY_THROW);
|
||||
@@ -169,7 +174,8 @@ void ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, c
|
||||
|
||||
// init set of params for storeToURL() call
|
||||
css::uno::Sequence<css::beans::PropertyValue> seqArguments{
|
||||
comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
|
||||
comphelper::makePropertyValue(u"FilterData"_ustr,
|
||||
comphelper::concatSequences(aFilterData, params)),
|
||||
comphelper::makePropertyValue(u"FilterName"_ustr, u"calc_pdf_Export"_ustr),
|
||||
comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL())
|
||||
};
|
||||
@@ -917,6 +923,33 @@ void ScPDFExportTest::testForcepoint97()
|
||||
exportToPDF(xModel, range1);
|
||||
}
|
||||
|
||||
void ScPDFExportTest::testTdf156893()
|
||||
{
|
||||
// Given a spreadsheet with a large number of rows, the whole-sheet export to PDF should export
|
||||
// all rows.
|
||||
loadFromFile(u"23000_rows.fods");
|
||||
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
|
||||
|
||||
// A1:A23000
|
||||
ScRange range(0, 0, 0, 0, 22999, 0);
|
||||
exportToPDF(xModel, range, { comphelper::makePropertyValue(u"SinglePageSheets"_ustr, true) });
|
||||
|
||||
// Parse the export result
|
||||
auto pPdfDocument = parsePDFExport();
|
||||
CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
|
||||
|
||||
// Get the first page
|
||||
auto pPdfPage = pPdfDocument->openPage(0);
|
||||
CPPUNIT_ASSERT(pPdfPage);
|
||||
|
||||
// Without the fix, this failed with
|
||||
// - Expected: 23000
|
||||
// - Actual : 1022
|
||||
CPPUNIT_ASSERT_EQUAL(23000, pPdfPage->getObjectCount());
|
||||
CPPUNIT_ASSERT_EQUAL(u"Last row"_ustr,
|
||||
pPdfPage->getObject(22999)->getText(pPdfPage->getTextPage()));
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ScPDFExportTest);
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
|
||||
<office:font-face-decls>
|
||||
<style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
|
||||
</office:font-face-decls>
|
||||
<office:styles>
|
||||
<style:default-style style:family="table-cell">
|
||||
<style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" fo:language="en" fo:country="US"/>
|
||||
</style:default-style>
|
||||
<style:style style:name="Default" style:family="table-cell"/>
|
||||
</office:styles>
|
||||
<office:automatic-styles>
|
||||
<style:style style:name="co1" style:family="table-column">
|
||||
<style:table-column-properties style:column-width="25mm"/>
|
||||
</style:style>
|
||||
<style:style style:name="ro1" style:family="table-row">
|
||||
<style:table-row-properties style:row-height="4.5mm" fo:break-before="auto" style:use-optimal-row-height="true"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:paragraph-properties fo:text-align="end"/>
|
||||
</style:style>
|
||||
</office:automatic-styles>
|
||||
<office:body>
|
||||
<office:spreadsheet>
|
||||
<table:table table:name="Sheet1">
|
||||
<table:table-column table:style-name="co1" table:default-cell-style-name="Default"/>
|
||||
<table:table-row table:style-name="ro1">
|
||||
<table:table-cell table:style-name="ce1" office:value-type="string" office:string-value="First row"/>
|
||||
</table:table-row>
|
||||
<table:table-row table:style-name="ro1" table:number-rows-repeated="22998">
|
||||
<table:table-cell table:style-name="ce1" office:value-type="string" office:string-value="row"/>
|
||||
</table:table-row>
|
||||
<table:table-row table:style-name="ro1">
|
||||
<table:table-cell table:style-name="ce1" office:value-type="string" office:string-value="Last row"/>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
</office:spreadsheet>
|
||||
</office:body>
|
||||
</office:document>
|
||||
@@ -526,7 +526,7 @@ void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPri
|
||||
|
||||
// Assemble data
|
||||
|
||||
ScTableInfo aTabInfo(nY1, nY2, true);
|
||||
ScTableInfo aTabInfo(nY1, nY2, false);
|
||||
rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
|
||||
nScaleX, nScaleY, false, bFormula );
|
||||
lcl_HidePrint( aTabInfo, nX1, nX2 );
|
||||
|
||||
Reference in New Issue
Block a user