Beispiel #1
0
 internal HighLightSegment(Interop.IHighlightRenderingServices render, Interop.IHTMLRenderStyle renderStyle, Interop.IDisplayPointer dpStart, Interop.IDisplayPointer dpEnd, Interop.IHTMLTxtRange range)
 {
     Interop.IHighlightSegment ppI;
     this.render = render;
     this.range  = range;
     this.render.AddSegment(dpStart, dpEnd, renderStyle, out ppI);
     this.ppISegment = ppI;
 }
Beispiel #2
0
        public Interop.IHTMLRenderStyle GetRenderStyle(Interop.IHTMLDocument2 ActiveDocument)
        {
            Interop.IHTMLRenderStyle renderStyle = ((Interop.IHTMLDocument4)ActiveDocument).createRenderStyle(null);
            renderStyle.defaultTextSelection = IsDefault ? "true" : "false";
            renderStyle.renderingPriority    = (int)this.priority;
            switch (lineType)
            {
            default:
            case LineType.None:
                renderStyle.textDecoration      = "none";
                renderStyle.textBackgroundColor = textBackgroundColor.ColorName;
                if (textColor.Type == ColorType.Auto || textColor.Type == ColorType.Inherit)
                {
                    renderStyle.textColor = ((Interop.IHTMLCurrentStyle)((Interop.IHTMLElement2)ActiveDocument.GetBody()).GetCurrentStyle()).getAttribute("color", 1);
                }
                else
                {
                    renderStyle.textColor = textColor.ColorName;
                }
                break;

            case LineType.Overline:
                renderStyle.textDecoration      = "overline";
                renderStyle.textDecorationColor = lineColor.ColorName;
                renderStyle.textBackgroundColor = textBackgroundColor.ColorName;
                if (textColor.Type == ColorType.Auto || textColor.Type == ColorType.Inherit)
                {
                    renderStyle.textColor = ((Interop.IHTMLCurrentStyle)((Interop.IHTMLElement2)ActiveDocument.GetBody()).GetCurrentStyle()).getAttribute("color", 1);
                }
                else
                {
                    renderStyle.textColor = textColor.ColorName;
                }
                break;

            case LineType.Underline:
                renderStyle.textDecoration      = "underline";
                renderStyle.textDecorationColor = lineColor.ColorName;
                renderStyle.textBackgroundColor = textBackgroundColor.ColorName;
                if (textColor.Type == ColorType.Auto || textColor.Type == ColorType.Inherit)
                {
                    renderStyle.textColor = ((Interop.IHTMLCurrentStyle)((Interop.IHTMLElement2)ActiveDocument.GetBody()).GetCurrentStyle()).getAttribute("color", 1);
                }
                else
                {
                    renderStyle.textColor = textColor.ColorName;
                }
                break;

            case LineType.LineThrough:
                renderStyle.textDecoration      = "line-through";
                renderStyle.textDecorationColor = lineColor.ColorName;
                renderStyle.textBackgroundColor = textBackgroundColor.ColorName;
                if (textColor.Type == ColorType.Auto || textColor.Type == ColorType.Inherit)
                {
                    renderStyle.textColor = ((Interop.IHTMLCurrentStyle)((Interop.IHTMLElement2)ActiveDocument.GetBody()).GetCurrentStyle()).getAttribute("color", 1);
                }
                else
                {
                    renderStyle.textColor = textColor.ColorName;
                }
                break;
            }
            string u;

            switch (underlineStyle)
            {
            case UnderlineStyle.Single:
                u = "single";
                break;

            case UnderlineStyle.Double:
                u = "double";
                break;

            case UnderlineStyle.Words:
                u = "words";
                break;

            case UnderlineStyle.Dotted:
                u = "dotted";
                break;

            case UnderlineStyle.Thick:
                u = "thick";
                break;

            case UnderlineStyle.Dash:
                u = "dash";
                break;

            case UnderlineStyle.DotDash:
                u = "dot-dash";
                break;

            case UnderlineStyle.DotDotDash:
                u = "dot-dot-dash";
                break;

            case UnderlineStyle.Wave:
                u = "wave";
                break;

            case UnderlineStyle.SingleAccounting:
                u = "single-accounting";
                break;

            case UnderlineStyle.DoubleAccounting:
                u = "double-accounting";
                break;

            case UnderlineStyle.ThickDash:
                u = "thick-dash";
                break;

            default:
            case UnderlineStyle.Undefined:
                u = "undefined";
                break;
            }
            renderStyle.textUnderlineStyle = u;
            string l;

            switch (lineThroughStyle)
            {
            default:
            case LineThroughStyle.Undefined:
                l = "undefined";
                break;

            case LineThroughStyle.Single:
                l = "single";
                break;

            case LineThroughStyle.Double:
                l = "double";
                break;
            }
            renderStyle.textLineThroughStyle = l;
            return(renderStyle);
        }