CWStruct.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 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* 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 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* Structures used by Claris Works parser
*
*/
#ifndef CW_MWAW_STRUCT
# define CW_MWAW_STRUCT
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include "libmwaw_internal.hxx"
class CWParser;
namespace CWStruct
{
struct DSET {
struct Child;
enum Type { T_Main=0, T_Header, T_Footer, T_Frame, T_Footnote, T_Table, T_Slide, T_Unknown};
DSET() : m_size(0), m_numData(0), m_dataSz(-1), m_headerSz(-1),
m_type(T_Unknown), m_fileType(-1), m_id(0), m_fathersList(), m_validedChildList(),
m_beginSelection(0), m_endSelection(-1), m_textType(0),
m_childs(), m_otherChilds(), m_parsed(false), m_internal(0) {
for (int i = 0; i < 4; i++) m_flags[i] = 0;
}
virtual ~DSET() {}
bool okChildId(int zoneId) const {
return m_validedChildList.find(zoneId) != m_validedChildList.end();
}
friend std::ostream &operator<<(std::ostream &o, DSET const &doc);
long m_size;
long m_numData;
long m_dataSz;
long m_headerSz;
Type m_type;
int m_fileType;
int m_id;
std::set<int> m_fathersList;
std::set<int> m_validedChildList;
int m_beginSelection;
int m_endSelection;
int m_textType;
int m_flags[4];
std::vector<Child> m_childs;
std::vector<int> m_otherChilds;
mutable bool m_parsed;
mutable int m_internal;
struct Child {
enum Type { ZONE, TEXT, GRAPHIC, TABLE, UNKNOWN };
Child() : m_type(UNKNOWN), m_id(-1), m_posC(-1), m_box() {
}
friend std::ostream &operator<<(std::ostream &o, Child const &ch) {
switch(ch.m_type) {
case TEXT:
o << "text,";
break;
case ZONE:
o << "zone,";
break;
case GRAPHIC:
o << "graphic,";
break;
case TABLE:
o << "table,";
break;
case UNKNOWN:
o << "#type,";
default:
break;
}
if (ch.m_id != -1) o << "id=" << ch.m_id << ",";
if (ch.m_posC != -1) o << "posC=" << ch.m_posC << ",";
if (ch.m_box.size().x() > 0 || ch.m_box.size().y() > 0)
o << "box=" << ch.m_box << ",";
return o;
}
int m_type;
int m_id;
long m_posC;
Box2i m_box;
};
};
}
#endif
CWStruct::DSET::m_endSelection
int m_endSelection
the end of selection ( at least in text header)
Definition: CWStruct.hxx:111
CWStruct::DSET::Child::ZONE
Definition: CWStruct.hxx:134
CWStruct::DSET
main structure which correspond to a document part
Definition: CWStruct.hxx:55
CWStruct::DSET::m_childs
std::vector< Child > m_childs
the list of child zone
Definition: CWStruct.hxx:120
CWStruct::DSET::Child::m_posC
long m_posC
a position (used in text zone to store the character )
Definition: CWStruct.hxx:172
CWStruct::DSET::T_Unknown
Definition: CWStruct.hxx:59
CWStruct::DSET::m_type
Type m_type
the document type
Definition: CWStruct.hxx:93
libmwaw_internal.hxx
CWStruct::DSET::Child::operator<<
friend std::ostream & operator<<(std::ostream &o, Child const &ch)
operator<<
Definition: CWStruct.hxx:141
CWStruct::DSET::Child
structure used to define the child of a DSET structure
Definition: CWStruct.hxx:132
Box2< int >
CWStruct::DSET::Child::m_id
int m_id
the identificator
Definition: CWStruct.hxx:170
CWStruct::DSET::Child::m_type
int m_type
the type
Definition: CWStruct.hxx:168
CWStruct::DSET::T_Main
Definition: CWStruct.hxx:59
CWStruct::DSET::m_validedChildList
std::set< int > m_validedChildList
the list of verified child
Definition: CWStruct.hxx:105
CWStruct::DSET::m_id
int m_id
the identificator
Definition: CWStruct.hxx:99
CWStruct::DSET::Child::TEXT
Definition: CWStruct.hxx:134
CWStruct::DSET::Child::GRAPHIC
Definition: CWStruct.hxx:134
CWStruct::DSET::T_Footer
Definition: CWStruct.hxx:59
CWStruct::DSET::okChildId
bool okChildId(int zoneId) const
test is a child id is valid
Definition: CWStruct.hxx:73
CWStruct::DSET::m_textType
int m_textType
the text type (header/footer,footnote, ...)
Definition: CWStruct.hxx:114
CWStruct::DSET::operator<<
friend std::ostream & operator<<(std::ostream &o, DSET const &doc)
operator<<
Definition: CWStruct.cxx:52
CWStruct::DSET::Child::m_box
Box2i m_box
the bdbox
Definition: CWStruct.hxx:174
CWStruct::DSET::T_Slide
Definition: CWStruct.hxx:59
CWStruct::DSET::Type
Type
the document type
Definition: CWStruct.hxx:59
CWStruct::DSET::Child::Type
Type
the different types
Definition: CWStruct.hxx:134
Vec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:434
CWStruct::DSET::m_dataSz
long m_dataSz
the data size
Definition: CWStruct.hxx:87
CWStruct::DSET::DSET
DSET()
constructor
Definition: CWStruct.hxx:62
CWStruct::DSET::m_fathersList
std::set< int > m_fathersList
the list of fathers
Definition: CWStruct.hxx:102
CWStruct::DSET::m_otherChilds
std::vector< int > m_otherChilds
the list of other child
Definition: CWStruct.hxx:123
CWStruct::DSET::m_size
long m_size
the size of the DSET header
Definition: CWStruct.hxx:81
CWStruct::DSET::m_headerSz
long m_headerSz
the header size
Definition: CWStruct.hxx:90
Vec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:430
CWStruct::DSET::Child::UNKNOWN
Definition: CWStruct.hxx:134
CWStruct::DSET::T_Header
Definition: CWStruct.hxx:59
CWParser
the main class to read a Claris Works file
Definition: CWParser.hxx:73
CWStruct::DSET::m_numData
long m_numData
the number of header
Definition: CWStruct.hxx:84
CWStruct::DSET::~DSET
virtual ~DSET()
virtual destructor
Definition: CWStruct.hxx:70
CWStruct::DSET::m_fileType
int m_fileType
the type ( 0: text, -1: graphic, ...)
Definition: CWStruct.hxx:96
CWStruct::DSET::m_flags
int m_flags[4]
some unknown flag
Definition: CWStruct.hxx:117
CWStruct::DSET::T_Table
Definition: CWStruct.hxx:59
CWStruct::DSET::Child::Child
Child()
constructor
Definition: CWStruct.hxx:137
CWStruct::DSET::m_parsed
bool m_parsed
a flag to know if the entry is sent or not to the listener
Definition: CWStruct.hxx:126
CWStruct::DSET::m_beginSelection
int m_beginSelection
the begin of selection ( at least in text header)
Definition: CWStruct.hxx:108
CWStruct::DSET::m_internal
int m_internal
an internal variable used to do some computation
Definition: CWStruct.hxx:129
Box2::size
Vec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:778
CWStruct::DSET::T_Footnote
Definition: CWStruct.hxx:59
CWStruct::DSET::T_Frame
Definition: CWStruct.hxx:59
CWStruct::DSET::Child::TABLE
Definition: CWStruct.hxx:134