00001 /* AbiSource 00002 * 00003 * Copyright (C) 2005 INdT 00004 * Author: Daniel d'Andrada T. de Carvalho <daniel.carvalho@indt.org.br> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef _ODE_STYLES_H_ 00023 #define _ODE_STYLES_H_ 00024 00025 // AbiWord includes 00026 #include <ut_hash.h> 00027 00028 // Internal includes 00029 #include "ODe_DefaultStyles.h" 00030 00031 // External includes 00032 #include <gsf/gsf-output.h> 00033 00034 // Internal classes 00035 class ODe_Style_Style; 00036 class ODe_Style_MasterPage; 00037 class ODe_Style_PageLayout; 00038 00039 // AbiWord classes 00040 class PD_Document; 00041 class PP_AttrProp; 00042 class PD_Style; 00043 00047 class ODe_Styles { 00048 public: 00049 00050 ODe_Styles(PD_Document* pAbiDoc); 00051 00052 ~ODe_Styles(); 00053 00054 // Fetch all regular <style:style> elements (the ones that will be defined 00055 // inside <office:styles>). 00056 bool fetchRegularStyleStyles(); 00057 00058 // Writes the <office:styles> element. 00059 bool write(GsfOutput* pODT) const; 00060 00061 ODe_DefaultStyles& getDefaultStyles() { 00062 return m_defaultStyles; 00063 } 00064 00065 UT_GenericVector<ODe_Style_Style*>* getParagraphStylesEnumeration() { 00066 return m_paragraphStyles.enumerate(); 00067 } 00068 00069 UT_GenericVector<ODe_Style_Style*>* getTextStylesEnumeration() { 00070 return m_textStyles.enumerate(); 00071 } 00072 00073 UT_GenericVector<ODe_Style_Style*>* getGraphicStylesEnumeration() { 00074 return m_graphicStyles.enumerate(); 00075 } 00076 00077 ODe_Style_Style* getGraphicsStyle(const gchar* name) { 00078 return m_graphicStyles.pick(name); 00079 } 00080 00081 void addGraphicsStyle(ODe_Style_Style* pStyle); 00082 00083 void addStyle(const UT_UTF8String& sStyle); 00084 00085 private: 00086 bool _addStyle(const PP_AttrProp* pAP); 00087 bool _writeStyles(GsfOutput* pODT, UT_GenericVector<ODe_Style_Style*>* pStyleVector) const; 00088 00089 PD_Document* m_pAbiDoc; 00090 ODe_DefaultStyles m_defaultStyles; 00091 UT_GenericStringMap<ODe_Style_Style*> m_textStyles; 00092 UT_GenericStringMap<ODe_Style_Style*> m_paragraphStyles; 00093 UT_GenericStringMap<ODe_Style_Style*> m_graphicStyles; 00094 }; 00095 00096 #endif //_ODE_STYLES_H_