Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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