1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet
3    version="1.0"
4    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5    xmlns:rng="http://relaxng.org/ns/structure/1.0"
6    xmlns:xalan="http://xml.apache.org/xalan"
7    exclude-result-prefixes = "xalan"
8    xml:indent="true">
9  <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
10
11  <xsl:template match="/">
12    <xsl:for-each select="/model/class">
13      <xsl:choose>
14	<xsl:when test="$filetype='inc'">
15	  <xsl:call-template name="incfile"/>
16	</xsl:when>
17	<xsl:when test="$filetype='impl'">
18	  <xsl:call-template name="implfile"/>
19	</xsl:when>
20      </xsl:choose>
21    </xsl:for-each>
22  </xsl:template>
23
24  <xsl:template name="license">
25    <xsl:text>/**************************************************************
26 *
27 * Licensed to the Apache Software Foundation (ASF) under one
28 * or more contributor license agreements.  See the NOTICE file
29 * distributed with this work for additional information
30 * regarding copyright ownership.  The ASF licenses this file
31 * to you under the Apache License, Version 2.0 (the
32 * "License"); you may not use this file except in compliance
33 * with the License.  You may obtain a copy of the License at
34 *
35 *   http://www.apache.org/licenses/LICENSE-2.0
36 *
37 * Unless required by applicable law or agreed to in writing,
38 * software distributed under the License is distributed on an
39 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40 * KIND, either express or implied.  See the License for the
41 * specific language governing permissions and limitations
42 * under the License.
43 *
44 *************************************************************/&#xa;</xsl:text>
45  </xsl:template>
46
47  <xsl:template name="memberid">
48    <xsl:variable name="member">
49      <xsl:choose>
50	<xsl:when test="@member">
51	  <xsl:value-of select="@member"/>
52	</xsl:when>
53	<xsl:otherwise>
54	  <xsl:value-of select="@name"/>
55	</xsl:otherwise>
56      </xsl:choose>
57    </xsl:variable>
58    <xsl:for-each select="ancestor::class/member[@name=$member]">
59      <xsl:choose>
60	<xsl:when test="@type='bool'">
61	  <xsl:text>m_b</xsl:text>
62	</xsl:when>
63	<xsl:when test="@type='OUString'">
64	  <xsl:text>m_s</xsl:text>
65	</xsl:when>
66	<xsl:when test="@type='sal_uInt32'">
67	  <xsl:text>m_n</xsl:text>
68	</xsl:when>
69	<xsl:otherwise>
70	  <xsl:text>m_</xsl:text>
71	</xsl:otherwise>
72      </xsl:choose>
73    </xsl:for-each>
74    <xsl:call-template name="capfirst">
75      <xsl:with-param name="string" select="$member"/>
76    </xsl:call-template>
77  </xsl:template>
78
79  <xsl:template name="incfile">
80    <xsl:call-template name="license"/>
81    <xsl:for-each select="//class">
82      <xsl:variable name="includeguard">
83	<xsl:text>INCLUDED_</xsl:text>
84	<xsl:value-of select="@name"/>
85	<xsl:text>_HXX</xsl:text>
86	</xsl:variable>
87	<xsl:text>#ifndef </xsl:text>
88	<xsl:value-of select="$includeguard"/>
89	<xsl:text>&#xa;#define </xsl:text>
90	<xsl:value-of select="$includeguard"/>
91	<xsl:text>&#xa;#include &lt;resourcemodel/WW8ResourceModel.hxx></xsl:text>
92	<xsl:text>&#xa;#include &lt;rtl/ustring.hxx></xsl:text>
93	<xsl:text>&#xa;namespace writerfilter {</xsl:text>
94	<xsl:text>&#xa;namespace dmapper {</xsl:text>
95	<xsl:call-template name="classdecl"/>
96	<xsl:text>&#xa;}}</xsl:text>
97	<xsl:text>&#xa;#endif //</xsl:text>
98	<xsl:value-of select="$includeguard"/>
99	<xsl:text>&#xa;</xsl:text>
100    </xsl:for-each>
101  </xsl:template>
102
103  <xsl:template name="implfile">
104    <xsl:call-template name="license"/>
105    <xsl:for-each select="//class">
106      <xsl:text>#include "</xsl:text>
107      <xsl:value-of select="@name"/>
108      <xsl:text>.hxx"&#xa;</xsl:text>
109      <xsl:text>&#xa;#include &lt;ooxml/resourceids.hxx></xsl:text>
110      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
111      <xsl:text>&#xa;#include &lt;resourcemodel/QNameToString.hxx></xsl:text>
112      <xsl:text>&#xa;#include "dmapperLoggers.hxx"</xsl:text>
113      <xsl:text>&#xa;#endif</xsl:text>
114      <xsl:text>&#xa;namespace writerfilter {</xsl:text>
115      <xsl:text>&#xa;namespace dmapper {&#xa;</xsl:text>
116      <xsl:call-template name="classimpl"/>
117      <xsl:text>}}&#xa;</xsl:text>
118    </xsl:for-each>
119  </xsl:template>
120
121  <xsl:template name="classdecl">
122    <xsl:text>&#xa;class </xsl:text>
123    <xsl:value-of select="@name"/>
124    <xsl:if test="parent">
125      <xsl:text> : public </xsl:text>
126    </xsl:if>
127    <xsl:for-each select="parent">
128      <xsl:if test="position() > 1">
129	<xsl:text>, </xsl:text>
130      </xsl:if>
131      <xsl:value-of select="@name"/>
132    </xsl:for-each>
133    <xsl:text>&#xa;{</xsl:text>
134    <xsl:text>&#xa;public:</xsl:text>
135    <xsl:call-template name="typedefs"/>
136    <xsl:text>&#xa;    // constructor</xsl:text>
137    <xsl:text>&#xa;    </xsl:text>
138    <xsl:value-of select="@name"/>
139    <xsl:text>();</xsl:text>
140    <xsl:text>&#xa;    // destructor</xsl:text>
141    <xsl:text>&#xa;    virtual ~</xsl:text>
142    <xsl:value-of select="@name"/>
143    <xsl:text>();&#xa;</xsl:text>
144    <xsl:call-template name="memberfuncdecls"/>
145    <xsl:for-each select="sprm">
146      <xsl:text>&#xa;    // sprm</xsl:text>
147      <xsl:text>&#xa;    void sprm(Sprm &amp; r_sprm);</xsl:text>
148      <xsl:text>&#xa;    void resolveSprm(Sprm &amp; r_sprm);&#xa;</xsl:text>
149    </xsl:for-each>
150    <xsl:for-each select="attribute">
151      <xsl:text>&#xa;    // attribute</xsl:text>
152      <xsl:text>&#xa;    void attribute(Id name, Value &amp; val);&#xa;</xsl:text>
153    </xsl:for-each>
154    <xsl:text>&#xa;private:</xsl:text>
155    <xsl:call-template name="memberdecls"/>
156    <xsl:text>&#xa;};&#xa;&#xa;</xsl:text>
157  </xsl:template>
158
159  <xsl:template name="type">
160    <xsl:param name="name"/>
161    <xsl:choose>
162      <xsl:when test="$name='OUString'">
163	<xsl:text>::rtl::OUString</xsl:text>
164      </xsl:when>
165      <xsl:otherwise>
166	<xsl:value-of select="$name"/>
167      </xsl:otherwise>
168    </xsl:choose>
169  </xsl:template>
170
171  <xsl:template name="typedefs">
172    <xsl:text>&#xa;    // typedefs</xsl:text>
173    <xsl:for-each select="typedef">
174      <xsl:text>&#xa;    typedef </xsl:text>
175      <xsl:choose>
176	<xsl:when test="@type = 'shared_ptr'">
177	  <xsl:text>::boost::shared_ptr&lt;</xsl:text>
178	  <xsl:value-of select="ancestor::class/@name"/>
179	  <xsl:text>&gt;</xsl:text>
180	</xsl:when>
181	<xsl:otherwise>
182	</xsl:otherwise>
183      </xsl:choose>
184      <xsl:for-each select="vector">
185	<xsl:text>::std::vector&lt;</xsl:text>
186	<xsl:call-template name="cctype"/>
187	<xsl:text>&gt;</xsl:text>
188      </xsl:for-each>
189      <xsl:text> </xsl:text>
190      <xsl:value-of select="@name"/>
191      <xsl:text>;</xsl:text>
192    </xsl:for-each>
193    <xsl:text>&#xa;</xsl:text>
194  </xsl:template>
195
196  <xsl:template name="settername">
197    <xsl:text>set</xsl:text>
198    <xsl:call-template name="capfirst">
199      <xsl:with-param name="string" select="@name"/>
200    </xsl:call-template>
201  </xsl:template>
202
203  <xsl:template name="gettername">
204    <xsl:text>get</xsl:text>
205    <xsl:call-template name="capfirst">
206      <xsl:with-param name="string" select="@name"/>
207    </xsl:call-template>
208  </xsl:template>
209
210  <xsl:template name="pushbackname">
211    <xsl:value-of select="@name"/>
212    <xsl:text>PushBack</xsl:text>
213  </xsl:template>
214
215  <xsl:template name="settersig">
216    <xsl:param name="classname"/>
217    <xsl:variable name="impl">
218      <xsl:if test="string-length($classname) > 0">
219	<xsl:text>true</xsl:text>
220      </xsl:if>
221    </xsl:variable>
222    <xsl:text>void </xsl:text>
223    <xsl:if test="string-length($classname) > 0">
224      <xsl:value-of select="$classname"/>
225      <xsl:text>::</xsl:text>
226    </xsl:if>
227    <xsl:call-template name="settername"/>
228    <xsl:text>(</xsl:text>
229    <xsl:call-template name="constcctyperef">
230      <xsl:with-param name="impl" select="$impl"/>
231    </xsl:call-template>
232    <xsl:text> </xsl:text>
233    <xsl:call-template name="paramname"/>
234    <xsl:text>)</xsl:text>
235  </xsl:template>
236
237  <xsl:template name="gettersig">
238    <xsl:param name="classname"/>
239    <xsl:variable name="impl">
240      <xsl:if test="string-length($classname) > 0">
241	<xsl:text>true</xsl:text>
242      </xsl:if>
243    </xsl:variable>
244    <xsl:variable name="type" select="@type"/>
245    <xsl:call-template name="constcctyperef">
246      <xsl:with-param name="impl" select="$impl"/>
247    </xsl:call-template>
248    <xsl:text> </xsl:text>
249    <xsl:if test="string-length($classname) > 0">
250      <xsl:value-of select="$classname"/>
251      <xsl:text>::</xsl:text>
252    </xsl:if>
253    <xsl:call-template name="gettername"/>
254    <xsl:text>() const</xsl:text>
255  </xsl:template>
256
257  <xsl:template name="pushbacksig">
258    <xsl:param name="classname"/>
259    <xsl:variable name="pushback">
260      <xsl:call-template name="pushbackname"/>
261    </xsl:variable>
262    <xsl:variable name="type" select="@type"/>
263    <xsl:for-each select="ancestor::class/typedef[@name=$type]">
264      <xsl:for-each select="vector">
265	<xsl:text>void </xsl:text>
266	<xsl:if test="string-length($classname) > 0">
267	  <xsl:value-of select="$classname"/>
268	  <xsl:text>::</xsl:text>
269	</xsl:if>
270	<xsl:value-of select="$pushback"/>
271	<xsl:text>(</xsl:text>
272	<xsl:call-template name="constcctyperef">
273	  <xsl:with-param name="deep">true</xsl:with-param>
274	</xsl:call-template>
275	<xsl:text> r_Element</xsl:text>
276	<xsl:text>)</xsl:text>
277      </xsl:for-each>
278    </xsl:for-each>
279  </xsl:template>
280
281  <xsl:template name="memberfuncdecls">
282    <xsl:for-each select="member">
283      <xsl:text>&#xa;    // member: </xsl:text>
284      <xsl:value-of select="@name"/>
285      <xsl:text>&#xa;    </xsl:text>
286      <xsl:call-template name="settersig"/>
287      <xsl:text>;</xsl:text>
288      <xsl:text>&#xa;    </xsl:text>
289      <xsl:call-template name="gettersig"/>
290      <xsl:text>;&#xa;    </xsl:text>
291      <xsl:variable name="pushback">
292	<xsl:call-template name="pushbacksig"/>
293      </xsl:variable>
294      <xsl:if test="string-length($pushback) > 0">
295	<xsl:value-of select="$pushback"/>
296	<xsl:text>;&#xa;</xsl:text>
297      </xsl:if>
298    </xsl:for-each>
299  </xsl:template>
300
301  <xsl:template name="memberdecls">
302    <xsl:for-each select="member">
303      <xsl:text>&#xa;    </xsl:text>
304      <xsl:call-template name="cctype"/>
305      <xsl:text> </xsl:text>
306      <xsl:call-template name="memberid"/>
307      <xsl:text>;</xsl:text>
308    </xsl:for-each>
309  </xsl:template>
310
311  <xsl:template name="cctype">
312    <xsl:param name="deep"/>
313    <xsl:param name="impl"/>
314    <xsl:variable name="type" select="@type"/>
315    <xsl:variable name="try1">
316      <xsl:if test="$deep='true'">
317	<xsl:for-each select="ancestor::class/typedef[@name=$type]">
318	  <xsl:for-each select="vector">
319	    <xsl:call-template name="cctype">
320	      <xsl:with-param name="impl" select="$impl"/>
321	      <xsl:with-param name="deep" select="$deep"/>
322	    </xsl:call-template>
323	  </xsl:for-each>
324	</xsl:for-each>
325      </xsl:if>
326    </xsl:variable>
327    <xsl:choose>
328      <xsl:when test="string-length($try1) > 0">
329	<xsl:value-of select="$try1"/>
330      </xsl:when>
331      <xsl:when test="@type='OUString'">
332	<xsl:text>rtl::OUString</xsl:text>
333      </xsl:when>
334      <xsl:otherwise>
335	<xsl:if test="$impl='true'">
336	  <xsl:for-each select="ancestor::class">
337	    <xsl:variable name="classname" select="@name"/>
338	    <xsl:for-each select="typedef[@name=$type]">
339	      <xsl:value-of select="$classname"/>
340	      <xsl:text>::</xsl:text>
341	    </xsl:for-each>
342	  </xsl:for-each>
343	</xsl:if>
344	<xsl:value-of select="@type"/>
345      </xsl:otherwise>
346    </xsl:choose>
347  </xsl:template>
348
349  <xsl:template name="constcctype">
350    <xsl:param name="impl"/>
351    <xsl:choose>
352      <xsl:when test="@type='bool' or @type='sal_uInt32'">
353	<xsl:value-of select="@type"/>
354      </xsl:when>
355      <xsl:otherwise>
356	<xsl:text>const </xsl:text>
357	<xsl:call-template name="cctype">
358	  <xsl:with-param name="impl" select="$impl"/>
359	</xsl:call-template>
360      </xsl:otherwise>
361    </xsl:choose>
362  </xsl:template>
363
364  <xsl:template name="constcctyperef">
365    <xsl:param name="impl"/>
366    <xsl:choose>
367      <xsl:when test="@type='bool' or @type='sal_uInt32'">
368	<xsl:value-of select="@type"/>
369      </xsl:when>
370      <xsl:otherwise>
371	<xsl:call-template name="constcctype">
372	  <xsl:with-param name="impl" select="$impl"/>
373	</xsl:call-template>
374	<xsl:text> &amp;</xsl:text>
375      </xsl:otherwise>
376    </xsl:choose>
377  </xsl:template>
378
379  <xsl:template name="capfirst">
380    <xsl:param name="string"/>
381    <xsl:variable name="first" select="translate(substring($string, 1,1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
382    <xsl:value-of select="concat($first, substring($string, 2))"/>
383  </xsl:template>
384
385  <xsl:template name="paramname">
386    <xsl:choose>
387      <xsl:when test="@type='OUString'">
388	<xsl:text>r_s</xsl:text>
389	<xsl:call-template name="capfirst">
390	  <xsl:with-param name="string" select="@name"/>
391	</xsl:call-template>
392      </xsl:when>
393      <xsl:otherwise>
394	<xsl:text>r_</xsl:text>
395	<xsl:value-of select="@name"/>
396      </xsl:otherwise>
397    </xsl:choose>
398  </xsl:template>
399
400  <xsl:template name="setterimpl">
401    <xsl:call-template name="settersig">
402      <xsl:with-param name="classname" select="ancestor::class/@name"/>
403    </xsl:call-template>
404    <xsl:text>&#xa;{</xsl:text>
405    <xsl:text>&#xa;    </xsl:text>
406    <xsl:call-template name="memberid"/>
407    <xsl:text> = </xsl:text>
408    <xsl:call-template name="paramname"/>
409    <xsl:text>;</xsl:text>
410    <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
411  </xsl:template>
412
413  <xsl:template name="getterimpl">
414    <xsl:call-template name="gettersig">
415      <xsl:with-param name="classname" select="ancestor::class/@name"/>
416    </xsl:call-template>
417    <xsl:text>&#xa;{</xsl:text>
418    <xsl:text>&#xa;    return </xsl:text>
419    <xsl:call-template name="memberid"/>
420    <xsl:text>;</xsl:text>
421    <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
422  </xsl:template>
423
424  <xsl:template name="pushbackimpl">
425    <xsl:variable name="sig">
426      <xsl:call-template name="pushbacksig">
427	<xsl:with-param name="classname" select="ancestor::class/@name"/>
428      </xsl:call-template>
429    </xsl:variable>
430    <xsl:if test="string-length($sig) > 0">
431      <xsl:value-of select="$sig"/>
432      <xsl:text>&#xa;{</xsl:text>
433      <xsl:text>&#xa;    </xsl:text>
434      <xsl:call-template name="memberid"/>
435      <xsl:text>.push_back(r_Element);</xsl:text>
436      <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
437    </xsl:if>
438  </xsl:template>
439
440  <xsl:template name="getvalue">
441    <xsl:param name="valuePrefix"/>
442    <xsl:choose>
443      <xsl:when test="@type='OUString'">
444	<xsl:value-of select="$valuePrefix"/>
445	<xsl:text>getString()</xsl:text>
446      </xsl:when>
447      <xsl:when test="@type='bool' or @type='sal_uInt32'">
448	<xsl:value-of select="$valuePrefix"/>
449	<xsl:text>getInt()</xsl:text>
450      </xsl:when>
451      <xsl:when test="@type">
452	<xsl:variable name="type" select="@type"/>
453	<xsl:for-each select="ancestor::class/typedef[@name=$type]">
454	  <xsl:call-template name="getvalue">
455	    <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
456	  </xsl:call-template>
457	</xsl:for-each>
458      </xsl:when>
459      <xsl:otherwise>
460	<xsl:variable name="member">
461	  <xsl:choose>
462	    <xsl:when test="@member">
463	      <xsl:value-of select="@member"/>
464	    </xsl:when>
465	    <xsl:otherwise>
466	      <xsl:value-of select="@name"/>
467	    </xsl:otherwise>
468	  </xsl:choose>
469	</xsl:variable>
470	<xsl:for-each select="ancestor::class/member[@name=$member]">
471	  <xsl:call-template name="getvalue">
472	    <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
473	  </xsl:call-template>
474	</xsl:for-each>
475      </xsl:otherwise>
476    </xsl:choose>
477    <xsl:for-each select="vector">
478      <xsl:call-template name="getvalue">
479	<xsl:with-param name="valuePrefix" select="$valuePrefix"/>
480      </xsl:call-template>
481    </xsl:for-each>
482  </xsl:template>
483
484  <xsl:template name="sprmactionset">
485    <xsl:param name="valuePrefix"/>
486    <xsl:text>&#xa;        {</xsl:text>
487    <xsl:text>&#xa;            </xsl:text>
488    <xsl:call-template name="memberid"/>
489    <xsl:text> = </xsl:text>
490    <xsl:call-template name="getvalue">
491      <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
492    </xsl:call-template>
493    <xsl:text>;&#xa;        }</xsl:text>
494  </xsl:template>
495
496  <xsl:template name="sprmactionpushback">
497    <xsl:param name="valuePrefix"/>
498    <xsl:text>&#xa;        {</xsl:text>
499    <xsl:text>&#xa;            </xsl:text>
500    <xsl:call-template name="memberid"/>
501    <xsl:text>.push_back(</xsl:text>
502    <xsl:call-template name="getvalue">
503      <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
504    </xsl:call-template>
505    <xsl:text>);</xsl:text>
506    <xsl:text>;&#xa;        }</xsl:text>
507  </xsl:template>
508
509  <xsl:template name="sprmactionresolve">
510    <xsl:text>&#xa;        {</xsl:text>
511    <xsl:text>&#xa;            resolveSprm(r_Sprm);</xsl:text>
512    <xsl:text>&#xa;        }</xsl:text>
513  </xsl:template>
514
515  <xsl:template name="sprmaction">
516    <xsl:param name="valuePrefix"/>
517    <xsl:choose>
518      <xsl:when test="@action='set'">
519	<xsl:call-template name="sprmactionset">
520	  <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
521	</xsl:call-template>
522      </xsl:when>
523      <xsl:when test="@action='pushback'">
524	<xsl:call-template name="sprmactionpushback">
525	  <xsl:with-param name="valuePrefix" select="$valuePrefix"/>
526	</xsl:call-template>
527      </xsl:when>
528      <xsl:when test="@action='resolve'">
529	<xsl:call-template name="sprmactionresolve"/>
530      </xsl:when>
531      <xsl:otherwise/>
532    </xsl:choose>
533  </xsl:template>
534
535  <xsl:template name="sprmimpl">
536    <xsl:for-each select="sprm">
537      <xsl:text>&#xa;void </xsl:text>
538      <xsl:variable name="classname" select="ancestor::class/@name"/>
539      <xsl:value-of select="$classname"/>
540      <xsl:text>::sprm(Sprm &amp; r_Sprm)</xsl:text>
541      <xsl:text>&#xa;{</xsl:text>
542      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
543      <xsl:text>&#xa;    dmapper_logger->startElement("</xsl:text>
544      <xsl:value-of select="$classname"/>
545      <xsl:text>.sprm");</xsl:text>
546      <xsl:text>&#xa;    dmapper_logger->chars(r_Sprm.toString());</xsl:text>
547      <xsl:text>&#xa;#endif</xsl:text>
548      <xsl:text>&#xa;    switch(r_Sprm.getId())</xsl:text>
549      <xsl:text>&#xa;    {</xsl:text>
550      <xsl:for-each select="element">
551	<xsl:text>&#xa;    case </xsl:text>
552	<xsl:value-of select="@id"/>
553	<xsl:text>:</xsl:text>
554	<xsl:text>&#xa;    /* WRITERFILTERSTATUS done: 100, planned: 2, spent: 0 */</xsl:text>
555	<xsl:call-template name="sprmaction">
556	  <xsl:with-param name="valuePrefix">r_Sprm.getValue()-&gt;</xsl:with-param>
557	</xsl:call-template>
558	<xsl:text>&#xa;        break;</xsl:text>
559      </xsl:for-each>
560      <xsl:text>&#xa;    default:</xsl:text>
561      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
562      <xsl:text>&#xa;        dmapper_logger->element("unhandled");</xsl:text>
563      <xsl:text>&#xa;#endif DEBUG_DOMAINMAPPER</xsl:text>
564      <xsl:text>&#xa;        break;</xsl:text>
565      <xsl:text>&#xa;    }</xsl:text>
566      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
567      <xsl:text>&#xa;    dmapper_logger->endElement("</xsl:text>
568      <xsl:value-of select="$classname"/>
569      <xsl:text>.sprm");</xsl:text>
570      <xsl:text>&#xa;#endif</xsl:text>
571      <xsl:text>&#xa;}&#xa;</xsl:text>
572      <xsl:text>&#xa;void </xsl:text>
573      <xsl:value-of select="ancestor::class/@name"/>
574      <xsl:text>::resolveSprm(Sprm &amp; r_Sprm)</xsl:text>
575      <xsl:text>&#xa;{</xsl:text>
576      <xsl:text>&#xa;    writerfilter::Reference&lt;Properties&gt;::Pointer_t pProperties = r_Sprm.getProps();</xsl:text>
577      <xsl:text>&#xa;    if( pProperties.get())</xsl:text>
578      <xsl:text>&#xa;        pProperties->resolve(*this);</xsl:text>
579      <xsl:text>&#xa;}&#xa;</xsl:text>
580    </xsl:for-each>
581  </xsl:template>
582
583  <xsl:template name="attrimpl">
584    <xsl:for-each select="attribute">
585      <xsl:text>&#xa;void </xsl:text>
586      <xsl:variable name="classname" select="ancestor::class/@name"/>
587      <xsl:value-of select="$classname"/>
588      <xsl:text>::</xsl:text>
589      <xsl:text>attribute(Id name, Value &amp; val)</xsl:text>
590      <xsl:text>&#xa;{</xsl:text>
591      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
592      <xsl:text>&#xa;    dmapper_logger->startElement("</xsl:text>
593      <xsl:value-of select="$classname"/>
594      <xsl:text>.attribute");</xsl:text>
595      <xsl:text>&#xa;    dmapper_logger->attribute("name", (*QNameToString::Instance())(name));</xsl:text>
596      <xsl:text>&#xa;    dmapper_logger->attribute("value", val.toString());</xsl:text>
597      <xsl:text>&#xa;    dmapper_logger->endElement("</xsl:text>
598      <xsl:value-of select="$classname"/>
599      <xsl:text>.attribute");</xsl:text>
600      <xsl:text>&#xa;#endif</xsl:text>
601      <xsl:text>&#xa;    switch (name)</xsl:text>
602      <xsl:text>&#xa;    {</xsl:text>
603      <xsl:for-each select="attribute">
604	<xsl:text>&#xa;    case </xsl:text>
605	<xsl:value-of select="@id"/>
606	<xsl:text>:</xsl:text>
607	<xsl:text>&#xa;    /* WRITERFILTERSTATUS done: 100, planned: 2, spent: 0 */</xsl:text>
608	<xsl:call-template name="sprmactionset">
609	  <xsl:with-param name="valuePrefix">val.</xsl:with-param>
610	</xsl:call-template>
611	<xsl:text>&#xa;        break;</xsl:text>
612      </xsl:for-each>
613      <xsl:text>&#xa;    default:</xsl:text>
614      <xsl:text>&#xa;#ifdef DEBUG_DOMAINMAPPER</xsl:text>
615      <xsl:text>&#xa;        dmapper_logger->element("unhandled");</xsl:text>
616      <xsl:text>&#xa;#endif DEBUG_DOMAINMAPPER</xsl:text>
617      <xsl:text>&#xa;        break;</xsl:text>
618      <xsl:text>&#xa;    }</xsl:text>
619      <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
620    </xsl:for-each>
621  </xsl:template>
622
623  <xsl:template name="constructorimpl">
624    <xsl:text>&#xa;</xsl:text>
625    <xsl:value-of select="@name"/>
626    <xsl:text>::</xsl:text>
627    <xsl:value-of select="@name"/>
628    <xsl:text>()</xsl:text>
629    <xsl:variable name="memberinits">
630      <xsl:for-each select="member[@type='sal_uInt32' or @type='bool']">
631	<xsl:if test="position() > 1">
632	  <xsl:text>,</xsl:text>
633	  <xsl:text>&#xa;  </xsl:text>
634	</xsl:if>
635	<xsl:call-template name="memberid"/>
636	<xsl:choose>
637	  <xsl:when test="@type='sal_uInt32'">
638	    <xsl:text>(0)</xsl:text>
639	  </xsl:when>
640	  <xsl:when test="@type='bool'">
641	    <xsl:text>(false)</xsl:text>
642	  </xsl:when>
643	</xsl:choose>
644      </xsl:for-each>
645    </xsl:variable>
646    <xsl:if test="string-length($memberinits) > 0">
647      <xsl:text>&#xa;: </xsl:text>
648      <xsl:value-of select="$memberinits"/>
649    </xsl:if>
650    <xsl:text>&#xa;{</xsl:text>
651    <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
652  </xsl:template>
653
654  <xsl:template name="destructorimpl">
655    <xsl:text>&#xa;</xsl:text>
656    <xsl:value-of select="@name"/>
657    <xsl:text>::~</xsl:text>
658    <xsl:value-of select="@name"/>
659    <xsl:text>()</xsl:text>
660    <xsl:text>&#xa;{</xsl:text>
661    <xsl:text>&#xa;}&#xa;&#xa;</xsl:text>
662  </xsl:template>
663
664  <xsl:template name="classimpl">
665    <xsl:variable name="classname" select="@name"/>
666    <xsl:variable name="comment">
667      <xsl:text>class: </xsl:text>
668      <xsl:value-of select="$classname"/>
669    </xsl:variable>
670    <xsl:variable name="commentfill">
671      <xsl:value-of select="translate($comment, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ: ',
672			                        '******************************************************')"/>
673    </xsl:variable>
674    <xsl:text>&#xa;/***</xsl:text>
675    <xsl:value-of select="$commentfill"/>
676    <xsl:text>*</xsl:text>
677    <xsl:text>&#xa; * </xsl:text>
678    <xsl:value-of select="$comment"/>
679    <xsl:text> *</xsl:text>
680    <xsl:text>&#xa; **</xsl:text>
681    <xsl:value-of select="$commentfill"/>
682    <xsl:text>**/&#xa;</xsl:text>
683    <xsl:call-template name="constructorimpl"/>
684    <xsl:call-template name="destructorimpl"/>
685    <xsl:for-each select="member">
686      <xsl:text>// member: </xsl:text>
687      <xsl:value-of select="$classname"/>
688      <xsl:text>::</xsl:text>
689      <xsl:value-of select="@name"/>
690      <xsl:text>&#xa;</xsl:text>
691      <xsl:call-template name="setterimpl"/>
692      <xsl:call-template name="getterimpl"/>
693      <xsl:call-template name="pushbackimpl"/>
694    </xsl:for-each>
695    <xsl:call-template name="sprmimpl"/>
696    <xsl:call-template name="attrimpl"/>
697  </xsl:template>
698</xsl:stylesheet>
699