StarFileManager.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libstaroffice
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * StarFileManager to read/parse some basic StarOffice OLEs
36 *
37 */
38 #ifndef STAR_FILE_MANAGER
39 # define STAR_FILE_MANAGER
40
41 #include <vector>
42
43 #include "STOFFDebug.hxx"
44 #include "STOFFEntry.hxx"
45 #include "STOFFInputStream.hxx"
46 #include "STOFFOLEParser.hxx"
47
48 namespace StarFileManagerInternal
49 {
50 struct State;
51 }
52
53 class StarObject;
54 class StarZone;
55
61 class StarFileManager
62 {
63 public:
65 StarFileManager();
67 virtual ~StarFileManager();
68
70
72 static void checkUnparsed(STOFFInputStreamPtr input, std::shared_ptr<STOFFOLEParser> oleParser, char const *password);
73
75 static bool readOLEDirectory(std::shared_ptr<STOFFOLEParser> oleParser, std::shared_ptr<STOFFOLEParser::OleDirectory> ole, STOFFEmbeddedObject &image, std::shared_ptr<StarObject> &object);
76
78 static bool readImageDocument(STOFFInputStreamPtr input, librevenge::RVNGBinaryData &data, std::string const &fileName);
79
81 static bool readEmbeddedPicture(std::shared_ptr<STOFFOLEParser> oleParser, std::string const &fileName, STOFFEmbeddedObject &image);
83 static bool readEmbeddedPicture(STOFFInputStreamPtr input, librevenge::RVNGBinaryData &data, std::string &dataType, std::string const &fileName);
84
85 // other
86
88 static bool readOleObject(STOFFInputStreamPtr input, librevenge::RVNGBinaryData &data, std::string const &fileName);
90 static bool readOutPlaceObject(STOFFInputStreamPtr input, libstoff::DebugFile &ascii);
91
93 static bool readJobSetUp(StarZone &zone, bool usePrinterLen);
95 static bool readFont(StarZone &zone);
97 static bool readSVGDI(StarZone &zone);
98
99 protected:
100
101 //
102 // data
103 //
104 private:
106 std::shared_ptr<StarFileManagerInternal::State> m_state;
107 };
108 #endif
109 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
StarFileManager.hxx
StarFileManager
the main class to read/.
Definition: StarFileManager.hxx:61
StarFileManagerInternal::SfxMultiRecord::SfxMultiRecord
SfxMultiRecord(StarZone &zone)
constructor
Definition: StarFileManager.cxx:70
STOFFDocument::STOFF_K_TEXT
@ STOFF_K_TEXT
word processing file
Definition: STOFFDocument.hxx:75
StarZone::closeVersionCompatHeader
bool closeVersionCompatHeader(std::string const &debugName)
close a zone header
Definition: StarZone.cxx:397
STOFFDocument::STOFF_K_DRAW
@ STOFF_K_DRAW
vectorized graphic: .sda
Definition: STOFFDocument.hxx:71
StarFileManager::readOLEDirectory
static bool readOLEDirectory(std::shared_ptr< STOFFOLEParser > oleParser, std::shared_ptr< STOFFOLEParser::OleDirectory > ole, STOFFEmbeddedObject &image, std::shared_ptr< StarObject > &object)
try to read a Ole directory
Definition: StarFileManager.cxx:301
libstoff::getString
librevenge::RVNGString getString(std::vector< uint32_t > const &unicode)
transform a unicode string in a RNVGString
Definition: libstaroffice_internal.cxx:63
STOFFSpreadsheetEncoder
main class used to define store librevenge::RVNGSpreadsheetInterface lists of command in a librevenge...
Definition: STOFFSpreadsheetEncoder.hxx:55
StarFileManager::m_state
std::shared_ptr< StarFileManagerInternal::State > m_state
the state
Definition: StarFileManager.hxx:106
StarZone::ascii
libstoff::DebugFile & ascii()
returns the ascii file
Definition: StarZone.hxx:254
STOFFEntry.hxx
STOFF_DEBUG_MSG
#define STOFF_DEBUG_MSG(M)
Definition: libstaroffice_internal.hxx:129
StarObjectSpreadsheet::send
bool send(STOFFSpreadsheetListenerPtr listener)
try to send the spreadsheet
Definition: StarObjectSpreadsheet.cxx:608
StarGraphicStruct::StarGraphic
Class to store a graphic.
Definition: StarGraphicStruct.hxx:104
StarObjectSpreadsheet
the main class to read a StarOffice sdc file
Definition: StarObjectSpreadsheet.hxx:63
StarObjectSpreadsheet::parse
bool parse()
try to parse the current object
Definition: StarObjectSpreadsheet.cxx:756
StarObjectMath
the main class to read a small StarOffice math zone .sdf
Definition: StarObjectMath.hxx:58
StarObjectText::parse
bool parse()
Definition: StarObjectText.cxx:819
StarFileManagerInternal::SfxMultiRecord::m_zone
StarZone & m_zone
the main zone
Definition: StarFileManager.cxx:248
StarGraphicStruct.hxx
StarFileManager::readOutPlaceObject
static bool readOutPlaceObject(STOFFInputStreamPtr input, libstoff::DebugFile &ascii)
try to read the "OutPlace Object"
Definition: StarFileManager.cxx:743
StarFileManagerInternal
Internal: the structures of a StarFileManager.
Definition: StarFileManager.cxx:64
StarFileManager::~StarFileManager
virtual ~StarFileManager()
destructor
Definition: StarFileManager.cxx:297
STOFFPageSpan
A class which defines the page properties.
Definition: STOFFPageSpan.hxx:75
STOFFGraphicListener
This class contains the code needed to create Graphic document.
Definition: STOFFGraphicListener.hxx:59
StarFileManagerInternal::SfxMultiRecord::close
void close(std::string const &wh)
try to close a zone
Definition: StarFileManager.cxx:162
StarFileManagerInternal::SfxMultiRecord::m_zoneType
unsigned char m_zoneType
the zone type
Definition: StarFileManager.cxx:250
StarFileManagerInternal::SfxMultiRecord::m_offsetList
std::vector< uint32_t > m_offsetList
the list of (offset + type)
Definition: StarFileManager.cxx:270
StarZone::readString
bool readString(std::vector< uint32_t > &string, int encoding=-1) const
try to read an unicode string
Definition: StarZone.hxx:220
StarFileManagerInternal::SfxMultiRecord::m_headerTag
uint16_t m_headerTag
the header tag
Definition: StarFileManager.cxx:258
StarGraphicStruct::StarGraphic::read
bool read(StarZone &zone, long lastPos=-1)
try to read a graphic, give lastPos if you are sure of the end graphic position
Definition: StarGraphicStruct.cxx:549
StarFileManagerInternal::State
Internal: the state of a StarFileManager.
Definition: StarFileManager.cxx:280
StarFileManagerInternal::SfxMultiRecord::operator<<
friend std::ostream & operator<<(std::ostream &o, SfxMultiRecord const &r)
basic operator<< ; print header data
Definition: StarFileManager.cxx:222
STOFFColor
the class to store a color
Definition: libstaroffice_internal.hxx:189
STOFFSpreadsheetListenerPtr
std::shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition: libstaroffice_internal.hxx:497
STOFFGraphicEncoder
main class used to define store librevenge::RVNGDrawingInterface lists of command in a librevenge::RV...
Definition: STOFFGraphicEncoder.hxx:55
StarFileManager::readOleObject
static bool readOleObject(STOFFInputStreamPtr input, librevenge::RVNGBinaryData &data, std::string const &fileName)
try to read a "Ole-Object" zone
Definition: StarFileManager.cxx:724
StarFileManagerInternal::SfxMultiRecord::m_zoneOpened
bool m_zoneOpened
true if a SfxRecord has been opened
Definition: StarFileManager.cxx:252
StarBitmap::readBitmap
bool readBitmap(StarZone &zone, bool inFileHeader, long lastPos, librevenge::RVNGBinaryData &data, std::string &type)
low level
Definition: StarBitmap.cxx:214
StarObjectSpreadsheet::updatePageSpans
bool updatePageSpans(std::vector< STOFFPageSpan > &pageSpan, int &numPages)
try to update the page span
Definition: StarObjectSpreadsheet.cxx:569
StarBitmap
the main class to read/.
Definition: StarBitmap.hxx:62
StarGraphicStruct::StarGraphic::m_object
STOFFEmbeddedObject m_object
the embedded object
Definition: StarGraphicStruct.hxx:116
StarObjectText
the main class to read a StarOffice sdw file
Definition: StarObjectText.hxx:100
STOFFOLEParser.hxx
STOFFDocument::STOFF_K_CHART
@ STOFF_K_CHART
chart
Definition: STOFFDocument.hxx:69
STOFFEmbeddedObject
small class use to define a embedded object
Definition: libstaroffice_internal.hxx:408
STOFFEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libstaroffice_internal.hxx:458
libstoff::Debug::dumpFile
bool dumpFile(librevenge::RVNGBinaryData &, char const *)
Definition: STOFFDebug.hxx:183
libstoff::DebugFile::reset
static void reset()
Definition: STOFFDebug.hxx:228
STOFFOLEParser::OleDirectory
Internal: internal method to keep ole directory and their content.
Definition: STOFFOLEParser.hxx:185
StarFileManagerInternal::SfxMultiRecord::m_actualRecord
uint16_t m_actualRecord
the actual record
Definition: StarFileManager.cxx:260
libstoff::DebugStream::str
static std::string str()
Definition: STOFFDebug.hxx:203
StarFileManagerInternal::SfxMultiRecord::m_extra
std::string m_extra
extra data
Definition: StarFileManager.cxx:272
STOFFPageSpan.hxx
StarObjectChart::parse
bool parse()
try to parse the current object
Definition: StarObjectChart.cxx:158
StarFileManager::readEmbeddedPicture
static bool readEmbeddedPicture(std::shared_ptr< STOFFOLEParser > oleParser, std::string const &fileName, STOFFEmbeddedObject &image)
try to read a embedded picture file: Embedded/PicXXXXXX
Definition: StarFileManager.cxx:547
STOFFGraphicEncoder::getBinaryResult
bool getBinaryResult(STOFFEmbeddedObject &result)
return the final graphic
Definition: STOFFGraphicEncoder.cxx:76
StarObjectDraw.hxx
StarFileManagerInternal::SfxMultiRecord::m_headerType
uint8_t m_headerType
the record type
Definition: StarFileManager.cxx:254
StarObjectDraw
the main class to read a StarOffice draw
Definition: StarObjectDraw.hxx:61
STOFFInputStreamPtr
std::shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition: libstaroffice_internal.hxx:489
STOFFEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libstaroffice_internal.hxx:456
StarFileManagerInternal::SfxMultiRecord::getLastContentPosition
long getLastContentPosition() const
returns the last content position
Definition: StarFileManager.cxx:210
StarFileManagerInternal::SfxMultiRecord::m_contentSize
uint32_t m_contentSize
the record/content/pos size
Definition: StarFileManager.cxx:264
StarFileManagerInternal::SfxMultiRecord::m_startPos
long m_startPos
the start of data position
Definition: StarFileManager.cxx:266
StarZone
a zone in a StarOffice file
Definition: StarZone.hxx:56
StarZone::getRecordLevel
int getRecordLevel() const
returns the record level
Definition: StarZone.hxx:195
StarObject
an object corresponding to an OLE directory
Definition: StarObject.hxx:64
StarObjectDraw::parse
bool parse()
try to parse the current object
Definition: StarObjectDraw.cxx:125
StarObjectDraw::sendPages
bool sendPages(STOFFGraphicListenerPtr listener)
try to send the different page
Definition: StarObjectDraw.cxx:115
StarFileManagerInternal::SfxMultiRecord
Internal: a structure use to read SfxMultiRecord zone of a StarFileManager.
Definition: StarFileManager.cxx:68
STOFFSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: STOFFSpreadsheetListener.hxx:64
STOFFPageSpan::m_pageSpan
int m_pageSpan
the number of page
Definition: STOFFPageSpan.hxx:108
StarObjectSpreadsheet.hxx
STOFFOLEParser::OleDirectory::getUnparsedOles
std::vector< std::string > getUnparsedOles() const
returns the list of unknown ole
Definition: STOFFOLEParser.hxx:206
libstoff::DebugStream
Definition: STOFFDebug.hxx:194
STOFFGraphicEncoder.hxx
StarObjectMath::parse
bool parse()
try to parse the current object
Definition: StarObjectMath.cxx:99
STOFFGraphicListenerPtr
std::shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition: libstaroffice_internal.hxx:485
StarFileManagerInternal::SfxMultiRecord::getNewContent
bool getNewContent(std::string const &wh)
try to go to the new content positon
Definition: StarFileManager.cxx:184
STOFFGraphicListener.hxx
StarObjectMath.hxx
StarFileManager::checkUnparsed
static void checkUnparsed(STOFFInputStreamPtr input, std::shared_ptr< STOFFOLEParser > oleParser, char const *password)
low level
Definition: StarFileManager.cxx:435
StarObjectDraw::updatePageSpans
bool updatePageSpans(std::vector< STOFFPageSpan > &pageSpan, int &numPages) const
try to update the page span (to create draw document)
Definition: StarObjectDraw.cxx:97
StarObjectText.hxx
STOFFDebug.hxx
StarBitmap.hxx
StarFileManagerInternal::SfxMultiRecord::operator=
SfxMultiRecord & operator=(SfxMultiRecord const &orig)
StarFileManager::readJobSetUp
static bool readJobSetUp(StarZone &zone, bool usePrinterLen)
try to read a printer zone
Definition: StarFileManager.cxx:847
libstoff::DebugFile::addPos
static void addPos(long)
Definition: STOFFDebug.hxx:223
libstoff::DebugFile::addDelimiter
static void addDelimiter(long, char)
Definition: STOFFDebug.hxx:225
StarObject.hxx
StarZone.hxx
StarFileManagerInternal::SfxMultiRecord::m_headerVersion
uint8_t m_headerVersion
the header version
Definition: StarFileManager.cxx:256
StarZone::closeSfxRecord
bool closeSfxRecord(unsigned char type, std::string const &debugName)
try to close a record
Definition: StarZone.hxx:189
STOFFListManagerPtr
std::shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition: libstaroffice_internal.hxx:493
StarZone::openVersionCompatHeader
bool openVersionCompatHeader()
open a version compat header (version+size)
Definition: StarZone.cxx:372
libstoff::DebugFile
Definition: STOFFDebug.hxx:210
STOFFDocument::STOFF_K_MATH
@ STOFF_K_MATH
math
Definition: STOFFDocument.hxx:72
StarFileManager::readImageDocument
static bool readImageDocument(STOFFInputStreamPtr input, librevenge::RVNGBinaryData &data, std::string const &fileName)
try to read a image zone: "StarImageDocument" or "StarImageDocument 4.0
Definition: StarFileManager.cxx:528
StarFileManagerInternal::State::State
State()
constructor
Definition: StarFileManager.cxx:282
StarObjectChart
the main class to read a StarOffice chart
Definition: StarObjectChart.hxx:60
StarFileManager::readFont
static bool readFont(StarZone &zone)
try to read a font
Definition: StarFileManager.cxx:775
StarFileManagerInternal::SfxMultiRecord::m_endPos
long m_endPos
the end of data position
Definition: StarFileManager.cxx:268
STOFFSpreadsheetEncoder::getBinaryResult
bool getBinaryResult(STOFFEmbeddedObject &object)
return the final spreadsheet
Definition: STOFFSpreadsheetEncoder.cxx:77
libstoff::DebugFile::addNote
static void addNote(char const *)
Definition: STOFFDebug.hxx:224
StarFileManagerInternal::SfxMultiRecord::open
bool open()
try to open a zone
Definition: StarFileManager.cxx:87
libstoff::DebugFile::skipZone
static void skipZone(long, long)
Definition: STOFFDebug.hxx:230
StarFileManagerInternal::SfxMultiRecord::getHeaderTag
int getHeaderTag() const
returns the header tag or -1
Definition: StarFileManager.cxx:179
StarZone::input
STOFFInputStreamPtr input()
return the zone input
Definition: StarZone.hxx:247
STOFFColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libstaroffice_internal.hxx:277
libstoff::DebugFile::open
static bool open(std::string const &)
Definition: STOFFDebug.hxx:218
StarFileManager::StarFileManager
StarFileManager()
constructor
Definition: StarFileManager.cxx:292
STOFFInputStream.hxx
StarItemPool.hxx
StarAttribute.hxx
StarZone::getRecordLastPosition
long getRecordLastPosition() const
returns the actual record last position
Definition: StarZone.hxx:200
StarFileManagerInternal::SfxMultiRecord::m_numRecord
uint16_t m_numRecord
the number of record
Definition: StarFileManager.cxx:262
StarZone::openSfxRecord
bool openSfxRecord(unsigned char &type)
try to open a Sfx record: type + size (24 bytes)
Definition: StarZone.cxx:550
STOFFSpreadsheetListener.hxx
StarFileManager::readSVGDI
static bool readSVGDI(StarZone &zone)
try to read a SVGDI object
Definition: StarFileManager.cxx:958
STOFFSpreadsheetEncoder.hxx
STOFFEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libstaroffice_internal.hxx:426
StarZone::getHeaderVersion
int getHeaderVersion() const
returns the StarOffice header version (if set)
Definition: StarZone.hxx:94
STOFFEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition: libstaroffice_internal.hxx:437
StarObjectChart.hxx
STOFFDocument::STOFF_K_SPREADSHEET
@ STOFF_K_SPREADSHEET
spreadsheet: .sdc
Definition: STOFFDocument.hxx:74