fde_visualset.h revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
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_FDE_VISUALSET_H_
8#define XFA_FDE_FDE_VISUALSET_H_
9
10#include "core/fxcrt/cfx_retain_ptr.h"
11#include "core/fxcrt/fx_coordinates.h"
12#include "core/fxcrt/fx_system.h"
13#include "core/fxge/fx_dib.h"
14#include "xfa/fde/cfde_path.h"
15#include "xfa/fde/fde_object.h"
16#include "xfa/fgas/font/cfgas_fontmgr.h"
17
18struct FXTEXT_CHARPOS;
19
20enum FDE_VISUALOBJTYPE {
21  FDE_VISUALOBJ_Canvas = 0x00,
22  FDE_VISUALOBJ_Text = 0x01
23};
24
25struct FDE_TEXTEDITPIECE {
26  int32_t nStart;
27  int32_t nCount;
28  int32_t nBidiLevel;
29  CFX_RectF rtPiece;
30  uint32_t dwCharStyles;
31};
32
33class IFDE_VisualSet {
34 public:
35  virtual ~IFDE_VisualSet() {}
36  virtual FDE_VISUALOBJTYPE GetType() = 0;
37  virtual void GetRect(FDE_TEXTEDITPIECE* hVisualObj, CFX_RectF& rt) = 0;
38};
39
40class IFDE_CanvasSet : public IFDE_VisualSet {
41 public:
42  virtual FX_POSITION GetFirstPosition() = 0;
43  virtual FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos,
44                                     IFDE_VisualSet*& pVisualSet) = 0;
45};
46
47class IFDE_TextSet : public IFDE_VisualSet {
48 public:
49  virtual int32_t GetString(FDE_TEXTEDITPIECE* hText,
50                            CFX_WideString& wsText) = 0;
51  virtual CFX_RetainPtr<CFGAS_GEFont> GetFont() = 0;
52  virtual FX_FLOAT GetFontSize() = 0;
53  virtual FX_ARGB GetFontColor() = 0;
54  virtual int32_t GetDisplayPos(FDE_TEXTEDITPIECE* hText,
55                                FXTEXT_CHARPOS* pCharPos,
56                                bool bCharCode = false,
57                                CFX_WideString* pWSForms = nullptr) = 0;
58  virtual int32_t GetCharRects(const FDE_TEXTEDITPIECE* hText,
59                               CFX_RectFArray& rtArray,
60                               bool bbox) = 0;
61};
62
63#endif  // XFA_FDE_FDE_VISUALSET_H_
64