File indexing completed on 2024-05-12 16:06:38

0001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; c-brace-offset: 0; -*-
0002 //
0003 // Class: hyperlink
0004 //
0005 // Part of KDVI- A previewer for TeX DVI files.
0006 //
0007 // SPDX-FileCopyrightText: 2004-2005 Stefan Kebekus
0008 // SPDX-License-Identifier: GPL-2.0-or-later
0009 
0010 #ifndef _hyperlink_h_
0011 #define _hyperlink_h_
0012 
0013 #include <QRect>
0014 #include <QString>
0015 
0016 /** Represents a named, rectangular region in a rendered documentPage
0017 
0018     This trivial class is used in the documentPage class to represent
0019     a hyperlink in a rendered documentPage.
0020 
0021     @author Stefan Kebekus <kebekus@kde.org>
0022     @version 1.0.0
0023 */
0024 
0025 class Hyperlink
0026 {
0027 public:
0028     /** \brief Default Constructor
0029 
0030     The default constructor leaves all fields uninitialized.
0031     */
0032     Hyperlink()
0033     {
0034     }
0035 
0036     /** \brief Constructor
0037 
0038     Trivial constructor leaves that initialized all members.
0039 
0040     @param bl value for the baseline field
0041     @param re value for the box
0042     @param lT valus for the text field
0043     */
0044     Hyperlink(quint32 bl, const QRect re, const QString &lT)
0045         : baseline(bl)
0046         , box(re)
0047         , linkText(lT)
0048     {
0049     }
0050 
0051     /** \brief Base line of a hyperlink
0052 
0053     This field specifies the Y-coordinate of the base line of the
0054     bounding box in the same coordinates that were used when the
0055     associated documentPage was rendered by the
0056     documentRenderer.drawPage() method. It is used to underline
0057     hyperlinks in blue. Note that this field does generally differ from
0058     the Y-coordinate of the bottom of the bounding box, e.g. if the text
0059     in the box contains characters with underlengths, such as 'y', 'j'
0060     or 'g'.
0061      */
0062     quint32 baseline;
0063 
0064     /** \brief Bounding box of the text or hyperlink
0065 
0066     This rectangle specifies where on the page the hyperlink is
0067     found. It uses the same coordinates that were used when the
0068     associated documentPage was rendered by the
0069     documentRenderer.drawPage() method. The box is used to determine if
0070     the mouse pointer hovers over the link.
0071     */
0072     QRect box;
0073 
0074     /** \brief Name of the region
0075 
0076     This field contains the name of the target,
0077     e.g. "http://www.kde.org". If the Hyperlink class is used to
0078     represent text, then the text is stored here.
0079     */
0080     QString linkText;
0081 };
0082 
0083 #endif