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/
2023-04-15 17:27:31 +00:00
package presentation ; import ( _d "archive/zip" ; _fa "bytes" ; _cd "encoding/xml" ; _gg "errors" ; _fg "fmt" ; _ea "github.com/unidoc/unioffice" ; _ef "github.com/unidoc/unioffice/common" ; _eb "github.com/unidoc/unioffice/common/logger" ; _bd "github.com/unidoc/unioffice/common/tempstorage" ; _fc "github.com/unidoc/unioffice/drawing" ; _f "github.com/unidoc/unioffice/internal/license" ; _ac "github.com/unidoc/unioffice/measurement" ; _cgg "github.com/unidoc/unioffice/schema/soo/dml" ; _c "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _ed "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _e "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _db "github.com/unidoc/unioffice/schema/soo/pml" ; _cg "github.com/unidoc/unioffice/zippkg" ; _gc "image" ; _cc "image/jpeg" ; _g "io" ; _da "math" ; _gce "os" ; _eg "path" ; _acb "sort" ; _ca "strconv" ; _b "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _ab * Presentation ) ExtractText ( ) * PresentationText { _ff := [ ] * SlideText { } ; for _ , _ffg := range _ab . Slides ( ) { _ebd := _ffg . ExtractText ( ) ; if _ebd != nil { _ff = append ( _ff , _ebd ) ; } ; } ; return & PresentationText { Slides : _ff } ; } ;
2021-05-31 16:22:30 +00:00
2023-04-15 17:27:31 +00:00
// SlideSize returns presentation slide size.
func ( _ded * Presentation ) SlideSize ( ) SlideSize { if _ded . _cbd . SldSz == nil { _ded . _cbd . SldSz = _db . NewCT_SlideSize ( ) ; } ; return SlideSize { _ded . _cbd . SldSz , _ded } ; } ;
2021-05-31 16:22:30 +00:00
2023-04-15 17:27:31 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _deac * _db . CT_Shape } ;
2022-01-15 21:17:38 +00:00
2023-04-15 17:27:31 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _ggg ViewProperties ) OutlineViewPr ( ) * _db . CT_OutlineViewProperties { return _ggg . _gfga . OutlineViewPr ; } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +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-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +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 ( _adcg Slide ) GetPlaceholder ( t _db . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _efcf := range _adcg . _egd . CSld . SpTree . Choice { for _ , _ggcc := range _efcf . Sp { if _ggcc . NvSpPr != nil && _ggcc . NvSpPr . NvPr != nil && _ggcc . NvSpPr . NvPr . Ph != nil { if _ggcc . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _ggcc , _adcg . _egd } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _gg . 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
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _abg PresentationProperties ) X ( ) * _db . PresentationPr { return _abg . _bcd } ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// AddImage adds an image textbox to a slide.
func ( _ggd Slide ) AddImage ( img _ef . ImageRef ) Image { _ccabf := _db . NewCT_GroupShapeChoice ( ) ; _ggd . _egd . CSld . SpTree . Choice = append ( _ggd . _egd . CSld . SpTree . Choice , _ccabf ) ; _ggdd := _db . NewCT_Picture ( ) ; _ccabf . Pic = append ( _ccabf . Pic , _ggdd ) ; _ggdd . NvPicPr . CNvPicPr = _cgg . NewCT_NonVisualPictureProperties ( ) ; _ggdd . NvPicPr . CNvPicPr . PicLocks = _cgg . NewCT_PictureLocking ( ) ; _ggdd . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _ea . Bool ( true ) ; _ggdd . BlipFill = _cgg . NewCT_BlipFillProperties ( ) ; _ggdd . BlipFill . Blip = _cgg . NewCT_Blip ( ) ; _dffe := _ggd . AddImageToRels ( img ) ; _ggdd . BlipFill . Blip . EmbedAttr = _ea . String ( _dffe ) ; _ggdd . BlipFill . Stretch = _cgg . NewCT_StretchInfoProperties ( ) ; _ggdd . BlipFill . Stretch . FillRect = _cgg . NewCT_RelativeRect ( ) ; _ggdd . SpPr = _cgg . NewCT_ShapeProperties ( ) ; _ggdd . SpPr . PrstGeom = _cgg . NewCT_PresetGeometry2D ( ) ; _ggdd . SpPr . PrstGeom . PrstAttr = _cgg . ST_ShapeTypeRect ; _ecfe := Image { _ggdd } ; _cef := img . Size ( ) ; _ecfe . Properties ( ) . SetWidth ( _ac . Distance ( _cef . X ) * _ac . Pixel72 ) ; _ecfe . Properties ( ) . SetHeight ( _ac . Distance ( _cef . Y ) * _ac . Pixel72 ) ; _ecfe . Properties ( ) . SetPosition ( 0 , 0 ) ; return _ecfe ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _ggbf SlideMaster ) X ( ) * _db . SldMaster { return _ggbf . _bafec } ;
2023-03-01 18:42:44 +00:00
2023-04-15 17:27:31 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _ggcg PlaceHolder ) Paragraphs ( ) [ ] _fc . Paragraph { _edb := [ ] _fc . Paragraph { } ; for _ , _daga := range _ggcg . _efg . TxBody . P { _edb = append ( _edb , _fc . MakeParagraph ( _daga ) ) ; } ; return _edb ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// Read reads a document from an io.Reader.
func Read ( r _g . ReaderAt , size int64 ) ( * Presentation , error ) { const _acc = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _f . GetLicenseKey ( ) . IsLicensed ( ) && ! _bdb { _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 , _gg . 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" ) ; } ; _efb := _aff ( ) ; _dgcf , _fcfc := _f . GenRefId ( "\u0070\u0072" ) ; if _fcfc != nil { _eb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fcfc ) ; return nil , _fcfc ; } ; _efb . _ecd = _dgcf ; if _bcdd := _f . Track ( _efb . _ecd , _acc ) ; _bcdd != nil { _eb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _bcdd ) ; return nil , _bcdd ; } ; _gffa , _fcfc := _bd . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ; if _fcfc != nil { return nil , _fcfc ; } ; _efb . TmpPath = _gffa ; _gagg , _fcfc := _d . NewReader ( r , size ) ; if _fcfc != nil { return nil , _fg . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _fcfc ) ; } ; _ccd := [ ] * _d . File { } ; _ccd = append ( _ccd , _gagg . File ... ) ; _debc := false ; for _ , _bad := range _ccd { if _bad . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _debc = true ; break ; } ; } ; if _debc { _efb . CreateCustomProperties ( ) ; } ; _ggcd := _cg . DecodeMap { } ; _ggcd . SetOnNewRelationshipFunc ( _efb . onNewRelationship ) ; _ggcd . AddTarget ( _ea . ContentTypesFilename , _efb . ContentTypes . X ( ) , "" , 0 ) ; _ggcd . AddTarget ( _ea . BaseRelsFilename , _efb . Rels . X ( ) , "" , 0 ) ; if _gfdd := _ggcd . Decode ( _ccd ) ; _gfdd != nil { return nil , _gfdd ; } ; for _ , _cgcgb := range _ccd { if _cgcgb == nil { continue ; } ; if _acbd := _efb . AddExtraFileFromZip ( _cgcgb ) ; _acbd != nil { return nil , _acbd ; } ; } ; if _debc { _aab := false ; for _ , _bceb := range _efb . Rels . X ( ) . Relationship { if _bceb . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _aab = true ; break ; } ; } ; if ! _aab { _efb . AddCustomRelationships ( ) ; } ; } ; return _efb , nil ; } ; func ( _gf * chart ) X ( ) * _c . ChartSpace { return _gf . _bg } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _affa ViewProperties ) SlideViewPr ( ) * _db . CT_SlideViewProperties { return _affa . _gfga . SlideViewPr } ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _cfba * Presentation ) SaveToFileAsTemplate ( path string ) error { return _cfba . saveToFile ( path , true ) ; } ; const _gbc float64 = 500000 ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _adgc * Presentation ) RemoveSlide ( s Slide ) error { _fced := false ; _cdba := 0 ; for _adf , _fbf := range _adgc . _gaaa { if _fbf == s . _egd { if _adgc . _cbd . SldIdLst . SldId [ _adf ] != s . _bfef { return _gg . 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 ( _adgc . _gaaa [ _adf : ] , _adgc . _gaaa [ _adf + 1 : ] ) ; _adgc . _gaaa = _adgc . _gaaa [ 0 : len ( _adgc . _gaaa ) - 1 ] ; copy ( _adgc . _fdbe [ _adf : ] , _adgc . _fdbe [ _adf + 1 : ] ) ; _adgc . _fdbe = _adgc . _fdbe [ 0 : len ( _adgc . _fdbe ) - 1 ] ; copy ( _adgc . _cbd . SldIdLst . SldId [ _adf : ] , _adgc . _cbd . SldIdLst . SldId [ _adf + 1 : ] ) ; _adgc . _cbd . SldIdLst . SldId = _adgc . _cbd . SldIdLst . SldId [ 0 : len ( _adgc . _cbd . SldIdLst . SldId ) - 1 ] ; _fced = true ; _cdba = _adf ; } ; } ; if ! _fced { return _gg . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ; } ; _eadb := _ea . AbsoluteFilename ( _ea . DocTypePresentation , _ea . SlideType , 0 ) ; return _adgc . ContentTypes . RemoveOverrideByIndex ( _eadb , _cdba ) ; } ;
2022-04-09 14:27:46 +00:00
2023-03-01 18:42:44 +00:00
// Presentation is the a presentation base document.
2023-04-15 17:27:31 +00:00
type Presentation struct { _ef . DocBase ; _cbd * _db . Presentation ; _dca _ef . Relationships ; _gaaa [ ] * _db . Sld ; _fdbe [ ] _ef . Relationships ; _cee [ ] * _db . SldMaster ; _gaf [ ] _ef . Relationships ; _bfae [ ] * _db . SldLayout ; _gag [ ] _ef . Relationships ; _bfgf [ ] * _cgg . Theme ; _agb [ ] _ef . Relationships ; _gga _ef . TableStyles ; _fad PresentationProperties ; _cgbc ViewProperties ; _deg [ ] * _cgg . CT_Hyperlink ; _gde [ ] * chart ; _cdb [ ] * _db . HandoutMaster ; _dgf [ ] * _db . NotesMaster ; _afb [ ] * _ea . XSDAny ; _dfd map [ string ] string ; _ecd string ; } ;
2020-08-23 14:15:53 +00:00
2023-03-01 18:42:44 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
2023-04-15 17:27:31 +00:00
func ( _gdef Slide ) AddImageToRels ( img _ef . ImageRef ) string { _ccbc := 0 ; for _eaec , _deaf := range _gdef . _gdee . Images { if _deaf == img { _ccbc = _eaec + 1 ; break ; } ; } ; var _fga string ; for _gfad , _geef := range _gdef . _gdee . Slides ( ) { if _geef . _egd == _gdef . _egd { _edgd := _fg . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _ccbc , img . Format ( ) ) ; _fedb := _gdef . _gdee . _fdbe [ _gfad ] . AddRelationship ( _edgd , _ea . ImageType ) ; _fga = _fedb . ID ( ) ; } ; } ; return _fga ; } ; type rectangle struct { _aa int64 ; _gfe int64 ; _be int64 ; _faf int64 ; } ; type sort2d [ ] * TextItem ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +00:00
// Image is an image within a slide.
type Image struct { _dgb * _db . CT_Picture } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +00:00
// Name returns the name of the slide layout.
func ( _fae SlideLayout ) Name ( ) string { if _fae . _afc . CSld != nil && _fae . _afc . CSld . NameAttr != nil { return * _fae . _afc . CSld . NameAttr ; } ; return "" ; } ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _bfaa * PresentationText ) Text ( ) string { _fcg := _fa . NewBuffer ( [ ] byte { } ) ; for _ , _cb := range _bfaa . Slides { _fcg . WriteString ( _cb . Text ( ) ) ; } ; return _fcg . String ( ) ; } ;
2022-04-09 14:27:46 +00:00
2023-03-01 18:42:44 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
2023-04-15 17:27:31 +00:00
func ( _aaea * Slide ) GetChartSpaceByRelId ( relId string ) * _c . ChartSpace { _gbgc := _aaea . getSlideRels ( ) ; if ( _gbgc == _ef . Relationships { } ) { return nil ; } ; _gad := _gbgc . GetTargetByRelId ( relId ) ; for _ , _acbb := range _aaea . _gdee . _gde { if _gad == _acbb . Target ( ) { return _acbb . _bg ; } ; } ; return nil ; } ; func _aff ( ) * Presentation { _cba := & Presentation { _cbd : _db . NewPresentation ( ) } ; _cba . _cbd . SldIdLst = _db . NewCT_SlideIdList ( ) ; _cba . _cbd . ConformanceAttr = _ed . ST_ConformanceClassTransitional ; _cba . AppProperties = _ef . NewAppProperties ( ) ; _cba . CoreProperties = _ef . NewCoreProperties ( ) ; _cba . _gga = _ef . NewTableStyles ( ) ; _cba . ContentTypes = _ef . NewContentTypes ( ) ; _cba . Rels = _ef . NewRelationships ( ) ; _cba . _dca = _ef . NewRelationships ( ) ; _cba . _fad = NewPresentationProperties ( ) ; _cba . _cgbc = NewViewProperties ( ) ; _cba . _dfd = map [ string ] string { } ; return _cba ; } ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _bcb PlaceHolder ) ClearAll ( ) { _bcb . _efg . SpPr = _cgg . NewCT_ShapeProperties ( ) ; _bcb . _efg . TxBody = _cgg . NewCT_TextBody ( ) ; _bcb . _efg . TxBody . LstStyle = _cgg . NewCT_TextListStyle ( ) ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// SetSize sets the slide size, take argument of SlideScreenSize.
func ( _dee * SlideSize ) SetSize ( sz SlideScreenSize ) { _dee . _gae . CxAttr = sz [ 0 ] ; _dee . _gae . CyAttr = sz [ 1 ] ; } ;
2022-01-15 21:17:38 +00:00
2023-04-15 17:27:31 +00:00
// Slides returns the slides in the presentation.
func ( _ccec * Presentation ) Slides ( ) [ ] Slide { _dage := [ ] Slide { } ; for _feda , _adca := range _ccec . _gaaa { _dage = append ( _dage , Slide { _ccec . _cbd . SldIdLst . SldId [ _feda ] , _adca , _ccec , nil } ) ; } ; return _dage ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// SetHeight sets height of slide screen size with given value in EMU units.
func ( _ddeg * SlideScreenSize ) SetHeight ( val int32 ) { _ddeg [ 1 ] = val } ;
2020-11-09 01:00:18 +00:00
2023-04-15 17:27:31 +00:00
// SetWidth sets width of slide screen size with given value in EMU units.
func ( _caac * SlideScreenSize ) SetWidth ( val int32 ) { _caac [ 0 ] = val } ; func ( _eef * Slide ) getSlideRels ( ) _ef . Relationships { _ccgc := _eef . _gdee ; for _ebdd , _fgg := range _ccgc . Slides ( ) { if * _eef . _egd == * _fgg . _egd { return _ccgc . _fdbe [ len ( _ccgc . _fdbe ) - _ebdd - 1 ] ; } ; } ; return _ef . Relationships { } ; } ;
2021-03-16 20:51:18 +00:00
2023-04-15 17:27:31 +00:00
// ShowPr returns the ShowPr property.
func ( _efdd PresentationProperties ) ShowPr ( ) * _db . CT_ShowProperties { return _efdd . _bcd . ShowPr } ; func ( _cede * Presentation ) Validate ( ) error { if _fbgec := _cede . _cbd . Validate ( ) ; _fbgec != nil { return _fbgec ; } ; for _faad , _bfac := range _cede . Slides ( ) { if _fdbef := _bfac . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _faad ) ) ; _fdbef != nil { return _fdbef ; } ; } ; for _caf , _gac := range _cede . _cee { if _ggce := _gac . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _caf ) ) ; _ggce != nil { return _ggce ; } ; } ; for _eadd , _bdbe := range _cede . _bfae { if _bfgg := _bdbe . ValidateWithPath ( _fg . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _eadd ) ) ; _bfgg != nil { return _bfgg ; } ; } ; return nil ; } ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +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 ( _bdbf * Presentation ) GetColorBySchemeColor ( schClr _cgg . ST_SchemeColorVal ) * _cgg . CT_Color { if len ( _bdbf . _cee ) == 0 || len ( _bdbf . _bfgf ) == 0 { return nil ; } ; var _eabf _cgg . ST_ColorSchemeIndex ; _ffbc := _bdbf . _cee [ 0 ] ; _efc := _ffbc . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _eabf = _efc . Bg1Attr ; case "\u0062\u0067\u0032" : _eabf = _efc . Bg2Attr ; case "\u0074\u0078\u0031" : _eabf = _efc . Tx1Attr ; case "\u0074\u0078\u0032" : _eabf = _efc . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _eabf = _efc . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _eabf = _efc . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _eabf = _efc . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _eabf = _efc . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _eabf = _efc . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _eabf = _efc . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _eabf = _efc . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _eabf = _efc . FolHlinkAttr ; case "\u0064\u006b\u0031" : _eabf = _cgg . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _eabf = _cgg . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _eabf = _cgg . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _eabf = _cgg . ST_ColorSchemeIndexLt2 ; default : _eabf = _cgg . ST_ColorSchemeIndexUnset ; } ; _dgc := _bdbf . _bfgf [ 0 ] ; _abag := _dgc . ThemeElements ; if _abag == nil { return nil ; } ; var _cda * _cgg . CT_Color ; _gcca := _abag . ClrScheme ; switch _eabf . String ( ) { case "\u0064\u006b\u0031" : _cda = _gcca . Dk1 ; case "\u0064\u006b\u0032" : _cda = _gcca . Dk2 ; case "\u006c\u0074\u0031" : _cda = _gcca . Lt1 ; case "\u006c\u0074\u0032" : _cda = _gcca . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _cda = _gcca . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _cda = _gcca . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _cda = _gcca . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _cda = _gcca . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _cda = _gcca . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _cda = _gcca . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _cda = _gcca . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _cda = _gcca . FolHlink ; default : return nil ; } ; return _cda ; } ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +00:00
// PlaceHolders returns all of the content place holders within a given slide.
func ( _bebcb Slide ) PlaceHolders ( ) [ ] PlaceHolder { _beba := [ ] PlaceHolder { } ; for _ , _gdfd := range _bebcb . _egd . CSld . SpTree . Choice { for _ , _fadf := range _gdfd . Sp { if _fadf . NvSpPr != nil && _fadf . NvSpPr . NvPr != nil && _fadf . NvSpPr . NvPr . Ph != nil { _beba = append ( _beba , PlaceHolder { _fadf , _bebcb . _egd } ) ; } ; } ; } ; return _beba ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _cga * Presentation ; _cfaa _ef . Relationships ; _bafec * _db . SldMaster ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +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 * _cgg . CT_Table ; Row * _cgg . CT_TableRow ; Cell * _cgg . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// Remove removes a placeholder from a presentation.
func ( _adc PlaceHolder ) Remove ( ) error { for _eca , _feb := range _adc . _fbg . CSld . SpTree . Choice { for _ , _fafe := range _feb . Sp { if _fafe == _adc . _efg { copy ( _adc . _fbg . CSld . SpTree . Choice [ _eca : ] , _adc . _fbg . CSld . SpTree . Choice [ _eca + 1 : ] ) ; _adc . _fbg . CSld . SpTree . Choice = _adc . _fbg . CSld . SpTree . Choice [ 0 : len ( _adc . _fbg . CSld . SpTree . Choice ) - 1 ] ; return nil ; } ; } ; } ; return _gg . 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" ) ; } ;
2021-08-23 20:44:48 +00:00
2023-04-15 17:27:31 +00:00
// Type returns the type of the slide layout.
func ( _fgaf SlideLayout ) Type ( ) _db . ST_SlideLayoutType { return _fgaf . _afc . TypeAttr } ;
2022-06-27 19:44:23 +00:00
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _edd Slide ) X ( ) * _db . Sld { return _edd . _egd } ;
2022-06-27 19:44:23 +00:00
2023-04-15 17:27:31 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _cbg PlaceHolder ) AddParagraph ( ) _fc . Paragraph { _fcge := _fc . MakeParagraph ( _cgg . NewCT_TextParagraph ( ) ) ; _cbg . _efg . TxBody . P = append ( _cbg . _efg . TxBody . P , _fcge . X ( ) ) ; return _fcge ; } ;
2021-08-23 20:44:48 +00:00
2023-04-15 17:27:31 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ;
2021-11-10 11:45:21 +00:00
2023-04-15 17:27:31 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _ffd * Presentation ) SaveAsTemplate ( w _g . Writer ) error { return _ffd . save ( w , true ) } ;
2021-08-23 20:44:48 +00:00
2023-04-15 17:27:31 +00:00
// ClrMru returns the ClrMru property.
func ( _eag PresentationProperties ) ClrMru ( ) * _cgg . CT_ColorMRU { return _eag . _bcd . ClrMru } ;
2020-12-17 22:07:08 +00:00
2023-04-15 17:27:31 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _cbgdb ViewProperties ) LastViewAttr ( ) _db . ST_ViewType { return _cbgdb . _gfga . LastViewAttr } ;
2021-06-16 07:10:52 +00:00
2023-04-15 17:27:31 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _bfef * _db . CT_SlideIdListEntry ; _egd * _db . Sld ; _gdee * Presentation ; _geda * _cgg . CT_ColorMapping ; } ; func ( _ffc TextBox ) getOff ( ) * _cgg . CT_Point2D { if _ffc . _deac . SpPr == nil { _ffc . _deac . SpPr = _cgg . NewCT_ShapeProperties ( ) ; } ; if _ffc . _deac . SpPr . Xfrm == nil { _ffc . _deac . SpPr . Xfrm = _cgg . NewCT_Transform2D ( ) ; } ; if _ffc . _deac . SpPr . Xfrm . Off == nil { _ffc . _deac . SpPr . Xfrm . Off = _cgg . NewCT_Point2D ( ) ; } ; return _ffc . _deac . SpPr . Xfrm . Off ; } ; func ( _bdg * chart ) Target ( ) string { return _bdg . _bb } ; func _bbad ( _fdac [ ] * _db . CT_GroupShapeChoice ) [ ] * _db . CT_GroupShapeChoice { var _fdg [ ] * _db . CT_GroupShapeChoice ; for _ , _ged := range _fdac { if len ( _ged . Pic ) == 0 { _fdg = append ( _fdg , _ged ) ; } ; } ; return _fdg ; } ; func ( _fbge * Presentation ) saveToFile ( _daef string , _egg bool ) error { _aba , _abc := _gce . Create ( _daef ) ; if _abc != nil { return _abc ; } ; defer _aba . Close ( ) ; return _fbge . save ( _aba , _egg ) ; } ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +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 ( _defb Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _adff := range _defb . _egd . CSld . SpTree . Choice { for _ , _adfc := range _adff . Sp { if _adfc . NvSpPr != nil && _adfc . NvSpPr . NvPr != nil && _adfc . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _adfc . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _adfc . NvSpPr . NvPr . Ph . IdxAttr != nil && * _adfc . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _adfc , _defb . _egd } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _gg . 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-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +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 ; } ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _cgbed ViewProperties ) X ( ) * _db . ViewPr { return _cgbed . _gfga } ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +00:00
// PrnPr returns the PrnPr property.
func ( _ega PresentationProperties ) PrnPr ( ) * _db . CT_PrintProperties { return _ega . _bcd . PrnPr } ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +00:00
// SetTextAnchor controls the text anchoring
func ( _cggd TextBox ) SetTextAnchor ( a _cgg . ST_TextAnchoringType ) { _cggd . _deac . TxBody . BodyPr = _cgg . NewCT_TextBodyProperties ( ) ; _cggd . _deac . TxBody . BodyPr . AnchorAttr = a ; } ; func ( _geb sort2d ) Len ( ) int { return len ( _geb ) } ; func ( _cad * chart ) RelId ( ) string { return _cad . _gge } ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +00:00
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _efg * _db . CT_Shape ; _fbg * _db . Sld ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _bcd * _db . PresentationPr } ;
// Themes returns an array of presentation themes.
func ( _cfbaa * Presentation ) Themes ( ) [ ] * _cgg . Theme { return _cfbaa . _bfgf } ;
2020-08-23 14:15:53 +00:00
2023-03-01 18:42:44 +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.
2023-04-15 17:27:31 +00:00
func ( _fdc PlaceHolder ) Clear ( ) { _fdc . ClearAll ( ) ; _bbcc := _cgg . NewCT_TextParagraph ( ) ; _fdc . _efg . TxBody . P = [ ] * _cgg . CT_TextParagraph { _bbcc } ; _bbcc . EndParaRPr = _cgg . NewCT_TextCharacterProperties ( ) ; _bbcc . EndParaRPr . LangAttr = _ea . String ( "\u0065\u006e\u002dU\u0053" ) ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// AddTable adds an empty table to a slide.
func ( _dgd Slide ) AddTable ( ) * _ef . Table { _fagf := _db . NewCT_GroupShapeChoice ( ) ; _dgd . _egd . CSld . SpTree . Choice = append ( _dgd . _egd . CSld . SpTree . Choice , _fagf ) ; _eeaa := _db . NewCT_GraphicalObjectFrame ( ) ; _fagf . GraphicFrame = append ( _fagf . GraphicFrame , _eeaa ) ; _eeaa . Xfrm . Off = _cgg . NewCT_Point2D ( ) ; _cbac := int64 ( 1 ) ; _eeaa . Xfrm . Off . XAttr = _cgg . ST_Coordinate { ST_CoordinateUnqualified : & _cbac } ; _eeaa . Xfrm . Off . YAttr = _cgg . ST_Coordinate { ST_CoordinateUnqualified : & _cbac } ; _abb := _eeaa . Graphic . CT_GraphicalObject . GraphicData ; _abb . 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" ; _bdaa := _ef . NewTableWithXfrm ( _eeaa . Xfrm ) ; _abb . Any = append ( _abb . Any , _bdaa . X ( ) ) ; return _bdaa ; } ;
2021-08-23 20:44:48 +00:00
2023-04-15 17:27:31 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _bag ViewProperties ) NotesTextViewPr ( ) * _db . CT_NotesTextViewProperties { return _bag . _gfga . NotesTextViewPr ; } ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _fgcf ViewProperties ) SorterViewPr ( ) * _db . CT_SlideSorterViewProperties { return _fgcf . _gfga . SorterViewPr ; } ;
2022-01-15 21:17:38 +00:00
2023-04-15 17:27:31 +00:00
// Width returns slide screen size width in EMU units.
func ( _gbce * SlideScreenSize ) Width ( ) int32 { return _gbce [ 0 ] } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _gbg := _aff ( ) ; _gbg . 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" ) ; _gbg . 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" ) ; _gbg . 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" ) ; _gbg . 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" ) ; _gbg . 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" ) ; _gbg . 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" ) ; _gbg . 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 \ u006
2023-03-01 18:42:44 +00:00
2023-04-15 17:27:31 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _bbbg * Presentation ) GetImageByRelID ( relID string ) ( _ef . ImageRef , bool ) { for _ , _ffgf := range _bbbg . Images { if _ffgf . RelID ( ) == relID { return _ffgf , true ; } ; } ; return _ef . ImageRef { } , false ; } ; func _dg ( _dbdc * Presentation , _ggb [ ] * _db . CT_GroupShapeChoice , _aae [ ] rectangle , _gd [ ] * TextItem ) [ ] * TextItem { for _ , _aaf := range _ggb { _eff := append ( [ ] rectangle { } , _aae ... ) ; for _ , _bc := range _aaf . Sp { _gd = append ( _gd , _ba ( _dbdc , _bc , nil , nil , _bc . SpPr . Xfrm , 0 , _aae , _bc . TxBody . P ) ... ) ; } ; for _ , _ccb := range _aaf . GraphicFrame { if _ccb != nil && _ccb . Graphic != nil && _ccb . Graphic . GraphicData != nil { _dd := _ccb . Xfrm ; for _ , _fb := range _ccb . Graphic . GraphicData . Any { if _bbc , _ace := _fb . ( * _cgg . Tbl ) ; _ace { _ede := & _bbc . CT_Table ; _bfa := 0 ; for _gdc , _dea := range _bbc . Tr { for _agd , _def := range _dea . Tc { _agg := & TableInfo { Table : _ede , Row : _dea , Cell : _def , RowIndex : _gdc , ColIndex : _agd } ; _gd = append ( _gd , _ba ( _dbdc , nil , _ccb , _agg , _dd , _bfa , _aae , _def . TxBody . P ) ... ) ; _bfa ++ ; } ; } ; } ; } ; } ; } ; for _ , _ec := range _aaf . GrpSp { if _ec . GrpSpPr != nil { _eae := _ec . GrpSpPr . Xfrm ; var _ga , _fd int64 ; if _eae . Off != nil { _ee , _af := _eae . Off . XAttr . ST_CoordinateUnqualified , _eae . Off . YAttr . ST_CoordinateUnqualified ; if _ee != nil && _af != nil { if _bef := _eae . Ext ; _bef != nil { _ga , _fd = _bef . CxAttr , _bef . CyAttr ; } ; _eff = append ( _eff , rectangle { _aa : * _ee , _gfe : * _af , _be : * _ee + _ga , _faf : * _af + _fd } ) ; } ; } ; } ; _gd = _dg ( _dbdc , _ec . Choice , _eff , _gd ) ; } ; } ; return _gd ; } ;
2023-03-01 18:42:44 +00:00
2023-04-15 17:27:31 +00:00
// Index returns the placeholder index
func ( _fda PlaceHolder ) Index ( ) uint32 { if _fda . _efg . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _fda . _efg . NvSpPr . NvPr . Ph . IdxAttr ; } ;
2023-03-01 18:42:44 +00:00
2023-04-15 17:27:31 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _cbaa Slide ) GetTextBoxes ( ) [ ] * TextBox { _eeea := [ ] * TextBox { } ; _edge := _cbaa . _egd . CSld . SpTree . Choice ; for _ , _gbcf := range _edge { for _ , _afdb := range _gbcf . Sp { if _afdb . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _afdb . NvSpPr . CNvSpPr . TxBoxAttr { _eeea = append ( _eeea , & TextBox { _afdb } ) ; } ; } ; } ; return _eeea ; } ;
2023-03-01 18:42:44 +00:00
2023-04-15 17:27:31 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _bda , _fdf := _gce . Open ( filename ) ; if _fdf != nil { return nil , _fg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fdf ) ; } ; defer _bda . Close ( ) ; _efd , _fdf := _gce . Stat ( filename ) ; if _fdf != nil { return nil , _fg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fdf ) ; } ; _ = _efd ; return Read ( _bda , _efd . Size ( ) ) ; } ;
2022-02-25 19:20:45 +00:00
2023-04-15 17:27:31 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _adg * Presentation ) SlideMasters ( ) [ ] SlideMaster { _dbdb := [ ] SlideMaster { } ; for _daefa , _eecc := range _adg . _cee { _dbdb = append ( _dbdb , SlideMaster { _adg , _adg . _gaf [ _daefa ] , _eecc } ) ; } ; return _dbdb ; } ;
2020-08-31 22:58:25 +00:00
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _aagg * SlideSize ) X ( ) * _db . CT_SlideSize { return _aagg . _gae } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// Presentation returns a slide's presentation.
func ( _cbc Slide ) Presentation ( ) * Presentation { return _cbc . _gdee } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// GetSlideLayout returns a slide layout related to the slide.
func ( _daa * Slide ) GetSlideLayout ( ) * _db . SldLayout { for _acef , _dfdb := range _daa . _gdee . Slides ( ) { if * _daa == _dfdb { return _daa . _gdee . _bfae [ len ( _daa . _gdee . Slides ( ) ) - _acef - 1 ] ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2022-12-06 11:56:49 +00:00
// X returns the inner wrapped XML type.
2023-04-15 17:27:31 +00:00
func ( _fafa * Presentation ) X ( ) * _db . Presentation { return _fafa . _cbd } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _ddee * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _ddfc := [ ] SlideLayout { } ; for _ , _dbdg := range _ddee . _bfae { _ddfc = append ( _ddfc , SlideLayout { _dbdg } ) ; } ; return _ddfc ; } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _bcf Slide ) AddTextBox ( ) TextBox { _baff := _db . NewCT_GroupShapeChoice ( ) ; _bcf . _egd . CSld . SpTree . Choice = append ( _bcf . _egd . CSld . SpTree . Choice , _baff ) ; _eeec := _db . NewCT_Shape ( ) ; _baff . Sp = append ( _baff . Sp , _eeec ) ; _eeec . SpPr = _cgg . NewCT_ShapeProperties ( ) ; _eeec . SpPr . Xfrm = _cgg . NewCT_Transform2D ( ) ; _eeec . SpPr . PrstGeom = _cgg . NewCT_PresetGeometry2D ( ) ; _eeec . SpPr . PrstGeom . PrstAttr = _cgg . ST_ShapeTypeRect ; _eeec . NvSpPr = _db . NewCT_ShapeNonVisual ( ) ; _eeec . NvSpPr . CNvSpPr = _cgg . NewCT_NonVisualDrawingShapeProps ( ) ; _aaec := true ; _eeec . NvSpPr . CNvSpPr . TxBoxAttr = & _aaec ; _eeec . TxBody = _cgg . NewCT_TextBody ( ) ; _eeec . TxBody . BodyPr = _cgg . NewCT_TextBodyProperties ( ) ; _eeec . TxBody . BodyPr . WrapAttr = _cgg . ST_TextWrappingTypeSquare ; _eeec . TxBody . BodyPr . SpAutoFit = _cgg . NewCT_TextShapeAutofit ( ) ; _fgb := TextBox { _eeec } ; _fgb . Properties ( ) . SetWidth ( 3 * _ac . Inch ) ; _fgb . Properties ( ) . SetHeight ( 1 * _ac . Inch ) ; _fgb . Properties ( ) . SetPosition ( 0 , 0 ) ; return _fgb ; } ;
2020-08-23 14:15:53 +00:00
2023-03-01 18:42:44 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
2023-04-15 17:27:31 +00:00
func ( _dgfb * Presentation ) Close ( ) error { if _dgfb . TmpPath != "" { return _bd . RemoveAll ( _dgfb . TmpPath ) ; } ; return nil ; } ;
2022-12-06 11:56:49 +00:00
2023-04-15 17:27:31 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _aaa * Presentation ) GetTableStyleById ( id string ) * _cgg . CT_TableStyle { _dcbe := _aaa . _gga . TblStyle ( ) ; for _ , _cea := range _dcbe { if _cea . StyleIdAttr == id { return _cea ; } ; } ; return nil ; } ; func ( _bgb * Slide ) ensureClrMap ( ) { if len ( _bgb . _gdee . _cee ) == 0 || len ( _bgb . _gdee . _bfgf ) == 0 { return ; } ; _cae := _bgb . _gdee . _cee [ 0 ] ; _gba := _cae . ClrMap ; if _cbef := _bgb . _egd . ClrMapOvr ; _cbef != nil { if _bea := _cbef . Choice ; _bea != nil { if _bea . MasterClrMapping == nil { if _gddb := _bea . OverrideClrMapping ; _gddb != nil { if _gddb . Bg1Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Bg1Attr = _gddb . Bg1Attr ; } ; if _gddb . Tx1Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Tx1Attr = _gddb . Tx1Attr ; } ; if _gddb . Bg2Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Bg2Attr = _gddb . Bg2Attr ; } ; if _gddb . Tx2Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Tx2Attr = _gddb . Tx2Attr ; } ; if _gddb . Accent1Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent1Attr = _gddb . Accent1Attr ; } ; if _gddb . Accent2Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent2Attr = _gddb . Accent2Attr ; } ; if _gddb . Accent3Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent3Attr = _gddb . Accent3Attr ; } ; if _gddb . Accent4Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent4Attr = _gddb . Accent4Attr ; } ; if _gddb . Accent5Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent5Attr = _gddb . Accent5Attr ; } ; if _gddb . Accent6Attr != _cgg . ST_ColorSchemeIndexUnset { _gba . Accent6Attr = _gddb . Accent6Attr ; } ; if _gddb . HlinkAttr != _cgg . ST_ColorSchemeIndexUnset { _gba . HlinkAttr = _gddb . HlinkAttr ; } ; if _gddb . FolHlinkAttr != _cgg . ST_ColorSchemeIndexUnset { _gba . FolHlinkAttr = _gddb . FolHlinkAttr ; } ; } ; } ; } ; } ; _bgb . _geda = _gba ; } ; func ( _dbe sort2d ) Swap ( i , j int ) { _dbe [ i ] , _dbe [ j ] = _dbe [ j ] , _dbe [ i ] } ;
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// GridSpacing returns the GridSpacing property.
func ( _ebf ViewProperties ) GridSpacing ( ) * _cgg . CT_PositiveSize2D { return _ebf . _gfga . GridSpacing } ; func ( _cfgd * Presentation ) save ( _ddbf _g . Writer , _gfd bool ) error { const _cggg = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ; if _dcb := _cfgd . _cbd . Validate ( ) ; _dcb != nil { _eb . 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" , _dcb ) ; } ; if ! _f . GetLicenseKey ( ) . IsLicensed ( ) && ! _bdb { _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 _gg . 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 ( _cfgd . _ecd ) == 0 { _fff , _dbc := _f . GenRefId ( "\u0070\u0077" ) ; if _dbc != nil { _eb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dbc ) ; return _dbc ; } ; _cfgd . _ecd = _fff ; } ; if _dba := _f . Track ( _cfgd . _ecd , _cggg ) ; _dba != nil { _eb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dba ) ; return _dba ; } ; if _gfd { _cfgd . 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" ) ; _cfgd . 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 { _cfgd . 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" ) ; _cfgd . 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" ) ; } ; _dge := _ea . DocTypePresentation ; _egf := _d . NewWriter ( _ddbf ) ; defer _egf . Close ( ) ; if _cag := _cg . MarshalXML ( _egf , _ea . BaseRelsFilename , _cfgd . Rels . X ( ) ) ; _cag != nil { return _cag ; } ; if _ggbg := _cg . MarshalXMLByType ( _egf , _dge , _ea . ExtendedPropertiesType , _cfgd . AppProperties . X ( ) ) ; _ggbg != nil { return _ggbg ; } ; if _cgca := _cg . MarshalXMLByType ( _egf , _dge , _ea . CorePropertiesType , _cfgd . CorePr
2020-08-23 14:15:53 +00:00
2023-04-15 17:27:31 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _bafff ViewProperties ) ShowCommentsAttr ( ) * bool { return _bafff . _gfga . ShowCommentsAttr } ;
2021-04-23 20:00:00 +00:00
2023-03-01 18:42:44 +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 ;
2020-06-07 20:13:15 +07:00
2023-04-15 17:27:31 +00:00
// AddSlide adds a new slide to the presentation.
func ( _fgc * Presentation ) AddSlide ( ) Slide { _bebc := _db . NewCT_SlideIdListEntry ( ) ; _bebc . IdAttr = _fgc . nextSlideID ( ) ; _fgc . _cbd . SldIdLst . SldId = append ( _fgc . _cbd . SldIdLst . SldId , _bebc ) ; _cfge := _db . NewSld ( ) ; _cfge . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ; _cfge . CSld . SpTree . GrpSpPr . Xfrm = _cgg . NewCT_GroupTransform2D ( ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Off = _cgg . NewCT_Point2D ( ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _ea . Int64 ( 0 ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _ea . Int64 ( 0 ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Ext = _cgg . NewCT_PositiveSize2D ( ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _ac . Point ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _ac . Point ) ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _cfge . CSld . SpTree . GrpSpPr . Xfrm . Off ; _cfge . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _cfge . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _fgc . _gaaa = append ( _fgc . _gaaa , _cfge ) ; _cbf := _fgc . _dca . AddAutoRelationship ( _ea . DocTypePresentation , _ea . OfficeDocumentType , len ( _fgc . _gaaa ) , _ea . SlideType ) ; _bebc . RIdAttr = _cbf . ID ( ) ; _eac := _ea . AbsoluteFilename ( _ea . DocTypePresentation , _ea . SlideType , len ( _fgc . _gaaa ) ) ; _fgc . ContentTypes . AddOverride ( _eac , _ea . SlideContentType ) ; _gdba := _ef . NewRelationships ( ) ; _fgc . _fdbe = append ( _fgc . _fdbe , _gdba ) ; _gdba . AddAutoRelationship ( _ea . DocTypePresentation , _ea . SlideType , len ( _fgc . _bfae ) , _ea . SlideLayoutType ) ; return Slide { _bebc , _cfge , _fgc , nil } ; } ;
2017-10-03 09:55:27 -05:00
2023-04-15 17:27:31 +00:00
// Height returns slide screen size height in EMU units.
func ( _effd * SlideScreenSize ) Height ( ) int32 { return _effd [ 1 ] } ;
2017-10-03 09:55:27 -05:00
2023-04-15 17:27:31 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _fcd TextBox ) X ( ) * _db . CT_Shape { return _fcd . _deac } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +00:00
// Type returns the placeholder type
func ( _deb PlaceHolder ) Type ( ) _db . ST_PlaceholderType { return _deb . _efg . NvSpPr . NvPr . Ph . TypeAttr } ; func _ba ( _ccbf * Presentation , _fgd * _db . CT_Shape , _cge * _db . CT_GraphicalObjectFrame , _dae * TableInfo , _cf * _cgg . CT_Transform2D , _fdb int , _gb [ ] rectangle , _cgd [ ] * _cgg . CT_TextParagraph ) [ ] * TextItem { _cfb := [ ] * TextItem { } ; var _cfbd , _bgf , _bfg , _bbf , _efa , _eba int64 ; _dc := _cf == nil ; _bfd := 0 ; for _ , _fge := range _cgd { for _ , _ffb := range _fge . EG_TextRun { if _edeg := _ffb . R ; _edeg != nil { if ! _dc { if _cf . Off != nil { if _bfb := _cf . Ext ; _bfb != nil { _efa , _eba = _bfb . CxAttr , _bfb . CyAttr ; } ; if _df := _cf . Off . XAttr . ST_CoordinateUnqualified ; _df != nil { _cfbd = * _df ; _bgf = _cfbd + _efa ; _dc = true ; } ; if _cce := _cf . Off . YAttr . ST_CoordinateUnqualified ; _cce != nil { _bfg = * _cce ; _bbf = _bfg + _eba ; _dc = true ; } ; } ; } ; _ffe := append ( [ ] rectangle { } , _gb ... ) ; _ffe = append ( _ffe , rectangle { _aa : _cfbd , _be : _bgf , _gfe : _bfg , _faf : _bbf } ) ; _cfb = append ( _cfb , & TextItem { Presentation : _ccbf , Shape : _fgd , GraphicFrame : _cge , TableInfo : _dae , Paragraph : _fge , Run : _edeg , Text : _edeg . T , _de : _ffe , _ggec : _fdb , _gfg : _bfd } ) ; _bfd ++ ; } ; } ; } ; return _cfb ; } ; func ( _bbbd * Presentation ) onNewRelationship ( _agab * _cg . DecodeMap , _eggd , _gbe string , _aef [ ] * _d . File , _efdc * _e . Relationship , _eaef _cg . Target ) error { _fcb := _ea . DocTypePresentation ; switch _gbe { case _ea . OfficeDocumentType : _bbbd . _cbd = _db . NewPresentation ( ) ; _agab . AddTarget ( _eggd , _bbbd . _cbd , _gbe , 0 ) ; _agab . AddTarget ( _cg . RelationsPathFor ( _eggd ) , _bbbd . _dca . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . CorePropertiesType : _agab . AddTarget ( _eggd , _bbbd . CoreProperties . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . CustomPropertiesType : _agab . AddTarget ( _eggd , _bbbd . CustomProperties . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . PresentationPropertiesType : _agab . AddTarget ( _eggd , _bbbd . _fad . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . ViewPropertiesType : _agab . AddTarget ( _eggd , _bbbd . _cgbc . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . TableStylesType : _agab . AddTarget ( _eggd , _bbbd . _gga . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . HyperLinkType : _dff := _cgg . NewCT_Hyperlink ( ) ; _abcb := uint32 ( len ( _bbbd . _deg ) ) ; _agab . AddTarget ( _eggd , _dff , _gbe , _abcb ) ; _bbbd . _deg = append ( _bbbd . _deg , _dff ) ; case _ea . CustomXMLType : _eee := & _ea . XSDAny { } ; _gee := uint32 ( len ( _bbbd . _afb ) ) ; _agab . AddTarget ( _eggd , _eee , _gbe , _gee ) ; _bbbd . _afb = append ( _bbbd . _afb , _eee ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , len ( _bbbd . _afb ) ) ; case _ea . ChartType : _ceg := chart { _bg : _c . NewChartSpace ( ) } ; _fagg := uint32 ( len ( _bbbd . _gde ) ) ; _agab . AddTarget ( _eggd , _ceg . _bg , _gbe , _fagg ) ; _bbbd . _gde = append ( _bbbd . _gde , & _ceg ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , len ( _bbbd . _gde ) ) ; _ceg . _bb = _efdc . TargetAttr ; case _ea . HandoutMasterType : _cfd := _db . NewHandoutMaster ( ) ; _gcd := uint32 ( len ( _bbbd . _cdb ) ) ; _agab . AddTarget ( _eggd , _cfd , _gbe , _gcd ) ; _bbbd . _cdb = append ( _bbbd . _cdb , _cfd ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , len ( _bbbd . _cdb ) ) ; case _ea . NotesMasterType : _cagg := _db . NewNotesMaster ( ) ; _cdc := uint32 ( len ( _bbbd . _dgf ) ) ; _agab . AddTarget ( _eggd , _cagg , _gbe , _cdc ) ; _bbbd . _dgf = append ( _bbbd . _dgf , _cagg ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , len ( _bbbd . _dgf ) ) ; case _ea . ExtendedPropertiesType : _agab . AddTarget ( _eggd , _bbbd . AppProperties . X ( ) , _gbe , 0 ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , 0 ) ; case _ea . SlideType : _adb := _db . NewSld ( ) ; _bbbd . _gaaa = append ( _bbbd . _gaaa , _adb ) ; _agab . AddTarget ( _eggd , _adb , _gbe , uint32 ( len ( _bbbd . _gaaa ) ) ) ; _efdc . TargetAttr = _ea . RelativeFilename ( _fcb , _eaef . Typ , _gbe , len ( _bbbd . _gaaa ) ) ; _acbe := _ef . Ne
// ExtractText returns text from a slide as a SlideText object.
func ( _faa * Slide ) ExtractText ( ) * SlideText { _bf := _dg ( _faa . _gdee , _faa . _egd . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _acb . Sort ( sort2d ( _bf ) ) ; return & SlideText { Items : _bf } ; } ;
2021-01-04 16:11:39 +00:00
2023-03-01 18:42:44 +00:00
// X returns the inner wrapped XML type.
2023-04-15 17:27:31 +00:00
func ( _efed SlideLayout ) X ( ) * _db . SldLayout { return _efed . _afc } ; var ( SlideScreenSize16x9 = SlideScreenSize { 12192000 , 6858000 } ; SlideScreenSize4x3 = SlideScreenSize { 9144000 , 6858000 } ; SlideScreenSizeA4 = SlideScreenSize { 9906000 , 6858000 } ; ) ;
2021-01-04 16:11:39 +00:00
2023-04-15 17:27:31 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _ggc , _dag := Open ( fn ) ; if _dag != nil { return nil , _dag ; } ; return _ggc , nil ; } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// Properties returns the properties of the TextBox.
func ( _cfg Image ) Properties ( ) _fc . ShapeProperties { if _cfg . _dgb . SpPr == nil { _cfg . _dgb . SpPr = _cgg . NewCT_ShapeProperties ( ) ; } ; return _fc . MakeShapeProperties ( _cfg . _dgb . SpPr ) ; } ;
2021-05-31 16:22:30 +00:00
2023-04-15 17:27:31 +00:00
// Save writes the presentation out to a writer in the Zip package format
func ( _fgcg * Presentation ) Save ( w _g . Writer ) error { return _fgcg . save ( w , false ) } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +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 ( _eaeg PlaceHolder ) SetText ( text string ) { _eaeg . Clear ( ) ; _bfdf := _cgg . NewEG_TextRun ( ) ; _bfdf . R = _cgg . NewCT_RegularTextRun ( ) ; _bfdf . R . T = text ; if len ( _eaeg . _efg . TxBody . P ) == 0 { _eaeg . _efg . TxBody . P = append ( _eaeg . _efg . TxBody . P , _cgg . NewCT_TextParagraph ( ) ) ; } ; _eaeg . _efg . TxBody . P [ 0 ] . EG_TextRun = nil ; _eaeg . _efg . TxBody . P [ 0 ] . EG_TextRun = append ( _eaeg . _efg . TxBody . P [ 0 ] . EG_TextRun , _bfdf ) ; } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +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 ( _gfa * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _cca , _efdda := _gfa . AddSlideWithLayout ( l ) ; for _ , _bae := range _cca . PlaceHolders ( ) { _bae . Clear ( ) ; switch _bae . Type ( ) { case _db . ST_PlaceholderTypeFtr , _db . ST_PlaceholderTypeDt , _db . ST_PlaceholderTypeSldNum : _bae . Remove ( ) ; } ; } ; return _cca , _efdda ; } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// Size returns slide size value as SlideScreenSize.
func ( _febc * SlideSize ) Size ( ) SlideScreenSize { return SlideScreenSize { _febc . _gae . CxAttr , _febc . _gae . CyAttr } ; } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// ExtLst returns the ExtLst property.
func ( _fbgg PresentationProperties ) ExtLst ( ) * _db . CT_ExtensionList { return _fbgg . _bcd . ExtLst } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// WebPr returns the WebPr property.
func ( _abd PresentationProperties ) WebPr ( ) * _db . CT_WebProperties { return _abd . _bcd . WebPr } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _cgbcf * Presentation ) SaveToFile ( path string ) error { return _cgbcf . saveToFile ( path , false ) } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +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 ( _abdg * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _gff := _db . NewCT_SlideIdListEntry ( ) ; _gff . IdAttr = 256 ; for _ , _cacg := range _abdg . _cbd . SldIdLst . SldId { if _cacg . IdAttr >= _gff . IdAttr { _gff . IdAttr = _cacg . IdAttr + 1 ; } ; } ; _abdg . _cbd . SldIdLst . SldId = append ( _abdg . _cbd . SldIdLst . SldId , _gff ) ; _eace := _db . NewSld ( ) ; _eab := _fa . Buffer { } ; _bgc := _cd . NewEncoder ( & _eab ) ; _gbd := _cd . StartElement { Name : _cd . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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" } ) ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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" } ) ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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" } ) ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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" } ) ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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" } ) ; _gbd . Attr = append ( _gbd . Attr , _cd . Attr { Name : _cd . 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 _dcab := l . _afc . CSld . MarshalXML ( _bgc , _gbd ) ; _dcab != nil { return Slide { } , _dcab ; } ; _bgc . Flush ( ) ; _bfc := _cd . NewDecoder ( & _eab ) ; _eace . CSld = _db . NewCT_CommonSlideData ( ) ; if _daed := _bfc . Decode ( _eace . CSld ) ; _daed != nil { return Slide { } , _daed ; } ; _eace . CSld . NameAttr = nil ; _eace . CSld . SpTree . Choice = _bbad ( _eace . CSld . SpTree . Choice ) ; _abdg . _gaaa = append ( _abdg . _gaaa , _eace ) ; _acea := _abdg . _dca . AddAutoRelationship ( _ea . DocTypePresentation , _ea . OfficeDocumentType , len ( _abdg . _gaaa ) , _ea . SlideType ) ; _gff . RIdAttr = _acea . ID ( ) ; _baf := _ea . AbsoluteFilename ( _ea . DocTypePresentation , _ea . SlideType , len ( _abdg . _gaaa ) ) ; _abdg . ContentTypes . AddOverride ( _baf , _ea . SlideContentType ) ; _dgfd := _ef . NewRelationships ( ) ; _abdg . _fdbe = append ( _abdg . _fdbe , _dgfd ) ; _ebc := len ( _abdg . _fdbe ) - 1 ; for _cfe , _edg := range _abdg . _bfae { if _edg == l . X ( ) { _ggf := _abdg . _gag [ _cfe ] ; for _ , _gbf := range _ggf . X ( ) . Relationship { if _gbf . TypeAttr != _ea . SlideMasterType { _abdg . _fdbe [ _ebc ] . X ( ) . Relationship = append ( _abdg . _fdbe [ _
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _bcd : _db . NewPresentationPr ( ) } ; } ;
2021-09-22 16:41:01 +00:00
2023-03-01 18:42:44 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
2023-04-15 17:27:31 +00:00
func ( _fea * Slide ) GetImageByRelID ( relID string ) ( _ef . ImageRef , bool ) { _cebe := _fea . getSlideRels ( ) ; if ( _cebe == _ef . Relationships { } ) { return _ef . ImageRef { } , false ; } ; var _gdfdg string ; for _ , _dcbb := range _cebe . X ( ) . Relationship { if _dcbb . IdAttr == relID { _gdfdg = _dcbb . TargetAttr ; break ; } ; } ; for _ , _ddec := range _fea . _gdee . Images { if _ddec . Target ( ) == _gdfdg { return _ddec , true ; } ; } ; return _ef . ImageRef { } , false ; } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// SlideSize represents a slide size of a presentation.
type SlideSize struct { _gae * _db . CT_SlideSize ; _gccc * Presentation ; } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +00:00
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
func NewSlideScreenSize ( ) SlideScreenSize { return NewSlideScreenSizeWithValue ( SlideScreenSize16x9 [ 0 ] , SlideScreenSize16x9 [ 1 ] ) ; } ;
2022-09-02 11:46:53 +00:00
2023-04-15 17:27:31 +00:00
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _eabc TextBox ) SetOffsetY ( offY float64 ) { _gagc := _eabc . getOff ( ) ; _bcgb := _ac . ToEMU ( offY ) ; _gagc . YAttr = _cgg . ST_Coordinate { ST_CoordinateUnqualified : & _bcgb } ; } ; func ( _agc * Presentation ) nextSlideID ( ) uint32 { _ddc := uint32 ( 256 ) ; for _ , _bced := range _agc . _cbd . SldIdLst . SldId { if _bced . IdAttr >= _ddc { _ddc = _bced . IdAttr + 1 ; } ; } ; return _ddc ; } ;
2022-12-06 11:56:49 +00:00
2023-04-15 17:27:31 +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 * _db . CT_Shape ; GraphicFrame * _db . CT_GraphicalObjectFrame ; Paragraph * _cgg . CT_TextParagraph ; Run * _cgg . CT_RegularTextRun ; TableInfo * TableInfo ; _de [ ] rectangle ; _ggec int ; _gfg int ; } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +00:00
// X returns the inner wrapped XML type.
func ( _bgg PlaceHolder ) X ( ) * _db . CT_Shape { return _bgg . _efg } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _ffbcf TextBox ) SetOffsetX ( offX float64 ) { _egac := _ffbcf . getOff ( ) ; _gadg := _ac . ToEMU ( offX ) ; _egac . XAttr = _cgg . ST_Coordinate { ST_CoordinateUnqualified : & _gadg } ; } ; type chart struct { _bg * _c . ChartSpace ; _gge string ; _bb string ; } ;
2021-09-22 16:41:01 +00:00
2023-04-15 17:27:31 +00:00
// AddParagraph adds a paragraph to the text box
func ( _bcgf TextBox ) AddParagraph ( ) _fc . Paragraph { _bfbe := _cgg . NewCT_TextParagraph ( ) ; _bcgf . _deac . TxBody . P = append ( _bcgf . _deac . TxBody . P , _bfbe ) ; return _fc . MakeParagraph ( _bfbe ) ; } ;
// ExtLst returns the ExtLst property.
func ( _egeg ViewProperties ) ExtLst ( ) * _db . CT_ExtensionList { return _egeg . _gfga . ExtLst } ; var _bdb = false ;
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _bcg Slide ) ValidateWithPath ( path string ) error { if _gcg := _bcg . _egd . ValidateWithPath ( path ) ; _gcg != nil { return _gcg ; } ; for _ , _fbc := range _bcg . _egd . CSld . SpTree . Choice { for _ , _dga := range _fbc . Sp { if _dga . TxBody != nil { if len ( _dga . TxBody . P ) == 0 { return _gg . 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 ; } ;
2021-11-10 11:45:21 +00:00
2023-03-01 18:42:44 +00:00
// SlideLayout is a layout from which slides can be created.
2023-04-15 17:27:31 +00:00
type SlideLayout struct { _afc * _db . SldLayout } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +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 ( _dbg * Presentation ) AddImage ( i _ef . Image ) ( _ef . ImageRef , error ) { _bfe := _ef . MakeImageRef ( i , & _dbg . DocBase , _dbg . _dca ) ; if i . Data == nil && i . Path == "" { return _bfe , _gg . 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 _bfe , _gg . 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 _bfe , _gg . 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 != "" { _dbfg := _bd . Add ( i . Path ) ; if _dbfg != nil { return _bfe , _dbfg ; } ; } ; _dbg . Images = append ( _dbg . Images , _bfe ) ; _dbg . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _dbg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _dbg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _dbg . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _dbg . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; return _bfe , nil ; } ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _gfga * _db . ViewPr } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _eea * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _agff := range _eea . _bfae { if _agff . CSld . NameAttr != nil && name == * _agff . CSld . NameAttr { return SlideLayout { _agff } , nil ; } ; } ; return SlideLayout { } , _gg . 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
2023-04-15 17:27:31 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _gfga : _db . NewViewPr ( ) } } ;
2022-02-05 13:05:36 +00:00
2023-04-15 17:27:31 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _ae PresentationProperties ) HtmlPubPr ( ) * _db . CT_HtmlPublishProperties { return _ae . _bcd . HtmlPubPr ; } ;
2022-04-09 14:27:46 +00:00
2023-04-15 17:27:31 +00:00
// Properties returns the properties of the TextBox.
func ( _edgeb TextBox ) Properties ( ) _fc . ShapeProperties { if _edgeb . _deac . SpPr == nil { _edgeb . _deac . SpPr = _cgg . NewCT_ShapeProperties ( ) ; } ; return _fc . MakeShapeProperties ( _edgeb . _deac . SpPr ) ; } ;
// NotesViewPr returns the NotesViewPr property.
func ( _edgef ViewProperties ) NotesViewPr ( ) * _db . CT_NotesViewProperties { return _edgef . _gfga . NotesViewPr ; } ;
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
func ( _dgfdb * Slide ) GetColorBySchemeColor ( schClr _cgg . ST_SchemeColorVal ) * _cgg . CT_Color { _dgfdb . ensureClrMap ( ) ; _fggf := _dgfdb . _geda ; if _fggf == nil { return nil ; } ; var _bafe _cgg . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _bafe = _fggf . Bg1Attr ; case "\u0062\u0067\u0032" : _bafe = _fggf . Bg2Attr ; case "\u0074\u0078\u0031" : _bafe = _fggf . Tx1Attr ; case "\u0074\u0078\u0032" : _bafe = _fggf . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _bafe = _fggf . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _bafe = _fggf . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _bafe = _fggf . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _bafe = _fggf . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _bafe = _fggf . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _bafe = _fggf . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _bafe = _fggf . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _bafe = _fggf . FolHlinkAttr ; case "\u0064\u006b\u0031" : _bafe = _cgg . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _bafe = _cgg . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _bafe = _cgg . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _bafe = _cgg . ST_ColorSchemeIndexLt2 ; default : _bafe = _cgg . ST_ColorSchemeIndexUnset ; } ; _bbd := _dgfdb . _gdee . _bfgf [ 0 ] ; _cbgd := _bbd . ThemeElements ; if _cbgd == nil { return nil ; } ; var _cecg * _cgg . CT_Color ; _bede := _cbgd . ClrScheme ; switch _bafe . String ( ) { case "\u0064\u006b\u0031" : _cecg = _bede . Dk1 ; case "\u0064\u006b\u0032" : _cecg = _bede . Dk2 ; case "\u006c\u0074\u0031" : _cecg = _bede . Lt1 ; case "\u006c\u0074\u0032" : _cecg = _bede . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _cecg = _bede . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _cecg = _bede . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _cecg = _bede . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _cecg = _bede . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _cecg = _bede . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _cecg = _bede . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _cecg = _bede . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _cecg = _bede . FolHlink ; default : return nil ; } ; return _cecg ; } ;
// Text returns text from a slide as one string separated with line breaks.
func ( _ge * SlideText ) Text ( ) string { _bge := _fa . NewBuffer ( [ ] byte { } ) ; for _ , _cgc := range _ge . Items { if _cgc . Text != "" { _bge . WriteString ( _cgc . Text ) ; _bge . WriteString ( "\u000a" ) ; } ; } ; return _bge . String ( ) ; } ;
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _edce SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _deea := map [ string ] int { } ; _ggfb := [ ] SlideLayout { } ; for _ , _eaea := range _edce . _cfaa . Relationships ( ) { _cgbe := _b . Replace ( _eaea . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ; _cgbe = _b . Replace ( _cgbe , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _afca , _bgfg := _ca . ParseInt ( _cgbe , 10 , 32 ) ; _bgfg == nil { _deea [ _eaea . ID ( ) ] = int ( _afca ) ; } ; } ; for _ , _cefa := range _edce . _bafec . SldLayoutIdLst . SldLayoutId { if _dbfd , _bcaf := _deea [ _cefa . RIdAttr ] ; _bcaf { _bdacc := _edce . _cga . _bfae [ _dbfd - 1 ] ; _ggfb = append ( _ggfb , SlideLayout { _bdacc } ) ; } ; } ; return _ggfb ; } ;
// NormalViewPr returns the NormalViewPr property.
func ( _aegd ViewProperties ) NormalViewPr ( ) * _db . CT_NormalViewProperties { return _aegd . _gfga . NormalViewPr ; } ;
// 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 ( _egc sort2d ) Less ( i , j int ) bool { _dad , _dbdcg := _egc [ i ] , _egc [ j ] ; _fca , _ggbd := _dad . _de , _dbdcg . _de ; _bba , _efad := len ( _fca ) - 1 , len ( _ggbd ) - 1 ; _cgb , _gcb := 0 , 0 ; for { _cdg , _ce , _bdf , _befa , _acec , _cbe , _cec , _ddb := _fca [ _cgb ] . _gfe , _ggbd [ _gcb ] . _gfe , _fca [ _cgb ] . _faf , _ggbd [ _gcb ] . _faf , _fca [ _cgb ] . _aa , _ggbd [ _gcb ] . _aa , _fca [ _cgb ] . _be , _ggbd [ _gcb ] . _be ; if _cdg == _ce || ( ( _da . Abs ( float64 ( _cdg ) - float64 ( _ce ) ) < _gbc ) && ( ( _cdg >= _ce && _cdg <= _befa ) || ( _ce >= _cdg && _ce <= _bdf ) ) && ( _cec < _cbe || _acec > _ddb ) ) { if _acec == _cbe { if _cgb < _bba && _gcb < _efad { _cgb ++ ; _gcb ++ ; continue ; } ; if _cgb >= _bba && _gcb >= _efad { break ; } ; return _cgb >= _bba ; } else { return _acec < _cbe ; } ; } else { return _cdg < _ce ; } ; } ; _aceb , _ad , _bca , _gebe := _dad . _ggec , _dbdcg . _ggec , _dad . _gfg , _dbdcg . _gfg ; if _aceb == _ad { return _bca <= _gebe ; } ; return _aceb < _ad ; } ;