[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/stage-singlecanvas-aakriti]
From:       Aakriti Gupta <aakriti.a.gupta () gmail ! com>
Date:       2011-07-31 20:39:25
Message-ID: 20110731203925.05F15A60B4 () git ! kde ! org
[Download RAW message or body]

Git commit 9b9de610027fb12f629e5f929727440d0d965e05 by Aakriti Gupta.
Committed on 29/07/2011 at 12:16.
Pushed by aakritigupta into branch 'stage-singlecanvas-aakriti'.

Added all animation properties to PVPShape. They were earlier part of the Frame \
class.

M  +238  -2    plugins/presentationviewportshape/PresentationViewPortShape.cpp
M  +68   -0    plugins/presentationviewportshape/PresentationViewPortShape.h

http://commits.kde.org/calligra/9b9de610027fb12f629e5f929727440d0d965e05

diff --git a/plugins/presentationviewportshape/PresentationViewPortShape.cpp \
b/plugins/presentationviewportshape/PresentationViewPortShape.cpp index \
                874981b..d2965e5 100644
--- a/plugins/presentationviewportshape/PresentationViewPortShape.cpp
+++ b/plugins/presentationviewportshape/PresentationViewPortShape.cpp
@@ -26,8 +26,8 @@ PresentationViewPortShape::PresentationViewPortShape() : \
m_noOfPoints(8)  {
     setShapeId(PresentationViewPortShapeId);
     m_adjMatrix = createAdjMatrix();
-    setName("ViewPort");
-    }
+    setName("ViewPort");//TODO remove this?
+}
 
 
 PresentationViewPortShape::~PresentationViewPortShape()
@@ -35,6 +35,137 @@ PresentationViewPortShape::~PresentationViewPortShape()
 
 }
 
