From d5051cfb96a765235efae10722c109fbf4445388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20P=C4=99giel?= Date: Fri, 16 Jan 2015 21:07:50 +0100 Subject: [PATCH 1/3] Gradient fill reader Gradient fill handling added to reader --- ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk | 56 +++++++++++++++++++++++++++- ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk | 1 + ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk | 3 +- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index 61c98f7..1d7d9bf 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -1265,6 +1265,7 @@ ENDMETHOD. lo_node_fill_child TYPE REF TO if_ixml_element, lo_node_bgcolor TYPE REF TO if_ixml_element, lo_node_fgcolor TYPE REF TO if_ixml_element, + lo_node_stop TYPE REF TO if_ixml_element, lo_fill TYPE REF TO zcl_excel_style_fill, ls_color TYPE t_color. @@ -1343,7 +1344,60 @@ ENDMETHOD. * gradientFill *--------------------------------------------------------------------* WHEN 'gradientFill'. - " 2do§1 Support gradientFill + lo_fill->gradtype-type = lo_node_fill_child->get_attribute( 'type' ). + lo_fill->gradtype-top = lo_node_fill_child->get_attribute( 'top' ). + lo_fill->gradtype-left = lo_node_fill_child->get_attribute( 'left' ). + lo_fill->gradtype-right = lo_node_fill_child->get_attribute( 'right' ). + lo_fill->gradtype-bottom = lo_node_fill_child->get_attribute( 'bottom' ). + lo_fill->gradtype-degree = lo_node_fill_child->get_attribute( 'degree' ). + free lo_node_stop. + lo_node_stop ?= lo_node_fill_child->find_from_name( 'stop' ). + while lo_node_stop is bound. + if lo_fill->gradtype-position1 is initial. + lo_fill->gradtype-position1 = lo_node_stop->get_attribute( 'position' ). + lo_node_bgcolor = lo_node_stop->find_from_name( 'color' ). + IF lo_node_bgcolor IS BOUND. + fill_struct_from_attributes( EXPORTING + ip_element = lo_node_bgcolor + CHANGING + cp_structure = ls_color ). + + lo_fill->bgcolor-rgb = ls_color-rgb. + IF ls_color-indexed IS NOT INITIAL. + lo_fill->bgcolor-indexed = ls_color-indexed. + ENDIF. + + IF ls_color-theme IS NOT INITIAL. + lo_fill->bgcolor-theme = ls_color-theme. + ENDIF. + lo_fill->bgcolor-tint = ls_color-tint. + ENDIF. + elseif lo_fill->gradtype-position2 is initial. + lo_fill->gradtype-position2 = lo_node_stop->get_attribute( 'position' ). + lo_node_fgcolor = lo_node_stop->find_from_name( 'color' ). + IF lo_node_fgcolor IS BOUND. + fill_struct_from_attributes( EXPORTING + ip_element = lo_node_fgcolor + CHANGING + cp_structure = ls_color ). + + lo_fill->fgcolor-rgb = ls_color-rgb. + IF ls_color-indexed IS NOT INITIAL. + lo_fill->fgcolor-indexed = ls_color-indexed. + ENDIF. + + IF ls_color-theme IS NOT INITIAL. + lo_fill->fgcolor-theme = ls_color-theme. + ENDIF. + lo_fill->fgcolor-tint = ls_color-tint. + ENDIF. + elseif lo_fill->gradtype-position3 is initial. + lo_fill->gradtype-position3 = lo_node_stop->get_attribute( 'position' ). + "BGColor is filled already with position 1 no need to check again + endif. + + lo_node_stop ?= lo_node_stop->get_next( ). + ENDWHILE. WHEN OTHERS. diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk index e2d4061..10e1aae 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk @@ -50,6 +50,7 @@ method build_gradient. check check_filltype_is_gradient( ) eq abap_true. + clear gradtype. case filltype. when c_fill_gradient_horizontal90. gradtype-degree = '90'. diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk index 6e6cfaf..186f35e 100644 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk +++ b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk @@ -1,7 +1,8 @@ - + + From c90c6d7e984253ef04b2bb52381b4be19410f4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20P=C4=99giel?= Date: Fri, 16 Jan 2015 21:09:50 +0100 Subject: [PATCH 2/3] Revert "Gradient fill reader" This reverts commit d5051cfb96a765235efae10722c109fbf4445388. --- ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk | 56 +--------------------------- ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk | 1 - ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk | 3 +- 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index 1d7d9bf..61c98f7 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -1265,7 +1265,6 @@ ENDMETHOD. lo_node_fill_child TYPE REF TO if_ixml_element, lo_node_bgcolor TYPE REF TO if_ixml_element, lo_node_fgcolor TYPE REF TO if_ixml_element, - lo_node_stop TYPE REF TO if_ixml_element, lo_fill TYPE REF TO zcl_excel_style_fill, ls_color TYPE t_color. @@ -1344,60 +1343,7 @@ ENDMETHOD. * gradientFill *--------------------------------------------------------------------* WHEN 'gradientFill'. - lo_fill->gradtype-type = lo_node_fill_child->get_attribute( 'type' ). - lo_fill->gradtype-top = lo_node_fill_child->get_attribute( 'top' ). - lo_fill->gradtype-left = lo_node_fill_child->get_attribute( 'left' ). - lo_fill->gradtype-right = lo_node_fill_child->get_attribute( 'right' ). - lo_fill->gradtype-bottom = lo_node_fill_child->get_attribute( 'bottom' ). - lo_fill->gradtype-degree = lo_node_fill_child->get_attribute( 'degree' ). - free lo_node_stop. - lo_node_stop ?= lo_node_fill_child->find_from_name( 'stop' ). - while lo_node_stop is bound. - if lo_fill->gradtype-position1 is initial. - lo_fill->gradtype-position1 = lo_node_stop->get_attribute( 'position' ). - lo_node_bgcolor = lo_node_stop->find_from_name( 'color' ). - IF lo_node_bgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_bgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->bgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->bgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->bgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->bgcolor-tint = ls_color-tint. - ENDIF. - elseif lo_fill->gradtype-position2 is initial. - lo_fill->gradtype-position2 = lo_node_stop->get_attribute( 'position' ). - lo_node_fgcolor = lo_node_stop->find_from_name( 'color' ). - IF lo_node_fgcolor IS BOUND. - fill_struct_from_attributes( EXPORTING - ip_element = lo_node_fgcolor - CHANGING - cp_structure = ls_color ). - - lo_fill->fgcolor-rgb = ls_color-rgb. - IF ls_color-indexed IS NOT INITIAL. - lo_fill->fgcolor-indexed = ls_color-indexed. - ENDIF. - - IF ls_color-theme IS NOT INITIAL. - lo_fill->fgcolor-theme = ls_color-theme. - ENDIF. - lo_fill->fgcolor-tint = ls_color-tint. - ENDIF. - elseif lo_fill->gradtype-position3 is initial. - lo_fill->gradtype-position3 = lo_node_stop->get_attribute( 'position' ). - "BGColor is filled already with position 1 no need to check again - endif. - - lo_node_stop ?= lo_node_stop->get_next( ). - ENDWHILE. + " 2do§1 Support gradientFill WHEN OTHERS. diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk index 10e1aae..e2d4061 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk @@ -50,7 +50,6 @@ method build_gradient. check check_filltype_is_gradient( ) eq abap_true. - clear gradtype. case filltype. when c_fill_gradient_horizontal90. gradtype-degree = '90'. diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk index 186f35e..6e6cfaf 100644 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk +++ b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk @@ -1,8 +1,7 @@ - + - From 29c7e3eb7d5356a8d2ac67ff961b05ec71940be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20P=C4=99giel?= Date: Fri, 16 Jan 2015 21:14:17 +0100 Subject: [PATCH 3/3] GF added handling of gradient fill in reader --- ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk | 56 +++++++++++++++++++++++++++- ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk | 1 + ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk | 3 +- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index 61c98f7..1d7d9bf 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -1265,6 +1265,7 @@ ENDMETHOD. lo_node_fill_child TYPE REF TO if_ixml_element, lo_node_bgcolor TYPE REF TO if_ixml_element, lo_node_fgcolor TYPE REF TO if_ixml_element, + lo_node_stop TYPE REF TO if_ixml_element, lo_fill TYPE REF TO zcl_excel_style_fill, ls_color TYPE t_color. @@ -1343,7 +1344,60 @@ ENDMETHOD. * gradientFill *--------------------------------------------------------------------* WHEN 'gradientFill'. - " 2do§1 Support gradientFill + lo_fill->gradtype-type = lo_node_fill_child->get_attribute( 'type' ). + lo_fill->gradtype-top = lo_node_fill_child->get_attribute( 'top' ). + lo_fill->gradtype-left = lo_node_fill_child->get_attribute( 'left' ). + lo_fill->gradtype-right = lo_node_fill_child->get_attribute( 'right' ). + lo_fill->gradtype-bottom = lo_node_fill_child->get_attribute( 'bottom' ). + lo_fill->gradtype-degree = lo_node_fill_child->get_attribute( 'degree' ). + free lo_node_stop. + lo_node_stop ?= lo_node_fill_child->find_from_name( 'stop' ). + while lo_node_stop is bound. + if lo_fill->gradtype-position1 is initial. + lo_fill->gradtype-position1 = lo_node_stop->get_attribute( 'position' ). + lo_node_bgcolor = lo_node_stop->find_from_name( 'color' ). + IF lo_node_bgcolor IS BOUND. + fill_struct_from_attributes( EXPORTING + ip_element = lo_node_bgcolor + CHANGING + cp_structure = ls_color ). + + lo_fill->bgcolor-rgb = ls_color-rgb. + IF ls_color-indexed IS NOT INITIAL. + lo_fill->bgcolor-indexed = ls_color-indexed. + ENDIF. + + IF ls_color-theme IS NOT INITIAL. + lo_fill->bgcolor-theme = ls_color-theme. + ENDIF. + lo_fill->bgcolor-tint = ls_color-tint. + ENDIF. + elseif lo_fill->gradtype-position2 is initial. + lo_fill->gradtype-position2 = lo_node_stop->get_attribute( 'position' ). + lo_node_fgcolor = lo_node_stop->find_from_name( 'color' ). + IF lo_node_fgcolor IS BOUND. + fill_struct_from_attributes( EXPORTING + ip_element = lo_node_fgcolor + CHANGING + cp_structure = ls_color ). + + lo_fill->fgcolor-rgb = ls_color-rgb. + IF ls_color-indexed IS NOT INITIAL. + lo_fill->fgcolor-indexed = ls_color-indexed. + ENDIF. + + IF ls_color-theme IS NOT INITIAL. + lo_fill->fgcolor-theme = ls_color-theme. + ENDIF. + lo_fill->fgcolor-tint = ls_color-tint. + ENDIF. + elseif lo_fill->gradtype-position3 is initial. + lo_fill->gradtype-position3 = lo_node_stop->get_attribute( 'position' ). + "BGColor is filled already with position 1 no need to check again + endif. + + lo_node_stop ?= lo_node_stop->get_next( ). + ENDWHILE. WHEN OTHERS. diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk index e2d4061..10e1aae 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE_FILL.slnk @@ -50,6 +50,7 @@ method build_gradient. check check_filltype_is_gradient( ) eq abap_true. + clear gradtype. case filltype. when c_fill_gradient_horizontal90. gradtype-degree = '90'. diff --git a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk index 6e6cfaf..186f35e 100644 --- a/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk +++ b/ZA2X/TTYP/ZEXCEL_T_STYLE_FILL.slnk @@ -1,7 +1,8 @@ - + +