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-04-09 14:27:46 +00:00
package presentation ; import ( _eae "archive/zip" ; _ac "bytes" ; _eg "encoding/xml" ; _ca "errors" ; _abg "fmt" ; _eb "github.com/unidoc/unioffice" ; _da "github.com/unidoc/unioffice/common" ; _e "github.com/unidoc/unioffice/common/logger" ; _f "github.com/unidoc/unioffice/common/tempstorage" ; _de "github.com/unidoc/unioffice/drawing" ; _aa "github.com/unidoc/unioffice/internal/license" ; _dd "github.com/unidoc/unioffice/measurement" ; _ge "github.com/unidoc/unioffice/schema/soo/dml" ; _a "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _ae "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _ab "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _g "github.com/unidoc/unioffice/schema/soo/pml" ; _agd "github.com/unidoc/unioffice/zippkg" ; _c "image" ; _ea "image/jpeg" ; _b "io" ; _dgd "math" ; _ff "os" ; _fd "path" ; _cae "sort" ; _ag "strconv" ; _dg "strings" ; ) ; func _dddb ( _ebdf [ ] * _g . CT_GroupShapeChoice ) [ ] * _g . CT_GroupShapeChoice { var _ged [ ] * _g . CT_GroupShapeChoice ; for _ , _gbce := range _ebdf { if len ( _gbce . Pic ) == 0 { _ged = append ( _ged , _gbce ) ; } ; } ; return _ged ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// AddParagraph adds a paragraph to the text box
func ( _dbd TextBox ) AddParagraph ( ) _de . Paragraph { _fgee := _ge . NewCT_TextParagraph ( ) ; _dbd . _eaaa . TxBody . P = append ( _dbd . _eaaa . TxBody . P , _fgee ) ; return _de . MakeParagraph ( _fgee ) ; } ;
2021-05-31 16:22:30 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
2022-04-09 14:27:46 +00:00
func ( _caa * SlideSize ) X ( ) * _g . CT_SlideSize { return _caa . _cgfb } ;
2021-05-31 16:22:30 +00:00
2022-04-09 14:27:46 +00:00
// Presentation returns a slide's presentation.
func ( _eefd Slide ) Presentation ( ) * Presentation { return _eefd . _agf } ;
2022-01-15 21:17:38 +00:00
2022-04-09 14:27:46 +00:00
// Index returns the placeholder index
func ( _bbe PlaceHolder ) Index ( ) uint32 { if _bbe . _gfe . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _bbe . _gfe . NvSpPr . NvPr . Ph . IdxAttr ; } ;
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _fdgd TextBox ) SetOffsetY ( offY float64 ) { _gddff := _fdgd . getOff ( ) ; _dgaf := _dd . ToEMU ( offY ) ; _gddff . YAttr = _ge . ST_Coordinate { ST_CoordinateUnqualified : & _dgaf } ; } ; func _fb ( _dae * Presentation , _aeb [ ] * _g . CT_GroupShapeChoice , _cgg [ ] rectangle , _bg [ ] * TextItem ) [ ] * TextItem { for _ , _aac := range _aeb { _fcf := append ( [ ] rectangle { } , _cgg ... ) ; for _ , _gb := range _aac . Sp { _bg = append ( _bg , _cdg ( _dae , _gb , nil , nil , _gb . SpPr . Xfrm , 0 , _cgg , _gb . TxBody . P ) ... ) ; } ; for _ , _daa := range _aac . GraphicFrame { if _daa != nil && _daa . Graphic != nil && _daa . Graphic . GraphicData != nil { _fdf := _daa . Xfrm ; for _ , _ebg := range _daa . Graphic . GraphicData . Any { if _gbc , _cd := _ebg . ( * _ge . Tbl ) ; _cd { _bge := & _gbc . CT_Table ; _aec := 0 ; for _dec , _gdb := range _gbc . Tr { for _bfg , _dgf := range _gdb . Tc { _fa := & TableInfo { Table : _bge , Row : _gdb , Cell : _dgf , RowIndex : _dec , ColIndex : _bfg } ; _bg = append ( _bg , _cdg ( _dae , nil , _daa , _fa , _fdf , _aec , _cgg , _dgf . TxBody . P ) ... ) ; _aec ++ ; } ; } ; } ; } ; } ; } ; for _ , _cdf := range _aac . GrpSp { if _cdf . GrpSpPr != nil { _fab := _cdf . GrpSpPr . Xfrm ; var _gg , _bbc int64 ; if _fab . Off != nil { _ded , _bbf := _fab . Off . XAttr . ST_CoordinateUnqualified , _fab . Off . YAttr . ST_CoordinateUnqualified ; if _ded != nil && _bbf != nil { if _ce := _fab . Ext ; _ce != nil { _gg , _bbc = _ce . CxAttr , _ce . CyAttr ; } ; _fcf = append ( _fcf , rectangle { _fdb : * _ded , _fe : * _bbf , _agg : * _ded + _gg , _caf : * _bbf + _bbc } ) ; } ; } ; } ; _bg = _fb ( _dae , _cdf . Choice , _fcf , _bg ) ; } ; } ; return _bg ; } ;
// 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 ( _bcdg * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _ffe , _aacd := _bcdg . AddSlideWithLayout ( l ) ; for _ , _fad := range _ffe . PlaceHolders ( ) { _fad . Clear ( ) ; switch _fad . Type ( ) { case _g . ST_PlaceholderTypeFtr , _g . ST_PlaceholderTypeDt , _g . ST_PlaceholderTypeSldNum : _fad . Remove ( ) ; } ; } ; return _ffe , _aacd ; } ;
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _gfe * _g . CT_Shape ; _dge * _g . Sld ; } ; type sort2d [ ] * TextItem ;
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _fbb Slide ) GetTextBoxes ( ) [ ] * TextBox { _ccea := [ ] * TextBox { } ; _febg := _fbb . _dad . CSld . SpTree . Choice ; for _ , _gde := range _febg { for _ , _ddba := range _gde . Sp { if _ddba . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _ddba . NvSpPr . CNvSpPr . TxBoxAttr { _ccea = append ( _ccea , & TextBox { _ddba } ) ; } ; } ; } ; return _ccea ; } ;
// ShowCommentsAttr returns the WebPr property.
func ( _ggdd ViewProperties ) ShowCommentsAttr ( ) * bool { return _ggdd . _bcabd . ShowCommentsAttr } ; var _gab = false ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
2022-04-09 14:27:46 +00:00
func ( _afg * Slide ) GetColorBySchemeColor ( schClr _ge . ST_SchemeColorVal ) * _ge . CT_Color { _afg . ensureClrMap ( ) ; _caec := _afg . _gabe ; if _caec == nil { return nil ; } ; var _fbg _ge . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _fbg = _caec . Bg1Attr ; case "\u0062\u0067\u0032" : _fbg = _caec . Bg2Attr ; case "\u0074\u0078\u0031" : _fbg = _caec . Tx1Attr ; case "\u0074\u0078\u0032" : _fbg = _caec . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _fbg = _caec . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _fbg = _caec . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _fbg = _caec . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _fbg = _caec . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _fbg = _caec . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _fbg = _caec . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _fbg = _caec . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _fbg = _caec . FolHlinkAttr ; case "\u0064\u006b\u0031" : _fbg = _ge . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _fbg = _ge . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _fbg = _ge . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _fbg = _ge . ST_ColorSchemeIndexLt2 ; default : _fbg = _ge . ST_ColorSchemeIndexUnset ; } ; _fege := _afg . _agf . _feg [ 0 ] ; _fbde := _fege . ThemeElements ; if _fbde == nil { return nil ; } ; var _fce * _ge . CT_Color ; _ggff := _fbde . ClrScheme ; switch _fbg . String ( ) { case "\u0064\u006b\u0031" : _fce = _ggff . Dk1 ; case "\u0064\u006b\u0032" : _fce = _ggff . Dk2 ; case "\u006c\u0074\u0031" : _fce = _ggff . Lt1 ; case "\u006c\u0074\u0032" : _fce = _ggff . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _fce = _ggff . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _fce = _ggff . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _fce = _ggff . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _fce = _ggff . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _fce = _ggff . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _fce = _ggff . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _fce = _ggff . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _fce = _ggff . FolHlink ; default : return nil ; } ; return _fce ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _dce * PresentationText ) Text ( ) string { _fcac := _ac . NewBuffer ( [ ] byte { } ) ; for _ , _deae := range _dce . Slides { _fcac . WriteString ( _deae . Text ( ) ) ; } ; return _fcac . String ( ) ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Type returns the placeholder type
func ( _ccg PlaceHolder ) Type ( ) _g . ST_PlaceholderType { return _ccg . _gfe . NvSpPr . NvPr . Ph . TypeAttr } ;
// Save writes the presentation out to a writer in the Zip package format
func ( _gcc * Presentation ) Save ( w _b . Writer ) error { return _gcc . save ( w , false ) } ;
// ShowPr returns the ShowPr property.
func ( _gce PresentationProperties ) ShowPr ( ) * _g . CT_ShowProperties { return _gce . _cbg . ShowPr } ; func ( _dab * chart ) X ( ) * _a . ChartSpace { return _dab . _fg } ;
// Remove removes a placeholder from a presentation.
func ( _edg PlaceHolder ) Remove ( ) error { for _dac , _ddf := range _edg . _dge . CSld . SpTree . Choice { for _ , _ddb := range _ddf . Sp { if _ddb == _edg . _gfe { copy ( _edg . _dge . CSld . SpTree . Choice [ _dac : ] , _edg . _dge . CSld . SpTree . Choice [ _dac + 1 : ] ) ; _edg . _dge . CSld . SpTree . Choice = _edg . _dge . CSld . SpTree . Choice [ 0 : len ( _edg . _dge . CSld . SpTree . Choice ) - 1 ] ; return nil ; } ; } ; } ; return _ca . 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" ) ; } ;
// SlideScreenSize represents the slide screen size as a 2 element array
// representing the width and height in EMU units.
type SlideScreenSize [ 2 ] int32 ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +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 ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _fbcf * Presentation ) SaveToFile ( path string ) error { return _fbcf . saveToFile ( path , false ) } ;
2020-11-09 01:00:18 +00:00
2022-04-09 14:27:46 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _dfd * Slide ) GetChartSpaceByRelId ( relId string ) * _a . ChartSpace { _ebcg := _dfd . getSlideRels ( ) ; if ( _ebcg == _da . Relationships { } ) { return nil ; } ; _acea := _ebcg . GetTargetByRelId ( relId ) ; for _ , _bgcd := range _dfd . _agf . _bcd { if _acea == _bgcd . Target ( ) { return _bgcd . _fg ; } ; } ; return nil ; } ; var ( SlideScreenSize16x9 = SlideScreenSize { 12192000 , 6858000 } ; SlideScreenSize4x3 = SlideScreenSize { 9144000 , 6858000 } ; SlideScreenSizeA4 = SlideScreenSize { 9906000 , 6858000 } ; ) ; func _cdg ( _ege * Presentation , _geb * _g . CT_Shape , _eaed * _g . CT_GraphicalObjectFrame , _gbg * TableInfo , _ef * _ge . CT_Transform2D , _dea int , _cda [ ] rectangle , _efb [ ] * _ge . CT_TextParagraph ) [ ] * TextItem { _dc := [ ] * TextItem { } ; var _agdf , _cec , _aeca , _gdd , _cab , _aad int64 ; _gfc := _ef == nil ; _gc := 0 ; for _ , _bfe := range _efb { for _ , _daeb := range _bfe . EG_TextRun { if _agge := _daeb . R ; _agge != nil { if ! _gfc { if _ef . Off != nil { if _gcf := _ef . Ext ; _gcf != nil { _cab , _aad = _gcf . CxAttr , _gcf . CyAttr ; } ; if _afc := _ef . Off . XAttr . ST_CoordinateUnqualified ; _afc != nil { _agdf = * _afc ; _cec = _agdf + _cab ; _gfc = true ; } ; if _cdae := _ef . Off . YAttr . ST_CoordinateUnqualified ; _cdae != nil { _aeca = * _cdae ; _gdd = _aeca + _aad ; _gfc = true ; } ; } ; } ; _acg := append ( [ ] rectangle { } , _cda ... ) ; _acg = append ( _acg , rectangle { _fdb : _agdf , _agg : _cec , _fe : _aeca , _caf : _gdd } ) ; _dc = append ( _dc , & TextItem { Presentation : _ege , Shape : _geb , GraphicFrame : _eaed , TableInfo : _gbg , Paragraph : _bfe , Run : _agge , Text : _agge . T , _fc : _acg , _cf : _dea , _fca : _gc } ) ; _gc ++ ; } ; } ; } ; return _dc ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ;
2021-05-31 16:22:30 +00:00
2022-02-05 13:05:36 +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.
2022-04-09 14:27:46 +00:00
func ( _afec * Presentation ) AddImage ( i _da . Image ) ( _da . ImageRef , error ) { _adac := _da . MakeImageRef ( i , & _afec . DocBase , _afec . _fbc ) ; if i . Data == nil && i . Path == "" { return _adac , _ca . 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 _adac , _ca . 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 _adac , _ca . 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 != "" { _gca := _f . Add ( i . Path ) ; if _gca != nil { return _adac , _gca ; } ; } ; _afec . Images = append ( _afec . Images , _adac ) ; _afec . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _afec . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _afec . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _afec . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _afec . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; return _adac , nil ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// SetHeight sets height of slide screen size with given value in EMU units.
func ( _ega * SlideScreenSize ) SetHeight ( val int32 ) { _ega [ 1 ] = val } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// AddTable adds an empty table to a slide.
func ( _fcb Slide ) AddTable ( ) * _da . Table { _eace := _g . NewCT_GroupShapeChoice ( ) ; _fcb . _dad . CSld . SpTree . Choice = append ( _fcb . _dad . CSld . SpTree . Choice , _eace ) ; _aaaa := _g . NewCT_GraphicalObjectFrame ( ) ; _eace . GraphicFrame = append ( _eace . GraphicFrame , _aaaa ) ; _aaaa . Xfrm . Off = _ge . NewCT_Point2D ( ) ; _babc := int64 ( 1 ) ; _aaaa . Xfrm . Off . XAttr = _ge . ST_Coordinate { ST_CoordinateUnqualified : & _babc } ; _aaaa . Xfrm . Off . YAttr = _ge . ST_Coordinate { ST_CoordinateUnqualified : & _babc } ; _bfaa := _aaaa . Graphic . CT_GraphicalObject . GraphicData ; _bfaa . 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" ; _gggb := _da . NewTableWithXfrm ( _aaaa . Xfrm ) ; _bfaa . Any = append ( _bfaa . Any , _gggb . X ( ) ) ; return _gggb ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _bcabd * _g . ViewPr } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _abef ViewProperties ) NotesTextViewPr ( ) * _g . CT_NotesTextViewProperties { return _abef . _bcabd . NotesTextViewPr ; } ;
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
func ( _edcf * Slide ) GetImageByRelID ( relID string ) ( _da . ImageRef , bool ) { _dag := _edcf . getSlideRels ( ) ; if ( _dag == _da . Relationships { } ) { return _da . ImageRef { } , false ; } ; var _dabf string ; for _ , _eaad := range _dag . X ( ) . Relationship { if _eaad . IdAttr == relID { _dabf = _eaad . TargetAttr ; break ; } ; } ; for _ , _dbbf := range _edcf . _agf . Images { if _dbbf . Target ( ) == _dabf { return _dbbf , true ; } ; } ; return _da . ImageRef { } , false ; } ;
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
2022-04-09 14:27:46 +00:00
func ( _df PlaceHolder ) X ( ) * _g . CT_Shape { return _df . _gfe } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +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 * _ge . CT_Table ; Row * _ge . CT_TableRow ; Cell * _ge . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// GetSlideLayout returns a slide layout related to the slide.
2022-04-09 14:27:46 +00:00
func ( _dece * Slide ) GetSlideLayout ( ) * _g . SldLayout { for _geag , _eaee := range _dece . _agf . Slides ( ) { if * _dece == _eaee { return _dece . _agf . _aaf [ len ( _dece . _agf . Slides ( ) ) - _geag - 1 ] ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +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 * _g . CT_Shape ; GraphicFrame * _g . CT_GraphicalObjectFrame ; Paragraph * _ge . CT_TextParagraph ; Run * _ge . CT_RegularTextRun ; TableInfo * TableInfo ; _fc [ ] rectangle ; _cf int ; _fca int ; } ;
2020-11-09 01:00:18 +00:00
2022-04-09 14:27:46 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _bgc := _dcda ( ) ; _bgc . 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" ) ; _bgc . 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" ) ; _bgc . 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" ) ; _bgc . 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" ) ; _bgc . 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" ) ; _bgc . 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" ) ; _bgc . 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
2021-03-16 20:51:18 +00:00
2022-04-09 14:27:46 +00:00
// Slides returns the slides in the presentation.
func ( _deac * Presentation ) Slides ( ) [ ] Slide { _dcgc := [ ] Slide { } ; for _cde , _baeg := range _deac . _eaa { _dcgc = append ( _dcgc , Slide { _deac . _ced . SldIdLst . SldId [ _cde ] , _baeg , _deac , nil } ) ; } ; return _dcgc ; } ; func ( _ecb * Presentation ) saveToFile ( _defg string , _eag bool ) error { _ebed , _deb := _ff . Create ( _defg ) ; if _deb != nil { return _deb ; } ; defer _ebed . Close ( ) ; return _ecb . save ( _ebed , _eag ) ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// SetSize sets the slide size, take argument of SlideScreenSize.
func ( _gada * SlideSize ) SetSize ( sz SlideScreenSize ) { _gada . _cgfb . CxAttr = sz [ 0 ] ; _gada . _cgfb . CyAttr = sz [ 1 ] ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// AddImage adds an image textbox to a slide.
func ( _fag Slide ) AddImage ( img _da . ImageRef ) Image { _bdfe := _g . NewCT_GroupShapeChoice ( ) ; _fag . _dad . CSld . SpTree . Choice = append ( _fag . _dad . CSld . SpTree . Choice , _bdfe ) ; _bbfb := _g . NewCT_Picture ( ) ; _bdfe . Pic = append ( _bdfe . Pic , _bbfb ) ; _bbfb . NvPicPr . CNvPicPr = _ge . NewCT_NonVisualPictureProperties ( ) ; _bbfb . NvPicPr . CNvPicPr . PicLocks = _ge . NewCT_PictureLocking ( ) ; _bbfb . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _eb . Bool ( true ) ; _bbfb . BlipFill = _ge . NewCT_BlipFillProperties ( ) ; _bbfb . BlipFill . Blip = _ge . NewCT_Blip ( ) ; _ecff := _fag . AddImageToRels ( img ) ; _bbfb . BlipFill . Blip . EmbedAttr = _eb . String ( _ecff ) ; _bbfb . BlipFill . Stretch = _ge . NewCT_StretchInfoProperties ( ) ; _bbfb . BlipFill . Stretch . FillRect = _ge . NewCT_RelativeRect ( ) ; _bbfb . SpPr = _ge . NewCT_ShapeProperties ( ) ; _bbfb . SpPr . PrstGeom = _ge . NewCT_PresetGeometry2D ( ) ; _bbfb . SpPr . PrstGeom . PrstAttr = _ge . ST_ShapeTypeRect ; _bfd := Image { _bbfb } ; _acd := img . Size ( ) ; _bfd . Properties ( ) . SetWidth ( _dd . Distance ( _acd . X ) * _dd . Pixel72 ) ; _bfd . Properties ( ) . SetHeight ( _dd . Distance ( _acd . Y ) * _dd . Pixel72 ) ; _bfd . Properties ( ) . SetPosition ( 0 , 0 ) ; return _bfd ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
func NewSlideScreenSize ( ) SlideScreenSize { return NewSlideScreenSizeWithValue ( SlideScreenSize16x9 [ 0 ] , SlideScreenSize16x9 [ 1 ] ) ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// PrnPr returns the PrnPr property.
func ( _gdc PresentationProperties ) PrnPr ( ) * _g . CT_PrintProperties { return _gdc . _cbg . PrnPr } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Width returns slide screen size width in EMU units.
func ( _cgbb * SlideScreenSize ) Width ( ) int32 { return _cgbb [ 0 ] } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _bcg * Presentation ) SaveToFileAsTemplate ( path string ) error { return _bcg . saveToFile ( path , true ) } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// Size returns slide size value as SlideScreenSize.
func ( _fgga * SlideSize ) Size ( ) SlideScreenSize { return SlideScreenSize { _fgga . _cgfb . CxAttr , _fgga . _cgfb . CyAttr } ; } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _eaba Slide ) ValidateWithPath ( path string ) error { if _deaee := _eaba . _dad . ValidateWithPath ( path ) ; _deaee != nil { return _deaee ; } ; for _ , _debf := range _eaba . _dad . CSld . SpTree . Choice { for _ , _cdbc := range _debf . Sp { if _cdbc . TxBody != nil { if len ( _cdbc . TxBody . P ) == 0 { return _ca . 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 ; } ; func ( _geg sort2d ) Len ( ) int { return len ( _geg ) } ;
2021-11-10 11:45:21 +00:00
2022-04-09 14:27:46 +00:00
// AddSlide adds a new slide to the presentation.
func ( _efed * Presentation ) AddSlide ( ) Slide { _dcg := _g . NewCT_SlideIdListEntry ( ) ; _dcg . IdAttr = _efed . nextSlideID ( ) ; _efed . _ced . SldIdLst . SldId = append ( _efed . _ced . SldIdLst . SldId , _dcg ) ; _cdc := _g . NewSld ( ) ; _cdc . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ; _cdc . CSld . SpTree . GrpSpPr . Xfrm = _ge . NewCT_GroupTransform2D ( ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Off = _ge . NewCT_Point2D ( ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _eb . Int64 ( 0 ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _eb . Int64 ( 0 ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Ext = _ge . NewCT_PositiveSize2D ( ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _dd . Point ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _dd . Point ) ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _cdc . CSld . SpTree . GrpSpPr . Xfrm . Off ; _cdc . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _cdc . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _efed . _eaa = append ( _efed . _eaa , _cdc ) ; _ddd := _efed . _fbc . AddAutoRelationship ( _eb . DocTypePresentation , _eb . OfficeDocumentType , len ( _efed . _eaa ) , _eb . SlideType ) ; _dcg . RIdAttr = _ddd . ID ( ) ; _gfd := _eb . AbsoluteFilename ( _eb . DocTypePresentation , _eb . SlideType , len ( _efed . _eaa ) ) ; _efed . ContentTypes . AddOverride ( _gfd , _eb . SlideContentType ) ; _bfa := _da . NewRelationships ( ) ; _efed . _ece = append ( _efed . _ece , _bfa ) ; _bfa . AddAutoRelationship ( _eb . DocTypePresentation , _eb . SlideType , len ( _efed . _aaf ) , _eb . SlideLayoutType ) ; return Slide { _dcg , _cdc , _efed , nil } ; } ;
2021-11-10 11:45:21 +00:00
2022-04-09 14:27:46 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _db * Presentation ) ExtractText ( ) * PresentationText { _gf := [ ] * SlideText { } ; for _ , _cg := range _db . Slides ( ) { _ba := _cg . ExtractText ( ) ; if _ba != nil { _gf = append ( _gf , _ba ) ; } ; } ; return & PresentationText { Slides : _gf } ; } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _gd * Slide ) ExtractText ( ) * SlideText { _ddc := _fb ( _gd . _agf , _gd . _dad . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _cae . Sort ( sort2d ( _ddc ) ) ; return & SlideText { Items : _ddc } ; } ;
2020-12-17 22:07:08 +00:00
2022-04-09 14:27:46 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _cgc * Presentation ) RemoveSlide ( s Slide ) error { _fcga := false ; _ggdf := 0 ; for _ceca , _aacf := range _cgc . _eaa { if _aacf == s . _dad { if _cgc . _ced . SldIdLst . SldId [ _ceca ] != s . _dca { return _ca . 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 ( _cgc . _eaa [ _ceca : ] , _cgc . _eaa [ _ceca + 1 : ] ) ; _cgc . _eaa = _cgc . _eaa [ 0 : len ( _cgc . _eaa ) - 1 ] ; copy ( _cgc . _ece [ _ceca : ] , _cgc . _ece [ _ceca + 1 : ] ) ; _cgc . _ece = _cgc . _ece [ 0 : len ( _cgc . _ece ) - 1 ] ; copy ( _cgc . _ced . SldIdLst . SldId [ _ceca : ] , _cgc . _ced . SldIdLst . SldId [ _ceca + 1 : ] ) ; _cgc . _ced . SldIdLst . SldId = _cgc . _ced . SldIdLst . SldId [ 0 : len ( _cgc . _ced . SldIdLst . SldId ) - 1 ] ; _fcga = true ; _ggdf = _ceca ; } ; } ; if ! _fcga { return _ca . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ; } ; _cddg := _eb . AbsoluteFilename ( _eb . DocTypePresentation , _eb . SlideType , 0 ) ; return _cgc . ContentTypes . RemoveOverrideByIndex ( _cddg , _ggdf ) ; } ; func ( _dbc * Presentation ) Validate ( ) error { if _dedd := _dbc . _ced . Validate ( ) ; _dedd != nil { return _dedd ; } ; for _dfea , _bfab := range _dbc . Slides ( ) { if _ecbd := _bfab . ValidateWithPath ( _abg . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _dfea ) ) ; _ecbd != nil { return _ecbd ; } ; } ; for _bdb , _dgae := range _dbc . _efe { if _dcf := _dgae . ValidateWithPath ( _abg . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _bdb ) ) ; _dcf != nil { return _dcf ; } ; } ; for _dcbe , _gaad := range _dbc . _aaf { if _eab := _gaad . ValidateWithPath ( _abg . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _dcbe ) ) ; _eab != nil { return _eab ; } ; } ; return nil ; } ; func ( _fde * Presentation ) nextSlideID ( ) uint32 { _agb := uint32 ( 256 ) ; for _ , _gea := range _fde . _ced . SldIdLst . SldId { if _gea . IdAttr >= _agb { _agb = _gea . IdAttr + 1 ; } ; } ; return _agb ; } ; func ( _agdg TextBox ) getOff ( ) * _ge . CT_Point2D { if _agdg . _eaaa . SpPr == nil { _agdg . _eaaa . SpPr = _ge . NewCT_ShapeProperties ( ) ; } ; if _agdg . _eaaa . SpPr . Xfrm == nil { _agdg . _eaaa . SpPr . Xfrm = _ge . NewCT_Transform2D ( ) ; } ; if _agdg . _eaaa . SpPr . Xfrm . Off == nil { _agdg . _eaaa . SpPr . Xfrm . Off = _ge . NewCT_Point2D ( ) ; } ; return _agdg . _eaaa . SpPr . Xfrm . Off ; } ;
2021-06-16 07:10:52 +00:00
2022-04-09 14:27:46 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _ddbd PresentationProperties ) HtmlPubPr ( ) * _g . CT_HtmlPublishProperties { return _ddbd . _cbg . HtmlPubPr ; } ; func ( _ecc * chart ) RelId ( ) string { return _ecc . _ec } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +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 ( _bbca PlaceHolder ) Clear ( ) { _bbca . ClearAll ( ) ; _cfc := _ge . NewCT_TextParagraph ( ) ; _bbca . _gfe . TxBody . P = [ ] * _ge . CT_TextParagraph { _cfc } ; _cfc . EndParaRPr = _ge . NewCT_TextCharacterProperties ( ) ; _cfc . EndParaRPr . LangAttr = _eb . String ( "\u0065\u006e\u002dU\u0053" ) ; } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _bcabd : _g . NewViewPr ( ) } } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _debg * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _aadb := range _debg . _aaf { if _aadb . CSld . NameAttr != nil && name == * _aadb . CSld . NameAttr { return SlideLayout { _aadb } , nil ; } ; } ; return SlideLayout { } , _ca . 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" ) ; } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _bbbd Slide ) AddTextBox ( ) TextBox { _debfg := _g . NewCT_GroupShapeChoice ( ) ; _bbbd . _dad . CSld . SpTree . Choice = append ( _bbbd . _dad . CSld . SpTree . Choice , _debfg ) ; _dabb := _g . NewCT_Shape ( ) ; _debfg . Sp = append ( _debfg . Sp , _dabb ) ; _dabb . SpPr = _ge . NewCT_ShapeProperties ( ) ; _dabb . SpPr . Xfrm = _ge . NewCT_Transform2D ( ) ; _dabb . SpPr . PrstGeom = _ge . NewCT_PresetGeometry2D ( ) ; _dabb . SpPr . PrstGeom . PrstAttr = _ge . ST_ShapeTypeRect ; _dabb . NvSpPr = _g . NewCT_ShapeNonVisual ( ) ; _dabb . NvSpPr . CNvSpPr = _ge . NewCT_NonVisualDrawingShapeProps ( ) ; _eafb := true ; _dabb . NvSpPr . CNvSpPr . TxBoxAttr = & _eafb ; _dabb . TxBody = _ge . NewCT_TextBody ( ) ; _dabb . TxBody . BodyPr = _ge . NewCT_TextBodyProperties ( ) ; _dabb . TxBody . BodyPr . WrapAttr = _ge . ST_TextWrappingTypeSquare ; _dabb . TxBody . BodyPr . SpAutoFit = _ge . NewCT_TextShapeAutofit ( ) ; _egca := TextBox { _dabb } ; _egca . Properties ( ) . SetWidth ( 3 * _dd . Inch ) ; _egca . Properties ( ) . SetHeight ( 1 * _dd . Inch ) ; _egca . Properties ( ) . SetPosition ( 0 , 0 ) ; return _egca ; } ; type chart struct { _fg * _a . ChartSpace ; _ec string ; _bf string ; } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _bgb * Presentation ) SlideMasters ( ) [ ] SlideMaster { _cbge := [ ] SlideMaster { } ; for _cfa , _adde := range _bgb . _efe { _cbge = append ( _cbge , SlideMaster { _bgb , _bgb . _abd [ _cfa ] , _adde } ) ; } ; return _cbge ; } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// SlideSize returns presentation slide size.
func ( _febe * Presentation ) SlideSize ( ) SlideSize { if _febe . _ced . SldSz == nil { _febe . _ced . SldSz = _g . NewCT_SlideSize ( ) ; } ; return SlideSize { _febe . _ced . SldSz , _febe } ; } ; func ( _bed * Slide ) getSlideRels ( ) _da . Relationships { _bcbc := _bed . _agf ; for _fged , _dcgcf := range _bcbc . Slides ( ) { if * _bed . _dad == * _dcgcf . _dad { return _bcbc . _ece [ len ( _bcbc . _ece ) - _fged - 1 ] ; } ; } ; return _da . Relationships { } ; } ;
2022-01-15 21:17:38 +00:00
2022-04-09 14:27:46 +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 ( _ebc Slide ) GetPlaceholder ( t _g . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _eeaf := range _ebc . _dad . CSld . SpTree . Choice { for _ , _edb := range _eeaf . Sp { if _edb . NvSpPr != nil && _edb . NvSpPr . NvPr != nil && _edb . NvSpPr . NvPr . Ph != nil { if _edb . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _edb , _ebc . _dad } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ca . 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-01-15 21:17:38 +00:00
2022-04-09 14:27:46 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _cega ViewProperties ) NotesViewPr ( ) * _g . CT_NotesViewProperties { return _cega . _bcabd . NotesViewPr } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// ExtLst returns the ExtLst property.
func ( _ebd PresentationProperties ) ExtLst ( ) * _g . CT_ExtensionList { return _ebd . _cbg . ExtLst } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// NormalViewPr returns the NormalViewPr property.
func ( _gegc ViewProperties ) NormalViewPr ( ) * _g . CT_NormalViewProperties { return _gegc . _bcabd . NormalViewPr ; } ;
2020-08-23 14:15:53 +00:00
2022-02-05 13:05:36 +00:00
// X returns the inner wrapped XML type.
2022-04-09 14:27:46 +00:00
func ( _cgfa ViewProperties ) X ( ) * _g . ViewPr { return _cgfa . _bcabd } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// ExtLst returns the ExtLst property.
func ( _bbgc ViewProperties ) ExtLst ( ) * _g . CT_ExtensionList { return _bbgc . _bcabd . ExtLst } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _bgf * Presentation ) SaveAsTemplate ( w _b . Writer ) error { return _bgf . save ( w , true ) } ;
2021-08-23 20:44:48 +00:00
2022-04-09 14:27:46 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _deag * Presentation ) GetTableStyleById ( id string ) * _ge . CT_TableStyle { _eac := _deag . _ggda . TblStyle ( ) ; for _ , _cfb := range _eac { if _cfb . StyleIdAttr == id { return _cfb ; } ; } ; return nil ; } ; func ( _aaa * chart ) Target ( ) string { return _aaa . _bf } ;
// 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 ( _cdb sort2d ) Less ( i , j int ) bool { _afb , _aed := _cdb [ i ] , _cdb [ j ] ; _bbce , _be := _afb . _fc , _aed . _fc ; _feb , _fee := len ( _bbce ) - 1 , len ( _be ) - 1 ; _ad , _gac := 0 , 0 ; for { _aag , _fed , _bd , _fbd , _fba , _bgd , _dbb , _cgd := _bbce [ _ad ] . _fe , _be [ _gac ] . _fe , _bbce [ _ad ] . _caf , _be [ _gac ] . _caf , _bbce [ _ad ] . _fdb , _be [ _gac ] . _fdb , _bbce [ _ad ] . _agg , _be [ _gac ] . _agg ; if _aag == _fed || ( ( _dgd . Abs ( float64 ( _aag ) - float64 ( _fed ) ) < _gddf ) && ( ( _aag >= _fed && _aag <= _fbd ) || ( _fed >= _aag && _fed <= _bd ) ) && ( _dbb < _bgd || _fba > _cgd ) ) { if _fba == _bgd { if _ad < _feb && _gac < _fee { _ad ++ ; _gac ++ ; continue ; } ; if _ad >= _feb && _gac >= _fee { break ; } ; return _ad >= _feb ; } else { return _fba < _bgd ; } ; } else { return _aag < _fed ; } ; } ; _dead , _ace , _fbf , _efa := _afb . _cf , _aed . _cf , _afb . _fca , _aed . _fca ; if _dead == _ace { return _fbf <= _efa ; } ; return _dead < _ace ; } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
2022-04-09 14:27:46 +00:00
func ( _affd SlideLayout ) X ( ) * _g . SldLayout { return _affd . _fdda } ; func ( _bbge * Presentation ) save ( _bdf _b . Writer , _fdcf bool ) error { const _agc = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ; if _gbd := _bbge . _ced . Validate ( ) ; _gbd != nil { _e . 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" , _gbd ) ; } ; if ! _aa . GetLicenseKey ( ) . IsLicensed ( ) && ! _gab { _abg . 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" ) ; _abg . 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 _ca . 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 ( _bbge . _dcd ) == 0 { _fdg , _dbe := _aa . GenRefId ( "\u0070\u0077" ) ; if _dbe != nil { _e . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dbe ) ; return _dbe ; } ; _bbge . _dcd = _fdg ; } ; if _fgg := _aa . Track ( _bbge . _dcd , _agc ) ; _fgg != nil { _e . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fgg ) ; return _fgg ; } ; if _fdcf { _bbge . 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" ) ; _bbge . 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 { _bbge . 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" ) ; _bbge . 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" ) ; } ; _age := _eb . DocTypePresentation ; _cad := _eae . NewWriter ( _bdf ) ; defer _cad . Close ( ) ; if _ffb := _agd . MarshalXML ( _cad , _eb . BaseRelsFilename , _bbge . Rels . X ( ) ) ; _ffb != nil { return _ffb ; } ; if _dga := _agd . MarshalXMLByType ( _cad , _age , _eb . ExtendedPropertiesType , _bbge . AppProperties . X ( ) ) ; _dga != nil { return _dga ; } ; if _bba := _agd . MarshalXMLByType ( _cad , _age , _eb . CorePropertiesType , _bbge . CoreProperties . X ( ) ) ; _bba != nil { retur
2022-01-15 21:17:38 +00:00
2022-04-09 14:27:46 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _efg PlaceHolder ) ClearAll ( ) { _efg . _gfe . SpPr = _ge . NewCT_ShapeProperties ( ) ; _efg . _gfe . TxBody = _ge . NewCT_TextBody ( ) ; _efg . _gfe . TxBody . LstStyle = _ge . NewCT_TextListStyle ( ) ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +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 } ; } ;
2022-02-25 19:20:45 +00:00
2022-04-09 14:27:46 +00:00
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _dfde SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _ccef := map [ string ] int { } ; _ccge := [ ] SlideLayout { } ; for _ , _cded := range _dfde . _fbcfa . Relationships ( ) { _ddcb := _dg . Replace ( _cded . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ; _ddcb = _dg . Replace ( _ddcb , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _dgdc , _egg := _ag . ParseInt ( _ddcb , 10 , 32 ) ; _egg == nil { _ccef [ _cded . ID ( ) ] = int ( _dgdc ) ; } ; } ; for _ , _agdc := range _dfde . _dadf . SldLayoutIdLst . SldLayoutId { if _cfcfb , _eaab := _ccef [ _agdc . RIdAttr ] ; _eaab { _ffee := _dfde . _fea . _aaf [ _cfcfb - 1 ] ; _ccge = append ( _ccge , SlideLayout { _ffee } ) ; } ; } ; return _ccge ; } ;
2020-08-31 22:58:25 +00:00
2022-04-09 14:27:46 +00:00
// Image is an image within a slide.
type Image struct { _gaa * _g . CT_Picture } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _fcff * Presentation ) Close ( ) error { if _fcff . TmpPath != "" { return _f . RemoveAll ( _fcff . TmpPath ) ; } ; return nil ; } ; type rectangle struct { _fdb int64 ; _fe int64 ; _agg int64 ; _caf int64 ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// ClrMru returns the ClrMru property.
func ( _cbe PresentationProperties ) ClrMru ( ) * _ge . CT_ColorMRU { return _cbe . _cbg . ClrMru } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _dca * _g . CT_SlideIdListEntry ; _dad * _g . Sld ; _agf * Presentation ; _gabe * _ge . CT_ColorMapping ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _cbg * _g . PresentationPr } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// PlaceHolders returns all of the content place holders within a given slide.
func ( _effc Slide ) PlaceHolders ( ) [ ] PlaceHolder { _cca := [ ] PlaceHolder { } ; for _ , _cgae := range _effc . _dad . CSld . SpTree . Choice { for _ , _ceg := range _cgae . Sp { if _ceg . NvSpPr != nil && _ceg . NvSpPr . NvPr != nil && _ceg . NvSpPr . NvPr . Ph != nil { _cca = append ( _cca , PlaceHolder { _ceg , _effc . _dad } ) ; } ; } ; } ; return _cca ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _cbg : _g . NewPresentationPr ( ) } ; } ; const _gddf float64 = 500000 ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _cgf PlaceHolder ) Paragraphs ( ) [ ] _de . Paragraph { _decd := [ ] _de . Paragraph { } ; for _ , _ade := range _cgf . _gfe . TxBody . P { _decd = append ( _decd , _de . MakeParagraph ( _ade ) ) ; } ; return _decd ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// Name returns the name of the slide layout.
func ( _dabg SlideLayout ) Name ( ) string { if _dabg . _fdda . CSld != nil && _dabg . _fdda . CSld . NameAttr != nil { return * _dabg . _fdda . CSld . NameAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _cdgb TextBox ) X ( ) * _g . CT_Shape { return _cdgb . _eaaa } ;
2020-08-23 14:15:53 +00:00
2022-04-09 14:27:46 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _beg * Presentation ) GetImageByRelID ( relID string ) ( _da . ImageRef , bool ) { for _ , _egb := range _beg . Images { if _egb . RelID ( ) == relID { return _egb , true ; } ; } ; return _da . ImageRef { } , false ; } ;
2021-04-23 20:00:00 +00:00
2022-04-09 14:27:46 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _bfbb ViewProperties ) OutlineViewPr ( ) * _g . CT_OutlineViewProperties { return _bfbb . _bcabd . OutlineViewPr ; } ;
2020-06-07 20:13:15 +07:00
2022-04-09 14:27:46 +00:00
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _fdda * _g . SldLayout } ;
2017-10-03 09:55:27 -05:00
2022-04-09 14:27:46 +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 ( _gad PlaceHolder ) SetText ( text string ) { _gad . Clear ( ) ; _ggd := _ge . NewEG_TextRun ( ) ; _ggd . R = _ge . NewCT_RegularTextRun ( ) ; _ggd . R . T = text ; if len ( _gad . _gfe . TxBody . P ) == 0 { _gad . _gfe . TxBody . P = append ( _gad . _gfe . TxBody . P , _ge . NewCT_TextParagraph ( ) ) ; } ; _gad . _gfe . TxBody . P [ 0 ] . EG_TextRun = nil ; _gad . _gfe . TxBody . P [ 0 ] . EG_TextRun = append ( _gad . _gfe . TxBody . P [ 0 ] . EG_TextRun , _ggd ) ; } ; func ( _fdc sort2d ) Swap ( i , j int ) { _fdc [ i ] , _fdc [ j ] = _fdc [ j ] , _fdc [ i ] } ;
2017-10-03 09:55:27 -05:00
2022-04-09 14:27:46 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _ffd , _dbbd := Open ( fn ) ; if _dbbd != nil { return nil , _dbbd ; } ; return _ffd , nil ; } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _eeag ViewProperties ) LastViewAttr ( ) _g . ST_ViewType { return _eeag . _bcabd . LastViewAttr } ; func ( _bgfa * Presentation ) onNewRelationship ( _bce * _agd . DecodeMap , _abcg , _cgb string , _badg [ ] * _eae . File , _fgd * _ab . Relationship , _fbe _agd . Target ) error { _dddd := _eb . DocTypePresentation ; switch _cgb { case _eb . OfficeDocumentType : _bgfa . _ced = _g . NewPresentation ( ) ; _bce . AddTarget ( _abcg , _bgfa . _ced , _cgb , 0 ) ; _bce . AddTarget ( _agd . RelationsPathFor ( _abcg ) , _bgfa . _fbc . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . CorePropertiesType : _bce . AddTarget ( _abcg , _bgfa . CoreProperties . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . CustomPropertiesType : _bce . AddTarget ( _abcg , _bgfa . CustomProperties . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . PresentationPropertiesType : _bce . AddTarget ( _abcg , _bgfa . _fcc . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . ViewPropertiesType : _bce . AddTarget ( _abcg , _bgfa . _bbd . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . TableStylesType : _bce . AddTarget ( _abcg , _bgfa . _ggda . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . HyperLinkType : _cee := _ge . NewCT_Hyperlink ( ) ; _aadd := uint32 ( len ( _bgfa . _aea ) ) ; _bce . AddTarget ( _abcg , _cee , _cgb , _aadd ) ; _bgfa . _aea = append ( _bgfa . _aea , _cee ) ; case _eb . CustomXMLType : _fcgd := & _eb . XSDAny { } ; _ecg := uint32 ( len ( _bgfa . _gfed ) ) ; _bce . AddTarget ( _abcg , _fcgd , _cgb , _ecg ) ; _bgfa . _gfed = append ( _bgfa . _gfed , _fcgd ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _gfed ) ) ; case _eb . ChartType : _ffc := chart { _fg : _a . NewChartSpace ( ) } ; _deadd := uint32 ( len ( _bgfa . _bcd ) ) ; _bce . AddTarget ( _abcg , _ffc . _fg , _cgb , _deadd ) ; _bgfa . _bcd = append ( _bgfa . _bcd , & _ffc ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _bcd ) ) ; _ffc . _bf = _fgd . TargetAttr ; case _eb . HandoutMasterType : _fga := _g . NewHandoutMaster ( ) ; _cga := uint32 ( len ( _bgfa . _bbda ) ) ; _bce . AddTarget ( _abcg , _fga , _cgb , _cga ) ; _bgfa . _bbda = append ( _bgfa . _bbda , _fga ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _bbda ) ) ; case _eb . NotesMasterType : _caef := _g . NewNotesMaster ( ) ; _eagc := uint32 ( len ( _bgfa . _gacg ) ) ; _bce . AddTarget ( _abcg , _caef , _cgb , _eagc ) ; _bgfa . _gacg = append ( _bgfa . _gacg , _caef ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _gacg ) ) ; case _eb . ExtendedPropertiesType : _bce . AddTarget ( _abcg , _bgfa . AppProperties . X ( ) , _cgb , 0 ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , 0 ) ; case _eb . SlideType : _fade := _g . NewSld ( ) ; _bgfa . _eaa = append ( _bgfa . _eaa , _fade ) ; _bce . AddTarget ( _abcg , _fade , _cgb , uint32 ( len ( _bgfa . _eaa ) ) ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _eaa ) ) ; _edea := _da . NewRelationships ( ) ; _bce . AddTarget ( _agd . RelationsPathFor ( _abcg ) , _edea . X ( ) , _cgb , 0 ) ; _bgfa . _ece = append ( _bgfa . _ece , _edea ) ; case _eb . SlideMasterType : _eca := _g . NewSldMaster ( ) ; if ! _bce . AddTarget ( _abcg , _eca , _cgb , uint32 ( len ( _bgfa . _efe ) + 1 ) ) { return nil ; } ; _bgfa . _efe = append ( _bgfa . _efe , _eca ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _efe ) ) ; _ggfd := _da . NewRelationships ( ) ; _bce . AddTarget ( _agd . RelationsPathFor ( _abcg ) , _ggfd . X ( ) , _cgb , 0 ) ; _bgfa . _abd = append ( _bgfa . _abd , _ggfd ) ; case _eb . SlideLayoutType : _bca := _g . NewSldLayout ( ) ; if ! _bce . AddTarget ( _abcg , _bca , _cgb , uint32 ( len ( _bgfa . _aaf ) + 1 ) ) { return nil ; } ; _bgfa . _aaf = append ( _bgfa . _aaf , _bca ) ; _fgd . TargetAttr = _eb . RelativeFilename ( _dddd , _fbe . Typ , _cgb , len ( _bgfa . _aaf ) ) ; _eced := _da . NewRelationships ( ) ; _bce . AddTarget ( _agd . RelationsPathFor ( _abcg ) , _eced . X ( ) , _cgb , 0 ) ; _bgfa . _gfb = append ( _bgfa . _gfb , _eced ) ; case _eb . ThumbnailType : for _eabg , _eafa := range _badg { if _eafa == nil { continue ; } ; if _eafa . Name == _abcg { _egc , _ef
2020-12-17 22:07:08 +00:00
2022-04-09 14:27:46 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _eaaa * _g . CT_Shape } ; func _dcda ( ) * Presentation { _aae := & Presentation { _ced : _g . NewPresentation ( ) } ; _aae . _ced . SldIdLst = _g . NewCT_SlideIdList ( ) ; _aae . _ced . ConformanceAttr = _ae . ST_ConformanceClassTransitional ; _aae . AppProperties = _da . NewAppProperties ( ) ; _aae . CoreProperties = _da . NewCoreProperties ( ) ; _aae . _ggda = _da . NewTableStyles ( ) ; _aae . ContentTypes = _da . NewContentTypes ( ) ; _aae . Rels = _da . NewRelationships ( ) ; _aae . _fbc = _da . NewRelationships ( ) ; _aae . _fcc = NewPresentationProperties ( ) ; _aae . _bbd = NewViewProperties ( ) ; _aae . _febb = map [ string ] string { } ; return _aae ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _ed , _gegf := _ff . Open ( filename ) ; if _gegf != nil { return nil , _abg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gegf ) ; } ; defer _ed . Close ( ) ; _aba , _gegf := _ff . Stat ( filename ) ; if _gegf != nil { return nil , _abg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gegf ) ; } ; _ = _aba ; return Read ( _ed , _aba . Size ( ) ) ; } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _eacef ViewProperties ) SlideViewPr ( ) * _g . CT_SlideViewProperties { return _eacef . _bcabd . SlideViewPr ; } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// SetTextAnchor controls the text anchoring
func ( _efef TextBox ) SetTextAnchor ( a _ge . ST_TextAnchoringType ) { _efef . _eaaa . TxBody . BodyPr = _ge . NewCT_TextBodyProperties ( ) ; _efef . _eaaa . TxBody . BodyPr . AnchorAttr = a ; } ;
2021-01-04 16:11:39 +00:00
2022-04-09 14:27:46 +00:00
// Themes returns an array of presentation themes.
func ( _cdag * Presentation ) Themes ( ) [ ] * _ge . Theme { return _cdag . _feg } ;
2021-03-16 20:51:18 +00:00
2022-04-09 14:27:46 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _bbb * SlideText ) Text ( ) string { _eea := _ac . NewBuffer ( [ ] byte { } ) ; for _ , _fge := range _bbb . Items { if _fge . Text != "" { _eea . WriteString ( _fge . Text ) ; _eea . WriteString ( "\u000a" ) ; } ; } ; return _eea . String ( ) ; } ;
2021-03-16 20:51:18 +00:00
2022-04-09 14:27:46 +00:00
// WebPr returns the WebPr property.
func ( _fcg PresentationProperties ) WebPr ( ) * _g . CT_WebProperties { return _fcg . _cbg . WebPr } ;
2021-04-23 20:00:00 +00:00
2022-04-09 14:27:46 +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 ( _daf Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _egf := range _daf . _dad . CSld . SpTree . Choice { for _ , _bgec := range _egf . Sp { if _bgec . NvSpPr != nil && _bgec . NvSpPr . NvPr != nil && _bgec . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _bgec . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _bgec . NvSpPr . NvPr . Ph . IdxAttr != nil && * _bgec . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _bgec , _daf . _dad } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ca . 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" ) ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// SetWidth sets width of slide screen size with given value in EMU units.
func ( _fac * SlideScreenSize ) SetWidth ( val int32 ) { _fac [ 0 ] = val } ;
2021-05-31 16:22:30 +00:00
2022-04-09 14:27:46 +00:00
// Read reads a document from an io.Reader.
func Read ( r _b . ReaderAt , size int64 ) ( * Presentation , error ) { const _bcbd = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _aa . GetLicenseKey ( ) . IsLicensed ( ) && ! _gab { _abg . 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" ) ; _abg . 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 , _ca . 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" ) ; } ; _dgg := _dcda ( ) ; _fgge , _badf := _aa . GenRefId ( "\u0070\u0072" ) ; if _badf != nil { _e . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _badf ) ; return nil , _badf ; } ; _dgg . _dcd = _fgge ; if _bfb := _aa . Track ( _dgg . _dcd , _bcbd ) ; _bfb != nil { _e . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _bfb ) ; return nil , _bfb ; } ; _dffc , _badf := _f . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ; if _badf != nil { return nil , _badf ; } ; _dgg . TmpPath = _dffc ; _ecgg , _badf := _eae . NewReader ( r , size ) ; if _badf != nil { return nil , _abg . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _badf ) ; } ; _ebaf := [ ] * _eae . File { } ; _ebaf = append ( _ebaf , _ecgg . File ... ) ; _cdee := false ; for _ , _cgdf := range _ebaf { if _cgdf . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _cdee = true ; break ; } ; } ; if _cdee { _dgg . CreateCustomProperties ( ) ; } ; _cbc := _agd . DecodeMap { } ; _cbc . SetOnNewRelationshipFunc ( _dgg . onNewRelationship ) ; _cbc . AddTarget ( _eb . ContentTypesFilename , _dgg . ContentTypes . X ( ) , "" , 0 ) ; _cbc . AddTarget ( _eb . BaseRelsFilename , _dgg . Rels . X ( ) , "" , 0 ) ; if _bfbd := _cbc . Decode ( _ebaf ) ; _bfbd != nil { return nil , _bfbd ; } ; for _ , _gfbe := range _ebaf { if _gfbe == nil { continue ; } ; if _gcd := _dgg . AddExtraFileFromZip ( _gfbe ) ; _gcd != nil { return nil , _gcd ; } ; } ; if _cdee { _aagg := false ; for _ , _faba := range _dgg . Rels . X ( ) . Relationship { if _faba . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _aagg = true ; break ; } ; } ; if ! _aagg { _dgg . AddCustomRelationships ( ) ; } ; } ; return _dgg , nil ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// Properties returns the properties of the TextBox.
func ( _cce Image ) Properties ( ) _de . ShapeProperties { if _cce . _gaa . SpPr == nil { _cce . _gaa . SpPr = _ge . NewCT_ShapeProperties ( ) ; } ; return _de . MakeShapeProperties ( _cce . _gaa . SpPr ) ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// X returns the inner wrapped XML type.
func ( _agef SlideMaster ) X ( ) * _g . SldMaster { return _agef . _dadf } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// Properties returns the properties of the TextBox.
func ( _bfae TextBox ) Properties ( ) _de . ShapeProperties { if _bfae . _eaaa . SpPr == nil { _bfae . _eaaa . SpPr = _ge . NewCT_ShapeProperties ( ) ; } ; return _de . MakeShapeProperties ( _bfae . _eaaa . SpPr ) ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _deaddf TextBox ) SetOffsetX ( offX float64 ) { _fadc := _deaddf . getOff ( ) ; _dged := _dd . ToEMU ( offX ) ; _fadc . XAttr = _ge . ST_Coordinate { ST_CoordinateUnqualified : & _dged } ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// GridSpacing returns the GridSpacing property.
func ( _gag ViewProperties ) GridSpacing ( ) * _ge . CT_PositiveSize2D { return _gag . _bcabd . GridSpacing } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// X returns the inner wrapped XML type.
func ( _ebe * Presentation ) X ( ) * _g . Presentation { return _ebe . _ced } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// Height returns slide screen size height in EMU units.
func ( _gfa * SlideScreenSize ) Height ( ) int32 { return _gfa [ 1 ] } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// SlideSize represents a slide size of a presentation.
type SlideSize struct { _cgfb * _g . CT_SlideSize ; _gggc * Presentation ; } ; func ( _fgaa * Slide ) ensureClrMap ( ) { if len ( _fgaa . _agf . _efe ) == 0 || len ( _fgaa . _agf . _feg ) == 0 { return ; } ; _bbdd := _fgaa . _agf . _efe [ 0 ] ; _bcfb := _bbdd . ClrMap ; if _agcd := _fgaa . _dad . ClrMapOvr ; _agcd != nil { if _fcge := _agcd . Choice ; _fcge != nil { if _fcge . MasterClrMapping == nil { if _ceed := _fcge . OverrideClrMapping ; _ceed != nil { if _ceed . Bg1Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Bg1Attr = _ceed . Bg1Attr ; } ; if _ceed . Tx1Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Tx1Attr = _ceed . Tx1Attr ; } ; if _ceed . Bg2Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Bg2Attr = _ceed . Bg2Attr ; } ; if _ceed . Tx2Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Tx2Attr = _ceed . Tx2Attr ; } ; if _ceed . Accent1Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent1Attr = _ceed . Accent1Attr ; } ; if _ceed . Accent2Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent2Attr = _ceed . Accent2Attr ; } ; if _ceed . Accent3Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent3Attr = _ceed . Accent3Attr ; } ; if _ceed . Accent4Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent4Attr = _ceed . Accent4Attr ; } ; if _ceed . Accent5Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent5Attr = _ceed . Accent5Attr ; } ; if _ceed . Accent6Attr != _ge . ST_ColorSchemeIndexUnset { _bcfb . Accent6Attr = _ceed . Accent6Attr ; } ; if _ceed . HlinkAttr != _ge . ST_ColorSchemeIndexUnset { _bcfb . HlinkAttr = _ceed . HlinkAttr ; } ; if _ceed . FolHlinkAttr != _ge . ST_ColorSchemeIndexUnset { _bcfb . FolHlinkAttr = _ceed . FolHlinkAttr ; } ; } ; } ; } ; } ; _fgaa . _gabe = _bcfb ; } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// Type returns the type of the slide layout.
func ( _adg SlideLayout ) Type ( ) _g . ST_SlideLayoutType { return _adg . _fdda . TypeAttr } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _cdcc Slide ) AddImageToRels ( img _da . ImageRef ) string { _bced := 0 ; for _abe , _efadc := range _cdcc . _agf . Images { if _efadc == img { _bced = _abe + 1 ; break ; } ; } ; var _eeg string ; for _ggc , _cebd := range _cdcc . _agf . Slides ( ) { if _cebd . _dad == _cdcc . _dad { _efff := _abg . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _bced , img . Format ( ) ) ; _gaaa := _cdcc . _agf . _ece [ _ggc ] . AddRelationship ( _efff , _eb . ImageType ) ; _eeg = _gaaa . ID ( ) ; } ; } ; return _eeg ; } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// X returns the inner wrapped XML type.
func ( _cag PresentationProperties ) X ( ) * _g . PresentationPr { return _cag . _cbg } ;
2021-09-22 16:41:01 +00:00
2022-04-09 14:27:46 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _dbfb ViewProperties ) SorterViewPr ( ) * _g . CT_SlideSorterViewProperties { return _dbfb . _bcabd . SorterViewPr ; } ;
2021-11-10 11:45:21 +00:00
2022-04-09 14:27:46 +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.
func ( _egd * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _edc := _g . NewCT_SlideIdListEntry ( ) ; _edc . IdAttr = 256 ; for _ , _aee := range _egd . _ced . SldIdLst . SldId { if _aee . IdAttr >= _edc . IdAttr { _edc . IdAttr = _aee . IdAttr + 1 ; } ; } ; _egd . _ced . SldIdLst . SldId = append ( _egd . _ced . SldIdLst . SldId , _edc ) ; _abc := _g . NewSld ( ) ; _ccc := _ac . Buffer { } ; _cge := _eg . NewEncoder ( & _ccc ) ; _fdd := _eg . StartElement { Name : _eg . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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" } ) ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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" } ) ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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" } ) ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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" } ) ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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" } ) ; _fdd . Attr = append ( _fdd . Attr , _eg . Attr { Name : _eg . 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 _efd := l . _fdda . CSld . MarshalXML ( _cge , _fdd ) ; _efd != nil { return Slide { } , _efd ; } ; _cge . Flush ( ) ; _ccdg := _eg . NewDecoder ( & _ccc ) ; _abc . CSld = _g . NewCT_CommonSlideData ( ) ; if _cdd := _ccdg . Decode ( _abc . CSld ) ; _cdd != nil { return Slide { } , _cdd ; } ; _abc . CSld . NameAttr = nil ; _abc . CSld . SpTree . Choice = _dddb ( _abc . CSld . SpTree . Choice ) ; _egd . _eaa = append ( _egd . _eaa , _abc ) ; _aggf := _egd . _fbc . AddAutoRelationship ( _eb . DocTypePresentation , _eb . OfficeDocumentType , len ( _egd . _eaa ) , _eb . SlideType ) ; _edc . RIdAttr = _aggf . ID ( ) ; _bde := _eb . AbsoluteFilename ( _eb . DocTypePresentation , _eb . SlideType , len ( _egd . _eaa ) ) ; _egd . ContentTypes . AddOverride ( _bde , _eb . SlideContentType ) ; _cddf := _da . NewRelationships ( ) ; _egd . _ece = append ( _egd . _ece , _cddf ) ; _bbg := len ( _egd . _ece ) - 1 ; for _bad , _fff := range _egd . _aaf { if _fff == l . X ( ) { _ccec := _egd . _gfb [ _bad ] ; for _ , _cdcb := range _ccec . X ( ) . Relationship { if _cdcb . TypeAttr != _eb . SlideMasterType { _egd . _ece [ _bbg ] . X ( ) . Relationship = append ( _egd . _ece [ _bbg ] . X ( ) . Relationship , _cdcb ) ; } ; } ; _c
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// Presentation is the a presentation base document.
type Presentation struct { _da . DocBase ; _ced * _g . Presentation ; _fbc _da . Relationships ; _eaa [ ] * _g . Sld ; _ece [ ] _da . Relationships ; _efe [ ] * _g . SldMaster ; _abd [ ] _da . Relationships ; _aaf [ ] * _g . SldLayout ; _gfb [ ] _da . Relationships ; _feg [ ] * _ge . Theme ; _ada [ ] _da . Relationships ; _ggda _da . TableStyles ; _fcc PresentationProperties ; _bbd ViewProperties ; _aea [ ] * _ge . CT_Hyperlink ; _bcd [ ] * chart ; _bbda [ ] * _g . HandoutMaster ; _gacg [ ] * _g . NotesMaster ; _gfed [ ] * _eb . XSDAny ; _febb map [ string ] string ; _dcd string ; } ;
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _gcbg * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _gfg := [ ] SlideLayout { } ; for _ , _ddfd := range _gcbg . _aaf { _gfg = append ( _gfg , SlideLayout { _ddfd } ) ; } ; return _gfg ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
2022-04-09 14:27:46 +00:00
func ( _cgac Slide ) X ( ) * _g . Sld { return _cgac . _dad } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +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 ( _efc * Presentation ) GetColorBySchemeColor ( schClr _ge . ST_SchemeColorVal ) * _ge . CT_Color { if len ( _efc . _efe ) == 0 || len ( _efc . _feg ) == 0 { return nil ; } ; var _eba _ge . ST_ColorSchemeIndex ; _eeba := _efc . _efe [ 0 ] ; _aafff := _eeba . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _eba = _aafff . Bg1Attr ; case "\u0062\u0067\u0032" : _eba = _aafff . Bg2Attr ; case "\u0074\u0078\u0031" : _eba = _aafff . Tx1Attr ; case "\u0074\u0078\u0032" : _eba = _aafff . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _eba = _aafff . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _eba = _aafff . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _eba = _aafff . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _eba = _aafff . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _eba = _aafff . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _eba = _aafff . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _eba = _aafff . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _eba = _aafff . FolHlinkAttr ; case "\u0064\u006b\u0031" : _eba = _ge . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _eba = _ge . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _eba = _ge . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _eba = _ge . ST_ColorSchemeIndexLt2 ; default : _eba = _ge . ST_ColorSchemeIndexUnset ; } ; _cgcb := _efc . _feg [ 0 ] ; _ecf := _cgcb . ThemeElements ; if _ecf == nil { return nil ; } ; var _adae * _ge . CT_Color ; _cfcd := _ecf . ClrScheme ; switch _eba . String ( ) { case "\u0064\u006b\u0031" : _adae = _cfcd . Dk1 ; case "\u0064\u006b\u0032" : _adae = _cfcd . Dk2 ; case "\u006c\u0074\u0031" : _adae = _cfcd . Lt1 ; case "\u006c\u0074\u0032" : _adae = _cfcd . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _adae = _cfcd . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _adae = _cfcd . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _adae = _cfcd . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _adae = _cfcd . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _adae = _cfcd . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _adae = _cfcd . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _adae = _cfcd . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _adae = _cfcd . FolHlink ; default : return nil ; } ; return _adae ; } ;
2022-02-05 13:05:36 +00:00
2022-04-09 14:27:46 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _eda PlaceHolder ) AddParagraph ( ) _de . Paragraph { _aef := _de . MakeParagraph ( _ge . NewCT_TextParagraph ( ) ) ; _eda . _gfe . TxBody . P = append ( _eda . _gfe . TxBody . P , _aef . X ( ) ) ; return _aef ; } ;
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _fea * Presentation ; _fbcfa _da . Relationships ; _dadf * _g . SldMaster ; } ;