00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PP_PROPERTY_H
00025 #define PP_PROPERTY_H
00026
00027
00028 #define pp_BASEDON_DEPTH_LIMIT 10
00029
00030 #include "ut_types.h"
00031 #include "ut_misc.h"
00032 #include "ut_units.h"
00033
00034 #include "pp_PropertyMap.h"
00035
00036 class PP_AttrProp;
00037 class PD_Document;
00038
00039
00040
00041
00042
00043 typedef enum {
00044 Property_type_bool,
00045 Property_type_int,
00046 Property_type_size,
00047 Property_type_color
00048 } tProperty_type;
00049
00050
00051 class ABI_EXPORT PP_PropertyType
00052 {
00053 public:
00054 PP_PropertyType() {};
00055 virtual ~PP_PropertyType() {};
00056
00057 public:
00058 virtual tProperty_type getType() const = 0;
00059
00060 static PP_PropertyType *createPropertyType(tProperty_type Type, const gchar *p_init);
00061 };
00062
00063 class ABI_EXPORT PP_PropertyTypeBool : public PP_PropertyType
00064 {
00065
00066 public:
00067 PP_PropertyTypeBool(const gchar *p_init);
00068
00069 tProperty_type getType() const {return Property_type_bool;}
00070
00071 bool getState() const {return State;}
00072
00073
00074 private:
00075
00076 bool State;
00077 };
00078
00079 class ABI_EXPORT PP_PropertyTypeInt : public PP_PropertyType
00080 {
00081
00082 public:
00083 PP_PropertyTypeInt(const gchar *p_init);
00084
00085 tProperty_type getType() const {return Property_type_int;}
00086
00087 int getValue() const {return Value;}
00088
00089
00090 private:
00091
00092 int Value;
00093 };
00094
00095 class ABI_EXPORT PP_PropertyTypeSize : public PP_PropertyType
00096 {
00097
00098 public:
00099 PP_PropertyTypeSize(const gchar *p_init);
00100
00101 tProperty_type getType() const {return Property_type_size;}
00102
00103 double getValue() const {return Value;}
00104 UT_Dimension getDim() const {return Dim;}
00105
00106
00107 private:
00108
00109 double Value;
00110 UT_Dimension Dim;
00111 };
00112
00113 class ABI_EXPORT PP_PropertyTypeColor : public PP_PropertyType
00114 {
00115
00116 public:
00117 PP_PropertyTypeColor(const gchar *p_init);
00118
00119 tProperty_type getType() const {return Property_type_color;}
00120
00121 const UT_RGBColor &getColor() const {return Color;}
00122
00123
00124 private:
00125
00126 UT_RGBColor Color;
00127 };
00128
00129
00130
00131 typedef unsigned int tPropLevel;
00132
00133
00134
00135 #define PP_LEVEL_CHAR 0x00000001
00136 #define PP_LEVEL_BLOCK 0x00000002
00137 #define PP_LEVEL_SECT 0x00000004
00138 #define PP_LEVEL_DOC 0x00000008
00139 #define PP_LEVEL_TABLE 0x00000010
00140 #define PP_LEVEL_OBJ 0x00000020
00141 #define PP_LEVEL_IMG 0x00000040
00142 #define PP_LEVEL_FIELD 0x00000080
00143 #define PP_LEVEL_FRAME 0x00000100
00144
00145 class ABI_EXPORT PP_Property
00146 {
00147 public:
00148 const gchar * m_pszName;
00149 const gchar * m_pszInitial;
00150 bool m_bInherit;
00151 PP_PropertyType * m_pProperty;
00152 tPropLevel m_iLevel;
00153 ~PP_Property();
00154
00155 inline const gchar * getName() const {return m_pszName;}
00156 inline const gchar * getInitial() const {return m_pszInitial;}
00157 const PP_PropertyType * getInitialType (tProperty_type Type) const;
00158 inline bool canInherit() const {return m_bInherit;}
00159 inline tPropLevel getLevel() const {return m_iLevel;}
00160 };
00161
00162 const PP_Property * PP_lookupProperty(const gchar * pszName);
00163
00164 void PP_resetInitialBiDiValues(const gchar * pszValue);
00165
00166 ABI_EXPORT void PP_setDefaultFontFamily(const char* pszFamily);
00167
00168 ABI_EXPORT const gchar * PP_evalProperty(const gchar * pszName,
00169 const PP_AttrProp * pSpanAttrProp,
00170 const PP_AttrProp * pBlockAttrProp,
00171 const PP_AttrProp * pSectionAttrProp,
00172 PD_Document * pDoc,
00173 bool bExpandStyles=false);
00174
00175
00176 ABI_EXPORT const PP_PropertyType * PP_evalPropertyType(const gchar * pszName,
00177 const PP_AttrProp * pSpanAttrProp,
00178 const PP_AttrProp * pBlockAttrProp,
00179 const PP_AttrProp * pSectionAttrProp,
00180 tProperty_type Type,
00181 PD_Document * pDoc=NULL,
00182 bool bExpandStyles=false);
00183
00184 ABI_EXPORT UT_uint32 PP_getPropertyCount();
00185 ABI_EXPORT const gchar * PP_getNthPropertyName(UT_uint32 n);
00186 ABI_EXPORT tPropLevel PP_getNthPropertyLevel(UT_uint32 n);
00187 #endif