root/trunk/src/IDocumentObserver.h

Revision 277, 6.0 kB (checked in by jordi, 16 months ago)

Added a patch by Igor Vagulin which adds text selection and copy to clipboard features. This fixes bug #14.

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#if !defined (__IDOCUMENT_OBSERVER_H__)
19#define __IDOCUMENT_OBSERVER_H__
20
21namespace ePDFView
22{
23    /// @class IDocumentObserver
24    /// @brief Interface for IDocument's observers.
25    ///
26    /// A document observer is just a class that receives notifications
27    /// of the document when it changes its state.
28    ///
29    class IDocumentObserver
30    {
31        public:
32            /// @brief Destroys all dynamically allocated memory.
33            virtual ~IDocumentObserver (void) { }
34
35            ///
36            /// @brief A find result has been changed.
37            ///
38            /// This is called every time the highligthed find result
39            /// is changed.
40            ///
41            /// @param matchRect The rectangle of the highligthed result.
42            ///
43            virtual void notifyFindChanged (DocumentRectangle *matchRect) { }
44
45            ///
46            /// @brief A find has been finished.
47            ///
48            /// This is called when the find is finished (i.e., no
49            /// results.)
50            ///
51            virtual void notifyFindFinished (void) { }
52
53            ///
54            /// @brief A find has been started.
55            ///
56            /// This function is called when a new find has been started.
57            /// This is mainly for test purposes.
58            ///
59            virtual void notifyFindStarted (void) { }
60
61            ///
62            /// @brief The document has been loaded.
63            ///
64            /// This function is called when the document has been
65            /// loaded successfully.
66            ///
67            virtual void notifyLoad (void) { }
68
69            ///
70            /// @brief The document couldn't be loaded due an error.
71            ///
72            /// This function is called when the document couldn't be
73            /// loaded because of an error. The error message is
74            /// passed as a parameter.
75            ///
76            /// @param error The error code and message.
77            ///
78            virtual void notifyLoadError (const GError *error) { }
79
80            ///
81            /// @brief The document is encrypted.
82            ///
83            /// This function is called when the document couldn't be
84            /// loaded because it's encrypted and no password or an invalid
85            /// password was supplied.
86            ///
87            /// @param fileName The file name that was trying to load.
88            /// @param reload TRUE if it was trying to reload the file, FALSE
89            ///               if it was trying to load a new file.
90            /// @param error The error message and code that the operation
91            ///              produced.
92            virtual void notifyLoadPassword (const gchar *fileName,
93                                             gboolean reload,
94                                             const GError *error) { }
95
96            ///
97            /// @brief The current page has been changed.
98            ///
99            /// This function is called when the current page has been
100            /// replaced by a new one.
101            ///
102            /// @param pageNum The number of the new page.
103            ///
104            virtual void notifyPageChanged (gint pageNum) { }
105
106            ///
107            /// @brief The current page has been rotated.
108            ///
109            /// This function is called when the current page has been
110            /// rotated.
111            ///
112            /// @param rotation The rotation angle in degrees.
113            ///
114            virtual void notifyPageRotated (gint rotation) { }
115
116            ///
117            /// @brief The current page has been scaled.
118            ///
119            /// This function is called when the current page zoom level
120            /// has been changed.
121            ///
122            /// @param zoom The current scale.
123            ///
124            virtual void notifyPageZoomed (gdouble zoom) { }
125
126            ///
127            /// @brief The document has been reloaded.
128            ///
129            /// This function is called when the document has been reloaded
130            /// successfully.
131            ///
132            virtual void notifyReload (void) { }
133
134            ///
135            /// @brief The document has been saved.
136            ///
137            /// This function is called when a document's copy has been
138            /// saved successfully.
139            ///
140            virtual void notifySave (void) { }
141
142            ///
143            /// @brief The document couldn't be saved due an error.
144            ///
145            /// This function is called when a document's copy couldn't be
146            /// saved because of an error. The error message is
147            /// passed as a parameter.
148            ///
149            /// @param error The error code and message.
150            ///
151            virtual void notifySaveError (const GError *error) { }
152
153            ///
154            /// @brief Someone select text in document.
155            ///
156            /// This function called when someone select some text
157            /// in document.
158            ///
159            /// @param text Selected text.
160            ///
161            virtual void notifyTextSelected (const gchar* text) { }
162
163        protected:
164            ///
165            /// @brief Constructs a new IDocumentObserver object.
166            IDocumentObserver (void) { }
167    };
168}
169
170#endif // !__IDOCUMENT_OBSERVER_H__
Note: See TracBrowser for help on using the browser.