mirror of
https://github.com/unidoc/unioffice.git
synced 2025-05-12 19:29:34 +08:00
136 lines
9.3 KiB
Go
136 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 (_g "github.com/unidoc/unioffice";_f "github.com/unidoc/unioffice/color";_b "github.com/unidoc/unioffice/measurement";_d "github.com/unidoc/unioffice/schema/soo/dml";);
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ca Run )X ()*_d .EG_TextRun {return _ca ._gc };
|
|
|
|
// SetAlign controls the paragraph alignment
|
|
func (_gfb ParagraphProperties )SetAlign (a _d .ST_TextAlignType ){_gfb ._gd .AlgnAttr =a };
|
|
|
|
// SetSolidFill controls the text color of a run.
|
|
func (_ba RunProperties )SetSolidFill (c _f .Color ){_ba ._adc .NoFill =nil ;_ba ._adc .BlipFill =nil ;_ba ._adc .GradFill =nil ;_ba ._adc .GrpFill =nil ;_ba ._adc .PattFill =nil ;_ba ._adc .SolidFill =_d .NewCT_SolidColorFillProperties ();_ba ._adc .SolidFill .SrgbClr =_d .NewCT_SRgbColor ();
|
|
_ba ._adc .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};const (LineJoinRound LineJoin =iota ;LineJoinBevel ;LineJoinMiter ;);
|
|
|
|
// Properties returns the paragraph properties.
|
|
func (_a Paragraph )Properties ()ParagraphProperties {if _a ._fc .PPr ==nil {_a ._fc .PPr =_d .NewCT_TextParagraphProperties ();};return MakeParagraphProperties (_a ._fc .PPr );};func (_c LineProperties )clearFill (){_c ._dd .NoFill =nil ;_c ._dd .GradFill =nil ;
|
|
_c ._dd .SolidFill =nil ;_c ._dd .PattFill =nil ;};func (_cgb ShapeProperties )clearFill (){_cgb ._de .NoFill =nil ;_cgb ._de .BlipFill =nil ;_cgb ._de .GradFill =nil ;_cgb ._de .GrpFill =nil ;_cgb ._de .SolidFill =nil ;_cgb ._de .PattFill =nil ;};
|
|
|
|
// Paragraph is a paragraph within a document.
|
|
type Paragraph struct{_fc *_d .CT_TextParagraph };
|
|
|
|
// SetWidth sets the width of the shape.
|
|
func (_dfd ShapeProperties )SetWidth (w _b .Distance ){_dfd .ensureXfrm ();if _dfd ._de .Xfrm .Ext ==nil {_dfd ._de .Xfrm .Ext =_d .NewCT_PositiveSize2D ();};_dfd ._de .Xfrm .Ext .CxAttr =int64 (w /_b .EMU );};
|
|
|
|
// MakeParagraphProperties constructs a new ParagraphProperties wrapper.
|
|
func MakeParagraphProperties (x *_d .CT_TextParagraphProperties )ParagraphProperties {return ParagraphProperties {x };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dc LineProperties )X ()*_d .CT_LineProperties {return _dc ._dd };
|
|
|
|
// SetFlipHorizontal controls if the shape is flipped horizontally.
|
|
func (_fcc ShapeProperties )SetFlipHorizontal (b bool ){_fcc .ensureXfrm ();if !b {_fcc ._de .Xfrm .FlipHAttr =nil ;}else {_fcc ._de .Xfrm .FlipHAttr =_g .Bool (true );};};
|
|
|
|
// SetWidth sets the line width, MS products treat zero as the minimum width
|
|
// that can be displayed.
|
|
func (_dg LineProperties )SetWidth (w _b .Distance ){_dg ._dd .WAttr =_g .Int32 (int32 (w /_b .EMU ))};
|
|
|
|
// SetBulletChar sets the bullet character for the paragraph.
|
|
func (_ff ParagraphProperties )SetBulletChar (c string ){if c ==""{_ff ._gd .BuChar =nil ;}else {_ff ._gd .BuChar =_d .NewCT_TextCharBullet ();_ff ._gd .BuChar .CharAttr =c ;};};
|
|
|
|
// ParagraphProperties allows controlling paragraph properties.
|
|
type ParagraphProperties struct{_gd *_d .CT_TextParagraphProperties ;};
|
|
|
|
// SetText sets the run's text contents.
|
|
func (_fd Run )SetText (s string ){_fd ._gc .Br =nil ;_fd ._gc .Fld =nil ;if _fd ._gc .R ==nil {_fd ._gc .R =_d .NewCT_RegularTextRun ();};_fd ._gc .R .T =s ;};
|
|
|
|
// SetFlipVertical controls if the shape is flipped vertically.
|
|
func (_bf ShapeProperties )SetFlipVertical (b bool ){_bf .ensureXfrm ();if !b {_bf ._de .Xfrm .FlipVAttr =nil ;}else {_bf ._de .Xfrm .FlipVAttr =_g .Bool (true );};};
|
|
|
|
// MakeParagraph constructs a new paragraph wrapper.
|
|
func MakeParagraph (x *_d .CT_TextParagraph )Paragraph {return Paragraph {x }};
|
|
|
|
// SetSize sets the width and height of the shape.
|
|
func (_dfb ShapeProperties )SetSize (w ,h _b .Distance ){_dfb .SetWidth (w );_dfb .SetHeight (h )};func (_dcd LineProperties )SetNoFill (){_dcd .clearFill ();_dcd ._dd .NoFill =_d .NewCT_NoFillProperties ();};
|
|
|
|
// SetLevel sets the level of indentation of a paragraph.
|
|
func (_ab ParagraphProperties )SetLevel (idx int32 ){_ab ._gd .LvlAttr =_g .Int32 (idx )};
|
|
|
|
// SetJoin sets the line join style.
|
|
func (_df LineProperties )SetJoin (e LineJoin ){_df ._dd .Round =nil ;_df ._dd .Miter =nil ;_df ._dd .Bevel =nil ;switch e {case LineJoinRound :_df ._dd .Round =_d .NewCT_LineJoinRound ();case LineJoinBevel :_df ._dd .Bevel =_d .NewCT_LineJoinBevel ();
|
|
case LineJoinMiter :_df ._dd .Miter =_d .NewCT_LineJoinMiterProperties ();};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dbe ParagraphProperties )X ()*_d .CT_TextParagraphProperties {return _dbe ._gd };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_db Paragraph )X ()*_d .CT_TextParagraph {return _db ._fc };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bd ShapeProperties )X ()*_d .CT_ShapeProperties {return _bd ._de };func (_ce ShapeProperties )ensureXfrm (){if _ce ._de .Xfrm ==nil {_ce ._de .Xfrm =_d .NewCT_Transform2D ();};};
|
|
|
|
// SetBold controls the bolding of a run.
|
|
func (_ffe RunProperties )SetBold (b bool ){_ffe ._adc .BAttr =_g .Bool (b )};
|
|
|
|
// SetSize sets the font size of the run text
|
|
func (_ae RunProperties )SetSize (sz _b .Distance ){_ae ._adc .SzAttr =_g .Int32 (int32 (sz /_b .HundredthPoint ));};func MakeShapeProperties (x *_d .CT_ShapeProperties )ShapeProperties {return ShapeProperties {x }};
|
|
|
|
// SetBulletFont controls the font for the bullet character.
|
|
func (_ad ParagraphProperties )SetBulletFont (f string ){if f ==""{_ad ._gd .BuFont =nil ;}else {_ad ._gd .BuFont =_d .NewCT_TextFont ();_ad ._gd .BuFont .TypefaceAttr =f ;};};
|
|
|
|
// SetGeometry sets the shape type of the shape
|
|
func (_ffa ShapeProperties )SetGeometry (g _d .ST_ShapeType ){if _ffa ._de .PrstGeom ==nil {_ffa ._de .PrstGeom =_d .NewCT_PresetGeometry2D ();};_ffa ._de .PrstGeom .PrstAttr =g ;};
|
|
|
|
// Properties returns the run's properties.
|
|
func (_gg Run )Properties ()RunProperties {if _gg ._gc .R ==nil {_gg ._gc .R =_d .NewCT_RegularTextRun ();};if _gg ._gc .R .RPr ==nil {_gg ._gc .R .RPr =_d .NewCT_TextCharacterProperties ();};return RunProperties {_gg ._gc .R .RPr };};
|
|
|
|
// SetFont controls the font of a run.
|
|
func (_eea RunProperties )SetFont (s string ){_eea ._adc .Latin =_d .NewCT_TextFont ();_eea ._adc .Latin .TypefaceAttr =s ;};
|
|
|
|
// SetPosition sets the position of the shape.
|
|
func (_gcb ShapeProperties )SetPosition (x ,y _b .Distance ){_gcb .ensureXfrm ();if _gcb ._de .Xfrm .Off ==nil {_gcb ._de .Xfrm .Off =_d .NewCT_Point2D ();};_gcb ._de .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_g .Int64 (int64 (x /_b .EMU ));_gcb ._de .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_g .Int64 (int64 (y /_b .EMU ));
|
|
};
|
|
|
|
// MakeRun constructs a new Run wrapper.
|
|
func MakeRun (x *_d .EG_TextRun )Run {return Run {x }};
|
|
|
|
// Run is a run within a paragraph.
|
|
type Run struct{_gc *_d .EG_TextRun };type ShapeProperties struct{_de *_d .CT_ShapeProperties };
|
|
|
|
// SetHeight sets the height of the shape.
|
|
func (_dgc ShapeProperties )SetHeight (h _b .Distance ){_dgc .ensureXfrm ();if _dgc ._de .Xfrm .Ext ==nil {_dgc ._de .Xfrm .Ext =_d .NewCT_PositiveSize2D ();};_dgc ._de .Xfrm .Ext .CyAttr =int64 (h /_b .EMU );};
|
|
|
|
// RunProperties controls the run properties.
|
|
type RunProperties struct{_adc *_d .CT_TextCharacterProperties ;};
|
|
|
|
// AddRun adds a new run to a paragraph.
|
|
func (_cd Paragraph )AddRun ()Run {_eb :=MakeRun (_d .NewEG_TextRun ());_cd ._fc .EG_TextRun =append (_cd ._fc .EG_TextRun ,_eb .X ());return _eb ;};
|
|
|
|
// SetNumbered controls if bullets are numbered or not.
|
|
func (_be ParagraphProperties )SetNumbered (scheme _d .ST_TextAutonumberScheme ){if scheme ==_d .ST_TextAutonumberSchemeUnset {_be ._gd .BuAutoNum =nil ;}else {_be ._gd .BuAutoNum =_d .NewCT_TextAutonumberBullet ();_be ._gd .BuAutoNum .TypeAttr =scheme ;
|
|
};};func (_cg LineProperties )SetSolidFill (c _f .Color ){_cg .clearFill ();_cg ._dd .SolidFill =_d .NewCT_SolidColorFillProperties ();_cg ._dd .SolidFill .SrgbClr =_d .NewCT_SRgbColor ();_cg ._dd .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};type LineProperties struct{_dd *_d .CT_LineProperties };
|
|
|
|
|
|
// MakeRunProperties constructs a new RunProperties wrapper.
|
|
func MakeRunProperties (x *_d .CT_TextCharacterProperties )RunProperties {return RunProperties {x }};
|
|
|
|
// GetPosition gets the position of the shape in EMU.
|
|
func (_ec ShapeProperties )GetPosition ()(int64 ,int64 ){_ec .ensureXfrm ();if _ec ._de .Xfrm .Off ==nil {_ec ._de .Xfrm .Off =_d .NewCT_Point2D ();};return *_ec ._de .Xfrm .Off .XAttr .ST_CoordinateUnqualified ,*_ec ._de .Xfrm .Off .YAttr .ST_CoordinateUnqualified ;
|
|
};
|
|
|
|
// LineJoin is the type of line join
|
|
type LineJoin byte ;func (_ga ShapeProperties )LineProperties ()LineProperties {if _ga ._de .Ln ==nil {_ga ._de .Ln =_d .NewCT_LineProperties ();};return LineProperties {_ga ._de .Ln };};func (_fcf ShapeProperties )SetNoFill (){_fcf .clearFill ();_fcf ._de .NoFill =_d .NewCT_NoFillProperties ();
|
|
};func (_cdf ShapeProperties )SetSolidFill (c _f .Color ){_cdf .clearFill ();_cdf ._de .SolidFill =_d .NewCT_SolidColorFillProperties ();_cdf ._de .SolidFill .SrgbClr =_d .NewCT_SRgbColor ();_cdf ._de .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};
|
|
|
|
|
|
// AddBreak adds a new line break to a paragraph.
|
|
func (_gf Paragraph )AddBreak (){_ee :=_d .NewEG_TextRun ();_ee .Br =_d .NewCT_TextLineBreak ();_gf ._fc .EG_TextRun =append (_gf ._fc .EG_TextRun ,_ee );}; |