4#include <QtPrintSupport/qtprintsupportglobal.h>
11#include <private/qapplication_p.h>
14#include <private/qprintengine_win_p.h>
15#include "../kernel/qprinter_p.h"
17#if !defined(PD_NOCURRENTPAGE)
18#define PD_NOCURRENTPAGE 0x00800000
19#define PD_RESULT_PRINT 1
20#define PD_RESULT_APPLY 2
21#define START_PAGE_GENERAL 0XFFFFFFFF
49 DEVMODE *devMode =
d->ep->devMode;
52 int size =
sizeof(DEVMODE) + devMode->dmDriverExtra;
53 pd->hDevMode = GlobalAlloc(GHND,
size);
55 void *dest = GlobalLock(pd->hDevMode);
56 memcpy(dest, devMode,
size);
57 GlobalUnlock(pd->hDevMode);
62 pd->hDevNames = tempDevNames;
64 pd->Flags = PD_RETURNDC;
65 pd->Flags |= PD_USEDEVMODECOPIESANDCOLLATE;
68 pd->Flags |= PD_NOSELECTION;
75 pd->Flags |= PD_DISABLEPRINTTOFILE;
78 pd->Flags |= PD_SELECTION;
80 pd->Flags |= PD_PAGENUMS;
82 pd->Flags |= PD_CURRENTPAGE;
84 pd->Flags |= PD_ALLPAGES;
88 if (pd->nMinPage==0 && pd->nMaxPage==0)
89 pd->Flags |= PD_NOPAGENUMS;
100 pd->nMaxPageRanges = 1;
102 if (
d->ep->printToFile)
103 pd->Flags |= PD_PRINTTOFILE;
109 pd->nCopies =
d->printer->copyCount();
114 if (pd->Flags & PD_SELECTION) {
117 }
else if (pd->Flags & PD_PAGENUMS) {
119 pdlg->
setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage);
120 }
else if (pd->Flags & PD_CURRENTPAGE) {
128 d->ep->printToFile = (pd->Flags & PD_PRINTTOFILE) != 0;
130 d->engine->setGlobalDevMode(pd->hDevNames, pd->hDevMode);
132 if (
d->ep->printToFile &&
d->ep->fileName.isEmpty())
133 d->ep->fileName =
"FILE:"_L1;
134 else if (!
d->ep->printToFile &&
d->ep->fileName ==
"FILE:"_L1)
135 d->ep->fileName.clear();
141 qWarning(
"QPrintDialog: Cannot be used on non-native printers");
179 return d->openWindowsPrintDialogModally();
195 q->QDialog::setVisible(
true);
203 PRINTPAGERANGE pageRange;
205 memset(&
pd, 0,
sizeof(PRINTDLGEX));
206 pd.lStructSize =
sizeof(PRINTDLGEX);
207 pd.lpPageRanges = &pageRange;
218 if ((
pd.Flags & PD_PAGENUMS)
219 && (
pd.lpPageRanges[0].nFromPage >
pd.lpPageRanges[0].nToPage))
221 pd.lpPageRanges[0].nFromPage = 1;
222 pd.lpPageRanges[0].nToPage = 1;
231 QPrintDialog::tr(
"Print"),
232 QPrintDialog::tr(
"The 'From' value cannot be greater than the 'To' value."));
236 q->QDialog::setVisible(
false);
250 GlobalFree(tempDevNames);
254 return result && doPrinting;
268 (
void)
d->openWindowsPrintDialogModally();
274#include "moc_qprintdialog.cpp"
The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure pri...
PrintRange printRange() const
Returns the print range.
void setFromTo(int fromPage, int toPage)
Sets the range in the print dialog to be from from to to.
int toPage() const
Returns the last page to be printed.
int maxPage() const
Returns the maximum page in the page range.
int minPage() const
Returns the minimum page in the page range.
QPrinter * printer() const
Returns the printer that this printer dialog operates on.
int fromPage() const
Returns the first page to be printed By default, this value is set to 0.
void setPrintRange(PrintRange range)
Sets the print range option in to be range.
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or \nullptr if no applica...
static QPlatformNativeInterface * platformNativeInterface()
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
virtual void setPageRanges(const QPageRanges &ranges)
QWin32PrintEnginePrivate * ep
int openWindowsPrintDialogModally()
QWin32PrintEngine * engine
The QPrintDialog class provides a dialog for specifying the printer's configuration.
int exec() override
\reimp
~QPrintDialog()
Destroys the print dialog.
bool testOption(PrintDialogOption option) const
Returns true if the given option is enabled; otherwise, returns false.
QPrintDialog(QPrinter *printer, QWidget *parent=nullptr)
Constructs a new modal printer dialog for the given printer with the given parent.
QString printerName() const
Returns the printer name.
OutputFormat outputFormat() const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
HGLOBAL * createGlobalDevNames()
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble q
static bool warnIfNotNative(QPrinter *printer)
static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, QPrintDialog *pdlg, QPrintDialogPrivate *d, HGLOBAL *tempDevNames)
#define START_PAGE_GENERAL
static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d)
app setAttribute(Qt::AA_DontShowIconsInMenus)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent