diff --git a/core/page.cpp b/core/page.cpp index 33c6127c4..7a4a249af 100644 --- a/core/page.cpp +++ b/core/page.cpp @@ -464,6 +464,22 @@ QLinkedList< const ObjectRect * > Page::objectRects( ObjectRect::ObjectType type return result; } +QLinkedList< const ObjectRect * > Page::objectRects( ObjectRect::ObjectType type) const +{ + QLinkedList< const ObjectRect * > result; + + QLinkedListIterator< ObjectRect * > it( m_rects ); + it.toBack(); + while ( it.hasPrevious() ) + { + const ObjectRect *objrect = it.previous(); + if ( ( objrect->objectType() == type ) ) + result.append( objrect ); + } + + return result; +} + const ObjectRect* Page::nearestObjectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double * distance ) const { diff --git a/core/page.h b/core/page.h index b33f0e039..6afba19db 100644 --- a/core/page.h +++ b/core/page.h @@ -234,6 +234,13 @@ class OKULARCORE_EXPORT Page */ QLinkedList< const ObjectRect * > objectRects( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const; + /** + * Returns all object rects of the given @p type + * + * @since 0.xxxx + */ + QLinkedList< const ObjectRect * > objectRects( ObjectRect::ObjectType type) const; + /** * Returns the object rect of the given @p type which is nearest to the point (@p x, @p y) at scale (@p xScale, @p yScale). *