Example #1
0
        /**
         * Adds a fragment of an RTF document to the current RTF document being generated.
         * Since this fragment doesn't contain font or color tables, all fonts and colors
         * are mapped to the default font and color. If the font and color mappings are
         * known, they can be specified via the mappings parameter.
         * Uses new RtfParser object.
         *
         * @param documentSource The Stream to read the RTF fragment from.
         * @param mappings The RtfImportMappings that contain font and color mappings to apply to the fragment.
         * @param eventListeners The array of event listeners. May be null
         * @throws IOException On errors reading the RTF fragment.
         * @throws DocumentException On errors adding to this RTF fragment.
         *
         * @see com.lowagie.text.rtf.parser.RtfImportMappings
         * @see com.lowagie.text.rtf.parser.RtfParser
         * @see com.lowagie.text.rtf.parser.RtfParser#importRtfFragment(Reader, RtfDocument, com.lowagie.text.rtf.parser.RtfImportMappings)
         * @since 2.0.8
         * @author Howard Shank
         */
        public void ImportRtfFragment(Stream documentSource, RtfImportMappings mappings, IEventListener[] events)
        {
            if (!this.open)
            {
                throw new DocumentException("The document must be open to import RTF fragments.");
            }
            RtfParser rtfImport = new RtfParser(this.document);

            if (events != null)
            {
                for (int idx = 0; idx < events.Length; idx++)
                {
                    rtfImport.AddListener(events[idx]);
                }
            }
            rtfImport.ImportRtfFragment(documentSource, this.rtfDoc, mappings);
        }
        }         // ValidateProgramSettings

        // ----------------------------------------------------------------------
        private IRtfGroup ParseRtf()
        {
            IRtfGroup rtfStructure;
            RtfParserListenerFileLogger parserLogger = null;

            try
            {
                // logger
                if (settings.LogParser)
                {
                    string logFileName = settings.BuildDestinationFileName(
                        settings.LogDirectory,
                        RtfParserListenerFileLogger.DefaultLogFileExtension);
                    parserLogger = new RtfParserListenerFileLogger(logFileName);
                }

                // rtf parser
                // open readonly - in case of dominant locks...
                using (FileStream stream = File.Open(settings.SourceFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    // parse the rtf structure
                    RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder();
                    RtfParser parser = new RtfParser(structureBuilder);
                    parser.IgnoreContentAfterRootGroup = true;                     // support WordPad documents
                    if (parserLogger != null)
                    {
                        parser.AddParserListener(parserLogger);
                    }
                    parser.Parse(new RtfSource(stream));
                    rtfStructure = structureBuilder.StructureRoot;
                }
            }
            catch (Exception e)
            {
                if (parserLogger != null)
                {
                    parserLogger.Dispose();
                }

                Console.WriteLine("error while parsing rtf: " + e.Message);
                ExitCode = ProgramExitCode.ParseRtf;
                return(null);
            }

            return(rtfStructure);
        }         // ParseRtf
        //  // TIMING DEBUG INFO
        //  private long endTime = 0;
        //  private Date endDate = null;
        //  private long endFree = 0;
        //  private DecimalFormat df = new DecimalFormat("#,##0");
        //  private Date startDate = new Date();
        //  private long startTime = System.CurrentTimeMillis();
        //  private long startFree = Runtime.GetRuntime().FreeMemory();

        /**
         * Constructor
         * @param rtfParser The parser object this manager works with.
         * @param reader the PushbackReader from the tokeniser.
         */
        public RtfCtrlWordMgr(RtfParser rtfParser, PushbackStream reader)
        {
            this.rtfParser = rtfParser; // set the parser
            this.reader    = reader;    // set the reader value
            ctrlWordMap    = new RtfCtrlWordMap(rtfParser);

            //      // TIMING DEBUG INFO
            //      endFree = Runtime.GetRuntime().FreeMemory();
            //      endTime = System.CurrentTimeMillis();
            //      endDate = new Date();
            //      Console.Out.WriteLine("RtfCtrlWordMgr start date: " + startDate.ToLocaleString());
            //      Console.Out.WriteLine("RtfCtrlWordMgr end date  : " + endDate.ToLocaleString());
            //      Console.Out.WriteLine("  Elapsed time    : " + Long.ToString(endTime - startTime) + " milliseconds.");
            //      Console.Out.WriteLine("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k");
            //      Console.Out.WriteLine("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k");
            //        Console.Out.WriteLine("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k");
        }
        /// <summary>
        /// Processes the color triplet parsed from the document.
        /// Add it to the import mapping so colors can be mapped when encountered
        /// in the RTF import or conversion.
        /// </summary>
        private void processColor()
        {
            if (_red != -1 && _green != -1 && _blue != -1)
            {
                if (RtfParser.IsImport())
                {
                    _importHeader.ImportColor(_colorNr.ToString(), new BaseColor(_red, _green, _blue));
                }

                if (RtfParser.IsConvert())
                {
                    _colorMap[_colorNr.ToString()] = new BaseColor(_red, _green, _blue);
                }
            }
            SetToDefaults();
            _colorNr++;
        }
Example #5
0
        public void TestReadGroupStart()
        {
            using (var input = StringStream(@"{stuff goes here}")) {
                var token = RtfParser.ReadGroupStart(input);

                Assert.AreEqual(EventType.GroupStart, token.Type);
                Assert.IsNull(token.Text);
                Assert.IsNull(token.Parameter);

                Assert.AreEqual((byte)'s', input.At(0));
            }

            using (var input = StringStream(@"stuff goes here}")) {
                AlsoAssert.Throws <ParseException>(() =>
                                                   RtfParser.ReadGroupStart(input));
            }
        }
Example #6
0
        public void TestReadControlWord()
        {
            using (var input = StringStream(@"\test ")) {
                var word = RtfParser.ReadControlWord(input);

                Assert.AreEqual(EventType.ControlWord, word.Type);
                Assert.AreEqual("test", word.Text);
                Assert.IsNull(word.Parameter);

                // Space should have been consumed.
                Assert.IsNull(input.At(0));
            }

            using (var input = StringStream(@"\test\foo")) {
                var word = RtfParser.ReadControlWord(input);

                Assert.AreEqual(EventType.ControlWord, word.Type);
                Assert.AreEqual("test", word.Text);
                Assert.IsNull(word.Parameter);

                // Slash should not have been consumed.
                Assert.AreEqual((byte)'\\', input.At(0));
            }

            using (var input = StringStream(@"\test12345 ")) {
                var word = RtfParser.ReadControlWord(input);

                Assert.AreEqual(EventType.ControlWord, word.Type);
                Assert.AreEqual("test", word.Text);
                Assert.AreEqual(12345, word.Parameter);

                // Space should have been consumed.
                Assert.IsNull(input.At(0));
            }

            using (var input = StringStream(@"\test-42foo")) {
                var word = RtfParser.ReadControlWord(input);

                Assert.AreEqual(EventType.ControlWord, word.Type);
                Assert.AreEqual("test", word.Text);
                Assert.AreEqual(-42, word.Parameter);

                // Delimiter should not have been consumed.
                Assert.AreEqual((byte)'f', input.At(0));
            }
        }
Example #7
0
        /**
         * Adds a fragment of an RTF document to the current RTF document being generated.
         * Since this fragment doesn't contain font or color tables, all fonts and colors
         * are mapped to the default font and color. If the font and color mappings are
         * known, they can be specified via the mappings parameter.
         * Uses new RtfParser object.
         *
         * @param documentSource The Stream to read the RTF fragment from.
         * @param mappings The RtfImportMappings that contain font and color mappings to apply to the fragment.
         * @param eventListeners The array of event listeners. May be null
         * @throws IOException On errors reading the RTF fragment.
         * @throws DocumentException On errors adding to this RTF fragment.
         *
         * @see com.lowagie.text.rtf.parser.RtfImportMappings
         * @see com.lowagie.text.rtf.parser.RtfParser
         * @see com.lowagie.text.rtf.parser.RtfParser#importRtfFragment(Reader, RtfDocument, com.lowagie.text.rtf.parser.RtfImportMappings)
         * @since 2.0.8
         * @author Howard Shank
         */
        public void ImportRtfFragment(Stream documentSource, RtfImportMappings mappings, IEventListener[] events)
        {
            if (!this.open)
            {
                throw new DocumentException(MessageLocalization.GetComposedMessage("the.document.must.be.open.to.import.rtf.fragments"));
            }
            RtfParser rtfImport = new RtfParser(this.document);

            if (events != null)
            {
                for (int idx = 0; idx < events.Length; idx++)
                {
                    rtfImport.AddListener(events[idx]);
                }
            }
            rtfImport.ImportRtfFragment(documentSource, this.rtfDoc, mappings);
        }
        /// <summary>
        /// Adds the complete RTF document to the current RTF document being generated.
        /// It will parse the font and color tables and correct the font and color references
        /// so that the imported RTF document retains its formattings.
        /// Uses new RtfParser object.
        /// @throws IOException
        /// @throws DocumentException
        /// @see com.lowagie.text.rtf.parser.RtfParser
        /// @see com.lowagie.text.rtf.parser.RtfParser#importRtfDocument(Reader, RtfDocument)
        /// @since 2.0.8
        /// @author Howard Shank
        /// </summary>
        /// <param name="documentSource">The Stream to read the RTF document from.</param>
        /// <param name="events">The array of event listeners. May be null</param>
        public void ImportRtfDocument(Stream documentSource, IEventListener[] events)
        {
            if (!open)
            {
                throw new DocumentException("The document must be open to import RTF documents.");
            }
            RtfParser rtfImport = new RtfParser(Document);

            if (events != null)
            {
                for (int idx = 0; idx < events.Length; idx++)
                {
                    rtfImport.AddListener(events[idx]);
                }
            }
            rtfImport.ImportRtfDocument(documentSource, _rtfDoc);
        }
Example #9
0
        }         // ConvertRtf2Html

        // ----------------------------------------------------------------------
        private IRtfGroup ParseRtf(string fileName)
        {
            IRtfGroup rtfStructure;

            using (FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder();
                RtfParser parser = new RtfParser(structureBuilder);
                parser.IgnoreContentAfterRootGroup = true;                 // support WordPad documents
                if (!string.IsNullOrEmpty(ParserLogFileName))
                {
                    parser.AddParserListener(new RtfParserListenerFileLogger(ParserLogFileName));
                }
                parser.Parse(new RtfSource(stream));
                rtfStructure = structureBuilder.StructureRoot;
            }
            return(rtfStructure);
        } // ParseRtf
