• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ODi_Office_Styles.h

Go to the documentation of this file.
00001 /* AbiSource
00002  *
00003  * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho
00004  * <daniel.carvalho@indt.org.br>
00005  * Copyright (C) 2009 Hubert Figuiere
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef _ODI_OFFICE_STYLES_H_
00024 #define _ODI_OFFICE_STYLES_H_
00025 
00026 #include <string>
00027 #include <map>
00028 
00029 // Internal includes
00030 #include "ODi_Style_Style_Family.h"
00031 
00032 // Internal classes
00033 class ODi_FontFaceDecls;
00034 class ODi_Style_Style;
00035 class ODi_Style_PageLayout;
00036 class ODi_Style_MasterPage;
00037 class ODi_Style_List;
00038 class ODi_NotesConfiguration;
00039 class ODi_ElementStack;
00040 class ODi_Abi_Data;
00041 
00042 // AbiWord classes
00043 class PD_Document;
00044 
00045 
00046 
00059 class ODi_Office_Styles {
00060 public:
00061 
00062     ODi_Office_Styles() {}
00063     ~ODi_Office_Styles();
00064 
00065     ODi_Style_Style* addStyle(const gchar** ppAtts,
00066                   ODi_ElementStack& rElementStack,
00067                   ODi_Abi_Data& rAbiData);
00068 
00069     ODi_Style_PageLayout* addPageLayout(const gchar** ppAtts,
00070                                        ODi_ElementStack& rElementStack,
00071                                        ODi_Abi_Data& rAbiData);
00072 
00073     ODi_Style_MasterPage* addMasterPage(const gchar** ppAtts,
00074                                        PD_Document* pDocument,
00075                                        ODi_ElementStack& rElementStack);
00076 
00077     ODi_Style_Style* addDefaultStyle(const gchar** ppAtts,
00078                      ODi_ElementStack& rElementStack,
00079                      ODi_Abi_Data &rAbiData );
00080 
00081     ODi_Style_List* addList(const gchar** ppAtts,
00082                            ODi_ElementStack& rElementStack);
00083 
00084     ODi_NotesConfiguration* addNotesConfiguration(const gchar** ppAtts,
00085                                                ODi_ElementStack& rElementStack);
00086 
00090     void addedAllStyles(PD_Document* pDocument,
00091                         ODi_FontFaceDecls& rFontFaceDecls) {
00092         _fixStyles();
00093         _linkStyles();
00094         _buildAbiPropsAttrString(rFontFaceDecls);
00095         _defineAbiStyles(pDocument);
00096     }
00097 
00098     const ODi_Style_Style* getTextStyle(const gchar* pStyleName,
00099                                        bool bOnContentStream) const;
00100 
00101     const ODi_Style_Style* getParagraphStyle(const gchar* pStyleName,
00102                                             bool bOnContentStream) const;
00103 
00104     const ODi_Style_Style* getSectionStyle(const gchar* pStyleName,
00105                                           bool bOnContentStream) const;
00106 
00107     const ODi_Style_Style* getGraphicStyle(const gchar* pStyleName,
00108                                           bool bOnContentStream) const;
00109 
00110     const ODi_Style_Style* getTableStyle(const gchar* pStyleName,
00111                                         bool bOnContentStream) const;
00112 
00113     const ODi_Style_Style* getTableColumnStyle(const gchar* pStyleName,
00114                                               bool bOnContentStream) const;
00115 
00116     const ODi_Style_Style* getTableRowStyle(const gchar* pStyleName,
00117                                            bool bOnContentStream) const;
00118 
00119     const ODi_Style_Style* getTableCellStyle(const gchar* pStyleName,
00120                                             bool bOnContentStream) const;
00121 
00122     const ODi_Style_Style* getDefaultParagraphStyle() const
00123         {
00124             return m_paragraphStyleStyles.getDefaultStyle();
00125         }
00126 
00127     const ODi_Style_PageLayout* getPageLayoutStyle(
00128                                              const gchar* pStyleName) const
00129         {
00130             std::map<std::string, ODi_Style_PageLayout*>::const_iterator
00131                 iter = m_pageLayoutStyles.find(pStyleName);
00132             if(iter != m_pageLayoutStyles.end()) {
00133                 return iter->second;
00134             }
00135             return NULL;
00136         }
00137 
00138     const ODi_Style_MasterPage* getMasterPageStyle(
00139                                              const gchar* pStyleName) const
00140         {
00141             std::map<std::string, ODi_Style_MasterPage*>::const_iterator
00142                 iter = m_masterPageStyles.find(pStyleName);
00143             if(iter != m_masterPageStyles.end()) {
00144                 return iter->second;
00145             }
00146             return NULL;
00147         }
00148 
00149     ODi_Style_List* getList(const gchar* pStyleName) const
00150         {
00151             std::map<std::string, ODi_Style_List*>::const_iterator
00152                 iter = m_listStyles.find(pStyleName);
00153             if(iter != m_listStyles.end()) {
00154                 return iter->second;
00155             }
00156             return NULL;
00157         }
00158 
00159     const ODi_NotesConfiguration* getNotesConfiguration(
00160                                                const gchar* pNoteClass) const
00161         {
00162             std::map<std::string, ODi_NotesConfiguration*>::const_iterator
00163                 iter = m_notesConfigurations.find(pNoteClass);
00164             if(iter != m_notesConfigurations.end()) {
00165                 return iter->second;
00166             }
00167             return NULL;
00168         }
00169 
00170 private:
00171 
00172     void _fixStyles();
00173     void _linkStyles();
00174     void _buildAbiPropsAttrString(ODi_FontFaceDecls& rFontFaceDecls);
00175     void _defineAbiStyles(PD_Document* pDocument) const;
00176 
00177     void _linkMasterStyles();
00178     void _linkListStyles() const;
00179 
00180 
00182     // Styles (<style:style>) are separated by family.
00183 
00184     // <style:style style:family="text">
00185     ODi_Style_Style_Family m_textStyleStyles;
00186 
00187     // <style:style style:family="paragraph">
00188     ODi_Style_Style_Family m_paragraphStyleStyles;
00189 
00190     // <style:style style:family="section">
00191     ODi_Style_Style_Family m_sectionStyleStyles;
00192 
00193     // <style:style style:family="graphic">
00194     ODi_Style_Style_Family m_graphicStyleStyles;
00195 
00196     // <style:style style:family="table">
00197     ODi_Style_Style_Family m_tableStyleStyles;
00198 
00199     // <style:style style:family="table-column">
00200     ODi_Style_Style_Family m_tableColumnStyleStyles;
00201 
00202     // <style:style style:family="table-row">
00203     ODi_Style_Style_Family m_tableRowStyleStyles;
00204 
00205     // <style:style style:family="table-cell">
00206     ODi_Style_Style_Family m_tableCellStyleStyles;
00207 
00208 
00209 
00210     // <text:list-style>
00211     typedef std::map<std::string, ODi_Style_List*> ListMap;
00212     ListMap m_listStyles;
00213 
00214     // <style:page-layout>
00215     typedef std::map<std::string, ODi_Style_PageLayout*> PageLayoutMap;
00216     PageLayoutMap m_pageLayoutStyles;
00217 
00218     // <style:master-page>
00219     typedef std::map<std::string, ODi_Style_MasterPage*> MasterPageMap;
00220     MasterPageMap m_masterPageStyles;
00221 
00222     // <text:notes-configuration>
00223     typedef std::map<std::string, ODi_NotesConfiguration*> NotesConfigMap;
00224     NotesConfigMap m_notesConfigurations;
00225 };
00226 
00227 #endif //_ODI_OFFICE_STYLES_H_

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1