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