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