diff options
author | Lei Zhang <thestig@chromium.org> | 2015-06-13 00:48:38 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-06-13 00:48:38 -0700 |
commit | a6d9f0edce07194f551db4c38bb427fbf7d550cf (patch) | |
tree | 5ab405c2afde59f7c78c0298992b25fe8566de3b /fpdfsdk/src/fxedit | |
parent | bef3c6d1fe83c0d1a84ace5c501932ed39651a74 (diff) | |
download | pdfium-a6d9f0edce07194f551db4c38bb427fbf7d550cf.tar.xz |
Remove trailing whitespaces in fpdfsdk, XFA edition.
Review URL: https://codereview.chromium.org/1185843005.
Diffstat (limited to 'fpdfsdk/src/fxedit')
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_ap.cpp | 26 | ||||
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_edit.cpp | 328 | ||||
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_module.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_pageobjs.cpp | 130 |
4 files changed, 243 insertions, 243 deletions
diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp index 10a76a7157..309a98f41e 100644 --- a/fpdfsdk/src/fxedit/fxet_ap.cpp +++ b/fpdfsdk/src/fxedit/fxet_ap.cpp @@ -1,14 +1,14 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxedit/fxet_stub.h" #include "../../include/fxedit/fx_edit.h" #include "../../include/fxedit/fxet_edit.h" -CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) +CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { ASSERT (pFontMap != NULL); @@ -18,7 +18,7 @@ CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, { if (SubWord > 0) { - Word = SubWord; + Word = SubWord; } else { @@ -65,7 +65,7 @@ static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, int32_t nFon return sRet.GetByteString(); } -CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, +CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange /* = NULL*/, FX_BOOL bContinuous/* = TRUE*/, FX_WORD SubWord/* = 0*/) { CFX_ByteTextBuf sEditStream, sWords; @@ -88,7 +88,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - if (bContinuous) + if (bContinuous) { if (place.LineCmp(oldplace) != 0) { @@ -120,7 +120,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi CPVT_Word word; if (pIterator->GetWord(word)) - { + { if (word.nFontIndex != nCurFontIndex) { if (sWords.GetSize() > 0) @@ -148,7 +148,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi { sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y << " Td\n"; ptOld = ptNew; - } + } if (word.nFontIndex != nCurFontIndex) { @@ -184,12 +184,12 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi } sAppStream << sEditStream; - } + } return sAppStream.GetByteString(); } -CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, +CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange /*= NULL*/) { CFX_ByteTextBuf sRet; @@ -199,22 +199,22 @@ CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_P if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { pIterator->SetAt(pRange->BeginPos); - + while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) break; + if (pRange && place.WordCmp(pRange->EndPos) > 0) break; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word) && pIterator->GetLine(line)) - { + { //CPDF_Rect rcWordSel = CPDF_Rect(word.ptWord.x,line.ptLine.y + line.fLineDescent, // word.ptWord.x+word.fWidth,line.ptLine.y + line.fLineAscent); sRet << word.ptWord.x + ptOffset.x << " " << line.ptLine.y + line.fLineDescent - << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n"; + << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n"; } } } diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index 19c05d20ae..70d7b77553 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxedit/fxet_stub.h" @@ -11,7 +11,7 @@ /* ---------------------------- CFX_Edit_Iterator ---------------------------- */ -CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : +CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : m_pEdit(pEdit), m_pVTIterator(pVTIterator) { @@ -24,7 +24,7 @@ CFX_Edit_Iterator::~CFX_Edit_Iterator() FX_BOOL CFX_Edit_Iterator::NextWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->NextWord(); } @@ -45,7 +45,7 @@ FX_BOOL CFX_Edit_Iterator::NextSection() FX_BOOL CFX_Edit_Iterator::PrevWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->PrevWord(); } @@ -83,7 +83,7 @@ FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const ASSERT(m_pVTIterator != NULL); if (m_pVTIterator->GetLine(line)) - { + { line.ptLine = m_pEdit->VTToEdit(line.ptLine); return TRUE; } @@ -153,12 +153,12 @@ int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_ { FX_DWORD charcode = word; - if (pPDFFont->IsUnicodeCompatible()) - charcode = pPDFFont->CharCodeFromUnicode(word); + if (pPDFFont->IsUnicodeCompatible()) + charcode = pPDFFont->CharCodeFromUnicode(word); else charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, word); - if (charcode != -1) + if (charcode != -1) return pPDFFont->GetCharWidthF(charcode); } @@ -272,14 +272,14 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) { rcResult = pOldRect->m_rcLine; rcResult.Union(pNewRect->m_rcLine); - m_RefreshRects.Add(rcResult); + m_RefreshRects.Add(rcResult); } else { - if (!pNewRect->IsSameLeft(*pOldRect)) + if (!pNewRect->IsSameLeft(*pOldRect)) { rcResult = pOldRect->m_rcLine; - rcResult.Union(pNewRect->m_rcLine); + rcResult.Union(pNewRect->m_rcLine); } else { @@ -374,9 +374,9 @@ void CFX_Edit_Undo::Undo() ASSERT(pItem != NULL); pItem->Undo(); - + m_nCurUndoPos--; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -401,7 +401,7 @@ void CFX_Edit_Undo::Redo() pItem->Redo(); m_nCurUndoPos++; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -417,17 +417,17 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) ASSERT(!m_bWorking); ASSERT(pItem != NULL); ASSERT(m_nBufSize > 1); - + if (m_nCurUndoPos < m_UndoItemStack.GetSize()) RemoveTails(); if (m_UndoItemStack.GetSize() >= m_nBufSize) { - RemoveHeads(); + RemoveHeads(); m_bVirgin = FALSE; } - m_UndoItemStack.Add(pItem); + m_UndoItemStack.Add(pItem); m_nCurUndoPos = m_UndoItemStack.GetSize(); m_bModified = (m_nCurUndoPos != 0); @@ -549,7 +549,7 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() /* ------------------------------------- CFX_Edit_UndoItem derived classes ------------------------------------- */ CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) + FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word), m_nCharset(charset), m_WordProps() { if (pWordProps) @@ -565,7 +565,7 @@ void CFXEU_InsertWord::Redo() if (m_pEdit) { m_pEdit->SelectNone(); - m_pEdit->SetCaret(m_wpOld); + m_pEdit->SetCaret(m_wpOld); m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); } } @@ -588,7 +588,7 @@ CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -632,7 +632,7 @@ CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -763,7 +763,7 @@ CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -815,7 +815,7 @@ CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl m_swText(swText), m_nCharset(charset), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -849,8 +849,8 @@ void CFXEU_InsertText::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, - const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, +CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, + const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -897,7 +897,7 @@ void CFXEU_SetSecProps::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, +CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -965,7 +965,7 @@ CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : m_bNotify(TRUE), m_bOprNotify(FALSE), m_pGroupUndoItem(NULL) -{ +{ ASSERT(pVT != NULL); } @@ -997,7 +997,7 @@ void CFX_Edit::Initialize() void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) { - if (m_pVTProvide) + if (m_pVTProvide) delete m_pVTProvide; m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); @@ -1040,9 +1040,9 @@ IFX_Edit_FontMap* CFX_Edit::GetFontMap() } void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) -{ +{ m_pVT->SetPlateRect(rect); - m_ptScrollPos = CPDF_Point(rect.left,rect.top); + m_ptScrollPos = CPDF_Point(rect.left,rect.top); if (bPaint) Paint(); } @@ -1139,11 +1139,11 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) SelectAll(); } else if (nStartChar < 0) - { + { SelectNone(); } else - { + { if (nStartChar < nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nStartChar),m_pVT->WordIndexToWordPlace(nEndChar)); @@ -1152,7 +1152,7 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nEndChar),m_pVT->WordIndexToWordPlace(nStartChar)); } - } + } } } @@ -1174,7 +1174,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) SetCaretInfo(); } else - { + { ScrollToCaret(); SetCaretInfo(); } @@ -1234,7 +1234,7 @@ CFX_WideString CFX_Edit::GetText() const pIterator->SetAt(0); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = pIterator->GetAt(); while (pIterator->NextWord()) { @@ -1249,7 +1249,7 @@ CFX_WideString CFX_Edit::GetText() const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1257,7 +1257,7 @@ CFX_WideString CFX_Edit::GetText() const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1275,13 +1275,13 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const FX_BOOL bRich = m_pVT->IsRichText(); if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { CPVT_WordRange wrTemp = range; m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = wrTemp.BeginPos; while (pIterator->NextWord()) { @@ -1297,7 +1297,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1305,7 +1305,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1383,28 +1383,28 @@ FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) { CPVT_WordProps WordProps; WordProps.nFontIndex = nFontIndex; - return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); + return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) -{ +{ CPVT_WordProps WordProps; WordProps.fFontSize = fFontSize; - return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); + return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { CPVT_WordProps WordProps; WordProps.dwWordColor = dwColor; - return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); + return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; - return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); + return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) @@ -1443,21 +1443,21 @@ FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) { CPVT_WordProps WordProps; WordProps.fCharSpace = fCharSpace; - return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); + return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) { CPVT_WordProps WordProps; WordProps.nHorzScale = nHorzScale; - return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); + return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) { CPVT_SecProps SecProps; SecProps.fLineLeading = fLineLeading; - return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); + return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); } FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) @@ -1483,7 +1483,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); - + m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); @@ -1498,7 +1498,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (place.WordCmp(wrTemp.EndPos) > 0) break; bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,TRUE); bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,TRUE); - + if (!bSet) bSet = (bSet1 || bSet2); } @@ -1510,7 +1510,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS PaintSetProps(eProps,wrTemp); } } - } + } return bSet; } @@ -1526,8 +1526,8 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) ScrollToCaret(); Refresh(RP_ANALYSE); SetCaretOrigin(); - SetCaretInfo(); - break; + SetCaretInfo(); + break; case EP_WORDCOLOR: case EP_UNDERLINE: case EP_CROSSOUT: @@ -1535,7 +1535,7 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) break; case EP_FONTINDEX: case EP_FONTSIZE: - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: case EP_CHARSPACE: case EP_HORZSCALE: case EP_BOLD: @@ -1548,13 +1548,13 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) Refresh(RP_ANALYSE,&wrRefresh); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); break; - } + } } -FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, - const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, + const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1578,10 +1578,10 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_LINELEADING: + case EP_LINELEADING: if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) { - secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; + secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; bSet = TRUE; } break; @@ -1616,7 +1616,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (secinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { secinfo.WordProps.nFontIndex = pWordProps->nFontIndex; @@ -1637,21 +1637,21 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, bSet = TRUE; } break; - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: if (secinfo.WordProps.nScriptType != pWordProps->nScriptType) { secinfo.WordProps.nScriptType = pWordProps->nScriptType; bSet = TRUE; } break; - case EP_CHARSPACE: + case EP_CHARSPACE: if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) { secinfo.WordProps.fCharSpace = pWordProps->fCharSpace; bSet = TRUE; } break; - case EP_HORZSCALE: + case EP_HORZSCALE: if (secinfo.WordProps.nHorzScale != pWordProps->nHorzScale) { secinfo.WordProps.nHorzScale = pWordProps->nHorzScale; @@ -1663,7 +1663,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; bSet = TRUE; } } @@ -1681,7 +1681,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1699,7 +1699,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1717,7 +1717,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1753,11 +1753,11 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, return bSet; } } - + return FALSE; } -FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, +FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1779,7 +1779,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { if (IFX_Edit_FontMap* pFontMap = GetFontMap()) @@ -1847,7 +1847,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1865,7 +1865,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1883,7 +1883,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1900,7 +1900,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place break; } } - } + } if (bSet) { @@ -1912,7 +1912,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordProps,wr)); } } - + pIterator->SetAt(oldplace); return bSet; } @@ -2089,9 +2089,9 @@ void CFX_Edit::SelectAll() { if (m_pVT->IsValid()) { - m_SelState = GetWholeWordRange(); - SetCaret(m_SelState.EndPos); - + m_SelState = GetWholeWordRange(); + SetCaret(m_SelState.EndPos); + ScrollToCaret(); CPVT_WordRange wrVisible = GetVisibleWordRange(); Refresh(RP_OPTIONAL,&wrVisible); @@ -2109,7 +2109,7 @@ void CFX_Edit::SelectNone() m_SelState.Default(); Refresh(RP_OPTIONAL,&wrTemp); } - } + } } FX_BOOL CFX_Edit::IsSelected() const @@ -2136,7 +2136,7 @@ CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const fPadding = rcPlate.Height() - rcContent.Height(); break; } - + return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } @@ -2191,10 +2191,10 @@ void CFX_Edit::SetScrollInfo() if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; - m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, + m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, rcContent.left, rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); - - m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, + + m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPlate.Height()); m_bNotifyFlag = FALSE; } @@ -2209,7 +2209,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) { - m_ptScrollPos.x = fx; + m_ptScrollPos.x = fx; Refresh(RP_NOANALYSE); if (m_bNotify && m_pNotify) @@ -2232,7 +2232,7 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) if (m_pVT->IsValid()) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) - { + { m_ptScrollPos.y = fy; Refresh(RP_NOANALYSE); @@ -2277,7 +2277,7 @@ void CFX_Edit::SetScrollLimit() { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.x, rcContent.left)) { - SetScrollPosX(rcContent.left); + SetScrollPosX(rcContent.left); } else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.x, rcContent.right - rcPlate.Width())) { @@ -2289,7 +2289,7 @@ void CFX_Edit::SetScrollLimit() { SetScrollPosY(rcPlate.top); } - else + else { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.y, rcContent.bottom + rcPlate.Height())) { @@ -2326,7 +2326,7 @@ void CFX_Edit::ScrollToCaret() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; @@ -2380,7 +2380,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const m_Refresh.BeginRefresh(); RefreshPushLineRects(GetVisibleWordRange()); -// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || +// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || // !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollPos.y)) // { m_Refresh.NoAnalyse(); @@ -2392,7 +2392,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // { // case RP_ANALYSE: // m_Refresh.Analyse(m_pVT->GetAlignment()); -// +// // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); // break; @@ -2402,9 +2402,9 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // case RP_OPTIONAL: // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); -// break; +// break; // } -// } +// } if (m_bNotify && m_pNotify) { @@ -2436,7 +2436,7 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wpEnd); pIterator->SetAt(wpBegin); - CPVT_Line lineinfo; + CPVT_Line lineinfo; do { if (!pIterator->GetLine(lineinfo))break; @@ -2466,15 +2466,15 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2488,7 +2488,7 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_Refresh.AddRefresh(VTToEdit(rcWord)); } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2513,15 +2513,15 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2544,7 +2544,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) } } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2569,8 +2569,8 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) void CFX_Edit::SetCaret(const CPVT_WordPlace & place) { - m_wpOldCaret = m_wpCaret; - m_wpCaret = place; + m_wpOldCaret = m_wpCaret; + m_wpCaret = place; } void CFX_Edit::SetCaretInfo() @@ -2594,13 +2594,13 @@ void CFX_Edit::SetCaretInfo() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; ptFoot.y = line.ptLine.y + line.fLineDescent; } - } + } m_bNotifyFlag = TRUE; m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEdit(ptFoot), m_wpCaret); @@ -2631,27 +2631,27 @@ void CFX_Edit::SetCaretChange() SecProps = section.SecProps; WordProps = section.WordProps; } - + if (pIterator->GetWord(word)) - { - WordProps = word.WordProps; + { + WordProps = word.WordProps; } - } - + } + if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; m_pNotify->IOnCaretChange(SecProps,WordProps); m_bNotifyFlag = FALSE; } - } + } } void CFX_Edit::SetCaret(int32_t nPos) { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->WordIndexToWordPlace(nPos)); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2665,7 +2665,7 @@ void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2683,7 +2683,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl if (m_wpCaret != m_wpOldCaret) { - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); @@ -2695,7 +2695,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl } void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) -{ +{ if (m_pVT->IsValid()) { SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); @@ -2717,9 +2717,9 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) } else { - SelectNone(); - - ScrollToCaret(); + SelectNone(); + + ScrollToCaret(); SetCaretInfo(); } } @@ -2750,7 +2750,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) { SelectNone(); - ScrollToCaret(); + ScrollToCaret(); SetCaretInfo(); } } @@ -2764,12 +2764,12 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret, m_wpCaret); @@ -2798,7 +2798,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); @@ -2823,12 +2823,12 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else - m_SelState.Set(m_wpOldCaret,m_wpCaret); + m_SelState.Set(m_wpOldCaret,m_wpCaret); if (m_wpOldCaret != m_wpCaret) - { + { ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); Refresh(RP_OPTIONAL,&wr); @@ -2854,7 +2854,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) - SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); ScrollToCaret(); SetCaretOrigin(); @@ -2876,7 +2876,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret,m_wpCaret); @@ -2903,8 +2903,8 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) if (bCtrl) SetCaret(m_pVT->GetBeginWordPlace()); else - SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); - + SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); @@ -2953,8 +2953,8 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetEndWordPlace()); else SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); - - ScrollToCaret(); + + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); } @@ -3000,11 +3000,11 @@ FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps return TRUE; } } - + return FALSE; } -FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { if (IsTextOverflow()) return FALSE; @@ -3027,9 +3027,9 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); - Refresh(RP_ANALYSE, &wr); + Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); } if (m_bOprNotify && m_pOprNotify) @@ -3054,7 +3054,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_wpCaret); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3069,7 +3069,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (bAddUndo && m_bEnableUndo) { - if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) + if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) AddEditUndoItem(new CFXEU_Backspace(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps)); else @@ -3084,7 +3084,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) CPVT_WordRange wr; if (m_wpCaret.SecCmp(m_wpOldCaret) !=0) - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else @@ -3118,7 +3118,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3133,14 +3133,14 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo && m_bEnableUndo) { - if (bSecEnd) + if (bSecEnd) AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps,bSecEnd)); else AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,word.WordProps,bSecEnd)); } - + if (bPaint) { RearrangePart(CPVT_WordRange(m_wpOldCaret,m_wpCaret)); @@ -3152,10 +3152,10 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3200,14 +3200,14 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { pIterator->SetAt(range.EndPos); - CPVT_Word wordinfo; - CPVT_Section secinfo; + CPVT_Word wordinfo; + CPVT_Section secinfo; do - { + { CPVT_WordPlace place = pIterator->GetAt(); if (place.WordCmp(range.BeginPos) <= 0)break; - CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); + CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); if (oldplace.SecCmp(place) != 0) { @@ -3220,7 +3220,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) else { if (pIterator->GetWord(wordinfo)) - { + { oldplace = m_pVT->AjustLineHeader(oldplace,TRUE); place = m_pVT->AjustLineHeader(place,TRUE); @@ -3233,23 +3233,23 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) EndGroupUndo(); } else - { - AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); + { + AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); } } - SelectNone(); - SetCaret(m_pVT->DeleteWords(range)); + SelectNone(); + SetCaret(m_pVT->DeleteWords(range)); m_SelState.Set(m_wpCaret,m_wpCaret); if (bPaint) { - RearrangePart(range); + RearrangePart(range); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3297,12 +3297,12 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac { RearrangePart(CPVT_WordRange(wpOld,wpNew)); ScrollToCaret(); - + CPVT_WordRange wr; if (m_wpCaret.LineCmp(wpOld) !=0) - wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); else - wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); SetCaretInfo(); @@ -3352,12 +3352,12 @@ void CFX_Edit::SetCaretOrigin() m_ptCaret.y = word.ptWord.y; } else if (pIterator->GetLine(line)) - { + { m_ptCaret.x = line.ptLine.x; m_ptCaret.y = line.ptLine.y; } - } - } + } + } } int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const @@ -3510,7 +3510,7 @@ FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const return 0.0f; } -CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, +CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { CPVT_WordPlace wp = place; @@ -3529,7 +3529,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA if (sText[i+1] == 0x0A) i++; break; - case 0x0A: + case 0x0A: wp = m_pVT->InsertSection(wp,pSecProps,pWordProps); if (sText[i+1] == 0x0D) i++; diff --git a/fpdfsdk/src/fxedit/fxet_module.cpp b/fpdfsdk/src/fxedit/fxet_module.cpp index 9ca7f2eb32..d1421641bc 100644 --- a/fpdfsdk/src/fxedit/fxet_module.cpp +++ b/fpdfsdk/src/fxedit/fxet_module.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxedit/fxet_stub.h" diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index 6b597cabb9..1c0269b682 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxedit/fxet_stub.h" @@ -108,7 +108,7 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - CPVT_Word word; + CPVT_Word word; if (pIterator->GetWord(word)) { CFX_PathData pathUnderline; @@ -121,17 +121,17 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, FXFILL_WINDING); } - } + } } } - + pDevice->RestoreState(); } -void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, +void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData) { - + FX_BOOL bContinuous = pEdit->GetCharArray() == 0; if (pEdit->GetCharSpace() > 0.0f) bContinuous = FALSE; @@ -175,7 +175,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { @@ -186,26 +186,26 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) - { - crCurFill = crWhite; + { + crCurFill = crWhite; } else { crCurFill = crTextFill; } } - if(pSystemHandler && pSystemHandler->IsSelectionImplemented()) + if(pSystemHandler && pSystemHandler->IsSelectionImplemented()) { crCurFill = crTextFill; crOldFill = crCurFill; } - CPVT_Word word; + CPVT_Word word; if (pIterator->GetWord(word)) { if (bSelect) { - + CPVT_Line line; pIterator->GetLine(line); @@ -219,22 +219,22 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF pSystemHandler->OutputSelectedRect(pFFLData,rc); } else - { + { CFX_PathData pathSelBK; pathSelBK.AppendRect(word.ptWord.x,line.ptLine.y + line.fLineDescent, word.ptWord.x+word.fWidth,line.ptLine.y + line.fLineAscent); - - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); + + pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } } if (bContinuous) { - if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || + if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); @@ -245,7 +245,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF crOldFill = crCurFill; } - sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord); + sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord); } else { @@ -260,17 +260,17 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF } if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); - } + } } } - + pDevice->RestoreState(); } -void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, +void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange) { //FX_FLOAT fFontSize = pEdit->GetFontSize(); @@ -309,14 +309,14 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { word.WordProps.fFontSize = word.fFontSize; @@ -327,7 +327,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) - { + { crCurText = crWhite; } } @@ -343,15 +343,15 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device word.ptWord.x+word.fWidth + ptOffset.x, line.ptLine.y + line.fLineAscent + ptOffset.y); - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); + pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } - if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || - FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || + if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || + FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); @@ -362,15 +362,15 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device crOld = crCurText; } - sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); - + sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); + if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { CFX_PathData pathUnderline; CPDF_Rect rcUnderline = GetUnderLineRect(word); pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, rcUnderline.right, rcUnderline.top); - pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); + pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) @@ -382,18 +382,18 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); } } } - + pDevice->RestoreState(); } @@ -401,8 +401,8 @@ static void AddRectToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crFill { CPDF_PathObject* pPathObj = new CPDF_PathObject; CPDF_PathData* pPathData = pPathObj->m_Path.GetModify(); - pPathData->AppendRect(rcFill.left,rcFill.bottom,rcFill.right,rcFill.top); - + pPathData->AppendRect(rcFill.left,rcFill.bottom,rcFill.right,rcFill.top); + FX_FLOAT rgb[3]; rgb[0] = FXARGB_R(crFill) / 255.0f ; rgb[1] = FXARGB_G(crFill) / 255.0f; @@ -415,12 +415,12 @@ static void AddRectToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crFill pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(),pPathObj); } -static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crText, - CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, +static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crText, + CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, const CPDF_Point& point, const CFX_ByteString& text) { CPDF_TextObject* pTxtObj = new CPDF_TextObject; - + CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify(); pTextStateData->m_pFont = pFont; pTextStateData->m_FontSize = fFontSize; @@ -440,7 +440,7 @@ static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_ pTxtObj->m_ColorState.SetStrokeColor(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB),rgb, 3); pTxtObj->SetPosition(point.x,point.y); - pTxtObj->SetText(text); + pTxtObj->SetText(text); pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(),pTxtObj); @@ -468,14 +468,14 @@ void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEd else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { if (place.LineCmp(oldplace) != 0 || nOldFontIndex != word.nFontIndex) @@ -493,12 +493,12 @@ void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEd } sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0); - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString())); } @@ -530,22 +530,22 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { word.WordProps.fFontSize = word.fFontSize; crCurText = ArgbEncode(255,word.WordProps.dwWordColor); - if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || - FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || + if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || + FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) @@ -559,24 +559,24 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* wp = word.WordProps; ptBT = word.ptWord; crOld = crCurText; - + } - sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); - + sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); + if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {/* - AddLineToPageObjects(pPageObjects, crCurText, + AddLineToPageObjects(pPageObjects, crCurText, CPDF_Point(word.ptWord.x, word.ptWord.y + word.fDescent * 0.4f), - CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent * 0.4f)); + CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent * 0.4f)); */ CPDF_Rect rcUnderline = GetUnderLineRect(word); rcUnderline.left += ptOffset.x; rcUnderline.right += ptOffset.x; rcUnderline.top += ptOffset.y; rcUnderline.bottom += ptOffset.y; - - AddRectToPageObjects(pPageObjects, crCurText, rcUnderline); + + AddRectToPageObjects(pPageObjects, crCurText, rcUnderline); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) @@ -587,15 +587,15 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* rcCrossout.top += ptOffset.y; rcCrossout.bottom += ptOffset.y; - AddRectToPageObjects(pPageObjects, crCurText, rcCrossout); + AddRectToPageObjects(pPageObjects, crCurText, rcCrossout); } - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString())); } @@ -617,14 +617,14 @@ void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { CPDF_Rect rcUnderline = GetUnderLineRect(word); |