Update ooo320-m1
[ooovba.git] / writerfilter / source / doctok / resources.xsl
blob28df89e6686e36229e48e76948416e073d94a55b
1 <!--
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * Copyright 2008 by Sun Microsystems, Inc.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * $RCSfile: resources.xsl,v $
12 * $Revision: 1.9 $
14 * This file is part of OpenOffice.org.
16 * OpenOffice.org is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Lesser General Public License version 3
18 * only, as published by the Free Software Foundation.
20 * OpenOffice.org is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU Lesser General Public License version 3 for more details
24 * (a copy is included in the LICENSE file that accompanied this code).
26 * You should have received a copy of the GNU Lesser General Public License
27 * version 3 along with OpenOffice.org. If not, see
28 * <http://www.openoffice.org/license.html>
29 * for a copy of the LGPLv3 License.
31 ************************************************************************/
33 -->
34 <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#"
35 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:space="default">
36 <xsl:output method="text" />
38 <xsl:template match="/">
39 <out xml:space="preserve">
40 <xsl:text>
41 /*************************************************************************
43 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45 * Copyright 2008 by Sun Microsystems, Inc.
47 * OpenOffice.org - a multi-platform office productivity suite
49 * $RCSfile: resources.xsl,v $
51 * $Revision: 1.9 $
53 * This file is part of OpenOffice.org.
55 * OpenOffice.org is free software: you can redistribute it and/or modify
56 * it under the terms of the GNU Lesser General Public License version 3
57 * only, as published by the Free Software Foundation.
59 * OpenOffice.org is distributed in the hope that it will be useful,
60 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62 * GNU Lesser General Public License version 3 for more details
63 * (a copy is included in the LICENSE file that accompanied this code).
65 * You should have received a copy of the GNU Lesser General Public License
66 * version 3 along with OpenOffice.org. If not, see
67 * http://www.openoffice.org/license.html
68 * for a copy of the LGPLv3 License.
70 ************************************************************************/
71 /*
73 THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT!
76 #ifndef INCLUDED_RESOURCES_HXX
77 #define INCLUDED_RESOURCES_HXX
79 #include &lt;vector&gt;
80 #include &lt;boost/shared_ptr.hpp&gt;
82 #ifndef INCLUDED_OUTPUT_WITH_DEPTH_HXX
83 #include &lt;resourcemodel/OutputWithDepth.hxx&gt;
84 #endif
86 #ifndef INCLUDED_RESOURCESIDS_HXX
87 #include &lt;doctok/resourceids.hxx&gt;
88 #endif
90 #ifndef INCLUDED_WW8_STRUCT_BASE_HXX
91 #include &lt;WW8StructBase.hxx&gt;
92 #endif
94 #ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
95 #include &lt;WW8ResourceModelImpl.hxx&gt;
96 #endif
98 #ifndef INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
99 #include &lt;WW8PropertySetImpl.hxx&gt;
100 #endif
102 #ifndef INCLUDED_DFF_HXX
103 #include &lt;Dff.hxx&gt;
104 #endif
106 namespace writerfilter {
107 namespace doctok {
109 class WW8DocumentImpl;
110 typedef const WW8DocumentImpl * WW8DocumentImplPointer;
112 using namespace ::std;&#xa;</xsl:text>
113 <xsl:apply-templates select="//UML:Class" mode="class"/>
114 <xsl:text>
115 rtl::OUString getDffOptName(sal_uInt32 nPid);
116 bool isBooleanDffOpt(sal_uInt32 nId);
118 #endif // INCLUDED_RESOURCES_HXX&#xa;</xsl:text></out>
119 </xsl:template>
121 <xsl:template match="UML:Class" mode="class">
122 <xsl:choose>
123 <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8resource"]'>
124 <xsl:apply-templates select="." mode="ww8resource"/>
125 </xsl:when>
126 <xsl:when test='.//UML:Stereotype[@xmi.idref = "dffrecord"]'>
127 <xsl:apply-templates select="." mode="dffrecord"/>
128 </xsl:when>
129 <xsl:when test='.//UML:Stereotype[@xmi.idref = "dffopt"]'>
130 <xsl:apply-templates select="." mode="dffopt"/>
131 </xsl:when>
132 </xsl:choose>
133 </xsl:template>
135 <xsl:template match="UML:Class" mode="ww8resource">
136 <xsl:variable name="parentresource">
137 <xsl:call-template name='parenttype'>
138 <xsl:with-param name='type'><xsl:value-of select='@xmi.id'/></xsl:with-param>
139 </xsl:call-template>
140 </xsl:variable>
141 <xsl:variable name='size_'><xsl:value-of select='./*/UML:TaggedValue[./*/UML:TagDefinition/@xmi.idref="size"]/UML:TaggedValue.dataValue'/></xsl:variable>
142 <xsl:variable name='size'>
143 <xsl:choose>
144 <xsl:when test='$size_ != ""'><xsl:value-of select='$size_'/></xsl:when>
145 <xsl:otherwise>0</xsl:otherwise>
146 </xsl:choose>
147 </xsl:variable>
148 <xsl:variable name="classname">WW8<xsl:value-of select="@name"/></xsl:variable>
149 <xsl:variable name="superclass">
150 <xsl:choose>
151 <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8sprm"]'>WW8PropertyImpl</xsl:when>
152 <xsl:otherwise>WW8StructBase</xsl:otherwise>
153 </xsl:choose>
154 </xsl:variable>
155 <xsl:variable name="surroundclass">
156 <xsl:choose>
157 <xsl:when test='.//UML:Stereotype[@xmi.idref = "ww8sprm"]'>WW8PropertyImpl</xsl:when>
158 <xsl:otherwise>WW8StructBase</xsl:otherwise>
159 </xsl:choose>
160 </xsl:variable>
161 <xsl:text>
163 Automatically generated class: </xsl:text><xsl:value-of select="@name"/><xsl:text>
164 </xsl:text>
165 <xsl:for-each select='./UML:ModelElement.stereotype/UML:Stereotype'>
166 <xsl:text>
167 Stereotype </xsl:text>
168 <xsl:value-of select='@xmi.idref'/>
169 <xsl:text>&#xa;</xsl:text>
170 </xsl:for-each>
171 <xsl:text>
172 Parent Resource: </xsl:text>
173 <xsl:value-of select="$parentresource"/>
174 <xsl:text>
175 Size: </xsl:text><xsl:value-of select='$size'/>
176 <xsl:text>
178 class </xsl:text>
179 <xsl:value-of select="$classname"/>
180 <xsl:text>: public </xsl:text>
181 <xsl:value-of select='$superclass'/>
182 <xsl:if test='$parentresource != ""'>
183 <xsl:text>, public writerfilter::Reference&lt; </xsl:text>
184 <xsl:value-of select='$parentresource'/>
185 <xsl:text>&gt;</xsl:text>
186 </xsl:if>
187 <xsl:text>
188 {</xsl:text>
189 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
190 <xsl:text> sal_uInt32 mnIndex;</xsl:text>
191 </xsl:if>
192 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withmembers"]'>
193 <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
194 <xsl:apply-templates select='.' mode='declmembers'/>
195 </xsl:for-each>
196 </xsl:if>
197 <xsl:if test='.//UML:Stereotype[@xmi.idref ="needsdocument"]'>
198 <xsl:text> WW8DocumentImplPointer mpDoc;&#xa;</xsl:text>
199 </xsl:if>
200 <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
201 <xsl:text>
202 sal_uInt32 mnPlcfPayloadOffset;
203 vector&lt;sal_uInt32&gt; entryOffsets;
204 vector&lt;sal_uInt32&gt; payloadOffsets;
205 vector&lt;sal_uInt32&gt; payloadIndices;
206 </xsl:text>
207 </xsl:if>
208 <xsl:text>
209 public:
210 typedef boost::shared_ptr&lt;</xsl:text>
211 <xsl:value-of select='$classname'/>
212 <xsl:text>&gt; Pointer_t;
214 </xsl:text>
215 <xsl:value-of select="$classname"/>
216 <xsl:text>(
217 WW8Stream &amp; rStream,
218 sal_uInt32 nOffset = 0,
219 sal_uInt32 nCount = </xsl:text>
220 <xsl:value-of select='$size'/>
221 <xsl:text>)
222 : </xsl:text><xsl:value-of select='$superclass'/>
223 <xsl:text>(rStream, nOffset, nCount)</xsl:text>
224 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
225 <xsl:text>, mnIndex(0)</xsl:text>
226 </xsl:if>
227 <xsl:text>
229 init();
231 </xsl:text>
232 <xsl:value-of select="$classname"/>
233 <xsl:text>(
234 WW8StructBase * pParent,
235 sal_uInt32 nOffset = 0,
236 sal_uInt32 nCount = </xsl:text>
237 <xsl:value-of select='$size'/>
238 <xsl:text>)
239 : </xsl:text>
240 <xsl:value-of select='$superclass'/>
241 <xsl:text>(pParent, nOffset, nCount)</xsl:text>
242 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
243 <xsl:text>, mnIndex(0)</xsl:text>
244 </xsl:if>
245 <xsl:text>
247 init();
248 }&#xa; </xsl:text>
249 <xsl:value-of select="$classname"/>
250 <xsl:text>( const </xsl:text>
251 <xsl:value-of select='$surroundclass'/>
252 <xsl:text>&amp; rSurround,
253 sal_uInt32 nOffset = 0, sal_uInt32 nCount = </xsl:text>
254 <xsl:value-of select='$size'/>)
255 <xsl:text>
256 : </xsl:text>
257 <xsl:value-of select='$superclass'/>
258 <xsl:text>(rSurround, nOffset, nCount)</xsl:text>
259 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
260 <xsl:text>, mnIndex(0)</xsl:text>
261 </xsl:if>
262 <xsl:text>
264 init();
265 }&#xa;
266 </xsl:text>
267 <xsl:value-of select="$classname"/>
268 <xsl:text>(
269 const Sequence &amp;
270 rSequence, sal_uInt32 nOffset = 0,
271 sal_uInt32 nCount = </xsl:text>
272 <xsl:value-of select='$size'/>
273 <xsl:text>)
274 : </xsl:text>
275 <xsl:value-of select='$superclass'/>
276 <xsl:text>(rSequence, nOffset, nCount)</xsl:text>
277 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
278 <xsl:text>, mnIndex(0)</xsl:text>
279 </xsl:if>
280 <xsl:text>
282 init();
285 virtual ~</xsl:text>
286 <xsl:value-of select="$classname"/>
287 <xsl:text>();&#xa;</xsl:text>
288 <xsl:if test='.//UML:Stereotype[@xmi.idref ="initimpl"]'>
289 <xsl:text> void initImpl();&#xa;</xsl:text>
290 </xsl:if>
291 <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
292 <xsl:text> void initPayload();</xsl:text>
293 </xsl:if>
294 <xsl:text>
295 void init();
298 Return type of resource.
300 virtual string getType() const
302 return "</xsl:text>
303 <xsl:value-of select="@name"/>
304 <xsl:text>";
308 Return static size.
310 static sal_uInt32 getSize() { return </xsl:text>
311 <xsl:value-of select='$size'/>
312 <xsl:text>; }
315 Calculate actual size.
317 sal_uInt32 calcSize();
319 </xsl:text>
320 <xsl:if test='.//UML:Stereotype[@xmi.idref ="plcf"]'>
321 <xsl:text>
323 Return offset for entry of PLCF.
325 @param nIndex index of entry
327 sal_uInt32 getEntryOffset(sal_uInt32 nIndex)
329 return entryOffsets[nIndex];
333 Calculate offset for payload.
335 sal_uInt32 calcPayloadOffset();
338 Set offset for payloads.
340 @param nOffset the offset to set
342 void setPayloadOffset(sal_uInt32 nOffset)
344 mnPlcfPayloadOffset = nOffset;
348 Return offset for payload of PLCF.
350 @param nIndex index of entry
352 sal_uInt32 getPayloadOffset(sal_uInt32 nIndex)
354 return payloadOffsets[nIndex];
358 Return size of payload.
360 sal_uInt32 getPayloadSize(sal_uInt32 nIndex) const
362 return payloadOffsets[nIndex + 1] - payloadOffsets[nIndex];
367 Return payload index of an entry.
370 sal_uInt32 getPayloadIndex(sal_uInt32 nIndex)
372 return payloadIndices[nIndex];
374 </xsl:text>
375 </xsl:if>
376 <xsl:if test='.//UML:Stereotype[@xmi.idref ="withindex"]'>
377 <xsl:text>
379 Set index in parent.
381 @param nIndex the index
383 void setIndex(sal_uInt32 nIndex) { mnIndex = nIndex; }
384 </xsl:text>
385 </xsl:if>
386 <xsl:if test='.//UML:Stereotype[@xmi.idref ="ww8sprm"]'>
387 <xsl:variable name='propsreftype'>writerfilter::Reference &lt; Properties &gt;::Pointer_t</xsl:variable>
388 <xsl:text> /**
389 Return reference to properties of Sprm.
391 </xsl:text>
392 <xsl:value-of select='$propsreftype'/>
393 <xsl:text> getProps()
395 return </xsl:text>
396 <xsl:value-of select='$propsreftype'/>
397 <xsl:text> (new </xsl:text>
398 <xsl:value-of select='$classname'/>
399 <xsl:text>(*this));
401 </xsl:text>
402 </xsl:if>
404 <xsl:if test='.//UML:Stereotype[@xmi.idref ="ww8sprmbinary"]'>
405 <xsl:text>
406 virtual writerfilter::Reference &lt; BinaryObj &gt; ::Pointer_t getBinary();
407 </xsl:text>
408 </xsl:if>
410 <xsl:if test='.//UML:Stereotype[@xmi.idref ="needsdocument"]'>
411 <xsl:text>
412 void setDoc(WW8DocumentImplPointer pDoc)
414 mpDoc = pDoc;
416 </xsl:text>
417 </xsl:if>
418 <xsl:apply-templates select="." mode="declsProperties"/>
419 <xsl:if test='$parentresource="Table"'>
420 <xsl:apply-templates select="." mode="declsTable"/>
421 </xsl:if>
422 <xsl:choose>
423 <xsl:when test='$parentresource="Properties"'>
424 <xsl:apply-templates select="." mode="resolveProperties"/>
425 </xsl:when>
426 <xsl:when test='$parentresource="Table"'>
427 <xsl:apply-templates select="." mode="resolveTable"/>
428 </xsl:when>
429 </xsl:choose>
430 <xsl:text>
432 </xsl:text>
433 </xsl:template>
435 <xsl:template match='UML:Class' mode='declsProperties'>
436 <xsl:choose>
437 <xsl:when test='.//UML:Stereotype[@xmi.idref ="withmembers"]'>
438 <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
439 <xsl:apply-templates select='.' mode='accessmembers'/>
440 </xsl:for-each>
441 </xsl:when>
442 <xsl:otherwise>
443 <xsl:variable name="debug">
444 <xsl:choose>
445 <xsl:when test='.//UML:Stereotype[@xmi.idref="debug"]'>
446 <xsl:text>true</xsl:text>
447 </xsl:when>
448 <xsl:otherwise>
449 <xsl:text>false</xsl:text>
450 </xsl:otherwise>
451 </xsl:choose>
452 </xsl:variable>
453 <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
454 <xsl:apply-templates select='.' mode='access'>
455 <xsl:with-param name="debug">
456 <xsl:value-of select="$debug"/>
457 </xsl:with-param>
458 </xsl:apply-templates>
459 </xsl:for-each>
460 </xsl:otherwise>
461 </xsl:choose>
462 <xsl:for-each select='.//UML:Operation[@name!="reserved"]'>
463 <xsl:apply-templates select='.' mode='declsOperations'/>
464 </xsl:for-each>
465 </xsl:template>
467 <xsl:template match="UML:Class" mode="resolveProperties">
468 <xsl:if test='.//UML:Stereotype[@xmi.idref = "resolvenoauto"]'>
469 void resolveNoAuto(Properties &amp; rHandler);
470 </xsl:if>
472 void dump(OutputWithDepth &lt; string &gt; &amp; o) const;
474 void resolve(Properties &amp; rHandler);
475 </xsl:template>
477 <xsl:template match="UML:Class" mode="declsTable">
478 sal_uInt32 getEntryCount();
479 writerfilter::Reference&lt; Properties &gt;::Pointer_t getEntry(sal_uInt32 nIndex);
480 </xsl:template>
482 <xsl:template match="UML:Class" mode="resolveTable">
483 void resolve(Table &amp; rHandler);
484 </xsl:template>
486 <xsl:template match="UML:Attribute" mode="access">
487 <xsl:param name="debug"/>
488 <xsl:variable name="stereotype"><xsl:value-of select=".//UML:Stereotype[1]/@xmi.idref"/></xsl:variable>
489 <xsl:variable name="offset_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="offset"]/UML:TaggedValue.dataValue, "ABCDEFX", "abcdefx")'/></xsl:variable>
490 <xsl:variable name="offset">
491 <xsl:if test='$offset_ != "" and not(starts-with($offset_, "0x"))'>0x</xsl:if>
492 <xsl:value-of select='$offset_'/>
493 </xsl:variable>
494 <xsl:variable name="shift"><xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="shift"]/UML:TaggedValue.dataValue'/></xsl:variable>
495 <xsl:variable name="mask_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="mask"]/UML:TaggedValue.dataValue, "ABCDEFX", "abcdefx")'/></xsl:variable>
496 <xsl:variable name="mask">
497 <xsl:if test='$mask_ != "" and not(starts-with($mask_, "0x"))'>0x</xsl:if>
498 <xsl:value-of select='$mask_'/>
499 </xsl:variable>
500 <xsl:variable name='type'>
501 <xsl:value-of select="UML:StructuralFeature.type/UML:DataType/@xmi.idref"/>
502 </xsl:variable>
503 <xsl:variable name="completetype">
504 <xsl:text>WW8</xsl:text>
505 <xsl:value-of select="$type"/>
506 </xsl:variable>
507 <xsl:variable name="saltype">
508 <xsl:apply-templates select="." mode="returntype"/>
509 </xsl:variable>
510 <xsl:variable name='typetype'>
511 <xsl:call-template name='typetype'>
512 <xsl:with-param name='type'><xsl:value-of select="$type"/></xsl:with-param>
513 </xsl:call-template>
514 </xsl:variable>
517 <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="comment"]/UML:TaggedValue.dataValue'/>
519 &lt;table&gt;
520 &lt;tr&gt;
521 &lt;th&gt;
522 Name
523 &lt;/th&gt;
524 &lt;td&gt;
525 <xsl:value-of select='@name'/>(<xsl:value-of select='$stereotype'/>)
526 &lt;/td&gt;
527 &lt;/tr&gt;
528 &lt;tr&gt;
529 &lt;th&gt;
530 Offset
531 &lt;/th&gt;
532 &lt;td&gt;
533 <xsl:value-of select='$offset'/>
534 &lt;/td&gt;
535 &lt;/tr&gt;
536 &lt;tr&gt;
537 &lt;th&gt;
538 Mask
539 &lt;/th&gt;
540 &lt;td&gt;
541 <xsl:value-of select='$mask'/>
542 &lt;/td&gt;
543 &lt;/tr&gt;
544 &lt;tr&gt;
545 &lt;th&gt;
546 Shift
547 &lt;/th&gt;
548 &lt;td&gt;
549 <xsl:value-of select='$shift'/>
550 &lt;/td&gt;
551 &lt;/tr&gt;
552 &lt;/table&gt;
555 <xsl:choose>
556 <xsl:when test='$stereotype = "attribute"'>
557 <xsl:if test='././/UML:Stereotype[@xmi.idref="virtual"]'>
558 <xsl:text>virtual </xsl:text>
559 </xsl:if>
560 <xsl:value-of select='$saltype'/> get_<xsl:value-of select='@name'/>() const
562 <xsl:if test='$debug="true"'>
563 <xsl:text>
564 clog &lt;&lt; "&lt;called&gt;</xsl:text>
565 <xsl:value-of select="@name"/>
566 <xsl:text>&lt;/called&gt;"
567 &lt;&lt; endl;&#xa;
568 </xsl:text>
569 </xsl:if>
570 <xsl:choose>
571 <xsl:when test='././/UML:Stereotype[@xmi.idref="attributeremainder"]'>
572 <xsl:text>return writerfilter::Reference &lt; BinaryObj &gt;::Pointer_t(new WW8BinaryObjReference(getRemainder(</xsl:text>
573 <xsl:value-of select="$offset"/>
574 <xsl:text>)));&#xa;</xsl:text>
575 </xsl:when>
576 <xsl:otherwise>
577 <xsl:choose>
578 <xsl:when test='$typetype = "complex"'>
579 <xsl:text> return </xsl:text>
580 <xsl:value-of select="$saltype"/>
581 <xsl:text>(new </xsl:text>
582 <xsl:value-of select="$completetype"/>
583 <xsl:text>(*this, </xsl:text>
584 <xsl:value-of select="$offset"/>
585 <xsl:text>));&#xa;</xsl:text>
586 </xsl:when>
587 <xsl:otherwise>
588 <xsl:text> return (get</xsl:text>
589 <xsl:value-of select="$type"/>
590 <xsl:text>(</xsl:text>
591 <xsl:value-of select="$offset"/>
592 <xsl:text>)</xsl:text>
593 <xsl:if test="string-length($mask)>0">
594 <xsl:text>&amp; </xsl:text>
595 <xsl:value-of select="$mask"/>
596 </xsl:if>
597 <xsl:text>)</xsl:text>
598 <xsl:if test="$shift>0">
599 <xsl:text>&gt;&gt; </xsl:text>
600 <xsl:value-of select="$shift"/>
601 </xsl:if>
602 <xsl:text>;</xsl:text>
603 </xsl:otherwise>
604 </xsl:choose>
605 </xsl:otherwise>
606 </xsl:choose>
608 </xsl:when>
609 <xsl:when test='$stereotype = "array"'>
610 <xsl:text>sal_uInt32 get_</xsl:text>
611 <xsl:value-of select='@name'/>
612 <xsl:text>_count() const </xsl:text>
613 <xsl:choose>
614 <xsl:when test='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = "arraycount"]'>
615 <xsl:text>{ return </xsl:text>
616 <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = "arraycount"]/UML:TaggedValue.dataValue'/>
617 <xsl:text>; }&#xa;</xsl:text>
618 </xsl:when>
619 <xsl:otherwise>
620 <xsl:text>;&#xa;</xsl:text>
621 </xsl:otherwise>
622 </xsl:choose>
623 <xsl:value-of select='$saltype'/>
624 <xsl:text> get_</xsl:text>
625 <xsl:value-of select='@name'/>
626 <xsl:text>(sal_uInt32 nIndex) const {</xsl:text>
627 <xsl:choose>
628 <xsl:when test="$typetype='complex'">
629 <xsl:text> return </xsl:text>
630 <xsl:value-of select="$saltype"/>
631 <xsl:text>( new </xsl:text>
632 <xsl:value-of select="$completetype"/>
633 <xsl:text>(static_cast&lt;const WW8StructBase &gt;(*this), </xsl:text>
634 <xsl:value-of select="$offset"/>
635 <xsl:text> + nIndex * </xsl:text>
636 <xsl:value-of select="$completetype"/>
637 <xsl:text>::getSize()));</xsl:text>
638 </xsl:when>
639 <xsl:otherwise>
640 <xsl:text> return get</xsl:text>
641 <xsl:value-of select='$type'/>
642 <xsl:text>(</xsl:text><xsl:value-of select='$offset'/>
643 <xsl:text> + nIndex * sizeof(</xsl:text>
644 <xsl:value-of select='$saltype'/>
645 <xsl:text>))</xsl:text>
646 </xsl:otherwise>
647 </xsl:choose>
648 <xsl:text>; }&#xa;</xsl:text>
649 </xsl:when>
650 <xsl:when test='$stereotype = "string"'>
651 rtl::OUString get_<xsl:value-of select='@name'/>() const { return getString(<xsl:value-of select='$offset'/>); }
652 </xsl:when>
653 </xsl:choose>
654 </xsl:template>
656 <xsl:template match='UML:Attribute' mode='accessmembers'>
657 <xsl:text> </xsl:text>
658 <xsl:call-template name='saltype'>
659 <xsl:with-param name='type'>
660 <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
661 </xsl:with-param>
662 </xsl:call-template>
663 <xsl:text> get_</xsl:text>
664 <xsl:value-of select='@name'/>
665 <xsl:text>() const { return m</xsl:text>
666 <xsl:value-of select='@name'/>
667 <xsl:text>; }
668 </xsl:text>
669 </xsl:template>
672 <xsl:template match="UML:Operation" mode="declsOperations">
673 <xsl:choose>
674 <xsl:when test='.//UML:Stereotype/@xmi.idref = "array"'>
675 <xsl:variable name="elementtype">
676 <xsl:value-of select='.//UML:Parameter.type/UML:Class/@xmi.idref'/>
677 </xsl:variable>
678 <xsl:variable name="parentclass">
679 <xsl:call-template name='parenttype'>
680 <xsl:with-param name='type'>
681 <xsl:value-of select='$elementtype'/>
682 </xsl:with-param>
683 </xsl:call-template>
684 </xsl:variable>
685 <xsl:variable name='saltype'>
686 <xsl:call-template name='saltype'>
687 <xsl:with-param name='type'>
688 <xsl:value-of select='$elementtype'/>
689 </xsl:with-param>
690 <xsl:with-param name='parenttype'>
691 <xsl:value-of select='$parentclass'/>
692 </xsl:with-param>
693 </xsl:call-template>
694 </xsl:variable>
696 Array: <xsl:value-of select="@name"/>
697 ElementType: <xsl:value-of select="$elementtype"/>(<xsl:value-of select="$parentclass"/>)
700 sal_uInt32 get_<xsl:value-of select="@name"/>_count();
702 <xsl:text> </xsl:text><xsl:value-of select='$saltype'/> get_<xsl:value-of select="@name"/>(sal_uInt32 pos);
703 </xsl:when>
704 <xsl:when test='.//UML:Stereotype/@xmi.idref = "attribute" or .//UML:Stereotype/@xmi.idref = "binary"'>
705 <xsl:variable name="returntype_">
706 <xsl:value-of select='.//UML:Parameter.type/UML:Class/@xmi.idref'/>
707 </xsl:variable>
708 <xsl:variable name="returntype">
709 <xsl:call-template name='saltype'>
710 <xsl:with-param name='type'>
711 <xsl:value-of select='$returntype_'/>
712 </xsl:with-param>
713 <xsl:with-param name='parenttype'>
714 <xsl:call-template name='parenttype'>
715 <xsl:with-param name='type'>
716 <xsl:value-of select='$returntype_'/>
717 </xsl:with-param>
718 </xsl:call-template>
719 </xsl:with-param>
720 </xsl:call-template>
721 </xsl:variable>
723 Operation: <xsl:value-of select="@name"/>
726 <xsl:text> </xsl:text>
727 <xsl:value-of select='$returntype'/>
728 <xsl:text> get_</xsl:text>
729 <xsl:value-of select='@name'/>
730 <xsl:text>();&#xa;</xsl:text>
731 </xsl:when>
732 </xsl:choose>
733 </xsl:template>
735 <xsl:template match="UML:Attribute" mode='declmembers'>
736 <xsl:text> </xsl:text>
737 <xsl:call-template name='saltype'>
738 <xsl:with-param name='type'>
739 <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
740 </xsl:with-param>
741 </xsl:call-template>
742 <xsl:text> m</xsl:text>
743 <xsl:value-of select="@name"/>
744 <xsl:text>;
745 </xsl:text>
746 </xsl:template>
748 <xsl:template name='idtoqname'>
749 <xsl:param name='id'/>NS_<xsl:value-of select='substring-before($id, ":")'/>::LN_<xsl:value-of select='substring-after($id, ":")'/>
750 </xsl:template>
752 <xsl:template name='saltype'>
753 <xsl:param name='type'/>
754 <xsl:param name='parenttype'/>
755 <xsl:choose>
756 <xsl:when test="$type='U8'">sal_uInt8</xsl:when>
757 <xsl:when test="$type='S8'">sal_Int8</xsl:when>
758 <xsl:when test="$type='U16'">sal_uInt16</xsl:when>
759 <xsl:when test="$type='S16'">sal_Int16</xsl:when>
760 <xsl:when test="$type='U32'">sal_uInt32</xsl:when>
761 <xsl:when test="$type='S32'">sal_Int32</xsl:when>
762 <xsl:when test="$type='String'">rtl::OUString</xsl:when>
763 <xsl:when test="$type='Value'">WW8Value::Pointer_t</xsl:when>
764 <xsl:when test="$type='Binary'">WW8BinaryObjReference::Pointer_t</xsl:when>
765 <xsl:when test="$parenttype=''">
766 <xsl:value-of select="$type"/>
767 </xsl:when>
768 <xsl:otherwise>
769 <xsl:text>writerfilter::Reference &lt; </xsl:text>
770 <xsl:value-of select='$parenttype'/>
771 <xsl:text> &gt;::Pointer_t</xsl:text>
772 </xsl:otherwise>
773 </xsl:choose>
774 </xsl:template>
776 <xsl:template name='typetype'>
777 <xsl:param name='type'/><xsl:choose>
778 <xsl:when test="$type='U8'">simple</xsl:when>
779 <xsl:when test="$type='S8'">simple</xsl:when>
780 <xsl:when test="$type='U16'">simple</xsl:when>
781 <xsl:when test="$type='S16'">simple</xsl:when>
782 <xsl:when test="$type='U32'">simple</xsl:when>
783 <xsl:when test="$type='S32'">simple</xsl:when>
784 <xsl:when test="$type='String'">string</xsl:when>
785 <xsl:when test="$type='Value'">value</xsl:when>
786 <xsl:otherwise>complex</xsl:otherwise>
787 </xsl:choose>
788 </xsl:template>
790 <xsl:template match="UML:Attribute" mode="valuetype">
791 <xsl:variable name='type'>
792 <xsl:value-of select='.//UML:DataType/@xmi.idref'/>
793 </xsl:variable>
794 <xsl:choose>
795 <xsl:when test='$type="U8"'>WW8IntValue</xsl:when>
796 <xsl:when test='$type="S8"'>WW8IntValue</xsl:when>
797 <xsl:when test='$type="U16"'>WW8IntValue</xsl:when>
798 <xsl:when test='$type="S16"'>WW8IntValue</xsl:when>
799 <xsl:when test='$type="U32"'>WW8IntValue</xsl:when>
800 <xsl:when test='$type="S32"'>WW8IntValue</xsl:when>
801 <xsl:otherwise>WW8PropertiesValue</xsl:otherwise>
802 </xsl:choose>
803 </xsl:template>
805 <xsl:template match="UML:Class" mode="dffrecord">
806 <xsl:variable name="classname">
807 <xsl:text>Dff</xsl:text><xsl:value-of select="@name"/>
808 </xsl:variable>
809 <xsl:text>
810 /**
811 Automaticallay generated class:
812 </xsl:text>
813 <xsl:value-of select="$classname"/>
814 <xsl:text>&#xa;
815 */&#xa;
816 class </xsl:text>
817 <xsl:value-of select="$classname"/>
818 <xsl:text> : public DffRecord
820 public:
821 typedef boost::shared_ptr &lt; </xsl:text>
822 <xsl:value-of select="$classname"/>
823 <xsl:text> &gt; Pointer_t;&#xa;
824 </xsl:text>
825 <xsl:value-of select="$classname"/>
826 <xsl:text>(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount)&#xa;
827 : DffRecord(pParent, nOffset, nCount) {}&#xa;
828 </xsl:text>
829 <xsl:value-of select="$classname"/>
830 <xsl:text>(WW8Stream &amp; rStream, sal_uInt32 nOffset, sal_uInt32 nCount)&#xa;
831 : DffRecord(rStream, nOffset, nCount) {}&#xa;
832 </xsl:text>
833 <xsl:value-of select="$classname"/>
834 <xsl:text>(DffRecord &amp; rRecord)&#xa;
835 : DffRecord(rRecord) {}
836 virtual ~</xsl:text>
837 <xsl:value-of select="$classname"/>
838 <xsl:text>();
840 virtual void resolveLocal(Properties &amp; props);</xsl:text>
841 <xsl:if test='.//UML:Stereotype[@xmi.idref = "resolvenoauto"]'>
842 void resolveNoAuto(Properties &amp; rHandler);
843 </xsl:if>
844 <xsl:text>
845 virtual void dump(OutputWithDepth &lt; string &gt; &amp; o) const;
847 virtual DffRecord * clone() const { return new </xsl:text>
848 <xsl:value-of select="$classname"/>
849 <xsl:text>(*this); }&#xa;
850 virtual string getType() const
852 return "</xsl:text>
853 <xsl:value-of select="$classname"/>
854 <xsl:text>";
857 virtual string getName() const { return ""; }
858 </xsl:text>
859 <xsl:apply-templates select="." mode="declsProperties"/>
860 <xsl:text>
862 </xsl:text>
863 </xsl:template>
866 <xsl:template match="UML:Class" mode="dffopt">
867 <!--
868 <xsl:variable name="classname">
869 <xsl:text>DffOpt</xsl:text><xsl:value-of select="@name"/>
870 </xsl:variable>
871 <xsl:text>
872 /**
873 Automaticallay generated class:
874 </xsl:text>
875 <xsl:value-of select="$classname"/>
876 <xsl:text>&#xa;
877 */&#xa;
878 class </xsl:text>
879 <xsl:value-of select="$classname"/>
880 <xsl:text> : public WW8FOPTE
882 </xsl:text>
883 <xsl:value-of select="$classname"/>
884 <xsl:text>(WW8FOPTE &amp; rOpt) : WW8FOPTE(rOpt) {}
886 virtual string getName() const
888 return "</xsl:text>
889 <xsl:value-of select="@name"/>
890 <xsl:text>";
891 }&#xa;</xsl:text>
893 <xsl:text>
895 </xsl:text>
897 </xsl:template>
899 <xsl:template name="parenttype">
900 <xsl:param name='type'/>
901 <xsl:for-each select='/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/UML:Generalization[UML:Generalization.child/UML:Class/@xmi.idref=$type]'>
902 <xsl:value-of select='./UML:Generalization.parent/UML:Class/@xmi.idref'/>
903 </xsl:for-each>
904 </xsl:template>
906 <xsl:template match="UML:Attribute" mode="returntype">
907 <xsl:variable name='type'>
908 <xsl:value-of select="UML:StructuralFeature.type/UML:DataType/@xmi.idref"/>
909 </xsl:variable>
910 <xsl:call-template name='saltype'>
911 <xsl:with-param name='type'>
912 <xsl:value-of select="$type"/>
913 </xsl:with-param>
914 <xsl:with-param name='parenttype'>
915 <xsl:call-template name='parenttype'>
916 <xsl:with-param name='type'><xsl:value-of select='$type'/></xsl:with-param>
917 </xsl:call-template>
918 </xsl:with-param>
919 </xsl:call-template>
920 </xsl:template>
922 </xsl:stylesheet>