Example #10
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
Example #11
0
        private IProducerConsumer CreateChain(Stream input, bool push, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            RtfParser parser = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, null);

            if (this.textExtractionMode == TextExtractionMode.ExtractText)
            {
                return(new RtfTextExtractionConverter(parser, output, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
            }
            Injection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = ((this.injectionFormat == HeaderFooterFormat.Html) ? new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, null, progressMonitor));
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, null, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new RtfToTextConverter(parser, output2, injection, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }
        /// <summary>
        /// (non-Javadoc)
        /// @see com.lowagie.text.rtf.direct.RtfDestination#handleCharacter(int)
        /// </summary>
        public override bool HandleCharacter(int ch)
        {
            bool result = true;
            OnCharacter(ch);   // event handler

            if (RtfParser.IsImport())
            {
                if (_buffer.Length > 254)
                {
                    writeBuffer();
                }
                _buffer.Append((char)ch);
            }
            if (RtfParser.IsConvert())
            {
                _buffer.Append((char)ch);
            }
            return result;
        }
Example #13
0
        /**
         * Constructor:
         *
         * @param rtfParser
         *      The parser for this control word.
         * @param ctrlWord
         *      The string value of this control word.
         * @param defaultParameterValue
         *      The default value of this control word. Not all control words have values.
         * @param passDefaultParameterValue
         *      Flag indicating if this control word should use the default value.
         * @param ctrlWordType
         *      Indicator of the type of control word this is. DESTINATION|DESTINATION_EX|VALUE|FLAG|TOGGLE|SYMBOL
         * @param prefix
         *      String to prefix the ctrl word with. "\" or "\*\" are the 2 used values.
         * @param suffix
         *      String to add as suffix to the ctrl word. " " and "" are the 2 used values.
         * @param specialHandler
         *      If TOGGLE then the property name as String (propertyGroup.propertyName format ex. "character.bold")
         *      If FLAG then the property name as String (propertyGroup.propertyName format ex. "character.bold")
         *      If VALUE then the property name as String (propertyGroup.propertyName format ex. "character.bold")
         *      If SYMBOL then the character to use for substitution as String
         *      If DESTINATION|DESTINATION_EX then the RtfDestination class name as String
         *
         * @since 2.0.8
         */
        public RtfCtrlWordHandler(RtfParser rtfParser, String ctrlWord, int defaultParameterValue, bool passDefaultParameterValue,
                                  int ctrlWordType, String prefix, String suffix, String specialHandler)
        {
            this.rtfParser                 = rtfParser;
            this.ctrlWord                  = ctrlWord;
            this.defaultParameterValue     = defaultParameterValue;
            this.passDefaultParameterValue = passDefaultParameterValue;
            this.ctrlWordType              = ctrlWordType;
            this.ctrlWordPrefix            = prefix;
            this.ctrlWordSuffix            = suffix;
            this.specialHandler            = specialHandler;

            if (this.ctrlWordType == RtfCtrlWordType.DESTINATION || this.ctrlWordType == RtfCtrlWordType.DESTINATION_EX)
            {
                if (this.specialHandler == null)
                {
                    this.specialHandler = "RtfDestinationNull";
                }
                String arg1 = ""; // stylesheet value - S, CS, TS
                RtfDestinationMgr.AddDestination(this.ctrlWord, new Object[] { this.specialHandler, arg1 });
            }
            else
            {
                if (this.ctrlWordType == RtfCtrlWordType.SYMBOL)
                {
                }
                else
                {
                    if (this.specialHandler == null)
                    {
                        this.specialHandler = this.ctrlWord;    // if null, make the property the name of the ctrl word
                    }
                    else
                    {
                        if (this.specialHandler.Length > 1 && this.specialHandler.EndsWith("."))
                        {
                            this.specialHandler += this.ctrlWord;   // if string length>1 and ends with a period, it's a group. Add ctrlWord
                        }
                    }
                }
            }
        }
Example #14
0
        private static IRtfGroup ParseRtf(RtfSource source)
        {
            IRtfGroup rtfStructure;

            try
            {
                // parse the rtf structure
                RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder();
                RtfParser parser = new RtfParser(structureBuilder);
                parser.IgnoreContentAfterRootGroup = true; // support WordPad documents
                parser.Parse(source);
                rtfStructure = structureBuilder.StructureRoot;
            }
            catch
            {
                return(null);
            }

            return(rtfStructure);
        } // ParseRtf
Example #15
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            String richText;

            this.RichBox.Document.GetText(TextGetOptions.FormatRtf, out richText);

            var structureBuilder = new RtfParserListenerStructureBuilder();
            var parser           = new RtfParser(structureBuilder);

            parser.IgnoreContentAfterRootGroup = true; // support WordPad documents

            parser.Parse(new RtfSource(richText));

            var rtfStructure = structureBuilder.StructureRoot;

            // image converter
            var imageAdapter         = new RtfVisualImageAdapter(ImageFormat.Jpeg);
            var imageConvertSettings = new RtfImageConvertSettings(imageAdapter);

            imageConvertSettings.ScaleImage = true; // scale images
            var imageConverter = new RtfImageConverter(imageConvertSettings);

            // rtf interpreter
            var interpreterSettings = new RtfInterpreterSettings();

            var rtfDocument = RtfInterpreterTool.BuildDoc(rtfStructure, interpreterSettings, imageConverter);

            var htmlSegments = await RtfToHtmlSegments(rtfDocument.VisualContent);

            var anonymited = this.Anonymity.IsChecked.HasValue && this.Anonymity.IsChecked.Value == true;

            this.Result = new UgcDialogResult(anonymited, htmlSegments);

            //var deferral = args.GetDeferral();

            //deferral.Complete();
        }
Example #16
0
        public void ParseStructureBuilderTest()
        {
            RtfParser parser = new RtfParser();
            RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder();

            parser.AddParserListener(structureBuilder);
            parser.Parse(new RtfSource(@"{\rtf1foobar}"));

            IRtfGroup rtfStructure = structureBuilder.StructureRoot;

            Assert.IsNotNull(rtfStructure);

            Assert.AreEqual(RtfElementKind.Group, rtfStructure.Kind);
            Assert.AreEqual(2, rtfStructure.Contents.Count);

            Assert.AreEqual(RtfElementKind.Tag, rtfStructure.Contents[0].Kind);
            Assert.AreEqual("rtf", ((IRtfTag)rtfStructure.Contents[0]).Name);
            Assert.AreEqual(true, ((IRtfTag)rtfStructure.Contents[0]).HasValue);
            Assert.AreEqual("1", ((IRtfTag)rtfStructure.Contents[0]).ValueAsText);
            Assert.AreEqual(1, ((IRtfTag)rtfStructure.Contents[0]).ValueAsNumber);

            Assert.AreEqual(RtfElementKind.Text, rtfStructure.Contents[1].Kind);
            Assert.AreEqual("foobar", ((IRtfText)rtfStructure.Contents[1]).Text);
        }         // ParseStructureBuilderTest
