From c0217257d4cf4dbcd835e88b085e2d9b28da1b2e Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Wed, 16 Oct 2019 01:17:31 -0400 Subject: [PATCH] [page] Add method to get all links in a given page --- core/page.cpp | 16 ++++++++++++++++ core/page.h | 7 +++++++ 2 files changed, 23 insertions(+) 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). *