public virtual bool ResetAttribute(string attrib) { Debug.Assert(attrib != null, "invalid attribute name"); Debug.WriteLineIf(StyleBuilder.StyleBuilderSaveSwitch.TraceVerbose, "CSSRuleStyle::ResetAttribute(" + attrib + ")"); bool result = false; try { style.RemoveAttribute(attrib, 1); result = true; } catch (Exception e) { Debug.Fail(e.ToString()); } return(result); }
/////////////////////////////////////////////////////////////////////////// // IStyleBuilderPage Implementation and StyleBuilderPage Overrides /// <include file='doc\ListsStylePage.uex' path='docs/doc[@for="ListsStylePage.ActivatePage"]/*' /> /// <devdoc> /// The page is now the currently active page in the StyleBuilder. /// Be sure to call super.activatePage, so that the page is made visible. /// </devdoc> protected override void ActivatePage() { base.ActivatePage(); // initialize the preview IStyleBuilderPreview preview = null; if (Site != null) { preview = (IStyleBuilderPreview)Site.GetService(typeof(IStyleBuilderPreview)); } if (preview != null) { try { IHTMLElement listsPreviewElem = null; IHTMLElement listItemElem = null; IHTMLElement previewElem = preview.GetPreviewElement(); previewElem.SetInnerHTML(PREVIEW_TEMPLATE); listsPreviewElem = preview.GetElement(PREVIEW_ELEM_ID); if (listsPreviewElem != null) { previewStyle = listsPreviewElem.GetStyle(); } listItemElem = preview.GetElement(PREVIEW_LISTITEM1_ID); if (listItemElem != null) { listItemElem.SetInnerHTML(SR.GetString(SR.LstSP_PreviewText_1)); } listItemElem = preview.GetElement(PREVIEW_LISTITEM2_ID); if (listItemElem != null) { listItemElem.SetInnerHTML(SR.GetString(SR.LstSP_PreviewText_2)); } } catch (Exception) { previewStyle = null; return; } Debug.Assert(previewStyle != null, "Expected to have non-null cached style reference"); // Setup the font from the shared element to reflect settings in the font page try { IHTMLElement sharedElem = preview.GetSharedElement(); IHTMLStyle sharedStyle; string fontValue; if (sharedElem != null) { sharedStyle = sharedElem.GetStyle(); previewStyle.SetTextDecoration(sharedStyle.GetTextDecoration()); previewStyle.SetTextTransform(sharedStyle.GetTextTransform()); fontValue = sharedStyle.GetFont(); if ((fontValue != null) && (fontValue.Length != 0)) { previewStyle.SetFont(fontValue); } else { previewStyle.RemoveAttribute("font", 1); previewStyle.SetFontFamily(sharedStyle.GetFontFamily()); object o = sharedStyle.GetFontSize(); if (o != null) { previewStyle.SetFontSize(o); } previewStyle.SetFontObject(sharedStyle.GetFontObject()); previewStyle.SetFontStyle(sharedStyle.GetFontStyle()); previewStyle.SetFontWeight(sharedStyle.GetFontWeight()); } } } catch (Exception) { } // update initial preview UpdateBulletStylePreview(); UpdateBulletImagePreview(); UpdateBulletPositionPreview(); } }