openxml-docx 0.10.1 → 0.10.2
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.
- data/Gemfile.lock +1 -1
- data/examples/booklet-printing +55 -0
- data/lib/openxml/docx/attribute_builder.rb +11 -5
- data/lib/openxml/docx/elements/absolute_position_tab.rb +1 -1
- data/lib/openxml/docx/elements/background.rb +16 -0
- data/lib/openxml/docx/elements/book_fold_printing.rb +1 -1
- data/lib/openxml/docx/elements/book_fold_reverse_printing.rb +1 -1
- data/lib/openxml/docx/elements/compatibility_setting.rb +10 -0
- data/lib/openxml/docx/elements/compatibility_settings.rb +15 -0
- data/lib/openxml/docx/elements/embed_bold.rb +2 -10
- data/lib/openxml/docx/elements/embed_bold_italic.rb +2 -10
- data/lib/openxml/docx/elements/embed_italic.rb +2 -10
- data/lib/openxml/docx/elements/embed_regular.rb +3 -3
- data/lib/openxml/docx/elements/embed_system_fonts.rb +1 -1
- data/lib/openxml/docx/elements/embed_true_type_fonts.rb +1 -1
- data/lib/openxml/docx/elements/even_and_odd_headers.rb +11 -0
- data/lib/openxml/docx/elements/family.rb +1 -1
- data/lib/openxml/docx/elements/markup_compatibility_choice.rb +1 -1
- data/lib/openxml/docx/elements/paragraph.rb +1 -0
- data/lib/openxml/docx/elements/save_subset_fonts.rb +1 -1
- data/lib/openxml/docx/elements/table_cell.rb +1 -0
- data/lib/openxml/docx/elements/textbox_content.rb +9 -0
- data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +6 -6
- data/lib/openxml/docx/elements/word_processing_drawing_inline.rb +16 -0
- data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_drawing_wrap_polygon.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_shapes_body_properties.rb +12 -12
- data/lib/openxml/docx/elements/word_processing_shapes_nv_drawing_properties.rb +1 -1
- data/lib/openxml/docx/elements/word_processing_shapes_shape.rb +1 -2
- data/lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb +1 -11
- data/lib/openxml/docx/elements/word_processing_shapes_textual_contents.rb +13 -0
- data/lib/openxml/{drawingml → docx}/elements/wordprocessing_shape_group.rb +1 -1
- data/lib/openxml/docx/package.rb +4 -3
- data/lib/openxml/docx/parts/document.rb +5 -0
- data/lib/openxml/docx/parts/header.rb +1 -1
- data/lib/openxml/docx/properties.rb +1 -0
- data/lib/openxml/docx/properties/border.rb +2 -2
- data/lib/openxml/docx/properties/columns.rb +8 -2
- data/lib/openxml/docx/properties/conditional_formatting.rb +12 -12
- data/lib/openxml/docx/properties/container_property.rb +10 -10
- data/lib/openxml/docx/properties/footer_references.rb +12 -0
- data/lib/openxml/docx/properties/frame.rb +1 -1
- data/lib/openxml/docx/properties/header_references.rb +12 -0
- data/lib/openxml/docx/properties/indentation.rb +5 -1
- data/lib/openxml/docx/properties/latent_styles.rb +4 -4
- data/lib/openxml/docx/properties/latent_styles_exception.rb +4 -4
- data/lib/openxml/docx/properties/section.rb +15 -0
- data/lib/openxml/docx/properties/table_border.rb +2 -2
- data/lib/openxml/docx/properties/table_cell_border.rb +2 -2
- data/lib/openxml/docx/properties/table_look.rb +7 -6
- data/lib/openxml/docx/properties/text_direction.rb +1 -1
- data/lib/openxml/docx/properties/transparent_container_property.rb +14 -0
- data/lib/openxml/docx/properties/vertical_merge.rb +14 -0
- data/lib/openxml/docx/section.rb +2 -0
- data/lib/openxml/docx/style.rb +18 -6
- data/lib/openxml/docx/version.rb +1 -1
- data/lib/openxml/drawingml/elements/blip_fill.rb +1 -1
- data/lib/openxml/drawingml/elements/children_extents.rb +14 -0
- data/lib/openxml/drawingml/elements/children_offset.rb +14 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +6 -6
- data/lib/openxml/drawingml/elements/no_autofit.rb +10 -0
- data/lib/openxml/drawingml/elements/no_fill.rb +1 -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 -1
- data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +12 -0
- data/lib/openxml/drawingml/elements/picture_locks.rb +11 -11
- data/lib/openxml/drawingml/elements/preset_text_warp.rb +25 -0
- data/lib/openxml/vml/elements/group.rb +17 -37
- data/lib/openxml/vml/elements/rectangle.rb +29 -62
- data/lib/openxml/vml/elements/rounded_rectangle.rb +29 -61
- data/spec/elements/absolute_position_tab_spec.rb +21 -15
- data/spec/elements/background_spec.rb +52 -0
- data/spec/elements/bidi_embed_spec.rb +12 -4
- data/spec/elements/bidi_override_spec.rb +12 -4
- data/spec/elements/break_spec.rb +12 -10
- data/spec/elements/compatibility_setting_spec.rb +41 -0
- data/spec/elements/compatibility_settings_spec.rb +8 -0
- data/spec/elements/content_part_spec.rb +2 -2
- data/spec/elements/control_spec.rb +5 -5
- data/spec/elements/deleted_text_spec.rb +2 -2
- data/spec/elements/drawingml/blip_fill_spec.rb +8 -3
- data/spec/elements/drawingml/extents_spec.rb +4 -4
- data/spec/elements/drawingml/head_end_spec.rb +16 -13
- data/spec/elements/drawingml/no_autofit_spec.rb +8 -0
- data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +6 -6
- data/spec/elements/drawingml/non_visual_shape_drawing_properties_spec.rb +24 -0
- data/spec/elements/drawingml/offset_spec.rb +14 -4
- data/spec/elements/drawingml/outline_spec.rb +20 -14
- data/spec/elements/drawingml/preset_geometry_spec.rb +1 -1
- data/spec/elements/drawingml/preset_text_warp_spec.rb +36 -0
- data/spec/elements/drawingml/shape_guide_spec.rb +7 -3
- data/spec/elements/drawingml/srgb_color_spec.rb +3 -4
- data/spec/elements/drawingml/tail_end_spec.rb +17 -14
- data/spec/elements/drawingml/transform_effect_spec.rb +48 -26
- data/spec/elements/markup_compatibility_choice_spec.rb +2 -2
- data/spec/elements/paragraph_spec.rb +25 -0
- data/spec/elements/symbol_spec.rb +4 -4
- data/spec/elements/text_spec.rb +1 -1
- data/spec/elements/textbox_content_spec.rb +8 -0
- data/spec/elements/vml/group_spec.rb +367 -375
- data/spec/elements/vml/rectangle_spec.rb +503 -513
- data/spec/elements/vml/rounded_rectangle_spec.rb +591 -463
- data/spec/elements/word_processing_drawing_effect_extent_spec.rb +32 -12
- data/spec/elements/word_processing_drawing_extent_spec.rb +4 -4
- data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +6 -6
- data/spec/elements/word_processing_drawing_simple_position_spec.rb +16 -6
- data/spec/elements/word_processing_shapes_body_properties_spec.rb +53 -44
- data/spec/elements/word_processing_shapes_shape_properties_spec.rb +6 -5
- data/spec/elements/word_processing_shapes_shape_spec.rb +2 -2
- data/spec/elements/word_processing_shapes_textual_content_spec.rb +23 -0
- data/spec/elements/{drawingml/wordprocessing_shape_group_spec.rb → wordprocessing_shape_group_spec.rb} +1 -1
- data/spec/properties/indentation_spec.rb +28 -0
- data/spec/properties/table_look_spec.rb +5 -0
- data/spec/properties/text_direction_spec.rb +5 -0
- data/spec/properties/vertical_merge_spec.rb +22 -0
- data/spec/support/data/elements/paragraph_with_section_properties_element.xml +12 -0
- data/spec/support/data/parts/empty_header_part.xml +1 -1
- data/spec/support/data/parts/header_with_children_part.xml +1 -1
- metadata +76 -27
- checksums.yaml +0 -7
data/lib/openxml/docx/version.rb
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Elements
|
|
4
|
+
class ChildrenExtents < OpenXml::Docx::Elements::Element
|
|
5
|
+
namespace :a
|
|
6
|
+
tag :chExt
|
|
7
|
+
|
|
8
|
+
attribute :extent_length, expects: :positive_integer, displays_as: :cx
|
|
9
|
+
attribute :extent_width, expects: :positive_integer, displays_as: :cy
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -4,12 +4,12 @@ module OpenXml
|
|
|
4
4
|
class GraphicFrameLocks < OpenXml::Docx::Elements::Element
|
|
5
5
|
namespace :a
|
|
6
6
|
|
|
7
|
-
attribute :disallow_aspect_ratio_changes, expects: :
|
|
8
|
-
attribute :disallow_drilldown, expects: :
|
|
9
|
-
attribute :disallow_grouping, expects: :
|
|
10
|
-
attribute :disallow_moving, expects: :
|
|
11
|
-
attribute :disallow_resizing, expects: :
|
|
12
|
-
attribute :disallow_selection, expects: :
|
|
7
|
+
attribute :disallow_aspect_ratio_changes, expects: :boolean, displays_as: :noChangeAspect
|
|
8
|
+
attribute :disallow_drilldown, expects: :boolean, displays_as: :noDrilldown
|
|
9
|
+
attribute :disallow_grouping, expects: :boolean, displays_as: :noGrp
|
|
10
|
+
attribute :disallow_moving, expects: :boolean, displays_as: :noMove
|
|
11
|
+
attribute :disallow_resizing, expects: :boolean, displays_as: :noResize
|
|
12
|
+
attribute :disallow_selection, expects: :boolean, displays_as: :noSelect
|
|
13
13
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -6,7 +6,7 @@ module OpenXml
|
|
|
6
6
|
tag :cNvPr
|
|
7
7
|
|
|
8
8
|
attribute :description, expects: :string, displays_as: :descr
|
|
9
|
-
attribute :hidden, expects: :
|
|
9
|
+
attribute :hidden, expects: :boolean
|
|
10
10
|
attribute :id, expects: :positive_integer
|
|
11
11
|
attribute :picture_name, expects: :string, displays_as: :name
|
|
12
12
|
attribute :title, expects: :string
|
|
@@ -5,17 +5,17 @@ module OpenXml
|
|
|
5
5
|
namespace :a
|
|
6
6
|
tag :picLocks
|
|
7
7
|
|
|
8
|
-
attribute :hide_adjust_handles, expects: :
|
|
9
|
-
attribute :disallow_arrowhead_changes, expects: :
|
|
10
|
-
attribute :disallow_aspect_ratio_changes, expects: :
|
|
11
|
-
attribute :disallow_shape_type_changes, expects: :
|
|
12
|
-
attribute :disallow_cropping, expects: :
|
|
13
|
-
attribute :disallow_editing_points, expects: :
|
|
14
|
-
attribute :disallow_grouping, expects: :
|
|
15
|
-
attribute :disallow_moving, expects: :
|
|
16
|
-
attribute :disallow_resizing, expects: :
|
|
17
|
-
attribute :disallow_rotation, expects: :
|
|
18
|
-
attribute :disallow_selection, expects: :
|
|
8
|
+
attribute :hide_adjust_handles, expects: :boolean, displays_as: :noAdjustHandles
|
|
9
|
+
attribute :disallow_arrowhead_changes, expects: :boolean, displays_as: :noChangeArrowheads
|
|
10
|
+
attribute :disallow_aspect_ratio_changes, expects: :boolean, displays_as: :noChangeAspect
|
|
11
|
+
attribute :disallow_shape_type_changes, expects: :boolean, displays_as: :noChangeShapeType
|
|
12
|
+
attribute :disallow_cropping, expects: :boolean, displays_as: :noCrop
|
|
13
|
+
attribute :disallow_editing_points, expects: :boolean, displays_as: :noEditPoints
|
|
14
|
+
attribute :disallow_grouping, expects: :boolean, displays_as: :noGrp
|
|
15
|
+
attribute :disallow_moving, expects: :boolean, displays_as: :noMove
|
|
16
|
+
attribute :disallow_resizing, expects: :boolean, displays_as: :noResize
|
|
17
|
+
attribute :disallow_rotation, expects: :boolean, displays_as: :noRot
|
|
18
|
+
attribute :disallow_selection, expects: :boolean, displays_as: :noSelect
|
|
19
19
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module OpenXml
|
|
2
|
+
module DrawingML
|
|
3
|
+
module Elements
|
|
4
|
+
class PresetTextWarp < OpenXml::Docx::Elements::Container
|
|
5
|
+
namespace :a
|
|
6
|
+
tag :prstTxWarp
|
|
7
|
+
|
|
8
|
+
attribute :preset, one_of: %i(textArchDown textArchDownPour textArchUp
|
|
9
|
+
textArchUpPour textButton textButtonPour
|
|
10
|
+
textCanDown textCanUp textCascadeDown
|
|
11
|
+
textCascadeUp textChevron textChevronInverted
|
|
12
|
+
textCircle textCirclePour textCurveDown
|
|
13
|
+
textCurveUp textDeflate textDeflateBottom
|
|
14
|
+
textDeflateInflate textDeflateTop
|
|
15
|
+
textDoubleWave1 textFadeDown textFadeLeft
|
|
16
|
+
textFadeRight textFadeUp textInflate
|
|
17
|
+
textInflateBottom textInflateTop textNoShape
|
|
18
|
+
textPlain textRingInside textRingOutside
|
|
19
|
+
textSlantDown textSlantUp textStop textTriangle
|
|
20
|
+
textTriangleInverted textWave1 textWave2
|
|
21
|
+
textWave4), displays_as: :prst
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -6,45 +6,45 @@ module OpenXml
|
|
|
6
6
|
|
|
7
7
|
attribute :alt, expects: :string
|
|
8
8
|
attribute :css_class, expects: :string, displays_as: :class
|
|
9
|
-
attribute :coordinate_origin,
|
|
10
|
-
attribute :coordinate_size,
|
|
9
|
+
attribute :coordinate_origin, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordorigin
|
|
10
|
+
attribute :coordinate_size, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordsize
|
|
11
11
|
attribute :edit_as, one_of: %i(bullseye canvas cycle orgchart radial stacked venn), displays_as: :editas
|
|
12
12
|
attribute :fill_color, expects: :valid_color, displays_as: :fillcolor
|
|
13
|
-
attribute :filled, expects: :
|
|
13
|
+
attribute :filled, expects: :boolean
|
|
14
14
|
attribute :href, expects: :string
|
|
15
15
|
attribute :id, expects: :string
|
|
16
|
-
attribute :print, expects: :
|
|
16
|
+
attribute :print, expects: :boolean
|
|
17
17
|
attribute :style, expects: :string
|
|
18
18
|
attribute :target, expects: :string
|
|
19
19
|
attribute :title, expects: :string
|
|
20
20
|
attribute :wrap_coordinates, expects: :string, displays_as: :wrapcoords
|
|
21
21
|
|
|
22
22
|
with_namespace :o do
|
|
23
|
-
attribute :allow_in_cell, expects: :
|
|
24
|
-
attribute :allow_overlap, expects: :
|
|
23
|
+
attribute :allow_in_cell, expects: :boolean, displays_as: :allowincell
|
|
24
|
+
attribute :allow_overlap, expects: :boolean, displays_as: :allowoverlap
|
|
25
25
|
attribute :border_bottom_color, expects: :string, displays_as: :borderbottomcolor
|
|
26
26
|
attribute :border_left_color, expects: :string, displays_as: :borderleftcolor
|
|
27
27
|
attribute :border_right_color, expects: :string, displays_as: :borderrightcolor
|
|
28
28
|
attribute :border_top_color, expects: :string, displays_as: :bordertopcolor
|
|
29
|
-
attribute :bullet, expects: :
|
|
30
|
-
attribute :button, expects: :
|
|
29
|
+
attribute :bullet, expects: :boolean
|
|
30
|
+
attribute :button, expects: :boolean
|
|
31
31
|
attribute :diagram_node_layout, expects: :valid_diagram_layout, displays_as: :dgmlayout
|
|
32
32
|
attribute :diagram_node_recent_layout, expects: :valid_diagram_layout, displays_as: :dgmlayoutmru
|
|
33
33
|
attribute :diagram_node_kind, expects: :integer, displays_as: :dgmnodekind
|
|
34
|
-
attribute :double_click_notify, expects: :
|
|
35
|
-
attribute :hr, expects: :
|
|
36
|
-
attribute :hr_align,
|
|
37
|
-
attribute :hr_no_shade, expects: :
|
|
34
|
+
attribute :double_click_notify, expects: :boolean, displays_as: :doubleclicknotify
|
|
35
|
+
attribute :hr, expects: :boolean
|
|
36
|
+
attribute :hr_align, one_of: %i(center left right), displays_as: :hralign
|
|
37
|
+
attribute :hr_no_shade, expects: :boolean, displays_as: :hrnoshade
|
|
38
38
|
attribute :hr_percent, expects: :integer, displays_as: :hrpct
|
|
39
|
-
attribute :hr_standard, expects: :
|
|
40
|
-
attribute :inset_mode,
|
|
41
|
-
attribute :hide_extra_handles, expects: :
|
|
39
|
+
attribute :hr_standard, expects: :boolean, displays_as: :hrstd
|
|
40
|
+
attribute :inset_mode, one_of: %i(auto custom), displays_as: :insetmode
|
|
41
|
+
attribute :hide_extra_handles, expects: :boolean, displays_as: :oned
|
|
42
42
|
attribute :regroup_id, expects: :integer, displays_as: :regroupid
|
|
43
43
|
attribute :optional_string, expects: :string, displays_as: :spid
|
|
44
44
|
attribute :table_limits, expects: :string, displays_as: :tablelimits
|
|
45
45
|
attribute :table_properties, expects: :string, displays_as: :tableproperties
|
|
46
|
-
attribute :user_drawn, expects: :
|
|
47
|
-
attribute :user_hidden, expects: :
|
|
46
|
+
attribute :user_drawn, expects: :boolean, displays_as: :userdrawn
|
|
47
|
+
attribute :user_hidden, expects: :boolean, displays_as: :userhidden
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
private
|
|
@@ -57,31 +57,11 @@ module OpenXml
|
|
|
57
57
|
raise ArgumentError, message unless ok_color_names.include?(value) || value =~ valid_hex || value =~ valid_palette_entry
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
def valid_coordinate(value)
|
|
61
|
-
raise ArgumentError, "Invalid coordinates." unless value =~ /^[\-0-9]+,\s?[\-0-9]+$/
|
|
62
|
-
end
|
|
63
|
-
|
|
64
60
|
def valid_diagram_layout(value)
|
|
65
61
|
message = "Invalid diagram layout. Must be a single digit between 0 and 3 inclusive"
|
|
66
62
|
raise ArgumentError, message unless (value.is_a?(Fixnum) && (0..3).include?(value)) || value =~ /^[0-3]$/
|
|
67
63
|
end
|
|
68
64
|
|
|
69
|
-
def valid_hr_align(value)
|
|
70
|
-
ok_values = %i(center left right)
|
|
71
|
-
message = "Invalid hr alignment (#{value}). Valid values are: #{ok_values.join(", ")}."
|
|
72
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def valid_inset_mode(value)
|
|
76
|
-
ok_values = %i(auto custom)
|
|
77
|
-
message = "Invalid inset mode (#{value}). Valid modes are: #{ok_values.join(", ")}."
|
|
78
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def explicit_true_false(value)
|
|
82
|
-
raise ArgumentError unless value.to_s =~ /^(?:[01tf]|true|false)$/
|
|
83
|
-
end
|
|
84
|
-
|
|
85
65
|
end
|
|
86
66
|
end
|
|
87
67
|
end
|
|
@@ -8,17 +8,17 @@ module OpenXml
|
|
|
8
8
|
attribute :alt, expects: :string
|
|
9
9
|
attribute :chroma_key, expects: :valid_color, displays_as: :chromakey
|
|
10
10
|
attribute :css_class, expects: :string, displays_as: :class
|
|
11
|
-
attribute :coordinate_origin,
|
|
12
|
-
attribute :coordinate_size,
|
|
11
|
+
attribute :coordinate_origin, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordorigin
|
|
12
|
+
attribute :coordinate_size, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordsize
|
|
13
13
|
attribute :fill_color, expects: :valid_color, displays_as: :fillcolor
|
|
14
|
-
attribute :filled, expects: :
|
|
14
|
+
attribute :filled, expects: :boolean
|
|
15
15
|
attribute :href, expects: :string
|
|
16
16
|
attribute :id, expects: :string
|
|
17
|
-
attribute :inset_pen, expects: :
|
|
17
|
+
attribute :inset_pen, expects: :boolean, displays_as: :insetpen
|
|
18
18
|
attribute :opacity, expects: :string # Can be a float or 1/65536ths when followed by `f`
|
|
19
|
-
attribute :print, expects: :
|
|
19
|
+
attribute :print, expects: :boolean
|
|
20
20
|
attribute :stroke_color, expects: :valid_color, displays_as: :strokecolor
|
|
21
|
-
attribute :stroked, expects: :
|
|
21
|
+
attribute :stroked, expects: :boolean
|
|
22
22
|
attribute :stroke_weight, expects: :string, displays_as: :strokeweight # Expects number with units
|
|
23
23
|
attribute :style, expects: :string
|
|
24
24
|
attribute :target, expects: :string
|
|
@@ -26,50 +26,44 @@ module OpenXml
|
|
|
26
26
|
attribute :wrap_coordinates, expects: :string, displays_as: :wrapcoords
|
|
27
27
|
|
|
28
28
|
with_namespace :o do
|
|
29
|
-
attribute :allow_in_cell, expects: :
|
|
30
|
-
attribute :allow_overlap, expects: :
|
|
29
|
+
attribute :allow_in_cell, expects: :boolean, displays_as: :allowincell
|
|
30
|
+
attribute :allow_overlap, expects: :boolean, displays_as: :allowoverlap
|
|
31
31
|
attribute :border_bottom_color, expects: :string, displays_as: :borderbottomcolor
|
|
32
32
|
attribute :border_left_color, expects: :string, displays_as: :borderleftcolor
|
|
33
33
|
attribute :border_right_color, expects: :string, displays_as: :borderrightcolor
|
|
34
34
|
attribute :border_top_color, expects: :string, displays_as: :bordertopcolor
|
|
35
|
-
attribute :bullet, expects: :
|
|
36
|
-
attribute :button, expects: :
|
|
37
|
-
attribute :bw_mode,
|
|
38
|
-
attribute :bw_normal,
|
|
39
|
-
attribute :bw_pure,
|
|
40
|
-
attribute :clip, expects: :
|
|
41
|
-
attribute :clip_to_wrap, expects: :
|
|
42
|
-
attribute :connector_type,
|
|
35
|
+
attribute :bullet, expects: :boolean
|
|
36
|
+
attribute :button, expects: :boolean
|
|
37
|
+
attribute :bw_mode, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white), displays_as: :bwmode
|
|
38
|
+
attribute :bw_normal, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white), displays_as: :bwnormal
|
|
39
|
+
attribute :bw_pure, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white), displays_as: :bwpure
|
|
40
|
+
attribute :clip, expects: :boolean
|
|
41
|
+
attribute :clip_to_wrap, expects: :boolean, displays_as: :cliptowrap
|
|
42
|
+
attribute :connector_type, one_of: %i(curved elbow none straight), displays_as: :connectortype
|
|
43
43
|
attribute :diagram_node_layout, expects: :valid_diagram_layout, displays_as: :dgmlayout
|
|
44
44
|
attribute :diagram_node_recent_layout, expects: :valid_diagram_layout, displays_as: :dgmlayoutmru
|
|
45
45
|
attribute :diagram_node_kind, expects: :integer, displays_as: :dgmnodekind
|
|
46
|
-
attribute :double_click_notify, expects: :
|
|
47
|
-
attribute :force_dash, expects: :
|
|
48
|
-
attribute :hr, expects: :
|
|
49
|
-
attribute :hr_align,
|
|
50
|
-
attribute :hr_no_shade, expects: :
|
|
46
|
+
attribute :double_click_notify, expects: :boolean, displays_as: :doubleclicknotify
|
|
47
|
+
attribute :force_dash, expects: :boolean, displays_as: :forcedash
|
|
48
|
+
attribute :hr, expects: :boolean
|
|
49
|
+
attribute :hr_align, one_of: %i(center left right), displays_as: :hralign
|
|
50
|
+
attribute :hr_no_shade, expects: :boolean, displays_as: :hrnoshade
|
|
51
51
|
attribute :hr_percent, expects: :integer, displays_as: :hrpct
|
|
52
|
-
attribute :hr_standard, expects: :
|
|
53
|
-
attribute :inset_mode,
|
|
54
|
-
attribute :ole, expects: :
|
|
55
|
-
attribute :ole_icon, expects: :
|
|
56
|
-
attribute :hide_extra_handles, expects: :
|
|
57
|
-
attribute :prefer_relative, expects: :
|
|
52
|
+
attribute :hr_standard, expects: :boolean, displays_as: :hrstd
|
|
53
|
+
attribute :inset_mode, one_of: %i(auto custom), displays_as: :insetmode
|
|
54
|
+
attribute :ole, expects: :boolean
|
|
55
|
+
attribute :ole_icon, expects: :boolean, displays_as: :oleicon
|
|
56
|
+
attribute :hide_extra_handles, expects: :boolean, displays_as: :oned
|
|
57
|
+
attribute :prefer_relative, expects: :boolean, displays_as: :preferrelative
|
|
58
58
|
attribute :regroup_id, expects: :integer, displays_as: :regroupid
|
|
59
59
|
attribute :optional_string, expects: :string, displays_as: :spid
|
|
60
60
|
attribute :optional_number, expects: :string, displays_as: :spt # Actually expects float
|
|
61
|
-
attribute :user_drawn, expects: :
|
|
62
|
-
attribute :user_hidden, expects: :
|
|
61
|
+
attribute :user_drawn, expects: :boolean, displays_as: :userdrawn
|
|
62
|
+
attribute :user_hidden, expects: :boolean, displays_as: :userhidden
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
private
|
|
66
66
|
|
|
67
|
-
def valid_bw_mode(value)
|
|
68
|
-
ok_values = %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
|
69
|
-
message = "Invalid black and white mode (#{value}). Valid options are: #{ok_values.join(", ")}."
|
|
70
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
71
|
-
end
|
|
72
|
-
|
|
73
67
|
def valid_color(value)
|
|
74
68
|
ok_color_names = %i(black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua)
|
|
75
69
|
valid_hex = /#[0-9a-f]{6}/i
|
|
@@ -78,37 +72,10 @@ module OpenXml
|
|
|
78
72
|
raise ArgumentError, message unless ok_color_names.include?(value) || value =~ valid_hex || value =~ valid_palette_entry
|
|
79
73
|
end
|
|
80
74
|
|
|
81
|
-
def valid_connector_type(value)
|
|
82
|
-
ok_values = %i(curved elbow none straight)
|
|
83
|
-
message = "Invalid connector type (#{value}). Valid types are: #{ok_values.join(", ")}."
|
|
84
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def valid_coordinate(value)
|
|
88
|
-
raise ArgumentError, "Invalid coordinates." unless value =~ /^[\-0-9]+,\s?[\-0-9]+$/
|
|
89
|
-
end
|
|
90
|
-
|
|
91
75
|
def valid_diagram_layout(value)
|
|
92
76
|
message = "Invalid diagram layout. Must be a single digit between 0 and 3 inclusive"
|
|
93
77
|
raise ArgumentError, message unless (value.is_a?(Fixnum) && (0..3).include?(value)) || value =~ /^[0-3]$/
|
|
94
78
|
end
|
|
95
|
-
|
|
96
|
-
def valid_hr_align(value)
|
|
97
|
-
ok_values = %i(center left right)
|
|
98
|
-
message = "Invalid hr alignment (#{value}). Valid values are: #{ok_values.join(", ")}."
|
|
99
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def valid_inset_mode(value)
|
|
103
|
-
ok_values = %i(auto custom)
|
|
104
|
-
message = "Invalid inset mode (#{value}). Valid modes are: #{ok_values.join(", ")}."
|
|
105
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def explicit_true_false(value)
|
|
109
|
-
raise ArgumentError unless value.to_s =~ /^(?:[01tf]|true|false)$/
|
|
110
|
-
end
|
|
111
|
-
|
|
112
79
|
end
|
|
113
80
|
end
|
|
114
81
|
end
|
|
@@ -9,17 +9,17 @@ module OpenXml
|
|
|
9
9
|
attribute :arc_size, expects: :valid_arc_size, displays_as: :arcsize
|
|
10
10
|
attribute :chroma_key, expects: :valid_color, displays_as: :chromakey
|
|
11
11
|
attribute :css_class, expects: :string, displays_as: :class
|
|
12
|
-
attribute :coordinate_origin,
|
|
13
|
-
attribute :coordinate_size,
|
|
12
|
+
attribute :coordinate_origin, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordorigin
|
|
13
|
+
attribute :coordinate_size, matches: /^[\-0-9]+,\s?[\-0-9]+$/, displays_as: :coordsize
|
|
14
14
|
attribute :fill_color, expects: :valid_color, displays_as: :fillcolor
|
|
15
|
-
attribute :filled, expects: :
|
|
15
|
+
attribute :filled, expects: :boolean
|
|
16
16
|
attribute :href, expects: :string
|
|
17
17
|
attribute :id, expects: :string
|
|
18
|
-
attribute :inset_pen, expects: :
|
|
18
|
+
attribute :inset_pen, expects: :boolean, displays_as: :insetpen
|
|
19
19
|
attribute :opacity, expects: :string # Can be a float or 1/65536ths when followed by `f`
|
|
20
|
-
attribute :print, expects: :
|
|
20
|
+
attribute :print, expects: :boolean
|
|
21
21
|
attribute :stroke_color, expects: :valid_color, displays_as: :strokecolor
|
|
22
|
-
attribute :stroked, expects: :
|
|
22
|
+
attribute :stroked, expects: :boolean
|
|
23
23
|
attribute :stroke_weight, expects: :string, displays_as: :strokeweight # Expects number with units
|
|
24
24
|
attribute :style, expects: :string
|
|
25
25
|
attribute :target, expects: :string
|
|
@@ -27,40 +27,40 @@ module OpenXml
|
|
|
27
27
|
attribute :wrap_coordinates, expects: :string, displays_as: :wrapcoords
|
|
28
28
|
|
|
29
29
|
with_namespace :o do
|
|
30
|
-
attribute :allow_in_cell, expects: :
|
|
31
|
-
attribute :allow_overlap, expects: :
|
|
30
|
+
attribute :allow_in_cell, expects: :boolean, displays_as: :allowincell
|
|
31
|
+
attribute :allow_overlap, expects: :boolean, displays_as: :allowoverlap
|
|
32
32
|
attribute :border_bottom_color, expects: :string, displays_as: :borderbottomcolor
|
|
33
33
|
attribute :border_left_color, expects: :string, displays_as: :borderleftcolor
|
|
34
34
|
attribute :border_right_color, expects: :string, displays_as: :borderrightcolor
|
|
35
35
|
attribute :border_top_color, expects: :string, displays_as: :bordertopcolor
|
|
36
|
-
attribute :bullet, expects: :
|
|
37
|
-
attribute :button, expects: :
|
|
38
|
-
attribute :bw_mode,
|
|
39
|
-
attribute :bw_normal,
|
|
40
|
-
attribute :bw_pure,
|
|
41
|
-
attribute :clip, expects: :
|
|
42
|
-
attribute :clip_to_wrap, expects: :
|
|
43
|
-
attribute :connector_type,
|
|
36
|
+
attribute :bullet, expects: :boolean
|
|
37
|
+
attribute :button, expects: :boolean
|
|
38
|
+
attribute :bw_mode, displays_as: :bwmode, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
|
39
|
+
attribute :bw_normal, displays_as: :bwnormal, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
|
40
|
+
attribute :bw_pure, displays_as: :bwpure, one_of: %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
|
41
|
+
attribute :clip, expects: :boolean
|
|
42
|
+
attribute :clip_to_wrap, expects: :boolean, displays_as: :cliptowrap
|
|
43
|
+
attribute :connector_type, one_of: %i(curved elbow none straight), displays_as: :connectortype
|
|
44
44
|
attribute :diagram_node_layout, expects: :valid_diagram_layout, displays_as: :dgmlayout
|
|
45
45
|
attribute :diagram_node_recent_layout, expects: :valid_diagram_layout, displays_as: :dgmlayoutmru
|
|
46
46
|
attribute :diagram_node_kind, expects: :integer, displays_as: :dgmnodekind
|
|
47
|
-
attribute :double_click_notify, expects: :
|
|
48
|
-
attribute :force_dash, expects: :
|
|
49
|
-
attribute :hr, expects: :
|
|
50
|
-
attribute :hr_align,
|
|
51
|
-
attribute :hr_no_shade, expects: :
|
|
47
|
+
attribute :double_click_notify, expects: :boolean, displays_as: :doubleclicknotify
|
|
48
|
+
attribute :force_dash, expects: :boolean, displays_as: :forcedash
|
|
49
|
+
attribute :hr, expects: :boolean
|
|
50
|
+
attribute :hr_align, one_of: %i(center left right), displays_as: :hralign
|
|
51
|
+
attribute :hr_no_shade, expects: :boolean, displays_as: :hrnoshade
|
|
52
52
|
attribute :hr_percent, expects: :integer, displays_as: :hrpct
|
|
53
|
-
attribute :hr_standard, expects: :
|
|
54
|
-
attribute :inset_mode,
|
|
55
|
-
attribute :ole, expects: :
|
|
56
|
-
attribute :ole_icon, expects: :
|
|
57
|
-
attribute :hide_extra_handles, expects: :
|
|
58
|
-
attribute :prefer_relative, expects: :
|
|
53
|
+
attribute :hr_standard, expects: :boolean, displays_as: :hrstd
|
|
54
|
+
attribute :inset_mode, one_of: %i(auto custom), displays_as: :insetmode
|
|
55
|
+
attribute :ole, expects: :boolean
|
|
56
|
+
attribute :ole_icon, expects: :boolean, displays_as: :oleicon
|
|
57
|
+
attribute :hide_extra_handles, expects: :boolean, displays_as: :oned
|
|
58
|
+
attribute :prefer_relative, expects: :boolean, displays_as: :preferrelative
|
|
59
59
|
attribute :regroup_id, expects: :integer, displays_as: :regroupid
|
|
60
60
|
attribute :optional_string, expects: :string, displays_as: :spid
|
|
61
61
|
attribute :optional_number, expects: :string, displays_as: :spt # Actually expects float
|
|
62
|
-
attribute :user_drawn, expects: :
|
|
63
|
-
attribute :user_hidden, expects: :
|
|
62
|
+
attribute :user_drawn, expects: :boolean, displays_as: :userdrawn
|
|
63
|
+
attribute :user_hidden, expects: :boolean, displays_as: :userhidden
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
private
|
|
@@ -70,12 +70,6 @@ module OpenXml
|
|
|
70
70
|
raise ArgumentError, message unless value.is_a?(String) && value =~ /^[0-9]+[%f]$/
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
def valid_bw_mode(value)
|
|
74
|
-
ok_values = %i(auto black blackTextAndLines color grayOutline grayScale hide highContrast inverseGray lightGrayscale undrawn white)
|
|
75
|
-
message = "Invalid black and white mode (#{value}). Valid options are: #{ok_values.join(", ")}."
|
|
76
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
77
|
-
end
|
|
78
|
-
|
|
79
73
|
def valid_color(value)
|
|
80
74
|
ok_color_names = %i(black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua)
|
|
81
75
|
valid_hex = /#[0-9a-f]{6}/i
|
|
@@ -84,37 +78,11 @@ module OpenXml
|
|
|
84
78
|
raise ArgumentError, message unless ok_color_names.include?(value) || value =~ valid_hex || value =~ valid_palette_entry
|
|
85
79
|
end
|
|
86
80
|
|
|
87
|
-
def valid_connector_type(value)
|
|
88
|
-
ok_values = %i(curved elbow none straight)
|
|
89
|
-
message = "Invalid connector type (#{value}). Valid types are: #{ok_values.join(", ")}."
|
|
90
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def valid_coordinate(value)
|
|
94
|
-
raise ArgumentError, "Invalid coordinates." unless value =~ /^[\-0-9]+,\s?[\-0-9]+$/
|
|
95
|
-
end
|
|
96
|
-
|
|
97
81
|
def valid_diagram_layout(value)
|
|
98
82
|
message = "Invalid diagram layout. Must be a single digit between 0 and 3 inclusive"
|
|
99
83
|
raise ArgumentError, message unless (value.is_a?(Fixnum) && (0..3).include?(value)) || value =~ /^[0-3]$/
|
|
100
84
|
end
|
|
101
85
|
|
|
102
|
-
def valid_hr_align(value)
|
|
103
|
-
ok_values = %i(center left right)
|
|
104
|
-
message = "Invalid hr alignment (#{value}). Valid values are: #{ok_values.join(", ")}."
|
|
105
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def valid_inset_mode(value)
|
|
109
|
-
ok_values = %i(auto custom)
|
|
110
|
-
message = "Invalid inset mode (#{value}). Valid modes are: #{ok_values.join(", ")}."
|
|
111
|
-
raise ArgumentError, message unless ok_values.include? value
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def explicit_true_false(value)
|
|
115
|
-
raise ArgumentError unless value.to_s =~ /^(?:[01tf]|true|false)$/
|
|
116
|
-
end
|
|
117
|
-
|
|
118
86
|
end
|
|
119
87
|
end
|
|
120
88
|
end
|