Kaydet (Commit) 1c6bd2c4 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#80911 toggle original page orientation on paper fallback

User defined page sizes which match rotated paper sizes available to the
printer don't work correctly when they are already in landscape mode.  i.e. the
orientation should be toggled, not overwritten.

Change-Id: I30dca5f988ad72319410a03f47eccff277be8640
üst 97f63c17
...@@ -1352,6 +1352,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1352,6 +1352,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
int nLandscapeAngle = GetLandscapeAngle(); int nLandscapeAngle = GetLandscapeAngle();
int nPaperCount = GetPaperInfoCount(); int nPaperCount = GetPaperInfoCount();
bool bFound = false; bool bFound = false;
bool bToggleOrient = false;
PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight); PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight);
...@@ -1364,7 +1365,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1364,7 +1365,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{ {
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() ); rPaperInfo.getHeight() );
pSetupData->meOrientation = ORIENTATION_PORTRAIT;
bFound = true; bFound = true;
break; break;
} }
...@@ -1388,8 +1388,8 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1388,8 +1388,8 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{ {
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() ); rPaperInfo.getHeight() );
pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
bFound = true; bFound = true;
bToggleOrient = true;
break; break;
} }
} }
...@@ -1399,7 +1399,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1399,7 +1399,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{ {
sal_Int64 nBestMatch = SAL_MAX_INT64; sal_Int64 nBestMatch = SAL_MAX_INT64;
int nBestIndex = 0; int nBestIndex = 0;
Orientation eBestOrientation = ORIENTATION_PORTRAIT;
for( int i = 0; i < nPaperCount; i++ ) for( int i = 0; i < nPaperCount; i++ )
{ {
const PaperInfo& rPaperInfo = GetPaperInfo( i ); const PaperInfo& rPaperInfo = GetPaperInfo( i );
...@@ -1412,7 +1411,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1412,7 +1411,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{ {
nBestMatch = nMatch; nBestMatch = nMatch;
nBestIndex = i; nBestIndex = i;
eBestOrientation = ORIENTATION_PORTRAIT; bToggleOrient = false;
} }
// check landscape match // check landscape match
...@@ -1423,13 +1422,20 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe ...@@ -1423,13 +1422,20 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{ {
nBestMatch = nMatch; nBestMatch = nMatch;
nBestIndex = i; nBestIndex = i;
eBestOrientation = ORIENTATION_LANDSCAPE; bToggleOrient = true;
} }
} }
const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex ); const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
pSetupData->mePaperFormat = ImplGetPaperFormat( rBestInfo.getWidth(), pSetupData->mePaperFormat = ImplGetPaperFormat( rBestInfo.getWidth(),
rBestInfo.getHeight() ); rBestInfo.getHeight() );
pSetupData->meOrientation = eBestOrientation; }
if (bToggleOrient)
{
if (pSetupData->meOrientation == ORIENTATION_PORTRAIT)
pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
else
pSetupData->meOrientation = ORIENTATION_PORTRAIT;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment