00001 #include "searchdcopinterface.h"
00002 #include "searchinterface.h"
00003
00004 #include <dcopclient.h>
00005 #include <qregexp.h>
00006
00007 using namespace KTextEditor;
00008
00009 SearchDCOPInterface::SearchDCOPInterface( SearchInterface *Parent, const char *name)
00010 : DCOPObject(name)
00011 {
00012 m_parent = Parent;
00013 m_currentcol = 0;
00014 m_currentrow = 0;
00015 m_currentmatchlen = 0;
00016 }
00017
00018 SearchDCOPInterface::~SearchDCOPInterface()
00019 {
00020
00021 }
00022
00023 bool SearchDCOPInterface::findFirstString( QString text, bool caseSensitive)
00024 {
00025 return m_parent->searchText(0, 0, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive);
00026 }
00027 bool SearchDCOPInterface::findNextString( QString text, bool caseSensitive)
00028 {
00029 return m_parent->searchText(m_currentrow, m_currentcol+1, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive);
00030 }
00031
00032 bool SearchDCOPInterface::findPreviousString( QString text, bool caseSensitive)
00033 {
00034 if( m_currentcol == 0)
00035 m_currentrow--;
00036 else
00037 m_currentcol--;
00038 return m_parent->searchText(m_currentrow, m_currentcol, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive, true);
00039 }
00040
00041 bool SearchDCOPInterface::findLastString( QString text, bool caseSensitive)
00042 {
00043 return m_parent->searchText(0,0, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive, true);
00044 }
00045
00046 bool SearchDCOPInterface::findStringAt( uint row, uint col, QString text, bool caseSensitive)
00047 {
00048 return m_parent->searchText(row,col, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive);
00049
00050 }
00051
00052 bool SearchDCOPInterface::findFirstRegExp( QString regexp)
00053 {
00054 return m_parent->searchText( 0,0, QRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen);
00055 }
00056
00057 bool SearchDCOPInterface::findNextRegExp( QString regexp)
00058 {
00059 return m_parent->searchText( m_currentrow, m_currentcol+1, QRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen);
00060 }
00061
00062 bool SearchDCOPInterface::findPreviousRegExp( QString regexp)
00063 {
00064 if( m_currentcol == 0)
00065 m_currentrow--;
00066 else
00067 m_currentcol--;
00068 return m_parent->searchText( m_currentrow, m_currentcol, QRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, true);
00069
00070 }
00071
00072 bool SearchDCOPInterface::findLastRegExp(QString regexp)
00073 {
00074 return m_parent->searchText( 0,0, QRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, true);
00075 }
00076
00077 bool SearchDCOPInterface::findRegExpAt( uint row, uint col, QString regexp)
00078 {
00079 return m_parent->searchText( row, col, QRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, false);
00080 }
00081
00082 uint SearchDCOPInterface::currentMatchLine()
00083 {
00084 return m_currentrow;
00085 }
00086 uint SearchDCOPInterface::currentMatchCol()
00087 {
00088 return m_currentcol;
00089 }
00090 uint SearchDCOPInterface::currentMatchLength()
00091 {
00092 return m_currentmatchlen;
00093 }
00094
00095