thinreports 0.7.6 → 0.8.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.
Files changed (277) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -5
  3. data/.travis.yml +8 -4
  4. data/CHANGELOG.md +220 -0
  5. data/Gemfile +2 -9
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +286 -0
  8. data/Rakefile +38 -8
  9. data/examples/character_spacing/character_spacing.rb +8 -0
  10. data/examples/character_spacing/character_spacing.tlf +1 -0
  11. data/examples/dynamic_image/dynamic_image.rb +31 -0
  12. data/examples/dynamic_image/dynamic_image.tlf +1 -0
  13. data/examples/dynamic_style/dynamic_style.rb +150 -0
  14. data/examples/dynamic_style/dynamic_style.tlf +1 -0
  15. data/examples/dynamic_style/dynamic_style_in_list.tlf +1 -0
  16. data/examples/eudc/eudc.rb +20 -0
  17. data/examples/eudc/eudc.tlf +1 -0
  18. data/examples/helper.rb +50 -0
  19. data/examples/hidden_shapes/hidden_shapes.rb +9 -0
  20. data/examples/hidden_shapes/hidden_shapes.tlf +1 -0
  21. data/examples/list_events/list_events.rb +59 -0
  22. data/examples/list_events/list_events_0_7_7.tlf +1 -0
  23. data/examples/list_events/list_events_0_8.tlf +1 -0
  24. data/examples/list_manual_generation/list_manual_generation.rb +22 -0
  25. data/examples/list_manual_generation/list_manual_generation.tlf +1 -0
  26. data/examples/list_page_number/list_page_number.rb +17 -0
  27. data/examples/list_page_number/list_page_number.tlf +1 -0
  28. data/examples/page_number/page_number.rb +33 -0
  29. data/examples/page_number/page_number.tlf +1 -0
  30. data/examples/password_setting/password_setting.rb +10 -0
  31. data/examples/password_setting/password_setting.tlf +1 -0
  32. data/examples/report_callbacks/report_callbacks.rb +31 -0
  33. data/examples/report_callbacks/report_callbacks.tlf +1 -0
  34. data/examples/single_line_tblock/single_line_tblock.rb +13 -0
  35. data/examples/single_line_tblock/single_line_tblock.tlf +1 -0
  36. data/examples/tblock_overflow/tblock_overflow.rb +20 -0
  37. data/examples/tblock_overflow/tblock_overflow.tlf +1 -0
  38. data/examples/tblock_styles/font_size.tlf +1 -0
  39. data/examples/tblock_styles/tblock_styles.rb +43 -0
  40. data/examples/tblock_styles/tblock_styles.tlf +1 -0
  41. data/examples/text_align/text_align.rb +8 -0
  42. data/examples/text_align/text_align.tlf +1 -0
  43. data/examples/typeB_page_size/B4_ISO.tlf +1 -0
  44. data/examples/typeB_page_size/B4_JIS.tlf +1 -0
  45. data/examples/typeB_page_size/typeB_page_size.rb +17 -0
  46. data/examples/word_wrap/word_wrap.rb +26 -0
  47. data/examples/word_wrap/word_wrap.tlf +1 -0
  48. data/lib/thinreports/config.rb +30 -10
  49. data/lib/thinreports/core/errors.rb +23 -20
  50. data/lib/thinreports/core/events.rb +18 -19
  51. data/lib/thinreports/core/format/base.rb +20 -25
  52. data/lib/thinreports/core/format/builder.rb +19 -27
  53. data/lib/thinreports/core/shape/base/interface.rb +15 -15
  54. data/lib/thinreports/core/shape/base/internal.rb +15 -20
  55. data/lib/thinreports/core/shape/base.rb +4 -5
  56. data/lib/thinreports/core/shape/basic/block_format.rb +3 -4
  57. data/lib/thinreports/core/shape/basic/block_interface.rb +9 -4
  58. data/lib/thinreports/core/shape/basic/block_internal.rb +9 -10
  59. data/lib/thinreports/core/shape/basic/format.rb +11 -10
  60. data/lib/thinreports/core/shape/basic/interface.rb +3 -3
  61. data/lib/thinreports/core/shape/basic/internal.rb +9 -6
  62. data/lib/thinreports/core/shape/basic.rb +1 -1
  63. data/lib/thinreports/core/shape/image_block/format.rb +5 -6
  64. data/lib/thinreports/core/shape/image_block/interface.rb +9 -7
  65. data/lib/thinreports/core/shape/image_block/internal.rb +5 -6
  66. data/lib/thinreports/core/shape/image_block.rb +1 -1
  67. data/lib/thinreports/core/shape/list/configuration.rb +37 -16
  68. data/lib/thinreports/core/shape/list/events.rb +11 -11
  69. data/lib/thinreports/core/shape/list/format.rb +27 -28
  70. data/lib/thinreports/core/shape/list/manager.rb +135 -95
  71. data/lib/thinreports/core/shape/list/page.rb +57 -51
  72. data/lib/thinreports/core/shape/list/page_state.rb +19 -17
  73. data/lib/thinreports/core/shape/list/section_format.rb +14 -15
  74. data/lib/thinreports/core/shape/list/section_interface.rb +15 -16
  75. data/lib/thinreports/core/shape/list/section_internal.rb +7 -8
  76. data/lib/thinreports/core/shape/list/store.rb +10 -11
  77. data/lib/thinreports/core/shape/list.rb +1 -1
  78. data/lib/thinreports/core/shape/manager/format.rb +10 -11
  79. data/lib/thinreports/core/shape/manager/internal.rb +22 -21
  80. data/lib/thinreports/core/shape/manager/target.rb +63 -34
  81. data/lib/thinreports/core/shape/manager.rb +1 -1
  82. data/lib/thinreports/core/shape/page_number/format.rb +25 -0
  83. data/lib/thinreports/core/shape/page_number/interface.rb +27 -0
  84. data/lib/thinreports/core/shape/page_number/internal.rb +57 -0
  85. data/lib/thinreports/core/shape/page_number.rb +15 -0
  86. data/lib/thinreports/core/shape/style/base.rb +29 -29
  87. data/lib/thinreports/core/shape/style/basic.rb +1 -1
  88. data/lib/thinreports/core/shape/style/graphic.rb +10 -25
  89. data/lib/thinreports/core/shape/style/text.rb +41 -31
  90. data/lib/thinreports/core/shape/style.rb +1 -1
  91. data/lib/thinreports/core/shape/text/format.rb +8 -9
  92. data/lib/thinreports/core/shape/text/interface.rb +2 -2
  93. data/lib/thinreports/core/shape/text/internal.rb +6 -7
  94. data/lib/thinreports/core/shape/text.rb +1 -1
  95. data/lib/thinreports/core/shape/text_block/format.rb +17 -17
  96. data/lib/thinreports/core/shape/text_block/formatter/basic.rb +13 -12
  97. data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +8 -9
  98. data/lib/thinreports/core/shape/text_block/formatter/number.rb +11 -12
  99. data/lib/thinreports/core/shape/text_block/formatter/padding.rb +9 -32
  100. data/lib/thinreports/core/shape/text_block/formatter.rb +7 -8
  101. data/lib/thinreports/core/shape/text_block/interface.rb +2 -2
  102. data/lib/thinreports/core/shape/text_block/internal.rb +19 -20
  103. data/lib/thinreports/core/shape/text_block.rb +1 -1
  104. data/lib/thinreports/core/shape.rb +11 -13
  105. data/lib/thinreports/core/utils.rb +33 -32
  106. data/lib/thinreports/generator/base.rb +15 -24
  107. data/lib/thinreports/generator/configuration.rb +10 -9
  108. data/lib/thinreports/generator/pdf/configuration.rb +11 -6
  109. data/lib/thinreports/generator/pdf/document/draw_shape.rb +41 -32
  110. data/lib/thinreports/generator/pdf/document/font.rb +53 -44
  111. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +34 -25
  112. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +25 -25
  113. data/lib/thinreports/generator/pdf/document/graphics/image.rb +15 -15
  114. data/lib/thinreports/generator/pdf/document/graphics/text.rb +43 -41
  115. data/lib/thinreports/generator/pdf/document/graphics.rb +8 -9
  116. data/lib/thinreports/generator/pdf/document/page.rb +37 -23
  117. data/lib/thinreports/generator/pdf/document/parse_color.rb +9 -10
  118. data/lib/thinreports/generator/pdf/document/parse_svg.rb +14 -15
  119. data/lib/thinreports/generator/pdf/document.rb +28 -28
  120. data/lib/thinreports/generator/pdf/drawer/base.rb +16 -22
  121. data/lib/thinreports/generator/pdf/drawer/list.rb +39 -21
  122. data/lib/thinreports/generator/pdf/drawer/list_section.rb +17 -18
  123. data/lib/thinreports/generator/pdf/drawer/page.rb +37 -26
  124. data/lib/thinreports/generator/pdf/prawn_ext.rb +18 -17
  125. data/lib/thinreports/generator/pdf.rb +28 -31
  126. data/lib/thinreports/generator.rb +6 -8
  127. data/lib/thinreports/layout/base.rb +24 -36
  128. data/lib/thinreports/layout/configuration.rb +11 -9
  129. data/lib/thinreports/layout/format.rb +26 -31
  130. data/lib/thinreports/layout/version.rb +8 -9
  131. data/lib/thinreports/layout.rb +2 -2
  132. data/lib/thinreports/report/base.rb +117 -109
  133. data/lib/thinreports/report/events.rb +5 -5
  134. data/lib/thinreports/report/internal.rb +48 -38
  135. data/lib/thinreports/{core → report}/page.rb +42 -32
  136. data/lib/thinreports/report.rb +10 -14
  137. data/lib/thinreports/version.rb +2 -3
  138. data/lib/thinreports.rb +14 -2
  139. data/test/data/font.ttf +0 -0
  140. data/test/data/layout_block.tlf +1 -0
  141. data/test/data/layout_list.tlf +1 -0
  142. data/test/data/layout_list_noheader.tlf +1 -0
  143. data/test/data/layout_text1.tlf +1 -0
  144. data/test/data/layout_text2.tlf +1 -0
  145. data/test/test_helper.rb +74 -0
  146. data/test/tmp/.gitkeep +0 -0
  147. data/test/unit/core/format/test_base.rb +14 -14
  148. data/test/unit/core/format/test_builder.rb +20 -25
  149. data/test/unit/core/shape/base/test_internal.rb +34 -37
  150. data/test/unit/core/shape/basic/test_basic_format.rb +4 -4
  151. data/test/unit/core/shape/basic/test_basic_interface.rb +15 -13
  152. data/test/unit/core/shape/basic/test_basic_internal.rb +19 -16
  153. data/test/unit/core/shape/basic/test_format.rb +4 -4
  154. data/test/unit/core/shape/basic/test_interface.rb +36 -46
  155. data/test/unit/core/shape/basic/test_internal.rb +29 -18
  156. data/test/unit/core/shape/image_block/test_format.rb +5 -5
  157. data/test/unit/core/shape/image_block/test_interface.rb +17 -16
  158. data/test/unit/core/shape/image_block/test_internal.rb +19 -16
  159. data/test/unit/core/shape/list/test_configuration.rb +50 -33
  160. data/test/unit/core/shape/list/test_events.rb +7 -7
  161. data/test/unit/core/shape/list/test_format.rb +16 -18
  162. data/test/unit/core/shape/list/test_manager.rb +15 -5
  163. data/test/unit/core/shape/list/test_page.rb +80 -22
  164. data/test/unit/core/shape/list/test_page_state.rb +13 -13
  165. data/test/unit/core/shape/list/test_section_format.rb +16 -17
  166. data/test/unit/core/shape/list/test_section_interface.rb +30 -22
  167. data/test/unit/core/shape/list/test_section_internal.rb +21 -19
  168. data/test/unit/core/shape/list/test_store.rb +7 -7
  169. data/test/unit/core/shape/manager/test_format.rb +11 -15
  170. data/test/unit/core/shape/manager/test_internal.rb +9 -9
  171. data/test/unit/core/shape/manager/test_target.rb +85 -57
  172. data/test/unit/core/shape/page_number/test_format.rb +73 -0
  173. data/test/unit/core/shape/page_number/test_interface.rb +33 -0
  174. data/test/unit/core/shape/page_number/test_internal.rb +81 -0
  175. data/test/unit/core/shape/styles/test_base.rb +9 -9
  176. data/test/unit/core/shape/styles/test_basic.rb +5 -5
  177. data/test/unit/core/shape/styles/test_graphic.rb +19 -33
  178. data/test/unit/core/shape/styles/test_text.rb +29 -7
  179. data/test/unit/core/shape/text/test_format.rb +6 -6
  180. data/test/unit/core/shape/text/test_internal.rb +11 -12
  181. data/test/unit/core/shape/text_block/formatter/test_basic.rb +16 -16
  182. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +22 -20
  183. data/test/unit/core/shape/text_block/formatter/test_number.rb +34 -34
  184. data/test/unit/core/shape/text_block/formatter/test_padding.rb +44 -44
  185. data/test/unit/core/shape/text_block/test_format.rb +13 -8
  186. data/test/unit/core/shape/text_block/test_formatter.rb +17 -17
  187. data/test/unit/core/shape/text_block/test_interface.rb +37 -20
  188. data/test/unit/core/shape/text_block/test_internal.rb +38 -38
  189. data/test/unit/core/test_events.rb +10 -8
  190. data/test/unit/core/test_shape.rb +11 -7
  191. data/test/unit/core/test_utils.rb +68 -0
  192. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +10 -4
  193. data/test/unit/generator/pdf/document/graphics/test_text.rb +60 -53
  194. data/test/unit/generator/pdf/document/test_draw_shape.rb +14 -6
  195. data/test/unit/generator/pdf/document/test_font.rb +79 -58
  196. data/test/unit/generator/pdf/document/test_graphics.rb +18 -19
  197. data/test/unit/generator/pdf/document/test_page.rb +68 -43
  198. data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
  199. data/test/unit/generator/pdf/test_configuration.rb +16 -9
  200. data/test/unit/generator/pdf/test_document.rb +8 -16
  201. data/test/unit/generator/test_base.rb +31 -42
  202. data/test/unit/generator/test_configuration.rb +6 -6
  203. data/test/unit/generator/test_pdf.rb +15 -21
  204. data/test/unit/layout/test_base.rb +34 -79
  205. data/test/unit/layout/test_configuration.rb +12 -37
  206. data/test/unit/layout/test_format.rb +36 -39
  207. data/test/unit/layout/test_version.rb +4 -4
  208. data/test/unit/report/test_base.rb +160 -192
  209. data/test/unit/report/test_events.rb +4 -4
  210. data/test/unit/report/test_internal.rb +102 -82
  211. data/test/unit/test_config.rb +31 -12
  212. data/test/unit/test_layout.rb +7 -7
  213. data/test/unit/test_report.rb +12 -24
  214. data/thinreports.gemspec +23 -26
  215. metadata +118 -181
  216. data/.yardopts +0 -1
  217. data/LICENSE +0 -1
  218. data/README.rdoc +0 -167
  219. data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
  220. data/lib/thinreports/core/ext/array.rb +0 -19
  221. data/lib/thinreports/core/ext/hash.rb +0 -19
  222. data/lib/thinreports/core/ext/object.rb +0 -25
  223. data/lib/thinreports/core/ext.rb +0 -5
  224. data/lib/thinreports/core/format.rb +0 -14
  225. data/lib/thinreports/core/ordered_hash.rb +0 -39
  226. data/lib/thinreports/core.rb +0 -20
  227. data/lib/thinreports/generator/pdf/drawer.rb +0 -16
  228. data/tasks/doc.rake +0 -13
  229. data/tasks/test.rake +0 -56
  230. data/test/benchmark/basic_estimate.tlf +0 -1
  231. data/test/benchmark/bench_basic_estimate.rb +0 -95
  232. data/test/case/character_spacing/character_spacing.rb +0 -7
  233. data/test/case/character_spacing/character_spacing.tlf +0 -1
  234. data/test/case/dynamic_image/dynamic_image.rb +0 -41
  235. data/test/case/dynamic_image/dynamic_image.tlf +0 -1
  236. data/test/case/dynamic_style/dynamic_style.rb +0 -154
  237. data/test/case/dynamic_style/dynamic_style.tlf +0 -1
  238. data/test/case/dynamic_style/dynamic_style_in_list.tlf +0 -1
  239. data/test/case/eudc/eudc.rb +0 -20
  240. data/test/case/eudc/eudc.tlf +0 -1
  241. data/test/case/helper.rb +0 -29
  242. data/test/case/hidden_shapes/hidden_shapes.rb +0 -13
  243. data/test/case/hidden_shapes/hidden_shapes.tlf +0 -1
  244. data/test/case/list_events/list_events.rb +0 -32
  245. data/test/case/list_events/list_events.tlf +0 -1
  246. data/test/case/list_header_inheriting/list_header_inheriting.rb +0 -17
  247. data/test/case/list_header_inheriting/list_header_inheriting.tlf +0 -1
  248. data/test/case/list_manual_generation/list_manual_generation.rb +0 -22
  249. data/test/case/list_manual_generation/list_manual_generation.tlf +0 -1
  250. data/test/case/single_line_tblock/single_line_tblock.rb +0 -15
  251. data/test/case/single_line_tblock/single_line_tblock.tlf +0 -1
  252. data/test/case/tblock_overflow/tblock_overflow.rb +0 -20
  253. data/test/case/tblock_overflow/tblock_overflow.tlf +0 -1
  254. data/test/case/tblock_styles/tblock_styles.rb +0 -27
  255. data/test/case/tblock_styles/tblock_styles.tlf +0 -1
  256. data/test/case/text_align/text_align.rb +0 -9
  257. data/test/case/text_align/text_align.tlf +0 -1
  258. data/test/unit/core/ext/array_spec.rb +0 -29
  259. data/test/unit/core/ext/hash_spec.rb +0 -29
  260. data/test/unit/core/ext/object_spec.rb +0 -30
  261. data/test/unit/core/ordered_hash_spec.rb +0 -51
  262. data/test/unit/core/shape/base/test_interface.rb +0 -52
  263. data/test/unit/core/utils_spec.rb +0 -56
  264. data/test/unit/data/basic_layout1.tlf +0 -1
  265. data/test/unit/data/basic_layout2.tlf +0 -1
  266. data/test/unit/data/basic_list_layout.tlf +0 -1
  267. data/test/unit/data/basic_list_noheader_layout.tlf +0 -1
  268. data/test/unit/helper.rb +0 -65
  269. /data/{test/case → examples}/dynamic_image/img200x100.png +0 -0
  270. /data/{test/case → examples}/dynamic_image/img50x50.png +0 -0
  271. /data/{test/case → examples}/dynamic_style/image.png +0 -0
  272. /data/{test/case → examples}/eudc/eudc.ttf +0 -0
  273. /data/{resources/fonts → fonts}/IPA_Font_License_Agreement_v1.0.txt +0 -0
  274. /data/{resources/fonts → fonts}/ipag.ttf +0 -0
  275. /data/{resources/fonts → fonts}/ipagp.ttf +0 -0
  276. /data/{resources/fonts → fonts}/ipam.ttf +0 -0
  277. /data/{resources/fonts → fonts}/ipamp.ttf +0 -0
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+
3
+ example :word_wrap, 'Word-wrap property of TextBlock' do |t|
4
+ Thinreports::Report.generate filename: t.output_filename do
5
+ use_layout t.layout_filename
6
+ start_new_page
7
+
8
+ page.item(:locale).value('ja')
9
+
10
+ text = 'Thinreports は Ruby 向けのオープンソース帳票・PDF ツールです。'
11
+ page.values single_none: text,
12
+ single_break_word: text,
13
+ multiple_none: text,
14
+ multiple_break_word: text
15
+
16
+ start_new_page
17
+
18
+ page.item(:locale).value('en')
19
+
20
+ text = 'Thinreports is the OSS reporting tool for Ruby-lang.'
21
+ page.values single_none: text,
22
+ single_break_word: text,
23
+ multiple_none: text,
24
+ multiple_break_word: text
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.7.1","finger-print":1936329983,"config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"single_none\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":33.1,\"y\":101,\"width\":210.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"expand\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":33.1,\"y\":113.9,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_478710130\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_478710130\" x-id=\"single_none\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"210.1\" x-height=\"17\" x-left=\"33.1\" x-top=\"101\" x-overflow=\"expand\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"210.1\" height=\"17\" x=\"33.1\" y=\"101\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"35.1\" y=\"112\">single_none</text></g>LAYOUT--><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"multiple_none\",\"display\":\"true\",\"desc\":null,\"multiple\":\"true\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":290.2,\"y\":101.9,\"width\":259.1,\"height\":105.1},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"textArea\",\"attrs\":{\"x\":290.2,\"y\":101.8,\"width\":259.1,\"height\":105.1,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_478710131\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"true\" id=\"goog_478710131\" x-id=\"multiple_none\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"259.1\" x-height=\"105.1\" x-left=\"290.2\" x-top=\"101.9\" x-word-wrap=\"none\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"101.9\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"292.2\" y=\"112.9\">multiple_none</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358811\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"101.9\"/><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"multiple_break_word\",\"display\":\"true\",\"desc\":null,\"multiple\":\"true\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":290.2,\"y\":232.9,\"width\":259.1,\"height\":105.1},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"truncate\",\"word-wrap\":\"break-word\",\"svg\":{\"tag\":\"textArea\",\"attrs\":{\"x\":290.2,\"y\":232.8,\"width\":259.1,\"height\":105.1,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_1119358812\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"start\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"true\" id=\"goog_1119358812\" x-id=\"multiple_break_word\" x-width=\"259.1\" x-height=\"105.1\" x-left=\"290.2\" x-top=\"232.9\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" x-overflow=\"truncate\" x-word-wrap=\"break-word\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"232.9\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"292.2\" y=\"243.9\">multiple_break_word</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358813\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"232.9\"/><line stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" id=\"goog_1119358814\" x1=\"252\" x2=\"252\" y1=\"100\" y2=\"379.1\"/><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"single_break_word\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":35,\"y\":235,\"width\":210.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"expand\",\"word-wrap\":\"break-word\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":35,\"y\":247.9,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_1119358815\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"start\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_1119358815\" x-id=\"single_break_word\" x-width=\"210.1\" x-height=\"17\" x-left=\"35\" x-top=\"235\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" x-overflow=\"expand\" x-word-wrap=\"break-word\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"210.1\" height=\"17\" x=\"35\" y=\"235\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"37\" y=\"246\">single_break_word</text></g>LAYOUT--><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_1119358816\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"58\" x-height=\"17\" x-left=\"32.1\" x-top=\"36\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"58\" height=\"17\" x=\"32.1\" y=\"36\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"32.1\" y=\"48.9\">Locale:</text></g><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"locale\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":100,\"y\":36,\"width\":145.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":100,\"y\":48.9,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_1119358817\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_1119358817\" x-id=\"locale\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"145.1\" x-height=\"17\" x-left=\"100\" x-top=\"36\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"145.1\" height=\"17\" x=\"100\" y=\"36\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"102\" y=\"47\">locale</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358818\" width=\"210.1\" height=\"17\" x=\"33.1\" y=\"101\"/><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358820\" width=\"210.1\" height=\"17\" x=\"34.1\" y=\"235\"/></g></svg>","state":{"layout-guide":[{"type":"x","position":59.5},{"type":"y","position":61}]}}
@@ -1,21 +1,41 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
3
+ module Thinreports
4
4
  # @yield [config]
5
- # @yieldparam [ThinReports::Configuration] config
5
+ # @yieldparam [Thinreports::Configuration] config
6
6
  def self.configure(&block)
7
- block_exec_on(self.config, &block)
7
+ Thinreports.call_block_in(self.config, &block)
8
8
  end
9
-
10
- # @return [ThinReports::Configuration]
9
+
10
+ # @return [Thinreports::Configuration]
11
11
  def self.config
12
- @config ||= ThinReports::Configuration.new
12
+ @config ||= Thinreports::Configuration.new
13
13
  end
14
-
14
+
15
15
  class Configuration
16
- # @return [ThinReports::Generator::Configuration]
16
+ def initialize
17
+ @fallback_fonts = []
18
+ end
19
+
20
+ # @return [Array<String>]
21
+ # @example
22
+ # config.fallback_fonts # => ['Times New Roman', '/path/to/font.ttf']
23
+ def fallback_fonts
24
+ @fallback_fonts ||= []
25
+ end
26
+
27
+ # @param [Array<String>,String] font_names
28
+ # @example
29
+ # config.fallback_fonts = 'Times New Roman'
30
+ # config.fallback_fonts = '/path/to/font.ttf'
31
+ # config.fallback_fonts = ['/path/to/font.ttf', 'IPAGothic']
32
+ def fallback_fonts=(font_names)
33
+ @fallback_fonts = font_names.is_a?(Array) ? font_names : [font_names]
34
+ end
35
+
36
+ # @return [Thinreports::Generator::Configuration]
17
37
  def generator
18
- @generator ||= ThinReports::Generator::Configuration.new
38
+ @generator ||= Thinreports::Generator::Configuration.new
19
39
  end
20
40
  end
21
- end
41
+ end
@@ -1,71 +1,74 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
4
-
3
+ module Thinreports
4
+
5
5
  module Errors
6
6
  class Basic < ::StandardError
7
7
  end
8
-
8
+
9
9
  class UnknownShapeStyleName < Basic
10
10
  def initialize(style, availables)
11
11
  super("The specified style name, '#{style}', cannot be used. " +
12
12
  "The available styles are #{availables.map{|s| ":#{s}"}.join(', ')}.")
13
13
  end
14
14
  end
15
-
15
+
16
16
  class UnknownShapeType < Basic
17
17
  end
18
-
18
+
19
19
  class UnknownFormatterType < Basic
20
20
  end
21
-
21
+
22
22
  class LayoutFileNotFound < Basic
23
23
  end
24
-
24
+
25
+ class FontFileNotFound < Basic
26
+ end
27
+
25
28
  class NoRegisteredLayoutFound < Basic
26
29
  end
27
-
30
+
28
31
  class UnknownItemId < Basic
29
32
  def initialize(id, item_type = 'Basic')
30
33
  super("The layout does not have a #{item_type} Item with id '#{id}'.")
31
34
  end
32
35
  end
33
-
36
+
34
37
  class DisabledListSection < Basic
35
38
  def initialize(section)
36
39
  super("The #{section} section is disabled.")
37
40
  end
38
41
  end
39
-
42
+
40
43
  class UnknownEventType < Basic
41
44
  end
42
-
45
+
43
46
  class UnknownLayoutId < Basic
44
47
  end
45
-
48
+
46
49
  class UnknownGeneratorType < Basic
47
50
  def initialize(type)
48
51
  super("The specified generator type, '#{type}', was not found.")
49
52
  end
50
53
  end
51
-
54
+
52
55
  class NoConfigurationFound < Basic
53
56
  end
54
-
57
+
55
58
  class UnsupportedColorName < Basic
56
59
  end
57
-
60
+
58
61
  class InvalidLayoutFormat < Basic
59
62
  end
60
-
63
+
61
64
  class IncompatibleLayoutFormat < Basic
62
65
  def initialize(filename, fileversion, required_rules)
63
- super("Generator #{ThinReports::VERSION} can not be built this file, " +
64
- "'#{File.basename(filename)}'." +
66
+ super("Generator #{Thinreports::VERSION} can not be built this file, " +
67
+ "'#{File.basename(filename)}'. " +
65
68
  "This file is updated in the Editor of version '#{fileversion}', " +
66
69
  "but Generator requires version #{required_rules}.")
67
- end
70
+ end
68
71
  end
69
72
  end
70
-
73
+
71
74
  end
@@ -1,27 +1,28 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
3
+ module Thinreports
4
4
  module Core
5
-
5
+
6
6
  class Events
7
+ include Utils
8
+
7
9
  Event = ::Struct.new(:type, :target)
8
-
9
- # @return [Hash<Symbol, ThinReports::Core::Events::Event>]
10
- # @private
10
+
11
+ # @return [Hash<Symbol, Thinreports::Core::Events::Event>]
11
12
  attr_accessor :events
12
-
13
+
13
14
  # @param [Symbol] types
14
15
  def initialize(*types)
15
16
  @events = {}
16
17
  @types = types
17
18
  end
18
-
19
+
19
20
  # @param [Symbol] type
20
21
  # @yield [e]
21
- # @yieldparam [ThinReports::Core::Events::Event] e
22
+ # @yieldparam [Thinreports::Core::Events::Event] e
22
23
  def listen(type, &block)
23
24
  verify_event_type(type)
24
-
25
+
25
26
  if block_given?
26
27
  events[type] = block
27
28
  else
@@ -29,14 +30,13 @@ module ThinReports
29
30
  end
30
31
  end
31
32
  alias_method :on, :listen
32
-
33
+
33
34
  # @param [Symbol] type
34
35
  def unlisten(type)
35
36
  events.delete(type)
36
37
  end
37
38
  alias_method :un, :unlisten
38
-
39
- # @private
39
+
40
40
  def dispatch(e)
41
41
  unless e.type
42
42
  raise ArgumentError, 'Event#type attribute is required'
@@ -47,22 +47,21 @@ module ThinReports
47
47
  event.call(e)
48
48
  end
49
49
  end
50
-
51
- # @private
50
+
52
51
  def copy
53
52
  new_events = self.dup
54
- new_events.events = events.simple_deep_copy
53
+ new_events.events = deep_copy(events)
55
54
  new_events
56
55
  end
57
-
56
+
58
57
  private
59
-
58
+
60
59
  # @param [Symbol] type
61
60
  def verify_event_type(type)
62
61
  return if @types.empty?
63
-
62
+
64
63
  unless @types.include?(type)
65
- raise ThinReports::Errors::UnknownEventType
64
+ raise Thinreports::Errors::UnknownEventType
66
65
  end
67
66
  end
68
67
  end
@@ -1,57 +1,52 @@
1
1
  # coding: utf-8
2
+ require 'thinreports/core/format/builder'
3
+
4
+ module Thinreports::Core
5
+ module Format
2
6
 
3
- module ThinReports
4
- module Core::Format
5
-
6
7
  # @abstract
7
- # @private
8
8
  class Base
9
- # Work like a BlankSlate.
10
- instance_methods.each do |m|
11
- undef_method(m) unless m.to_s =~ /^(object|eq|__|instance_|=|!)/
12
- end
13
-
9
+ extend Format::Builder
10
+
14
11
  class << self
15
- include Core::Format::Builder
16
-
17
12
  def config_reader(*configs, &block)
18
13
  each_configs(*configs) do |m, location|
19
14
  define_read_method(m, location, &block)
20
15
  end
21
16
  end
22
-
17
+
23
18
  def config_checker(check, *configs)
24
19
  checker = lambda {|val| val == check}
25
20
  each_configs(*configs) do |m, location|
26
21
  define_read_method(:"#{m}?", location, &checker)
27
22
  end
28
23
  end
29
-
24
+
30
25
  def config_writer(*configs)
31
26
  each_configs(*configs) do |m, location|
32
27
  define_write_method(m, location)
33
28
  end
34
29
  end
35
-
30
+
36
31
  def config_accessor(*configs, &block)
37
32
  config_reader(*configs, &block)
38
33
  config_writer(*configs)
39
34
  end
40
-
35
+
41
36
  private
42
-
37
+
43
38
  def define_read_method(m, location = nil, &block)
44
39
  define_method(m) do
45
40
  read(*location, &block)
46
41
  end
47
42
  end
48
-
43
+
49
44
  def define_write_method(m, location = nil)
50
45
  define_method(:"#{m}=") do |value|
51
46
  write(value, *location)
52
47
  end
53
48
  end
54
-
49
+
55
50
  def each_configs(*configs, &block)
56
51
  c = configs.first.is_a?(::Hash) ? configs.first : (configs || [])
57
52
  c.each do |m, location|
@@ -59,14 +54,14 @@ module ThinReports
59
54
  end
60
55
  end
61
56
  end
62
-
57
+
63
58
  def initialize(config, &block)
64
59
  @config = config
65
60
  block.call(self) if ::Kernel.block_given?
66
61
  end
67
-
62
+
68
63
  private
69
-
64
+
70
65
  def find(*keys)
71
66
  if keys.empty?
72
67
  @config
@@ -76,18 +71,18 @@ module ThinReports
76
71
  end
77
72
  end
78
73
  end
79
-
74
+
80
75
  def write(value, *keys)
81
76
  key = keys.pop
82
77
  owner = find(*keys)
83
78
  owner[key] = value
84
79
  end
85
-
80
+
86
81
  def read(*keys, &block)
87
82
  value = find(*keys)
88
83
  ::Kernel.block_given? ? block.call(value) : value
89
84
  end
90
85
  end
91
-
86
+
92
87
  end
93
- end
88
+ end
@@ -1,61 +1,53 @@
1
1
  # coding: utf-8
2
2
 
3
- begin
4
- require 'json'
5
- rescue LoadError
6
- puts 'ThinReports requires json >= 1.4.6. ' +
7
- 'Please `gem install json` and try again.'
8
- end
3
+ require 'json'
4
+
5
+ module Thinreports::Core
6
+ module Format
9
7
 
10
- module ThinReports
11
- module Core::Format
12
-
13
- # @private
14
8
  module Builder
15
9
  def build(*args)
16
10
  build_internal(*args)
17
- rescue ThinReports::Errors::Basic => e
18
- raise e
11
+ rescue Thinreports::Errors::Basic => e
12
+ raise
19
13
  rescue => e
20
- raise ThinReports::Errors::InvalidLayoutFormat
14
+ raise Thinreports::Errors::InvalidLayoutFormat
21
15
  end
22
-
23
- private
24
-
16
+
25
17
  # @abstract
26
18
  def build_internal(*args)
27
19
  raise NotImplementedError
28
20
  end
29
21
 
30
- # @param [ThinReports::Core::Format::Base] format
22
+ # @param [Thinreports::Core::Format::Base] format
31
23
  # @param [Hash] options
32
24
  def build_layout(format, options = {}, &block)
33
25
  level = '-' * ((options[:level] || 1 ) - 1)
26
+ pattern = /<!--#{level}SHAPE(.*?)SHAPE#{level}-->/
34
27
 
35
- format.layout.gsub!(/<!--#{level}SHAPE(.*?)SHAPE#{level}-->/) do
36
- shape_format = block.call(*parsed_format_and_shape_type($1))
37
-
28
+ format.layout.scan(pattern) do |m|
29
+ shape_format = block.call(*parsed_format_and_shape_type(m.first))
38
30
  format.shapes[shape_format.id.to_sym] = shape_format
39
- shape_tag(shape_format)
40
31
  end
32
+ format.layout.gsub!(pattern, '')
41
33
  end
42
-
34
+
43
35
  # @param [String] svg
44
36
  def clean(svg)
45
37
  svg.gsub!(/<!--.*?-->/, '')
46
38
  end
47
-
39
+
48
40
  # @param [String] svg
49
41
  def clean_with_attributes(svg)
50
42
  clean(svg)
51
43
  svg.gsub!(/ x\-[a-z\d\-]+?=".*?"/, '')
52
- svg.gsub!(/ class=".*?"/, '')
44
+ svg.gsub!(/ class=".*?"/, '')
53
45
  end
54
-
46
+
55
47
  def shape_tag(format)
56
48
  %{<%= r(:"#{format.id}")%>}
57
49
  end
58
-
50
+
59
51
  def parsed_format_and_shape_type(json_string)
60
52
  f = parse_json(json_string)
61
53
  [ f['type'], f ]
@@ -65,6 +57,6 @@ module ThinReports
65
57
  JSON.parse(json_string)
66
58
  end
67
59
  end
68
-
60
+
69
61
  end
70
62
  end
@@ -1,38 +1,38 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
3
+ module Thinreports
4
4
  module Core::Shape
5
-
6
- # @private
5
+
7
6
  # @abstract
8
7
  class Base::Interface
9
- extend ::Forwardable
10
-
8
+ include Utils
9
+ extend Forwardable
10
+
11
11
  def self.internal_delegators(*args)
12
12
  def_delegators :internal, *args
13
13
  end
14
14
  private_class_method :internal_delegators
15
-
15
+
16
16
  attr_reader :internal
17
-
17
+
18
18
  def initialize(parent, format, internal = nil)
19
19
  @internal = internal || init_internal(parent, format)
20
20
  end
21
-
21
+
22
22
  def copy(parent)
23
23
  self.class.new(parent, internal.format, internal.copy(parent))
24
24
  end
25
-
25
+
26
26
  private
27
-
28
- # @param [ThinReports::Core::Page, ThinReports::Core::Shape::List::SectionInterface] parent
29
- # @param [ThinReports::Core::Shape::Basic::Format] format
30
- # @return [ThinReports::Core::Shape::Basic::Internal]
27
+
28
+ # @param [Thinreports::Report::Page, Thinreports::Core::Shape::List::SectionInterface] parent
29
+ # @param [Thinreports::Core::Shape::Basic::Format] format
30
+ # @return [Thinreports::Core::Shape::Basic::Internal]
31
31
  # @abstract
32
32
  def init_internal(parent, format)
33
33
  raise NotImplementedError
34
34
  end
35
35
  end
36
-
36
+
37
37
  end
38
- end
38
+ end
@@ -1,54 +1,49 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
3
+ module Thinreports
4
4
  module Core::Shape
5
-
6
- # @private
5
+
7
6
  # @abstract
8
7
  class Base::Internal
9
- extend ::Forwardable
10
-
8
+ include Utils
9
+ extend Forwardable
10
+
11
11
  def self.format_delegators(*args)
12
12
  def_delegators :format, *args
13
13
  end
14
14
  private_class_method :format_delegators
15
-
15
+
16
16
  attr_reader :parent
17
17
  attr_reader :format
18
18
  attr_writer :style
19
19
  attr_accessor :states
20
-
20
+
21
21
  def initialize(parent, format)
22
22
  @parent = parent
23
23
  @format = format
24
24
  @states = {}
25
25
  @style = nil
26
-
26
+
27
27
  @finalized_attributes = nil
28
28
  end
29
-
29
+
30
30
  def style
31
31
  raise NotImplementedError
32
32
  end
33
-
33
+
34
34
  def copy(new_parent, &block)
35
35
  new_internal = self.class.new(new_parent, format)
36
36
  new_internal.style = style.copy
37
- new_internal.states = states.simple_deep_copy
38
-
37
+ new_internal.states = deep_copy(states)
38
+
39
39
  block.call(new_internal) if block_given?
40
40
  new_internal
41
41
  end
42
-
43
- def switch_parent!(new_parent)
44
- @parent = new_parent
45
- self
46
- end
47
-
42
+
48
43
  def type_of?(type_name)
49
44
  raise NotImplementedError
50
45
  end
51
46
  end
52
-
47
+
53
48
  end
54
- end
49
+ end
@@ -2,15 +2,14 @@
2
2
 
3
3
  require 'forwardable'
4
4
 
5
- module ThinReports
5
+ module Thinreports
6
6
  module Core::Shape
7
-
8
- # @private
7
+
9
8
  module Base
10
9
  end
11
-
10
+
12
11
  end
13
12
  end
14
13
 
15
14
  require 'thinreports/core/shape/base/internal'
16
- require 'thinreports/core/shape/base/interface'
15
+ require 'thinreports/core/shape/base/interface'
@@ -1,12 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
- module ThinReports
3
+ module Thinreports
4
4
  module Core::Shape
5
-
6
- # @private
5
+
7
6
  class Basic::BlockFormat < Basic::Format
8
7
  config_reader :value, :box
9
8
  end
10
-
9
+
11
10
  end
12
11
  end