Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }