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 5b50cd55b48aedce85bceb966520136c08fe1eb0 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 23 16:31:08 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/+/184211 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 962308e327dc..f6107f414566 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; } @@ -489,7 +486,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 19ef534be1e6..ee5ba4be9941 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1862,7 +1862,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); @@ -1874,16 +1873,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, std::move(aStatus), aPrintPageSize, bPrintPageLandscape, bUsePrintDialogSetting)); @@ -2783,6 +2779,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 8cc67e7d5e68..8b6a9f89ce56 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 0cef1d915af2..75d28ca69688 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -588,7 +588,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() ); } @@ -1048,17 +1047,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 );