mirror of
https://github.com/unidoc/unioffice.git
synced 2025-05-10 19:29:15 +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 (_a "github.com/unidoc/unioffice";_ag "github.com/unidoc/unioffice/color";_c "github.com/unidoc/unioffice/measurement";_e "github.com/unidoc/unioffice/schema/soo/dml";);
|
|
|
|
// AddBreak adds a new line break to a paragraph.
|
|
func (_ce Paragraph )AddBreak (){_deb :=_e .NewEG_TextRun ();_deb .Br =_e .NewCT_TextLineBreak ();_ce ._fe .EG_TextRun =append (_ce ._fe .EG_TextRun ,_deb );};
|
|
|
|
// ParagraphProperties allows controlling paragraph properties.
|
|
type ParagraphProperties struct{_bd *_e .CT_TextParagraphProperties ;};
|
|
|
|
// Paragraph is a paragraph within a document.
|
|
type Paragraph struct{_fe *_e .CT_TextParagraph };
|
|
|
|
// SetHeight sets the height of the shape.
|
|
func (_bdg ShapeProperties )SetHeight (h _c .Distance ){_bdg .ensureXfrm ();if _bdg ._bg .Xfrm .Ext ==nil {_bdg ._bg .Xfrm .Ext =_e .NewCT_PositiveSize2D ();};_bdg ._bg .Xfrm .Ext .CyAttr =int64 (h /_c .EMU );};
|
|
|
|
// SetBold controls the bolding of a run.
|
|
func (_cc RunProperties )SetBold (b bool ){_cc ._bf .BAttr =_a .Bool (b )};func (_acc ShapeProperties )LineProperties ()LineProperties {if _acc ._bg .Ln ==nil {_acc ._bg .Ln =_e .NewCT_LineProperties ();};return LineProperties {_acc ._bg .Ln };};
|
|
|
|
// MakeParagraphProperties constructs a new ParagraphProperties wrapper.
|
|
func MakeParagraphProperties (x *_e .CT_TextParagraphProperties )ParagraphProperties {return ParagraphProperties {x };};
|
|
|
|
// Run is a run within a paragraph.
|
|
type Run struct{_be *_e .EG_TextRun };func (_gae ShapeProperties )ensureXfrm (){if _gae ._bg .Xfrm ==nil {_gae ._bg .Xfrm =_e .NewCT_Transform2D ();};};
|
|
|
|
// Properties returns the run's properties.
|
|
func (_bc Run )Properties ()RunProperties {if _bc ._be .R ==nil {_bc ._be .R =_e .NewCT_RegularTextRun ();};if _bc ._be .R .RPr ==nil {_bc ._be .R .RPr =_e .NewCT_TextCharacterProperties ();};return RunProperties {_bc ._be .R .RPr };};
|
|
|
|
// GetPosition gets the position of the shape in EMU.
|
|
func (_bb ShapeProperties )GetPosition ()(int64 ,int64 ){_bb .ensureXfrm ();if _bb ._bg .Xfrm .Off ==nil {_bb ._bg .Xfrm .Off =_e .NewCT_Point2D ();};return *_bb ._bg .Xfrm .Off .XAttr .ST_CoordinateUnqualified ,*_bb ._bg .Xfrm .Off .YAttr .ST_CoordinateUnqualified ;
|
|
};const (LineJoinRound LineJoin =iota ;LineJoinBevel ;LineJoinMiter ;);
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_agd LineProperties )X ()*_e .CT_LineProperties {return _agd ._f };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ff Run )X ()*_e .EG_TextRun {return _ff ._be };
|
|
|
|
// SetAlign controls the paragraph alignment
|
|
func (_ga ParagraphProperties )SetAlign (a _e .ST_TextAlignType ){_ga ._bd .AlgnAttr =a };func (_abd ShapeProperties )SetSolidFill (c _ag .Color ){_abd .clearFill ();_abd ._bg .SolidFill =_e .NewCT_SolidColorFillProperties ();_abd ._bg .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();
|
|
_abd ._bg .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aca ParagraphProperties )X ()*_e .CT_TextParagraphProperties {return _aca ._bd };
|
|
|
|
// SetBulletChar sets the bullet character for the paragraph.
|
|
func (_baf ParagraphProperties )SetBulletChar (c string ){if c ==""{_baf ._bd .BuChar =nil ;}else {_baf ._bd .BuChar =_e .NewCT_TextCharBullet ();_baf ._bd .BuChar .CharAttr =c ;};};
|
|
|
|
// SetText sets the run's text contents.
|
|
func (_gf Run )SetText (s string ){_gf ._be .Br =nil ;_gf ._be .Fld =nil ;if _gf ._be .R ==nil {_gf ._be .R =_e .NewCT_RegularTextRun ();};_gf ._be .R .T =s ;};
|
|
|
|
// SetWidth sets the width of the shape.
|
|
func (_bcb ShapeProperties )SetWidth (w _c .Distance ){_bcb .ensureXfrm ();if _bcb ._bg .Xfrm .Ext ==nil {_bcb ._bg .Xfrm .Ext =_e .NewCT_PositiveSize2D ();};_bcb ._bg .Xfrm .Ext .CxAttr =int64 (w /_c .EMU );};
|
|
|
|
// MakeParagraph constructs a new paragraph wrapper.
|
|
func MakeParagraph (x *_e .CT_TextParagraph )Paragraph {return Paragraph {x }};
|
|
|
|
// MakeRunProperties constructs a new RunProperties wrapper.
|
|
func MakeRunProperties (x *_e .CT_TextCharacterProperties )RunProperties {return RunProperties {x }};
|
|
|
|
// Properties returns the paragraph properties.
|
|
func (_ba Paragraph )Properties ()ParagraphProperties {if _ba ._fe .PPr ==nil {_ba ._fe .PPr =_e .NewCT_TextParagraphProperties ();};return MakeParagraphProperties (_ba ._fe .PPr );};
|
|
|
|
// MakeRun constructs a new Run wrapper.
|
|
func MakeRun (x *_e .EG_TextRun )Run {return Run {x }};
|
|
|
|
// SetFont controls the font of a run.
|
|
func (_ced RunProperties )SetFont (s string ){_ced ._bf .Latin =_e .NewCT_TextFont ();_ced ._bf .Latin .TypefaceAttr =s ;};
|
|
|
|
// SetNumbered controls if bullets are numbered or not.
|
|
func (_g ParagraphProperties )SetNumbered (scheme _e .ST_TextAutonumberScheme ){if scheme ==_e .ST_TextAutonumberSchemeUnset {_g ._bd .BuAutoNum =nil ;}else {_g ._bd .BuAutoNum =_e .NewCT_TextAutonumberBullet ();_g ._bd .BuAutoNum .TypeAttr =scheme ;};
|
|
};func (_ac LineProperties )clearFill (){_ac ._f .NoFill =nil ;_ac ._f .GradFill =nil ;_ac ._f .SolidFill =nil ;_ac ._f .PattFill =nil ;};func (_ge ShapeProperties )SetNoFill (){_ge .clearFill ();_ge ._bg .NoFill =_e .NewCT_NoFillProperties ()};
|
|
|
|
// SetLevel sets the level of indentation of a paragraph.
|
|
func (_bae ParagraphProperties )SetLevel (idx int32 ){_bae ._bd .LvlAttr =_a .Int32 (idx )};
|
|
|
|
// SetWidth sets the line width, MS products treat zero as the minimum width
|
|
// that can be displayed.
|
|
func (_b LineProperties )SetWidth (w _c .Distance ){_b ._f .WAttr =_a .Int32 (int32 (w /_c .EMU ))};
|
|
|
|
// SetPosition sets the position of the shape.
|
|
func (_dgb ShapeProperties )SetPosition (x ,y _c .Distance ){_dgb .ensureXfrm ();if _dgb ._bg .Xfrm .Off ==nil {_dgb ._bg .Xfrm .Off =_e .NewCT_Point2D ();};_dgb ._bg .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_a .Int64 (int64 (x /_c .EMU ));_dgb ._bg .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_a .Int64 (int64 (y /_c .EMU ));
|
|
};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dg ShapeProperties )X ()*_e .CT_ShapeProperties {return _dg ._bg };
|
|
|
|
// SetJoin sets the line join style.
|
|
func (_ef LineProperties )SetJoin (e LineJoin ){_ef ._f .Round =nil ;_ef ._f .Miter =nil ;_ef ._f .Bevel =nil ;switch e {case LineJoinRound :_ef ._f .Round =_e .NewCT_LineJoinRound ();case LineJoinBevel :_ef ._f .Bevel =_e .NewCT_LineJoinBevel ();case LineJoinMiter :_ef ._f .Miter =_e .NewCT_LineJoinMiterProperties ();
|
|
};};func (_fa ShapeProperties )clearFill (){_fa ._bg .NoFill =nil ;_fa ._bg .BlipFill =nil ;_fa ._bg .GradFill =nil ;_fa ._bg .GrpFill =nil ;_fa ._bg .SolidFill =nil ;_fa ._bg .PattFill =nil ;};
|
|
|
|
// AddRun adds a new run to a paragraph.
|
|
func (_ad Paragraph )AddRun ()Run {_de :=MakeRun (_e .NewEG_TextRun ());_ad ._fe .EG_TextRun =append (_ad ._fe .EG_TextRun ,_de .X ());return _de ;};
|
|
|
|
// LineJoin is the type of line join
|
|
type LineJoin byte ;
|
|
|
|
// SetFlipHorizontal controls if the shape is flipped horizontally.
|
|
func (_da ShapeProperties )SetFlipHorizontal (b bool ){_da .ensureXfrm ();if !b {_da ._bg .Xfrm .FlipHAttr =nil ;}else {_da ._bg .Xfrm .FlipHAttr =_a .Bool (true );};};
|
|
|
|
// SetSize sets the width and height of the shape.
|
|
func (_df ShapeProperties )SetSize (w ,h _c .Distance ){_df .SetWidth (w );_df .SetHeight (h )};
|
|
|
|
// RunProperties controls the run properties.
|
|
type RunProperties struct{_bf *_e .CT_TextCharacterProperties ;};
|
|
|
|
// SetFlipVertical controls if the shape is flipped vertically.
|
|
func (_fb ShapeProperties )SetFlipVertical (b bool ){_fb .ensureXfrm ();if !b {_fb ._bg .Xfrm .FlipVAttr =nil ;}else {_fb ._bg .Xfrm .FlipVAttr =_a .Bool (true );};};type LineProperties struct{_f *_e .CT_LineProperties };func MakeShapeProperties (x *_e .CT_ShapeProperties )ShapeProperties {return ShapeProperties {x }};
|
|
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ec Paragraph )X ()*_e .CT_TextParagraph {return _ec ._fe };
|
|
|
|
// SetSize sets the font size of the run text
|
|
func (_bda RunProperties )SetSize (sz _c .Distance ){_bda ._bf .SzAttr =_a .Int32 (int32 (sz /_c .HundredthPoint ));};
|
|
|
|
// SetGeometry sets the shape type of the shape
|
|
func (_agf ShapeProperties )SetGeometry (g _e .ST_ShapeType ){if _agf ._bg .PrstGeom ==nil {_agf ._bg .PrstGeom =_e .NewCT_PresetGeometry2D ();};_agf ._bg .PrstGeom .PrstAttr =g ;};type ShapeProperties struct{_bg *_e .CT_ShapeProperties };func (_cf LineProperties )SetNoFill (){_cf .clearFill ();
|
|
_cf ._f .NoFill =_e .NewCT_NoFillProperties ()};func (_ab LineProperties )SetSolidFill (c _ag .Color ){_ab .clearFill ();_ab ._f .SolidFill =_e .NewCT_SolidColorFillProperties ();_ab ._f .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();_ab ._f .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();
|
|
};
|
|
|
|
// SetBulletFont controls the font for the bullet character.
|
|
func (_ed ParagraphProperties )SetBulletFont (f string ){if f ==""{_ed ._bd .BuFont =nil ;}else {_ed ._bd .BuFont =_e .NewCT_TextFont ();_ed ._bd .BuFont .TypefaceAttr =f ;};};
|
|
|
|
// SetSolidFill controls the text color of a run.
|
|
func (_gff RunProperties )SetSolidFill (c _ag .Color ){_gff ._bf .NoFill =nil ;_gff ._bf .BlipFill =nil ;_gff ._bf .GradFill =nil ;_gff ._bf .GrpFill =nil ;_gff ._bf .PattFill =nil ;_gff ._bf .SolidFill =_e .NewCT_SolidColorFillProperties ();_gff ._bf .SolidFill .SrgbClr =_e .NewCT_SRgbColor ();
|
|
_gff ._bf .SolidFill .SrgbClr .ValAttr =*c .AsRGBString ();}; |