mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +08:00
76 lines
14 KiB
Go
76 lines
14 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 (_g "encoding/xml";_d "fmt";_a "github.com/unidoc/unioffice";_cg "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_e "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/office/excel";_ca "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml";_b "strconv";_ce "strings";);func NewContainer ()*Container {return &Container {}};
|
|
|
|
// NewTextpathStyle accept value of string style attribute of element v:textpath and format it to generate TextpathStyle.
|
|
func NewTextpathStyle (style string )TextpathStyle {_ccc :=TextpathStyle {_gbd :"\u0022C\u0061\u006c\u0069\u0062\u0072\u0069\"",_bc :44,_dbb :false ,_adc :false };_bfe :=_ce .Split (style ,"\u003b");for _ ,_ebb :=range _bfe {_dc :=_ce .Split (_ebb ,"\u003a");if len (_dc )!=2{continue ;};switch _dc [0]{case "f\u006f\u006e\u0074\u002d\u0066\u0061\u006d\u0069\u006c\u0079":_ccc ._gbd =_dc [1];break ;case "\u0066o\u006e\u0074\u002d\u0073\u0069\u007ae":_ccc ._bc ,_ =_b .ParseInt (_ce .ReplaceAll (_dc [1],"\u0070\u0074",""),10,64);break ;case "f\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074":_ccc ._dbb =_dc [1]=="\u0062\u006f\u006c\u0064";break ;case "\u0066\u006f\u006e\u0074\u002d\u0073\u0074\u0079\u006c\u0065":_ccc ._adc =_dc [1]=="\u0069\u0074\u0061\u006c\u0069\u0063";break ;};};return _ccc ;};
|
|
|
|
// NewCommentDrawing constructs a new comment drawing.
|
|
func NewCommentDrawing ()*Container {_de :=NewContainer ();_de .Layout =_ca .NewOfcShapelayout ();_de .Layout .ExtAttr =_ca .ST_ExtEdit ;_de .Layout .Idmap =_ca .NewOfcCT_IdMap ();_de .Layout .Idmap .DataAttr =_a .String ("\u0031");_de .Layout .Idmap .ExtAttr =_ca .ST_ExtEdit ;_de .ShapeType =_ca .NewShapetype ();_de .ShapeType .IdAttr =_a .String ("_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_de .ShapeType .CoordsizeAttr =_a .String ("2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030");_de .ShapeType .SptAttr =_a .Float32 (202);_de .ShapeType .PathAttr =_a .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");_da :=_ca .NewEG_ShapeElements ();_de .ShapeType .EG_ShapeElements =append (_de .ShapeType .EG_ShapeElements ,_da );_da .Path =_ca .NewPath ();_da .Path .GradientshapeokAttr =_cg .ST_TrueFalseT ;_da .Path .ConnecttypeAttr =_ca .OfcST_ConnectTypeRect ;return _de ;};
|
|
|
|
// IsBold returns true if text is bold.
|
|
func (_ffg *TextpathStyle )IsBold ()bool {return _ffg ._dbb };
|
|
|
|
// ToString generate string of TextpathStyle.
|
|
func (_bcd *TextpathStyle )String ()string {_dag :="";_dag +=_d .Sprintf ("\u0066o\u006et\u002d\u0066\u0061\u006d\u0069\u006c\u0079\u003a\u0025\u0073\u003b",_bcd ._gbd );_dag +=_d .Sprintf ("\u0066o\u006et\u002d\u0073\u0069\u007a\u0065\u003a\u0025\u0064\u0070\u0074\u003b",_bcd ._bc );if _bcd ._adc {_dag +=_d .Sprintf ("\u0066o\u006et\u002d\u0073\u0074\u0079\u006ce\u003a\u0069t\u0061\u006c\u0069\u0063\u003b");};if _bcd ._dbb {_dag +=_d .Sprintf ("\u0066\u006f\u006e\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074\u003ab\u006f\u006c\u0064\u003b");};return _dag ;};
|
|
|
|
// TextpathStyle is style attribute of element v:textpath.
|
|
type TextpathStyle struct{_gbd string ;_bc int64 ;_dbb bool ;_adc bool ;};
|
|
|
|
// FontSize returns fontSize of the text.
|
|
func (_fd *TextpathStyle )FontSize ()int64 {return _fd ._bc };
|
|
|
|
// FontFamily returns fontFamily of the text.
|
|
func (_fea *TextpathStyle )FontFamily ()string {return _fea ._gbd };
|
|
|
|
// ToString formatting ShapeStyle to string.
|
|
func (_ge *ShapeStyle )String ()string {_dd :="";_dd +=_d .Sprintf ("\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u003a\u0025\u0073\u003b",_ge ._dae );_dd +=_d .Sprintf ("\u006da\u0072g\u0069\u006e\u002d\u006c\u0065\u0066\u0074\u003a\u0025\u0064\u003b",_ge ._gf );_dd +=_d .Sprintf ("\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006fp\u003a\u0025\u0064\u003b",_ge ._dac );_dd +=_d .Sprintf ("w\u0069\u0064\u0074\u0068\u003a\u0025\u0064\u0070\u0074\u003b",_ge ._ad );_dd +=_d .Sprintf ("\u0068\u0065\u0069g\u0068\u0074\u003a\u0025\u0064\u0070\u0074\u003b",_ge ._fg );_dd +=_d .Sprintf ("z\u002d\u0069\u006e\u0064\u0065\u0078\u003a\u0025\u0064\u003b",_ge ._db );_dd +=_d .Sprintf ("m\u0073\u006f\u002d\u0070\u006f\u0073i\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069z\u006f\u006e\u0074a\u006c:\u0025\u0073\u003b",_ge ._bf );_dd +=_d .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",_ge ._cga );_dd +=_d .Sprintf ("\u006ds\u006f\u002d\u0070\u006fs\u0069\u0074\u0069\u006f\u006e-\u0076e\u0072t\u0069\u0063\u0061\u006c\u003a\u0025\u0073;",_ge ._fe );_dd +=_d .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",_ge ._cef );return _dd ;};
|
|
|
|
// IsItalic returns true if text is italic.
|
|
func (_abaf *TextpathStyle )IsItalic ()bool {return _abaf ._adc };func (_ab *Container )MarshalXML (e *_g .Encoder ,start _g .StartElement )error {start .Attr =append (start .Attr ,_g .Attr {Name :_g .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 ,_g .Attr {Name :_g .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 ,_g .Attr {Name :_g .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 _ab .Layout !=nil {_cc :=_g .StartElement {Name :_g .Name {Local :"\u006f\u003a\u0073\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074"}};e .EncodeElement (_ab .Layout ,_cc );};if _ab .ShapeType !=nil {_bg :=_g .StartElement {Name :_g .Name {Local :"v\u003a\u0073\u0068\u0061\u0070\u0065\u0074\u0079\u0070\u0065"}};e .EncodeElement (_ab .ShapeType ,_bg );};for _ ,_ec :=range _ab .Shape {_bb :=_g .StartElement {Name :_g .Name {Local :"\u0076:\u0073\u0068\u0061\u0070\u0065"}};e .EncodeElement (_ec ,_bb );};return e .EncodeToken (_g .EndElement {Name :start .Name });};type Container struct{Layout *_ca .OfcShapelayout ;ShapeType *_ca .Shapetype ;Shape []*_ca .Shape ;};
|
|
|
|
// SetFontSize sets text's fontSize.
|
|
func (_fgb *TextpathStyle )SetFontSize (fontSize int64 ){_fgb ._bc =fontSize };
|
|
|
|
// SetFontFamily sets text's fontFamily.
|
|
func (_abe *TextpathStyle )SetFontFamily (fontFamily string ){_abe ._gbd =fontFamily };
|
|
|
|
// NewShapeStyle accept value of string style attribute in v:shape and format it to generate ShapeStyle.
|
|
func NewShapeStyle (style string )ShapeStyle {_gb :=ShapeStyle {_ad :0,_fg :0};_cge :=_ce .Split (style ,"\u003b");for _ ,_cgaf :=range _cge {_ae :=_ce .Split (_cgaf ,"\u003a");if len (_ae )!=2{continue ;};switch _ae [0]{case "\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e":_gb ._dae =_ae [1];break ;case "m\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074":_gb ._gf ,_ =_b .ParseInt (_ae [1],10,64);break ;case "\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070":_gb ._dac ,_ =_b .ParseInt (_ae [1],10,64);break ;case "\u0077\u0069\u0064t\u0068":_gb ._ad ,_ =_b .ParseInt (_ce .ReplaceAll (_ae [1],"\u0070\u0074",""),10,64);break ;case "\u0068\u0065\u0069\u0067\u0068\u0074":_gb ._fg ,_ =_b .ParseInt (_ce .ReplaceAll (_ae [1],"\u0070\u0074",""),10,64);break ;case "\u007a-\u0069\u006e\u0064\u0065\u0078":_gb ._db ,_ =_b .ParseInt (_ae [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":_gb ._bf =_ae [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":_gb ._cga =_ae [1];break ;case "m\u0073\u006f\u002d\u0070os\u0069t\u0069\u006f\u006e\u002d\u0076e\u0072\u0074\u0069\u0063\u0061\u006c":_gb ._fe =_ae [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":_gb ._cef =_ae [1];break ;};};return _gb ;};
|
|
|
|
// NewCommentShape creates a new comment shape for a given cell index. The
|
|
// indices here are zero based.
|
|
func NewCommentShape (col ,row int64 )*_ca .Shape {_ag :=_ca .NewShape ();_ag .IdAttr =_a .String (_d .Sprintf ("\u0063\u0073\u005f\u0025\u0064\u005f\u0025\u0064",col ,row ));_ag .TypeAttr =_a .String ("\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0032\u0030\u0032");_ag .StyleAttr =_a .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");_ag .FillcolorAttr =_a .String ("\u0023f\u0062\u0066\u0036\u0064\u0036");_ag .StrokecolorAttr =_a .String ("\u0023e\u0064\u0065\u0061\u0061\u0031");_f :=_ca .NewEG_ShapeElements ();_f .Fill =_ca .NewFill ();_f .Fill .Color2Attr =_a .String ("\u0023f\u0062\u0066\u0065\u0038\u0032");_f .Fill .AngleAttr =_a .Float64 (-180);_f .Fill .TypeAttr =_ca .ST_FillTypeGradient ;_f .Fill .Fill =_ca .NewOfcFill ();_f .Fill .Fill .ExtAttr =_ca .ST_ExtView ;_f .Fill .Fill .TypeAttr =_ca .OfcST_FillTypeGradientUnscaled ;_ag .EG_ShapeElements =append (_ag .EG_ShapeElements ,_f );_cgg :=_ca .NewEG_ShapeElements ();_cgg .Shadow =_ca .NewShadow ();_cgg .Shadow .OnAttr =_cg .ST_TrueFalseT ;_cgg .Shadow .ObscuredAttr =_cg .ST_TrueFalseT ;_ag .EG_ShapeElements =append (_ag .EG_ShapeElements ,_cgg );_fc :=_ca .NewEG_ShapeElements ();_fc .Path =_ca .NewPath ();_fc .Path .ConnecttypeAttr =_ca .OfcST_ConnectTypeNone ;_ag .EG_ShapeElements =append (_ag .EG_ShapeElements ,_fc );_ga :=_ca .NewEG_ShapeElements ();_ga .Textbox =_ca .NewTextbox ();_ga .Textbox .StyleAttr =_a .String ("\u006d\u0073\u006f\u002ddi\u0072\u0065\u0063\u0074\u0069\u006f\u006e\u002d\u0061\u006c\u0074\u003a\u0061\u0075t\u006f");_ag .EG_ShapeElements =append (_ag .EG_ShapeElements ,_ga );_eg :=_ca .NewEG_ShapeElements ();_eg .ClientData =_e .NewClientData ();_eg .ClientData .ObjectTypeAttr =_e .ST_ObjectTypeNote ;_eg .ClientData .MoveWithCells =_cg .ST_TrueFalseBlankT ;_eg .ClientData .SizeWithCells =_cg .ST_TrueFalseBlankT ;_eg .ClientData .Anchor =_a .String ("\u0031,\u0020\u0031\u0035\u002c\u0020\u0030\u002c\u0020\u0032\u002c\u00202\u002c\u0020\u0035\u0034\u002c\u0020\u0035\u002c\u0020\u0033");_eg .ClientData .AutoFill =_cg .ST_TrueFalseBlankFalse ;_eg .ClientData .Row =_a .Int64 (row );_eg .ClientData .Column =_a .Int64 (col );_ag .EG_ShapeElements =append (_ag .EG_ShapeElements ,_eg );return _ag ;};
|
|
|
|
// Width return width of shape.
|
|
func (_cea *ShapeStyle )Width ()int64 {return _cea ._ad };
|
|
|
|
// SetWidth set width of shape.
|
|
func (_bd *ShapeStyle )SetWidth (width int64 ){_bd ._ad =width };
|
|
|
|
// Height return height of shape.
|
|
func (_afd *ShapeStyle )Height ()int64 {return _afd ._fg };
|
|
|
|
// ShapeStyle is style attribute of v:shape element.
|
|
type ShapeStyle struct{_dae string ;_gf int64 ;_dac int64 ;_ad int64 ;_fg int64 ;_db int64 ;_bf string ;_cga string ;_fe string ;_cef string ;};func (_deg *Container )UnmarshalXML (d *_g .Decoder ,start _g .StartElement )error {_deg .Shape =nil ;_fb :for {_gd ,_cb :=d .Token ();if _cb !=nil {return _cb ;};switch _eb :=_gd .(type ){case _g .StartElement :switch _eb .Name .Local {case "s\u0068\u0061\u0070\u0065\u006c\u0061\u0079\u006f\u0075\u0074":_deg .Layout =_ca .NewOfcShapelayout ();if _gg :=d .DecodeElement (_deg .Layout ,&_eb );_gg !=nil {return _gg ;};case "\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e":_deg .ShapeType =_ca .NewShapetype ();if _ac :=d .DecodeElement (_deg .ShapeType ,&_eb );_ac !=nil {return _ac ;};case "\u0073\u0068\u0061p\u0065":_fce :=_ca .NewShape ();if _abab :=d .DecodeElement (_fce ,&_eb );_abab !=nil {return _abab ;};_deg .Shape =append (_deg .Shape ,_fce );};case _g .EndElement :break _fb ;};};return nil ;};
|
|
|
|
// SetHeight set height of shape.
|
|
func (_cee *ShapeStyle )SetHeight (height int64 ){_cee ._fg =height };
|
|
|
|
// SetBold sets text to bold.
|
|
func (_caa *TextpathStyle )SetBold (bold bool ){_caa ._dbb =bold };
|
|
|
|
// CreateFormula creates F element for typeFormulas.
|
|
func CreateFormula (s string )*_ca .CT_F {_ecb :=_ca .NewCT_F ();_ecb .EqnAttr =&s ;return _ecb };
|
|
|
|
// SetItalic sets text to italic.
|
|
func (_dbg *TextpathStyle )SetItalic (italic bool ){_dbg ._adc =italic }; |