PageRenderTime 34ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/AODL/Document/Import/IImporter.cs

https://bitbucket.org/chrisc/aodl
C# | 112 lines | 25 code | 7 blank | 80 comment | 0 complexity | bc237d4c229c13657de9b889259b5bfb MD5 | raw file
  1. /*************************************************************************
  2. *
  3. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  4. *
  5. * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
  6. *
  7. * Use is subject to license terms.
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  10. * use this file except in compliance with the License. You may obtain a copy
  11. * of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also
  12. * obtain a copy of the License at http://odftoolkit.org/docs/license.txt
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  16. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. *
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. *
  21. ************************************************************************/
  22. using System;
  23. using System.IO;
  24. using AODL.Document.Export;
  25. using System.Collections.Generic;
  26. using AODL.Document.Exceptions;
  27. using AODL.IO;
  28. namespace AODL.Document.Import
  29. {
  30. public class ImporterException : AODLException
  31. {
  32. public ImporterException(string message, Exception e)
  33. : base(message, e)
  34. {
  35. }
  36. }
  37. /// <summary>
  38. /// All classes that want to act as an importer have to
  39. /// to implement this interface.
  40. /// </summary>
  41. public interface IImporter
  42. {
  43. /// <summary>
  44. /// Imports the specified document.
  45. /// A Importer class have to return a TextDocument object
  46. /// </summary>
  47. /// <param name="document">The document.</param>
  48. /// <param name="filename">The filename.</param>
  49. void Import(IDocument document,string filename);
  50. /// <summary>
  51. /// Opens a readonly stream
  52. /// </summary>
  53. /// <param name="path"></param>
  54. /// <returns></returns>
  55. Stream Open(string path);
  56. /// <summary>
  57. /// Gets a file descriptor
  58. /// </summary>
  59. /// <param name="path"></param>
  60. /// <returns></returns>
  61. IFile GetFile(string path);
  62. /// <summary>
  63. /// Gets the import error.
  64. /// </summary>
  65. /// <value>The import error.</value>
  66. IList<AODLWarning> ImportError {get; }
  67. /// <summary>
  68. /// List of DocumentSupportInfo objects
  69. /// </summary>
  70. /// <value>List of DocumentSupportInfo objects.</value>
  71. IList<DocumentSupportInfo> DocumentSupportInfos { get; }
  72. /// <summary>
  73. /// If the import file format isn't any OpenDocument
  74. /// format you have to return true and AODL will
  75. /// create a new one.
  76. /// </summary>
  77. bool NeedNewOpenDocument {get;}
  78. }
  79. }
  80. /*
  81. * $Log: IImporter.cs,v $
  82. * Revision 1.2 2008/04/29 15:39:52 mt
  83. * new copyright header
  84. *
  85. * Revision 1.1 2007/02/25 08:58:44 larsbehr
  86. * initial checkin, import from Sourceforge.net to OpenOffice.org
  87. *
  88. * Revision 1.2 2006/02/02 21:55:59 larsbm
  89. * - Added Clone object support for many AODL object types
  90. * - New Importer implementation PlainTextImporter and CsvImporter
  91. * - New tests
  92. *
  93. * Revision 1.1 2006/01/29 11:28:23 larsbm
  94. * - Changes for the new version. 1.2. see next changelog for details
  95. *
  96. * Revision 1.2 2005/11/20 17:31:20 larsbm
  97. * - added suport for XLinks, TabStopStyles
  98. * - First experimental of loading dcuments
  99. * - load and save via importer and exporter interfaces
  100. *
  101. * Revision 1.1 2005/11/06 14:55:25 larsbm
  102. * - Interfaces for Import and Export
  103. * - First implementation of IExport OpenDocumentTextExporter
  104. *
  105. */