From c2fdb394e63c0df50f1a38eace1077a9151374ce Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 1 Jul 2023 13:08:29 +0900 Subject: [PATCH] Fix functionality broken by commit a9bbaa83 Signed-off-by: Michele Calgaro --- filters/kpresenter/kword/kprkword.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/filters/kpresenter/kword/kprkword.cpp b/filters/kpresenter/kword/kprkword.cpp index 8dbd628bf..87e57a6fa 100644 --- a/filters/kpresenter/kword/kprkword.cpp +++ b/filters/kpresenter/kword/kprkword.cpp @@ -19,6 +19,8 @@ #include +#include + #include #include #include @@ -26,7 +28,6 @@ #include #include #include -#include #include typedef KGenericFactory KprKwordFactory; @@ -177,8 +178,7 @@ void KprKword::convert() if ( objects.isNull() ) return; - TQPtrList< KprObject > objList; - objList.setAutoDelete( true ); + std::list 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 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