Example #17
0
        public void Verify_RTF_To_PDF_File_CanBeCreated()
        {
            Verify_PDF_To_RTF_File_CanBeCreated(); // Create a sample .rtf file first

            var rtfFilePath = Path.Combine(TestUtils.GetOutputFolder(), $"{nameof(Verify_PDF_To_RTF_File_CanBeCreated)}.rtf");
            var inputStream = new FileStream(rtfFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);

            var pdfFilePath  = TestUtils.GetOutputFileName();
            var outputStream = new FileStream(pdfFilePath, FileMode.Create);

            var document = new Document();

            PdfWriter.GetInstance(document, outputStream);

            document.Open();

            var parser = new RtfParser(null);

            parser.ConvertRtfDocument(inputStream, document);

            document.Close();
            outputStream.Dispose();
            inputStream.Dispose();
        }
Example #18
0
        /**
         * The primary control word handler method.
         * Called by the parser once it has a control word and parameter if applicable.
         *
         * @param ctrlWordDataIn
         *      The control word and associated parameter if applicable.
         * @return
         *      <code>true</code> or <code>false</code> if the control word was handled.
         * @since 2.0.8
         */
        public bool HandleControlword(RtfCtrlWordData ctrlWordDataIn)
        {
            bool result = false;

            this.ctrlWordData = ctrlWordDataIn;
            RtfDestination dest    = null;
            bool           handled = false;

            this.ctrlWordData.prefix         = this.ctrlWordPrefix;
            this.ctrlWordData.suffix         = this.ctrlWordSuffix;
            this.ctrlWordData.newGroup       = this.rtfParser.GetState().newGroup;
            this.ctrlWordData.ctrlWordType   = this.ctrlWordType;
            this.ctrlWordData.specialHandler = this.specialHandler;

            if (!this.ctrlWordData.hasParam && this.passDefaultParameterValue)
            {
                this.ctrlWordData.hasParam = true;
                this.ctrlWordData.param    = this.defaultParameterValue.ToString();
            }

            if (debug)
            {
                PrintDebug("handleKeyword: [" + this.ctrlWordData.ctrlWord + "] param=" + ctrlWordDataIn.param);
                RtfParser.OutputDebug(this.rtfParser.GetRtfDocument(), this.rtfParser.GetLevel() + 1, "RtfCtrlWordHandler debug Start: " + this.ctrlWordData.ctrlWord + " ");
            }
            if (this.ctrlWordData.ctrlWord.Equals("*"))
            {
                return(true);
            }

            if (!BeforeControlWord())
            {
                return(true);
            }

            switch (this.ctrlWordType)
            {
            case RtfCtrlWordType.FLAG:
            case RtfCtrlWordType.TOGGLE:
            case RtfCtrlWordType.VALUE:
                dest = this.rtfParser.GetCurrentDestination();
                if (dest != null)
                {
                    handled = dest.HandleControlWord(this.ctrlWordData);
                }
                break;

            case RtfCtrlWordType.SYMBOL:
                dest = this.rtfParser.GetCurrentDestination();
                if (dest != null)
                {
                    String data = null;
                    // if doing an import, then put the control word in the output stream through the character handler
                    if (this.rtfParser.IsImport())
                    {
                        data = this.ctrlWordPrefix + this.ctrlWordData.ctrlWord + this.ctrlWordSuffix;
                    }
                    if (this.rtfParser.IsConvert())
                    {
                        data = this.specialHandler;
                    }

                    // If there is a substitute character, process the character.
                    // If no substitute character, then provide special handling in the destination for the ctrl word.
                    if (data != null)
                    {
                        foreach (char cc in data.ToCharArray())
                        {
                            handled = dest.HandleCharacter((int)cc);
                        }
                    }
                    else
                    {
                        handled = dest.HandleControlWord(this.ctrlWordData);
                    }
                }
                break;

            case RtfCtrlWordType.DESTINATION_EX:
            case RtfCtrlWordType.DESTINATION:
                // set the destination
                int x = 0;
                if (this.ctrlWord == "shppict" || this.ctrlWord == "nonshppict")
                {
                    x++;
                }
                handled = this.rtfParser.SetCurrentDestination(this.ctrlWord);
                // let destination handle the ctrl word now.
                dest = this.rtfParser.GetCurrentDestination();
                if (dest != null)
                {
                    if (dest.GetNewTokeniserState() == RtfParser.TOKENISER_IGNORE_RESULT)
                    {
                        handled = dest.HandleControlWord(this.ctrlWordData);
                    }
                    else
                    {
                        this.rtfParser.SetTokeniserState(dest.GetNewTokeniserState());
                    }
                }
                break;
            }

            AfterControlWord();

            if (debug)
            {
                RtfParser.OutputDebug(this.rtfParser.GetRtfDocument(), this.rtfParser.GetLevel() + 1, "RtfCtrlWordHandler debug End: " + this.ctrlWordData.ctrlWord + " ");
            }

            return(result);
        }
 /**
 * Constructs a new RtfDestinationShppict.
 */
 public RtfDestinationShppict(RtfParser parser)
     : base(parser)
 {
 }
        /**
        * Constructor:
        *
        * @param rtfParser
        *      The parser for this control word.
        * @param ctrlWord
        *      The string value of this control word.
        * @param defaultParameterValue
        *      The default value of this control word. Not all control words have values.
        * @param passDefaultParameterValue
        *      Flag indicating if this control word should use the default value.
        * @param ctrlWordType
        *      Indicator of the type of control word this is. DESTINATION|DESTINATION_EX|VALUE|FLAG|TOGGLE|SYMBOL
        * @param prefix
        *      String to prefix the ctrl word with. "\" or "\*\" are the 2 used values.
        * @param suffix
        *      String to add as suffix to the ctrl word. " " and "" are the 2 used values.
        * @param specialHandler
        *      If TOGGLE then the property name as String (propertyGroup.propertyName format ex. "character.bold")
        *      If FLAG then the property name as String (propertyGroup.propertyName format ex. "character.bold")
        *      If VALUE then the property name as String (propertyGroup.propertyName format ex. "character.bold")
        *      If SYMBOL then the character to use for substitution as String
        *      If DESTINATION|DESTINATION_EX then the RtfDestination class name as String
        * 
        * @since 2.0.8
        */
        public RtfCtrlWordHandler(RtfParser rtfParser, String ctrlWord, int defaultParameterValue, bool passDefaultParameterValue, 
                int ctrlWordType, String prefix, String suffix, String specialHandler) {
            this.rtfParser = rtfParser;
            this.ctrlWord = ctrlWord;
            this.defaultParameterValue = defaultParameterValue;
            this.passDefaultParameterValue = passDefaultParameterValue;
            this.ctrlWordType = ctrlWordType;
            this.ctrlWordPrefix = prefix;
            this.ctrlWordSuffix = suffix;
            this.specialHandler = specialHandler;

            if (this.ctrlWordType == RtfCtrlWordType.DESTINATION || this.ctrlWordType == RtfCtrlWordType.DESTINATION_EX){
                if (this.specialHandler == null) {
                    this.specialHandler = "RtfDestinationNull";
                }
                String arg1 = ""; // stylesheet value - S, CS, TS
                RtfDestinationMgr.AddDestination(this.ctrlWord, new Object[] { this.specialHandler, arg1 });            
            } else {
                if (this.ctrlWordType == RtfCtrlWordType.SYMBOL){
                    
                } else {
                    if (this.specialHandler == null) {
                        this.specialHandler = this.ctrlWord;    // if null, make the property the name of the ctrl word
                    } else {
                        if (this.specialHandler.Length > 1 && this.specialHandler.EndsWith(".")) {
                            this.specialHandler += this.ctrlWord;   // if string length>1 and ends with a period, it's a group. Add ctrlWord
                        }
                    }
                }
            }
        }
        // Token: 0x06000EFA RID: 3834 RVA: 0x00073B80 File Offset: 0x00071D80
        internal IProducerConsumer CreateChain(RtfEncapsulation encapsulation, RtfParser parser, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.rtfEncapsulation = encapsulation;
            if (this.reportBytes == null)
            {
                throw new InvalidOperationException("I have an RtfParser but no ReportBytes.");
            }
            output.ReportBytes = this.reportBytes;
            IProducerConsumer result;

            if (encapsulation != RtfEncapsulation.Html)
            {
                HtmlInjection injection = null;
                if (this.injectHead != null || this.injectTail != null)
                {
                    injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                }
                HtmlWriter         writer             = new HtmlWriter(output, this.filterHtml, !this.testNoNewLines);
                FormatOutput       output2            = new HtmlFormatOutput(writer, injection, this.outputFragment, this.testFormatTraceStream, this.testFormatOutputTraceStream, this.filterHtml, this.htmlCallback, true);
                RtfFormatConverter rtfFormatConverter = new RtfFormatConverter(parser, output2, null, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream);
                result = rtfFormatConverter;
            }
            else
            {
                HtmlInjection htmlInjection  = null;
                HtmlInjection htmlInjection2 = null;
                try
                {
                    if (this.injectHead != null || this.injectTail != null)
                    {
                        htmlInjection2          = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                        htmlInjection           = htmlInjection2;
                        this.normalizeInputHtml = true;
                    }
                    if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
                    {
                        this.normalizeInputHtml = true;
                    }
                    HtmlInRtfExtractingInput input = new HtmlInRtfExtractingInput(parser, this.maxHtmlTagSize, this.testBoundaryConditions, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum);
                    IHtmlParser parser3;
                    if (this.normalizeInputHtml)
                    {
                        HtmlParser parser2 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                        parser3        = new HtmlNormalizingParser(parser2, htmlInjection, this.htmlCallback != null, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                        htmlInjection2 = null;
                    }
                    else
                    {
                        parser3 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                    }
                    HtmlWriter writer2 = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml && !this.testNoNewLines);
                    result = new HtmlToHtmlConverter(parser3, writer2, false, this.outputFragment, this.filterHtml, this.htmlCallback, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, this.testHtmlTraceStream, this.testHtmlTraceShowTokenNum, this.testHtmlTraceStopOnTokenNum, this.smallCssBlockThreshold, this.preserveDisplayNoneStyle, progressMonitor);
                }
                finally
                {
                    IDisposable disposable = htmlInjection2;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                        htmlInjection2 = null;
                    }
                }
            }
            return(result);
        }
