ooxml_parser 0.14.1-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats/pivot_format.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/number_string_reference.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/number_string_cache.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/x_y_values.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +174 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +48 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +39 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +13 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +63 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +44 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +116 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +37 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +40 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +49 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +49 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +24 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +39 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +63 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +59 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +12 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +8 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +28 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +32 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +73 -0
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +59 -0
- data/lib/ooxml_parser/common_parser/common_data/color/color_indexes.list +66 -0
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +66 -0
- data/lib/ooxml_parser/common_parser/common_data/color.rb +308 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +17 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +67 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +36 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +41 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +19 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +26 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +45 -0
- data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +155 -0
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +89 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +117 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +144 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +109 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +60 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +148 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +63 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +41 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +57 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_stlye_ref.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +100 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +46 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +30 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +68 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +33 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +54 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +23 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +48 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +50 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +61 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +45 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +57 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +25 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +89 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +29 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +96 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +21 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +43 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +34 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +40 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +22 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +38 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +104 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +52 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +50 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +25 -0
- data/lib/ooxml_parser/common_parser/parser.rb +49 -0
- data/lib/ooxml_parser/configuration.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +42 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +35 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +39 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +98 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +35 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +31 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +24 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +45 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +27 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +75 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +20 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +111 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +14 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +13 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +19 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +77 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +16 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +29 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +147 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +51 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +51 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +57 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +46 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +30 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +30 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +273 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +63 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +33 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +66 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +44 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +23 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +56 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +25 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +34 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +52 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +45 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +83 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +62 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +22 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +28 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +32 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +290 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +19 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +24 -0
- data/lib/ooxml_parser/name.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +16 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +47 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +54 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +13 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +35 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +35 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +28 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +7 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +50 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +30 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +33 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +28 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/codition_list/condition.rb +23 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +44 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +59 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +29 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +68 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +36 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +30 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +85 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +25 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +62 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +17 -0
- data/lib/ooxml_parser/version.rb +9 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/defined_name.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +46 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb +35 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +150 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +35 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +49 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +44 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +44 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +50 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +14 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +31 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +44 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +20 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +23 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +41 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +36 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation/data_validation_formula.rb +22 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations/data_validation.rb +88 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/data_validations.rb +47 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +115 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +33 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +32 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +50 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +54 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +27 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +40 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer/header_footer_child.rb +56 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_header_footer.rb +64 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +84 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +43 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +152 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +165 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +17 -0
- data/lib/ooxml_parser.rb +40 -0
- metadata +572 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'shape/old_docx_shape'
|
4
|
+
require_relative 'shape/old_docx_shape_fill'
|
5
|
+
require_relative 'group/old_docx_group'
|
6
|
+
module OoxmlParser
|
7
|
+
# Fallback DOCX Picture
|
8
|
+
class OldDocxPicture < OOXMLDocumentObject
|
9
|
+
attr_accessor :data, :type
|
10
|
+
|
11
|
+
# Parse OldDocxPicture object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [OldDocxPicture] result of parsing
|
14
|
+
def parse(node)
|
15
|
+
node.xpath('*').each do |node_child|
|
16
|
+
case node_child.name
|
17
|
+
when 'shape'
|
18
|
+
@type = :shape
|
19
|
+
@data = OldDocxShape.new(parent: self).parse(node_child)
|
20
|
+
when 'group'
|
21
|
+
@type = :group
|
22
|
+
@data = OldDocxGroup.new(parent: self).parse(node_child)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'old_docx_shape_properties'
|
4
|
+
module OoxmlParser
|
5
|
+
# Fallback DOCX shape data
|
6
|
+
class OldDocxShape < OOXMLDocumentObject
|
7
|
+
attr_accessor :properties, :text_box, :fill
|
8
|
+
# @return [FileReference] image structure
|
9
|
+
attr_accessor :file_reference
|
10
|
+
|
11
|
+
# Parse OldDocxShape object
|
12
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
13
|
+
# @return [OldDocxShape] result of parsing
|
14
|
+
def parse(node)
|
15
|
+
@properties = OldDocxShapeProperties.new(parent: self).parse(node)
|
16
|
+
node.xpath('*').each do |node_child|
|
17
|
+
case node_child.name
|
18
|
+
when 'textbox'
|
19
|
+
@text_box = TextBox.parse_list(node_child, parent: self)
|
20
|
+
when 'imagedata'
|
21
|
+
@file_reference = FileReference.new(parent: self).parse(node_child)
|
22
|
+
when 'fill'
|
23
|
+
@fill = OldDocxShapeFill.new(parent: self).parse(node_child)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Fallback DOCX shape fill properties
|
5
|
+
class OldDocxShapeFill < OOXMLDocumentObject
|
6
|
+
attr_accessor :stretching_type, :opacity, :title
|
7
|
+
# @return [FileReference] image structure
|
8
|
+
attr_accessor :file_reference
|
9
|
+
|
10
|
+
# Parse OldDocxShapeFill object
|
11
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
12
|
+
# @return [OldDocxShapeFill] result of parsing
|
13
|
+
def parse(node)
|
14
|
+
node.attributes.each do |key, value|
|
15
|
+
case key
|
16
|
+
when 'id'
|
17
|
+
@file_reference = FileReference.new(parent: self).parse(node)
|
18
|
+
when 'type'
|
19
|
+
@stretching_type = case value.value
|
20
|
+
when 'frame'
|
21
|
+
:stretch
|
22
|
+
else
|
23
|
+
value.value.to_sym
|
24
|
+
end
|
25
|
+
when 'title'
|
26
|
+
@title = value.value.to_s
|
27
|
+
end
|
28
|
+
end
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Fallback DOCX Shape Properties
|
5
|
+
class OldDocxShapeProperties < OOXMLDocumentObject
|
6
|
+
attr_accessor :fill_color, :stroke_color, :stroke_weight
|
7
|
+
|
8
|
+
# Parse OldDocxShapeProperties object
|
9
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
10
|
+
# @return [OldDocxShapeProperties] result of parsing
|
11
|
+
def parse(node)
|
12
|
+
node.attributes.each do |key, value|
|
13
|
+
case key
|
14
|
+
when 'fillcolor'
|
15
|
+
@fill_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
|
16
|
+
when 'strokecolor'
|
17
|
+
@stroke_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
|
18
|
+
when 'strokeweight'
|
19
|
+
@stroke_weight = value.value.to_f
|
20
|
+
end
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Border Properties Data
|
5
|
+
class BordersProperties < OOXMLDocumentObject
|
6
|
+
attr_accessor :color, :space, :val, :shadow, :frame, :side
|
7
|
+
# @return [OoxmlSize] size of border
|
8
|
+
attr_reader :size
|
9
|
+
|
10
|
+
def initialize(color = :auto, size = 0, val = :none, space = 0, parent: nil)
|
11
|
+
@color = color
|
12
|
+
@size = size
|
13
|
+
@val = val
|
14
|
+
@space = space
|
15
|
+
super(parent: parent)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [OoxmlSize] alias for sz
|
19
|
+
def sz
|
20
|
+
size
|
21
|
+
end
|
22
|
+
|
23
|
+
extend Gem::Deprecate
|
24
|
+
deprecate :sz, 'size', 2020, 1
|
25
|
+
|
26
|
+
def nil?
|
27
|
+
size.zero? && val == :none
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [String] result of convert of object to string
|
31
|
+
def to_s
|
32
|
+
return '' if nil?
|
33
|
+
|
34
|
+
"borders color: #{@color}, size: #{size}, space: #{@space}, value: #{@val}"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Method to copy object
|
38
|
+
# @return [BordersProperties] copied object
|
39
|
+
def copy
|
40
|
+
BordersProperties.new(@color, size, @val, @space)
|
41
|
+
end
|
42
|
+
|
43
|
+
def visible?
|
44
|
+
return false if nil?
|
45
|
+
|
46
|
+
val != 'none'
|
47
|
+
end
|
48
|
+
|
49
|
+
# Parse BordersProperties
|
50
|
+
# @param [Nokogiri::XML:Element] node with BordersProperties
|
51
|
+
# @return [BordersProperties] value of BordersProperties
|
52
|
+
def parse(node)
|
53
|
+
return nil if node.attribute('val').value == 'nil'
|
54
|
+
|
55
|
+
node.attributes.each do |key, value|
|
56
|
+
case key
|
57
|
+
when 'val'
|
58
|
+
@val = value.value.to_sym
|
59
|
+
when 'sz'
|
60
|
+
@size = OoxmlSize.new(value.value.to_f, :one_eighth_point)
|
61
|
+
when 'space'
|
62
|
+
@space = OoxmlSize.new(value.value.to_f, :point)
|
63
|
+
when 'color'
|
64
|
+
@color = value.value.to_s
|
65
|
+
@color = Color.new(parent: self).parse_hex_string(@color) if @color != 'auto'
|
66
|
+
when 'shadow'
|
67
|
+
@shadow = value.value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
self
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Helper methods for color
|
5
|
+
module ColorHelper
|
6
|
+
# Parse string in hex
|
7
|
+
# @param [String] hex_string with or without alpha-channel
|
8
|
+
def parse_hex_string(hex_string)
|
9
|
+
return self if %w[auto null].include?(hex_string)
|
10
|
+
|
11
|
+
char_array = hex_string.chars
|
12
|
+
case char_array.length
|
13
|
+
when 3
|
14
|
+
@red = char_array[0].hex
|
15
|
+
@green = char_array[1].hex
|
16
|
+
@blue = char_array[2].hex
|
17
|
+
when 6
|
18
|
+
@red = (char_array[0] + char_array[1]).hex
|
19
|
+
@green = (char_array[2] + char_array[3]).hex
|
20
|
+
@blue = (char_array[4] + char_array[5]).hex
|
21
|
+
when 8
|
22
|
+
@alpha_channel = (char_array[0] + char_array[1]).hex
|
23
|
+
@red = (char_array[2] + char_array[3]).hex
|
24
|
+
@green = (char_array[4] + char_array[5]).hex
|
25
|
+
@blue = (char_array[6] + char_array[7]).hex
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
# Convert color to HSLColor
|
31
|
+
# @return [HSLColor]
|
32
|
+
def to_hsl
|
33
|
+
hls_color = HSLColor.new
|
34
|
+
|
35
|
+
min = [red, green, blue].min.to_f
|
36
|
+
max = [red, green, blue].max.to_f
|
37
|
+
|
38
|
+
delta = (max - min).to_f
|
39
|
+
hls_color.l = (min + max) / 255.0 / 2.0
|
40
|
+
hls_color.alpha_channel = alpha_channel.to_f / 255.0
|
41
|
+
|
42
|
+
unless max == min
|
43
|
+
hls_color.s = delta / (255.0 - (255.0 - max - min).abs)
|
44
|
+
|
45
|
+
hls_color.h = if max == red && green >= blue
|
46
|
+
60.0 * (green - blue) / delta
|
47
|
+
elsif max == red && green < blue
|
48
|
+
60.0 * (green - blue) / delta + 360.0
|
49
|
+
elsif max == green
|
50
|
+
60.0 * (blue - red) / delta + 120.0
|
51
|
+
else
|
52
|
+
60.0 * (red - green) / delta + 240.0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
hls_color
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
000000
|
2
|
+
FFFFFF
|
3
|
+
FF0000
|
4
|
+
00FF00
|
5
|
+
0000FF
|
6
|
+
FFFF00
|
7
|
+
FF00FF
|
8
|
+
00FFFF
|
9
|
+
000000
|
10
|
+
FFFFFF
|
11
|
+
FF0000
|
12
|
+
00FF00
|
13
|
+
0000FF
|
14
|
+
FFFF00
|
15
|
+
FF00FF
|
16
|
+
00FFFF
|
17
|
+
800000
|
18
|
+
008000
|
19
|
+
000080
|
20
|
+
808000
|
21
|
+
800080
|
22
|
+
008080
|
23
|
+
C0C0C0
|
24
|
+
808080
|
25
|
+
9999FF
|
26
|
+
993366
|
27
|
+
FFFFCC
|
28
|
+
CCFFFF
|
29
|
+
660066
|
30
|
+
FF8080
|
31
|
+
0066CC
|
32
|
+
CCCCFF
|
33
|
+
000080
|
34
|
+
FF00FF
|
35
|
+
FFFF00
|
36
|
+
00FFFF
|
37
|
+
800080
|
38
|
+
800000
|
39
|
+
008080
|
40
|
+
0000FF
|
41
|
+
00CCFF
|
42
|
+
CCFFFF
|
43
|
+
CCFFCC
|
44
|
+
FFFF99
|
45
|
+
99CCFF
|
46
|
+
FF99CC
|
47
|
+
CC99FF
|
48
|
+
FFCC99
|
49
|
+
3366FF
|
50
|
+
33CCCC
|
51
|
+
99CC00
|
52
|
+
FFCC00
|
53
|
+
FF9900
|
54
|
+
FF6600
|
55
|
+
666699
|
56
|
+
969696
|
57
|
+
003366
|
58
|
+
339966
|
59
|
+
003300
|
60
|
+
333300
|
61
|
+
993300
|
62
|
+
993366
|
63
|
+
333399
|
64
|
+
333333
|
65
|
+
n/a
|
66
|
+
n/a
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OoxmlParser
|
4
|
+
# Class for parsing `color` tag
|
5
|
+
class OoxmlColor < OOXMLDocumentObject
|
6
|
+
# @return [Color] value of color
|
7
|
+
attr_reader :value
|
8
|
+
# @return [Symbol] theme color name
|
9
|
+
attr_reader :theme_color
|
10
|
+
# @return [Symbol] theme shade
|
11
|
+
attr_reader :theme_shade
|
12
|
+
# @return [Integer] theme index
|
13
|
+
attr_reader :theme
|
14
|
+
# @return [Float] tint
|
15
|
+
attr_reader :tint
|
16
|
+
# @return [Float] Indexed id
|
17
|
+
attr_reader :indexed
|
18
|
+
# @return [Color] rgb color
|
19
|
+
attr_reader :rgb
|
20
|
+
|
21
|
+
# Convert OoxmlColor to other color type
|
22
|
+
# @return [Object] result of conversion
|
23
|
+
def to_color
|
24
|
+
return Color.get_rgb_by_color_index(indexed) if indexed
|
25
|
+
return ThemeColors.new(parent: self).parse_color_theme(theme, tint) if theme
|
26
|
+
return rgb if rgb
|
27
|
+
|
28
|
+
value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Compare this object to other
|
32
|
+
# @param other [Object] any other object
|
33
|
+
# @return [True, False] result of comparision
|
34
|
+
def ==(other)
|
35
|
+
return to_color == other if other.is_a?(Color)
|
36
|
+
return to_color == other if other.is_a?(Symbol)
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
# Parse OoxmlColor object
|
42
|
+
# @param node [Nokogiri::XML:Element] node to parse
|
43
|
+
# @return [OoxmlColor] result of parsing
|
44
|
+
def parse(node)
|
45
|
+
node.attributes.each do |key, value|
|
46
|
+
case key
|
47
|
+
when 'val'
|
48
|
+
@value = Color.new.parse_hex_string(value.value.to_s)
|
49
|
+
when 'themeColor'
|
50
|
+
@theme_color = value.value.to_sym
|
51
|
+
when 'themeShade'
|
52
|
+
@theme_shade = Integer("0x#{value.value}")
|
53
|
+
when 'theme'
|
54
|
+
@theme = value.value.to_i
|
55
|
+
when 'tint'
|
56
|
+
@tint = value.value.to_f
|
57
|
+
when 'indexed'
|
58
|
+
@indexed = value.value.to_i
|
59
|
+
when 'rgb'
|
60
|
+
@rgb = Color.new.parse_hex_string(value.value)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,308 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'color/color_helper'
|
4
|
+
require_relative 'color/ooxml_color'
|
5
|
+
require_relative 'colors/color_alpha_channel'
|
6
|
+
require_relative 'colors/hsl_color'
|
7
|
+
require_relative 'colors/scheme_color'
|
8
|
+
require_relative 'colors/color_properties'
|
9
|
+
require_relative 'colors/theme_colors'
|
10
|
+
# @author Pavel.Lobashov
|
11
|
+
module OoxmlParser
|
12
|
+
# Class for Color in RGB
|
13
|
+
class Color < OOXMLDocumentObject
|
14
|
+
include ColorHelper
|
15
|
+
# @return [Integer] Value of Red Part
|
16
|
+
attr_accessor :red
|
17
|
+
# @return [Integer] Value of Green Part
|
18
|
+
attr_accessor :green
|
19
|
+
# @return [Integer] Value of Blue Part
|
20
|
+
attr_accessor :blue
|
21
|
+
# @return [String] Value of Color Style
|
22
|
+
attr_accessor :style
|
23
|
+
|
24
|
+
alias set_style style=
|
25
|
+
# @return [String] color scheme of color
|
26
|
+
attr_accessor :scheme
|
27
|
+
|
28
|
+
# @return [Integer] Value of alpha-channel
|
29
|
+
attr_accessor :alpha_channel
|
30
|
+
|
31
|
+
alias set_alpha_channel alpha_channel=
|
32
|
+
|
33
|
+
# @return [ColorProperties] properties of color
|
34
|
+
attr_accessor :properties
|
35
|
+
|
36
|
+
# Value of color if non selected
|
37
|
+
VALUE_FOR_NONE_COLOR = nil
|
38
|
+
|
39
|
+
def initialize(new_red = VALUE_FOR_NONE_COLOR,
|
40
|
+
new_green = VALUE_FOR_NONE_COLOR,
|
41
|
+
new_blue = VALUE_FOR_NONE_COLOR,
|
42
|
+
parent: nil)
|
43
|
+
@red = new_red
|
44
|
+
@green = new_green
|
45
|
+
@blue = new_blue
|
46
|
+
super(parent: parent)
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [String] result of convert of object to string
|
50
|
+
def to_s
|
51
|
+
if @red == VALUE_FOR_NONE_COLOR && @green == VALUE_FOR_NONE_COLOR && @blue == VALUE_FOR_NONE_COLOR
|
52
|
+
'none'
|
53
|
+
else
|
54
|
+
"RGB (#{@red}, #{@green}, #{@blue})"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [String] inspect of object for debug means
|
59
|
+
def inspect
|
60
|
+
to_s
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [String] color in hex value
|
64
|
+
def to_hex
|
65
|
+
(@red.to_s(16).rjust(2, '0') + @green.to_s(16).rjust(2, '0') + @blue.to_s(16).rjust(2, '0')).upcase
|
66
|
+
end
|
67
|
+
|
68
|
+
alias to_int16 to_hex
|
69
|
+
|
70
|
+
# @return [True, False] is color default
|
71
|
+
def none?
|
72
|
+
(@red == VALUE_FOR_NONE_COLOR) && (@green == VALUE_FOR_NONE_COLOR) && (@blue == VALUE_FOR_NONE_COLOR) ||
|
73
|
+
(style == :nil)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [True, False] is color not default
|
77
|
+
def any?
|
78
|
+
!none?
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [True, False] is color white
|
82
|
+
def white?
|
83
|
+
(@red == 255) && (@green == 255) && (@blue == 255)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Method to copy object
|
87
|
+
# @return [Color] copied object
|
88
|
+
def copy
|
89
|
+
Color.new(@red, @green, @blue)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Compare this object to other
|
93
|
+
# @param other [Object] any other object
|
94
|
+
# @return [True, False] result of comparision
|
95
|
+
def ==(other)
|
96
|
+
if other.is_a?(Color)
|
97
|
+
((@red == other.red) && (@green == other.green) && (@blue == other.blue)) ||
|
98
|
+
(none? && other.white?) ||
|
99
|
+
(white? && other.none?)
|
100
|
+
else
|
101
|
+
false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# To compare color, which look alike
|
106
|
+
# @param [String or Color] color_to_check color to compare
|
107
|
+
# @param [Integer] delta max delta for each of specters
|
108
|
+
def looks_like?(color_to_check = nil, delta = 8)
|
109
|
+
color_to_check = color_to_check.converted_color if color_to_check.is_a?(SchemeColor)
|
110
|
+
color_to_check = color_to_check.pattern_fill.foreground_folor if color_to_check.is_a?(Fill)
|
111
|
+
color_to_check = color_to_check.color.converted_color if color_to_check.is_a?(PresentationFill)
|
112
|
+
color_to_check = Color.parse(color_to_check) if color_to_check.is_a?(String)
|
113
|
+
color_to_check = Color.parse(color_to_check.to_s) if color_to_check.is_a?(Symbol)
|
114
|
+
color_to_check = Color.parse(color_to_check.value) if color_to_check.is_a?(DocxColor)
|
115
|
+
return true if none? && color_to_check.nil?
|
116
|
+
return true if none? && color_to_check.none?
|
117
|
+
return false if none? && color_to_check.any?
|
118
|
+
return false if !none? && color_to_check.none?
|
119
|
+
return true if self == color_to_check
|
120
|
+
|
121
|
+
red = color_to_check.red
|
122
|
+
green = color_to_check.green
|
123
|
+
blue = color_to_check.blue
|
124
|
+
(self.red - red).abs < delta && (self.green - green).abs < delta && (self.blue - blue).abs < delta
|
125
|
+
end
|
126
|
+
|
127
|
+
# Apply tint to color
|
128
|
+
# @param tint [Integer] tint to apply
|
129
|
+
# @return [void]
|
130
|
+
def calculate_with_tint!(tint)
|
131
|
+
@red += (tint.to_f * (255 - @red)).to_i
|
132
|
+
@green += (tint.to_f * (255 - @green)).to_i
|
133
|
+
@blue += (tint.to_f * (255 - @blue)).to_i
|
134
|
+
end
|
135
|
+
|
136
|
+
# Apply shade to color
|
137
|
+
# @param shade [Integer] shade to apply
|
138
|
+
# @return [void]
|
139
|
+
def calculate_with_shade!(shade)
|
140
|
+
@red = (@red * shade.to_f).to_i
|
141
|
+
@green = (@green * shade.to_f).to_i
|
142
|
+
@blue = (@blue * shade.to_f).to_i
|
143
|
+
end
|
144
|
+
|
145
|
+
# Parse color scheme data
|
146
|
+
# @param scheme_color_node [Nokogiri::XML:Element] node to parse
|
147
|
+
# @return [Color] result of parsing
|
148
|
+
def parse_scheme_color(scheme_color_node)
|
149
|
+
color = root_object.theme.color_scheme[scheme_color_node.attribute('val').value.to_sym].color
|
150
|
+
hls = color.to_hsl
|
151
|
+
scheme_name = nil
|
152
|
+
scheme_color_node.xpath('*').each do |scheme_color_node_child|
|
153
|
+
case scheme_color_node_child.name
|
154
|
+
when 'lumMod'
|
155
|
+
hls.l = hls.l * (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
156
|
+
when 'lumOff'
|
157
|
+
hls.l = hls.l + (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
scheme_color_node.attributes.each do |key, value|
|
161
|
+
case key
|
162
|
+
when 'val'
|
163
|
+
scheme_name = value.to_s
|
164
|
+
end
|
165
|
+
end
|
166
|
+
color = hls.to_rgb
|
167
|
+
@red = color.red
|
168
|
+
@green = color.green
|
169
|
+
@blue = color.blue
|
170
|
+
@alpha_channel = ColorAlphaChannel.parse(scheme_color_node)
|
171
|
+
@scheme = scheme_name
|
172
|
+
self
|
173
|
+
end
|
174
|
+
|
175
|
+
# Parse color model data
|
176
|
+
# @param color_model_parent_node [Nokogiri::XML:Element] node to parse
|
177
|
+
# @return [Color] result of parsing
|
178
|
+
def parse_color_model(color_model_parent_node)
|
179
|
+
color = nil
|
180
|
+
tint = nil
|
181
|
+
color_model_parent_node.xpath('*').each do |color_model_node|
|
182
|
+
color_model_node.xpath('*').each do |color_mode_node_child|
|
183
|
+
case color_mode_node_child.name
|
184
|
+
when 'tint'
|
185
|
+
tint = color_mode_node_child.attribute('val').value.to_f / 100_000.0
|
186
|
+
end
|
187
|
+
end
|
188
|
+
case color_model_node.name
|
189
|
+
when 'srgbClr'
|
190
|
+
color = Color.new.parse_hex_string(color_model_node.attribute('val').value)
|
191
|
+
color.alpha_channel = ColorAlphaChannel.parse(color_model_node)
|
192
|
+
when 'schemeClr'
|
193
|
+
color = Color.new(parent: self).parse_scheme_color(color_model_node)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
return nil unless color
|
197
|
+
|
198
|
+
color.calculate_with_tint!(1.0 - tint) if tint
|
199
|
+
@red = color.red
|
200
|
+
@green = color.green
|
201
|
+
@blue = color.blue
|
202
|
+
@alpha_channel = color.alpha_channel
|
203
|
+
@scheme = color.scheme
|
204
|
+
self
|
205
|
+
end
|
206
|
+
|
207
|
+
# Parse color data
|
208
|
+
# @param color_node [Nokogiri::XML:Element] node to parse
|
209
|
+
# @return [Color] result of parsing
|
210
|
+
def parse_color(color_node)
|
211
|
+
case color_node.name
|
212
|
+
when 'srgbClr'
|
213
|
+
color = parse_hex_string(color_node.attribute('val').value)
|
214
|
+
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
215
|
+
color
|
216
|
+
when 'schemeClr'
|
217
|
+
color = SchemeColor.new(parent: parent)
|
218
|
+
return ValuedChild.new(:string, parent: parent).parse(color_node) unless root_object.theme
|
219
|
+
|
220
|
+
color.value = root_object.theme.color_scheme[color_node.attribute('val').value.to_sym].color
|
221
|
+
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
222
|
+
color.converted_color = Color.new(parent: self).parse_scheme_color(color_node)
|
223
|
+
color.value.calculate_with_tint!(1.0 - color.properties.tint) if color.properties.tint
|
224
|
+
color
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
class << self
|
229
|
+
# @return [Color] random color
|
230
|
+
def generate_random_color
|
231
|
+
Color.new(rand(256), rand(256), rand(256))
|
232
|
+
end
|
233
|
+
|
234
|
+
alias random generate_random_color
|
235
|
+
|
236
|
+
# Read array of color from the AllTestData's constant
|
237
|
+
# @param [Array] const_array_name - array of the string
|
238
|
+
# @return [Array, Color] array of color
|
239
|
+
def array_from_const(const_array_name)
|
240
|
+
const_array_name.map { |current_color| Color.parse_string(current_color) }
|
241
|
+
end
|
242
|
+
|
243
|
+
# @param index [Integer] index to get
|
244
|
+
# @return [Color] color by it's index
|
245
|
+
def get_rgb_by_color_index(index)
|
246
|
+
color_by_index = color_indexes[index]
|
247
|
+
return :unknown if color_by_index.nil?
|
248
|
+
|
249
|
+
color_by_index == 'n/a' ? Color.new : Color.new.parse_hex_string(color_by_index)
|
250
|
+
end
|
251
|
+
|
252
|
+
# @return [Array] Deprecated Indexed colors
|
253
|
+
# List of color duplicated from `OpenXML Sdk IndexedColors` class
|
254
|
+
# See https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.indexedcolors.aspx
|
255
|
+
def color_indexes
|
256
|
+
@color_indexes ||= File.readlines("#{__dir__}/color/color_indexes.list", chomp: true)
|
257
|
+
end
|
258
|
+
|
259
|
+
# Parse color from string
|
260
|
+
# @param str [String] string to parse
|
261
|
+
# @return [Color] result of parsing
|
262
|
+
def parse_string(str)
|
263
|
+
return str if str.is_a?(Color)
|
264
|
+
return Color.new(VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR) if str == 'none' || str == '' || str == 'transparent' || str.nil?
|
265
|
+
|
266
|
+
split = if str.include?('RGB (') || str.include?('rgb(')
|
267
|
+
str.gsub(/[(RGBrgb) ]/, '').split(',')
|
268
|
+
elsif str.include?('RGB ') || str.include?('rgb')
|
269
|
+
str.gsub(/RGB |rgb/, '').split(', ')
|
270
|
+
else
|
271
|
+
raise "Incorrect data for color to parse: '#{str}'"
|
272
|
+
end
|
273
|
+
|
274
|
+
Color.new(split[0].to_i, split[1].to_i, split[2].to_i)
|
275
|
+
end
|
276
|
+
|
277
|
+
alias parse parse_string
|
278
|
+
|
279
|
+
# Convert other object type to Color
|
280
|
+
# @param something [Object] object to convert
|
281
|
+
# @return [Color] result of conversion
|
282
|
+
def to_color(something)
|
283
|
+
case something
|
284
|
+
when SchemeColor
|
285
|
+
something.converted_color
|
286
|
+
when DocxColorScheme
|
287
|
+
something.color
|
288
|
+
when Fill
|
289
|
+
something.to_color
|
290
|
+
when PresentationFill
|
291
|
+
if something.color.respond_to? :converted_color
|
292
|
+
something.color.converted_color
|
293
|
+
else
|
294
|
+
something.color
|
295
|
+
end
|
296
|
+
when String
|
297
|
+
Color.parse(something)
|
298
|
+
when Symbol
|
299
|
+
Color.parse(something.to_s)
|
300
|
+
when DocxColor
|
301
|
+
Color.parse(something.value)
|
302
|
+
else
|
303
|
+
something
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|