include/vcl/print.hxx | 4 ---- sc/source/ui/unoobj/docuno.cxx | 19 ++++++++++++++----- vcl/source/gdi/print.cxx | 1 - vcl/source/gdi/print3.cxx | 12 ------------ 4 files changed, 14 insertions(+), 22 deletions(-)
New commits: commit 631e5b4b427199f5bb978c21f4fa11616f10ac4e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Apr 9 22:44:11 2025 +0200 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Wed Apr 16 17:28:30 2025 +0200 tdf#166107: remove unnecessary resetPrintArea() In the mentioned regression, resetPrintArea() was responsible for reverting the print area in Calc, which was set by the Print Dialog, back to the one defined by the Page Styles. It was implemented in the print-related part that is used by all modules but this is a Calc-specific issue. Therefore, in this commit, resetPrintArea() was removed and it made more sense to fix the print area issue in the Calc modul. from commit 364f0bb1cac0e12f5f926857f61c2f329a353ec7 Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> Date: Wed Feb 28 11:13:10 2024 +0100 tdf#155218 sc: fix regression page orientation in print dialog Change-Id: I3767c0685addefb9b2fb16bfc7cf967a0f332272 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183948 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit eccf4cd57a1970b296e12296bf0f5a0f52e917a7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184212 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index a1aacf8f0d90..9397519056c1 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -93,7 +93,6 @@ private: bool mbNewJobSetup; bool mbSinglePrintJobs; bool mbUsePrintSetting; - bool mbResetPrintArea; SAL_DLLPRIVATE void ImplInitData(); SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); @@ -223,8 +222,6 @@ public: SAL_DLLPRIVATE void SetPrinterOptions( const vcl::printer::Options& rOptions ); const vcl::printer::Options& GetPrinterOptions() const { return( *mpPrinterOptions ); } - void ResetPrintArea(bool bReset) { mbResetPrintArea = bReset; } - bool IsPrintAreaReset() { return mbResetPrintArea; } void SetUsePrintDialogSetting(bool bUsed) { mbUsePrintSetting = bUsed; } bool IsUsePrintDialogSetting() { return mbUsePrintSetting; } void SetPrintPageSize(Size aPrintPageSize) { maPrintPageSize = aPrintPageSize; } @@ -486,7 +483,6 @@ public: SAL_DLLPRIVATE bool getPrinterModified() const; SAL_DLLPRIVATE void pushPropertiesToPrinter(); SAL_DLLPRIVATE void resetPaperToLastConfigured(); - SAL_DLLPRIVATE void resetPrintArea(); void setJobState( css::view::PrintableState ); SAL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1f67c756a35a..fbb8c817ab4c 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1839,7 +1839,6 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection, return 0; Size aPrintPageSize; - bool bPrintAreaReset = false; bool bPrintPageLandscape = false; bool bUsePrintDialogSetting = false; Printer* pPrinter = lcl_GetPrinter(rOptions); @@ -1851,16 +1850,13 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection, bPrintPageLandscape = (pPrinter->GetOrientation() == Orientation::Landscape); aPrintPageSize = lcl_GetPrintPageSize(pPrinter->GetPrintPageSize()); } - else // reset the print area created by the Print Dialog to the page style's print area. - bPrintAreaReset = pPrinter->IsPrintAreaReset(); } // The same ScPrintFuncCache object in pPrintFuncCache is used as long as // the same selection is used (aStatus) and the document isn't changed // (pPrintFuncCache is cleared in Notify handler) - if (!pPrintFuncCache || !pPrintFuncCache->IsSameSelection(aStatus) || bUsePrintDialogSetting - || bPrintAreaReset) + if (!pPrintFuncCache || !pPrintFuncCache->IsSameSelection(aStatus) || bUsePrintDialogSetting) { pPrintFuncCache.reset(new ScPrintFuncCache(pDocShell, aMark, aStatus, aPrintPageSize, bPrintPageLandscape, bUsePrintDialogSetting)); @@ -2760,6 +2756,19 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec (void)pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, true, nullptr ); + if (pPrinter) + { + // reset the print area created by the Print Dialog to the page style's print area + if (pPrinter->IsUsePrintDialogSetting()) + { + bUsePrintDialogSetting = false; + if (m_pPrintState && m_pPrintState->nPrintTab == nTab && !pSelRange) + pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, *m_pPrintState, + &aStatus.GetOptions(), aPrintPageSize, + bPrintPageLandscape, bUsePrintDialogSetting)); + } + } + vcl::PDFExtOutDevData* pPDFData = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); if (pPDFData && pPDFData->GetIsExportTaggedPDF() && bIsLastPage) { diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index b277b4186e78..026ec6abcc25 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -455,7 +455,6 @@ void Printer::ImplInitData() mbNewJobSetup = false; mbSinglePrintJobs = false; mbUsePrintSetting = false; - mbResetPrintArea = false; mpInfoPrinter = nullptr; mpPrinter = nullptr; mpDisplayDev = nullptr; diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 54d6ab769cb7..ec246f258f97 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -596,7 +596,6 @@ bool Printer::ExecutePrintJob(const std::shared_ptr<PrinterController>& xControl void Printer::FinishPrintJob(const std::shared_ptr<PrinterController>& xController) { - xController->resetPrintArea(); xController->resetPaperToLastConfigured(); xController->jobFinished( xController->getJobState() ); } @@ -1053,17 +1052,6 @@ void vcl::ImplPrinterControllerData::resetPaperToLastConfigured() mxPrinter->Pop(); } -// reset the print area created by the Print Dialog to the page style's print area. -void PrinterController::resetPrintArea() -{ - if (mpImplData->mxPrinter->IsUsePrintDialogSetting()) - { - mpImplData->mxPrinter->ResetPrintArea(true); - mpImplData->mxPrinter->SetUsePrintDialogSetting(false); - getPageCount(); - } -} - int PrinterController::getPageCountProtected() const { const MapMode aMapMode( MapUnit::Map100thMM );