nss: upgrade to release 3.73
[LibreOffice.git] / vcl / osx / salprn.cxx
bloba066f881164b0431f0405a6ce3f0e624f09600fc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <officecfg/Office/Common.hxx>
22 #include <vcl/gdimtf.hxx>
23 #include <vcl/print.hxx>
24 #include <sal/macros.h>
25 #include <osl/diagnose.h>
26 #include <tools/long.hxx>
28 #include <osx/salinst.h>
29 #include <osx/salprn.h>
30 #include <osx/printview.h>
31 #include <quartz/salgdi.h>
32 #include <osx/saldata.hxx>
33 #include <quartz/utils.h>
35 #include <jobset.h>
36 #include <salptype.hxx>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/awt/Size.hpp>
40 #include <com/sun/star/uno/Sequence.hxx>
42 #include <algorithm>
43 #include <cstdlib>
45 using namespace vcl;
46 using namespace com::sun::star;
47 using namespace com::sun::star::beans;
49 AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
50 mpGraphics( nullptr ),
51 mbGraphics( false ),
52 mbJob( false ),
53 mpPrinter( nil ),
54 mpPrintInfo( nil ),
55 mePageOrientation( Orientation::Portrait ),
56 mnStartPageOffsetX( 0 ),
57 mnStartPageOffsetY( 0 ),
58 mnCurPageRangeStart( 0 ),
59 mnCurPageRangeCount( 0 )
61 NSString* pStr = CreateNSString( i_rQueue.maPrinterName );
62 mpPrinter = [NSPrinter printerWithName: pStr];
63 [pStr release];
65 NSPrintInfo* pShared = [NSPrintInfo sharedPrintInfo];
66 if( pShared )
68 mpPrintInfo = [pShared copy];
69 [mpPrintInfo setPrinter: mpPrinter];
70 mePageOrientation = ([mpPrintInfo orientation] == NSPaperOrientationLandscape) ? Orientation::Landscape : Orientation::Portrait;
71 [mpPrintInfo setOrientation: NSPaperOrientationPortrait];
74 mpGraphics = new AquaSalGraphics();
76 const int nWidth = 100, nHeight = 100;
77 mpContextMemory.reset(new (std::nothrow) sal_uInt8[nWidth * 4 * nHeight]);
79 if (mpContextMemory)
81 mrContext = CGBitmapContextCreate(mpContextMemory.get(),
82 nWidth, nHeight, 8, nWidth * 4,
83 GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst);
84 if( mrContext )
85 SetupPrinterGraphics( mrContext );
89 AquaSalInfoPrinter::~AquaSalInfoPrinter()
91 delete mpGraphics;
92 if( mpPrintInfo )
93 [mpPrintInfo release];
94 if( mrContext )
95 CFRelease( mrContext );
98 void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
100 if( mpGraphics )
102 if( mpPrintInfo )
104 // FIXME: get printer resolution
105 sal_Int32 nDPIX = 720, nDPIY = 720;
106 NSSize aPaperSize = [mpPrintInfo paperSize];
108 NSRect aImageRect = [mpPrintInfo imageablePageBounds];
109 if( mePageOrientation == Orientation::Portrait )
111 // move mirrored CTM back into paper
112 double dX = 0, dY = aPaperSize.height;
113 // move CTM to reflect imageable area
114 dX += aImageRect.origin.x;
115 dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
116 CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY );
117 // scale to be top/down and reflect our "virtual" DPI
118 CGContextScaleCTM( i_rContext, 72.0/double(nDPIX), -(72.0/double(nDPIY)) );
120 else
122 // move CTM to reflect imageable area
123 double dX = aImageRect.origin.x, dY = aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
124 CGContextTranslateCTM( i_rContext, -dX, -dY );
125 // turn by 90 degree
126 CGContextRotateCTM( i_rContext, M_PI/2 );
127 // move turned CTM back into paper
128 dX = aPaperSize.height;
129 dY = -aPaperSize.width;
130 CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX );
131 // scale to be top/down and reflect our "virtual" DPI
132 CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) );
134 mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY );
136 else
137 OSL_FAIL( "no print info in SetupPrinterGraphics" );
141 SalGraphics* AquaSalInfoPrinter::AcquireGraphics()
143 SalGraphics* pGraphics = mbGraphics ? nullptr : mpGraphics;
144 mbGraphics = true;
145 return pGraphics;
148 void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* )
150 mbGraphics = false;
153 bool AquaSalInfoPrinter::Setup( weld::Window*, ImplJobSetup* )
155 return false;
158 bool AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData )
160 // FIXME: implement driver data
161 if( io_pSetupData && io_pSetupData->GetDriverData() )
162 return SetData( JobSetFlags::ALL, io_pSetupData );
164 bool bSuccess = true;
166 // set system type
167 io_pSetupData->SetSystem( JOBSETUP_SYSTEM_MAC );
169 // get paper format
170 if( mpPrintInfo )
172 NSSize aPaperSize = [mpPrintInfo paperSize];
173 double width = aPaperSize.width, height = aPaperSize.height;
174 // set paper
175 PaperInfo aInfo( PtTo10Mu( width ), PtTo10Mu( height ) );
176 aInfo.doSloppyFit();
177 io_pSetupData->SetPaperFormat( aInfo.getPaper() );
178 if( io_pSetupData->GetPaperFormat() == PAPER_USER )
180 io_pSetupData->SetPaperWidth( PtTo10Mu( width ) );
181 io_pSetupData->SetPaperHeight( PtTo10Mu( height ) );
183 else
185 io_pSetupData->SetPaperWidth( 0 );
186 io_pSetupData->SetPaperHeight( 0 );
189 // set orientation
190 io_pSetupData->SetOrientation( mePageOrientation );
192 io_pSetupData->SetPaperBin( 0 );
193 io_pSetupData->SetDriverData( static_cast<sal_uInt8*>(std::malloc( 4 )) );
194 io_pSetupData->SetDriverDataLen( 4 );
196 else
197 bSuccess = false;
199 return bSuccess;
202 void AquaSalInfoPrinter::setPaperSize( tools::Long i_nWidth, tools::Long i_nHeight, Orientation i_eSetOrientation )
205 Orientation ePaperOrientation = Orientation::Portrait;
206 const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation );
208 if( pPaper )
210 NSString* pPaperName = [CreateNSString( OStringToOUString(PaperInfo::toPSName(pPaper->getPaper()), RTL_TEXTENCODING_ASCII_US) ) autorelease];
211 [mpPrintInfo setPaperName: pPaperName];
213 else if( i_nWidth > 0 && i_nHeight > 0 )
215 NSSize aPaperSize = { static_cast<CGFloat>(TenMuToPt(i_nWidth)), static_cast<CGFloat>(TenMuToPt(i_nHeight)) };
216 [mpPrintInfo setPaperSize: aPaperSize];
218 // this seems counterintuitive
219 mePageOrientation = i_eSetOrientation;
222 bool AquaSalInfoPrinter::SetData( JobSetFlags i_nFlags, ImplJobSetup* io_pSetupData )
224 if( ! io_pSetupData || io_pSetupData->GetSystem() != JOBSETUP_SYSTEM_MAC )
225 return false;
227 if( mpPrintInfo )
229 if( i_nFlags & JobSetFlags::ORIENTATION )
230 mePageOrientation = io_pSetupData->GetOrientation();
232 if( i_nFlags & JobSetFlags::PAPERSIZE )
234 // set paper format
235 tools::Long width = 21000, height = 29700;
236 if( io_pSetupData->GetPaperFormat() == PAPER_USER )
238 // #i101108# sanity check
239 if( io_pSetupData->GetPaperWidth() && io_pSetupData->GetPaperHeight() )
241 width = io_pSetupData->GetPaperWidth();
242 height = io_pSetupData->GetPaperHeight();
245 else
247 PaperInfo aInfo( io_pSetupData->GetPaperFormat() );
248 width = aInfo.getWidth();
249 height = aInfo.getHeight();
252 setPaperSize( width, height, mePageOrientation );
256 return mpPrintInfo != nil;
259 sal_uInt16 AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* )
261 return 0;
264 OUString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup*, sal_uInt16 )
266 return OUString();
269 sal_uInt32 AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType )
271 switch( i_nType )
273 case PrinterCapType::SupportDialog:
274 return 0;
275 case PrinterCapType::Copies:
276 return 0xffff;
277 case PrinterCapType::CollateCopies:
278 return 0xffff;
279 case PrinterCapType::SetOrientation:
280 return 1;
281 case PrinterCapType::SetPaperSize:
282 return 1;
283 case PrinterCapType::SetPaper:
284 return 1;
285 case PrinterCapType::ExternalDialog:
286 return officecfg::Office::Common::Misc::UseSystemPrintDialog::get()
287 ? 1 : 0;
288 case PrinterCapType::PDF:
289 return 1;
290 case PrinterCapType::UsePullModel:
291 return 1;
292 default: break;
294 return 0;
297 void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*,
298 tools::Long& o_rOutWidth, tools::Long& o_rOutHeight,
299 Point& rPageOffset,
300 Size& rPaperSize )
302 if( mpPrintInfo )
304 sal_Int32 nDPIX = 72, nDPIY = 72;
305 mpGraphics->GetResolution( nDPIX, nDPIY );
306 const double fXScaling = static_cast<double>(nDPIX)/72.0,
307 fYScaling = static_cast<double>(nDPIY)/72.0;
309 NSSize aPaperSize = [mpPrintInfo paperSize];
310 rPaperSize.setWidth( static_cast<tools::Long>( double(aPaperSize.width) * fXScaling ) );
311 rPaperSize.setHeight( static_cast<tools::Long>( double(aPaperSize.height) * fYScaling ) );
313 NSRect aImageRect = [mpPrintInfo imageablePageBounds];
314 rPageOffset.setX( static_cast<tools::Long>( aImageRect.origin.x * fXScaling ) );
315 rPageOffset.setY( static_cast<tools::Long>( (aPaperSize.height - aImageRect.size.height - aImageRect.origin.y) * fYScaling ) );
316 o_rOutWidth = static_cast<tools::Long>( aImageRect.size.width * fXScaling );
317 o_rOutHeight = static_cast<tools::Long>( aImageRect.size.height * fYScaling );
319 if( mePageOrientation == Orientation::Landscape )
321 std::swap( o_rOutWidth, o_rOutHeight );
322 // swap width and height
323 tools::Long n = rPaperSize.Width();
324 rPaperSize.setWidth(rPaperSize.Height());
325 rPaperSize.setHeight(n);
326 // swap offset x and y
327 n = rPageOffset.X();
328 rPageOffset.setX(rPageOffset.Y());
329 rPageOffset.setY(n);
334 static Size getPageSize( vcl::PrinterController const & i_rController, sal_Int32 i_nPage )
336 Size aPageSize;
337 uno::Sequence< PropertyValue > const aPageParms( i_rController.getPageParameters( i_nPage ) );
338 for( const PropertyValue & pv : aPageParms )
340 if ( pv.Name == "PageSize" )
342 awt::Size aSize;
343 pv.Value >>= aSize;
344 aPageSize.setWidth( aSize.Width );
345 aPageSize.setHeight( aSize.Height );
346 break;
349 return aPageSize;
352 bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName,
353 const OUString& i_rJobName,
354 const OUString& /*i_rAppName*/,
355 ImplJobSetup* i_pSetupData,
356 vcl::PrinterController& i_rController
359 if( mbJob )
360 return false;
362 bool bSuccess = false;
363 bool bWasAborted = false;
364 AquaSalInstance* pInst = GetSalData()->mpInstance;
365 PrintAccessoryViewState aAccViewState;
366 sal_Int32 nAllPages = 0;
368 // reset IsLastPage
369 i_rController.setLastPage( false );
371 // update job data
372 if( i_pSetupData )
373 SetData( JobSetFlags::ALL, i_pSetupData );
375 // do we want a progress panel ?
376 bool bShowProgressPanel = true;
377 beans::PropertyValue* pMonitor = i_rController.getValue( OUString( "MonitorVisible" ) );
378 if( pMonitor )
379 pMonitor->Value >>= bShowProgressPanel;
380 if( ! i_rController.isShowDialogs() )
381 bShowProgressPanel = false;
383 // possibly create one job for collated output
384 bool bSinglePrintJobs = i_rController.getPrinter()->IsSinglePrintJobs();
386 // FIXME: jobStarted() should be done after the print dialog has ended (if there is one)
387 // how do I know when that might be ?
388 i_rController.jobStarted();
390 int nCopies = i_rController.getPrinter()->GetCopyCount();
391 int nJobs = 1;
392 if( bSinglePrintJobs )
394 nJobs = nCopies;
395 nCopies = 1;
398 for( int nCurJob = 0; nCurJob < nJobs; nCurJob++ )
400 aAccViewState.bNeedRestart = true;
403 if( aAccViewState.bNeedRestart )
405 mnCurPageRangeStart = 0;
406 mnCurPageRangeCount = 0;
407 nAllPages = i_rController.getFilteredPageCount();
410 aAccViewState.bNeedRestart = false;
412 Size aCurSize( 21000, 29700 );
413 if( nAllPages > 0 )
415 mnCurPageRangeCount = 1;
416 aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
417 Size aNextSize( aCurSize );
419 // print pages up to a different size
420 while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
422 aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
423 if( aCurSize == aNextSize // same page size
425 (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
428 mnCurPageRangeCount++;
430 else
431 break;
434 else
435 mnCurPageRangeCount = 0;
437 // now for the current run
438 mnStartPageOffsetX = mnStartPageOffsetY = 0;
439 // setup the paper size and orientation
440 // do this on our associated Printer object, since that is
441 // out interface to the applications which occasionally rely on the paper
442 // information (e.g. brochure printing scales to the found paper size)
443 // also SetPaperSizeUser has the advantage that we can share a
444 // platform independent paper matching algorithm
445 VclPtr<Printer> pPrinter( i_rController.getPrinter() );
446 pPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) );
447 pPrinter->SetPaperSizeUser( aCurSize );
449 // create view
450 NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
452 NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
454 // set filename
455 if( i_pFileName )
457 [mpPrintInfo setJobDisposition: NSPrintSaveJob];
458 NSString* pPath = CreateNSString( *i_pFileName );
459 [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintJobSavingURL];
460 [pPath release];
463 [pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies];
464 if( nCopies > 1 )
465 [pPrintDict setObject: [[NSNumber numberWithBool: pPrinter->IsCollateCopy()] autorelease] forKey: NSPrintMustCollate];
466 [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
467 [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
468 // #i103253# weird: for some reason, autoreleasing the value below like the others above
469 // leads do a double free malloc error. Why this value should behave differently from all the others
470 // is a mystery.
471 [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
473 // create print operation
474 NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo];
476 if( pPrintOperation )
478 NSObject* pReleaseAfterUse = nil;
479 bool bShowPanel = !i_rController.isDirectPrint()
480 && (officecfg::Office::Common::Misc::UseSystemPrintDialog::
481 get())
482 && i_rController.isShowDialogs();
483 [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
484 [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
486 // set job title (since MacOSX 10.5)
487 if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
488 [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
490 if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accessory view
491 pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
493 bSuccess = true;
494 mbJob = true;
495 pInst->startedPrintJob();
496 bool wasSuccessful = [pPrintOperation runOperation];
497 pInst->endedPrintJob();
498 bSuccess = wasSuccessful;
499 bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
500 mbJob = false;
501 if( pReleaseAfterUse )
502 [pReleaseAfterUse release];
505 mnCurPageRangeStart += mnCurPageRangeCount;
506 mnCurPageRangeCount = 1;
507 } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
510 // inform application that it can release its data
511 // this is awkward, but the XRenderable interface has no method for this,
512 // so we need to call XRenderable::render one last time with IsLastPage = true
513 i_rController.setLastPage( true );
514 GDIMetaFile aPageFile;
515 if( mrContext )
516 SetupPrinterGraphics( mrContext );
517 i_rController.getFilteredPageFile( 0, aPageFile );
519 i_rController.setJobState( bWasAborted
520 ? view::PrintableState_JOB_ABORTED
521 : view::PrintableState_JOB_SPOOLED );
523 mnCurPageRangeStart = mnCurPageRangeCount = 0;
525 return bSuccess;
528 bool AquaSalInfoPrinter::EndJob()
530 mnStartPageOffsetX = mnStartPageOffsetY = 0;
531 mbJob = false;
532 return true;
535 bool AquaSalInfoPrinter::AbortJob()
537 mbJob = false;
539 // FIXME: implementation
540 return false;
543 SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData )
545 if( i_bNewJobData && i_pSetupData )
546 SetPrinterData( i_pSetupData );
548 CGContextRef rContext = [[NSGraphicsContext currentContext] CGContext];
550 SetupPrinterGraphics( rContext );
552 return mpGraphics;
555 bool AquaSalInfoPrinter::EndPage()
557 mpGraphics->InvalidateContext();
558 return true;
561 AquaSalPrinter::AquaSalPrinter( AquaSalInfoPrinter* i_pInfoPrinter ) :
562 mpInfoPrinter( i_pInfoPrinter )
566 AquaSalPrinter::~AquaSalPrinter()
570 bool AquaSalPrinter::StartJob( const OUString* i_pFileName,
571 const OUString& i_rJobName,
572 const OUString& i_rAppName,
573 ImplJobSetup* i_pSetupData,
574 vcl::PrinterController& i_rController )
576 return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController );
579 bool AquaSalPrinter::StartJob( const OUString* /*i_pFileName*/,
580 const OUString& /*i_rJobName*/,
581 const OUString& /*i_rAppName*/,
582 sal_uInt32 /*i_nCopies*/,
583 bool /*i_bCollate*/,
584 bool /*i_bDirect*/,
585 ImplJobSetup* )
587 OSL_FAIL( "should never be called" );
588 return false;
591 bool AquaSalPrinter::EndJob()
593 return mpInfoPrinter->EndJob();
596 SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData )
598 return mpInfoPrinter->StartPage( i_pSetupData, i_bNewJobData );
601 void AquaSalPrinter::EndPage()
603 mpInfoPrinter->EndPage();
606 void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
608 m_aPaperFormats.clear();
609 m_bPapersInit = true;
611 if( mpPrinter )
613 SAL_WNODEPRECATED_DECLARATIONS_PUSH
614 //TODO: 10.9 statusForTable:, stringListForKey:inTable:
615 if( [mpPrinter statusForTable: @"PPD"] == NSPrinterTableOK )
617 NSArray* pPaperNames = [mpPrinter stringListForKey: @"PageSize" inTable: @"PPD"];
618 if( pPaperNames )
620 unsigned int nPapers = [pPaperNames count];
621 for( unsigned int i = 0; i < nPapers; i++ )
623 NSString* pPaper = [pPaperNames objectAtIndex: i];
624 // first try to match the name
625 OString aPaperName( [pPaper UTF8String] );
626 Paper ePaper = PaperInfo::fromPSName( aPaperName );
627 if( ePaper != PAPER_USER )
629 m_aPaperFormats.push_back( PaperInfo( ePaper ) );
631 else
633 NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
634 if( aPaperSize.width > 0 && aPaperSize.height > 0 )
636 PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
637 PtTo10Mu( aPaperSize.height ) );
638 if( aInfo.getPaper() == PAPER_USER )
639 aInfo.doSloppyFit();
640 m_aPaperFormats.push_back( aInfo );
646 SAL_WNODEPRECATED_DECLARATIONS_POP
650 const PaperInfo* AquaSalInfoPrinter::matchPaper( tools::Long i_nWidth, tools::Long i_nHeight, Orientation& o_rOrientation ) const
652 if( ! m_bPapersInit )
653 const_cast<AquaSalInfoPrinter*>(this)->InitPaperFormats( nullptr );
655 const PaperInfo* pMatch = nullptr;
656 o_rOrientation = Orientation::Portrait;
657 for( int n = 0; n < 2 ; n++ )
659 for( size_t i = 0; i < m_aPaperFormats.size(); i++ )
661 if( std::abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 50 &&
662 std::abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 50 )
664 pMatch = &m_aPaperFormats[i];
665 return pMatch;
668 o_rOrientation = Orientation::Landscape;
669 std::swap( i_nWidth, i_nHeight );
671 return pMatch;
674 int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
676 return 900;
679 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */