Beispiel #1
0
        ///
        ///	 <summary> * heuristics to check which version an element of a Layout is in: 1.3 or
        ///	 * 1.2
        ///	 *
        ///	 * Note that this routine is static since it must be used on all sheets,
        ///	 * surfaces etc.
        ///	 *  </summary>
        ///	 * <param name="sheet">
        ///	 *            the Sheet, Surface, Signature or Layout to check </param>
        ///	 * <returns> true if this is a new, i.e. partitioned Layout
        ///	 *  </returns>
        ///
        public static bool isNewLayout(JDFResource sheet)
        {
            // not one of Layout, Signature, Sheet or Surface
            if (!(sheet is JDFLayout))
            {
                return(false);
            }

            // either Signature, Sheet or Surface --> old
            if (!sheet.LocalName.Equals(ElementName.LAYOUT))
            {
                return(false);
            }

            // it's a layout the only allowed (old) element is a signature , if it
            // exists --> old
            if (sheet.getElement_KElement(ElementName.SIGNATURE, null, 0) != null)
            {
                return(false);
            }
            // it is a layout and it has no subelements and it is partitioned -->
            // new
            JDFResource resourceRoot = sheet.getResourceRoot();

            if (resourceRoot.hasAttribute(AttributeName.PARTIDKEYS))
            {
                return(true);
            }
            // it is a non partitioned layout and it has palacedobjects --> new
            if (resourceRoot.hasChildElement(ElementName.CONTENTOBJECT, null) || resourceRoot.hasChildElement(ElementName.MARKOBJECT, null))
            {
                return(true);
            }

            // now I'm ready to punt - no partition and no subelements --> assume
            // that version tags are correct
            EnumVersion v = sheet.getVersion(true);

            // no version, we are 1.3 --> assume 1.3
            if (v == null)
            {
                return(true);
            }

            return(v.getValue() >= EnumVersion.Version_1_3.getValue());
        }