File indexing completed on 2024-04-28 04:32:45

0001 /*
0002     SPDX-FileCopyrightText: 2005 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef _OKULAR_PAGETRANSITION_H_
0008 #define _OKULAR_PAGETRANSITION_H_
0009 
0010 #include "okularcore_export.h"
0011 
0012 namespace Okular
0013 {
0014 /**
0015  * @short Information object for the transition effect of a page.
0016  *
0017  * This class encapsulates the information about the effect of
0018  * a page transition. It supports mainly the transition effects as
0019  * defined in PDF specification 1.6.
0020  */
0021 class OKULARCORE_EXPORT PageTransition
0022 {
0023 public:
0024     /**
0025      * Describes the type of transition effect.
0026      */
0027     enum Type { Replace, Split, Blinds, Box, Wipe, Dissolve, Glitter, Fly, Push, Cover, Uncover, Fade };
0028 
0029     /**
0030      * Describes the alignment that is applied to the @ref Type
0031      * of transition effect.
0032      */
0033     enum Alignment { Horizontal, Vertical };
0034 
0035     /**
0036      * Describes the direction that is applied to the @ref Type
0037      * of transition effect.
0038      */
0039     enum Direction { Inward, Outward };
0040 
0041     /**
0042      * Creates a new page transition of the given @p type.
0043      *
0044      * If no type is given, the normal @ref Replace transition is used.
0045      */
0046     explicit PageTransition(Type type = Replace);
0047 
0048     /**
0049      * Creates a new page transition from an @p other.
0050      */
0051     PageTransition(const PageTransition &other);
0052     PageTransition &operator=(const PageTransition &other);
0053 
0054     /**
0055      * Destroys the page transition.
0056      */
0057     ~PageTransition();
0058 
0059     /**
0060      * Returns the type of the transition.
0061      */
0062     Type type() const;
0063 
0064     /**
0065      * Returns the duration of the transition in seconds.
0066      */
0067     double duration() const;
0068 
0069     /**
0070      * Returns the alignment of the transition.
0071      */
0072     Alignment alignment() const;
0073 
0074     /**
0075      * Returns the direction of motion of the transition.
0076      */
0077     Direction direction() const;
0078 
0079     /**
0080      * Returns the angle of rotation of the transition.
0081      */
0082     int angle() const;
0083 
0084     /**
0085      * Returns the starting or ending scale (Only if type == 'Fly').
0086      */
0087     double scale() const;
0088 
0089     /**
0090      * Returns true if the area to be flown is rectangular and opaque (Only if type == 'Fly').
0091      */
0092     bool isRectangular() const;
0093 
0094     /**
0095      * Sets the @p type of the transition (@ref Type).
0096      */
0097     void setType(Type type);
0098 
0099     /**
0100      * Sets the @p duration in seconds for the transition.
0101      */
0102     void setDuration(double duration);
0103 
0104     /**
0105      * Sets the @p alignment of the transition (@ref Alignment).
0106      */
0107     void setAlignment(Alignment alignment);
0108 
0109     /**
0110      * Sets the @p direction of the transition (@see Direction).
0111      */
0112     void setDirection(Direction direction);
0113 
0114     /**
0115      * Sets the moving @p angle of the transition.
0116      */
0117     void setAngle(int angle);
0118 
0119     /**
0120      * Sets the starting or ending scale of the transition (Only if type == 'Fly').
0121      */
0122     void setScale(double scale);
0123 
0124     /**
0125      * Sets whether the area to be flown is rectangular and opaque (Only if type == 'Fly').
0126      */
0127     void setIsRectangular(bool rectangular);
0128 
0129 private:
0130     class Private;
0131     Private *const d;
0132 };
0133 
0134 }
0135 
0136 #endif