1 //========================================================================
2 //
3 // This file comes from pdftohtml project
4 // http://pdftohtml.sourceforge.net
5 //
6 // Copyright from:
7 // Gueorgui Ovtcharov
8 // Rainer Dorsch <http://www.ra.informatik.uni-stuttgart.de/~rainer/>
9 // Mikhail Kruk <meshko@cs.brandeis.edu>
10 //
11 //========================================================================
12 
13 //========================================================================
14 //
15 // Modified under the Poppler project - http://poppler.freedesktop.org
16 //
17 // All changes made under the Poppler project to this file are licensed
18 // under GPL version 2 or later
19 //
20 // Copyright (C) 2010, 2018, 2021 Albert Astals Cid <aacid@kde.org>
21 //
22 // To see a description of the changes please see the Changelog file that
23 // came with your tarball or type make ChangeLog if you are building from git
24 //
25 //========================================================================
26 
27 #ifndef _HTML_LINKS
28 #define _HTML_LINKS
29 
30 #include <cstdlib>
31 #include <cstring>
32 #include <vector>
33 #include "goo/GooString.h"
34 
35 class HtmlLink
36 {
37 
38 private:
39     double Xmin;
40     double Ymin;
41     double Xmax;
42     double Ymax;
43     GooString *dest;
44 
45 public:
46     HtmlLink(const HtmlLink &x);
47     HtmlLink(double xmin, double ymin, double xmax, double ymax, GooString *_dest);
48     ~HtmlLink();
49     HtmlLink &operator=(const HtmlLink &) = delete;
50     bool isEqualDest(const HtmlLink &x) const;
getDest()51     GooString *getDest() const { return new GooString(dest); }
getX1()52     double getX1() const { return Xmin; }
getX2()53     double getX2() const { return Xmax; }
getY1()54     double getY1() const { return Ymin; }
getY2()55     double getY2() const { return Ymax; }
56     bool inLink(double xmin, double ymin, double xmax, double ymax) const;
57     // GooString *Link(GooString *content);
58     GooString *getLinkStart() const;
59 };
60 
61 class HtmlLinks
62 {
63 private:
64     std::vector<HtmlLink> accu;
65 
66 public:
67     HtmlLinks();
68     ~HtmlLinks();
69     HtmlLinks(const HtmlLinks &) = delete;
70     HtmlLinks &operator=(const HtmlLinks &) = delete;
AddLink(const HtmlLink & x)71     void AddLink(const HtmlLink &x) { accu.push_back(x); }
72     bool inLink(double xmin, double ymin, double xmax, double ymax, int &p) const;
73     const HtmlLink *getLink(int i) const;
74 };
75 
76 #endif
77