Fix functionality broken by commit a9bbaa83

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/38/head
Michele Calgaro 10 months ago
parent a9bbaa83cc
commit c2fdb394e6
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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>

Loading…
Cancel
Save