diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-22 10:54:46 +0000 |
---|---|---|
committer | Ilhan Yesil <ilhanyesil@gmx.de> | 2023-01-04 09:16:56 +0000 |
commit | c6bede5c55d7a791ec2d292401dfd6f1420589f8 (patch) | |
tree | 1330dc4c8a5afc6dd1524236b792af12f3f6eff6 | |
parent | 3a2b58b03d07308a902cc42c53be6afb7d8dbbfc (diff) |
tdf#135590 rotated paper sizes reported as portrait size they are not
since...
commit ff4896a2af1df6138e9246fe1588dfe8c3748f1a
Date: Fri Jun 29 11:36:03 2018 -0300
Sets paper sizes listbox in print dialog
see as the above commit added some uses of doSloppyFit to vcl I imagine
the calls there want to be able to match rotated paper sizes, but in
the cases of tdf#135590 we don't want that behaviour because it doesn't
match what the user is presented with, the width and height are swapped.
So drop matching against swapped height/width by default, but let calls
added in 'Sets paper sizes listbox in print dialog' continue to match
rotated sizes.
Change-Id: I34aeddf12a7ca22234fbc6394487d3c8da7772ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109792
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
(cherry picked from commit 9355d020e0b6bec6c6e08bd5155ed1428df5f674)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143696
Tested-by: Ilhan Yesil <ilhanyesil@gmx.de>
Reviewed-by: Ilhan Yesil <ilhanyesil@gmx.de>
-rw-r--r-- | i18nutil/source/utility/paper.cxx | 14 | ||||
-rw-r--r-- | include/i18nutil/paper.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index 6b59399e9124..0bc2d61a1134 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -158,7 +158,7 @@ static const size_t nTabSize = SAL_N_ELEMENTS(aDinTab); #define MAXSLOPPY 21 -void PaperInfo::doSloppyFit() +void PaperInfo::doSloppyFit(bool bAlsoTryRotated) { if (m_eType != PAPER_USER) return; @@ -169,11 +169,8 @@ void PaperInfo::doSloppyFit() long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth); long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight); - long lFlipDiffW = labs(aDinTab[i].m_nHeight - m_nPaperWidth); - long lFlipDiffH = labs(aDinTab[i].m_nWidth - m_nPaperHeight); - if ( (lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY) || - (lFlipDiffW < MAXSLOPPY && lFlipDiffH < MAXSLOPPY) ) + if (lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY) { m_nPaperWidth = aDinTab[i].m_nWidth; m_nPaperHeight = aDinTab[i].m_nHeight; @@ -181,6 +178,13 @@ void PaperInfo::doSloppyFit() return; } } + + if (bAlsoTryRotated) + { + std::swap(m_nPaperWidth, m_nPaperHeight); + doSloppyFit(); + std::swap(m_nPaperWidth, m_nPaperHeight); + } } bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx index 99bf5df87116..c86b96d0a5ab 100644 --- a/include/i18nutil/paper.hxx +++ b/include/i18nutil/paper.hxx @@ -131,7 +131,7 @@ public: long getWidth() const { return m_nPaperWidth; } long getHeight() const { return m_nPaperHeight; } bool sloppyEqual(const PaperInfo &rOther) const; - void doSloppyFit(); + void doSloppyFit(bool bAlsoTryRotated = false); static PaperInfo getSystemDefaultPaper(); static PaperInfo getDefaultPaperForLocale(const css::lang::Locale & rLocale); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 1515b8b74264..e19abd69b2db 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -833,7 +833,7 @@ void PrintDialog::setPaperSizes() for (int nPaper = 0; nPaper < aPrt->GetPaperInfoCount(); nPaper++) { PaperInfo aInfo = aPrt->GetPaperInfo( nPaper ); - aInfo.doSloppyFit(); + aInfo.doSloppyFit(true); Paper ePaper = aInfo.getPaper(); const LocaleDataWrapper& rLocWrap(Application::GetSettings().GetLocaleDataWrapper()); @@ -1870,7 +1870,7 @@ IMPL_LINK(PrintDialog, ClickHdl, weld::Button&, rButton, void) for (int nPaper = 0; nPaper < aPrt->GetPaperInfoCount(); nPaper++ ) { PaperInfo aInfo = aPrt->GetPaperInfo( nPaper ); - aInfo.doSloppyFit(); + aInfo.doSloppyFit(true); Paper ePaper = aInfo.getPaper(); if ( mePaper == ePaper ) @@ -1952,7 +1952,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void ) { VclPtr<Printer> aPrt( maPController->getPrinter() ); PaperInfo aInfo = aPrt->GetPaperInfo( rBox.get_active() ); - aInfo.doSloppyFit(); + aInfo.doSloppyFit(true); mePaper = aInfo.getPaper(); if ( mePaper == PAPER_USER ) |