00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PP_PROPERTYMAP_H
00024 #define PP_PROPERTYMAP_H
00025
00026 #if 0 // only used for code below. determine what to do with it
00027 #if defined(__MINGW32__)
00028 #undef snprintf
00029 #define _GLIBCXX_USE_C99_DYNAMIC 1
00030 #endif
00031
00032 #include <map>
00033 #endif
00034
00035
00036
00037
00038
00039 #ifndef UT_TYPES_H
00040 #include "ut_types.h"
00041 #endif
00042
00043 #include "ut_string_class.h"
00044 #include "ut_color.h"
00045
00046
00047 class ABI_EXPORT PP_PropertyMap
00048 {
00049 public:
00050
00054 static const char** _properties(int & num);
00055
00060 enum AbiPropertyIndex
00061 {
00062 abi_annotation_author= 0,
00063 abi_annotation_date,
00064 abi_annotation_title,
00065 abi_background_color,
00066 abi_background_image,
00067 abi_bgcolor,
00068 abi_border_merge,
00069 abi_border_shadow_merge,
00070 abi_bot_attach,
00071 abi_bot_color,
00072 abi_bot_style,
00073 abi_bot_shadow,
00074 abi_bot_shadow_color,
00075 abi_bot_space,
00076 abi_bot_thickness,
00077 abi_bounding_space,
00078 abi_cell_margin_bottom,
00079 abi_cell_margin_left,
00080 abi_cell_margin_right,
00081 abi_cell_margin_top,
00082 abi_color,
00083 abi_column_gap,
00084 abi_column_line,
00085 abi_columns,
00086 abi_default_tab_interval,
00087 abi_dir_override,
00088 abi_display,
00089 abi_document_endnote_initial,
00090 abi_document_endnote_place_enddoc,
00091 abi_document_endnote_place_endsection,
00092 abi_document_endnote_restart_section,
00093 abi_document_endnote_type,
00094 abi_document_footnote_initial,
00095 abi_document_footnote_restart_page,
00096 abi_document_footnote_restart_section,
00097 abi_document_footnote_type,
00098 abi_dom_dir,
00099 abi_field_color,
00100 abi_field_font,
00101 abi_font_family,
00102 abi_font_size,
00103 abi_font_stretch,
00104 abi_font_style,
00105 abi_font_variant,
00106 abi_font_weight,
00107 abi_footer,
00108 abi_footer_even,
00109 abi_footer_first,
00110 abi_footer_last,
00111 abi_format,
00112 abi_frame_col_xpos,
00113 abi_frame_col_ypos,
00114 abi_frame_expand_height,
00115 abi_frame_height,
00116 abi_frame_horiz_align,
00117 abi_frame_min_height,
00118 abi_frame_page_xpos,
00119 abi_frame_page_ypos,
00120 abi_frame_pref_column,
00121 abi_frame_pref_page,
00122 abi_frame_rel_width,
00123 abi_frame_type,
00124 abi_frame_width,
00125 abi_header,
00126 abi_header_even,
00127 abi_header_first,
00128 abi_header_last,
00129 abi_height,
00130 abi_homogeneous,
00131 abi_keep_together,
00132 abi_keep_with_next,
00133 abi_lang,
00134 abi_left_attach,
00135 abi_left_color,
00136 abi_left_style,
00137 abi_left_thickness,
00138 abi_left_shadow,
00139 abi_left_shadow_color,
00140 abi_left_space,
00141 abi_line_height,
00142 abi_list_decimal,
00143 abi_list_delim,
00144 abi_list_style,
00145 abi_list_tag,
00146 abi_margin_bottom,
00147 abi_margin_left,
00148 abi_margin_right,
00149 abi_margin_top,
00150 abi_orphans,
00151 abi_page_margin_bottom,
00152 abi_page_margin_footer,
00153 abi_page_margin_header,
00154 abi_page_margin_left,
00155 abi_page_margin_right,
00156 abi_page_margin_top,
00157 abi_position_to,
00158 abi_right_attach,
00159 abi_right_color,
00160 abi_right_shadow,
00161 abi_right_shadow_color,
00162 abi_right_space,
00163 abi_right_style,
00164 abi_right_thickness,
00165 abi_section_footnote_line_thickness,
00166 abi_section_footnote_yoff,
00167 abi_section_max_column_height,
00168 abi_section_restart,
00169 abi_section_restart_value,
00170 abi_section_space_after,
00171 abi_shading_background_color,
00172 abi_shading_foreground_color,
00173 abi_shading_pattern,
00174 abi_start_value,
00175 abi_table_border,
00176 abi_table_col_spacing,
00177 abi_table_column_leftpos,
00178 abi_table_column_props,
00179 abi_table_line_thickness,
00180 abi_table_line_type,
00181 abi_table_margin_bottom,
00182 abi_table_margin_left,
00183 abi_table_margin_right,
00184 abi_table_margin_top,
00185 abi_table_rel_column_props,
00186 abi_table_rel_width,
00187 abi_table_row_props,
00188 abi_table_row_spacing,
00189 abi_table_width,
00190 abi_tabstops,
00191 abi_text_align,
00192 abi_text_decoration,
00193 abi_text_folded,
00194 abi_text_folded_id,
00195 abi_text_indent,
00196 abi_text_position,
00197 abi_text_transform,
00198 abi_tight_wrap,
00199 abi_toc_dest_style1,
00200 abi_toc_dest_style2,
00201 abi_toc_dest_style3,
00202 abi_toc_dest_style4,
00203 abi_toc_id,
00204 abi_toc_indent1,
00205 abi_toc_indent2,
00206 abi_toc_indent3,
00207 abi_toc_indent4,
00208 abi_toc_has_heading,
00209 abi_toc_heading,
00210 abi_toc_has_label1,
00211 abi_toc_has_label2,
00212 abi_toc_has_label3,
00213 abi_toc_has_label4,
00214 abi_toc_heading_style,
00215 abi_toc_label_after1,
00216 abi_toc_label_after2,
00217 abi_toc_label_after3,
00218 abi_toc_label_after4,
00219 abi_toc_label_before1,
00220 abi_toc_label_before2,
00221 abi_toc_label_before3,
00222 abi_toc_label_before4,
00223 abi_toc_label_inherits1,
00224 abi_toc_label_inherits2,
00225 abi_toc_label_inherits3,
00226 abi_toc_label_inherits4,
00227 abi_toc_label_start1,
00228 abi_toc_label_start2,
00229 abi_toc_label_start3,
00230 abi_toc_label_start4,
00231 abi_toc_label_type1,
00232 abi_toc_label_type2,
00233 abi_toc_label_type3,
00234 abi_toc_label_type4,
00235 abi_toc_page_type1,
00236 abi_toc_page_type2,
00237 abi_toc_page_type3,
00238 abi_toc_page_type4,
00239 abi_toc_source_style1,
00240 abi_toc_source_style2,
00241 abi_toc_source_style3,
00242 abi_toc_source_style4,
00243 abi_toc_tab_leader1,
00244 abi_toc_tab_leader2,
00245 abi_toc_tab_leader3,
00246 abi_toc_tab_leader4,
00247 abi_top_attach,
00248 abi_top_color,
00249 abi_top_style,
00250 abi_top_thickness,
00251 abi_top_shadow,
00252 abi_top_shadow_color,
00253 abi_top_space,
00254 abi_vert_align,
00255 abi_widows,
00256 abi_width,
00257 abi_wrap_mode,
00258 abi_xpad,
00259 abi_xpos,
00260 abi_ypad,
00261 abi_ypos,
00262 abi__count
00263 };
00264 enum TypeColor
00265 {
00266 color__unset = 0,
00267 color_inherit,
00268 color_transparent,
00269 color_color
00270 };
00271 enum TypeLineStyle
00272 {
00273 linestyle__unset = 0,
00274 linestyle_none,
00275 linestyle_solid,
00276 linestyle_dotted,
00277 linestyle_dashed,
00278
00279
00280
00281 linestyle_inherit
00282 };
00283 enum TypeThickness
00284 {
00285 thickness__unset = 0,
00286 thickness_inherit,
00287 thickness_length
00288 };
00289
00290
00291
00292
00293 enum TypeBackground
00294 {
00295 background__unset = 0,
00296 background_none,
00297 background_solid,
00298
00299
00300
00301 background_inherit
00302 };
00303
00304 static TypeColor color_type (const char * property);
00305 static TypeLineStyle linestyle_type (const char * property);
00306 static TypeThickness thickness_type (const char * property);
00307 static TypeBackground background_type (const char * property);
00308
00309 static const char * linestyle_for_CSS (const char * property);
00310
00311 class ABI_EXPORT Line
00312 {
00313 public:
00314 Line ();
00315
00316 void reset ();
00317 TypeColor m_t_color;
00318 TypeLineStyle m_t_linestyle;
00319 TypeThickness m_t_thickness;
00320
00321 UT_RGBColor m_color;
00322 UT_uint32 m_thickness;
00323 UT_sint32 m_spacing;
00324 };
00325
00326
00327 class ABI_EXPORT Background
00328 {
00329 public:
00330 Background ();
00331
00332 void reset ();
00333
00334 TypeBackground m_t_background;
00335
00336 UT_RGBColor m_color;
00337 };
00338
00339 static const char * abi_property_name (AbiPropertyIndex index);
00340
00341 static bool abi_property_lookup (const char * name, AbiPropertyIndex & index);
00342
00343 #if 0
00344 typedef std::map<UT_sint32, UT_UTF8String *> map_type;
00345 private:
00346 map_type m_map;
00347 public:
00348 const map_type & map () const { return m_map; }
00349
00350 inline void clear ()
00351 {
00352 m_map.clear ();
00353 }
00354
00355 bool ins (AbiPropertyIndex key, UT_UTF8String * value)
00356 {
00357 if ((value == 0) || (key == abi__count))
00358 return false;
00359 std::pair<map_type::iterator, bool> p =
00360 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00361 value));
00362 return p.second;
00363 }
00364 bool ins (AbiPropertyIndex key, const char * value)
00365 {
00366 if ((value == 0) || (key == abi__count))
00367 return false;
00368 std::pair<map_type::iterator, bool> p =
00369 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00370 new UT_UTF8String(value)));
00371 return p.second;
00372 }
00373
00374
00375
00376 inline bool del (AbiPropertyIndex key)
00377 {
00378 if (key == abi__count) {
00379 return false;
00380 }
00381 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00382 if (i == m_map.end()) {
00383 return false;
00384 }
00385 delete (*i).second;
00386 m_map.erase(i);
00387 return true;
00388 }
00389 inline bool del (AbiPropertyIndex key, UT_UTF8String *& value)
00390 {
00391 if (key == abi__count) return false;
00392 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00393 if (i == m_map.end()) {
00394 return false;
00395 }
00396 value = (*i).second;
00397 m_map.erase(i);
00398 return true;
00399 }
00400
00401 inline const UT_UTF8String * operator[] (AbiPropertyIndex key)
00402 {
00403 if (key == abi__count)
00404 return 0;
00405 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00406 if (i == m_map.end()) {
00407 return NULL;
00408 }
00409 return (*i).second;
00410 }
00411 #endif
00412 };
00413 ABI_EXPORT bool operator==(const PP_PropertyMap::Line L1, const PP_PropertyMap::Line L2);
00414
00415 #endif