/* * Copyright (C) 2004-2012 Geometer Plus * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __OLEMAINSTREAM_H__ #define __OLEMAINSTREAM_H__ #include #include #include "OleStream.h" #include "DocFloatImageReader.h" class OleMainStream : public OleStream { public: struct Piece { enum PieceType { PIECE_TEXT, PIECE_FOOTNOTE, PIECE_OTHER }; int Offset; // TODO: maybe make it unsigned int int Length; // TODO: maybe make it unsigned int bool IsANSI; PieceType Type; unsigned int startCP; }; typedef std::vector Pieces; struct CharInfo { enum Font { FONT_REGULAR = 0, FONT_BOLD = 1 << 0, FONT_ITALIC = 1 << 1, FONT_UNDERLINE = 1 << 2, FONT_CAPITALS = 1 << 3, FONT_SMALL_CAPS = 1 << 4, FONT_STRIKE = 1 << 5, FONT_HIDDEN = 1 << 6, FONT_MARKDEL = 1 << 7, FONT_SUPERSCRIPT = 1 << 8, FONT_SUBSCRIPT = 1 << 9 }; unsigned int FontStyle; unsigned int FontSize; CharInfo(); }; typedef std::pair CharPosToCharInfo; typedef std::vector CharInfoList; struct Style { enum AlignmentType { ALIGNMENT_LEFT = 0x00, ALIGNMENT_CENTER = 0x01, ALIGNMENT_RIGHT = 0x02, ALIGNMENT_JUSTIFY = 0x03, ALIGNMENT_DEFAULT // for case if alignment is not setted by word }; // style Ids: // (this is not full list of possible style ids, enum is used for using in switch-case) enum StyleID { STYLE_H1 = 0x1, STYLE_H2 = 0x2, STYLE_H3 = 0x3, STYLE_USER = 0xFFE, STYLE_NIL = 0xFFF, STYLE_INVALID = 0xFFFF }; unsigned int StyleIdCurrent; unsigned int StyleIdNext; // Next style unless overruled bool HasPageBreakBefore; unsigned int BeforeParagraphIndent; // Vertical indent before paragraph, pixels unsigned int AfterParagraphIndent; // Vertical indent after paragraph, pixels int LeftIndent; int FirstLineIndent; int RightIndent; AlignmentType Alignment; CharInfo CurrentCharInfo; Style(); }; typedef std::pair CharPosToStyle; typedef std::vector StyleInfoList; typedef std::vector