+void PresentationViewPortShape::parseAnimationProperties(const KoXmlElement& e)
+{
+      //static int s = 0;
+  //TODO:Use namespace instead of writing 'calligra:' again and again
+    if(e.hasAttribute("calligra:title")) {
+      setTitle(e.attribute("calligra:title"));
+      }
+
+    if(e.hasAttribute("calligra:refid")) {
+      setRefId(e.attribute("calligra:refid"));
+      }
+
+    if(e.hasAttribute("calligra:clip")) {
+      setClip((e.attribute("calligra:clip") == "true"));
+      }
+
+    if(e.hasAttribute("calligra:hide")) {
+      setHide((e.attribute("calligra:hide") == "true"));
+      }
+
+    if(e.hasAttribute("calligra:sequence")) {
+      setSequence(e.attribute("calligra:sequence").toInt());
+      //setSequence(++s);
+      }
+     
+     if(e.hasAttribute("calligra:timeout-ms")) {
+      setTimeout(e.attribute("calligra:timeout-ms").toInt());
+      }
+    
+    if(e.hasAttribute("calligra:timeout-enable")) {
+      enableTimeout(e.attribute("calligra:timeout-enable").toInt());
+      }
+    
+    if(e.hasAttribute("calligra:transition-profile")) {
+      setTransitionProfile(e.attribute("calligra:transition-profile"));
+      }
+    
+    if(e.hasAttribute("calligra:transition-duration-ms")) {
+      setTransitionDuration(e.attribute("calligra:transition-duration-ms").toInt());
+      }
+      
+    if(e.hasAttribute("calligra:transition-zoom-percent")) {
+      setZoomPercent(e.attribute("calligra:transition-zoom-percent").toInt());
+      }
+    
+
+}
+
+void PresentationViewPortShape::initializeAnimationProperties()
+{
+    m_attributes.append("title");
+    m_attributes.append("refid");
+    m_attributes.append("transition-profile");
+    m_attributes.append("hide");
+    m_attributes.append("clip");
+    m_attributes.append("timeout-enable");
+    m_attributes.append("sequence");
+    m_attributes.append("transition-zoom-percent");
+    m_attributes.append("timeout-ms");
+    m_attributes.append("transition-duration-ms");
+        
+    setDefaultValues();
+}
+
+static void printIndentation(QTextStream *stream, unsigned int indent)
+//void SvgWriter_generic::printIndentation(QTextStream* stream, unsigned int indent)
+{
+    static const QString INDENT("  ");
+    for (unsigned int i = 0; i < indent;++i)
+    *stream << INDENT;
+}
+
+void PresentationViewPortShape::setDefaultValues()
+{
+    m_title = "No Title";
+    m_refId = "No Ref ID"; 
+    m_transitionProfile = "linear";
+    m_hide = true;
+    m_clip = true;
+    m_timeoutEnable = false;
+
+    m_sequence = 0;
+    m_transitionZoomPercent = 1;
+    m_transitionDurationMs = 1000; 
+    m_timeoutMs = 5000;    
+}
+
+void PresentationViewPortShape::writeToStream(QTextStream* stream)
+{
+        unsigned indent = 1;
+    //QTextStream * stream;
+    
+    printIndentation(stream, indent++);
+    *stream << "<calligra:frame" << endl;
+       
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "title=\"" << title() << "\"" << endl;
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "refid=\"" << refId() << "\"" << endl;
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "transition-profile=\"" << transitionProfile() << "\"" \
<< endl; +    printIndentation(stream, indent);
+    *stream << "calligra:" << "hide=\"";
+    if(isHide())
+      *stream << "true";
+    else
+     *stream << "false";
+    *stream << "\"" << endl;
+     
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "clip=\"";
+    if(isClip())
+      *stream << "true";
+    else
+      *stream << "false";
+    *stream << "\"" << endl;
+    
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "timeout-enable=\"" << isEnableTimeout() << "\"" << \
endl; +    printIndentation(stream, indent);
+    *stream << "calligra:" << "sequence=\"" << sequence() << "\"" << endl;
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "transition-zoom-percent=\"" << zoomPercent() << "\"" \
<< endl; +    printIndentation(stream, indent);
+    *stream << "calligra:" << "timeout-ms=\"" << timeout() << "\"" << endl;
+    printIndentation(stream, indent);
+    *stream << "calligra:" << "transition-duration-ms=\"" << transitionDuration() << \
"\"" << endl; +              
+    //*stream << "/>" << endl; because transform needs to be added
+
+}
 
 QVector< QVector < int > > PresentationViewPortShape::createAdjMatrix()
 {
@@ -154,6 +285,111 @@ QSizeF PresentationViewPortShape::size() const
     return KoShape::size();
 }
 
