Example #1
0
 public PropertyList(
     PropertyList parentPropertyList, string space, string el)
 {
     this.parentPropertyList = parentPropertyList;
     this.nmspace = space;
     this.element = el;
 }
Example #2
0
 protected FObj(FObj parent, PropertyList propertyList)
     : base(parent)
 {
     this.properties = propertyList;
     propertyList.FObj = this;
     this.propMgr = MakePropertyManager(propertyList);
     this.name = "default FO";
     SetWritingMode();
 }
Example #3
0
 public override Property ConvertProperty(
     Property p, PropertyList propertyList, FObj fo)
 {
     if (p is ToBeImplementedProperty)
     {
         return p;
     }
     ToBeImplementedProperty val = new ToBeImplementedProperty(PropName);
     return val;
 }
Example #4
0
 public override Property ConvertProperty(
     Property p, PropertyList propertyList, FObj fo)
 {
     if (p is ListProperty)
     {
         return p;
     }
     else
     {
         return new ListProperty(p);
     }
 }
Example #5
0
 protected UnknownXMLObj(FObj parent, PropertyList propertyList, string space, string tag)
     : base(parent, propertyList, tag)
 {
     this.nmspace = space;
     if (!"".Equals(space))
     {
         this.name = this.nmspace + ":" + tag;
     }
     else
     {
         this.name = "(none):" + tag;
     }
 }
Example #6
0
 protected virtual Property convertValueForProperty(
     string propName, PropertyMaker maker, PropertyList propertyList)
 {
     foreach (Property p in list)
     {
         Property prop = maker.ConvertShorthandProperty(propertyList, p, null);
         if (prop != null)
         {
             return prop;
         }
     }
     return null;
 }
Example #7
0
 public Property GetValueForProperty(string propName,
                                     PropertyMaker maker,
                                     PropertyList propertyList)
 {
     if (count() == 1)
     {
         string sval = ((Property)list[0]).GetString();
         if (sval != null && sval.Equals("inherit"))
         {
             return propertyList.GetFromParentProperty(propName);
         }
     }
     return convertValueForProperty(propName, maker, propertyList);
 }
Example #8
0
 public override Property ConvertProperty(
     Property p, PropertyList propertyList, FObj fo)
 {
     if (p is NumberProperty)
     {
         return p;
     }
     Number val = p.GetNumber();
     if (val != null)
     {
         return new NumberProperty(val);
     }
     return ConvertPropertyDatatype(p, propertyList, fo);
 }
Example #9
0
 public override Property ConvertProperty(
     Property p, PropertyList propertyList, FObj fo)
 {
     if (p is ColorTypeProperty)
     {
         return p;
     }
     ColorType val = p.GetColorType();
     if (val != null)
     {
         return new ColorTypeProperty(val);
     }
     return ConvertPropertyDatatype(p, propertyList, fo);
 }
Example #10
0
 public override Property Make(
     PropertyList propertyList, string value, FObj fo)
 {
     int vlen = value.Length - 1;
     if (vlen > 0)
     {
         char q1 = value[0];
         if (q1 == '"' || q1 == '\'')
         {
             if (value[vlen] == q1)
             {
                 return new StringProperty(value.Substring(1, vlen - 2));
             }
             Console.WriteLine("Warning String-valued property starts with quote"
                 + " but doesn't end with quote: "
                 + value);
         }
     }
     return new StringProperty(value);
 }
Example #11
0
 public override Property ConvertProperty(
     Property p, PropertyList propertyList, FObj fo)
 {
     if (IsAutoLengthAllowed())
     {
         string pval = p.GetString();
         if (pval != null && pval.Equals("auto"))
         {
             return new LengthProperty(new AutoLength());
         }
     }
     if (p is LengthProperty)
     {
         return p;
     }
     Length val = p.GetLength();
     if (val != null)
     {
         return new LengthProperty(val);
     }
     return ConvertPropertyDatatype(p, propertyList, fo);
 }
Example #12
0
 public PropertyManager(PropertyList pList)
 {
     this.properties = pList;
 }
Example #13
0
 internal Property MakeProperty(PropertyList propertyList, string propertyName)
 {
     Property p = null;
     PropertyMaker propertyMaker = FindMaker(propertyName);
     if (propertyMaker != null)
     {
         p = propertyMaker.Make(propertyList);
     }
     else
     {
         FonetDriver.ActiveDriver.FireFonetWarning("property " + propertyName + " ignored");
     }
     return p;
 }
Example #14
0
 private Property ComputeProperty(
     PropertyList propertyList, PropertyMaker propertyMaker)
 {
     Property p = null;
     try
     {
         p = propertyMaker.Compute(propertyList);
     }
     catch (FonetException e)
     {
         FonetDriver.ActiveDriver.FireFonetError(e.Message);
     }
     return p;
 }
Example #15
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new FObjMixed(parent, propertyList));
 }
Example #16
0
 internal Property GetShorthand(PropertyList propertyList, string propertyName)
 {
     PropertyMaker propertyMaker = FindMaker(propertyName);
     if (propertyMaker != null)
     {
         return propertyMaker.GetShorthand(propertyList);
     }
     else
     {
         FonetDriver.ActiveDriver.FireFonetError("No maker for " + propertyName);
         return null;
     }
 }
Example #17
0
 protected Unknown(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "unknown";
 }
Example #18
0
 public virtual FObj Make(FObj parent, PropertyList propertyList)
 {
     return new FObj(parent, propertyList);
 }
Example #19
0
 public XMLElement(FObj parent, PropertyList propertyList, string tag)
     : base(parent, propertyList, tag)
 {
     Init();
 }
Example #20
0
 protected Title(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:title";
 }
Example #21
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return new Unknown(parent, propertyList);
 }
Example #22
0
        internal PropertyList MakeList(
            string ns,
            string elementName,
            Attributes attributes,
            FObj parentFO)
        {
            Debug.Assert(ns != null, "Namespace should never be null.");

            string space = "http://www.w3.org/TR/1999/XSL/Format";
            if (ns != null)
            {
                space = ns;
            }

            PropertyList parentPropertyList = parentFO != null ? parentFO.properties : null;
            PropertyList par = null;
            if (parentPropertyList != null && space.Equals(parentPropertyList.GetNameSpace()))
            {
                par = parentPropertyList;
            }

            PropertyList p = new PropertyList(par, space, elementName);
            p.SetBuilder(this);

            StringCollection propsDone = new StringCollection();

            string fontsizeval = attributes.getValue(FONTSIZEATTR);
            if (fontsizeval != null)
            {
                PropertyMaker propertyMaker = FindMaker(FONTSIZEATTR);
                if (propertyMaker != null)
                {
                    try
                    {
                        p.Add(FONTSIZEATTR,
                              propertyMaker.Make(p, fontsizeval, parentFO));
                    }
                    catch (FonetException) { }
                }
                propsDone.Add(FONTSIZEATTR);
            }

            for (int i = 0; i < attributes.getLength(); i++)
            {
                string attributeName = attributes.getQName(i);
                int sepchar = attributeName.IndexOf('.');
                string propName = attributeName;
                string subpropName = null;
                Property propVal = null;
                if (sepchar > -1)
                {
                    propName = attributeName.Substring(0, sepchar);
                    subpropName = attributeName.Substring(sepchar + 1);
                }
                else if (propsDone.Contains(propName))
                {
                    continue;
                }

                PropertyMaker propertyMaker = FindMaker(propName);

                if (propertyMaker != null)
                {
                    try
                    {
                        if (subpropName != null)
                        {
                            Property baseProp = p.GetExplicitBaseProperty(propName);
                            if (baseProp == null)
                            {
                                string baseValue = attributes.getValue(propName);
                                if (baseValue != null)
                                {
                                    baseProp = propertyMaker.Make(p, baseValue, parentFO);
                                    propsDone.Add(propName);
                                }
                            }
                            propVal = propertyMaker.Make(baseProp, subpropName,
                                                         p,
                                                         attributes.getValue(i),
                                                         parentFO);
                        }
                        else
                        {
                            propVal = propertyMaker.Make(p,
                                                         attributes.getValue(i),
                                                         parentFO);
                        }
                        if (propVal != null)
                        {
                            p[propName] = propVal;
                        }
                    }
                    catch (FonetException e)
                    {
                        FonetDriver.ActiveDriver.FireFonetError(e.Message);
                    }
                }
                else
                {
                    if (!attributeName.StartsWith("xmlns"))
                    {
                        FonetDriver.ActiveDriver.FireFonetWarning(
                            "property " + attributeName + " ignored");
                    }
                }
            }

            return p;
        }
Example #23
0
 public override XMLElement Make(FObj parent, PropertyList propertyList)
 {
     return(new XMLElement(parent, propertyList, tag));
 }
Example #24
0
        internal PropertyList MakeList(
            string ns,
            string elementName,
            Attributes attributes,
            FObj parentFO)
        {
            Debug.Assert(ns != null, "Namespace should never be null.");

            string space = "http://www.w3.org/TR/1999/XSL/Format";

            if (ns != null)
            {
                space = ns;
            }

            PropertyList parentPropertyList = parentFO != null ? parentFO.properties : null;
            PropertyList par = null;

            if (parentPropertyList != null && space.Equals(parentPropertyList.GetNameSpace()))
            {
                par = parentPropertyList;
            }

            PropertyList p = new PropertyList(par, space, elementName);

            p.SetBuilder(this);

            StringCollection propsDone = new StringCollection();

            string fontsizeval = attributes.getValue(FONTSIZEATTR);

            if (fontsizeval != null)
            {
                PropertyMaker propertyMaker = FindMaker(FONTSIZEATTR);
                if (propertyMaker != null)
                {
                    try
                    {
                        p.Add(FONTSIZEATTR,
                              propertyMaker.Make(p, fontsizeval, parentFO));
                    }
                    catch (FonetException) { }
                }
                propsDone.Add(FONTSIZEATTR);
            }

            for (int i = 0; i < attributes.getLength(); i++)
            {
                string   attributeName = attributes.getQName(i);
                int      sepchar       = attributeName.IndexOf('.');
                string   propName      = attributeName;
                string   subpropName   = null;
                Property propVal       = null;
                if (sepchar > -1)
                {
                    propName    = attributeName.Substring(0, sepchar);
                    subpropName = attributeName.Substring(sepchar + 1);
                }
                else if (propsDone.Contains(propName))
                {
                    continue;
                }

                PropertyMaker propertyMaker = FindMaker(propName);

                if (propertyMaker != null)
                {
                    try
                    {
                        if (subpropName != null)
                        {
                            Property baseProp = p.GetExplicitBaseProperty(propName);
                            if (baseProp == null)
                            {
                                string baseValue = attributes.getValue(propName);
                                if (baseValue != null)
                                {
                                    baseProp = propertyMaker.Make(p, baseValue, parentFO);
                                    propsDone.Add(propName);
                                }
                            }
                            propVal = propertyMaker.Make(baseProp, subpropName,
                                                         p,
                                                         attributes.getValue(i),
                                                         parentFO);
                        }
                        else
                        {
                            propVal = propertyMaker.Make(p,
                                                         attributes.getValue(i),
                                                         parentFO);
                        }
                        if (propVal != null)
                        {
                            p[propName] = propVal;
                        }
                    }
                    catch (FonetException e)
                    {
                        FonetDriver.ActiveDriver.FireFonetError(e.Message);
                    }
                }
                else
                {
                    if (!attributeName.StartsWith("xmlns"))
                    {
                        FonetDriver.ActiveDriver.FireFonetWarning(
                            "property " + attributeName + " ignored");
                    }
                }
            }

            return(p);
        }
Example #25
0
 public override UnknownXMLObj Make(FObj parent,
                                    PropertyList propertyList)
 {
     return(new UnknownXMLObj(parent, propertyList, space, tag));
 }
Example #26
0
 protected PropertyManager MakePropertyManager(PropertyList propertyList)
 {
     return new PropertyManager(propertyList);
 }
Example #27
0
 public XMLElement(FObj parent, PropertyList propertyList, string tag)
     : base(parent, propertyList, tag)
 {
     Init();
 }
 protected ToBeImplementedElement(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Example #29
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return new Title(parent, propertyList);
 }
Example #30
0
 public override FObj Make(FObj parent,
                           PropertyList propertyList)
 {
     return new UnknownXMLObj(parent, propertyList, space, tag);
 }
Example #31
0
 protected Unknown(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "unknown";
 }
Example #32
0
 public XMLObj(FObj parent, PropertyList propertyList, string tag)
     : base(parent, propertyList)
 {
     tagName = tag;
 }
Example #33
0
 protected UnknownXMLObj(FObj parent, PropertyList propertyList, string space, string tag)
     : base(parent, propertyList, tag)
 {
     this.nmspace = space;
 }
Example #34
0
 public virtual FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new FObj(parent, propertyList));
 }
Example #35
0
 protected Title(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:title";
 }
Example #36
0
 public LengthBase(FObj parentFO, PropertyList plist, int iBaseType)
 {
     this.parentFO = parentFO;
     this.propertyList = plist;
     this.iBaseType = iBaseType;
 }
Example #37
0
 public PropertyManager(PropertyList pList)
 {
     this.properties = pList;
 }
Example #38
0
 /// <summary>
 ///     Return a Property object based on the passed Property object.
 ///     This method is called if the Property object built by the parser
 ///     isn't the right type for this property.
 ///     It is overridden by subclasses when the property specification in
 ///     foproperties.xml specifies conversion rules.
 /// </summary>
 /// <param name="p">The Property object return by the expression parser</param>
 /// <param name="propertyList">The PropertyList object being built for this FO.</param>
 /// <param name="fo">The current FO whose properties are being set.</param>
 /// <returns>
 ///     A Property of the correct type or null if the parsed value
 ///     can't be converted to the correct type.
 /// </returns>
 public virtual Property ConvertProperty(Property p,
                                         PropertyList propertyList,
                                         FObj fo)
 {
     return(null);
 }
