NS_IMETHODIMP AddStyleSheetTransaction::DoTransaction() { NS_ENSURE_TRUE(mEditor && mSheet, NS_ERROR_NOT_INITIALIZED); AddStyleSheet(mEditor, mSheet); return NS_OK; }
///////////////////////////////// // class nuiHTMLNode nuiHTMLNode::nuiHTMLNode(const nglString& rName, nuiHTMLNode::NodeType Type, nuiHTMLNode::TagType _tagType, const nglString& rText, nuiHTMLNode* pParent, bool ComputeStyle) : mpParent(pParent), mpStyle(NULL), mpInlineStyle(NULL) { mName = rName; mType = Type; mTagType = _tagType; mText = rText; mpParent = NULL; mpInlineStyle = NULL; if (ComputeStyle) { mpStyle = new nuiCSSStyle(this); nuiHTMLAttrib* pStyle = GetAttribute(nuiHTMLAttrib::eAttrib_STYLE); if (pStyle) { AddStyleSheet(GetSourceURL(), pStyle->GetValue(), true); } } }
void nuiHTMLNode::SetFromNode(const void* _tdoc, const void* _tnod, nglTextEncoding encoding, bool ComputeStyle) { Clear(); TidyDoc tdoc = (TidyDoc)_tdoc; TidyNode tnod = (TidyNode)_tnod; mName = nglString(tidyNodeGetName(tnod), encoding); mType = (NodeType)tidyNodeGetType(tnod); mTagType = (TagType)tidyNodeGetId(tnod); nglString text; TidyBuffer buf; tidyBufInit(&buf); if (tidyNodeGetValue(tdoc, tnod, &buf)) { mText.Import((const char*)buf.bp, (int32)buf.size, encoding); //NGL_OUT(_T("<%s> %s\n"), mName.GetChars(), mText.GetChars()); } tidyBufFree(&buf); // Fill the attributes: TidyAttr tattr; for (tattr = tidyAttrFirst(tnod); tattr; tattr = tidyAttrNext(tattr)) { nuiHTMLAttrib* pAttrib = new nuiHTMLAttrib(tattr, encoding); mAttributes.push_back(pAttrib); } if (ComputeStyle) { mpStyle = new nuiCSSStyle(this); nuiHTMLAttrib* pStyle = GetAttribute(nuiHTMLAttrib::eAttrib_STYLE); if (pStyle) { AddStyleSheet(GetSourceURL(), pStyle->GetValue(), true); } } }