*----------------------------------------------------------------------*
* CLASS ZCL_EXCEL_STYLE_FILL DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class zcl_excel_style_fill definition
public
final
create public .
public section.
constants c_fill_none type zexcel_fill_type value 'none'. "#EC NOTEXT
constants c_fill_solid type zexcel_fill_type value 'solid'. "#EC NOTEXT
constants c_fill_gradient_linear type zexcel_fill_type value 'linear'. "#EC NOTEXT
constants c_fill_gradient_path type zexcel_fill_type value 'path'. "#EC NOTEXT
constants c_fill_pattern_darkdown type zexcel_fill_type value 'darkDown'. "#EC NOTEXT
constants c_fill_pattern_darkgray type zexcel_fill_type value 'darkGray'. "#EC NOTEXT
constants c_fill_pattern_darkgrid type zexcel_fill_type value 'darkGrid'. "#EC NOTEXT
constants c_fill_pattern_darkhorizontal type zexcel_fill_type value 'darkHorizontal'. "#EC NOTEXT
constants c_fill_pattern_darktrellis type zexcel_fill_type value 'darkTrellis'. "#EC NOTEXT
constants c_fill_pattern_darkup type zexcel_fill_type value 'darkUp'. "#EC NOTEXT
constants c_fill_pattern_darkvertical type zexcel_fill_type value 'darkVertical'. "#EC NOTEXT
constants c_fill_pattern_gray0625 type zexcel_fill_type value 'gray0625'. "#EC NOTEXT
constants c_fill_pattern_gray125 type zexcel_fill_type value 'gray125'. "#EC NOTEXT
constants c_fill_pattern_lightdown type zexcel_fill_type value 'lightDown'. "#EC NOTEXT
constants c_fill_pattern_lightgray type zexcel_fill_type value 'lightGray'. "#EC NOTEXT
constants c_fill_pattern_lightgrid type zexcel_fill_type value 'lightGrid'. "#EC NOTEXT
constants c_fill_pattern_lighthorizontal type zexcel_fill_type value 'lightHorizontal'. "#EC NOTEXT
constants c_fill_pattern_lighttrellis type zexcel_fill_type value 'lightTrellis'. "#EC NOTEXT
constants c_fill_pattern_lightup type zexcel_fill_type value 'lightUp'. "#EC NOTEXT
constants c_fill_pattern_lightvertical type zexcel_fill_type value 'lightVertical'. "#EC NOTEXT
constants c_fill_pattern_mediumgray type zexcel_fill_type value 'mediumGray'. "#EC NOTEXT
constants c_fill_gradient_horizontal90 type zexcel_fill_type value 'horizontal90'. "#EC NOTEXT
constants c_fill_gradient_horizontal270 type zexcel_fill_type value 'horizontal270'. "#EC NOTEXT
constants c_fill_gradient_horizontalb type zexcel_fill_type value 'horizontalb'. "#EC NOTEXT
constants c_fill_gradient_vertical type zexcel_fill_type value 'vertical'. "#EC NOTEXT
constants c_fill_gradient_fromcenter type zexcel_fill_type value 'fromCenter'. "#EC NOTEXT
constants c_fill_gradient_diagonal45 type zexcel_fill_type value 'diagonal45'. "#EC NOTEXT
constants c_fill_gradient_diagonal45b type zexcel_fill_type value 'diagonal45b'. "#EC NOTEXT
constants c_fill_gradient_diagonal135 type zexcel_fill_type value 'diagonal135'. "#EC NOTEXT
constants c_fill_gradient_diagonal135b type zexcel_fill_type value 'diagonal135b'. "#EC NOTEXT
constants c_fill_gradient_cornerlt type zexcel_fill_type value 'cornerLT'. "#EC NOTEXT
constants c_fill_gradient_cornerlb type zexcel_fill_type value 'cornerLB'. "#EC NOTEXT
constants c_fill_gradient_cornerrt type zexcel_fill_type value 'cornerRT'. "#EC NOTEXT
constants c_fill_gradient_cornerrb type zexcel_fill_type value 'cornerRB'. "#EC NOTEXT
data gradtype type zexcel_s_gradient_type.
data filltype type zexcel_fill_type .
data rotation type zexcel_rotation .
data fgcolor type zexcel_s_style_color .
data bgcolor type zexcel_s_style_color .
methods constructor .
methods get_structure
returning
value(es_fill) type zexcel_s_style_fill .protected section.private section.
methods build_gradient.
methods check_filltype_is_gradient returning value(rv_is_gradient) type abap_bool.*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature*"* use this source file for any macro definitions you need
*"* in the implementation part of the classmethod build_gradient.
check check_filltype_is_gradient( ) eq abap_true.
case filltype.
when c_fill_gradient_horizontal90.
gradtype-degree = '90'.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_horizontal270.
gradtype-degree = '270'.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_horizontalb.
gradtype-degree = '90'.
gradtype-position1 = '0'.
gradtype-position2 = '0.5'.
gradtype-position3 = '1'.
when c_fill_gradient_vertical.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_fromcenter.
gradtype-type = c_fill_gradient_path.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
gradtype-bottom = '0.5'.
gradtype-top = '0.5'.
gradtype-left = '0.5'.
gradtype-right = '0.5'.
when c_fill_gradient_diagonal45.
gradtype-degree = '45'.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_diagonal45b.
gradtype-degree = '45'.
gradtype-position1 = '0'.
gradtype-position2 = '0.5'.
gradtype-position3 = '1'.
when c_fill_gradient_diagonal135.
gradtype-degree = '135'.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_diagonal135b.
gradtype-degree = '135'.
gradtype-position1 = '0'.
gradtype-position2 = '0.5'.
gradtype-position3 = '1'.
when c_fill_gradient_cornerlt.
gradtype-type = c_fill_gradient_path.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
when c_fill_gradient_cornerlb.
gradtype-type = c_fill_gradient_path.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
gradtype-bottom = '1'.
gradtype-top = '1'.
when c_fill_gradient_cornerrt.
gradtype-type = c_fill_gradient_path.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
gradtype-left = '1'.
gradtype-right = '1'.
when c_fill_gradient_cornerrb.
gradtype-type = c_fill_gradient_path.
gradtype-position1 = '0'.
gradtype-position2 = '1'.
gradtype-bottom = '0.5'.
gradtype-top = '0.5'.
gradtype-left = '0.5'.
gradtype-right = '0.5'.
endcase.
endmethod. "build_gradientmethod check_filltype_is_gradient.
case filltype.
when c_fill_gradient_horizontal90 or
c_fill_gradient_horizontal270 or
c_fill_gradient_horizontalb or
c_fill_gradient_vertical or
c_fill_gradient_fromcenter or
c_fill_gradient_diagonal45 or
c_fill_gradient_diagonal45b or
c_fill_gradient_diagonal135 or
c_fill_gradient_diagonal135b or
c_fill_gradient_cornerlt or
c_fill_gradient_cornerlb or
c_fill_gradient_cornerrt or
c_fill_gradient_cornerrb.
rv_is_gradient = abap_true.
endcase.
endmethod. "check_filltype_is_gradientmethod constructor.
filltype = zcl_excel_style_fill=>c_fill_none.
fgcolor-theme = zcl_excel_style_color=>c_theme_not_set.
fgcolor-indexed = zcl_excel_style_color=>c_indexed_not_set.
bgcolor-theme = zcl_excel_style_color=>c_theme_not_set.
bgcolor-indexed = zcl_excel_style_color=>c_indexed_sys_foreground.
rotation = 0.
endmethod. "CONSTRUCTORmethod get_structure.
es_fill-rotation = me->rotation.
es_fill-filltype = me->filltype.
es_fill-fgcolor = me->fgcolor.
es_fill-bgcolor = me->bgcolor.
me->build_gradient( ).
es_fill-gradtype = me->gradtype.
endmethod. "GET_STRUCTURE