Implement infobar encouraging the community involvement.
[LibreOffice.git] / vcl / osx / salprn.cxx
blobbaeb6c6d71d99128c839b3d305edb92cf6739e58
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/print.hxx>
23 #include <sal/macros.h>
25 #include <osx/salinst.h>
26 #include <osx/salprn.h>
27 #include <osx/printview.h>
28 #include <quartz/salgdi.h>
29 #include <osx/saldata.hxx>
30 #include <quartz/utils.h>
32 #include <jobset.h>
33 #include <salptype.hxx>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <com/sun/star/awt/Size.hpp>
37 #include <com/sun/star/uno/Sequence.hxx>
39 #include <algorithm>
40 #include <cstdlib>
42 using namespace vcl;
43 using namespace com::sun::star;
44 using namespace com::sun::star::beans;
46 AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
47 mpGraphics( nullptr ),
48 mbGraphics( false ),
49 mbJob( false ),
50 mpPrinter( nil ),
51 mpPrintInfo( nil ),
52 mePageOrientation( Orientation::Portrait ),
53 mnStartPageOffsetX( 0 ),
54 mnStartPageOffsetY( 0 ),
55 mnCurPageRangeStart( 0 ),
56 mnCurPageRangeCount( 0 )
58 NSString* pStr = CreateNSString( i_rQueue.maPrinterName );
59 mpPrinter = [NSPrinter printerWithName: pStr];
60 [pStr release];
62 NSPrintInfo* pShared = [NSPrintInfo sharedPrintInfo];
63 if( pShared )
65 mpPrintInfo = [pShared copy];
66 [mpPrintInfo setPrinter: mpPrinter];
67 mePageOrientation = ([mpPrintInfo orientation] == NSPaperOrientationLandscape) ? Orientation::Landscape : Orientation::Portrait;
68 [mpPrintInfo setOrientation: NSPaperOrientationPortrait];
71 mpGraphics = new AquaSalGraphics();
73 const int nWidth = 100, nHeight = 100;
74 mpContextMemory.reset(static_cast<sal_uInt8*>(rtl_allocateMemory(nWidth * 4 * nHeight)),
75 &rtl_freeMemory);
77 if (mpContextMemory)
79 mrContext = CGBitmapContextCreate(mpContextMemory.get(),
80 nWidth, nHeight, 8, nWidth * 4,
81 GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst);
82 if( mrContext )
83 SetupPrinterGraphics( mrContext );
87 AquaSalInfoPrinter::~AquaSalInfoPrinter()
89 delete mpGraphics;
90 if( mpPrintInfo )
91 [mpPrintInfo release];
92 if( mrContext )
93 CFRelease( mrContext );
96 void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
98 if( mpGraphics )
100 if( mpPrintInfo )
102 // FIXME: get printer resolution
103 long nDPIX = 720, nDPIY = 720;
104 NSSize aPaperSize = [mpPrintInfo paperSize];
106 NSRect aImageRect = [mpPrintInfo imageablePageBounds];
107 if( mePageOrientation == Orientation::Portrait )
109 // move mirrored CTM back into paper
110 double dX = 0, dY = aPaperSize.height;
111 // move CTM to reflect imageable area
112 dX += aImageRect.origin.x;
113 dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
114 CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY );
115 // scale to be top/down and reflect our "virtual" DPI
116 CGContextScaleCTM( i_rContext, 72.0/double(nDPIX), -(72.0/double(nDPIY)) );
118 else
120 // move CTM to reflect imageable area
121 double dX = aImageRect.origin.x, dY = aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
122 CGContextTranslateCTM( i_rContext, -dX, -dY );
123 // turn by 90 degree
124 CGContextRotateCTM( i_rContext, M_PI/2 );
125 // move turned CTM back into paper
126 dX = aPaperSize.height;
127 dY = -aPaperSize.width;
128 CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX );
129 // scale to be top/down and reflect our "virtual" DPI
130 CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) );
132 mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY );
134 else
135 OSL_FAIL( "no print info in SetupPrinterGraphics" );
139 SalGraphics* AquaSalInfoPrinter::AcquireGraphics()
141 SalGraphics* pGraphics = mbGraphics ? nullptr : mpGraphics;
142 mbGraphics = true;
143 return pGraphics;
146 void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* )
148 mbGraphics = false;
151 bool AquaSalInfoPrinter::Setup( weld::Window*, ImplJobSetup* )
153 return false;
156 bool AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData )
158 // FIXME: implement driver data
159 if( io_pSetupData && io_pSetupData->GetDriverData() )
160 return SetData( JobSetFlags::ALL, io_pSetupData );
162 bool bSuccess = true;
164 // set system type
165 io_pSetupData->SetSystem( JOBSETUP_SYSTEM_MAC );
167 // get paper format
168 if( mpPrintInfo )
170 NSSize aPaperSize = [mpPrintInfo paperSize];
171 double width = aPaperSize.width, height = aPaperSize.height;
172 // set paper
173 PaperInfo aInfo( PtTo10Mu( width ), PtTo10Mu( height ) );
174 aInfo.doSloppyFit();
175 io_pSetupData->SetPaperFormat( aInfo.getPaper() );
176 if( io_pSetupData->GetPaperFormat() == PAPER_USER )
178 io_pSetupData->SetPaperWidth( PtTo10Mu( width ) );
179 io_pSetupData->SetPaperHeight( PtTo10Mu( height ) );
181 else
183 io_pSetupData->SetPaperWidth( 0 );
184 io_pSetupData->SetPaperHeight( 0 );
187 // set orientation
188 io_pSetupData->SetOrientation( mePageOrientation );
190 io_pSetupData->SetPaperBin( 0 );
191 io_pSetupData->SetDriverData( static_cast<sal_uInt8*>(rtl_allocateMemory( 4 )) );
192 io_pSetupData->SetDriverDataLen( 4 );
194 else
195 bSuccess = false;
197 return bSuccess;
200 void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation )
203 Orientation ePaperOrientation = Orientation::Portrait;
204 const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation );
206 if( pPaper )
208 NSString* pPaperName = [CreateNSString( OStringToOUString(PaperInfo::toPSName(pPaper->getPaper()), RTL_TEXTENCODING_ASCII_US) ) autorelease];
209 [mpPrintInfo setPaperName: pPaperName];
211 else if( i_nWidth > 0 && i_nHeight > 0 )
213 NSSize aPaperSize = { static_cast<CGFloat>(TenMuToPt(i_nWidth)), static_cast<CGFloat>(TenMuToPt(i_nHeight)) };
214 [mpPrintInfo setPaperSize: aPaperSize];
216 // this seems counterintuitive
217 mePageOrientation = i_eSetOrientation;
220 bool AquaSalInfoPrinter::SetData( JobSetFlags i_nFlags, ImplJobSetup* io_pSetupData )
222 if( ! io_pSetupData || io_pSetupData->GetSystem() != JOBSETUP_SYSTEM_MAC )
223 return false;
225 if( mpPrintInfo )
227 if( i_nFlags & JobSetFlags::ORIENTATION )
228 mePageOrientation = io_pSetupData->GetOrientation();
230 if( i_nFlags & JobSetFlags::PAPERSIZE )
232 // set paper format
233 long width = 21000, height = 29700;
234 if( io_pSetupData->GetPaperFormat() == PAPER_USER )
236 // #i101108# sanity check
237 if( io_pSetupData->GetPaperWidth() && io_pSetupData->GetPaperHeight() )
239 width = io_pSetupData->GetPaperWidth();
240 height = io_pSetupData->GetPaperHeight();
243 else
245 PaperInfo aInfo( io_pSetupData->GetPaperFormat() );
246 width = aInfo.getWidth();
247 height = aInfo.getHeight();
250 setPaperSize( width, height, mePageOrientation );
254 return mpPrintInfo != nil;
257 sal_uInt16 AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* )
259 return 0;
262 OUString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup*, sal_uInt16 )
264 return OUString();
267 sal_uInt32 AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType )
269 switch( i_nType )
271 case PrinterCapType::SupportDialog:
272 return 0;
273 case PrinterCapType::Copies:
274 return 0xffff;
275 case PrinterCapType::CollateCopies:
276 return 0xffff;
277 case PrinterCapType::SetOrientation:
278 return 1;
279 case PrinterCapType::SetPaperSize:
280 return 1;
281 case PrinterCapType::SetPaper:
282 return 1;
283 case PrinterCapType::ExternalDialog:
284 return officecfg::Office::Common::Misc::UseSystemPrintDialog::get()
285 ? 1 : 0;
286 case PrinterCapType::PDF:
287 return 1;
288 case PrinterCapType::UsePullModel:
289 return 1;
290 default: break;
292 return 0;
295 void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*,
296 long& o_rOutWidth, long& o_rOutHeight,
297 Point& rPageOffset,
298 Size& rPaperSize )
300 if( mpPrintInfo )
302 sal_Int32 nDPIX = 72, nDPIY = 72;
303 mpGraphics->GetResolution( nDPIX, nDPIY );
304 const double fXScaling = static_cast<double>(nDPIX)/72.0,
305 fYScaling = static_cast<double>(nDPIY)/72.0;
307 NSSize aPaperSize = [mpPrintInfo paperSize];
308 rPaperSize.setWidth( static_cast<long>( double(aPaperSize.width) * fXScaling ) );
309 rPaperSize.setHeight( static_cast<long>( double(aPaperSize.height) * fYScaling ) );
311 NSRect aImageRect = [mpPrintInfo imageablePageBounds];
312 rPageOffset.setX( static_cast<long>( aImageRect.origin.x * fXScaling ) );
313 rPageOffset.setY( static_cast<long>( (aPaperSize.height - aImageRect.size.height - aImageRect.origin.y) * fYScaling ) );
314 o_rOutWidth = static_cast<long>( aImageRect.size.width * fXScaling );
315 o_rOutHeight = static_cast<long>( aImageRect.size.height * fYScaling );
317 if( mePageOrientation == Orientation::Landscape )
319 std::swap( o_rOutWidth, o_rOutHeight );
320 // swap width and height
321 long n = rPaperSize.Width();
322 rPaperSize.setWidth(rPaperSize.Height());
323 rPaperSize.setHeight(n);
324 // swap offset x and y
325 n = rPageOffset.X();
326 rPageOffset.setX(rPageOffset.Y());
327 rPageOffset.setY(n);
332 static Size getPageSize( vcl::PrinterController const & i_rController, sal_Int32 i_nPage )
334 Size aPageSize;
335 uno::Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) );
336 for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty )
338 if ( aPageParms[ nProperty ].Name == "PageSize" )
340 awt::Size aSize;
341 aPageParms[ nProperty].Value >>= aSize;
342 aPageSize.setWidth( aSize.Width );
343 aPageSize.setHeight( aSize.Height );
344 break;
347 return aPageSize;
350 bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName,
351 const OUString& i_rJobName,
352 const OUString& /*i_rAppName*/,
353 ImplJobSetup* i_pSetupData,
354 vcl::PrinterController& i_rController
357 if( mbJob )
358 return false;
360 bool bSuccess = false;
361 bool bWasAborted = false;
362 AquaSalInstance* pInst = GetSalData()->mpInstance;
363 PrintAccessoryViewState aAccViewState;
364 sal_Int32 nAllPages = 0;
366 // reset IsLastPage
367 i_rController.setLastPage( false );
369 // update job data
370 if( i_pSetupData )
371 SetData( JobSetFlags::ALL, i_pSetupData );
373 // do we want a progress panel ?
374 bool bShowProgressPanel = true;
375 beans::PropertyValue* pMonitor = i_rController.getValue( OUString( "MonitorVisible" ) );
376 if( pMonitor )
377 pMonitor->Value >>= bShowProgressPanel;
378 if( ! i_rController.isShowDialogs() )
379 bShowProgressPanel = false;
381 // possibly create one job for collated output
382 bool bSinglePrintJobs = false;
383 beans::PropertyValue* pSingleValue = i_rController.getValue( OUString( "PrintCollateAsSingleJobs" ) );
384 if( pSingleValue )
386 pSingleValue->Value >>= bSinglePrintJobs;
389 // FIXME: jobStarted() should be done after the print dialog has ended (if there is one)
390 // how do I know when that might be ?
391 i_rController.jobStarted();
393 int nCopies = i_rController.getPrinter()->GetCopyCount();
394 int nJobs = 1;
395 if( bSinglePrintJobs )
397 nJobs = nCopies;
398 nCopies = 1;
401 for( int nCurJob = 0; nCurJob < nJobs; nCurJob++ )
403 aAccViewState.bNeedRestart = true;
406 if( aAccViewState.bNeedRestart )
408 mnCurPageRangeStart = 0;
409 mnCurPageRangeCount = 0;
410 nAllPages = i_rController.getFilteredPageCount();
413 aAccViewState.bNeedRestart = false;
415 Size aCurSize( 21000, 29700 );
416 if( nAllPages > 0 )
418 mnCurPageRangeCount = 1;
419 aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
420 Size aNextSize( aCurSize );
422 // print pages up to a different size
423 while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
425 aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
426 if( aCurSize == aNextSize // same page size
428 (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
431 mnCurPageRangeCount++;
433 else
434 break;
437 else
438 mnCurPageRangeCount = 0;
440 // now for the current run
441 mnStartPageOffsetX = mnStartPageOffsetY = 0;
442 // setup the paper size and orientation
443 // do this on our associated Printer object, since that is
444 // out interface to the applications which occasionally rely on the paper
445 // information (e.g. brochure printing scales to the found paper size)
446 // also SetPaperSizeUser has the advantage that we can share a
447 // platform independent paper matching algorithm
448 VclPtr<Printer> pPrinter( i_rController.getPrinter() );
449 pPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) );
450 pPrinter->SetPaperSizeUser( aCurSize, true );
452 // create view
453 NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
455 NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
457 // set filename
458 if( i_pFileName )
460 [mpPrintInfo setJobDisposition: NSPrintSaveJob];
461 NSString* pPath = CreateNSString( *i_pFileName );
462 [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintJobSavingURL];
463 [pPath release];
466 [pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies];
467 if( nCopies > 1 )
468 [pPrintDict setObject: [[NSNumber numberWithBool: pPrinter->IsCollateCopy()] autorelease] forKey: NSPrintMustCollate];
469 [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
470 [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
471 // #i103253# weird: for some reason, autoreleasing the value below like the others above
472 // leads do a double free malloc error. Why this value should behave differently from all the others
473 // is a mystery.
474 [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
476 // create print operation
477 NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo];
479 if( pPrintOperation )
481 NSObject* pReleaseAfterUse = nil;
482 bool bShowPanel = !i_rController.isDirectPrint()
483 && (officecfg::Office::Common::Misc::UseSystemPrintDialog::
484 get())
485 && i_rController.isShowDialogs();
486 [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
487 [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
489 // set job title (since MacOSX 10.5)
490 if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
491 [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
493 if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accessory view
494 pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
496 bSuccess = true;
497 mbJob = true;
498 pInst->startedPrintJob();
499 BOOL wasSuccessful = [pPrintOperation runOperation];
500 pInst->endedPrintJob();
501 bSuccess = wasSuccessful;
502 bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
503 mbJob = false;
504 if( pReleaseAfterUse )
505 [pReleaseAfterUse release];
508 mnCurPageRangeStart += mnCurPageRangeCount;
509 mnCurPageRangeCount = 1;
510 } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
513 // inform application that it can release its data
514 // this is awkward, but the XRenderable interface has no method for this,
515 // so we need to call XRenderadble::render one last time with IsLastPage = true
516 i_rController.setLastPage( true );
517 GDIMetaFile aPageFile;
518 if( mrContext )
519 SetupPrinterGraphics( mrContext );
520 i_rController.getFilteredPageFile( 0, aPageFile );
522 i_rController.setJobState( bWasAborted
523 ? view::PrintableState_JOB_ABORTED
524 : view::PrintableState_JOB_SPOOLED );
526 mnCurPageRangeStart = mnCurPageRangeCount = 0;
528 return bSuccess;
531 bool AquaSalInfoPrinter::EndJob()
533 mnStartPageOffsetX = mnStartPageOffsetY = 0;
534 mbJob = false;
535 return true;
538 bool AquaSalInfoPrinter::AbortJob()
540 mbJob = false;
542 // FIXME: implementation
543 return false;
546 SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData )
548 if( i_bNewJobData && i_pSetupData )
549 SetPrinterData( i_pSetupData );
551 CGContextRef rContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
553 SetupPrinterGraphics( rContext );
555 return mpGraphics;
558 bool AquaSalInfoPrinter::EndPage()
560 mpGraphics->InvalidateContext();
561 return true;
564 AquaSalPrinter::AquaSalPrinter( AquaSalInfoPrinter* i_pInfoPrinter ) :
565 mpInfoPrinter( i_pInfoPrinter )
569 AquaSalPrinter::~AquaSalPrinter()
573 bool AquaSalPrinter::StartJob( const OUString* i_pFileName,
574 const OUString& i_rJobName,
575 const OUString& i_rAppName,
576 ImplJobSetup* i_pSetupData,
577 vcl::PrinterController& i_rController )
579 return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController );
582 bool AquaSalPrinter::StartJob( const OUString* /*i_pFileName*/,
583 const OUString& /*i_rJobName*/,
584 const OUString& /*i_rAppName*/,
585 sal_uInt32 /*i_nCopies*/,
586 bool /*i_bCollate*/,
587 bool /*i_bDirect*/,
588 ImplJobSetup* )
590 OSL_FAIL( "should never be called" );
591 return false;
594 bool AquaSalPrinter::EndJob()
596 return mpInfoPrinter->EndJob();
599 SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* i_pSetupData, bool i_bNewJobData )
601 return mpInfoPrinter->StartPage( i_pSetupData, i_bNewJobData );
604 void AquaSalPrinter::EndPage()
606 mpInfoPrinter->EndPage();
609 void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
611 m_aPaperFormats.clear();
612 m_bPapersInit = true;
614 if( mpPrinter )
616 SAL_WNODEPRECATED_DECLARATIONS_PUSH
617 //TODO: 10.9 statusForTable:, stringListForKey:inTable:
618 if( [mpPrinter statusForTable: @"PPD"] == NSPrinterTableOK )
620 NSArray* pPaperNames = [mpPrinter stringListForKey: @"PageSize" inTable: @"PPD"];
621 if( pPaperNames )
623 unsigned int nPapers = [pPaperNames count];
624 for( unsigned int i = 0; i < nPapers; i++ )
626 NSString* pPaper = [pPaperNames objectAtIndex: i];
627 // first try to match the name
628 OString aPaperName( [pPaper UTF8String] );
629 Paper ePaper = PaperInfo::fromPSName( aPaperName );
630 if( ePaper != PAPER_USER )
632 m_aPaperFormats.push_back( PaperInfo( ePaper ) );
634 else
636 NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
637 if( aPaperSize.width > 0 && aPaperSize.height > 0 )
639 PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
640 PtTo10Mu( aPaperSize.height ) );
641 if( aInfo.getPaper() == PAPER_USER )
642 aInfo.doSloppyFit();
643 m_aPaperFormats.push_back( aInfo );
649 SAL_WNODEPRECATED_DECLARATIONS_POP
653 const PaperInfo* AquaSalInfoPrinter::matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const
655 if( ! m_bPapersInit )
656 const_cast<AquaSalInfoPrinter*>(this)->InitPaperFormats( nullptr );
658 const PaperInfo* pMatch = nullptr;
659 o_rOrientation = Orientation::Portrait;
660 for( int n = 0; n < 2 ; n++ )
662 for( size_t i = 0; i < m_aPaperFormats.size(); i++ )
664 if( std::abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 50 &&
665 std::abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 50 )
667 pMatch = &m_aPaperFormats[i];
668 return pMatch;
671 o_rOrientation = Orientation::Landscape;
672 std::swap( i_nWidth, i_nHeight );
674 return pMatch;
677 int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
679 return 900;
682 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */