pdfsearch.h.svn-base
来自「SumatraPDF是一款小型开源的pdf阅读工具。虽然玲珑小巧(只有800多K」· SVN-BASE 代码 · 共 85 行
SVN-BASE
85 行
#ifndef _PDF_SEARCH_H
#define _PDF_SEARCH_H
#include <windows.h>
#include "PdfEngine.h"
enum PdfSearchDirection {
FIND_BACKWARD = false,
FIND_FORWARD = true
};
typedef struct {
int page;
int left;
int top;
int right;
int bottom;
} PdfSearchResult;
class PdfSearchTracker
{
public:
virtual void FindUpdateStatus(int count, int total) = 0;
};
class PdfSearch
{
protected:
void *text;
int length;
bool forward;
bool sensitive;
public:
PdfSearchResult result;
PdfSearchTracker *tracker;
private:
PdfEngine *engine;
pdf_textline *line;
pdf_textline *current;
long last;
protected:
void ReverseLineList();
bool MatchChars(int c1, int c2);
bool MatchAtPosition(int n);
bool FindTextInPage(int page = 0);
bool FindStartingAtPage(int page);
public:
PdfSearch(PdfEngine *engine);
~PdfSearch();
void Reset();
void SetText(wchar_t *text);
void SetSensitive(bool sensitive) { this->sensitive = sensitive; }
void SetDirection(bool forward);
bool FindFirst(int page, wchar_t *text);
bool FindNext();
protected:
void Clear()
{
free(text);
text = NULL;
Reset();
}
void UpdateTracker(int pageNo, int total)
{
if (!tracker)
return;
int count;
if (forward)
count = pageNo;
else
count = total - pageNo + 1;
tracker->FindUpdateStatus(count, total);
}
};
#endif // _PDF_SEARCH_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?