arrange to enable passing a match term as an argument when opening a document with the native editor (only / mostly pdf for now)
This commit is contained in:
+7
-5
@@ -25,6 +25,9 @@
|
||||
#include "refcntr.h"
|
||||
#include "hldata.h"
|
||||
|
||||
// Need this for the "Snippet" class def.
|
||||
#include "rclquery.h"
|
||||
|
||||
// A result list entry.
|
||||
struct ResListEntry {
|
||||
Rcl::Doc doc;
|
||||
@@ -96,13 +99,12 @@ class DocSequence {
|
||||
return true;
|
||||
}
|
||||
virtual bool getAbstract(Rcl::Doc& doc,
|
||||
std::vector<std::pair<int, std::string> >& abs)
|
||||
std::vector<Rcl::Snippet>& abs)
|
||||
{
|
||||
abs.push_back(std::pair<int, std::string>(0,
|
||||
doc.meta[Rcl::Doc::keyabs]));
|
||||
abs.push_back(Rcl::Snippet(0, doc.meta[Rcl::Doc::keyabs]));
|
||||
return true;
|
||||
}
|
||||
virtual int getFirstMatchPage(Rcl::Doc&)
|
||||
virtual int getFirstMatchPage(Rcl::Doc&, std::string&)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -173,7 +175,7 @@ public:
|
||||
return m_seq->getAbstract(doc, abs);
|
||||
}
|
||||
virtual bool getAbstract(Rcl::Doc& doc,
|
||||
std::vector<std::pair<int, std::string> >& abs)
|
||||
std::vector<Rcl::Snippet>& abs)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
return false;
|
||||
|
||||
@@ -64,11 +64,11 @@ int DocSequenceDb::getResCnt()
|
||||
}
|
||||
return m_rescnt;
|
||||
}
|
||||
static const string cstr_mre("[...]");
|
||||
|
||||
// This one only gets called to fill-up the snippets window
|
||||
// We ignore most abstract/snippets preferences.
|
||||
bool DocSequenceDb::getAbstract(Rcl::Doc &doc,
|
||||
vector<pair<int, string> >& vpabs)
|
||||
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
|
||||
{
|
||||
LOGDEB(("DocSequenceDb::getAbstract/pair\n"));
|
||||
setQuery();
|
||||
@@ -77,15 +77,16 @@ bool DocSequenceDb::getAbstract(Rcl::Doc &doc,
|
||||
int maxoccs = 500;
|
||||
Rcl::abstract_result ret = Rcl::ABSRES_ERROR;
|
||||
if (m_q->whatDb()) {
|
||||
ret = m_q->makeDocAbstract(doc,vpabs, maxoccs,
|
||||
ret = m_q->makeDocAbstract(doc, vpabs, maxoccs,
|
||||
m_q->whatDb()->getAbsCtxLen()+ 2);
|
||||
}
|
||||
if (vpabs.empty())
|
||||
vpabs.push_back(pair<int, string>(0, doc.meta[Rcl::Doc::keyabs]));
|
||||
vpabs.push_back(Rcl::Snippet(0, doc.meta[Rcl::Doc::keyabs]));
|
||||
|
||||
// If the list was probably truncated, indicate it.
|
||||
if (ret == Rcl::ABSRES_TRUNC)
|
||||
vpabs.push_back(pair<int, string>(-1, "[...]"));
|
||||
if (ret == Rcl::ABSRES_TRUNC) {
|
||||
vpabs.push_back(Rcl::Snippet(-1, cstr_mre));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -102,11 +103,11 @@ bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
|
||||
return true;
|
||||
}
|
||||
|
||||
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc)
|
||||
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
|
||||
{
|
||||
setQuery();
|
||||
if (m_q->whatDb()) {
|
||||
return m_q->getFirstMatchPage(doc);
|
||||
return m_q->getFirstMatchPage(doc, term);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ class DocSequenceDb : public DocSequence {
|
||||
|
||||
// Called to fill-up the snippets window. Ignoers
|
||||
// buildabstract/replaceabstract and syntabslen
|
||||
virtual bool getAbstract(Rcl::Doc &doc, vector<pair<int, string> >&);
|
||||
virtual bool getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>&);
|
||||
|
||||
virtual bool getAbstract(Rcl::Doc &doc, vector<string>&);
|
||||
virtual int getFirstMatchPage(Rcl::Doc&);
|
||||
virtual int getFirstMatchPage(Rcl::Doc&, std::string& term);
|
||||
virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc);
|
||||
virtual string getDescription();
|
||||
virtual list<string> expand(Rcl::Doc &doc);
|
||||
|
||||
Reference in New Issue
Block a user