aquaprintview.mm (cd426cce) | aquaprintview.mm (01367266) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 18 unchanged lines hidden (view full) --- 27#include "vcl/print.hxx" 28 29#include "aqua/aquaprintview.h" 30#include "aqua/salprn.h" 31 32@implementation AquaPrintView 33-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter 34{ | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 18 unchanged lines hidden (view full) --- 27#include "vcl/print.hxx" 28 29#include "aqua/aquaprintview.h" 30#include "aqua/salprn.h" 31 32@implementation AquaPrintView 33-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter 34{ |
35 NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] }; | 35 NSRect aRect = { NSZeroPoint, [pInfoPrinter->getPrintInfo() paperSize] }; |
36 if( (self = [super initWithFrame: aRect]) != nil ) 37 { 38 mpController = pController; 39 mpInfoPrinter = pInfoPrinter; 40 } 41 return self; 42} 43 --- 13 unchanged lines hidden (view full) --- 57 nWidth = 1; 58 NSRect aRect = { NSMakePoint( page % nWidth, page / nWidth), aPaperSize }; 59 return aRect; 60} 61 62-(NSPoint)locationOfPrintRect: (NSRect)aRect 63{ 64 (void)aRect; | 36 if( (self = [super initWithFrame: aRect]) != nil ) 37 { 38 mpController = pController; 39 mpInfoPrinter = pInfoPrinter; 40 } 41 return self; 42} 43 --- 13 unchanged lines hidden (view full) --- 57 nWidth = 1; 58 NSRect aRect = { NSMakePoint( page % nWidth, page / nWidth), aPaperSize }; 59 return aRect; 60} 61 62-(NSPoint)locationOfPrintRect: (NSRect)aRect 63{ 64 (void)aRect; |
65 NSPoint aPoint = { 0, 0 }; 66 return aPoint; | 65 return NSZeroPoint; |
67} 68 69-(void)drawRect: (NSRect)rect 70{ 71 NSPoint aPoint = [self locationOfPrintRect: rect]; 72 mpInfoPrinter->setStartPageOffset( static_cast<int>(rect.origin.x), static_cast<int>(rect.origin.y) ); 73 NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize]; 74 int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x); 75 76 // page count is 1 based 77 if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) ) 78 mpController->printFilteredPage( nPage-1 ); 79} 80@end | 66} 67 68-(void)drawRect: (NSRect)rect 69{ 70 NSPoint aPoint = [self locationOfPrintRect: rect]; 71 mpInfoPrinter->setStartPageOffset( static_cast<int>(rect.origin.x), static_cast<int>(rect.origin.y) ); 72 NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize]; 73 int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x); 74 75 // page count is 1 based 76 if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) ) 77 mpController->printFilteredPage( nPage-1 ); 78} 79@end |