e61c0cc45649e3223e0b8f60d695da2d993473de
[pdfium.git] / core / include / fxcrt / fx_arb.h
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 _FX_ARABIC_
8 #define _FX_ARABIC_
9
10 #include "fx_system.h"
11 #include "fx_ucd.h"
12
13 class IFX_ArabicChar;
14 class IFX_BidiChar;
15 #ifdef __cplusplus
16 extern "C"
17 {
18 #endif
19 typedef struct _FX_ARBFORMTABLE {
20     FX_WCHAR    wIsolated;
21     FX_WCHAR    wFinal;
22     FX_WCHAR    wInitial;
23     FX_WCHAR    wMedial;
24 } FX_ARBFORMTABLE, * FX_LPARBFORMTABLE;
25 typedef FX_ARBFORMTABLE const * FX_LPCARBFORMTABLE;
26 typedef struct _FX_ARAALEF {
27     FX_WCHAR    wAlef;
28     FX_WCHAR    wIsolated;
29 } FX_ARAALEF, * FX_LPARAALEF;
30 typedef FX_ARAALEF const * FX_LPCARAALEF;
31 typedef struct _FX_ARASHADDA {
32     FX_WCHAR    wShadda;
33     FX_WCHAR    wIsolated;
34 } FX_ARASHADDA, * FX_LPARASHADDA;
35 typedef FX_ARASHADDA const * FX_LPCARASHADDA;
36 FX_LPCARBFORMTABLE FX_GetArabicFormTable(FX_WCHAR unicode);
37 FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef);
38 FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda);
39 #ifdef __cplusplus
40 };
41 #endif
42 enum FX_ARBPOSITION {
43     FX_ARBPOSITION_Isolated = 0,
44     FX_ARBPOSITION_Final,
45     FX_ARBPOSITION_Initial,
46     FX_ARBPOSITION_Medial,
47 };
48 class IFX_ArabicChar
49 {
50 public:
51     static IFX_ArabicChar*              Create();
52     virtual void                                Release() = 0;
53     virtual FX_BOOL                             IsArabicChar(FX_WCHAR wch) const = 0;
54     virtual FX_BOOL                             IsArabicFormChar(FX_WCHAR wch) const = 0;
55     virtual FX_WCHAR                    GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR next = 0) const = 0;
56     virtual FX_WCHAR                    GetFormChar(const CFX_Char *cur, const CFX_Char *prev, const CFX_Char *next) const = 0;
57 };
58 void FX_BidiLine(CFX_WideString &wsText, FX_INT32 iBaseLevel = 0);
59 void FX_BidiLine(CFX_TxtCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0);
60 void FX_BidiLine(CFX_RTFCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0);
61 class IFX_BidiChar
62 {
63 public:
64     static IFX_BidiChar*        Create();
65     virtual void                        Release() = 0;
66     virtual void                        SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0;
67     virtual FX_BOOL                     AppendChar(FX_WCHAR wch) = 0;
68     virtual FX_BOOL                     EndChar() = 0;
69     virtual FX_INT32            GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) = 0;
70     virtual void                        Reset() = 0;
71
72 protected:
73     ~IFX_BidiChar() { }
74 };
75 #endif