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_max_extra_margin,
00186 abi_table_rel_column_props,
00187 abi_table_rel_width,
00188 abi_table_row_props,
00189 abi_table_row_spacing,
00190 abi_table_width,
00191 abi_tabstops,
00192 abi_text_align,
00193 abi_text_decoration,
00194 abi_text_folded,
00195 abi_text_folded_id,
00196 abi_text_indent,
00197 abi_text_position,
00198 abi_text_transform,
00199 abi_tight_wrap,
00200 abi_toc_dest_style1,
00201 abi_toc_dest_style2,
00202 abi_toc_dest_style3,
00203 abi_toc_dest_style4,
00204 abi_toc_id,
00205 abi_toc_indent1,
00206 abi_toc_indent2,
00207 abi_toc_indent3,
00208 abi_toc_indent4,
00209 abi_toc_has_heading,
00210 abi_toc_heading,
00211 abi_toc_has_label1,
00212 abi_toc_has_label2,
00213 abi_toc_has_label3,
00214 abi_toc_has_label4,
00215 abi_toc_heading_style,
00216 abi_toc_label_after1,
00217 abi_toc_label_after2,
00218 abi_toc_label_after3,
00219 abi_toc_label_after4,
00220 abi_toc_label_before1,
00221 abi_toc_label_before2,
00222 abi_toc_label_before3,
00223 abi_toc_label_before4,
00224 abi_toc_label_inherits1,
00225 abi_toc_label_inherits2,
00226 abi_toc_label_inherits3,
00227 abi_toc_label_inherits4,
00228 abi_toc_label_start1,
00229 abi_toc_label_start2,
00230 abi_toc_label_start3,
00231 abi_toc_label_start4,
00232 abi_toc_label_type1,
00233 abi_toc_label_type2,
00234 abi_toc_label_type3,
00235 abi_toc_label_type4,
00236 abi_toc_page_type1,
00237 abi_toc_page_type2,
00238 abi_toc_page_type3,
00239 abi_toc_page_type4,
00240 abi_toc_source_style1,
00241 abi_toc_source_style2,
00242 abi_toc_source_style3,
00243 abi_toc_source_style4,
00244 abi_toc_tab_leader1,
00245 abi_toc_tab_leader2,
00246 abi_toc_tab_leader3,
00247 abi_toc_tab_leader4,
00248 abi_top_attach,
00249 abi_top_color,
00250 abi_top_style,
00251 abi_top_thickness,
00252 abi_top_shadow,
00253 abi_top_shadow_color,
00254 abi_top_space,
00255 abi_vert_align,
00256 abi_widows,
00257 abi_width,
00258 abi_wrap_mode,
00259 abi_xpad,
00260 abi_xpos,
00261 abi_ypad,
00262 abi_ypos,
00263 abi__count
00264 };
00265 enum TypeColor
00266 {
00267 color__unset = 0,
00268 color_inherit,
00269 color_transparent,
00270 color_color
00271 };
00272 enum TypeLineStyle
00273 {
00274 linestyle__unset = 0,
00275 linestyle_none,
00276 linestyle_solid,
00277 linestyle_dotted,
00278 linestyle_dashed,
00279
00280
00281
00282 linestyle_inherit
00283 };
00284 enum TypeThickness
00285 {
00286 thickness__unset = 0,
00287 thickness_inherit,
00288 thickness_length
00289 };
00290
00291
00292
00293
00294 enum TypeBackground
00295 {
00296 background__unset = 0,
00297 background_none,
00298 background_solid,
00299
00300
00301
00302 background_inherit
00303 };
00304
00305 static TypeColor color_type (const char * property);
00306 static TypeLineStyle linestyle_type (const char * property);
00307 static TypeThickness thickness_type (const char * property);
00308 static TypeBackground background_type (const char * property);
00309
00310 static const char * linestyle_for_CSS (const char * property);
00311
00312 class ABI_EXPORT Line
00313 {
00314 public:
00315 Line ();
00316
00317 void reset ();
00318 TypeColor m_t_color;
00319 TypeLineStyle m_t_linestyle;
00320 TypeThickness m_t_thickness;
00321
00322 UT_RGBColor m_color;
00323 UT_uint32 m_thickness;
00324 UT_sint32 m_spacing;
00325 };
00326
00327
00328 class ABI_EXPORT Background
00329 {
00330 public:
00331 Background ();
00332
00333 void reset ();
00334
00335 TypeBackground m_t_background;
00336
00337 UT_RGBColor m_color;
00338 };
00339
00340 static const char * abi_property_name (AbiPropertyIndex index);
00341
00342 static bool abi_property_lookup (const char * name, AbiPropertyIndex & index);
00343
00344 #if 0
00345 typedef std::map<UT_sint32, UT_UTF8String *> map_type;
00346 private:
00347 map_type m_map;
00348 public:
00349 const map_type & map () const { return m_map; }
00350
00351 inline void clear ()
00352 {
00353 m_map.clear ();
00354 }
00355
00356 bool ins (AbiPropertyIndex key, UT_UTF8String * value)
00357 {
00358 if ((value == 0) || (key == abi__count))
00359 return false;
00360 std::pair<map_type::iterator, bool> p =
00361 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00362 value));
00363 return p.second;
00364 }
00365 bool ins (AbiPropertyIndex key, const char * value)
00366 {
00367 if ((value == 0) || (key == abi__count))
00368 return false;
00369 std::pair<map_type::iterator, bool> p =
00370 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00371 new UT_UTF8String(value)));
00372 return p.second;
00373 }
00374
00375
00376
00377 inline bool del (AbiPropertyIndex key)
00378 {
00379 if (key == abi__count) {
00380 return false;
00381 }
00382 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00383 if (i == m_map.end()) {
00384 return false;
00385 }
00386 delete (*i).second;
00387 m_map.erase(i);
00388 return true;
00389 }
00390 inline bool del (AbiPropertyIndex key, UT_UTF8String *& value)
00391 {
00392 if (key == abi__count) return false;
00393 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00394 if (i == m_map.end()) {
00395 return false;
00396 }
00397 value = (*i).second;
00398 m_map.erase(i);
00399 return true;
00400 }
00401
00402 inline const UT_UTF8String * operator[] (AbiPropertyIndex key)
00403 {
00404 if (key == abi__count)
00405 return 0;
00406 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00407 if (i == m_map.end()) {
00408 return NULL;
00409 }
00410 return (*i).second;
00411 }
00412 #endif
00413 };
00414 ABI_EXPORT bool operator==(const PP_PropertyMap::Line L1, const PP_PropertyMap::Line L2);
00415
00416 #endif