xref: /aoo42x/main/vcl/inc/salprn.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 _SV_SALPRN_HXX
29 #define _SV_SALPRN_HXX
30 
31 #include <tools/string.hxx>
32 #include <vcl/sv.h>
33 #include <vcl/dllapi.h>
34 #include <vcl/prntypes.hxx>
35 
36 #include <vector>
37 
38 class SalGraphics;
39 class SalFrame;
40 struct ImplJobSetup;
41 namespace vcl { class PrinterController; }
42 
43 // -----------------------
44 // - SalPrinterQueueInfo -
45 // -----------------------
46 
47 struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo
48 {
49 	XubString				maPrinterName;
50 	XubString				maDriver;
51 	XubString				maLocation;
52 	XubString				maComment;
53 	sal_uLong					mnStatus;
54 	sal_uLong					mnJobs;
55 	void*					mpSysData;
56 
57 							SalPrinterQueueInfo();
58 							~SalPrinterQueueInfo();
59 };
60 
61 // ------------------
62 // - SalInfoPrinter -
63 // ------------------
64 
65 class VCL_PLUGIN_PUBLIC SalInfoPrinter
66 {
67 public:
68     std::vector< PaperInfo  >			m_aPaperFormats;	// all printer supported formats
69     bool								m_bPapersInit;		// set to true after InitPaperFormats
70     bool                                m_bCompatMetrics;
71 
72     SalInfoPrinter() : m_bPapersInit( false ), m_bCompatMetrics( false ) {}
73     virtual ~SalInfoPrinter();
74 
75 	// SalGraphics or NULL, but two Graphics for all SalFrames
76 	// must be returned
77 	virtual SalGraphics*			GetGraphics() = 0;
78 	virtual void					ReleaseGraphics( SalGraphics* pGraphics ) = 0;
79 
80 	virtual sal_Bool					Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) = 0;
81     // This function set the driver data and
82     // set the new indepen data in pSetupData
83 	virtual sal_Bool					SetPrinterData( ImplJobSetup* pSetupData ) = 0;
84     // This function merged the indepen driver data
85     // and set the new indepen data in pSetupData
86     // Only the data must changed, where the bit
87     // in nFlags is set
88 	virtual sal_Bool					SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ) = 0;
89 
90 	virtual void					GetPageInfo( const ImplJobSetup* pSetupData,
91                                                  long& rOutWidth, long& rOutHeight,
92                                                  long& rPageOffX, long& rPageOffY,
93                                                  long& rPageWidth, long& rPageHeight ) = 0;
94 	virtual sal_uLong					GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) = 0;
95 	virtual sal_uLong					GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0;
96 	virtual String					GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin ) = 0;
97 	// fills m_aPaperFormats and sets m_bPapersInit to true
98     virtual void					InitPaperFormats( const ImplJobSetup* pSetupData ) = 0;
99     // returns angle that a landscape page will be turned counterclockwise wrt to portrait
100     virtual int					GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0;
101 };
102 
103 // --------------
104 // - SalPrinter -
105 // --------------
106 
107 class VCL_PLUGIN_PUBLIC SalPrinter
108 {
109 public: 					// public for Sal Implementation
110     SalPrinter() {}
111     virtual ~SalPrinter();
112 
113 	virtual sal_Bool					StartJob( const String* pFileName,
114                                               const String& rJobName,
115                                               const String& rAppName,
116                                               sal_uLong nCopies,
117                                               bool bCollate,
118                                               bool bDirect,
119                                               ImplJobSetup* pSetupData ) = 0;
120 
121     // implement for pull model print systems only,
122     // default implementations (see salvtables.cxx) just returns sal_False
123     virtual sal_Bool                    StartJob( const String* pFileName,
124                                               const String& rJobName,
125                                               const String& rAppName,
126                                               ImplJobSetup* pSetupData,
127                                               vcl::PrinterController& rController );
128 
129 	virtual sal_Bool					EndJob() = 0;
130 	virtual sal_Bool					AbortJob() = 0;
131 	virtual SalGraphics*			StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData ) = 0;
132 	virtual sal_Bool					EndPage() = 0;
133 	virtual sal_uLong					GetErrorCode() = 0;
134 
135 };
136 
137 #endif // _SV_SALPRN_HXX
138