FullWrtStruct.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 FULL_WRT_STRUCT
00039 #  define FULL_WRT_STRUCT
00040 
00041 #include <librevenge/librevenge.h>
00042 
00043 #include "libmwaw_internal.hxx"
00044 
00045 #include "MWAWDebug.hxx"
00046 #include "MWAWEntry.hxx"
00047 
00049 namespace FullWrtStruct
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   {
00065     m_frameBorder.m_style=MWAWBorder::None;
00066     for (int w=0; w < 3; w++) m_type[w]=0;
00067   }
00069   static MWAWBorder getBorder(int type);
00071   void addTo(MWAWGraphicStyle &style) const;
00073   bool hasShadow() const
00074   {
00075     return m_shadowDepl[0]||m_shadowDepl[1];
00076   }
00078   bool read(shared_ptr<FullWrtStruct::Entry> zone, int fSz);
00080   std::vector<MWAWVariable<MWAWBorder> > getParagraphBorders() const;
00082   friend std::ostream &operator<<(std::ostream &o, Border const &p);
00083 
00085   int m_type[3];
00087   MWAWBorder m_frameBorder;
00089   MWAWColor m_frontColor;
00091   MWAWColor m_backColor;
00093   MWAWColor m_shadowColor;
00095   MWAWVec2i m_shadowDepl;
00097   MWAWColor m_color[2];
00099   int m_flags;
00101   std::string m_extra;
00102 };
00103 
00105 struct Entry : public MWAWEntry {
00106   Entry(MWAWInputStreamPtr input);
00107   ~Entry();
00108 
00110   friend std::ostream &operator<<(std::ostream &o, Entry const &entry);
00111 
00113   bool valid() const;
00115   void update();
00117   void closeDebugFile();
00118 
00120   libmwaw::DebugFile &getAsciiFile();
00122   bool operator==(const Entry &a) const;
00124   bool operator!=(const Entry &a) const
00125   {
00126     return !operator==(a);
00127   }
00128 
00130   MWAWInputStreamPtr m_input;
00132   int m_nextId;
00134   int m_type;
00136   int m_typeId;
00138   int m_values[3];
00140   librevenge::RVNGBinaryData m_data;
00142   shared_ptr<libmwaw::DebugFile> m_asciiFile;
00143 private:
00144   Entry(Entry const &);
00145   Entry &operator=(Entry const &);
00146 };
00147 typedef shared_ptr<Entry> EntryPtr;
00148 
00150 struct ZoneHeader {
00152   ZoneHeader() : m_type(-1), m_docId(-1), m_fileId(-1), m_wrapping(-1), m_extra("") {}
00154   virtual ~ZoneHeader() { }
00156   bool read(shared_ptr<FullWrtStruct::Entry> zone);
00158   friend std::ostream &operator<<(std::ostream &o, ZoneHeader const &dt);
00160   int m_type;
00162   int m_docId;
00164   int m_fileId;
00166   int m_wrapping;
00168   std::string m_extra;
00169 };
00170 }
00171 
00172 #endif
00173 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: