openxml-drawingml 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/openxml/drawingml.rb +11 -0
- data/lib/openxml/drawingml/elements.rb +1 -1
- data/lib/openxml/drawingml/elements/adjust_values_list.rb +2 -2
- data/lib/openxml/drawingml/elements/blip.rb +3 -3
- data/lib/openxml/drawingml/elements/blip_fill.rb +1 -2
- data/lib/openxml/drawingml/elements/children_extents.rb +2 -1
- data/lib/openxml/drawingml/elements/children_offset.rb +2 -1
- data/lib/openxml/drawingml/elements/extension.rb +2 -1
- data/lib/openxml/drawingml/elements/extension_list.rb +2 -2
- data/lib/openxml/drawingml/elements/extents.rb +2 -1
- data/lib/openxml/drawingml/elements/fill_rectangle.rb +2 -1
- data/lib/openxml/drawingml/elements/graphic.rb +4 -1
- data/lib/openxml/drawingml/elements/graphic_data.rb +3 -1
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +3 -1
- data/lib/openxml/drawingml/elements/head_end.rb +3 -1
- data/lib/openxml/drawingml/elements/line_break.rb +89 -0
- data/lib/openxml/drawingml/elements/no_autofit.rb +2 -2
- data/lib/openxml/drawingml/elements/no_fill.rb +3 -1
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +1 -1
- data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +1 -2
- data/lib/openxml/drawingml/elements/non_visual_picture_properties.rb +1 -2
- data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +1 -2
- data/lib/openxml/drawingml/elements/offset.rb +1 -1
- data/lib/openxml/drawingml/elements/outline.rb +2 -2
- data/lib/openxml/drawingml/elements/paragraph.rb +78 -0
- data/lib/openxml/drawingml/elements/picture.rb +1 -2
- data/lib/openxml/drawingml/elements/picture_locks.rb +1 -1
- data/lib/openxml/drawingml/elements/picture_shape_properties.rb +1 -2
- data/lib/openxml/drawingml/elements/preset_geometry.rb +2 -2
- data/lib/openxml/drawingml/elements/preset_text_warp.rb +1 -2
- data/lib/openxml/drawingml/elements/round.rb +4 -1
- data/lib/openxml/drawingml/elements/run.rb +85 -0
- data/lib/openxml/drawingml/elements/shape_guide.rb +1 -1
- data/lib/openxml/drawingml/elements/solid_fill.rb +3 -1
- data/lib/openxml/drawingml/elements/source_rectangle.rb +1 -1
- data/lib/openxml/drawingml/elements/srgb_color.rb +2 -1
- data/lib/openxml/drawingml/elements/stretch.rb +2 -2
- data/lib/openxml/drawingml/elements/tail_end.rb +3 -1
- data/lib/openxml/drawingml/elements/text.rb +21 -0
- data/lib/openxml/drawingml/elements/theme_elements.rb +4 -1
- data/lib/openxml/drawingml/elements/transform_effect.rb +1 -2
- data/lib/openxml/drawingml/parts.rb +10 -0
- data/lib/openxml/drawingml/parts/theme.rb +46 -0
- data/lib/openxml/drawingml/properties.rb +24 -0
- data/lib/openxml/drawingml/properties/audio_cd.rb +16 -0
- data/lib/openxml/drawingml/properties/audio_cd_end.rb +13 -0
- data/lib/openxml/drawingml/properties/audio_cd_start.rb +13 -0
- data/lib/openxml/drawingml/properties/audio_cd_time_property.rb +11 -0
- data/lib/openxml/drawingml/properties/audio_file.rb +13 -0
- data/lib/openxml/drawingml/properties/autofit_none.rb +11 -0
- data/lib/openxml/drawingml/properties/autofit_normal.rb +14 -0
- data/lib/openxml/drawingml/properties/autofit_shape.rb +11 -0
- data/lib/openxml/drawingml/properties/background_fill_style_list.rb +14 -0
- data/lib/openxml/drawingml/properties/blip.rb +27 -0
- data/lib/openxml/drawingml/properties/body_properties.rb +81 -0
- data/lib/openxml/drawingml/properties/bullet_color.rb +13 -0
- data/lib/openxml/drawingml/properties/bullet_color_text.rb +11 -0
- data/lib/openxml/drawingml/properties/bullet_font.rb +13 -0
- data/lib/openxml/drawingml/properties/bullet_font_text.rb +11 -0
- data/lib/openxml/drawingml/properties/bullet_size_percent.rb +20 -0
- data/lib/openxml/drawingml/properties/bullet_size_points.rb +20 -0
- data/lib/openxml/drawingml/properties/bullet_size_text.rb +11 -0
- data/lib/openxml/drawingml/properties/bullet_style_auto_numbered.rb +27 -0
- data/lib/openxml/drawingml/properties/bullet_style_blip.rb +12 -0
- data/lib/openxml/drawingml/properties/bullet_style_character.rb +13 -0
- data/lib/openxml/drawingml/properties/bullet_style_none.rb +11 -0
- data/lib/openxml/drawingml/properties/child_extent.rb +13 -0
- data/lib/openxml/drawingml/properties/child_offset.rb +13 -0
- data/lib/openxml/drawingml/properties/color_component_rgb.rb +17 -0
- data/lib/openxml/drawingml/properties/color_container_property.rb +17 -0
- data/lib/openxml/drawingml/properties/color_hex_rgb.rb +20 -0
- data/lib/openxml/drawingml/properties/color_hsl.rb +17 -0
- data/lib/openxml/drawingml/properties/color_mapping.rb +31 -0
- data/lib/openxml/drawingml/properties/color_mapping_override.rb +16 -0
- data/lib/openxml/drawingml/properties/color_mapping_override_map.rb +13 -0
- data/lib/openxml/drawingml/properties/color_mapping_override_master.rb +11 -0
- data/lib/openxml/drawingml/properties/color_preset_color.rb +51 -0
- data/lib/openxml/drawingml/properties/color_property.rb +40 -0
- data/lib/openxml/drawingml/properties/color_scheme.rb +29 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_five.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_four.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_one.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_six.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_three.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_accent_two.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_color.rb +25 -0
- data/lib/openxml/drawingml/properties/color_scheme_dark_one.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_dark_two.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_followed_hyperlink.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_hyperlink.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_light_one.rb +13 -0
- data/lib/openxml/drawingml/properties/color_scheme_light_two.rb +13 -0
- data/lib/openxml/drawingml/properties/color_system_color.rb +30 -0
- data/lib/openxml/drawingml/properties/color_xform_alpha.rb +19 -0
- data/lib/openxml/drawingml/properties/color_xform_alpha_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_alpha_offset.rb +19 -0
- data/lib/openxml/drawingml/properties/color_xform_blue.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_blue_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_blue_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_complement.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_gamma.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_grayscale.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_green.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_green_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_green_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_hue.rb +20 -0
- data/lib/openxml/drawingml/properties/color_xform_hue_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_hue_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_inverse.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_inverse_gamma.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_luminance.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_luminance_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_luminance_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_red.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_red_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_red_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_saturation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_saturation_modulation.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_saturation_offset.rb +11 -0
- data/lib/openxml/drawingml/properties/color_xform_shade.rb +19 -0
- data/lib/openxml/drawingml/properties/color_xform_tint.rb +19 -0
- data/lib/openxml/drawingml/properties/complex_script_font.rb +13 -0
- data/lib/openxml/drawingml/properties/connection.rb +11 -0
- data/lib/openxml/drawingml/properties/connection_end.rb +13 -0
- data/lib/openxml/drawingml/properties/connection_shape_locks.rb +24 -0
- data/lib/openxml/drawingml/properties/connection_start.rb +13 -0
- data/lib/openxml/drawingml/properties/custom_color.rb +13 -0
- data/lib/openxml/drawingml/properties/custom_color_list.rb +14 -0
- data/lib/openxml/drawingml/properties/custom_dash_style.rb +14 -0
- data/lib/openxml/drawingml/properties/custom_geometry.rb +18 -0
- data/lib/openxml/drawingml/properties/dash_stop.rb +14 -0
- data/lib/openxml/drawingml/properties/default_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/default_run_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/default_shape_properties.rb +15 -0
- data/lib/openxml/drawingml/properties/east_asian_font.rb +13 -0
- data/lib/openxml/drawingml/properties/effect_dag.rb +20 -0
- data/lib/openxml/drawingml/properties/effect_list.rb +17 -0
- data/lib/openxml/drawingml/properties/effect_reference.rb +13 -0
- data/lib/openxml/drawingml/properties/effect_style.rb +18 -0
- data/lib/openxml/drawingml/properties/effect_style_list.rb +14 -0
- data/lib/openxml/drawingml/properties/embedded_sound_file.rb +14 -0
- data/lib/openxml/drawingml/properties/extension.rb +14 -0
- data/lib/openxml/drawingml/properties/extension_list.rb +14 -0
- data/lib/openxml/drawingml/properties/extent.rb +29 -0
- data/lib/openxml/drawingml/properties/external_media_file.rb +15 -0
- data/lib/openxml/drawingml/properties/extra_color_scheme.rb +14 -0
- data/lib/openxml/drawingml/properties/extra_color_scheme_list.rb +14 -0
- data/lib/openxml/drawingml/properties/fill_blip.rb +22 -0
- data/lib/openxml/drawingml/properties/fill_gradient.rb +24 -0
- data/lib/openxml/drawingml/properties/fill_group.rb +11 -0
- data/lib/openxml/drawingml/properties/fill_none.rb +11 -0
- data/lib/openxml/drawingml/properties/fill_pattern.rb +23 -0
- data/lib/openxml/drawingml/properties/fill_rectangle.rb +13 -0
- data/lib/openxml/drawingml/properties/fill_reference.rb +13 -0
- data/lib/openxml/drawingml/properties/fill_solid.rb +13 -0
- data/lib/openxml/drawingml/properties/fill_style_list.rb +19 -0
- data/lib/openxml/drawingml/properties/fill_to_rectangle.rb +13 -0
- data/lib/openxml/drawingml/properties/flat_text.rb +39 -0
- data/lib/openxml/drawingml/properties/font_collection_property.rb +16 -0
- data/lib/openxml/drawingml/properties/font_property.rb +29 -0
- data/lib/openxml/drawingml/properties/font_reference.rb +13 -0
- data/lib/openxml/drawingml/properties/font_scheme.rb +18 -0
- data/lib/openxml/drawingml/properties/format_scheme.rb +19 -0
- data/lib/openxml/drawingml/properties/geometry_guide.rb +14 -0
- data/lib/openxml/drawingml/properties/geometry_guide_list.rb +14 -0
- data/lib/openxml/drawingml/properties/gradient_line.rb +14 -0
- data/lib/openxml/drawingml/properties/gradient_path.rb +16 -0
- data/lib/openxml/drawingml/properties/gradient_stop.rb +13 -0
- data/lib/openxml/drawingml/properties/gradient_stop_list.rb +14 -0
- data/lib/openxml/drawingml/properties/graphic.rb +13 -0
- data/lib/openxml/drawingml/properties/graphic_data.rb +14 -0
- data/lib/openxml/drawingml/properties/graphic_frame_locks.rb +20 -0
- data/lib/openxml/drawingml/properties/group_shape_locks.rb +22 -0
- data/lib/openxml/drawingml/properties/group_transform.rb +16 -0
- data/lib/openxml/drawingml/properties/head_end.rb +13 -0
- data/lib/openxml/drawingml/properties/highlight.rb +13 -0
- data/lib/openxml/drawingml/properties/hyperlink_click.rb +13 -0
- data/lib/openxml/drawingml/properties/hyperlink_hover.rb +13 -0
- data/lib/openxml/drawingml/properties/hyperlink_mouse_over.rb +13 -0
- data/lib/openxml/drawingml/properties/hyperlink_property.rb +22 -0
- data/lib/openxml/drawingml/properties/integer_property.rb +12 -0
- data/lib/openxml/drawingml/properties/latin_font.rb +13 -0
- data/lib/openxml/drawingml/properties/level1_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level2_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level3_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level4_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level5_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level6_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level7_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level8_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/level9_paragraph_properties.rb +13 -0
- data/lib/openxml/drawingml/properties/line_default.rb +13 -0
- data/lib/openxml/drawingml/properties/line_end_properties.rb +12 -0
- data/lib/openxml/drawingml/properties/line_join_bevel.rb +11 -0
- data/lib/openxml/drawingml/properties/line_join_miter.rb +31 -0
- data/lib/openxml/drawingml/properties/line_join_round.rb +11 -0
- data/lib/openxml/drawingml/properties/line_property.rb +43 -0
- data/lib/openxml/drawingml/properties/line_spacing.rb +16 -0
- data/lib/openxml/drawingml/properties/line_style_list.rb +14 -0
- data/lib/openxml/drawingml/properties/list_style.rb +24 -0
- data/lib/openxml/drawingml/properties/major_font.rb +13 -0
- data/lib/openxml/drawingml/properties/minor_font.rb +13 -0
- data/lib/openxml/drawingml/properties/object_defaults.rb +17 -0
- data/lib/openxml/drawingml/properties/offset.rb +29 -0
- data/lib/openxml/drawingml/properties/outline.rb +13 -0
- data/lib/openxml/drawingml/properties/outline_reference.rb +13 -0
- data/lib/openxml/drawingml/properties/paragraph_properties.rb +78 -0
- data/lib/openxml/drawingml/properties/path.rb +49 -0
- data/lib/openxml/drawingml/properties/path_list.rb +14 -0
- data/lib/openxml/drawingml/properties/percentage_property.rb +17 -0
- data/lib/openxml/drawingml/properties/picture_locks.rb +25 -0
- data/lib/openxml/drawingml/properties/positive_integer_property.rb +12 -0
- data/lib/openxml/drawingml/properties/positive_percentage_property.rb +17 -0
- data/lib/openxml/drawingml/properties/preset_dash_style.rb +16 -0
- data/lib/openxml/drawingml/properties/preset_geometry.rb +59 -0
- data/lib/openxml/drawingml/properties/preset_text_warp.rb +25 -0
- data/lib/openxml/drawingml/properties/quick_time_file.rb +17 -0
- data/lib/openxml/drawingml/properties/relative_rectangle_property.rb +13 -0
- data/lib/openxml/drawingml/properties/right_to_left.rb +11 -0
- data/lib/openxml/drawingml/properties/run_properties.rb +93 -0
- data/lib/openxml/drawingml/properties/scene_3d.rb +17 -0
- data/lib/openxml/drawingml/properties/shape_adjustment_list.rb +14 -0
- data/lib/openxml/drawingml/properties/shape_default.rb +13 -0
- data/lib/openxml/drawingml/properties/shape_locks.rb +25 -0
- data/lib/openxml/drawingml/properties/shape_properties.rb +46 -0
- data/lib/openxml/drawingml/properties/shape_style.rb +16 -0
- data/lib/openxml/drawingml/properties/simple_boolean_property.rb +16 -0
- data/lib/openxml/drawingml/properties/simple_property_container_property.rb +14 -0
- data/lib/openxml/drawingml/properties/source_rectangle.rb +13 -0
- data/lib/openxml/drawingml/properties/space_after.rb +22 -0
- data/lib/openxml/drawingml/properties/space_before.rb +22 -0
- data/lib/openxml/drawingml/properties/spacing_percent.rb +11 -0
- data/lib/openxml/drawingml/properties/spacing_points.rb +20 -0
- data/lib/openxml/drawingml/properties/stretch.rb +13 -0
- data/lib/openxml/drawingml/properties/style_matrix_reference_property.rb +20 -0
- data/lib/openxml/drawingml/properties/supplemental_font.rb +14 -0
- data/lib/openxml/drawingml/properties/symbol_font.rb +13 -0
- data/lib/openxml/drawingml/properties/tab_list.rb +14 -0
- data/lib/openxml/drawingml/properties/tab_stop.rb +29 -0
- data/lib/openxml/drawingml/properties/tail_end.rb +13 -0
- data/lib/openxml/drawingml/properties/text_body.rb +15 -0
- data/lib/openxml/drawingml/properties/text_default.rb +13 -0
- data/lib/openxml/drawingml/properties/theme_elements.rb +16 -0
- data/lib/openxml/drawingml/properties/tile.rb +35 -0
- data/lib/openxml/drawingml/properties/tile_rectangle.rb +13 -0
- data/lib/openxml/drawingml/properties/transform.rb +19 -0
- data/lib/openxml/drawingml/properties/underline.rb +13 -0
- data/lib/openxml/drawingml/properties/underline_fill.rb +20 -0
- data/lib/openxml/drawingml/properties/underline_fill_text.rb +11 -0
- data/lib/openxml/drawingml/properties/underline_text.rb +11 -0
- data/lib/openxml/drawingml/properties/value_property.rb +12 -0
- data/lib/openxml/drawingml/properties/video_file.rb +13 -0
- data/lib/openxml/drawingml/properties/wav_audio_file.rb +13 -0
- data/lib/openxml/drawingml/version.rb +1 -1
- data/openxml-drawingml.gemspec +3 -3
- metadata +222 -5
- data/lib/openxml/drawingml/element.rb +0 -9
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class ParagraphProperties < OpenXml::Properties::ComplexProperty
|
|
5
|
+
include OpenXml::ContainsProperties
|
|
6
|
+
namespace :a
|
|
7
|
+
tag :pPr
|
|
8
|
+
|
|
9
|
+
attribute :alignment, displays_as: :algn, one_of: %i{ ctr dist just justLow l r thaiDist }
|
|
10
|
+
attribute :default_tab_size, displays_as: :defTabSz, expects: :coordinate
|
|
11
|
+
attribute :east_asian_line_break, displays_as: :eaLnBrk, expects: :boolean
|
|
12
|
+
attribute :vertical_alignment, displays_as: :fontAlgn, one_of: %i{ auto b base ctr t }
|
|
13
|
+
attribute :hanging_punctuation, displays_as: :hangingPunct, expects: :boolean
|
|
14
|
+
attribute :indent, expects: :indent_range
|
|
15
|
+
attribute :latin_line_break, displays_as: :latinLnBrk, expects: :boolean
|
|
16
|
+
attribute :level, displays_as: :lvl, in_range: 0..8
|
|
17
|
+
attribute :left_margin, displays_as: :marL, expects: :text_margin
|
|
18
|
+
attribute :right_margin, displays_as: :marR, expects: :text_margin
|
|
19
|
+
attribute :right_to_left, displays_as: :rtl, expects: :boolean
|
|
20
|
+
|
|
21
|
+
property :line_spacing
|
|
22
|
+
property :space_before
|
|
23
|
+
property :space_after
|
|
24
|
+
|
|
25
|
+
property_choice do
|
|
26
|
+
property :bullet_color
|
|
27
|
+
value_property :bullet_color_matches_text, as: :bullet_color_text
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
property_choice do
|
|
31
|
+
value_property :bullet_size_matches_text, as: :bullet_size_text
|
|
32
|
+
value_property :bullet_size_percent
|
|
33
|
+
value_property :bullet_size_points
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
property_choice do
|
|
37
|
+
value_property :bullet_font_matches_text, as: :bullet_font_text
|
|
38
|
+
value_property :bullet_font
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
property_choice do
|
|
42
|
+
value_property :disable_bullets, as: :bullet_style_none
|
|
43
|
+
property :autonumbered_bullets, as: :bullet_style_auto_numbered
|
|
44
|
+
property :character_bullets, as: :bullet_style_character
|
|
45
|
+
property :blip_bullets, as: :bullet_style_blip
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
property :tab_list
|
|
49
|
+
property :default_run_properties
|
|
50
|
+
property :extension_list
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def coordinate(value)
|
|
55
|
+
message = "Invalid coordinate: Must either be an integer or include units"
|
|
56
|
+
is_integer = value.is_a?(Integer)
|
|
57
|
+
is_measure = value.is_a?(String) && value =~ OpenXml::DrawingML::ST_UniversalMeasure
|
|
58
|
+
raise ArgumentError, message unless is_integer || is_measure
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def indent_range(value)
|
|
62
|
+
message = "Invalid indentation range: Must be an integer between -51,206,400 and 51,206,400 or include units"
|
|
63
|
+
is_integer_in_range = value.is_a?(Integer) && (-51_206_400..51_206_400).cover?(value)
|
|
64
|
+
is_measure = value.is_a?(String) && value =~ OpenXml::DrawingML::ST_UniversalMeasure
|
|
65
|
+
raise ArgumentError, message unless is_integer_in_range || is_measure
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def text_margin(value)
|
|
69
|
+
message = "Invalid text margin: Must be an integer between 0 and 51,206,400 or include units"
|
|
70
|
+
is_integer_in_range = value.is_a?(Integer) && (0..51_206_400).cover?(value)
|
|
71
|
+
is_measure = value.is_a?(String) && value =~ OpenXml::DrawingML::ST_PositiveUniversalMeasure
|
|
72
|
+
raise ArgumentError, message unless is_integer_in_range || is_measure
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# require "openxml/drawingml/properties/path_close"
|
|
2
|
+
# require "openxml/drawingml/properties/path_move_to"
|
|
3
|
+
# require "openxml/drawingml/properties/path_line_to"
|
|
4
|
+
# require "openxml/drawingml/properties/path_arc_to"
|
|
5
|
+
# require "openxml/drawingml/properties/path_quadratic_bezier_to"
|
|
6
|
+
# require "openxml/drawingml/properties/path_cubic_bezier_to"
|
|
7
|
+
|
|
8
|
+
module OpenXml
|
|
9
|
+
module DrawingML
|
|
10
|
+
module Properties
|
|
11
|
+
class Path < OpenXml::Properties::ContainerProperty
|
|
12
|
+
include OpenXml::HasAttributes
|
|
13
|
+
namespace :a
|
|
14
|
+
tag :path
|
|
15
|
+
# TODO: Implement child classes
|
|
16
|
+
# child_classes :path_close, :path_move_to, :path_line_to, :path_arc_to,
|
|
17
|
+
# :path_quadradic_bezier_to, :cubic_bezier_to
|
|
18
|
+
|
|
19
|
+
FILL_MODES = %i{ none norm lighten lightenLess darken darkenLess }.freeze
|
|
20
|
+
|
|
21
|
+
attribute :width, displays_as: :w, expects: :positive_coordinate
|
|
22
|
+
attribute :height, displays_as: :h, expects: :positive_coordinate
|
|
23
|
+
attribute :fill_mode, displays_as: :fill, one_of: FILL_MODES
|
|
24
|
+
attribute :stroked, displays_as: :stroke, expects: :boolean
|
|
25
|
+
attribute :extrusion_ok, displays_as: :extrusionOk, expects: :boolean
|
|
26
|
+
|
|
27
|
+
def render?
|
|
28
|
+
attributes.keys.map(&method(:send)).any? { |value| !value.nil? } || super
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def positive_coordinate(value)
|
|
34
|
+
message = "Invalid coordinate: should either be an integer (in EMUs) or include a unit"
|
|
35
|
+
raise ArgumentError, message unless positive_universal_measure?(value) || positive_integer?(value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def positive_universal_measure?(value)
|
|
39
|
+
value.is_a?(String) && value =~ OpenXml::DrawingML::ST_PositiveUniversalMeasure
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def positive_integer?(value)
|
|
43
|
+
value.is_a?(Integer) && value >= 0
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PercentageProperty < ValueProperty
|
|
5
|
+
|
|
6
|
+
def valid?
|
|
7
|
+
value =~ OpenXml::DrawingML::ST_Percentage
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def invalid_message
|
|
11
|
+
"#{value.inspect} is an invalid value for #{name}; it must be a percentage"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PictureLocks < OpenXml::Properties::ComplexProperty
|
|
5
|
+
include OpenXml::ContainsProperties
|
|
6
|
+
namespace :a
|
|
7
|
+
tag :picLocks
|
|
8
|
+
|
|
9
|
+
attribute :disable_grouping, displays_as: :noGrp, expects: :boolean
|
|
10
|
+
attribute :disable_selection, displays_as: :noSelect, expects: :boolean
|
|
11
|
+
attribute :disable_rotation, displays_as: :noRot, expects: :boolean
|
|
12
|
+
attribute :disable_aspect_ratio_change, displays_as: :noChangeAspect, expects: :boolean
|
|
13
|
+
attribute :disable_moving, displays_as: :noMove, expects: :boolean
|
|
14
|
+
attribute :disable_resizing, displays_as: :noResize, expects: :boolean
|
|
15
|
+
attribute :disable_edit_points, displays_as: :noEditPoints, expects: :boolean
|
|
16
|
+
attribute :disable_adjustment_handles, displays_as: :noAdjustHandles, expects: :boolean
|
|
17
|
+
attribute :disable_change_arrowheads, displays_as: :noChangeArrowheads, expects: :boolean
|
|
18
|
+
attribute :disable_cropping, displays_as: :noCrop, expects: :boolean
|
|
19
|
+
|
|
20
|
+
property :extension_list
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PositivePercentageProperty < ValueProperty
|
|
5
|
+
|
|
6
|
+
def valid?
|
|
7
|
+
value =~ OpenXml::DrawingML::ST_PositivePercentage
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def invalid_message
|
|
11
|
+
"#{value.inspect} is an invalid value for #{name}; it must be a positive percentage"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PresetDashStyle < ValueProperty
|
|
5
|
+
namespace :a
|
|
6
|
+
tag :prstDash
|
|
7
|
+
|
|
8
|
+
def ok_values
|
|
9
|
+
%i{ dash dashDot dot lgDash lgDashDot lgDashDotDot solid sysDash
|
|
10
|
+
sysDashDot sysDashDotDot sysDot }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PresetGeometry < OpenXml::Properties::ComplexProperty
|
|
5
|
+
include OpenXml::ContainsProperties
|
|
6
|
+
namespace :a
|
|
7
|
+
tag :prstGeom
|
|
8
|
+
|
|
9
|
+
PRESET_GEOMETRIES = %i{
|
|
10
|
+
accentBorderCallout1 accentBorderCallout2 accentBorderCallout3
|
|
11
|
+
accentCallout1 accentCallout2 accentCallout3 actionButtonBackPrevious
|
|
12
|
+
actionButtonBeginning actionButtonBlank actionButtonDocument
|
|
13
|
+
actionButtonEnd actionButtonForwardNext actionButtonHelp
|
|
14
|
+
actionButtonHome actionButtonInformation actionButtonMovie
|
|
15
|
+
actionButtonReturn actionButtonSound arc bentArrow bentConnector2
|
|
16
|
+
bentConnector3 bentConnector4 bentConnector5 bentUpArrow bevel
|
|
17
|
+
blockArc borderCallout1 borderCallout2 borderCallout3 bracePair
|
|
18
|
+
bracketPair callout1 callout2 callout3 can chartPlus chartStar chartX
|
|
19
|
+
chevron chord circularArrow cloud cloudCallout corner cornerTabs cube
|
|
20
|
+
curvedConnector2 curvedConnector3 curvedConnector4 curvedConnector5
|
|
21
|
+
curvedDownArrow curvedLeftArrow curvedRightArrow curvedUpArrow
|
|
22
|
+
decagon diagStripe diamond dodecagon donut doubleWave downArrow
|
|
23
|
+
downArrowCallout ellipse ellipseRibbon ellipseRibbon2
|
|
24
|
+
flowChartAlternateProcess flowChartCollate flowChartConnector
|
|
25
|
+
flowChartDecision flowChartDelay flowChartDisplay flowChartDocument
|
|
26
|
+
flowChartExtract flowChartInputOutput flowChartInternalStorage
|
|
27
|
+
flowChartMagneticDisk flowChartMagneticDrum flowChartMagneticTape
|
|
28
|
+
flowChartManualInput flowChartManualOperation flowChartMerge
|
|
29
|
+
flowChartMultidocument flowChartOfflineStorage flowChartOffpageConnector
|
|
30
|
+
flowChartOnlineStorage flowChartOr flowChartPredefinedProcess
|
|
31
|
+
flowChartPreparation flowChartProcess flowChartPunchedCard
|
|
32
|
+
flowChartPunchedTape flowChartSort flowChartSummingJunction
|
|
33
|
+
flowChartTerminator foldedCorner frame funnel gear6 gear9 halfFrame
|
|
34
|
+
heart heptagon hexagon homePlate horizontalScroll irregularSeal1
|
|
35
|
+
irregularSeal2 leftArrow leftArrowCallout leftBrace leftBracket
|
|
36
|
+
leftCircularArrow leftRightArrow leftRightArrowCallout
|
|
37
|
+
leftRightCircularArrow leftRightRibbon leftRightUpArrow leftUpArrow
|
|
38
|
+
lightningBolt line lineInv mathDivide mathEqual mathMinu mathMultiply
|
|
39
|
+
mathNotEqual mathPlus moon nonIsoscelesTrapezoid noSmoking
|
|
40
|
+
notchedRightArrow octagon parallelogram pentagon pie pieWedge plaque
|
|
41
|
+
plaqueTabs plus quadArrow quadArrowCallout rect ribbon ribbon2
|
|
42
|
+
rightArrow rightArrowCallout rightBrace rightBracket round1Rect
|
|
43
|
+
round2DiagRect round2SameRect roundRect rtTriangle smileyFace
|
|
44
|
+
snip1Rect snip2DiagRect snip2SameRect snipRoundRect squareTabs star10
|
|
45
|
+
star12 star16 star24 star32 star4 star5 star6 star7 star8
|
|
46
|
+
straightConnector1 stripedRightArrow sun swooshArrow teardrop
|
|
47
|
+
trapezoid triangle upArrow upArrowCallout upDownArrow upDownArrowCallout
|
|
48
|
+
uturnArrow verticalScroll wave wedgeEllipseCallout wedgeRectCallout
|
|
49
|
+
wedgeRoundRectCallout
|
|
50
|
+
}.freeze
|
|
51
|
+
|
|
52
|
+
attribute :shape, displays_as: :prst, one_of: PRESET_GEOMETRIES
|
|
53
|
+
|
|
54
|
+
property :shape_adjustment_list
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class PresetTextWarp < OpenXml::Properties::ComplexProperty
|
|
5
|
+
namespace :a
|
|
6
|
+
tag :prstTxWarp
|
|
7
|
+
|
|
8
|
+
PRESET_WARPS = %i{
|
|
9
|
+
textArchDown textArchDownPour textArchUp textArchUpPour textButton
|
|
10
|
+
textButtonPour textCanDown textCanUp textCascadeDown textCascadeUp
|
|
11
|
+
textChevron textChevronInverted textCircle textCirclePour
|
|
12
|
+
textCurveDown textCurveUp textDeflate textDeflateBottom
|
|
13
|
+
textDeflateInflate textDeflateInflateDeflate textDeflateTop
|
|
14
|
+
textDoubleWave1 textFadeDown textFadeLeft textFadeRight textFadeUp
|
|
15
|
+
textInflate textInflateBottom textInflateTop textNoShape textPlain
|
|
16
|
+
textRingInside textRingOutside textSlantDown textSlantUp textStop
|
|
17
|
+
textTriangle textTriangleInverted textWave1 textWave2 textWave4
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
attribute :preset, displays_as: :prst, one_of: PRESET_WARPS
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class QuickTimeFile < OpenXml::Properties::ComplexProperty
|
|
5
|
+
include OpenXml::ContainsProperties
|
|
6
|
+
namespace :a
|
|
7
|
+
tag :quickTimeFile
|
|
8
|
+
|
|
9
|
+
attribute :link, namespace: :r, expects: :string, required: true
|
|
10
|
+
|
|
11
|
+
property :extension_list
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class RelativeRectangleProperty < OpenXml::Properties::ComplexProperty
|
|
5
|
+
attribute :bottom_offset, displays_as: :b, expects: :percentage
|
|
6
|
+
attribute :left_offset, displays_as: :l, expects: :percentage
|
|
7
|
+
attribute :right_offset, displays_as: :r, expects: :percentage
|
|
8
|
+
attribute :top_offset, displays_as: :t, expects: :percentage
|
|
9
|
+
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Properties
|
|
4
|
+
class RunProperties < OpenXml::Properties::ComplexProperty
|
|
5
|
+
include OpenXml::ContainsProperties
|
|
6
|
+
namespace :a
|
|
7
|
+
tag :rPr
|
|
8
|
+
|
|
9
|
+
UNDERLINE_STYLES = %i{
|
|
10
|
+
dash dashHeavy dashLong dashLongHeavy dbl dotDash dotDashHeavy
|
|
11
|
+
dotDotDash dotDotDashHeavy dotted dottedHeavy heavy none sng wavy
|
|
12
|
+
wavyDbl wavyHeavy words
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
attribute :alternative_language, displays_as: :altLang, expects: :string
|
|
16
|
+
attribute :bold, displays_as: :b, expects: :boolean
|
|
17
|
+
attribute :baseline, expects: :percentage
|
|
18
|
+
attribute :bookmark_target, displays_as: :bmk, expects: :string
|
|
19
|
+
attribute :capitalization, displays_as: :cap, one_of: %i{ all none small }
|
|
20
|
+
attribute :dirty, expects: :boolean
|
|
21
|
+
attribute :spelling_error, displays_as: :err, expects: :boolean
|
|
22
|
+
attribute :italic, displays_as: :i, expects: :boolean
|
|
23
|
+
attribute :kerning, displays_as: :kern, expects: :integer, in_range: (0..400_000)
|
|
24
|
+
attribute :kumimoji, expects: :boolean
|
|
25
|
+
attribute :language, displays_as: :lang, expects: :string
|
|
26
|
+
attribute :no_proofing, displays_as: :noProof, expects: :boolean
|
|
27
|
+
attribute :normalize_heights, displays_as: :normalizeH, expects: :boolean
|
|
28
|
+
attribute :smart_tag_clean, displays_as: :smtClean, expects: :boolean
|
|
29
|
+
attribute :smart_tag_id, displays_as: :smtId, expects: :positive_integer
|
|
30
|
+
attribute :spacing, displays_as: :spc, expects: :point
|
|
31
|
+
attribute :strikethrough, displays_as: :strike, one_of: %i{ dblStrike noStrike sngStrike }
|
|
32
|
+
attribute :font_size, displays_as: :sz, expects: :integer, in_range: (100..400_000)
|
|
33
|
+
attribute :underline_style, displays_as: :u, one_of: UNDERLINE_STYLES
|
|
34
|
+
|
|
35
|
+
property :outline
|
|
36
|
+
|
|
37
|
+
property_choice do
|
|
38
|
+
value_property :no_fill, as: :fill_none
|
|
39
|
+
property :solid_fill, as: :fill_solid
|
|
40
|
+
property :gradient_fill, as: :fill_gradient
|
|
41
|
+
property :pattern_fill, as: :fill_pattern
|
|
42
|
+
property :blip_fill, as: :fill_blip
|
|
43
|
+
value_property :inherit_group_fill, as: :fill_group
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
property_choice do
|
|
47
|
+
property :effect_list
|
|
48
|
+
property :effect_dag
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
property :highlight
|
|
52
|
+
|
|
53
|
+
property_choice do
|
|
54
|
+
value_property :underline_inherits, as: :underline_text
|
|
55
|
+
property :underline
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
property_choice do
|
|
59
|
+
value_property :underline_fill_inherits, as: :underline_fill_text
|
|
60
|
+
property :underline_fill
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
value_property :latin_font
|
|
64
|
+
value_property :east_asian_font
|
|
65
|
+
value_property :complex_script_font
|
|
66
|
+
value_property :symbol_font
|
|
67
|
+
|
|
68
|
+
property :hyperlink_click
|
|
69
|
+
property :hyperlink_mouse_over
|
|
70
|
+
|
|
71
|
+
value_property :right_to_left
|
|
72
|
+
|
|
73
|
+
property :extension_list
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def point(value)
|
|
78
|
+
message = "Invalid point: Must either be an integer between -400,000 and 400,000 or include units"
|
|
79
|
+
raise ArgumentError, message unless valid_point?(value) || valid_measure?(value)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def valid_point?(value)
|
|
83
|
+
value.is_a?(Integer) && (-400_000..400_000).cover?(value)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def valid_measure?(value)
|
|
87
|
+
value.is_a?(String) && value =~ OpenXml::DrawingML::ST_UniversalMeasure
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|