[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/filters/kword/rtf/import
From: Nicolas Goutte <nicolasg () snafu ! de>
Date: 2004-11-29 11:25:23
Message-ID: 20041129112523.144691B9E0 () office ! kde ! org
[Download RAW message or body]
CVS commit by goutte:
Generate <STYLE> by using ConstIterators to find the right styles
Reason: QValueList::at() is slow, as a QValueList is a linked list
M +15 -12 rtfimport.cpp 1.116
M +1 -1 rtfimport.h 1.44
--- koffice/filters/kword/rtf/import/rtfimport.cpp #1.115:1.116
@@ -27,4 +27,6 @@
#include <qfileinfo.h>
#include <qregexp.h>
+#include <qvaluelist.h>
+
#include <kurl.h>
#include <koPicture.h>
@@ -455,4 +457,5 @@ KoFilter::ConversionStatus RTFImport::co
}
}
+ // ### TODO: why can this not be simplified to use QValueList::isEmpty()
if (stateStack.count() <= 1)
{
@@ -640,22 +643,22 @@ KoFilter::ConversionStatus RTFImport::co
// Process all styles in the style sheet
- for (uint i=0; i < styleSheet.count(); i++)
+ const QValueList<RTFStyle>::ConstIterator endStyleSheet=styleSheet.end();
+ for (QValueList<RTFStyle>::ConstIterator it=styleSheet.begin();it!=endStyleSheet;++it)
{
- RTFStyle &style = styleSheet[i];
mainDoc.addNode( "STYLE" );
- kwFormat.fmt = style.format;
+ kwFormat.fmt = (*it).format;
// Search for 'following' style
- for (uint k=0; k < styleSheet.count(); k++)
+ for (QValueList<RTFStyle>::ConstIterator it2=styleSheet.begin();it2!=endStyleSheet;++it2)
{
- if (styleSheet[k].layout.style == style.next)
+ if ((*it2).layout.style == (*it).next)
{
mainDoc.addNode( "FOLLOWING" );
- mainDoc.setAttribute( "name", CheckAndEscapeXmlText( styleSheet[k].name ));
+ mainDoc.setAttribute( "name", CheckAndEscapeXmlText( (*it2).name ));
mainDoc.closeNode( "FOLLOWING");
break;
}
}
- addLayout( mainDoc, style.name, style.layout, false );
+ addLayout( mainDoc, (*it).name, (*it).layout, false );
addFormat( mainDoc, kwFormat, 0L );
mainDoc.closeNode( "STYLE" );
@@ -2263,5 +2266,5 @@ void RTFImport::addFormat( DomNode &node
* @param frameBreak paragraph is always the last in a frame if true
*/
-void RTFImport::addLayout( DomNode &node, const QString &name, RTFLayout &layout, bool frameBreak )
+void RTFImport::addLayout( DomNode &node, const QString &name, const RTFLayout &layout, bool frameBreak )
{
// Style name and alignment
@@ -2374,5 +2377,5 @@ void RTFImport::addLayout( DomNode &node
for (uint i=0; i < 4; i++)
{
- RTFBorder &border = layout.borders[i];
+ const RTFBorder &border = layout.borders[i];
if (border.style != RTFBorder::None || border.width > 0)
@@ -2401,5 +2404,5 @@ void RTFImport::addLayout( DomNode &node
for (uint i=0; i < layout.tablist.count(); i++)
{
- RTFTab &tab = layout.tablist[i];
+ const RTFTab &tab = layout.tablist[i];
int l = (int)tab.leader;
node.addNode( "TABULATOR" );
--- koffice/filters/kword/rtf/import/rtfimport.h #1.43:1.44
@@ -314,5 +314,5 @@ public:
void addAnchor( const char *instance );
void addFormat( DomNode &node, KWFormat &format, RTFFormat *baseFormat );
- void addLayout( DomNode &node, const QString &name, RTFLayout &layout, bool frameBreak );
+ void addLayout( DomNode &node, const QString &name, const RTFLayout &layout, bool frameBreak );
void addParagraph( DomNode &node, bool frameBreak );
void addVariable(const DomNode& spec, int type, const QString& key, const RTFFormat* fmt=0);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic