Exemple #1
0
        public override Property Eval(Property[] args, PropertyInfo pInfo)
        {
            Length distance =
                pInfo.getPropertyList().GetProperty("provisional-distance-between-starts").GetLength();
            Length separation =
                pInfo.getPropertyList().GetNearestSpecifiedProperty("provisional-label-separation").GetLength();

            FObj item = pInfo.getFO();
            while (item != null && !(item is ListItem))
            {
                item = item.getParent();
            }
            if (item == null)
            {
                throw new PropertyException("label-end() called from outside an fo:list-item");
            }
            Length startIndent = item.properties.GetProperty("start-indent").GetLength();

            LinearCombinationLength labelEnd = new LinearCombinationLength();

            LengthBase bse = new LengthBase(item, pInfo.getPropertyList(),
                                            LengthBase.CONTAINING_BOX);
            PercentLength refWidth = new PercentLength(1.0, bse);

            labelEnd.AddTerm(1.0, refWidth);
            labelEnd.AddTerm(-1.0, distance);
            labelEnd.AddTerm(-1.0, startIndent);
            labelEnd.AddTerm(1.0, separation);

            labelEnd.ComputeValue();

            return new LengthProperty(labelEnd);
        }
Exemple #2
0
 public override Property Eval(Property[] args, PropertyInfo pInfo)
 {
     Number dbl = args[0].GetNumber();
     if (dbl == null)
     {
         throw new PropertyException("Non number operand to ceiling function");
     }
     return new NumberProperty(Math.Ceiling(dbl.DoubleValue()));
 }
Exemple #3
0
 public override Property Eval(Property[] args, PropertyInfo pInfo)
 {
     Number dbl = args[0].GetNumber();
     if (dbl == null)
     {
         throw new PropertyException("Non number operand to round function");
     }
     double n = dbl.DoubleValue();
     double r = Math.Floor(n + 0.5);
     if (r == 0.0 && n < 0.0)
     {
         r = -r;
     }
     return new NumberProperty(r);
 }
Exemple #4
0
        public override Property Eval(Property[] args, PropertyInfo pInfo)
        {
            Numeric distance = pInfo.getPropertyList().GetProperty("provisional-distance-between-starts").GetNumeric();

            FObj item = pInfo.getFO();
            while (item != null && !(item is ListItem))
            {
                item = item.getParent();
            }
            if (item == null)
            {
                throw new PropertyException("body-start() called from outside an fo:list-item");
            }

            Numeric startIndent =
                item.properties.GetProperty("start-indent").GetNumeric();

            return new NumericProperty(distance.add(startIndent));
        }
Exemple #5
0
        public override Property Eval(Property[] args, PropertyInfo pInfo)
        {
            float[] cfvals = new float[3];
            for (int i = 0; i < 3; i++)
            {
                Number cval = args[i].GetNumber();
                if (cval == null)
                {
                    throw new PropertyException("Argument to rgb() must be a Number");
                }
                float colorVal = cval.FloatValue() / 255f;
                if (colorVal < 0.0 || colorVal > 255.0)
                {
                    FonetDriver.ActiveDriver.FireFonetWarning(
                        String.Format("Normalising colour value {0} to 0", cval.FloatValue()));

                    colorVal = 0.0f;
                }
                cfvals[i] = colorVal;
            }
            return new ColorTypeProperty(new ColorType(cfvals[0], cfvals[1],
                                                       cfvals[2]));

        }
Exemple #6
0
 public abstract Property Eval(Property[] args, PropertyInfo propInfo);
Exemple #7
0
 private PropertyParser(string propExpr, PropertyInfo pInfo)
     : base(propExpr)
 {
     this.propInfo = pInfo;
 }
Exemple #8
0
 public static Property parse(string expr, PropertyInfo propInfo)
 {
     return new PropertyParser(expr, propInfo).parseProperty();
 }