Example #22
0
 public RtfDestinationListTable(RtfParser parser) : base(parser)
 {
     this.importHeader = parser.GetImportManager();
 }
 /**
 * Constructs a new <code>RtfDestinationDocument</code> using
 * the parameters to initialize the object.
 * @param rtfDoc The <code>RtfDocument</code> this works with.
 * @param doc The iText <code>Document</code> this works with.
 * @param type The type of conversion being done.
 */
 public RtfDestinationDocument(RtfParser parser)
     : base(parser)
 {
     this.rtfDoc = parser.GetRtfDocument();
     this.doc = parser.GetDocument();
     this.conversionType = parser.GetConversionType();
     SetToDefaults();
     if (this.rtfParser.IsConvert()) {
         this.rtfParser.GetState().properties.AddRtfPropertyListener(this);
     }
 }
Example #24
0
 /// <summary>
 /// Constructs a new RtfDestinationInfo.
 /// </summary>
 public RtfDestinationInfo(RtfParser parser, string elementname) : base(parser)
 {
     SetToDefaults();
     _elementName = elementname;
 }
Example #25
0
 public override void SetParser(RtfParser parser)
 {
     RtfParser = parser;
     SetToDefaults();
 }
 // Token: 0x06001764 RID: 5988 RVA: 0x000B648E File Offset: 0x000B468E
 public RtfTextExtractionConverter(RtfParser parser, ConverterOutput output, Stream traceStream, bool traceShowTokenNum, int traceStopOnTokenNum)
 {
     this.output = output;
     this.parser = parser;
 }
 public override void SetParser(RtfParser parser)
 {
     this.rtfParser = parser;
     colorMap = new Hashtable();
     this.colorNr = 0;
     this.importHeader = parser.GetImportManager();
     this.SetToDefaults();
 }
 /**
 * Constructs a new RtfColorTableParser.
 *
 * @param importHeader The RtfImportHeader to add the color mappings to.
 */
 public RtfDestinationColorTable(RtfParser parser)
     : base(parser)
 {
     colorMap = new Hashtable();
     this.colorNr = 0;
     this.importHeader = parser.GetImportManager();
     this.SetToDefaults();
 }
 /**
 * Constructs a new RtfFontTableParser.
 * 
 * @param importHeader The RtfImportHeader to add font mappings to.
 * 
 * @since 2.0.8
 */
 public RtfDestinationFontTable(RtfParser parser) : base(parser) {
     this.Init(true);
 }
