Home | History | Annotate | Download | only in reflow
      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 _REFLOWED_TEXT_PAGE_H
      8 #define _REFLOWED_TEXT_PAGE_H
      9 #include "../../include/reflow/reflowengine.h"
     10 #include "../../src/reflow/reflowedpage.h"
     11 typedef CFX_SegmentedArray<CRF_CharData*> CRF_CharDataPtrArray;
     12 typedef CFX_SegmentedArray<FX_INT32> CFX_CountBSINT32Array;
     13 class CRF_TextPage : public IPDF_TextPage
     14 {
     15 public:
     16     CRF_TextPage(IPDF_ReflowedPage* pRefPage);
     17 
     18     virtual ~CRF_TextPage() ;
     19     FX_BOOL			ParseTextPage();
     20     void			NormalizeObjects(FX_BOOL bNormalize)
     21     {
     22         return;
     23     };
     24 
     25     FX_BOOL			IsParsered() const;
     26 public:
     27 
     28     int CharIndexFromTextIndex(int TextIndex) const;
     29 
     30     int TextIndexFromCharIndex(int CharIndex) const;
     31 
     32 
     33     int				CountChars() const;
     34 
     35     virtual	void	GetCharInfo(int index, FPDF_CHAR_INFO & info) const;
     36 
     37     void			GetRectArray(int start, int nCount, CFX_RectArray& rectArray) const;
     38 
     39 
     40     int				GetIndexAtPos(CPDF_Point point, FX_FLOAT xTorelance, FX_FLOAT yTorelance) const;
     41 
     42     int				GetIndexAtPos(FX_FLOAT x, FX_FLOAT y, FX_FLOAT xTorelance, FX_FLOAT yTorelance) const;
     43 
     44     virtual	int				GetOrderByDirection(int index, int direction) const;
     45 
     46     CFX_WideString	GetTextByRect(CFX_FloatRect rect) const;
     47 
     48     void			GetRectsArrayByRect(CFX_FloatRect rect, CFX_RectArray& resRectArray) const;
     49 
     50 
     51     int				CountRects(int start, int nCount);
     52 
     53     virtual	void			GetRect(int rectIndex, FX_FLOAT& left, FX_FLOAT& top, FX_FLOAT& right, FX_FLOAT &bottom) const;
     54     virtual	FX_BOOL			GetBaselineRotate(int rectIndex, int& Rotate);
     55     virtual FX_BOOL			GetBaselineRotate(CFX_FloatRect rect, int& Rotate);
     56 
     57     virtual	int				CountBoundedSegments(FX_FLOAT left, FX_FLOAT top, FX_FLOAT right, FX_FLOAT bottom, FX_BOOL bContains = FALSE);
     58 
     59     virtual	void			GetBoundedSegment(int index, int& start, int& count) const;
     60 
     61 
     62     int				GetWordBreak(int index, int direction) const;
     63 
     64     CFX_WideString	GetPageText(int start, int nCount = -1 ) const;
     65 private:
     66     CPDF_ReflowedPage*		m_pRefPage;
     67     CRF_CharDataPtrArray*	m_pDataList;
     68     CFX_RectArray			m_rectArray;
     69     CFX_CountBSINT32Array*	m_CountBSArray;
     70 };
     71 #endif
     72