StarObjectText.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 /* libstaroffice
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  * Parser to convert a text zone/OLE in a StarOffice document
00036  *
00037  */
00038 #ifndef STAR_OBJECT_TEXT
00039 #  define STAR_OBJECT_TEXT
00040 
00041 #include <vector>
00042 
00043 #include "libstaroffice_internal.hxx"
00044 #include "StarObject.hxx"
00045 
00046 class StarState;
00047 
00048 namespace StarObjectTextInternal
00049 {
00051 struct Zone {
00053   Zone()
00054   {
00055   }
00057   virtual ~Zone();
00059   virtual bool send(STOFFListenerPtr listener, StarState &state) const=0;
00061   virtual void inventoryPage(StarState &/*state*/) const
00062   {
00063   }
00064 };
00065 
00067 struct Content {
00069   Content() : m_sectionName(""), m_zoneList()
00070   {
00071   }
00073   ~Content();
00075   bool send(STOFFListenerPtr listener, StarState &state) const;
00077   void inventoryPages(StarState &state) const;
00079   librevenge::RVNGString m_sectionName;
00081   std::vector<shared_ptr<Zone> > m_zoneList;
00082 };
00083 
00084 struct GraphZone;
00085 struct SectionZone;
00086 struct TextZone;
00087 struct State;
00088 }
00089 
00090 class StarZone;
00091 
00097 class StarObjectText : public StarObject
00098 {
00099 public:
00101   StarObjectText(StarObject const &orig, bool duplicateState);
00103   virtual ~StarObjectText();
00104 
00105   // try to parse all zone
00106   bool parse();
00107 
00109   bool updatePageSpans(std::vector<STOFFPageSpan> &pageSpan, int &numPages);
00111   bool sendPages(STOFFTextListenerPtr listener);
00112 
00114   static bool readSWImageMap(StarZone &zone);
00115 
00117   bool readSWContent(StarZone &zone, shared_ptr<StarObjectTextInternal::Content> &content);
00118 protected:
00119   //
00120   // low level
00121   //
00122 
00124   bool readSfxStyleSheets(STOFFInputStreamPtr input, std::string const &fileName);
00126   bool readWriterDocument(STOFFInputStreamPtr input, std::string const &fileName);
00127 
00129   bool readDrawingLayer(STOFFInputStreamPtr input, std::string const &fileName);
00130 
00131 protected:
00133   bool readSWGraphNode(StarZone &zone, shared_ptr<StarObjectTextInternal::GraphZone> &graphZone);
00135   bool readSWJobSetUp(StarZone &zone);
00137   bool readSWOLENode(StarZone &zone);
00139   bool readSWSection(StarZone &zone, shared_ptr<StarObjectTextInternal::SectionZone> &section);
00141   bool readSWTextZone(StarZone &zone, shared_ptr<StarObjectTextInternal::TextZone> &textZone);
00142   //
00143   // data
00144   //
00145 
00147   shared_ptr<StarObjectTextInternal::State> m_textState;
00148 private:
00149   StarObjectText &operator=(StarObjectText const &orig);
00150 };
00151 #endif
00152 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: