summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filters/kpresenter/kword/kprkword.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/filters/kpresenter/kword/kprkword.cpp b/filters/kpresenter/kword/kprkword.cpp
index 8dbd628b..87e57a6f 100644
--- a/filters/kpresenter/kword/kprkword.cpp
+++ b/filters/kpresenter/kword/kprkword.cpp
@@ -19,6 +19,8 @@
#include <config.h>
+#include <list>
+
#include <kgenericfactory.h>
#include <KoStoreDevice.h>
#include <KoFilterChain.h>
@@ -26,7 +28,6 @@
#include <kprkword.h>
#include <tdelocale.h>
#include <kdebug.h>
-#include <tqptrlist.h>
#include <tqcolor.h>
typedef KGenericFactory<KprKword, KoFilter> KprKwordFactory;
@@ -177,8 +178,7 @@ void KprKword::convert()
if ( objects.isNull() )
return;
- TQPtrList< KprObject > objList;
- objList.setAutoDelete( true );
+ std::list<KprObject*> objList;
TQDomNodeList lst = objects.elementsByTagName( "OBJECT" );
uint lstcount = lst.count();
@@ -193,21 +193,22 @@ void KprKword::convert()
KprObject * obj = new KprObject;
obj->y = orig.attribute( "y" ).toDouble();
obj->elem = object;
- objList.inSort( obj );
+ objList.push_back(obj);
}
}
}
+ objList.sort([](KprObject *a, KprObject *b) { return *a < *b; });
int curPage = -1;
- //kdDebug() << "found " << objList.count() << " objects" << endl;
+ //kdDebug() << "found " << objList.size() << " objects" << endl;
- for ( TQPtrListIterator<KprObject> it(objList); it.current(); ++it )
+ for (KprObject *obj : objList)
{
- TQDomElement elem = it.current()->elem;
+ TQDomElement elem = obj->elem;
// Detect the first object of each page
- int page = int( it.current()->y / ptPageHeight );
+ int page = int( obj->y / ptPageHeight );
bool isTitle = ( page > curPage );
- //kdDebug() << "KprKword::convert y=" << it.current()->y << " ptPageHeight=" << ptPageHeight
+ //kdDebug() << "KprKword::convert y=" << obj->y << " ptPageHeight=" << ptPageHeight
// << " isTitle=" << isTitle << endl;
curPage = page;
@@ -461,6 +462,11 @@ void KprKword::convert()
isTitle = false;
}
}
+
+ for (KprObject *obj : objList)
+ {
+ delete obj;
+ }
}
#include <kprkword.moc>