FWStruct.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 /* libmwaw
00004 * Version: MPL 2.0 / LGPLv2+
00005 *
00006 * The contents of this file are subject to the Mozilla Public License Version
00007 * 2.0 (the "License"); you may not use this file except in compliance with
00008 * the License or as specified alternatively below. You may obtain a copy of
00009 * the License at http://www.mozilla.org/MPL/
00010 *
00011 * Software distributed under the License is distributed on an "AS IS" basis,
00012 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013 * for the specific language governing rights and limitations under the
00014 * License.
00015 *
00016 * Major Contributor(s):
00017 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
00018 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
00019 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00020 * Copyright (C) 2006, 2007 Andrew Ziem
00021 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
00022 *
00023 *
00024 * All Rights Reserved.
00025 *
00026 * For minor contributions see the git repository.
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
00030 * in which case the provisions of the LGPLv2+ are applicable
00031 * instead of those above.
00032 */
00033 
00034 /*
00035  * basic structure used to code zone when converting FullWrite document
00036  *
00037  */
00038 #ifndef FP_MWAW_STRUCT
00039 #  define FP_MWAW_STRUCT
00040 
00041 #include <libwpd/libwpd.h>
00042 
00043 #include "libmwaw_internal.hxx"
00044 
00045 #include "MWAWDebug.hxx"
00046 #include "MWAWEntry.hxx"
00047 
00049 namespace FWStruct
00050 {
00051 
00052 // basic
00053 struct Entry;
00055 bool getColor(int color, MWAWColor &col);
00057 std::string getTypeName(int type);
00058 
00060 struct Border {
00062   Border() :m_frameBorder(), m_frontColor(MWAWColor::black()), m_backColor(MWAWColor::white()),
00063     m_shadowColor(MWAWColor::black()), m_shadowDepl(0,0), m_flags(0), m_extra("") {
00064     m_frameBorder.m_style=MWAWBorder::None;
00065     for (int w=0; w < 3; w++) m_type[w]=0;
00066   }
00068   static MWAWBorder getBorder(int type);
00070   void addToFrame(WPXPropertyList &pList) const;
00072   bool hasShadow() const {
00073     return m_shadowDepl[0]||m_shadowDepl[1];
00074   }
00076   bool read(shared_ptr<FWStruct::Entry> zone, int fSz);
00078   std::vector<Variable<MWAWBorder> > getParagraphBorders() const;
00080   friend std::ostream &operator<<(std::ostream &o, Border const &p);
00081 
00083   int m_type[3];
00085   MWAWBorder m_frameBorder;
00087   MWAWColor m_frontColor;
00089   MWAWColor m_backColor;
00091   MWAWColor m_shadowColor;
00093   Vec2i m_shadowDepl;
00095   MWAWColor m_color[2];
00097   int m_flags;
00099   std::string m_extra;
00100 };
00101 
00103 struct Entry : public MWAWEntry {
00104   Entry(MWAWInputStreamPtr input);
00105   ~Entry();
00106 
00108   friend std::ostream &operator<<(std::ostream &o, Entry const &entry);
00109 
00111   bool valid() const;
00113   void update();
00115   void closeDebugFile();
00116 
00118   libmwaw::DebugFile &getAsciiFile();
00120   bool operator==(const Entry &a) const;
00122   bool operator!=(const Entry &a) const {
00123     return !operator==(a);
00124   }
00125 
00127   MWAWInputStreamPtr m_input;
00129   int m_nextId;
00131   int m_type;
00133   int m_typeId;
00135   int m_values[3];
00137   WPXBinaryData m_data;
00139   shared_ptr<libmwaw::DebugFile> m_asciiFile;
00140 private:
00141   Entry(Entry const &);
00142   Entry &operator=(Entry const &);
00143 };
00144 typedef shared_ptr<Entry> EntryPtr;
00145 
00147 struct ZoneHeader {
00149   ZoneHeader() : m_type(-1), m_docId(-1), m_fileId(-1), m_wrapping(-1), m_extra("") {}
00151   virtual ~ZoneHeader() { }
00153   bool read(shared_ptr<FWStruct::Entry> zone);
00155   friend std::ostream &operator<<(std::ostream &o, ZoneHeader const &dt);
00157   int m_type;
00159   int m_docId;
00161   int m_fileId;
00163   int m_wrapping;
00165   std::string m_extra;
00166 };
00167 }
00168 
00169 #endif
00170 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: