summaryrefslogtreecommitdiff
path: root/xfa/fde/cfde_txtedtbuf.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-30 12:16:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-30 16:26:12 +0000
commit68eefa6a6f6bbab73000a29e2cac3e104be1cc81 (patch)
treeb48dbf0932022bc551ae06e2400262c203856942 /xfa/fde/cfde_txtedtbuf.h
parentaa3a9cd82df9dff1ef136797259e606a39c18b75 (diff)
downloadpdfium-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_txtedtbuf.h')
-rw-r--r--xfa/fde/cfde_txtedtbuf.h76
1 files changed, 0 insertions, 76 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h
deleted file mode 100644
index e8293d0240..0000000000
--- a/xfa/fde/cfde_txtedtbuf.h
+++ /dev/null
@@ -1,76 +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_TXTEDTBUF_H_
-#define XFA_FDE_CFDE_TXTEDTBUF_H_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxcrt/ifx_chariter.h"
-
-class CFDE_TxtEdtBuf {
- public:
- class Iterator : public IFX_CharIter {
- public:
- Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias);
- ~Iterator() override;
-
- bool Next(bool bPrev = false) override;
- wchar_t GetChar() const override;
-
- void SetAt(int32_t nIndex) override;
- int32_t GetAt() const override;
-
- bool IsEOF(bool bTail = true) const override;
- std::unique_ptr<IFX_CharIter> Clone() const override;
-
- private:
- CFDE_TxtEdtBuf* m_pBuf;
- int32_t m_nCurChunk;
- int32_t m_nCurIndex;
- int32_t m_nIndex;
- wchar_t m_Alias;
- };
-
- CFDE_TxtEdtBuf();
- ~CFDE_TxtEdtBuf();
-
- int32_t GetTextLength() const { return m_nTotal; }
- void SetText(const CFX_WideString& wsText);
- CFX_WideString GetText() const { return GetRange(0, m_nTotal); }
-
- wchar_t GetCharByIndex(int32_t nIndex) const;
- CFX_WideString GetRange(int32_t nBegin, int32_t nCount) const;
-
- void Insert(int32_t nPos, const CFX_WideString& wsText);
- void Delete(int32_t nIndex, int32_t nLength);
- void Clear();
-
- void SetChunkSizeForTesting(size_t size);
- size_t GetChunkCountForTesting() const { return m_chunks.size(); }
-
- private:
- class ChunkHeader {
- public:
- explicit ChunkHeader(int32_t chunkSize);
- ~ChunkHeader();
-
- int32_t nUsed;
- std::vector<wchar_t> wChars;
- };
-
- std::pair<int32_t, int32_t> Index2CP(int32_t nIndex) const;
-
- int32_t m_chunkSize;
- int32_t m_nTotal;
- std::vector<std::unique_ptr<ChunkHeader>> m_chunks;
-};
-
-#endif // XFA_FDE_CFDE_TXTEDTBUF_H_