+void PresentationViewPortShape::setTitle(const QString& title) 
+{  
+    m_title = title;
+}
+        
+void PresentationViewPortShape::setRefId(const QString& refId)
+{
+    m_refId = refId;
+}
+        
+void PresentationViewPortShape::setSequence(int sequence) 
+{
+    m_sequence = sequence;
+}
+        
+void PresentationViewPortShape::setZoomPercent(int zoomPercent) 
+{
+    m_transitionZoomPercent = zoomPercent;
+}
+        
+void PresentationViewPortShape::setTransitionProfile(const QString& transProfile) 
+{
+    m_transitionProfile = transProfile;
+}
+        
+void PresentationViewPortShape::setTransitionDuration(int timeMs) 
+{
+    m_transitionDurationMs = timeMs;
+}
+        
+void PresentationViewPortShape::setTimeout(int timeoutMs)
+{
+    m_timeoutMs = timeoutMs;
+}
+
+void PresentationViewPortShape::enableTimeout(bool condition)
+{
+    m_timeoutEnable = condition;
+}
+
+void PresentationViewPortShape::setClip(bool condition)
+{
+    m_clip = condition;
+}
+
+void PresentationViewPortShape::setHide(bool condition)
+{
+    m_hide = condition;
+ }
+
+QString PresentationViewPortShape::title() const
+{
+    return m_title;
+}
+        
+QString PresentationViewPortShape::refId() const
+{
+    return m_refId;
+}
+       
+QString PresentationViewPortShape::transitionProfile() const
+{
+    return m_transitionProfile;
+}
+
+bool PresentationViewPortShape::isHide() const
+{
+    return m_hide;
+}
+
+bool PresentationViewPortShape::isClip() const
+{
+    return m_clip;
+}
+
+bool PresentationViewPortShape::isEnableTimeout() const
+{
+    return m_timeoutEnable;
+}
+
+int PresentationViewPortShape::sequence() const
+{
+    return m_sequence;
+}
+        
+int PresentationViewPortShape::zoomPercent() const
+{
+    return m_transitionZoomPercent;
+}
+        
+int PresentationViewPortShape::timeout() const
+{
+    return m_timeoutMs;
+}
+
+int PresentationViewPortShape::transitionDuration() const 
+{
+    return m_transitionDurationMs;
+}
+          
+QList< QString > PresentationViewPortShape::attributes() const
+{
+    return m_attributes;
+}
+
 //TODO: What will be done in this?
 // Neccessary to write to and from an ODF
 bool PresentationViewPortShape::loadOdf(const KoXmlElement& element, \
                KoShapeLoadingContext& context)
diff --git a/plugins/presentationviewportshape/PresentationViewPortShape.h \
b/plugins/presentationviewportshape/PresentationViewPortShape.h index \
                592e3ad..536bd78 100644
--- a/plugins/presentationviewportshape/PresentationViewPortShape.h
+++ b/plugins/presentationviewportshape/PresentationViewPortShape.h
@@ -51,6 +51,55 @@ public:
 
     virtual QSizeF size() const;
 
+    //Methods for the frame object
+    void initializeAnimationProperties(); //Frame()
+    /**
+     * Parses frame information from a KoXmlElement,
+     * And saves it into this frame.
+     */
+    void parseAnimationProperties(const KoXmlElement& e); //Frame(e)
+        
+    /**
+     * Sets the default values for all frame attrbutes
+     */
+    void setDefaultValues();
+    /**
+     * @param stream QTextStream to which all frame data is written in specific \
format. +     */
+    void writeToStream(QTextStream * stream);
+    
+    void setTitle(const QString& title);
+    void setRefId(const QString& refId); 
+    void setTransitionProfile(const QString& transProfile);
+
+    void setHide(bool condition);
+    void setClip(bool condition);
+    void enableTimeout(bool condition);
+
+    void setSequence(int seq);
+    void setZoomPercent(int zoomPercent);
+    void setTimeout(int timeoutMs);
+    void setTransitionDuration(int timeMs);
+      
+    QString title() const;
+    QString refId() const; 
+    QString transitionProfile() const;
+      
+    bool isHide() const;
+    bool isClip() const;
+    bool isEnableTimeout() const;
+      
+    int sequence() const;
+    int zoomPercent() const;
+    int timeout() const;
+    int transitionDuration() const;
+     
+     
+    /**
+     * @return m_attributes 
+     */
+    QList<QString> attributes() const; 
+    
 private:     
     void setListOfPoints(QList<QPointF> points);
 
@@ -64,6 +113,25 @@ private:
      QList<QPointF> m_pointsOfShape;
      int m_noOfPoints;
      QVector< QVector<int> > m_adjMatrix;
+     
+    //Animation properties
+     QString m_title;
+     QString m_refId;
+     QString m_transitionProfile;
+      
+     bool m_hide;
+     bool m_clip;
+     bool m_timeoutEnable;
+
+     int m_sequence;
+     int m_transitionZoomPercent;
+     int m_transitionDurationMs;
+     int m_timeoutMs;
+        
+     /**
+      * @brief m_attributes List of all attributes a frame can have
+      */
+     QList<QString> m_attributes;
   
 };
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic