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 #include "core/include/fpdfapi/fpdf_resource.h" |
7 #include "fpdfsdk/include/fxedit/fx_edit.h" | 8 #include "fpdfsdk/include/fxedit/fx_edit.h" |
8 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 9 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
9 #include "fpdfsdk/include/fxedit/fxet_stub.h" | |
10 | 10 |
11 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, | 11 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, |
12 int32_t nFontIndex, | 12 int32_t nFontIndex, |
13 FX_WORD Word, | 13 FX_WORD Word, |
14 FX_WORD SubWord) { | 14 FX_WORD SubWord) { |
15 CFX_ByteString sWord; | 15 CFX_ByteString sWord; |
16 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { | 16 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { |
17 if (SubWord > 0) { | 17 if (SubWord > 0) { |
18 Word = SubWord; | 18 Word = SubWord; |
19 } else { | 19 } else { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 sAppStream << sEditStream; | 171 sAppStream << sEditStream; |
172 } | 172 } |
173 | 173 |
174 return sAppStream.GetByteString(); | 174 return sAppStream.GetByteString(); |
175 } | 175 } |
176 | 176 |
177 CFX_ByteString IFX_Edit::GetSelectAppearanceStream( | 177 CFX_ByteString IFX_Edit::GetSelectAppearanceStream( |
178 IFX_Edit* pEdit, | 178 IFX_Edit* pEdit, |
179 const CPDF_Point& ptOffset, | 179 const CPDF_Point& ptOffset, |
180 const CPVT_WordRange* pRange /*= NULL*/) { | 180 const CPVT_WordRange* pRange) { |
181 CFX_ByteTextBuf sRet; | 181 CFX_ByteTextBuf sRet; |
182 | 182 |
183 if (pRange && pRange->IsExist()) { | 183 if (pRange && pRange->IsExist()) { |
184 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 184 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
185 pIterator->SetAt(pRange->BeginPos); | 185 pIterator->SetAt(pRange->BeginPos); |
186 | 186 |
187 while (pIterator->NextWord()) { | 187 while (pIterator->NextWord()) { |
188 CPVT_WordPlace place = pIterator->GetAt(); | 188 CPVT_WordPlace place = pIterator->GetAt(); |
189 | 189 |
190 if (pRange && place.WordCmp(pRange->EndPos) > 0) | 190 if (pRange && place.WordCmp(pRange->EndPos) > 0) |
191 break; | 191 break; |
192 | 192 |
193 CPVT_Word word; | 193 CPVT_Word word; |
194 CPVT_Line line; | 194 CPVT_Line line; |
195 if (pIterator->GetWord(word) && pIterator->GetLine(line)) { | 195 if (pIterator->GetWord(word) && pIterator->GetLine(line)) { |
196 sRet << word.ptWord.x + ptOffset.x << " " | 196 sRet << word.ptWord.x + ptOffset.x << " " |
197 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " | 197 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " |
198 << line.fLineAscent - line.fLineDescent << " re\nf\n"; | 198 << line.fLineAscent - line.fLineDescent << " re\nf\n"; |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 return sRet.GetByteString(); | 204 return sRet.GetByteString(); |
205 } | 205 } |
OLD | NEW |