summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/print.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/gdi/print.cxx')
-rw-r--r--vcl/source/gdi/print.cxx58
1 files changed, 5 insertions, 53 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 3e9ce5d64b9c..38a985807dfe 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1220,16 +1220,13 @@ void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup)
}
// Map user paper format to a available printer paper formats
-void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest )
+void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
{
ImplJobSetup& rData = aJobSetup.ImplGetData();
// The angle that a landscape page will be turned counterclockwise wrt to portrait.
int nLandscapeAngle = mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( &maJobSetup.ImplGetConstData() ) : 900;
-
int nPaperCount = GetPaperInfoCount();
- bool bFound = false;
-
PaperInfo aInfo(rData.GetPaperWidth(), rData.GetPaperHeight());
// Compare all paper formats and get the appropriate one
@@ -1243,8 +1240,7 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() ));
rData.SetOrientation( Orientation::Portrait );
- bFound = true;
- break;
+ return;
}
}
@@ -1269,49 +1265,10 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNe
ImplGetPaperFormat( rPaperInfo.getWidth(),
rPaperInfo.getHeight() ));
rData.SetOrientation( Orientation::Landscape );
- bFound = true;
- break;
+ return;
}
}
}
-
- if( ! bFound && bMatchNearest )
- {
- 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 );
-
- // check portrait match
- sal_Int64 nDX = rData.GetPaperWidth() - rPaperInfo.getWidth();
- sal_Int64 nDY = rData.GetPaperHeight() - rPaperInfo.getHeight();
- sal_Int64 nMatch = nDX*nDX + nDY*nDY;
- if( nMatch < nBestMatch )
- {
- nBestMatch = nMatch;
- nBestIndex = i;
- eBestOrientation = Orientation::Portrait;
- }
-
- // check landscape match
- nDX = rData.GetPaperWidth() - rPaperInfo.getHeight();
- nDY = rData.GetPaperHeight() - rPaperInfo.getWidth();
- nMatch = nDX*nDX + nDY*nDY;
- if( nMatch < nBestMatch )
- {
- nBestMatch = nMatch;
- nBestIndex = i;
- eBestOrientation = Orientation::Landscape;
- }
- }
- const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
- rData.SetPaperFormat(
- ImplGetPaperFormat( rBestInfo.getWidth(),
- rBestInfo.getHeight() ));
- rData.SetOrientation(eBestOrientation);
- }
}
void Printer::SetPaper( Paper ePaper )
@@ -1341,7 +1298,7 @@ void Printer::SetPaper( Paper ePaper )
ReleaseGraphics();
if ( ePaper == PAPER_USER )
- ImplFindPaperFormatForUserSize( aJobSetup, false );
+ ImplFindPaperFormatForUserSize( aJobSetup );
if ( mpInfoPrinter->SetData( JobSetFlags::PAPERSIZE | JobSetFlags::ORIENTATION, &rData ))
{
ImplUpdateJobSetupPaper( aJobSetup );
@@ -1355,11 +1312,6 @@ void Printer::SetPaper( Paper ePaper )
bool Printer::SetPaperSizeUser( const Size& rSize )
{
- return SetPaperSizeUser( rSize, false );
-}
-
-bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest )
-{
if ( mbInPrintPage )
return false;
@@ -1397,7 +1349,7 @@ bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest )
}
ReleaseGraphics();
- ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest );
+ ImplFindPaperFormatForUserSize( aJobSetup );
// Changing the paper size can also change the orientation!
if ( mpInfoPrinter->SetData( JobSetFlags::PAPERSIZE | JobSetFlags::ORIENTATION, &rData ))