2017-08-28 20:56:18 -05:00
//
2020-08-23 14:15:53 +00:00
// 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/
2022-12-06 11:56:49 +00:00
package presentation ; import ( _ea "archive/zip" ; _fa "bytes" ; _cc "encoding/xml" ; _ef "errors" ; _fg "fmt" ; _bde "github.com/unidoc/unioffice" ; _e "github.com/unidoc/unioffice/common" ; _g "github.com/unidoc/unioffice/common/logger" ; _ae "github.com/unidoc/unioffice/common/tempstorage" ; _eb "github.com/unidoc/unioffice/drawing" ; _ac "github.com/unidoc/unioffice/internal/license" ; _a "github.com/unidoc/unioffice/measurement" ; _de "github.com/unidoc/unioffice/schema/soo/dml" ; _b "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _d "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _fd "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _cgc "github.com/unidoc/unioffice/schema/soo/pml" ; _fb "github.com/unidoc/unioffice/zippkg" ; _cg "image" ; _bd "image/jpeg" ; _eg "io" ; _ag "math" ; _ca "os" ; _ce "path" ; _cb "sort" ; _c "strconv" ; _fc "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _dfd , _efg := Open ( fn ) ; if _efg != nil { return nil , _efg ; } ; return _dfd , nil ; } ;
2022-06-27 19:44:23 +00:00
2022-12-06 11:56:49 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _gfa Slide ) AddTextBox ( ) TextBox { _cgcc := _cgc . NewCT_GroupShapeChoice ( ) ; _gfa . _fbb . CSld . SpTree . Choice = append ( _gfa . _fbb . CSld . SpTree . Choice , _cgcc ) ; _edgf := _cgc . NewCT_Shape ( ) ; _cgcc . Sp = append ( _cgcc . Sp , _edgf ) ; _edgf . SpPr = _de . NewCT_ShapeProperties ( ) ; _edgf . SpPr . Xfrm = _de . NewCT_Transform2D ( ) ; _edgf . SpPr . PrstGeom = _de . NewCT_PresetGeometry2D ( ) ; _edgf . SpPr . PrstGeom . PrstAttr = _de . ST_ShapeTypeRect ; _edgf . NvSpPr = _cgc . NewCT_ShapeNonVisual ( ) ; _edgf . NvSpPr . CNvSpPr = _de . NewCT_NonVisualDrawingShapeProps ( ) ; _egc := true ; _edgf . NvSpPr . CNvSpPr . TxBoxAttr = & _egc ; _edgf . TxBody = _de . NewCT_TextBody ( ) ; _edgf . TxBody . BodyPr = _de . NewCT_TextBodyProperties ( ) ; _edgf . TxBody . BodyPr . WrapAttr = _de . ST_TextWrappingTypeSquare ; _edgf . TxBody . BodyPr . SpAutoFit = _de . NewCT_TextShapeAutofit ( ) ; _bcef := TextBox { _edgf } ; _bcef . Properties ( ) . SetWidth ( 3 * _a . Inch ) ; _bcef . Properties ( ) . SetHeight ( 1 * _a . Inch ) ; _bcef . Properties ( ) . SetPosition ( 0 , 0 ) ; return _bcef ; } ;
2022-06-27 19:44:23 +00:00
2022-12-06 11:56:49 +00:00
// AddImage adds an image textbox to a slide.
func ( _aaff Slide ) AddImage ( img _e . ImageRef ) Image { _ddb := _cgc . NewCT_GroupShapeChoice ( ) ; _aaff . _fbb . CSld . SpTree . Choice = append ( _aaff . _fbb . CSld . SpTree . Choice , _ddb ) ; _gea := _cgc . NewCT_Picture ( ) ; _ddb . Pic = append ( _ddb . Pic , _gea ) ; _gea . NvPicPr . CNvPicPr = _de . NewCT_NonVisualPictureProperties ( ) ; _gea . NvPicPr . CNvPicPr . PicLocks = _de . NewCT_PictureLocking ( ) ; _gea . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _bde . Bool ( true ) ; _gea . BlipFill = _de . NewCT_BlipFillProperties ( ) ; _gea . BlipFill . Blip = _de . NewCT_Blip ( ) ; _dfbg := _aaff . AddImageToRels ( img ) ; _gea . BlipFill . Blip . EmbedAttr = _bde . String ( _dfbg ) ; _gea . BlipFill . Stretch = _de . NewCT_StretchInfoProperties ( ) ; _gea . BlipFill . Stretch . FillRect = _de . NewCT_RelativeRect ( ) ; _gea . SpPr = _de . NewCT_ShapeProperties ( ) ; _gea . SpPr . PrstGeom = _de . NewCT_PresetGeometry2D ( ) ; _gea . SpPr . PrstGeom . PrstAttr = _de . ST_ShapeTypeRect ; _efde := Image { _gea } ; _ffdb := img . Size ( ) ; _efde . Properties ( ) . SetWidth ( _a . Distance ( _ffdb . X ) * _a . Pixel72 ) ; _efde . Properties ( ) . SetHeight ( _a . Distance ( _ffdb . Y ) * _a . Pixel72 ) ; _efde . Properties ( ) . SetPosition ( 0 , 0 ) ; return _efde ; } ;
2021-05-31 16:22:30 +00:00
2022-12-06 11:56:49 +00:00
// AddParagraph adds a paragraph to the text box
func ( _cedb TextBox ) AddParagraph ( ) _eb . Paragraph { _bcg := _de . NewCT_TextParagraph ( ) ; _cedb . _ecbf . TxBody . P = append ( _cedb . _ecbf . TxBody . P , _bcg ) ; return _eb . MakeParagraph ( _bcg ) ; } ; const _gcb float64 = 500000 ;
2021-05-31 16:22:30 +00:00
2022-12-06 11:56:49 +00:00
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
func ( _dbf * Slide ) GetColorBySchemeColor ( schClr _de . ST_SchemeColorVal ) * _de . CT_Color { _dbf . ensureClrMap ( ) ; _fgfa := _dbf . _eec ; if _fgfa == nil { return nil ; } ; var _afca _de . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _afca = _fgfa . Bg1Attr ; case "\u0062\u0067\u0032" : _afca = _fgfa . Bg2Attr ; case "\u0074\u0078\u0031" : _afca = _fgfa . Tx1Attr ; case "\u0074\u0078\u0032" : _afca = _fgfa . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _afca = _fgfa . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _afca = _fgfa . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _afca = _fgfa . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _afca = _fgfa . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _afca = _fgfa . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _afca = _fgfa . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _afca = _fgfa . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _afca = _fgfa . FolHlinkAttr ; case "\u0064\u006b\u0031" : _afca = _de . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _afca = _de . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _afca = _de . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _afca = _de . ST_ColorSchemeIndexLt2 ; default : _afca = _de . ST_ColorSchemeIndexUnset ; } ; _bda := _dbf . _bgg . _efb [ 0 ] ; _dgfc := _bda . ThemeElements ; if _dgfc == nil { return nil ; } ; var _aeg * _de . CT_Color ; _gbf := _dgfc . ClrScheme ; switch _afca . String ( ) { case "\u0064\u006b\u0031" : _aeg = _gbf . Dk1 ; case "\u0064\u006b\u0032" : _aeg = _gbf . Dk2 ; case "\u006c\u0074\u0031" : _aeg = _gbf . Lt1 ; case "\u006c\u0074\u0032" : _aeg = _gbf . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _aeg = _gbf . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _aeg = _gbf . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _aeg = _gbf . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _aeg = _gbf . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _aeg = _gbf . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _aeg = _gbf . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _aeg = _gbf . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _aeg = _gbf . FolHlink ; default : return nil ; } ; return _aeg ; } ; func ( _gaa * Presentation ) nextSlideID ( ) uint32 { _ebfe := uint32 ( 256 ) ; for _ , _bff := range _gaa . _eeg . SldIdLst . SldId { if _bff . IdAttr >= _ebfe { _ebfe = _bff . IdAttr + 1 ; } ; } ; return _ebfe ; } ;
2022-01-15 21:17:38 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _gae PlaceHolder ) X ( ) * _cgc . CT_Shape { return _gae . _dga } ;
2022-09-02 11:46:53 +00:00
// Width returns slide screen size width in EMU units.
2022-12-06 11:56:49 +00:00
func ( _eacbb * SlideScreenSize ) Width ( ) int32 { return _eacbb [ 0 ] } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// Name returns the name of the slide layout.
func ( _dfgg SlideLayout ) Name ( ) string { if _dfgg . _gfeg . CSld != nil && _dfgg . _gfeg . CSld . NameAttr != nil { return * _dfgg . _gfeg . CSld . NameAttr ; } ; return "" ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _cfd * Presentation ) X ( ) * _cgc . Presentation { return _cfd . _eeg } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// Remove removes a placeholder from a presentation.
func ( _dag PlaceHolder ) Remove ( ) error { for _bge , _gdb := range _dag . _abe . CSld . SpTree . Choice { for _ , _dbd := range _gdb . Sp { if _dbd == _dag . _dga { copy ( _dag . _abe . CSld . SpTree . Choice [ _bge : ] , _dag . _abe . CSld . SpTree . Choice [ _bge + 1 : ] ) ; _dag . _abe . CSld . SpTree . Choice = _dag . _abe . CSld . SpTree . Choice [ 0 : len ( _dag . _abe . CSld . SpTree . Choice ) - 1 ] ; return nil ; } ; } ; } ; return _ef . New ( "\u0070\u006c\u0061\u0063\u0065\u0068\u006f\u006c\u0064\u0065r\u0020\u006e\u006f\u0074\u0020\u0066\u006fu\u006e\u0064\u0020\u0069\u006e\u0020\u0073\u006c\u0069\u0064\u0065" ) ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _gbee * Slide ) GetChartSpaceByRelId ( relId string ) * _b . ChartSpace { _afgf := _gbee . getSlideRels ( ) ; if ( _afgf == _e . Relationships { } ) { return nil ; } ; _dcee := _afgf . GetTargetByRelId ( relId ) ; for _ , _cba := range _gbee . _bgg . _fcf { if _dcee == _cba . Target ( ) { return _cba . _be ; } ; } ; return nil ; } ; func ( _aee * Presentation ) save ( _def _eg . Writer , _ffb bool ) error { const _ecd = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ; if _gac := _aee . _eeg . Validate ( ) ; _gac != nil { _g . Log . Debug ( "\u0076\u0061\u006c\u0069\u0064\u0061\u0074\u0069\u006f\u006e\u0020\u0065\u0072\u0072\u006fr\u0020i\u006e\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020\u0025\u0073" , _gac ) ; } ; if ! _ac . GetLicenseKey ( ) . IsLicensed ( ) && ! _dac { _fg . Println ( "\u0055\u006e\u006ci\u0063\u0065\u006e\u0073e\u0064\u0020\u0076\u0065\u0072\u0073\u0069o\u006e\u0020\u006f\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065" ) ; _fg . Println ( "\u002d\u0020\u0047e\u0074\u0020\u0061\u0020\u0074\u0072\u0069\u0061\u006c\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f" ) ; return _ef . New ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064" ) ; } ; if len ( _aee . _gggb ) == 0 { _aefb , _edag := _ac . GenRefId ( "\u0070\u0077" ) ; if _edag != nil { _g . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _edag ) ; return _edag ; } ; _aee . _gggb = _aefb ; } ; if _fba := _ac . Track ( _aee . _gggb , _ecd ) ; _fba != nil { _g . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fba ) ; return _fba ; } ; if _ffb { _aee . ContentTypes . RemoveOverride ( "\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c" ) ; _aee . ContentTypes . EnsureOverride ( "/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c" , "\u0061\u0070pl\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074s\u002d\u006f\u0066\u0066ic\u0065\u0064o\u0063u\u006d\u0065\u006e\u0074\u002e\u0070r\u0065\u0073\u0065n\u0074\u0061t\u0069\u006f\u006e\u006d\u006c\u002e\u0074\u0065\u006d\u0070\u006c\u0061\u0074\u0065.\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c" ) ; } else { _aee . ContentTypes . RemoveOverride ( "\u0061\u0070pl\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074s\u002d\u006f\u0066\u0066ic\u0065\u0064o\u0063u\u006d\u0065\u006e\u0074\u002e\u0070r\u0065\u0073\u0065n\u0074\u0061t\u0069\u006f\u006e\u006d\u006c\u002e\u0074\u0065\u006d\u0070\u006c\u0061\u0074\u0065.\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c" ) ; _aee . ContentTypes . EnsureOverride ( "/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c" , "\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c" ) ; } ; _ecga := _bde . DocTypePresentation ; _dca := _ea . NewWriter ( _def ) ; defer _dca . Close ( ) ; if _bafe := _fb . MarshalXML ( _dca , _bde . BaseRelsFilename , _aee . Rels . X ( ) ) ; _bafe != nil { return _bafe ; } ; if _adg := _fb . Mars
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// TextItem is used for keeping text with references to a paragraph and run, a shape or a table, a row and a cell where it is located.
type TextItem struct { Text string ; Presentation * Presentation ; Shape * _cgc . CT_Shape ; GraphicFrame * _cgc . CT_GraphicalObjectFrame ; Paragraph * _de . CT_TextParagraph ; Run * _de . CT_RegularTextRun ; TableInfo * TableInfo ; _ebb [ ] rectangle ; _ba int ; _eac int ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _ecbf * _cgc . CT_Shape } ; func ( _bcgd TextBox ) getOff ( ) * _de . CT_Point2D { if _bcgd . _ecbf . SpPr == nil { _bcgd . _ecbf . SpPr = _de . NewCT_ShapeProperties ( ) ; } ; if _bcgd . _ecbf . SpPr . Xfrm == nil { _bcgd . _ecbf . SpPr . Xfrm = _de . NewCT_Transform2D ( ) ; } ; if _bcgd . _ecbf . SpPr . Xfrm . Off == nil { _bcgd . _ecbf . SpPr . Xfrm . Off = _de . NewCT_Point2D ( ) ; } ; return _bcgd . _ecbf . SpPr . Xfrm . Off ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _bcd Slide ) GetTextBoxes ( ) [ ] * TextBox { _egeb := [ ] * TextBox { } ; _dabe := _bcd . _fbb . CSld . SpTree . Choice ; for _ , _bedd := range _dabe { for _ , _gdefd := range _bedd . Sp { if _gdefd . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _gdefd . NvSpPr . CNvSpPr . TxBoxAttr { _egeb = append ( _egeb , & TextBox { _gdefd } ) ; } ; } ; } ; return _egeb ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// Less is for implementing sorting of two locations. Symbols share the same location if they are in the same paragraph or table. One location is 'less' than another first by y coordinate, if y coordinates are equal or differ by less than yEpsilon, then x coordinates are compared, then if they are also equal, indexes of locations in the table are compared, then positions of locations in a paragraph.
func ( _ebfd sort2d ) Less ( i , j int ) bool { _faf , _eefg := _ebfd [ i ] , _ebfd [ j ] ; _dcfe , _afg := _faf . _ebb , _eefg . _ebb ; _ebfdf , _aeb := len ( _dcfe ) - 1 , len ( _afg ) - 1 ; _ccgg , _eda := 0 , 0 ; for { _agf , _ggg , _ebcc , _caf , _bdcf , _dg , _afe , _bdgd := _dcfe [ _ccgg ] . _ccd , _afg [ _eda ] . _ccd , _dcfe [ _ccgg ] . _aed , _afg [ _eda ] . _aed , _dcfe [ _ccgg ] . _fcb , _afg [ _eda ] . _fcb , _dcfe [ _ccgg ] . _ee , _afg [ _eda ] . _ee ; if _agf == _ggg || ( ( _ag . Abs ( float64 ( _agf ) - float64 ( _ggg ) ) < _gcb ) && ( ( _agf >= _ggg && _agf <= _caf ) || ( _ggg >= _agf && _ggg <= _ebcc ) ) && ( _afe < _dg || _bdcf > _bdgd ) ) { if _bdcf == _dg { if _ccgg < _ebfdf && _eda < _aeb { _ccgg ++ ; _eda ++ ; continue ; } ; if _ccgg >= _ebfdf && _eda >= _aeb { break ; } ; return _ccgg >= _ebfdf ; } else { return _bdcf < _dg ; } ; } else { return _agf < _ggg ; } ; } ; _ebfb , _bfb , _cad , _fbe := _faf . _ba , _eefg . _ba , _faf . _eac , _eefg . _eac ; if _ebfb == _bfb { return _cad <= _fbe ; } ; return _ebfb < _bfb ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// GetPlaceholder returns a placeholder given its type. If there are multiplace
// placeholders of the same type, this method returns the first one. You must use the
// PlaceHolders() method to access the others.
func ( _fdd Slide ) GetPlaceholder ( t _cgc . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _bdb := range _fdd . _fbb . CSld . SpTree . Choice { for _ , _bad := range _bdb . Sp { if _bad . NvSpPr != nil && _bad . NvSpPr . NvPr != nil && _bad . NvSpPr . NvPr . Ph != nil { if _bad . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _bad , _fdd . _fbb } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ef . New ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0070\u006c\u0061\u0063\u0065\u0068\u006fl\u0064\u0065\u0072" ) ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _bac * Presentation ) SlideMasters ( ) [ ] SlideMaster { _cag := [ ] SlideMaster { } ; for _cbffd , _fee := range _bac . _efd { _cag = append ( _cag , SlideMaster { _bac , _bac . _edc [ _cbffd ] , _fee } ) ; } ; return _cag ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// SetHeight sets height of slide screen size with given value in EMU units.
func ( _acdb * SlideScreenSize ) SetHeight ( val int32 ) { _acdb [ 1 ] = val } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _acge * Presentation ) GetImageByRelID ( relID string ) ( _e . ImageRef , bool ) { for _ , _ddf := range _acge . Images { if _ddf . RelID ( ) == relID { return _ddf , true ; } ; } ; return _e . ImageRef { } , false ; } ;
2020-11-09 01:00:18 +00:00
2022-12-06 11:56:49 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _fgdd * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _egee := [ ] SlideLayout { } ; for _ , _dcd := range _fgdd . _becb { _egee = append ( _egee , SlideLayout { _dcd } ) ; } ; return _egee ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _ecc : _cgc . NewViewPr ( ) } } ;
2021-05-31 16:22:30 +00:00
2022-12-06 11:56:49 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _acgg ViewProperties ) NotesViewPr ( ) * _cgc . CT_NotesViewProperties { return _acgg . _ecc . NotesViewPr } ; func _daa ( _acdg [ ] * _cgc . CT_GroupShapeChoice ) [ ] * _cgc . CT_GroupShapeChoice { var _fbgd [ ] * _cgc . CT_GroupShapeChoice ; for _ , _aef := range _acdg { if len ( _aef . Pic ) == 0 { _fbgd = append ( _fbgd , _aef ) ; } ; } ; return _fbgd ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// Clear clears the placeholder contents and adds a single empty paragraph. The
// empty paragrah is required by PowerPoint or it will report the file as being
// invalid.
func ( _eeb PlaceHolder ) Clear ( ) { _eeb . ClearAll ( ) ; _cfe := _de . NewCT_TextParagraph ( ) ; _eeb . _dga . TxBody . P = [ ] * _de . CT_TextParagraph { _cfe } ; _cfe . EndParaRPr = _de . NewCT_TextCharacterProperties ( ) ; _cfe . EndParaRPr . LangAttr = _bde . String ( "\u0065\u006e\u002dU\u0053" ) ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// Properties returns the properties of the TextBox.
func ( _gcbc Image ) Properties ( ) _eb . ShapeProperties { if _gcbc . _ece . SpPr == nil { _gcbc . _ece . SpPr = _de . NewCT_ShapeProperties ( ) ; } ; return _eb . MakeShapeProperties ( _gcbc . _ece . SpPr ) ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// SlideSize returns presentation slide size.
func ( _efdfc * Presentation ) SlideSize ( ) SlideSize { if _efdfc . _eeg . SldSz == nil { _efdfc . _eeg . SldSz = _cgc . NewCT_SlideSize ( ) ; } ; return SlideSize { _efdfc . _eeg . SldSz , _efdfc } ; } ;
2022-09-02 11:46:53 +00:00
// GetSlideLayout returns a slide layout related to the slide.
2022-12-06 11:56:49 +00:00
func ( _cadd * Slide ) GetSlideLayout ( ) * _cgc . SldLayout { for _bag , _dff := range _cadd . _bgg . Slides ( ) { if * _cadd == _dff { return _cadd . _bgg . _becb [ len ( _cadd . _bgg . Slides ( ) ) - _bag - 1 ] ; } ; } ; return nil ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// PrnPr returns the PrnPr property.
func ( _dab PresentationProperties ) PrnPr ( ) * _cgc . CT_PrintProperties { return _dab . _egf . PrnPr } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _aec * Presentation ; _cedg _e . Relationships ; _feff * _cgc . SldMaster ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _aeef * Presentation ) SaveToFileAsTemplate ( path string ) error { return _aeef . saveToFile ( path , true ) ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _bcgf ViewProperties ) ShowCommentsAttr ( ) * bool { return _bcgf . _ecc . ShowCommentsAttr } ;
2022-01-15 21:17:38 +00:00
2022-12-06 11:56:49 +00:00
// Slides returns the slides in the presentation.
func ( _cabb * Presentation ) Slides ( ) [ ] Slide { _cfb := [ ] Slide { } ; for _bfba , _gcda := range _cabb . _ace { _cfb = append ( _cfb , Slide { _cabb . _eeg . SldIdLst . SldId [ _bfba ] , _gcda , _cabb , nil } ) ; } ; return _cfb ; } ;
2020-08-23 14:15:53 +00:00
2022-09-02 11:46:53 +00:00
// X returns the inner wrapped XML type.
2022-12-06 11:56:49 +00:00
func ( _ffg SlideLayout ) X ( ) * _cgc . SldLayout { return _ffg . _gfeg } ; func ( _bb * chart ) Target ( ) string { return _bb . _bdg } ;
2020-11-09 01:00:18 +00:00
2022-09-02 11:46:53 +00:00
// X returns the inner wrapped XML type.
2022-12-06 11:56:49 +00:00
func ( _fecg SlideMaster ) X ( ) * _cgc . SldMaster { return _fecg . _feff } ;
2021-03-16 20:51:18 +00:00
2022-12-06 11:56:49 +00:00
// SlideText is an array of extracted text items which has some methods for representing extracted text from a slide.
type SlideText struct { Items [ ] * TextItem ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _gbfb ViewProperties ) NotesTextViewPr ( ) * _cgc . CT_NotesTextViewProperties { return _gbfb . _ecc . NotesTextViewPr ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _abcg TextBox ) SetOffsetY ( offY float64 ) { _bded := _abcg . getOff ( ) ; _aaa := _a . ToEMU ( offY ) ; _bded . YAttr = _de . ST_Coordinate { ST_CoordinateUnqualified : & _aaa } ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
type TableInfo struct { Table * _de . CT_Table ; Row * _de . CT_TableRow ; Cell * _de . CT_TableCell ; RowIndex int ; ColIndex int ; } ; func ( _eeca * Slide ) getSlideRels ( ) _e . Relationships { _afdg := _eeca . _bgg ; for _abf , _cbeg := range _afdg . Slides ( ) { if * _eeca . _fbb == * _cbeg . _fbb { return _afdg . _dfg [ len ( _afdg . _dfg ) - _abf - 1 ] ; } ; } ; return _e . Relationships { } ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// ShowPr returns the ShowPr property.
func ( _ddgg PresentationProperties ) ShowPr ( ) * _cgc . CT_ShowProperties { return _ddgg . _egf . ShowPr } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _dfdg * Presentation ) SaveAsTemplate ( w _eg . Writer ) error { return _dfdg . save ( w , true ) } ;
2021-08-23 20:44:48 +00:00
2022-12-06 11:56:49 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _acfb Slide ) ValidateWithPath ( path string ) error { if _fcec := _acfb . _fbb . ValidateWithPath ( path ) ; _fcec != nil { return _fcec ; } ; for _ , _efac := range _acfb . _fbb . CSld . SpTree . Choice { for _ , _dfb := range _efac . Sp { if _dfb . TxBody != nil { if len ( _dfb . TxBody . P ) == 0 { return _ef . New ( path + "\u0020\u003a \u0073\u006c\u0069\u0064\u0065 \u0073\u0068\u0061\u0070\u0065 \u0077\u0069\u0074\u0068\u0020\u0061\u0020\u0074\u0078\u0062\u006f\u0064\u0079\u0020\u006d\u0075\u0073\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0020\u0070\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0073" ) ; } ; } ; } ; } ; return nil ; } ;
2022-06-27 19:44:23 +00:00
2022-12-06 11:56:49 +00:00
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
func ( _ggdg * Presentation ) GetColorBySchemeColor ( schClr _de . ST_SchemeColorVal ) * _de . CT_Color { if len ( _ggdg . _efd ) == 0 || len ( _ggdg . _efb ) == 0 { return nil ; } ; var _cbfe _de . ST_ColorSchemeIndex ; _cef := _ggdg . _efd [ 0 ] ; _gab := _cef . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _cbfe = _gab . Bg1Attr ; case "\u0062\u0067\u0032" : _cbfe = _gab . Bg2Attr ; case "\u0074\u0078\u0031" : _cbfe = _gab . Tx1Attr ; case "\u0074\u0078\u0032" : _cbfe = _gab . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _cbfe = _gab . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _cbfe = _gab . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _cbfe = _gab . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _cbfe = _gab . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _cbfe = _gab . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _cbfe = _gab . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _cbfe = _gab . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _cbfe = _gab . FolHlinkAttr ; case "\u0064\u006b\u0031" : _cbfe = _de . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _cbfe = _de . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _cbfe = _de . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _cbfe = _de . ST_ColorSchemeIndexLt2 ; default : _cbfe = _de . ST_ColorSchemeIndexUnset ; } ; _accb := _ggdg . _efb [ 0 ] ; _bdfg := _accb . ThemeElements ; if _bdfg == nil { return nil ; } ; var _dge * _de . CT_Color ; _afc := _bdfg . ClrScheme ; switch _cbfe . String ( ) { case "\u0064\u006b\u0031" : _dge = _afc . Dk1 ; case "\u0064\u006b\u0032" : _dge = _afc . Dk2 ; case "\u006c\u0074\u0031" : _dge = _afc . Lt1 ; case "\u006c\u0074\u0032" : _dge = _afc . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _dge = _afc . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _dge = _afc . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _dge = _afc . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _dge = _afc . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _dge = _afc . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _dge = _afc . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _dge = _afc . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _dge = _afc . FolHlink ; default : return nil ; } ; return _dge ; } ;
2022-06-27 19:44:23 +00:00
2022-12-06 11:56:49 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _egegf * Presentation ) Close ( ) error { if _egegf . TmpPath != "" { return _ae . RemoveAll ( _egegf . TmpPath ) ; } ; return nil ; } ;
2021-08-23 20:44:48 +00:00
2022-12-06 11:56:49 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _ecc * _cgc . ViewPr } ;
2021-11-10 11:45:21 +00:00
2022-12-06 11:56:49 +00:00
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _dga * _cgc . CT_Shape ; _abe * _cgc . Sld ; } ;
2021-08-23 20:44:48 +00:00
2022-12-06 11:56:49 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _dbb ViewProperties ) OutlineViewPr ( ) * _cgc . CT_OutlineViewProperties { return _dbb . _ecc . OutlineViewPr ; } ;
2020-12-17 22:07:08 +00:00
2022-12-06 11:56:49 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _ege PlaceHolder ) ClearAll ( ) { _ege . _dga . SpPr = _de . NewCT_ShapeProperties ( ) ; _ege . _dga . TxBody = _de . NewCT_TextBody ( ) ; _ege . _dga . TxBody . LstStyle = _de . NewCT_TextListStyle ( ) ; } ;
2021-06-16 07:10:52 +00:00
2022-12-06 11:56:49 +00:00
// NormalViewPr returns the NormalViewPr property.
func ( _adae ViewProperties ) NormalViewPr ( ) * _cgc . CT_NormalViewProperties { return _adae . _ecc . NormalViewPr ; } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _egf : _cgc . NewPresentationPr ( ) } ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// AddTable adds an empty table to a slide.
func ( _ddgca Slide ) AddTable ( ) * _e . Table { _add := _cgc . NewCT_GroupShapeChoice ( ) ; _ddgca . _fbb . CSld . SpTree . Choice = append ( _ddgca . _fbb . CSld . SpTree . Choice , _add ) ; _aac := _cgc . NewCT_GraphicalObjectFrame ( ) ; _add . GraphicFrame = append ( _add . GraphicFrame , _aac ) ; _aac . Xfrm . Off = _de . NewCT_Point2D ( ) ; _ebbg := int64 ( 1 ) ; _aac . Xfrm . Off . XAttr = _de . ST_Coordinate { ST_CoordinateUnqualified : & _ebbg } ; _aac . Xfrm . Off . YAttr = _de . ST_Coordinate { ST_CoordinateUnqualified : & _ebbg } ; _ggbc := _aac . Graphic . CT_GraphicalObject . GraphicData ; _ggbc . UriAttr = "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002eo\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073.\u006f\u0072\u0067\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067\u006dl/\u0032\u0030\u0030\u0036\u002f\u0074\u0061\u0062\u006c\u0065" ; _bfcc := _e . NewTableWithXfrm ( _aac . Xfrm ) ; _ggbc . Any = append ( _ggbc . Any , _bfcc . X ( ) ) ; return _bfcc ; } ; func ( _dcef * Presentation ) onNewRelationship ( _ffd * _fb . DecodeMap , _bfa , _gcd string , _gff [ ] * _ea . File , _ebgd * _fd . Relationship , _dcfg _fb . Target ) error { _bfge := _bde . DocTypePresentation ; switch _gcd { case _bde . OfficeDocumentType : _dcef . _eeg = _cgc . NewPresentation ( ) ; _ffd . AddTarget ( _bfa , _dcef . _eeg , _gcd , 0 ) ; _ffd . AddTarget ( _fb . RelationsPathFor ( _bfa ) , _dcef . _baea . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . CorePropertiesType : _ffd . AddTarget ( _bfa , _dcef . CoreProperties . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . CustomPropertiesType : _ffd . AddTarget ( _bfa , _dcef . CustomProperties . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . PresentationPropertiesType : _ffd . AddTarget ( _bfa , _dcef . _feb . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . ViewPropertiesType : _ffd . AddTarget ( _bfa , _dcef . _fbec . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . TableStylesType : _ffd . AddTarget ( _bfa , _dcef . _cdc . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . HyperLinkType : _egeg := _de . NewCT_Hyperlink ( ) ; _cga := uint32 ( len ( _dcef . _fbc ) ) ; _ffd . AddTarget ( _bfa , _egeg , _gcd , _cga ) ; _dcef . _fbc = append ( _dcef . _fbc , _egeg ) ; case _bde . CustomXMLType : _fed := & _bde . XSDAny { } ; _cgac := uint32 ( len ( _dcef . _gf ) ) ; _ffd . AddTarget ( _bfa , _fed , _gcd , _cgac ) ; _dcef . _gf = append ( _dcef . _gf , _fed ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , len ( _dcef . _gf ) ) ; case _bde . ChartType : _ebbe := chart { _be : _b . NewChartSpace ( ) } ; _bdfa := uint32 ( len ( _dcef . _fcf ) ) ; _ffd . AddTarget ( _bfa , _ebbe . _be , _gcd , _bdfa ) ; _dcef . _fcf = append ( _dcef . _fcf , & _ebbe ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , len ( _dcef . _fcf ) ) ; _ebbe . _bdg = _ebgd . TargetAttr ; case _bde . HandoutMasterType : _abg := _cgc . NewHandoutMaster ( ) ; _cca := uint32 ( len ( _dcef . _afea ) ) ; _ffd . AddTarget ( _bfa , _abg , _gcd , _cca ) ; _dcef . _afea = append ( _dcef . _afea , _abg ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , len ( _dcef . _afea ) ) ; case _bde . NotesMasterType : _fbce := _cgc . NewNotesMaster ( ) ; _afdf := uint32 ( len ( _dcef . _cgcf ) ) ; _ffd . AddTarget ( _bfa , _fbce , _gcd , _afdf ) ; _dcef . _cgcf = append ( _dcef . _cgcf , _fbce ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , len ( _dcef . _cgcf ) ) ; case _bde . ExtendedPropertiesType : _ffd . AddTarget ( _bfa , _dcef . AppProperties . X ( ) , _gcd , 0 ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , 0 ) ; case _bde . SlideType : _ddggc := _cgc . NewSld ( ) ; _dcef . _ace = append ( _dcef . _ace , _ddggc ) ; _ffd . AddTarget ( _bfa , _ddggc , _gcd , uint32 ( len ( _dcef . _ace ) ) ) ; _ebgd . TargetAttr = _bde . RelativeFilename ( _bfge , _dcfg . Typ , _gcd , len ( _dcef . _ace ) ) ; _aab := _e . NewRelationships ( ) ; _ffd . AddTarget ( _fb . RelationsPathFor ( _bfa ) , _aab . X ( ) , _gcd , 0 ) ; _dcef . _dfg = append ( _dcef . _dfg , _aab ) ; case _bde . SlideMasterType : _aceg :
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// Index returns the placeholder index
func ( _aeda PlaceHolder ) Index ( ) uint32 { if _aeda . _dga . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _aeda . _dga . NvSpPr . NvPr . Ph . IdxAttr ; } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// NewSlideScreenSizeWithValue returns slide screen size with given width and height.
// Width and Height value is in EMU units, use our measurement.ToEMU to convert the -
// width and height value.
func NewSlideScreenSizeWithValue ( width , height int32 ) SlideScreenSize { return SlideScreenSize { width , height } ; } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// Read reads a document from an io.Reader.
func Read ( r _eg . ReaderAt , size int64 ) ( * Presentation , error ) { const _afda = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _ac . GetLicenseKey ( ) . IsLicensed ( ) && ! _dac { _fg . Println ( "\u0055\u006e\u006ci\u0063\u0065\u006e\u0073e\u0064\u0020\u0076\u0065\u0072\u0073\u0069o\u006e\u0020\u006f\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065" ) ; _fg . Println ( "\u002d\u0020\u0047e\u0074\u0020\u0061\u0020\u0074\u0072\u0069\u0061\u006c\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f" ) ; return nil , _ef . New ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064" ) ; } ; _aafe := _fccc ( ) ; _cefa , _dad := _ac . GenRefId ( "\u0070\u0072" ) ; if _dad != nil { _g . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dad ) ; return nil , _dad ; } ; _aafe . _gggb = _cefa ; if _gacd := _ac . Track ( _aafe . _gggb , _afda ) ; _gacd != nil { _g . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _gacd ) ; return nil , _gacd ; } ; _gad , _dad := _ae . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ; if _dad != nil { return nil , _dad ; } ; _aafe . TmpPath = _gad ; _fbceb , _dad := _ea . NewReader ( r , size ) ; if _dad != nil { return nil , _fg . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _dad ) ; } ; _baa := [ ] * _ea . File { } ; _baa = append ( _baa , _fbceb . File ... ) ; _bce := false ; for _ , _bdgc := range _baa { if _bdgc . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _bce = true ; break ; } ; } ; if _bce { _aafe . CreateCustomProperties ( ) ; } ; _dbda := _fb . DecodeMap { } ; _dbda . SetOnNewRelationshipFunc ( _aafe . onNewRelationship ) ; _dbda . AddTarget ( _bde . ContentTypesFilename , _aafe . ContentTypes . X ( ) , "" , 0 ) ; _dbda . AddTarget ( _bde . BaseRelsFilename , _aafe . Rels . X ( ) , "" , 0 ) ; if _dceg := _dbda . Decode ( _baa ) ; _dceg != nil { return nil , _dceg ; } ; for _ , _deaa := range _baa { if _deaa == nil { continue ; } ; if _gdcf := _aafe . AddExtraFileFromZip ( _deaa ) ; _gdcf != nil { return nil , _gdcf ; } ; } ; if _bce { _dfcg := false ; for _ , _dgcg := range _aafe . Rels . X ( ) . Relationship { if _dgcg . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _dfcg = true ; break ; } ; } ; if ! _dfcg { _aafe . AddCustomRelationships ( ) ; } ; } ; return _aafe , nil ; } ;
2021-08-23 20:44:48 +00:00
2022-12-06 11:56:49 +00:00
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _gfeg * _cgc . SldLayout } ;
2022-01-15 21:17:38 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _ecece Slide ) X ( ) * _cgc . Sld { return _ecece . _fbb } ;
2022-01-15 21:17:38 +00:00
2022-12-06 11:56:49 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _bbg * Slide ) ExtractText ( ) * SlideText { _dd := _gc ( _bbg . _bgg , _bbg . _fbb . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _cb . Sort ( sort2d ( _dd ) ) ; return & SlideText { Items : _dd } ; } ; func ( _ebd sort2d ) Swap ( i , j int ) { _ebd [ i ] , _ebd [ j ] = _ebd [ j ] , _ebd [ i ] } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _ffef * Presentation ) AddImage ( i _e . Image ) ( _e . ImageRef , error ) { _ecb := _e . MakeImageRef ( i , & _ffef . DocBase , _ffef . _baea ) ; if i . Data == nil && i . Path == "" { return _ecb , _ef . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0064\u0061t\u0061\u0020\u006f\u0072\u0020\u0061\u0020\u0070\u0061\u0074\u0068" ) ; } ; if i . Format == "" { return _ecb , _ef . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0061\u0020v\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074" ) ; } ; if i . Size . X == 0 || i . Size . Y == 0 { return _ecb , _ef . New ( "\u0069\u006d\u0061\u0067e\u0020\u006d\u0075\u0073\u0074\u0020\u0068\u0061\u0076\u0065 \u0061 \u0076\u0061\u006c\u0069\u0064\u0020\u0073i\u007a\u0065" ) ; } ; if i . Path != "" { _dagf := _ae . Add ( i . Path ) ; if _dagf != nil { return _ecb , _dagf ; } ; } ; _ffef . Images = append ( _ffef . Images , _ecb ) ; _ffef . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _ffef . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _ffef . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _ffef . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _ffef . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; return _ecb , nil ; } ; func _cbc ( _egb * Presentation , _dfc * _cgc . CT_Shape , _afb * _cgc . CT_GraphicalObjectFrame , _fdg * TableInfo , _cde * _de . CT_Transform2D , _fab int , _fcd [ ] rectangle , _dc [ ] * _de . CT_TextParagraph ) [ ] * TextItem { _bec := [ ] * TextItem { } ; var _cfc , _cff , _ecg , _ccg , _eef , _dfcb int64 ; _ccgc := _cde == nil ; _cfg := 0 ; for _ , _aff := range _dc { for _ , _ebfc := range _aff . EG_TextRun { if _egbg := _ebfc . R ; _egbg != nil { if ! _ccgc { if _cde . Off != nil { if _da := _cde . Ext ; _da != nil { _eef , _dfcb = _da . CxAttr , _da . CyAttr ; } ; if _fgd := _cde . Off . XAttr . ST_CoordinateUnqualified ; _fgd != nil { _cfc = * _fgd ; _cff = _cfc + _eef ; _ccgc = true ; } ; if _fgf := _cde . Off . YAttr . ST_CoordinateUnqualified ; _fgf != nil { _ecg = * _fgf ; _ccg = _ecg + _dfcb ; _ccgc = true ; } ; } ; } ; _fga := append ( [ ] rectangle { } , _fcd ... ) ; _fga = append ( _fga , rectangle { _fcb : _cfc , _ee : _cff , _ccd : _ecg , _aed : _ccg } ) ; _bec = append ( _bec , & TextItem { Presentation : _egb , Shape : _dfc , GraphicFrame : _afb , TableInfo : _fdg , Paragraph : _aff , Run : _egbg , Text : _egbg . T , _ebb : _fga , _ba : _fab , _eac : _cfg } ) ; _cfg ++ ; } ; } ; } ; return _bec ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// Presentation is the a presentation base document.
type Presentation struct { _e . DocBase ; _eeg * _cgc . Presentation ; _baea _e . Relationships ; _ace [ ] * _cgc . Sld ; _dfg [ ] _e . Relationships ; _efd [ ] * _cgc . SldMaster ; _edc [ ] _e . Relationships ; _becb [ ] * _cgc . SldLayout ; _ff [ ] _e . Relationships ; _efb [ ] * _de . Theme ; _aggc [ ] _e . Relationships ; _cdc _e . TableStyles ; _feb PresentationProperties ; _fbec ViewProperties ; _fbc [ ] * _de . CT_Hyperlink ; _fcf [ ] * chart ; _afea [ ] * _cgc . HandoutMaster ; _cgcf [ ] * _cgc . NotesMaster ; _gf [ ] * _bde . XSDAny ; _eaa map [ string ] string ; _gggb string ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _fea TextBox ) SetOffsetX ( offX float64 ) { _eaf := _fea . getOff ( ) ; _cge := _a . ToEMU ( offX ) ; _eaf . XAttr = _de . ST_Coordinate { ST_CoordinateUnqualified : & _cge } ; } ; func ( _db * chart ) X ( ) * _b . ChartSpace { return _db . _be } ; type sort2d [ ] * TextItem ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _efc PlaceHolder ) Paragraphs ( ) [ ] _eb . Paragraph { _eee := [ ] _eb . Paragraph { } ; for _ , _ebfdfd := range _efc . _dga . TxBody . P { _eee = append ( _eee , _eb . MakeParagraph ( _ebfdfd ) ) ; } ; return _eee ; } ;
2021-08-23 20:44:48 +00:00
2022-12-06 11:56:49 +00:00
// AddDefaultSlideWithLayout tries to replicate what PowerPoint does when
// inserting a slide with a new style by clearing placeholder content and removing
// some placeholders. Use AddSlideWithLayout if you need more control.
func ( _gdef * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _bdf , _bbc := _gdef . AddSlideWithLayout ( l ) ; for _ , _ecf := range _bdf . PlaceHolders ( ) { _ecf . Clear ( ) ; switch _ecf . Type ( ) { case _cgc . ST_PlaceholderTypeFtr , _cgc . ST_PlaceholderTypeDt , _cgc . ST_PlaceholderTypeSldNum : _ecf . Remove ( ) ; } ; } ; return _bdf , _bbc ; } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// ExtLst returns the ExtLst property.
func ( _agc PresentationProperties ) ExtLst ( ) * _cgc . CT_ExtensionList { return _agc . _egf . ExtLst } ; func ( _bbb sort2d ) Len ( ) int { return len ( _bbb ) } ; func _fccc ( ) * Presentation { _eefgg := & Presentation { _eeg : _cgc . NewPresentation ( ) } ; _eefgg . _eeg . SldIdLst = _cgc . NewCT_SlideIdList ( ) ; _eefgg . _eeg . ConformanceAttr = _d . ST_ConformanceClassTransitional ; _eefgg . AppProperties = _e . NewAppProperties ( ) ; _eefgg . CoreProperties = _e . NewCoreProperties ( ) ; _eefgg . _cdc = _e . NewTableStyles ( ) ; _eefgg . ContentTypes = _e . NewContentTypes ( ) ; _eefgg . Rels = _e . NewRelationships ( ) ; _eefgg . _baea = _e . NewRelationships ( ) ; _eefgg . _feb = NewPresentationProperties ( ) ; _eefgg . _fbec = NewViewProperties ( ) ; _eefgg . _eaa = map [ string ] string { } ; return _eefgg ; } ;
2022-01-15 21:17:38 +00:00
2022-12-06 11:56:49 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _adb * Presentation ) SaveToFile ( path string ) error { return _adb . saveToFile ( path , false ) } ; var ( SlideScreenSize16x9 = SlideScreenSize { 12192000 , 6858000 } ; SlideScreenSize4x3 = SlideScreenSize { 9144000 , 6858000 } ; SlideScreenSizeA4 = SlideScreenSize { 9906000 , 6858000 } ; ) ; func ( _ccf * Presentation ) Validate ( ) error { if _fbgg := _ccf . _eeg . Validate ( ) ; _fbgg != nil { return _fbgg ; } ; for _bc , _adaf := range _ccf . Slides ( ) { if _afgc := _adaf . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _bc ) ) ; _afgc != nil { return _afgc ; } ; } ; for _ebca , _egfb := range _ccf . _efd { if _dfcbd := _egfb . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _ebca ) ) ; _dfcbd != nil { return _dfcbd ; } ; } ; for _cbcc , _bdec := range _ccf . _becb { if _gdce := _bdec . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _cbcc ) ) ; _gdce != nil { return _gdce ; } ; } ; return nil ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// SetText sets the text of a placeholder for the initial paragraph. This is a
// shortcut method that is useful for things like titles which only contain a
// single paragraph.
func ( _gbg PlaceHolder ) SetText ( text string ) { _gbg . Clear ( ) ; _ggd := _de . NewEG_TextRun ( ) ; _ggd . R = _de . NewCT_RegularTextRun ( ) ; _ggd . R . T = text ; if len ( _gbg . _dga . TxBody . P ) == 0 { _gbg . _dga . TxBody . P = append ( _gbg . _dga . TxBody . P , _de . NewCT_TextParagraph ( ) ) ; } ; _gbg . _dga . TxBody . P [ 0 ] . EG_TextRun = nil ; _gbg . _dga . TxBody . P [ 0 ] . EG_TextRun = append ( _gbg . _dga . TxBody . P [ 0 ] . EG_TextRun , _ggd ) ; } ;
2022-02-25 19:20:45 +00:00
2022-12-06 11:56:49 +00:00
// ExtLst returns the ExtLst property.
func ( _dgcb ViewProperties ) ExtLst ( ) * _cgc . CT_ExtensionList { return _dgcb . _ecc . ExtLst } ;
2020-08-31 22:58:25 +00:00
2022-12-06 11:56:49 +00:00
// GetPlaceholderByIndex returns a placeholder given its index. If there are multiplace
// placeholders of the same index, this method returns the first one. You must use the
// PlaceHolders() method to access the others.
func ( _cdd Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _abbf := range _cdd . _fbb . CSld . SpTree . Choice { for _ , _eceg := range _abbf . Sp { if _eceg . NvSpPr != nil && _eceg . NvSpPr . NvPr != nil && _eceg . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _eceg . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _eceg . NvSpPr . NvPr . Ph . IdxAttr != nil && * _eceg . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _eceg , _cdd . _fbb } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ef . New ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0070\u006c\u0061\u0063\u0065\u0068\u006fl\u0064\u0065\u0072" ) ; } ;
2020-08-23 14:15:53 +00:00
2022-09-02 11:46:53 +00:00
// Save writes the presentation out to a writer in the Zip package format
2022-12-06 11:56:49 +00:00
func ( _gbe * Presentation ) Save ( w _eg . Writer ) error { return _gbe . save ( w , false ) } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _gbd := _fccc ( ) ; _gbd . ContentTypes . AddOverride ( "/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c" , "\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c" ) ; _gbd . Rels . AddRelationship ( "\u0064\u006f\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0063\u006f\u0072e\u002e\u0078\u006d\u006c" , "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061s\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0070\u0061\u0063\u006ba\u0067\u0065\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068\u0069\u0070\u0073\u002f\u006d\u0065\u0074\u0061\u0064\u0061\u0074\u0061/\u0063\u006f\u0072\u0065\u002d\u0070\u0072\u006f\u0070e\u0072\u0074i\u0065\u0073" ) ; _gbd . Rels . AddRelationship ( "\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c" , "\u0068t\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002eo\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073.\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074i\u006f\u006e\u0073\u0068\u0069p\u0073\u002f\u0065x\u0074\u0065\u006e\u0064\u0065d\u002d\u0070\u0072\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073" ) ; _gbd . Rels . AddRelationship ( "p\u0070t\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074a\u0074\u0069\u006f\u006e.x\u006d\u006c" , "\u0068\u0074\u0074\u0070\u003a\u002f\u002fs\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072g\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006fc\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068\u0069\u0070\u0073\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074" ) ; _gbd . Rels . AddRelationship ( "\u0070\u0070\u0074\u002f\u0070\u0072\u0065\u0073\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c" , "ht\u0074\u0070\u003a\u002f\u002f\u0073\u0063he\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006et\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068i\u0070s\u002f\u0070\u0072\u0065\u0073\u0050\u0072\u006f\u0070\u0073" ) ; _gbd . Rels . AddRelationship ( "\u0070\u0070\u0074\u002f\u0076\u0069\u0065\u0077\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c" , "ht\u0074\u0070\u003a\u002f\u002f\u0073\u0063he\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006et\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068i\u0070s\u002f\u0076\u0069\u0065\u0077\u0050\u0072\u006f\u0070\u0073" ) ; _gbd . Rels . AddRelationship ( "\u0070\u0070\u0074\u002fta\u0062\u006c\u0065\u0053\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c" , " \ u0068 \ u0074 \ u0074 \ u0070 \ u003a \ u002f \ u002fs \ u0063 \ u0068 \ u0065 \ u006d \ u0061 \ u0073 \ u002e \ u006f \ u0070 \ u0065 \ u006e \ u0078 \ u006d \ u006cf \ u006fr \ u006d \ u0061 \ u0074 \ u0073 \ u002e \ u006fr \ u0067 \ u002f \ u006f \ u0066 \ u0066 \ u0069 \ u0063e \ u0044 \ u006f \ u0063 \ u0075 \ u006d \ u0065 \ u006e \ u0074 \ u002f \ u0032 \ u0030 \ u0030 \ u0036 \ u002f \ u0072 \ u0065 \ u006c \ u0061 \ u0074 \ u0069 \ u006f \ u006e \ u0073h \ u0069 \ u0070 \ u0073 \ u002f \ u0074 \ u00
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _dggc * SlideSize ) X ( ) * _cgc . CT_SlideSize { return _dggc . _agcef } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// GridSpacing returns the GridSpacing property.
func ( _fdea ViewProperties ) GridSpacing ( ) * _de . CT_PositiveSize2D { return _fdea . _ecc . GridSpacing } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _cbfg PresentationProperties ) HtmlPubPr ( ) * _cgc . CT_HtmlPublishProperties { return _cbfg . _egf . HtmlPubPr ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _bbdd TextBox ) X ( ) * _cgc . CT_Shape { return _bbdd . _ecbf } ;
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
func NewSlideScreenSize ( ) SlideScreenSize { return NewSlideScreenSizeWithValue ( SlideScreenSize16x9 [ 0 ] , SlideScreenSize16x9 [ 1 ] ) ; } ;
// Presentation returns a slide's presentation.
func ( _edb Slide ) Presentation ( ) * Presentation { return _edb . _bgg } ;
2020-08-23 14:15:53 +00:00
2022-09-02 11:46:53 +00:00
// AddSlideWithLayout adds a new slide with content copied from a layout. Normally you should
// use AddDefaultSlideWithLayout as it will do some post processing similar to PowerPoint to
// clear place holder text, etc.
2022-12-06 11:56:49 +00:00
func ( _baf * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _gba := _cgc . NewCT_SlideIdListEntry ( ) ; _gba . IdAttr = 256 ; for _ , _efdf := range _baf . _eeg . SldIdLst . SldId { if _efdf . IdAttr >= _gba . IdAttr { _gba . IdAttr = _efdf . IdAttr + 1 ; } ; } ; _baf . _eeg . SldIdLst . SldId = append ( _baf . _eeg . SldIdLst . SldId , _gba ) ; _gaaf := _cgc . NewSld ( ) ; _ffe := _fa . Buffer { } ; _ggda := _cc . NewEncoder ( & _ffe ) ; _dcfd := _cc . StartElement { Name : _cc . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078\u006d\u006cn\u0073" } , Value : "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002eo\u0072\u0067\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069o\u006e\u006d\u006c\u002f\u0032\u00300\u0036\u002f\u006da\u0069\u006e" } ) ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078m\u006c\u006e\u0073\u003a\u0061" } , Value : "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065m\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006cf\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067m\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u006d\u0061\u0069\u006e" } ) ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078m\u006c\u006e\u0073\u003a\u0070" } , Value : "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002eo\u0072\u0067\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069o\u006e\u006d\u006c\u002f\u0032\u00300\u0036\u002f\u006da\u0069\u006e" } ) ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078m\u006c\u006e\u0073\u003a\u0072" } , Value : "\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068\u0065\u006da\u0073\u002e\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069c\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073h\u0069\u0070\u0073" } ) ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078\u006d\u006c\u006e\u0073\u003a\u0073\u0068" } , Value : "\u0068\u0074\u0074\u0070\u003a/\u002f\u0073\u0063\u0068\u0065m\u0061s\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067/\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0073\u0068\u0061\u0072e\u0064\u0054\u0079\u0070\u0065\u0073" } ) ; _dcfd . Attr = append ( _dcfd . Attr , _cc . Attr { Name : _cc . Name { Local : "\u0078m\u006c\u006e\u0073\u003a\u0078\u006dl" } , Value : "\u0068\u0074tp\u003a\u002f\u002fw\u0077\u0077\u002e\u00773.o\u0072g/\u0058\u004d\u004c\u002f\u0031\u0039\u00398/\u006e\u0061\u006d\u0065\u0073\u0070\u0061c\u0065" } ) ; if _cdcf := l . _gfeg . CSld . MarshalXML ( _ggda , _dcfd ) ; _cdcf != nil { return Slide { } , _cdcf ; } ; _ggda . Flush ( ) ; _fce := _cc . NewDecoder ( & _ffe ) ; _gaaf . CSld = _cgc . NewCT_CommonSlideData ( ) ; if _afd := _fce . Decode ( _gaaf . CSld ) ; _afd != nil { return Slide { } , _afd ; } ; _gaaf . CSld . NameAttr = nil ; _gaaf . CSld . SpTree . Choice = _daa ( _gaaf . CSld . SpTree . Choice ) ; _baf . _ace = append ( _baf . _ace , _gaaf ) ; _abb := _baf . _baea . AddAutoRelationship ( _bde . DocTypePresentation , _bde . OfficeDocumentType , len ( _baf . _ace ) , _bde . SlideType ) ; _gba . RIdAttr = _abb . ID ( ) ; _dgc := _bde . AbsoluteFilename ( _bde . DocTypePresentation , _bde . SlideType , len ( _baf . _ace ) ) ; _baf . ContentTypes . AddOverride ( _dgc , _bde . SlideContentType ) ; _bab := _e . NewRelationships ( ) ; _baf . _dfg = append ( _baf . _dfg , _bab ) ; _cgg := len ( _baf . _dfg ) - 1 ; for _age , _gdc := range _baf . _becb { if _gdc == l . X ( ) { _cfa := _baf . _ff [ _age ] ; for _ , _ebg := range _cfa . X ( ) . Relationship { if _ebg . TypeAttr != _bde . SlideMasterType { _baf . _dfg [ _cgg ] . X ( ) . Relationship = append ( _baf . _dfg [ _cgg ] .
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _bga ViewProperties ) X ( ) * _cgc . ViewPr { return _bga . _ecc } ;
2021-04-23 20:00:00 +00:00
2022-12-06 11:56:49 +00:00
// PlaceHolders returns all of the content place holders within a given slide.
func ( _ccaa Slide ) PlaceHolders ( ) [ ] PlaceHolder { _dbec := [ ] PlaceHolder { } ; for _ , _dcda := range _ccaa . _fbb . CSld . SpTree . Choice { for _ , _fadd := range _dcda . Sp { if _fadd . NvSpPr != nil && _fadd . NvSpPr . NvPr != nil && _fadd . NvSpPr . NvPr . Ph != nil { _dbec = append ( _dbec , PlaceHolder { _fadd , _ccaa . _fbb } ) ; } ; } ; } ; return _dbec ; } ;
2020-06-07 20:13:15 +07:00
2022-12-06 11:56:49 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _bbeg * Presentation ) GetTableStyleById ( id string ) * _de . CT_TableStyle { _fca := _bbeg . _cdc . TblStyle ( ) ; for _ , _dedg := range _fca { if _dedg . StyleIdAttr == id { return _dedg ; } ; } ; return nil ; } ;
2017-10-03 09:55:27 -05:00
2022-12-06 11:56:49 +00:00
// AddSlide adds a new slide to the presentation.
func ( _cabc * Presentation ) AddSlide ( ) Slide { _eba := _cgc . NewCT_SlideIdListEntry ( ) ; _eba . IdAttr = _cabc . nextSlideID ( ) ; _cabc . _eeg . SldIdLst . SldId = append ( _cabc . _eeg . SldIdLst . SldId , _eba ) ; _ebda := _cgc . NewSld ( ) ; _ebda . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ; _ebda . CSld . SpTree . GrpSpPr . Xfrm = _de . NewCT_GroupTransform2D ( ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Off = _de . NewCT_Point2D ( ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _bde . Int64 ( 0 ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _bde . Int64 ( 0 ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Ext = _de . NewCT_PositiveSize2D ( ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _a . Point ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _a . Point ) ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _ebda . CSld . SpTree . GrpSpPr . Xfrm . Off ; _ebda . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _ebda . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _cabc . _ace = append ( _cabc . _ace , _ebda ) ; _ggb := _cabc . _baea . AddAutoRelationship ( _bde . DocTypePresentation , _bde . OfficeDocumentType , len ( _cabc . _ace ) , _bde . SlideType ) ; _eba . RIdAttr = _ggb . ID ( ) ; _gagg := _bde . AbsoluteFilename ( _bde . DocTypePresentation , _bde . SlideType , len ( _cabc . _ace ) ) ; _cabc . ContentTypes . AddOverride ( _gagg , _bde . SlideContentType ) ; _gaec := _e . NewRelationships ( ) ; _cabc . _dfg = append ( _cabc . _dfg , _gaec ) ; _gaec . AddAutoRelationship ( _bde . DocTypePresentation , _bde . SlideType , len ( _cabc . _becb ) , _bde . SlideLayoutType ) ; return Slide { _eba , _ebda , _cabc , nil } ; } ;
2017-10-03 09:55:27 -05:00
2022-12-06 11:56:49 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _gfda * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _ccc := range _gfda . _becb { if _ccc . CSld . NameAttr != nil && name == * _ccc . CSld . NameAttr { return SlideLayout { _ccc } , nil ; } ; } ; return SlideLayout { } , _ef . New ( "\u0075\u006eab\u006c\u0065\u0020t\u006f\u0020\u0066\u0069nd \u006cay\u006f\u0075\u0074\u0020\u0077\u0069\u0074h \u0074\u0068\u0061\u0074\u0020\u006e\u0061m\u0065" ) ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
func ( _edg PresentationProperties ) X ( ) * _cgc . PresentationPr { return _edg . _egf } ;
2020-12-17 22:07:08 +00:00
2022-12-06 11:56:49 +00:00
// Themes returns an array of presentation themes.
func ( _eegd * Presentation ) Themes ( ) [ ] * _de . Theme { return _eegd . _efb } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// SetTextAnchor controls the text anchoring
func ( _dfgd TextBox ) SetTextAnchor ( a _de . ST_TextAnchoringType ) { _dfgd . _ecbf . TxBody . BodyPr = _de . NewCT_TextBodyProperties ( ) ; _dfgd . _ecbf . TxBody . BodyPr . AnchorAttr = a ; } ; func _gc ( _bf * Presentation , _fcc [ ] * _cgc . CT_GroupShapeChoice , _fbgf [ ] rectangle , _fdf [ ] * TextItem ) [ ] * TextItem { for _ , _fe := range _fcc { _aaf := append ( [ ] rectangle { } , _fbgf ... ) ; for _ , _cf := range _fe . Sp { _fdf = append ( _fdf , _cbc ( _bf , _cf , nil , nil , _cf . SpPr . Xfrm , 0 , _fbgf , _cf . TxBody . P ) ... ) ; } ; for _ , _ddc := range _fe . GraphicFrame { if _ddc != nil && _ddc . Graphic != nil && _ddc . Graphic . GraphicData != nil { _df := _ddc . Xfrm ; for _ , _ed := range _ddc . Graphic . GraphicData . Any { if _ge , _dbe := _ed . ( * _de . Tbl ) ; _dbe { _cgf := & _ge . CT_Table ; _gd := 0 ; for _fad , _ad := range _ge . Tr { for _ebf , _caa := range _ad . Tc { _bgb := & TableInfo { Table : _cgf , Row : _ad , Cell : _caa , RowIndex : _fad , ColIndex : _ebf } ; _fdf = append ( _fdf , _cbc ( _bf , nil , _ddc , _bgb , _df , _gd , _fbgf , _caa . TxBody . P ) ... ) ; _gd ++ ; } ; } ; } ; } ; } ; } ; for _ , _dbc := range _fe . GrpSp { if _dbc . GrpSpPr != nil { _gg := _dbc . GrpSpPr . Xfrm ; var _eff , _adf int64 ; if _gg . Off != nil { _cce , _ebc := _gg . Off . XAttr . ST_CoordinateUnqualified , _gg . Off . YAttr . ST_CoordinateUnqualified ; if _cce != nil && _ebc != nil { if _bdd := _gg . Ext ; _bdd != nil { _eff , _adf = _bdd . CxAttr , _bdd . CyAttr ; } ; _aaf = append ( _aaf , rectangle { _fcb : * _cce , _ccd : * _ebc , _ee : * _cce + _eff , _aed : * _ebc + _adf } ) ; } ; } ; } ; _fdf = _gc ( _bf , _dbc . Choice , _aaf , _fdf ) ; } ; } ; return _fdf ; } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _ffa Slide ) AddImageToRels ( img _e . ImageRef ) string { _dege := 0 ; for _gfg , _aea := range _ffa . _bgg . Images { if _aea == img { _dege = _gfg + 1 ; break ; } ; } ; var _bddd string ; for _gga , _fec := range _ffa . _bgg . Slides ( ) { if _fec . _fbb == _ffa . _fbb { _edab := _fg . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _dege , img . Format ( ) ) ; _dgf := _ffa . _bgg . _dfg [ _gga ] . AddRelationship ( _edab , _bde . ImageType ) ; _bddd = _dgf . ID ( ) ; } ; } ; return _bddd ; } ;
2021-01-04 16:11:39 +00:00
2022-12-06 11:56:49 +00:00
// SetWidth sets width of slide screen size with given value in EMU units.
func ( _baab * SlideScreenSize ) SetWidth ( val int32 ) { _baab [ 0 ] = val } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _dbbf ViewProperties ) SorterViewPr ( ) * _cgc . CT_SlideSorterViewProperties { return _dbbf . _ecc . SorterViewPr ; } ;
2021-05-31 16:22:30 +00:00
2022-12-06 11:56:49 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _geag ViewProperties ) SlideViewPr ( ) * _cgc . CT_SlideViewProperties { return _geag . _ecc . SlideViewPr } ;
2022-09-02 11:46:53 +00:00
2022-12-06 11:56:49 +00:00
// Type returns the type of the slide layout.
func ( _dadg SlideLayout ) Type ( ) _cgc . ST_SlideLayoutType { return _dadg . _gfeg . TypeAttr } ; func ( _ebaf * Slide ) ensureClrMap ( ) { if len ( _ebaf . _bgg . _efd ) == 0 || len ( _ebaf . _bgg . _efb ) == 0 { return ; } ; _fbff := _ebaf . _bgg . _efd [ 0 ] ; _abaf := _fbff . ClrMap ; if _dccg := _ebaf . _fbb . ClrMapOvr ; _dccg != nil { if _defb := _dccg . Choice ; _defb != nil { if _defb . MasterClrMapping == nil { if _bcf := _defb . OverrideClrMapping ; _bcf != nil { if _bcf . Bg1Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Bg1Attr = _bcf . Bg1Attr ; } ; if _bcf . Tx1Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Tx1Attr = _bcf . Tx1Attr ; } ; if _bcf . Bg2Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Bg2Attr = _bcf . Bg2Attr ; } ; if _bcf . Tx2Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Tx2Attr = _bcf . Tx2Attr ; } ; if _bcf . Accent1Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent1Attr = _bcf . Accent1Attr ; } ; if _bcf . Accent2Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent2Attr = _bcf . Accent2Attr ; } ; if _bcf . Accent3Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent3Attr = _bcf . Accent3Attr ; } ; if _bcf . Accent4Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent4Attr = _bcf . Accent4Attr ; } ; if _bcf . Accent5Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent5Attr = _bcf . Accent5Attr ; } ; if _bcf . Accent6Attr != _de . ST_ColorSchemeIndexUnset { _abaf . Accent6Attr = _bcf . Accent6Attr ; } ; if _bcf . HlinkAttr != _de . ST_ColorSchemeIndexUnset { _abaf . HlinkAttr = _bcf . HlinkAttr ; } ; if _bcf . FolHlinkAttr != _de . ST_ColorSchemeIndexUnset { _abaf . FolHlinkAttr = _bcf . FolHlinkAttr ; } ; } ; } ; } ; } ; _ebaf . _eec = _abaf ; } ;
2022-09-02 11:46:53 +00:00
2022-12-06 11:56:49 +00:00
// Properties returns the properties of the TextBox.
func ( _gabg TextBox ) Properties ( ) _eb . ShapeProperties { if _gabg . _ecbf . SpPr == nil { _gabg . _ecbf . SpPr = _de . NewCT_ShapeProperties ( ) ; } ; return _eb . MakeShapeProperties ( _gabg . _ecbf . SpPr ) ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// Size returns slide size value as SlideScreenSize.
func ( _cbcb * SlideSize ) Size ( ) SlideScreenSize { return SlideScreenSize { _cbcb . _agcef . CxAttr , _cbcb . _agcef . CyAttr } ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _adbe ViewProperties ) LastViewAttr ( ) _cgc . ST_ViewType { return _adbe . _ecc . LastViewAttr } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _gb * Presentation ) ExtractText ( ) * PresentationText { _aa := [ ] * SlideText { } ; for _ , _bae := range _gb . Slides ( ) { _ec := _bae . ExtractText ( ) ; if _ec != nil { _aa = append ( _aa , _ec ) ; } ; } ; return & PresentationText { Slides : _aa } ; } ; func ( _gbec * Presentation ) saveToFile ( _cea string , _eebc bool ) error { _acg , _dee := _ca . Create ( _cea ) ; if _dee != nil { return _dee ; } ; defer _acg . Close ( ) ; return _gbec . save ( _acg , _eebc ) ; } ; var _dac = false ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// SlideSize represents a slide size of a presentation.
type SlideSize struct { _agcef * _cgc . CT_SlideSize ; _fda * Presentation ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// Height returns slide screen size height in EMU units.
func ( _gade * SlideScreenSize ) Height ( ) int32 { return _gade [ 1 ] } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// SetSize sets the slide size, take argument of SlideScreenSize.
func ( _facd * SlideSize ) SetSize ( sz SlideScreenSize ) { _facd . _agcef . CxAttr = sz [ 0 ] ; _facd . _agcef . CyAttr = sz [ 1 ] ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// ClrMru returns the ClrMru property.
func ( _gdd PresentationProperties ) ClrMru ( ) * _de . CT_ColorMRU { return _gdd . _egf . ClrMru } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// Image is an image within a slide.
type Image struct { _ece * _cgc . CT_Picture } ; type chart struct { _be * _b . ChartSpace ; _beb string ; _bdg string ; } ;
2022-09-02 11:46:53 +00:00
2022-12-06 11:56:49 +00:00
// WebPr returns the WebPr property.
func ( _ddg PresentationProperties ) WebPr ( ) * _cgc . CT_WebProperties { return _ddg . _egf . WebPr } ;
2022-09-02 11:46:53 +00:00
2022-12-06 11:56:49 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _dec * SlideText ) Text ( ) string { _bdc := _fa . NewBuffer ( [ ] byte { } ) ; for _ , _ga := range _dec . Items { if _ga . Text != "" { _bdc . WriteString ( _ga . Text ) ; _bdc . WriteString ( "\u000a" ) ; } ; } ; return _bdc . String ( ) ; } ;
// Text returns text from a presentation as one string separated with line breaks.
func ( _ccgd * PresentationText ) Text ( ) string { _eab := _fa . NewBuffer ( [ ] byte { } ) ; for _ , _aba := range _ccgd . Slides { _eab . WriteString ( _aba . Text ( ) ) ; } ; return _eab . String ( ) ; } ;
2022-02-05 13:05:36 +00:00
2022-06-27 19:44:23 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
2022-09-02 11:46:53 +00:00
type PresentationText struct { Slides [ ] * SlideText ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _becc * _cgc . CT_SlideIdListEntry ; _fbb * _cgc . Sld ; _bgg * Presentation ; _eec * _de . CT_ColorMapping ; } ;
2021-09-22 16:41:01 +00:00
2022-12-06 11:56:49 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _gaafb * Presentation ) RemoveSlide ( s Slide ) error { _adbb := false ; _gfe := 0 ; for _dfgad , _ddgc := range _gaafb . _ace { if _ddgc == s . _fbb { if _gaafb . _eeg . SldIdLst . SldId [ _dfgad ] != s . _becc { return _ef . New ( "i\u006e\u0063\u006f\u006e\u0073\u0069s\u0074\u0065\u006e\u0063\u0079\u0020i\u006e\u0020\u0073\u006c\u0069\u0064\u0065s\u0020\u0061\u006e\u0064\u0020\u0049\u0044\u0020\u006c\u0069s\u0074" ) ; } ; copy ( _gaafb . _ace [ _dfgad : ] , _gaafb . _ace [ _dfgad + 1 : ] ) ; _gaafb . _ace = _gaafb . _ace [ 0 : len ( _gaafb . _ace ) - 1 ] ; copy ( _gaafb . _dfg [ _dfgad : ] , _gaafb . _dfg [ _dfgad + 1 : ] ) ; _gaafb . _dfg = _gaafb . _dfg [ 0 : len ( _gaafb . _dfg ) - 1 ] ; copy ( _gaafb . _eeg . SldIdLst . SldId [ _dfgad : ] , _gaafb . _eeg . SldIdLst . SldId [ _dfgad + 1 : ] ) ; _gaafb . _eeg . SldIdLst . SldId = _gaafb . _eeg . SldIdLst . SldId [ 0 : len ( _gaafb . _eeg . SldIdLst . SldId ) - 1 ] ; _adbb = true ; _gfe = _dfgad ; } ; } ; if ! _adbb { return _ef . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ; } ; _egba := _bde . AbsoluteFilename ( _bde . DocTypePresentation , _bde . SlideType , 0 ) ; return _gaafb . ContentTypes . RemoveOverrideByIndex ( _egba , _gfe ) ; } ;
2021-11-10 11:45:21 +00:00
2022-12-06 11:56:49 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _afbd PlaceHolder ) AddParagraph ( ) _eb . Paragraph { _cbd := _eb . MakeParagraph ( _de . NewCT_TextParagraph ( ) ) ; _afbd . _dga . TxBody . P = append ( _afbd . _dga . TxBody . P , _cbd . X ( ) ) ; return _cbd ; } ; type rectangle struct { _fcb int64 ; _ccd int64 ; _ee int64 ; _aed int64 ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// SlideScreenSize represents the slide screen size as a 2 element array
// representing the width and height in EMU units.
type SlideScreenSize [ 2 ] int32 ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
func ( _dgae * Slide ) GetImageByRelID ( relID string ) ( _e . ImageRef , bool ) { _dfa := _dgae . getSlideRels ( ) ; if ( _dfa == _e . Relationships { } ) { return _e . ImageRef { } , false ; } ; var _dacb string ; for _ , _ebae := range _dfa . X ( ) . Relationship { if _ebae . IdAttr == relID { _dacb = _ebae . TargetAttr ; break ; } ; } ; for _ , _fgda := range _dgae . _bgg . Images { if _fgda . Target ( ) == _dacb { return _fgda , true ; } ; } ; return _e . ImageRef { } , false ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _gda , _fgb := _ca . Open ( filename ) ; if _fgb != nil { return nil , _fg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fgb ) ; } ; defer _gda . Close ( ) ; _cbff , _fgb := _ca . Stat ( filename ) ; if _fgb != nil { return nil , _fg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fgb ) ; } ; _ = _cbff ; return Read ( _gda , _cbff . Size ( ) ) ; } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// Type returns the placeholder type
func ( _agg PlaceHolder ) Type ( ) _cgc . ST_PlaceholderType { return _agg . _dga . NvSpPr . NvPr . Ph . TypeAttr } ;
2022-02-05 13:05:36 +00:00
2022-12-06 11:56:49 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _egf * _cgc . PresentationPr } ;
2022-04-09 14:27:46 +00:00
2022-12-06 11:56:49 +00:00
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _abbg SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _ebe := map [ string ] int { } ; _fde := [ ] SlideLayout { } ; for _ , _agd := range _abbg . _cedg . Relationships ( ) { _agb := _fc . Replace ( _agd . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ; _agb = _fc . Replace ( _agb , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _aegf , _ggab := _c . ParseInt ( _agb , 10 , 32 ) ; _ggab == nil { _ebe [ _agd . ID ( ) ] = int ( _aegf ) ; } ; } ; for _ , _faga := range _abbg . _feff . SldLayoutIdLst . SldLayoutId { if _efgc , _gbc := _ebe [ _faga . RIdAttr ] ; _gbc { _acad := _abbg . _aec . _becb [ _efgc - 1 ] ; _fde = append ( _fde , SlideLayout { _acad } ) ; } ; } ; return _fde ; } ;