1:   //  IDocument.cs 
2:   //  Copyright (c) 2001 Mike Krueger
3:   //
4:   //  This program is free software; you can redistribute it and/or modify
5:   //  it under the terms of the GNU General Public License as published by
6:   //  the Free Software Foundation; either version 2 of the License, or
7:   //  (at your option) any later version.
8:   //
9:   //  This program is distributed in the hope that it will be useful,
10:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12:   //  GNU General Public License for more details.
13:   //
14:   //  You should have received a copy of the GNU General Public License
15:   //  along with this program; if not, write to the Free Software
16:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17:  
18:   using System.IO;
19:  
20:   using Core.Properties;
21:   using SharpDevelop.Internal.Undo;
22:   using SharpDevelop.Gui.Edit// for the ProgressEventHandler
23:  
24:   namespace SharpDevelop.DefaultEditor.Text {
25:       
26:       /// <summary>
27:       /// This interface represents a container which holds a text sequence and
28:       /// all necessary information about it. It is used as the base for a text editor.
29:       /// </summary>
30:       public class DocumentFactory
31:       {
32:           public IDocument CreateDocument()
33:           {
34:               Document doc new Document();
35:               
36:               doc.Properties           = ((IProperties)GlobalProperties.GetProperty("SharpDevelop.DefaultEditor.Text.Document.DefaultDocumentProperties"new DefaultProperties())).Clone();
37:               doc.UndoStack            new UndoStack();
38:   //            doc.TextStoreStrategy    = new StringTextStoreStrategy();
39:               doc.TextStoreStrategy    new GapTextStoreStrategy(30300);
40:               doc.Caret                new DefaultCaret(doc);
41:               doc.FormatingStrategy    new CSharpFormatingStrategy();
42:               doc.FormatingStrategy.Document doc;
43:               
44:               doc.LineTrackingStrategy new DefaultLineTrackingStrategy(docnull);
45:               doc.BookmarkManager      new BookmarkManager(doc.LineTrackingStrategy);
46:               doc.TextModel            new DefaultTextModel(doc);
47:               return doc;
48:           }
49:           public IDocument CreateFromFile(string fileName)
50:           {
51:               IDocument document CreateDocument();
52:               StreamReader stream File.OpenText(fileName);
53:               document.TextContent stream.ReadToEnd();
54:               stream.Close();
55:               return document;
56:           }
57:       }
58:   }

This page was automatically generated by SharpDevelop.