vcl/source/window/printdlg.cxx |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit ae1cc1ecb6015fc28f3a8f03e7edc9b942982626
Author:     Tibor Nagy <tibor.nagy.ext...@allotropia.de>
AuthorDate: Wed Oct 2 19:29:04 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Oct 24 12:01:05 2024 +0200

    tdf#163047 sc: fix more pages on a single sheet printing function
    
    issue caused by commit I5e494a0714e398221bee00744d7e25c419a41df7
    "tdf#155218 sc: fix different page orientation in print dialog".
    
    Change-Id: I0b6f645dc77af83b132a415570e5dfca4a5abddf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174404
    Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 4b8cec7e83e675eeafb8d722c5d6fb3181a051d1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174446
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index faa8d7179cb6..cb48bd636251 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1022,20 +1022,26 @@ void PrintDialog::updatePageSize(int nOrientation)
 {
     VclPtr<Printer> aPrt(maPController->getPrinter());
 
-    PaperInfo aInfo = aPrt->GetPaperInfo(mxPaperSizeBox->get_active());
-    Size aSize(aInfo.getWidth(), aInfo.getHeight());
-    if (aSize.IsEmpty())
-        aSize = aPrt->GetSizeOfPaper();
-
-    if (nOrientation != ORIENTATION_AUTOMATIC)
+    Size aSize;
+    if (mxNupPagesBox->get_active_id() == "1")
     {
-        if ((nOrientation == ORIENTATION_PORTRAIT && aSize.Width() > 
aSize.Height())
-            || (nOrientation == ORIENTATION_LANDSCAPE && aSize.Width() < 
aSize.Height()))
+        PaperInfo aInfo = aPrt->GetPaperInfo(mxPaperSizeBox->get_active());
+        aSize = Size(aInfo.getWidth(), aInfo.getHeight());
+        if (aSize.IsEmpty())
+            aSize = aPrt->GetSizeOfPaper();
+
+        if (nOrientation != ORIENTATION_AUTOMATIC)
         {
-            // coverity[swapped_arguments : FALSE] - this is in the intended 
order
-            aSize = Size(aSize.Height(), aSize.Width());
+            if ((nOrientation == ORIENTATION_PORTRAIT && aSize.Width() > 
aSize.Height())
+                || (nOrientation == ORIENTATION_LANDSCAPE && aSize.Width() < 
aSize.Height()))
+            {
+                // coverity[swapped_arguments : FALSE] - this is in the 
intended order
+                aSize = Size(aSize.Height(), aSize.Width());
+            }
         }
     }
+    else
+        aSize = getJobPageSize();
 
     aPrt->SetPrintPageSize(aSize);
     aPrt->SetUsePrintDialogSetting(true);
@@ -2024,6 +2030,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, 
void )
     {
         if( !mxPagesBtn->get_active() )
             mxPagesBtn->set_active(true);
+        updatePageSize(mxOrientationBox->get_active());
         updateNupFromPages( false );
     }
     else if ( &rBox == mxPaperSizeBox.get() )

Reply via email to