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 00023 #ifndef _ODE_AUTOMATICSTYLES_H_ 00024 #define _ODE_AUTOMATICSTYLES_H_ 00025 00026 // AbiWord includes 00027 #include <ut_hash.h> 00028 00029 // External includes 00030 #include <gsf/gsf-output.h> 00031 00032 // Internal classes 00033 class ODe_Style_Style; 00034 class ODe_Style_PageLayout; 00035 class ODe_Style_List; 00036 00040 class ODe_AutomaticStyles { 00041 00042 public: 00043 00044 ~ODe_AutomaticStyles(); 00045 00046 void storeTextStyle(ODe_Style_Style*& rpTextStyle); 00047 void storeParagraphStyle(ODe_Style_Style*& rpParagraphStyle); 00048 void storeSectionStyle(ODe_Style_Style*& rpSectionStyle); 00049 void storeGraphicStyle(ODe_Style_Style*& rpGraphicStyle); 00050 00051 ODe_Style_Style* addTableStyle(const UT_UTF8String& rStyleName); 00052 ODe_Style_Style* addTableColumnStyle(const UT_UTF8String& rStyleName); 00053 ODe_Style_Style* addTableRowStyle(const UT_UTF8String& rStyleName); 00054 ODe_Style_Style* addTableCellStyle(const UT_UTF8String& rStyleName); 00055 ODe_Style_PageLayout* addPageLayout(); 00056 ODe_Style_List* addListStyle(); 00057 00058 void addPageLayout(ODe_Style_PageLayout*& pPageLayout); 00059 00060 ODe_Style_PageLayout* getPageLayout(const gchar* pName) { 00061 return m_pageLayouts.pick(pName); 00062 }; 00063 00064 ODe_Style_PageLayout* getMasterPage(const gchar* pName) { 00065 return m_pageLayouts.pick(pName); 00066 }; 00067 00068 UT_uint32 getSectionStylesCount() const { 00069 return m_sectionStyles.size(); 00070 } 00071 00072 UT_GenericVector<ODe_Style_Style*>* getParagraphStyles() { 00073 return m_paragraphStyles.enumerate(); 00074 } 00075 00076 UT_GenericVector<ODe_Style_Style*>* getTextStyles() { 00077 return m_textStyles.enumerate(); 00078 } 00079 00080 UT_GenericVector<ODe_Style_List*>* getListStyles() { 00081 return m_listStyles.enumerate(); 00082 } 00083 00084 // Writes <office:automatic-styles> element. 00085 void write(GsfOutput* pContentStream) const; 00086 00087 private: 00088 void _storeStyle(ODe_Style_Style*& rpStyle, 00089 UT_GenericStringMap<ODe_Style_Style*>& rStyles, 00090 const char* pNamingPrefix); 00091 00092 UT_GenericStringMap<ODe_Style_Style*> m_textStyles; 00093 UT_GenericStringMap<ODe_Style_Style*> m_paragraphStyles; 00094 UT_GenericStringMap<ODe_Style_Style*> m_sectionStyles; 00095 UT_GenericStringMap<ODe_Style_Style*> m_tableStyles; 00096 UT_GenericStringMap<ODe_Style_Style*> m_tableColumnStyles; 00097 UT_GenericStringMap<ODe_Style_Style*> m_tableRowStyles; 00098 UT_GenericStringMap<ODe_Style_Style*> m_tableCellStyles; 00099 UT_GenericStringMap<ODe_Style_Style*> m_graphicStyles; 00100 UT_GenericStringMap<ODe_Style_PageLayout*> m_pageLayouts; 00101 UT_GenericStringMap<ODe_Style_List*> m_listStyles; 00102 }; 00103 00104 #endif //_ODE_AUTOMATICSTYLES_H_