- if ( !m_ok )
- return ;
-
- m_logicalFunction = wxCOPY;
-// m_textAlignment = wxALIGN_TOP_LEFT;
- m_backgroundMode = wxTRANSPARENT;
-
- m_textForegroundColour = *wxBLACK;
- m_textBackgroundColour = *wxWHITE;
- m_pen = *wxBLACK_PEN;
- m_font = *wxNORMAL_FONT;
- m_brush = *wxTRANSPARENT_BRUSH;
- m_backgroundBrush = *wxWHITE_BRUSH;
-
- m_macFontInstalled = false ;
- m_macBrushInstalled = false ;
- m_macPenInstalled = false ;
-
-
- OSStatus err ;
- wxString message ;
-
-#if !TARGET_CARBON
- PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
- m_macLocalOrigin.x = (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
- m_macLocalOrigin.y = (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
-
- Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
- ::ClipRect( &clip ) ;
- err = PrError() ;
- if ( err != noErr )
- {
- message.Printf( "Print Error %d", err ) ;
- wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
- dialog.ShowModal();
- ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
- ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
- ::UMAPrClose() ;
- ::SetPort( macPrintFormerPort ) ;
- m_ok = FALSE ;
- }
-#else
- #if PM_USE_SESSION_APIS
- err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
- (PMPageFormat)m_printData.m_macPageFormat,
- nil);
- #else
- err = PMBeginPage(m_macPrintSessionPort, nil);
- #endif
- if ( err != noErr )
- {
- message.Printf( "Print Error %d", err ) ;
- wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
- dialog.ShowModal();
- #if PM_USE_SESSION_APIS
- PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
- PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
- UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ;
- #else
- PMEndPage(m_macPrintSessionPort);
- PMEndDocument(m_macPrintSessionPort);
- UMAPrClose() ;
- #endif
- ::SetPort( macPrintFormerPort ) ;
- m_ok = FALSE ;
- }
-#endif
+ wxASSERT_MSG( Ok() , wxT("Called wxPrinterDC::StartDoc from an invalid object") ) ;
+
+ if ( !m_ok )
+ return false ;
+
+ if ( m_nativePrinterDC->StartDoc(this, message ) )
+ {
+ // in case we have to do additional things when successful
+ }
+ m_ok = m_nativePrinterDC->Ok() ;
+ if ( !m_ok )
+ {
+ wxString message ;
+ message.Printf( wxT("Print Error %u"), m_nativePrinterDC->GetStatus() ) ;
+ wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
+ dialog.ShowModal();
+ }
+
+ return m_ok ;