Foxit PDF SDK

Public Member Functions | List of all members
foxit::addon::pageeditor::TextSearchReplace Class Reference
Inheritance diagram for foxit::addon::pageeditor::TextSearchReplace:

## Public Member Functions
| TextSearchReplace (const foxit::pdf::PDFDoc &doc)
| Constructor. More...
| TextSearchReplace (const TextSearchReplace &other)
| Constructor, with another text search replace object. More...
| ~TextSearchReplace ()
| Destructor.
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | operator!= (const TextSearchReplace &other) const
| Not equal operator. More...
TextSearchReplace & | operator= (const TextSearchReplace &other)
| Assign operator. More...
bool | operator== (const TextSearchReplace &other) const
| Equal operator. More...
bool | ReplaceNext (const WString &replace_text)
| Replace next text with replacing text. More...
bool | ReplacePrev (const WString &replace_text)
| Replace previous text with replacing text. More...
void | SetPattern (const WString &keywords, int page_index, const FindOption &find_option)
| Set keywords and page index to do searching and replacing. More...
void | SetReplaceCallback (ReplaceCallback *replace_callback)
| Set replacing callback function. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

This class can be used for searching and replacing text. Before using any class or methods in this module, please ensure Foxit PDF SDK has been initialized successfully by function common::Library::Initialize with a key including "AdvEdit" module.

See also
  common::Library

## Constructor & Destructor Documentation

## ◆ TextSearchReplace() [1/2]

foxit::addon::pageeditor::TextSearchReplace::TextSearchReplace | ( | const foxit::pdf::PDFDoc & | doc | ) |

Constructor.

Parameters

  [in] | doc | A valid PDF document object to be searched or replaced. Currently, Foxit PDF SDK does not support to do the replacing for dynamic XFA document.

This constructor is to construct a text search replace object.

## ◆ TextSearchReplace() [2/2]

foxit::addon::pageeditor::TextSearchReplace::TextSearchReplace | ( | const TextSearchReplace & | other | ) |

Constructor, with another text search replace object.

Parameters

  [in] | other | Another text search replace object.

## Member Function Documentation

## ◆ IsEmpty()

bool foxit::addon::pageeditor::TextSearchReplace::IsEmpty | ( |  | ) | const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means that current object is empty, while false means not.

## ◆ operator!=()

bool foxit::addon::pageeditor::TextSearchReplace::operator!= | ( | const TextSearchReplace & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another text search replace object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

TextSearchReplace& foxit::addon::pageeditor::TextSearchReplace::operator= | ( | const TextSearchReplace & | other | ) |

Assign operator.

Parameters

  [in] | other | Another text search replace object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::addon::pageeditor::TextSearchReplace::operator== | ( | const TextSearchReplace & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another text search replace object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ ReplaceNext()

bool foxit::addon::pageeditor::TextSearchReplace::ReplaceNext | ( | const WString & | replace_text | ) |

Replace next text with replacing text.

Parameters

  [in] | replace_text | The text to be replaced with. This should not be an empty string.

Returns
  true means success, while false means that keywords is not found. It will still return true if users do not want to replace.

## ◆ ReplacePrev()

bool foxit::addon::pageeditor::TextSearchReplace::ReplacePrev | ( | const WString & | replace_text | ) |

Replace previous text with replacing text.

Parameters

  [in] | replace_text | The text to be replaced with. This should not be an empty string.

Returns
  true means success, while false means that keywords is not found. It will still return true if users do not want to replace.

## ◆ SetPattern()

void foxit::addon::pageeditor::TextSearchReplace::SetPattern | ( | const WString & | keywords,
|  | int | page_index,
|  | const FindOption & | find_option
| ) |  |

Set keywords and page index to do searching and replacing.

Parameters

  [in] | keywords | The text content to be replaced. It should not be an empty string.
  [in] | page_index | Index of the page that will be searched and replaced.Valid range: from 0 to (count-1). count is returned by function PDFDoc::GetPageCount for PDF document. This is only used for TextSearchReplace::ReplacePrev and TextSearchReplace::ReplaceNext.
  [in] | find_option | The find option. It should be a valid find option object.

Returns
  true means success, while false means failure.

## ◆ SetReplaceCallback()

void foxit::addon::pageeditor::TextSearchReplace::SetReplaceCallback | ( | ReplaceCallback * | replace_callback | ) |

Set replacing callback function.

Parameters

  [in] | replace_callback | The callback object for replacing.This should be implemented by user and can be NULL. It means that the found text always needs to be replaced if it is NULL

Returns
  None.