|
a/src/qtgui/plaintorich.cpp |
|
b/src/qtgui/plaintorich.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.10 2006-02-07 09:44:33 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.11 2006-09-13 14:57:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
81 |
// on qtextedit internals, and we don't do it any more, so we finally
|
81 |
// on qtextedit internals, and we don't do it any more, so we finally
|
82 |
// don't know the term par/car positions in the editor text. Instead,
|
82 |
// don't know the term par/car positions in the editor text. Instead,
|
83 |
// we return the first term encountered, and the caller will use the
|
83 |
// we return the first term encountered, and the caller will use the
|
84 |
// editor's find() function to position on it
|
84 |
// editor's find() function to position on it
|
85 |
bool plaintorich(const string& in, string& out, const list<string>& terms,
|
85 |
bool plaintorich(const string& in, string& out, const list<string>& terms,
|
86 |
string *firstTerm)
|
86 |
string *firstTerm, bool noHeader)
|
87 |
{
|
87 |
{
|
88 |
Chrono chron;
|
88 |
Chrono chron;
|
89 |
LOGDEB(("plaintorich: terms: %s\n",
|
89 |
LOGDEB(("plaintorich: terms: %s\n",
|
90 |
stringlistdisp(terms).c_str()));
|
90 |
stringlistdisp(terms).c_str()));
|
91 |
out.erase();
|
91 |
out.erase();
|
|
... |
|
... |
102 |
if (firstTerm)
|
102 |
if (firstTerm)
|
103 |
*firstTerm = cb.firstTerm;
|
103 |
*firstTerm = cb.firstTerm;
|
104 |
LOGDEB(("plaintorich: split done %d mS\n", chron.millis()));
|
104 |
LOGDEB(("plaintorich: split done %d mS\n", chron.millis()));
|
105 |
|
105 |
|
106 |
// Rich text output
|
106 |
// Rich text output
|
|
|
107 |
if (noHeader)
|
|
|
108 |
out = "";
|
|
|
109 |
else
|
107 |
out = "<qt><head><title></title></head><body><p>";
|
110 |
out = "<qt><head><title></title></head><body><p>";
|
108 |
|
111 |
|
109 |
// Iterator for the list of input term positions. We use it to
|
112 |
// Iterator for the list of input term positions. We use it to
|
110 |
// output highlight tags and to compute term positions in the
|
113 |
// output highlight tags and to compute term positions in the
|
111 |
// output text
|
114 |
// output text
|
112 |
list<pair<int, int> >::iterator tPosIt = cb.tboffs.begin();
|
115 |
list<pair<int, int> >::iterator tPosIt = cb.tboffs.begin();
|