blob: ee5c46e5ffc5e6efed935f72d201fcc22d1a310a [file] [log] [blame]
// Copyright 2016 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc.
#include <stddef.h>
#include <memory>
#include <vector>
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxcrt/widestring.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
class CPDF_TextPage;
class CPDF_TextPageFind {
struct Options {
bool bMatchCase = false;
bool bMatchWholeWord = false;
bool bConsecutive = false;
static std::unique_ptr<CPDF_TextPageFind> Create(
const CPDF_TextPage* pTextPage,
const WideString& findwhat,
const Options& options,
absl::optional<size_t> startPos);
bool FindNext();
bool FindPrev();
int GetCurOrder() const;
int GetMatchedCount() const;
CPDF_TextPageFind(const CPDF_TextPage* pTextPage,
const std::vector<WideString>& findwhat_array,
const Options& options,
absl::optional<size_t> startPos);
// Should be called immediately after construction.
bool FindFirst();
int GetCharIndex(int index) const;
UnownedPtr<const CPDF_TextPage> const m_pTextPage;
const WideString m_strText;
const std::vector<WideString> m_csFindWhatArray;
absl::optional<size_t> m_findNextStart;
absl::optional<size_t> m_findPreStart;
int m_resStart = 0;
int m_resEnd = -1;
const Options m_options;