2 /*************************************************************************
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 Copyright 2008 by Sun Microsystems, Inc.
8 OpenOffice.org - a multi-platform office productivity suite
10 $RCSfile: resourcesimpl.xsl,v $
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 ************************************************************************/
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:include href=
"resourcetools.xsl"/>
40 <xsl:template match=
"/">
41 <xsl:call-template name=
"licenseheader"/>
43 #include
<resources.hxx
>
45 #ifndef WW8_OUTPUT_WITH_DEPTH
46 #include
<WW8OutputWithDepth.hxx
>
49 #ifndef INCLUDED_SPRMIDS_HXX
50 #include
<sprmids.hxx
>
53 namespace writerfilter {
56 extern WW8OutputWithDepth output;
58 using namespace ::std;
60 <xsl:apply-templates select='/XMI/XMI.content/UML:Model'
mode=
"sprmkind"/>
61 <xsl:apply-templates select='.//UML:Class' mode='class'
/>
62 <xsl:apply-templates select='//UML:Model' mode='createsprmprops'
/>
63 <xsl:apply-templates select='/XMI/XMI.content/UML:Model'
64 mode='createsprmbinary'
/>
65 <xsl:apply-templates select='/XMI/XMI.content/UML:Model'
66 mode='createdffrecord'
/>
67 <xsl:apply-templates select='/XMI/XMI.content/UML:Model' mode='ww8foptename'
/>
68 <xsl:apply-templates select='/XMI/XMI.content/UML:Model'
69 mode='isbooleandffopt'
/>
75 <xsl:template match=
"UML:Class" mode=
"class">
77 <xsl:when test='.//UML:Stereotype[@xmi.idref =
"ww8resource"]'
>
78 <xsl:apply-templates select=
"." mode=
"ww8resource">
79 <xsl:with-param name=
"classprefix">WW8
</xsl:with-param>
80 <xsl:with-param name=
"needsinit">true
</xsl:with-param>
81 </xsl:apply-templates>
83 <xsl:when test='.//UML:Stereotype[@xmi.idref =
"dffrecord"]'
>
84 <xsl:apply-templates select=
"." mode=
"ww8resource">
85 <xsl:with-param name=
"classprefix">Dff
</xsl:with-param>
86 </xsl:apply-templates>
91 <xsl:template match=
"UML:Class" mode=
"ww8resource">
92 <xsl:param name=
"classprefix"/>
93 <xsl:param name=
"needsinit"/>
94 <xsl:variable name=
"parentresource">
95 <xsl:call-template name='parenttype'
>
96 <xsl:with-param name='type'
><xsl:value-of select='@xmi.id'
/></xsl:with-param>
99 <xsl:variable name='size_'
><xsl:value-of select='./*/UML:TaggedValue[./*/UML:TagDefinition/@xmi.
idref=
"size"]/UML:TaggedValue.dataValue'
/></xsl:variable>
100 <xsl:variable name='size'
>
102 <xsl:when test='$size_ !=
""'
><xsl:value-of select='$size_'
/></xsl:when>
103 <xsl:otherwise>0</xsl:otherwise>
106 <xsl:variable name=
"classname"><xsl:value-of select=
"$classprefix"/><xsl:value-of select=
"@name"/></xsl:variable>
107 <xsl:variable name=
"superclass">
109 <xsl:when test='.//UML:Stereotype[@xmi.idref =
"ww8sprm"]'
>WW8PropertyImpl
</xsl:when>
110 <xsl:otherwise>WW8StructBase
</xsl:otherwise>
113 <xsl:variable name=
"surroundclass">
115 <xsl:when test='.//UML:Stereotype[@xmi.idref =
"ww8sprm"]'
>WW8PropertyImpl
</xsl:when>
116 <xsl:otherwise>WW8StructBase
</xsl:otherwise>
121 Automatically generated class:
</xsl:text><xsl:value-of select=
"@name"/><xsl:text>
123 <xsl:for-each select='./UML:ModelElement.stereotype/UML:Stereotype'
>
125 Stereotype
</xsl:text>
126 <xsl:value-of select='@xmi.idref'
/>
127 <xsl:text>
</xsl:text>
130 Parent Resource:
</xsl:text>
131 <xsl:value-of select=
"$parentresource"/>
133 Size:
</xsl:text><xsl:value-of select='$size'
/>
138 <xsl:value-of select=
"$classname"/>
139 <xsl:text>::~
</xsl:text>
140 <xsl:value-of select=
"$classname"/>
145 <xsl:if test=
"$needsinit='true'">
148 <xsl:value-of select=
"$classname"/>
152 <xsl:if test='.//UML:Stereotype[@xmi.idref =
"withmembers"]'
>
153 <xsl:for-each select='.//UML:Attribute[@name!=
"reserved"]'
>
154 <xsl:apply-templates select='.' mode='initmembers'
/>
157 <xsl:if test='.//UML:Stereotype[@xmi.idref =
"initimpl"]'
>
158 <xsl:text> initImpl();

