public TextDocument New()
{
this._xmldoc = new XmlDocument();
this.Styles = new StyleCollection();
this._xmldoc.LoadXml(TextDocumentHelper.GetBlankDocument());
this.NamespaceManager = TextDocumentHelper.NameSpace(this._xmldoc.NameTable);
this.DocumentConfigurations2 = new DocumentConfiguration2();
this.DocumentManifest = new DocumentManifest();
this.DocumentManifest.New();
this.DocumentMetadata = new DocumentMetadata(this);
this.DocumentMetadata.New();
this.DocumentPictures = new DocumentPictureCollection();
this.DocumentSetting = new DocumentSetting();
this.DocumentSetting.New();
this.DocumentStyles = new DocumentStyles();
this.DocumentStyles.New(this);
this.ReadCommonStyles();
this.Forms = new ODFFormCollection();
this._formCollection.Clearing += FormsCollection_Clear;
this._formCollection.Removed += FormsCollection_Removed;
this.Fields.Clear();
this.Content.Clear();
this.VariableDeclarations = new VariableDeclCollection();
this.DocumentThumbnails = new DocumentPictureCollection();
MasterPageFactory.RenameMasterStyles(
this.DocumentStyles.Styles,
this.XmlDoc, this.NamespaceManager);
// Read the moved and renamed styles
LocalStyleProcessor lsp = new LocalStyleProcessor(this, false);
lsp.ReReadKnownAutomaticStyles();
new MasterPageFactory(m_dirInfo).FillFromXMLDocument(this);
return this;
}