/// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlFormat.Compare"]/*' />
 public virtual bool Compare(WmlFormat format)
 {
     return Bold == format.Bold &&
            Italic == format.Italic &&
            Size == format.Size;
 }
        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.BeginForm"]/*' />
        public virtual void BeginForm(Form form)
        {
            _cachedFormQueryString = null;
            _currentForm = form;

            _writtenFormVariables = false;

            // To keep track of postbacks which submit form variables,
            // and postbacks that don't. Used for postback cards
            // (see UsePostBackCards)

            _usingPostBackType[0] = _usingPostBackType[1] = false;

            if (AnalyzeMode)
            {
                _numberOfPostBacks = 0;
                _postBackCardsEfficient = false;
                _controlShortNames = null;
            }
            else
            {
                PendingBreak = false;
                _currentWrittenLayout = null;
                _currentWrittenFormat = null;

                RenderBeginForm(form);
            }
        }
 /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlFormat.WmlFormat"]/*' />
 public WmlFormat(Style style, WmlFormat currentFormat)
 {
     BooleanOption bold = (BooleanOption)style[Style.BoldKey, true];
     Bold = (bold != BooleanOption.NotSet) ? bold == BooleanOption.True : currentFormat.Bold;
     BooleanOption italic = (BooleanOption)style[Style.ItalicKey, true];
     Italic = (italic != BooleanOption.NotSet) ? italic == BooleanOption.True : currentFormat.Italic;
     FontSize fontSize  = (FontSize)style[Style.FontSizeKey, true];
     Size = (fontSize != FontSize.NotSet) ? fontSize : currentFormat.Size;
 }
        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.EnterFormat"]/*' />
        public override void EnterFormat(Style style)
        {
            if (AnalyzeMode)
            {
                return;
            }

            WmlFormat newFormat = new WmlFormat(style, CurrentFormat);
            _formatStack.Push(newFormat);
        }
        // Close any open character formatting tags.

        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.CloseCharacterFormat"]/*' />
        protected virtual void CloseCharacterFormat()
        {
            if (_currentWrittenFormat != null)
            {
                if (_currentWrittenFormat.WrittenSize)
                {
                    WriteEndTag(_currentWrittenFormat.Size == FontSize.Large ? _largeTag : _smallTag);
                }
                if (_currentWrittenFormat.WrittenItalic)
                {
                    WriteEndTag(_italicTag);
                }
                if (_currentWrittenFormat.WrittenBold)
                {
                    WriteEndTag(_boldTag);
                }
                _currentWrittenFormat = null;
            }
        }
        // Renders tags to enter the given character format. Only the specified 
        // attributes are used.

        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.OpenCharacterFormat"]/*' />
        protected virtual void OpenCharacterFormat(WmlFormat format, bool writeBold, bool writeItalic, bool writeSize)
        {
            if (_currentWrittenFormat == null)
            {
                if (writeBold && format.Bold)
                {
                    WriteFullBeginTag(_boldTag);
                    format.WrittenBold = true;
                }
                if (writeItalic && format.Italic)
                {
                    WriteFullBeginTag(_italicTag);
                    format.WrittenItalic = true;
                }
                if (writeSize && format.Size != FontSize.Normal)
                {
                    WriteFullBeginTag(format.Size == FontSize.Large ? _largeTag : _smallTag);
                    format.WrittenSize = true;
                }
                _currentWrittenFormat = format;
            }
        }