Files
libreoffice/vcl/inc/vcl/print.hxx

503 lines
22 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: print.hxx,v $
2008-10-01 13:31:44 +00:00
* $Revision: 1.6.86.1 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SV_PRINT_HXX
#define _SV_PRINT_HXX
#include "tools/errcode.hxx"
#include "vcl/sv.h"
#include "vcl/dllapi.h"
#include "vcl/outdev.hxx"
#include "vcl/prntypes.hxx"
#include "vcl/jobset.hxx"
#include "vcl/gdimtf.hxx"
#include "tools/stream.hxx"
#include "tools/multisel.hxx"
#include "com/sun/star/beans/PropertyValue.hpp"
#include <boost/shared_ptr.hpp>
struct SalPrinterInfoQueue;
class SalInfoPrinter;
struct SalPrinterQueueInfo;
class SalPrinter;
class VirtualDevice;
class Window;
class ImplQPrinter;
struct ImplPrivatePrinterData;
namespace vcl {
class PrinterListener;
class PrintDialog;
}
// -----------------
// - Printer-Types -
// -----------------
#define PAGEQUEUE_ALLPAGES 0xFFFF
enum PrinterSupport { SUPPORT_SET_ORIENTATION, SUPPORT_SET_PAPERBIN,
SUPPORT_SET_PAPERSIZE, SUPPORT_SET_PAPER,
SUPPORT_COPY, SUPPORT_COLLATECOPY,
SUPPORT_SETUPDIALOG, SUPPORT_FAX, SUPPORT_PDF };
// ---------------
// - PrinterPage -
// ---------------
class VCL_DLLPUBLIC PrinterPage
{
GDIMetaFile* mpMtf;
JobSetup maJobSetup;
UINT16 mbNewJobSetup;
public:
PrinterPage() : mpMtf( new GDIMetaFile() ) {}
PrinterPage( GDIMetaFile* pMtf, BOOL bNewJobSetup, const JobSetup& rSetup ) :
mpMtf( pMtf ), maJobSetup( rSetup ), mbNewJobSetup( bNewJobSetup ) {}
~PrinterPage() { delete mpMtf; }
GDIMetaFile* GetGDIMetaFile() const { return mpMtf; }
const JobSetup& GetJobSetup() const { return maJobSetup; }
BOOL IsNewJobSetup() const { return (mbNewJobSetup != 0); }
friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const PrinterPage& rPage )
{ rOStm << rPage.mbNewJobSetup; rOStm << rPage.maJobSetup; rPage.mpMtf->Write( rOStm ); return rOStm; }
friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, PrinterPage& rPage )
{ return rIStm >> rPage.mbNewJobSetup >> rPage.maJobSetup >> *rPage.mpMtf; }
};
// -------------
// - QueueInfo -
// -------------
class VCL_DLLPUBLIC QueueInfo
{
friend class Printer;
private:
XubString maPrinterName;
XubString maDriver;
XubString maLocation;
XubString maComment;
sal_uInt32 mnStatus;
sal_uInt32 mnJobs;
public:
QueueInfo();
QueueInfo( const QueueInfo& rInfo );
~QueueInfo();
const XubString& GetPrinterName() const { return maPrinterName; }
const XubString& GetDriver() const { return maDriver; }
const XubString& GetLocation() const { return maLocation; }
const XubString& GetComment() const { return maComment; }
sal_uInt32 GetStatus() const { return mnStatus; }
sal_uInt32 GetJobs() const { return mnJobs; }
bool operator==( const QueueInfo& rInfo ) const;
friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, QueueInfo& rInfo );
friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const QueueInfo& rInfo );
};
// ------------------
// - PrinterOptions -
// ------------------
enum PrinterTransparencyMode
{
PRINTER_TRANSPARENCY_AUTO = 0,
PRINTER_TRANSPARENCY_NONE = 1
};
// -----------------------------------------------------------------------------
enum PrinterGradientMode
{
PRINTER_GRADIENT_STRIPES = 0,
PRINTER_GRADIENT_COLOR = 1
};
// -----------------------------------------------------------------------------
enum PrinterBitmapMode
{
PRINTER_BITMAP_OPTIMAL = 0,
PRINTER_BITMAP_NORMAL = 1,
PRINTER_BITMAP_RESOLUTION = 2
};
// -----------------------------------------------------------------------------
class VCL_DLLPUBLIC PrinterOptions
{
private:
BOOL mbReduceTransparency;
PrinterTransparencyMode meReducedTransparencyMode;
BOOL mbReduceGradients;
PrinterGradientMode meReducedGradientsMode;
USHORT mnReducedGradientStepCount;
BOOL mbReduceBitmaps;
PrinterBitmapMode meReducedBitmapMode;
USHORT mnReducedBitmapResolution;
BOOL mbReducedBitmapsIncludeTransparency;
BOOL mbConvertToGreyscales;
public:
PrinterOptions();
~PrinterOptions();
BOOL IsReduceTransparency() const { return mbReduceTransparency; }
void SetReduceTransparency( BOOL bSet ) { mbReduceTransparency = bSet; }
PrinterTransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
void SetReducedTransparencyMode( PrinterTransparencyMode eMode ) { meReducedTransparencyMode = eMode; }
BOOL IsReduceGradients() const { return mbReduceGradients; }
void SetReduceGradients( BOOL bSet ) { mbReduceGradients = bSet; }
PrinterGradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
void SetReducedGradientMode( PrinterGradientMode eMode ) { meReducedGradientsMode = eMode; }
USHORT GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
void SetReducedGradientStepCount( USHORT nStepCount ) { mnReducedGradientStepCount = nStepCount; }
BOOL IsReduceBitmaps() const { return mbReduceBitmaps; }
void SetReduceBitmaps( BOOL bSet ) { mbReduceBitmaps = bSet; }
PrinterBitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
void SetReducedBitmapMode( PrinterBitmapMode eMode ) { meReducedBitmapMode = eMode; }
USHORT GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
void SetReducedBitmapResolution( USHORT nResolution ) { mnReducedBitmapResolution = nResolution; }
BOOL IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
void SetReducedBitmapIncludesTransparency( BOOL bSet ) { mbReducedBitmapsIncludeTransparency = bSet; }
BOOL IsConvertToGreyscales() const { return mbConvertToGreyscales; }
void SetConvertToGreyscales( BOOL bSet ) { mbConvertToGreyscales = bSet; }
};
// -----------
// - Printer -
// -----------
class VCL_DLLPUBLIC Printer : public OutputDevice
{
friend class OutputDevice;
friend class ImplQPrinter;
private:
ImplPrivatePrinterData* mpPrinterData;
SalInfoPrinter* mpInfoPrinter;
SalPrinter* mpPrinter;
Printer* mpJobPrinter;
SalGraphics* mpJobGraphics;
Printer* mpPrev;
Printer* mpNext;
VirtualDevice* mpDisplayDev;
ImplQPrinter* mpQPrinter;
GDIMetaFile* mpQMtf;
PrinterOptions* mpPrinterOptions;
XubString maPrinterName;
XubString maDriver;
XubString maPrintFile;
XubString maJobName;
JobSetup maJobSetup;
Point maPageOffset;
Size maPaperSize;
ULONG mnError;
USHORT mnCurPage;
USHORT mnCurPrintPage;
USHORT mnPageQueueSize;
USHORT mnCopyCount;
BOOL mbDefPrinter;
BOOL mbPrinting;
BOOL mbJobActive;
BOOL mbCollateCopy;
BOOL mbPrintFile;
BOOL mbInPrintPage;
BOOL mbNewJobSetup;
BOOL mbIsQueuePrinter;
BOOL mbUserSetupCompleted;
BOOL mbUserSetupResult;
Link maErrorHdl;
Link maStartPrintHdl;
Link maEndPrintHdl;
Link maPrintPageHdl;
SAL_DLLPRIVATE void ImplInitData();
SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
SAL_DLLPRIVATE void ImplInitDisplay( const Window* pWindow );
SAL_DLLPRIVATE static SalPrinterQueueInfo* ImplGetQueueInfo( const XubString& rPrinterName,
const XubString* pDriver );
SAL_DLLPRIVATE void ImplUpdatePageData();
SAL_DLLPRIVATE void ImplUpdateFontList();
SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup& );
DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* );
SAL_DLLPRIVATE bool StartJob( const XubString& rJobName, boost::shared_ptr<vcl::PrinterListener>& );
static SAL_DLLPRIVATE ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError );
public:
SAL_DLLPRIVATE void ImplEndPrint();
SAL_DLLPRIVATE void ImplUpdateQuickStatus();
private:
SAL_DLLPRIVATE Printer( const Printer& rPrinter );
SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter );
#ifdef _SPOOLPRINTER_EXT
public:
void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient );
void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient );
#endif // _SPOOLPRINTER_EXT
protected:
void SetSelfAsQueuePrinter( BOOL bQueuePrinter ) { mbIsQueuePrinter = bQueuePrinter; }
BOOL IsQueuePrinter() const { return mbIsQueuePrinter; }
public:
Printer();
Printer( const Window* pWindow );
Printer( const JobSetup& rJobSetup );
Printer( const QueueInfo& rQueueInfo );
Printer( const XubString& rPrinterName );
virtual ~Printer();
static const std::vector< rtl::OUString >& GetPrinterQueues();
static const QueueInfo* GetQueueInfo( const String& rPrinterName, bool bStatusUpdate );
static XubString GetDefaultPrinterName();
virtual void Error();
virtual void StartPrint();
virtual void EndPrint();
virtual void PrintPage();
const XubString& GetName() const { return maPrinterName; }
const XubString& GetDriverName() const { return maDriver; }
BOOL IsDefPrinter() const { return mbDefPrinter; }
BOOL IsDisplayPrinter() const { return mpDisplayDev != NULL; }
BOOL IsValid() const { return !IsDisplayPrinter(); }
ULONG GetCapabilities( USHORT nType ) const;
BOOL HasSupport( PrinterSupport eFeature ) const;
BOOL SetJobSetup( const JobSetup& rSetup );
const JobSetup& GetJobSetup() const { return maJobSetup; }
String GetJobValue( const String& rKey ) const { return maJobSetup.GetValue( rKey ); }
void SetJobValue( const String& rKey, const String& rValue ) { maJobSetup.SetValue( rKey, rValue ); }
BOOL Setup( Window* pWindow = NULL );
BOOL SetPrinterProps( const Printer* pPrinter );
void SetPrinterOptions( const PrinterOptions& rOptions ) { *mpPrinterOptions = rOptions; }
const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); }
BOOL SetOrientation( Orientation eOrient );
Orientation GetOrientation() const;
DuplexMode GetDuplexMode() const;
// returns the angle that a landscape page will be turned counterclockwise
// wrt to portrait. The return value may be only valid for
// the current paper
int GetLandscapeAngle() const;
BOOL SetPaperBin( USHORT nPaperBin );
USHORT GetPaperBin() const;
BOOL SetPaper( Paper ePaper );
BOOL SetPaperSizeUser( const Size& rSize );
Paper GetPaper() const;
// returns number of available paper formats
int GetPaperInfoCount() const;
// returns info about paper format nPaper
const vcl::PaperInfo& GetPaperInfo( int nPaper ) const;
// sets current paper to format contained in rInfo
BOOL SetPaperFromInfo( const vcl::PaperInfo& rInfo );
// gets info about paper fromat best matching current paper
const vcl::PaperInfo& GetCurrentPaperInfo() const;
USHORT GetPaperBinCount() const;
XubString GetPaperBinName( USHORT nPaperBin ) const;
const Size& GetPaperSizePixel() const { return maPaperSize; }
Size GetPaperSize() const { return PixelToLogic( maPaperSize ); }
const Point& GetPageOffsetPixel() const { return maPageOffset; }
Point GetPageOffset() const { return PixelToLogic( maPageOffset ); }
BOOL SetCopyCount( USHORT nCopy, BOOL bCollate = FALSE );
USHORT GetCopyCount() const { return mnCopyCount; }
BOOL IsCollateCopy() const { return mbCollateCopy; }
USHORT GetCurPrintPage() const { return mnCurPrintPage; }
BOOL IsPrinting() const { return mbPrinting; }
void SetPrintFile( const XubString& rFileName ) { maPrintFile = rFileName; }
const XubString& GetPrintFile() const { return maPrintFile; }
void EnablePrintFile( BOOL bEnable ) { mbPrintFile = bEnable; }
BOOL IsPrintFileEnabled() const { return mbPrintFile; }
BOOL StartJob( const XubString& rJobName );
BOOL EndJob();
BOOL AbortJob();
const XubString& GetCurJobName() const { return maJobName; }
USHORT GetCurPage() const { return mnCurPage; }
BOOL IsJobActive() const { return mbJobActive; }
BOOL StartPage();
BOOL EndPage();
void SetPageQueueSize( USHORT nPages ) { mnPageQueueSize = nPages; }
USHORT GetPageQueueSize() const { return mnPageQueueSize; }
ULONG GetError() const { return ERRCODE_TOERROR(mnError); }
ULONG GetErrorCode() const { return mnError; }
void SetErrorHdl( const Link& rLink ) { maErrorHdl = rLink; }
const Link& GetErrorHdl() const { return maErrorHdl; }
void SetStartPrintHdl( const Link& rLink ) { maStartPrintHdl = rLink; }
const Link& GetStartPrintHdl() const { return maStartPrintHdl; }
void SetEndPrintHdl( const Link& rLink ) { maEndPrintHdl = rLink; }
const Link& GetEndPrintHdl() const { return maEndPrintHdl; }
void SetPrintPageHdl( const Link& rLink ) { maPrintPageHdl = rLink; }
const Link& GetPrintPageHdl() const { return maPrintPageHdl; }
void Compat_OldPrinterMetrics( bool bSet );
/** Notify that the next StartJob belongs to a UI less "direct print" job
*
* deprecated: the canonical way to notify a UI less job is to set the
* JobSetup value "IsQuickJob" to "true". If set at all, the "IsQuickJob" value
* on JobSetup will be preferred. However if no "IsQuickJob" value is set,
* setting SetNextJobIsQuick will cause the following StartJob to set this value
* to "true" in the current JobSetup.
CWS-TOOLING: integrate CWS vcl98 2009-01-16 15:17:38 +0100 pl r266422 : #i93515# add fix for compiz (thanks cmc) 2009-01-15 10:55:36 +0100 thb r266352 : #i97399# start==end angle means no arc at all 2009-01-14 18:54:37 +0100 pl r266327 : #i96536# #i96396# add: pagescroll for wheel events (thanks mod) 2009-01-14 18:21:06 +0100 pl r266325 : #i96536# #i96396# add: gestures, bracket matching (thanks mod) 2009-01-13 12:03:29 +0100 hdu r266206 : #i98024# preserve glyph zero-advance for artificial bold and vertical layout (thanks CMC!) 2009-01-12 16:32:20 +0100 hdu r266167 : #i97991# fix rotated text: temporary workaround for #i87686# 2009-01-08 17:16:17 +0100 hdu r266028 : #159054# ignore empty ATSULayout 2009-01-08 16:59:05 +0100 hdu r266026 : #159054# prevent invalid ATSUStyle 2009-01-07 19:04:06 +0100 pl r265976 : #158288# add extraction of fonts and individual object streams to pdfunzip 2009-01-07 14:42:17 +0100 pl r265969 : #i93011# workaround our ancient accelerator mechanisms to have deeper child window hirearchies working 2009-01-07 14:39:15 +0100 pl r265967 : #i93011# workaround our ancient accelerator mechanisms to have deeper child window hirearchies working 2009-01-07 11:10:58 +0100 hdu r265956 : #i97522# getPixel() returns COL_BLACK on printers or when out of bounds 2009-01-06 18:41:48 +0100 pl r265938 : #i97696# do not force user password to owner password after all 2009-01-06 18:00:52 +0100 pl r265934 : #i97157# fix a snafu 2009-01-06 13:23:38 +0100 pl r265914 : #i93515# support for _NET_WM_USER_TIME (thanks cmc) 2009-01-06 12:50:37 +0100 hdu r265912 : #i97538# get rid of compiler warnings for complex logical expressions 2009-01-06 12:49:09 +0100 hdu r265911 : #i97538# get rid of compiler warnings for complex logical expressions 2009-01-06 12:14:07 +0100 hdu r265906 : #i97522# implemented AquaSalGraphics::getPixel() 2008-12-18 16:46:59 +0100 pl r265706 : #i96343# reset quick job flag 2008-12-18 16:44:22 +0100 pl r265705 : #i96343# reset quick job flag 2008-12-18 14:08:22 +0100 pl r265688 : #i93241# fix bit field query 2008-12-18 12:41:52 +0100 pl r265682 : #i93241# eliminate useless static locale variable 2008-12-17 19:23:07 +0100 pl r265654 : #i97064# set language to OOo user configured UI language (thanks cmc) 2008-12-17 17:44:38 +0100 hdu r265651 : #i97326# debug-helper: print cairo version 2008-12-17 17:43:15 +0100 hdu r265650 : #i97326# ignore cairo changing the transformation of our FT_FACE 2008-12-17 14:44:32 +0100 pl r265604 : #i93631# refine control positioning 2008-12-17 12:40:39 +0100 hdu r265596 : #i97167# update VCL.xcu for MacOSX for Japanese (thanks maho!) 2008-12-17 11:59:51 +0100 hdu r265592 : #i97317# code movement to prevent needless and expensive construction/destruction in error path 2008-12-17 11:54:43 +0100 hdu r265590 : #i97317# workaround QUARTZ bug with drawing small polygons 2008-12-16 17:57:02 +0100 pl r265567 : #i97138# select num copies when grabbing focus 2008-12-16 17:15:11 +0100 pl r265561 : #i93173# lazy deletion of toolbars 2008-12-16 16:33:51 +0100 pl r265558 : #i93173# lazy deletion of toolbars: reparent floating DockingWindows in doLazyDelete 2008-12-16 13:23:17 +0100 pl r265536 : #i97196# ensure style engine has been loaded (thanks cmc)
2009-02-11 10:53:35 +00:00
*
* the paramter can be set to "false" again in case a job was not started and the
* printer is to be reused.
*/
CWS-TOOLING: integrate CWS vcl98 2009-01-16 15:17:38 +0100 pl r266422 : #i93515# add fix for compiz (thanks cmc) 2009-01-15 10:55:36 +0100 thb r266352 : #i97399# start==end angle means no arc at all 2009-01-14 18:54:37 +0100 pl r266327 : #i96536# #i96396# add: pagescroll for wheel events (thanks mod) 2009-01-14 18:21:06 +0100 pl r266325 : #i96536# #i96396# add: gestures, bracket matching (thanks mod) 2009-01-13 12:03:29 +0100 hdu r266206 : #i98024# preserve glyph zero-advance for artificial bold and vertical layout (thanks CMC!) 2009-01-12 16:32:20 +0100 hdu r266167 : #i97991# fix rotated text: temporary workaround for #i87686# 2009-01-08 17:16:17 +0100 hdu r266028 : #159054# ignore empty ATSULayout 2009-01-08 16:59:05 +0100 hdu r266026 : #159054# prevent invalid ATSUStyle 2009-01-07 19:04:06 +0100 pl r265976 : #158288# add extraction of fonts and individual object streams to pdfunzip 2009-01-07 14:42:17 +0100 pl r265969 : #i93011# workaround our ancient accelerator mechanisms to have deeper child window hirearchies working 2009-01-07 14:39:15 +0100 pl r265967 : #i93011# workaround our ancient accelerator mechanisms to have deeper child window hirearchies working 2009-01-07 11:10:58 +0100 hdu r265956 : #i97522# getPixel() returns COL_BLACK on printers or when out of bounds 2009-01-06 18:41:48 +0100 pl r265938 : #i97696# do not force user password to owner password after all 2009-01-06 18:00:52 +0100 pl r265934 : #i97157# fix a snafu 2009-01-06 13:23:38 +0100 pl r265914 : #i93515# support for _NET_WM_USER_TIME (thanks cmc) 2009-01-06 12:50:37 +0100 hdu r265912 : #i97538# get rid of compiler warnings for complex logical expressions 2009-01-06 12:49:09 +0100 hdu r265911 : #i97538# get rid of compiler warnings for complex logical expressions 2009-01-06 12:14:07 +0100 hdu r265906 : #i97522# implemented AquaSalGraphics::getPixel() 2008-12-18 16:46:59 +0100 pl r265706 : #i96343# reset quick job flag 2008-12-18 16:44:22 +0100 pl r265705 : #i96343# reset quick job flag 2008-12-18 14:08:22 +0100 pl r265688 : #i93241# fix bit field query 2008-12-18 12:41:52 +0100 pl r265682 : #i93241# eliminate useless static locale variable 2008-12-17 19:23:07 +0100 pl r265654 : #i97064# set language to OOo user configured UI language (thanks cmc) 2008-12-17 17:44:38 +0100 hdu r265651 : #i97326# debug-helper: print cairo version 2008-12-17 17:43:15 +0100 hdu r265650 : #i97326# ignore cairo changing the transformation of our FT_FACE 2008-12-17 14:44:32 +0100 pl r265604 : #i93631# refine control positioning 2008-12-17 12:40:39 +0100 hdu r265596 : #i97167# update VCL.xcu for MacOSX for Japanese (thanks maho!) 2008-12-17 11:59:51 +0100 hdu r265592 : #i97317# code movement to prevent needless and expensive construction/destruction in error path 2008-12-17 11:54:43 +0100 hdu r265590 : #i97317# workaround QUARTZ bug with drawing small polygons 2008-12-16 17:57:02 +0100 pl r265567 : #i97138# select num copies when grabbing focus 2008-12-16 17:15:11 +0100 pl r265561 : #i93173# lazy deletion of toolbars 2008-12-16 16:33:51 +0100 pl r265558 : #i93173# lazy deletion of toolbars: reparent floating DockingWindows in doLazyDelete 2008-12-16 13:23:17 +0100 pl r265536 : #i97196# ensure style engine has been loaded (thanks cmc)
2009-02-11 10:53:35 +00:00
void SetNextJobIsQuick( bool bQuick = true );
/** checks the printer list and updates it necessary
*
* sends a DataChanged event of type DATACHANGED_PRINTER
* if the printer list changed
*/
static void updatePrinters();
/** execute a print job
starts a print job asynchronously (that is will return
*/
static void PrintJob( const boost::shared_ptr<vcl::PrinterListener>& i_pListener,
const JobSetup& i_rInitSetup
);
// implementation detail of PrintJob being asynchronous
// not exported, not usable outside vcl
static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterListener>& i_pListener,
const JobSetup& i_rInitSetup
);
};
namespace vcl
{
class ImplPrinterListenerData;
class VCL_DLLPUBLIC PrinterListener
{
ImplPrinterListenerData* mpImplData;
public:
PrinterListener();
virtual ~PrinterListener();
const boost::shared_ptr<Printer>& getPrinter() const;
/* for implementations: get current job properties as changed by e.g. print dialog
this gets the current set of properties initially told to Printer::PrintJob
For convenience a second sequence will be merged in to get a combined sequence.
In case of duplicate property names, the value of i_MergeList wins.
*/
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
getJobProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rMergeList ) const;
/* get the PorpertyValue of a Property
*/
com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& rPropertyName );
const com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& rPropertyName ) const;
/* return the currently active UI options. These are the same passed to setUIOptions.
*/
const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& getUIOptions() const;
/* set possible UI options. should only be done once before passing the PrinterListener
to Printer::PrintJob
*/
void setUIOptions( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
/* enable/disable an option; this can be used to implement dialog logic.
*/
void enableUIOption( const rtl::OUString& rPropName, bool bEnable );
bool isUIOptionEnabled( const rtl::OUString& rPropName ) const;
virtual int getPageCount() const = 0; // must be overloaded by the app
/* get the page parameters, namely the jobsetup that should be active for the page
(describing among others the physical page size) and the "page size". In writer
case this would probably be the same as the JobSetup since writer sets the page size
draw/impress for example print their page on the paper set on the printer,
possibly adjusting the page size to fit. That means the page size can be different from
the paper size.
*/
// must be overloaded by the app, return page size in 1/100th mm
virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const = 0;
virtual void printPage( int i_nPage ) const = 0; // must be overloaded by the app
virtual void jobFinished(); // optionally release resources bound to the job
2009-03-18 14:46:10 +00:00
// implementation details, not usable outside vcl
2009-03-27 12:57:53 +00:00
int SAL_DLLPRIVATE getFilteredPageCount();
Size SAL_DLLPRIVATE getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf );
Size SAL_DLLPRIVATE getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf );
2009-03-18 14:46:10 +00:00
void SAL_DLLPRIVATE printFilteredPage( int i_nPage );
void SAL_DLLPRIVATE setPrinter( const boost::shared_ptr<Printer>& );
void SAL_DLLPRIVATE setOptionChangeHdl( const Link& );
2009-03-18 14:46:10 +00:00
void SAL_DLLPRIVATE createProgressDialog();
void SAL_DLLPRIVATE setPrintSelection( const rtl::OUString& );
2009-03-28 08:52:14 +00:00
void SAL_DLLPRIVATE setMultipage( int nRows, int nColumns, const Size& rPaperSize );
};
}
#endif // _SV_PRINT_HXX