OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_RTFBREAK | 7 #ifndef _FX_RTFBREAK |
8 #define _FX_RTFBREAK | 8 #define _FX_RTFBREAK |
9 class IFX_Unknown; | 9 class IFX_Unknown; |
10 class IFX_Font; | 10 class IFX_Font; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 fFontSize = 12.0f; | 62 fFontSize = 12.0f; |
63 dwLayoutStyles = 0; | 63 dwLayoutStyles = 0; |
64 iCharRotation = 0; | 64 iCharRotation = 0; |
65 iBidiLevel = 0; | 65 iBidiLevel = 0; |
66 pRect = NULL; | 66 pRect = NULL; |
67 wLineBreakChar = L'\n'; | 67 wLineBreakChar = L'\n'; |
68 iHorizontalScale = 100; | 68 iHorizontalScale = 100; |
69 iVerticalScale = 100; | 69 iVerticalScale = 100; |
70 } | 70 } |
71 FX_LPCWSTR pStr; | 71 FX_LPCWSTR pStr; |
72 FX_INT32» » *pWidths; | 72 int32_t» » *pWidths; |
73 FX_INT32» » iLength; | 73 int32_t» » iLength; |
74 IFX_Font *pFont; | 74 IFX_Font *pFont; |
75 FX_FLOAT fFontSize; | 75 FX_FLOAT fFontSize; |
76 FX_DWORD dwLayoutStyles; | 76 FX_DWORD dwLayoutStyles; |
77 FX_INT32» » iCharRotation; | 77 int32_t» » iCharRotation; |
78 FX_INT32» » iBidiLevel; | 78 int32_t» » iBidiLevel; |
79 FX_LPCRECTF pRect; | 79 FX_LPCRECTF pRect; |
80 FX_WCHAR wLineBreakChar; | 80 FX_WCHAR wLineBreakChar; |
81 FX_INT32» » iHorizontalScale; | 81 int32_t» » iHorizontalScale; |
82 FX_INT32» » iVerticalScale; | 82 int32_t» » iVerticalScale; |
83 } FX_RTFTEXTOBJ, * FX_LPRTFTEXTOBJ; | 83 } FX_RTFTEXTOBJ, * FX_LPRTFTEXTOBJ; |
84 typedef FX_RTFTEXTOBJ const * FX_LPCRTFTEXTOBJ; | 84 typedef FX_RTFTEXTOBJ const * FX_LPCRTFTEXTOBJ; |
85 class CFX_RTFPiece : public CFX_Target | 85 class CFX_RTFPiece : public CFX_Target |
86 { | 86 { |
87 public: | 87 public: |
88 CFX_RTFPiece() : m_dwStatus(FX_RTFBREAK_PieceBreak) | 88 CFX_RTFPiece() : m_dwStatus(FX_RTFBREAK_PieceBreak) |
89 , m_iStartPos(0) | 89 , m_iStartPos(0) |
90 , m_iWidth(-1) | 90 , m_iWidth(-1) |
91 , m_iStartChar(0) | 91 , m_iStartChar(0) |
92 , m_iChars(0) | 92 , m_iChars(0) |
(...skipping 17 matching lines...) Expand all Loading... |
110 { | 110 { |
111 FXSYS_assert(m_pChars != NULL); | 111 FXSYS_assert(m_pChars != NULL); |
112 m_pChars->Add(tc); | 112 m_pChars->Add(tc); |
113 if (m_iWidth < 0) { | 113 if (m_iWidth < 0) { |
114 m_iWidth = tc.m_iCharWidth; | 114 m_iWidth = tc.m_iCharWidth; |
115 } else { | 115 } else { |
116 m_iWidth += tc.m_iCharWidth; | 116 m_iWidth += tc.m_iCharWidth; |
117 } | 117 } |
118 m_iChars ++; | 118 m_iChars ++; |
119 } | 119 } |
120 FX_INT32 GetEndPos() const | 120 int32_t GetEndPos() const |
121 { | 121 { |
122 return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth; | 122 return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth; |
123 } | 123 } |
124 FX_INT32 GetLength() const | 124 int32_t GetLength() const |
125 { | 125 { |
126 return m_iChars; | 126 return m_iChars; |
127 } | 127 } |
128 FX_INT32 GetEndChar() const | 128 int32_t GetEndChar() const |
129 { | 129 { |
130 return m_iStartChar + m_iChars; | 130 return m_iStartChar + m_iChars; |
131 } | 131 } |
132 CFX_RTFChar& GetChar(FX_INT32 index) | 132 CFX_RTFChar& GetChar(int32_t index) |
133 { | 133 { |
134 FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); | 134 FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); |
135 return *m_pChars->GetDataPtr(m_iStartChar + index); | 135 return *m_pChars->GetDataPtr(m_iStartChar + index); |
136 } | 136 } |
137 CFX_RTFChar* GetCharPtr(FX_INT32 index) const | 137 CFX_RTFChar* GetCharPtr(int32_t index) const |
138 { | 138 { |
139 FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); | 139 FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); |
140 return m_pChars->GetDataPtr(m_iStartChar + index); | 140 return m_pChars->GetDataPtr(m_iStartChar + index); |
141 } | 141 } |
142 void GetString (FX_LPWSTR pText) const | 142 void GetString (FX_LPWSTR pText) const |
143 { | 143 { |
144 FXSYS_assert(pText != NULL); | 144 FXSYS_assert(pText != NULL); |
145 FX_INT32 iEndChar = m_iStartChar + m_iChars; | 145 int32_t iEndChar = m_iStartChar + m_iChars; |
146 CFX_RTFChar *pChar; | 146 CFX_RTFChar *pChar; |
147 for (FX_INT32 i = m_iStartChar; i < iEndChar; i ++) { | 147 for (int32_t i = m_iStartChar; i < iEndChar; i ++) { |
148 pChar = m_pChars->GetDataPtr(i); | 148 pChar = m_pChars->GetDataPtr(i); |
149 *pText ++ = (FX_WCHAR)pChar->m_wCharCode; | 149 *pText ++ = (FX_WCHAR)pChar->m_wCharCode; |
150 } | 150 } |
151 } | 151 } |
152 void GetString(CFX_WideString &wsText) const | 152 void GetString(CFX_WideString &wsText) const |
153 { | 153 { |
154 FX_LPWSTR pText = wsText.GetBuffer(m_iChars); | 154 FX_LPWSTR pText = wsText.GetBuffer(m_iChars); |
155 GetString(pText); | 155 GetString(pText); |
156 wsText.ReleaseBuffer(m_iChars); | 156 wsText.ReleaseBuffer(m_iChars); |
157 } | 157 } |
158 void GetWidths(FX_INT32 *pWidths) const | 158 void GetWidths(int32_t *pWidths) const |
159 { | 159 { |
160 FXSYS_assert(pWidths != NULL); | 160 FXSYS_assert(pWidths != NULL); |
161 FX_INT32 iEndChar = m_iStartChar + m_iChars; | 161 int32_t iEndChar = m_iStartChar + m_iChars; |
162 CFX_RTFChar *pChar; | 162 CFX_RTFChar *pChar; |
163 for (FX_INT32 i = m_iStartChar; i < iEndChar; i ++) { | 163 for (int32_t i = m_iStartChar; i < iEndChar; i ++) { |
164 pChar = m_pChars->GetDataPtr(i); | 164 pChar = m_pChars->GetDataPtr(i); |
165 *pWidths ++ = pChar->m_iCharWidth; | 165 *pWidths ++ = pChar->m_iCharWidth; |
166 } | 166 } |
167 } | 167 } |
168 void Reset() | 168 void Reset() |
169 { | 169 { |
170 m_dwStatus = FX_RTFBREAK_PieceBreak; | 170 m_dwStatus = FX_RTFBREAK_PieceBreak; |
171 if (m_iWidth > -1) { | 171 if (m_iWidth > -1) { |
172 m_iStartPos += m_iWidth; | 172 m_iStartPos += m_iWidth; |
173 } | 173 } |
174 m_iWidth = -1; | 174 m_iWidth = -1; |
175 m_iStartChar += m_iChars; | 175 m_iStartChar += m_iChars; |
176 m_iChars = 0; | 176 m_iChars = 0; |
177 m_iBidiLevel = 0; | 177 m_iBidiLevel = 0; |
178 m_iBidiPos = 0; | 178 m_iBidiPos = 0; |
179 m_iHorizontalScale = 100; | 179 m_iHorizontalScale = 100; |
180 m_iVerticalScale = 100; | 180 m_iVerticalScale = 100; |
181 } | 181 } |
182 FX_DWORD m_dwStatus; | 182 FX_DWORD m_dwStatus; |
183 FX_INT32» » » m_iStartPos; | 183 int32_t» » » m_iStartPos; |
184 FX_INT32» » » m_iWidth; | 184 int32_t» » » m_iWidth; |
185 FX_INT32» » » m_iStartChar; | 185 int32_t» » » m_iStartChar; |
186 FX_INT32» » » m_iChars; | 186 int32_t» » » m_iChars; |
187 FX_INT32» » » m_iBidiLevel; | 187 int32_t» » » m_iBidiLevel; |
188 FX_INT32» » » m_iBidiPos; | 188 int32_t» » » m_iBidiPos; |
189 FX_INT32» » » m_iFontSize; | 189 int32_t» » » m_iFontSize; |
190 FX_INT32» » » m_iFontHeight; | 190 int32_t» » » m_iFontHeight; |
191 FX_INT32» » » m_iHorizontalScale; | 191 int32_t» » » m_iHorizontalScale; |
192 FX_INT32» » » m_iVerticalScale; | 192 int32_t» » » m_iVerticalScale; |
193 FX_DWORD m_dwLayoutStyles; | 193 FX_DWORD m_dwLayoutStyles; |
194 FX_DWORD m_dwIdentity; | 194 FX_DWORD m_dwIdentity; |
195 CFX_RTFCharArray *m_pChars; | 195 CFX_RTFCharArray *m_pChars; |
196 IFX_Unknown *m_pUserData; | 196 IFX_Unknown *m_pUserData; |
197 }; | 197 }; |
198 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; | 198 typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; |
199 class IFX_RTFBreak | 199 class IFX_RTFBreak |
200 { | 200 { |
201 public: | 201 public: |
202 static IFX_RTFBreak* Create(FX_DWORD dwPolicies); | 202 static IFX_RTFBreak* Create(FX_DWORD dwPolicies); |
203 virtual void Release() = 0; | 203 virtual void Release() = 0; |
204 virtual void SetLineWidth(FX_FLOAT fLineStart, FX_FLO
AT fLineEnd) = 0; | 204 virtual void SetLineWidth(FX_FLOAT fLineStart, FX_FLO
AT fLineEnd) = 0; |
205 virtual void SetLinePos(FX_FLOAT fLinePos) = 0; | 205 virtual void SetLinePos(FX_FLOAT fLinePos) = 0; |
206 virtual FX_DWORD GetLayoutStyles() const = 0; | 206 virtual FX_DWORD GetLayoutStyles() const = 0; |
207 virtual void SetLayoutStyles(FX_DWORD dwLayoutStyles)
= 0; | 207 virtual void SetLayoutStyles(FX_DWORD dwLayoutStyles)
= 0; |
208 virtual void SetFont(IFX_Font *pFont) = 0; | 208 virtual void SetFont(IFX_Font *pFont) = 0; |
209 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; | 209 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; |
210 virtual void SetTabWidth(FX_FLOAT fTabWidth) = 0; | 210 virtual void SetTabWidth(FX_FLOAT fTabWidth) = 0; |
211 virtual void AddPositionedTab(FX_FLOAT fTabPos) = 0; | 211 virtual void AddPositionedTab(FX_FLOAT fTabPos) = 0; |
212 virtual void SetPositionedTabs(const CFX_FloatArray &
tabs) = 0; | 212 virtual void SetPositionedTabs(const CFX_FloatArray &
tabs) = 0; |
213 virtual void ClearPositionedTabs() = 0; | 213 virtual void ClearPositionedTabs() = 0; |
214 virtual void SetDefaultChar(FX_WCHAR wch) = 0; | 214 virtual void SetDefaultChar(FX_WCHAR wch) = 0; |
215 virtual void SetLineBreakChar(FX_WCHAR wch) = 0; | 215 virtual void SetLineBreakChar(FX_WCHAR wch) = 0; |
216 virtual void SetLineBreakTolerance(FX_FLOAT fToleranc
e) = 0; | 216 virtual void SetLineBreakTolerance(FX_FLOAT fToleranc
e) = 0; |
217 virtual void» » » SetHorizontalScale(FX_INT32 iScale) = 0; | 217 virtual void» » » SetHorizontalScale(int32_t iScale) = 0; |
218 virtual void» » » SetVerticalScale(FX_INT32 iScale) = 0; | 218 virtual void» » » SetVerticalScale(int32_t iScale) = 0; |
219 virtual void» » » SetCharRotation(FX_INT32 iCharRotation)
= 0; | 219 virtual void» » » SetCharRotation(int32_t iCharRotation) =
0; |
220 virtual void SetCharSpace(FX_FLOAT fCharSpace) = 0; | 220 virtual void SetCharSpace(FX_FLOAT fCharSpace) = 0; |
221 virtual void SetWordSpace(FX_BOOL bDefault, FX_FLOAT
fWordSpace) = 0; | 221 virtual void SetWordSpace(FX_BOOL bDefault, FX_FLOAT
fWordSpace) = 0; |
222 virtual void SetReadingOrder(FX_BOOL bRTL = FALSE) =
0; | 222 virtual void SetReadingOrder(FX_BOOL bRTL = FALSE) =
0; |
223 virtual void» » » SetAlignment(FX_INT32 iAlignment = FX_RT
FLINEALIGNMENT_Left) = 0; | 223 virtual void» » » SetAlignment(int32_t iAlignment = FX_RTF
LINEALIGNMENT_Left) = 0; |
224 virtual void SetUserData(IFX_Unknown *pUserData) = 0; | 224 virtual void SetUserData(IFX_Unknown *pUserData) = 0; |
225 virtual FX_DWORD AppendChar(FX_WCHAR wch)
= 0; | 225 virtual FX_DWORD AppendChar(FX_WCHAR wch)
= 0; |
226 virtual FX_DWORD EndBreak(FX_DWORD dwStat
us = FX_RTFBREAK_PieceBreak) = 0; | 226 virtual FX_DWORD EndBreak(FX_DWORD dwStat
us = FX_RTFBREAK_PieceBreak) = 0; |
227 virtual FX_INT32» » » » » CountBreakPieces() const
= 0; | 227 virtual int32_t» » » » » CountBreakPieces() const
= 0; |
228 virtual const CFX_RTFPiece*»» » GetBreakPiece(FX_INT32 index) co
nst = 0; | 228 virtual const CFX_RTFPiece*»» » GetBreakPiece(int32_t index) con
st = 0; |
229 virtual void GetLineRect(CFX_
RectF &rect) const = 0; | 229 virtual void GetLineRect(CFX_
RectF &rect) const = 0; |
230 virtual void ClearBreakPieces
() = 0; | 230 virtual void ClearBreakPieces
() = 0; |
231 virtual void Reset() = 0; | 231 virtual void Reset() = 0; |
232 virtual FX_INT32» » GetDisplayPos(FX_LPCRTFTEXTOBJ pText, FXTEXT_CHA
RPOS *pCharPos, FX_BOOL bCharCode = FALSE, CFX_WideString *pWSForms = NULL, FX_A
djustCharDisplayPos pAdjustPos = NULL) const = 0; | 232 virtual int32_t» » GetDisplayPos(FX_LPCRTFTEXTOBJ pText, FXTEXT_CHA
RPOS *pCharPos, FX_BOOL bCharCode = FALSE, CFX_WideString *pWSForms = NULL, FX_A
djustCharDisplayPos pAdjustPos = NULL) const = 0; |
233 virtual FX_INT32» » GetCharRects(FX_LPCRTFTEXTOBJ pText, CFX_RectFAr
ray &rtArray, FX_BOOL bCharBBox = FALSE) const = 0; | 233 virtual int32_t» » GetCharRects(FX_LPCRTFTEXTOBJ pText, CFX_RectFAr
ray &rtArray, FX_BOOL bCharBBox = FALSE) const = 0; |
234 }; | 234 }; |
235 #endif | 235 #endif |
OLD | NEW |