unioffice/drawing/drawing.go
2023-08-06 17:57:53 +00:00

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