Anonymous avatar Anonymous committed 82f5d4f

sw34bf04: #i114533# handle SDT

Comments (0)

Files changed (3)

writerfilter/source/ooxml/dummyannotate.xsl

 
   <xsl:template match="/">
     <out>
-      <xsl:apply-templates select="//rng:define[@name='CT_DocGrid']" 
+      <xsl:apply-templates select="//rng:define[@name='CT_SdtContentCell']" 
                            mode='resourcesPropertySetValue'/>
     </out>
   </xsl:template>

writerfilter/source/ooxml/model.xml

     <resource name="ST_EighthPointMeasure" resource="Integer"/>
     <resource name="ST_PointMeasure" resource="Integer"/>
     <resource name="ST_String" resource="String"/>
-    <resource name="CT_String" resource="Value" tag="attribute" >
+    <resource name="CT_String" resource="Value" tag="attribute">
       <attribute name="val" tokenid="ooxml:CT_String_val" action="setValue"/>
       <action name="start" action="setDefaultStringValue"/>
     </resource>
       <value name="bestFit" tokenid="ooxml:Value_wordprocessingml_ST_Zoom_bestFit">bestFit</value>
       <value name="textFit" tokenid="ooxml:Value_wordprocessingml_ST_Zoom_textFit">textFit</value>
     </resource>
+    <resource name="ST_Percentage" resource="Integer" generated="yes"/>
     <resource name="CT_Zoom" resource="Properties" tag="settings">
       <attribute name="val" tokenid="ooxml:CT_Zoom_val"/>
       <attribute name="percent" tokenid="ooxml:CT_Zoom_percent"/>
       <attribute name="val" tokenid="ooxml:CT_CalendarType_val" action="setValue"/>
       <action name="start" action="setDefaultStringValue"/>
     </resource>
-    <resource name="CT_SdtContentRun" resource="Properties" tag="content"/>
+    <resource name="CT_SdtPr" resource="Properties" tag="field">
+      <element name="rPr" tokenid="ooxml:CT_SdtPr_rPr"/>
+      <element name="alias" tokenid="ooxml:CT_SdtPr_alias"/>
+      <element name="lock" tokenid="ooxml:CT_SdtPr_lock"/>
+      <element name="placeholder" tokenid="ooxml:CT_SdtPr_placeholder"/>
+      <element name="showingPlcHdr" tokenid="ooxml:CT_SdtPr_showingPlcHdr"/>
+      <element name="dataBinding" tokenid="ooxml:CT_SdtPr_dataBinding"/>
+      <element name="temporary" tokenid="ooxml:CT_SdtPr_temporary"/>
+      <element name="id" tokenid="ooxml:CT_SdtPr_id"/>
+      <element name="tag" tokenid="ooxml:CT_SdtPr_tag"/>
+      <element name="equation" tokenid="ooxml:CT_SdtPr_equation"/>
+      <element name="comboBox" tokenid="ooxml:CT_SdtPr_comboBox"/>
+      <element name="date" tokenid="ooxml:CT_SdtPr_date"/>
+      <element name="docPartObj" tokenid="ooxml:CT_SdtPr_docPartObj"/>
+      <element name="docPartList" tokenid="ooxml:CT_SdtPr_docPartList"/>
+      <element name="dropDownList" tokenid="ooxml:CT_SdtPr_dropDownList"/>
+      <element name="picture" tokenid="ooxml:CT_SdtPr_picture"/>
+      <element name="richText" tokenid="ooxml:CT_SdtPr_richText"/>
+      <element name="text" tokenid="ooxml:CT_SdtPr_text"/>
+      <element name="citation" tokenid="ooxml:CT_SdtPr_citation"/>
+      <element name="group" tokenid="ooxml:CT_SdtPr_group"/>
+      <element name="bibliography" tokenid="ooxml:CT_SdtPr_bibliography"/>
+    </resource>
+    <resource name="CT_SdtEndPr" resource="Properties" tag="field">
+      <element name="rPr" tokenid="ooxml:CT_SdtEndPr_rPr"/>
+    </resource>
+    <resource name="CT_SdtContentRun" resource="Stream" tag="field"/>
+    <resource name="CT_SdtContentBlock" resource="Stream" tag="field"/>
+    <resource name="CT_SdtContentRow" resource="Stream" tag="field"/>
+    <resource name="CT_SdtContentCell" resource="Stream" tag="field"/>
+    <resource name="CT_SdtBlock" resource="Stream" tag="field">
+      <element name="sdtPr" tokenid="ooxml:CT_SdtBlock_sdtPr"/>
+      <element name="sdtEndPr" tokenid="ooxml:CT_SdtBlock_sdtEndPr"/>
+      <element name="sdtContent" tokenid="ooxml:CT_SdtBlock_sdtContent"/>
+    </resource>
+    <resource name="CT_SdtRun" resource="Stream" tag="field">
+      <element name="sdtPr" tokenid="ooxml:CT_SdtRun_sdtPr"/>
+      <element name="sdtEndPr" tokenid="ooxml:CT_SdtRun_sdtEndPr"/>
+      <element name="sdtContent" tokenid="ooxml:CT_SdtRun_sdtContent"/>
+    </resource>
+    <resource name="CT_SdtCell" resource="Stream" tag="field">
+      <element name="sdtPr" tokenid="ooxml:CT_SdtCell_sdtPr"/>
+      <element name="sdtEndPr" tokenid="ooxml:CT_SdtCell_sdtEndPr"/>
+      <element name="sdtContent" tokenid="ooxml:CT_SdtCell_sdtContent"/>
+    </resource>
+    <resource name="CT_SdtRow" resource="Stream" tag="field">
+      <element name="sdtPr" tokenid="ooxml:CT_SdtRow_sdtPr"/>
+      <element name="sdtEndPr" tokenid="ooxml:CT_SdtRow_sdtEndPr"/>
+      <element name="sdtContent" tokenid="ooxml:CT_SdtRow_sdtContent"/>
+    </resource>
     <resource name="CT_Attr" resource="Properties" tag="content">
       <attribute name="uri" tokenid="ooxml:CT_Attr_uri"/>
       <attribute name="name" tokenid="ooxml:CT_Attr_name"/>

