Ejemplo n.º 1
0
        } // RemoveParserListener

        public void Parse(IRtfSource rtfTextSource)
        {
            if (rtfTextSource == null)
            {
                throw new ArgumentNullException(nameof(rtfTextSource));
            }
            DoParse(rtfTextSource);
        } // Parse
Ejemplo n.º 2
0
 // ----------------------------------------------------------------------
 public void Parse( IRtfSource rtfTextSource )
 {
     if ( rtfTextSource == null )
     {
         throw new ArgumentNullException( "rtfTextSource" );
     }
     DoParse( rtfTextSource );
 }
 // ----------------------------------------------------------------------
 public static IRtfGroup Parse( IRtfSource rtfTextSource, params IRtfParserListener[] listeners )
 {
     RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder();
     RtfParser parser = new RtfParser( structureBuilder );
     if ( listeners != null )
     {
         foreach ( IRtfParserListener listener in listeners )
         {
             if ( listener != null )
             {
                 parser.AddParserListener( listener );
             }
         }
     }
     parser.Parse( rtfTextSource );
     return structureBuilder.StructureRoot;
 }
Ejemplo n.º 4
0
        } // RtfParser

        // ----------------------------------------------------------------------
        protected override void DoParse(IRtfSource rtfTextSource)
        {
            NotifyParseBegin();
            try
            {
                ParseRtf(rtfTextSource.Reader);
                NotifyParseSuccess();
            }
            catch (RtfException e)
            {
                NotifyParseFail(e);
                throw;
            }
            finally
            {
                NotifyParseEnd();
            }
        } // DoParse
Ejemplo n.º 5
0
        } // Parse

        public static IRtfGroup Parse(IRtfSource rtfTextSource, params IRtfParserListener[] listeners)
        {
            var structureBuilder = new RtfParserListenerStructureBuilder();
            var parser           = new RtfParser(structureBuilder);

            if (listeners != null)
            {
                foreach (var listener in listeners)
                {
                    if (listener != null)
                    {
                        parser.AddParserListener(listener);
                    }
                }
            }
            parser.Parse(rtfTextSource);
            return(structureBuilder.StructureRoot);
        } // Parse
 // ----------------------------------------------------------------------
 protected override void DoParse( IRtfSource rtfTextSource )
 {
     NotifyParseBegin();
     try
     {
         ParseRtf( rtfTextSource.Reader );
         NotifyParseSuccess();
     }
     catch ( RtfException e )
     {
         NotifyParseFail( e );
         throw;
     }
     finally
     {
         NotifyParseEnd();
     }
 }
Ejemplo n.º 7
0
        } // Parse

        protected abstract void DoParse(IRtfSource rtfTextSource);
        }         // Interpret

        // ----------------------------------------------------------------------
        public static void Interpret(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners)
        {
            Interpret(RtfParserTool.Parse(rtfTextSource), listeners);
        }         // Interpret
        }         // BuildDoc

        // ----------------------------------------------------------------------
        public static IRtfDocument BuildDoc(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners)
        {
            return(BuildDoc(RtfParserTool.Parse(rtfTextSource), listeners));
        }         // BuildDoc
Ejemplo n.º 10
0
        }         // BuildDoc

        // ----------------------------------------------------------------------
        public static IRtfDocument BuildDoc(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners)
        {
            return(BuildDoc(rtfTextSource, new RtfInterpreterSettings(), listeners));
        }         // BuildDoc
Ejemplo n.º 11
0
        }         // Interpret

        // ----------------------------------------------------------------------
        public static void Interpret(IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners)
        {
            Interpret(rtfTextSource, new RtfInterpreterSettings(), listeners);
        }         // Interpret
Ejemplo n.º 12
0
 // ----------------------------------------------------------------------
 protected abstract void DoParse( IRtfSource rtfTextSource );
 // ----------------------------------------------------------------------
 public static void Interpret( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners )
 {
     Interpret( RtfParserTool.Parse( rtfTextSource ), listeners );
 }
 // ----------------------------------------------------------------------
 public static IRtfDocument BuildDoc( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners )
 {
     return BuildDoc( RtfParserTool.Parse( rtfTextSource ), listeners );
 }
 // ----------------------------------------------------------------------
 public static IRtfDocument BuildDoc( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners )
 {
     return BuildDoc( rtfTextSource, new RtfInterpreterSettings(), listeners );
 }
 // ----------------------------------------------------------------------
 public static void Interpret( IRtfSource rtfTextSource, params IRtfInterpreterListener[] listeners )
 {
     Interpret( rtfTextSource, new RtfInterpreterSettings(), listeners );
 }