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