2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: Renderer.h /main/3 1996/06/11 17:08:07 cde-hal $ */
29 #include "Exceptions.hh"
31 /* **************************************************************
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 ************************************************************** */
39 /* **************************************************************
40 The symbol table supplied is common to the Node Parser,
41 Style Sheet parser and the Renderer.
42 * ************************************************************** */
46 class Renderer : public Destructable
50 virtual ~Renderer() {};
52 virtual FeatureSet *initialize() = 0; /* return default feature set */
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 * ************************************************************ */
61 /* returns a non-zero value if element is to be ignored */
64 BeginElement(const Element &element,
65 const FeatureSet &featureset,
66 const FeatureSet &complete,
67 const FeatureSet &parentComplete) = 0;
70 /* -------- Data -------- */
71 /* ************************************************************
72 * ELEMENT data passed in (usually text to be displayed)
73 * embedded ELEMENT children are passed in with BeginElement...
74 * ************************************************************ */
77 data(const char *data, unsigned int size) = 0;
80 /* -------- End Element -------- */
81 /* ************************************************************
82 * End of ELEMENT processing (eg. postfixes, reset pointers etc.)
83 * ************************************************************ */
86 EndElement(const Symbol &element_name) = 0 ;
88 /* ************************************************************
89 * Called BEFORE any data processing begins
90 * ************************************************************ */
92 virtual void Begin() = 0;
94 /* **************************************************************
95 * called after all data has been processed
96 * ************************************************************** */
98 virtual void End() = 0;
101 // These two functions allow a renderer to set up internal variable table.
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.
108 * non zero return value means that it has been entered into the internal
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 ;}
116 /* ************************************************************
118 * evaluate the variable to a FeatureValue
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 ; }
125 /* **************************************************************
126 * notifies renderer that the local feature set will be evaluated.
127 * ************************************************************** */
128 virtual void preEvaluate(const Element &) {}
130 /* **************************************************************
131 * notifies renderer that the local feature set has been evaluated.
132 * ************************************************************** */
133 virtual void postEvaluate(const Element &) {}