STOFFDocument.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
00002 
00003 /* libstaroffice
00004  * Version: MPL 2.0 / LGPLv2.1+
00005  *
00006  * This Source Code Form is subject to the terms of the Mozilla Public
00007  * License, v. 2.0. If a copy of the MPL was not distributed with this
00008  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009  *
00010  * Major Contributor(s):
00011  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00012  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
00013  *
00014  * For minor contributions see the git repository.
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the GNU Lesser General Public License Version 2.1 or later
00018  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00019  * applicable instead of those above.
00020  *
00021  * For further information visit http://libstoff.sourceforge.net
00022  */
00023 
00024 
00025 #ifndef STOFFDOCUMENT_HXX
00026 #define STOFFDOCUMENT_HXX
00027 
00028 #ifdef DLL_EXPORT
00029 #ifdef BUILD_STOFF
00030 #define STOFFLIB __declspec(dllexport)
00031 #else
00032 #define STOFFLIB __declspec(dllimport)
00033 #endif
00034 #else // !DLL_EXPORT
00035 #ifdef LIBSTAROFFICE_VISIBILITY
00036 #define STOFFLIB __attribute__((visibility("default")))
00037 #else
00038 #define STOFFLIB
00039 #endif
00040 #endif
00041 
00042 namespace librevenge
00043 {
00044 class RVNGBinaryData;
00045 class RVNGDrawingInterface;
00046 class RVNGPresentationInterface;
00047 class RVNGSpreadsheetInterface;
00048 class RVNGTextInterface;
00049 class RVNGInputStream;
00050 }
00051 
00055 class STOFFDocument
00056 {
00057 public:
00059   enum Confidence {
00060     STOFF_C_NONE=0,
00061     STOFF_C_UNSUPPORTED_ENCRYPTION ,
00062     STOFF_C_SUPPORTED_ENCRYPTION ,
00063     STOFF_C_EXCELLENT 
00064   };
00066   enum Kind {
00067     STOFF_K_UNKNOWN=0 ,
00068     STOFF_K_BITMAP ,
00069     STOFF_K_CHART ,
00070     STOFF_K_DATABASE ,
00071     STOFF_K_DRAW ,
00072     STOFF_K_MATH ,
00073     STOFF_K_PRESENTATION ,
00074     STOFF_K_SPREADSHEET ,
00075     STOFF_K_TEXT ,
00076     STOFF_K_GRAPHIC 
00077   };
00079   enum Result {
00080     STOFF_R_OK=0 ,
00081     STOFF_R_FILE_ACCESS_ERROR ,
00082     STOFF_R_OLE_ERROR ,
00083     STOFF_R_PARSE_ERROR ,
00084     STOFF_R_PASSWORD_MISSMATCH_ERROR ,
00085     STOFF_R_UNKNOWN_ERROR 
00086   };
00087 
00093   static STOFFLIB Confidence isFileFormatSupported(librevenge::RVNGInputStream *input, Kind &kind);
00094 
00095   // ------------------------------------------------------------
00096   // the different main parsers
00097   // ------------------------------------------------------------
00098 
00107   static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *documentInterface, char const *password=0);
00108 
00117   static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *documentInterface, char const *password=0);
00118 
00127   static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGPresentationInterface *documentInterface, char const *password=0);
00128 
00137   static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *documentInterface, char const *password=0);
00138 
00139   // ------------------------------------------------------------
00140   // decoders of the embedded zones created by libstoff
00141   // ------------------------------------------------------------
00142 
00152   static STOFFLIB bool decodeGraphic(librevenge::RVNGBinaryData const &binary, librevenge::RVNGDrawingInterface *documentInterface);
00153 
00163   static STOFFLIB bool decodeSpreadsheet(librevenge::RVNGBinaryData const &binary, librevenge::RVNGSpreadsheetInterface *documentInterface);
00164 
00174   static STOFFLIB bool decodeText(librevenge::RVNGBinaryData const &binary, librevenge::RVNGTextInterface *documentInterface);
00175 };
00176 
00177 #endif /* STOFFDOCUMENT_HXX */
00178 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: