pass in bDontSwap rather than use a local static

Change-Id: I8758802064476199f34d57e0937ee56cef6e0363
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140429
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-09-22 14:08:44 +01:00
parent 74410f8a8c
commit 3805a4090d
2 changed files with 3 additions and 7 deletions

View file

@ -201,7 +201,7 @@ public:
// returns false if paper not found
// match the best paper for width and height
OUString matchPaper( int nWidth, int nHeight ) const;
OUString matchPaper( int nWidth, int nHeight, bool bDontSwap = false ) const;
bool getMargins( std::u16string_view rPaperName,
int &rLeft, int& rRight,

View file

@ -1466,7 +1466,7 @@ bool PPDParser::getPaperDimension(
return true;
}
OUString PPDParser::matchPaper( int nWidth, int nHeight ) const
OUString PPDParser::matchPaper(int nWidth, int nHeight, bool bDontSwap) const
{
if( ! m_pPaperDimensions )
return OUString();
@ -1497,14 +1497,10 @@ OUString PPDParser::matchPaper( int nWidth, int nHeight ) const
}
}
static bool bDontSwap = false;
if( nPDim == -1 && ! bDontSwap )
{
// swap portrait/landscape and try again
bDontSwap = true;
OUString rRet = matchPaper( nHeight, nWidth );
bDontSwap = false;
return rRet;
return matchPaper( nHeight, nWidth, true );
}
return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : OUString();