diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-30 12:16:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-30 16:26:12 +0000 |
commit | 68eefa6a6f6bbab73000a29e2cac3e104be1cc81 (patch) | |
tree | b48dbf0932022bc551ae06e2400262c203856942 /xfa/fde/cfde_txtedtpage.h | |
parent | aa3a9cd82df9dff1ef136797259e606a39c18b75 (diff) | |
download | pdfium-68eefa6a6f6bbab73000a29e2cac3e104be1cc81.tar.xz |
Rebuild CFDE_TextEditEngine.
This CL rebuilds the text edit engine in a simpler fashion. Instead of
depending on multiple pages, paragraphs and buffer fields there is a
single text edit engine which contains a gap buffer.
This makes the code easier to understand and follow.
Change-Id: I10fe85603fa9ed15a647eaac2d931f113cd0c7b0
Reviewed-on: https://pdfium-review.googlesource.com/11990
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fde/cfde_txtedtpage.h')
-rw-r--r-- | xfa/fde/cfde_txtedtpage.h | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h deleted file mode 100644 index cdf6c55080..0000000000 --- a/xfa/fde/cfde_txtedtpage.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// 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. http://www.foxitsoftware.com - -#ifndef XFA_FDE_CFDE_TXTEDTPAGE_H_ -#define XFA_FDE_CFDE_TXTEDTPAGE_H_ - -#include <deque> -#include <memory> -#include <vector> - -#include "core/fxcrt/fx_coordinates.h" -#include "core/fxcrt/ifx_chariter.h" -#include "core/fxge/cfx_renderdevice.h" - -class CFDE_TxtEdtEngine; -class CFDE_TxtEdtParag; -class CFDE_TxtEdtTextSet; - -struct FDE_TEXTEDITPIECE { - FDE_TEXTEDITPIECE(); - FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that); - ~FDE_TEXTEDITPIECE(); - - int32_t nStart; - int32_t nCount; - int32_t nBidiLevel; - CFX_RectF rtPiece; - uint32_t dwCharStyles; -}; - -inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default; -inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) = - default; -inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default; - -class CFDE_TxtEdtPage { - public: - CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex); - ~CFDE_TxtEdtPage(); - - CFDE_TxtEdtEngine* GetEngine() const { return m_pEditEngine.Get(); } - - int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, bool bBBox) const; - int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore); - - void CalcRangeRectArray(int32_t nStart, - int32_t nCount, - std::vector<CFX_RectF>* RectFArr) const; - - int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount); - - int32_t GetCharStart() const { return m_nPageStart; } - int32_t GetCharCount() const { return m_nCharCount; } - - int32_t LoadPage(); - void UnloadPage(); - - const CFX_RectF& GetContentsBox() { return m_rtPageContents; } - - size_t GetTextPieceCount() const { return m_pTextSet ? m_Pieces.size() : 0; } - const FDE_TEXTEDITPIECE& GetTextPiece(size_t pos) const; - - wchar_t GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; - int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; - - CFDE_TxtEdtTextSet* GetTextSet() const { return m_pTextSet.get(); } - - private: - void NormalizePt2Rect(CFX_PointF& ptF, - const CFX_RectF& rtF, - float fTolerance) const; - - std::unique_ptr<IFX_CharIter> m_pIter; - std::unique_ptr<CFDE_TxtEdtTextSet> m_pTextSet; - CFX_UnownedPtr<CFDE_TxtEdtEngine> const m_pEditEngine; - std::deque<FDE_TEXTEDITPIECE> m_Pieces; - CFDE_TxtEdtParag* m_pBgnParag; - CFDE_TxtEdtParag* m_pEndParag; - int32_t m_nRefCount; - int32_t m_nPageStart; - int32_t m_nCharCount; - int32_t m_nPageIndex; - bool m_bLoaded; - CFX_RectF m_rtPage; - CFX_RectF m_rtPageMargin; - CFX_RectF m_rtPageContents; - CFX_RectF m_rtPageCanvas; - std::vector<int32_t> m_CharWidths; -}; - -#endif // XFA_FDE_CFDE_TXTEDTPAGE_H_ |