summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--i18nutil/source/utility/paper.cxx14
-rw-r--r--include/i18nutil/paper.hxx2
-rw-r--r--vcl/source/window/printdlg.cxx6
3 files changed, 13 insertions, 9 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
diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx
index 1fc09f1f1267..7b99c0861e48 100644
--- a/include/i18nutil/paper.hxx
+++ b/include/i18nutil/paper.hxx
@@ -134,7 +134,7 @@ public:
tools::Long getWidth() const { return m_nPaperWidth; }
tools::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 45ac01862829..7e0033aa2b9a 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -822,7 +822,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());
@@ -1884,7 +1884,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 )
@@ -1966,7 +1966,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 )