mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +08:00
361 lines
77 KiB
Go
361 lines
77 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
package presentation ;import (_bg "archive/zip";_cb "bytes";_bb "encoding/xml";_cd "errors";_geg "fmt";_fb "github.com/unidoc/unioffice";_cf "github.com/unidoc/unioffice/common";_fgd "github.com/unidoc/unioffice/common/logger";_a "github.com/unidoc/unioffice/common/tempstorage";_de "github.com/unidoc/unioffice/drawing";_fg "github.com/unidoc/unioffice/internal/license";_f "github.com/unidoc/unioffice/measurement";_fc "github.com/unidoc/unioffice/schema/soo/dml";_g "github.com/unidoc/unioffice/schema/soo/dml/chart";_dg "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_e "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_gb "github.com/unidoc/unioffice/schema/soo/pml";_c "github.com/unidoc/unioffice/zippkg";_ac "image";_ca "image/jpeg";_ge "io";_cfc "math";_bbg "os";_ec "path";_af "sort";_da "strconv";_b "strings";);
|
|
|
|
// PresentationProperties contains document specific properties.
|
|
type PresentationProperties struct{_fed *_gb .PresentationPr };func (_eg *chart )Target ()string {return _eg ._gc };const _dge float64 =500000;
|
|
|
|
// AddTable adds an empty table to a slide.
|
|
func (_bfad Slide )AddTable ()*_cf .Table {_aeg :=_gb .NewCT_GroupShapeChoice ();_bfad ._beee .CSld .SpTree .Choice =append (_bfad ._beee .CSld .SpTree .Choice ,_aeg );_aba :=_gb .NewCT_GraphicalObjectFrame ();_aeg .GraphicFrame =append (_aeg .GraphicFrame ,_aba );_aba .Xfrm .Off =_fc .NewCT_Point2D ();_egge :=int64 (1);_aba .Xfrm .Off .XAttr =_fc .ST_Coordinate {ST_CoordinateUnqualified :&_egge };_aba .Xfrm .Off .YAttr =_fc .ST_Coordinate {ST_CoordinateUnqualified :&_egge };_fded :=_aba .Graphic .CT_GraphicalObject .GraphicData ;_fded .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";_cebc :=_cf .NewTableWithXfrm (_aba .Xfrm );_fded .Any =append (_fded .Any ,_cebc .X ());return _cebc ;};
|
|
|
|
// X returns TextBox's underlying *pml.CT_Shape.
|
|
func (_eef TextBox )X ()*_gb .CT_Shape {return _eef ._fabe };
|
|
|
|
// Remove removes a placeholder from a presentation.
|
|
func (_aag PlaceHolder )Remove ()error {for _abbb ,_bda :=range _aag ._ddb .CSld .SpTree .Choice {for _ ,_bfg :=range _bda .Sp {if _bfg ==_aag ._fda {copy (_aag ._ddb .CSld .SpTree .Choice [_abbb :],_aag ._ddb .CSld .SpTree .Choice [_abbb +1:]);_aag ._ddb .CSld .SpTree .Choice =_aag ._ddb .CSld .SpTree .Choice [0:len (_aag ._ddb .CSld .SpTree .Choice )-1];return nil ;};};};return _cd .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");};func _deed ()*Presentation {_cbd :=&Presentation {_bga :_gb .NewPresentation ()};_cbd ._bga .SldIdLst =_gb .NewCT_SlideIdList ();_cbd ._bga .ConformanceAttr =_dg .ST_ConformanceClassTransitional ;_cbd .AppProperties =_cf .NewAppProperties ();_cbd .CoreProperties =_cf .NewCoreProperties ();_cbd ._dbcb =_cf .NewTableStyles ();_cbd .ContentTypes =_cf .NewContentTypes ();_cbd .Rels =_cf .NewRelationships ();_cbd ._aga =_cf .NewRelationships ();_cbd ._fbg =NewPresentationProperties ();_cbd ._bdf =NewViewProperties ();_cbd ._fbf =map[string ]string {};return _cbd ;};
|
|
|
|
// ClrMru returns the ClrMru property.
|
|
func (_aac PresentationProperties )ClrMru ()*_fc .CT_ColorMRU {return _aac ._fed .ClrMru };
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_dafc *Presentation )GetImageByRelID (relID string )(_cf .ImageRef ,bool ){for _ ,_afdc :=range _dafc .Images {if _afdc .RelID ()==relID {return _afdc ,true ;};};return _cf .ImageRef {},false ;};
|
|
|
|
// SlideText is an array of extracted text items which has some methods for representing extracted text from a slide.
|
|
type SlideText struct{Items []*TextItem ;};
|
|
|
|
// PlaceHolder is a place holder from a slide.
|
|
type PlaceHolder struct{_fda *_gb .CT_Shape ;_ddb *_gb .Sld ;};func (_fadcf *Presentation )save (_bea _ge .Writer ,_ecb bool )error {const _ddg ="\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065";if _fcb :=_fadcf ._bga .Validate ();_fcb !=nil {_fgd .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",_fcb );};if !_fg .GetLicenseKey ().IsLicensed ()&&!_dbf {_geg .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");_geg .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 _cd .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 (_fadcf ._fadc )==0{_gdd ,_bcg :=_fg .GenRefId ("\u0070\u0077");if _bcg !=nil {_fgd .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_bcg );return _bcg ;};_fadcf ._fadc =_gdd ;};if _gfbg :=_fg .Track (_fadcf ._fadc ,_ddg );_gfbg !=nil {_fgd .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gfbg );return _gfbg ;};if _ecb {_fadcf .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");_fadcf .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 {_fadcf .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");_fadcf .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");};_cdc :=_fb .DocTypePresentation ;_ebda :=_bg .NewWriter (_bea );defer _ebda .Close ();if _bdda :=_c .MarshalXML (_ebda ,_fb .BaseRelsFilename ,_fadcf .Rels .X ());_bdda !=nil {return _bdda ;};if _cge :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .ExtendedPropertiesType ,_fadcf .AppProperties .X ());_cge !=nil {return _cge ;};if _fgg :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .CorePropertiesType ,_fadcf .CoreProperties .X ());_fgg !=nil {return _fgg ;};if _cega :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .PresentationPropertiesType ,_fadcf ._fbg .X ());_cega !=nil {return _cega ;};if _bba :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .ViewPropertiesType ,_fadcf ._bdf .X ());_bba !=nil {return _bba ;};if _fagf :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .TableStylesType ,_fadcf ._dbcb .X ());_fagf !=nil {return _fagf ;};if _fadcf .CustomProperties .X ()!=nil {if _fec :=_c .MarshalXMLByType (_ebda ,_cdc ,_fb .CustomPropertiesType ,_fadcf .CustomProperties .X ());_fec !=nil {return _fec ;};};if _fadcf .Thumbnail !=nil {_eeaef ,_abba :=_ebda .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _abba !=nil {return _abba ;};if _def :=_ca .Encode (_eeaef ,_fadcf .Thumbnail ,nil );_def !=nil {return _def ;};};_adc :=_fb .AbsoluteFilename (_cdc ,_fb .OfficeDocumentType ,0);if _gff :=_c .MarshalXML (_ebda ,_adc ,_fadcf ._bga );_gff !=nil {return _gff ;};if _dgd :=_c .MarshalXML (_ebda ,_c .RelationsPathFor (_adc ),_fadcf ._aga .X ());_dgd !=nil {return _dgd ;};for _dae ,_bbe :=range _fadcf ._feda {_daf :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideType ,_dae +1);_c .MarshalXML (_ebda ,_daf ,_bbe );if !_fadcf ._gae [_dae ].IsEmpty (){_bebf :=_c .RelationsPathFor (_daf );_c .MarshalXML (_ebda ,_bebf ,_fadcf ._gae [_dae ].X ());};};for _gbc ,_acce :=range _fadcf ._beca {_cfg :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideMasterType ,_gbc +1);_c .MarshalXML (_ebda ,_cfg ,_acce );if !_fadcf ._dcdf [_gbc ].IsEmpty (){_fab :=_c .RelationsPathFor (_cfg );_c .MarshalXML (_ebda ,_fab ,_fadcf ._dcdf [_gbc ].X ());};};for _dafa ,_fce :=range _fadcf ._gcd {_caee :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideLayoutType ,_dafa +1);_c .MarshalXML (_ebda ,_caee ,_fce );if !_fadcf ._dbc [_dafa ].IsEmpty (){_cfceb :=_c .RelationsPathFor (_caee );_c .MarshalXML (_ebda ,_cfceb ,_fadcf ._dbc [_dafa ].X ());};};for _ffeb ,_ccbe :=range _fadcf ._gea {_eeda :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .ThemeType ,_ffeb +1);_c .MarshalXML (_ebda ,_eeda ,_ccbe );if !_fadcf ._daaed [_ffeb ].IsEmpty (){_bfc :=_c .RelationsPathFor (_eeda );_c .MarshalXML (_ebda ,_bfc ,_fadcf ._daaed [_ffeb ].X ());};};for _gebg ,_ceb :=range _fadcf ._dbcg {_ffgg :=_fb .AbsoluteFilename (_cdc ,_fb .ChartType ,_gebg +1);_c .MarshalXML (_ebda ,_ffgg ,_ceb );};for _fcaee ,_ffb :=range _fadcf ._bee {_daad :=_fb .AbsoluteFilename (_cdc ,_fb .HandoutMasterType ,_fcaee +1);_c .MarshalXML (_ebda ,_daad ,_ffb );};for _aeb ,_cad :=range _fadcf ._ega {_agac :=_fb .AbsoluteFilename (_cdc ,_fb .NotesMasterType ,_aeb +1);_c .MarshalXML (_ebda ,_agac ,_cad );};for _gba ,_facc :=range _fadcf ._age {_daaef :=_fb .AbsoluteFilename (_cdc ,_fb .CustomXMLType ,_gba +1);_c .MarshalXML (_ebda ,_daaef ,_facc );};for _cdea ,_ffac :=range _fadcf .Images {if _gfd :=_cf .AddImageToZip (_ebda ,_ffac ,_cdea +1,_fb .DocTypePresentation );_gfd !=nil {return _gfd ;};};_fadcf .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_fadcf .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadcf .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadcf .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");if _fedf :=_c .MarshalXML (_ebda ,_fb .ContentTypesFilename ,_fadcf .ContentTypes .X ());_fedf !=nil {return _fedf ;};if _gda :=_fadcf .WriteExtraFiles (_ebda );_gda !=nil {return _gda ;};return nil ;};
|
|
|
|
// New initializes and reurns a new presentation
|
|
func New ()*Presentation {_cff :=_deed ();_cff .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");_cff .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");_cff .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");_cff .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");_cff .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");_cff .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");_cff .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");_cff ._bga .SldMasterIdLst =_gb .NewCT_SlideMasterIdList ();_edf :=_gb .NewSldMaster ();_edf .ClrMap .Bg1Attr =_fc .ST_ColorSchemeIndexLt1 ;_edf .ClrMap .Bg2Attr =_fc .ST_ColorSchemeIndexLt2 ;_edf .ClrMap .Tx1Attr =_fc .ST_ColorSchemeIndexDk1 ;_edf .ClrMap .Tx2Attr =_fc .ST_ColorSchemeIndexDk2 ;_edf .ClrMap .Accent1Attr =_fc .ST_ColorSchemeIndexAccent1 ;_edf .ClrMap .Accent2Attr =_fc .ST_ColorSchemeIndexAccent2 ;_edf .ClrMap .Accent3Attr =_fc .ST_ColorSchemeIndexAccent3 ;_edf .ClrMap .Accent4Attr =_fc .ST_ColorSchemeIndexAccent4 ;_edf .ClrMap .Accent5Attr =_fc .ST_ColorSchemeIndexAccent5 ;_edf .ClrMap .Accent6Attr =_fc .ST_ColorSchemeIndexAccent6 ;_edf .ClrMap .HlinkAttr =_fc .ST_ColorSchemeIndexHlink ;_edf .ClrMap .FolHlinkAttr =_fc .ST_ColorSchemeIndexFolHlink ;_cff ._beca =append (_cff ._beca ,_edf );_egb :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideMasterType ,1);_cff .ContentTypes .AddOverride (_egb ,_fb .SlideMasterContentType );_ccg :=_cff ._aga .AddAutoRelationship (_fb .DocTypePresentation ,_fb .OfficeDocumentType ,1,_fb .SlideMasterType );_bgg :=_gb .NewCT_SlideMasterIdListEntry ();_bgg .IdAttr =_fb .Uint32 (2147483648);_bgg .RIdAttr =_ccg .ID ();_cff ._bga .SldMasterIdLst .SldMasterId =append (_cff ._bga .SldMasterIdLst .SldMasterId ,_bgg );_cfce :=_cf .NewRelationships ();_cff ._dcdf =append (_cff ._dcdf ,_cfce );_ege :=_gb .NewSldLayout ();_abf :=_cfce .AddAutoRelationship (_fb .DocTypePresentation ,_fb .SlideMasterType ,1,_fb .SlideLayoutType );_agag :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideLayoutType ,1);_cff .ContentTypes .AddOverride (_agag ,_fb .SlideLayoutContentType );_cfce .AddAutoRelationship (_fb .DocTypePresentation ,_fb .SlideMasterType ,1,_fb .ThemeType );_cff ._gcd =append (_cff ._gcd ,_ege );_edf .SldLayoutIdLst =_gb .NewCT_SlideLayoutIdList ();_cddg :=_gb .NewCT_SlideLayoutIdListEntry ();_cddg .IdAttr =_fb .Uint32 (2147483649);_cddg .RIdAttr =_abf .ID ();_edf .SldLayoutIdLst .SldLayoutId =append (_edf .SldLayoutIdLst .SldLayoutId ,_cddg );_bbc :=_cf .NewRelationships ();_cff ._dbc =append (_cff ._dbc ,_bbc );_bbc .AddAutoRelationship (_fb .DocTypePresentation ,_fb .SlideType ,1,_fb .SlideMasterType );_cff ._bga .NotesSz .CxAttr =6858000;_cff ._bga .NotesSz .CyAttr =9144000;_gaa :=_fc .NewTheme ();_gaa .NameAttr =_fb .String ("\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065");_gaa .ThemeElements .ClrScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gaa .ThemeElements .ClrScheme .Dk1 .SysClr =_fc .NewCT_SystemColor ();_gaa .ThemeElements .ClrScheme .Dk1 .SysClr .LastClrAttr =_fb .String ("\u0030\u0030\u0030\u0030\u0030\u0030");_gaa .ThemeElements .ClrScheme .Dk1 .SysClr .ValAttr =_fc .ST_SystemColorValWindowText ;_gaa .ThemeElements .ClrScheme .Lt1 .SysClr =_fc .NewCT_SystemColor ();_gaa .ThemeElements .ClrScheme .Lt1 .SysClr .LastClrAttr =_fb .String ("\u0066\u0066\u0066\u0066\u0066\u0066");_gaa .ThemeElements .ClrScheme .Lt1 .SysClr .ValAttr =_fc .ST_SystemColorValWindow ;_gaa .ThemeElements .ClrScheme .Dk2 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Dk2 .SrgbClr .ValAttr ="\u0034\u0034\u0035\u0034\u0036\u0061";_gaa .ThemeElements .ClrScheme .Lt2 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Lt2 .SrgbClr .ValAttr ="\u0065\u0037\u0065\u0037\u0065\u0036";_gaa .ThemeElements .ClrScheme .Accent1 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent1 .SrgbClr .ValAttr ="\u0034\u0034\u0037\u0032\u0063\u0034";_gaa .ThemeElements .ClrScheme .Accent2 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent2 .SrgbClr .ValAttr ="\u0065\u0064\u0037\u0064\u0033\u0031";_gaa .ThemeElements .ClrScheme .Accent3 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent3 .SrgbClr .ValAttr ="\u0061\u0035\u0061\u0035\u0061\u0035";_gaa .ThemeElements .ClrScheme .Accent4 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent4 .SrgbClr .ValAttr ="\u0066\u0066\u0063\u0030\u0030\u0030";_gaa .ThemeElements .ClrScheme .Accent5 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent5 .SrgbClr .ValAttr ="\u0035\u0062\u0039\u0062\u0064\u0035";_gaa .ThemeElements .ClrScheme .Accent6 .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Accent6 .SrgbClr .ValAttr ="\u0037\u0030\u0061\u0064\u0034\u0037";_gaa .ThemeElements .ClrScheme .Hlink .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .Hlink .SrgbClr .ValAttr ="\u0030\u0035\u0036\u0033\u0063\u0031";_gaa .ThemeElements .ClrScheme .FolHlink .SrgbClr =_fc .NewCT_SRgbColor ();_gaa .ThemeElements .ClrScheme .FolHlink .SrgbClr .ValAttr ="\u0039\u0035\u0034\u0066\u0037\u0032";_gaa .ThemeElements .FontScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gaa .ThemeElements .FontScheme .MajorFont .Latin .TypefaceAttr ="\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074";_gaa .ThemeElements .FontScheme .MinorFont .Latin .TypefaceAttr ="\u0043a\u006c\u0069\u0062\u0072\u0069";_gaa .ThemeElements .FmtScheme .NameAttr =_fb .String ("\u004f\u0066\u0066\u0069\u0063\u0065");_acc :=_fc .NewEG_FillProperties ();_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_acc );_acc .SolidFill =&_fc .CT_SolidColorFillProperties {SchemeClr :&_fc .CT_SchemeColor {ValAttr :_fc .ST_SchemeColorValPhClr }};_acc =_fc .NewEG_FillProperties ();_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_acc );_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_acc );_acc .GradFill =&_fc .CT_GradientFillProperties {RotWithShapeAttr :_fb .Bool (true ),GsLst :&_fc .CT_GradientStopList {},Lin :&_fc .CT_LinearShadeProperties {}};_acc .GradFill .Lin .AngAttr =_fb .Int32 (5400000);_acc .GradFill .Lin .ScaledAttr =_fb .Bool (false );_ffe :=_fc .NewCT_GradientStop ();_ffe .PosAttr .ST_PositiveFixedPercentageDecimal =_fb .Int32 (0);_ffe .SchemeClr =&_fc .CT_SchemeColor {ValAttr :_fc .ST_SchemeColorValPhClr };_acc .GradFill .GsLst .Gs =append (_acc .GradFill .GsLst .Gs ,_ffe );_ffe =_fc .NewCT_GradientStop ();_ffe .PosAttr .ST_PositiveFixedPercentageDecimal =_fb .Int32 (50000);_ffe .SchemeClr =&_fc .CT_SchemeColor {ValAttr :_fc .ST_SchemeColorValPhClr };_acc .GradFill .GsLst .Gs =append (_acc .GradFill .GsLst .Gs ,_ffe );_gaa .ThemeElements .FmtScheme .LnStyleLst =_fc .NewCT_LineStyleList ();for _caa :=0;_caa < 3;_caa ++{_ea :=_fc .NewCT_LineProperties ();_ea .WAttr =_fb .Int32 (int32 (6350*(_caa +1)));_ea .CapAttr =_fc .ST_LineCapFlat ;_ea .CmpdAttr =_fc .ST_CompoundLineSng ;_ea .AlgnAttr =_fc .ST_PenAlignmentCtr ;_gaa .ThemeElements .FmtScheme .LnStyleLst .Ln =append (_gaa .ThemeElements .FmtScheme .LnStyleLst .Ln ,_ea );};_gaa .ThemeElements .FmtScheme .EffectStyleLst =_fc .NewCT_EffectStyleList ();for _ffgf :=0;_ffgf < 3;_ffgf ++{_dce :=_fc .NewCT_EffectStyleItem ();_dce .EffectLst =_fc .NewCT_EffectList ();_gaa .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle =append (_gaa .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle ,_dce );};_abfb :=_fc .NewEG_FillProperties ();_abfb .SolidFill =&_fc .CT_SolidColorFillProperties {SchemeClr :&_fc .CT_SchemeColor {ValAttr :_fc .ST_SchemeColorValPhClr }};_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_abfb );_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_abfb );_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gaa .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_acc );_cff ._gea =append (_cff ._gea ,_gaa );_aead :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .ThemeType ,1);_cff .ContentTypes .AddOverride (_aead ,_fb .ThemeContentType );_cff ._aga .AddAutoRelationship (_fb .DocTypePresentation ,_fb .OfficeDocumentType ,1,_fb .ThemeType );_fgdf :=_cf .NewRelationships ();_cff ._daaed =append (_cff ._daaed ,_fgdf );return _cff ;};
|
|
|
|
// SaveToFile writes the Presentation out to a file.
|
|
func (_daed *Presentation )SaveToFile (path string )error {return _daed .saveToFile (path ,false )};
|
|
|
|
// 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 (_cgg PlaceHolder )SetText (text string ){_cgg .Clear ();_fcdf :=_fc .NewEG_TextRun ();_fcdf .R =_fc .NewCT_RegularTextRun ();_fcdf .R .T =text ;if len (_cgg ._fda .TxBody .P )==0{_cgg ._fda .TxBody .P =append (_cgg ._fda .TxBody .P ,_fc .NewCT_TextParagraph ());};_cgg ._fda .TxBody .P [0].EG_TextRun =nil ;_cgg ._fda .TxBody .P [0].EG_TextRun =append (_cgg ._fda .TxBody .P [0].EG_TextRun ,_fcdf );};
|
|
|
|
// ValidateWithPath validates the slide passing path informaton for a better
|
|
// error message.
|
|
func (_agb Slide )ValidateWithPath (path string )error {if _abfa :=_agb ._beee .ValidateWithPath (path );_abfa !=nil {return _abfa ;};for _ ,_ggae :=range _agb ._beee .CSld .SpTree .Choice {for _ ,_acaf :=range _ggae .Sp {if _acaf .TxBody !=nil {if len (_acaf .TxBody .P )==0{return _cd .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 ;};
|
|
|
|
// 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 *_gb .CT_Shape ;GraphicFrame *_gb .CT_GraphicalObjectFrame ;Paragraph *_fc .CT_TextParagraph ;Run *_fc .CT_RegularTextRun ;TableInfo *TableInfo ;_ef []rectangle ;_ad int ;_fgc int ;};func (_cdd *chart )X ()*_g .ChartSpace {return _cdd ._cc };
|
|
|
|
// Open opens and reads a document from a file (.pptx).
|
|
func Open (filename string )(*Presentation ,error ){_dec ,_efde :=_bbg .Open (filename );if _efde !=nil {return nil ,_geg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_efde );};defer _dec .Close ();_fbd ,_efde :=_bbg .Stat (filename );if _efde !=nil {return nil ,_geg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_efde );};_ =_fbd ;return Read (_dec ,_fbd .Size ());};
|
|
|
|
// AddTextBox adds an empty textbox to a slide.
|
|
func (_abbccg Slide )AddTextBox ()TextBox {_aef :=_gb .NewCT_GroupShapeChoice ();_abbccg ._beee .CSld .SpTree .Choice =append (_abbccg ._beee .CSld .SpTree .Choice ,_aef );_aefc :=_gb .NewCT_Shape ();_aef .Sp =append (_aef .Sp ,_aefc );_aefc .SpPr =_fc .NewCT_ShapeProperties ();_aefc .SpPr .Xfrm =_fc .NewCT_Transform2D ();_aefc .SpPr .PrstGeom =_fc .NewCT_PresetGeometry2D ();_aefc .SpPr .PrstGeom .PrstAttr =_fc .ST_ShapeTypeRect ;_aefc .NvSpPr =_gb .NewCT_ShapeNonVisual ();_aefc .NvSpPr .CNvSpPr =_fc .NewCT_NonVisualDrawingShapeProps ();_dfda :=true ;_aefc .NvSpPr .CNvSpPr .TxBoxAttr =&_dfda ;_aefc .TxBody =_fc .NewCT_TextBody ();_aefc .TxBody .BodyPr =_fc .NewCT_TextBodyProperties ();_aefc .TxBody .BodyPr .WrapAttr =_fc .ST_TextWrappingTypeSquare ;_aefc .TxBody .BodyPr .SpAutoFit =_fc .NewCT_TextShapeAutofit ();_cfgc :=TextBox {_aefc };_cfgc .Properties ().SetWidth (3*_f .Inch );_cfgc .Properties ().SetHeight (1*_f .Inch );_cfgc .Properties ().SetPosition (0,0);return _cfgc ;};
|
|
|
|
// ShowPr returns the ShowPr property.
|
|
func (_dba PresentationProperties )ShowPr ()*_gb .CT_ShowProperties {return _dba ._fed .ShowPr };var (SlideScreenSize16x9 =SlideScreenSize {12192000,6858000};SlideScreenSize4x3 =SlideScreenSize {9144000,6858000};SlideScreenSizeA4 =SlideScreenSize {9906000,6858000};);
|
|
|
|
// Presentation is the a presentation base document.
|
|
type Presentation struct{_cf .DocBase ;_bga *_gb .Presentation ;_aga _cf .Relationships ;_feda []*_gb .Sld ;_gae []_cf .Relationships ;_beca []*_gb .SldMaster ;_dcdf []_cf .Relationships ;_gcd []*_gb .SldLayout ;_dbc []_cf .Relationships ;_gea []*_fc .Theme ;_daaed []_cf .Relationships ;_dbcb _cf .TableStyles ;_fbg PresentationProperties ;_bdf ViewProperties ;_dfc []*_fc .CT_Hyperlink ;_dbcg []*chart ;_bee []*_gb .HandoutMaster ;_ega []*_gb .NotesMaster ;_age []*_fb .XSDAny ;_fbf map[string ]string ;_fadc string ;};
|
|
|
|
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
|
|
type TableInfo struct{Table *_fc .CT_Table ;Row *_fc .CT_TableRow ;Cell *_fc .CT_TableCell ;RowIndex int ;ColIndex int ;};func (_cedf *Slide )getSlideRels ()_cf .Relationships {_dgaa :=_cedf ._afdce ;for _agg ,_eeed :=range _dgaa .Slides (){if *_cedf ._beee ==*_eeed ._beee {return _dgaa ._gae [len (_dgaa ._gae )-_agg -1];};};return _cf .Relationships {};};
|
|
|
|
// Slides returns the slides in the presentation.
|
|
func (_ace *Presentation )Slides ()[]Slide {_ded :=[]Slide {};for _ccbd ,_eeg :=range _ace ._feda {_ded =append (_ded ,Slide {_ace ._bga .SldIdLst .SldId [_ccbd ],_eeg ,_ace ,nil });};return _ded ;};func (_ffd TextBox )getOff ()*_fc .CT_Point2D {if _ffd ._fabe .SpPr ==nil {_ffd ._fabe .SpPr =_fc .NewCT_ShapeProperties ();};if _ffd ._fabe .SpPr .Xfrm ==nil {_ffd ._fabe .SpPr .Xfrm =_fc .NewCT_Transform2D ();};if _ffd ._fabe .SpPr .Xfrm .Off ==nil {_ffd ._fabe .SpPr .Xfrm .Off =_fc .NewCT_Point2D ();};return _ffd ._fabe .SpPr .Xfrm .Off ;};
|
|
|
|
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
|
|
func (_ecae Slide )AddImageToRels (img _cf .ImageRef )string {_dagfa :=0;for _aaca ,_eae :=range _ecae ._afdce .Images {if _eae ==img {_dagfa =_aaca +1;break ;};};var _ebac string ;for _bebg ,_cdcc :=range _ecae ._afdce .Slides (){if _cdcc ._beee ==_ecae ._beee {_ffc :=_geg .Sprintf ("\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",_dagfa ,img .Format ());_adaa :=_ecae ._afdce ._gae [_bebg ].AddRelationship (_ffc ,_fb .ImageType );_ebac =_adaa .ID ();};};return _ebac ;};
|
|
|
|
// RemoveSlide removes a slide from a presentation.
|
|
func (_cadd *Presentation )RemoveSlide (s Slide )error {_gefa :=false ;_fadcfg :=0;for _cebg ,_fdddb :=range _cadd ._feda {if _fdddb ==s ._beee {if _cadd ._bga .SldIdLst .SldId [_cebg ]!=s ._gad {return _cd .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 (_cadd ._feda [_cebg :],_cadd ._feda [_cebg +1:]);_cadd ._feda =_cadd ._feda [0:len (_cadd ._feda )-1];copy (_cadd ._gae [_cebg :],_cadd ._gae [_cebg +1:]);_cadd ._gae =_cadd ._gae [0:len (_cadd ._gae )-1];copy (_cadd ._bga .SldIdLst .SldId [_cebg :],_cadd ._bga .SldIdLst .SldId [_cebg +1:]);_cadd ._bga .SldIdLst .SldId =_cadd ._bga .SldIdLst .SldId [0:len (_cadd ._bga .SldIdLst .SldId )-1];_gefa =true ;_fadcfg =_cebg ;};};if !_gefa {return _cd .New ("u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065");};_fgdff :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideType ,0);return _cadd .ContentTypes .RemoveOverrideByIndex (_fgdff ,_fadcfg );};
|
|
|
|
// Type returns the placeholder type
|
|
func (_gcc PlaceHolder )Type ()_gb .ST_PlaceholderType {return _gcc ._fda .NvSpPr .NvPr .Ph .TypeAttr };
|
|
|
|
// AddParagraph adds a paragraph to the text box
|
|
func (_gdafa TextBox )AddParagraph ()_de .Paragraph {_efg :=_fc .NewCT_TextParagraph ();_gdafa ._fabe .TxBody .P =append (_gdafa ._fabe .TxBody .P ,_efg );return _de .MakeParagraph (_efg );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fcc ViewProperties )X ()*_gb .ViewPr {return _fcc ._ccff };
|
|
|
|
// GetSlideLayout returns a slide layout related to the slide.
|
|
func (_bbf *Slide )GetSlideLayout ()*_gb .SldLayout {for _gecf ,_afcd :=range _bbf ._afdce .Slides (){if *_bbf ==_afcd {return _bbf ._afdce ._gcd [len (_bbf ._afdce .Slides ())-_gecf -1];};};return nil ;};
|
|
|
|
// Index returns the placeholder index
|
|
func (_cdbf PlaceHolder )Index ()uint32 {if _cdbf ._fda .NvSpPr .NvPr .Ph .IdxAttr ==nil {return 0;};return *_cdbf ._fda .NvSpPr .NvPr .Ph .IdxAttr ;};
|
|
|
|
// LastViewAttr returns the LastViewAttr property.
|
|
func (_dgge ViewProperties )LastViewAttr ()_gb .ST_ViewType {return _dgge ._ccff .LastViewAttr };
|
|
|
|
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
|
|
func (_dac *Presentation )SaveAsTemplate (w _ge .Writer )error {return _dac .save (w ,true )};type chart struct{_cc *_g .ChartSpace ;_aa string ;_gc string ;};
|
|
|
|
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
|
|
// slide.
|
|
func (_caac *Slide )GetChartSpaceByRelId (relId string )*_g .ChartSpace {_fggb :=_caac .getSlideRels ();if (_fggb ==_cf .Relationships {}){return nil ;};_fbdg :=_fggb .GetTargetByRelId (relId );for _ ,_gcba :=range _caac ._afdce ._dbcg {if _fbdg ==_gcba .Target (){return _gcba ._cc ;};};return nil ;};
|
|
|
|
// SlideViewPr returns the SlideViewPr property.
|
|
func (_ceag ViewProperties )SlideViewPr ()*_gb .CT_SlideViewProperties {return _ceag ._ccff .SlideViewPr };func _aee (_aafg []*_gb .CT_GroupShapeChoice )[]*_gb .CT_GroupShapeChoice {var _acg []*_gb .CT_GroupShapeChoice ;for _ ,_adgc :=range _aafg {if len (_adgc .Pic )==0{_acg =append (_acg ,_adgc );};};return _acg ;};
|
|
|
|
// 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 (_ddfa Slide )GetPlaceholder (t _gb .ST_PlaceholderType )(PlaceHolder ,error ){for _ ,_ced :=range _ddfa ._beee .CSld .SpTree .Choice {for _ ,_cfb :=range _ced .Sp {if _cfb .NvSpPr !=nil &&_cfb .NvSpPr .NvPr !=nil &&_cfb .NvSpPr .NvPr .Ph !=nil {if _cfb .NvSpPr .NvPr .Ph .TypeAttr ==t {return PlaceHolder {_cfb ,_ddfa ._beee },nil ;};};};};return PlaceHolder {},_cd .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");};
|
|
|
|
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
|
|
type PresentationText struct{Slides []*SlideText ;};func (_dee *chart )RelId ()string {return _dee ._aa };
|
|
|
|
// PrnPr returns the PrnPr property.
|
|
func (_deae PresentationProperties )PrnPr ()*_gb .CT_PrintProperties {return _deae ._fed .PrnPr };
|
|
|
|
// Type returns the type of the slide layout.
|
|
func (_ccdf SlideLayout )Type ()_gb .ST_SlideLayoutType {return _ccdf ._dca .TypeAttr };
|
|
|
|
// OpenTemplate opens a template file.
|
|
func OpenTemplate (fn string )(*Presentation ,error ){_cfa ,_dd :=Open (fn );if _dd !=nil {return nil ,_dd ;};return _cfa ,nil ;};func (_fcad *Presentation )onNewRelationship (_accb *_c .DecodeMap ,_ade ,_ccf string ,_bgf []*_bg .File ,_ebg *_e .Relationship ,_cgd _c .Target )error {_agad :=_fb .DocTypePresentation ;switch _ccf {case _fb .OfficeDocumentType :_fcad ._bga =_gb .NewPresentation ();_accb .AddTarget (_ade ,_fcad ._bga ,_ccf ,0);_accb .AddTarget (_c .RelationsPathFor (_ade ),_fcad ._aga .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .CorePropertiesType :_accb .AddTarget (_ade ,_fcad .CoreProperties .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .CustomPropertiesType :_accb .AddTarget (_ade ,_fcad .CustomProperties .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .PresentationPropertiesType :_accb .AddTarget (_ade ,_fcad ._fbg .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .ViewPropertiesType :_accb .AddTarget (_ade ,_fcad ._bdf .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .TableStylesType :_accb .AddTarget (_ade ,_fcad ._dbcb .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .HyperLinkType :_bgcc :=_fc .NewCT_Hyperlink ();_fdgd :=uint32 (len (_fcad ._dfc ));_accb .AddTarget (_ade ,_bgcc ,_ccf ,_fdgd );_fcad ._dfc =append (_fcad ._dfc ,_bgcc );case _fb .CustomXMLType :_afd :=&_fb .XSDAny {};_bed :=uint32 (len (_fcad ._age ));_accb .AddTarget (_ade ,_afd ,_ccf ,_bed );_fcad ._age =append (_fcad ._age ,_afd );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._age ));case _fb .ChartType :_bggcb :=chart {_cc :_g .NewChartSpace ()};_cea :=uint32 (len (_fcad ._dbcg ));_accb .AddTarget (_ade ,_bggcb ._cc ,_ccf ,_cea );_fcad ._dbcg =append (_fcad ._dbcg ,&_bggcb );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._dbcg ));_bggcb ._gc =_ebg .TargetAttr ;case _fb .HandoutMasterType :_fbb :=_gb .NewHandoutMaster ();_fdeg :=uint32 (len (_fcad ._bee ));_accb .AddTarget (_ade ,_fbb ,_ccf ,_fdeg );_fcad ._bee =append (_fcad ._bee ,_fbb );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._bee ));case _fb .NotesMasterType :_fddd :=_gb .NewNotesMaster ();_abfe :=uint32 (len (_fcad ._ega ));_accb .AddTarget (_ade ,_fddd ,_ccf ,_abfe );_fcad ._ega =append (_fcad ._ega ,_fddd );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._ega ));case _fb .ExtendedPropertiesType :_accb .AddTarget (_ade ,_fcad .AppProperties .X (),_ccf ,0);_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,0);case _fb .SlideType :_cfe :=_gb .NewSld ();_fcad ._feda =append (_fcad ._feda ,_cfe );_accb .AddTarget (_ade ,_cfe ,_ccf ,uint32 (len (_fcad ._feda )));_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._feda ));_abbcc :=_cf .NewRelationships ();_accb .AddTarget (_c .RelationsPathFor (_ade ),_abbcc .X (),_ccf ,0);_fcad ._gae =append (_fcad ._gae ,_abbcc );case _fb .SlideMasterType :_bgca :=_gb .NewSldMaster ();if !_accb .AddTarget (_ade ,_bgca ,_ccf ,uint32 (len (_fcad ._beca )+1)){return nil ;};_fcad ._beca =append (_fcad ._beca ,_bgca );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._beca ));_dagf :=_cf .NewRelationships ();_accb .AddTarget (_c .RelationsPathFor (_ade ),_dagf .X (),_ccf ,0);_fcad ._dcdf =append (_fcad ._dcdf ,_dagf );case _fb .SlideLayoutType :_gcdaf :=_gb .NewSldLayout ();if !_accb .AddTarget (_ade ,_gcdaf ,_ccf ,uint32 (len (_fcad ._gcd )+1)){return nil ;};_fcad ._gcd =append (_fcad ._gcd ,_gcdaf );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._gcd ));_fbdf :=_cf .NewRelationships ();_accb .AddTarget (_c .RelationsPathFor (_ade ),_fbdf .X (),_ccf ,0);_fcad ._dbc =append (_fcad ._dbc ,_fbdf );case _fb .ThumbnailType :for _bcgf ,_bbaf :=range _bgf {if _bbaf ==nil {continue ;};if _bbaf .Name ==_ade {_gabf ,_gfef :=_bbaf .Open ();if _gfef !=nil {return _geg .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_gfef );};_fcad .Thumbnail ,_ ,_gfef =_ac .Decode (_gabf );_gabf .Close ();if _gfef !=nil {return _geg .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",_gfef );};_bgf [_bcgf ]=nil ;};};case _fb .ThemeType :_gcfb :=_fc .NewTheme ();if !_accb .AddTarget (_ade ,_gcfb ,_ccf ,uint32 (len (_fcad ._gea )+1)){return nil ;};_fcad ._gea =append (_fcad ._gea ,_gcfb );_ebg .TargetAttr =_fb .RelativeFilename (_agad ,_cgd .Typ ,_ccf ,len (_fcad ._gea ));_efcb :=_cf .NewRelationships ();_accb .AddTarget (_c .RelationsPathFor (_ade ),_efcb .X (),_ccf ,0);_fcad ._daaed =append (_fcad ._daaed ,_efcb );case _fb .ImageType :_ade =_ec .Clean (_ade );if _fabg ,_bcea :=_fcad ._fbf [_ade ];_bcea {_ebg .TargetAttr =_fabg ;return nil ;};_cfae :="";for _efee ,_fabb :=range _bgf {if _fabb ==nil {continue ;};if _fabb .Name ==_ade {_edg ,_adf :=_c .ExtractToDiskTmp (_fabb ,_fcad .TmpPath );if _adf !=nil {return _adf ;};_adcf ,_adf :=_cf .ImageFromStorage (_edg );if _adf !=nil {return _adf ;};_cfae =_adcf .Format ;_ecde :=_cf .MakeImageRef (_adcf ,&_fcad .DocBase ,_fcad ._aga );_ecde .SetTarget ("\u002e\u002e\u002f"+_ade [4:]);_fcad .Images =append (_fcad .Images ,_ecde );_bgf [_efee ]=nil ;_accb .RecordIndex (_ade ,len (_fcad .Images ));break ;};};_bbd :=_accb .IndexFor (_ade );_ebg .TargetAttr =_fb .RelativeImageFilename (_agad ,_cgd .Typ ,_ccf ,_bbd ,_cfae );_fcad ._fbf [_ade ]=_ebg .TargetAttr ;default:_fgd .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",_ccf ,_ade );};return nil ;};func _bd (_eec *Presentation ,_daa *_gb .CT_Shape ,_gg *_gb .CT_GraphicalObjectFrame ,_abc *TableInfo ,_ff *_fc .CT_Transform2D ,_ffa int ,_ag []rectangle ,_dad []*_fc .CT_TextParagraph )[]*TextItem {_be :=[]*TextItem {};var _ebf ,_egc ,_ga ,_dea ,_abe ,_daae int64 ;_abb :=_ff ==nil ;_eeaec :=0;for _ ,_gee :=range _dad {for _ ,_gec :=range _gee .EG_TextRun {if _bfd :=_gec .R ;_bfd !=nil {if !_abb {if _ff .Off !=nil {if _dag :=_ff .Ext ;_dag !=nil {_abe ,_daae =_dag .CxAttr ,_dag .CyAttr ;};if _db :=_ff .Off .XAttr .ST_CoordinateUnqualified ;_db !=nil {_ebf =*_db ;_egc =_ebf +_abe ;_abb =true ;};if _eda :=_ff .Off .YAttr .ST_CoordinateUnqualified ;_eda !=nil {_ga =*_eda ;_dea =_ga +_daae ;_abb =true ;};};};_ged :=append ([]rectangle {},_ag ...);_ged =append (_ged ,rectangle {_acb :_ebf ,_ae :_egc ,_dab :_ga ,_aec :_dea });_be =append (_be ,&TextItem {Presentation :_eec ,Shape :_daa ,GraphicFrame :_gg ,TableInfo :_abc ,Paragraph :_gee ,Run :_bfd ,Text :_bfd .T ,_ef :_ged ,_ad :_ffa ,_fgc :_eeaec });_eeaec ++;};};};return _be ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bae *SlideSize )X ()*_gb .CT_SlideSize {return _bae ._cabc };
|
|
|
|
// Text returns text from a presentation as one string separated with line breaks.
|
|
func (_agd *PresentationText )Text ()string {_fbe :=_cb .NewBuffer ([]byte {});for _ ,_ffg :=range _agd .Slides {_fbe .WriteString (_ffg .Text ());};return _fbe .String ();};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aaf *Presentation )X ()*_gb .Presentation {return _aaf ._bga };func (_dbe *Presentation )saveToFile (_gbfa string ,_bggc bool )error {_cab ,_faa :=_bbg .Create (_gbfa );if _faa !=nil {return _faa ;};defer _cab .Close ();return _dbe .save (_cab ,_bggc );};
|
|
|
|
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
|
|
func NewSlideScreenSize ()SlideScreenSize {return NewSlideScreenSizeWithValue (SlideScreenSize16x9 [0],SlideScreenSize16x9 [1]);};
|
|
|
|
// Text returns text from a slide as one string separated with line breaks.
|
|
func (_cfcb *SlideText )Text ()string {_df :=_cb .NewBuffer ([]byte {});for _ ,_abd :=range _cfcb .Items {if _abd .Text !=""{_df .WriteString (_abd .Text );_df .WriteString ("\u000a");};};return _df .String ();};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_fbdc TextBox )Properties ()_de .ShapeProperties {if _fbdc ._fabe .SpPr ==nil {_fbdc ._fabe .SpPr =_fc .NewCT_ShapeProperties ();};return _de .MakeShapeProperties (_fbdc ._fabe .SpPr );};
|
|
|
|
// GetLayoutByName retrieves a slide layout given a layout name.
|
|
func (_adga *Presentation )GetLayoutByName (name string )(SlideLayout ,error ){for _ ,_fbc :=range _adga ._gcd {if _fbc .CSld .NameAttr !=nil &&name ==*_fbc .CSld .NameAttr {return SlideLayout {_fbc },nil ;};};return SlideLayout {},_cd .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");};
|
|
|
|
// 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 (_adg *Presentation )AddSlideWithLayout (l SlideLayout )(Slide ,error ){_edb :=_gb .NewCT_SlideIdListEntry ();_edb .IdAttr =256;for _ ,_fac :=range _adg ._bga .SldIdLst .SldId {if _fac .IdAttr >=_edb .IdAttr {_edb .IdAttr =_fac .IdAttr +1;};};_adg ._bga .SldIdLst .SldId =append (_adg ._bga .SldIdLst .SldId ,_edb );_egf :=_gb .NewSld ();_fee :=_cb .Buffer {};_edd :=_bb .NewEncoder (&_fee );_facb :=_bb .StartElement {Name :_bb .Name {Local :"\u0073\u006c\u0069d\u0065"}};_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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"});_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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"});_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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"});_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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"});_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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"});_facb .Attr =append (_facb .Attr ,_bb .Attr {Name :_bb .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 _ebbe :=l ._dca .CSld .MarshalXML (_edd ,_facb );_ebbe !=nil {return Slide {},_ebbe ;};_edd .Flush ();_cfd :=_bb .NewDecoder (&_fee );_egf .CSld =_gb .NewCT_CommonSlideData ();if _gcda :=_cfd .Decode (_egf .CSld );_gcda !=nil {return Slide {},_gcda ;};_egf .CSld .NameAttr =nil ;_egf .CSld .SpTree .Choice =_aee (_egf .CSld .SpTree .Choice );_adg ._feda =append (_adg ._feda ,_egf );_ddf :=_adg ._aga .AddAutoRelationship (_fb .DocTypePresentation ,_fb .OfficeDocumentType ,len (_adg ._feda ),_fb .SlideType );_edb .RIdAttr =_ddf .ID ();_bgb :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideType ,len (_adg ._feda ));_adg .ContentTypes .AddOverride (_bgb ,_fb .SlideContentType );_efc :=_cf .NewRelationships ();_adg ._gae =append (_adg ._gae ,_efc );_agaa :=len (_adg ._gae )-1;for _fadf ,_dbb :=range _adg ._gcd {if _dbb ==l .X (){_ccgf :=_adg ._dbc [_fadf ];for _ ,_gfa :=range _ccgf .X ().Relationship {if _gfa .TypeAttr !=_fb .SlideMasterType {_adg ._gae [_agaa ].X ().Relationship =append (_adg ._gae [_agaa ].X ().Relationship ,_gfa );};};_efc .AddAutoRelationship (_fb .DocTypePresentation ,_fb .SlideType ,_fadf +1,_fb .SlideLayoutType );};};_gfe :=Slide {_edb ,_egf ,_adg ,nil };return _gfe ,nil ;};
|
|
|
|
// SlideMasters returns the slide masters defined in the presentation.
|
|
func (_beaa *Presentation )SlideMasters ()[]SlideMaster {_gdaf :=[]SlideMaster {};for _beg ,_feg :=range _beaa ._beca {_gdaf =append (_gdaf ,SlideMaster {_beaa ,_beaa ._dcdf [_beg ],_feg });};return _gdaf ;};
|
|
|
|
// AddImage adds an image textbox to a slide.
|
|
func (_bdc Slide )AddImage (img _cf .ImageRef )Image {_bde :=_gb .NewCT_GroupShapeChoice ();_bdc ._beee .CSld .SpTree .Choice =append (_bdc ._beee .CSld .SpTree .Choice ,_bde );_cdg :=_gb .NewCT_Picture ();_bde .Pic =append (_bde .Pic ,_cdg );_cdg .NvPicPr .CNvPicPr =_fc .NewCT_NonVisualPictureProperties ();_cdg .NvPicPr .CNvPicPr .PicLocks =_fc .NewCT_PictureLocking ();_cdg .NvPicPr .CNvPicPr .PicLocks .NoChangeAspectAttr =_fb .Bool (true );_cdg .BlipFill =_fc .NewCT_BlipFillProperties ();_cdg .BlipFill .Blip =_fc .NewCT_Blip ();_aabf :=_bdc .AddImageToRels (img );_cdg .BlipFill .Blip .EmbedAttr =_fb .String (_aabf );_cdg .BlipFill .Stretch =_fc .NewCT_StretchInfoProperties ();_cdg .BlipFill .Stretch .FillRect =_fc .NewCT_RelativeRect ();_cdg .SpPr =_fc .NewCT_ShapeProperties ();_cdg .SpPr .PrstGeom =_fc .NewCT_PresetGeometry2D ();_cdg .SpPr .PrstGeom .PrstAttr =_fc .ST_ShapeTypeRect ;_bgbf :=Image {_cdg };_cggf :=img .Size ();_bgbf .Properties ().SetWidth (_f .Distance (_cggf .X )*_f .Pixel72 );_bgbf .Properties ().SetHeight (_f .Distance (_cggf .Y )*_f .Pixel72 );_bgbf .Properties ().SetPosition (0,0);return _bgbf ;};
|
|
|
|
// SlideLayouts returns the slide layouts defined in the presentation.
|
|
func (_dfba *Presentation )SlideLayouts ()[]SlideLayout {_fdg :=[]SlideLayout {};for _ ,_dfbae :=range _dfba ._gcd {_fdg =append (_fdg ,SlideLayout {_dfbae });};return _fdg ;};
|
|
|
|
// PlaceHolders returns all of the content place holders within a given slide.
|
|
func (_dbg Slide )PlaceHolders ()[]PlaceHolder {_dadg :=[]PlaceHolder {};for _ ,_ecc :=range _dbg ._beee .CSld .SpTree .Choice {for _ ,_aab :=range _ecc .Sp {if _aab .NvSpPr !=nil &&_aab .NvSpPr .NvPr !=nil &&_aab .NvSpPr .NvPr .Ph !=nil {_dadg =append (_dadg ,PlaceHolder {_aab ,_dbg ._beee });};};};return _dadg ;};
|
|
|
|
// NormalViewPr returns the NormalViewPr property.
|
|
func (_ffag ViewProperties )NormalViewPr ()*_gb .CT_NormalViewProperties {return _ffag ._ccff .NormalViewPr ;};
|
|
|
|
// 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 (_cee *Presentation )AddDefaultSlideWithLayout (l SlideLayout )(Slide ,error ){_cbcg ,_bdff :=_cee .AddSlideWithLayout (l );for _ ,_afc :=range _cbcg .PlaceHolders (){_afc .Clear ();switch _afc .Type (){case _gb .ST_PlaceholderTypeFtr ,_gb .ST_PlaceholderTypeDt ,_gb .ST_PlaceholderTypeSldNum :_afc .Remove ();};};return _cbcg ,_bdff ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_afg Image )Properties ()_de .ShapeProperties {if _afg ._ceg .SpPr ==nil {_afg ._ceg .SpPr =_fc .NewCT_ShapeProperties ();};return _de .MakeShapeProperties (_afg ._ceg .SpPr );};
|
|
|
|
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
|
|
func (_gbbb TextBox )SetOffsetX (offX float64 ){_aegf :=_gbbb .getOff ();_bdaa :=_f .ToEMU (offX );_aegf .XAttr =_fc .ST_Coordinate {ST_CoordinateUnqualified :&_bdaa };};
|
|
|
|
// 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 };};
|
|
|
|
// ViewProperties contains presentation specific properties.
|
|
type ViewProperties struct{_ccff *_gb .ViewPr };
|
|
|
|
// 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 (_gde *Presentation )AddImage (i _cf .Image )(_cf .ImageRef ,error ){_ebdc :=_cf .MakeImageRef (i ,&_gde .DocBase ,_gde ._aga );if i .Data ==nil &&i .Path ==""{return _ebdc ,_cd .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 _ebdc ,_cd .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 _ebdc ,_cd .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 !=""{_gcbb :=_a .Add (i .Path );if _gcbb !=nil {return _ebdc ,_gcbb ;};};_gde .Images =append (_gde .Images ,_ebdc );_gde .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_gde .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_gde .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_gde .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_gde .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );return _ebdc ,nil ;};
|
|
|
|
// Size returns slide size value as SlideScreenSize.
|
|
func (_fbee *SlideSize )Size ()SlideScreenSize {return SlideScreenSize {_fbee ._cabc .CxAttr ,_fbee ._cabc .CyAttr };};
|
|
|
|
// 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 (_cgf PlaceHolder )Clear (){_cgf .ClearAll ();_gcf :=_fc .NewCT_TextParagraph ();_cgf ._fda .TxBody .P =[]*_fc .CT_TextParagraph {_gcf };_gcf .EndParaRPr =_fc .NewCT_TextCharacterProperties ();_gcf .EndParaRPr .LangAttr =_fb .String ("\u0065\u006e\u002dU\u0053");};var _dbf =false ;
|
|
|
|
// Paragraphs returns the paragraphs defined in the placeholder.
|
|
func (_cde PlaceHolder )Paragraphs ()[]_de .Paragraph {_ebb :=[]_de .Paragraph {};for _ ,_dgg :=range _cde ._fda .TxBody .P {_ebb =append (_ebb ,_de .MakeParagraph (_dgg ));};return _ebb ;};
|
|
|
|
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
|
|
func (_fdddg *Presentation )GetTableStyleById (id string )*_fc .CT_TableStyle {_afge :=_fdddg ._dbcb .TblStyle ();for _ ,_fedd :=range _afge {if _fedd .StyleIdAttr ==id {return _fedd ;};};return nil ;};
|
|
|
|
// GetTextBoxes returns a list of all text boxes from a slide.
|
|
func (_dfbc Slide )GetTextBoxes ()[]*TextBox {_ba :=[]*TextBox {};_beec :=_dfbc ._beee .CSld .SpTree .Choice ;for _ ,_dagcc :=range _beec {for _ ,_cced :=range _dagcc .Sp {if _cced .NvSpPr .CNvSpPr .TxBoxAttr !=nil &&*_cced .NvSpPr .CNvSpPr .TxBoxAttr {_ba =append (_ba ,&TextBox {_cced });};};};return _ba ;};
|
|
|
|
// Themes returns an array of presentation themes.
|
|
func (_gac *Presentation )Themes ()[]*_fc .Theme {return _gac ._gea };func (_aaff *Presentation )Validate ()error {if _aeea :=_aaff ._bga .Validate ();_aeea !=nil {return _aeea ;};for _beed ,_aca :=range _aaff .Slides (){if _bgae :=_aca .ValidateWithPath (_geg .Sprintf ("\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]",_beed ));_bgae !=nil {return _bgae ;};};for _cbce ,_cba :=range _aaff ._beca {if _cgeb :=_cba .ValidateWithPath (_geg .Sprintf ("\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d",_cbce ));_cgeb !=nil {return _cgeb ;};};for _ggc ,_deb :=range _aaff ._gcd {if _dfb :=_deb .ValidateWithPath (_geg .Sprintf ("\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d",_ggc ));_dfb !=nil {return _dfb ;};};return nil ;};
|
|
|
|
// TextBox is a text box within a slide.
|
|
type TextBox struct{_fabe *_gb .CT_Shape };
|
|
|
|
// AddParagraph adds a new paragraph to a placeholder.
|
|
func (_gca PlaceHolder )AddParagraph ()_de .Paragraph {_bec :=_de .MakeParagraph (_fc .NewCT_TextParagraph ());_gca ._fda .TxBody .P =append (_gca ._fda .TxBody .P ,_bec .X ());return _bec ;};
|
|
|
|
// AddSlide adds a new slide to the presentation.
|
|
func (_cdag *Presentation )AddSlide ()Slide {_fdc :=_gb .NewCT_SlideIdListEntry ();_fdc .IdAttr =_cdag .nextSlideID ();_cdag ._bga .SldIdLst .SldId =append (_cdag ._bga .SldIdLst .SldId ,_fdc );_agc :=_gb .NewSld ();_agc .CSld .SpTree .NvGrpSpPr .CNvPr .IdAttr =1;_agc .CSld .SpTree .GrpSpPr .Xfrm =_fc .NewCT_GroupTransform2D ();_agc .CSld .SpTree .GrpSpPr .Xfrm .Off =_fc .NewCT_Point2D ();_agc .CSld .SpTree .GrpSpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_fb .Int64 (0);_agc .CSld .SpTree .GrpSpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_fb .Int64 (0);_agc .CSld .SpTree .GrpSpPr .Xfrm .Ext =_fc .NewCT_PositiveSize2D ();_agc .CSld .SpTree .GrpSpPr .Xfrm .Ext .CxAttr =int64 (0*_f .Point );_agc .CSld .SpTree .GrpSpPr .Xfrm .Ext .CyAttr =int64 (0*_f .Point );_agc .CSld .SpTree .GrpSpPr .Xfrm .ChOff =_agc .CSld .SpTree .GrpSpPr .Xfrm .Off ;_agc .CSld .SpTree .GrpSpPr .Xfrm .ChExt =_agc .CSld .SpTree .GrpSpPr .Xfrm .Ext ;_cdag ._feda =append (_cdag ._feda ,_agc );_cgb :=_cdag ._aga .AddAutoRelationship (_fb .DocTypePresentation ,_fb .OfficeDocumentType ,len (_cdag ._feda ),_fb .SlideType );_fdc .RIdAttr =_cgb .ID ();_gfb :=_fb .AbsoluteFilename (_fb .DocTypePresentation ,_fb .SlideType ,len (_cdag ._feda ));_cdag .ContentTypes .AddOverride (_gfb ,_fb .SlideContentType );_dgee :=_cf .NewRelationships ();_cdag ._gae =append (_cdag ._gae ,_dgee );_dgee .AddAutoRelationship (_fb .DocTypePresentation ,_fb .SlideType ,len (_cdag ._gcd ),_fb .SlideLayoutType );return Slide {_fdc ,_agc ,_cdag ,nil };};
|
|
|
|
// ExtractText returns text from a slide as a SlideText object.
|
|
func (_eb *Slide )ExtractText ()*SlideText {_cda :=_ee (_eb ._afdce ,_eb ._beee .CSld .SpTree .Choice ,[]rectangle {},[]*TextItem {});_af .Sort (sort2d (_cda ));return &SlideText {Items :_cda };};
|
|
|
|
// Presentation returns a slide's presentation.
|
|
func (_agbf Slide )Presentation ()*Presentation {return _agbf ._afdce };
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_dcd PresentationProperties )ExtLst ()*_gb .CT_ExtensionList {return _dcd ._fed .ExtLst };func (_eccb *Slide )ensureClrMap (){if len (_eccb ._afdce ._beca )==0||len (_eccb ._afdce ._gea )==0{return ;};_gcfg :=_eccb ._afdce ._beca [0];_dgde :=_gcfg .ClrMap ;if _eaa :=_eccb ._beee .ClrMapOvr ;_eaa !=nil {if _ffbge :=_eaa .Choice ;_ffbge !=nil {if _ffbge .MasterClrMapping ==nil {if _eaad :=_ffbge .OverrideClrMapping ;_eaad !=nil {if _eaad .Bg1Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Bg1Attr =_eaad .Bg1Attr ;};if _eaad .Tx1Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Tx1Attr =_eaad .Tx1Attr ;};if _eaad .Bg2Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Bg2Attr =_eaad .Bg2Attr ;};if _eaad .Tx2Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Tx2Attr =_eaad .Tx2Attr ;};if _eaad .Accent1Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent1Attr =_eaad .Accent1Attr ;};if _eaad .Accent2Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent2Attr =_eaad .Accent2Attr ;};if _eaad .Accent3Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent3Attr =_eaad .Accent3Attr ;};if _eaad .Accent4Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent4Attr =_eaad .Accent4Attr ;};if _eaad .Accent5Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent5Attr =_eaad .Accent5Attr ;};if _eaad .Accent6Attr !=_fc .ST_ColorSchemeIndexUnset {_dgde .Accent6Attr =_eaad .Accent6Attr ;};if _eaad .HlinkAttr !=_fc .ST_ColorSchemeIndexUnset {_dgde .HlinkAttr =_eaad .HlinkAttr ;};if _eaad .FolHlinkAttr !=_fc .ST_ColorSchemeIndexUnset {_dgde .FolHlinkAttr =_eaad .FolHlinkAttr ;};};};};};_eccb ._bedf =_dgde ;};
|
|
|
|
// Name returns the name of the slide layout.
|
|
func (_dfa SlideLayout )Name ()string {if _dfa ._dca .CSld !=nil &&_dfa ._dca .CSld .NameAttr !=nil {return *_dfa ._dca .CSld .NameAttr ;};return "";};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_bdg ViewProperties )ExtLst ()*_gb .CT_ExtensionList {return _bdg ._ccff .ExtLst };
|
|
|
|
// ShowCommentsAttr returns the WebPr property.
|
|
func (_ebe ViewProperties )ShowCommentsAttr ()*bool {return _ebe ._ccff .ShowCommentsAttr };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fbbd SlideLayout )X ()*_gb .SldLayout {return _fbbd ._dca };
|
|
|
|
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
|
|
func (_eeea TextBox )SetOffsetY (offY float64 ){_gddf :=_eeea .getOff ();_ddc :=_f .ToEMU (offY );_gddf .YAttr =_fc .ST_Coordinate {ST_CoordinateUnqualified :&_ddc };};
|
|
|
|
// Height returns slide screen size height in EMU units.
|
|
func (_efdd *SlideScreenSize )Height ()int32 {return _efdd [1]};
|
|
|
|
// Close closes the presentation, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_eba *Presentation )Close ()error {if _eba .TmpPath !=""{return _a .RemoveAll (_eba .TmpPath );};return nil ;};
|
|
|
|
// SetSize sets the slide size, take argument of SlideScreenSize.
|
|
func (_ccd *SlideSize )SetSize (sz SlideScreenSize ){_ccd ._cabc .CxAttr =sz [0];_ccd ._cabc .CyAttr =sz [1];};
|
|
|
|
// Read reads a document from an io.Reader.
|
|
func Read (r _ge .ReaderAt ,size int64 )(*Presentation ,error ){const _dagc ="\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064";if !_fg .GetLicenseKey ().IsLicensed ()&&!_dbf {_geg .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");_geg .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 ,_cd .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");};_gdee :=_deed ();_dacd ,_ecbd :=_fg .GenRefId ("\u0070\u0072");if _ecbd !=nil {_fgd .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ecbd );return nil ,_ecbd ;};_gdee ._fadc =_dacd ;if _egec :=_fg .Track (_gdee ._fadc ,_dagc );_egec !=nil {_fgd .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_egec );return nil ,_egec ;};_gddc ,_ecbd :=_a .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078");if _ecbd !=nil {return nil ,_ecbd ;};_gdee .TmpPath =_gddc ;_fgce ,_ecbd :=_bg .NewReader (r ,size );if _ecbd !=nil {return nil ,_geg .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_ecbd );};_gaab :=[]*_bg .File {};_gaab =append (_gaab ,_fgce .File ...);_ffbg :=false ;for _ ,_aebe :=range _gaab {if _aebe .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_ffbg =true ;break ;};};if _ffbg {_gdee .CreateCustomProperties ();};_gedf :=_c .DecodeMap {};_gedf .SetOnNewRelationshipFunc (_gdee .onNewRelationship );_gedf .AddTarget (_fb .ContentTypesFilename ,_gdee .ContentTypes .X (),"",0);_gedf .AddTarget (_fb .BaseRelsFilename ,_gdee .Rels .X (),"",0);if _daac :=_gedf .Decode (_gaab );_daac !=nil {return nil ,_daac ;};for _ ,_eee :=range _gaab {if _eee ==nil {continue ;};if _cfca :=_gdee .AddExtraFileFromZip (_eee );_cfca !=nil {return nil ,_cfca ;};};if _ffbg {_aagd :=false ;for _ ,_fcg :=range _gdee .Rels .X ().Relationship {if _fcg .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_aagd =true ;break ;};};if !_aagd {_gdee .AddCustomRelationships ();};};return _gdee ,nil ;};
|
|
|
|
// NewPresentationProperties constructs a new PresentationProperties.
|
|
func NewPresentationProperties ()PresentationProperties {return PresentationProperties {_fed :_gb .NewPresentationPr ()};};
|
|
|
|
// Slide represents a slide of a presentation.
|
|
type Slide struct{_gad *_gb .CT_SlideIdListEntry ;_beee *_gb .Sld ;_afdce *Presentation ;_bedf *_fc .CT_ColorMapping ;};
|
|
|
|
// SlideScreenSize represents the slide screen size as a 2 element array
|
|
// representing the width and height in EMU units.
|
|
type SlideScreenSize [2]int32 ;
|
|
|
|
// SlideMaster is the slide master for a presentation.
|
|
type SlideMaster struct{_adge *Presentation ;_fcbc _cf .Relationships ;_bca *_gb .SldMaster ;};
|
|
|
|
// ExtractText returns text from a presentation as a PresentationText object.
|
|
func (_add *Presentation )ExtractText ()*PresentationText {_fcd :=[]*SlideText {};for _ ,_bbb :=range _add .Slides (){_cdb :=_bbb .ExtractText ();if _cdb !=nil {_fcd =append (_fcd ,_cdb );};};return &PresentationText {Slides :_fcd };};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_dedc *Presentation )GetColorBySchemeColor (schClr _fc .ST_SchemeColorVal )*_fc .CT_Color {if len (_dedc ._beca )==0||len (_dedc ._gea )==0{return nil ;};var _gga _fc .ST_ColorSchemeIndex ;_ccaf :=_dedc ._beca [0];_dgfg :=_ccaf .ClrMap ;switch schClr .String (){case "\u0062\u0067\u0031":_gga =_dgfg .Bg1Attr ;case "\u0062\u0067\u0032":_gga =_dgfg .Bg2Attr ;case "\u0074\u0078\u0031":_gga =_dgfg .Tx1Attr ;case "\u0074\u0078\u0032":_gga =_dgfg .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_gga =_dgfg .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_gga =_dgfg .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_gga =_dgfg .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_gga =_dgfg .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_gga =_dgfg .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_gga =_dgfg .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_gga =_dgfg .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_gga =_dgfg .FolHlinkAttr ;case "\u0064\u006b\u0031":_gga =_fc .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_gga =_fc .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_gga =_fc .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_gga =_fc .ST_ColorSchemeIndexLt2 ;default:_gga =_fc .ST_ColorSchemeIndexUnset ;};_efcd :=_dedc ._gea [0];_feba :=_efcd .ThemeElements ;if _feba ==nil {return nil ;};var _adcd *_fc .CT_Color ;_eff :=_feba .ClrScheme ;switch _gga .String (){case "\u0064\u006b\u0031":_adcd =_eff .Dk1 ;case "\u0064\u006b\u0032":_adcd =_eff .Dk2 ;case "\u006c\u0074\u0031":_adcd =_eff .Lt1 ;case "\u006c\u0074\u0032":_adcd =_eff .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_adcd =_eff .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_adcd =_eff .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_adcd =_eff .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_adcd =_eff .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_adcd =_eff .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_adcd =_eff .Accent6 ;case "\u0068\u006c\u0069n\u006b":_adcd =_eff .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_adcd =_eff .FolHlink ;default:return nil ;};return _adcd ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ddd Slide )X ()*_gb .Sld {return _ddd ._beee };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_beb PresentationProperties )X ()*_gb .PresentationPr {return _beb ._fed };
|
|
|
|
// 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 (_agcg Slide )GetPlaceholderByIndex (idx uint32 )(PlaceHolder ,error ){for _ ,_gbb :=range _agcg ._beee .CSld .SpTree .Choice {for _ ,_agee :=range _gbb .Sp {if _agee .NvSpPr !=nil &&_agee .NvSpPr .NvPr !=nil &&_agee .NvSpPr .NvPr .Ph !=nil {if (idx ==0&&_agee .NvSpPr .NvPr .Ph .IdxAttr ==nil )||(_agee .NvSpPr .NvPr .Ph .IdxAttr !=nil &&*_agee .NvSpPr .NvPr .Ph .IdxAttr ==idx ){return PlaceHolder {_agee ,_agcg ._beee },nil ;};};};};return PlaceHolder {},_cd .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");};type rectangle struct{_acb int64 ;_dab int64 ;_ae int64 ;_aec int64 ;};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_agce *Slide )GetColorBySchemeColor (schClr _fc .ST_SchemeColorVal )*_fc .CT_Color {_agce .ensureClrMap ();_aad :=_agce ._bedf ;if _aad ==nil {return nil ;};var _bdcc _fc .ST_ColorSchemeIndex ;switch schClr .String (){case "\u0062\u0067\u0031":_bdcc =_aad .Bg1Attr ;case "\u0062\u0067\u0032":_bdcc =_aad .Bg2Attr ;case "\u0074\u0078\u0031":_bdcc =_aad .Tx1Attr ;case "\u0074\u0078\u0032":_bdcc =_aad .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_bdcc =_aad .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_bdcc =_aad .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_bdcc =_aad .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_bdcc =_aad .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_bdcc =_aad .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_bdcc =_aad .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_bdcc =_aad .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_bdcc =_aad .FolHlinkAttr ;case "\u0064\u006b\u0031":_bdcc =_fc .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_bdcc =_fc .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_bdcc =_fc .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_bdcc =_fc .ST_ColorSchemeIndexLt2 ;default:_bdcc =_fc .ST_ColorSchemeIndexUnset ;};_dage :=_agce ._afdce ._gea [0];_fcag :=_dage .ThemeElements ;if _fcag ==nil {return nil ;};var _deg *_fc .CT_Color ;_cfgd :=_fcag .ClrScheme ;switch _bdcc .String (){case "\u0064\u006b\u0031":_deg =_cfgd .Dk1 ;case "\u0064\u006b\u0032":_deg =_cfgd .Dk2 ;case "\u006c\u0074\u0031":_deg =_cfgd .Lt1 ;case "\u006c\u0074\u0032":_deg =_cfgd .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_deg =_cfgd .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_deg =_cfgd .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_deg =_cfgd .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_deg =_cfgd .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_deg =_cfgd .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_deg =_cfgd .Accent6 ;case "\u0068\u006c\u0069n\u006b":_deg =_cfgd .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_deg =_cfgd .FolHlink ;default:return nil ;};return _deg ;};
|
|
|
|
// HtmlPubPr returns the HtmlPubPr property.
|
|
func (_fagg PresentationProperties )HtmlPubPr ()*_gb .CT_HtmlPublishProperties {return _fagg ._fed .HtmlPubPr ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_abbc PlaceHolder )X ()*_gb .CT_Shape {return _abbc ._fda };
|
|
|
|
// WebPr returns the WebPr property.
|
|
func (_dfd PresentationProperties )WebPr ()*_gb .CT_WebProperties {return _dfd ._fed .WebPr };
|
|
|
|
// NotesViewPr returns the NotesViewPr property.
|
|
func (_eeaa ViewProperties )NotesViewPr ()*_gb .CT_NotesViewProperties {return _eeaa ._ccff .NotesViewPr };type sort2d []*TextItem ;func _ee (_bc *Presentation ,_bf []*_gb .CT_GroupShapeChoice ,_eea []rectangle ,_ada []*TextItem )[]*TextItem {for _ ,_ab :=range _bf {_fe :=append ([]rectangle {},_eea ...);for _ ,_fca :=range _ab .Sp {_ada =append (_ada ,_bd (_bc ,_fca ,nil ,nil ,_fca .SpPr .Xfrm ,0,_eea ,_fca .TxBody .P )...);};for _ ,_fd :=range _ab .GraphicFrame {if _fd !=nil &&_fd .Graphic !=nil &&_fd .Graphic .GraphicData !=nil {_afb :=_fd .Xfrm ;for _ ,_efd :=range _fd .Graphic .GraphicData .Any {if _eca ,_afba :=_efd .(*_fc .Tbl );_afba {_ccb :=&_eca .CT_Table ;_egg :=0;for _efa ,_fa :=range _eca .Tr {for _fad ,_cca :=range _fa .Tc {_geb :=&TableInfo {Table :_ccb ,Row :_fa ,Cell :_cca ,RowIndex :_efa ,ColIndex :_fad };_ada =append (_ada ,_bd (_bc ,nil ,_fd ,_geb ,_afb ,_egg ,_eea ,_cca .TxBody .P )...);_egg ++;};};};};};};for _ ,_ecf :=range _ab .GrpSp {if _ecf .GrpSpPr !=nil {_ed :=_ecf .GrpSpPr .Xfrm ;var _eed ,_fag int64 ;if _ed .Off !=nil {_eeae ,_fde :=_ed .Off .XAttr .ST_CoordinateUnqualified ,_ed .Off .YAttr .ST_CoordinateUnqualified ;if _eeae !=nil &&_fde !=nil {if _egd :=_ed .Ext ;_egd !=nil {_eed ,_fag =_egd .CxAttr ,_egd .CyAttr ;};_fe =append (_fe ,rectangle {_acb :*_eeae ,_dab :*_fde ,_ae :*_eeae +_eed ,_aec :*_fde +_fag });};};};_ada =_ee (_bc ,_ecf .Choice ,_fe ,_ada );};};return _ada ;};
|
|
|
|
// NewViewProperties constructs a new ViewProperties.
|
|
func NewViewProperties ()ViewProperties {return ViewProperties {_ccff :_gb .NewViewPr ()}};func (_eeca sort2d )Len ()int {return len (_eeca )};
|
|
|
|
// ClearAll completely clears a placeholder. To be useable, at least one
|
|
// paragraph must be added after ClearAll via AddParagraph.
|
|
func (_efe PlaceHolder )ClearAll (){_efe ._fda .SpPr =_fc .NewCT_ShapeProperties ();_efe ._fda .TxBody =_fc .NewCT_TextBody ();_efe ._fda .TxBody .LstStyle =_fc .NewCT_TextListStyle ();};
|
|
|
|
// NotesTextViewPr returns the NotesTextViewPr property.
|
|
func (_efdg ViewProperties )NotesTextViewPr ()*_gb .CT_NotesTextViewProperties {return _efdg ._ccff .NotesTextViewPr ;};
|
|
|
|
// Width returns slide screen size width in EMU units.
|
|
func (_afea *SlideScreenSize )Width ()int32 {return _afea [0]};
|
|
|
|
// SetTextAnchor controls the text anchoring
|
|
func (_gbfaf TextBox )SetTextAnchor (a _fc .ST_TextAnchoringType ){_gbfaf ._fabe .TxBody .BodyPr =_fc .NewCT_TextBodyProperties ();_gbfaf ._fabe .TxBody .BodyPr .AnchorAttr =a ;};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// slide.
|
|
func (_dabd *Slide )GetImageByRelID (relID string )(_cf .ImageRef ,bool ){_fgga :=_dabd .getSlideRels ();if (_fgga ==_cf .Relationships {}){return _cf .ImageRef {},false ;};var _bbdd string ;for _ ,_aebg :=range _fgga .X ().Relationship {if _aebg .IdAttr ==relID {_bbdd =_aebg .TargetAttr ;break ;};};for _ ,_adca :=range _dabd ._afdce .Images {if _adca .Target ()==_bbdd {return _adca ,true ;};};return _cf .ImageRef {},false ;};
|
|
|
|
// Less is for implementing sorting of two locations. Symbols share the same location if they are in the same paragraph or table. One location is 'less' than another first by y coordinate, if y coordinates are equal or differ by less than yEpsilon, then x coordinates are compared, then if they are also equal, indexes of locations in the table are compared, then positions of locations in a paragraph.
|
|
func (_bfa sort2d )Less (i ,j int )bool {_gaf ,_cef :=_bfa [i ],_bfa [j ];_ccab ,_cbb :=_gaf ._ef ,_cef ._ef ;_cg ,_afe :=len (_ccab )-1,len (_cbb )-1;_fcf ,_dgf :=0,0;for {_dff ,_gd ,_gbf ,_aae ,_bce ,_fff ,_dc ,_gdc :=_ccab [_fcf ]._dab ,_cbb [_dgf ]._dab ,_ccab [_fcf ]._aec ,_cbb [_dgf ]._aec ,_ccab [_fcf ]._acb ,_cbb [_dgf ]._acb ,_ccab [_fcf ]._ae ,_cbb [_dgf ]._ae ;if _dff ==_gd ||((_cfc .Abs (float64 (_dff )-float64 (_gd ))< _dge )&&((_dff >=_gd &&_dff <=_aae )||(_gd >=_dff &&_gd <=_gbf ))&&(_dc < _fff ||_bce > _gdc )){if _bce ==_fff {if _fcf < _cg &&_dgf < _afe {_fcf ++;_dgf ++;continue ;};if _fcf >=_cg &&_dgf >=_afe {break ;};return _fcf >=_cg ;}else {return _bce < _fff ;};}else {return _dff < _gd ;};};_fdd ,_feb ,_dbd ,_cbc :=_gaf ._ad ,_cef ._ad ,_gaf ._fgc ,_cef ._fgc ;if _fdd ==_feb {return _dbd <=_cbc ;};return _fdd < _feb ;};
|
|
|
|
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
|
|
func (_deac *Presentation )SaveToFileAsTemplate (path string )error {return _deac .saveToFile (path ,true );};
|
|
|
|
// SetHeight sets height of slide screen size with given value in EMU units.
|
|
func (_aff *SlideScreenSize )SetHeight (val int32 ){_aff [1]=val };
|
|
|
|
// SlideSize returns presentation slide size.
|
|
func (_bbgg *Presentation )SlideSize ()SlideSize {if _bbgg ._bga .SldSz ==nil {_bbgg ._bga .SldSz =_gb .NewCT_SlideSize ();};return SlideSize {_bbgg ._bga .SldSz ,_bbgg };};
|
|
|
|
// SetWidth sets width of slide screen size with given value in EMU units.
|
|
func (_fdaf *SlideScreenSize )SetWidth (val int32 ){_fdaf [0]=val };
|
|
|
|
// OutlineViewPr returns the OutlineViewPr property.
|
|
func (_ggf ViewProperties )OutlineViewPr ()*_gb .CT_OutlineViewProperties {return _ggf ._ccff .OutlineViewPr ;};
|
|
|
|
// Save writes the presentation out to a writer in the Zip package format
|
|
func (_ecgb *Presentation )Save (w _ge .Writer )error {return _ecgb .save (w ,false )};
|
|
|
|
// SlideLayout is a layout from which slides can be created.
|
|
type SlideLayout struct{_dca *_gb .SldLayout };
|
|
|
|
// SlideSize represents a slide size of a presentation.
|
|
type SlideSize struct{_cabc *_gb .CT_SlideSize ;_bdac *Presentation ;};
|
|
|
|
// SorterViewPr returns the SorterViewPr property.
|
|
func (_dfdf ViewProperties )SorterViewPr ()*_gb .CT_SlideSorterViewProperties {return _dfdf ._ccff .SorterViewPr ;};
|
|
|
|
// SlideLayouts returns a slice of all layouts in SlideMaster.
|
|
func (_agdc SlideMaster )SlideLayouts ()[]SlideLayout {_fdea :=map[string ]int {};_dfdac :=[]SlideLayout {};for _ ,_gdb :=range _agdc ._fcbc .Relationships (){_gabc :=_b .Replace (_gdb .Target (),".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074","",-1);_gabc =_b .Replace (_gabc ,"\u002e\u0078\u006d\u006c","",-1);if _aebb ,_ecbc :=_da .ParseInt (_gabc ,10,32);_ecbc ==nil {_fdea [_gdb .ID ()]=int (_aebb );};};for _ ,_abbbd :=range _agdc ._bca .SldLayoutIdLst .SldLayoutId {if _bgfa ,_abdd :=_fdea [_abbbd .RIdAttr ];_abdd {_efca :=_agdc ._adge ._gcd [_bgfa -1];_dfdac =append (_dfdac ,SlideLayout {_efca });};};return _dfdac ;};func (_dga *Presentation )nextSlideID ()uint32 {_afbc :=uint32 (256);for _ ,_deaf :=range _dga ._bga .SldIdLst .SldId {if _deaf .IdAttr >=_afbc {_afbc =_deaf .IdAttr +1;};};return _afbc ;};func (_bdd sort2d )Swap (i ,j int ){_bdd [i ],_bdd [j ]=_bdd [j ],_bdd [i ]};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cfac SlideMaster )X ()*_gb .SldMaster {return _cfac ._bca };
|
|
|
|
// Image is an image within a slide.
|
|
type Image struct{_ceg *_gb .CT_Picture };
|
|
|
|
// GridSpacing returns the GridSpacing property.
|
|
func (_cfcg ViewProperties )GridSpacing ()*_fc .CT_PositiveSize2D {return _cfcg ._ccff .GridSpacing }; |