[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/stage-singlecanvas-aakriti] /: Removed unused getter and
From: Aakriti Gupta <aakriti.a.gupta () gmail ! com>
Date: 2011-07-31 20:39:25
Message-ID: 20110731203925.20F03A60C4 () git ! kde ! org
[Download RAW message or body]
Git commit 68f917dfced00192878be1a6bab079f97bd3e259 by Aakriti Gupta.
Committed on 29/07/2011 at 15:37.
Pushed by aakritigupta into branch 'stage-singlecanvas-aakriti'.
Removed unused getter and setter methods and re-factored code to use the new QMap \
made for animation attributes. Code looks shorter and cleaner now.
Edited SvgWriters accordingly.
M +2 -5 filters/libsvg/SvgWriter_generic.h
M +4 -44 filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.cpp
M +3 -6 filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.h
M +8 -152 plugins/presentationviewportshape/PresentationViewPortShape.cpp
M +6 -52 plugins/presentationviewportshape/PresentationViewPortShape.h
http://commits.kde.org/calligra/68f917dfced00192878be1a6bab079f97bd3e259
diff --git a/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.cpp \
b/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.cpp index a240888..801b0a0 \
100644
--- a/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.cpp
+++ b/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.cpp
@@ -19,20 +19,10 @@
#include "SvgWriter_Stage.h"
#include "SvgWriter_generic.h"
-#include "SvgAnimationData.h"
-#include "KoShape.h"
-
-#include "plugins/presentationviewportshape/PresentationViewPortShape.h"
-#include <QDebug>
-#include <KoPathShape.h>
SvgWriter_Stage::SvgWriter_Stage(const QList<KoShapeLayer*> &layers, const QSizeF& \
pageSize): SvgWriter_generic(layers, pageSize) {
m_hasAppData = true;
- m_appDataId = PresentationViewPortShapeId;
-
- m_frames = new QTextStream(&m_appData, QIODevice::ReadWrite);
-
saveScript();
}
@@ -40,8 +30,6 @@ SvgWriter_Stage::SvgWriter_Stage(const QList<KoShapeLayer*> \
&layers, const QSize SvgWriter_Stage::SvgWriter_Stage(const QList< KoShape* >& \
toplevelShapes, const QSizeF& pageSize): SvgWriter_generic(toplevelShapes, pageSize) \
{ m_hasAppData = true;
- m_frames = new QTextStream(&m_appData, QIODevice::ReadWrite);
-
saveScript();
}
@@ -50,42 +38,14 @@ SvgWriter_Stage::~SvgWriter_Stage()
}
-//TODO PVPShape should have the animation data, not Frame.
-void SvgWriter_Stage::saveAnimationTags(PresentationViewPortShape* shape)
-{
- if(shape->applicationData() == 0){
- forTesting(shape);// Adds a frame object to this shape
- }
-
- SvgAnimationData * appData = \
dynamic_cast<SvgAnimationData*>(shape->applicationData());
- Frame *frameObj;// = new Frame();
- frameObj = &(appData->frame());
-
- frameObj->writeToStream(m_frames);
-
- *m_frames << "/>" << endl;
-}
-
-void SvgWriter_Stage::saveAppData(KoShape* shape)
-{
- saveAnimationTags(dynamic_cast<PresentationViewPortShape*>(shape));
-}
-
void SvgWriter_Stage::saveScript()
{
m_script = "Function.prototype.bind=function(c){var \
a=Array.prototype.slice.call(arguments,1),b=this;return \
function(){b.apply(c,a.concat(Array.prototype.slice.call(arguments)))}};var \
sozi=sozi||{};sozi.Display=function(a){this.controller=a;this.cx=0;this.cy=0;this.widt \
h=1;this.height=1;this.rotate=0;this.clip=true};sozi.Display.prototype.svgNs="http://www.w3.org/2000/svg";sozi.Display.prototype.onLoad=function(){var \
b,a=document.createElementNS(this.svgNs,"clipPath");this.svgRoot=document.do \
cumentElement;this.svgRoot.removeAttribute("viewBox");this.initialBBox=this. \
svgRoot.getBBox();this.wrapper=document.createElementNS(this.svgNs,"g");this \
.wrapper.setAttribute("id","sozi-wrapper");while(true){b=this.svgR \
oot.firstChild;if(!b){break}this.svgRoot.removeChild(b);this.wrapper.appendChild(b)}th \
is.svgRoot.appendChild(this.wrapper);this.clipRect=document.createElementNS(this.svgNs \
,"rect");this.clipRect.setAttribute("id","sozi-clip-rect" \
;);a.setAttribute("id","sozi-clip-path");a.appendChild(this.clipRe \
ct);this.svgRoot.appendChild(a);this.svgRoot.setAttribute("clip-path"," \
url(#sozi-clip-path)");this.svgRoot.setAttribute("width",window.innerWi \
dth);this.svgRoot.setAttribute("height",window.innerHeight)};sozi.Display.pr \
ototype.resize=function(){this.svgRoot.setAttribute("width",window.innerWidt \
h);this.svgRoot.setAttribute("height",window.innerHeight);this.update()};sozi.Display.prototype.getFrameGeometry=function(){var \
a={};a.scale=Math.min(window.innerWidth/this.width,window.innerHeight/this.height);a.w \
idth=this.width*a.scale;a.height=this.height*a.scale;a.x=(window.innerWidth-a.width)/2;a.y=(window.innerHeight-a.height)/2;return \
a};sozi.Display.prototype.getElementGeometry=function(d){var \
j,g,a,k,h,f,i=d.getCTM(),e=Math.sqrt(i.a*i.a+i.b*i.b);if(d.nodeName==="rect" \
){j=d.x.baseVal.value;g=d.y.baseVal.value;a=d.width.baseVal.value;k=d.height.baseVal.v \
alue}else{h=d.getBBox();j=h.x;g=h.y;a=h.width;k=h.height}f=document.documentElement.cr \
eateSVGPoint();f.x=j+a/2;f.y=g+k/2;f=f.matrixTransform(i);return{cx:f.x,cy:f.y,width:a \
*e,height:k*e,rotate:Math.atan2(i.b,i.a)*180/Math.PI}};sozi.Display.prototype.getDocum \
entGeometry=function(){return{cx:this.initialBBox.x+this.initialBBox.width/2,cy:this.i \
nitialBBox.y+this.initialBBox.height/2,width:this.initialBBox.width,height:this.initia \
lBBox.height,rotate:0,clip:false}};sozi.Display.prototype.getCurrentGeometry=function( \
){return{cx:this.cx,cy:this.cy,width:this.width,height:this.height,rotate:this.rotate,clip:this.clip}};sozi.Display.prototype.drag=function(b,a){var \
c=this.getFrameGeometry(),d=this.rotate*Math.PI/180;this.cx-=(b*Math.cos(d)-a*Math.sin \
(d))/c.scale;this.cy-=(b*Math.sin(d)+a*Math.cos(d))/c.scale;this.clip=false;if(this.ta \
bleOfContentsIsVisible()){this.hideTableOfContents()}this.update()};sozi.Display.prototype.update=function(){var \
a=this.getFrameGeometry(),c=-this.cx+this.width/2+a.x/a.scale,b=-this.cy+this.height/2 \
+a.y/a.scale;this.wrapper.setAttribute("transform","scale("+a.scal \
e+")translate("+c+","+b+")rotate("+(-this.rotate)+" \
,"+this.cx+","+this.cy+")");this.clipRect.setAttribute(" \
x",this.clip?a.x:0);this.clipRect.setAttribute("y",this.clip?a.y:0);thi \
s.clipRect.setAttribute("width",this.clip?a.width:window.innerWidth);this.cl \
ipRect.setAttribute("height",this.clip?a.height:window.innerHeight)};sozi.Display.prototype.showFrame=function(b){var \
a;for(a in b.geometry){if(b.geometry.hasOwnProperty(a)){this[a]=b.geometry[a]}}this.up \
date()};sozi.Display.prototype.applyZoomFactor=function(a){this.width/=a;this.height/=a};sozi.Display.prototype.installTableOfContents=function(){var \
c=Math.floor(window.innerHeight/Math.max((this.controller.frames.length+1),40)),b=docu \
ment.createElementNS(this.svgNs,"rect"),d=0,a,g,f,e;this.tocGroup=document.c \
reateElementNS(this.svgNs,"g");this.tocGroup.setAttribute("visibility&q \
uot;,"hidden");this.tocGroup.appendChild(b);this.svgRoot.appendChild(this.to \
cGroup);b.setAttribute("fill","#eee");b.setAttribute("stroke& \
quot;,"#888");b.setAttribute("x","0");b.setAttribute(&qu \
ot;y","0");b.setAttribute("height",(this.controller.frames.le \
ngth+1)*c);for(a=0;a<this.controller.frames.length;a++){g=this.controller.frames[a] \
;f=document.createElementNS(this.svgNs,"text");f.appendChild(document.create \
TextNode(g.title));f.setAttribute("x",c/2);f.setAttribute("y",c*(a \
+1.3));f.setAttribute("fill","black");f.setAttribute("style","font-size: \
"+(c*0.9)+"px;font-family: Verdana, \
sans-serif");f.addEventListener("click",function(i,h){this.hideTableOfC \
ontents();this.controller.moveToFrame(i);h.stopPropagation()}.bind(this,a),false);f.ad \
dEventListener("mouseover",function(){this.setAttribute("fill",&qu \
ot;#08c")},false);f.addEventListener("mouseout",function(){this.setAttr \
ibute("fill","black")},false);this.tocGroup.appendChild(f);e=f.get \
BBox().width;if(e>d){d=e}}b.setAttribute("width",d+c)};sozi.Display.proto \
type.showTableOfContents=function(){this.clipRect.setAttribute("x",0);this.c \
lipRect.setAttribute("y",0);this.clipRect.setAttribute("width",win \
dow.innerWidth);this.clipRect.setAttribute("height",window.innerHeight);this \
.tocGroup.setAttribute("visibility","visible")};sozi.Display.prototype.hideTableOfContents=function(){var \
a=this.getFrameGeometry();this.tocGroup.setAttribute("visibility","hidd \
en");this.clipRect.setAttribute("x",a.x);this.clipRect.setAttribute(&qu \
ot;y",a.y);this.clipRect.setAttribute("width",a.width);this.clipRect.se \
tAttribute("height",a.height)};sozi.Display.prototype.tableOfContentsIsVisible=function(){return \
this.tocGroup.getAttribute("visibility")==="visible"};var \
sozi=sozi||{};sozi.Animator=function(b,a,c){this.timeStepMs=b||40;this.onStep=a;this.o \
nDone=c;this.durationMs=0;this.data={};this.initialTime=0;this.started=false;this.time \
r=0};sozi.Animator.prototype.start=function(a,b){this.durationMs=a;this.data=b;this.in \
itialTime=Date.now();this.onStep(0,this.data);if(!this.started){this.started=true;this \
.timer=window.setInterval(this.step.bind(this),this.timeStepMs)}};sozi.Animator.protot \
ype.stop=function(){if(this.started){window.clearInterval(this.timer);this.started=false}};sozi.Animator.prototype.step=function(){var \
a=Date.now()-this.initialTime;if(a>=this.durationMs){this.stop();this.onStep(1,this.data);this.onDone()}else{this.onStep(a/this.durationMs,this.data)}};var \
sozi=sozi||{};sozi.Player=function(){this.display=new \
sozi.Display(this,false);this.animator=new \
sozi.Animator(40,this.onAnimationStep.bind(this),this.onAnimationDone.bind(this));this \
.frames=[];this.playing=false;this.waiting=false;this.sourceFrameIndex=0;this.currentFrameIndex=0};sozi.Player.prototype.profiles={linear:function(a){return \
a},accelerate:function(a){return \
Math.pow(a,3)},"strong-accelerate":function(a){return \
Math.pow(a,5)},decelerate:function(a){return \
1-Math.pow(1-a,3)},"strong-decelerate":function(a){return \
1-Math.pow(1-a,5)},"accelerate-decelerate":function(a){var \
b=a<=0.5?a:1-a,c=Math.pow(2*b,3)/2;return \
a<=0.5?c:1-c},"strong-accelerate-decelerate":function(a){var \
b=a<=0.5?a:1-a,c=Math.pow(2*b,5)/2;return \
a<=0.5?c:1-c},"decelerate-accelerate":function(a){var \
b=a<=0.5?a:1-a,c=(1-Math.pow(1-2*b,2))/2;return \
a<=0.5?c:1-c},"strong-decelerate-accelerate":function(a){var \
b=a<=0.5?a:1-a,c=(1-Math.pow(1-2*b,3))/2;return \
a<=0.5?c:1-c}};sozi.Player.prototype.soziNs="http://sozi.baierouge.fr";so \
zi.Player.prototype.dragButton=1;sozi.Player.prototype.defaultDurationMs=500;sozi.Play \
er.prototype.defaultZoomPercent=-10;sozi.Player.prototype.defaultProfile=sozi.Player.p \
rototype.profiles.linear;sozi.Player.prototype.scaleFactor=1.05;sozi.Player.prototype. \
defaults={title:"Untitled",sequence:"0",hide:"true",clip \
:"true","timeout-enable":"false","timeout-ms": \
"5000","transition-duration-ms":"1000","transition- \
zoom-percent":"0","transition-profile":"linear"};sozi.Player.prototype.onLoad=function(){var \
a=this.onWheel.bind(this);this.display.onLoad();this.readFrames();this.display.install \
TableOfContents();this.startFromIndex(this.getFrameIndexFromURL());this.display.svgRoo \
t.addEventListener("click",this.onClick.bind(this),false);this.display.svgRo \
ot.addEventListener("mousedown",this.onMouseDown.bind(this),false);this.disp \
lay.svgRoot.addEventListener("mouseup",this.onMouseUp.bind(this),false);this \
.display.svgRoot.addEventListener("mousemove",this.onMouseMove.bind(this),fa \
lse);this.display.svgRoot.addEventListener("keypress",this.onKeyPress.bind(t \
his),false);this.display.svgRoot.addEventListener("keydown",this.onKeyDown.b \
ind(this),false);window.addEventListener("hashchange",this.onHashChange.bind \
(this),false);window.addEventListener("resize",this.display.resize.bind(this \
.display),false);this.display.svgRoot.addEventListener("DOMMouseScroll",a,fa \
lse);window.onmousewheel=a;this.dragButtonIsDown=false};sozi.Player.prototype.onMouseD \
own=function(a){if(a.button===0){this.dragButtonIsDown=true;this.dragged=false;this.dr \
agClientX=a.clientX;this.dragClientY=a.clientY}else{if(a.button===1){if(this.display.t \
ableOfContentsIsVisible()){this.display.hideTableOfContents()}else{this.stop();this.di \
splay.showTableOfContents()}}}a.stopPropagation()};sozi.Player.prototype.onMouseMove=f \
unction(a){if(this.dragButtonIsDown){this.stop();this.dragged=true;this.display.drag(a \
.clientX-this.dragClientX,a.clientY-this.dragClientY);this.dragClientX=a.clientX;this. \
dragClientY=a.clientY}a.stopPropagation()};sozi.Player.prototype.onMouseUp=function(a) \
{if(a.button===0){this.dragButtonIsDown=false}a.stopPropagation()};sozi.Player.prototy \
pe.onClick=function(a){if(!this.dragged){this.moveToNext()}a.stopPropagation()};sozi.Player.prototype.onWheel=function(a){var \
b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta;if(window.opera){b=-b}}else{ \
if(a.detail){b=-a.detail}}if(b!==0){this.zoom(b)}a.stopPropagation();a.preventDefault()};sozi.Player.prototype.onKeyPress=function(a){switch(a.charCode){case \
43:this.zoom(1);break;case 45:this.zoom(-1);break;case \
61:this.moveToCurrent();break;case 70:case \
102:this.showAll();break}a.stopPropagation()};sozi.Player.prototype.onKeyDown=function(a){switch(a.keyCode){case \
36:this.moveToFirst();break;case 35:this.moveToLast();break;case \
38:this.jumpToPrevious();break;case 33:case 37:this.moveToPrevious();break;case \
40:this.jumpToNext();break;case 34:case 39:case 13:this.moveToNext();break;case \
32:this.moveToNext();break}a.stopPropagation()};sozi.Player.prototype.onHashChange=function(){var \
a=this.getFrameIndexFromURL();if(a!==this.currentFrameIndex){this.moveToFrame(a)}};sozi.Player.prototype.onAnimationStep=function(c,f){var \
e=1-c,d=f.profile(c),b=1-d,a,g;for(a in \
f.initialState){if(f.initialState.hasOwnProperty(a)){if(typeof \
f.initialState[a]==="number"&&typeof \
f.finalState[a]==="number"){this.display[a]=f.finalState[a]*d+f.initialState \
[a]*b}}}if(f.zoomWidth&&f.zoomWidth.k!==0){g=c-f.zoomWidth.ts;this.display.wid \
th=f.zoomWidth.k*g*g+f.zoomWidth.ss}if(f.zoomHeight&&f.zoomHeight.k!==0){g=c-f \
.zoomHeight.ts;this.display.height=f.zoomHeight.k*g*g+f.zoomHeight.ss}this.display.cli \
p=f.finalState.clip;this.display.update()};sozi.Player.prototype.onAnimationDone=funct \
ion(){this.sourceFrameIndex=this.currentFrameIndex;if(this.playing){this.waitTimeout()}};sozi.Player.prototype.getFrameIndexFromURL=function(){var \
a=window.location.hash?parseInt(window.location.hash.slice(1),10)-1:0;if(isNaN(a)||a<0){return \
0}else{if(a>=this.frames.length){return this.frames.length-1}else{return \
a}}};sozi.Player.prototype.readAttribute=function(b,a){var \
c=b.getAttributeNS(this.soziNs,a);return \
c===""?this.defaults[a]:c};sozi.Player.prototype.readFrames=function(){var \
a=document.getElementsByTagNameNS(this.soziNs,"frame"),c,b,d;for(b=0;b<a. \
length;b++){c=document.getElementById(a[b].getAttributeNS(this.soziNs,"refid" \
;));if(c){d={geometry:this.display.getElementGeometry(c),title:this.readAttribute(a[b] \
,"title"),sequence:parseInt(this.readAttribute(a[b],"sequence"),10 \
),hide:this.readAttribute(a[b],"hide")==="true",timeoutEnable:this \
.readAttribute(a[b],"timeout-enable")==="true",timeoutMs:parseInt( \
this.readAttribute(a[b],"timeout-ms"),10),transitionDurationMs:parseInt(this \
.readAttribute(a[b],"transition-duration-ms"),10),transitionZoomPercent:pars \
eInt(this.readAttribute(a[b],"transition-zoom-percent"),10),transitionProfil \
e:this.profiles[this.readAttribute(a[b],"transition-profile")||"linear& \
quot;]};if(d.hide){c.setAttribute("visibility","hidden")}d.geometr \
y.clip=this.readAttribute(a[b],"clip")==="true";this.frames.push(d)}}this.frames.sort(function(f,e){return \
f.sequence-e.sequence})};sozi.Player.prototype.startFromIndex=function(a){this.playing \
=true;this.waiting=false;this.sourceFrameIndex=a;this.currentFrameIndex=a;this.display \
.showFrame(this.frames[a]);this.waitTimeout()};sozi.Player.prototype.stop=function(){t \
his.animator.stop();if(this.waiting){window.clearTimeout(this.nextFrameTimeout);this.w \
aiting=false}this.playing=false;this.sourceFrameIndex=this.currentFrameIndex};sozi.Player.prototype.waitTimeout=function(){var \
a;if(this.frames[this.currentFrameIndex].timeoutEnable){this.waiting=true;a=(this.curr \
entFrameIndex+1)%this.frames.length;this.nextFrameTimeout=window.setTimeout(this.moveT \
oFrame.bind(this,a),this.frames[this.currentFrameIndex].timeoutMs)}};sozi.Player.prototype.getZoomData=function(e,m,k){var \
n={ss:((e<0)?Math.max(m,k):Math.min(m,k))*(100-e)/100,ts:0.5,k:0},i,h,g,f,l,j;if(e! \
==0){i=m-k;h=m-n.ss;g=k-n.ss;if(i!==0){f=Math.sqrt(h*g);l=(h-f)/i;j=(h+f)/i;n.ts=(l>0&&l<=1)?l:j}n.k=h/n.ts/n.ts}return \
n};sozi.Player.prototype.jumpToFrame=function(a){this.stop();if(this.display.tableOfCo \
ntentsIsVisible()){this.display.hideTableOfContents()}this.sourceFrameIndex=a;this.cur \
rentFrameIndex=a;this.display.showFrame(this.frames[a]);window.location.hash="#"+(a+1)};sozi.Player.prototype.moveToFrame=function(c){var \
b=this.defaultDurationMs,f=this.defaultZoomPercent,d=this.defaultProfile,a,e;if(this.w \
aiting){window.clearTimeout(this.nextFrameTimeout);this.waiting=false}if(c===(this.cur \
rentFrameIndex+1)%this.frames.length){b=this.frames[c].transitionDurationMs;f=this.fra \
mes[c].transitionZoomPercent;d=this.frames[c].transitionProfile}if(this.display.tableO \
fContentsIsVisible()){this.display.hideTableOfContents()}if(f!==0){a=this.getZoomData( \
f,this.display.width,this.frames[c].geometry.width);e=this.getZoomData(f,this.display. \
height,this.frames[c].geometry.height)}this.playing=true;this.currentFrameIndex=c;this \
.animator.start(b,{initialState:this.display.getCurrentGeometry(),finalState:this.fram \
es[this.currentFrameIndex].geometry,profile:d,zoomWidth:a,zoomHeight:e});window.locati \
on.hash="#"+(c+1)};sozi.Player.prototype.moveToFirst=function(){this.moveToFrame(0)};sozi.Player.prototype.jumpToPrevious=function(){var \
a=this.currentFrameIndex;if(!this.animator.started||this.sourceFrameIndex<=this.cur \
rentFrameIndex){a-=1}if(a>=0){this.jumpToFrame(a)}};sozi.Player.prototype.moveToPrevious=function(){var \
a=this.currentFrameIndex,b;for(a--;a>=0;a--){b=this.frames[a];if(!b.timeoutEnable|| \
b.timeoutMs!==0){this.moveToFrame(a);break}}};sozi.Player.prototype.jumpToNext=function(){var \
a=this.currentFrameIndex;if(!this.animator.started||this.sourceFrameIndex>=this.cur \
rentFrameIndex){a+=1}if(a<this.frames.length){this.jumpToFrame(a)}};sozi.Player.pro \
totype.moveToNext=function(){if(this.currentFrameIndex<this.frames.length-1||this.f \
rames[this.currentFrameIndex].timeoutEnable){this.moveToFrame((this.currentFrameIndex+ \
1)%this.frames.length)}};sozi.Player.prototype.moveToLast=function(){this.moveToFrame( \
this.frames.length-1)};sozi.Player.prototype.moveToCurrent=function(){this.moveToFrame \
(this.currentFrameIndex)};sozi.Player.prototype.showAll=function(){this.stop();if(this \
.display.tableOfContentsIsVisible()){this.display.hideTableOfContents()}this.animator. \
start(this.defaultDurationMs,{initialState:this.display.getCurrentGeometry(),finalStat \
e:this.display.getDocumentGeometry(),profile:this.defaultProfile})};sozi.Player.protot \
ype.zoom=function(a){this.stop();if(this.display.tableOfContentsIsVisible()){this.disp \
lay.hideTableOfContents()}this.display.applyZoomFactor(a>0?this.scaleFactor:1/this. \
scaleFactor);this.display.clip=false;this.display.update()};window.addEventListener("load",sozi.Player.prototype.onLoad.bind(new \
sozi.Player()),false);";
- *m_frames << "<script id=" << "\"sozi-script\">" << m_script << "</script>" << \
endl; + m_appData.append("<script \
id=").append("\"sozi-script\">").append(m_script).append("</script>\n"); }
- //This function will eventually be removed.
- //Only used for dummy data.
-void SvgWriter_Stage::forTesting(KoShape * shape)
+void SvgWriter_Stage::saveAppData(KoShape* shape)
{
- //First save Frame properties to a shape. This is for testing only.
- SvgAnimationData *obj = new SvgAnimationData();
- Frame *frame = new Frame(); //Default properties set
- frame->setRefId(m_shapeIds[shape]);
-
- obj->addNewFrame(shape, frame);
-}
+ Q_UNUSED(shape);
+}
\ No newline at end of file
diff --git a/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.h \
b/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.h index 97e0b53..14946aa 100644
--- a/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.h
+++ b/filters/kpresenter/svgsinglecanvas/SvgWriter_Stage.h
@@ -51,18 +51,15 @@ public:
/**
* @param shape saves app data conatined in this to a stream
*/
- void saveAppData(KoShape *shape);
+ void saveAppData(KoShape *shape);
private:
- void saveAnimationTags(PresentationViewPortShape* shape);
+
/**
* Saves javascript to the SVG doc
*/
void saveScript();
- //Temporary function, since UI still not ready to test adding of frame data
- void forTesting(KoShape *shape);
-
- QTextStream* m_frames;
+
QString m_script;
};
#endif /*SVG_dWRITER_STAGE_H*/
\ No newline at end of file
diff --git a/filters/libsvg/SvgWriter_generic.h b/filters/libsvg/SvgWriter_generic.h
index 137cf50..a38319f 100644
--- a/filters/libsvg/SvgWriter_generic.h
+++ b/filters/libsvg/SvgWriter_generic.h
@@ -78,13 +78,10 @@ protected:
* To save application specific data in the correct format
*/
virtual void saveAppData(KoShape *shape) =0;
-
-
+
bool m_hasAppData;
QString m_appData;
- QString m_appDataId;
- QMap<const KoShape*, QString> m_shapeIds;
private:
@@ -136,7 +133,7 @@ private:
QSizeF m_pageSize;
bool m_writeInlineImages;
QString m_filename;
-
+ QMap<const KoShape*, QString> m_shapeIds;
};
#endif /*SVGWRITER_GENERIC_H */
diff --git a/plugins/presentationviewportshape/PresentationViewPortShape.cpp \
b/plugins/presentationviewportshape/PresentationViewPortShape.cpp index \
1ac516f..88e73a5 100644
--- a/plugins/presentationviewportshape/PresentationViewPortShape.cpp
+++ b/plugins/presentationviewportshape/PresentationViewPortShape.cpp
@@ -23,7 +23,7 @@
#include <KoShapeBackground.h>
#include <KoXmlReader.h>
-PresentationViewPortShape::PresentationViewPortShape() : m_noOfPoints(8)
+PresentationViewPortShape::PresentationViewPortShape() : m_noOfPoints(8), \
m_ns("calligra") {
setShapeId(PresentationViewPortShapeId);
m_adjMatrix = createAdjMatrix();
@@ -39,50 +39,10 @@ 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());
- }
-
-
+ foreach(QString key, m_animationAttributes){
+ if(e.hasAttribute(m_ns + ":" + key))
+ m_animationAttributes.insert(key, e.attribute(m_ns + key));
+ }
}
void PresentationViewPortShape::initializeAnimationProperties()
@@ -112,15 +72,14 @@ QString PresentationViewPortShape::toString()
{
unsigned indent = 1;
QString stream;
- QString ns("calligra:");
-
+
printIndentation(stream, indent++);
stream.append("<calligra:frame");
stream.append("\n");
foreach(QString key, m_animationAttributes.keys()){
printIndentation(stream, indent);
- stream.append(ns).append(key).append("=\"").append(m_animationAttributes.value(key)).append("\"");
+ stream.append(m_ns + \
":").append(key).append("=\"").append(m_animationAttributes.value(key)).append("\""); \
stream.append("\n"); }
stream.append("/>\n");
@@ -243,108 +202,7 @@ QPainterPath PresentationViewPortShape::createShapePath(const \
QSizeF& size) 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;
-}
-
+}
//TODO: What will be done in this?
// Neccessary to write to and from an ODF
bool PresentationViewPortShape::loadOdf(const KoXmlElement& element, \
KoShapeLoadingContext& context) @@ -356,5 +214,3 @@ void \
PresentationViewPortShape::saveOdf(KoShapeSavingContext& context) const {
//TODO
}
-
-
diff --git a/plugins/presentationviewportshape/PresentationViewPortShape.h \
b/plugins/presentationviewportshape/PresentationViewPortShape.h index \
55bf050..76cad88 100644
--- a/plugins/presentationviewportshape/PresentationViewPortShape.h
+++ b/plugins/presentationviewportshape/PresentationViewPortShape.h
@@ -52,51 +52,15 @@ public:
virtual QSizeF size() const;
//Methods for the frame object
- void initializeAnimationProperties(); //Frame()
+ void initializeAnimationProperties();
/**
* Parses frame information from a KoXmlElement,
* And saves it into this frame.
*/
- void parseAnimationProperties(const KoXmlElement& e); //Frame(e)
+ void parseAnimationProperties(const KoXmlElement& e);
- /**
- * Sets the default values for all frame attrbutes
- */
- //void setDefaultValues();
- /**
- * @param stream QTextStream to which all frame data is written in specific \
format.
- */
- //QTextStream* writeToStream();
QString toString();
-
- 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;
-
-
-
+
private:
void setListOfPoints(QList<QPointF> points);
@@ -111,21 +75,11 @@ private:
int m_noOfPoints;
QVector< QVector<int> > m_adjMatrix;
+ QString m_ns;
//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;
-
QMap<QString, QString> m_animationAttributes;
};
#endif
+
+
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic