bool KPrDocument::saveOdfEpilogue( KoPASavingContext & context ) { context.xmlWriter().startElement( "presentation:settings" ); if ( !m_activeCustomSlideShow.isEmpty() && m_customSlideShows->names().contains( m_activeCustomSlideShow ) ) { context.xmlWriter().addAttribute( "presentation:show", m_activeCustomSlideShow ); } m_customSlideShows->saveOdf( context ); context.xmlWriter().endElement();//presentation:settings return true; }
bool KPrShapeAnimation::saveOdf(KoPASavingContext &paContext, bool startStep, bool startSubStep) const { KoXmlWriter &writer = paContext.xmlWriter(); writer.startElement("anim:par"); QString nodeType; if (startStep && startSubStep) { nodeType = QString("on-click"); } else if (startSubStep) { nodeType = QString("after-previous"); } else { nodeType = QString("with-previous"); } writer.addAttribute("presentation:node-type", nodeType); for(int i=0;i < this->animationCount(); i++) { QAbstractAnimation * animation = this->animationAt(i); if (KPrAnimationBase * a = dynamic_cast<KPrAnimationBase *>(animation)) { a->saveOdf(paContext); } } writer.endElement(); return true; }
bool KPrAnimSet::saveOdf(KoPASavingContext &paContext) const { KoXmlWriter &writer = paContext.xmlWriter(); writer.startElement("anim:set"); saveAttribute(paContext); writer.endElement(); return true; }
bool KPrAnimSet::saveAttribute(KoPASavingContext &paContext) const { KPrAnimationBase::saveAttribute(paContext); KoXmlWriter &writer = paContext.xmlWriter(); // Anim set allow only visibility change currently writer.addAttribute("smil:attributeName","visibility"); writer.addAttribute("smil:to", m_visible ? "visible" : "hidden"); return true; }
bool KPrPageLayouts::saveOdf( KoPASavingContext & context ) { KPrPageLayoutSharedSavingData * sharedData = new KPrPageLayoutSharedSavingData(); QMap<KPrPageLayoutWrapper, KPrPageLayout *>::iterator it( m_pageLayouts.begin() ); for ( ; it != m_pageLayouts.end(); ++it ) { QString style = it.value()->saveOdf( context ); sharedData->addPageLayoutStyle( it.value(), style ); } context.addSharedData( KPR_PAGE_LAYOUT_SHARED_SAVING_ID, sharedData ); return true; }
bool KPrAnimationStep::saveOdf(KoPASavingContext & paContext) const { KoXmlWriter &writer = paContext.xmlWriter(); writer.startElement("anim:par"); for (int i=0; i < this->animationCount(); i++) { bool startStep = !i; QAbstractAnimation *animation = this->animationAt(i); if (KPrAnimationSubStep *a = dynamic_cast<KPrAnimationSubStep*>(animation)) { a->saveOdf(paContext, startStep); } } writer.endElement(); return true; }
void KoPAPageBase::saveOdfLayers(KoPASavingContext &paContext) const { QList<KoShape*> shapes(this->shapes()); qSort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex); foreach(KoShape* shape, shapes) { KoShapeLayer *layer = dynamic_cast<KoShapeLayer*>(shape); if (layer) { paContext.addLayerForSaving(layer); } else { Q_ASSERT(layer); kWarning(30010) << "Page contains non layer where a layer is expected"; } }
void KPrCustomSlideShows::saveOdf( KoPASavingContext & context ) { QMap<QString, QList<KoPAPageBase*> >::ConstIterator it = m_customSlideShows.constBegin(); const QMap<QString, QList<KoPAPageBase*> >::ConstIterator end = m_customSlideShows.constEnd(); for (; it != end; ++it) { const QString &name = it.key(); const QList<KoPAPageBase*> &slideList = it.value(); context.xmlWriter().startElement( "presentation:show" ); context.xmlWriter().addAttribute( "presentation:name", name ); QString pages; foreach( KoPAPageBase* page, slideList ) { KoPAPage * p = dynamic_cast<KoPAPage *>( page ); if ( p ) { pages += context.pageName( p ) + ','; } } if( !slideList.isEmpty() ) { pages.chop(1); //remove the last comma } context.xmlWriter().addAttribute( "presentation:pages", pages ); context.xmlWriter().endElement();//presentation:show }
QString SCPageLayout::saveOdf(KoPASavingContext &context) const { KOdfGenericStyle style(KOdfGenericStyle::PresentationPageLayoutStyle); style.addAttribute("style:display-name", m_name); QBuffer buffer; buffer.open(QIODevice::WriteOnly); KXmlWriter elementWriter(&buffer); QList<SCPlaceholder *>::const_iterator it(m_placeholders.begin()); for (; it != m_placeholders.end(); ++it) { (*it)->saveOdf(elementWriter); } QString placeholders = QString::fromUtf8(buffer.buffer(), buffer.buffer().size()); style.addChildElement("placeholders", placeholders); // return the style name so we can save the ptr -> style in the saving context so the pages can use it during saving return context.mainStyles().insert(style, "pl"); }
bool KPrDeclarations::saveOdf(KoPASavingContext &paContext) const { /* <presentation:header-decl presentation:name="hdr1">header</presentation:header-decl> <presentation:footer-decl presentation:name="ftr1">Footer for the slide</presentation:footer-decl> <presentation:footer-decl presentation:name="ftr2">footer</presentation:footer-decl> <presentation:date-time-decl presentation:name="dtd1" presentation:source="current-date" style:data-style-name="D3"/> */ KoXmlWriter &writer(paContext.xmlWriter()); QHash<Type, QHash<QString, QVariant> >::const_iterator typeIt(m_declarations.constBegin()); for (; typeIt != m_declarations.constEnd(); ++typeIt) { QHash<QString, QVariant>::const_iterator keyIt(typeIt.value().begin()); for (; keyIt != typeIt.value().constEnd(); ++keyIt) { switch (typeIt.key()) { case Footer: writer.startElement("presentation:footer-decl"); break; case Header: writer.startElement("presentation:header-decl"); break; case DateTime: writer.startElement("presentation:date-time-decl"); break; } writer.addAttribute("presentation:name", keyIt.key()); if (typeIt.key() == DateTime) { //TODO } else { writer.addTextNode(keyIt.value().value<QString>()); } writer.endElement(); } } return true; }
bool KoPADocument::saveOdfPages(KoPASavingContext &paContext, QList<KoPAPage *> &pages, QList<KoPAPage *> &masterPages) { paContext.addOption(KoPASavingContext::DrawId); paContext.addOption(KoPASavingContext::AutoStyleInStyleXml); // save master pages foreach(KoPAPage *page, masterPages) { if (paContext.isSetClearDrawIds()) { paContext.clearDrawIds(); } page->saveOdf(paContext); } paContext.removeOption(KoPASavingContext::AutoStyleInStyleXml); // save pages foreach (KoPAPage *page, pages) { page->saveOdf(paContext); paContext.incrementPage(); }