ooxml_parser 0.4.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ooxml_parser.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +39 -4
- 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/pivot_formats/pivot_format.rb +26 -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/plot_area/common_chart_data.rb +31 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +22 -9
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/{string_reference.rb → number_string_reference.rb} +9 -7
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/{string_cache.rb → number_string_cache.rb} +11 -6
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +9 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +2 -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/view_3d.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +7 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +12 -8
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +26 -14
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +8 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +7 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +3 -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 +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +2 -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 +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -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 +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
- 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 +2 -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 +2 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +6 -2
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -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 +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -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 +2 -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 +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +3 -3
- data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +25 -9
- data/lib/ooxml_parser/common_parser/common_data/color.rb +119 -71
- data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
- data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +12 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +23 -8
- data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +6 -1
- data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +18 -14
- data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/content_types.rb +38 -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/coordinates.rb +18 -6
- data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
- data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +42 -3
- data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
- 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/paragraph.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +27 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -16
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +25 -35
- 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/tabs.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
- data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +6 -8
- data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +10 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +10 -2
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +3 -0
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +8 -5
- data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +11 -11
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +27 -39
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
- data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +5 -0
- data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
- data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_data/underline.rb +6 -0
- data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
- data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
- data/lib/ooxml_parser/common_parser/parser.rb +6 -2
- data/lib/ooxml_parser/configuration.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +100 -41
- 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/comment.rb +37 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +11 -12
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +93 -82
- 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.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +30 -23
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +15 -4
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -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 +6 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +3 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +12 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +7 -2
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +16 -14
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +5 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +14 -1
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
- data/lib/ooxml_parser/docx_parser/docx_parser.rb +6 -0
- data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
- data/lib/ooxml_parser/name.rb +9 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +32 -37
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -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/presentation_comments.rb +33 -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_helpers.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +12 -3
- 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/font_scheme/font_collection.rb +31 -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/theme_color.rb +14 -8
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +11 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +7 -4
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
- 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_helper.rb +19 -1
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +6 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
- 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_size.rb +2 -0
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
- data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +7 -1
- data/lib/ooxml_parser/version.rb +4 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +57 -38
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +6 -1
- 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_cache/pivot_cache_definition.rb +37 -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/cache_source/worksheet_source.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/shared_string_table/string_index.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +15 -1
- 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/{worksheet/xlsx_row/xlsx_cell → style_sheet/cell_xfs}/cell_style/alignment.rb +2 -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/fills.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +4 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +5 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -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/xlsx_borders/xlsx_border.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +56 -25
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +32 -29
- 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 +10 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -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 +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -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/custom_filters/custom_filter.rb +26 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -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_columns/table_column.rb +34 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -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 +12 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
- 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_parser.rb +7 -1
- metadata +147 -29
- data/LICENSE.txt +0 -661
- data/README.md +0 -43
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +0 -20
- data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +0 -30
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +0 -28
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +0 -21
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +0 -20
- data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +0 -20
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +0 -31
- data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +0 -26
- data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +0 -128
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'docx_color'
|
2
4
|
require_relative 'docx_shape_size'
|
3
5
|
require_relative 'docx_shape_line'
|
@@ -5,10 +7,10 @@ require_relative 'docx_shape_properties/blip_fill'
|
|
5
7
|
require_relative 'docx_shape_properties/preset_geometry'
|
6
8
|
require_relative 'docx_shape_properties/text_box'
|
7
9
|
require_relative 'custom_geometry/ooxml_custom_geometry'
|
8
|
-
# DOCX Shape Properties
|
9
10
|
module OoxmlParser
|
11
|
+
# DOCX Shape Properties
|
10
12
|
class DocxShapeProperties < OOXMLDocumentObject
|
11
|
-
attr_accessor :shape_size, :preset_geometry, :fill_color, :
|
13
|
+
attr_accessor :shape_size, :preset_geometry, :fill_color, :line, :custom_geometry
|
12
14
|
attr_accessor :blip_fill
|
13
15
|
|
14
16
|
alias transform shape_size
|
@@ -31,8 +33,6 @@ module OoxmlParser
|
|
31
33
|
@shape_size = DocxShapeSize.new(parent: self).parse(node_child)
|
32
34
|
when 'prstGeom'
|
33
35
|
@preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
|
34
|
-
when 'txbx'
|
35
|
-
@text_box = TextBox.parse_list(node_child)
|
36
36
|
when 'ln'
|
37
37
|
@line = DocxShapeLine.new(parent: self).parse(node_child)
|
38
38
|
when 'blipFill'
|
@@ -1,5 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module OoxmlParser
|
4
|
+
# Class for working with TextBox (w:txbxContent)
|
3
5
|
class TextBox
|
4
6
|
# Parse TextBox List
|
5
7
|
# @param [Nokogiri::XML:Node] node with TextBox
|
@@ -7,16 +9,15 @@ module OoxmlParser
|
|
7
9
|
def self.parse_list(node, parent: nil)
|
8
10
|
elements = []
|
9
11
|
text_box_content_node = node.xpath('w:txbxContent').first
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
|
13
|
+
text_box_content_node&.xpath('*')&.each_with_index do |textbox_element, i|
|
14
|
+
case textbox_element.name
|
15
|
+
when 'p'
|
16
|
+
DocumentStructure.default_paragraph_style = DocxParagraph.new
|
17
|
+
DocumentStructure.default_paragraph_style.spacing = Spacing.new(0, 0.35, 1.15, :multiple)
|
18
|
+
elements << DocumentStructure.default_paragraph_style.dup.parse(textbox_element, i, parent: parent)
|
19
|
+
when 'tbl'
|
20
|
+
elements << Table.new(parent: parent).parse(textbox_element, i)
|
20
21
|
end
|
21
22
|
end
|
22
23
|
elements
|
@@ -1,9 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module OoxmlParser
|
4
|
+
# Docx Shape Size
|
3
5
|
class DocxShapeSize < OOXMLDocumentObject
|
4
|
-
attr_accessor :rotation, :
|
6
|
+
attr_accessor :rotation, :offset, :extent
|
5
7
|
attr_accessor :child_offset
|
6
8
|
attr_accessor :child_extent
|
9
|
+
# @return [True, False] is image flipped horizontally
|
10
|
+
attr_reader :flip_horizontal
|
11
|
+
# @return [True, False] is image flipped vertically
|
12
|
+
attr_reader :flip_vertical
|
7
13
|
|
8
14
|
alias extents extent
|
9
15
|
|
@@ -14,11 +20,11 @@ module OoxmlParser
|
|
14
20
|
node.attributes.each do |key, value|
|
15
21
|
case key
|
16
22
|
when 'rot'
|
17
|
-
@rotation = value.value.to_f
|
23
|
+
@rotation = OoxmlSize.new(value.value.to_f, :one_60000th_degree)
|
18
24
|
when 'flipH'
|
19
|
-
@flip_horizontal = value
|
25
|
+
@flip_horizontal = attribute_enabled?(value)
|
20
26
|
when 'flipV'
|
21
|
-
@flip_vertical = value
|
27
|
+
@flip_vertical = attribute_enabled?(value)
|
22
28
|
end
|
23
29
|
end
|
24
30
|
node.xpath('*').each do |node_child|
|
data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'old_docx_group_properties'
|
2
4
|
require_relative 'old_docx_group_element'
|
3
|
-
# Fallback DOCX group data
|
4
5
|
module OoxmlParser
|
6
|
+
# Fallback DOCX group data
|
5
7
|
class OldDocxGroup < OOXMLDocumentObject
|
6
8
|
attr_accessor :elements, :properties
|
7
9
|
|
data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'shape/old_docx_shape'
|
2
4
|
require_relative 'shape/old_docx_shape_fill'
|
3
5
|
require_relative 'group/old_docx_group'
|
4
6
|
module OoxmlParser
|
5
7
|
# Fallback DOCX Picture
|
6
8
|
class OldDocxPicture < OOXMLDocumentObject
|
7
|
-
attr_accessor :data, :type
|
9
|
+
attr_accessor :data, :type
|
8
10
|
|
9
11
|
# Parse OldDocxPicture object
|
10
12
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -18,8 +20,6 @@ module OoxmlParser
|
|
18
20
|
when 'group'
|
19
21
|
@type = :group
|
20
22
|
@data = OldDocxGroup.new(parent: self).parse(node_child)
|
21
|
-
when 'style'
|
22
|
-
@style_number = node_child.attribute('val').value.to_i
|
23
23
|
end
|
24
24
|
end
|
25
25
|
self
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OoxmlParser
|
2
4
|
# Fallback DOCX Shape Properties
|
3
5
|
class OldDocxShapeProperties < OOXMLDocumentObject
|
4
|
-
attr_accessor :fill_color, :
|
6
|
+
attr_accessor :fill_color, :stroke_color, :stroke_weight
|
5
7
|
|
6
8
|
# Parse OldDocxShapeProperties object
|
7
9
|
# @param node [Nokogiri::XML:Element] node to parse
|
@@ -11,8 +13,6 @@ module OoxmlParser
|
|
11
13
|
case key
|
12
14
|
when 'fillcolor'
|
13
15
|
@fill_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
|
14
|
-
when 'opacity'
|
15
|
-
@opacity = value.value.to_f
|
16
16
|
when 'strokecolor'
|
17
17
|
@stroke_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
|
18
18
|
when 'strokeweight'
|
@@ -1,33 +1,48 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module OoxmlParser
|
4
|
+
# Border Properties Data
|
3
5
|
class BordersProperties < OOXMLDocumentObject
|
4
|
-
attr_accessor :color, :space, :
|
6
|
+
attr_accessor :color, :space, :val, :shadow, :frame, :side
|
7
|
+
# @return [OoxmlSize] size of border
|
8
|
+
attr_reader :size
|
5
9
|
|
6
|
-
def initialize(color = :auto,
|
10
|
+
def initialize(color = :auto, size = 0, val = :none, space = 0, parent: nil)
|
7
11
|
@color = color
|
8
|
-
@
|
12
|
+
@size = size
|
9
13
|
@val = val
|
10
14
|
@space = space
|
11
15
|
@parent = parent
|
12
16
|
end
|
13
17
|
|
14
|
-
alias
|
18
|
+
# @return [OoxmlSize] alias for sz
|
19
|
+
def sz
|
20
|
+
size
|
21
|
+
end
|
22
|
+
|
23
|
+
extend Gem::Deprecate
|
24
|
+
deprecate :sz, 'size', 2020, 1
|
15
25
|
|
16
26
|
def nil?
|
17
|
-
|
27
|
+
size.zero? && val == :none
|
18
28
|
end
|
19
29
|
|
30
|
+
# @return [String] result of convert of object to string
|
20
31
|
def to_s
|
21
32
|
return '' if nil?
|
22
|
-
|
33
|
+
|
34
|
+
"borders color: #{@color}, size: #{size}, space: #{@space}, value: #{@val}"
|
23
35
|
end
|
24
36
|
|
37
|
+
# Method to copy object
|
38
|
+
# @return [BordersProperties] copied object
|
25
39
|
def copy
|
26
|
-
BordersProperties.new(@color,
|
40
|
+
BordersProperties.new(@color, size, @val, @space)
|
27
41
|
end
|
28
42
|
|
29
43
|
def visible?
|
30
44
|
return false if nil?
|
45
|
+
|
31
46
|
val != 'none'
|
32
47
|
end
|
33
48
|
|
@@ -36,12 +51,13 @@ module OoxmlParser
|
|
36
51
|
# @return [BordersProperties] value of BordersProperties
|
37
52
|
def parse(node)
|
38
53
|
return nil if node.attribute('val').value == 'nil'
|
54
|
+
|
39
55
|
node.attributes.each do |key, value|
|
40
56
|
case key
|
41
57
|
when 'val'
|
42
58
|
@val = value.value.to_sym
|
43
59
|
when 'sz'
|
44
|
-
@
|
60
|
+
@size = OoxmlSize.new(value.value.to_f, :one_eighth_point)
|
45
61
|
when 'space'
|
46
62
|
@space = OoxmlSize.new(value.value.to_f, :point)
|
47
63
|
when 'color'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'color/color_helper'
|
2
4
|
require_relative 'color/ooxml_color'
|
3
5
|
require_relative 'colors/color_alpha_channel'
|
@@ -6,8 +8,8 @@ require_relative 'colors/scheme_color'
|
|
6
8
|
require_relative 'colors/color_properties'
|
7
9
|
require_relative 'colors/theme_colors'
|
8
10
|
# @author Pavel.Lobashov
|
9
|
-
# Class for Color in RGB
|
10
11
|
module OoxmlParser
|
12
|
+
# Class for Color in RGB
|
11
13
|
class Color < OOXMLDocumentObject
|
12
14
|
include ColorHelper
|
13
15
|
# @return [Array] Deprecated Indexed colors
|
@@ -91,12 +93,14 @@ module OoxmlParser
|
|
91
93
|
attr_accessor :blue
|
92
94
|
# @return [String] Value of Color Style
|
93
95
|
attr_accessor :style
|
96
|
+
|
94
97
|
alias set_style style=
|
95
98
|
# @return [String] color scheme of color
|
96
99
|
attr_accessor :scheme
|
97
100
|
|
98
101
|
# @return [Integer] Value of alpha-channel
|
99
102
|
attr_accessor :alpha_channel
|
103
|
+
|
100
104
|
alias set_alpha_channel alpha_channel=
|
101
105
|
|
102
106
|
attr_accessor :position
|
@@ -115,6 +119,7 @@ module OoxmlParser
|
|
115
119
|
@parent = parent
|
116
120
|
end
|
117
121
|
|
122
|
+
# @return [String] result of convert of object to string
|
118
123
|
def to_s
|
119
124
|
if @red == VALUE_FOR_NONE_COLOR && @green == VALUE_FOR_NONE_COLOR && @blue == VALUE_FOR_NONE_COLOR
|
120
125
|
'none'
|
@@ -123,38 +128,46 @@ module OoxmlParser
|
|
123
128
|
end
|
124
129
|
end
|
125
130
|
|
131
|
+
# @return [String] inspect of object for debug means
|
126
132
|
def inspect
|
127
133
|
to_s
|
128
134
|
end
|
129
135
|
|
136
|
+
# @return [String] color in hex value
|
130
137
|
def to_hex
|
131
138
|
(@red.to_s(16).rjust(2, '0') + @green.to_s(16).rjust(2, '0') + @blue.to_s(16).rjust(2, '0')).upcase
|
132
139
|
end
|
133
140
|
|
134
141
|
alias to_int16 to_hex
|
135
142
|
|
143
|
+
# @return [True, False] is color default
|
136
144
|
def none?
|
137
145
|
(@red == VALUE_FOR_NONE_COLOR) && (@green == VALUE_FOR_NONE_COLOR) && (@blue == VALUE_FOR_NONE_COLOR) ||
|
138
146
|
(style == :nil)
|
139
147
|
end
|
140
148
|
|
149
|
+
# @return [True, False] is color not default
|
141
150
|
def any?
|
142
151
|
!none?
|
143
152
|
end
|
144
153
|
|
154
|
+
# @return [True, False] is color white
|
145
155
|
def white?
|
146
156
|
(@red == 255) && (@green == 255) && (@blue == 255)
|
147
157
|
end
|
148
158
|
|
159
|
+
# Method to copy object
|
160
|
+
# @return [Color] copied object
|
149
161
|
def copy
|
150
162
|
Color.new(@red, @green, @blue)
|
151
163
|
end
|
152
164
|
|
165
|
+
# Compare this object to other
|
166
|
+
# @param other [Object] any other object
|
167
|
+
# @return [True, False] result of comparision
|
153
168
|
def ==(other)
|
154
169
|
if other.is_a?(Color)
|
155
|
-
if
|
156
|
-
false
|
157
|
-
elsif (@red == other.red) && (@green == other.green) && (@blue == other.blue)
|
170
|
+
if (@red == other.red) && (@green == other.green) && (@blue == other.blue)
|
158
171
|
true
|
159
172
|
elsif (none? && other.white?) || (white? && other.none?)
|
160
173
|
true
|
@@ -181,25 +194,116 @@ module OoxmlParser
|
|
181
194
|
return false if none? && color_to_check.any?
|
182
195
|
return false if !none? && color_to_check.none?
|
183
196
|
return true if self == color_to_check
|
197
|
+
|
184
198
|
red = color_to_check.red
|
185
199
|
green = color_to_check.green
|
186
200
|
blue = color_to_check.blue
|
187
201
|
(self.red - red).abs < delta && (self.green - green).abs < delta && (self.blue - blue).abs < delta ? true : false
|
188
202
|
end
|
189
203
|
|
204
|
+
# Apply tint to color
|
205
|
+
# @param tint [Integer] tint to apply
|
206
|
+
# @return [void]
|
190
207
|
def calculate_with_tint!(tint)
|
191
208
|
@red += (tint.to_f * (255 - @red)).to_i
|
192
209
|
@green += (tint.to_f * (255 - @green)).to_i
|
193
210
|
@blue += (tint.to_f * (255 - @blue)).to_i
|
194
211
|
end
|
195
212
|
|
213
|
+
# Apply shade to color
|
214
|
+
# @param shade [Integer] shade to apply
|
215
|
+
# @return [void]
|
196
216
|
def calculate_with_shade!(shade)
|
197
217
|
@red = (@red * shade.to_f).to_i
|
198
218
|
@green = (@green * shade.to_f).to_i
|
199
219
|
@blue = (@blue * shade.to_f).to_i
|
200
220
|
end
|
201
221
|
|
222
|
+
# Parse color scheme data
|
223
|
+
# @param scheme_color_node [Nokogiri::XML:Element] node to parse
|
224
|
+
# @return [Color] result of parsing
|
225
|
+
def parse_scheme_color(scheme_color_node)
|
226
|
+
color = root_object.theme.color_scheme[scheme_color_node.attribute('val').value.to_sym].color
|
227
|
+
hls = HSLColor.rgb_to_hsl(color)
|
228
|
+
scheme_name = nil
|
229
|
+
scheme_color_node.xpath('*').each do |scheme_color_node_child|
|
230
|
+
case scheme_color_node_child.name
|
231
|
+
when 'lumMod'
|
232
|
+
hls.l = hls.l * (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
233
|
+
when 'lumOff'
|
234
|
+
hls.l = hls.l + (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
scheme_color_node.attributes.each do |key, value|
|
238
|
+
case key
|
239
|
+
when 'val'
|
240
|
+
scheme_name = value.to_s
|
241
|
+
end
|
242
|
+
end
|
243
|
+
color = hls.to_rgb
|
244
|
+
@red = color.red
|
245
|
+
@green = color.green
|
246
|
+
@blue = color.blue
|
247
|
+
@alpha_channel = ColorAlphaChannel.parse(scheme_color_node)
|
248
|
+
@scheme = scheme_name
|
249
|
+
self
|
250
|
+
end
|
251
|
+
|
252
|
+
# Parse color model data
|
253
|
+
# @param color_model_parent_node [Nokogiri::XML:Element] node to parse
|
254
|
+
# @return [Color] result of parsing
|
255
|
+
def parse_color_model(color_model_parent_node)
|
256
|
+
color = nil
|
257
|
+
tint = nil
|
258
|
+
color_model_parent_node.xpath('*').each do |color_model_node|
|
259
|
+
color_model_node.xpath('*').each do |color_mode_node_child|
|
260
|
+
case color_mode_node_child.name
|
261
|
+
when 'tint'
|
262
|
+
tint = color_mode_node_child.attribute('val').value.to_f / 100_000.0
|
263
|
+
end
|
264
|
+
end
|
265
|
+
case color_model_node.name
|
266
|
+
when 'srgbClr'
|
267
|
+
color = Color.new.parse_hex_string(color_model_node.attribute('val').value)
|
268
|
+
color.alpha_channel = ColorAlphaChannel.parse(color_model_node)
|
269
|
+
when 'schemeClr'
|
270
|
+
color = Color.new(parent: self).parse_scheme_color(color_model_node)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
return nil unless color
|
274
|
+
|
275
|
+
color.calculate_with_tint!(1.0 - tint) if tint
|
276
|
+
@red = color.red
|
277
|
+
@green = color.green
|
278
|
+
@blue = color.blue
|
279
|
+
@alpha_channel = color.alpha_channel
|
280
|
+
@scheme = color.scheme
|
281
|
+
self
|
282
|
+
end
|
283
|
+
|
284
|
+
# Parse color data
|
285
|
+
# @param color_node [Nokogiri::XML:Element] node to parse
|
286
|
+
# @return [Color] result of parsing
|
287
|
+
def parse_color(color_node)
|
288
|
+
case color_node.name
|
289
|
+
when 'srgbClr'
|
290
|
+
color = parse_hex_string(color_node.attribute('val').value)
|
291
|
+
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
292
|
+
color
|
293
|
+
when 'schemeClr'
|
294
|
+
color = SchemeColor.new(parent: parent)
|
295
|
+
return ValuedChild.new(:string, parent: parent).parse(color_node) unless root_object.theme
|
296
|
+
|
297
|
+
color.value = root_object.theme.color_scheme[color_node.attribute('val').value.to_sym].color
|
298
|
+
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
299
|
+
color.converted_color = Color.new(parent: self).parse_scheme_color(color_node)
|
300
|
+
color.value.calculate_with_tint!(1.0 - color.properties.tint) if color.properties.tint
|
301
|
+
color
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
202
305
|
class << self
|
306
|
+
# @return [Color] random color
|
203
307
|
def generate_random_color
|
204
308
|
Color.new(rand(256), rand(256), rand(256))
|
205
309
|
end
|
@@ -213,17 +317,24 @@ module OoxmlParser
|
|
213
317
|
const_array_name.map { |current_color| Color.parse_string(current_color) }
|
214
318
|
end
|
215
319
|
|
320
|
+
# @param index [Integer] index to get
|
321
|
+
# @return [Color] color by it's index
|
216
322
|
def get_rgb_by_color_index(index)
|
217
323
|
color_by_index = COLOR_INDEXED[index]
|
218
324
|
return :unknown if color_by_index.nil?
|
325
|
+
|
219
326
|
color_by_index == 'n/a' ? Color.new : Color.new.parse_hex_string(color_by_index)
|
220
327
|
end
|
221
328
|
|
329
|
+
# Parse color from string
|
330
|
+
# @param str [String] string to parse
|
331
|
+
# @return [Color] result of parsing
|
222
332
|
def parse_string(str)
|
223
333
|
return str if str.is_a?(Color)
|
224
334
|
return Color.new(VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR, VALUE_FOR_NONE_COLOR) if str == 'none' || str == '' || str == 'transparent' || str.nil?
|
335
|
+
|
225
336
|
split = if str.include?('RGB (') || str.include?('rgb(')
|
226
|
-
str.gsub(/[(RGBrgb
|
337
|
+
str.gsub(/[(RGBrgb() )]/, '').split(',')
|
227
338
|
elsif str.include?('RGB ') || str.include?('rgb')
|
228
339
|
str.gsub(/RGB |rgb/, '').split(', ')
|
229
340
|
else
|
@@ -235,6 +346,9 @@ module OoxmlParser
|
|
235
346
|
|
236
347
|
alias parse parse_string
|
237
348
|
|
349
|
+
# Convert other object type to Color
|
350
|
+
# @param something [Object] object to convert
|
351
|
+
# @return [Color] result of conversion
|
238
352
|
def to_color(something)
|
239
353
|
case something
|
240
354
|
when SchemeColor
|
@@ -259,72 +373,6 @@ module OoxmlParser
|
|
259
373
|
something
|
260
374
|
end
|
261
375
|
end
|
262
|
-
|
263
|
-
def parse_scheme_color(scheme_color_node)
|
264
|
-
color = ThemeColors.list[scheme_color_node.attribute('val').value.to_sym]
|
265
|
-
hls = HSLColor.rgb_to_hsl(color)
|
266
|
-
scheme_name = nil
|
267
|
-
scheme_color_node.xpath('*').each do |scheme_color_node_child|
|
268
|
-
case scheme_color_node_child.name
|
269
|
-
when 'lumMod'
|
270
|
-
hls.l = hls.l * (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
271
|
-
when 'lumOff'
|
272
|
-
hls.l = hls.l + (scheme_color_node_child.attribute('val').value.to_f / 100_000.0)
|
273
|
-
end
|
274
|
-
end
|
275
|
-
scheme_color_node.attributes.each do |key, value|
|
276
|
-
case key
|
277
|
-
when 'val'
|
278
|
-
scheme_name = value.to_s
|
279
|
-
end
|
280
|
-
end
|
281
|
-
color = hls.to_rgb
|
282
|
-
color.alpha_channel = ColorAlphaChannel.parse(scheme_color_node)
|
283
|
-
color.scheme = scheme_name
|
284
|
-
color
|
285
|
-
end
|
286
|
-
|
287
|
-
def parse_color_model(color_model_parent_node)
|
288
|
-
color = nil
|
289
|
-
tint = nil
|
290
|
-
color_model_parent_node.xpath('*').each do |color_model_node|
|
291
|
-
color_model_node.xpath('*').each do |color_mode_node_child|
|
292
|
-
case color_mode_node_child.name
|
293
|
-
when 'tint'
|
294
|
-
tint = color_mode_node_child.attribute('val').value.to_f / 100_000.0
|
295
|
-
end
|
296
|
-
end
|
297
|
-
case color_model_node.name
|
298
|
-
when 'scrgbClr'
|
299
|
-
color = Color.new(color_model_node.attribute('r').value.to_i, color_model_node.attribute('g').value.to_i, color_model_node.attribute('b').value.to_i)
|
300
|
-
color.alpha_channel = ColorAlphaChannel.parse(color_model_node)
|
301
|
-
when 'srgbClr'
|
302
|
-
color = Color.new.parse_hex_string(color_model_node.attribute('val').value)
|
303
|
-
color.alpha_channel = ColorAlphaChannel.parse(color_model_node)
|
304
|
-
when 'schemeClr'
|
305
|
-
color = parse_scheme_color(color_model_node)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
return nil unless color
|
309
|
-
color.calculate_with_tint!(1.0 - tint) if tint
|
310
|
-
color
|
311
|
-
end
|
312
|
-
|
313
|
-
def parse_color(color_node)
|
314
|
-
case color_node.name
|
315
|
-
when 'srgbClr'
|
316
|
-
color = Color.new.parse_hex_string(color_node.attribute('val').value)
|
317
|
-
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
318
|
-
color
|
319
|
-
when 'schemeClr'
|
320
|
-
color = SchemeColor.new
|
321
|
-
color.value = ThemeColors.list[color_node.attribute('val').value.to_sym]
|
322
|
-
color.properties = ColorProperties.new(parent: color).parse(color_node)
|
323
|
-
color.converted_color = parse_scheme_color(color_node)
|
324
|
-
color.value.calculate_with_tint!(1.0 - color.properties.tint) if color.properties.tint
|
325
|
-
color
|
326
|
-
end
|
327
|
-
end
|
328
376
|
end
|
329
377
|
end
|
330
378
|
end
|