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

127 lines
9.3 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 drawing ;import (_a "github.com/unidoc/unioffice";_f "github.com/unidoc/unioffice/color";_aa "github.com/unidoc/unioffice/measurement";_e "github.com/unidoc/unioffice/schema/soo/dml";);
// RunProperties controls the run properties.
type RunProperties struct{_ff *_e .CT_TextCharacterProperties ;};
// Properties returns the run's properties.
func (_af Run )Properties ()RunProperties {if _af ._fb .R ==nil {_af ._fb .R =_e .NewCT_RegularTextRun ();};if _af ._fb .R .RPr ==nil {_af ._fb .R .RPr =_e .NewCT_TextCharacterProperties ();};return RunProperties {_af ._fb .R .RPr };};
// SetJoin sets the line join style.
func (_dc LineProperties )SetJoin (e LineJoin ){_dc ._ef .Round =nil ;_dc ._ef .Miter =nil ;_dc ._ef .Bevel =nil ;switch e {case LineJoinRound :_dc ._ef .Round =_e .NewCT_LineJoinRound ();case LineJoinBevel :_dc ._ef .Bevel =_e .NewCT_LineJoinBevel ();case LineJoinMiter :_dc ._ef .Miter =_e .NewCT_LineJoinMiterProperties ();};};
// LineJoin is the type of line join
type LineJoin byte ;
// SetSize sets the font size of the run text
func (_fbg RunProperties )SetSize (sz _aa .Distance ){_fbg ._ff .SzAttr =_a .Int32 (int32 (sz /_aa .HundredthPoint ));};func MakeShapeProperties (x *_e .CT_ShapeProperties )ShapeProperties {return ShapeProperties {x }};
// X returns the inner wrapped XML type.
func (_ggg ShapeProperties )X ()*_e .CT_ShapeProperties {return _ggg ._bc };func (_ab LineProperties )SetNoFill (){_ab .clearFill ();_ab ._ef .NoFill =_e .NewCT_NoFillProperties ()};
// Paragraph is a paragraph within a document.
type Paragraph struct{_de *_e .CT_TextParagraph };
// SetWidth sets the width of the shape.
func (_fc ShapeProperties )SetWidth (w _aa .Distance ){_fc .ensureXfrm ();if _fc ._bc .Xfrm .Ext ==nil {_fc ._bc .Xfrm .Ext =_e .NewCT_PositiveSize2D ();};_fc ._bc .Xfrm .Ext .CxAttr =int64 (w /_aa .EMU );};
// MakeRun constructs a new Run wrapper.
func MakeRun (x *_e .EG_TextRun )Run {return Run {x }};
// MakeParagraphProperties constructs a new ParagraphProperties wrapper.
func MakeParagraphProperties (x *_e .CT_TextParagraphProperties )ParagraphProperties {return ParagraphProperties {x };};
// SetLevel sets the level of indentation of a paragraph.
func (_aag ParagraphProperties )SetLevel (idx int32 ){_aag ._gd .LvlAttr =_a .Int32 (idx )};
// SetFont controls the font of a run.
func (_bd RunProperties )SetFont (s string ){_bd ._ff .Latin =_e .NewCT_TextFont ();_bd ._ff .Latin .TypefaceAttr =s ;};
// Properties returns the paragraph properties.
func (_gfd Paragraph )Properties ()ParagraphProperties {if _gfd ._de .PPr ==nil {_gfd ._de .PPr =_e .NewCT_TextParagraphProperties ();};return MakeParagraphProperties (_gfd ._de .PPr );};
// SetSolidFill controls the text color of a run.
func (_agd RunProperties )SetSolidFill (c _f .Color ){_agd ._ff .NoFill =nil ;_agd ._ff .BlipFill =nil ;_agd ._ff .GradFill =nil ;_agd ._ff .GrpFill =nil ;_agd ._ff .PattFill =nil ;_agd ._ff .SolidFill =_e .NewCT_SolidColorFillProperties ();_agd ._ff .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();_agd ._ff .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};type ShapeProperties struct{_bc *_e .CT_ShapeProperties };func (_faf ShapeProperties )LineProperties ()LineProperties {if _faf ._bc .Ln ==nil {_faf ._bc .Ln =_e .NewCT_LineProperties ();};return LineProperties {_faf ._bc .Ln };};
// Run is a run within a paragraph.
type Run struct{_fb *_e .EG_TextRun };func (_aac ShapeProperties )clearFill (){_aac ._bc .NoFill =nil ;_aac ._bc .BlipFill =nil ;_aac ._bc .GradFill =nil ;_aac ._bc .GrpFill =nil ;_aac ._bc .SolidFill =nil ;_aac ._bc .PattFill =nil ;};
// X returns the inner wrapped XML type.
func (_gg Paragraph )X ()*_e .CT_TextParagraph {return _gg ._de };
// SetBulletFont controls the font for the bullet character.
func (_fe ParagraphProperties )SetBulletFont (f string ){if f ==""{_fe ._gd .BuFont =nil ;}else {_fe ._gd .BuFont =_e .NewCT_TextFont ();_fe ._gd .BuFont .TypefaceAttr =f ;};};type LineProperties struct{_ef *_e .CT_LineProperties };
// SetFlipVertical controls if the shape is flipped vertically.
func (_gb ShapeProperties )SetFlipVertical (b bool ){_gb .ensureXfrm ();if !b {_gb ._bc .Xfrm .FlipVAttr =nil ;}else {_gb ._bc .Xfrm .FlipVAttr =_a .Bool (true );};};func (_d LineProperties )SetSolidFill (c _f .Color ){_d .clearFill ();_d ._ef .SolidFill =_e .NewCT_SolidColorFillProperties ();_d ._ef .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();_d ._ef .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};func (_faa ShapeProperties )SetSolidFill (c _f .Color ){_faa .clearFill ();_faa ._bc .SolidFill =_e .NewCT_SolidColorFillProperties ();_faa ._bc .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();_faa ._bc .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};
// SetPosition sets the position of the shape.
func (_eg ShapeProperties )SetPosition (x ,y _aa .Distance ){_eg .ensureXfrm ();if _eg ._bc .Xfrm .Off ==nil {_eg ._bc .Xfrm .Off =_e .NewCT_Point2D ();};_eg ._bc .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_a .Int64 (int64 (x /_aa .EMU ));_eg ._bc .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_a .Int64 (int64 (y /_aa .EMU ));};
// X returns the inner wrapped XML type.
func (_b Run )X ()*_e .EG_TextRun {return _b ._fb };
// ParagraphProperties allows controlling paragraph properties.
type ParagraphProperties struct{_gd *_e .CT_TextParagraphProperties ;};const (LineJoinRound LineJoin =iota ;LineJoinBevel ;LineJoinMiter ;);
// SetGeometry sets the shape type of the shape
func (_afb ShapeProperties )SetGeometry (g _e .ST_ShapeType ){if _afb ._bc .PrstGeom ==nil {_afb ._bc .PrstGeom =_e .NewCT_PresetGeometry2D ();};_afb ._bc .PrstGeom .PrstAttr =g ;};
// SetFlipHorizontal controls if the shape is flipped horizontally.
func (_eb ShapeProperties )SetFlipHorizontal (b bool ){_eb .ensureXfrm ();if !b {_eb ._bc .Xfrm .FlipHAttr =nil ;}else {_eb ._bc .Xfrm .FlipHAttr =_a .Bool (true );};};
// SetBulletChar sets the bullet character for the paragraph.
func (_dd ParagraphProperties )SetBulletChar (c string ){if c ==""{_dd ._gd .BuChar =nil ;}else {_dd ._gd .BuChar =_e .NewCT_TextCharBullet ();_dd ._gd .BuChar .CharAttr =c ;};};
// SetBold controls the bolding of a run.
func (_ag RunProperties )SetBold (b bool ){_ag ._ff .BAttr =_a .Bool (b )};
// SetSize sets the width and height of the shape.
func (_aacb ShapeProperties )SetSize (w ,h _aa .Distance ){_aacb .SetWidth (w );_aacb .SetHeight (h )};
// SetNumbered controls if bullets are numbered or not.
func (_fa ParagraphProperties )SetNumbered (scheme _e .ST_TextAutonumberScheme ){if scheme ==_e .ST_TextAutonumberSchemeUnset {_fa ._gd .BuAutoNum =nil ;}else {_fa ._gd .BuAutoNum =_e .NewCT_TextAutonumberBullet ();_fa ._gd .BuAutoNum .TypeAttr =scheme ;};};
// SetAlign controls the paragraph alignment
func (_aba ParagraphProperties )SetAlign (a _e .ST_TextAlignType ){_aba ._gd .AlgnAttr =a };
// AddBreak adds a new line break to a paragraph.
func (_gf Paragraph )AddBreak (){_ca :=_e .NewEG_TextRun ();_ca .Br =_e .NewCT_TextLineBreak ();_gf ._de .EG_TextRun =append (_gf ._de .EG_TextRun ,_ca );};
// SetText sets the run's text contents.
func (_ddd Run )SetText (s string ){_ddd ._fb .Br =nil ;_ddd ._fb .Fld =nil ;if _ddd ._fb .R ==nil {_ddd ._fb .R =_e .NewCT_RegularTextRun ();};_ddd ._fb .R .T =s ;};func (_aaa LineProperties )clearFill (){_aaa ._ef .NoFill =nil ;_aaa ._ef .GradFill =nil ;_aaa ._ef .SolidFill =nil ;_aaa ._ef .PattFill =nil ;};
// SetHeight sets the height of the shape.
func (_dae ShapeProperties )SetHeight (h _aa .Distance ){_dae .ensureXfrm ();if _dae ._bc .Xfrm .Ext ==nil {_dae ._bc .Xfrm .Ext =_e .NewCT_PositiveSize2D ();};_dae ._bc .Xfrm .Ext .CyAttr =int64 (h /_aa .EMU );};
// X returns the inner wrapped XML type.
func (_c LineProperties )X ()*_e .CT_LineProperties {return _c ._ef };
// MakeParagraph constructs a new paragraph wrapper.
func MakeParagraph (x *_e .CT_TextParagraph )Paragraph {return Paragraph {x }};
// X returns the inner wrapped XML type.
func (_da ParagraphProperties )X ()*_e .CT_TextParagraphProperties {return _da ._gd };
// MakeRunProperties constructs a new RunProperties wrapper.
func MakeRunProperties (x *_e .CT_TextCharacterProperties )RunProperties {return RunProperties {x }};func (_ba ShapeProperties )SetNoFill (){_ba .clearFill ();_ba ._bc .NoFill =_e .NewCT_NoFillProperties ()};
// SetWidth sets the line width, MS products treat zero as the minimum width
// that can be displayed.
func (_gc LineProperties )SetWidth (w _aa .Distance ){_gc ._ef .WAttr =_a .Int32 (int32 (w /_aa .EMU ))};func (_ce ShapeProperties )ensureXfrm (){if _ce ._bc .Xfrm ==nil {_ce ._bc .Xfrm =_e .NewCT_Transform2D ();};};
// AddRun adds a new run to a paragraph.
func (_ec Paragraph )AddRun ()Run {_dee :=MakeRun (_e .NewEG_TextRun ());_ec ._de .EG_TextRun =append (_ec ._de .EG_TextRun ,_dee .X ());return _dee ;};
// GetPosition gets the position of the shape in EMU.
func (_ad ShapeProperties )GetPosition ()(int64 ,int64 ){_ad .ensureXfrm ();if _ad ._bc .Xfrm .Off ==nil {_ad ._bc .Xfrm .Off =_e .NewCT_Point2D ();};return *_ad ._bc .Xfrm .Off .XAttr .ST_CoordinateUnqualified ,*_ad ._bc .Xfrm .Off .YAttr .ST_CoordinateUnqualified ;};