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/
2024-07-28 07:48:26 +00:00
package presentation ; import ( _df "archive/zip" ; _cb "bytes" ; _af "encoding/xml" ; _ca "errors" ; _eg "fmt" ; _cc "github.com/unidoc/unioffice" ; _fe "github.com/unidoc/unioffice/common" ; _a "github.com/unidoc/unioffice/common/logger" ; _c "github.com/unidoc/unioffice/common/tempstorage" ;
_ee "github.com/unidoc/unioffice/drawing" ; _gf "github.com/unidoc/unioffice/internal/formatutils" ; _ge "github.com/unidoc/unioffice/internal/license" ; _ea "github.com/unidoc/unioffice/measurement" ; _ged "github.com/unidoc/unioffice/schema/soo/dml" ; _b "github.com/unidoc/unioffice/schema/soo/dml/chart" ;
_ec "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _e "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _fb "github.com/unidoc/unioffice/schema/soo/pml" ; _g "github.com/unidoc/unioffice/zippkg" ; _f "image" ; _abd "image/jpeg" ; _dc "io" ; _be "math" ;
_bg "os" ; _ab "path" ; _cd "sort" ; _de "strconv" ; _ed "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _agga PlaceHolder ) X ( ) * _fb . CT_Shape { return _agga . _gd } ; func ( _dfg * Presentation ) onNewRelationship ( _eab * _g . DecodeMap , _acf , _cafc string , _dcdf [ ] * _df . File , _bfe * _e . Relationship , _cde _g . Target ) error { _gdf := _cc . DocTypePresentation ;
switch _cafc { case _cc . OfficeDocumentType : _dfg . _bfb = _fb . NewPresentation ( ) ; _eab . AddTarget ( _acf , _dfg . _bfb , _cafc , 0 ) ; _eab . AddTarget ( _g . RelationsPathFor ( _acf ) , _dfg . _bfce . X ( ) , _cafc , 0 ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ;
case _cc . CorePropertiesType : _eab . AddTarget ( _acf , _dfg . CoreProperties . X ( ) , _cafc , 0 ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ; case _cc . CustomPropertiesType : _eab . AddTarget ( _acf , _dfg . CustomProperties . X ( ) , _cafc , 0 ) ;
_bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ; case _cc . PresentationPropertiesType : _eab . AddTarget ( _acf , _dfg . _eafg . X ( ) , _cafc , 0 ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ; case _cc . ViewPropertiesType : _eab . AddTarget ( _acf , _dfg . _ebf . X ( ) , _cafc , 0 ) ;
_bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ; case _cc . TableStylesType : _eab . AddTarget ( _acf , _dfg . _aagb . X ( ) , _cafc , 0 ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ; case _cc . HyperLinkType : _fca := _ged . NewCT_Hyperlink ( ) ;
_aebe := uint32 ( len ( _dfg . _gcg ) ) ; _eab . AddTarget ( _acf , _fca , _cafc , _aebe ) ; _dfg . _gcg = append ( _dfg . _gcg , _fca ) ; case _cc . CustomXMLType : _gfee := & _cc . XSDAny { } ; _ddd := uint32 ( len ( _dfg . _dgda ) ) ; _eab . AddTarget ( _acf , _gfee , _cafc , _ddd ) ; _dfg . _dgda = append ( _dfg . _dgda , _gfee ) ;
_bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _dgda ) ) ; case _cc . ChartType : _febb := chart { _geda : _b . NewChartSpace ( ) } ; _cab := uint32 ( len ( _dfg . _afg ) ) ; _eab . AddTarget ( _acf , _febb . _geda , _cafc , _cab ) ; _dfg . _afg = append ( _dfg . _afg , & _febb ) ;
_bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _afg ) ) ; _febb . _gc = _bfe . TargetAttr ; case _cc . HandoutMasterType : _gdfd := _fb . NewHandoutMaster ( ) ; _gcb := uint32 ( len ( _dfg . _bac ) ) ; _eab . AddTarget ( _acf , _gdfd , _cafc , _gcb ) ;
_dfg . _bac = append ( _dfg . _bac , _gdfd ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _bac ) ) ; case _cc . NotesMasterType : _aefb := _fb . NewNotesMaster ( ) ; _ddg := uint32 ( len ( _dfg . _dbbc ) ) ; _eab . AddTarget ( _acf , _aefb , _cafc , _ddg ) ;
_dfg . _dbbc = append ( _dfg . _dbbc , _aefb ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _dbbc ) ) ; case _cc . ExtendedPropertiesType : _eab . AddTarget ( _acf , _dfg . AppProperties . X ( ) , _cafc , 0 ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , 0 ) ;
case _cc . SlideType : if _feed , _gcca := _gf . StringToNumbers ( _acf ) ; _gcca { if len ( _dfg . _dbf ) < _feed { _fgf := _fb . NewSld ( ) ; _dfg . _dbf = append ( _dfg . _dbf , _fgf ) ; _eab . AddTarget ( _acf , _fgf , _cafc , uint32 ( _feed ) ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , _feed ) ;
_cbeb := _fe . NewRelationships ( ) ; _eab . AddTarget ( _g . RelationsPathFor ( _acf ) , _cbeb . X ( ) , _cafc , 0 ) ; if len ( _dfg . _abgdg ) >= _feed { _dfg . _abgdg [ _feed - 1 ] = _cbeb ; } else { _dfg . _abgdg = append ( _dfg . _abgdg , _cbeb ) ; } ; } ; } ; case _cc . SlideMasterType : _bacd := _fb . NewSldMaster ( ) ;
if ! _eab . AddTarget ( _acf , _bacd , _cafc , uint32 ( len ( _dfg . _dcgbcc ) + 1 ) ) { return nil ; } ; _dfg . _dcgbcc = append ( _dfg . _dcgbcc , _bacd ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _dcgbcc ) ) ; _gaad := _fe . NewRelationships ( ) ;
_eab . AddTarget ( _g . RelationsPathFor ( _acf ) , _gaad . X ( ) , _cafc , 0 ) ; _dfg . _cgdb = append ( _dfg . _cgdb , _gaad ) ; case _cc . SlideLayoutType : if _agd , _cad := _gf . StringToNumbers ( _acf ) ; _cad { _ccgc := _fb . NewSldLayout ( ) ; if ! _eab . AddTarget ( _acf , _ccgc , _cafc , uint32 ( _agd ) ) { return nil ;
} ; for _bfca := len ( _dfg . _fcc ) ; _bfca < _agd ; _bfca ++ { _dfg . _fcc = append ( _dfg . _fcc , _fb . NewSldLayout ( ) ) ; } ; _dfg . _fcc [ _agd - 1 ] = _ccgc ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , _agd ) ; for _baf := len ( _dfg . _ecg ) ; _baf < _agd ;
_baf ++ { _dfg . _ecg = append ( _dfg . _ecg , _fe . NewRelationships ( ) ) ; } ; _facf := _fe . NewRelationships ( ) ; _eab . AddTarget ( _g . RelationsPathFor ( _acf ) , _facf . X ( ) , _cafc , 0 ) ; _dfg . _ecg [ _agd - 1 ] = _facf ; } ; case _cc . ThumbnailType : for _gbg , _feea := range _dcdf { if _feea == nil { continue ;
} ; if _feea . Name == _acf { _dgee , _dcfa := _feea . Open ( ) ; if _dcfa != nil { return _eg . Errorf ( "e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073" , _dcfa ) ; } ; _dfg . Thumbnail , _ , _dcfa = _f . Decode ( _dgee ) ;
_dgee . Close ( ) ; if _dcfa != nil { return _eg . Errorf ( "\u0065\u0072\u0072\u006fr\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020t\u0068u\u006d\u0062\u006e\u0061\u0069\u006c\u003a \u0025\u0073" , _dcfa ) ; } ; _dcdf [ _gbg ] = nil ; } ; } ; case _cc . ThemeType : _ceef := _ged . NewTheme ( ) ;
if ! _eab . AddTarget ( _acf , _ceef , _cafc , uint32 ( len ( _dfg . _caeg ) + 1 ) ) { return nil ; } ; _dfg . _caeg = append ( _dfg . _caeg , _ceef ) ; _bfe . TargetAttr = _cc . RelativeFilename ( _gdf , _cde . Typ , _cafc , len ( _dfg . _caeg ) ) ; _gab := _fe . NewRelationships ( ) ; _eab . AddTarget ( _g . RelationsPathFor ( _acf ) , _gab . X ( ) , _cafc , 0 ) ;
_dfg . _bgde = append ( _dfg . _bgde , _gab ) ; case _cc . ImageType : _acf = _ab . Clean ( _acf ) ; if _ggf , _cafe := _dfg . _gfda [ _acf ] ; _cafe { _bfe . TargetAttr = _ggf ; return nil ; } ; _gdce := "" ; for _abdf , _agdg := range _dcdf { if _agdg == nil { continue ; } ; if _agdg . Name == _acf { _gedd , _aeeg := _g . ExtractToDiskTmp ( _agdg , _dfg . TmpPath ) ;
if _aeeg != nil { return _aeeg ; } ; _bbfa , _aeeg := _fe . ImageFromStorage ( _gedd ) ; if _aeeg != nil { return _aeeg ; } ; _gdce = _bbfa . Format ; _bde := _fe . MakeImageRef ( _bbfa , & _dfg . DocBase , _dfg . _bfce ) ; _bde . SetTarget ( "\u002e\u002e\u002f" + _acf [ 4 : ] ) ; _dfg . Images = append ( _dfg . Images , _bde ) ;
_dcdf [ _abdf ] = nil ; _eggd := len ( _dfg . Images ) ; if _dabf , _fec := _gf . StringToNumbers ( _acf ) ; _fec { _eggd = _dabf ; } ; _eab . RecordIndex ( _acf , _eggd ) ; break ; } ; } ; _bdag := _eab . IndexFor ( _acf ) ; _bfe . TargetAttr = _cc . RelativeImageFilename ( _gdf , _cde . Typ , _cafc , _bdag , _gdce ) ;
_dfg . _gfda [ _acf ] = _bfe . TargetAttr ; default : _a . Log . Debug ( "\u0075\u006e\u0073\u0075\u0070p\u006f\u0072\u0074\u0065\u0064\u0020\u0072\u0065\u006c\u0061\u0074\u0069\u006fn\u0073\u0068\u0069\u0070\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0073\u0020\u0074\u0067\u0074\u003a\u0020\u0025\u0073" , _cafc , _acf ) ;
} ; return nil ; } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ; func _cef ( ) * Presentation { _dae := & Presentation { _bfb : _fb . NewPresentation ( ) } ; _dae . _bfb . SldIdLst = _fb . NewCT_SlideIdList ( ) ; _dae . _bfb . ConformanceAttr = _ec . ST_ConformanceClassTransitional ; _dae . AppProperties = _fe . NewAppProperties ( ) ;
_dae . CoreProperties = _fe . NewCoreProperties ( ) ; _dae . _aagb = _fe . NewTableStyles ( ) ; _dae . ContentTypes = _fe . NewContentTypes ( ) ; _dae . Rels = _fe . NewRelationships ( ) ; _dae . _bfce = _fe . NewRelationships ( ) ; _dae . _eafg = NewPresentationProperties ( ) ; _dae . _ebf = NewViewProperties ( ) ;
_dae . _gfda = map [ string ] string { } ; return _dae ; } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +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 ( _ecf * Presentation ) GetColorBySchemeColor ( schClr _ged . ST_SchemeColorVal ) * _ged . CT_Color { if len ( _ecf . _dcgbcc ) == 0 || len ( _ecf . _caeg ) == 0 { return nil ; } ; var _dgg _ged . ST_ColorSchemeIndex ; _daee := _ecf . _dcgbcc [ 0 ] ; _cbb := _daee . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _dgg = _cbb . Bg1Attr ;
case "\u0062\u0067\u0032" : _dgg = _cbb . Bg2Attr ; case "\u0074\u0078\u0031" : _dgg = _cbb . Tx1Attr ; case "\u0074\u0078\u0032" : _dgg = _cbb . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _dgg = _cbb . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _dgg = _cbb . Accent2Attr ;
case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _dgg = _cbb . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _dgg = _cbb . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _dgg = _cbb . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _dgg = _cbb . Accent6Attr ;
case "\u0068\u006c\u0069n\u006b" : _dgg = _cbb . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _dgg = _cbb . FolHlinkAttr ; case "\u0064\u006b\u0031" : _dgg = _ged . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _dgg = _ged . ST_ColorSchemeIndexDk2 ;
case "\u006c\u0074\u0031" : _dgg = _ged . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _dgg = _ged . ST_ColorSchemeIndexLt2 ; default : _dgg = _ged . ST_ColorSchemeIndexUnset ; } ; _edbb := _ecf . _caeg [ 0 ] ; _cfee := _edbb . ThemeElements ; if _cfee == nil { return nil ;
} ; var _eadd * _ged . CT_Color ; _gdga := _cfee . ClrScheme ; switch _dgg . String ( ) { case "\u0064\u006b\u0031" : _eadd = _gdga . Dk1 ; case "\u0064\u006b\u0032" : _eadd = _gdga . Dk2 ; case "\u006c\u0074\u0031" : _eadd = _gdga . Lt1 ; case "\u006c\u0074\u0032" : _eadd = _gdga . Lt2 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _eadd = _gdga . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _eadd = _gdga . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _eadd = _gdga . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _eadd = _gdga . Accent4 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _eadd = _gdga . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _eadd = _gdga . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _eadd = _gdga . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _eadd = _gdga . FolHlink ;
default : return nil ; } ; return _eadd ; } ;
2023-07-04 11:04:03 +00:00
2024-07-28 07:48:26 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _gbae * Presentation ) GetImageByRelID ( relID string ) ( _fe . ImageRef , bool ) { for _ , _edc := range _gbae . Images { if _edc . RelID ( ) == relID { return _edc , true ; } ; } ; return _fe . ImageRef { } , false ; } ;
2022-04-09 14:27:46 +00:00
2024-07-28 07:48:26 +00:00
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
func NewSlideScreenSize ( ) SlideScreenSize { return NewSlideScreenSizeWithValue ( SlideScreenSize16x9 [ 0 ] , SlideScreenSize16x9 [ 1 ] ) ; } ; var ( SlideScreenSize16x9 = SlideScreenSize { 12192000 , 6858000 } ; SlideScreenSize4x3 = SlideScreenSize { 9144000 , 6858000 } ; SlideScreenSizeA4 = SlideScreenSize { 9906000 , 6858000 } ;
) ;
2021-03-16 20:51:18 +00:00
2024-07-28 07:48:26 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _cgg * Slide ) ExtractText ( ) * SlideText { _agg := _ece ( _cgg . _geed , _cgg . _bbdfd . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _cd . Sort ( sort2d ( _agg ) ) ; return & SlideText { Items : _agg } ; } ;
2024-02-17 03:37:07 +00:00
2024-07-28 07:48:26 +00:00
// MoveSlide moves a slide with given number to position targetPos within a presentation.
func ( _fef * Presentation ) MoveSlide ( slideNumber , targetPos int ) error { if slideNumber < 0 || slideNumber >= len ( _fef . _dbf ) { return _ca . New ( "\u0073\u006c\u0069\u0064eN\u0075\u006d\u0062\u0065\u0072\u0020\u0069\u0073\u0020\u0069\u006e\u0076\u0061\u006ci\u0064" ) ;
} ; if targetPos < 0 || targetPos >= len ( _fef . _dbf ) { return _ca . New ( "t\u0061r\u0067\u0065\u0074\u0050\u006f\u0073\u0020\u0069s\u0020\u0069\u006e\u0076al\u0069\u0064" ) ; } ; if slideNumber == targetPos { return nil ; } ; _dgbf := _fef . _dbf [ slideNumber ] ; _bgag := _fef . _abgdg [ slideNumber ] ;
if slideNumber < targetPos { copy ( _fef . _dbf [ slideNumber : targetPos ] , _fef . _dbf [ slideNumber + 1 : targetPos + 1 ] ) ; copy ( _fef . _abgdg [ slideNumber : targetPos ] , _fef . _abgdg [ slideNumber + 1 : targetPos + 1 ] ) ; } else { copy ( _fef . _dbf [ targetPos + 1 : slideNumber + 1 ] , _fef . _dbf [ targetPos : slideNumber ] ) ;
copy ( _fef . _abgdg [ targetPos + 1 : slideNumber + 1 ] , _fef . _abgdg [ targetPos : slideNumber ] ) ; } ; _fef . _dbf [ targetPos ] = _dgbf ; _fef . _abgdg [ targetPos ] = _bgag ; return nil ; } ;
2023-05-26 09:49:04 +00:00
2024-07-28 07:48:26 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _eafcc Slide ) AddImageToRels ( img _fe . ImageRef ) string { _fgec := 0 ; for _egfa , _aebc := range _eafcc . _geed . Images { if _aebc == img { _fgec = _egfa + 1 ; break ; } ; } ; var _caegb string ; for _afgf , _cgbf := range _eafcc . _geed . Slides ( ) { if _cgbf . _bbdfd == _eafcc . _bbdfd { _abece := _eg . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _fgec , img . Format ( ) ) ;
_eagf := _eafcc . _geed . _abgdg [ _afgf ] . AddRelationship ( _abece , _cc . ImageType ) ; _caegb = _eagf . ID ( ) ; } ; } ; return _caegb ; } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// Save writes the presentation out to a writer in the Zip package format
func ( _bcg * Presentation ) Save ( w _dc . Writer ) error { return _bcg . save ( w , false ) } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// Read reads a document from an io.Reader.
func Read ( r _dc . ReaderAt , size int64 ) ( * Presentation , error ) { const _bdd = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _ge . GetLicenseKey ( ) . IsLicensed ( ) && ! _edfa { _eg . 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" ) ;
_eg . 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" ) ; } ; _fda := _cef ( ) ; _gdd , _eeaa := _ge . GenRefId ( "\u0070\u0072" ) ; if _eeaa != nil { _a . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _eeaa ) ;
return nil , _eeaa ; } ; _fda . _caff = _gdd ; if _bff := _ge . Track ( _fda . _caff , _bdd ) ; _bff != nil { _a . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _bff ) ; return nil , _bff ; } ; _ccea , _eeaa := _c . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ;
if _eeaa != nil { return nil , _eeaa ; } ; _fda . TmpPath = _ccea ; _aca , _eeaa := _df . NewReader ( r , size ) ; if _eeaa != nil { return nil , _eg . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _eeaa ) ; } ; _ada := [ ] * _df . File { } ;
_ada = append ( _ada , _aca . File ... ) ; _becc := false ; for _ , _gccg := range _ada { if _gccg . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _becc = true ; break ; } ; } ; if _becc { _fda . CreateCustomProperties ( ) ;
} ; _dgfa := _g . DecodeMap { } ; _dgfa . SetOnNewRelationshipFunc ( _fda . onNewRelationship ) ; _dgfa . AddTarget ( _cc . ContentTypesFilename , _fda . ContentTypes . X ( ) , "" , 0 ) ; _dgfa . AddTarget ( _cc . BaseRelsFilename , _fda . Rels . X ( ) , "" , 0 ) ; if _afga := _dgfa . Decode ( _ada ) ;
_afga != nil { return nil , _afga ; } ; for _ , _facd := range _ada { if _facd == nil { continue ; } ; if _ffgf := _fda . AddExtraFileFromZip ( _facd ) ; _ffgf != nil { return nil , _ffgf ; } ; } ; if _becc { _dabg := false ; for _ , _bbdfc := range _fda . Rels . X ( ) . Relationship { if _bbdfc . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _dabg = true ;
break ; } ; } ; if ! _dabg { _fda . AddCustomRelationships ( ) ; } ; } ; return _fda , nil ; } ; type chart struct { _geda * _b . ChartSpace ; _abe string ; _gc string ; } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// Type returns the type of the slide layout.
func ( _gcac SlideLayout ) Type ( ) _fb . ST_SlideLayoutType { return _gcac . _badb . TypeAttr } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// Slides returns the slides in the presentation.
func ( _egga * Presentation ) Slides ( ) [ ] Slide { _bagbf := [ ] Slide { } ; for _aafe , _fcd := range _egga . _dbf { _bagbf = append ( _bagbf , Slide { _egga . _bfb . SldIdLst . SldId [ _aafe ] , _fcd , _egga , nil } ) ; } ; return _bagbf ; } ;
2022-02-25 19:20:45 +00:00
2024-07-28 07:48:26 +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 ( _cfcg * Presentation ) AddImage ( i _fe . Image ) ( _fe . ImageRef , error ) { _fccf := _fe . MakeImageRef ( i , & _cfcg . DocBase , _cfcg . _bfce ) ; if i . Data == nil && i . Path == "" { return _fccf , _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 _fccf , _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 _fccf , _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 != "" { _egfg := _c . Add ( i . Path ) ; if _egfg != nil { return _fccf , _egfg ; } ; } ; _cfcg . Images = append ( _cfcg . Images , _fccf ) ; _cfcg . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _cfcg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ;
_cfcg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _cfcg . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _cfcg . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ;
return _fccf , nil ; } ;
2021-08-23 20:44:48 +00:00
2024-07-28 07:48:26 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _ff * SlideText ) Text ( ) string { _geb := _cb . NewBuffer ( [ ] byte { } ) ; for _ , _dcgb := range _ff . Items { if _dcgb . Text != "" { _geb . WriteString ( _dcgb . Text ) ; _geb . WriteString ( "\u000a" ) ; } ; } ; return _geb . String ( ) ; } ;
2021-01-04 16:11:39 +00:00
2024-07-28 07:48:26 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _afgb * Presentation ) RemoveSlide ( s Slide ) error { _dddg := false ; _fbe := 0 ; for _aedg , _dce := range _afgb . _dbf { if _dce == s . _bbdfd { if _afgb . _bfb . SldIdLst . SldId [ _aedg ] != s . _acc { 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 ( _afgb . _dbf [ _aedg : ] , _afgb . _dbf [ _aedg + 1 : ] ) ; _afgb . _dbf = _afgb . _dbf [ 0 : len ( _afgb . _dbf ) - 1 ] ; copy ( _afgb . _abgdg [ _aedg : ] , _afgb . _abgdg [ _aedg + 1 : ] ) ; _afgb . _abgdg = _afgb . _abgdg [ 0 : len ( _afgb . _abgdg ) - 1 ] ; copy ( _afgb . _bfb . SldIdLst . SldId [ _aedg : ] , _afgb . _bfb . SldIdLst . SldId [ _aedg + 1 : ] ) ;
_afgb . _bfb . SldIdLst . SldId = _afgb . _bfb . SldIdLst . SldId [ 0 : len ( _afgb . _bfb . SldIdLst . SldId ) - 1 ] ; _dddg = true ; _fbe = _aedg ; } ; } ; if ! _dddg { return _ca . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ;
} ; _dabc := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideType , 0 ) ; return _afgb . ContentTypes . RemoveOverrideByIndex ( _dabc , _fbe ) ; } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _cfac * Presentation ) SlideMasters ( ) [ ] SlideMaster { _bbgc := [ ] SlideMaster { } ; for _cggg , _ebgf := range _cfac . _dcgbcc { _bbgc = append ( _bbgc , SlideMaster { _cfac , _cfac . _cgdb [ _cggg ] , _ebgf } ) ; } ; return _bbgc ; } ;
2022-04-09 14:27:46 +00:00
2024-07-28 07:48:26 +00:00
// Presentation is the a presentation base document.
type Presentation struct { _fe . DocBase ; _bfb * _fb . Presentation ; _bfce _fe . Relationships ; _dbf [ ] * _fb . Sld ; _abgdg [ ] _fe . Relationships ; _dcgbcc [ ] * _fb . SldMaster ; _cgdb [ ] _fe . Relationships ; _fcc [ ] * _fb . SldLayout ; _ecg [ ] _fe . Relationships ; _caeg [ ] * _ged . Theme ;
_bgde [ ] _fe . Relationships ; _aagb _fe . TableStyles ; _eafg PresentationProperties ; _ebf ViewProperties ; _gcg [ ] * _ged . CT_Hyperlink ; _afg [ ] * chart ; _bac [ ] * _fb . HandoutMaster ; _dbbc [ ] * _fb . NotesMaster ; _dgda [ ] * _cc . XSDAny ; _gfda map [ string ] string ; _caff string ;
} ;
2022-01-15 21:17:38 +00:00
2024-07-28 07:48:26 +00:00
// Size returns slide size value as SlideScreenSize.
func ( _efefd * SlideSize ) Size ( ) SlideScreenSize { return SlideScreenSize { _efefd . _gcdd . CxAttr , _efefd . _gcdd . CyAttr } ; } ;
2021-09-22 16:41:01 +00:00
2024-07-28 07:48:26 +00:00
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _dbg SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _adf := map [ string ] int { } ; _dbfe := [ ] SlideLayout { } ; for _ , _ebfd := range _dbg . _cbge . Relationships ( ) { _eacfc := _ed . Replace ( _ebfd . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ;
_eacfc = _ed . Replace ( _eacfc , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _gffa , _ggfe := _de . ParseInt ( _eacfc , 10 , 32 ) ; _ggfe == nil { _adf [ _ebfd . ID ( ) ] = int ( _gffa ) ; } ; } ; for _ , _ffc := range _dbg . _fae . SldLayoutIdLst . SldLayoutId { if _egbd , _adfe := _adf [ _ffc . RIdAttr ] ;
_adfe { _ebfg := _dbg . _fgee . _fcc [ _egbd - 1 ] ; _dbfe = append ( _dbfe , SlideLayout { _ebfg } ) ; } ; } ; return _dbfe ; } ; func _ece ( _da * Presentation , _ecb [ ] * _fb . CT_GroupShapeChoice , _fc [ ] rectangle , _cfc [ ] * TextItem ) [ ] * TextItem { for _ , _gg := range _ecb { _eb := append ( [ ] rectangle { } , _fc ... ) ;
for _ , _ggd := range _gg . Sp { _cfc = append ( _cfc , _gbe ( _da , _ggd , nil , nil , _ggd . SpPr . Xfrm , 0 , _fc , _ggd . TxBody . P ) ... ) ; } ; for _ , _dg := range _gg . GraphicFrame { if _dg != nil && _dg . Graphic != nil && _dg . Graphic . GraphicData != nil { _eed := _dg . Xfrm ; for _ , _eac := range _dg . Graphic . GraphicData . Any { if _gfea , _dfd := _eac . ( * _ged . Tbl ) ;
_dfd { _aba := & _gfea . CT_Table ; _dgf := 0 ; for _efe , _ebe := range _gfea . Tr { for _cdab , _bea := range _ebe . Tc { _ac := & TableInfo { Table : _aba , Row : _ebe , Cell : _bea , RowIndex : _efe , ColIndex : _cdab } ; _cfc = append ( _cfc , _gbe ( _da , nil , _dg , _ac , _eed , _dgf , _fc , _bea . TxBody . P ) ... ) ;
_dgf ++ ; } ; } ; } ; } ; } ; } ; for _ , _ecc := range _gg . GrpSp { if _ecc . GrpSpPr != nil { _ba := _ecc . GrpSpPr . Xfrm ; var _gbd , _bec int64 ; if _ba . Off != nil { _bcd , _bag := _ba . Off . XAttr . ST_CoordinateUnqualified , _ba . Off . YAttr . ST_CoordinateUnqualified ; if _bcd != nil && _bag != nil { if _ecd := _ba . Ext ;
_ecd != nil { _gbd , _bec = _ecd . CxAttr , _ecd . CyAttr ; } ; _eb = append ( _eb , rectangle { _egg : * _bcd , _dea : * _bag , _ae : * _bcd + _gbd , _ag : * _bag + _bec } ) ; } ; } ; } ; _cfc = _ece ( _da , _ecc . Choice , _eb , _cfc ) ; } ; } ; return _cfc ; } ; func ( _egf * Presentation ) saveToFile ( _agff string , _gbbb bool ) error { _egee , _bdf := _bg . Create ( _agff ) ;
if _bdf != nil { return _bdf ; } ; defer _egee . Close ( ) ; return _egf . save ( _egee , _gbbb ) ; } ;
2022-02-25 19:20:45 +00:00
2024-07-28 07:48:26 +00:00
// Properties returns the properties of the TextBox.
func ( _cbde TextBox ) Properties ( ) _ee . ShapeProperties { if _cbde . _eafa . SpPr == nil { _cbde . _eafa . SpPr = _ged . NewCT_ShapeProperties ( ) ; } ; return _ee . MakeShapeProperties ( _cbde . _eafa . SpPr ) ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _bfbfd * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _afb := range _bfbfd . _fcc { if _afb . CSld . NameAttr != nil && name == * _afb . CSld . NameAttr { return SlideLayout { _afb } , 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" ) ;
} ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +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 ( _ccb * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _fgce , _dbbg := _ccb . AddSlideWithLayout ( l ) ; for _ , _cfdd := range _fgce . PlaceHolders ( ) { _cfdd . Clear ( ) ; switch _cfdd . Type ( ) { case _fb . ST_PlaceholderTypeFtr , _fb . ST_PlaceholderTypeDt , _fb . ST_PlaceholderTypeSldNum : _cfdd . Remove ( ) ;
} ; } ; return _fgce , _dbbg ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// AddTable adds a new table to a placeholder.
func ( _fbcb PlaceHolder ) AddTable ( ) * _fe . Table { _fbcb . Clear ( ) ; _bgb := _fb . NewCT_GroupShapeChoice ( ) ; _fbcb . _bfc . CSld . SpTree . Choice = append ( _fbcb . _bfc . CSld . SpTree . Choice , _bgb ) ; _gda := _fb . NewCT_GraphicalObjectFrame ( ) ; _bgb . GraphicFrame = append ( _bgb . GraphicFrame , _gda ) ;
_gda . Xfrm . Off = _ged . NewCT_Point2D ( ) ; _caf := int64 ( 1 ) ; _gda . Xfrm . Off . XAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _caf } ; _gda . Xfrm . Off . YAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _caf } ; _cbd := _gda . Graphic . CT_GraphicalObject . GraphicData ;
_cbd . 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" ;
_dcgbc := _fe . NewTableWithXfrm ( _gda . Xfrm ) ; _cbd . Any = append ( _cbd . Any , _dcgbc . X ( ) ) ; return _dcgbc ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// ExtLst returns the ExtLst property.
func ( _cbg PresentationProperties ) ExtLst ( ) * _fb . CT_ExtensionList { return _cbg . _fde . ExtLst } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _feedg ViewProperties ) ShowCommentsAttr ( ) * bool { return _feedg . _gedde . ShowCommentsAttr } ; var _edfa = false ;
2021-04-23 20:00:00 +00:00
2024-07-28 07:48:26 +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 ( _cae PlaceHolder ) Clear ( ) { _cae . ClearAll ( ) ; _eaf := _ged . NewCT_TextParagraph ( ) ; _cae . _gd . TxBody . P = [ ] * _ged . CT_TextParagraph { _eaf } ; _eaf . EndParaRPr = _ged . NewCT_TextCharacterProperties ( ) ; _eaf . EndParaRPr . LangAttr = _cc . String ( "\u0065\u006e\u002dU\u0053" ) ;
2024-06-20 13:33:45 +00:00
} ;
2020-06-07 20:13:15 +07:00
2024-07-28 07:48:26 +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 } ; } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _bbb * Slide ) GetChartSpaceByRelId ( relId string ) * _b . ChartSpace { _agca := _bbb . getSlideRels ( ) ; if ( _agca == _fe . Relationships { } ) { return nil ; } ; _fgeca := _agca . GetTargetByRelId ( relId ) ; for _ , _bgc := range _bbb . _geed . _afg { if _fgeca == _bgc . Target ( ) { return _bgc . _geda ;
} ; } ; return nil ; } ; func ( _cda * chart ) RelId ( ) string { return _cda . _abe } ; func ( _defe sort2d ) Swap ( i , j int ) { _defe [ i ] , _defe [ j ] = _defe [ j ] , _defe [ i ] } ;
2017-10-03 09:55:27 -05:00
2024-06-20 13:33:45 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
2024-07-28 07:48:26 +00:00
func ( _ddb * Slide ) GetImageByRelID ( relID string ) ( _fe . ImageRef , bool ) { _beaa := _ddb . getSlideRels ( ) ; if ( _beaa == _fe . Relationships { } ) { return _fe . ImageRef { } , false ; } ; _ggfa := _beaa . GetTargetByRelId ( relID ) ; for _ , _ebb := range _ddb . _geed . Images { if _ebb . Target ( ) == _ggfa { return _ebb , true ;
} ; } ; return _fe . ImageRef { } , false ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// SlideSize returns presentation slide size.
func ( _badf * Presentation ) SlideSize ( ) SlideSize { if _badf . _bfb . SldSz == nil { _badf . _bfb . SldSz = _fb . NewCT_SlideSize ( ) ; } ; return SlideSize { _badf . _bfb . SldSz , _badf } ; } ; func ( _bagg * Slide ) ensureClrMap ( ) { if len ( _bagg . _geed . _dcgbcc ) == 0 || len ( _bagg . _geed . _caeg ) == 0 { return ;
} ; _bdb := _bagg . _geed . _dcgbcc [ 0 ] ; _cgge := _bdb . ClrMap ; if _eaad := _bagg . _bbdfd . ClrMapOvr ; _eaad != nil { if _cbdd := _eaad . Choice ; _cbdd != nil { if _cbdd . MasterClrMapping == nil { if _cga := _cbdd . OverrideClrMapping ; _cga != nil { if _cga . Bg1Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Bg1Attr = _cga . Bg1Attr ;
} ; if _cga . Tx1Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Tx1Attr = _cga . Tx1Attr ; } ; if _cga . Bg2Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Bg2Attr = _cga . Bg2Attr ; } ; if _cga . Tx2Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Tx2Attr = _cga . Tx2Attr ;
} ; if _cga . Accent1Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent1Attr = _cga . Accent1Attr ; } ; if _cga . Accent2Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent2Attr = _cga . Accent2Attr ; } ; if _cga . Accent3Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent3Attr = _cga . Accent3Attr ;
} ; if _cga . Accent4Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent4Attr = _cga . Accent4Attr ; } ; if _cga . Accent5Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent5Attr = _cga . Accent5Attr ; } ; if _cga . Accent6Attr != _ged . ST_ColorSchemeIndexUnset { _cgge . Accent6Attr = _cga . Accent6Attr ;
} ; if _cga . HlinkAttr != _ged . ST_ColorSchemeIndexUnset { _cgge . HlinkAttr = _cga . HlinkAttr ; } ; if _cga . FolHlinkAttr != _ged . ST_ColorSchemeIndexUnset { _cgge . FolHlinkAttr = _cga . FolHlinkAttr ; } ; } ; } ; } ; } ; _bagg . _gbeb = _cgge ; } ;
2023-04-15 17:27:31 +00:00
2024-07-28 07:48:26 +00:00
// ShowPr returns the ShowPr property.
func ( _ace PresentationProperties ) ShowPr ( ) * _fb . CT_ShowProperties { return _ace . _fde . ShowPr } ;
2021-01-04 16:11:39 +00:00
2024-06-20 13:33:45 +00:00
// OutlineViewPr returns the OutlineViewPr property.
2024-07-28 07:48:26 +00:00
func ( _fcf ViewProperties ) OutlineViewPr ( ) * _fb . CT_OutlineViewProperties { return _fcf . _gedde . OutlineViewPr ; } ;
2021-01-04 16:11:39 +00:00
2024-07-28 07:48:26 +00:00
// AddTable adds an empty table to a slide.
func ( _ebee Slide ) AddTable ( ) * _fe . Table { _fede := _fb . NewCT_GroupShapeChoice ( ) ; _ebee . _bbdfd . CSld . SpTree . Choice = append ( _ebee . _bbdfd . CSld . SpTree . Choice , _fede ) ; _gdfdf := _fb . NewCT_GraphicalObjectFrame ( ) ; _fede . GraphicFrame = append ( _fede . GraphicFrame , _gdfdf ) ;
_gdfdf . Xfrm . Off = _ged . NewCT_Point2D ( ) ; _fgcg := int64 ( 1 ) ; _gdfdf . Xfrm . Off . XAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _fgcg } ; _gdfdf . Xfrm . Off . YAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _fgcg } ; _beae := _gdfdf . Graphic . CT_GraphicalObject . GraphicData ;
_beae . 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" ;
_cbaf := _fe . NewTableWithXfrm ( _gdfdf . Xfrm ) ; _beae . Any = append ( _beae . Any , _cbaf . X ( ) ) ; return _cbaf ; } ;
2022-09-02 11:46:53 +00:00
2024-07-28 07:48:26 +00:00
// Index returns the placeholder index
func ( _bda PlaceHolder ) Index ( ) uint32 { if _bda . _gd . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _bda . _gd . NvSpPr . NvPr . Ph . IdxAttr ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +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 * _ged . CT_Table ; Row * _ged . CT_TableRow ; Cell * _ged . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2022-09-02 11:46:53 +00:00
2024-07-28 07:48:26 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _fde : _fb . NewPresentationPr ( ) } ; } ;
2023-12-28 15:53:06 +00:00
2024-07-28 07:48:26 +00:00
// SetHeight sets height of slide screen size with given value in EMU units.
func ( _eddd * SlideScreenSize ) SetHeight ( val int32 ) { _eddd [ 1 ] = val } ;
2021-09-22 16:41:01 +00:00
2024-06-20 13:33:45 +00:00
// X returns the inner wrapped XML type.
2024-07-28 07:48:26 +00:00
func ( _aef * Presentation ) X ( ) * _fb . Presentation { return _aef . _bfb } ;
2021-09-22 16:41:01 +00:00
2024-07-28 07:48:26 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _baa * PresentationText ) Text ( ) string { _bgg := _cb . NewBuffer ( [ ] byte { } ) ; for _ , _eda := range _baa . Slides { _bgg . WriteString ( _eda . Text ( ) ) ; } ; return _bgg . String ( ) ; } ;
2021-09-22 16:41:01 +00:00
2024-07-28 07:48:26 +00:00
// Remove removes a placeholder from a presentation.
func ( _abb PlaceHolder ) Remove ( ) error { for _gba , _dbb := range _abb . _bfc . CSld . SpTree . Choice { for _ , _dcff := range _dbb . Sp { if _dcff == _abb . _gd { copy ( _abb . _bfc . CSld . SpTree . Choice [ _gba : ] , _abb . _bfc . CSld . SpTree . Choice [ _gba + 1 : ] ) ; _abb . _bfc . CSld . SpTree . Choice = _abb . _bfc . CSld . SpTree . Choice [ 0 : len ( _abb . _bfc . 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" ) ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// GetLayoutImageByRelID returns an ImageRef with the associated relation ID in the
// slide layout.
func ( _eged * Slide ) GetLayoutImageByRelID ( relID string ) ( _fe . ImageRef , bool ) { _aegc := _eged . getSlideLayoutRels ( ) ; if ( _aegc == _fe . Relationships { } ) { return _fe . ImageRef { } , false ; } ; _fefb := _aegc . GetTargetByRelId ( relID ) ; for _ , _efga := range _eged . _geed . Images { if _efga . Target ( ) == _fefb { return _efga , true ;
} ; } ; return _fe . ImageRef { } , false ; } ;
2021-09-22 16:41:01 +00:00
2024-07-28 07:48:26 +00:00
// Type returns the placeholder type
func ( _fge PlaceHolder ) Type ( ) _fb . ST_PlaceholderType { return _fge . _gd . NvSpPr . NvPr . Ph . TypeAttr } ;
2022-09-02 11:46:53 +00:00
2024-07-28 07:48:26 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _eggg * Presentation ) ExtractText ( ) * PresentationText { _cf := [ ] * SlideText { } ; for _ , _gb := range _eggg . Slides ( ) { _bga := _gb . ExtractText ( ) ; if _bga != nil { _cf = append ( _cf , _bga ) ; } ; } ; return & PresentationText { Slides : _cf } ; } ;
2022-09-02 11:46:53 +00:00
2024-07-28 07:48:26 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _cdc PresentationProperties ) HtmlPubPr ( ) * _fb . CT_HtmlPublishProperties { return _cdc . _fde . HtmlPubPr ; } ;
2022-12-06 11:56:49 +00:00
2024-07-28 07:48:26 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _acc * _fb . CT_SlideIdListEntry ; _bbdfd * _fb . Sld ; _geed * Presentation ; _gbeb * _ged . CT_ColorMapping ; } ;
2022-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// SlideSize represents a slide size of a presentation.
type SlideSize struct { _gcdd * _fb . CT_SlideSize ; _cbbg * Presentation ; } ; func ( _cddb * Presentation ) addLayoutFromSlide ( _dgb Slide ) error { _agc := 1 ; for _ , _ccd := range _cddb . Images { if _abac , _daga := _gf . StringToNumbers ( _ccd . Target ( ) ) ; _daga && _abac >= _agc { _agc = _abac + 1 ;
} ; } ; _cddb . _fcc = append ( _cddb . _fcc , _dgb . GetSlideLayout ( ) ) ; _bfbf := _dgb . getSlideLayoutRels ( ) ; for _ , _ffa := range _bfbf . X ( ) . Relationship { if _ffa . TypeAttr == _cc . ImageType { _adge , _gbac := _dgb . _geed . GetImageByTarget ( _ffa . TargetAttr ) ; if _gbac { if _eea , _dda := _gf . StringToNumbers ( _adge . Target ( ) ) ;
_dda && _eea < _agc { _adge . SetTarget ( _ed . ReplaceAll ( _adge . Target ( ) , _eg . Sprint ( _eea ) , _eg . Sprint ( _agc ) ) ) ; _ffa . TargetAttr = _adge . Target ( ) ; _agc = _agc + 1 ; } ; _cddb . Images = append ( _cddb . Images , _adge ) ; } ; } ; } ; _cddb . _ecg = append ( _cddb . _ecg , _bfbf ) ;
if len ( _cddb . _dcgbcc ) > 0 && len ( _cddb . _cgdb ) > 0 { _aee := _cddb . _cgdb [ 0 ] . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideMasterType , len ( _cddb . _fcc ) , _cc . SlideLayoutType ) ; _fffe := _fb . NewCT_SlideLayoutIdListEntry ( ) ; _fffe . IdAttr = _cc . Uint32 ( 2147483649 ) ;
_fffe . RIdAttr = _aee . ID ( ) ; for _ , _cgdc := range _cddb . _dcgbcc [ 0 ] . SldLayoutIdLst . SldLayoutId { if * _cgdc . IdAttr >= * _fffe . IdAttr { _fffe . IdAttr = _cc . Uint32 ( ( * _cgdc . IdAttr + 1 ) ) ; } ; } ; _cddb . _dcgbcc [ 0 ] . SldLayoutIdLst . SldLayoutId = append ( _cddb . _dcgbcc [ 0 ] . SldLayoutIdLst . SldLayoutId , _fffe ) ;
} ; _bbdf := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideLayoutType , len ( _cddb . _fcc ) ) ; _cddb . ContentTypes . AddOverride ( _bbdf , _cc . SlideLayoutContentType ) ; return nil ; } ;
2022-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _aebf * SlideSize ) X ( ) * _fb . CT_SlideSize { return _aebf . _gcdd } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +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 ( _bfbc * Slide ) GetColorBySchemeColor ( schClr _ged . ST_SchemeColorVal ) * _ged . CT_Color { _bfbc . ensureClrMap ( ) ; _acb := _bfbc . _gbeb ; if _acb == nil { return nil ; } ; var _adgb _ged . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _adgb = _acb . Bg1Attr ;
case "\u0062\u0067\u0032" : _adgb = _acb . Bg2Attr ; case "\u0074\u0078\u0031" : _adgb = _acb . Tx1Attr ; case "\u0074\u0078\u0032" : _adgb = _acb . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _adgb = _acb . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _adgb = _acb . Accent2Attr ;
case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _adgb = _acb . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _adgb = _acb . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _adgb = _acb . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _adgb = _acb . Accent6Attr ;
case "\u0068\u006c\u0069n\u006b" : _adgb = _acb . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _adgb = _acb . FolHlinkAttr ; case "\u0064\u006b\u0031" : _adgb = _ged . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _adgb = _ged . ST_ColorSchemeIndexDk2 ;
case "\u006c\u0074\u0031" : _adgb = _ged . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _adgb = _ged . ST_ColorSchemeIndexLt2 ; default : _adgb = _ged . ST_ColorSchemeIndexUnset ; } ; _bfbab := _bfbc . _geed . _caeg [ 0 ] ; _bbfeg := _bfbab . ThemeElements ; if _bbfeg == nil { return nil ;
} ; var _aeef * _ged . CT_Color ; _fcdf := _bbfeg . ClrScheme ; switch _adgb . String ( ) { case "\u0064\u006b\u0031" : _aeef = _fcdf . Dk1 ; case "\u0064\u006b\u0032" : _aeef = _fcdf . Dk2 ; case "\u006c\u0074\u0031" : _aeef = _fcdf . Lt1 ; case "\u006c\u0074\u0032" : _aeef = _fcdf . Lt2 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _aeef = _fcdf . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _aeef = _fcdf . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _aeef = _fcdf . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _aeef = _fcdf . Accent4 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _aeef = _fcdf . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _aeef = _fcdf . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _aeef = _fcdf . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _aeef = _fcdf . FolHlink ;
default : return nil ; } ; return _aeef ; } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// PrnPr returns the PrnPr property.
func ( _bbf PresentationProperties ) PrnPr ( ) * _fb . CT_PrintProperties { return _bbf . _fde . PrnPr } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _agcac ViewProperties ) X ( ) * _fb . ViewPr { return _agcac . _gedde } ;
2023-04-15 17:27:31 +00:00
2024-07-28 07:48:26 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _dd , _fbca := _bg . Open ( filename ) ; if _fbca != nil { return nil , _eg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fbca ) ; } ; defer _dd . Close ( ) ;
_feb , _fbca := _bg . Stat ( filename ) ; if _fbca != nil { return nil , _eg . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _fbca ) ; } ; _ = _feb ; return Read ( _dd , _feb . Size ( ) ) ; } ;
2023-04-15 17:27:31 +00:00
2024-06-20 13:33:45 +00:00
// AddParagraph adds a paragraph to the text box
2024-07-28 07:48:26 +00:00
func ( _cbbc TextBox ) AddParagraph ( ) _ee . Paragraph { _fafa := _ged . NewCT_TextParagraph ( ) ; _cbbc . _eafa . TxBody . P = append ( _cbbc . _eafa . TxBody . P , _fafa ) ; return _ee . MakeParagraph ( _fafa ) ; } ; func _gde ( _cdbc [ ] * _fb . CT_GroupShapeChoice ) [ ] * _fb . CT_GroupShapeChoice { var _bgfc [ ] * _fb . CT_GroupShapeChoice ;
for _ , _fed := range _cdbc { if len ( _fed . Pic ) == 0 { _bgfc = append ( _bgfc , _fed ) ; } ; } ; return _bgfc ; } ;
2021-11-10 11:45:21 +00:00
2024-07-28 07:48:26 +00:00
// SetTextAnchor controls the text anchoring
func ( _eec TextBox ) SetTextAnchor ( a _ged . ST_TextAnchoringType ) { _eec . _eafa . TxBody . BodyPr = _ged . NewCT_TextBodyProperties ( ) ; _eec . _eafa . TxBody . BodyPr . AnchorAttr = a ; } ; func ( _dde * Slide ) getSlideRels ( ) _fe . Relationships { _bagf := _dde . _geed ; for _bfba , _eace := range _bagf . Slides ( ) { if * _dde . _bbdfd == * _eace . _bbdfd { return _bagf . _abgdg [ _bfba ] ;
} ; } ; return _fe . Relationships { } ; } ;
2022-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// GetSlideLayout returns a slide layout related to the slide.
func ( _bbc * Slide ) GetSlideLayout ( ) * _fb . SldLayout { _fecb := _bbc . getSlideRels ( ) ; for _ , _gdcd := range _fecb . Relationships ( ) { if _gdcd . Type ( ) == _cc . SlideLayoutType { if _ffgb , _gbdfg := _gf . StringToNumbers ( _gdcd . Target ( ) ) ; _gbdfg { return _bbc . _geed . _fcc [ _ffgb - 1 ] ;
} ; return nil ; } ; } ; return nil ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// ClrMru returns the ClrMru property.
func ( _abbd PresentationProperties ) ClrMru ( ) * _ged . CT_ColorMRU { return _abbd . _fde . ClrMru } ;
2022-04-09 14:27:46 +00:00
2024-06-20 13:33:45 +00:00
// NormalViewPr returns the NormalViewPr property.
2024-07-28 07:48:26 +00:00
func ( _fdcf ViewProperties ) NormalViewPr ( ) * _fb . CT_NormalViewProperties { return _fdcf . _gedde . NormalViewPr ; } ;
2022-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// Name returns the name of the slide layout.
func ( _cabb SlideLayout ) Name ( ) string { if _cabb . _badb . CSld != nil && _cabb . _badb . CSld . NameAttr != nil { return * _cabb . _badb . CSld . NameAttr ; } ; return "" ; } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +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 ( _fdda Slide ) GetPlaceholder ( t _fb . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _fbb := range _fdda . _bbdfd . CSld . SpTree . Choice { for _ , _bcb := range _fbb . Sp { if _bcb . NvSpPr != nil && _bcb . NvSpPr . NvPr != nil && _bcb . NvSpPr . NvPr . Ph != nil { if _bcb . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _bcb , _fdda . _bbdfd } , 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-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _fde * _fb . PresentationPr } ;
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _ddc PlaceHolder ) ClearAll ( ) { _ddc . _gd . SpPr = _ged . NewCT_ShapeProperties ( ) ; _ddc . _gd . TxBody = _ged . NewCT_TextBody ( ) ; _ddc . _gd . TxBody . LstStyle = _ged . NewCT_TextListStyle ( ) ; } ; func ( _agfc * Presentation ) nextSlideID ( ) uint32 { _fea := uint32 ( 256 ) ;
for _ , _dcd := range _agfc . _bfb . SldIdLst . SldId { if _dcd . IdAttr >= _fea { _fea = _dcd . IdAttr + 1 ; } ; } ; return _fea ; } ;
// 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 ( _eadf * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _bbda := _fb . NewCT_SlideIdListEntry ( ) ; _bbda . IdAttr = _eadf . nextSlideID ( ) ; _eadf . _bfb . SldIdLst . SldId = append ( _eadf . _bfb . SldIdLst . SldId , _bbda ) ; _gcf := _fb . NewSld ( ) ;
_aeb := _cb . Buffer { } ; _edde := _af . NewEncoder ( & _aeb ) ; _gbef := _af . StartElement { Name : _af . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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" } ) ;
_gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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" } ) ;
_gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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" } ) ;
_gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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" } ) ;
_gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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" } ) ;
_gbef . Attr = append ( _gbef . Attr , _af . Attr { Name : _af . 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 _bbg := l . _badb . CSld . MarshalXML ( _edde , _gbef ) ; _bbg != nil { return Slide { } , _bbg ; } ; _edde . Flush ( ) ; _dag := _af . NewDecoder ( & _aeb ) ; _gcf . CSld = _fb . NewCT_CommonSlideData ( ) ; if _aea := _dag . Decode ( _gcf . CSld ) ; _aea != nil { return Slide { } , _aea ; } ;
_gcf . CSld . NameAttr = nil ; _gcf . CSld . SpTree . Choice = _gde ( _gcf . CSld . SpTree . Choice ) ; _eadf . _dbf = append ( _eadf . _dbf , _gcf ) ; _gbf := _eadf . _bfce . AddAutoRelationship ( _cc . DocTypePresentation , _cc . OfficeDocumentType , len ( _eadf . _dbf ) , _cc . SlideType ) ;
_bbda . RIdAttr = _gbf . ID ( ) ; _adc := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideType , len ( _eadf . _dbf ) ) ; _eadf . ContentTypes . AddOverride ( _adc , _cc . SlideContentType ) ; _fbcbf := _fe . NewRelationships ( ) ; _eadf . _abgdg = append ( _eadf . _abgdg , _fbcbf ) ;
_adg := len ( _eadf . _abgdg ) - 1 ; for _fdd , _cbdc := range _eadf . _fcc { if _cbdc == l . X ( ) { _acef := _eadf . _ecg [ _fdd ] ; for _ , _bbde := range _acef . X ( ) . Relationship { if _bbde . TypeAttr != _cc . SlideMasterType { _eadf . _abgdg [ _adg ] . X ( ) . Relationship = append ( _eadf . _abgdg [ _adg ] . X ( ) . Relationship , _bbde ) ;
} ; } ; _fbcbf . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideType , _fdd + 1 , _cc . SlideLayoutType ) ; } ; } ; _gcc := Slide { _bbda , _gcf , _eadf , nil } ; return _gcc , nil ; } ;
2022-02-05 13:05:36 +00:00
2024-06-20 13:33:45 +00:00
// Less is for implementing sorting of two locations. Symbols share the same location if they are in the same paragraph or table. One location is 'less' than another first by y coordinate, if y coordinates are equal or differ by less than yEpsilon, then x coordinates are compared, then if they are also equal, indexes of locations in the table are compared, then positions of locations in a paragraph.
2024-07-28 07:48:26 +00:00
func ( _dcb sort2d ) Less ( i , j int ) bool { _ggb , _fd := _dcb [ i ] , _dcb [ j ] ; _ccf , _edf := _ggb . _cg , _fd . _cg ; _cfgd , _fgd := len ( _ccf ) - 1 , len ( _edf ) - 1 ; _ggc , _fgb := 0 , 0 ; for { _fa , _fff , _dge , _gede , _deg , _bb , _fcgg , _efc := _ccf [ _ggc ] . _dea , _edf [ _fgb ] . _dea , _ccf [ _ggc ] . _ag , _edf [ _fgb ] . _ag , _ccf [ _ggc ] . _egg , _edf [ _fgb ] . _egg , _ccf [ _ggc ] . _ae , _edf [ _fgb ] . _ae ;
if _fa == _fff || ( ( _be . Abs ( float64 ( _fa ) - float64 ( _fff ) ) < _agf ) && ( ( _fa >= _fff && _fa <= _gede ) || ( _fff >= _fa && _fff <= _dge ) ) && ( _fcgg < _bb || _deg > _efc ) ) { if _deg == _bb { if _ggc < _cfgd && _fgb < _fgd { _ggc ++ ; _fgb ++ ; continue ; } ; if _ggc >= _cfgd && _fgb >= _fgd { break ;
} ; return _ggc >= _cfgd ; } else { return _deg < _bb ; } ; } else { return _fa < _fff ; } ; } ; _aeg , _ccg , _abgd , _cce := _ggb . _cdb , _fd . _cdb , _ggb . _bc , _fd . _bc ; if _aeg == _ccg { return _abgd <= _cce ; } ; return _aeg < _ccg ; } ;
2023-04-15 17:27:31 +00:00
2024-07-28 07:48:26 +00:00
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _badb * _fb . SldLayout } ;
2024-06-20 13:33:45 +00:00
2024-07-28 07:48:26 +00:00
// New initializes and returns a new presentation
func New ( ) * Presentation { _aggd := _cef ( ) ; _aggd . 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" ) ;
_aggd . 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" ) ;
_aggd . 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" ) ;
_aggd . 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" ) ;
_aggd . 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" ) ;
_aggd . 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" ) ;
_aggd . 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\u0061\u0062\u006c\u0065\u0053\u0074\u0079\u006ce\u0073" ) ;
_aggd . _bfb . SldMasterIdLst = _fb . NewCT_SlideMasterIdList ( ) ; _fce := _fb . NewSldMaster ( ) ; _fce . ClrMap . Bg1Attr = _ged . ST_ColorSchemeIndexLt1 ; _fce . ClrMap . Bg2Attr = _ged . ST_ColorSchemeIndexLt2 ; _fce . ClrMap . Tx1Attr = _ged . ST_ColorSchemeIndexDk1 ; _fce . ClrMap . Tx2Attr = _ged . ST_ColorSchemeIndexDk2 ;
_fce . ClrMap . Accent1Attr = _ged . ST_ColorSchemeIndexAccent1 ; _fce . ClrMap . Accent2Attr = _ged . ST_ColorSchemeIndexAccent2 ; _fce . ClrMap . Accent3Attr = _ged . ST_ColorSchemeIndexAccent3 ; _fce . ClrMap . Accent4Attr = _ged . ST_ColorSchemeIndexAccent4 ; _fce . ClrMap . Accent5Attr = _ged . ST_ColorSchemeIndexAccent5 ;
_fce . ClrMap . Accent6Attr = _ged . ST_ColorSchemeIndexAccent6 ; _fce . ClrMap . HlinkAttr = _ged . ST_ColorSchemeIndexHlink ; _fce . ClrMap . FolHlinkAttr = _ged . ST_ColorSchemeIndexFolHlink ; _aggd . _dcgbcc = append ( _aggd . _dcgbcc , _fce ) ; _bgf := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideMasterType , 1 ) ;
_aggd . ContentTypes . AddOverride ( _bgf , _cc . SlideMasterContentType ) ; _ead := _aggd . _bfce . AddAutoRelationship ( _cc . DocTypePresentation , _cc . OfficeDocumentType , 1 , _cc . SlideMasterType ) ; _ad := _fb . NewCT_SlideMasterIdListEntry ( ) ; _ad . IdAttr = _cc . Uint32 ( 2147483648 ) ;
_ad . RIdAttr = _ead . ID ( ) ; _aggd . _bfb . SldMasterIdLst . SldMasterId = append ( _aggd . _bfb . SldMasterIdLst . SldMasterId , _ad ) ; _fdef := _fe . NewRelationships ( ) ; _aggd . _cgdb = append ( _aggd . _cgdb , _fdef ) ; _cgb := _fb . NewSldLayout ( ) ; _dcc := _fdef . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideMasterType , 1 , _cc . SlideLayoutType ) ;
_eeg := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideLayoutType , 1 ) ; _aggd . ContentTypes . AddOverride ( _eeg , _cc . SlideLayoutContentType ) ; _fdef . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideMasterType , 1 , _cc . ThemeType ) ; _aggd . _fcc = append ( _aggd . _fcc , _cgb ) ;
_fce . SldLayoutIdLst = _fb . NewCT_SlideLayoutIdList ( ) ; _eegf := _fb . NewCT_SlideLayoutIdListEntry ( ) ; _eegf . IdAttr = _cc . Uint32 ( 2147483649 ) ; _eegf . RIdAttr = _dcc . ID ( ) ; _fce . SldLayoutIdLst . SldLayoutId = append ( _fce . SldLayoutIdLst . SldLayoutId , _eegf ) ;
_edb := _fe . NewRelationships ( ) ; _aggd . _ecg = append ( _aggd . _ecg , _edb ) ; _edb . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideType , 1 , _cc . SlideMasterType ) ; _aggd . _bfb . NotesSz . CxAttr = 6858000 ; _aggd . _bfb . NotesSz . CyAttr = 9144000 ; _ddf := _ged . NewTheme ( ) ;
_ddf . NameAttr = _cc . String ( "\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065" ) ; _ddf . ThemeElements . ClrScheme . NameAttr = "\u004f\u0066\u0066\u0069\u0063\u0065" ; _ddf . ThemeElements . ClrScheme . Dk1 . SysClr = _ged . NewCT_SystemColor ( ) ;
_ddf . ThemeElements . ClrScheme . Dk1 . SysClr . LastClrAttr = _cc . String ( "\u0030\u0030\u0030\u0030\u0030\u0030" ) ; _ddf . ThemeElements . ClrScheme . Dk1 . SysClr . ValAttr = _ged . ST_SystemColorValWindowText ; _ddf . ThemeElements . ClrScheme . Lt1 . SysClr = _ged . NewCT_SystemColor ( ) ;
_ddf . ThemeElements . ClrScheme . Lt1 . SysClr . LastClrAttr = _cc . String ( "\u0066\u0066\u0066\u0066\u0066\u0066" ) ; _ddf . ThemeElements . ClrScheme . Lt1 . SysClr . ValAttr = _ged . ST_SystemColorValWindow ; _ddf . ThemeElements . ClrScheme . Dk2 . SrgbClr = _ged . NewCT_SRgbColor ( ) ;
_ddf . ThemeElements . ClrScheme . Dk2 . SrgbClr . ValAttr = "\u0034\u0034\u0035\u0034\u0036\u0061" ; _ddf . ThemeElements . ClrScheme . Lt2 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Lt2 . SrgbClr . ValAttr = "\u0065\u0037\u0065\u0037\u0065\u0036" ;
_ddf . ThemeElements . ClrScheme . Accent1 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent1 . SrgbClr . ValAttr = "\u0034\u0034\u0037\u0032\u0063\u0034" ; _ddf . ThemeElements . ClrScheme . Accent2 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent2 . SrgbClr . ValAttr = "\u0065\u0064\u0037\u0064\u0033\u0031" ;
_ddf . ThemeElements . ClrScheme . Accent3 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent3 . SrgbClr . ValAttr = "\u0061\u0035\u0061\u0035\u0061\u0035" ; _ddf . ThemeElements . ClrScheme . Accent4 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent4 . SrgbClr . ValAttr = "\u0066\u0066\u0063\u0030\u0030\u0030" ;
_ddf . ThemeElements . ClrScheme . Accent5 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent5 . SrgbClr . ValAttr = "\u0035\u0062\u0039\u0062\u0064\u0035" ; _ddf . ThemeElements . ClrScheme . Accent6 . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Accent6 . SrgbClr . ValAttr = "\u0037\u0030\u0061\u0064\u0034\u0037" ;
_ddf . ThemeElements . ClrScheme . Hlink . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . Hlink . SrgbClr . ValAttr = "\u0030\u0035\u0036\u0033\u0063\u0031" ; _ddf . ThemeElements . ClrScheme . FolHlink . SrgbClr = _ged . NewCT_SRgbColor ( ) ; _ddf . ThemeElements . ClrScheme . FolHlink . SrgbClr . ValAttr = "\u0039\u0035\u0034\u0066\u0037\u0032" ;
_ddf . ThemeElements . FontScheme . NameAttr = "\u004f\u0066\u0066\u0069\u0063\u0065" ; _ddf . ThemeElements . FontScheme . MajorFont . Latin . TypefaceAttr = "\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074" ; _ddf . ThemeElements . FontScheme . MinorFont . Latin . TypefaceAttr = "\u0043a\u006c\u0069\u0062\u0072\u0069" ;
_ddf . ThemeElements . FmtScheme . NameAttr = _cc . String ( "\u004f\u0066\u0066\u0069\u0063\u0065" ) ; _dgdc := _ged . NewEG_FillProperties ( ) ; _ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _dgdc ) ;
_dgdc . SolidFill = & _ged . CT_SolidColorFillProperties { SchemeClr : & _ged . CT_SchemeColor { ValAttr : _ged . ST_SchemeColorValPhClr } } ; _dgdc = _ged . NewEG_FillProperties ( ) ; _ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _dgdc ) ;
_ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _dgdc ) ; _dgdc . GradFill = & _ged . CT_GradientFillProperties { RotWithShapeAttr : _cc . Bool ( true ) , GsLst : & _ged . CT_GradientStopList { } , Lin : & _ged . CT_LinearShadeProperties { } } ;
_dgdc . GradFill . Lin . AngAttr = _cc . Int32 ( 5400000 ) ; _dgdc . GradFill . Lin . ScaledAttr = _cc . Bool ( false ) ; _cfd := _ged . NewCT_GradientStop ( ) ; _cfd . PosAttr . ST_PositiveFixedPercentageDecimal = _cc . Int32 ( 0 ) ; _cfd . SchemeClr = & _ged . CT_SchemeColor { ValAttr : _ged . ST_SchemeColorValPhClr } ;
_dgdc . GradFill . GsLst . Gs = append ( _dgdc . GradFill . GsLst . Gs , _cfd ) ; _cfd = _ged . NewCT_GradientStop ( ) ; _cfd . PosAttr . ST_PositiveFixedPercentageDecimal = _cc . Int32 ( 50000 ) ; _cfd . SchemeClr = & _ged . CT_SchemeColor { ValAttr : _ged . ST_SchemeColorValPhClr } ;
_dgdc . GradFill . GsLst . Gs = append ( _dgdc . GradFill . GsLst . Gs , _cfd ) ; _ddf . ThemeElements . FmtScheme . LnStyleLst = _ged . NewCT_LineStyleList ( ) ; for _ga := 0 ; _ga < 3 ; _ga ++ { _cdaa := _ged . NewCT_LineProperties ( ) ; _cdaa . WAttr = _cc . Int32 ( int32 ( 6350 * ( _ga + 1 ) ) ) ;
_cdaa . CapAttr = _ged . ST_LineCapFlat ; _cdaa . CmpdAttr = _ged . ST_CompoundLineSng ; _cdaa . AlgnAttr = _ged . ST_PenAlignmentCtr ; _ddf . ThemeElements . FmtScheme . LnStyleLst . Ln = append ( _ddf . ThemeElements . FmtScheme . LnStyleLst . Ln , _cdaa ) ; } ; _ddf . ThemeElements . FmtScheme . EffectStyleLst = _ged . NewCT_EffectStyleList ( ) ;
for _abfb := 0 ; _abfb < 3 ; _abfb ++ { _dab := _ged . NewCT_EffectStyleItem ( ) ; _dab . EffectLst = _ged . NewCT_EffectList ( ) ; _ddf . ThemeElements . FmtScheme . EffectStyleLst . EffectStyle = append ( _ddf . ThemeElements . FmtScheme . EffectStyleLst . EffectStyle , _dab ) ; } ;
_bdg := _ged . NewEG_FillProperties ( ) ; _bdg . SolidFill = & _ged . CT_SolidColorFillProperties { SchemeClr : & _ged . CT_SchemeColor { ValAttr : _ged . ST_SchemeColorValPhClr } } ; _ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _bdg ) ;
_ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _bdg ) ; _ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _ddf . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _dgdc ) ;
_aggd . _caeg = append ( _aggd . _caeg , _ddf ) ; _efbac := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . ThemeType , 1 ) ; _aggd . ContentTypes . AddOverride ( _efbac , _cc . ThemeContentType ) ; _aggd . _bfce . AddAutoRelationship ( _cc . DocTypePresentation , _cc . OfficeDocumentType , 1 , _cc . ThemeType ) ;
_eef := _fe . NewRelationships ( ) ; _aggd . _bgde = append ( _aggd . _bgde , _eef ) ; return _aggd ; } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// Width returns slide screen size width in EMU units.
func ( _dcge * SlideScreenSize ) Width ( ) int32 { return _dcge [ 0 ] } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// Sid returns the sid of slide
func ( _cgf Slide ) Sid ( ) * _fb . CT_SlideIdListEntry { return _cgf . _acc } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _gedde : _fb . NewViewPr ( ) } } ;
// AddImage adds an image textbox to a slide.
func ( _gcag Slide ) AddImage ( img _fe . ImageRef ) Image { _aaag := _fb . NewCT_GroupShapeChoice ( ) ; _gcag . _bbdfd . CSld . SpTree . Choice = append ( _gcag . _bbdfd . CSld . SpTree . Choice , _aaag ) ; _eafc := _fb . NewCT_Picture ( ) ; _aaag . Pic = append ( _aaag . Pic , _eafc ) ;
_eafc . NvPicPr . CNvPicPr = _ged . NewCT_NonVisualPictureProperties ( ) ; _eafc . NvPicPr . CNvPicPr . PicLocks = _ged . NewCT_PictureLocking ( ) ; _eafc . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _cc . Bool ( true ) ; _eafc . BlipFill = _ged . NewCT_BlipFillProperties ( ) ;
_eafc . BlipFill . Blip = _ged . NewCT_Blip ( ) ; _gaga := _gcag . AddImageToRels ( img ) ; _eafc . BlipFill . Blip . EmbedAttr = _cc . String ( _gaga ) ; _eafc . BlipFill . Stretch = _ged . NewCT_StretchInfoProperties ( ) ; _eafc . BlipFill . Stretch . FillRect = _ged . NewCT_RelativeRect ( ) ;
_eafc . SpPr = _ged . NewCT_ShapeProperties ( ) ; _eafc . SpPr . PrstGeom = _ged . NewCT_PresetGeometry2D ( ) ; _eafc . SpPr . PrstGeom . PrstAttr = _ged . ST_ShapeTypeRect ; _cadc := Image { _eafc } ; _bcbg := img . Size ( ) ; _cadc . Properties ( ) . SetWidth ( _ea . Distance ( _bcbg . X ) * _ea . Pixel72 ) ;
_cadc . Properties ( ) . SetHeight ( _ea . Distance ( _bcbg . Y ) * _ea . Pixel72 ) ; _cadc . Properties ( ) . SetPosition ( 0 , 0 ) ; return _cadc ; } ;
// ExtLst returns the ExtLst property.
func ( _gcec ViewProperties ) ExtLst ( ) * _fb . CT_ExtensionList { return _gcec . _gedde . ExtLst } ;
// Properties returns the properties of the TextBox.
func ( _egb Image ) Properties ( ) _ee . ShapeProperties { if _egb . _aag . SpPr == nil { _egb . _aag . SpPr = _ged . NewCT_ShapeProperties ( ) ; } ; return _ee . MakeShapeProperties ( _egb . _aag . SpPr ) ; } ; func ( _aeegg * Slide ) getSlideLayoutRels ( ) _fe . Relationships { _dfb := _aeegg . _geed ;
for _gcaa , _beca := range _dfb . SlideLayouts ( ) { if * _aeegg . GetSlideLayout ( ) . CSld == * _beca . _badb . CSld { return _dfb . _ecg [ _gcaa ] ; } ; } ; return _fe . Relationships { } ; } ;
// WebPr returns the WebPr property.
func ( _cceb PresentationProperties ) WebPr ( ) * _fb . CT_WebProperties { return _cceb . _fde . WebPr } ;
2023-12-12 23:20:29 +00:00
2024-06-20 13:33:45 +00:00
// X returns the inner wrapped XML type.
2024-07-28 07:48:26 +00:00
func ( _ebgfg SlideLayout ) X ( ) * _fb . SldLayout { return _ebgfg . _badb } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// CopySlide copies existing slide from another presentation and inserts it as a last one.
func ( _gdg * Presentation ) CopySlide ( s Slide ) ( Slide , error ) { _fded := _fb . NewCT_SlideIdListEntry ( ) ; _fded . IdAttr = _gdg . nextSlideID ( ) ; _gdg . _bfb . SldIdLst . SldId = append ( _gdg . _bfb . SldIdLst . SldId , _fded ) ; _fgc := s . GetSlideLayout ( ) ; _aaf := true ;
for _ , _ega := range _gdg . _fcc { if _ega == _fgc { _aaf = false ; break ; } ; } ; if _aaf { _gdg . addLayoutFromSlide ( s ) ; } ; _gdg . _dbf = append ( _gdg . _dbf , s . _bbdfd ) ; _cea := _gdg . _bfce . AddAutoRelationship ( _cc . DocTypePresentation , _cc . OfficeDocumentType , len ( _gdg . _dbf ) , _cc . SlideType ) ;
_fded . RIdAttr = _cea . ID ( ) ; _gcd := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideType , len ( _gdg . _dbf ) ) ; _gdg . ContentTypes . AddOverride ( _gcd , _cc . SlideContentType ) ; _efag := _fe . NewRelationships ( ) ; _gdg . _abgdg = append ( _gdg . _abgdg , _efag ) ;
_cbc := len ( _gdg . _abgdg ) - 1 ; for _bae , _fbg := range _gdg . _fcc { if _fbg == _fgc { _bbfe := _gdg . _ecg [ _bae ] ; for _ , _cefd := range _bbfe . X ( ) . Relationship { if _cefd . TypeAttr != _cc . SlideMasterType { _gdg . _abgdg [ _cbc ] . X ( ) . Relationship = append ( _gdg . _abgdg [ _cbc ] . X ( ) . Relationship , _cefd ) ;
} ; } ; _efag . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideType , _bae + 1 , _cc . SlideLayoutType ) ; } ; } ; _gcfd := Slide { _fded , s . _bbdfd , _gdg , nil } ; return _gcfd , nil ; } ;
2023-04-15 17:27:31 +00:00
2024-07-28 07:48:26 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _cefg * Presentation ) SaveToFile ( path string ) error { return _cefg . saveToFile ( path , false ) } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +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 ; func ( _aegb * Presentation ) Validate ( ) error { if _cgga := _aegb . _bfb . Validate ( ) ; _cgga != nil { return _cgga ; } ; for _gebe , _abcd := range _aegb . Slides ( ) { if _ddag := _abcd . ValidateWithPath ( _eg . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _gebe ) ) ;
_ddag != nil { return _ddag ; } ; } ; for _aceb , _bca := range _aegb . _dcgbcc { if _aaad := _bca . ValidateWithPath ( _eg . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _aceb ) ) ; _aaad != nil { return _aaad ; } ; } ; for _daf , _efef := range _aegb . _fcc { if _feec := _efef . ValidateWithPath ( _eg . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _daf ) ) ;
_feec != nil { return _feec ; } ; } ; return nil ; } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _gedde * _fb . ViewPr } ;
2023-08-06 17:57:53 +00:00
2024-07-28 07:48:26 +00:00
// SetWidth sets width of slide screen size with given value in EMU units.
func ( _faf * SlideScreenSize ) SetWidth ( val int32 ) { _faf [ 0 ] = val } ;
2023-06-10 07:12:37 +00:00
2024-07-28 07:48:26 +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 * _fb . CT_Shape ; GraphicFrame * _fb . CT_GraphicalObjectFrame ; Paragraph * _ged . CT_TextParagraph ; Run * _ged . CT_RegularTextRun ; TableInfo * TableInfo ; _cg [ ] rectangle ; _cdb int ; _bc int ; } ;
func ( _abaf sort2d ) Len ( ) int { return len ( _abaf ) } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// GetImageByTarget returns an ImageRef with the given target in the
2024-06-20 13:33:45 +00:00
// document.
2024-07-28 07:48:26 +00:00
func ( _eagg * Presentation ) GetImageByTarget ( target string ) ( _fe . ImageRef , bool ) { for _ , _egaa := range _eagg . Images { if _egaa . Target ( ) == target { return _egaa , true ; } ; } ; return _fe . ImageRef { } , false ; } ;
2023-08-06 17:57:53 +00:00
2024-07-28 07:48:26 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _ce PlaceHolder ) Paragraphs ( ) [ ] _ee . Paragraph { _ecbg := [ ] _ee . Paragraph { } ; for _ , _gfdc := range _ce . _gd . TxBody . P { _ecbg = append ( _ecbg , _ee . MakeParagraph ( _gfdc ) ) ; } ; return _ecbg ; } ;
2023-06-10 07:12:37 +00:00
2024-07-28 07:48:26 +00:00
// Image is an image within a slide.
type Image struct { _aag * _fb . CT_Picture } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _bbfg Slide ) AddTextBox ( ) TextBox { _edea := _fb . NewCT_GroupShapeChoice ( ) ; _bbfg . _bbdfd . CSld . SpTree . Choice = append ( _bbfg . _bbdfd . CSld . SpTree . Choice , _edea ) ; _ccc := _fb . NewCT_Shape ( ) ; _edea . Sp = append ( _edea . Sp , _ccc ) ; _ccc . SpPr = _ged . NewCT_ShapeProperties ( ) ;
_ccc . SpPr . Xfrm = _ged . NewCT_Transform2D ( ) ; _ccc . SpPr . PrstGeom = _ged . NewCT_PresetGeometry2D ( ) ; _ccc . SpPr . PrstGeom . PrstAttr = _ged . ST_ShapeTypeRect ; _ccc . NvSpPr = _fb . NewCT_ShapeNonVisual ( ) ; _ccc . NvSpPr . CNvSpPr = _ged . NewCT_NonVisualDrawingShapeProps ( ) ;
_cdabf := true ; _ccc . NvSpPr . CNvSpPr . TxBoxAttr = & _cdabf ; _ccc . TxBody = _ged . NewCT_TextBody ( ) ; _ccc . TxBody . BodyPr = _ged . NewCT_TextBodyProperties ( ) ; _ccc . TxBody . BodyPr . WrapAttr = _ged . ST_TextWrappingTypeSquare ; _ccc . TxBody . BodyPr . SpAutoFit = _ged . NewCT_TextShapeAutofit ( ) ;
_cdbg := TextBox { _ccc } ; _cdbg . Properties ( ) . SetWidth ( 3 * _ea . Inch ) ; _cdbg . Properties ( ) . SetHeight ( 1 * _ea . Inch ) ; _cdbg . Properties ( ) . SetPosition ( 0 , 0 ) ; return _cdbg ; } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// GridSpacing returns the GridSpacing property.
func ( _ecca ViewProperties ) GridSpacing ( ) * _ged . CT_PositiveSize2D { return _ecca . _gedde . GridSpacing } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _aaage TextBox ) SetOffsetY ( offY float64 ) { _ffbg := _aaage . getOff ( ) ; _cffb := _ea . ToEMU ( offY ) ; _ffbg . YAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _cffb } ; } ; func ( _dfa TextBox ) getOff ( ) * _ged . CT_Point2D { if _dfa . _eafa . SpPr == nil { _dfa . _eafa . SpPr = _ged . NewCT_ShapeProperties ( ) ;
} ; if _dfa . _eafa . SpPr . Xfrm == nil { _dfa . _eafa . SpPr . Xfrm = _ged . NewCT_Transform2D ( ) ; } ; if _dfa . _eafa . SpPr . Xfrm . Off == nil { _dfa . _eafa . SpPr . Xfrm . Off = _ged . NewCT_Point2D ( ) ; } ; return _dfa . _eafa . SpPr . Xfrm . Off ; } ;
2023-06-10 07:12:37 +00:00
2024-07-28 07:48:26 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _efd TextBox ) X ( ) * _fb . CT_Shape { return _efd . _eafa } ;
2023-08-06 17:57:53 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _geg PresentationProperties ) X ( ) * _fb . PresentationPr { return _geg . _fde } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +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 ; } ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _afe * Presentation ) Close ( ) error { if _afe . TmpPath != "" { return _c . RemoveAll ( _afe . TmpPath ) ; } ; return nil ; } ; const _agf float64 = 500000 ;
2023-09-16 17:56:36 +00:00
2024-07-28 07:48:26 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _gfeag * Presentation ) GetTableStyleById ( id string ) * _ged . CT_TableStyle { _cec := _gfeag . _aagb . TblStyle ( ) ; for _ , _dccc := range _cec { if _dccc . StyleIdAttr == id { return _dccc ; } ; } ; return nil ; } ;
2023-12-12 23:20:29 +00:00
2024-07-28 07:48:26 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _fdc * Presentation ) SaveAsTemplate ( w _dc . Writer ) error { return _fdc . save ( w , true ) } ;
2023-12-28 15:53:06 +00:00
2024-07-28 07:48:26 +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 ( _bbd PlaceHolder ) SetText ( text string ) { _bbd . Clear ( ) ; _bad := _ged . NewEG_TextRun ( ) ; _bad . R = _ged . NewCT_RegularTextRun ( ) ; _bad . R . T = text ; if len ( _bbd . _gd . TxBody . P ) == 0 { _bbd . _gd . TxBody . P = append ( _bbd . _gd . TxBody . P , _ged . NewCT_TextParagraph ( ) ) ;
} ; _bbd . _gd . TxBody . P [ 0 ] . EG_TextRun = nil ; _bbd . _gd . TxBody . P [ 0 ] . EG_TextRun = append ( _bbd . _gd . TxBody . P [ 0 ] . EG_TextRun , _bad ) ; } ;
2024-06-20 13:33:45 +00:00
2024-07-28 07:48:26 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _ecbc ViewProperties ) SlideViewPr ( ) * _fb . CT_SlideViewProperties { return _ecbc . _gedde . SlideViewPr ; } ;
2024-06-20 13:33:45 +00:00
2024-07-28 07:48:26 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _dgad Slide ) GetTextBoxes ( ) [ ] * TextBox { _bdfc := [ ] * TextBox { } ; _dacg := _dgad . _bbdfd . CSld . SpTree . Choice ; for _ , _ddfb := range _dacg { for _ , _bce := range _ddfb . Sp { if _bce . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _bce . NvSpPr . CNvSpPr . TxBoxAttr { _bdfc = append ( _bdfc , & TextBox { _bce } ) ;
} ; } ; } ; return _bdfc ; } ;
2024-06-20 13:33:45 +00:00
2024-07-28 07:48:26 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _abgc ViewProperties ) LastViewAttr ( ) _fb . ST_ViewType { return _abgc . _gedde . LastViewAttr } ;
2024-06-20 13:33:45 +00:00
2024-07-28 07:48:26 +00:00
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _fgee * Presentation ; _cbge _fe . Relationships ; _fae * _fb . SldMaster ; } ;
2024-02-17 03:37:07 +00:00
2024-07-28 07:48:26 +00:00
// PlaceHolders returns all of the content place holders within a given slide.
func ( _bgdc Slide ) PlaceHolders ( ) [ ] PlaceHolder { _gff := [ ] PlaceHolder { } ; for _ , _bgfg := range _bgdc . _bbdfd . CSld . SpTree . Choice { for _ , _dffd := range _bgfg . Sp { if _dffd . NvSpPr != nil && _dffd . NvSpPr . NvPr != nil && _dffd . NvSpPr . NvPr . Ph != nil { _gff = append ( _gff , PlaceHolder { _dffd , _bgdc . _bbdfd } ) ;
} ; } ; } ; return _gff ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// Height returns slide screen size height in EMU units.
func ( _aafd * SlideScreenSize ) Height ( ) int32 { return _aafd [ 1 ] } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _cddg TextBox ) SetOffsetX ( offX float64 ) { _gaae := _cddg . getOff ( ) ; _gega := _ea . ToEMU ( offX ) ; _gaae . XAttr = _ged . ST_Coordinate { ST_CoordinateUnqualified : & _gega } ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// SetSize sets the slide size, take argument of SlideScreenSize.
func ( _badgd * SlideSize ) SetSize ( sz SlideScreenSize ) { _badgd . _gcdd . CxAttr = sz [ 0 ] ; _badgd . _gcdd . CyAttr = sz [ 1 ] ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// Themes returns an array of presentation themes.
func ( _gagb * Presentation ) Themes ( ) [ ] * _ged . Theme { return _gagb . _caeg } ;
2024-02-17 03:37:07 +00:00
2024-07-28 07:48:26 +00:00
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _gd * _fb . CT_Shape ; _bfc * _fb . Sld ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _gbc Slide ) X ( ) * _fb . Sld { return _gbc . _bbdfd } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _befe * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _cbe := [ ] SlideLayout { } ; for _ , _gee := range _befe . _fcc { if _gee . CSld . NameAttr == nil { continue ; } ; _cbe = append ( _cbe , SlideLayout { _gee } ) ; } ; return _cbe ; } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _ddca Slide ) ValidateWithPath ( path string ) error { if _dagaf := _ddca . _bbdfd . ValidateWithPath ( path ) ; _dagaf != nil { return _dagaf ; } ; for _ , _becca := range _ddca . _bbdfd . CSld . SpTree . Choice { for _ , _fbd := range _becca . Sp { if _fbd . TxBody != nil { if len ( _fbd . 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 ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _baae , _abf := Open ( fn ) ; if _abf != nil { return nil , _abf ; } ; return _baae , nil ; } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +00:00
// Presentation returns a slide's presentation.
func ( _dcde Slide ) Presentation ( ) * Presentation { return _dcde . _geed } ;
2024-05-04 18:48:06 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
func ( _bfa SlideMaster ) X ( ) * _fb . SldMaster { return _bfa . _fae } ; func ( _bd * chart ) X ( ) * _b . ChartSpace { return _bd . _geda } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _ffb PlaceHolder ) AddParagraph ( ) _ee . Paragraph { _dgfb := _ee . MakeParagraph ( _ged . NewCT_TextParagraph ( ) ) ; _ffb . _gd . TxBody . P = append ( _ffb . _gd . TxBody . P , _dgfb . X ( ) ) ; return _dgfb ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _eafa * _fb . CT_Shape } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _becd * Presentation ) SaveToFileAsTemplate ( path string ) error { return _becd . saveToFile ( path , true ) ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// AddSlide adds a new slide to the presentation.
func ( _gfc * Presentation ) AddSlide ( ) Slide { _dec := _fb . NewCT_SlideIdListEntry ( ) ; _dec . IdAttr = _gfc . nextSlideID ( ) ; _gfc . _bfb . SldIdLst . SldId = append ( _gfc . _bfb . SldIdLst . SldId , _dec ) ; _efa := _fb . NewSld ( ) ; _efa . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ;
_efa . CSld . SpTree . GrpSpPr . Xfrm = _ged . NewCT_GroupTransform2D ( ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . Off = _ged . NewCT_Point2D ( ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _cc . Int64 ( 0 ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _cc . Int64 ( 0 ) ;
_efa . CSld . SpTree . GrpSpPr . Xfrm . Ext = _ged . NewCT_PositiveSize2D ( ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _ea . Point ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _ea . Point ) ; _efa . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _efa . CSld . SpTree . GrpSpPr . Xfrm . Off ;
_efa . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _efa . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _gfc . _dbf = append ( _gfc . _dbf , _efa ) ; _ebc := _gfc . _bfce . AddAutoRelationship ( _cc . DocTypePresentation , _cc . OfficeDocumentType , len ( _gfc . _dbf ) , _cc . SlideType ) ; _dec . RIdAttr = _ebc . ID ( ) ;
_cee := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideType , len ( _gfc . _dbf ) ) ; _gfc . ContentTypes . AddOverride ( _cee , _cc . SlideContentType ) ; _dga := _fe . NewRelationships ( ) ; _gfc . _abgdg = append ( _gfc . _abgdg , _dga ) ; _dga . AddAutoRelationship ( _cc . DocTypePresentation , _cc . SlideType , len ( _gfc . _fcc ) , _cc . SlideLayoutType ) ;
return Slide { _dec , _efa , _gfc , nil } ; } ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _bbfd ViewProperties ) NotesTextViewPr ( ) * _fb . CT_NotesTextViewProperties { return _bbfd . _gedde . NotesTextViewPr ; } ; type sort2d [ ] * TextItem ;
2024-05-22 00:21:11 +00:00
2024-07-28 07:48:26 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _dgea ViewProperties ) NotesViewPr ( ) * _fb . CT_NotesViewProperties { return _dgea . _gedde . NotesViewPr ; } ; func _gbe ( _dgd * Presentation , _ege * _fb . CT_Shape , _abg * _fb . CT_GraphicalObjectFrame , _edd * TableInfo , _cfg * _ged . CT_Transform2D , _dcg int , _gef [ ] rectangle , _db [ ] * _ged . CT_TextParagraph ) [ ] * TextItem { _fbc := [ ] * TextItem { } ;
var _def , _bed , _bagd , _efb , _dff , _cdd int64 ; _bef := _cfg == nil ; _bgd := 0 ; for _ , _fba := range _db { for _ , _eag := range _fba . EG_TextRun { if _gbb := _eag . R ; _gbb != nil { if ! _bef { if _cfg . Off != nil { if _efba := _cfg . Ext ; _efba != nil { _dff , _cdd = _efba . CxAttr , _efba . CyAttr ;
} ; if _gfd := _cfg . Off . XAttr . ST_CoordinateUnqualified ; _gfd != nil { _def = * _gfd ; _bed = _def + _dff ; _bef = true ; } ; if _fcg := _cfg . Off . YAttr . ST_CoordinateUnqualified ; _fcg != nil { _bagd = * _fcg ; _efb = _bagd + _cdd ; _bef = true ; } ; } ; } ; _abge := append ( [ ] rectangle { } , _gef ... ) ;
_abge = append ( _abge , rectangle { _egg : _def , _ae : _bed , _dea : _bagd , _ag : _efb } ) ; _fbc = append ( _fbc , & TextItem { Presentation : _dgd , Shape : _ege , GraphicFrame : _abg , TableInfo : _edd , Paragraph : _fba , Run : _gbb , Text : _gbb . T , _cg : _abge , _cdb : _dcg , _bc : _bgd } ) ;
_bgd ++ ; } ; } ; } ; return _fbc ; } ; type rectangle struct { _egg int64 ; _dea int64 ; _ae int64 ; _ag int64 ; } ;
// SorterViewPr returns the SorterViewPr property.
func ( _accg ViewProperties ) SorterViewPr ( ) * _fb . CT_SlideSorterViewProperties { return _accg . _gedde . SorterViewPr ; } ; func ( _dcf * chart ) Target ( ) string { return _dcf . _gc } ;
// 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 ( _bfcc Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _ebae := range _bfcc . _bbdfd . CSld . SpTree . Choice { for _ , _dafe := range _ebae . Sp { if _dafe . NvSpPr != nil && _dafe . NvSpPr . NvPr != nil && _dafe . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _dafe . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _dafe . NvSpPr . NvPr . Ph . IdxAttr != nil && * _dafe . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _dafe , _bfcc . _bbdfd } , 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" ) ; } ; func ( _becf * Presentation ) save ( _eacf _dc . Writer , _fee bool ) error { const _gcge = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ;
if _dgdf := _becf . _bfb . Validate ( ) ; _dgdf != nil { _a . 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" , _dgdf ) ;
} ; if ! _ge . GetLicenseKey ( ) . IsLicensed ( ) && ! _edfa { _eg . 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" ) ; _eg . 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 ( _becf . _caff ) == 0 { _afa , _ffd := _ge . GenRefId ( "\u0070\u0077" ) ; if _ffd != nil { _a . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _ffd ) ;
return _ffd ; } ; _becf . _caff = _afa ; } ; if _efagc := _ge . Track ( _becf . _caff , _gcge ) ; _efagc != nil { _a . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _efagc ) ; return _efagc ; } ; if _fee { _becf . 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" ) ;
_becf . 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 { _becf . 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" ) ;
_becf . 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" ) ;
} ; _faa := _cc . DocTypePresentation ; _bagb := _df . NewWriter ( _eacf ) ; defer _bagb . Close ( ) ; if _cfa := _g . MarshalXML ( _bagb , _cc . BaseRelsFilename , _becf . Rels . X ( ) ) ; _cfa != nil { return _cfa ; } ; if _febe := _g . MarshalXMLByType ( _bagb , _faa , _cc . ExtendedPropertiesType , _becf . AppProperties . X ( ) ) ;
_febe != nil { return _febe ; } ; if _cbac := _g . MarshalXMLByType ( _bagb , _faa , _cc . CorePropertiesType , _becf . CoreProperties . X ( ) ) ; _cbac != nil { return _cbac ; } ; if _ebfb := _g . MarshalXMLByType ( _bagb , _faa , _cc . PresentationPropertiesType , _becf . _eafg . X ( ) ) ;
_ebfb != nil { return _ebfb ; } ; if _fcga := _g . MarshalXMLByType ( _bagb , _faa , _cc . ViewPropertiesType , _becf . _ebf . X ( ) ) ; _fcga != nil { return _fcga ; } ; if _afd := _g . MarshalXMLByType ( _bagb , _faa , _cc . TableStylesType , _becf . _aagb . X ( ) ) ; _afd != nil { return _afd ;
} ; if _becf . CustomProperties . X ( ) != nil { if _fbge := _g . MarshalXMLByType ( _bagb , _faa , _cc . CustomPropertiesType , _becf . CustomProperties . X ( ) ) ; _fbge != nil { return _fbge ; } ; } ; if _becf . Thumbnail != nil { _cfb , _aega := _bagb . Create ( "\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067" ) ;
if _aega != nil { return _aega ; } ; if _dgc := _abd . Encode ( _cfb , _becf . Thumbnail , nil ) ; _dgc != nil { return _dgc ; } ; } ; _ceb := _cc . AbsoluteFilename ( _faa , _cc . OfficeDocumentType , 0 ) ; if _aed := _g . MarshalXML ( _bagb , _ceb , _becf . _bfb ) ; _aed != nil { return _aed ;
} ; if _dcga := _g . MarshalXML ( _bagb , _g . RelationsPathFor ( _ceb ) , _becf . _bfce . X ( ) ) ; _dcga != nil { return _dcga ; } ; for _badg , _cbad := range _becf . _dbf { _ecde := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideType , _badg + 1 ) ; _g . MarshalXML ( _bagb , _ecde , _cbad ) ;
if ! _becf . _abgdg [ _badg ] . IsEmpty ( ) { _ebg := _g . RelationsPathFor ( _ecde ) ; _g . MarshalXML ( _bagb , _ebg , _becf . _abgdg [ _badg ] . X ( ) ) ; } ; } ; for _gegg , _aefe := range _becf . _dcgbcc { _dbd := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideMasterType , _gegg + 1 ) ;
_g . MarshalXML ( _bagb , _dbd , _aefe ) ; if ! _becf . _cgdb [ _gegg ] . IsEmpty ( ) { _fga := _g . RelationsPathFor ( _dbd ) ; _g . MarshalXML ( _bagb , _fga , _becf . _cgdb [ _gegg ] . X ( ) ) ; } ; } ; for _efg , _beab := range _becf . _fcc { _ccbg := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . SlideLayoutType , _efg + 1 ) ;
_g . MarshalXML ( _bagb , _ccbg , _beab ) ; if ! _becf . _ecg [ _efg ] . IsEmpty ( ) { _bge := _g . RelationsPathFor ( _ccbg ) ; _g . MarshalXML ( _bagb , _bge , _becf . _ecg [ _efg ] . X ( ) ) ; } ; } ; for _edfe , _eddee := range _becf . _caeg { _eaa := _cc . AbsoluteFilename ( _cc . DocTypePresentation , _cc . ThemeType , _edfe + 1 ) ;
_g . MarshalXML ( _bagb , _eaa , _eddee ) ; if ! _becf . _bgde [ _edfe ] . IsEmpty ( ) { _gbdf := _g . RelationsPathFor ( _eaa ) ; _g . MarshalXML ( _bagb , _gbdf , _becf . _bgde [ _edfe ] . X ( ) ) ; } ; } ; for _bgff , _baad := range _becf . _afg { _gdc := _cc . AbsoluteFilename ( _faa , _cc . ChartType , _bgff + 1 ) ;
_g . MarshalXML ( _bagb , _gdc , _baad ) ; } ; for _bgda , _cdaf := range _becf . _bac { _fac := _cc . AbsoluteFilename ( _faa , _cc . HandoutMasterType , _bgda + 1 ) ; _g . MarshalXML ( _bagb , _fac , _cdaf ) ; } ; for _baaee , _bcgc := range _becf . _dbbc { _bcc := _cc . AbsoluteFilename ( _faa , _cc . NotesMasterType , _baaee + 1 ) ;
_g . MarshalXML ( _bagb , _bcc , _bcgc ) ; } ; for _abc , _bgba := range _becf . _dgda { _eacg := _cc . AbsoluteFilename ( _faa , _cc . CustomXMLType , _abc + 1 ) ; _g . MarshalXML ( _bagb , _eacg , _bgba ) ; } ; for _dfc , _fdb := range _becf . Images { _gag := _dfc + 1 ; if _gdgg , _abec := _gf . StringToNumbers ( _fdb . Target ( ) ) ;
_abec && _gag != _gdgg { _gag = _gdgg ; } ; if _gaa := _fe . AddImageToZip ( _bagb , _fdb , _gag , _cc . DocTypePresentation ) ; _gaa != nil { return _gaa ; } ; } ; _becf . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _becf . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ;
_becf . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _becf . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; if _deb := _g . MarshalXML ( _bagb , _cc . ContentTypesFilename , _becf . ContentTypes . X ( ) ) ;
_deb != nil { return _deb ; } ; if _efbc := _becf . WriteExtraFiles ( _bagb ) ; _efbc != nil { return _efbc ; } ; return nil ; } ;