xref: /aoo42x/main/vcl/inc/salprn.hxx (revision ebfcd9af)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALPRN_HXX
25 #define _SV_SALPRN_HXX
26 
27 #include <tools/string.hxx>
28 #include <vcl/sv.h>
29 #include <vcl/dllapi.h>
30 #include <vcl/prntypes.hxx>
31 
32 #include <vector>
33 
34 class SalGraphics;
35 class SalFrame;
36 struct ImplJobSetup;
37 namespace vcl { class PrinterController; }
38 
39 // -----------------------
40 // - SalPrinterQueueInfo -
41 // -----------------------
42 
43 struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo
44 {
45 	XubString				maPrinterName;
46 	XubString				maDriver;
47 	XubString				maLocation;
48 	XubString				maComment;
49 	sal_uLong					mnStatus;
50 	sal_uLong					mnJobs;
51 	void*					mpSysData;
52 
53 							SalPrinterQueueInfo();
54 							~SalPrinterQueueInfo();
55 };
56 
57 // ------------------
58 // - SalInfoPrinter -
59 // ------------------
60 
61 class VCL_PLUGIN_PUBLIC SalInfoPrinter
62 {
63 public:
64     std::vector< PaperInfo  >			m_aPaperFormats;	// all printer supported formats
65     bool								m_bPapersInit;		// set to true after InitPaperFormats
66     bool                                m_bCompatMetrics;
67 
SalInfoPrinter()68     SalInfoPrinter() : m_bPapersInit( false ), m_bCompatMetrics( false ) {}
69     virtual ~SalInfoPrinter();
70 
71 	// SalGraphics or NULL, but two Graphics for all SalFrames
72 	// must be returned
73 	virtual SalGraphics*			GetGraphics() = 0;
74 	virtual void					ReleaseGraphics( SalGraphics* pGraphics ) = 0;
75 
76 	virtual sal_Bool					Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) = 0;
77     // This function set the driver data and
78     // set the new indepen data in pSetupData
79 	virtual sal_Bool					SetPrinterData( ImplJobSetup* pSetupData ) = 0;
80     // This function merged the indepen driver data
81     // and set the new indepen data in pSetupData
82     // Only the data must changed, where the bit
83     // in nFlags is set
84 	virtual sal_Bool					SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ) = 0;
85 
86 	virtual void					GetPageInfo( const ImplJobSetup* pSetupData,
87                                                  long& rOutWidth, long& rOutHeight,
88                                                  long& rPageOffX, long& rPageOffY,
89                                                  long& rPageWidth, long& rPageHeight ) = 0;
90 	virtual sal_uLong					GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) = 0;
91 	virtual sal_uLong					GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0;
92 	virtual String					GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin ) = 0;
93 	// fills m_aPaperFormats and sets m_bPapersInit to true
94     virtual void					InitPaperFormats( const ImplJobSetup* pSetupData ) = 0;
95     // returns angle that a landscape page will be turned counterclockwise wrt to portrait
96     virtual int					GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0;
97 };
98 
99 // --------------
100 // - SalPrinter -
101 // --------------
102 
103 class VCL_PLUGIN_PUBLIC SalPrinter
104 {
105 public: 					// public for Sal Implementation
SalPrinter()106     SalPrinter() {}
107     virtual ~SalPrinter();
108 
109 	virtual sal_Bool					StartJob( const String* pFileName,
110                                               const String& rJobName,
111                                               const String& rAppName,
112                                               sal_uLong nCopies,
113                                               bool bCollate,
114                                               bool bDirect,
115                                               ImplJobSetup* pSetupData ) = 0;
116 
117     // implement for pull model print systems only,
118     // default implementations (see salvtables.cxx) just returns sal_False
119     virtual sal_Bool                    StartJob( const String* pFileName,
120                                               const String& rJobName,
121                                               const String& rAppName,
122                                               ImplJobSetup* pSetupData,
123                                               vcl::PrinterController& rController );
124 
125 	virtual sal_Bool					EndJob() = 0;
126 	virtual sal_Bool					AbortJob() = 0;
127 	virtual SalGraphics*			StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData ) = 0;
128 	virtual sal_Bool					EndPage() = 0;
129 	virtual sal_uLong					GetErrorCode() = 0;
130 
131 };
132 
133 #endif // _SV_SALPRN_HXX
134