[Libreoffice-commits] core.git: officecfg/registry officecfg/util

Stephan Bergmann sbergman at redhat.com
Wed Apr 18 06:48:26 UTC 2018


 officecfg/registry/data/org/openoffice/Office/Impress.xcu |    4 ++--
 officecfg/util/data_val.xsl                               |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit d2799676584b51f66721717b69a5604cf4a65af8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 17 23:15:45 2018 +0200

    Find non-set-elements marked as mandatory
    
    Change-Id: I7f75c835339b61ba9e545c13d7e5bb208c12df4c
    Reviewed-on: https://gerrit.libreoffice.org/53069
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu
index 72d2fb8b4155..b8323973c891 100644
--- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu
@@ -195,12 +195,12 @@
       <value oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/transitions.xml;vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/transitions-ogl.xml</value>
     </prop>
   </node>
-  <node oor:name="Pictures" oor:op="fuse" oor:mandatory="true">
+  <node oor:name="Pictures" oor:op="fuse">
     <prop oor:name="Path">
       <value>$(work)</value>
     </prop>
   </node>
-  <node oor:name="Sound" oor:op="fuse" oor:mandatory="true">
+  <node oor:name="Sound" oor:op="fuse">
     <prop oor:name="Path">
       <value>$(work)</value>
     </prop>
diff --git a/officecfg/util/data_val.xsl b/officecfg/util/data_val.xsl
index 97508eb34a00..3e2200dbd526 100644
--- a/officecfg/util/data_val.xsl
+++ b/officecfg/util/data_val.xsl
@@ -48,6 +48,7 @@
             <xsl:apply-templates select=".">
                 <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/>
                 <xsl:with-param name="component-schema" select="$component-schema"/>
+                <xsl:with-param name="parent-schema-type" select="local-name($component-schema)"/>
             </xsl:apply-templates>
         </xsl:for-each>
     </xsl:template>
@@ -72,9 +73,11 @@
 
         <xsl:choose>
             <xsl:when test="$schema-type='node-ref'">
+                <xsl:variable name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/>
                 <xsl:apply-templates select=".">
-                    <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/>
+                    <xsl:with-param name="context" select="$context"/>
                     <xsl:with-param name="component-schema" select="$component-schema"/>
+                    <xsl:with-param name="parent-schema-type" select="local-name($context)"/>
                 </xsl:apply-templates>
             </xsl:when>
             <xsl:when test="$schema-type='set'">
@@ -82,6 +85,7 @@
                     <xsl:apply-templates select=".">
                         <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/>
                         <xsl:with-param name="component-schema" select="$component-schema"/>
+                        <xsl:with-param name="parent-schema-type" select="$schema-type"/>
                     </xsl:apply-templates>
                 </xsl:for-each>
             </xsl:when>
@@ -99,6 +103,7 @@
     <xsl:template match="node">
         <xsl:param name = "context"/>
         <xsl:param name = "component-schema"/>
+        <xsl:param name = "parent-schema-type"/>
         <xsl:variable name = "path">
             <xsl:call-template name="collectPath"/>
         </xsl:variable>
@@ -139,6 +144,7 @@
                     <xsl:apply-templates select="." mode="extensible">
                         <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/>
                         <xsl:with-param name="component-schema" select="$component-schema"/>
+                        <xsl:with-param name="parent-schema-type" select="local-name($context)"/>
                     </xsl:apply-templates>
                 </xsl:for-each>
             </xsl:when>
@@ -147,10 +153,15 @@
                     <xsl:apply-templates select=".">
                         <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/>
                         <xsl:with-param name="component-schema" select="$component-schema"/>
+                        <xsl:with-param name="parent-schema-type" select="local-name($context)"/>
                     </xsl:apply-templates>
                 </xsl:for-each>
             </xsl:otherwise>
         </xsl:choose>
+
+        <xsl:if test="@oor:mandatory='true' and $parent-schema-type!='set'">
+            <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' that is not a set element is marked as mandatory!</xsl:message>
+        </xsl:if>
     </xsl:template>
 
 <!-- ****************************************** -->


More information about the Libreoffice-commits mailing list