</xsl:text>
165 <xsl:when test='$
parentresource=
"Properties"'
>
166 <xsl:apply-templates select=
"." mode=
"resolveProperties">
167 <xsl:with-param name=
"classname" select=
"$classname"/>
168 </xsl:apply-templates>
170 <xsl:when test='$
parentresource=
"Table"'
>
171 <xsl:apply-templates select=
"." mode=
"resolveTable">
172 <xsl:with-param name=
"classname" select=
"$classname"/>
173 </xsl:apply-templates>
179 <xsl:template match=
"UML:Class" mode=
"resolveProperties">
180 <xsl:param name=
"classname"/>
181 <xsl:variable name=
"rHandler">
183 <xsl:when test='.//UML:Attribute[@name!=
"reserved"]'
>
184 <xsl:if test='.//UML:Stereotype[@xmi.idref !=
"noresolve"]'
>
185 <xsl:text>rHandler
</xsl:text>
188 <xsl:when test='.//UML:Operation[@name!=
"reserved"]'
>
189 <xsl:if test='.//UML:Stereotype[@xmi.idref !=
"noresolve"]'
>
190 <xsl:text>rHandler
</xsl:text>
193 <xsl:when test='.//UML:Stereotype[@xmi.idref =
"resolvenoauto"]'
>
194 <xsl:text>rHandler
</xsl:text>
200 <xsl:value-of select=
"$classname"/>
202 <xsl:when test=
".//UML:Stereotype[@xmi.idref='ww8resource']">
203 <xsl:text>::resolve(Properties
& </xsl:text>
204 <xsl:value-of select=
"$rHandler"/>
205 <xsl:text>)
</xsl:text>
207 <xsl:when test=
".//UML:Stereotype[@xmi.idref='dffrecord']">
208 <xsl:text>::resolveLocal(Properties
& </xsl:text>
209 <xsl:value-of select=
"$rHandler"/>
210 <xsl:text>)
</xsl:text>
215 <xsl:if test='.//UML:Stereotype[@xmi.
idref=
"debug"]'
>
217 dump(output);
</xsl:text>
222 <xsl:for-each select='.//UML:Attribute[@name!=
"reserved"]'
>
224 <xsl:when test='.//UML:Stereotype[@xmi.
idref=
"noresolve"]'
>
227 <xsl:apply-templates select='.' mode='resolveAttribute'
/>
231 <xsl:for-each select='.//UML:Operation[@name!=
"reserved"]'
>
233 <xsl:when test='.//UML:Stereotype[@xmi.
idref=
"noresolve"]'
>
236 <xsl:apply-templates select='.' mode='resolveOperation'
/>
241 <xsl:if test='.//UML:Stereotype[@xmi.idref =
"resolvenoauto"]'
>
242 resolveNoAuto(rHandler);
245 } catch (Exception
& e) {
246 clog
<< e.getText()
<< endl;
252 <xsl:value-of select=
"$classname"/>
253 <xsl:text>::dump(OutputWithDepth
< string
> & o) const
255 o.addItem(
"<dump type='</xsl:text>
256 <xsl:value-of select='@name'/>
259 WW8StructBase::dump(o);
</xsl:text>
260 <xsl:for-each select='.//UML:Attribute[@name!=
"reserved"]'
>
261 <xsl:apply-templates select='.' mode='dumpAttribute'
/>
265 o.addItem(
"</dump>");
269 <xsl:template match='UML:Attribute' mode='resolveAttribute'
>
270 <xsl:variable name=
"attrid">
271 <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"attrid"]'
>
272 <xsl:value-of select='UML:TaggedValue.dataValue'
/>
275 <xsl:variable name=
"qname">
276 <xsl:call-template name='idtoqname'
>
277 <xsl:with-param name='id'
>
278 <xsl:value-of select='$attrid'
/>
283 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"attribute"'
>
286 WW8Value::Pointer_t pVal = createValue(get_
</xsl:text>
287 <xsl:value-of select=
"@name"/>
289 rHandler.attribute(
</xsl:text>
290 <xsl:value-of select=
"$qname"/>
294 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"array"'
>
295 <xsl:variable name=
"elementtype">
296 <xsl:value-of select='.//UML:DataType/@xmi.idref'
/>
298 <xsl:variable name=
"parentclass">
299 <xsl:call-template name='parenttype'
>
300 <xsl:with-param name='type'
>
301 <xsl:value-of select='$elementtype'
/>
307 sal_uInt32 nCount = get_
</xsl:text>
308 <xsl:value-of select=
"@name"/>
310 for (sal_uInt32 n =
0; n
< nCount; ++n)
312 WW8Value::Pointer_t pVal = createValue(get_
</xsl:text>
313 <xsl:value-of select=
"@name"/>
315 rHandler.attribute(
</xsl:text>
316 <xsl:value-of select=
"$qname"/>
321 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"string"'
>
324 WW8StringValue aVal(get_
</xsl:text>
325 <xsl:value-of select='@name'
/>
327 rHandler.attribute(
</xsl:text>
328 <xsl:value-of select=
"$qname"/>
335 <xsl:template match='UML:Attribute' mode='dumpAttribute'
>
336 <xsl:variable name=
"type">
337 <xsl:value-of select='.//UML:DataType/@xmi.idref'
/>
338 </xsl:variable><xsl:variable name=
"saltype">
339 <xsl:call-template name='saltype'
>
340 <xsl:with-param name='type'
>
341 <xsl:value-of select='$type'
/>
343 <xsl:with-param name='parenttype'
>
344 <xsl:apply-templates select=
"." mode=
"parentclass"/>
348 <xsl:variable name=
"name" select=
"@name"/>
349 <xsl:for-each select=
".//UML:Stereotype">
351 <xsl:when test='@xmi.idref =
"attributeremainder"'
/>
352 <xsl:when test='@xmi.idref =
"array"'
>
355 sal_uInt32 nCount = get_
</xsl:text>
356 <xsl:value-of select='$name'
/>
359 for (sal_uInt32 n =
0; n
< nCount; ++n)
361 writerfilter::dump(o,
"</xsl:text>
362 <xsl:value-of select='$name'/>
363 <xsl:text>", get_
</xsl:text>
364 <xsl:value-of select=
"$name"/>
369 <xsl:when test='@xmi.idref =
"string"'
>
372 WW8StringValue aVal(get_
</xsl:text>
373 <xsl:value-of select='$name'
/>
376 o.addItem(
"</xsl:text>
377 <xsl:value-of select='$name'/>
378 <xsl:text>" << "=\"" + aVal.toString() + "\
"");
383 writerfilter::dump(o,
"</xsl:text>
384 <xsl:value-of select='$name'/>
385 <xsl:text>", get_
</xsl:text>
386 <xsl:value-of select=
"$name"/>
387 <xsl:text>());
</xsl:text>
393 <xsl:template name=
"resolveOperationAttribute">
394 <xsl:variable name=
"opid">
395 <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"opid"]'
>
396 <xsl:value-of select='./UML:TaggedValue.dataValue'
/>
401 WW8Value::Pointer_t pVal = createValue(get_
</xsl:text>
402 <xsl:value-of select=
"@name"/>
404 rHandler.attribute(
</xsl:text>
405 <xsl:call-template name='idtoqname'
>
406 <xsl:with-param name='id'
><xsl:value-of select='$opid'
/></xsl:with-param>
412 <xsl:template name=
"resolveOperationArray">
413 <xsl:variable name=
"elementtype">
414 <xsl:value-of select='.//UML:Parameter.type/@xmi.idref'
/>
416 <xsl:variable name=
"opid">
417 <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"opid"]'
>
418 <xsl:value-of select='./UML:TaggedValue.dataValue'
/>
421 <xsl:variable name=
"parentclass">
422 <xsl:for-each select='/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/UML:Generalization[UML:Generalization.child/UML:Class/@xmi.idref=$elementtype]'
>
423 <xsl:value-of select='./UML:Generalization.parent/UML:Class/@xmi.idref'
/>
428 sal_uInt32 nCount = get_
</xsl:text>
429 <xsl:value-of select=
"@name"/>
432 for (sal_uInt32 n =
0; n
< nCount; ++n)
434 WW8Value::Pointer_t pVal = createValue(get_
</xsl:text>
435 <xsl:value-of select=
"@name"/>
437 rHandler.attribute(
</xsl:text>
438 <xsl:call-template name='idtoqname'
>
439 <xsl:with-param name='id'
><xsl:value-of select='$opid'
/></xsl:with-param>
446 <xsl:template name=
"resolveOperationBinary">
449 WW8BinaryObjReference::Pointer_t pRef(get_
</xsl:text>
450 <xsl:value-of select=
"@name"/>
454 rHandler.sprm(aSprm);
458 <xsl:template match='UML:Operation' mode='resolveOperation'
>
460 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"attribute"'
>
461 <xsl:call-template name=
"resolveOperationAttribute"/>
463 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"array"'
>
464 <xsl:call-template name=
"resolveOperationArray"/>
466 <xsl:when test='.//UML:Stereotype/@xmi.idref =
"binary"'
>
467 <xsl:call-template name=
"resolveOperationBinary"/>
472 <xsl:template match=
"UML:Class" mode=
"resolveTable">
473 <xsl:param name=
"classname"/>
474 <xsl:text>void
</xsl:text>
475 <xsl:value-of select=
"$classname"/>
476 <xsl:text>::resolve(Table
& rHandler)
478 sal_uInt32 nCount = getEntryCount();
479 writerfilter::Reference
< Properties
>::Pointer_t pEntry;
480 for (sal_uInt32 n =
0; n
< nCount; ++n)
482 pEntry = getEntry(n);
484 if (pEntry.get() !=
0x0)
488 rHandler.entry(n, pEntry);
490 catch (ExceptionOutOfBounds e)
499 <xsl:template match='UML:Model' mode='createsprmprops'
>
500 writerfilter::Reference
< Properties
> ::Pointer_t createSprmProps
501 (WW8PropertyImpl
& rProp)
503 writerfilter::Reference
< Properties
> ::Pointer_t pResult;
505 switch (rProp.getId())
507 <xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.
idref=
"ww8sprm" and .//UML:Stereotype/@xmi.
idref=
"ww8resource"]'
>
508 case
<xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"sprmcode"]//UML:TaggedValue.dataValue'
/>:
509 pResult = writerfilter::Reference
< Properties
> ::Pointer_t(new WW8
<xsl:value-of select='@name'
/>(rProp,
0, rProp.getCount()));
521 <xsl:template match='UML:Model' mode='createsprmbinary'
>
523 writerfilter::Reference
< BinaryObj
> ::Pointer_t createSprmBinary
524 (WW8PropertyImpl
& rProp)
526 writerfilter::Reference
< BinaryObj
> ::Pointer_t pResult;
528 switch (rProp.getId())
534 <xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.
idref=
"ww8sprmbinary" and .//UML:Stereotype/@xmi.
idref=
"ww8resource"]'
>
535 case
<xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"sprmcode"]//UML:TaggedValue.dataValue'
/>:
537 WW8
<xsl:value-of select='@name'
/>::Pointer_t p(new WW8
<xsl:value-of select='@name'
/>(rProp,
0, rProp.getCount()));
539 pResult = p-
>getBinary();
554 <!-- returns optname of UML:Class -->
555 <xsl:template name=
"optname">
556 <xsl:for-each select=
"./UML:ModelElement.taggedValue/UML:TaggedValue">
557 <xsl:if test=
".//UML:TagDefinition/@xmi.idref='optname'">
558 <xsl:value-of select=
"./UML:TaggedValue.dataValue"/>
563 <xsl:template name=
"ww8foptenamecase">
566 <xsl:variable name=
"optname">
567 <xsl:call-template name=
"optname"/>
569 <xsl:call-template name=
"idtoqname">
570 <xsl:with-param name=
"id" select=
"$optname"/>
573 result = rtl::OUString::createFromAscii(
"</xsl:text>
574 <xsl:value-of select="$optname
"/>
579 <xsl:template name=
"getdffoptname">
581 rtl::OUString getDffOptName(sal_uInt32 nPid)
583 rtl::OUString result;
587 <xsl:for-each select=
"./UML:Class[./UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']">
588 <xsl:call-template name=
"ww8foptenamecase"/>
599 <xsl:template name=
"ww8foptegetvalue">
601 WW8Value::Pointer_t WW8FOPTE::get_value()
603 WW8Value::Pointer_t pResult;
607 <xsl:for-each select=
".//UML:Class[./UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']">
608 <xsl:variable name=
"type">
609 <xsl:for-each select=
"./UML:ModelElement.taggedValue/UML:TaggedValue[./UML:TaggedValue.type/UML:TagDefinition/@xmi.idref='type']">
610 <xsl:value-of select=
"UML:TaggedValue.dataValue"/>
613 <xsl:if test=
"$type != 'unknown'">
614 <xsl:variable name=
"typetype">
615 <xsl:call-template name=
"typetype">
616 <xsl:with-param name=
"type" select=
"$type"/>
619 <xsl:variable name=
"valuetype">
620 <xsl:call-template name=
"valuetype">
621 <xsl:with-param name=
"type" select=
"$type"/>
626 <xsl:for-each select=
"./UML:ModelElement.taggedValue/UML:TaggedValue[./UML:TaggedValue.type/UML:TagDefinition/@xmi.idref='dffid']">
627 <xsl:value-of select=
"UML:TaggedValue.dataValue"/>
629 <xsl:variable name=
"optname">
630 <xsl:for-each select=
"./UML:ModelElement.taggedValue/UML:TaggedValue[./UML:TaggedValue.type/UML:TagDefinition/@xmi.idref='optname']">
631 <xsl:value-of select=
"UML:TaggedValue.dataValue"/>
634 <xsl:call-template name=
"idtoqname">
635 <xsl:with-param name=
"id" select=
"$optname"/>
637 <xsl:text>:
</xsl:text>
639 <xsl:when test=
"./UML:ModelElement.taggedValue/UML:TaggedValue[./UML:TaggedValue.type/UML:TagDefinition/@xmi.idref='isbool']">
641 pResult = createValue(getU32(
0x2)
& 1);
</xsl:text>
643 <xsl:when test=
"$typetype='complex'">
645 pResult = createValue(new
</xsl:text>
646 <xsl:value-of select=
"$valuetype"/>
647 <xsl:text>(getU32(
0x2)));
</xsl:text>
649 <xsl:when test=
"$typetype='string'">
651 pResult = get_stringValue();

</xsl:text>
655 pResult = createValue(getU32(
0x2));
</xsl:text>
664 pResult = createValue(getU32(
0x2));
673 <xsl:template match='UML:Model/UML:Namespace.ownedElement' mode='ww8foptename'
>
675 rtl::OUString WW8FOPTE::get_name()
677 return getDffOptName(get_pid());
679 <xsl:call-template name=
"getdffoptname"/>
682 WW8Value::Pointer_t WW8FOPTE::get_stringValue()
684 WW8Value::Pointer_t pResult;
685 DffOPT * pOpt = dynamic_cast
< DffOPT *
>(mpParent);
686 sal_uInt32 nExtraOffset = pOpt-
>get_extraoffset(mnIndex);
687 sal_uInt32 nExtraLength = pOpt-
>get_extraoffset(mnIndex +
1) - nExtraOffset;
688 pResult = createValue(mpParent-
>getString(nExtraOffset, nExtraLength /
2));
693 <xsl:call-template name=
"ww8foptegetvalue"/>
696 <xsl:template match=
"UML:Model" mode=
"createdffrecord">
698 DffRecord * createDffRecord
699 (WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 * pCount)
701 DffRecord * pResult = NULL;
702 DffRecord aTmpRec(pParent, nOffset,
8);
703 sal_uInt32 nSize = aTmpRec.calcSize();
708 switch (aTmpRec.getRecordType())
710 <xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.
idref=
"dffrecord"]'
>
711 <xsl:text> case
</xsl:text>
712 <xsl:value-of select=
".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref='dffid']//UML:TaggedValue.dataValue"/>
714 pResult = new Dff
</xsl:text>
715 <xsl:value-of select=
"@name"/>
716 <xsl:text>(pParent, nOffset, nSize);
718 break;

</xsl:text>
722 pResult = new DffRecord(pParent, nOffset, nSize);
730 DffRecord * createDffRecord
731 (WW8Stream
& rStream, sal_uInt32 nOffset, sal_uInt32 * pCount)
733 DffRecord * pResult = NULL;
734 DffRecord aTmpRec(rStream, nOffset,
8);
735 sal_uInt32 nSize = aTmpRec.calcSize();
740 switch (aTmpRec.getRecordType())
742 <xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.
idref=
"dffrecord"]'
>
743 <xsl:text> case
</xsl:text>
744 <xsl:value-of select=
".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref='dffid']//UML:TaggedValue.dataValue"/>
746 pResult = new Dff
</xsl:text>
747 <xsl:value-of select=
"@name"/>
748 <xsl:text>(rStream, nOffset, nSize);
750 break;

</xsl:text>
754 pResult = new DffRecord(rStream, nOffset, nSize);
764 <xsl:template match=
"UML:Attribute" mode=
"initmembers">
765 <xsl:variable name=
"stereotype"><xsl:value-of select=
".//UML:Stereotype/@xmi.idref"/></xsl:variable>
766 <xsl:variable name=
"offset_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"offset"]/UML:TaggedValue.dataValue,
"ABCDEFX",
"abcdefx")'
/></xsl:variable>
767 <xsl:variable name=
"offset">
768 <xsl:if test='$offset_ !=
"" and not(starts-with($offset_,
"0x"))'
>0x
</xsl:if>
769 <xsl:value-of select='$offset_'
/>
771 <xsl:variable name=
"shift"><xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"shift"]/UML:TaggedValue.dataValue'
/></xsl:variable>
772 <xsl:variable name=
"mask_"><xsl:value-of select='translate(.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"mask"]/UML:TaggedValue.dataValue,
"ABCDEFX",
"abcdefx")'
/></xsl:variable>
773 <xsl:variable name=
"mask">
774 <xsl:if test='$mask_ !=
"" and not(starts-with($mask_,
"0x"))'
>0x
</xsl:if>
775 <xsl:value-of select='$mask_'
/>
777 <xsl:variable name=
"type"><xsl:value-of select='.//UML:DataType/@xmi.idref'
/></xsl:variable><xsl:variable name=
"saltype">
778 <xsl:call-template name='saltype'
>
779 <xsl:with-param name='type'
>
780 <xsl:value-of select='$type'
/>
786 <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.
idref=
"comment"]/UML:TaggedValue.dataValue'
/>
788 Name:
<xsl:value-of select='@name'
/>(
<xsl:value-of select='$stereotype'
/>)
789 Offset:
<xsl:value-of select='$offset'
/>
790 Mask:
<xsl:value-of select='$mask'
/>
791 Shift:
<xsl:value-of select='$shift'
/>
795 <xsl:when test='$stereotype =
"attribute"'
>
796 m
<xsl:value-of select='@name'
/> = (get
<xsl:value-of select=
"$type"/>(
<xsl:value-of select=
"$offset"/>)
<xsl:if test=
"string-length($mask)>0"> & <xsl:value-of select=
"$mask"/></xsl:if>)
<xsl:if test=
"$shift>0"> >> <xsl:value-of select=
"$shift"/></xsl:if>;
798 <xsl:when test='$stereotype =
"array"'
>
801 sal_uInt32 nCount =
</xsl:text>
802 <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref =
"arraycount"]/UML:TaggedValue.dataValue'
/>
805 <xsl:value-of select='@name'
/>
806 <xsl:text> = new
</xsl:text><xsl:value-of select='$saltype'
/><xsl:text>[nCount];
808 for (sal_uInt32 n =
0; n
< nCount; ++n)
809 m
</xsl:text><xsl:value-of select='@name'
/><xsl:text>[n] = get
</xsl:text>
810 <xsl:value-of select='$type'
/>
811 <xsl:text>(
</xsl:text>
812 <xsl:value-of select='$offset'
/>
813 <xsl:text> + nIndex * sizeof(
</xsl:text>
814 <xsl:value-of select='$saltype'
/>
819 <xsl:when test='$stereotype =
"string"'
>
820 m
<xsl:value-of select='@name'
/> = getString(
<xsl:value-of select='$offset'
/>)
825 <xsl:template match=
"UML:Model" mode=
"isbooleandffopt">
827 bool isBooleanDffOpt(sal_uInt32 nId)
829 bool bResult = false;
833 <xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.
idref=
"dffopt"]'
>
834 <xsl:if test=
".//UML:TagDefinition[@xmi.idref='isbool']">
835 <xsl:text> case
</xsl:text>
836 <xsl:variable name=
"optname">
837 <xsl:value-of select=
".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref='optname']//UML:TaggedValue.dataValue"/>
839 <xsl:call-template name=
"idtoqname">
840 <xsl:with-param name=
"id" select=
"$optname"/>
842 <xsl:text>:

</xsl:text>