sc/source/ui/unoobj/docuno.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit aff8f97d1bc908bd8637d5cb61f7ea82c376c8b9
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Tue May 21 10:59:29 2024 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Jun 21 15:06:58 2024 +0200

    tdf#161190: fix crash when exporting spreadsheet as PDF...
    
    with "whole sheet export" option'
    
    See bt here:
    https://bug-attachments.documentfoundation.org/attachment.cgi?id=194240
    
    Change-Id: I453882be5c8bb761a722482f9c94a2b2bb5c7dd4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167890
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167897
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6d94542095ef..3b60ccca8001 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2146,7 +2146,7 @@ static void lcl_SetMediaScreen(const 
uno::Reference<drawing::XShape>& xMediaShap
         pPDF->SetScreenURL(nScreenId, sMediaURL);
 }
 
-static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const 
ScPrintState& rState,
+static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const 
std::unique_ptr<ScPrintState>& rState,
                                           ScDocument& rDoc, SCTAB nTab, 
tools::Long nStartPage,
                                           bool bSinglePageSheets)
 {
@@ -2196,12 +2196,12 @@ static void lcl_PDFExportMediaShapeScreen(const 
OutputDevice* pDev, const ScPrin
                         if (bTopDown) // top-bottom page order
                         {
                             nX1 = 0;
-                            for (size_t i = 0; i < rState.nPagesX; ++i)
+                            for (size_t i = 0; i < rState->nPagesX; ++i)
                             {
-                                nX2 = (*rState.xPageEndX)[i];
-                                for (size_t j = 0; j < rState.nPagesY; ++j)
+                                nX2 = (*rState->xPageEndX)[i];
+                                for (size_t j = 0; j < rState->nPagesY; ++j)
                                 {
-                                    auto& rPageRow = (*rState.xPageRows)[j];
+                                    auto& rPageRow = (*rState->xPageRows)[j];
                                     nY1 = rPageRow.GetStartRow();
                                     nY2 = rPageRow.GetEndRow();
 
@@ -2221,15 +2221,15 @@ static void lcl_PDFExportMediaShapeScreen(const 
OutputDevice* pDev, const ScPrin
                         }
                         else // left to right page order
                         {
-                            for (size_t i = 0; i < rState.nPagesY; ++i)
+                            for (size_t i = 0; i < rState->nPagesY; ++i)
                             {
-                                auto& rPageRow = (*rState.xPageRows)[i];
+                                auto& rPageRow = (*rState->xPageRows)[i];
                                 nY1 = rPageRow.GetStartRow();
                                 nY2 = rPageRow.GetEndRow();
                                 nX1 = 0;
-                                for (size_t j = 0; j < rState.nPagesX; ++j)
+                                for (size_t j = 0; j < rState->nPagesX; ++j)
                                 {
-                                    nX2 = (*rState.xPageEndX)[j];
+                                    nX2 = (*rState->xPageEndX)[j];
 
                                     tools::Rectangle 
aPageRect(rDoc.GetMMRect(nX1, nY1, nX2, nY2, nTab));
                                     tools::Rectangle 
aTmpRect(aPageRect.GetIntersection(pObj->GetCurrentBoundRect()));
@@ -2332,7 +2332,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, 
const uno::Any& aSelec
     tools::Long nTabStart = pPrintFuncCache->GetTabStart(nTab);
 
     if (nRenderer == nTabStart)
-        lcl_PDFExportMediaShapeScreen(pDev, *m_pPrintState, rDoc, nTab, 
nTabStart, bSinglePageSheets);
+        lcl_PDFExportMediaShapeScreen(pDev, m_pPrintState, rDoc, nTab, 
nTabStart, bSinglePageSheets);
 
     ScRange aRange;
     const ScRange* pSelRange = nullptr;

Reply via email to