private HierarchicalContentDocument(DocumentConfiguration thisNotepadXConfiguration, bool isDirty, bool makeNewDocument) { InitializePrivateVars(thisNotepadXConfiguration); if (makeNewDocument) { MakeBlankDocument(); } m_catNoteConfiguration.SetIsDirty(isDirty); }
public void Remove() { if (this.IsReadOnly == false) { m_catNoteDetailXmlNode.ParentNode.RemoveChild(m_catNoteDetailXmlNode); m_catNoteConfiguration.SetIsDirty(true); } else { throw new ReadOnlyNoteException("Can not remove this note because it is read-only. You must remove read-only attribute before deleting this note"); } }
protected internal static ContentDetail CreateCatNoteDetail(XmlNode parentXmlNode, DocumentConfiguration thisNotepadXConfiguration) { XmlDocument ownerDocument; if (parentXmlNode.OwnerDocument != null) { ownerDocument = parentXmlNode.OwnerDocument; } else { ownerDocument = (XmlDocument)parentXmlNode; } XmlNode newCatNoteDetailXmlNode = ownerDocument.CreateElement(thisNotepadXConfiguration.XmlTagName); XmlAttribute idXmlAttribute = ownerDocument.CreateAttribute("id"); idXmlAttribute.Value = System.Guid.NewGuid().ToString(); newCatNoteDetailXmlNode.Attributes.Append(idXmlAttribute); XmlAttribute titleXmlAttribute = ownerDocument.CreateAttribute("title"); newCatNoteDetailXmlNode.Attributes.Append(titleXmlAttribute); XmlAttribute contentXmlAttribute = ownerDocument.CreateAttribute("content"); newCatNoteDetailXmlNode.Attributes.Append(contentXmlAttribute); parentXmlNode.AppendChild(newCatNoteDetailXmlNode); thisNotepadXConfiguration.SetIsDirty(true); return(new ContentDetail(newCatNoteDetailXmlNode, thisNotepadXConfiguration)); }
protected override void OnClear() { if (m_catNoteConfiguration.IsDocumentReadOnly == false) { foreach (XmlNode catNoteDetailNode in m_NotepadXDocumentParentXmlNode.ChildNodes) { m_NotepadXDocumentParentXmlNode.RemoveChild(catNoteDetailNode); } } else { throw new ReadOnlyDocumentException("Can not remove all notes because this document is read-only"); } m_catNoteConfiguration.SetIsDirty(true); }