diff options
Diffstat (limited to 'fpdfsdk/fxedit/fxet_edit.cpp')
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index cf382f8426..41019b3459 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -38,27 +38,6 @@ namespace { const int kEditUndoMaxItems = 10000; -CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { - if (strWords.GetLength() > 0) - return PDF_EncodeString(strWords, false) + " Tj\n"; - return CFX_ByteString(); -} - -CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, - int32_t nFontIndex, - float fFontSize) { - if (!pFontMap) - return CFX_ByteString(); - - CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); - if (sFontAlias.GetLength() <= 0 || fFontSize <= 0) - return CFX_ByteString(); - - std::ostringstream sRet; - sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; - return CFX_ByteString(sRet); -} - void DrawTextString(CFX_RenderDevice* pDevice, const CFX_PointF& pt, CPDF_Font* pFont, @@ -514,149 +493,6 @@ void CFXEU_InsertText::Undo() { } // static -CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, - const CPVT_WordRange* pRange, - bool bContinuous, - uint16_t SubWord) { - CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); - if (pRange) - pIterator->SetAt(pRange->BeginPos); - else - pIterator->SetAt(0); - - std::ostringstream sEditStream; - std::ostringstream sWords; - int32_t nCurFontIndex = -1; - CFX_PointF ptOld; - CFX_PointF ptNew; - CPVT_WordPlace oldplace; - - while (pIterator->NextWord()) { - CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place > pRange->EndPos) - break; - - if (bContinuous) { - if (place.LineCmp(oldplace) != 0) { - if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); - sWords.str(""); - } - - CPVT_Word word; - if (pIterator->GetWord(word)) { - ptNew = CFX_PointF(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); - } else { - CPVT_Line line; - pIterator->GetLine(line); - ptNew = CFX_PointF(line.ptLine.x + ptOffset.x, - line.ptLine.y + ptOffset.y); - } - - if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) { - sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y - << " Td\n"; - - ptOld = ptNew; - } - } - - CPVT_Word word; - if (pIterator->GetWord(word)) { - if (word.nFontIndex != nCurFontIndex) { - if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); - sWords.str(""); - } - sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex, - word.fFontSize); - nCurFontIndex = word.nFontIndex; - } - - sWords << GetPDFWordString(pEdit->GetFontMap(), nCurFontIndex, - word.Word, SubWord); - } - - oldplace = place; - } else { - CPVT_Word word; - if (pIterator->GetWord(word)) { - ptNew = - CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y); - - if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) { - sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y - << " Td\n"; - ptOld = ptNew; - } - - if (word.nFontIndex != nCurFontIndex) { - sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex, - word.fFontSize); - nCurFontIndex = word.nFontIndex; - } - - sEditStream << GetWordRenderString(GetPDFWordString( - pEdit->GetFontMap(), nCurFontIndex, word.Word, SubWord)); - } - } - } - - if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); - sWords.str(""); - } - - std::ostringstream sAppStream; - if (sEditStream.tellp() > 0) { - int32_t nHorzScale = pEdit->GetHorzScale(); - if (nHorzScale != 100) { - sAppStream << nHorzScale << " Tz\n"; - } - - float fCharSpace = pEdit->GetCharSpace(); - if (!IsFloatZero(fCharSpace)) { - sAppStream << fCharSpace << " Tc\n"; - } - - sAppStream << sEditStream.str(); - } - - return CFX_ByteString(sAppStream); -} - -// static -CFX_ByteString CFX_Edit::GetSelectAppearanceStream( - CFX_Edit* pEdit, - const CFX_PointF& ptOffset, - const CPVT_WordRange* pRange) { - if (!pRange || pRange->IsEmpty()) - return CFX_ByteString(); - - CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); - pIterator->SetAt(pRange->BeginPos); - - std::ostringstream sRet; - while (pIterator->NextWord()) { - CPVT_WordPlace place = pIterator->GetAt(); - if (place > pRange->EndPos) - break; - - CPVT_Word word; - CPVT_Line line; - if (pIterator->GetWord(word) && pIterator->GetLine(line)) { - sRet << word.ptWord.x + ptOffset.x << " " - << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " - << line.fLineAscent - line.fLineDescent << " re\nf\n"; - } - } - - return CFX_ByteString(sRet); -} - -// static void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CFX_Edit* pEdit, |