コード例 #1
0
        public TextState getTextDecoration(FObj parent)
        {
            TextState tsp   = null;
            bool      found = false;

            do
            {
                string fname = parent.GetName();
                if (fname.Equals("fo:flow") || fname.Equals("fo:static-content"))
                {
                    found = true;
                }
                else if (fname.Equals("fo:block") || fname.Equals("fo:inline"))
                {
                    FObjMixed fom = (FObjMixed)parent;
                    tsp   = fom.getTextState();
                    found = true;
                }
                parent = parent.getParent();
            } while (!found);

            TextState ts = new TextState();

            if (tsp != null)
            {
                ts.setUnderlined(tsp.getUnderlined());
                ts.setOverlined(tsp.getOverlined());
                ts.setLineThrough(tsp.getLineThrough());
            }

            int textDecoration = this.properties.GetProperty("text-decoration").GetEnum();

            if (textDecoration == TextDecoration.UNDERLINE)
            {
                ts.setUnderlined(true);
            }
            if (textDecoration == TextDecoration.OVERLINE)
            {
                ts.setOverlined(true);
            }
            if (textDecoration == TextDecoration.LINE_THROUGH)
            {
                ts.setLineThrough(true);
            }
            if (textDecoration == TextDecoration.NO_UNDERLINE)
            {
                ts.setUnderlined(false);
            }
            if (textDecoration == TextDecoration.NO_OVERLINE)
            {
                ts.setOverlined(false);
            }
            if (textDecoration == TextDecoration.NO_LINE_THROUGH)
            {
                ts.setLineThrough(false);
            }

            return(ts);
        }
コード例 #2
0
        public override Status Layout(Area area)
        {
            if (!(area is BlockArea))
            {
                FonetDriver.ActiveDriver.FireFonetError(
                    "Text outside block area" + new String(ca, start, length));
                return(new Status(Status.OK));
            }
            if (this.marker == MarkerStart)
            {
                string fontFamily =
                    this.parent.properties.GetProperty("font-family").GetString();
                string fontStyle =
                    this.parent.properties.GetProperty("font-style").GetString();
                string fontWeight =
                    this.parent.properties.GetProperty("font-weight").GetString();
                int fontSize =
                    this.parent.properties.GetProperty("font-size").GetLength().MValue();
                int fontVariant =
                    this.parent.properties.GetProperty("font-variant").GetEnum();

                int letterSpacing =
                    this.parent.properties.GetProperty("letter-spacing").GetLength().MValue();
                this.fs = new FontState(area.getFontInfo(), fontFamily,
                                        fontStyle, fontWeight, fontSize,
                                        fontVariant, letterSpacing);

                ColorType c = this.parent.properties.GetProperty("color").GetColorType();
                this.red   = c.Red;
                this.green = c.Green;
                this.blue  = c.Blue;

                this.verticalAlign =
                    this.parent.properties.GetVerticalAlign();

                this.wrapOption =
                    (WrapOption)this.parent.properties.GetProperty("wrap-option").GetEnum();
                this.whiteSpaceCollapse =
                    this.parent.properties.GetProperty("white-space-collapse").GetEnum();
                this.ts = new TextState();
                ts.setUnderlined(underlined);
                ts.setOverlined(overlined);
                ts.setLineThrough(lineThrough);

                this.marker = this.start;
            }
            int orig_start = this.marker;

            this.marker = addText((BlockArea)area, fs, red, green, blue,
                                  wrapOption, this.GetLinkSet(),
                                  whiteSpaceCollapse, ca, this.marker, length,
                                  ts, verticalAlign);
            if (this.marker == -1)
            {
                return(new Status(Status.OK));
            }
            else if (this.marker != orig_start)
            {
                return(new Status(Status.AREA_FULL_SOME));
            }
            else
            {
                return(new Status(Status.AREA_FULL_NONE));
            }
        }
コード例 #3
0
        public TextState getTextDecoration(FObj parent)
        {
            TextState tsp   = null;
            bool      found = false;

            do
            {
                switch (parent.ElementName)
                {
                case "fo:flow":
                case "fo:static-content":
                    found = true;
                    break;

                case "fo:block":
                case "fo:inline":
                    FObjMixed fom = (FObjMixed)parent;
                    tsp   = fom.getTextState();
                    found = true;
                    break;
                }
                parent = parent.getParent();
            } while (!found);

            TextState ts = new TextState();

            if (tsp != null)
            {
                ts.setUnderlined(tsp.getUnderlined());
                ts.setOverlined(tsp.getOverlined());
                ts.setLineThrough(tsp.getLineThrough());
            }

            TextDecoration textDecoration = this.properties.GetTextDecoration();

            switch (this.properties.GetTextDecoration())
            {
            case TextDecoration.UNDERLINE:
                ts.setUnderlined(true);
                break;

            case TextDecoration.OVERLINE:
                ts.setOverlined(true);
                break;

            case TextDecoration.LINE_THROUGH:
                ts.setLineThrough(true);
                break;

            case TextDecoration.NO_UNDERLINE:
                ts.setUnderlined(false);
                break;

            case TextDecoration.NO_OVERLINE:
                ts.setOverlined(false);
                break;

            case TextDecoration.NO_LINE_THROUGH:
                ts.setLineThrough(false);
                break;
            }
            return(ts);
        }