/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import "PrinterView.h"
#import "java_awt_print_Pageable.h"
#import "java_awt_print_Printable.h"
#import "java_awt_print_PageFormat.h"
#import "ThreadUtilities.h"
#import "GeomUtilities.h"
{
if (self)
{
fCurPainter = NULL;
}
return self;
}
{
if (fCurPageFormat != NULL)
{
}
if (fCurPainter != NULL)
{
fCurPainter = NULL;
}
if (fCurPeekGraphics != NULL)
{
}
}
}
{
static JNF_MEMBER_CACHE(jm_printToPathGraphics, sjc_CPrinterJob, "printToPathGraphics", "(Lsun/print/PeekGraphics;Ljava/awt/print/PrinterJob;Ljava/awt/print/Printable;Ljava/awt/print/PageFormat;IJ)V");
// Create and draw into a new CPrinterGraphics with the current Context.
assert(fCurPageFormat != NULL);
assert(fCurPainter != NULL);
assert(fCurPeekGraphics != NULL);
{
return;
}
CGContextSaveGState(cgRef); //04/28/2004: state needs to be saved here due to addition of lazy state management
JNFCallVoidMethod(env, fPrinterJob, jm_printToPathGraphics, fCurPeekGraphics, fPrinterJob, fCurPainter, fCurPageFormat, jPageIndex, context); // AWT_THREADING Safe (AWTRunLoop)
}
{
jobject o = JNFCallObjectMethod(env, fPrinterJob, jm_getJobName); // AWT_THREADING Safe (known object)
return result;
}
{
{
return NO;
}
{
}
else
{
}
return YES;
}
{
static JNF_MEMBER_CACHE(jm_getPageformatPrintablePeekgraphics, sjc_CPrinterJob, "getPageformatPrintablePeekgraphics", "(I)[Ljava/lang/Object;");
static JNF_MEMBER_CACHE(jm_printAndGetPageFormatArea, sjc_CPrinterJob, "printAndGetPageFormatArea", "(Ljava/awt/print/Printable;Ljava/awt/Graphics;Ljava/awt/print/PageFormat;I)Ljava/awt/geom/Rectangle2D;");
// Assertions removed, and corresponding JNFDeleteGlobalRefs added, for radr://3962543
// Actual fix that will keep these assertions from being true is radr://3205462 ,
// which will hopefully be fixed by the blocking AppKit bug radr://3056694
//assert(fCurPageFormat == NULL);
//assert(fCurPainter == NULL);
//assert(fCurPeekGraphics == NULL);
if(fCurPageFormat != NULL) {
}
if(fCurPainter != NULL) {
}
if(fCurPeekGraphics != NULL) {
}
//+++gdb Check the pageNumber for validity (PageAttrs)
{
return NSZeroRect;
}
jobjectArray objectArray = JNFCallObjectMethod(env, fPrinterJob, jm_getPageformatPrintablePeekgraphics, jPageNumber); // AWT_THREADING Safe (AWTRunLoopMode)
if (objectArray != NULL) {
// Get references to the return objects -> PageFormat, Printable, PeekGraphics
// Cheat - we know we either got NULL or a 3 element array
// Actually print and get the PageFormatArea
jobject pageFormatArea = JNFCallObjectMethod(env, fPrinterJob, jm_printAndGetPageFormatArea, fCurPainter, fCurPeekGraphics, fCurPageFormat, jPageNumber); // AWT_THREADING Safe (AWTRunLoopMode)
if (pageFormatArea != NULL) {
// set page orientation
default:
if (currentOrientation != NSPortraitOrientation) {
}
break;
if (currentOrientation != NSLandscapeOrientation) {
}
break;
}
} else {
result = NSZeroRect;
}
} else {
result = NSZeroRect;
}
return result;
}
{
}
// This is called by -[PrintModel safePrintLoop]
{
// Clean up after ourselves
// Can't put these into -dealloc since that happens (potentially) after the JNIEnv is stale
if (fPrinterJob != NULL)
{
fPrinterJob = NULL;
}
}
{
return TRUE;
}
@end