diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-22 10:54:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-22 18:15:51 +0100 |
commit | 651e9e7278fffa79248fb173432de0af4a622b5d (patch) | |
tree | fa929970c5ea65cb303288f1d2a19824369bb0ea /i18nutil | |
parent | 6bda2e11c553b4032a33b95dd89e762db23e60f3 (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/+/109784
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'i18nutil')
-rw-r--r-- | i18nutil/source/utility/paper.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index 4e94f9b36a14..74c9fd35e9f4 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -164,7 +164,7 @@ 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; @@ -175,11 +175,8 @@ void PaperInfo::doSloppyFit() tools::Long lDiffW = std::abs(aDinTab[i].m_nWidth - m_nPaperWidth); tools::Long lDiffH = std::abs(aDinTab[i].m_nHeight - m_nPaperHeight); - tools::Long lFlipDiffW = std::abs(aDinTab[i].m_nHeight - m_nPaperWidth); - tools::Long lFlipDiffH = std::abs(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; @@ -187,6 +184,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 |