diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-07 12:39:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-07 12:39:44 -0700 |
commit | 8da140e8747920057a2f2bbcf5c78e40bb198733 (patch) | |
tree | e6500e1812669c52fb55abe818703f30183ba844 /fpdfsdk/pdfwindow/PWL_Utils.cpp | |
parent | 1596f0ae0a289da6f16ede1dd7e3fbcc55ef8b41 (diff) | |
download | pdfium-8da140e8747920057a2f2bbcf5c78e40bb198733.tar.xz |
Remove all PWL_Note classes
The PWL_Note clasess are never instantiated, remove them and their
implementation. PWL_Note was the only caller to enable spellcheck so this
allows us to remove IPWL_SpellCheck and the conditionals for PES_SPELLCHECK.
BUG=pdfium:468
Review URL: https://codereview.chromium.org/1869533003
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Utils.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Utils.cpp | 313 |
1 files changed, 0 insertions, 313 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index fe0075c2b0..92787b9e6c 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -430,152 +430,6 @@ CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, return IFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); } -static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, - FX_FLOAT fEndX, - FX_FLOAT fY, - FX_FLOAT fStep) { - CFX_ByteTextBuf sRet; - - sRet << "0 w\n" << fStartX << " " << fY << " m\n"; - - FX_FLOAT fx; - int32_t i; - - for (i = 1, fx = fStartX + fStep; fx < fEndX; fx += fStep, i++) { - sRet << fx << " " << fY + (i & 1) * fStep << " l\n"; - } - - sRet << "S\n"; - - return sRet.GetByteString(); -} - -static CFX_ByteString GetWordSpellCheckAppearanceStream( - IFX_Edit_Iterator* pIterator, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange& wrWord) { - CFX_ByteTextBuf sRet; - - FX_FLOAT fStartX = 0.0f; - FX_FLOAT fEndX = 0.0f; - FX_FLOAT fY = 0.0f; - FX_FLOAT fStep = 0.0f; - - FX_BOOL bBreak = FALSE; - - if (pIterator) { - pIterator->SetAt(wrWord.BeginPos); - - do { - CPVT_WordPlace place = pIterator->GetAt(); - - CPVT_Line line; - if (pIterator->GetLine(line)) { - fY = line.ptLine.y; - fStep = (line.fLineAscent - line.fLineDescent) / 16.0f; - } - - if (place.LineCmp(wrWord.BeginPos) == 0) { - pIterator->SetAt(wrWord.BeginPos); - CPVT_Word word; - if (pIterator->GetWord(word)) { - fStartX = word.ptWord.x; - } - } else { - fStartX = line.ptLine.x; - } - - if (place.LineCmp(wrWord.EndPos) == 0) { - pIterator->SetAt(wrWord.EndPos); - CPVT_Word word; - if (pIterator->GetWord(word)) { - fEndX = word.ptWord.x + word.fWidth; - } - - bBreak = TRUE; - } else { - fEndX = line.ptLine.x + line.fLineWidth; - } - - sRet << GetSquigglyAppearanceStream( - fStartX + ptOffset.x, fEndX + ptOffset.x, fY + ptOffset.y, fStep); - - if (bBreak) - break; - } while (pIterator->NextLine()); - } - - return sRet.GetByteString(); -} - -CFX_ByteString CPWL_Utils::GetSpellCheckAppStream( - IFX_Edit* pEdit, - IPWL_SpellCheck* pSpellCheck, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange) { - CFX_ByteTextBuf sRet; - - if (pRange && pRange->IsExist()) { - if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - pIterator->SetAt(pRange->BeginPos); - - FX_BOOL bLatinWord = FALSE; - CPVT_WordPlace wpWordStart; - CFX_ByteString sWord; - - CPVT_WordPlace oldplace; - while (pIterator->NextWord()) { - CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) - break; - - CPVT_Word word; - if (pIterator->GetWord(word)) { - if (FX_EDIT_ISLATINWORD(word.Word)) { - if (!bLatinWord) { - wpWordStart = place; - bLatinWord = TRUE; - } - - sWord += (char)word.Word; - oldplace = place; - } else { - if (bLatinWord) { - if (!pSpellCheck->CheckWord(sWord)) { - sRet << GetWordSpellCheckAppearanceStream( - pIterator, ptOffset, CPVT_WordRange(wpWordStart, oldplace)); - pIterator->SetAt(place); - } - bLatinWord = FALSE; - } - - sWord.Empty(); - } - } else { - if (bLatinWord) { - if (!pSpellCheck->CheckWord(sWord)) - sRet << GetWordSpellCheckAppearanceStream( - pIterator, ptOffset, CPVT_WordRange(wpWordStart, oldplace)); - bLatinWord = FALSE; - sWord.Empty(); - } - } - } - - if (bLatinWord) { - if (!pSpellCheck->CheckWord(sWord)) - sRet << GetWordSpellCheckAppearanceStream( - pIterator, ptOffset, CPVT_WordRange(wpWordStart, oldplace)); - - bLatinWord = FALSE; - sWord.Empty(); - } - } - } - - return sRet.GetByteString(); -} - CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, IPVT_FontMap* pFontMap, const CFX_WideString& sText, @@ -1608,173 +1462,6 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, } } -static void AddSquigglyPath(CFX_PathData& PathData, - FX_FLOAT fStartX, - FX_FLOAT fEndX, - FX_FLOAT fY, - FX_FLOAT fStep) { - PathData.AddPointCount(1); - PathData.SetPoint(PathData.GetPointCount() - 1, fStartX, fY, FXPT_MOVETO); - - FX_FLOAT fx; - int32_t i; - - for (i = 1, fx = fStartX + fStep; fx < fEndX; fx += fStep, i++) { - PathData.AddPointCount(1); - PathData.SetPoint(PathData.GetPointCount() - 1, fx, fY + (i & 1) * fStep, - FXPT_LINETO); - } -} - -static void AddSpellCheckObj(CFX_PathData& PathData, - IFX_Edit* pEdit, - const CPVT_WordRange& wrWord) { - FX_FLOAT fStartX = 0.0f; - FX_FLOAT fEndX = 0.0f; - FX_FLOAT fY = 0.0f; - FX_FLOAT fStep = 0.0f; - - FX_BOOL bBreak = FALSE; - - if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - pIterator->SetAt(wrWord.BeginPos); - - do { - CPVT_WordPlace place = pIterator->GetAt(); - - CPVT_Line line; - if (pIterator->GetLine(line)) { - fY = line.ptLine.y; - fStep = (line.fLineAscent - line.fLineDescent) / 16.0f; - } - - if (place.LineCmp(wrWord.BeginPos) == 0) { - pIterator->SetAt(wrWord.BeginPos); - CPVT_Word word; - if (pIterator->GetWord(word)) { - fStartX = word.ptWord.x; - } - } else { - fStartX = line.ptLine.x; - } - - if (place.LineCmp(wrWord.EndPos) == 0) { - pIterator->SetAt(wrWord.EndPos); - CPVT_Word word; - if (pIterator->GetWord(word)) { - fEndX = word.ptWord.x + word.fWidth; - } - - bBreak = TRUE; - } else { - fEndX = line.ptLine.x + line.fLineWidth; - } - - AddSquigglyPath(PathData, fStartX, fEndX, fY, fStep); - - if (bBreak) - break; - } while (pIterator->NextLine()); - } -} - -void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device, - IFX_Edit* pEdit, - const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange, - IPWL_SpellCheck* pSpellCheck) { - const FX_COLORREF crSpell = ArgbEncode(255, 255, 0, 0); - - // for spellcheck - FX_BOOL bLatinWord = FALSE; - CPVT_WordPlace wpWordStart; - CFX_ByteString sLatinWord; - - CFX_PathData pathSpell; - - pDevice->SaveState(); - - if (!rcClip.IsEmpty()) { - CFX_FloatRect rcTemp = rcClip; - pUser2Device->TransformRect(rcTemp); - pDevice->SetClip_Rect(rcTemp.ToFxRect()); - } - - if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - if (pEdit->GetFontMap()) { - if (pRange) - pIterator->SetAt(pRange->BeginPos); - else - pIterator->SetAt(0); - - CPVT_WordPlace oldplace; - - while (pIterator->NextWord()) { - CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) - break; - - CPVT_Word word; - if (pIterator->GetWord(word)) { - if (FX_EDIT_ISLATINWORD(word.Word)) { - if (!bLatinWord) { - wpWordStart = place; - bLatinWord = TRUE; - } - - sLatinWord += (char)word.Word; - } else { - if (bLatinWord) { - if (!sLatinWord.IsEmpty()) { - if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell, pEdit, - CPVT_WordRange(wpWordStart, oldplace)); - pIterator->SetAt(place); - } - } - bLatinWord = FALSE; - } - - sLatinWord.Empty(); - } - - oldplace = place; - } else { - if (bLatinWord) { - if (!sLatinWord.IsEmpty()) { - if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell, pEdit, - CPVT_WordRange(wpWordStart, oldplace)); - pIterator->SetAt(place); - } - } - bLatinWord = FALSE; - } - - sLatinWord.Empty(); - } - } - - if (!sLatinWord.IsEmpty()) { - if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell, pEdit, - CPVT_WordRange(wpWordStart, oldplace)); - } - } - } - } - - CFX_GraphStateData gsd; - gsd.m_LineWidth = 0; - if (pathSpell.GetPointCount() > 0) - pDevice->DrawPath(&pathSpell, pUser2Device, &gsd, 0, crSpell, - FXFILL_ALTERNATE); - - pDevice->RestoreState(); -} - FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { switch (color.nColorType) { case COLORTYPE_TRANSPARENT: |