xref: /aoo41x/main/vcl/unx/headless/svpprn.hxx (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 _SVP_SVPPRN_HXX
29 #define _SVP_SVPPRN_HXX
30 
31 #include "vcl/jobdata.hxx"
32 
33 #include "printergfx.hxx"
34 #include "printerjob.hxx"
35 #include "salprn.hxx"
36 
37 #include "vclpluginapi.h"
38 
39 class PspGraphics;
40 
41 class PspSalInfoPrinter : public SalInfoPrinter
42 {
43 public:
44 	PspGraphics*			m_pGraphics;
45 	psp::JobData			m_aJobData;
46 	psp::PrinterGfx			m_aPrinterGfx;
47 
48     PspSalInfoPrinter();
49     virtual ~PspSalInfoPrinter();
50 
51     // overload all pure virtual methods
52 	virtual SalGraphics*			GetGraphics();
53 	virtual void					ReleaseGraphics( SalGraphics* pGraphics );
54     virtual sal_Bool					Setup( SalFrame* pFrame, ImplJobSetup* pSetupData );
55 	virtual sal_Bool					SetPrinterData( ImplJobSetup* pSetupData );
56 	virtual sal_Bool					SetData( sal_uLong nFlags, ImplJobSetup* pSetupData );
57 	virtual void					GetPageInfo( const ImplJobSetup* pSetupData,
58                                                  long& rOutWidth, long& rOutHeight,
59                                                  long& rPageOffX, long& rPageOffY,
60                                                  long& rPageWidth, long& rPageHeight );
61 	virtual sal_uLong					GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType );
62 	virtual sal_uLong					GetPaperBinCount( const ImplJobSetup* pSetupData );
63 	virtual String					GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin );
64     virtual void					InitPaperFormats( const ImplJobSetup* pSetupData );
65     virtual int					GetLandscapeAngle( const ImplJobSetup* pSetupData );
66 };
67 
68 class PspSalPrinter : public SalPrinter
69 {
70 public:
71 	String					m_aFileName;
72 	String					m_aTmpFile;
73 	String					m_aFaxNr;
74 	bool					m_bFax:1;
75 	bool					m_bPdf:1;
76 	bool					m_bSwallowFaxNo:1;
77 	PspGraphics*			m_pGraphics;
78 	psp::PrinterJob			m_aPrintJob;
79 	psp::JobData			m_aJobData;
80 	psp::PrinterGfx			m_aPrinterGfx;
81     sal_uLong					m_nCopies;
82     bool                    m_bCollate;
83     SalInfoPrinter*         m_pInfoPrinter;
84 
85     PspSalPrinter( SalInfoPrinter* );
86     virtual ~PspSalPrinter();
87 
88     // overload all pure virtual methods
89     using SalPrinter::StartJob;
90 	virtual sal_Bool					StartJob( const XubString* pFileName,
91                                               const XubString& rJobName,
92                                               const XubString& rAppName,
93                                               sal_uLong nCopies,
94                                               bool bCollate,
95                                               bool bDirect,
96                                               ImplJobSetup* pSetupData );
97 	virtual sal_Bool					EndJob();
98 	virtual sal_Bool					AbortJob();
99 	virtual SalGraphics*			StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData );
100 	virtual sal_Bool					EndPage();
101 	virtual sal_uLong					GetErrorCode();
102 };
103 
104 class Timer;
105 
106 namespace vcl_sal {
107 class VCLPLUG_SVP_PUBLIC PrinterUpdate
108 {
109     static Timer*			pPrinterUpdateTimer;
110     static int				nActiveJobs;
111 
112     static void doUpdate();
113     DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
114 public:
115     static void update();
116     static void jobStarted() { nActiveJobs++; }
117     static void jobEnded();
118 };
119 }
120 
121 #endif // _SVP_SVPPRN_HXX
122 
123 
124