https://bugs.documentfoundation.org/show_bug.cgi?id=173642

--- Comment #9 from Julien Nabet <[email protected]> ---
(In reply to Michael Weghorn from comment #8)
> Pending fixes awaiting review in the Collabora Gerrit instance:
> 
> https://gerrit.collaboraoffice.com/c/core/+/13342/2
> https://gerrit.collaboraoffice.com/c/core/+/13343/2

Great news!

Just for the record, I was testing this for tdf#173642

------------------------ vcl/source/window/printdlg.cxx
------------------------
index bc1fe19b7a97..589b18b37bef 100644
@@ -873,6 +873,14 @@ void PrintDialog::setPaperSizes()
         {
             PaperInfo aInfo = aPrt->GetPaperInfo( nPaper );
             aInfo.doSloppyFit(true);
+            // Match current paper dimensions regardless of the Paper enum.
+            // Some drivers return PAPER_USER for standard sizes with slightly
+            // different dimensions.
+            if (nSizeMatch == -1 && aInfo.sloppyEqual(aPaperInfo))
+                nSizeMatch = nPaper;
+
+            if (nRotatedSizeMatch == -1 &&
aInfo.sloppyEqual(aRotatedPaperInfo))
+                nRotatedSizeMatch = nPaper;
             Paper ePaper = aInfo.getPaper();

             // Use PaperInfo directly (1/100th mm); GetPaperSize() uses
@@ -929,15 +937,17 @@ void PrintDialog::setPaperSizes()
             mxPaperSizeBox->set_active(nSizeMatch);
         else if (nRotatedSizeMatch != -1)
             mxPaperSizeBox->set_active(nRotatedSizeMatch);
-
-        // Override with document dimension match if enum matching failed.
-        if (nDocDimMatch != -1)
-        {
-            mxPaperSizeBox->set_active(nDocDimMatch);
-        }
-        else if (nDocDimRotatedMatch != -1)
+        // Use document dimensions only as a fallback.
+        else
         {
-            mxPaperSizeBox->set_active(nDocDimRotatedMatch);
+            if (nDocDimMatch != -1)
+            {
+                mxPaperSizeBox->set_active(nDocDimMatch);
+            }
+            else if (nDocDimRotatedMatch != -1)
+            {
+                mxPaperSizeBox->set_active(nDocDimRotatedMatch);
+            }
         }

         // No printer paper matches — probe the driver for custom size.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to