writerfilter/source/ooxml/modelcleanup.xsl

   <xsl:key name="resources"
            match="resource[not(@generated)]" use="@name" />
 
+  <xsl:key name="resourcetags"
+           match="resource/@tag" use="ancestor::resource/@name"/>
+
   <xsl:template name="generateresource">
     <xsl:param name="resource"/>
     <xsl:element name="resource">
       <xsl:attribute name="generated">
         <xsl:text>yes</xsl:text>
       </xsl:attribute>
+      <xsl:for-each select="key('resourcetags', @name)">
+        <xsl:attribute name="tag">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:for-each>
     </xsl:element>
   </xsl:template>
 
       </xsl:attribute>
       <xsl:attribute name="resource">List</xsl:attribute>
       <xsl:attribute name="generated">yes</xsl:attribute>
+      <xsl:for-each select="key('resourcetags', @name)">
+        <xsl:attribute name="tag">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:for-each>
       <xsl:for-each select=".//rng:value">
         <xsl:element name="value">
           <xsl:attribute name="name">
         
     <xsl:template name="generatevalueresource">
         <xsl:variable name="name" select="@name"/>
+        <xsl:variable name="ns_id" select="generate-id(ancestor::namespace)"/>
         <resource>
             <xsl:attribute name="name">
                 <xsl:value-of select="@name"/>
             </xsl:attribute>
             <xsl:attribute name="resource">Value</xsl:attribute>
             <xsl:attribute name="generated">yes</xsl:attribute>
+            <xsl:for-each select="key('resourcetags', @name)[generate-id(ancestor::namespace) = $ns_id]">
+              <xsl:attribute name="tag">
+                <xsl:value-of select="."/>
+              </xsl:attribute>
+            </xsl:for-each>
             <xsl:for-each select=".//rng:attribute">
                 <xsl:variable name="type">
                     <xsl:choose>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.