1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FDE_CFDE_TXTEDTPARAG_H_
8 #define XFA_FDE_CFDE_TXTEDTPARAG_H_
9 
10 #include <stdint.h>
11 
12 class CFDE_TxtEdtEngine;
13 
14 class CFDE_TxtEdtParag {
15  public:
16   explicit CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine);
17   ~CFDE_TxtEdtParag();
18 
GetTextLength()19   int32_t GetTextLength() const { return m_nCharCount; }
GetStartIndex()20   int32_t GetStartIndex() const { return m_nCharStart; }
GetLineCount()21   int32_t GetLineCount() const { return m_nLineCount; }
22 
SetTextLength(int32_t len)23   void SetTextLength(int32_t len) { m_nCharCount = len; }
IncrementTextLength(int32_t len)24   void IncrementTextLength(int32_t len) { m_nCharCount += len; }
SetStartIndex(int32_t idx)25   void SetStartIndex(int32_t idx) { m_nCharStart = idx; }
IncrementStartIndex(int32_t val)26   void IncrementStartIndex(int32_t val) { m_nCharStart += val; }
DecrementStartIndex(int32_t val)27   void DecrementStartIndex(int32_t val) { m_nCharStart -= val; }
SetLineCount(int32_t count)28   void SetLineCount(int32_t count) { m_nLineCount = count; }
29 
30   void GetLineRange(int32_t nLineIndex, int32_t& nStart, int32_t& nCount) const;
31   void LoadParag();
32   void UnloadParag();
33   void CalcLines();
34 
35  private:
36   int32_t m_nCharStart;
37   int32_t m_nCharCount;
38   int32_t m_nLineCount;
39   int32_t* m_lpData;
40   CFDE_TxtEdtEngine* m_pEngine;
41 };
42 
43 #endif  // XFA_FDE_CFDE_TXTEDTPARAG_H_
44