StarObject.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  * class to parse/store an object corresponding to an OLE directory
00036  *
00037  */
00038 #ifndef STAR_OBJECT
00039 #  define STAR_OBJECT
00040 
00041 #include <vector>
00042 #include <stack>
00043 #include <libstaroffice/STOFFDocument.hxx>
00044 
00045 #include "STOFFDebug.hxx"
00046 #include "STOFFOLEParser.hxx"
00047 
00048 #include "StarItemPool.hxx"
00049 
00050 namespace StarObjectInternal
00051 {
00052 struct State;
00053 }
00054 
00055 class StarAttributeManager;
00056 class StarFormatManager;
00057 class StarItemSet;
00058 
00064 class StarObject
00065 {
00066 public:
00068   StarObject(char const *passwd, shared_ptr<STOFFOLEParser> oleParser, shared_ptr<STOFFOLEParser::OleDirectory> directory);
00070   virtual ~StarObject();
00071 
00072   //
00073   // basic
00074   //
00075 
00077   bool parse();
00079   STOFFDocument::Kind getDocumentKind() const;
00081   char const *getPassword() const
00082   {
00083     return m_password;
00084   }
00086   shared_ptr<STOFFOLEParser::OleDirectory> getOLEDirectory()
00087   {
00088     return m_directory;
00089   }
00091   shared_ptr<StarAttributeManager> getAttributeManager();
00093   shared_ptr<StarFormatManager> getFormatManager();
00095   librevenge::RVNGPropertyList const &getMetaData() const
00096   {
00097     return m_metaData;
00098   }
00100   librevenge::RVNGString getUserNameMetaData(int i) const;
00101   // the document pool
00103   void cleanPools();
00105   shared_ptr<StarItemPool> getNewItemPool(StarItemPool::Type type);
00109   shared_ptr<StarItemPool> findItemPool(StarItemPool::Type type, bool isInside);
00111   shared_ptr<StarItemPool> getCurrentPool(bool onlyInside=true);
00112 
00114   bool readPersistData(StarZone &zone, long endPos);
00116   bool readSfxStyleSheets(STOFFInputStreamPtr input, std::string const &name);
00118   bool readItemSet(StarZone &zone, std::vector<STOFFVec2i> const &limits, long endPos,
00119                    StarItemSet &itemSet, StarItemPool *pool=0, bool isDirect=false);
00120 protected:
00122   bool readPersistElements(STOFFInputStreamPtr input, std::string const &name);
00124   bool readSfxDocumentInformation(STOFFInputStreamPtr input, std::string const &name);
00126   bool readSfxPreview(STOFFInputStreamPtr input, std::string const &name);
00128   bool readSfxWindows(STOFFInputStreamPtr input, libstoff::DebugFile &ascii);
00130   bool readStarFrameworkConfigFile(STOFFInputStreamPtr input, libstoff::DebugFile &ascii);
00131 
00132   //
00133   // data
00134   //
00135 protected:
00137   StarObject(StarObject const &orig, bool duplicateState);
00139   char const *m_password;
00141   shared_ptr<STOFFOLEParser> m_oleParser;
00143   shared_ptr<STOFFOLEParser::OleDirectory> m_directory;
00144 
00146   shared_ptr<StarObjectInternal::State> m_state;
00148   librevenge::RVNGPropertyList m_metaData;
00149 
00150 private:
00151   StarObject(StarObject const &orig);
00152   StarObject &operator=(StarObject const &orig);
00153 };
00154 
00155 #endif
00156 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: