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

ODi_Style_Style_Family.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  *
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 _ODI_STYLE_STYLE_FAMILY_H_
00023 #define _ODI_STYLE_STYLE_FAMILY_H_
00024 
00025 #include <map>
00026 #include <string>
00027 
00028 // Internal includes
00029 #include "ODi_Style_Style.h"
00030 
00031 // AbiWord includes
00032 #include <ut_types.h>
00033 #include <ut_string_class.h>
00034 
00035 // Internal classes
00036 class ODi_ElementStack;
00037 class ODi_FontFaceDecls;
00038 
00039 // AbiWord classes
00040 class PD_Document;
00041 class ODi_Abi_Data;
00046 class ODi_Style_Style_Family {
00047 public:
00048 
00049     ODi_Style_Style_Family() : m_pDefaultStyle(NULL) {}
00050     virtual ~ODi_Style_Style_Family();
00051 
00052     ODi_Style_Style* addStyle(const gchar** ppAtts,
00053                              ODi_ElementStack& rElementStack,
00054                  ODi_Abi_Data & rAbiData,
00055                              std::string* pReplacementName = NULL,
00056                              std::string* pReplacementDisplayName = NULL);
00057 
00058     ODi_Style_Style* addDefaultStyle(ODi_ElementStack& rElementStack,
00059                      ODi_Abi_Data & rAbiData) {
00060       m_pDefaultStyle = new ODi_Style_Style(rElementStack,rAbiData);
00061         return m_pDefaultStyle;
00062     }
00063 
00064     void fixStyles();
00065     void linkStyles();
00066 
00067     const ODi_Style_Style* getStyle(const gchar* pStyleName,
00068                                    bool bOnContentStream) const;
00069 
00070     const ODi_Style_Style* getDefaultStyle() const {
00071         return m_pDefaultStyle;
00072     }
00073 
00074     void removeStyleStyle(ODi_Style_Style* pRemovedStyle, bool bOnContentStream);
00075 
00076     void defineAbiStyles(PD_Document* pDocument) const;
00077     void buildAbiPropsAttrString(ODi_FontFaceDecls& rFontFaceDecls);
00078 
00079 private:
00080 
00081     typedef std::map<std::string, ODi_Style_Style*> StyleMap;
00082 
00083     void _buildAbiPropsAttrString(ODi_FontFaceDecls& rFontFaceDecls,
00084                                   const StyleMap & map);
00085     void _findSuitableReplacement(std::string& rReplacementName,
00086                     const ODi_Style_Style* pRemovedStyle,
00087                     bool bOnContentStream);
00088     void _reparentStyles(const StyleMap & map, const std::string & removedName,
00089                          const std::string & replacementName);
00090 
00091     void _linkStyles(const StyleMap & map, bool onContentStream);
00092     void _removeEmptyStyles(const StyleMap & map, bool bOnContentStream);
00093 
00094     // Styles define inside the styles stream (<office:document-styles>).
00095     StyleMap m_styles;
00096 
00097     // Styles defined inside the content stream, only automatic styles.
00098     // (<office:document-content> element)
00099     StyleMap m_styles_contentStream;
00100 
00101     // <style:default-style style:family="...">
00102     ODi_Style_Style* m_pDefaultStyle;
00103 
00104     // The styles (<style:style> kind) that get removed due to lack of
00105     // properties have their names stored here.
00106     //
00107     // The key is the name of the removed style and its value is the name of
00108     // the style to replace him.
00109     std::map<std::string, std::string> m_removedStyleStyles;
00110     std::map<std::string, std::string> m_removedStyleStyles_contentStream;
00111 };
00112 
00113 #endif //_ODI_STYLE_STYLE_FAMILY_H_

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1