File indexing completed on 2024-05-12 16:36:44

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2020 Dag Andersen <danders@get2net.dk>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KPRPAGETRANSITION_H
0021 #define KPRPAGETRANSITION_H
0022 
0023 #include "stage_export.h"
0024 
0025 #include <QMap>
0026 #include <QDebug>
0027 
0028 class KoShapeLoadingContext;
0029 class KoXmlElement;
0030 class KoGenStyle;
0031 
0032 class STAGE_EXPORT KPrPageTransition
0033 {
0034 public:
0035     KPrPageTransition();
0036 
0037     /// Odf 20.233 presentation:transition-type
0038     /// The presentation:transition-type attribute specifies the mode of a transition.
0039     enum Type {
0040         Manual,         /// Slide transition and shape effects are started separately by the user
0041         Automatic,      /// Slide transition and shape effects start automatically
0042         SemiAutomatic   /// Slide transition starts automatically, shape effects are started by the user.
0043     }; // NOTE: If this is changed, also update KPrPageEffectDocker
0044 
0045     /// Return the transition type
0046     Type type() const;
0047     /// Set the transition type to @p type
0048     void setType(Type type);
0049     /// Return the odf name of the type
0050     QString odfName() const;
0051 
0052     /// Return the presentation duration
0053     qreal duration() const;
0054     /// Set presentation duration to @p duration
0055     /// @p duration must be in seconds, e.g. 3.5
0056     void setDuration(qreal duration);
0057     /// Return presentation duration in milliseconds
0058     int milliseconds() const;
0059 
0060     void saveOdfAttributes(KoGenStyle &style) const;
0061     bool loadOdfAttributes(const KoXmlElement &element, KoShapeLoadingContext &context);
0062 
0063 private:
0064     Type m_type;
0065     qreal m_duration; // duration in seconds
0066     QMap<Type, QString> m_odfNames;
0067 };
0068 STAGE_EXPORT QDebug operator<<(QDebug dbg, const KPrPageTransition &t);
0069 
0070 #endif