void SCHtmlExport::exportImageToTmpDir() { // Export slides as image into the temporary export directory KUrl fileUrl; for(int i=0; i < m_parameters.slides.size(); ++i){ fileUrl = m_tmpDirPath; fileUrl.addPath(QString("slide%1.png").arg(i)); KoPAPage *slide = m_parameters.slides.at(i); m_parameters.kprView->exportPageThumbnail(slide,fileUrl, slide->size().toSize(), "PNG", -1); } }
// update pages which have a duplicate master page foreach (KoPAPage * page, pages) { KoPAPage * p = dynamic_cast<KoPAPage*>(page); Q_ASSERT(p); if (p) { KoPAMasterPage * masterPage(p->masterPage()); QMap<KoPAMasterPage*, KoPAMasterPage*>::const_iterator pageIt(updateMasterPage.constFind(masterPage)); if (pageIt != updateMasterPage.constEnd()) { p->setMasterPage(pageIt.value()); } } }
void SCPresenterViewInterface::setPreviewSize(const QSize &size) { m_previewSize = size; m_canvas->setFixedSize(size); // set the thumbnail for next page preview Q_ASSERT(m_activePage != -1); KoPAPage *nextPage = 0; if (m_activePage != m_pages.count() - 1) { nextPage = m_pages.at(m_activePage + 1); } else { nextPage = m_pages.at(m_activePage); } m_nextSlidePreview->setPixmap(nextPage->thumbnail(m_previewSize)); }
void KoPABackgroundToolWidget::slotActivePageChanged() { KoPAPageBase * page = m_tool->view()->activePage(); KoPAPage * normalPage = dynamic_cast<KoPAPage *>( page ); widget.useMasterBackground->setEnabled( normalPage ); widget.displayMasterShapes->setEnabled( normalPage ); if ( normalPage ) { widget.useMasterBackground->setChecked( normalPage->displayMasterBackground() ); widget.displayMasterShapes->setChecked( normalPage->displayMasterShapes() ); } else { widget.useMasterBackground->setChecked( false ); widget.displayMasterShapes->setChecked( false ); } }
QList<KoPAPage *> KoPADocument::loadOdfPages(const KXmlElement &body, KoPALoadingContext &context) { if (d->masterPages.isEmpty()) { // we require at least one master page. Auto create one if the doc was faulty. d->masterPages << newMasterPage(); } QList<KoPAPage *> pages; KXmlElement element; forEachElement(element, body) { if (element.tagName() == "page" && element.namespaceURI() == KOdfXmlNS::draw) { KoPAPage *page = newPage(static_cast<KoPAMasterPage*>(d->masterPages.first())); page->loadOdf(element, context); pages.append(page); } } return pages; }
void KPrAnimationDirector::updateActivePage( KoPAPageBase * page ) { deactivate(); if ( m_canvas == m_view->kopaCanvas() ) { m_view->viewMode()->updateActivePage( page ); } else { QList<KoShape*> shapes = page->shapes(); m_canvas->shapeManager()->setShapes(shapes, KoShapeManager::AddWithoutRepaint); //Make the top most layer active if ( !shapes.isEmpty() ) { KoShapeLayer* layer = dynamic_cast<KoShapeLayer*>( shapes.last() ); m_canvas->shapeManager()->selection()->setActiveLayer( layer ); } // if the page is not a master page itself set shapes of the master page KoPAPage * paPage = dynamic_cast<KoPAPage *>( page ); Q_ASSERT( paPage ); KoPAMasterPage * masterPage = paPage->masterPage(); QList<KoShape*> masterShapes = masterPage->shapes(); m_canvas->masterShapeManager()->setShapes(masterShapes, KoShapeManager::AddWithoutRepaint); // Make the top most layer active if ( !masterShapes.isEmpty() ) { KoShapeLayer* layer = dynamic_cast<KoShapeLayer*>( masterShapes.last() ); m_canvas->masterShapeManager()->selection()->setActiveLayer( layer ); } } KPrPage * kprPage = dynamic_cast<KPrPage *>( page ); Q_ASSERT( kprPage ); if (m_pageIndex > m_pages.size() || m_pageIndex < 0) { m_pageIndex = m_pages.indexOf(page); } m_animations = kprPage->animations().steps(); // it can be that the pages have different sizes. So we need to recalulate // the zoom when we change the page updateZoom( m_canvas->size() ); }
KoPAOdfPageSaveHelper::KoPAOdfPageSaveHelper( KoPADocument * doc, QList<KoPAPageBase *> pages ) : m_doc(doc), m_context(0) { foreach( KoPAPageBase * page, pages ) { if ( dynamic_cast<KoPAPage *>( page ) ) { m_pages.append( page ); } else { m_masterPages.append( page ); } } if ( m_pages.size() > 0 ) { m_masterPages.clear(); // this might result in a different order of master pages when copying to a different document QSet<KoPAPageBase *> masterPages; foreach( KoPAPageBase * page, m_pages ) { KoPAPage * p = static_cast<KoPAPage *>( page ); masterPages.insert( p->masterPage() ); }
void KPrPicturesImport::import(KPrView *view) { m_factory = KoShapeRegistry::instance()->value("PictureShape"); Q_ASSERT(m_factory); if (m_factory) { m_urls = KFileDialog::getOpenUrls(KUrl(), "image/png image/jpeg image/gif"); // TODO there should be a progress bar // instead of the progress bar opening for each loaded picture m_currentPage = view->activePage(); KoPAPage *activePage = dynamic_cast<KoPAPage*>(m_currentPage); if (activePage) { m_masterPage = activePage->masterPage(); m_doc = view->kprDocument(); m_cmd = new KUndo2Command(kundo2_i18n("Insert Pictures")); import(); } } else { kWarning(33001) << "picture shape factory not found"; } }
void SCPresenterViewInterface::setActivePage(int pageIndex) { SCPresenterViewBaseInterface::setActivePage(pageIndex); Q_ASSERT(pageIndex >= 0 && pageIndex < m_pages.size()); KoPAPage *page = m_pages.at(pageIndex); int pageCount = dynamic_cast<SCEndOfSlideShowPage *>(m_pages.last()) ? m_pages.count() - 1 : m_pages.count(); // set the thumbnail for next page preview KoPAPage *nextPage = 0; if (pageIndex != pageCount) { nextPage = m_pages.at(pageIndex + 1); m_nextSlidePreview->setPixmap(nextPage->thumbnail(m_previewSize)); } else { // End of presentation, just a black pixmap for the next slide preview QPixmap pixmap(m_previewSize); pixmap.fill(Qt::black); m_nextSlidePreview->setPixmap(pixmap); } // update the label m_currentSlideLabel->setText(pageIndex != pageCount ? i18n("Current Slide %1 of %2", pageIndex + 1, pageCount) : i18n("End of Slide Show")); // set the presentation notes SCPage *prPage = dynamic_cast<SCPage *>(page); Q_ASSERT(prPage); SCNotes *pageNotes = prPage->pageNotes(); KShape *textShape = pageNotes->textShape(); KTextShapeData *textShapeData = qobject_cast<KTextShapeData *>(textShape->userData()); Q_ASSERT(textShapeData); QTextDocument *document = textShapeData->document()->clone(m_notesTextEdit); m_notesTextEdit->setDocument(document); }
void KoPABackgroundToolWidget::slotActivePageChanged() { KoPAPageBase * page = m_tool->view()->activePage(); KoPAPage * normalPage = dynamic_cast<KoPAPage *>( page ); widget.useMasterBackground->setEnabled( normalPage ); widget.displayMasterShapes->setEnabled( normalPage ); if ( normalPage ) { widget.useMasterBackground->setChecked( normalPage->displayMasterBackground() ); widget.displayMasterShapes->setChecked( normalPage->displayMasterShapes() ); const bool enableBackgroundEditing = (! normalPage->displayMasterBackground()); widget.backgroundImage->setEnabled(enableBackgroundEditing); widget.useStrokeAndFillDockerLabel->setEnabled(enableBackgroundEditing); } else { widget.useMasterBackground->setChecked( false ); widget.displayMasterShapes->setChecked( false ); widget.backgroundImage->setEnabled(true); widget.useStrokeAndFillDockerLabel->setEnabled(true); } }