summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoAutoFormat.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
commitb6edfe41c9395f2e20784cbf0e630af6426950a3 (patch)
tree56ed9b871d4296e6c15949c24e16420be1b28697 /lib/kotext/KoAutoFormat.cpp
parentef39e8e4178a8f98cf5f154916ba0f03e4855206 (diff)
downloadkoffice-b6edfe41c9395f2e20784cbf0e630af6426950a3.tar.gz
koffice-b6edfe41c9395f2e20784cbf0e630af6426950a3.zip
rename the following methods:
tqfind find tqreplace replace tqcontains contains git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kotext/KoAutoFormat.cpp')
-rw-r--r--lib/kotext/KoAutoFormat.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/lib/kotext/KoAutoFormat.cpp b/lib/kotext/KoAutoFormat.cpp
index b6529b8f0..dfe6c6df2 100644
--- a/lib/kotext/KoAutoFormat.cpp
+++ b/lib/kotext/KoAutoFormat.cpp
@@ -75,8 +75,8 @@ void KoCompletionBox::setLastWord( TQString const &lastword)
m_lastWord = lastword;
}
-KoAutoFormatEntry::KoAutoFormatEntry(const TQString& tqreplace)
- : m_tqreplace( tqreplace )
+KoAutoFormatEntry::KoAutoFormatEntry(const TQString& replace)
+ : m_replace( replace )
{
m_formatOptions= 0L;
}
@@ -296,11 +296,11 @@ void KoAutoFormat::readConfig(bool force)
TQString beginDoubleQuote = config->readEntry( "TypographicQuotesBegin" );
TQString endDoubleQuote = config->readEntry( "TypographicQuotesEnd" );
- m_typographicDoubleQuotes.tqreplace = config->readBoolEntry( "TypographicQuotesEnabled", false );
+ m_typographicDoubleQuotes.replace = config->readBoolEntry( "TypographicQuotesEnabled", false );
TQString begin = config->readEntry( "TypographicSimpleQuotesBegin" );
TQString end = config->readEntry( "TypographicSimpleQuotesEnd" );
- m_typographicSimpleQuotes.tqreplace = config->readBoolEntry( "TypographicSimpleQuotesEnabled", false );
+ m_typographicSimpleQuotes.replace = config->readBoolEntry( "TypographicSimpleQuotesEnabled", false );
m_bAutoSuperScript = config->readBoolEntry( "AutoSuperScript", true );
@@ -352,7 +352,7 @@ void KoAutoFormat::readConfig(bool force)
else
m_typographicDoubleQuotes.end = endDoubleQuote[0];
- m_typographicDoubleQuotes.tqreplace = m_typographicDoubleQuotes.tqreplace
+ m_typographicDoubleQuotes.replace = m_typographicDoubleQuotes.replace
&& !m_typographicDoubleQuotes.begin.isNull()
&& !m_typographicDoubleQuotes.end.isNull();
@@ -377,7 +377,7 @@ void KoAutoFormat::readConfig(bool force)
else
m_typographicSimpleQuotes.end = end[0];
- m_typographicSimpleQuotes.tqreplace = m_typographicSimpleQuotes.tqreplace
+ m_typographicSimpleQuotes.replace = m_typographicSimpleQuotes.replace
&& !m_typographicSimpleQuotes.end.isNull()
&& !m_typographicSimpleQuotes.begin.isNull();
@@ -404,7 +404,7 @@ void KoAutoFormat::readAutoCorrectConfig()
{
if ( fname.isEmpty() && !kdelang.isEmpty() )
fname = locate( "data", "koffice/autocorrect/" + kdelang + ".xml", m_doc->instance() );
- if ( fname.isEmpty() && kdelang.tqcontains("_") )
+ if ( fname.isEmpty() && kdelang.contains("_") )
{
kdelang.remove( TQRegExp( "_.*" ) );
fname = locate( "data", "koffice/autocorrect/" + kdelang + ".xml", m_doc->instance() );
@@ -456,7 +456,7 @@ void KoAutoFormat::readAutoCorrectConfig()
for(uint i = 0; i < nl.count() ; i++) {
//bug in qmap we overwrite = false doesn't work
//so we can't add multiple "othernb"
- m_superScriptEntries.insert( nl.item(i).toElement().attribute("tqfind"), KoAutoFormatEntry(nl.item(i).toElement().attribute("super")),FALSE );
+ m_superScriptEntries.insert( nl.item(i).toElement().attribute("find"), KoAutoFormatEntry(nl.item(i).toElement().attribute("super")),FALSE );
}
}
@@ -527,7 +527,7 @@ void KoAutoFormat::loadAutoCorrection( const TQDomElement & _de, bool _allLangua
void KoAutoFormat::loadEntry( const TQDomElement &nl, bool _allLanguages)
{
- KoAutoFormatEntry *tmp =new KoAutoFormatEntry(nl.attribute("tqreplace"));
+ KoAutoFormatEntry *tmp =new KoAutoFormatEntry(nl.attribute("replace"));
if ( nl.hasAttribute("FONT"))
{
tmp->createNewEntryContext();
@@ -607,9 +607,9 @@ void KoAutoFormat::loadEntry( const TQDomElement &nl, bool _allLanguages)
tmp->formatEntryContext()->m_backGroundColor = col;
}
if ( !_allLanguages )
- m_entries.insert( nl.attribute("tqfind"), tmp );
+ m_entries.insert( nl.attribute("find"), tmp );
else
- m_allLanguages.insert( nl.attribute("tqfind"), tmp );
+ m_allLanguages.insert( nl.attribute("find"), tmp );
}
@@ -628,10 +628,10 @@ void KoAutoFormat::saveConfig()
config->writeEntry( "TypographicQuotesBegin", TQString( m_typographicDoubleQuotes.begin ) );
config->writeEntry( "TypographicQuotesEnd", TQString( m_typographicDoubleQuotes.end ) );
- config->writeEntry( "TypographicQuotesEnabled", m_typographicDoubleQuotes.tqreplace );
+ config->writeEntry( "TypographicQuotesEnabled", m_typographicDoubleQuotes.replace );
config->writeEntry( "TypographicSimpleQuotesBegin", TQString( m_typographicSimpleQuotes.begin ) );
config->writeEntry( "TypographicSimpleQuotesEnd", TQString( m_typographicSimpleQuotes.end ) );
- config->writeEntry( "TypographicSimpleQuotesEnabled", m_typographicSimpleQuotes.tqreplace );
+ config->writeEntry( "TypographicSimpleQuotesEnabled", m_typographicSimpleQuotes.replace );
config->writeEntry( "AdvancedAutocorrect", m_advancedAutoCorrect );
config->writeEntry( "AutoCorrectionWithFormat", m_bAutoCorrectionWithFormat );
@@ -709,8 +709,8 @@ void KoAutoFormat::saveConfig()
for ( ; it2 != m_superScriptEntries.end() ; ++it2 )
{
data = doc.createElement("superscript");
- data.setAttribute("tqfind", it2.key());
- data.setAttribute("super", it2.data().tqreplace());
+ data.setAttribute("find", it2.key());
+ data.setAttribute("super", it2.data().replace());
super.appendChild(data);
}
begin.appendChild(super);
@@ -751,8 +751,8 @@ TQDomElement KoAutoFormat::saveEntry( TQDictIterator<KoAutoFormatEntry> _entry,
{
TQDomElement data;
data = doc.createElement("item");
- data.setAttribute("tqfind", _entry.currentKey());
- data.setAttribute("tqreplace", _entry.current()->tqreplace());
+ data.setAttribute("find", _entry.currentKey());
+ data.setAttribute("replace", _entry.current()->replace());
if ( _entry.current()->formatEntryContext() )
{
KoSearchContext *tmp = _entry.current()->formatEntryContext();
@@ -847,16 +847,16 @@ TQDomElement KoAutoFormat::saveEntry( TQDictIterator<KoAutoFormatEntry> _entry,
return data;
}
-void KoAutoFormat::addAutoFormatEntry( const TQString &key, const TQString &tqreplace )
+void KoAutoFormat::addAutoFormatEntry( const TQString &key, const TQString &replace )
{
- KoAutoFormatEntry *findEntry = m_entries.tqfind( key);
+ KoAutoFormatEntry *findEntry = m_entries.find( key);
if ( findEntry )
{
- if ( findEntry->tqreplace().lower() == tqreplace.lower() )
+ if ( findEntry->replace().lower() == replace.lower() )
return;
}
- KoAutoFormatEntry *tmp = new KoAutoFormatEntry( tqreplace );
+ KoAutoFormatEntry *tmp = new KoAutoFormatEntry( replace );
m_entries.insert( key, tmp );
saveConfig();
buildMaxLen();
@@ -932,7 +932,7 @@ bool KoAutoFormat::doCompletion( KoTextCursor* textEditCursor, KoTextParag *para
uint maxlength = 0;
for ( TQStringList::ConstIterator it = wordlist.begin(); it != wordlist.end(); ++it ) // several completion words were found
{
- if ( (*it).tqstartsWith( lastWord, false ) && new_wordlist.tqfind(*it) == new_wordlist.end() ) //the completion words that begin with lastWord
+ if ( (*it).tqstartsWith( lastWord, false ) && new_wordlist.find(*it) == new_wordlist.end() ) //the completion words that begin with lastWord
{
if ( (*it).length() > maxlength )
maxlength = (*it).length();
@@ -1092,8 +1092,8 @@ void KoAutoFormat::autoFormatIsActive()
m_autoReplaceNumber ||
m_autoChangeFormat ||
m_completion ||
- m_typographicDoubleQuotes.tqreplace ||
- m_typographicSimpleQuotes.tqreplace ||
+ m_typographicDoubleQuotes.replace ||
+ m_typographicSimpleQuotes.replace ||
m_entries.count()!=0 ||
m_allLanguages.count()!=0;
}
@@ -1323,13 +1323,13 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para
}
else
{
- if ( ch == '"' && m_typographicDoubleQuotes.tqreplace )
+ if ( ch == '"' && m_typographicDoubleQuotes.replace )
{
KCommand *cmd = doTypographicQuotes( textEditCursor, parag, index, txtObj, true /*double quote*/ );
if ( cmd )
txtObj->emitNewCommand( cmd );
}
- else if ( ch == '\'' && m_typographicDoubleQuotes.tqreplace )
+ else if ( ch == '\'' && m_typographicDoubleQuotes.replace )
{
KCommand *cmd = doTypographicQuotes( textEditCursor, parag, index, txtObj, false /* simple quote*/ );
if ( cmd )
@@ -1400,10 +1400,10 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara
cursor.setIndex( start + length );
textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor );
KCommand *cmd = 0L;
- kdDebug()<<"it->tqreplace() :"<<it->tqreplace()<<endl;
+ kdDebug()<<"it->replace() :"<<it->replace()<<endl;
if (!it->formatEntryContext() || !m_bAutoCorrectionWithFormat)
{
- cmd = txtObj->replaceSelectionCommand( textEditCursor, it->tqreplace(),
+ cmd = txtObj->replaceSelectionCommand( textEditCursor, it->replace(),
i18n("Autocorrect Word"),
KoTextDocument::HighlightSelection );
}
@@ -1414,7 +1414,7 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara
KoTextFormat * newFormat = new KoTextFormat(*lastFormat);
changeTextFormat(it->formatEntryContext(), newFormat, flags );
KMacroCommand *macro = new KMacroCommand( i18n("Autocorrect Word with Format"));
- KCommand *cmd2=txtObj->replaceSelectionCommand( textEditCursor, it->tqreplace(),
+ KCommand *cmd2=txtObj->replaceSelectionCommand( textEditCursor, it->replace(),
i18n("Autocorrect Word"),
KoTextDocument::HighlightSelection );
if ( cmd2 )
@@ -1423,13 +1423,13 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara
cursor.setParag( parag );
cursor.setIndex( start );
textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor );
- cursor.setIndex( start + it->tqreplace().length()/*+ length + 1*/ );
+ cursor.setIndex( start + it->replace().length()/*+ length + 1*/ );
textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor );
cmd2 =txtObj->setFormatCommand( textEditCursor, &lastFormat, newFormat, flags, false, KoTextDocument::HighlightSelection );
macro->addCommand( cmd2);
- index = index - length + it->tqreplace().length();
+ index = index - length + it->replace().length();
textEditCursor->setIndex(index+1);
cmd2 =txtObj->setFormatCommand( textEditCursor, &newFormat, lastFormat, 0 );
macro->addCommand( cmd2);
@@ -1448,7 +1448,7 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara
txtObj->emitHideCursor();
textEditCursor->gotoRight();
txtObj->emitShowCursor();
- index = index - length + it->tqreplace().length();
+ index = index - length + it->replace().length();
return cmd;
}
}
@@ -1557,7 +1557,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag
// Go back over any space/tab/CR
while ( backCursor.index() > 0 || backCursor.parag()->prev() )
{
- beginningOfSentence = false; // we could go back -> false unless we'll tqfind '.'
+ beginningOfSentence = false; // we could go back -> false unless we'll find '.'
backCursor.gotoLeft();
if ( !backCursor.parag()->at( backCursor.index() )->c.isSpace() )
break;
@@ -1578,7 +1578,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag
+ punct;
kdDebug() << "text: " << text << endl;
// text has the word at the end of the 'sentence', including the termination. Example: "Mr."
- beginningOfSentence = (m_upperCaseExceptions.tqfindIndex(text)==-1); // Ok if we can't find it
+ beginningOfSentence = (m_upperCaseExceptions.findIndex(text)==-1); // Ok if we can't find it
}
if ( beginningOfSentence )
@@ -1605,7 +1605,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag
// Check next letter - we still want to be able to write fully uppercase words...
backCursor.setIndex( backCursor.index() + 1 );
TQChar thirdChar = backCursor.parag()->at( backCursor.index() )->c;
- if ( isLower( thirdChar ) && (m_twoUpperLetterException.tqfindIndex(word)==-1))
+ if ( isLower( thirdChar ) && (m_twoUpperLetterException.findIndex(word)==-1))
{
// Ok, convert
KoTextCursor cursor( parag->document() );
@@ -1681,13 +1681,13 @@ void KoAutoFormat::detectStartOfLink(KoTextParag * parag, int const index, bool
word.append( s->at( i ).c );
}
- if (word.tqfind("http")!=-1 || word.tqfind("https")!=-1 || word.tqfind("mailto")!=-1 || word.tqfind("ftp")!=-1 || word.tqfind("file")!=-1
- || word.tqfind("news")!=-1 || word.tqfind('@')!=-1)
+ if (word.find("http")!=-1 || word.find("https")!=-1 || word.find("mailto")!=-1 || word.find("ftp")!=-1 || word.find("file")!=-1
+ || word.find("news")!=-1 || word.find('@')!=-1)
m_ignoreUpperCase=true;
else
{
- int const tmp_pos=word.tqfind("www.");
- if (tmp_pos!=-1 && (word.tqfind('.',tmp_pos+4)!=-1 || insertedDot) )
+ int const tmp_pos=word.find("www.");
+ if (tmp_pos!=-1 && (word.find('.',tmp_pos+4)!=-1 || insertedDot) )
m_ignoreUpperCase=true;
}
}
@@ -1696,35 +1696,35 @@ void KoAutoFormat::doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *p
{
kdDebug() << "link:" << word << endl;
char link_type = 0;
- int pos = word.tqfind("http://");
- int tmp_pos = word.tqfind("https://");
+ int pos = word.find("http://");
+ int tmp_pos = word.find("https://");
if(tmp_pos<pos && tmp_pos!=-1)
pos = tmp_pos;
- tmp_pos = word.tqfind("mailto:/");
+ tmp_pos = word.find("mailto:/");
if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1)
pos = tmp_pos;
- tmp_pos = word.tqfind("ftp://");
+ tmp_pos = word.find("ftp://");
if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1)
pos = tmp_pos;
- tmp_pos = word.tqfind("ftp.");
+ tmp_pos = word.find("ftp.");
if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1)
{
pos = tmp_pos;
link_type = 3;
}
- tmp_pos = word.tqfind("file:/");
+ tmp_pos = word.find("file:/");
if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1)
pos = tmp_pos;
- tmp_pos = word.tqfind("news:");
+ tmp_pos = word.find("news:");
if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1)
pos = tmp_pos;
- tmp_pos = word.tqfind("www.");
- if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1 && word.tqfind('.',tmp_pos+4)!=-1 )
+ tmp_pos = word.find("www.");
+ if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1 && word.find('.',tmp_pos+4)!=-1 )
{
pos = tmp_pos;
link_type = 2;
}
- tmp_pos = word.tqfind('@');
+ tmp_pos = word.find('@');
if ( pos == -1 && tmp_pos != -1 )
{
pos = tmp_pos-1;
@@ -1821,7 +1821,7 @@ void KoAutoFormat::doAutoIncludeUpperUpper(KoTextCursor* /*textEditCursor*/, KoT
}
if( word.length() > 2 && word.left(2)==word.left(2).upper() && word.tqat(3)!=word.tqat(3).upper() )
{
- if ( m_twoUpperLetterException.tqfindIndex(word )==-1)
+ if ( m_twoUpperLetterException.findIndex(word )==-1)
m_twoUpperLetterException.append( word);
}
i+=word.length();
@@ -1858,7 +1858,7 @@ void KoAutoFormat::doAutoIncludeAbbreviation(KoTextCursor* /*textEditCursor*/, K
}
if( word.length()>1 && !wordAfter.isEmpty() && wordAfter.tqat(0)==wordAfter.tqat(0).lower())
{
- if ( m_upperCaseExceptions.tqfindIndex(word )==-1)
+ if ( m_upperCaseExceptions.findIndex(word )==-1)
m_upperCaseExceptions.append( word );
}
}
@@ -2151,7 +2151,7 @@ KCommand *KoAutoFormat::doCapitalizeNameOfDays( KoTextCursor* textEditCursor, Ko
{
//m_cacheNameOfDays
//todo
- int pos = m_cacheNameOfDays.tqfindIndex( word.lower() );
+ int pos = m_cacheNameOfDays.findIndex( word.lower() );
if ( pos == -1 )
return 0L;
KoTextDocument * textdoc = parag->textDocument();
@@ -2183,19 +2183,19 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP
{
KoAutoFormatEntryMap::Iterator it = m_superScriptEntries.begin();
bool found = false;
- TQString tqreplace;
+ TQString replace;
for ( ; it != m_superScriptEntries.end() ; ++it )
{
if( it.key()==word)
{
- tqreplace = it.data().tqreplace();
+ replace = it.data().replace();
found = true;
break;
}
else if ( it.key()=="othernb")
{
- TQString tmp = it.data().tqreplace();
- int pos = word.tqfind( tmp );
+ TQString tmp = it.data().replace();
+ int pos = word.find( tmp );
if( pos != -1)
{
if( pos + tmp.length() == word.length())
@@ -2204,7 +2204,7 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP
word.left( pos ).toInt( &ok);
if( ok )
{
- tqreplace = tmp;
+ replace = tmp;
found = true;
break;
}
@@ -2216,7 +2216,7 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP
{
KoTextDocument * textdoc = parag->textDocument();
- int start = index - tqreplace.length();
+ int start = index - replace.length();
KoTextFormat * lastFormat = parag->at( start )->format();
KoTextFormat * newFormat = new KoTextFormat(*lastFormat);
KoTextCursor cursor( parag->document() );