| 2285 | } |
| 2286 | |
| 2287 | void WorksheetView::exportPaint(QPainter* painter, const QRectF& targetRect, const QRectF& sourceRect, const bool background, const bool selection) { |
| 2288 | // hide the magnification window, shouldn't be exported |
| 2289 | bool magnificationActive = false; |
| 2290 | if (m_magnificationWindow && m_magnificationWindow->isVisible()) { |
| 2291 | magnificationActive = true; |
| 2292 | m_magnificationWindow->setVisible(false); |
| 2293 | } |
| 2294 | |
| 2295 | // draw the background |
| 2296 | m_isPrinting = true; |
| 2297 | if (background) { |
| 2298 | painter->save(); |
| 2299 | const qreal scaleX = targetRect.width() / sourceRect.width(); |
| 2300 | const qreal scaleY = targetRect.height() / sourceRect.height(); |
| 2301 | painter->scale(scaleX, scaleY); |
| 2302 | drawBackground(painter, targetRect); |
| 2303 | painter->restore(); |
| 2304 | } |
| 2305 | |
| 2306 | // draw the scene items |
| 2307 | if (!selection) // if no selection effects have to be exported, set the printing flag to suppress it in the paint()'s of the children |
| 2308 | m_worksheet->setPrinting(true); |
| 2309 | scene()->render(painter, QRectF(), sourceRect, Qt::IgnoreAspectRatio); |
| 2310 | if (!selection) |
| 2311 | m_worksheet->setPrinting(false); |
| 2312 | m_isPrinting = false; |
| 2313 | |
| 2314 | // show the magnification window if it was active before |
| 2315 | if (magnificationActive) |
| 2316 | m_magnificationWindow->setVisible(true); |
| 2317 | } |
| 2318 | |
| 2319 | void WorksheetView::print(QPrinter* printer) { |
| 2320 | m_isPrinting = true; |
nothing calls this directly
no test coverage detected