summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-07-04 13:28:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-07-04 13:30:36 +0100
commit1c6bd2c40fd03ec735fd6dbec01520f10ee1d55a (patch)
treec4392198f80113afb3ba26d523feee90d1d6559e
parent97f63c17f7bc069a12e3afc3975f09897731a693 (diff)
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
-rw-r--r--vcl/source/gdi/print.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 6c8bdc449264..ded7ebc3c648 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1352,6 +1352,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
int nLandscapeAngle = GetLandscapeAngle();
int nPaperCount = GetPaperInfoCount();
bool bFound = false;
+ bool bToggleOrient = false;
PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight);
@@ -1364,7 +1365,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() );
- pSetupData->meOrientation = ORIENTATION_PORTRAIT;
bFound = true;
break;
}
@@ -1388,8 +1388,8 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{
pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() );
- pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
bFound = true;
+ bToggleOrient = true;
break;
}
}
@@ -1399,7 +1399,6 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{
sal_Int64 nBestMatch = SAL_MAX_INT64;
int nBestIndex = 0;
- Orientation eBestOrientation = ORIENTATION_PORTRAIT;
for( int i = 0; i < nPaperCount; i++ )
{
const PaperInfo& rPaperInfo = GetPaperInfo( i );
@@ -1412,7 +1411,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{
nBestMatch = nMatch;
nBestIndex = i;
- eBestOrientation = ORIENTATION_PORTRAIT;
+ bToggleOrient = false;
}
// check landscape match
@@ -1423,13 +1422,20 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
{
nBestMatch = nMatch;
nBestIndex = i;
- eBestOrientation = ORIENTATION_LANDSCAPE;
+ bToggleOrient = true;
}
}
const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
pSetupData->mePaperFormat = ImplGetPaperFormat( rBestInfo.getWidth(),
rBestInfo.getHeight() );
- pSetupData->meOrientation = eBestOrientation;
+ }
+
+ if (bToggleOrient)
+ {
+ if (pSetupData->meOrientation == ORIENTATION_PORTRAIT)
+ pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
+ else
+ pSetupData->meOrientation = ORIENTATION_PORTRAIT;
}
}