Example #39
0
 protected PropertyManager MakePropertyManager(PropertyList propertyList)
 {
     return(new PropertyManager(propertyList));
 }
Example #40
0
 protected virtual Property ConvertPropertyDatatype(Property p,
                                                    PropertyList propertyList,
                                                    FObj fo)
 {
     return(null);
 }
Example #41
0
        private void StartElement(
            string uri,
            string localName,
            Attributes attlist)
        {
            FObj.MakerBase fobjMaker = GetFObjMaker(uri, localName);

            PropertyListBuilder currentListBuilder =
                (PropertyListBuilder)this.propertylistTable[uri];

            bool foreignXML = false;

            if (fobjMaker == null)
            {
                string fullName = uri + "^" + localName;
                if (!this.unknownFOs.ContainsKey(fullName))
                {
                    this.unknownFOs.Add(fullName, "");
                    FonetDriver.ActiveDriver.FireFonetError("Unknown formatting object " + fullName);
                }
                //if (namespaces.Contains(String.Intern(uri)))
                if (namespaces.Contains(uri))
                {
                    fobjMaker = Unknown.GetMaker();
                }
                else
                {
                    fobjMaker  = UnknownXMLObj.GetMaker(uri, localName);
                    foreignXML = true;
                }
            }

            PropertyList list = null;

            if (currentListBuilder != null)
            {
                list = currentListBuilder.MakeList(uri, localName, attlist, currentFObj);
            }
            else if (foreignXML)
            {
                list = null;
            }
            else
            {
                if (currentFObj == null)
                {
                    throw new FonetException("Invalid XML or missing namespace");
                }
                list = currentFObj.properties;
            }
            //
            FObj fobj = fobjMaker.InnerMake(currentFObj, list);

            if (rootFObj == null)
            {
                rootFObj = fobj;
                if (!fobj.ElementName.Equals("fo:root"))
                {
                    throw new FonetException("Root element must" + " be root, not " + fobj.ElementName);
                }
            }
            else if (!(fobj is PageSequence))
            {
                currentFObj.AddChild(fobj);
            }

            currentFObj = fobj;
        }
Example #42
0
 /// <summary>
 ///     Return a Property object representing the initial value.
 /// </summary>
 /// <param name="propertyList">The PropertyList object being built for this FO.</param>
 /// <returns></returns>
 public virtual Property Make(PropertyList propertyList)
 {
     return(null);
 }
Example #43
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new Unknown(parent, propertyList));
 }
Example #44
0
 /// <summary>
 ///     Return a Property object representing the initial value.
 /// </summary>
 /// <param name="propertyList">The PropertyList object being built for this FO.</param>
 /// <param name="parentFO">The parent FO for the FO whose property is being made.</param>
 /// <returns>
 ///     A Property subclass object holding a "compound" property object
 ///     initialized to the default values for each component.
 /// </returns>
 protected virtual Property MakeCompound(PropertyList propertyList,
                                         FObj parentFO)
 {
     return(null);
 }
Example #45
0
 public virtual bool IsCorrespondingForced(PropertyList propertyList)
 {
     return(false);
 }
Example #46
0
 public virtual Property GetShorthand(PropertyList propertyList)
 {
     return(null);
 }
Example #47
0
 protected FObjMixed(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Example #48
0
 /// <summary>
 ///     Return an object implementing the PercentBase interface.  This is
 ///     used to handle properties specified as a percentage of some "base
 ///     length", such as the content width of their containing box.
 ///     Overridden by subclasses which allow percent specifications. See
 ///     the documentation on properties.xsl for details.
 /// </summary>
 /// <param name="fo"></param>
 /// <param name="pl"></param>
 /// <returns></returns>
 public virtual IPercentBase GetPercentBase(FObj fo, PropertyList pl)
 {
     return(null);
 }
Example #49
0
 protected ToBeImplementedElement(FObj parent, PropertyList propertyList)
     : base(parent, propertyList) { }
Example #50
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return new XMLElement(parent, propertyList, tag);
 }
Example #51
0
 public XMLObj(FObj parent, PropertyList propertyList, string tag)
     : base(parent, propertyList)
 {
     tagName = tag;
 }
Example #52
0
 protected FObjMixed(FObj parent, PropertyList propertyList)
     : base(parent, propertyList) { }