50 |
50 |
51 #include <private/qabstractprintdialog_p.h> |
51 #include <private/qabstractprintdialog_p.h> |
52 #include <private/qprintengine_win_p.h> |
52 #include <private/qprintengine_win_p.h> |
53 #include <private/qprinter_p.h> |
53 #include <private/qprinter_p.h> |
54 |
54 |
55 #if defined(Q_CC_MINGW) && !defined(PD_NOCURRENTPAGE) |
55 #if !defined(PD_NOCURRENTPAGE) |
56 #define PD_NOCURRENTPAGE 0x00800000 |
56 #define PD_NOCURRENTPAGE 0x00800000 |
57 #define PD_RESULT_PRINT 1 |
57 #define PD_RESULT_PRINT 1 |
58 #define PD_RESULT_APPLY 2 |
58 #define PD_RESULT_APPLY 2 |
59 #define START_PAGE_GENERAL 0XFFFFFFFF |
59 #define START_PAGE_GENERAL 0XFFFFFFFF |
60 #endif |
60 #endif |
126 // As stated by MSDN, to enable collate option when minpage==maxpage==0 |
126 // As stated by MSDN, to enable collate option when minpage==maxpage==0 |
127 // set the PD_NOPAGENUMS flag |
127 // set the PD_NOPAGENUMS flag |
128 if (pd->nMinPage==0 && pd->nMaxPage==0) |
128 if (pd->nMinPage==0 && pd->nMaxPage==0) |
129 pd->Flags |= PD_NOPAGENUMS; |
129 pd->Flags |= PD_NOPAGENUMS; |
130 |
130 |
131 // we don't have a 'current page' notion in the QPrinter API yet. |
131 // Disable Current Page option if not required as default is Enabled |
132 // Neither do we support more than one page range, so limit those |
132 if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) |
133 // options |
133 pd->Flags |= PD_NOCURRENTPAGE; |
134 pd->Flags |= PD_NOCURRENTPAGE; |
134 |
|
135 // Default to showing the General tab first |
135 pd->nStartPage = START_PAGE_GENERAL; |
136 pd->nStartPage = START_PAGE_GENERAL; |
|
137 |
|
138 // We don't support more than one page range in the QPrinter API yet. |
136 pd->nPageRanges = 1; |
139 pd->nPageRanges = 1; |
137 pd->nMaxPageRanges = 1; |
140 pd->nMaxPageRanges = 1; |
138 |
141 |
139 if (d->ep->printToFile) |
142 if (d->ep->printToFile) |
140 pd->Flags |= PD_PRINTTOFILE; |
143 pd->Flags |= PD_PRINTTOFILE; |
141 Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created)); |
144 Q_ASSERT(parent); |
142 pd->hwndOwner = parent->window()->winId(); |
145 pd->hwndOwner = parent->window()->winId(); |
143 pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); |
146 pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); |
144 pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; |
147 pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; |
145 pd->nCopies = d->ep->num_copies; |
148 pd->nCopies = d->ep->num_copies; |
146 } |
149 } |
151 pdlg->setPrintRange(QPrintDialog::Selection); |
154 pdlg->setPrintRange(QPrintDialog::Selection); |
152 pdlg->setFromTo(0, 0); |
155 pdlg->setFromTo(0, 0); |
153 } else if (pd->Flags & PD_PAGENUMS) { |
156 } else if (pd->Flags & PD_PAGENUMS) { |
154 pdlg->setPrintRange(QPrintDialog::PageRange); |
157 pdlg->setPrintRange(QPrintDialog::PageRange); |
155 pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); |
158 pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); |
156 } else { |
159 } else if (pd->Flags & PD_CURRENTPAGE) { |
|
160 pdlg->setPrintRange(QPrintDialog::CurrentPage); |
|
161 pdlg->setFromTo(0, 0); |
|
162 } else { // PD_ALLPAGES |
157 pdlg->setPrintRange(QPrintDialog::AllPages); |
163 pdlg->setPrintRange(QPrintDialog::AllPages); |
158 pdlg->setFromTo(0, 0); |
164 pdlg->setFromTo(0, 0); |
159 } |
165 } |
160 |
166 |
161 d->ep->printToFile = (pd->Flags & PD_PRINTTOFILE) != 0; |
167 d->ep->printToFile = (pd->Flags & PD_PRINTTOFILE) != 0; |