Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / StyleSheet / Renderer.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: Renderer.h /main/3 1996/06/11 17:08:07 cde-hal $ */
24
25 #ifndef _Renderer_h
26 #define _Renderer_h 1
27
28 #include "Feature.h"
29 #include "Exceptions.hh"
30
31 /* **************************************************************
32  * class Renderer
33  
34    the Renderer is responsible for taking the style sheet features
35    matched with an ELEMENT and using them to guide the drawing of the
36    ELEMENT data on the page
37    ************************************************************** */
38
39 /* **************************************************************
40    The symbol table supplied is common to the Node Parser,
41    Style Sheet parser and the Renderer.
42  * ************************************************************** */
43
44 //class FeatureSet;
45
46 class Renderer : public Destructable
47 {
48 public:
49   Renderer() {};
50   virtual ~Renderer() {};
51
52   virtual FeatureSet *initialize() = 0; /* return default feature set */
53
54   /* -------- Begin Element -------- */
55   /* ************************************************************
56    * called when a new ELEMENT is found in the document
57    * FeatureSet is set of features and values that match with the
58    * ELEMENT as described in the style sheet 
59    * ************************************************************ */
60
61   /* returns a non-zero value if element is to be ignored */
62
63   virtual unsigned int
64     BeginElement(const Element       &element,
65                  const FeatureSet    &featureset,
66                  const FeatureSet    &complete,
67                  const FeatureSet    &parentComplete) = 0;
68
69
70   /* -------- Data -------- */
71   /* ************************************************************
72    * ELEMENT data passed in (usually text to be displayed)
73    * embedded ELEMENT children are passed in with BeginElement...
74    * ************************************************************ */
75
76   virtual void
77     data(const char *data, unsigned int size) = 0;
78
79
80   /* -------- End Element -------- */
81   /* ************************************************************
82    * End of ELEMENT processing (eg. postfixes, reset pointers etc.)
83    * ************************************************************ */
84
85   virtual void
86     EndElement(const Symbol &element_name) = 0 ;
87
88   /* ************************************************************
89    * Called BEFORE any data processing begins
90    * ************************************************************ */
91
92   virtual void Begin() = 0;
93
94 /* **************************************************************
95  * called after all data has been processed
96  * ************************************************************** */
97
98   virtual void End() = 0;
99
100
101   // These two functions allow a renderer to set up internal variable table.
102  
103 /* **************************************************************
104  * pass a variable and a Expression to the renderer and let it decide
105  * whether to accept the variable and the Expression and put them into
106  * the internal variable table.
107  *
108  * non zero return value means that it has been entered into the internal
109  * table 
110  *
111  * If gRenderer is set to null while style sheet is parsed, the 
112  * accept() function will not be called from style.y.
113  * ************************************************************** */
114   virtual unsigned int accept(const char*, const Expression*) { return 0 ;}
115
116   /* ************************************************************
117    *
118    * evaluate the variable to a FeatureValue
119    *
120    * If gRenderer is set to null while the renderer is running, the 
121    * evaluate() function will not be called. 
122    * ************************************************************ */
123   virtual FeatureValue* evaluate(const char*) { return 0 ; }
124
125 /* **************************************************************
126  * notifies renderer that the local feature set will be evaluated.
127  * ************************************************************** */
128   virtual void preEvaluate(const Element &) {}
129
130 /* **************************************************************
131  * notifies renderer that the local feature set has been evaluated.
132  * ************************************************************** */
133   virtual void postEvaluate(const Element &) {}
134
135
136 protected:
137 };
138
139 #endif
140