#include "xfa/fde/cfde_texteditengine.h"
#include <algorithm>
#include <utility>
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/text_char_pos.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fde/cfde_wordbreak_data.h"
#include "xfa/fgas/font/cfgas_gefont.h"
namespace pdfium {
namespace {
class InsertOperation final : public CFDE_TextEditEngine::Operation { … };
class DeleteOperation final : public CFDE_TextEditEngine::Operation { … };
class ReplaceOperation final : public CFDE_TextEditEngine::Operation { … };
int GetBreakFlagsFor(WordBreakProperty current, WordBreakProperty next) { … }
bool BreakFlagsChanged(int flags, WordBreakProperty previous) { … }
}
CFDE_TextEditEngine::CFDE_TextEditEngine() { … }
CFDE_TextEditEngine::~CFDE_TextEditEngine() = default;
void CFDE_TextEditEngine::Clear() { … }
void CFDE_TextEditEngine::SetMaxEditOperationsForTesting(size_t max) { … }
void CFDE_TextEditEngine::AdjustGap(size_t idx, size_t length) { … }
size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text,
size_t num_to_check) { … }
void CFDE_TextEditEngine::Insert(size_t idx,
const WideString& request_text,
RecordOperation add_operation) { … }
void CFDE_TextEditEngine::AddOperationRecord(std::unique_ptr<Operation> op) { … }
void CFDE_TextEditEngine::ClearOperationRecords() { … }
size_t CFDE_TextEditEngine::GetIndexLeft(size_t pos) const { … }
size_t CFDE_TextEditEngine::GetIndexRight(size_t pos) const { … }
size_t CFDE_TextEditEngine::GetIndexUp(size_t pos) const { … }
size_t CFDE_TextEditEngine::GetIndexDown(size_t pos) const { … }
size_t CFDE_TextEditEngine::GetIndexAtStartOfLine(size_t pos) const { … }
size_t CFDE_TextEditEngine::GetIndexAtEndOfLine(size_t pos) const { … }
void CFDE_TextEditEngine::LimitHorizontalScroll(bool val) { … }
void CFDE_TextEditEngine::LimitVerticalScroll(bool val) { … }
bool CFDE_TextEditEngine::CanUndo() const { … }
bool CFDE_TextEditEngine::CanRedo() const { … }
bool CFDE_TextEditEngine::Redo() { … }
bool CFDE_TextEditEngine::Undo() { … }
void CFDE_TextEditEngine::Layout() { … }
CFX_RectF CFDE_TextEditEngine::GetContentsBoundingBox() { … }
void CFDE_TextEditEngine::SetAvailableWidth(size_t width) { … }
void CFDE_TextEditEngine::SetHasCharacterLimit(bool limit) { … }
void CFDE_TextEditEngine::SetCharacterLimit(size_t limit) { … }
void CFDE_TextEditEngine::SetFont(RetainPtr<CFGAS_GEFont> font) { … }
RetainPtr<CFGAS_GEFont> CFDE_TextEditEngine::GetFont() const { … }
void CFDE_TextEditEngine::SetFontSize(float size) { … }
void CFDE_TextEditEngine::SetTabWidth(float width) { … }
void CFDE_TextEditEngine::SetAlignment(uint32_t alignment) { … }
void CFDE_TextEditEngine::SetVisibleLineCount(size_t count) { … }
void CFDE_TextEditEngine::EnableMultiLine(bool val) { … }
void CFDE_TextEditEngine::EnableLineWrap(bool val) { … }
void CFDE_TextEditEngine::SetCombText(bool enable) { … }
void CFDE_TextEditEngine::SetCombTextWidth() { … }
void CFDE_TextEditEngine::SelectAll() { … }
void CFDE_TextEditEngine::ClearSelection() { … }
void CFDE_TextEditEngine::SetSelection(size_t start_idx, size_t count) { … }
WideString CFDE_TextEditEngine::GetSelectedText() const { … }
WideString CFDE_TextEditEngine::DeleteSelectedText(
RecordOperation add_operation) { … }
WideString CFDE_TextEditEngine::Delete(size_t start_idx,
size_t length,
RecordOperation add_operation) { … }
void CFDE_TextEditEngine::ReplaceSelectedText(const WideString& requested_rep) { … }
WideString CFDE_TextEditEngine::GetText() const { … }
size_t CFDE_TextEditEngine::GetLength() const { … }
wchar_t CFDE_TextEditEngine::GetChar(size_t idx) const { … }
int32_t CFDE_TextEditEngine::GetWidthOfChar(size_t idx) { … }
size_t CFDE_TextEditEngine::GetIndexForPoint(const CFX_PointF& point) { … }
std::vector<CFX_RectF> CFDE_TextEditEngine::GetCharRects(
const FDE_TEXTEDITPIECE& piece) { … }
std::vector<TextCharPos> CFDE_TextEditEngine::GetDisplayPos(
const FDE_TEXTEDITPIECE& piece) { … }
void CFDE_TextEditEngine::RebuildPieces() { … }
std::pair<int32_t, CFX_RectF> CFDE_TextEditEngine::GetCharacterInfo(
int32_t start_idx) { … }
std::vector<CFX_RectF> CFDE_TextEditEngine::GetCharacterRectsInRange(
int32_t start_idx,
int32_t count) { … }
std::pair<size_t, size_t> CFDE_TextEditEngine::BoundsForWordAt(
size_t idx) const { … }
CFDE_TextEditEngine::Iterator::Iterator(const CFDE_TextEditEngine* engine)
: … { … }
CFDE_TextEditEngine::Iterator::~Iterator() = default;
void CFDE_TextEditEngine::Iterator::Next(bool bPrev) { … }
wchar_t CFDE_TextEditEngine::Iterator::GetChar() const { … }
void CFDE_TextEditEngine::Iterator::SetAt(size_t nIndex) { … }
bool CFDE_TextEditEngine::Iterator::IsEOF(bool bPrev) const { … }
size_t CFDE_TextEditEngine::Iterator::FindNextBreakPos(bool bPrev) { … }
}