Mac OS X Porting - Native Printing

From Apache OpenOffice Wiki
Revision as of 22:08, 8 October 2006 by Ybart (Talk | contribs)

Jump to: navigation, search

This page is dedicated to the native printing implementation in OpenOffice.org for Mac OS X

OpenOffice.org side

This part describes what can be found in the OOo APIs, how it is implemented and how it will be changed.

Concerned OOo modules

  • psprint
  • vcl
  • svtools

VCL

What we know about vcl.

SalPrinter class

SalPrinter is a virtual class intended for managing print jobs. It is composed of virtual fonctions, and a dummy constructor. This class is inherited by PspSalPrinter, WinSalPrinter, and of course by AquaSalPrinter (see AquaSalPrinter class).

   class VCL_DLLPUBLIC SalPrinter
   {
   public: // public for Sal Implementation
       SalPrinter() {}
       virtual ~SalPrinter();
       virtual BOOL StartJob( const XubString* pFileName,
                                       const XubString& rJobName,
                                       const XubString& rAppName,
                                       ULONG nCopies, BOOL bCollate,
                                       ImplJobSetup* pSetupData ) = 0;
       virtual BOOL EndJob() = 0;
       virtual BOOL AbortJob() = 0;
       virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) = 0;
       virtual BOOL EndPage() = 0;
       virtual ULONG GetErrorCode() = 0;
   };

PspSalPrinter class

PspSalPrinter means PostScript Print System Abstraction Layer Printer. Its implementation is located. As the name suggests it relies on features psprint module.

TODO : Discuss about PspSalPrinter implementation.

Printer class

This is an abstraction class of a printer driver. You can entirely set up the printer there and start print jobs. What we need here is to make our native dialog access to this Printer. The we will need to make this class access to OS API rather than psprint.

AquaSalPrinter class is located in vcl/aqua/source/gdi/print.cxx

This class inherits of OutputDevice and is derivated in ImplQPrinter.

OutputDevice class

This class allows applications such as Writer to draw graphics elements (pixels, lines, rects, characters, strings, etc...).

This class is located in vcl/source/gdi/outdev.cxx, vcl/source/gdi/outdev[2-6].cxx

At this time, we don't need to know the details of this class. We will focus on it when we will use the Carbon Printing API.

AquaSalPrinter class

AquaSalPrinter class is located in vcl/aqua/source/gdi/salprn.cxx

Headers are in :

vcl/inc/salinst.hxx  
vcl/inc/salgdi.hxx    
vcl/inc/salprn.hxx
Aqua implementation :
vcl/aqua/inc/salprn.h  (AquaSalPrinter class implementation, inherits from SalPrinter)

psprint

What we know about psprint.

svtools

What we need to know about svtools. Mostly it provides us the Print Dialog, and some other Print related dialogs.

PrintDialog class

This class is responsible for drawing the print dialog we usaually view when we choose the Print option of the File menu. The current implementation uses this class to draw the print dialog. In our Aqua native implementation, we want to use the on provided by Carbon API. To achieve this, we want to know the functionality of this class, and let carbon manage the functionality maybe at this level or maybe in a other lever (higher or lower). We also need to know how this class provides information to the Printer instance.

  • The header of this class is located in svtools/source/dialogs/printdlg.hxx
  • The implementation of this class is located in svtools/source/dialogs/printdlg.cxx

TODO : details the implementation of this class

Mac OS X API side

This part describes what can be used and how we intend to use it.

The strategy is to first use the Carbon API to get Print Information and to provide an Aqua User Inerface for printing. Then, we will try to replace the current printing API to the native one, allowing to reduce dependencies, and the total package size.

Todo : implement missing methods, using Carbon API

Links

Link for Mac OS X API documentation

http://developer.apple.com/documentation/Carbon/Reference/CarbonPrintingManager_Ref/index.html

Starting point for documentation

http://developer.apple.com/documentation/Carbon/Printing-date.html#//apple_ref/doc/uid/TP30000440-TP30000420-TP30000455 http://developer.apple.com/documentation/Carbon/Conceptual/CPM_Concepts/cpm_chap4/chapter_4_section_1.html

This work is part of http://wiki.services.openoffice.org/wiki/Mac_OS_X_Porting_-_Work_Areas/Todo%27s

Created: Ericb 19:33, 4 June 2006 (CEST) Last modification: Ericb 11:00, 3 September 2006 (CEST)

Personal tools