xref: /trunk/main/vcl/inc/unx/salprn.h (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_SALPRN_H
29 #define _SV_SALPRN_H
30 
31 #include "vcl/jobdata.hxx"
32 #include "printergfx.hxx"
33 #include "printerjob.hxx"
34 #include "salprn.hxx"
35 #include "vclpluginapi.h"
36 
37 class PspGraphics;
38 
39 class PspSalInfoPrinter : public SalInfoPrinter
40 {
41 public:
42 	PspGraphics*			m_pGraphics;
43 	psp::JobData			m_aJobData;
44 	psp::PrinterGfx			m_aPrinterGfx;
45 
46     PspSalInfoPrinter();
47     virtual ~PspSalInfoPrinter();
48 
49     // overload all pure virtual methods
50 	virtual SalGraphics*			GetGraphics();
51 	virtual void					ReleaseGraphics( SalGraphics* pGraphics );
52     virtual sal_Bool					Setup( SalFrame* pFrame, ImplJobSetup* pSetupData );
53 	virtual sal_Bool					SetPrinterData( ImplJobSetup* pSetupData );
54 	virtual sal_Bool					SetData( sal_uIntPtr nFlags, ImplJobSetup* pSetupData );
55 	virtual void					GetPageInfo( const ImplJobSetup* pSetupData,
56                                                  long& rOutWidth, long& rOutHeight,
57                                                  long& rPageOffX, long& rPageOffY,
58                                                  long& rPageWidth, long& rPageHeight );
59 	virtual sal_uIntPtr					GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType );
60 	virtual sal_uIntPtr					GetPaperBinCount( const ImplJobSetup* pSetupData );
61 	virtual String					GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin );
62     virtual void					InitPaperFormats( const ImplJobSetup* pSetupData );
63     virtual int					GetLandscapeAngle( const ImplJobSetup* pSetupData );
64 };
65 
66 class PspSalPrinter : public SalPrinter
67 {
68 public:
69 	String					m_aFileName;
70 	String					m_aTmpFile;
71 	String					m_aFaxNr;
72 	bool					m_bFax:1;
73 	bool					m_bPdf:1;
74 	bool					m_bSwallowFaxNo:1;
75 	bool                    m_bIsPDFWriterJob:1;
76 	PspGraphics*			m_pGraphics;
77 	psp::PrinterJob			m_aPrintJob;
78 	psp::JobData			m_aJobData;
79 	psp::PrinterGfx			m_aPrinterGfx;
80     sal_uIntPtr					m_nCopies;
81     bool                    m_bCollate;
82     SalInfoPrinter*         m_pInfoPrinter;
83 
84     PspSalPrinter( SalInfoPrinter* );
85     virtual ~PspSalPrinter();
86 
87     // overload all pure virtual methods
88     using SalPrinter::StartJob;
89 	virtual sal_Bool					StartJob( const XubString* pFileName,
90                                               const XubString& rJobName,
91                                               const XubString& rAppName,
92                                               sal_uIntPtr nCopies,
93                                               bool bCollate,
94                                               bool bDirect,
95                                               ImplJobSetup* pSetupData );
96     virtual sal_Bool                    StartJob( const String*,
97                                               const String&,
98                                               const String&,
99                                               ImplJobSetup*,
100                                               vcl::PrinterController& i_rController );
101 	virtual sal_Bool					EndJob();
102 	virtual sal_Bool					AbortJob();
103 	virtual SalGraphics*			StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData );
104 	virtual sal_Bool					EndPage();
105 	virtual sal_uIntPtr					GetErrorCode();
106 };
107 
108 class Timer;
109 
110 namespace vcl_sal {
111 class VCLPLUG_GEN_PUBLIC PrinterUpdate
112 {
113     static Timer*			pPrinterUpdateTimer;
114     static int				nActiveJobs;
115 
116     static void doUpdate();
117     DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
118 public:
119     static void update();
120     static void jobStarted() { nActiveJobs++; }
121     static void jobEnded();
122 };
123 }
124 
125 #endif // _SV_SALPRN_H
126 
127 
128