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

ie_exp_RTF_AttrProp.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 
00021 #ifndef IE_EXP_RTF_ATTRPROP_H
00022 #define IE_EXP_RTF_ATTRPROP_H
00023 
00024 #include "pt_Types.h"
00025 class PD_Document;
00026 class PD_Style;
00027 class PP_AttrProp;
00028 
00029 
00030 #include <list>
00031 #include <boost/function.hpp>
00032 
00078 class APFilterList
00079     :
00080     public std::binary_function< const gchar *, const gchar *, const gchar * >
00081 {
00082 protected:
00083     mutable std::string m_cache;
00084     typedef boost::function2< std::string, const gchar *, const std::string& > m_filter_t;
00085     typedef std::list< m_filter_t > m_filterlist_t;
00086     m_filterlist_t m_filterlist;
00087 
00088 public:
00089     const gchar* operator()( const gchar * szName, const gchar * szValue ) const
00090     {
00091         if( m_filterlist.empty() )
00092             return szValue;
00093 
00094         m_cache = szValue ? szValue : "";
00095         for( m_filterlist_t::const_iterator fi = m_filterlist.begin();
00096              fi != m_filterlist.end(); ++fi )
00097         {
00098             const m_filter_t& f = *fi;
00099             m_cache = f( szName, m_cache );
00100         }
00101 
00102         return m_cache.c_str();
00103     }
00104     void append( m_filter_t f )
00105     {
00106         m_filterlist.push_back(f);
00107     }
00108     void push_back( m_filter_t f )
00109     {
00110         append( f );
00111     }
00112 };
00113 
00118 struct APFilterNULL
00119 {
00120     std::string operator()( const gchar * szName, const std::string& value ) const
00121     {
00122         UT_UNUSED( szName );
00123         return value;
00124     }
00125 };
00126 
00127 
00128 
00129 
00141 class ABI_EXPORT s_RTF_AttrPropAdapter
00142 {
00143 public:
00144     virtual ~s_RTF_AttrPropAdapter() {}
00145     virtual const gchar * getAttribute(const gchar * szName) const = 0;
00146 
00147     virtual const gchar * getProperty(const gchar * szName) const = 0;
00148 };
00149 
00150 class ABI_EXPORT s_RTF_AttrPropAdapter_Style : public s_RTF_AttrPropAdapter
00151 {
00152 private:
00153     const PD_Style * m_pStyle;
00154 
00155 public:
00156     virtual ~s_RTF_AttrPropAdapter_Style() {}
00157     s_RTF_AttrPropAdapter_Style(const PD_Style * pStyle) : m_pStyle(pStyle) {}
00158 
00159     virtual const gchar * getAttribute(const gchar * szName) const;
00160     virtual const gchar * getProperty(const gchar * szName) const;
00161 };
00162 
00163 class ABI_EXPORT s_RTF_AttrPropAdapter_AP : public s_RTF_AttrPropAdapter
00164 {
00165 private:
00166     const PP_AttrProp * m_pSpanAP;
00167     const PP_AttrProp * m_pBlockAP;
00168     const PP_AttrProp * m_pSectionAP;
00169     PD_Document *m_pDoc;
00170     APFilterList m_attrAPFilterList;
00171 
00172 public:
00173     s_RTF_AttrPropAdapter_AP(const PP_AttrProp * pSpanAP,
00174                              const PP_AttrProp * pBlockAP,
00175                              const PP_AttrProp * pSectionAP,
00176                              PD_Document * pDoc);
00177     virtual ~s_RTF_AttrPropAdapter_AP();
00178 
00179     virtual const gchar * getAttribute(const gchar * szName) const;
00180     virtual const gchar * getProperty(const gchar * szName) const;
00181 };
00182 
00183 #endif

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1