1
|
<?xml version="1.0"?>
|
2
|
<sm:freeOdWidget xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" code="mathTexInline">
|
3
|
<sm:widgetBsFragment contentFormat="od"><source type="xslOnSrc-dynamique">
|
4
|
<xsl:stylesheet version="1.0"
|
5
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
6
|
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
7
|
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
|
8
|
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
9
|
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
10
|
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
11
|
xmlns:sl="http://www.utc.fr/ics/scenari/v3/library"
|
12
|
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
13
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
14
|
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
15
|
xmlns:java="http://xml.apache.org/xslt/java"
|
16
|
xmlns:scodPp="scenari.eu:openDocumentExtension.postprocessing:1.0"
|
17
|
xmlns:scod="scenari.eu:openDocumentExtension:1.0"
|
18
|
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
19
|
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
|
20
|
exclude-result-prefixes="table sp office draw style svg sl fo xlink java scodPp scod text sc ">
|
21
|
<xsl:output omit-xml-declaration="yes" indent="no" method="xml" />
|
22
|
<xsl:param name="vAgent" />
|
23
|
<xsl:param name="vDialog" />
|
24
|
<xsl:variable select="getIdNode(.)" name="idRootAgt" />
|
25
|
<xsl:template match="*">
|
26
|
<xsl:variable name="vInfosRes" select="computeStrAgent('viewResource/genResSize')"/>
|
27
|
<xsl:variable name="vWidth" select="substring-before(substring-after($vInfosRes, 'w='), ';')"/>
|
28
|
<xsl:variable name="vHeight" select="substring-before(substring-after($vInfosRes, 'h='), ';')"/>
|
29
|
<xsl:variable name="vExistRes" select="boolean($vInfosRes)"/>
|
30
|
|
31
|
<xsl:comment> ### IMAGE ### infores : <xsl:copy-of select="$vInfosRes"/></xsl:comment>
|
32
|
<xsl:choose>
|
33
|
<xsl:when test="$vExistRes">
|
34
|
<draw:frame
|
35
|
svg:height="{normalize-space($vHeight)}cm"
|
36
|
svg:width="{normalize-space($vWidth)}cm"
|
37
|
svg:y="-{normalize-space(computeStrAgent('viewResource/Dep'))}cm"
|
38
|
svg:x="0cm"
|
39
|
draw:z-index="{getEntryBuffer('odStyleBlocks', '_globalsStyles_viewPicture')/text:p/draw:frame/@draw:z-index}"
|
40
|
text:anchor-type="as-char"
|
41
|
draw:style-name="{getEntryBuffer('odStyleBlocks', '_globalsStyles_viewPicture')/text:p/draw:frame/@draw:style-name}"
|
42
|
draw:name="{local-name()}">
|
43
|
<draw:image>
|
44
|
<xsl:attribute name="scod:src">
|
45
|
<xsl:value-of select="concat('dest:', computeStrAgent('viewResource/genResUri'))" />
|
46
|
</xsl:attribute>
|
47
|
<xsl:attribute name="xlink:type">simple</xsl:attribute>
|
48
|
<xsl:attribute name="xlink:show">embed</xsl:attribute>
|
49
|
<xsl:attribute name="xlink:actuate">onLoad</xsl:attribute>
|
50
|
</draw:image>
|
51
|
</draw:frame>
|
52
|
</xsl:when>
|
53
|
<xsl:otherwise>
|
54
|
<scodPp:error text="Ressource manquante" phase="generation" type="error">La ressource '<xsl:value-of select="computeStrAgent('viewResource/outFileName')"/>' est introuvable.</scodPp:error>
|
55
|
</xsl:otherwise>
|
56
|
</xsl:choose>
|
57
|
</xsl:template>
|
58
|
|
59
|
</xsl:stylesheet>
|
60
|
</source>
|
61
|
|
62
|
<set code="viewResource">
|
63
|
<!-- parametres -->
|
64
|
<valeur code="maxWidth"><source>10</source></valeur>
|
65
|
<valeur code="maxHeight"><source>6</source></valeur>
|
66
|
<valeur code="scale"><source>1.2</source></valeur>
|
67
|
|
68
|
<valeur code="outFileName">
|
69
|
<source type="xpathOnSrc-dynamique">
|
70
|
concat('agt',alphaHash(codeAgent('//')),'_',java:com.scenari.s.fw.utils.HCharSeqUtil.stringWithoutAccent(java:getSrcName(srcFileAgent())))
|
71
|
</source>
|
72
|
</valeur>
|
73
|
<valeur code="odResPath">
|
74
|
<source type="xpathOnSrc-dynamique">
|
75
|
concat(computeStrAgent('/@@/pathBinaryInOdFile'), '/', extractFileNameFromPath(computeStrAgent('../genResUri')))
|
76
|
</source>
|
77
|
</valeur>
|
78
|
<valeur code="genResUri">
|
79
|
<source type="xpathOnSrc-dynamique">computeStrAgent('//', concat(
|
80
|
'resUri:src=src:', java:getSrcUri(srcFileAgent()),
|
81
|
';transform=latex2img&amp;resolution=300&amp;scale=',computeStrAgent('../scale'),
|
82
|
'&amp;;mutabledst=', computeStrAgent('/@@/destPathBinaryTmp'), '/', computeStrAgent('../outFileName'),
|
83
|
''
|
84
|
))
|
85
|
</source>
|
86
|
</valeur>
|
87
|
<valeur code="genResSize">
|
88
|
<source type="xpathOnSrc-dynamique">
|
89
|
computeStrAgent('//', concat('get:src:',java:getSrcUri(srcFileAgent()), '?',
|
90
|
'transform=latex2img&amp;resolution=300&amp;scale=',computeStrAgent('../scale'),'&amp;transform=img2img&amp;sizeRules=Dim(Sc(ratio''1''srcDpi''300'')Bounds(unit''cm''maxW''',computeStrAgent('../maxWidth'),'''maxH''',computeStrAgent('../maxHeight'),'''))&amp;outType=DIMS&amp;outRules='
|
91
|
, "Str(pattern'w=!wcm;h=!hcm;r=!rot(y,n);')"))
|
92
|
</source>
|
93
|
</valeur>
|
94
|
|
95
|
|
96
|
<valeur code="Dep">
|
97
|
<source type="xpath-dynamique">( 1 - number(computeStrAgent('//', concat('get:src:', java:getSrcUri(srcFileAgent()), '?transform=latex2img&amp;resolution=300&amp;scale=',computeStrAgent('../scale'), '&amp;outType=DIMS&amp;outRules=Str(pattern''!dpc'')')))) * number(substring-before(substring-after(computeStrAgent('../genResSize'), 'h='), ';'))</source>
|
98
|
</valeur>
|
99
|
|
100
|
|
101
|
</set>
|
102
|
</sm:widgetBsFragment>
|
103
|
</sm:freeOdWidget>
|