Example #1
0
        }         // CopyTo

        // ----------------------------------------------------------------------
        public void Add(IRtfFont item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            InnerList.Add(item);
            fontByIdMap.Add(item.Id, item);
        }         // Add
 // ----------------------------------------------------------------------
 public void Add( IRtfFont item )
 {
     if ( item == null )
     {
         throw new ArgumentNullException( "item" );
     }
     InnerList.Add( item );
     fontByIdMap.Add( item.Id, item );
 }
Example #3
0
 // ----------------------------------------------------------------------
 public RtfDocument(
     int rtfVersion,
     IRtfFont defaultFont,
     IRtfFontCollection fontTable,
     IRtfColorCollection colorTable,
     string generator,
     IRtfTextFormatCollection uniqueTextFormats,
     IRtfDocumentInfo documentInfo,
     IRtfDocumentPropertyCollection userProperties,
     IRtfVisualCollection visualContent
     )
 {
     if ( rtfVersion != RtfSpec.RtfVersion1 )
     {
         throw new RtfUnsupportedStructureException( Strings.UnsupportedRtfVersion( rtfVersion ) );
     }
     if ( defaultFont == null )
     {
         throw new ArgumentNullException( "defaultFont" );
     }
     if ( fontTable == null )
     {
         throw new ArgumentNullException( "fontTable" );
     }
     if ( colorTable == null )
     {
         throw new ArgumentNullException( "colorTable" );
     }
     if ( uniqueTextFormats == null )
     {
         throw new ArgumentNullException( "uniqueTextFormats" );
     }
     if ( documentInfo == null )
     {
         throw new ArgumentNullException( "documentInfo" );
     }
     if ( userProperties == null )
     {
         throw new ArgumentNullException( "userProperties" );
     }
     if ( visualContent == null )
     {
         throw new ArgumentNullException( "visualContent" );
     }
     this.rtfVersion = rtfVersion;
     this.defaultFont = defaultFont;
     defaultTextFormat = new RtfTextFormat( defaultFont, RtfSpec.DefaultFontSize );
     this.fontTable = fontTable;
     this.colorTable = colorTable;
     this.generator = generator;
     this.uniqueTextFormats = uniqueTextFormats;
     this.documentInfo = documentInfo;
     this.userProperties = userProperties;
     this.visualContent = visualContent;
 }
Example #4
0
        }         // RtfDocument

        // ----------------------------------------------------------------------
        public RtfDocument(
            int rtfVersion,
            IRtfFont defaultFont,
            IRtfFontCollection fontTable,
            IRtfColorCollection colorTable,
            string generator,
            IRtfTextFormatCollection uniqueTextFormats,
            IRtfDocumentInfo documentInfo,
            IRtfDocumentPropertyCollection userProperties,
            IRtfVisualCollection visualContent
            )
        {
            if (rtfVersion != RtfSpec.RtfVersion1)
            {
                throw new RtfUnsupportedStructureException(Strings.UnsupportedRtfVersion(rtfVersion));
            }
            if (defaultFont == null)
            {
                throw new ArgumentNullException("defaultFont");
            }
            if (fontTable == null)
            {
                throw new ArgumentNullException("fontTable");
            }
            if (colorTable == null)
            {
                throw new ArgumentNullException("colorTable");
            }
            if (uniqueTextFormats == null)
            {
                throw new ArgumentNullException("uniqueTextFormats");
            }
            if (documentInfo == null)
            {
                throw new ArgumentNullException("documentInfo");
            }
            if (userProperties == null)
            {
                throw new ArgumentNullException("userProperties");
            }
            if (visualContent == null)
            {
                throw new ArgumentNullException("visualContent");
            }
            this.rtfVersion        = rtfVersion;
            this.defaultFont       = defaultFont;
            defaultTextFormat      = new RtfTextFormat(defaultFont, RtfSpec.DefaultFontSize);
            this.fontTable         = fontTable;
            this.colorTable        = colorTable;
            this.generator         = generator;
            this.uniqueTextFormats = uniqueTextFormats;
            this.documentInfo      = documentInfo;
            this.userProperties    = userProperties;
            this.visualContent     = visualContent;
        }         // RtfDocument
Example #5
0
        } // RtfDocument

        public RtfDocument(
            int rtfVersion,
            IRtfFont defaultFont,
            IRtfFontCollection fontTable,
            IRtfColorCollection colorTable,
            string generator,
            IRtfTextFormatCollection uniqueTextFormats,
            IRtfDocumentInfo documentInfo,
            IRtfDocumentPropertyCollection userProperties,
            IRtfVisualCollection visualContent
            )
        {
            if (rtfVersion != RtfSpec.RtfVersion1)
            {
                throw new RtfUnsupportedStructureException(Strings.UnsupportedRtfVersion(rtfVersion));
            }
            if (defaultFont == null)
            {
                throw new ArgumentNullException(nameof(defaultFont));
            }
            if (fontTable == null)
            {
                throw new ArgumentNullException(nameof(fontTable));
            }
            if (colorTable == null)
            {
                throw new ArgumentNullException(nameof(colorTable));
            }
            if (uniqueTextFormats == null)
            {
                throw new ArgumentNullException(nameof(uniqueTextFormats));
            }
            if (documentInfo == null)
            {
                throw new ArgumentNullException(nameof(documentInfo));
            }
            if (userProperties == null)
            {
                throw new ArgumentNullException(nameof(userProperties));
            }
            if (visualContent == null)
            {
                throw new ArgumentNullException(nameof(visualContent));
            }
            RtfVersion        = rtfVersion;
            DefaultFont       = defaultFont;
            DefaultTextFormat = new RtfTextFormat(defaultFont, RtfSpec.DefaultFontSize);
            FontTable         = fontTable;
            ColorTable        = colorTable;
            Generator         = generator;
            UniqueTextFormats = uniqueTextFormats;
            DocumentInfo      = documentInfo;
            UserProperties    = userProperties;
            VisualContent     = visualContent;
        } // RtfDocument
 // ----------------------------------------------------------------------
 public RtfTextFormat( IRtfFont font, int fontSize )
 {
     if ( font == null )
     {
         throw new ArgumentNullException( "font" );
     }
     if ( fontSize <= 0 || fontSize > 0xFFFF )
     {
         throw new ArgumentException( Strings.FontSizeOutOfRange( fontSize ) );
     }
     this.font = font;
     this.fontSize = fontSize;
 }
 // ----------------------------------------------------------------------
 public RtfTextFormat(IRtfFont font, int fontSize)
 {
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     if (fontSize <= 0 || fontSize > 0xFFFF)
     {
         throw new ArgumentException(Strings.FontSizeOutOfRange(fontSize));
     }
     this.font     = font;
     this.fontSize = fontSize;
 }         // RtfTextFormat
        }         // Font

        // ----------------------------------------------------------------------
        public RtfTextFormat DeriveWithFont(IRtfFont rtfFont)
        {
            if (rtfFont == null)
            {
                throw new ArgumentNullException("rtfFont");
            }
            if (font.Equals(rtfFont))
            {
                return(this);
            }

            RtfTextFormat copy = new RtfTextFormat(this);

            copy.font = rtfFont;
            return(copy);
        }         // DeriveWithFont
 // ----------------------------------------------------------------------
 public RtfTextFormat( IRtfTextFormat copy )
 {
     if ( copy == null )
     {
         throw new ArgumentNullException( "copy" );
     }
     font = copy.Font; // enough because immutable
     fontSize = copy.FontSize;
     superScript = copy.SuperScript;
     bold = copy.IsBold;
     italic = copy.IsItalic;
     underline = copy.IsUnderline;
     strikeThrough = copy.IsStrikeThrough;
     hidden = copy.IsHidden;
     backgroundColor = copy.BackgroundColor; // enough because immutable
     foregroundColor = copy.ForegroundColor; // enough because immutable
     alignment = copy.Alignment;
 }
        // ----------------------------------------------------------------------
        public RtfTextFormat DeriveWithFont( IRtfFont rtfFont )
        {
            if ( rtfFont == null )
            {
                throw new ArgumentNullException( "rtfFont" );
            }
            if ( font.Equals( rtfFont ) )
            {
                return this;
            }

            RtfTextFormat copy = new RtfTextFormat( this );
            copy.font = rtfFont;
            return copy;
        }
 // ----------------------------------------------------------------------
 public void CopyTo( IRtfFont[] array, int index )
 {
     InnerList.CopyTo( array, index );
 }