2020-08-23 14:15:53 +00:00
|
|
|
//
|
|
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
|
|
//
|
|
|
|
// This is a commercial product and requires a license to operate.
|
|
|
|
// A trial license can be obtained at https://unidoc.io
|
|
|
|
//
|
|
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
|
2021-07-30 17:03:26 +00:00
|
|
|
package vmldrawing ;import (_e "encoding/xml";_b "fmt";_g "github.com/unidoc/unioffice";_c "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_bd "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/office/excel";_eb "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml";_bf "strconv";_ag "strings";);
|
|
|
|
|
|
|
|
// NewShapeStyle accept value of string style attribute in v:shape and format it to generate ShapeStyle.
|
|
|
|
func NewShapeStyle (style string )ShapeStyle {_be :=ShapeStyle {_fg :0,_bad :0};_geg :=_ag .Split (style ,"\u003b");for _ ,_dd :=range _geg {_ed :=_ag .Split (_dd ,"\u003a");if len (_ed )!=2{continue ;};switch _ed [0]{case "\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e":_be ._ec =_ed [1];break ;case "m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074":_be ._bb ,_ =_bf .ParseInt (_ed [1],10,64);break ;case "\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070":_be ._dc ,_ =_bf .ParseInt (_ed [1],10,64);break ;case "\u0077\u0069\u0064t\u0068":_be ._fg ,_ =_bf .ParseInt (_ag .ReplaceAll (_ed [1],"\u0070\u0074",""),10,64);break ;case "\u0068\u0065\u0069\u0067\u0068\u0074":_be ._bad ,_ =_bf .ParseInt (_ag .ReplaceAll (_ed [1],"\u0070\u0074",""),10,64);break ;case "\u007a-\u0069\u006e\u0064\u0065\u0078":_be ._gaa ,_ =_bf .ParseInt (_ed [1],10,64);break ;case "\u006d\u0073\u006f-p\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069\u007a\u006f\u006e\u0074\u0061\u006c":_be ._ad =_ed [1];break ;case "\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0068\u006fr\u0069z\u006f\u006e\u0074\u0061\u006c\u002d\u0072\u0065\u006c\u0061\u0074\u0069\u0076\u0065":_be ._bab =_ed [1];break ;case "m\u0073\u006f\u002d\u0070os\u0069t\u0069\u006f\u006e\u002d\u0076e\u0072\u0074\u0069\u0063\u0061\u006c":_be ._fgd =_ed [1];break ;case "\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069o\u006e\u002d\u0076\u0065\u0072\u0074\u0069c\u0061\u006c\u002d\u0072\u0065\u006c\u0061\u0074\u0069\u0076\u0065":_be ._dcb =_ed [1];break ;};};return _be ;};
|
|
|
|
|
|
|
|
// CreateFormula creates F element for typeFormulas.
|
|
|
|
func CreateFormula (s string )*_eb .CT_F {_cac :=_eb .NewCT_F ();_cac .EqnAttr =&s ;return _cac };
|
|
|
|
|
|
|
|
// ToString formatting ShapeStyle to string.
|
|
|
|
func (_dbb *ShapeStyle )String ()string {_fge :="";_fge +=_b .Sprintf ("\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u003a\u0025\u0073\u003b",_dbb ._ec );_fge +=_b .Sprintf ("\u006da\u0072g\u0069\u006e\u002d\u006c\u0065\u0066\u0074\u003a\u0025\u0064\u003b",_dbb ._bb );_fge +=_b .Sprintf ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006fp\u003a\u0025\u0064\u003b",_dbb ._dc );_fge +=_b .Sprintf ("w\u0069\u0064\u0074\u0068\u003a\u0025\u0064\u0070\u0074\u003b",_dbb ._fg );_fge +=_b .Sprintf ("\u0068\u0065\u0069g\u0068\u0074\u003a\u0025\u0064\u0070\u0074\u003b",_dbb ._bad );_fge +=_b .Sprintf ("z\u002d\u0069\u006e\u0064\u0065\u0078\u003a\u0025\u0064\u003b",_dbb ._gaa );_fge +=_b .Sprintf ("m\u0073\u006f\u002d\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069z\u006f\u006e\u0074a\u006c:\u0025\u0073\u003b",_dbb ._ad );_fge +=_b .Sprintf ("\u006d\u0073o-\u0070\u006f\u0073i\u0074\u0069\u006f\u006e-ho\u0072iz\u006f\u006e\u0074\u0061\u006c\u002d\u0072el\u0061\u0074\u0069\u0076\u0065\u003a\u0025s\u003b",_dbb ._bab );_fge +=_b .Sprintf ("\u006ds\u006f\u002d\u0070\u006fs\u0069\u0074\u0069\u006f\u006e-\u0076e\u0072t\u0069\u0063\u0061\u006c\u003a\u0025\u0073;",_dbb ._fgd );_fge +=_b .Sprintf ("\u006d\u0073\u006f-p\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0076e\u0072t\u0069c\u0061l\u002d\u0072\u0065\u006c\u0061\u0074\u0069\u0076\u0065\u003a\u0025\u0073\u003b",_dbb ._dcb );return _fge ;};
|
2021-06-16 07:10:52 +00:00
|
|
|
|
|
|
|
// NewCommentDrawing constructs a new comment drawing.
|
2021-07-30 17:03:26 +00:00
|
|
|
func NewCommentDrawing ()*Container {_ab :=NewContainer ();_ab .Layout =_eb .NewOfcShapelayout ();_ab .Layout .ExtAttr =_eb .ST_ExtEdit ;_ab .Layout .Idmap =_eb .NewOfcCT_IdMap ();_ab .Layout .Idmap .DataAttr =_g .String ("\u0031");_ab .Layout .Idmap .ExtAttr =_eb .ST_ExtEdit ;_ab .ShapeType =_eb .NewShapetype ();_ab .ShapeType .IdAttr =_g .String ("_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_ab .ShapeType .CoordsizeAttr =_g .String ("2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030");_ab .ShapeType .SptAttr =_g .Float32 (202);_ab .ShapeType .PathAttr =_g .String ("\u006d\u0030\u002c0l\u0030\u002c\u0032\u0031\u0036\u0030\u0030\u002c\u00321\u00360\u0030,\u00321\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030\u002c\u0030\u0078\u0065");_ca :=_eb .NewEG_ShapeElements ();_ab .ShapeType .EG_ShapeElements =append (_ab .ShapeType .EG_ShapeElements ,_ca );_ca .Path =_eb .NewPath ();_ca .Path .GradientshapeokAttr =_c .ST_TrueFalseT ;_ca .Path .ConnecttypeAttr =_eb .OfcST_ConnectTypeRect ;return _ab ;};
|
|
|
|
|
|
|
|
// SetWidth set width of shape.
|
|
|
|
func (_bbe *ShapeStyle )SetWidth (width int64 ){_bbe ._fg =width };func NewContainer ()*Container {return &Container {}};
|
|
|
|
|
|
|
|
// TextpathStyle is style attribute of element v:textpath.
|
|
|
|
type TextpathStyle struct{_gdga string ;_gb int64 ;_cd bool ;_gdc bool ;};
|
|
|
|
|
|
|
|
// IsBold returns true if text is bold.
|
|
|
|
func (_fgdc *TextpathStyle )IsBold ()bool {return _fgdc ._cd };
|
|
|
|
|
|
|
|
// Width return width of shape.
|
|
|
|
func (_dda *ShapeStyle )Width ()int64 {return _dda ._fg };
|
2020-08-23 14:15:53 +00:00
|
|
|
|
|
|
|
// NewCommentShape creates a new comment shape for a given cell index. The
|
|
|
|
// indices here are zero based.
|
2021-07-30 17:03:26 +00:00
|
|
|
func NewCommentShape (col ,row int64 )*_eb .Shape {_agg :=_eb .NewShape ();_agg .IdAttr =_g .String (_b .Sprintf ("\u0063\u0073\u005f\u0025\u0064\u005f\u0025\u0064",col ,row ));_agg .TypeAttr =_g .String ("\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_agg .StyleAttr =_g .String ("\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u003a\u0061\u0062\u0073\u006f\u006cu\u0074\u0065\u003b\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074:\u0038\u0030\u0070\u0074;\u006d\u0061\u0072\u0067\u0069n-\u0074o\u0070\u003a\u0032pt\u003b\u0077\u0069\u0064\u0074\u0068\u003a1\u0030\u0034\u0070\u0074\u003b\u0068\u0065\u0069\u0067\u0068\u0074\u003a\u0037\u0036\u0070\u0074\u003b\u007a\u002d\u0069\u006e\u0064\u0065x\u003a\u0031\u003bv\u0069\u0073\u0069\u0062\u0069\u006c\u0069t\u0079\u003a\u0068\u0069\u0064\u0064\u0065\u006e");_agg .FillcolorAttr =_g .String ("\u0023f\u0062\u0066\u0036\u0064\u0036");_agg .StrokecolorAttr =_g .String ("\u0023e\u0064\u0065\u0061\u0061\u0031");_ga :=_eb .NewEG_ShapeElements ();_ga .Fill =_eb .NewFill ();_ga .Fill .Color2Attr =_g .String ("\u0023f\u0062\u0066\u0065\u0038\u0032");_ga .Fill .AngleAttr =_g .Float64 (-180);_ga .Fill .TypeAttr =_eb .ST_FillTypeGradient ;_ga .Fill .Fill =_eb .NewOfcFill ();_ga .Fill .Fill .ExtAttr =_eb .ST_ExtView ;_ga .Fill .Fill .TypeAttr =_eb .OfcST_FillTypeGradientUnscaled ;_agg .EG_ShapeElements =append (_agg .EG_ShapeElements ,_ga );_bdb :=_eb .NewEG_ShapeElements ();_bdb .Shadow =_eb .NewShadow ();_bdb .Shadow .OnAttr =_c .ST_TrueFalseT ;_bdb .Shadow .ObscuredAttr =_c .ST_TrueFalseT ;_agg .EG_ShapeElements =append (_agg .EG_ShapeElements ,_bdb );_ebd :=_eb .NewEG_ShapeElements ();_ebd .Path =_eb .NewPath ();_ebd .Path .ConnecttypeAttr =_eb .OfcST_ConnectTypeNone ;_agg .EG_ShapeElements =append (_agg .EG_ShapeElements ,_ebd );_aa :=_eb .NewEG_ShapeElements ();_aa .Textbox =_eb .NewTextbox ();_aa .Textbox .StyleAttr =_g .String ("\u006d\u0073\u006f\u002ddi\u0072\u0065\u0063\u0074\u0069\u006f\u006e\u002d\u0061\u006c\u0074\u003a\u0061\u0075t\u006f");_agg .EG_ShapeElements =append (_agg .EG_ShapeElements ,_aa );_cb :=_eb .NewEG_ShapeElements ();_cb .ClientData =_bd .NewClientData ();_cb .ClientData .ObjectTypeAttr =_bd .ST_ObjectTypeNote ;_cb .ClientData .MoveWithCells =_c .ST_TrueFalseBlankT ;_cb .ClientData .SizeWithCells =_c .ST_TrueFalseBlankT ;_cb .ClientData .Anchor =_g .String ("\u0031,\u0020\u0031\u0035\u002c\u0020\u0030\u002c\u0020\u0032\u002c\u00202\u002c\u0020\u0035\u0034\u002c\u0020\u0035\u002c\u0020\u0033");_cb .ClientData .AutoFill =_c .ST_TrueFalseBlankFalse ;_cb .ClientData .Row =_g .Int64 (row );_cb .ClientData .Column =_g .Int64 (col );_agg .EG_ShapeElements =append (_agg .EG_ShapeElements ,_cb );return _agg ;};type Container struct{Layout *_eb .OfcShapelayout ;ShapeType *_eb .Shapetype ;Shape []*_eb .Shape ;};
|
|
|
|
|
|
|
|
// ToString generate string of TextpathStyle.
|
|
|
|
func (_cad *TextpathStyle )String ()string {_gde :="";_gde +=_b .Sprintf ("\u0066o\u006et\u002d\u0066\u0061\u006d\u0069\u006c\u0079\u003a\u0025\u0073\u003b",_cad ._gdga );_gde +=_b .Sprintf ("\u0066o\u006et\u002d\u0073\u0069\u007a\u0065\u003a\u0025\u0064\u0070\u0074\u003b",_cad ._gb );if _cad ._gdc {_gde +=_b .Sprintf ("\u0066o\u006et\u002d\u0073\u0074\u0079\u006ce\u003a\u0069t\u0061\u006c\u0069\u0063\u003b");};if _cad ._cd {_gde +=_b .Sprintf ("\u0066\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074\u003ab\u006f\u006c\u0064\u003b");};return _gde ;};
|
|
|
|
|
|
|
|
// NewTextpathStyle accept value of string style attribute of element v:textpath and format it to generate TextpathStyle.
|
|
|
|
func NewTextpathStyle (style string )TextpathStyle {_bdc :=TextpathStyle {_gdga :"\u0022C\u0061\u006c\u0069\u0062\u0072\u0069\"",_gb :44,_cd :false ,_gdc :false };_fc :=_ag .Split (style ,"\u003b");for _ ,_fd :=range _fc {_adb :=_ag .Split (_fd ,"\u003a");if len (_adb )!=2{continue ;};switch _adb [0]{case "f\u006f\u006e\u0074\u002d\u0066\u0061\u006d\u0069\u006c\u0079":_bdc ._gdga =_adb [1];break ;case "\u0066o\u006e\u0074\u002d\u0073\u0069\u007ae":_bdc ._gb ,_ =_bf .ParseInt (_ag .ReplaceAll (_adb [1],"\u0070\u0074",""),10,64);break ;case "f\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074":_bdc ._cd =_adb [1]=="\u0062\u006f\u006c\u0064";break ;case "\u0066\u006f\u006e\u0074\u002d\u0073\u0074\u0079\u006c\u0065":_bdc ._gdc =_adb [1]=="\u0069\u0074\u0061\u006c\u0069\u0063";break ;};};return _bdc ;};func (_f *Container )UnmarshalXML (d *_e .Decoder ,start _e .StartElement )error {_f .Shape =nil ;_bc :for {_ce ,_cc :=d .Token ();if _cc !=nil {return _cc ;};switch _ccd :=_ce .(type ){case _e .StartElement :switch _ccd .Name .Local {case "s\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074":_f .Layout =_eb .NewOfcShapelayout ();if _gd :=d .DecodeElement (_f .Layout ,&_ccd );_gd !=nil {return _gd ;};case "\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e":_f .ShapeType =_eb .NewShapetype ();if _ge :=d .DecodeElement (_f .ShapeType ,&_ccd );_ge !=nil {return _ge ;};case "\u0073\u0068\u0061p\u0065":_gae :=_eb .NewShape ();if _db :=d .DecodeElement (_gae ,&_ccd );_db !=nil {return _db ;};_f .Shape =append (_f .Shape ,_gae );};case _e .EndElement :break _bc ;};};return nil ;};
|
|
|
|
|
|
|
|
// SetHeight set height of shape.
|
|
|
|
func (_gdg *ShapeStyle )SetHeight (height int64 ){_gdg ._bad =height };
|
|
|
|
|
|
|
|
// FontFamily returns fontFamily of the text.
|
|
|
|
func (_bada *TextpathStyle )FontFamily ()string {return _bada ._gdga };
|
|
|
|
|
|
|
|
// IsItalic returns true if text is italic.
|
|
|
|
func (_de *TextpathStyle )IsItalic ()bool {return _de ._gdc };
|
|
|
|
|
|
|
|
// SetFontSize sets text's fontSize.
|
|
|
|
func (_bg *TextpathStyle )SetFontSize (fontSize int64 ){_bg ._gb =fontSize };
|
|
|
|
|
|
|
|
// Height return height of shape.
|
|
|
|
func (_dab *ShapeStyle )Height ()int64 {return _dab ._bad };
|
|
|
|
|
|
|
|
// FontSize returns fontSize of the text.
|
|
|
|
func (_cab *TextpathStyle )FontSize ()int64 {return _cab ._gb };
|
|
|
|
|
|
|
|
// SetItalic sets text to italic.
|
|
|
|
func (_ae *TextpathStyle )SetItalic (italic bool ){_ae ._gdc =italic };
|
|
|
|
|
|
|
|
// ShapeStyle is style attribute of v:shape element.
|
|
|
|
type ShapeStyle struct{_ec string ;_bb int64 ;_dc int64 ;_fg int64 ;_bad int64 ;_gaa int64 ;_ad string ;_bab string ;_fgd string ;_dcb string ;};
|
|
|
|
|
|
|
|
// SetBold sets text to bold.
|
|
|
|
func (_afe *TextpathStyle )SetBold (bold bool ){_afe ._cd =bold };func (_ba *Container )MarshalXML (e *_e .Encoder ,start _e .StartElement )error {start .Attr =append (start .Attr ,_e .Attr {Name :_e .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0076"},Value :"\u0075\u0072n\u003a\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002d\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002d\u0063\u006f\u006d:v\u006d\u006c"});start .Attr =append (start .Attr ,_e .Attr {Name :_e .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u006f"},Value :"\u0075\u0072\u006e\u003a\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002d\u006di\u0063\u0072\u006f\u0073\u006f\u0066t\u002d\u0063\u006f\u006d\u003a\u006f\u0066\u0066\u0069\u0063\u0065\u003a\u006ff\u0066\u0069\u0063\u0065"});start .Attr =append (start .Attr ,_e .Attr {Name :_e .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0078"},Value :"\u0075\u0072\u006e\u003a\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002d\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002d\u0063\u006fm\u003a\u006f\u0066\u0066\u0069c\u0065\u003ae\u0078\u0063\u0065\u006c"});start .Name .Local ="\u0078\u006d\u006c";e .EncodeToken (start );if _ba .Layout !=nil {_cbg :=_e .StartElement {Name :_e .Name {Local :"\u006f\u003a\u0073\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074"}};e .EncodeElement (_ba .Layout ,_cbg );};if _ba .ShapeType !=nil {_af :=_e .StartElement {Name :_e .Name {Local :"v\u003a\u0073\u0068\u0061\u0070\u0065\u0074\u0079\u0070\u0065"}};e .EncodeElement (_ba .ShapeType ,_af );};for _ ,_ac :=range _ba .Shape {_da :=_e .StartElement {Name :_e .Name {Local :"\u0076:\u0073\u0068\u0061\u0070\u0065"}};e .EncodeElement (_ac ,_da );};return e .EncodeToken (_e .EndElement {Name :start .Name });};
|
|
|
|
|
|
|
|
// SetFontFamily sets text's fontFamily.
|
|
|
|
func (_eg *TextpathStyle )SetFontFamily (fontFamily string ){_eg ._gdga =fontFamily };
|