1 /* AbiSource 2 * 3 * Copyright (C) 2005 INdT 4 * Author: Daniel d'Andrada T. de Carvalho <daniel.carvalho@indt.org.br> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 * 02110-1301 USA. 20 */ 21 22 #ifndef _ODE_STYLES_H_ 23 #define _ODE_STYLES_H_ 24 25 // AbiWord includes 26 #include <ut_hash.h> 27 28 // Internal includes 29 #include "ODe_DefaultStyles.h" 30 31 // External includes 32 #include <gsf/gsf-output.h> 33 34 // Internal classes 35 class ODe_Style_Style; 36 class ODe_Style_MasterPage; 37 class ODe_Style_PageLayout; 38 39 // AbiWord classes 40 class PD_Document; 41 class PP_AttrProp; 42 class PD_Style; 43 44 /** 45 * This class stores all normal and automatic styles. 46 */ 47 class ODe_Styles { 48 public: 49 50 ODe_Styles(PD_Document* pAbiDoc); 51 52 ~ODe_Styles(); 53 54 // Fetch all regular <style:style> elements (the ones that will be defined 55 // inside <office:styles>). 56 bool fetchRegularStyleStyles(); 57 58 // Writes the <office:styles> element. 59 bool write(GsfOutput* pODT) const; 60 getDefaultStyles()61 ODe_DefaultStyles& getDefaultStyles() { 62 return m_defaultStyles; 63 } 64 getParagraphStylesEnumeration()65 UT_GenericVector<ODe_Style_Style*>* getParagraphStylesEnumeration() { 66 return m_paragraphStyles.enumerate(); 67 } 68 getTextStylesEnumeration()69 UT_GenericVector<ODe_Style_Style*>* getTextStylesEnumeration() { 70 return m_textStyles.enumerate(); 71 } 72 getGraphicStylesEnumeration()73 UT_GenericVector<ODe_Style_Style*>* getGraphicStylesEnumeration() { 74 return m_graphicStyles.enumerate(); 75 } 76 getGraphicsStyle(const gchar * name)77 ODe_Style_Style* getGraphicsStyle(const gchar* name) { 78 return m_graphicStyles.pick(name); 79 } 80 81 void addGraphicsStyle(ODe_Style_Style* pStyle); 82 83 void addStyle(const UT_UTF8String& sStyle); 84 85 private: 86 bool _addStyle(const PP_AttrProp* pAP); 87 bool _writeStyles(GsfOutput* pODT, UT_GenericVector<ODe_Style_Style*>* pStyleVector) const; 88 89 PD_Document* m_pAbiDoc; 90 ODe_DefaultStyles m_defaultStyles; 91 UT_GenericStringMap<ODe_Style_Style*> m_textStyles; 92 UT_GenericStringMap<ODe_Style_Style*> m_paragraphStyles; 93 UT_GenericStringMap<ODe_Style_Style*> m_graphicStyles; 94 }; 95 96 #endif //_ODE_STYLES_H_ 97