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_misc.h"
00045
00046 class ABI_EXPORT PP_PropertyMap
00047 {
00048 public:
00049 enum AbiPropertyIndex
00050 {
00051 abi_annotation_author= 0,
00052 abi_annotation_date,
00053 abi_annotation_title,
00054 abi_background_color,
00055 abi_background_image,
00056 abi_bgcolor,
00057 abi_bot_attach,
00058 abi_bot_color,
00059 abi_bot_style,
00060 abi_bot_thickness,
00061 abi_bounding_space,
00062 abi_cell_margin_bottom,
00063 abi_cell_margin_left,
00064 abi_cell_margin_right,
00065 abi_cell_margin_top,
00066 abi_color,
00067 abi_column_gap,
00068 abi_column_line,
00069 abi_columns,
00070 abi_default_tab_interval,
00071 abi_dir_override,
00072 abi_display,
00073 abi_document_endnote_initial,
00074 abi_document_endnote_place_enddoc,
00075 abi_document_endnote_place_endsection,
00076 abi_document_endnote_restart_section,
00077 abi_document_endnote_type,
00078 abi_document_footnote_initial,
00079 abi_document_footnote_restart_page,
00080 abi_document_footnote_restart_section,
00081 abi_document_footnote_type,
00082 abi_dom_dir,
00083 abi_field_color,
00084 abi_field_font,
00085 abi_font_family,
00086 abi_font_size,
00087 abi_font_stretch,
00088 abi_font_style,
00089 abi_font_variant,
00090 abi_font_weight,
00091 abi_footer,
00092 abi_footer_even,
00093 abi_footer_first,
00094 abi_footer_last,
00095 abi_format,
00096 abi_frame_column_xpos,
00097 abi_frame_column_ypos,
00098 abi_frame_height,
00099 abi_frame_page_xpos,
00100 abi_frame_page_ypos,
00101 abi_frame_position_to,
00102 abi_frame_type,
00103 abi_frame_width,
00104 abi_frame_xpos,
00105 abi_frame_ypos,
00106 abi_header,
00107 abi_header_even,
00108 abi_header_first,
00109 abi_header_last,
00110 abi_height,
00111 abi_homogeneous,
00112 abi_keep_together,
00113 abi_keep_with_next,
00114 abi_lang,
00115 abi_left_attach,
00116 abi_left_color,
00117 abi_left_style,
00118 abi_left_thickness,
00119 abi_line_height,
00120 abi_list_decimal,
00121 abi_list_delim,
00122 abi_list_style,
00123 abi_list_tag,
00124 abi_margin_bottom,
00125 abi_margin_left,
00126 abi_margin_right,
00127 abi_margin_top,
00128 abi_orphans,
00129 abi_page_margin_bottom,
00130 abi_page_margin_footer,
00131 abi_page_margin_header,
00132 abi_page_margin_left,
00133 abi_page_margin_right,
00134 abi_page_margin_top,
00135 abi_relocate,
00136 abi_right_attach,
00137 abi_right_color,
00138 abi_right_style,
00139 abi_right_thickness,
00140 abi_section_footnote_line_thickness,
00141 abi_section_footnote_yoff,
00142 abi_section_max_column_height,
00143 abi_section_restart,
00144 abi_section_restart_value,
00145 abi_section_space_after,
00146 abi_start_value,
00147 abi_table_border,
00148 abi_table_col_spacing,
00149 abi_table_column_leftpos,
00150 abi_table_column_props,
00151 abi_table_line_thickness,
00152 abi_table_line_type,
00153 abi_table_margin_bottom,
00154 abi_table_margin_left,
00155 abi_table_margin_right,
00156 abi_table_margin_top,
00157 abi_table_row_props,
00158 abi_table_row_spacing,
00159 abi_tabstops,
00160 abi_text_align,
00161 abi_text_decoration,
00162 abi_text_folded,
00163 abi_text_folded_id,
00164 abi_text_indent,
00165 abi_text_position,
00166 abi_tight_wrap,
00167 abi_toc_dest_style1,
00168 abi_toc_dest_style2,
00169 abi_toc_dest_style3,
00170 abi_toc_dest_style4,
00171 abi_toc_id,
00172 abi_toc_indent1,
00173 abi_toc_indent2,
00174 abi_toc_indent3,
00175 abi_toc_indent4,
00176 abi_toc_has_heading,
00177 abi_toc_heading,
00178 abi_toc_has_label1,
00179 abi_toc_has_label2,
00180 abi_toc_has_label3,
00181 abi_toc_has_label4,
00182 abi_toc_heading_style,
00183 abi_toc_label_after1,
00184 abi_toc_label_after2,
00185 abi_toc_label_after3,
00186 abi_toc_label_after4,
00187 abi_toc_label_before1,
00188 abi_toc_label_before2,
00189 abi_toc_label_before3,
00190 abi_toc_label_before4,
00191 abi_toc_label_inherits1,
00192 abi_toc_label_inherits2,
00193 abi_toc_label_inherits3,
00194 abi_toc_label_inherits4,
00195 abi_toc_label_start1,
00196 abi_toc_label_start2,
00197 abi_toc_label_start3,
00198 abi_toc_label_start4,
00199 abi_toc_label_type1,
00200 abi_toc_label_type2,
00201 abi_toc_label_type3,
00202 abi_toc_label_type4,
00203 abi_toc_page_type1,
00204 abi_toc_page_type2,
00205 abi_toc_page_type3,
00206 abi_toc_page_type4,
00207 abi_toc_source_style1,
00208 abi_toc_source_style2,
00209 abi_toc_source_style3,
00210 abi_toc_source_style4,
00211 abi_toc_tab_leader1,
00212 abi_toc_tab_leader2,
00213 abi_toc_tab_leader3,
00214 abi_toc_tab_leader4,
00215 abi_top_attach,
00216 abi_top_color,
00217 abi_top_style,
00218 abi_top_thickness,
00219 abi_widows,
00220 abi_width,
00221 abi_wrap_mode,
00222 abi__count
00223 };
00224 enum TypeColor
00225 {
00226 color__unset = 0,
00227 color_inherit,
00228 color_transparent,
00229 color_color
00230 };
00231 enum TypeLineStyle
00232 {
00233 linestyle__unset = 0,
00234 linestyle_none,
00235 linestyle_solid,
00236 linestyle_dotted,
00237 linestyle_dashed,
00238
00239
00240
00241 linestyle_inherit
00242 };
00243 enum TypeThickness
00244 {
00245 thickness__unset = 0,
00246 thickness_inherit,
00247 thickness_length
00248 };
00249
00250
00251
00252
00253 enum TypeBackground
00254 {
00255 background__unset = 0,
00256 background_none,
00257 background_solid,
00258
00259
00260
00261 background_inherit
00262 };
00263
00264 static TypeColor color_type (const char * property);
00265 static TypeLineStyle linestyle_type (const char * property);
00266 static TypeThickness thickness_type (const char * property);
00267 static TypeBackground background_type (const char * property);
00268
00269 static const char * linestyle_for_CSS (const char * property);
00270
00271 class ABI_EXPORT Line
00272 {
00273 public:
00274 Line ();
00275
00276 void reset ();
00277
00278 TypeColor m_t_color;
00279 TypeLineStyle m_t_linestyle;
00280 TypeThickness m_t_thickness;
00281
00282 UT_RGBColor m_color;
00283 UT_uint32 m_thickness;
00284 };
00285 class ABI_EXPORT Background
00286 {
00287 public:
00288 Background ();
00289
00290 void reset ();
00291
00292 TypeBackground m_t_background;
00293
00294 UT_RGBColor m_color;
00295 };
00296
00297 static const char * abi_property_name (AbiPropertyIndex index);
00298
00299 static bool abi_property_lookup (const char * name, AbiPropertyIndex & index);
00300 #if 0
00301 typedef std::map<UT_sint32, UT_UTF8String *> map_type;
00302 private:
00303 map_type m_map;
00304 public:
00305 const map_type & map () const { return m_map; }
00306
00307 inline void clear ()
00308 {
00309 m_map.clear ();
00310 }
00311
00312 bool ins (AbiPropertyIndex key, UT_UTF8String * value)
00313 {
00314 if ((value == 0) || (key == abi__count))
00315 return false;
00316 std::pair<map_type::iterator, bool> p =
00317 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00318 value));
00319 return p.second;
00320 }
00321 bool ins (AbiPropertyIndex key, const char * value)
00322 {
00323 if ((value == 0) || (key == abi__count))
00324 return false;
00325 std::pair<map_type::iterator, bool> p =
00326 m_map.insert(map_type::value_type(static_cast<UT_sint32>(key),
00327 new UT_UTF8String(value)));
00328 return p.second;
00329 }
00330
00331
00332
00333 inline bool del (AbiPropertyIndex key)
00334 {
00335 if (key == abi__count) {
00336 return false;
00337 }
00338 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00339 if (i == m_map.end()) {
00340 return false;
00341 }
00342 delete (*i).second;
00343 m_map.erase(i);
00344 return true;
00345 }
00346 inline bool del (AbiPropertyIndex key, UT_UTF8String *& value)
00347 {
00348 if (key == abi__count) return false;
00349 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00350 if (i == m_map.end()) {
00351 return false;
00352 }
00353 value = (*i).second;
00354 m_map.erase(i);
00355 return true;
00356 }
00357
00358 inline const UT_UTF8String * operator[] (AbiPropertyIndex key)
00359 {
00360 if (key == abi__count)
00361 return 0;
00362 map_type::iterator i = m_map.find(static_cast<UT_sint32>(key));
00363 if (i == m_map.end()) {
00364 return NULL;
00365 }
00366 return (*i).second;
00367 }
00368 #endif
00369 };
00370
00371 #endif