Example #30
0
 /**
  * Constructs a new RtfDestinationNull.
  *
  * This constructor is hidden for internal use only.
  *
  * @param parser Unused value
  */
 private RtfDestinationNull(RtfParser parser) : base(null)
 {
 }
 public override void SetParser(RtfParser parser)
 {
     this.rtfParser = parser;
     this.rtfDoc = parser.GetRtfDocument();
     this.doc = parser.GetDocument();
     this.conversionType = parser.GetConversionType();
     SetToDefaults();
     if (this.rtfParser.IsConvert()) {
         this.rtfParser.GetState().properties.AddRtfPropertyListener(this);
     }
 }
Example #32
0
        public override bool HandleControlWord(RtfCtrlWordData ctrlWordData)
        {
            var result = true;

            OnCtrlWord(ctrlWordData);  // event handler

            if (RtfParser.IsImport())
            {
                // information
                if (ctrlWordData.CtrlWord.Equals("s"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("cs"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("ds"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("ts"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsrowd"))
                {
                }

                if (ctrlWordData.CtrlWord.Equals("keycode"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("shift"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("ctrl"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("alt"))
                {
                }
                //cells
                if (ctrlWordData.CtrlWord.Equals("fn"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("additive"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("sbasedon"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("snext"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("sautoupd"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("shidden"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("slink"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("slocked"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("spersonal"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("scompose"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("sreply"))
                {
                }
                /* FORMATTING */
                // brdrdef/parfmt/apoctl/tabdef/shading/chrfmt



                if (ctrlWordData.CtrlWord.Equals("styrsid"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("ssemihidden"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("sqformat"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("spriority"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("sunhideused"))
                {
                }

                /* TABLE STYLES */
                if (ctrlWordData.CtrlWord.Equals("tscellwidth"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellwidthfts"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddt"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddl"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddr"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddb"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddft"))/*0-auto, 3-twips*/
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddfl"))/*0-auto, 3-twips*/
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddfr"))/*0-auto, 3-twips*/
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellpaddfb"))/*0-auto, 3-twips*/
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsvertalt"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsvertalc"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsvertalb"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsnowrap"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellcfpat"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscellcbpat"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgbdiag"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgfdiag"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgcross"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgdcross"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgdkcross "))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgdkdcross"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbghoriz"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgvert"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgdkhor"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbgdkvert"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrt"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrb"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrl"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrr"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrh"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrv"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrdgl"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tsbrdrdgr"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscbandsh"))
                {
                }
                if (ctrlWordData.CtrlWord.Equals("tscbandsv"))
                {
                }
            }
            if (ctrlWordData.CtrlWordType == RtfCtrlWordType.FLAG ||
                ctrlWordData.CtrlWordType == RtfCtrlWordType.TOGGLE ||
                ctrlWordData.CtrlWordType == RtfCtrlWordType.VALUE)
            {
                RtfParser.GetState().Properties.SetProperty(ctrlWordData);
            }

            switch (RtfParser.GetConversionType())
            {
            case RtfParser.TYPE_IMPORT_FULL:
                result = true;
                break;

            case RtfParser.TYPE_IMPORT_FRAGMENT:
                result = true;
                break;

            case RtfParser.TYPE_CONVERT:
                result = true;
                break;

            default:        // error because is should be an import or convert
                result = false;
                break;
            }
            return(result);
        }
        public override bool HandleControlWord(RtfCtrlWordData ctrlWordData)
        {
            bool result = false;
            OnCtrlWord(ctrlWordData);  // event handler

            if (RtfParser.IsImport())
            {
                // map font information
                if (ctrlWordData.CtrlWord.Equals("f")) { ctrlWordData.Param = RtfParser.GetImportManager().MapFontNr(ctrlWordData.Param); }

                // map color information
                //colors
                if (ctrlWordData.CtrlWord.Equals("cb")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                if (ctrlWordData.CtrlWord.Equals("cf")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                //cells
                if (ctrlWordData.CtrlWord.Equals("clcbpat")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                if (ctrlWordData.CtrlWord.Equals("clcbpatraw")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                if (ctrlWordData.CtrlWord.Equals("clcfpat")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                if (ctrlWordData.CtrlWord.Equals("clcfpatraw")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                //table rows
                if (ctrlWordData.CtrlWord.Equals("trcfpat")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                if (ctrlWordData.CtrlWord.Equals("trcbpat")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                //paragraph border
                if (ctrlWordData.CtrlWord.Equals("brdrcf")) { ctrlWordData.Param = RtfParser.GetImportManager().MapColorNr(ctrlWordData.Param); }
                // map lists
                if (ctrlWordData.CtrlWord.Equals("ls")) { ctrlWordData.Param = RtfParser.GetImportManager().MapListNr(ctrlWordData.Param); }
            }



            if (RtfParser.IsConvert())
            {
                if (ctrlWordData.CtrlWord.Equals("par")) { addParagraphToDocument(); }
                // Set Font
                if (ctrlWordData.CtrlWord.Equals("f")) { }

                // color information
                //colors
                if (ctrlWordData.CtrlWord.Equals("cb")) { }
                if (ctrlWordData.CtrlWord.Equals("cf")) { }
                //cells
                if (ctrlWordData.CtrlWord.Equals("clcbpat")) { }
                if (ctrlWordData.CtrlWord.Equals("clcbpatraw")) { }
                if (ctrlWordData.CtrlWord.Equals("clcfpat")) { }
                if (ctrlWordData.CtrlWord.Equals("clcfpatraw")) { }
                //table rows
                if (ctrlWordData.CtrlWord.Equals("trcfpat")) { }
                if (ctrlWordData.CtrlWord.Equals("trcbpat")) { }
                //paragraph border
                if (ctrlWordData.CtrlWord.Equals("brdrcf")) { }

                /* TABLES */
                if (ctrlWordData.CtrlWord.Equals("trowd")) /*Beginning of row*/ { _tableLevel++; }
                if (ctrlWordData.CtrlWord.Equals("cell")) /*End of Cell Denotes the end of a table cell*/
                {
                    //              String ctl = ctrlWordData.ctrlWord;
                    //              System.out.Print("cell found");
                }
                if (ctrlWordData.CtrlWord.Equals("row")) /*End of row*/ { _tableLevel++; }
                if (ctrlWordData.CtrlWord.Equals("lastrow")) /*Last row of the table*/ { }
                if (ctrlWordData.CtrlWord.Equals("row")) /*End of row*/ { _tableLevel++; }
                if (ctrlWordData.CtrlWord.Equals("irow")) /*param  is the row index of this row.*/ { }
                if (ctrlWordData.CtrlWord.Equals("irowband")) /*param is the row index of the row, adjusted to account for header rows. A header row has a value of -1.*/ { }
                if (ctrlWordData.CtrlWord.Equals("tcelld")) /*Sets table cell defaults*/ { }
                if (ctrlWordData.CtrlWord.Equals("nestcell")) /*Denotes the end of a nested cell.*/ { }
                if (ctrlWordData.CtrlWord.Equals("nestrow")) /*Denotes the end of a nested row*/ { }
                if (ctrlWordData.CtrlWord.Equals("nesttableprops")) /*Defines the properties of a nested table. This is a destination control word*/ { }
                if (ctrlWordData.CtrlWord.Equals("nonesttables")) /*Contains text for readers that do not understand nested tables. This destination should be ignored by readers that support nested tables.*/ { }
                if (ctrlWordData.CtrlWord.Equals("trgaph")) /*Half the space between the cells of a table row in twips.*/ { }
                if (ctrlWordData.CtrlWord.Equals("cellx")) /*param Defines the right boundary of a table cell, including its half of the space between cells.*/ { }
                if (ctrlWordData.CtrlWord.Equals("clmgf")) /*The first cell in a range of table cells to be merged.*/ { }
                if (ctrlWordData.CtrlWord.Equals("clmrg")) /*Contents of the table cell are merged with those of the preceding cell*/ { }
                if (ctrlWordData.CtrlWord.Equals("clvmgf")) /*The first cell in a range of table cells to be vertically merged.*/ { }
                if (ctrlWordData.CtrlWord.Equals("clvmrg")) /*Contents of the table cell are vertically merged with those of the preceding cell*/ { }
                /* TABLE: table row revision tracking */
                if (ctrlWordData.CtrlWord.Equals("trauth")) /*With revision tracking enabled, this control word identifies the author of changes to a table row's properties. N refers to a value in the revision table*/ { }
                if (ctrlWordData.CtrlWord.Equals("trdate")) /*With revision tracking enabled, this control word identifies the date of a revision*/ { }
                /* TABLE: Autoformatting flags */
                if (ctrlWordData.CtrlWord.Equals("tbllkborder")) /*Flag sets table autoformat to format borders*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkshading")) /*Flag sets table autoformat to affect shading.*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkfont")) /*Flag sets table autoformat to affect font*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkcolor")) /*Flag sets table autoformat to affect color*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkbestfit")) /*Flag sets table autoformat to apply best fit*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkhdrrows")) /*Flag sets table autoformat to format the first (header) row*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllklastrow")) /*Flag sets table autoformat to format the last row.*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllkhdrcols")) /*Flag sets table autoformat to format the first (header) column*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllklastcol")) /*Flag sets table autoformat to format the last column*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllknorowband")) /*Specifies row banding conditional formatting shall not be applied*/ { }
                if (ctrlWordData.CtrlWord.Equals("tbllknocolband")) /*Specifies column banding conditional formatting shall not be applied.*/ { }
                /* TABLE: Row Formatting */
                if (ctrlWordData.CtrlWord.Equals("taprtl")) /*Table direction is right to left*/ { }
                if (ctrlWordData.CtrlWord.Equals("trautofit")) /*param = AutoFit:
    0   No AutoFit (default).
    1   AutoFit is on for the row. Overridden by \clwWidthN and \trwWidthN in any table row.
    */
                { }
                if (ctrlWordData.CtrlWord.Equals("trhdr")) /*Table row header. This row should appear at the top of every page on which the current table appears*/ { }
                if (ctrlWordData.CtrlWord.Equals("trkeep")) /*Keep table row together. This row cannot be split by a page break. This property is assumed to be off unless the control word is present*/ { }
                if (ctrlWordData.CtrlWord.Equals("trkeepfollow")) /*Keep row in the same page as the following row.*/ { }
                if (ctrlWordData.CtrlWord.Equals("trleft")) /*Position in twips of the leftmost edge of the table with respect to the left edge of its column.*/ { }
                if (ctrlWordData.CtrlWord.Equals("trqc")) /*Centers a table row with respect to its containing column.*/ { }
                if (ctrlWordData.CtrlWord.Equals("trql")) /*Left-justifies a table row with respect to its containing column.*/ { }
                if (ctrlWordData.CtrlWord.Equals("trqr")) /*Right-justifies a table row with respect to its containing column*/ { }
                if (ctrlWordData.CtrlWord.Equals("trrh")) /*Height of a table row in twips. When 0, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line*/ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddfb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddfl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddfr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpaddft")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdfl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdft")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdfb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trspdfr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trwWidth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trftsWidth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trwWidthB")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trftsWidthB")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trftsWidthB")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trwWidthA")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trftsWidthA")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tblind")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tblindtype")) /* */ { }
                /*TABLE: Row shading and Background Colors*/
                if (ctrlWordData.CtrlWord.Equals("trcbpat")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trcfpat")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trpat")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trshdng")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgbdiag")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgcross")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdcross")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkbdiag")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkcross")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkdcross")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkfdiag")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkhor")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgdkvert")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgfdiag")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbghoriz")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbgvert")) /* */ { }
                /* TABLE: Cell Formatting*/
                if (ctrlWordData.CtrlWord.Equals("clFitText")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clNoWrap")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadfl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadft")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadfb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clpadfr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clwWidth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clftsWidth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clhidemark")) /* */ { }
                /* TABLE: Compared Table Cells */
                if (ctrlWordData.CtrlWord.Equals("clins")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("cldel")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clmrgd")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clmrgdr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clsplit")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clsplitr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clinsauth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clinsdttm")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("cldelauth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("cldeldttm")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clmrgdauth")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clmrgddttm")) /* */ { }
                /*TABLE: Position Wrapped Tables (The following properties must be the same for all rows in the table.)*/
                if (ctrlWordData.CtrlWord.Equals("tdfrmtxtLeft")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tdfrmtxtRight")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tdfrmtxtTop")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tdfrmtxtBottom")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tabsnoovrlp")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tphcol")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tphmrg")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tphpg")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposnegx")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposnegy")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposx")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposxc")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposxi")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposxl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposxo")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposxr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposy")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyc")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyil")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyin")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyout")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tposyt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tpvmrg")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tpvpara")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("tpvpg")) /* */ { }
                /* TABLE: Bidirectional Controls */
                if (ctrlWordData.CtrlWord.Equals("rtlrow")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("ltrrow")) /* */ { }
                /* TABLE: Row Borders */
                if (ctrlWordData.CtrlWord.Equals("trbrdrt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbrdrl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbrdrb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbrdrr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbrdrh")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("trbrdrv")) /* */ { }
                /* TABLE: Cell Borders */
                if (ctrlWordData.CtrlWord.Equals("brdrnil")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clbrdrb")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clbrdrt")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clbrdrl")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("clbrdrr")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("cldglu")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("cldgll")) /* */ { }
                if (ctrlWordData.CtrlWord.Equals("")) /* */ { }
            }
            if (ctrlWordData.CtrlWordType == RtfCtrlWordType.TOGGLE)
            {
                RtfParser.GetState().Properties.ToggleProperty(ctrlWordData);//ctrlWordData.specialHandler);
            }

            if (ctrlWordData.CtrlWordType == RtfCtrlWordType.FLAG ||
                    ctrlWordData.CtrlWordType == RtfCtrlWordType.VALUE)
            {
                RtfParser.GetState().Properties.SetProperty(ctrlWordData);//ctrlWordData.specialHandler, ctrlWordData.param);
            }

            switch (_conversionType)
            {
                case RtfParser.TYPE_IMPORT_FULL:
                    if (!_importIgnoredCtrlwords.Contains(ctrlWordData.CtrlWord))
                    {
                        writeBuffer();
                        writeText(ctrlWordData.ToString());
                    }
                    result = true;
                    break;
                case RtfParser.TYPE_IMPORT_FRAGMENT:
                    if (!_importIgnoredCtrlwords.Contains(ctrlWordData.CtrlWord))
                    {
                        writeBuffer();
                        writeText(ctrlWordData.ToString());
                    }
                    result = true;
                    break;
                case RtfParser.TYPE_CONVERT:
                    if (_importIgnoredCtrlwords.Contains(ctrlWordData.CtrlWord) == false)
                    {
                    }
                    result = true;
                    break;
                default:    // error because is should be an import or convert
                    result = false;
                    break;
            }




            return result;
        }
Example #34
0
 public override void SetParser(RtfParser parser)
 {
     RtfParser     = parser;
     _importHeader = parser.GetImportManager();
 }
Example #35
0
 public override void SetParser(RtfParser parser)
 {
     this.rtfParser    = parser;
     this.importHeader = parser.GetImportManager();
     this.SetToDefaults();
 }
 public RtfDestinationStylesheetTable(RtfParser parser, String type) : base(parser)
 {
     this.importHeader = parser.GetImportManager();
     this.type         = type;
 }
 /**
  * Constructs a new RtfDestinationShppict.
  */
 public RtfDestinationShppict(RtfParser parser) : base(parser)
 {
 }
 /* (non-Javadoc)
 * @see com.lowagie.text.rtf.parser.destinations.RtfDestination#setParser(com.lowagie.text.rtf.parser.RtfParser)
 * 
 * @since 2.0.8
 */
 public override void SetParser(RtfParser parser) {
     if (this.rtfParser != null && this.rtfParser.Equals(parser)) return;
     this.rtfParser = parser;
     this.Init(true);
 }