1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
* Copyright (C) 2006 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef GECKO_PRINT_SESSION_H
#define GECKO_PRINT_SESSION_H
#include <nsCOMPtr.h>
#include <nsIPrintSession.h>
#include <nsIWebProgressListener.h>
#include <nsIPrintProgress.h>
#include <nsIPrintProgressParams.h>
#include <nsWeakReference.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtkprintjob.h>
#include <gtk/gtkprinter.h>
#include <gtk/gtkprintjob.h>
class nsIPrintSettings;
class nsIDOMWindow;
/* 0940c973-97e7-476f-a612-4ed9473a0b36 */
#define GECKO_PRINT_SESSION_IID \
{ 0x0940c973, 0x97e7, 0x476f, \
{ 0xa6, 0x12, 0x4e, 0xd9, 0x47, 0x3a, 0x0b, 0x36 } }
#define GECKO_PRINT_SESSION_CLASSNAME "Gecko Print Session"
class GeckoPrintSession : public nsIPrintSession,
public nsIPrintProgress,
public nsIPrintProgressParams,
public nsSupportsWeakReference
{
public:
GeckoPrintSession();
virtual ~GeckoPrintSession();
NS_DECL_ISUPPORTS
NS_DECL_NSIPRINTSESSION
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIPRINTPROGRESS
NS_DECL_NSIPRINTPROGRESSPARAMS
nsresult SetSettings (GtkPrintSettings*, GtkPageSetup*, GtkPrinter*);
void GetSourceFile (nsACString&);
static GeckoPrintSession *FromSettings (nsIPrintSettings *);
void Cancel ();
void StartPrinting ();
void JobStatusChanged ();
void JobDone ();
void JobError (const char *);
private:
GtkPrintSettings *mSettings;
GtkPageSetup *mPageSetup;
GtkPrinter *mPrinter;
GtkPrintJob *mJob;
GtkWidget *mProgressDialog;
GtkWidget *mTitleLabel;
GtkWidget *mProgressBar;
nsCString mSourceFile;
nsCString mTitle;
guint mStartPrintIdleID;
PRPackedBool mSourceFileIsTemp;
PRPackedBool mDone;
PRPackedBool mCancelled;
void SetProgress (PRInt32, PRInt32);
void SetProgressText (const char *);
void LaunchJobOnIdle ();
void DestroyJob ();
};
#endif /* GECKO_PRINT_SESSION_H */
|