summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-12-04 21:53:45 +0200
committerTor Lillqvist <tml@collabora.com>2021-12-06 12:55:35 +0100
commitd2ca15952de167b6236139d53f6757a7c0d22d0a (patch)
tree51e7c6bb5dd1d9708d03cda13109bdc7d4c43d52
parent4c00e8fb10437fcaefe8635ef390b78376938d15 (diff)
Revert "tdf#145354: Ensure displayed paper name matches displayed paper ..."
It causes tdf#146045. This reverts commit 65081542d2dabdf17820d62abdc5a22d3734e52d Change-Id: Id980701b1a823c8bf7cfb57e0b32cf5d672c3bfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126373 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/inc/printdlg.hxx1
-rw-r--r--vcl/source/window/printdlg.cxx13
2 files changed, 6 insertions, 8 deletions
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index d2ce1670a845..21aab3667d4e 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -65,6 +65,7 @@ namespace vcl
virtual void Resize() override;
void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
+ std::u16string_view i_rPaperName,
const OUString& i_rNoPageString,
sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
bool i_bGreyscale
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 12aa14628887..46cb72752bbf 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -207,6 +207,7 @@ bool PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview,
const Size& i_rOrigSize,
+ std::u16string_view i_rPaperName,
const OUString& i_rReplacement,
sal_Int32 i_nDPIX,
sal_Int32 i_nDPIY,
@@ -234,18 +235,12 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
OUStringBuffer aBuf;
aBuf.append( aNumText + " " );
aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" );
-
- // Look up the paper name from the dimensions
- PaperInfo aPaperInfoFromSize(i_rOrigSize.getWidth(), i_rOrigSize.getHeight());
- aPaperInfoFromSize.doSloppyFit( true );
-
- if (aPaperInfoFromSize.getPaper() != PAPER_USER)
+ if( !i_rPaperName.empty() )
{
aBuf.append( " (" );
- aBuf.append( Printer::GetPaperName(aPaperInfoFromSize.getPaper()) );
+ aBuf.append( i_rPaperName );
aBuf.append( ')' );
}
-
maHorzText = aBuf.makeStringAndClear();
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
@@ -959,6 +954,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
if ( !hasPreview() )
{
mxPreview->setPreview( aMtf, aCurPageSize,
+ Printer::GetPaperName( mePaper ),
maNoPreviewStr,
aPrt->GetDPIX(), aPrt->GetDPIY(),
aPrt->GetPrinterOptions().IsConvertToGreyscales()
@@ -994,6 +990,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
}
mxPreview->setPreview( aMtf, aCurPageSize,
+ Printer::GetPaperName( mePaper ),
nPages > 0 ? OUString() : maNoPageStr,
aPrt->GetDPIX(), aPrt->GetDPIY(),
aPrt->GetPrinterOptions().IsConvertToGreyscales()