| 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 CORE_SRC_FPDFDOC_PDF_VT_H_ | 7 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_ |
| 8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ | 8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ |
| 9 | 9 |
| 10 class CPVT_Size; | 10 class CPVT_Size; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 CPVT_FloatRect() { left = top = right = bottom = 0.0f; } | 37 CPVT_FloatRect() { left = top = right = bottom = 0.0f; } |
| 38 CPVT_FloatRect(FX_FLOAT other_left, | 38 CPVT_FloatRect(FX_FLOAT other_left, |
| 39 FX_FLOAT other_top, | 39 FX_FLOAT other_top, |
| 40 FX_FLOAT other_right, | 40 FX_FLOAT other_right, |
| 41 FX_FLOAT other_bottom) { | 41 FX_FLOAT other_bottom) { |
| 42 left = other_left; | 42 left = other_left; |
| 43 top = other_top; | 43 top = other_top; |
| 44 right = other_right; | 44 right = other_right; |
| 45 bottom = other_bottom; | 45 bottom = other_bottom; |
| 46 } | 46 } |
| 47 explicit CPVT_FloatRect(const CFX_FloatRect& rect) { | 47 explicit CPVT_FloatRect(const CPDF_Rect& rect) { |
| 48 left = rect.left; | 48 left = rect.left; |
| 49 top = rect.top; | 49 top = rect.top; |
| 50 right = rect.right; | 50 right = rect.right; |
| 51 bottom = rect.bottom; | 51 bottom = rect.bottom; |
| 52 } | 52 } |
| 53 void Default() { left = top = right = bottom = 0.0f; } | 53 void Default() { left = top = right = bottom = 0.0f; } |
| 54 FX_FLOAT Height() const { | 54 FX_FLOAT Height() const { |
| 55 if (top > bottom) | 55 if (top > bottom) |
| 56 return top - bottom; | 56 return top - bottom; |
| 57 return bottom - top; | 57 return bottom - top; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo); | 250 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo); |
| 251 void ClearWords(const CPVT_WordRange& PlaceRange); | 251 void ClearWords(const CPVT_WordRange& PlaceRange); |
| 252 void ClearWord(const CPVT_WordPlace& place); | 252 void ClearWord(const CPVT_WordPlace& place); |
| 253 CPVT_FloatRect Rearrange(); | 253 CPVT_FloatRect Rearrange(); |
| 254 CPVT_Size GetSectionSize(FX_FLOAT fFontSize); | 254 CPVT_Size GetSectionSize(FX_FLOAT fFontSize); |
| 255 CPVT_WordPlace GetBeginWordPlace() const; | 255 CPVT_WordPlace GetBeginWordPlace() const; |
| 256 CPVT_WordPlace GetEndWordPlace() const; | 256 CPVT_WordPlace GetEndWordPlace() const; |
| 257 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; | 257 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; |
| 258 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; | 258 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; |
| 259 void UpdateWordPlace(CPVT_WordPlace& place) const; | 259 void UpdateWordPlace(CPVT_WordPlace& place) const; |
| 260 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; | 260 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const; |
| 261 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, | 261 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, |
| 262 const CPVT_WordPlace& lineplace) const; | 262 const CPVT_WordPlace& lineplace) const; |
| 263 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, | 263 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, |
| 264 const CPVT_WordRange& range) const; | 264 const CPVT_WordRange& range) const; |
| 265 | 265 |
| 266 public: | 266 public: |
| 267 CPVT_WordPlace SecPlace; | 267 CPVT_WordPlace SecPlace; |
| 268 CPVT_SectionInfo m_SecInfo; | 268 CPVT_SectionInfo m_SecInfo; |
| 269 CLines m_LineArray; | 269 CLines m_LineArray; |
| 270 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray; | 270 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 289 void OutputLines(); | 289 void OutputLines(); |
| 290 | 290 |
| 291 CPVT_FloatRect m_rcRet; | 291 CPVT_FloatRect m_rcRet; |
| 292 CPDF_VariableText* m_pVT; | 292 CPDF_VariableText* m_pVT; |
| 293 CSection* m_pSection; | 293 CSection* m_pSection; |
| 294 }; | 294 }; |
| 295 class CPDF_EditContainer { | 295 class CPDF_EditContainer { |
| 296 public: | 296 public: |
| 297 CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {} | 297 CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {} |
| 298 virtual ~CPDF_EditContainer() {} | 298 virtual ~CPDF_EditContainer() {} |
| 299 virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } | 299 virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; } |
| 300 virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; } | 300 virtual const CPDF_Rect& GetPlateRect() const { return m_rcPlate; } |
| 301 virtual void SetContentRect(const CPVT_FloatRect& rect) { | 301 virtual void SetContentRect(const CPVT_FloatRect& rect) { |
| 302 m_rcContent = rect; | 302 m_rcContent = rect; |
| 303 } | 303 } |
| 304 virtual CFX_FloatRect GetContentRect() const { return m_rcContent; } | 304 virtual CPDF_Rect GetContentRect() const { return m_rcContent; } |
| 305 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } | 305 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } |
| 306 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } | 306 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } |
| 307 CPVT_Size GetPlateSize() const { | 307 CPVT_Size GetPlateSize() const { |
| 308 return CPVT_Size(GetPlateWidth(), GetPlateHeight()); | 308 return CPVT_Size(GetPlateWidth(), GetPlateHeight()); |
| 309 } | 309 } |
| 310 CFX_FloatPoint GetBTPoint() const { | 310 CPDF_Point GetBTPoint() const { |
| 311 return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); | 311 return CPDF_Point(m_rcPlate.left, m_rcPlate.top); |
| 312 } | 312 } |
| 313 CFX_FloatPoint GetETPoint() const { | 313 CPDF_Point GetETPoint() const { |
| 314 return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); | 314 return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom); |
| 315 } | 315 } |
| 316 inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const { | 316 inline CPDF_Point InToOut(const CPDF_Point& point) const { |
| 317 return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); | 317 return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y); |
| 318 } | 318 } |
| 319 inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const { | 319 inline CPDF_Point OutToIn(const CPDF_Point& point) const { |
| 320 return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); | 320 return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y); |
| 321 } | 321 } |
| 322 inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const { | 322 inline CPDF_Rect InToOut(const CPVT_FloatRect& rect) const { |
| 323 CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); | 323 CPDF_Point ptLeftTop = InToOut(CPDF_Point(rect.left, rect.top)); |
| 324 CFX_FloatPoint ptRightBottom = | 324 CPDF_Point ptRightBottom = InToOut(CPDF_Point(rect.right, rect.bottom)); |
| 325 InToOut(CFX_FloatPoint(rect.right, rect.bottom)); | 325 return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, |
| 326 return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, | 326 ptLeftTop.y); |
| 327 ptLeftTop.y); | |
| 328 } | 327 } |
| 329 inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const { | 328 inline CPVT_FloatRect OutToIn(const CPDF_Rect& rect) const { |
| 330 CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); | 329 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top)); |
| 331 CFX_FloatPoint ptRightBottom = | 330 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom)); |
| 332 OutToIn(CFX_FloatPoint(rect.right, rect.bottom)); | |
| 333 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, | 331 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, |
| 334 ptRightBottom.y); | 332 ptRightBottom.y); |
| 335 } | 333 } |
| 336 | 334 |
| 337 private: | 335 private: |
| 338 CFX_FloatRect m_rcPlate; | 336 CPDF_Rect m_rcPlate; |
| 339 CPVT_FloatRect m_rcContent; | 337 CPVT_FloatRect m_rcContent; |
| 340 }; | 338 }; |
| 341 | 339 |
| 342 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { | 340 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { |
| 343 friend class CTypeset; | 341 friend class CTypeset; |
| 344 friend class CSection; | 342 friend class CSection; |
| 345 friend class CPDF_VariableText_Iterator; | 343 friend class CPDF_VariableText_Iterator; |
| 346 | 344 |
| 347 public: | 345 public: |
| 348 CPDF_VariableText(); | 346 CPDF_VariableText(); |
| 349 ~CPDF_VariableText() override; | 347 ~CPDF_VariableText() override; |
| 350 | 348 |
| 351 // IPDF_VariableText | 349 // IPDF_VariableText |
| 352 IPDF_VariableText_Provider* SetProvider( | 350 IPDF_VariableText_Provider* SetProvider( |
| 353 IPDF_VariableText_Provider* pProvider) override; | 351 IPDF_VariableText_Provider* pProvider) override; |
| 354 IPDF_VariableText_Iterator* GetIterator() override; | 352 IPDF_VariableText_Iterator* GetIterator() override; |
| 355 void SetPlateRect(const CFX_FloatRect& rect) override { | 353 void SetPlateRect(const CPDF_Rect& rect) override { |
| 356 CPDF_EditContainer::SetPlateRect(rect); | 354 CPDF_EditContainer::SetPlateRect(rect); |
| 357 } | 355 } |
| 358 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; } | 356 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; } |
| 359 void SetPasswordChar(FX_WORD wSubWord = '*') override { | 357 void SetPasswordChar(FX_WORD wSubWord = '*') override { |
| 360 m_wSubWord = wSubWord; | 358 m_wSubWord = wSubWord; |
| 361 } | 359 } |
| 362 void SetLimitChar(int32_t nLimitChar = 0) override { | 360 void SetLimitChar(int32_t nLimitChar = 0) override { |
| 363 m_nLimitChar = nLimitChar; | 361 m_nLimitChar = nLimitChar; |
| 364 } | 362 } |
| 365 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override { | 363 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 const CPVT_SecProps* pSecProps = NULL, | 400 const CPVT_SecProps* pSecProps = NULL, |
| 403 const CPVT_WordProps* pWordProps = NULL) override; | 401 const CPVT_WordProps* pWordProps = NULL) override; |
| 404 CPVT_WordPlace InsertText(const CPVT_WordPlace& place, | 402 CPVT_WordPlace InsertText(const CPVT_WordPlace& place, |
| 405 const FX_WCHAR* text, | 403 const FX_WCHAR* text, |
| 406 int32_t charset = 1, | 404 int32_t charset = 1, |
| 407 const CPVT_SecProps* pSecProps = NULL, | 405 const CPVT_SecProps* pSecProps = NULL, |
| 408 const CPVT_WordProps* pWordProps = NULL) override; | 406 const CPVT_WordProps* pWordProps = NULL) override; |
| 409 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override; | 407 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override; |
| 410 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override; | 408 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override; |
| 411 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override; | 409 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override; |
| 412 const CFX_FloatRect& GetPlateRect() const override { | 410 const CPDF_Rect& GetPlateRect() const override { |
| 413 return CPDF_EditContainer::GetPlateRect(); | 411 return CPDF_EditContainer::GetPlateRect(); |
| 414 } | 412 } |
| 415 CFX_FloatRect GetContentRect() const override; | 413 CPDF_Rect GetContentRect() const override; |
| 416 int32_t GetTotalWords() const override; | 414 int32_t GetTotalWords() const override; |
| 417 FX_FLOAT GetFontSize() const override { return m_fFontSize; } | 415 FX_FLOAT GetFontSize() const override { return m_fFontSize; } |
| 418 int32_t GetAlignment() const override { return m_nAlignment; } | 416 int32_t GetAlignment() const override { return m_nAlignment; } |
| 419 FX_WORD GetPasswordChar() const override { return GetSubWord(); } | 417 FX_WORD GetPasswordChar() const override { return GetSubWord(); } |
| 420 int32_t GetCharArray() const override { return m_nCharArray; } | 418 int32_t GetCharArray() const override { return m_nCharArray; } |
| 421 int32_t GetLimitChar() const override { return m_nLimitChar; } | 419 int32_t GetLimitChar() const override { return m_nLimitChar; } |
| 422 FX_BOOL IsMultiLine() const override { return m_bMultiLine; } | 420 FX_BOOL IsMultiLine() const override { return m_bMultiLine; } |
| 423 int32_t GetHorzScale() const override { return m_nHorzScale; } | 421 int32_t GetHorzScale() const override { return m_nHorzScale; } |
| 424 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; } | 422 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; } |
| 425 CPVT_WordPlace GetBeginWordPlace() const override; | 423 CPVT_WordPlace GetBeginWordPlace() const override; |
| 426 CPVT_WordPlace GetEndWordPlace() const override; | 424 CPVT_WordPlace GetEndWordPlace() const override; |
| 427 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override; | 425 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override; |
| 428 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override; | 426 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override; |
| 429 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; | 427 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const override; |
| 430 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, | 428 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, |
| 431 const CFX_FloatPoint& point) const override; | 429 const CPDF_Point& point) const override; |
| 432 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, | 430 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, |
| 433 const CFX_FloatPoint& point) const override; | 431 const CPDF_Point& point) const override; |
| 434 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; | 432 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; |
| 435 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; | 433 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; |
| 436 CPVT_WordPlace GetSectionBeginPlace( | 434 CPVT_WordPlace GetSectionBeginPlace( |
| 437 const CPVT_WordPlace& place) const override; | 435 const CPVT_WordPlace& place) const override; |
| 438 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; | 436 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; |
| 439 void UpdateWordPlace(CPVT_WordPlace& place) const override; | 437 void UpdateWordPlace(CPVT_WordPlace& place) const override; |
| 440 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, | 438 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, |
| 441 FX_BOOL bPrevOrNext) const override; | 439 FX_BOOL bPrevOrNext) const override; |
| 442 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; | 440 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; |
| 443 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; | 441 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 void SetAt(int32_t nWordIndex) override; | 550 void SetAt(int32_t nWordIndex) override; |
| 553 void SetAt(const CPVT_WordPlace& place) override; | 551 void SetAt(const CPVT_WordPlace& place) override; |
| 554 const CPVT_WordPlace& GetAt() const override { return m_CurPos; } | 552 const CPVT_WordPlace& GetAt() const override { return m_CurPos; } |
| 555 | 553 |
| 556 private: | 554 private: |
| 557 CPVT_WordPlace m_CurPos; | 555 CPVT_WordPlace m_CurPos; |
| 558 CPDF_VariableText* m_pVT; | 556 CPDF_VariableText* m_pVT; |
| 559 }; | 557 }; |
| 560 | 558 |
| 561 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ | 559 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ |
| OLD | NEW |