42 #ifndef QT_NO_PRINTDIALOG 49 #include <private/qapplication_p.h> 51 #include <private/qabstractprintdialog_p.h> 52 #include <private/qprintengine_win_p.h> 53 #include <private/qprinter_p.h> 55 #if !defined(PD_NOCURRENTPAGE) 56 #define PD_NOCURRENTPAGE 0x00800000 57 #define PD_RESULT_PRINT 1 58 #define PD_RESULT_APPLY 2 59 #define START_PAGE_GENERAL 0XFFFFFFFF 91 DEVMODE *devMode = d->
ep->devMode;
94 int size =
sizeof(DEVMODE) + devMode->dmDriverExtra;
95 pd->hDevMode = GlobalAlloc(GHND, size);
97 void *dest = GlobalLock(pd->hDevMode);
98 memcpy(dest, devMode, size);
99 GlobalUnlock(pd->hDevMode);
104 pd->hDevNames = tempDevNames;
106 pd->Flags = PD_RETURNDC;
107 pd->Flags |= PD_USEDEVMODECOPIESANDCOLLATE;
112 pd->nMinPage = pdlg->
minPage();
113 pd->nMaxPage = pdlg->
maxPage();
117 pd->Flags |= PD_DISABLEPRINTTOFILE;
120 pd->Flags |= PD_SELECTION;
122 pd->Flags |= PD_PAGENUMS;
124 pd->Flags |= PD_CURRENTPAGE;
130 if (pd->nMinPage==0 && pd->nMaxPage==0)
142 pd->nMaxPageRanges = 1;
144 if (d->
ep->printToFile)
145 pd->Flags |= PD_PRINTTOFILE;
150 pd->nCopies = d->
ep->num_copies;
155 if (pd->Flags & PD_SELECTION) {
158 }
else if (pd->Flags & PD_PAGENUMS) {
160 pdlg->
setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage);
161 }
else if (pd->Flags & PD_CURRENTPAGE) {
169 d->
ep->printToFile = (pd->Flags & PD_PRINTTOFILE) != 0;
171 d->
ep->readDevnames(pd->hDevNames);
172 d->
ep->readDevmode(pd->hDevMode);
173 d->
ep->updateCustomPaperSize();
175 if (d->
ep->printToFile && d->
ep->fileName.isEmpty())
176 d->
ep->fileName = d->
ep->port;
178 d->
ep->fileName.clear();
184 qWarning(
"QPrintDialog: Cannot be used on non-native printers");
218 return d->openWindowsPrintDialogModally();
226 parent = parent->
window();
239 HGLOBAL *tempDevNames =
ep->createDevNames();
245 PRINTPAGERANGE pageRange;
247 memset(&pd, 0,
sizeof(PRINTDLGEX));
248 pd.lStructSize =
sizeof(PRINTDLGEX);
249 pd.lpPageRanges = &pageRange;
255 result = (PrintDlgEx(&pd) == S_OK);
260 if ((pd.Flags & PD_PAGENUMS)
261 && (pd.lpPageRanges[0].nFromPage > pd.lpPageRanges[0].nToPage))
263 pd.lpPageRanges[0].nFromPage = 1;
264 pd.lpPageRanges[0].nToPage = 1;
273 QPrintDialog::tr(
"The 'From' value cannot be greater than the 'To' value."),
288 printer->d_func()->validPrinter = !
ep->name.isEmpty();
292 GlobalFree(tempDevNames);
294 q->done(result && doPrinting);
296 return result && doPrinting;
310 (void)
d->openWindowsPrintDialogModally();
316 #include "moc_qprintdialog.cpp" 318 #endif // QT_NO_PRINTDIALOG
void _q_printerChanged(int)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void _q_printToFileChanged(int)
QMacPrintEnginePrivate * ep
bool isOptionEnabled(PrintDialogOption option) const
Use QPrintDialog::testOption(option) instead.
void qt_win_eatMouseMove()
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d)
int minPage() const
Returns the minimum page in the page range.
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
Opens a warning message box with the given title and text in front of the specified parent widget...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
~QPrintDialog()
Destroys the print dialog.
The QPrintDialog class provides a dialog for specifying the printer's configuration.
#define QT_BEGIN_NAMESPACE
This macro expands to.
OutputFormat outputFormat() const
Returns the output format for this printer.
void _q_btnPropertiesClicked()
The QPrinter class is a paint device that paints on a printer.
PrintRange printRange() const
Returns the print range.
int fromPage() const
Returns the first page to be printed By default, this value is set to 0.
void _q_chbPrintLastFirstToggled(bool)
int toPage() const
Returns the last page to be printed.
Q_CORE_EXPORT void qWarning(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static bool warnIfNotNative(QPrinter *printer)
void setFromTo(int fromPage, int toPage)
Sets the range in the print dialog to be from from to to.
int exec()
Reimplemented Function
#define START_PAGE_GENERAL
int maxPage() const
Returns the maximum page in the page range.
The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure pri...
#define Q_DECLARE_PUBLIC(Class)
int openWindowsPrintDialogModally()
if(void) toggleToolbarShown
QWin32PrintEnginePrivate * ep
void setVisible(bool visible)
Reimplemented Function
void setPrintRange(PrintRange range)
Sets the print range option in to be range.
void _q_btnBrowseClicked()
void _q_paperSizeChanged(int)
static void leaveModal(QWidget *)
void _q_rbPrintRangeToggled(bool)
static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, QPrintDialog *pdlg, QPrintDialogPrivate *d, HGLOBAL *tempDevNames)
QPrintDialog(QPrinter *printer, QWidget *parent=0)
Constructs a new modal printer dialog for the given printer with the given parent.
static void enterModal(QWidget *)