KPrPageEffect * KPrPageEffectFactory::createPageEffect( const KoXmlElement & element ) const { KPrPageEffectStrategy * strategy = 0; KPrPageEffect * pageEffect = 0; if ( element.hasAttributeNS( KoXmlNS::smil, "subtype" ) ) { QString smilSubType( element.attributeNS( KoXmlNS::smil, "subtype" ) ); bool reverse = false; if ( element.hasAttributeNS( KoXmlNS::smil, "direction" ) && element.attributeNS( KoXmlNS::smil, "direction" ) == "reverse" ) { reverse = true; } EffectStrategies::nth_index<1>::type::iterator it( d->strategies.get<1>().find( boost::make_tuple( smilSubType, reverse ) ) ); if ( it != d->strategies.get<1>().end() ) { strategy = *it; pageEffect = new KPrPageEffect( 5000, d->id, strategy ); } else { kWarning(33002) << "effect for " << d->id << smilSubType << reverse << "not supported"; } } return pageEffect; }
SCPageEffect * SCPageEffectFactory::createPageEffect(const KXmlElement &element) const { SCPageEffectStrategy * strategy = 0; SCPageEffect * pageEffect = 0; if (element.hasAttributeNS(KOdfXmlNS::smil, "subtype")) { QString smilSubType(element.attributeNS(KOdfXmlNS::smil, "subtype")); bool reverse = false; if (element.attributeNS(KOdfXmlNS::smil, "direction") == "reverse") { reverse = true; } int duration = 5000; if (element.hasAttributeNS(KOdfXmlNS::smil, "dur")) { duration = SCDurationParser::durationMs(element.attributeNS(KOdfXmlNS::smil, "dur")); // TODO what if duration is -1 } else if (element.hasAttributeNS(KOdfXmlNS::presentation, "transition-speed")) { QString transitionSpeed(element.attributeNS(KOdfXmlNS::presentation, "transition-speed")); if (transitionSpeed == "fast") { duration = 2000; } else if (transitionSpeed == "slow") { duration = 10000; } // wrong values and medium ar treated as default which is 5s } EffectStrategies::nth_index<1>::type::iterator it(d->strategies.get<1>().find(boost::make_tuple(smilSubType, reverse))); if (it != d->strategies.get<1>().end()) { strategy = *it; strategy->loadOdfSmilAttributes(element); pageEffect = new SCPageEffect(duration, d->id, strategy); } else { kWarning(33002) << "effect for " << d->id << smilSubType << reverse << "not supported"; } } return pageEffect; }