STOFFDocument.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libstaroffice
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
* Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libstoff.sourceforge.net
*/
#ifndef STOFFDOCUMENT_HXX
#define STOFFDOCUMENT_HXX
#ifdef _WINDLL
#ifdef BUILD_STOFF
#define STOFFLIB __declspec(dllexport)
#else
#define STOFFLIB __declspec(dllimport)
#endif
#else // !DLL_EXPORT
#ifdef LIBSTAROFFICE_VISIBILITY
#define STOFFLIB __attribute__((visibility("default")))
#else
#define STOFFLIB
#endif
#endif
namespace librevenge
{
class RVNGBinaryData;
class RVNGDrawingInterface;
class RVNGPresentationInterface;
class RVNGSpreadsheetInterface;
class RVNGTextInterface;
class RVNGInputStream;
}
class STOFFDocument
{
public:
enum Confidence {
STOFF_C_NONE=0,
STOFF_C_UNSUPPORTED_ENCRYPTION ,
STOFF_C_SUPPORTED_ENCRYPTION ,
STOFF_C_EXCELLENT
};
enum Kind {
STOFF_K_UNKNOWN=0 ,
STOFF_K_BITMAP ,
STOFF_K_CHART ,
STOFF_K_DATABASE ,
STOFF_K_DRAW ,
STOFF_K_MATH ,
STOFF_K_PRESENTATION ,
STOFF_K_SPREADSHEET ,
STOFF_K_TEXT ,
STOFF_K_GRAPHIC
};
enum Result {
STOFF_R_OK=0 ,
STOFF_R_FILE_ACCESS_ERROR ,
STOFF_R_OLE_ERROR ,
STOFF_R_PARSE_ERROR ,
STOFF_R_PASSWORD_MISSMATCH_ERROR ,
STOFF_R_UNKNOWN_ERROR
};
static STOFFLIB Confidence isFileFormatSupported(librevenge::RVNGInputStream *input, Kind &kind);
// ------------------------------------------------------------
// the different main parsers
// ------------------------------------------------------------
static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *documentInterface, char const *password=nullptr);
static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *documentInterface, char const *password=nullptr);
static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGPresentationInterface *documentInterface, char const *password=nullptr);
static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *documentInterface, char const *password=nullptr);
// ------------------------------------------------------------
// decoders of the embedded zones created by libstoff
// ------------------------------------------------------------
static STOFFLIB bool decodeGraphic(librevenge::RVNGBinaryData const &binary, librevenge::RVNGDrawingInterface *documentInterface);
static STOFFLIB bool decodeSpreadsheet(librevenge::RVNGBinaryData const &binary, librevenge::RVNGSpreadsheetInterface *documentInterface);
static STOFFLIB bool decodeText(librevenge::RVNGBinaryData const &binary, librevenge::RVNGTextInterface *documentInterface);
};
#endif /* STOFFDOCUMENT_HXX */
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFLIB
#define STOFFLIB
Definition STOFFDocument.hxx:38
STOFFDocument
This class provides all the functions an application would need to parse StarOffice documents.
Definition STOFFDocument.hxx:56
STOFFDocument::decodeText
static STOFFLIB bool decodeText(librevenge::RVNGBinaryData const &binary, librevenge::RVNGTextInterface *documentInterface)
Parses the text contained in the binary data and called documentInterface to reconstruct a text.
Definition STOFFDocument.cxx:276
STOFFDocument::Kind
Kind
an enum to define the kind of document
Definition STOFFDocument.hxx:66
STOFFDocument::STOFF_K_CHART
@ STOFF_K_CHART
chart
Definition STOFFDocument.hxx:69
STOFFDocument::STOFF_K_DATABASE
@ STOFF_K_DATABASE
database
Definition STOFFDocument.hxx:70
STOFFDocument::STOFF_K_GRAPHIC
@ STOFF_K_GRAPHIC
gallery graphic: .sdg
Definition STOFFDocument.hxx:76
STOFFDocument::STOFF_K_BITMAP
@ STOFF_K_BITMAP
bitmap/image
Definition STOFFDocument.hxx:68
STOFFDocument::STOFF_K_UNKNOWN
@ STOFF_K_UNKNOWN
unknown
Definition STOFFDocument.hxx:67
STOFFDocument::STOFF_K_DRAW
@ STOFF_K_DRAW
vectorized graphic: .sda
Definition STOFFDocument.hxx:71
STOFFDocument::STOFF_K_TEXT
@ STOFF_K_TEXT
word processing file
Definition STOFFDocument.hxx:75
STOFFDocument::STOFF_K_PRESENTATION
@ STOFF_K_PRESENTATION
presentation
Definition STOFFDocument.hxx:73
STOFFDocument::STOFF_K_MATH
@ STOFF_K_MATH
math
Definition STOFFDocument.hxx:72
STOFFDocument::STOFF_K_SPREADSHEET
@ STOFF_K_SPREADSHEET
spreadsheet: .sdc
Definition STOFFDocument.hxx:74
STOFFDocument::decodeSpreadsheet
static STOFFLIB bool decodeSpreadsheet(librevenge::RVNGBinaryData const &binary, librevenge::RVNGSpreadsheetInterface *documentInterface)
Parses the spreadsheet contained in the binary data and called documentInterface to reconstruct a spr...
Definition STOFFDocument.cxx:259
STOFFDocument::parse
static STOFFLIB Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *documentInterface, char const *password=nullptr)
Parses the input stream content.
Definition STOFFDocument.cxx:204
STOFFDocument::isFileFormatSupported
static STOFFLIB Confidence isFileFormatSupported(librevenge::RVNGInputStream *input, Kind &kind)
Analyzes the content of an input stream to see if it can be parsed.
Definition STOFFDocument.cxx:63
STOFFDocument::decodeGraphic
static STOFFLIB bool decodeGraphic(librevenge::RVNGBinaryData const &binary, librevenge::RVNGDrawingInterface *documentInterface)
Parses the graphic contained in the binary data and called documentInterface to reconstruct a graphic...
Definition STOFFDocument.cxx:242
STOFFDocument::Result
Result
an enum which defines the result of the file parsing
Definition STOFFDocument.hxx:79
STOFFDocument::STOFF_R_FILE_ACCESS_ERROR
@ STOFF_R_FILE_ACCESS_ERROR
problem when accessing file
Definition STOFFDocument.hxx:81
STOFFDocument::STOFF_R_OLE_ERROR
@ STOFF_R_OLE_ERROR
problem when reading the OLE structure
Definition STOFFDocument.hxx:82
STOFFDocument::STOFF_R_OK
@ STOFF_R_OK
conversion ok
Definition STOFFDocument.hxx:80
STOFFDocument::STOFF_R_PARSE_ERROR
@ STOFF_R_PARSE_ERROR
problem when parsing the file
Definition STOFFDocument.hxx:83
STOFFDocument::STOFF_R_PASSWORD_MISSMATCH_ERROR
@ STOFF_R_PASSWORD_MISSMATCH_ERROR
problem when using the given password
Definition STOFFDocument.hxx:84
STOFFDocument::STOFF_R_UNKNOWN_ERROR
@ STOFF_R_UNKNOWN_ERROR
unknown error
Definition STOFFDocument.hxx:85
STOFFDocument::Confidence
Confidence
an enum which defines if we have confidence that a file is supported
Definition STOFFDocument.hxx:59
STOFFDocument::STOFF_C_NONE
@ STOFF_C_NONE
not supported
Definition STOFFDocument.hxx:60
STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION
@ STOFF_C_SUPPORTED_ENCRYPTION
encryption supported
Definition STOFFDocument.hxx:62
STOFFDocument::STOFF_C_UNSUPPORTED_ENCRYPTION
@ STOFF_C_UNSUPPORTED_ENCRYPTION
encryption not supported
Definition STOFFDocument.hxx:61
STOFFDocument::STOFF_C_EXCELLENT
@ STOFF_C_EXCELLENT
supported
Definition STOFFDocument.hxx:63
librevenge
Definition STOFFDocument.hxx:43