Code

Mnemonics in "Fill and stroke", "Align and distribute", and "Transform" dialogs ...
[inkscape.git] / src / dom / views.h
1 #ifndef __VIEWS_H__
2 #define __VIEWS_H__
4 /**
5  * Phoebe DOM Implementation.
6  *
7  * This is a C++ approximation of the W3C DOM model, which follows
8  * fairly closely the specifications in the various .idl files, copies of
9  * which are provided for reference.  Most important is this one:
10  *
11  * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
12  *
13  * Authors:
14  *   Bob Jamison
15  *
16  * Copyright (C) 2005-2008 Bob Jamison
17  *
18  *  This library is free software; you can redistribute it and/or
19  *  modify it under the terms of the GNU Lesser General Public
20  *  License as published by the Free Software Foundation; either
21  *  version 2.1 of the License, or (at your option) any later version.
22  *
23  *  This library is distributed in the hope that it will be useful,
24  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  *  Lesser General Public License for more details.
27  *
28  *  You should have received a copy of the GNU Lesser General Public
29  *  License along with this library; if not, write to the Free Software
30  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
31  *  
32  * =========================================================================
33  * NOTES
34  * 
35  * This is the Level 2 Views definition, which is very minimalist.  It is
36  * described here:
37  * http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113
38  * 
39  * Note that SVG uses the DOM Core and Events Level 3, but Level 2 CSS and Views.         
40  * 
41  * The level 3 version is much larger:
42  * http://www.w3.org/TR/2004/NOTE-DOM-Level-3-Views-20040226
43  * Be prepared in the future to adjust to this, if SVG ever switches .
44  */
48 #include "dom.h"
52 namespace org
53 {
54 namespace w3c
55 {
56 namespace dom
57 {
58 namespace views
59 {
62 //local aliases
63 typedef dom::Node Node;
64 typedef dom::DOMString DOMString;
66 //forward declarations
67 class DocumentView;
68 class AbstractView;
72 /*#########################################################################
73 ## AbstractView
74 #########################################################################*/
76 /**
77  * A base interface that all views shall derive from.
78  */
79 class AbstractView
80 {
81 public:
83     /**
84      * The source DocumentView of which this is an AbstractView.
85      */
86     virtual DocumentView *getDocument()
87         {
88         return documentView;
89                 }
91     //##################
92     //# Non-API methods
93     //##################
95     /**
96      *
97      */
98     AbstractView()
99             { documentView = NULL; }
101     /**
102      *
103      */
104     AbstractView(const AbstractView &other)
105         {
106         assign(other);
107         }
109     /**
110      *
111      */
112     AbstractView &operator=(const AbstractView &other)
113         {
114         assign(other);
115         return *this;
116         }
118     /**
119      *
120      */
121     virtual ~AbstractView() {}
123 private:
125     void assign(const AbstractView &other)
126         {
127         documentView = other.documentView;
128                 }
130         DocumentView *documentView;
131                 
132 };
135 /*#########################################################################
136 ## DocumentView
137 #########################################################################*/
140 /**
141  * The DocumentView interface is implemented by Document objects in DOM 
142  * implementations supporting DOM Views. It provides an attribute to retrieve the 
143  * default view of a document.
144  */
145 class DocumentView
147 public:
149     /**
150      * The default AbstractView for this Document, or null if none available.
151      */
152     virtual AbstractView *getDefaultView()
153         {
154                 return defaultView;
155                 }
157     //##################
158     //# Non-API methods
159     //##################
161     /**
162      *
163      */
164     DocumentView() {}
166     /**
167      *
168      */
169     DocumentView(const DocumentView &other)
170         {
171         assign(other);
172         }
174     /**
175      *
176      */
177     DocumentView &operator=(const DocumentView &other)
178         {
179         assign(other);
180         return *this;
181         }
183     /**
184      *
185      */
186     virtual ~DocumentView() {}
188 private:
190     void assign(const DocumentView &other)
191         {
192         defaultView = other.defaultView;
193                 }
195     AbstractView *defaultView;
196                 
197 };
204 }  //namespace views
205 }  //namespace dom
206 }  //namespace w3c
207 }  //namespace org
210 #endif  /* __VIEWS_H__ */
211 /*#########################################################################
212 ## E N D    O F    F I L E
213 #########################################################################*/