1<!--***********************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 ***********************************************************-->
21
22
23<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
24                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:space="default">
25  <xsl:output method="text" />
26
27  <xsl:template match="/">
28    <out xml:space="preserve">
29      <xsl:text>
30/**************************************************************
31 *
32 * Licensed to the Apache Software Foundation (ASF) under one
33 * or more contributor license agreements.  See the NOTICE file
34 * distributed with this work for additional information
35 * regarding copyright ownership.  The ASF licenses this file
36 * to you under the Apache License, Version 2.0 (the
37 * "License"); you may not use this file except in compliance
38 * with the License.  You may obtain a copy of the License at
39 *
40 *   http://www.apache.org/licenses/LICENSE-2.0
41 *
42 * Unless required by applicable law or agreed to in writing,
43 * software distributed under the License is distributed on an
44 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
45 * KIND, either express or implied.  See the License for the
46 * specific language governing permissions and limitations
47 * under the License.
48 *
49 *************************************************************/
50/*
51
52  THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT!
53
54*/
55#ifndef INCLUDED_RESOURCES_HXX
56#define INCLUDED_RESOURCES_HXX
57
58#include &lt;vector&gt;
59#include &lt;boost/shared_ptr.hpp&gt;
60
61#ifndef INCLUDED_OUTPUT_WITH_DEPTH_HXX
62#include &lt;resourcemodel/OutputWithDepth.hxx&gt;
63#endif
64
65#ifndef INCLUDED_RESOURCESIDS_HXX
66#include &lt;doctok/resourceids.hxx&gt;
67#endif
68
69#ifndef INCLUDED_WW8_STRUCT_BASE_HXX
70#include &lt;WW8StructBase.hxx&gt;
71#endif
72
73#ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
74#include &lt;WW8ResourceModelImpl.hxx&gt;
75#endif
76
77#ifndef INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
78#include &lt;WW8PropertySetImpl.hxx&gt;
79#endif
80
81#ifndef INCLUDED_DFF_HXX
82#include &lt;Dff.hxx&gt;
83#endif
84
85namespace writerfilter {
86namespace doctok {
87
88class WW8DocumentImpl;
89typedef const WW8DocumentImpl * WW8DocumentImplPointer;
90
91using namespace ::std;&#xa;</xsl:text>
92      <xsl:apply-templates select="//UML:Class" mode="class"/>
93      <xsl:text>
94rtl::OUString getDffOptName(sal_uInt32 nPid);
95bool isBooleanDffOpt(sal_uInt32 nId);
96}}
97#endif // INCLUDED_RESOURCES_HXX&#xa;</xsl:text></out>
98</xsl:template>
99
100  <xsl:template match="UML:Class" mode="class">
101    <xsl:choose>
102      <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8resource"]'>
103        <xsl:apply-templates select="." mode="ww8resource"/>
104      </xsl:when>
105      <xsl:when test='.//UML:Stereotype[@xmi.idref = "dffrecord"]'>
106        <xsl:apply-templates select="." mode="dffrecord"/>
107      </xsl:when>
108      <xsl:when test='.//UML:Stereotype[@xmi.idref = "dffopt"]'>
109        <xsl:apply-templates select="." mode="dffopt"/>
110      </xsl:when>
111    </xsl:choose>
112  </xsl:template>
113
114  <xsl:template match="UML:Class" mode="ww8resource">
115    <xsl:variable name="parentresource">
116      <xsl:call-template name='parenttype'>
117        <xsl:with-param name='type'><xsl:value-of select='@xmi.id'/></xsl:with-param>
118      </xsl:call-template>
119    </xsl:variable>
120    <xsl:variable name='size_'><xsl:value-of select='./*/UML:TaggedValue[./*/UML:TagDefinition/@xmi.idref="size"]/UML:TaggedValue.dataValue'/></xsl:variable>
121    <xsl:variable name='size'>
122      <xsl:choose>
123        <xsl:when test='$size_ != ""'><xsl:value-of select='$size_'/></xsl:when>
124        <xsl:otherwise>0</xsl:otherwise>
125      </xsl:choose>
126    </xsl:variable>
127    <xsl:variable name="classname">WW8<xsl:value-of select="@name"/></xsl:variable>
128    <xsl:variable name="superclass">
129      <xsl:choose>
130        <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8sprm"]'>WW8PropertyImpl</xsl:when>
131        <xsl:otherwise>WW8StructBase</xsl:otherwise>
132      </xsl:choose>
133    </xsl:variable>
134    <xsl:variable name="surroundclass">
135      <xsl:choose>
136        <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8sprm"]'>WW8PropertyImpl</xsl:when>
137        <xsl:otherwise>WW8StructBase</xsl:otherwise>
138      </xsl:choose>
139    </xsl:variable>
140    <xsl:text>
141/**
142    Automatically generated class: </xsl:text><xsl:value-of select="@name"/><xsl:text>
143    </xsl:text>
144    <xsl:for-each select='./UML:ModelElement.stereotype/UML:Stereotype'>
145      <xsl:text>
146    Stereotype </xsl:text>
147      <xsl:value-of select='@xmi.idref'/>
148      <xsl:text>&#xa;</xsl:text>
149    </xsl:for-each>
150    <xsl:text>
151    Parent Resource: </xsl:text>
152    <xsl:value-of select="$parentresource"/>
153    <xsl:text>
154    Size: </xsl:text><xsl:value-of select='$size'/>
155    <xsl:text>
156*/
157class </xsl:text>
158    <xsl:value-of select="$classname"/>
159    <xsl:text>: public </xsl:text>
160    <xsl:value-of select='$superclass'/>
161    <xsl:if test='$parentresource != ""'>
162      <xsl:text>, public writerfilter::Reference&lt; </xsl:text>
163      <xsl:value-of select='$parentresource'/>
164      <xsl:text>&gt;</xsl:text>
165    </xsl:if>
166    <xsl:text>
167{</xsl:text>
168    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
169     <xsl:text>    sal_uInt32 mnIndex;</xsl:text>
170    </xsl:if>
171    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withmembers"]'>
172      <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
173        <xsl:apply-templates select='.' mode='declmembers'/>
174      </xsl:for-each>
175    </xsl:if>
176    <xsl:if test='.//UML:Stereotype[@xmi.idref ="needsdocument"]'>
177      <xsl:text>    WW8DocumentImplPointer mpDoc;&#xa;</xsl:text>
178    </xsl:if>
179    <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
180      <xsl:text>
181    sal_uInt32 mnPlcfPayloadOffset;
182    vector&lt;sal_uInt32&gt; entryOffsets;
183    vector&lt;sal_uInt32&gt; payloadOffsets;
184    vector&lt;sal_uInt32&gt; payloadIndices;
185      </xsl:text>
186    </xsl:if>
187    <xsl:text>
188    public:
189    typedef boost::shared_ptr&lt;</xsl:text>
190    <xsl:value-of select='$classname'/>
191    <xsl:text>&gt; Pointer_t;
192
193    </xsl:text>
194    <xsl:value-of select="$classname"/>
195    <xsl:text>(
196        WW8Stream &amp; rStream,
197        sal_uInt32 nOffset = 0,
198        sal_uInt32 nCount = </xsl:text>
199    <xsl:value-of select='$size'/>
200    <xsl:text>)
201    : </xsl:text><xsl:value-of select='$superclass'/>
202    <xsl:text>(rStream, nOffset, nCount)</xsl:text>
203    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
204      <xsl:text>, mnIndex(0)</xsl:text>
205    </xsl:if>
206    <xsl:text>
207    {
208      init();
209    }
210    </xsl:text>
211    <xsl:value-of select="$classname"/>
212    <xsl:text>(
213        WW8StructBase * pParent,
214        sal_uInt32 nOffset = 0,
215        sal_uInt32 nCount = </xsl:text>
216        <xsl:value-of select='$size'/>
217        <xsl:text>)
218    : </xsl:text>
219    <xsl:value-of select='$superclass'/>
220    <xsl:text>(pParent, nOffset, nCount)</xsl:text>
221    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
222      <xsl:text>, mnIndex(0)</xsl:text>
223    </xsl:if>
224    <xsl:text>
225    {
226      init();
227    }&#xa;    </xsl:text>
228    <xsl:value-of select="$classname"/>
229    <xsl:text>( const </xsl:text>
230    <xsl:value-of select='$surroundclass'/>
231    <xsl:text>&amp; rSurround,
232    sal_uInt32 nOffset = 0, sal_uInt32 nCount = </xsl:text>
233    <xsl:value-of select='$size'/>)
234    <xsl:text>
235    : </xsl:text>
236    <xsl:value-of select='$superclass'/>
237    <xsl:text>(rSurround, nOffset, nCount)</xsl:text>
238    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
239      <xsl:text>, mnIndex(0)</xsl:text>
240    </xsl:if>
241    <xsl:text>
242    {
243        init();
244    }&#xa;
245    </xsl:text>
246    <xsl:value-of select="$classname"/>
247    <xsl:text>(
248        const Sequence &amp;
249        rSequence, sal_uInt32 nOffset = 0,
250        sal_uInt32 nCount = </xsl:text>
251        <xsl:value-of select='$size'/>
252        <xsl:text>)
253    : </xsl:text>
254    <xsl:value-of select='$superclass'/>
255    <xsl:text>(rSequence, nOffset, nCount)</xsl:text>
256    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
257      <xsl:text>, mnIndex(0)</xsl:text>
258    </xsl:if>
259    <xsl:text>
260    {
261      init();
262    }
263
264    virtual ~</xsl:text>
265    <xsl:value-of select="$classname"/>
266    <xsl:text>();&#xa;</xsl:text>
267    <xsl:if test='.//UML:Stereotype[@xmi.idref ="initimpl"]'>
268      <xsl:text>    void initImpl();&#xa;</xsl:text>
269    </xsl:if>
270    <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
271      <xsl:text>    void initPayload();</xsl:text>
272    </xsl:if>
273    <xsl:text>
274    void init();
275
276    /**
277        Return type of resource.
278    */
279    virtual string getType() const
280    {
281        return "</xsl:text>
282    <xsl:value-of select="@name"/>
283    <xsl:text>";
284    }
285
286    /**
287        Return static size.
288    */
289    static sal_uInt32 getSize() { return </xsl:text>
290    <xsl:value-of select='$size'/>
291    <xsl:text>; }</xsl:text>
292    <xsl:if test="not(.//UML:Stereotype[@xmi.ref='ww8nocalcsize'])">
293      <xsl:text>
294    /**
295        Calculate actual size.
296    */
297    sal_uInt32 calcSize();
298      </xsl:text>
299    </xsl:if>
300    <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
301      <xsl:text>
302    /**
303        Return offset for entry of PLCF.
304
305        @param nIndex      index of entry
306    */
307    sal_uInt32 getEntryOffset(sal_uInt32 nIndex)
308    {
309        return entryOffsets[nIndex];
310    }</xsl:text>
311    <xsl:if test="not(.//UML:Stereotype[@xmi.idref='ww8nopayloadoffset'])">
312      <xsl:text>
313    /**
314        Calculate offset for payload.
315    */
316    sal_uInt32 calcPayloadOffset();</xsl:text>
317    </xsl:if>
318    <xsl:text>
319    /**
320    Set offset for payloads.
321
322    @param nOffset    the offset to set
323    */
324    void setPayloadOffset(sal_uInt32 nOffset)
325    {
326    mnPlcfPayloadOffset = nOffset;
327    }
328
329    /**
330    Return offset for payload of PLCF.
331
332    @param nIndex      index of entry
333    */
334    sal_uInt32 getPayloadOffset(sal_uInt32 nIndex)
335    {
336    return payloadOffsets[nIndex];
337    }
338
339    /**
340    Return size of payload.
341    */
342    sal_uInt32 getPayloadSize(sal_uInt32 nIndex) const
343    {
344    return payloadOffsets[nIndex + 1] - payloadOffsets[nIndex];
345    }
346
347
348    /**
349    Return payload index of an entry.
350
351    */
352    sal_uInt32 getPayloadIndex(sal_uInt32 nIndex)
353    {
354    return payloadIndices[nIndex];
355    }
356      </xsl:text>
357    </xsl:if>
358    <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
359      <xsl:text>
360    /**
361        Set index in parent.
362
363        @param    nIndex    the index
364    */
365    void setIndex(sal_uInt32 nIndex) { mnIndex = nIndex; }
366      </xsl:text>
367    </xsl:if>
368    <xsl:if test='.//UML:Stereotype[@xmi.idref ="ww8sprm"]'>
369      <xsl:variable name='propsreftype'>writerfilter::Reference &lt; Properties &gt;::Pointer_t</xsl:variable>
370      <xsl:text>    /**
371      Return reference to properties of Sprm.
372    */
373      </xsl:text>
374      <xsl:value-of select='$propsreftype'/>
375      <xsl:text> getProps()
376    {
377        return </xsl:text>
378        <xsl:value-of select='$propsreftype'/>
379        <xsl:text> (new </xsl:text>
380        <xsl:value-of select='$classname'/>
381        <xsl:text>(*this));
382    }
383        </xsl:text>
384    </xsl:if>
385
386    <xsl:if test='.//UML:Stereotype[@xmi.idref ="ww8sprmbinary"]'>
387      <xsl:text>
388        virtual writerfilter::Reference &lt; BinaryObj &gt; ::Pointer_t getBinary();
389      </xsl:text>
390    </xsl:if>
391
392    <xsl:if test='.//UML:Stereotype[@xmi.idref ="needsdocument"]'>
393      <xsl:text>
394    void setDoc(WW8DocumentImplPointer pDoc)
395    {
396        mpDoc = pDoc;
397    }
398      </xsl:text>
399    </xsl:if>
400    <xsl:apply-templates select="." mode="declsProperties"/>
401    <xsl:if test='$parentresource="Table"'>
402      <xsl:apply-templates select="." mode="declsTable"/>
403    </xsl:if>
404    <xsl:choose>
405      <xsl:when test='$parentresource="Properties"'>
406        <xsl:apply-templates select="." mode="resolveProperties"/>
407      </xsl:when>
408      <xsl:when test='$parentresource="Table"'>
409        <xsl:apply-templates select="." mode="resolveTable"/>
410      </xsl:when>
411    </xsl:choose>
412    <xsl:text>
413  };
414    </xsl:text>
415  </xsl:template>
416
417<xsl:template match='UML:Class' mode='declsProperties'>
418  <xsl:choose>
419    <xsl:when test='.//UML:Stereotype[@xmi.idref ="withmembers"]'>
420      <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
421        <xsl:apply-templates select='.' mode='accessmembers'/>
422      </xsl:for-each>
423    </xsl:when>
424    <xsl:otherwise>
425      <xsl:variable name="debug">
426        <xsl:choose>
427          <xsl:when test='.//UML:Stereotype[@xmi.idref="debug"]'>
428            <xsl:text>true</xsl:text>
429          </xsl:when>
430          <xsl:otherwise>
431            <xsl:text>false</xsl:text>
432          </xsl:otherwise>
433        </xsl:choose>
434      </xsl:variable>
435      <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
436        <xsl:apply-templates select='.' mode='access'>
437          <xsl:with-param name="debug">
438            <xsl:value-of select="$debug"/>
439          </xsl:with-param>
440        </xsl:apply-templates>
441      </xsl:for-each>
442    </xsl:otherwise>
443  </xsl:choose>
444  <xsl:for-each select='.//UML:Operation[@name!="reserved"]'>
445    <xsl:apply-templates select='.' mode='declsOperations'/>
446  </xsl:for-each>
447</xsl:template>
448
449<xsl:template match="UML:Class" mode="resolveProperties">
450  <xsl:if test='.//UML:Stereotype[@xmi.idref = "resolvenoauto"]'>
451    void resolveNoAuto(Properties &amp; rHandler);
452  </xsl:if>
453
454  void dump(OutputWithDepth &lt; string &gt; &amp; o) const;
455
456  void resolve(Properties &amp; rHandler);
457</xsl:template>
458
459<xsl:template match="UML:Class" mode="declsTable">
460  sal_uInt32 getEntryCount();
461  writerfilter::Reference&lt; Properties &gt;::Pointer_t getEntry(sal_uInt32 nIndex);
462</xsl:template>
463
464<xsl:template match="UML:Class" mode="resolveTable">
465  void resolve(Table &amp; rHandler);
466</xsl:template>
467
468<xsl:template match="UML:Attribute" mode="access">
469  <xsl:param name="debug"/>
470  <xsl:variable name="stereotype"><xsl:value-of select=".//UML:Stereotype[1]/@xmi.idref"/></xsl:variable>
471  <xsl:variable name="offset_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="offset"]/UML:TaggedValue.dataValue, "ABCDEFX", "abcdefx")'/></xsl:variable>
472  <xsl:variable name="offset">
473    <xsl:value-of select='$offset_'/>
474  </xsl:variable>
475  <xsl:variable name="shift"><xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="shift"]/UML:TaggedValue.dataValue'/></xsl:variable>
476  <xsl:variable name="mask_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="mask"]/UML:TaggedValue.dataValue, "ABCDEFX", "abcdefx")'/></xsl:variable>
477  <xsl:variable name="mask">
478    <xsl:if test='$mask_ != "" and not(starts-with($mask_, "0x"))'>0x</xsl:if>
479    <xsl:value-of select='$mask_'/>
480  </xsl:variable>
481  <xsl:variable name='type'>
482    <xsl:value-of select="UML:StructuralFeature.type/UML:DataType/@xmi.idref"/>
483  </xsl:variable>
484  <xsl:variable name="completetype">
485    <xsl:text>WW8</xsl:text>
486    <xsl:value-of select="$type"/>
487  </xsl:variable>
488  <xsl:variable name="saltype">
489    <xsl:apply-templates select="." mode="returntype"/>
490  </xsl:variable>
491  <xsl:variable name='typetype'>
492    <xsl:call-template name='typetype'>
493      <xsl:with-param name='type'><xsl:value-of select="$type"/></xsl:with-param>
494    </xsl:call-template>
495  </xsl:variable>
496
497    /**
498        <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="comment"]/UML:TaggedValue.dataValue'/>
499
500        &lt;table&gt;
501        &lt;tr&gt;
502        &lt;th&gt;
503        Name
504        &lt;/th&gt;
505        &lt;td&gt;
506        <xsl:value-of select='@name'/>(<xsl:value-of select='$stereotype'/>)
507        &lt;/td&gt;
508        &lt;/tr&gt;
509        &lt;tr&gt;
510        &lt;th&gt;
511        Offset
512        &lt;/th&gt;
513        &lt;td&gt;
514        <xsl:value-of select='$offset'/>
515        &lt;/td&gt;
516        &lt;/tr&gt;
517        &lt;tr&gt;
518        &lt;th&gt;
519        Mask
520        &lt;/th&gt;
521        &lt;td&gt;
522        <xsl:value-of select='$mask'/>
523        &lt;/td&gt;
524        &lt;/tr&gt;
525        &lt;tr&gt;
526        &lt;th&gt;
527        Shift
528        &lt;/th&gt;
529        &lt;td&gt;
530        <xsl:value-of select='$shift'/>
531        &lt;/td&gt;
532        &lt;/tr&gt;
533        &lt;/table&gt;
534        */
535
536<xsl:choose>
537  <xsl:when test='$stereotype = "attribute"'>
538    <xsl:if test='././/UML:Stereotype[@xmi.idref="virtual"]'>
539      <xsl:text>virtual </xsl:text>
540    </xsl:if>
541    <xsl:value-of select='$saltype'/> get_<xsl:value-of select='@name'/>() const
542    {
543    <xsl:if test='$debug="true"'>
544      <xsl:text>
545        clog &lt;&lt; "&lt;called&gt;</xsl:text>
546      <xsl:value-of select="@name"/>
547      <xsl:text>&lt;/called&gt;"
548        &lt;&lt; endl;&#xa;
549      </xsl:text>
550    </xsl:if>
551    <xsl:choose>
552      <xsl:when test='././/UML:Stereotype[@xmi.idref="attributeremainder"]'>
553        <xsl:text>return writerfilter::Reference &lt; BinaryObj &gt;::Pointer_t(new WW8BinaryObjReference(getRemainder(</xsl:text>
554        <xsl:value-of select="$offset"/>
555        <xsl:text>)));&#xa;</xsl:text>
556      </xsl:when>
557      <xsl:otherwise>
558        <xsl:choose>
559          <xsl:when test='$typetype = "complex"'>
560            <xsl:text>        return </xsl:text>
561            <xsl:value-of select="$saltype"/>
562            <xsl:text>(new </xsl:text>
563            <xsl:value-of select="$completetype"/>
564            <xsl:text>(*this, </xsl:text>
565            <xsl:value-of select="$offset"/>
566            <xsl:text>));&#xa;</xsl:text>
567          </xsl:when>
568          <xsl:otherwise>
569            <xsl:text>        return (get</xsl:text>
570            <xsl:value-of select="$type"/>
571            <xsl:text>(</xsl:text>
572            <xsl:value-of select="$offset"/>
573            <xsl:text>)</xsl:text>
574            <xsl:if test="string-length($mask)>0">
575              <xsl:text>&amp; </xsl:text>
576              <xsl:value-of select="$mask"/>
577            </xsl:if>
578            <xsl:text>)</xsl:text>
579            <xsl:if test="$shift>0">
580              <xsl:text>&gt;&gt; </xsl:text>
581              <xsl:value-of select="$shift"/>
582            </xsl:if>
583            <xsl:text>;</xsl:text>
584          </xsl:otherwise>
585        </xsl:choose>
586      </xsl:otherwise>
587    </xsl:choose>
588    }
589  </xsl:when>
590  <xsl:when test='$stereotype = "array"'>
591    <xsl:text>sal_uInt32 get_</xsl:text>
592    <xsl:value-of select='@name'/>
593    <xsl:text>_count() const </xsl:text>
594    <xsl:choose>
595      <xsl:when test='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = "arraycount"]'>
596        <xsl:text>{ return </xsl:text>
597        <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = "arraycount"]/UML:TaggedValue.dataValue'/>
598        <xsl:text>; }&#xa;</xsl:text>
599      </xsl:when>
600      <xsl:otherwise>
601        <xsl:text>;&#xa;</xsl:text>
602      </xsl:otherwise>
603    </xsl:choose>
604    <xsl:value-of select='$saltype'/>
605    <xsl:text> get_</xsl:text>
606    <xsl:value-of select='@name'/>
607    <xsl:text>(sal_uInt32 nIndex) const {</xsl:text>
608    <xsl:choose>
609      <xsl:when test="$typetype='complex'">
610        <xsl:text> return </xsl:text>
611        <xsl:value-of select="$saltype"/>
612        <xsl:text>( new </xsl:text>
613        <xsl:value-of select="$completetype"/>
614        <xsl:text>(static_cast&lt;const WW8StructBase &gt;(*this), </xsl:text>
615        <xsl:value-of select="$offset"/>
616        <xsl:text> + nIndex * </xsl:text>
617        <xsl:value-of select="$completetype"/>
618        <xsl:text>::getSize()));</xsl:text>
619      </xsl:when>
620      <xsl:otherwise>
621        <xsl:text> return get</xsl:text>
622        <xsl:value-of select='$type'/>
623        <xsl:text>(</xsl:text><xsl:value-of select='$offset'/>
624        <xsl:text> + nIndex * sizeof(</xsl:text>
625        <xsl:value-of select='$saltype'/>
626        <xsl:text>))</xsl:text>
627      </xsl:otherwise>
628    </xsl:choose>
629    <xsl:text>; }&#xa;</xsl:text>
630  </xsl:when>
631  <xsl:when test='$stereotype = "string"'>
632    rtl::OUString get_<xsl:value-of select='@name'/>() const { return getString(<xsl:value-of select='$offset'/>); }
633  </xsl:when>
634</xsl:choose>
635</xsl:template>
636
637<xsl:template match='UML:Attribute' mode='accessmembers'>
638  <xsl:text>    </xsl:text>
639  <xsl:call-template name='saltype'>
640    <xsl:with-param name='type'>
641      <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
642    </xsl:with-param>
643  </xsl:call-template>
644  <xsl:text> get_</xsl:text>
645  <xsl:value-of select='@name'/>
646  <xsl:text>() const { return m</xsl:text>
647  <xsl:value-of select='@name'/>
648  <xsl:text>; }
649  </xsl:text>
650</xsl:template>
651
652
653<xsl:template match="UML:Operation" mode="declsOperations">
654  <xsl:choose>
655    <xsl:when test='.//UML:Stereotype/@xmi.idref = "array"'>
656      <xsl:variable name="elementtype">
657        <xsl:value-of select='.//UML:Parameter.type/UML:Class/@xmi.idref'/>
658      </xsl:variable>
659      <xsl:variable name="parentclass">
660        <xsl:call-template name='parenttype'>
661          <xsl:with-param name='type'>
662            <xsl:value-of select='$elementtype'/>
663          </xsl:with-param>
664        </xsl:call-template>
665      </xsl:variable>
666      <xsl:variable name='saltype'>
667        <xsl:call-template name='saltype'>
668          <xsl:with-param name='type'>
669            <xsl:value-of select='$elementtype'/>
670          </xsl:with-param>
671          <xsl:with-param name='parenttype'>
672            <xsl:value-of select='$parentclass'/>
673          </xsl:with-param>
674        </xsl:call-template>
675      </xsl:variable>
676      /**
677      Array: <xsl:value-of select="@name"/>
678      ElementType: <xsl:value-of select="$elementtype"/>(<xsl:value-of select="$parentclass"/>)
679      */
680
681      sal_uInt32 get_<xsl:value-of select="@name"/>_count();
682
683      <xsl:text>    </xsl:text><xsl:value-of select='$saltype'/> get_<xsl:value-of select="@name"/>(sal_uInt32 pos);
684    </xsl:when>
685    <xsl:when test='.//UML:Stereotype/@xmi.idref = "attribute" or .//UML:Stereotype/@xmi.idref = "binary"'>
686      <xsl:variable name="returntype_">
687        <xsl:value-of select='.//UML:Parameter.type/UML:Class/@xmi.idref'/>
688      </xsl:variable>
689      <xsl:variable name="returntype">
690        <xsl:call-template name='saltype'>
691          <xsl:with-param name='type'>
692            <xsl:value-of select='$returntype_'/>
693          </xsl:with-param>
694          <xsl:with-param name='parenttype'>
695            <xsl:call-template name='parenttype'>
696              <xsl:with-param name='type'>
697                <xsl:value-of select='$returntype_'/>
698              </xsl:with-param>
699            </xsl:call-template>
700          </xsl:with-param>
701        </xsl:call-template>
702      </xsl:variable>
703      /**
704      Operation: <xsl:value-of select="@name"/>
705      */
706
707      <xsl:text>    </xsl:text>
708      <xsl:value-of select='$returntype'/>
709      <xsl:text> get_</xsl:text>
710      <xsl:value-of select='@name'/>
711      <xsl:text>();&#xa;</xsl:text>
712    </xsl:when>
713  </xsl:choose>
714</xsl:template>
715
716<xsl:template match="UML:Attribute" mode='declmembers'>
717  <xsl:text>    </xsl:text>
718  <xsl:call-template name='saltype'>
719    <xsl:with-param name='type'>
720      <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
721    </xsl:with-param>
722  </xsl:call-template>
723  <xsl:text> m</xsl:text>
724  <xsl:value-of select="@name"/>
725  <xsl:text>;
726  </xsl:text>
727</xsl:template>
728
729<xsl:template name='idtoqname'>
730  <xsl:param name='id'/>NS_<xsl:value-of select='substring-before($id, ":")'/>::LN_<xsl:value-of select='substring-after($id, ":")'/>
731</xsl:template>
732
733<xsl:template name='saltype'>
734  <xsl:param name='type'/>
735  <xsl:param name='parenttype'/>
736  <xsl:choose>
737    <xsl:when test="$type='U8'">sal_uInt8</xsl:when>
738    <xsl:when test="$type='S8'">sal_Int8</xsl:when>
739    <xsl:when test="$type='U16'">sal_uInt16</xsl:when>
740    <xsl:when test="$type='S16'">sal_Int16</xsl:when>
741    <xsl:when test="$type='U32'">sal_uInt32</xsl:when>
742    <xsl:when test="$type='S32'">sal_Int32</xsl:when>
743    <xsl:when test="$type='String'">rtl::OUString</xsl:when>
744    <xsl:when test="$type='Value'">WW8Value::Pointer_t</xsl:when>
745    <xsl:when test="$type='Binary'">WW8BinaryObjReference::Pointer_t</xsl:when>
746    <xsl:when test="$parenttype=''">
747      <xsl:value-of select="$type"/>
748    </xsl:when>
749    <xsl:otherwise>
750      <xsl:text>writerfilter::Reference &lt; </xsl:text>
751      <xsl:value-of select='$parenttype'/>
752      <xsl:text> &gt;::Pointer_t</xsl:text>
753    </xsl:otherwise>
754  </xsl:choose>
755</xsl:template>
756
757<xsl:template name='typetype'>
758  <xsl:param name='type'/><xsl:choose>
759  <xsl:when test="$type='U8'">simple</xsl:when>
760  <xsl:when test="$type='S8'">simple</xsl:when>
761  <xsl:when test="$type='U16'">simple</xsl:when>
762  <xsl:when test="$type='S16'">simple</xsl:when>
763  <xsl:when test="$type='U32'">simple</xsl:when>
764  <xsl:when test="$type='S32'">simple</xsl:when>
765  <xsl:when test="$type='String'">string</xsl:when>
766  <xsl:when test="$type='Value'">value</xsl:when>
767  <xsl:otherwise>complex</xsl:otherwise>
768</xsl:choose>
769</xsl:template>
770
771<xsl:template match="UML:Attribute" mode="valuetype">
772  <xsl:variable name='type'>
773    <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
774  </xsl:variable>
775  <xsl:choose>
776    <xsl:when test='$type="U8"'>WW8IntValue</xsl:when>
777    <xsl:when test='$type="S8"'>WW8IntValue</xsl:when>
778    <xsl:when test='$type="U16"'>WW8IntValue</xsl:when>
779    <xsl:when test='$type="S16"'>WW8IntValue</xsl:when>
780    <xsl:when test='$type="U32"'>WW8IntValue</xsl:when>
781    <xsl:when test='$type="S32"'>WW8IntValue</xsl:when>
782    <xsl:otherwise>WW8PropertiesValue</xsl:otherwise>
783  </xsl:choose>
784</xsl:template>
785
786<xsl:template match="UML:Class" mode="dffrecord">
787  <xsl:variable name="classname">
788  <xsl:text>Dff</xsl:text><xsl:value-of select="@name"/>
789  </xsl:variable>
790  <xsl:text>
791/**
792    Automaticallay generated class:
793  </xsl:text>
794  <xsl:value-of select="$classname"/>
795  <xsl:text>&#xa;
796*/&#xa;
797class </xsl:text>
798<xsl:value-of select="$classname"/>
799<xsl:text> : public DffRecord
800{
801public:
802    typedef boost::shared_ptr &lt; </xsl:text>
803    <xsl:value-of select="$classname"/>
804    <xsl:text> &gt; Pointer_t;&#xa;
805    </xsl:text>
806    <xsl:value-of select="$classname"/>
807    <xsl:text>(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount)&#xa;
808    : DffRecord(pParent, nOffset, nCount) {}&#xa;
809    </xsl:text>
810    <xsl:value-of select="$classname"/>
811    <xsl:text>(WW8Stream &amp; rStream, sal_uInt32 nOffset, sal_uInt32 nCount)&#xa;
812    : DffRecord(rStream, nOffset, nCount) {}&#xa;
813    </xsl:text>
814    <xsl:value-of select="$classname"/>
815    <xsl:text>(DffRecord &amp; rRecord)&#xa;
816    : DffRecord(rRecord) {}
817    virtual ~</xsl:text>
818    <xsl:value-of select="$classname"/>
819    <xsl:text>();
820
821    virtual void resolveLocal(Properties &amp; props);</xsl:text>
822    <xsl:if test='.//UML:Stereotype[@xmi.idref = "resolvenoauto"]'>
823      void resolveNoAuto(Properties &amp; rHandler);
824    </xsl:if>
825    <xsl:text>
826    virtual void dump(OutputWithDepth &lt; string &gt; &amp; o) const;
827
828    virtual DffRecord * clone() const { return new </xsl:text>
829    <xsl:value-of select="$classname"/>
830    <xsl:text>(*this); }&#xa;
831    virtual string getType() const
832    {
833        return "</xsl:text>
834        <xsl:value-of select="$classname"/>
835        <xsl:text>";
836    }
837
838    virtual string getName() const { return ""; }
839    </xsl:text>
840    <xsl:apply-templates select="." mode="declsProperties"/>
841    <xsl:text>
842};
843</xsl:text>
844</xsl:template>
845
846
847<xsl:template match="UML:Class" mode="dffopt">
848<!--
849  <xsl:variable name="classname">
850  <xsl:text>DffOpt</xsl:text><xsl:value-of select="@name"/>
851  </xsl:variable>
852  <xsl:text>
853/**
854    Automaticallay generated class:
855  </xsl:text>
856  <xsl:value-of select="$classname"/>
857  <xsl:text>&#xa;
858*/&#xa;
859class </xsl:text>
860<xsl:value-of select="$classname"/>
861<xsl:text> : public WW8FOPTE
862{
863    </xsl:text>
864    <xsl:value-of select="$classname"/>
865    <xsl:text>(WW8FOPTE &amp; rOpt) : WW8FOPTE(rOpt) {}
866
867    virtual string getName() const
868    {
869       return "</xsl:text>
870       <xsl:value-of select="@name"/>
871       <xsl:text>";
872     }&#xa;</xsl:text>
873
874     <xsl:text>
875};
876</xsl:text>
877-->
878</xsl:template>
879
880<xsl:template name="parenttype">
881  <xsl:param name='type'/>
882  <xsl:for-each select='/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/UML:Generalization[UML:Generalization.child/UML:Class/@xmi.idref=$type]'>
883    <xsl:value-of select='./UML:Generalization.parent/UML:Class/@xmi.idref'/>
884  </xsl:for-each>
885</xsl:template>
886
887<xsl:template match="UML:Attribute" mode="returntype">
888  <xsl:variable name='type'>
889    <xsl:value-of select="UML:StructuralFeature.type/UML:DataType/@xmi.idref"/>
890  </xsl:variable>
891  <xsl:call-template name='saltype'>
892    <xsl:with-param name='type'>
893      <xsl:value-of select="$type"/>
894    </xsl:with-param>
895    <xsl:with-param name='parenttype'>
896      <xsl:call-template name='parenttype'>
897        <xsl:with-param name='type'><xsl:value-of select='$type'/></xsl:with-param>
898      </xsl:call-template>
899    </xsl:with-param>
900  </xsl:call-template>
901</xsl:template>
902
903</xsl:stylesheet>
904
905