summaryrefslogtreecommitdiff
path: root/xfa/fde/fde_visualset.h
blob: 64f98b9b2324a78c727b8f5392bcf12177fe789e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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_FDE_VISUALSET_H_
#define XFA_FDE_FDE_VISUALSET_H_

#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
#include "core/fxge/include/fx_dib.h"
#include "core/fxge/include/fx_ge.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/fde_object.h"
#include "xfa/fgas/crt/fgas_memory.h"
#include "xfa/fgas/font/fgas_font.h"

enum FDE_VISUALOBJTYPE {
  FDE_VISUALOBJ_Canvas = 0x00,
  FDE_VISUALOBJ_Text = 0x01
};

typedef struct FDE_HVISUALOBJ_ { void* pData; } const* FDE_HVISUALOBJ;

class IFDE_VisualSet {
 public:
  virtual ~IFDE_VisualSet() {}
  virtual FDE_VISUALOBJTYPE GetType() = 0;
  virtual FX_BOOL GetBBox(FDE_HVISUALOBJ hVisualObj, CFX_RectF& bbox) = 0;
  virtual FX_BOOL GetMatrix(FDE_HVISUALOBJ hVisualObj, CFX_Matrix& matrix) = 0;
  virtual FX_BOOL GetRect(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) = 0;
  virtual FX_BOOL GetClip(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) = 0;
};

class IFDE_CanvasSet : public IFDE_VisualSet {
 public:
  virtual FX_POSITION GetFirstPosition(FDE_HVISUALOBJ hCanvas) = 0;
  virtual FDE_HVISUALOBJ GetNext(FDE_HVISUALOBJ hCanvas,
                                 FX_POSITION& pos,
                                 IFDE_VisualSet*& pVisualSet) = 0;
  virtual FDE_HVISUALOBJ GetParentCanvas(FDE_HVISUALOBJ hCanvas,
                                         IFDE_VisualSet*& pVisualSet) = 0;
};

class IFDE_TextSet : public IFDE_VisualSet {
 public:
  virtual int32_t GetString(FDE_HVISUALOBJ hText, CFX_WideString& wsText) = 0;
  virtual IFX_Font* GetFont(FDE_HVISUALOBJ hText) = 0;
  virtual FX_FLOAT GetFontSize(FDE_HVISUALOBJ hText) = 0;
  virtual FX_ARGB GetFontColor(FDE_HVISUALOBJ hText) = 0;
  virtual int32_t GetDisplayPos(FDE_HVISUALOBJ hText,
                                FXTEXT_CHARPOS* pCharPos,
                                FX_BOOL bCharCode = FALSE,
                                CFX_WideString* pWSForms = NULL) = 0;
  virtual int32_t GetCharRects(FDE_HVISUALOBJ hText,
                               CFX_RectFArray& rtArray) = 0;
};

#endif  // XFA_FDE_FDE_VISUALSET_H_