コード例 #1
0
        public TextToTextConverter(
            TextParser parser,
            TextOutput output,
            Injection injection,
            bool convertFragment,
            bool treatNbspAsBreakable,
            Stream traceStream,
            bool traceShowTokenNum,
            int traceStopOnTokenNum)
        {
#if DEBUG
            if (traceStream != null)
            {
                trace = new TestHtmlTrace(traceStream, traceShowTokenNum, traceStopOnTokenNum);
            }
#endif
            this.treatNbspAsBreakable = treatNbspAsBreakable;

            this.convertFragment = convertFragment;

            this.output = output;
            this.parser = parser;

            if (!this.convertFragment)
            {
                this.injection = injection;
            }
        }
コード例 #2
0
        public TextFormatConverter(
            TextParser parser,
            FormatStore store,
            Injection injection,
            Stream traceStream,
            bool traceShowTokenNum,
            int traceStopOnTokenNum,
            Stream formatConverterTraceStream) :
            base(store, formatConverterTraceStream)
        {
#if DEBUG
            if (traceStream != null)
            {
                trace = new TestHtmlTrace(traceStream, traceShowTokenNum, traceStopOnTokenNum);
            }
#endif
            this.parser = parser;

            this.injection = injection;

            // open the document container
            InitializeDocument();

            // open the first paragraph container
            OpenContainer(FormatContainerType.Block, false);


            Last.SetProperty(PropertyPrecedence.NonStyle, PropertyId.FontSize, new PropertyValue(LengthUnits.Points, 10));
        }
コード例 #3
0
        public TextFormatConverter(
            TextParser parser,
            FormatOutput output,
            Injection injection,
            Stream traceStream,
            bool traceShowTokenNum,
            int traceStopOnTokenNum,
            Stream formatConverterTraceStream) :
            base(formatConverterTraceStream)
        {
#if DEBUG
            if (traceStream != null)
            {
                trace = new TestHtmlTrace(traceStream, traceShowTokenNum, traceStopOnTokenNum);
            }
#endif
            this.parser = parser;

            this.output = output;

            if (this.output != null)
            {
                this.output.Initialize(
                    Store,
                    SourceFormat.Text,
                    "converted from text");
            }

            this.injection = injection;

            // open the document container
            InitializeDocument();

            if (this.injection != null && this.injection.HaveHead)
            {
                InternalDebug.Assert(this.output != null);
                // this.injection.Inject(true, this.output);
            }


            OpenContainer(FormatContainerType.Block, false);


            Last.SetProperty(PropertyPrecedence.NonStyle, PropertyId.FontSize, new PropertyValue(LengthUnits.Points, 10));
        }
コード例 #4
0
        void IDisposable.Dispose()
        {
            if (parser != null /*&& this.parser is IDisposable*/)
            {
                ((IDisposable)parser).Dispose();
            }
#if DEBUG
            if (trace != null /*&& this.trace is IDisposable*/)
            {
                ((IDisposable)trace).Dispose();
            }
#endif
            parser = null;
#if DEBUG
            trace = null;
#endif
            GC.SuppressFinalize(this);
        }
コード例 #5
0
        void IDisposable.Dispose()
        {
            if (parser != null /*&& this.parser is IDisposable*/)
            {
                ((IDisposable)parser).Dispose();
            }

            if (!convertFragment && output != null && output is IDisposable)
            {
                ((IDisposable)output).Dispose();
            }
#if DEBUG
            if (trace != null /*&& this.trace is IDisposable*/)
            {
                ((IDisposable)trace).Dispose();
            }
#endif
            parser = null;
            output = null;
#if DEBUG
            trace = null;
#endif
            GC.SuppressFinalize(this);
        }