unioffice/vmldrawing/vmldrawing.go
2022-04-09 14:27:46 +00:00

94 lines
16 KiB
Go

//
// 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/
package vmldrawing ;import (_c "encoding/xml";_a "fmt";_f "github.com/unidoc/unioffice";_da "github.com/unidoc/unioffice/common/logger";_cb "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_d "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/office/excel";_e "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml";_aa "strconv";_gg "strings";);
// Left get left attribute of shape style.
func (_fgf *ShapeStyle )Left ()float64 {return _fgf ._afg };func (_fc *Container )UnmarshalXML (d *_c .Decoder ,start _c .StartElement )error {_fc .Shape =nil ;_ccf :for {_cf ,_gaf :=d .Token ();if _gaf !=nil {return _gaf ;};switch _fga :=_cf .(type ){case _c .StartElement :switch _fga .Name .Local {case "s\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074":_fc .Layout =_e .NewOfcShapelayout ();if _ee :=d .DecodeElement (_fc .Layout ,&_fga );_ee !=nil {return _ee ;};case "\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e":_fc .ShapeType =_e .NewShapetype ();if _ed :=d .DecodeElement (_fc .ShapeType ,&_fga );_ed !=nil {return _ed ;};case "\u0073\u0068\u0061p\u0065":_fgad :=_e .NewShape ();if _ffg :=d .DecodeElement (_fgad ,&_fga );_ffg !=nil {return _ffg ;};_fc .Shape =append (_fc .Shape ,_fgad );};case _c .EndElement :break _ccf ;};};return nil ;};
// NewTextpathStyle accept value of string style attribute of element v:textpath and format it to generate TextpathStyle.
func NewTextpathStyle (style string )TextpathStyle {_eda :=TextpathStyle {_bff :"\u0022C\u0061\u006c\u0069\u0062\u0072\u0069\"",_de :44,_efec :false ,_abg :false };_eea :=_gg .Split (style ,"\u003b");for _ ,_dg :=range _eea {_cfe :=_gg .Split (_dg ,"\u003a");if len (_cfe )!=2{continue ;};switch _cfe [0]{case "f\u006f\u006e\u0074\u002d\u0066\u0061\u006d\u0069\u006c\u0079":_eda ._bff =_cfe [1];break ;case "\u0066o\u006e\u0074\u002d\u0073\u0069\u007ae":_eda ._de ,_ =_aa .ParseInt (_gg .ReplaceAll (_cfe [1],"\u0070\u0074",""),10,64);break ;case "f\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074":_eda ._efec =_cfe [1]=="\u0062\u006f\u006c\u0064";break ;case "\u0066\u006f\u006e\u0074\u002d\u0073\u0074\u0079\u006c\u0065":_eda ._abg =_cfe [1]=="\u0069\u0074\u0061\u006c\u0069\u0063";break ;};};return _eda ;};
// FontFamily returns fontFamily of the text.
func (_gda *TextpathStyle )FontFamily ()string {return _gda ._bff };func NewContainer ()*Container {return &Container {}};
// IsItalic returns true if text is italic.
func (_db *TextpathStyle )IsItalic ()bool {return _db ._abg };
// Margins get margin top, left, bottom, and right of shape style.
func (_fb *ShapeStyle )Margins ()(float64 ,float64 ,float64 ,float64 ){return _fb ._ef ,_fb ._be ,_fb ._fff ,_fb ._cd ;};
// ToString generate string of TextpathStyle.
func (_ffae *TextpathStyle )String ()string {_afd :="";_afd +=_a .Sprintf ("\u0066o\u006et\u002d\u0066\u0061\u006d\u0069\u006c\u0079\u003a\u0025\u0073\u003b",_ffae ._bff );_afd +=_a .Sprintf ("\u0066o\u006et\u002d\u0073\u0069\u007a\u0065\u003a\u0025\u0064\u0070\u0074\u003b",_ffae ._de );if _ffae ._abg {_afd +=_a .Sprintf ("\u0066o\u006et\u002d\u0073\u0074\u0079\u006ce\u003a\u0069t\u0061\u006c\u0069\u0063\u003b");};if _ffae ._efec {_afd +=_a .Sprintf ("\u0066\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074\u003ab\u006f\u006c\u0064\u003b");};return _afd ;};type Container struct{Layout *_e .OfcShapelayout ;ShapeType *_e .Shapetype ;Shape []*_e .Shape ;};
// Width return width of shape.
func (_ffd *ShapeStyle )Width ()float64 {return _ffd ._dc };
// TextpathStyle is style attribute of element v:textpath.
type TextpathStyle struct{_bff string ;_de int64 ;_efec bool ;_abg bool ;};
// IsBold returns true if text is bold.
func (_dgf *TextpathStyle )IsBold ()bool {return _dgf ._efec };
// Position get position attribute of shape style.
func (_ace *ShapeStyle )Position ()string {return _ace ._edb };
// SetWidth set width of shape.
func (_cba *ShapeStyle )SetWidth (width float64 ){_cba ._dc =width };
// SetBold sets text to bold.
func (_dfe *TextpathStyle )SetBold (bold bool ){_dfe ._efec =bold };
// ToString formatting ShapeStyle to string.
func (_aaa *ShapeStyle )String ()string {_age :="";_age +=_a .Sprintf ("\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u003a\u0025\u0073\u003b",_aaa ._edb );_age +=_a .Sprintf ("\u006da\u0072g\u0069\u006e\u002d\u006c\u0065\u0066\u0074\u003a\u0025\u0064\u003b",int64 (_aaa ._be ));_age +=_a .Sprintf ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006fp\u003a\u0025\u0064\u003b",int64 (_aaa ._ef ));_age +=_a .Sprintf ("w\u0069\u0064\u0074\u0068\u003a\u0025\u0064\u0070\u0074\u003b",int64 (_aaa ._dc ));_age +=_a .Sprintf ("\u0068\u0065\u0069g\u0068\u0074\u003a\u0025\u0064\u0070\u0074\u003b",int64 (_aaa ._fd ));_age +=_a .Sprintf ("z\u002d\u0069\u006e\u0064\u0065\u0078\u003a\u0025\u0064\u003b",_aaa ._bfb );_age +=_a .Sprintf ("m\u0073\u006f\u002d\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069z\u006f\u006e\u0074a\u006c:\u0025\u0073\u003b",_aaa ._fgbg );_age +=_a .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",_aaa ._bee );_age +=_a .Sprintf ("\u006ds\u006f\u002d\u0070\u006fs\u0069\u0074\u0069\u006f\u006e-\u0076e\u0072t\u0069\u0063\u0061\u006c\u003a\u0025\u0073;",_aaa ._eg );_age +=_a .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",_aaa ._edd );return _age ;};
// NewShapeStyle accept value of string style attribute in v:shape and format it to generate ShapeStyle.
func NewShapeStyle (style string )ShapeStyle {_eeb :=ShapeStyle {_dc :0,_fd :0};_ba :=_gg .Split (style ,"\u003b");for _ ,_ac :=range _ba {_fdg :=_gg .Split (_ac ,"\u003a");if len (_fdg )!=2{continue ;};var _ffa error ;switch _fdg [0]{case "\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e":_eeb ._edb =_fdg [1];break ;case "\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070":_eeb ._ef ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074":_eeb ._be ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0062\u006f\u0074\u0074\u006f\u006d":_eeb ._fff ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u006d\u0061\u0072g\u0069\u006e\u002d\u0072\u0069\u0067\u0068\u0074":_eeb ._cd ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u0074\u006f\u0070":_eeb ._efe ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u006c\u0065\u0066\u0074":_eeb ._afg ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u0062\u006f\u0074\u0074\u006f\u006d":_eeb ._ge ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u0072\u0069\u0067h\u0074":_eeb ._gd ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u0077\u0069\u0064t\u0068":_eeb ._dc ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u0068\u0065\u0069\u0067\u0068\u0074":_eeb ._fd ,_ffa =_aa .ParseFloat (_gg .ReplaceAll (_fdg [1],"\u0070\u0074",""),64);break ;case "\u007a-\u0069\u006e\u0064\u0065\u0078":_eeb ._bfb ,_ffa =_aa .ParseInt (_fdg [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":_eeb ._fgbg =_fdg [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":_eeb ._bee =_fdg [1];break ;case "m\u0073\u006f\u002d\u0070os\u0069t\u0069\u006f\u006e\u002d\u0076e\u0072\u0074\u0069\u0063\u0061\u006c":_eeb ._eg =_fdg [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":_eeb ._edd =_fdg [1];break ;};if _ffa !=nil {_da .Log .Debug ("\u0055n\u0061\u0062l\u0065\u0020\u0074o\u0020\u0070\u0061\u0072\u0073\u0065\u0020s\u0074\u0079\u006c\u0065\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u003a\u0020\u0025\u0073 \u0076\u0061\u006c\u0075\u0065\u003a\u0020\u0025\u0076",_fdg [0],_fdg [1]);};};return _eeb ;};
// SetHeight set height of shape.
func (_ab *ShapeStyle )SetHeight (height float64 ){_ab ._fd =height };
// SetFontSize sets text's fontSize.
func (_aee *TextpathStyle )SetFontSize (fontSize int64 ){_aee ._de =fontSize };
// Top get top attribute of shape style.
func (_ae *ShapeStyle )Top ()float64 {return _ae ._efe };
// ShapeStyle is style attribute of v:shape element.
type ShapeStyle struct{_edb string ;_ef float64 ;_be float64 ;_fff float64 ;_cd float64 ;_efe float64 ;_afg float64 ;_ge float64 ;_gd float64 ;_dc float64 ;_fd float64 ;_bfb int64 ;_fgbg string ;_bee string ;_eg string ;_edd string ;};
// CreateFormula creates F element for typeFormulas.
func CreateFormula (s string )*_e .CT_F {_efd :=_e .NewCT_F ();_efd .EqnAttr =&s ;return _efd };
// SetFontFamily sets text's fontFamily.
func (_edg *TextpathStyle )SetFontFamily (fontFamily string ){_edg ._bff =fontFamily };const (ShapeStylePositionAbsolute ="\u0061\u0062\u0073\u006f\u006c\u0075\u0074\u0065";ShapeStylePositionRelative ="\u0072\u0065\u006c\u0061\u0074\u0069\u0076\u0065";);
// SetItalic sets text to italic.
func (_acb *TextpathStyle )SetItalic (italic bool ){_acb ._abg =italic };
// Bottom get bottom attribute of shape style.
func (_gafc *ShapeStyle )Bottom ()float64 {return _gafc ._ge };
// FontSize returns fontSize of the text.
func (_ccc *TextpathStyle )FontSize ()int64 {return _ccc ._de };
// NewCommentShape creates a new comment shape for a given cell index. The
// indices here are zero based.
func NewCommentShape (col ,row int64 )*_e .Shape {_daf :=_e .NewShape ();_daf .IdAttr =_f .String (_a .Sprintf ("\u0063\u0073\u005f\u0025\u0064\u005f\u0025\u0064",col ,row ));_daf .TypeAttr =_f .String ("\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_daf .StyleAttr =_f .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");_daf .FillcolorAttr =_f .String ("\u0023f\u0062\u0066\u0036\u0064\u0036");_daf .StrokecolorAttr =_f .String ("\u0023e\u0064\u0065\u0061\u0061\u0031");_fgc :=_e .NewEG_ShapeElements ();_fgc .Fill =_e .NewFill ();_fgc .Fill .Color2Attr =_f .String ("\u0023f\u0062\u0066\u0065\u0038\u0032");_fgc .Fill .AngleAttr =_f .Float64 (-180);_fgc .Fill .TypeAttr =_e .ST_FillTypeGradient ;_fgc .Fill .Fill =_e .NewOfcFill ();_fgc .Fill .Fill .ExtAttr =_e .ST_ExtView ;_fgc .Fill .Fill .TypeAttr =_e .OfcST_FillTypeGradientUnscaled ;_daf .EG_ShapeElements =append (_daf .EG_ShapeElements ,_fgc );_eb :=_e .NewEG_ShapeElements ();_eb .Shadow =_e .NewShadow ();_eb .Shadow .OnAttr =_cb .ST_TrueFalseT ;_eb .Shadow .ObscuredAttr =_cb .ST_TrueFalseT ;_daf .EG_ShapeElements =append (_daf .EG_ShapeElements ,_eb );_ag :=_e .NewEG_ShapeElements ();_ag .Path =_e .NewPath ();_ag .Path .ConnecttypeAttr =_e .OfcST_ConnectTypeNone ;_daf .EG_ShapeElements =append (_daf .EG_ShapeElements ,_ag );_cc :=_e .NewEG_ShapeElements ();_cc .Textbox =_e .NewTextbox ();_cc .Textbox .StyleAttr =_f .String ("\u006d\u0073\u006f\u002ddi\u0072\u0065\u0063\u0074\u0069\u006f\u006e\u002d\u0061\u006c\u0074\u003a\u0061\u0075t\u006f");_daf .EG_ShapeElements =append (_daf .EG_ShapeElements ,_cc );_ff :=_e .NewEG_ShapeElements ();_ff .ClientData =_d .NewClientData ();_ff .ClientData .ObjectTypeAttr =_d .ST_ObjectTypeNote ;_ff .ClientData .MoveWithCells =_cb .ST_TrueFalseBlankT ;_ff .ClientData .SizeWithCells =_cb .ST_TrueFalseBlankT ;_ff .ClientData .Anchor =_f .String ("\u0031,\u0020\u0031\u0035\u002c\u0020\u0030\u002c\u0020\u0032\u002c\u00202\u002c\u0020\u0035\u0034\u002c\u0020\u0035\u002c\u0020\u0033");_ff .ClientData .AutoFill =_cb .ST_TrueFalseBlankFalse ;_ff .ClientData .Row =_f .Int64 (row );_ff .ClientData .Column =_f .Int64 (col );_daf .EG_ShapeElements =append (_daf .EG_ShapeElements ,_ff );return _daf ;};
// Height return height of shape.
func (_df *ShapeStyle )Height ()float64 {return _df ._fd };
// NewCommentDrawing constructs a new comment drawing.
func NewCommentDrawing ()*Container {_fe :=NewContainer ();_fe .Layout =_e .NewOfcShapelayout ();_fe .Layout .ExtAttr =_e .ST_ExtEdit ;_fe .Layout .Idmap =_e .NewOfcCT_IdMap ();_fe .Layout .Idmap .DataAttr =_f .String ("\u0031");_fe .Layout .Idmap .ExtAttr =_e .ST_ExtEdit ;_fe .ShapeType =_e .NewShapetype ();_fe .ShapeType .IdAttr =_f .String ("_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_fe .ShapeType .CoordsizeAttr =_f .String ("2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030");_fe .ShapeType .SptAttr =_f .Float32 (202);_fe .ShapeType .PathAttr =_f .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");_fg :=_e .NewEG_ShapeElements ();_fe .ShapeType .EG_ShapeElements =append (_fe .ShapeType .EG_ShapeElements ,_fg );_fg .Path =_e .NewPath ();_fg .Path .GradientshapeokAttr =_cb .ST_TrueFalseT ;_fg .Path .ConnecttypeAttr =_e .OfcST_ConnectTypeRect ;return _fe ;};
// Right get right attribute of shape style.
func (_cbc *ShapeStyle )Right ()float64 {return _cbc ._gd };func (_ga *Container )MarshalXML (e *_c .Encoder ,start _c .StartElement )error {start .Attr =append (start .Attr ,_c .Attr {Name :_c .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 ,_c .Attr {Name :_c .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 ,_c .Attr {Name :_c .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 _ga .Layout !=nil {_af :=_c .StartElement {Name :_c .Name {Local :"\u006f\u003a\u0073\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074"}};e .EncodeElement (_ga .Layout ,_af );};if _ga .ShapeType !=nil {_b :=_c .StartElement {Name :_c .Name {Local :"v\u003a\u0073\u0068\u0061\u0070\u0065\u0074\u0079\u0070\u0065"}};e .EncodeElement (_ga .ShapeType ,_b );};for _ ,_agd :=range _ga .Shape {_bf :=_c .StartElement {Name :_c .Name {Local :"\u0076:\u0073\u0068\u0061\u0070\u0065"}};e .EncodeElement (_agd ,_bf );};return e .EncodeToken (_c .EndElement {Name :start .Name });};