root/trunk/src/DocumentLinkGoto.cxx

Revision 196, 1.8 kB (checked in by jordi, 2 years ago)

The old DocumentLink? class is now the IDocumentLink interface and only handles the link's rectangle. The functionality of the old DocumentLink? class is now inside the IDocumentLink derived DocumentLinkGoto? class.

The links are now created inside PDFDocument::createDocumentLink function and can be of DocumentLinkGoto? for internal references or DocumentLinkUri? for internet addresses (not yet implemented).

Line 
1 // ePDFView - A lightweight PDF Viewer.
2 // Copyright (C) 2006 Emma's Software.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18 #include <config.h>
19 #include "epdfview.h"
20
21 using namespace ePDFView;
22
23 ///
24 /// @brief Construct a new DocumentLinkGoto object.
25 ///
26 /// @param x1 The X coordinate of the link's top-left corner.
27 /// @param y1 The Y coordinate of the link's top-left corner.
28 /// @param x2 The X coordinate of the link's bottom-right corner.
29 /// @param y2 The Y coordinate of the link's bottom-right corner.
30 /// @param destinationPage The page number the links points to.
31 ///
32 DocumentLinkGoto::DocumentLinkGoto (gdouble x1, gdouble y1, gdouble x2,
33                                     gdouble y2, gint destinationPage):
34     IDocumentLink (x1, y1, x2, y2)
35 {
36     m_DestinationPage = destinationPage;
37 }
38
39 ///
40 /// @brief Destroys all dynamically allocated memory by DocumentLinkGoto.
41 ///
42 DocumentLinkGoto::~DocumentLinkGoto ()
43 {
44 }
45
46 ///
47 /// @brief Activates the link.
48 ///
49 /// @param document The document where the link was activated from.
50 ///
51 void
52 DocumentLinkGoto::activate (IDocument *document)
53 {
54     document->goToPage (m_DestinationPage);
55 }
Note: See TracBrowser for help on using the browser.