qt4/src/poppler-page.cc | 22 +++++++++++++++------- qt4/src/poppler-qt4.h | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 9 deletions(-)
New commits: commit 92738ebb8a9c7cfc879aae59c2cbdf3159f03cd3 Author: Albert Astals Cid <[email protected]> Date: Mon Mar 22 20:28:15 2010 +0000 Add a search overload that takes doubles QRectF is evil and is float in some arch and causes search to loop infinitely because of double->float conversion diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 5a90a4b..4a3690a 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <[email protected]> - * Copyright (C) 2005-2009, Albert Astals Cid <[email protected]> + * Copyright (C) 2005-2010, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Stefan Kebekus <[email protected]> * Copyright (C) 2006-2009, Pino Toscano <[email protected]> * Copyright (C) 2008 Carlos Garcia Campos <[email protected]> @@ -319,7 +319,7 @@ QString Page::text(const QRectF &r) const return result; } -bool Page::search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate) const +bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate) const { const QChar * str = text.unicode(); int len = text.length(); @@ -331,11 +331,6 @@ bool Page::search(const QString &text, QRectF &rect, SearchDirection direction, else sCase = gFalse; bool found = false; - double sLeft, sTop, sRight, sBottom; - sLeft = rect.left(); - sTop = rect.top(); - sRight = rect.right(); - sBottom = rect.bottom(); int rotation = (int)rotate * 90; @@ -356,6 +351,19 @@ bool Page::search(const QString &text, QRectF &rect, SearchDirection direction, textPage->decRefCnt(); + return found; +} + +bool Page::search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate) const +{ + double sLeft, sTop, sRight, sBottom; + sLeft = rect.left(); + sTop = rect.top(); + sRight = rect.right(); + sBottom = rect.bottom(); + + bool found = search(text, sLeft, sTop, sRight, sBottom, direction, caseSensitive, rotate); + rect.setLeft( sLeft ); rect.setTop( sTop ); rect.setRight( sRight ); diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h index 2f5521f..117dc43 100644 --- a/qt4/src/poppler-qt4.h +++ b/qt4/src/poppler-qt4.h @@ -1,7 +1,7 @@ /* poppler-qt.h: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, 2007, Brad Hards <[email protected]> - * Copyright (C) 2005-2009, Albert Astals Cid <[email protected]> + * Copyright (C) 2005-2010, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Stefan Kebekus <[email protected]> * Copyright (C) 2006-2009, Pino Toscano <[email protected]> * Copyright (C) 2009 Shawn Rutledge <[email protected]> @@ -472,8 +472,20 @@ delete it; \param caseSensitive be case sensitive? \param rotate the rotation to apply for the search order **/ - bool search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; + Q_DECL_DEPRECATED bool search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; + /** + Returns true if the specified text was found. + + \param text the text the search + \param rectXXX in all directions is used to return where the text was found, for NextResult and PreviousResult + indicates where to continue searching for + \param direction in which direction do the search + \param caseSensitive be case sensitive? + \param rotate the rotation to apply for the search order + \since 0.14 + **/ + bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; /** Returns a list of text of the page _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
