mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +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 (_dg "archive/zip";_fa "bytes";_da "encoding/xml";_fg "errors";_bg "fmt";_ba "github.com/unidoc/unioffice";_c "github.com/unidoc/unioffice/common";_d "github.com/unidoc/unioffice/common/logger";_b "github.com/unidoc/unioffice/common/tempstorage";_ae "github.com/unidoc/unioffice/drawing";_ebb "github.com/unidoc/unioffice/internal/license";_fc "github.com/unidoc/unioffice/measurement";_ef "github.com/unidoc/unioffice/schema/soo/dml";_e "github.com/unidoc/unioffice/schema/soo/dml/chart";_ab "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_ec "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_bd "github.com/unidoc/unioffice/schema/soo/pml";_eb "github.com/unidoc/unioffice/zippkg";_eg "image";_gd "image/jpeg";_ga "io";_aed "math";_fb "os";_g "path";_gb "sort";_f "strconv";_ad "strings";);func (_cfae *Presentation )save (_ebc _ga .Writer ,_egfe bool )error {const _fcbe ="\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065";if _cca :=_cfae ._bag .Validate ();_cca !=nil {_d .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",_cca );};if !_ebb .GetLicenseKey ().IsLicensed ()&&!_dfce {_bg .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");_bg .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 _fg .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 (_cfae ._cgb )==0{_ccaa ,_eaea :=_ebb .GenRefId ("\u0070\u0077");if _eaea !=nil {_d .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_eaea );return _eaea ;};_cfae ._cgb =_ccaa ;};if _dfbe :=_ebb .Track (_cfae ._cgb ,_fcbe );_dfbe !=nil {_d .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dfbe );return _dfbe ;};if _egfe {_cfae .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");_cfae .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 {_cfae .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");_cfae .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");};_fgde :=_ba .DocTypePresentation ;_fgbe :=_dg .NewWriter (_ebc );defer _fgbe .Close ();if _aefae :=_eb .MarshalXML (_fgbe ,_ba .BaseRelsFilename ,_cfae .Rels .X ());_aefae !=nil {return _aefae ;};if _beff :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .ExtendedPropertiesType ,_cfae .AppProperties .X ());_beff !=nil {return _beff ;};if _addc :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .CorePropertiesType ,_cfae .CoreProperties .X ());_addc !=nil {return _addc ;};if _agc :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .PresentationPropertiesType ,_cfae ._def .X ());_agc !=nil {return _agc ;};if _addf :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .ViewPropertiesType ,_cfae ._cfc .X ());_addf !=nil {return _addf ;};if _fggd :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .TableStylesType ,_cfae ._gbe .X ());_fggd !=nil {return _fggd ;};if _cfae .CustomProperties .X ()!=nil {if _cdge :=_eb .MarshalXMLByType (_fgbe ,_fgde ,_ba .CustomPropertiesType ,_cfae .CustomProperties .X ());_cdge !=nil {return _cdge ;};};if _cfae .Thumbnail !=nil {_fge ,_geeb :=_fgbe .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _geeb !=nil {return _geeb ;};if _ggf :=_gd .Encode (_fge ,_cfae .Thumbnail ,nil );_ggf !=nil {return _ggf ;};};_cgd :=_ba .AbsoluteFilename (_fgde ,_ba .OfficeDocumentType ,0);if _eeg :=_eb .MarshalXML (_fgbe ,_cgd ,_cfae ._bag );_eeg !=nil {return _eeg ;};if _cdd :=_eb .MarshalXML (_fgbe ,_eb .RelationsPathFor (_cgd ),_cfae ._bebf .X ());_cdd !=nil {return _cdd ;};for _fbfd ,_edc :=range _cfae ._cce {_deb :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideType ,_fbfd +1);_eb .MarshalXML (_fgbe ,_deb ,_edc );if !_cfae ._adda [_fbfd ].IsEmpty (){_geb :=_eb .RelationsPathFor (_deb );_eb .MarshalXML (_fgbe ,_geb ,_cfae ._adda [_fbfd ].X ());};};for _eeb ,_cba :=range _cfae ._dde {_facf :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideMasterType ,_eeb +1);_eb .MarshalXML (_fgbe ,_facf ,_cba );if !_cfae ._fbcc [_eeb ].IsEmpty (){_gfbg :=_eb .RelationsPathFor (_facf );_eb .MarshalXML (_fgbe ,_gfbg ,_cfae ._fbcc [_eeb ].X ());};};for _fbd ,_gef :=range _cfae ._ddcg {_ccbf :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideLayoutType ,_fbd +1);_eb .MarshalXML (_fgbe ,_ccbf ,_gef );if !_cfae ._afg [_fbd ].IsEmpty (){_dfd :=_eb .RelationsPathFor (_ccbf );_eb .MarshalXML (_fgbe ,_dfd ,_cfae ._afg [_fbd ].X ());};};for _bfea ,_dcb :=range _cfae ._aef {_daag :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .ThemeType ,_bfea +1);_eb .MarshalXML (_fgbe ,_daag ,_dcb );if !_cfae ._ccc [_bfea ].IsEmpty (){_adef :=_eb .RelationsPathFor (_daag );_eb .MarshalXML (_fgbe ,_adef ,_cfae ._ccc [_bfea ].X ());};};for _cdda ,_dfcb :=range _cfae ._ccec {_fda :=_ba .AbsoluteFilename (_fgde ,_ba .ChartType ,_cdda +1);_eb .MarshalXML (_fgbe ,_fda ,_dfcb );};for _cadfb ,_abcd :=range _cfae ._edf {_ecb :=_ba .AbsoluteFilename (_fgde ,_ba .HandoutMasterType ,_cadfb +1);_eb .MarshalXML (_fgbe ,_ecb ,_abcd );};for _geg ,_ggbg :=range _cfae ._dcag {_gfa :=_ba .AbsoluteFilename (_fgde ,_ba .NotesMasterType ,_geg +1);_eb .MarshalXML (_fgbe ,_gfa ,_ggbg );};for _ecgb ,_cbf :=range _cfae ._agg {_ggea :=_ba .AbsoluteFilename (_fgde ,_ba .CustomXMLType ,_ecgb +1);_eb .MarshalXML (_fgbe ,_ggea ,_cbf );};for _cfce ,_ded :=range _cfae .Images {if _cfb :=_c .AddImageToZip (_fgbe ,_ded ,_cfce +1,_ba .DocTypePresentation );_cfb !=nil {return _cfb ;};};_cfae .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_cfae .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_cfae .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_cfae .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");if _bebg :=_eb .MarshalXML (_fgbe ,_ba .ContentTypesFilename ,_cfae .ContentTypes .X ());_bebg !=nil {return _bebg ;};if _aaaga :=_cfae .WriteExtraFiles (_fgbe );_aaaga !=nil {return _aaaga ;};return nil ;};type sort2d []*TextItem ;func (_gbaa *Presentation )onNewRelationship (_eddb *_eb .DecodeMap ,_fgeg ,_acca string ,_cdbe []*_dg .File ,_fdeg *_ec .Relationship ,_agaf _eb .Target )error {_gfae :=_ba .DocTypePresentation ;switch _acca {case _ba .OfficeDocumentType :_gbaa ._bag =_bd .NewPresentation ();_eddb .AddTarget (_fgeg ,_gbaa ._bag ,_acca ,0);_eddb .AddTarget (_eb .RelationsPathFor (_fgeg ),_gbaa ._bebf .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .CorePropertiesType :_eddb .AddTarget (_fgeg ,_gbaa .CoreProperties .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .CustomPropertiesType :_eddb .AddTarget (_fgeg ,_gbaa .CustomProperties .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .PresentationPropertiesType :_eddb .AddTarget (_fgeg ,_gbaa ._def .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .ViewPropertiesType :_eddb .AddTarget (_fgeg ,_gbaa ._cfc .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .TableStylesType :_eddb .AddTarget (_fgeg ,_gbaa ._gbe .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .HyperLinkType :_cfg :=_ef .NewCT_Hyperlink ();_dgbg :=uint32 (len (_gbaa ._abg ));_eddb .AddTarget (_fgeg ,_cfg ,_acca ,_dgbg );_gbaa ._abg =append (_gbaa ._abg ,_cfg );case _ba .CustomXMLType :_daad :=&_ba .XSDAny {};_cgdb :=uint32 (len (_gbaa ._agg ));_eddb .AddTarget (_fgeg ,_daad ,_acca ,_cgdb );_gbaa ._agg =append (_gbaa ._agg ,_daad );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._agg ));case _ba .ChartType :_egc :=chart {_fgb :_e .NewChartSpace ()};_edcb :=uint32 (len (_gbaa ._ccec ));_eddb .AddTarget (_fgeg ,_egc ._fgb ,_acca ,_edcb );_gbaa ._ccec =append (_gbaa ._ccec ,&_egc );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._ccec ));_egc ._de =_fdeg .TargetAttr ;case _ba .HandoutMasterType :_abag :=_bd .NewHandoutMaster ();_afe :=uint32 (len (_gbaa ._edf ));_eddb .AddTarget (_fgeg ,_abag ,_acca ,_afe );_gbaa ._edf =append (_gbaa ._edf ,_abag );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._edf ));case _ba .NotesMasterType :_fce :=_bd .NewNotesMaster ();_ddcb :=uint32 (len (_gbaa ._dcag ));_eddb .AddTarget (_fgeg ,_fce ,_acca ,_ddcb );_gbaa ._dcag =append (_gbaa ._dcag ,_fce );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._dcag ));case _ba .ExtendedPropertiesType :_eddb .AddTarget (_fgeg ,_gbaa .AppProperties .X (),_acca ,0);_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,0);case _ba .SlideType :_aaf :=_bd .NewSld ();_gbaa ._cce =append (_gbaa ._cce ,_aaf );_eddb .AddTarget (_fgeg ,_aaf ,_acca ,uint32 (len (_gbaa ._cce )));_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._cce ));_fbca :=_c .NewRelationships ();_eddb .AddTarget (_eb .RelationsPathFor (_fgeg ),_fbca .X (),_acca ,0);_gbaa ._adda =append (_gbaa ._adda ,_fbca );case _ba .SlideMasterType :_fbfc :=_bd .NewSldMaster ();if !_eddb .AddTarget (_fgeg ,_fbfc ,_acca ,uint32 (len (_gbaa ._dde )+1)){return nil ;};_gbaa ._dde =append (_gbaa ._dde ,_fbfc );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._dde ));_eebd :=_c .NewRelationships ();_eddb .AddTarget (_eb .RelationsPathFor (_fgeg ),_eebd .X (),_acca ,0);_gbaa ._fbcc =append (_gbaa ._fbcc ,_eebd );case _ba .SlideLayoutType :_dabc :=_bd .NewSldLayout ();if !_eddb .AddTarget (_fgeg ,_dabc ,_acca ,uint32 (len (_gbaa ._ddcg )+1)){return nil ;};_gbaa ._ddcg =append (_gbaa ._ddcg ,_dabc );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._ddcg ));_gcga :=_c .NewRelationships ();_eddb .AddTarget (_eb .RelationsPathFor (_fgeg ),_gcga .X (),_acca ,0);_gbaa ._afg =append (_gbaa ._afg ,_gcga );case _ba .ThumbnailType :for _gfda ,_ecf :=range _cdbe {if _ecf ==nil {continue ;};if _ecf .Name ==_fgeg {_fe ,_edcbf :=_ecf .Open ();if _edcbf !=nil {return _bg .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_edcbf );};_gbaa .Thumbnail ,_ ,_edcbf =_eg .Decode (_fe );_fe .Close ();if _edcbf !=nil {return _bg .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",_edcbf );};_cdbe [_gfda ]=nil ;};};case _ba .ThemeType :_gdgb :=_ef .NewTheme ();if !_eddb .AddTarget (_fgeg ,_gdgb ,_acca ,uint32 (len (_gbaa ._aef )+1)){return nil ;};_gbaa ._aef =append (_gbaa ._aef ,_gdgb );_fdeg .TargetAttr =_ba .RelativeFilename (_gfae ,_agaf .Typ ,_acca ,len (_gbaa ._aef ));_aeef :=_c .NewRelationships ();_eddb .AddTarget (_eb .RelationsPathFor (_fgeg ),_aeef .X (),_acca ,0);_gbaa ._ccc =append (_gbaa ._ccc ,_aeef );case _ba .ImageType :_fgeg =_g .Clean (_fgeg );if _ebg ,_gbb :=_gbaa ._ggb [_fgeg ];_gbb {_fdeg .TargetAttr =_ebg ;return nil ;};_agcf :="";for _agad ,_cfac :=range _cdbe {if _cfac ==nil {continue ;};if _cfac .Name ==_fgeg {_afcf ,_acde :=_eb .ExtractToDiskTmp (_cfac ,_gbaa .TmpPath );if _acde !=nil {return _acde ;};_cdbeg ,_acde :=_c .ImageFromStorage (_afcf );if _acde !=nil {return _acde ;};_agcf =_cdbeg .Format ;_fdf :=_c .MakeImageRef (_cdbeg ,&_gbaa .DocBase ,_gbaa ._bebf );_fdf .SetTarget ("\u002e\u002e\u002f"+_fgeg [4:]);_gbaa .Images =append (_gbaa .Images ,_fdf );_cdbe [_agad ]=nil ;_eddb .RecordIndex (_fgeg ,len (_gbaa .Images ));break ;};};_bbe :=_eddb .IndexFor (_fgeg );_fdeg .TargetAttr =_ba .RelativeImageFilename (_gfae ,_agaf .Typ ,_acca ,_bbe ,_agcf );_gbaa ._ggb [_fgeg ]=_fdeg .TargetAttr ;default:_d .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",_acca ,_fgeg );};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 *_bd .CT_Shape ;GraphicFrame *_bd .CT_GraphicalObjectFrame ;Paragraph *_ef .CT_TextParagraph ;Run *_ef .CT_RegularTextRun ;TableInfo *TableInfo ;_adf []rectangle ;_fga int ;_ff int ;};func _cdb ()*Presentation {_gde :=&Presentation {_bag :_bd .NewPresentation ()};_gde ._bag .SldIdLst =_bd .NewCT_SlideIdList ();_gde ._bag .ConformanceAttr =_ab .ST_ConformanceClassTransitional ;_gde .AppProperties =_c .NewAppProperties ();_gde .CoreProperties =_c .NewCoreProperties ();_gde ._gbe =_c .NewTableStyles ();_gde .ContentTypes =_c .NewContentTypes ();_gde .Rels =_c .NewRelationships ();_gde ._bebf =_c .NewRelationships ();_gde ._def =NewPresentationProperties ();_gde ._cfc =NewViewProperties ();_gde ._ggb =map[string ]string {};return _gde ;};
|
|
|
|
// Read reads a document from an io.Reader.
|
|
func Read (r _ga .ReaderAt ,size int64 )(*Presentation ,error ){const _gga ="\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064";if !_ebb .GetLicenseKey ().IsLicensed ()&&!_dfce {_bg .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");_bg .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 ,_fg .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");};_gdac :=_cdb ();_ffcdc ,_cdbed :=_ebb .GenRefId ("\u0070\u0072");if _cdbed !=nil {_d .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_cdbed );return nil ,_cdbed ;};_gdac ._cgb =_ffcdc ;if _dgd :=_ebb .Track (_gdac ._cgb ,_gga );_dgd !=nil {_d .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dgd );return nil ,_dgd ;};_gfba ,_cdbed :=_b .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078");if _cdbed !=nil {return nil ,_cdbed ;};_gdac .TmpPath =_gfba ;_gab ,_cdbed :=_dg .NewReader (r ,size );if _cdbed !=nil {return nil ,_bg .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_cdbed );};_gacf :=[]*_dg .File {};_gacf =append (_gacf ,_gab .File ...);_dfae :=false ;for _ ,_aadb :=range _gacf {if _aadb .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_dfae =true ;break ;};};if _dfae {_gdac .CreateCustomProperties ();};_cfbg :=_eb .DecodeMap {};_cfbg .SetOnNewRelationshipFunc (_gdac .onNewRelationship );_cfbg .AddTarget (_ba .ContentTypesFilename ,_gdac .ContentTypes .X (),"",0);_cfbg .AddTarget (_ba .BaseRelsFilename ,_gdac .Rels .X (),"",0);if _agac :=_cfbg .Decode (_gacf );_agac !=nil {return nil ,_agac ;};for _ ,_aaba :=range _gacf {if _aaba ==nil {continue ;};if _eabc :=_gdac .AddExtraFileFromZip (_aaba );_eabc !=nil {return nil ,_eabc ;};};if _dfae {_gdeg :=false ;for _ ,_afee :=range _gdac .Rels .X ().Relationship {if _afee .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_gdeg =true ;break ;};};if !_gdeg {_gdac .AddCustomRelationships ();};};return _gdac ,nil ;};
|
|
|
|
// Open opens and reads a document from a file (.pptx).
|
|
func Open (filename string )(*Presentation ,error ){_fgg ,_bc :=_fb .Open (filename );if _bc !=nil {return nil ,_bg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_bc );};defer _fgg .Close ();_aaab ,_bc :=_fb .Stat (filename );if _bc !=nil {return nil ,_bg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_bc );};_ =_aaab ;return Read (_fgg ,_aaab .Size ());};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_bageb ViewProperties )ExtLst ()*_bd .CT_ExtensionList {return _bageb ._dccb .ExtLst };func _aa (_egb *Presentation ,_be []*_bd .CT_GroupShapeChoice ,_dd []rectangle ,_fbg []*TextItem )[]*TextItem {for _ ,_ffcb :=range _be {_ffb :=append ([]rectangle {},_dd ...);for _ ,_adb :=range _ffcb .Sp {_fbg =append (_fbg ,_bec (_egb ,_adb ,nil ,nil ,_adb .SpPr .Xfrm ,0,_dd ,_adb .TxBody .P )...);};for _ ,_abc :=range _ffcb .GraphicFrame {if _abc !=nil &&_abc .Graphic !=nil &&_abc .Graphic .GraphicData !=nil {_dfa :=_abc .Xfrm ;for _ ,_ge :=range _abc .Graphic .GraphicData .Any {if _cfd ,_bef :=_ge .(*_ef .Tbl );_bef {_gae :=&_cfd .CT_Table ;_aaa :=0;for _aab ,_ffbd :=range _cfd .Tr {for _cfde ,_af :=range _ffbd .Tc {_abcg :=&TableInfo {Table :_gae ,Row :_ffbd ,Cell :_af ,RowIndex :_aab ,ColIndex :_cfde };_fbg =append (_fbg ,_bec (_egb ,nil ,_abc ,_abcg ,_dfa ,_aaa ,_dd ,_af .TxBody .P )...);_aaa ++;};};};};};};for _ ,_eac :=range _ffcb .GrpSp {if _eac .GrpSpPr !=nil {_ccd :=_eac .GrpSpPr .Xfrm ;var _fbfa ,_cge int64 ;if _ccd .Off !=nil {_ddc ,_ddf :=_ccd .Off .XAttr .ST_CoordinateUnqualified ,_ccd .Off .YAttr .ST_CoordinateUnqualified ;if _ddc !=nil &&_ddf !=nil {if _efe :=_ccd .Ext ;_efe !=nil {_fbfa ,_cge =_efe .CxAttr ,_efe .CyAttr ;};_ffb =append (_ffb ,rectangle {_ffc :*_ddc ,_adfa :*_ddf ,_gf :*_ddc +_fbfa ,_aba :*_ddf +_cge });};};};_fbg =_aa (_egb ,_eac .Choice ,_ffb ,_fbg );};};return _fbg ;};
|
|
|
|
// WebPr returns the WebPr property.
|
|
func (_bbbc PresentationProperties )WebPr ()*_bd .CT_WebProperties {return _bbbc ._fdg .WebPr };
|
|
|
|
// OpenTemplate opens a template file.
|
|
func OpenTemplate (fn string )(*Presentation ,error ){_ebe ,_bgb :=Open (fn );if _bgb !=nil {return nil ,_bgb ;};return _ebe ,nil ;};
|
|
|
|
// Width returns slide screen size width in EMU units.
|
|
func (_dfcea *SlideScreenSize )Width ()int32 {return _dfcea [0]};func (_cc *chart )X ()*_e .ChartSpace {return _cc ._fgb };
|
|
|
|
// 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 (_adfb *Presentation )AddImage (i _c .Image )(_c .ImageRef ,error ){_ada :=_c .MakeImageRef (i ,&_adfb .DocBase ,_adfb ._bebf );if i .Data ==nil &&i .Path ==""{return _ada ,_fg .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 _ada ,_fg .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 _ada ,_fg .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 !=""{_ffg :=_b .Add (i .Path );if _ffg !=nil {return _ada ,_ffg ;};};_adfb .Images =append (_adfb .Images ,_ada );_adfb .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_adfb .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_adfb .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_adfb .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_adfb .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );return _ada ,nil ;};
|
|
|
|
// ClearAll completely clears a placeholder. To be useable, at least one
|
|
// paragraph must be added after ClearAll via AddParagraph.
|
|
func (_ggd PlaceHolder )ClearAll (){_ggd ._dfab .SpPr =_ef .NewCT_ShapeProperties ();_ggd ._dfab .TxBody =_ef .NewCT_TextBody ();_ggd ._dfab .TxBody .LstStyle =_ef .NewCT_TextListStyle ();};func (_ddd *Presentation )Validate ()error {if _dcf :=_ddd ._bag .Validate ();_dcf !=nil {return _dcf ;};for _cfdc ,_agf :=range _ddd .Slides (){if _eggb :=_agf .ValidateWithPath (_bg .Sprintf ("\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]",_cfdc ));_eggb !=nil {return _eggb ;};};for _gdc ,_dbc :=range _ddd ._dde {if _gfdb :=_dbc .ValidateWithPath (_bg .Sprintf ("\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d",_gdc ));_gfdb !=nil {return _gfdb ;};};for _cfbb ,_gce :=range _ddd ._ddcg {if _eeac :=_gce .ValidateWithPath (_bg .Sprintf ("\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d",_cfbb ));_eeac !=nil {return _eeac ;};};return nil ;};
|
|
|
|
// Close closes the presentation, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_gedg *Presentation )Close ()error {if _gedg .TmpPath !=""{return _b .RemoveAll (_gedg .TmpPath );};return nil ;};
|
|
|
|
// New initializes and reurns a new presentation
|
|
func New ()*Presentation {_cag :=_cdb ();_cag .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");_cag .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");_cag .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");_cag .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");_cag .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");_cag .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");_cag .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");_cag ._bag .SldMasterIdLst =_bd .NewCT_SlideMasterIdList ();_aefa :=_bd .NewSldMaster ();_aefa .ClrMap .Bg1Attr =_ef .ST_ColorSchemeIndexLt1 ;_aefa .ClrMap .Bg2Attr =_ef .ST_ColorSchemeIndexLt2 ;_aefa .ClrMap .Tx1Attr =_ef .ST_ColorSchemeIndexDk1 ;_aefa .ClrMap .Tx2Attr =_ef .ST_ColorSchemeIndexDk2 ;_aefa .ClrMap .Accent1Attr =_ef .ST_ColorSchemeIndexAccent1 ;_aefa .ClrMap .Accent2Attr =_ef .ST_ColorSchemeIndexAccent2 ;_aefa .ClrMap .Accent3Attr =_ef .ST_ColorSchemeIndexAccent3 ;_aefa .ClrMap .Accent4Attr =_ef .ST_ColorSchemeIndexAccent4 ;_aefa .ClrMap .Accent5Attr =_ef .ST_ColorSchemeIndexAccent5 ;_aefa .ClrMap .Accent6Attr =_ef .ST_ColorSchemeIndexAccent6 ;_aefa .ClrMap .HlinkAttr =_ef .ST_ColorSchemeIndexHlink ;_aefa .ClrMap .FolHlinkAttr =_ef .ST_ColorSchemeIndexFolHlink ;_cag ._dde =append (_cag ._dde ,_aefa );_aad :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideMasterType ,1);_cag .ContentTypes .AddOverride (_aad ,_ba .SlideMasterContentType );_ccef :=_cag ._bebf .AddAutoRelationship (_ba .DocTypePresentation ,_ba .OfficeDocumentType ,1,_ba .SlideMasterType );_dcg :=_bd .NewCT_SlideMasterIdListEntry ();_dcg .IdAttr =_ba .Uint32 (2147483648);_dcg .RIdAttr =_ccef .ID ();_cag ._bag .SldMasterIdLst .SldMasterId =append (_cag ._bag .SldMasterIdLst .SldMasterId ,_dcg );_fcbg :=_c .NewRelationships ();_cag ._fbcc =append (_cag ._fbcc ,_fcbg );_ead :=_bd .NewSldLayout ();_dfb :=_fcbg .AddAutoRelationship (_ba .DocTypePresentation ,_ba .SlideMasterType ,1,_ba .SlideLayoutType );_fgd :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideLayoutType ,1);_cag .ContentTypes .AddOverride (_fgd ,_ba .SlideLayoutContentType );_fcbg .AddAutoRelationship (_ba .DocTypePresentation ,_ba .SlideMasterType ,1,_ba .ThemeType );_cag ._ddcg =append (_cag ._ddcg ,_ead );_aefa .SldLayoutIdLst =_bd .NewCT_SlideLayoutIdList ();_daa :=_bd .NewCT_SlideLayoutIdListEntry ();_daa .IdAttr =_ba .Uint32 (2147483649);_daa .RIdAttr =_dfb .ID ();_aefa .SldLayoutIdLst .SldLayoutId =append (_aefa .SldLayoutIdLst .SldLayoutId ,_daa );_fff :=_c .NewRelationships ();_cag ._afg =append (_cag ._afg ,_fff );_fff .AddAutoRelationship (_ba .DocTypePresentation ,_ba .SlideType ,1,_ba .SlideMasterType );_cag ._bag .NotesSz .CxAttr =6858000;_cag ._bag .NotesSz .CyAttr =9144000;_bge :=_ef .NewTheme ();_bge .NameAttr =_ba .String ("\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065");_bge .ThemeElements .ClrScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_bge .ThemeElements .ClrScheme .Dk1 .SysClr =_ef .NewCT_SystemColor ();_bge .ThemeElements .ClrScheme .Dk1 .SysClr .LastClrAttr =_ba .String ("\u0030\u0030\u0030\u0030\u0030\u0030");_bge .ThemeElements .ClrScheme .Dk1 .SysClr .ValAttr =_ef .ST_SystemColorValWindowText ;_bge .ThemeElements .ClrScheme .Lt1 .SysClr =_ef .NewCT_SystemColor ();_bge .ThemeElements .ClrScheme .Lt1 .SysClr .LastClrAttr =_ba .String ("\u0066\u0066\u0066\u0066\u0066\u0066");_bge .ThemeElements .ClrScheme .Lt1 .SysClr .ValAttr =_ef .ST_SystemColorValWindow ;_bge .ThemeElements .ClrScheme .Dk2 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Dk2 .SrgbClr .ValAttr ="\u0034\u0034\u0035\u0034\u0036\u0061";_bge .ThemeElements .ClrScheme .Lt2 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Lt2 .SrgbClr .ValAttr ="\u0065\u0037\u0065\u0037\u0065\u0036";_bge .ThemeElements .ClrScheme .Accent1 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent1 .SrgbClr .ValAttr ="\u0034\u0034\u0037\u0032\u0063\u0034";_bge .ThemeElements .ClrScheme .Accent2 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent2 .SrgbClr .ValAttr ="\u0065\u0064\u0037\u0064\u0033\u0031";_bge .ThemeElements .ClrScheme .Accent3 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent3 .SrgbClr .ValAttr ="\u0061\u0035\u0061\u0035\u0061\u0035";_bge .ThemeElements .ClrScheme .Accent4 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent4 .SrgbClr .ValAttr ="\u0066\u0066\u0063\u0030\u0030\u0030";_bge .ThemeElements .ClrScheme .Accent5 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent5 .SrgbClr .ValAttr ="\u0035\u0062\u0039\u0062\u0064\u0035";_bge .ThemeElements .ClrScheme .Accent6 .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Accent6 .SrgbClr .ValAttr ="\u0037\u0030\u0061\u0064\u0034\u0037";_bge .ThemeElements .ClrScheme .Hlink .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .Hlink .SrgbClr .ValAttr ="\u0030\u0035\u0036\u0033\u0063\u0031";_bge .ThemeElements .ClrScheme .FolHlink .SrgbClr =_ef .NewCT_SRgbColor ();_bge .ThemeElements .ClrScheme .FolHlink .SrgbClr .ValAttr ="\u0039\u0035\u0034\u0066\u0037\u0032";_bge .ThemeElements .FontScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_bge .ThemeElements .FontScheme .MajorFont .Latin .TypefaceAttr ="\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074";_bge .ThemeElements .FontScheme .MinorFont .Latin .TypefaceAttr ="\u0043a\u006c\u0069\u0062\u0072\u0069";_bge .ThemeElements .FmtScheme .NameAttr =_ba .String ("\u004f\u0066\u0066\u0069\u0063\u0065");_dbe :=_ef .NewEG_FillProperties ();_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_dbe );_dbe .SolidFill =&_ef .CT_SolidColorFillProperties {SchemeClr :&_ef .CT_SchemeColor {ValAttr :_ef .ST_SchemeColorValPhClr }};_dbe =_ef .NewEG_FillProperties ();_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_dbe );_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_dbe );_dbe .GradFill =&_ef .CT_GradientFillProperties {RotWithShapeAttr :_ba .Bool (true ),GsLst :&_ef .CT_GradientStopList {},Lin :&_ef .CT_LinearShadeProperties {}};_dbe .GradFill .Lin .AngAttr =_ba .Int32 (5400000);_dbe .GradFill .Lin .ScaledAttr =_ba .Bool (false );_fag :=_ef .NewCT_GradientStop ();_fag .PosAttr .ST_PositiveFixedPercentageDecimal =_ba .Int32 (0);_fag .SchemeClr =&_ef .CT_SchemeColor {ValAttr :_ef .ST_SchemeColorValPhClr };_dbe .GradFill .GsLst .Gs =append (_dbe .GradFill .GsLst .Gs ,_fag );_fag =_ef .NewCT_GradientStop ();_fag .PosAttr .ST_PositiveFixedPercentageDecimal =_ba .Int32 (50000);_fag .SchemeClr =&_ef .CT_SchemeColor {ValAttr :_ef .ST_SchemeColorValPhClr };_dbe .GradFill .GsLst .Gs =append (_dbe .GradFill .GsLst .Gs ,_fag );_bge .ThemeElements .FmtScheme .LnStyleLst =_ef .NewCT_LineStyleList ();for _becf :=0;_becf < 3;_becf ++{_fbfec :=_ef .NewCT_LineProperties ();_fbfec .WAttr =_ba .Int32 (int32 (6350*(_becf +1)));_fbfec .CapAttr =_ef .ST_LineCapFlat ;_fbfec .CmpdAttr =_ef .ST_CompoundLineSng ;_fbfec .AlgnAttr =_ef .ST_PenAlignmentCtr ;_bge .ThemeElements .FmtScheme .LnStyleLst .Ln =append (_bge .ThemeElements .FmtScheme .LnStyleLst .Ln ,_fbfec );};_bge .ThemeElements .FmtScheme .EffectStyleLst =_ef .NewCT_EffectStyleList ();for _fgaa :=0;_fgaa < 3;_fgaa ++{_bebe :=_ef .NewCT_EffectStyleItem ();_bebe .EffectLst =_ef .NewCT_EffectList ();_bge .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle =append (_bge .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle ,_bebe );};_dfc :=_ef .NewEG_FillProperties ();_dfc .SolidFill =&_ef .CT_SolidColorFillProperties {SchemeClr :&_ef .CT_SchemeColor {ValAttr :_ef .ST_SchemeColorValPhClr }};_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_dfc );_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_dfc );_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_bge .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_dbe );_cag ._aef =append (_cag ._aef ,_bge );_gdb :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .ThemeType ,1);_cag .ContentTypes .AddOverride (_gdb ,_ba .ThemeContentType );_cag ._bebf .AddAutoRelationship (_ba .DocTypePresentation ,_ba .OfficeDocumentType ,1,_ba .ThemeType );_bed :=_c .NewRelationships ();_cag ._ccc =append (_cag ._ccc ,_bed );return _cag ;};
|
|
|
|
// Paragraphs returns the paragraphs defined in the placeholder.
|
|
func (_fbfe PlaceHolder )Paragraphs ()[]_ae .Paragraph {_bee :=[]_ae .Paragraph {};for _ ,_eea :=range _fbfe ._dfab .TxBody .P {_bee =append (_bee ,_ae .MakeParagraph (_eea ));};return _bee ;};
|
|
|
|
// RemoveSlide removes a slide from a presentation.
|
|
func (_dcbf *Presentation )RemoveSlide (s Slide )error {_fae :=false ;_ecd :=0;for _bbbd ,_ecc :=range _dcbf ._cce {if _ecc ==s ._agcb {if _dcbf ._bag .SldIdLst .SldId [_bbbd ]!=s ._ggff {return _fg .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 (_dcbf ._cce [_bbbd :],_dcbf ._cce [_bbbd +1:]);_dcbf ._cce =_dcbf ._cce [0:len (_dcbf ._cce )-1];copy (_dcbf ._adda [_bbbd :],_dcbf ._adda [_bbbd +1:]);_dcbf ._adda =_dcbf ._adda [0:len (_dcbf ._adda )-1];copy (_dcbf ._bag .SldIdLst .SldId [_bbbd :],_dcbf ._bag .SldIdLst .SldId [_bbbd +1:]);_dcbf ._bag .SldIdLst .SldId =_dcbf ._bag .SldIdLst .SldId [0:len (_dcbf ._bag .SldIdLst .SldId )-1];_fae =true ;_ecd =_bbbd ;};};if !_fae {return _fg .New ("u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065");};_fcbd :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideType ,0);return _dcbf .ContentTypes .RemoveOverrideByIndex (_fcbd ,_ecd );};func (_cggb *Slide )getSlideRels ()_c .Relationships {_adbc :=_cggb ._gggc ;for _dfgc ,_ebaa :=range _adbc .Slides (){if *_cggb ._agcb ==*_ebaa ._agcb {return _adbc ._adda [len (_adbc ._adda )-_dfgc -1];};};return _c .Relationships {};};
|
|
|
|
// Index returns the placeholder index
|
|
func (_dae PlaceHolder )Index ()uint32 {if _dae ._dfab .NvSpPr .NvPr .Ph .IdxAttr ==nil {return 0;};return *_dae ._dfab .NvSpPr .NvPr .Ph .IdxAttr ;};func _bec (_dgb *Presentation ,_add *_bd .CT_Shape ,_ggg *_bd .CT_GraphicalObjectFrame ,_abf *TableInfo ,_acf *_ef .CT_Transform2D ,_gfg int ,_aega []rectangle ,_dgg []*_ef .CT_TextParagraph )[]*TextItem {_cgf :=[]*TextItem {};var _gee ,_cd ,_ca ,_dgc ,_fd ,_ed int64 ;_ecg :=_acf ==nil ;_bbb :=0;for _ ,_fgc :=range _dgg {for _ ,_eae :=range _fgc .EG_TextRun {if _bf :=_eae .R ;_bf !=nil {if !_ecg {if _acf .Off !=nil {if _ebd :=_acf .Ext ;_ebd !=nil {_fd ,_ed =_ebd .CxAttr ,_ebd .CyAttr ;};if _gbg :=_acf .Off .XAttr .ST_CoordinateUnqualified ;_gbg !=nil {_gee =*_gbg ;_cd =_gee +_fd ;_ecg =true ;};if _fdb :=_acf .Off .YAttr .ST_CoordinateUnqualified ;_fdb !=nil {_ca =*_fdb ;_dgc =_ca +_ed ;_ecg =true ;};};};_edd :=append ([]rectangle {},_aega ...);_edd =append (_edd ,rectangle {_ffc :_gee ,_gf :_cd ,_adfa :_ca ,_aba :_dgc });_cgf =append (_cgf ,&TextItem {Presentation :_dgb ,Shape :_add ,GraphicFrame :_ggg ,TableInfo :_abf ,Paragraph :_fgc ,Run :_bf ,Text :_bf .T ,_adf :_edd ,_fga :_gfg ,_ff :_bbb });_bbb ++;};};};return _cgf ;};
|
|
|
|
// SlideScreenSize represents the slide screen size as a 2 element array
|
|
// representing the width and height in EMU units.
|
|
type SlideScreenSize [2]int32 ;
|
|
|
|
// ExtractText returns text from a presentation as a PresentationText object.
|
|
func (_bgd *Presentation )ExtractText ()*PresentationText {_aeg :=[]*SlideText {};for _ ,_gg :=range _bgd .Slides (){_ea :=_gg .ExtractText ();if _ea !=nil {_aeg =append (_aeg ,_ea );};};return &PresentationText {Slides :_aeg };};
|
|
|
|
// Slide represents a slide of a presentation.
|
|
type Slide struct{_ggff *_bd .CT_SlideIdListEntry ;_agcb *_bd .Sld ;_gggc *Presentation ;_acdb *_ef .CT_ColorMapping ;};func (_fbf *chart )Target ()string {return _fbf ._de };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bcc SlideMaster )X ()*_bd .SldMaster {return _bcc ._ecgbe };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bdc ViewProperties )X ()*_bd .ViewPr {return _bdc ._dccb };
|
|
|
|
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
|
|
func (_ggfc TextBox )SetOffsetX (offX float64 ){_ecgg :=_ggfc .getOff ();_bdga :=_fc .ToEMU (offX );_ecgg .XAttr =_ef .ST_Coordinate {ST_CoordinateUnqualified :&_bdga };};
|
|
|
|
// Themes returns an array of presentation themes.
|
|
func (_cgba *Presentation )Themes ()[]*_ef .Theme {return _cgba ._aef };
|
|
|
|
// SlideMasters returns the slide masters defined in the presentation.
|
|
func (_fgad *Presentation )SlideMasters ()[]SlideMaster {_eda :=[]SlideMaster {};for _aee ,_efa :=range _fgad ._dde {_eda =append (_eda ,SlideMaster {_fgad ,_fgad ._fbcc [_aee ],_efa });};return _eda ;};
|
|
|
|
// TextBox is a text box within a slide.
|
|
type TextBox struct{_abca *_bd .CT_Shape };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cad PlaceHolder )X ()*_bd .CT_Shape {return _cad ._dfab };
|
|
|
|
// X returns TextBox's underlying *pml.CT_Shape.
|
|
func (_bfgf TextBox )X ()*_bd .CT_Shape {return _bfgf ._abca };var (SlideScreenSize16x9 =SlideScreenSize {12192000,6858000};SlideScreenSize4x3 =SlideScreenSize {9144000,6858000};SlideScreenSizeA4 =SlideScreenSize {9906000,6858000};);
|
|
|
|
// 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 (_ccb sort2d )Less (i ,j int )bool {_fdbb ,_gfe :=_ccb [i ],_ccb [j ];_dc ,_ade :=_fdbb ._adf ,_gfe ._adf ;_cb ,_bga :=len (_dc )-1,len (_ade )-1;_fcb ,_gba :=0,0;for {_gfea ,_gbgd ,_abe ,_ee ,_ddg ,_gfd ,_gff ,_acd :=_dc [_fcb ]._adfa ,_ade [_gba ]._adfa ,_dc [_fcb ]._aba ,_ade [_gba ]._aba ,_dc [_fcb ]._ffc ,_ade [_gba ]._ffc ,_dc [_fcb ]._gf ,_ade [_gba ]._gf ;if _gfea ==_gbgd ||((_aed .Abs (float64 (_gfea )-float64 (_gbgd ))< _eff )&&((_gfea >=_gbgd &&_gfea <=_ee )||(_gbgd >=_gfea &&_gbgd <=_abe ))&&(_gff < _gfd ||_ddg > _acd )){if _ddg ==_gfd {if _fcb < _cb &&_gba < _bga {_fcb ++;_gba ++;continue ;};if _fcb >=_cb &&_gba >=_bga {break ;};return _fcb >=_cb ;}else {return _ddg < _gfd ;};}else {return _gfea < _gbgd ;};};_acfe ,_cga ,_abef ,_gfb :=_fdbb ._fga ,_gfe ._fga ,_fdbb ._ff ,_gfe ._ff ;if _acfe ==_cga {return _abef <=_gfb ;};return _acfe < _cga ;};
|
|
|
|
// Size returns slide size value as SlideScreenSize.
|
|
func (_efb *SlideSize )Size ()SlideScreenSize {return SlideScreenSize {_efb ._gegg .CxAttr ,_efb ._gegg .CyAttr };};
|
|
|
|
// GetSlideLayout returns a slide layout related to the slide.
|
|
func (_abee *Slide )GetSlideLayout ()*_bd .SldLayout {for _dddf ,_ffd :=range _abee ._gggc .Slides (){if *_abee ==_ffd {return _abee ._gggc ._ddcg [len (_abee ._gggc .Slides ())-_dddf -1];};};return nil ;};
|
|
|
|
// Slides returns the slides in the presentation.
|
|
func (_faa *Presentation )Slides ()[]Slide {_acfc :=[]Slide {};for _bgg ,_dcgg :=range _faa ._cce {_acfc =append (_acfc ,Slide {_faa ._bag .SldIdLst .SldId [_bgg ],_dcgg ,_faa ,nil });};return _acfc ;};func (_aec sort2d )Len ()int {return len (_aec )};
|
|
|
|
// 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 };};
|
|
|
|
// ClrMru returns the ClrMru property.
|
|
func (_acdf PresentationProperties )ClrMru ()*_ef .CT_ColorMRU {return _acdf ._fdg .ClrMru };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_eca Slide )X ()*_bd .Sld {return _eca ._agcb };
|
|
|
|
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
|
|
func (_daf *Presentation )GetTableStyleById (id string )*_ef .CT_TableStyle {_gafc :=_daf ._gbe .TblStyle ();for _ ,_eccc :=range _gafc {if _eccc .StyleIdAttr ==id {return _eccc ;};};return nil ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dab *Presentation )X ()*_bd .Presentation {return _dab ._bag };type rectangle struct{_ffc int64 ;_adfa int64 ;_gf int64 ;_aba int64 ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ffcd PresentationProperties )X ()*_bd .PresentationPr {return _ffcd ._fdg };
|
|
|
|
// 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 (_cgab Slide )GetPlaceholderByIndex (idx uint32 )(PlaceHolder ,error ){for _ ,_bfba :=range _cgab ._agcb .CSld .SpTree .Choice {for _ ,_geff :=range _bfba .Sp {if _geff .NvSpPr !=nil &&_geff .NvSpPr .NvPr !=nil &&_geff .NvSpPr .NvPr .Ph !=nil {if (idx ==0&&_geff .NvSpPr .NvPr .Ph .IdxAttr ==nil )||(_geff .NvSpPr .NvPr .Ph .IdxAttr !=nil &&*_geff .NvSpPr .NvPr .Ph .IdxAttr ==idx ){return PlaceHolder {_geff ,_cgab ._agcb },nil ;};};};};return PlaceHolder {},_fg .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");};
|
|
|
|
// Text returns text from a slide as one string separated with line breaks.
|
|
func (_cac *SlideText )Text ()string {_fde :=_fa .NewBuffer ([]byte {});for _ ,_dfe :=range _cac .Items {if _dfe .Text !=""{_fde .WriteString (_dfe .Text );_fde .WriteString ("\u000a");};};return _fde .String ();};
|
|
|
|
// ExtractText returns text from a slide as a SlideText object.
|
|
func (_df *Slide )ExtractText ()*SlideText {_egg :=_aa (_df ._gggc ,_df ._agcb .CSld .SpTree .Choice ,[]rectangle {},[]*TextItem {});_gb .Sort (sort2d (_egg ));return &SlideText {Items :_egg };};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_fgga *Slide )GetColorBySchemeColor (schClr _ef .ST_SchemeColorVal )*_ef .CT_Color {_fgga .ensureClrMap ();_facc :=_fgga ._acdb ;if _facc ==nil {return nil ;};var _adaeg _ef .ST_ColorSchemeIndex ;switch schClr .String (){case "\u0062\u0067\u0031":_adaeg =_facc .Bg1Attr ;case "\u0062\u0067\u0032":_adaeg =_facc .Bg2Attr ;case "\u0074\u0078\u0031":_adaeg =_facc .Tx1Attr ;case "\u0074\u0078\u0032":_adaeg =_facc .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_adaeg =_facc .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_adaeg =_facc .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_adaeg =_facc .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_adaeg =_facc .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_adaeg =_facc .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_adaeg =_facc .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_adaeg =_facc .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_adaeg =_facc .FolHlinkAttr ;case "\u0064\u006b\u0031":_adaeg =_ef .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_adaeg =_ef .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_adaeg =_ef .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_adaeg =_ef .ST_ColorSchemeIndexLt2 ;default:_adaeg =_ef .ST_ColorSchemeIndexUnset ;};_fba :=_fgga ._gggc ._aef [0];_bede :=_fba .ThemeElements ;if _bede ==nil {return nil ;};var _bdad *_ef .CT_Color ;_cdac :=_bede .ClrScheme ;switch _adaeg .String (){case "\u0064\u006b\u0031":_bdad =_cdac .Dk1 ;case "\u0064\u006b\u0032":_bdad =_cdac .Dk2 ;case "\u006c\u0074\u0031":_bdad =_cdac .Lt1 ;case "\u006c\u0074\u0032":_bdad =_cdac .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_bdad =_cdac .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_bdad =_cdac .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_bdad =_cdac .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_bdad =_cdac .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_bdad =_cdac .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_bdad =_cdac .Accent6 ;case "\u0068\u006c\u0069n\u006b":_bdad =_cdac .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_bdad =_cdac .FolHlink ;default:return nil ;};return _bdad ;};
|
|
|
|
// Height returns slide screen size height in EMU units.
|
|
func (_ffdd *SlideScreenSize )Height ()int32 {return _ffdd [1]};
|
|
|
|
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
|
|
func (_ccf *Presentation )SaveToFileAsTemplate (path string )error {return _ccf .saveToFile (path ,true )};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cae SlideLayout )X ()*_bd .SldLayout {return _cae ._ffba };
|
|
|
|
// SetHeight sets height of slide screen size with given value in EMU units.
|
|
func (_bgbd *SlideScreenSize )SetHeight (val int32 ){_bgbd [1]=val };
|
|
|
|
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
|
|
func (_ffgc Slide )AddImageToRels (img _c .ImageRef )string {_afdb :=0;for _adeg ,_cbfg :=range _ffgc ._gggc .Images {if _cbfg ==img {_afdb =_adeg +1;break ;};};var _baf string ;for _bebd ,_fcda :=range _ffgc ._gggc .Slides (){if _fcda ._agcb ==_ffgc ._agcb {_fbdg :=_bg .Sprintf ("\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",_afdb ,img .Format ());_ccdc :=_ffgc ._gggc ._adda [_bebd ].AddRelationship (_fbdg ,_ba .ImageType );_baf =_ccdc .ID ();};};return _baf ;};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// slide.
|
|
func (_ecab *Slide )GetImageByRelID (relID string )(_c .ImageRef ,bool ){_bab :=_ecab .getSlideRels ();if (_bab ==_c .Relationships {}){return _c .ImageRef {},false ;};var _cbbd string ;for _ ,_agfa :=range _bab .X ().Relationship {if _agfa .IdAttr ==relID {_cbbd =_agfa .TargetAttr ;break ;};};for _ ,_feg :=range _ecab ._gggc .Images {if _feg .Target ()==_cbbd {return _feg ,true ;};};return _c .ImageRef {},false ;};
|
|
|
|
// ShowCommentsAttr returns the WebPr property.
|
|
func (_abgf ViewProperties )ShowCommentsAttr ()*bool {return _abgf ._dccb .ShowCommentsAttr };
|
|
|
|
// SetSize sets the slide size, take argument of SlideScreenSize.
|
|
func (_dda *SlideSize )SetSize (sz SlideScreenSize ){_dda ._gegg .CxAttr =sz [0];_dda ._gegg .CyAttr =sz [1];};func (_bda *chart )RelId ()string {return _bda ._fbc };func (_afb sort2d )Swap (i ,j int ){_afb [i ],_afb [j ]=_afb [j ],_afb [i ]};
|
|
|
|
// GridSpacing returns the GridSpacing property.
|
|
func (_afcd ViewProperties )GridSpacing ()*_ef .CT_PositiveSize2D {return _afcd ._dccb .GridSpacing };
|
|
|
|
// GetLayoutByName retrieves a slide layout given a layout name.
|
|
func (_eccd *Presentation )GetLayoutByName (name string )(SlideLayout ,error ){for _ ,_ccdg :=range _eccd ._ddcg {if _ccdg .CSld .NameAttr !=nil &&name ==*_ccdg .CSld .NameAttr {return SlideLayout {_ccdg },nil ;};};return SlideLayout {},_fg .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");};
|
|
|
|
// NotesViewPr returns the NotesViewPr property.
|
|
func (_ddgc ViewProperties )NotesViewPr ()*_bd .CT_NotesViewProperties {return _ddgc ._dccb .NotesViewPr };
|
|
|
|
// PresentationProperties contains document specific properties.
|
|
type PresentationProperties struct{_fdg *_bd .PresentationPr };
|
|
|
|
// Remove removes a placeholder from a presentation.
|
|
func (_dbd PlaceHolder )Remove ()error {for _fgcd ,_bbd :=range _dbd ._gaf .CSld .SpTree .Choice {for _ ,_acc :=range _bbd .Sp {if _acc ==_dbd ._dfab {copy (_dbd ._gaf .CSld .SpTree .Choice [_fgcd :],_dbd ._gaf .CSld .SpTree .Choice [_fgcd +1:]);_dbd ._gaf .CSld .SpTree .Choice =_dbd ._gaf .CSld .SpTree .Choice [0:len (_dbd ._gaf .CSld .SpTree .Choice )-1];return nil ;};};};return _fg .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");};
|
|
|
|
// AddTable adds an empty table to a slide.
|
|
func (_accb Slide )AddTable ()*_c .Table {_agda :=_bd .NewCT_GroupShapeChoice ();_accb ._agcb .CSld .SpTree .Choice =append (_accb ._agcb .CSld .SpTree .Choice ,_agda );_afba :=_bd .NewCT_GraphicalObjectFrame ();_agda .GraphicFrame =append (_agda .GraphicFrame ,_afba );_afba .Xfrm .Off =_ef .NewCT_Point2D ();_ddb :=int64 (1);_afba .Xfrm .Off .XAttr =_ef .ST_Coordinate {ST_CoordinateUnqualified :&_ddb };_afba .Xfrm .Off .YAttr =_ef .ST_Coordinate {ST_CoordinateUnqualified :&_ddb };_eaa :=_afba .Graphic .CT_GraphicalObject .GraphicData ;_eaa .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";_ecgc :=_c .NewTableWithXfrm (_afba .Xfrm );_eaa .Any =append (_eaa .Any ,_ecgc .X ());return _ecgc ;};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_edfc *Presentation )GetColorBySchemeColor (schClr _ef .ST_SchemeColorVal )*_ef .CT_Color {if len (_edfc ._dde )==0||len (_edfc ._aef )==0{return nil ;};var _afda _ef .ST_ColorSchemeIndex ;_fad :=_edfc ._dde [0];_dfg :=_fad .ClrMap ;switch schClr .String (){case "\u0062\u0067\u0031":_afda =_dfg .Bg1Attr ;case "\u0062\u0067\u0032":_afda =_dfg .Bg2Attr ;case "\u0074\u0078\u0031":_afda =_dfg .Tx1Attr ;case "\u0074\u0078\u0032":_afda =_dfg .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_afda =_dfg .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_afda =_dfg .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_afda =_dfg .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_afda =_dfg .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_afda =_dfg .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_afda =_dfg .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_afda =_dfg .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_afda =_dfg .FolHlinkAttr ;case "\u0064\u006b\u0031":_afda =_ef .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_afda =_ef .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_afda =_ef .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_afda =_ef .ST_ColorSchemeIndexLt2 ;default:_afda =_ef .ST_ColorSchemeIndexUnset ;};_abfc :=_edfc ._aef [0];_gdad :=_abfc .ThemeElements ;if _gdad ==nil {return nil ;};var _eaf *_ef .CT_Color ;_gdbe :=_gdad .ClrScheme ;switch _afda .String (){case "\u0064\u006b\u0031":_eaf =_gdbe .Dk1 ;case "\u0064\u006b\u0032":_eaf =_gdbe .Dk2 ;case "\u006c\u0074\u0031":_eaf =_gdbe .Lt1 ;case "\u006c\u0074\u0032":_eaf =_gdbe .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_eaf =_gdbe .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_eaf =_gdbe .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_eaf =_gdbe .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_eaf =_gdbe .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_eaf =_gdbe .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_eaf =_gdbe .Accent6 ;case "\u0068\u006c\u0069n\u006b":_eaf =_gdbe .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_eaf =_gdbe .FolHlink ;default:return nil ;};return _eaf ;};
|
|
|
|
// 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 (_edcdf Slide )GetPlaceholder (t _bd .ST_PlaceholderType )(PlaceHolder ,error ){for _ ,_bgf :=range _edcdf ._agcb .CSld .SpTree .Choice {for _ ,_bfeab :=range _bgf .Sp {if _bfeab .NvSpPr !=nil &&_bfeab .NvSpPr .NvPr !=nil &&_bfeab .NvSpPr .NvPr .Ph !=nil {if _bfeab .NvSpPr .NvPr .Ph .TypeAttr ==t {return PlaceHolder {_bfeab ,_edcdf ._agcb },nil ;};};};};return PlaceHolder {},_fg .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 (_ddeg *Slide )ensureClrMap (){if len (_ddeg ._gggc ._dde )==0||len (_ddeg ._gggc ._aef )==0{return ;};_bage :=_ddeg ._gggc ._dde [0];_dedc :=_bage .ClrMap ;if _cbd :=_ddeg ._agcb .ClrMapOvr ;_cbd !=nil {if _dcbd :=_cbd .Choice ;_dcbd !=nil {if _dcbd .MasterClrMapping ==nil {if _abcgb :=_dcbd .OverrideClrMapping ;_abcgb !=nil {if _abcgb .Bg1Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Bg1Attr =_abcgb .Bg1Attr ;};if _abcgb .Tx1Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Tx1Attr =_abcgb .Tx1Attr ;};if _abcgb .Bg2Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Bg2Attr =_abcgb .Bg2Attr ;};if _abcgb .Tx2Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Tx2Attr =_abcgb .Tx2Attr ;};if _abcgb .Accent1Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent1Attr =_abcgb .Accent1Attr ;};if _abcgb .Accent2Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent2Attr =_abcgb .Accent2Attr ;};if _abcgb .Accent3Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent3Attr =_abcgb .Accent3Attr ;};if _abcgb .Accent4Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent4Attr =_abcgb .Accent4Attr ;};if _abcgb .Accent5Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent5Attr =_abcgb .Accent5Attr ;};if _abcgb .Accent6Attr !=_ef .ST_ColorSchemeIndexUnset {_dedc .Accent6Attr =_abcgb .Accent6Attr ;};if _abcgb .HlinkAttr !=_ef .ST_ColorSchemeIndexUnset {_dedc .HlinkAttr =_abcgb .HlinkAttr ;};if _abcgb .FolHlinkAttr !=_ef .ST_ColorSchemeIndexUnset {_dedc .FolHlinkAttr =_abcgb .FolHlinkAttr ;};};};};};_ddeg ._acdb =_dedc ;};func (_ebae TextBox )getOff ()*_ef .CT_Point2D {if _ebae ._abca .SpPr ==nil {_ebae ._abca .SpPr =_ef .NewCT_ShapeProperties ();};if _ebae ._abca .SpPr .Xfrm ==nil {_ebae ._abca .SpPr .Xfrm =_ef .NewCT_Transform2D ();};if _ebae ._abca .SpPr .Xfrm .Off ==nil {_ebae ._abca .SpPr .Xfrm .Off =_ef .NewCT_Point2D ();};return _ebae ._abca .SpPr .Xfrm .Off ;};
|
|
|
|
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
|
|
func NewSlideScreenSize ()SlideScreenSize {return NewSlideScreenSizeWithValue (SlideScreenSize16x9 [0],SlideScreenSize16x9 [1]);};
|
|
|
|
// NotesTextViewPr returns the NotesTextViewPr property.
|
|
func (_ggdg ViewProperties )NotesTextViewPr ()*_bd .CT_NotesTextViewProperties {return _ggdg ._dccb .NotesTextViewPr ;};
|
|
|
|
// GetTextBoxes returns a list of all text boxes from a slide.
|
|
func (_gdaa Slide )GetTextBoxes ()[]*TextBox {_gdd :=[]*TextBox {};_gfdg :=_gdaa ._agcb .CSld .SpTree .Choice ;for _ ,_gbf :=range _gfdg {for _ ,_fbe :=range _gbf .Sp {if _fbe .NvSpPr .CNvSpPr .TxBoxAttr !=nil &&*_fbe .NvSpPr .CNvSpPr .TxBoxAttr {_gdd =append (_gdd ,&TextBox {_fbe });};};};return _gdd ;};
|
|
|
|
// SaveToFile writes the Presentation out to a file.
|
|
func (_adea *Presentation )SaveToFile (path string )error {return _adea .saveToFile (path ,false )};func (_fcd *Presentation )nextSlideID ()uint32 {_gfbd :=uint32 (256);for _ ,_ffe :=range _fcd ._bag .SldIdLst .SldId {if _ffe .IdAttr >=_gfbd {_gfbd =_ffe .IdAttr +1;};};return _gfbd ;};
|
|
|
|
// SlideLayouts returns a slice of all layouts in SlideMaster.
|
|
func (_aadc SlideMaster )SlideLayouts ()[]SlideLayout {_gbc :=map[string ]int {};_dabb :=[]SlideLayout {};for _ ,_fadc :=range _aadc ._ffdg .Relationships (){_bdg :=_ad .Replace (_fadc .Target (),".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074","",-1);_bdg =_ad .Replace (_bdg ,"\u002e\u0078\u006d\u006c","",-1);if _dfdf ,_eee :=_f .ParseInt (_bdg ,10,32);_eee ==nil {_gbc [_fadc .ID ()]=int (_dfdf );};};for _ ,_fbcac :=range _aadc ._ecgbe .SldLayoutIdLst .SldLayoutId {if _gccc ,_bfg :=_gbc [_fbcac .RIdAttr ];_bfg {_bca :=_aadc ._fbdf ._ddcg [_gccc -1];_dabb =append (_dabb ,SlideLayout {_bca });};};return _dabb ;};
|
|
|
|
// Type returns the type of the slide layout.
|
|
func (_eccca SlideLayout )Type ()_bd .ST_SlideLayoutType {return _eccca ._ffba .TypeAttr };
|
|
|
|
// SetWidth sets width of slide screen size with given value in EMU units.
|
|
func (_aafc *SlideScreenSize )SetWidth (val int32 ){_aafc [0]=val };const _eff float64 =500000;
|
|
|
|
// HtmlPubPr returns the HtmlPubPr property.
|
|
func (_aaag PresentationProperties )HtmlPubPr ()*_bd .CT_HtmlPublishProperties {return _aaag ._fdg .HtmlPubPr ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cgee *SlideSize )X ()*_bd .CT_SlideSize {return _cgee ._gegg };
|
|
|
|
// AddTextBox adds an empty textbox to a slide.
|
|
func (_gfgg Slide )AddTextBox ()TextBox {_ggffd :=_bd .NewCT_GroupShapeChoice ();_gfgg ._agcb .CSld .SpTree .Choice =append (_gfgg ._agcb .CSld .SpTree .Choice ,_ggffd );_bcf :=_bd .NewCT_Shape ();_ggffd .Sp =append (_ggffd .Sp ,_bcf );_bcf .SpPr =_ef .NewCT_ShapeProperties ();_bcf .SpPr .Xfrm =_ef .NewCT_Transform2D ();_bcf .SpPr .PrstGeom =_ef .NewCT_PresetGeometry2D ();_bcf .SpPr .PrstGeom .PrstAttr =_ef .ST_ShapeTypeRect ;_bcf .NvSpPr =_bd .NewCT_ShapeNonVisual ();_bcf .NvSpPr .CNvSpPr =_ef .NewCT_NonVisualDrawingShapeProps ();_adae :=true ;_bcf .NvSpPr .CNvSpPr .TxBoxAttr =&_adae ;_bcf .TxBody =_ef .NewCT_TextBody ();_bcf .TxBody .BodyPr =_ef .NewCT_TextBodyProperties ();_bcf .TxBody .BodyPr .WrapAttr =_ef .ST_TextWrappingTypeSquare ;_bcf .TxBody .BodyPr .SpAutoFit =_ef .NewCT_TextShapeAutofit ();_cbbg :=TextBox {_bcf };_cbbg .Properties ().SetWidth (3*_fc .Inch );_cbbg .Properties ().SetHeight (1*_fc .Inch );_cbbg .Properties ().SetPosition (0,0);return _cbbg ;};
|
|
|
|
// Name returns the name of the slide layout.
|
|
func (_eabca SlideLayout )Name ()string {if _eabca ._ffba .CSld !=nil &&_eabca ._ffba .CSld .NameAttr !=nil {return *_eabca ._ffba .CSld .NameAttr ;};return "";};func _fggg (_gdf []*_bd .CT_GroupShapeChoice )[]*_bd .CT_GroupShapeChoice {var _adec []*_bd .CT_GroupShapeChoice ;for _ ,_dabd :=range _gdf {if len (_dabd .Pic )==0{_adec =append (_adec ,_dabd );};};return _adec ;};
|
|
|
|
// PlaceHolders returns all of the content place holders within a given slide.
|
|
func (_dgbe Slide )PlaceHolders ()[]PlaceHolder {_cbad :=[]PlaceHolder {};for _ ,_dff :=range _dgbe ._agcb .CSld .SpTree .Choice {for _ ,_gced :=range _dff .Sp {if _gced .NvSpPr !=nil &&_gced .NvSpPr .NvPr !=nil &&_gced .NvSpPr .NvPr .Ph !=nil {_cbad =append (_cbad ,PlaceHolder {_gced ,_dgbe ._agcb });};};};return _cbad ;};
|
|
|
|
// Save writes the presentation out to a writer in the Zip package format
|
|
func (_fcg *Presentation )Save (w _ga .Writer )error {return _fcg .save (w ,false )};
|
|
|
|
// AddParagraph adds a paragraph to the text box
|
|
func (_aeb TextBox )AddParagraph ()_ae .Paragraph {_ecbb :=_ef .NewCT_TextParagraph ();_aeb ._abca .TxBody .P =append (_aeb ._abca .TxBody .P ,_ecbb );return _ae .MakeParagraph (_ecbb );};
|
|
|
|
// SlideLayout is a layout from which slides can be created.
|
|
type SlideLayout struct{_ffba *_bd .SldLayout };
|
|
|
|
// SlideSize represents a slide size of a presentation.
|
|
type SlideSize struct{_gegg *_bd .CT_SlideSize ;_gfge *Presentation ;};
|
|
|
|
// Presentation returns a slide's presentation.
|
|
func (_cdbb Slide )Presentation ()*Presentation {return _cdbb ._gggc };
|
|
|
|
// PlaceHolder is a place holder from a slide.
|
|
type PlaceHolder struct{_dfab *_bd .CT_Shape ;_gaf *_bd .Sld ;};type chart struct{_fgb *_e .ChartSpace ;_fbc string ;_de string ;};
|
|
|
|
// 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 (_cbc *Presentation )AddSlideWithLayout (l SlideLayout )(Slide ,error ){_agd :=_bd .NewCT_SlideIdListEntry ();_agd .IdAttr =256;for _ ,_aga :=range _cbc ._bag .SldIdLst .SldId {if _aga .IdAttr >=_agd .IdAttr {_agd .IdAttr =_aga .IdAttr +1;};};_cbc ._bag .SldIdLst .SldId =append (_cbc ._bag .SldIdLst .SldId ,_agd );_dea :=_bd .NewSld ();_cbb :=_fa .Buffer {};_bagf :=_da .NewEncoder (&_cbb );_egf :=_da .StartElement {Name :_da .Name {Local :"\u0073\u006c\u0069d\u0065"}};_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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"});_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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"});_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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"});_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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"});_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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"});_egf .Attr =append (_egf .Attr ,_da .Attr {Name :_da .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 _cadf :=l ._ffba .CSld .MarshalXML (_bagf ,_egf );_cadf !=nil {return Slide {},_cadf ;};_bagf .Flush ();_aae :=_da .NewDecoder (&_cbb );_dea .CSld =_bd .NewCT_CommonSlideData ();if _abcgd :=_aae .Decode (_dea .CSld );_abcgd !=nil {return Slide {},_abcgd ;};_dea .CSld .NameAttr =nil ;_dea .CSld .SpTree .Choice =_fggg (_dea .CSld .SpTree .Choice );_cbc ._cce =append (_cbc ._cce ,_dea );_eab :=_cbc ._bebf .AddAutoRelationship (_ba .DocTypePresentation ,_ba .OfficeDocumentType ,len (_cbc ._cce ),_ba .SlideType );_agd .RIdAttr =_eab .ID ();_aggd :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideType ,len (_cbc ._cce ));_cbc .ContentTypes .AddOverride (_aggd ,_ba .SlideContentType );_gcg :=_c .NewRelationships ();_cbc ._adda =append (_cbc ._adda ,_gcg );_dcgf :=len (_cbc ._adda )-1;for _ebde ,_gdg :=range _cbc ._ddcg {if _gdg ==l .X (){_gedd :=_cbc ._afg [_ebde ];for _ ,_acg :=range _gedd .X ().Relationship {if _acg .TypeAttr !=_ba .SlideMasterType {_cbc ._adda [_dcgf ].X ().Relationship =append (_cbc ._adda [_dcgf ].X ().Relationship ,_acg );};};_gcg .AddAutoRelationship (_ba .DocTypePresentation ,_ba .SlideType ,_ebde +1,_ba .SlideLayoutType );};};_ceb :=Slide {_agd ,_dea ,_cbc ,nil };return _ceb ,nil ;};
|
|
|
|
// SlideLayouts returns the slide layouts defined in the presentation.
|
|
func (_ggda *Presentation )SlideLayouts ()[]SlideLayout {_ebf :=[]SlideLayout {};for _ ,_bcb :=range _ggda ._ddcg {_ebf =append (_ebf ,SlideLayout {_bcb });};return _ebf ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_cgg Image )Properties ()_ae .ShapeProperties {if _cgg ._dgbd .SpPr ==nil {_cgg ._dgbd .SpPr =_ef .NewCT_ShapeProperties ();};return _ae .MakeShapeProperties (_cgg ._dgbd .SpPr );};
|
|
|
|
// OutlineViewPr returns the OutlineViewPr property.
|
|
func (_adba ViewProperties )OutlineViewPr ()*_bd .CT_OutlineViewProperties {return _adba ._dccb .OutlineViewPr ;};
|
|
|
|
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
|
|
type TableInfo struct{Table *_ef .CT_Table ;Row *_ef .CT_TableRow ;Cell *_ef .CT_TableCell ;RowIndex int ;ColIndex int ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_bce TextBox )Properties ()_ae .ShapeProperties {if _bce ._abca .SpPr ==nil {_bce ._abca .SpPr =_ef .NewCT_ShapeProperties ();};return _ae .MakeShapeProperties (_bce ._abca .SpPr );};
|
|
|
|
// Text returns text from a presentation as one string separated with line breaks.
|
|
func (_cfdec *PresentationText )Text ()string {_caf :=_fa .NewBuffer ([]byte {});for _ ,_eba :=range _cfdec .Slides {_caf .WriteString (_eba .Text ());};return _caf .String ();};
|
|
|
|
// Image is an image within a slide.
|
|
type Image struct{_dgbd *_bd .CT_Picture };
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_egcf *Presentation )GetImageByRelID (relID string )(_c .ImageRef ,bool ){for _ ,_gdee :=range _egcf .Images {if _gdee .RelID ()==relID {return _gdee ,true ;};};return _c .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 ;};
|
|
|
|
// LastViewAttr returns the LastViewAttr property.
|
|
func (_aadd ViewProperties )LastViewAttr ()_bd .ST_ViewType {return _aadd ._dccb .LastViewAttr };
|
|
|
|
// AddImage adds an image textbox to a slide.
|
|
func (_aggg Slide )AddImage (img _c .ImageRef )Image {_cea :=_bd .NewCT_GroupShapeChoice ();_aggg ._agcb .CSld .SpTree .Choice =append (_aggg ._agcb .CSld .SpTree .Choice ,_cea );_bdb :=_bd .NewCT_Picture ();_cea .Pic =append (_cea .Pic ,_bdb );_bdb .NvPicPr .CNvPicPr =_ef .NewCT_NonVisualPictureProperties ();_bdb .NvPicPr .CNvPicPr .PicLocks =_ef .NewCT_PictureLocking ();_bdb .NvPicPr .CNvPicPr .PicLocks .NoChangeAspectAttr =_ba .Bool (true );_bdb .BlipFill =_ef .NewCT_BlipFillProperties ();_bdb .BlipFill .Blip =_ef .NewCT_Blip ();_fgf :=_aggg .AddImageToRels (img );_bdb .BlipFill .Blip .EmbedAttr =_ba .String (_fgf );_bdb .BlipFill .Stretch =_ef .NewCT_StretchInfoProperties ();_bdb .BlipFill .Stretch .FillRect =_ef .NewCT_RelativeRect ();_bdb .SpPr =_ef .NewCT_ShapeProperties ();_bdb .SpPr .PrstGeom =_ef .NewCT_PresetGeometry2D ();_bdb .SpPr .PrstGeom .PrstAttr =_ef .ST_ShapeTypeRect ;_aff :=Image {_bdb };_faec :=img .Size ();_aff .Properties ().SetWidth (_fc .Distance (_faec .X )*_fc .Pixel72 );_aff .Properties ().SetHeight (_fc .Distance (_faec .Y )*_fc .Pixel72 );_aff .Properties ().SetPosition (0,0);return _aff ;};func (_gcc *Presentation )saveToFile (_abgc string ,_bff bool )error {_fdag ,_deaf :=_fb .Create (_abgc );if _deaf !=nil {return _deaf ;};defer _fdag .Close ();return _gcc .save (_fdag ,_bff );};var _dfce =false ;
|
|
|
|
// SlideSize returns presentation slide size.
|
|
func (_bgdd *Presentation )SlideSize ()SlideSize {if _bgdd ._bag .SldSz ==nil {_bgdd ._bag .SldSz =_bd .NewCT_SlideSize ();};return SlideSize {_bgdd ._bag .SldSz ,_bgdd };};
|
|
|
|
// 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 (_agb PlaceHolder )SetText (text string ){_agb .Clear ();_fbb :=_ef .NewEG_TextRun ();_fbb .R =_ef .NewCT_RegularTextRun ();_fbb .R .T =text ;if len (_agb ._dfab .TxBody .P )==0{_agb ._dfab .TxBody .P =append (_agb ._dfab .TxBody .P ,_ef .NewCT_TextParagraph ());};_agb ._dfab .TxBody .P [0].EG_TextRun =nil ;_agb ._dfab .TxBody .P [0].EG_TextRun =append (_agb ._dfab .TxBody .P [0].EG_TextRun ,_fbb );};
|
|
|
|
// Presentation is the a presentation base document.
|
|
type Presentation struct{_c .DocBase ;_bag *_bd .Presentation ;_bebf _c .Relationships ;_cce []*_bd .Sld ;_adda []_c .Relationships ;_dde []*_bd .SldMaster ;_fbcc []_c .Relationships ;_ddcg []*_bd .SldLayout ;_afg []_c .Relationships ;_aef []*_ef .Theme ;_ccc []_c .Relationships ;_gbe _c .TableStyles ;_def PresentationProperties ;_cfc ViewProperties ;_abg []*_ef .CT_Hyperlink ;_ccec []*chart ;_edf []*_bd .HandoutMaster ;_dcag []*_bd .NotesMaster ;_agg []*_ba .XSDAny ;_ggb map[string ]string ;_cgb string ;};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_dca PresentationProperties )ExtLst ()*_bd .CT_ExtensionList {return _dca ._fdg .ExtLst };
|
|
|
|
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
|
|
func (_cbbf TextBox )SetOffsetY (offY float64 ){_ggec :=_cbbf .getOff ();_ebcd :=_fc .ToEMU (offY );_ggec .YAttr =_ef .ST_Coordinate {ST_CoordinateUnqualified :&_ebcd };};
|
|
|
|
// PrnPr returns the PrnPr property.
|
|
func (_cafa PresentationProperties )PrnPr ()*_bd .CT_PrintProperties {return _cafa ._fdg .PrnPr };
|
|
|
|
// NormalViewPr returns the NormalViewPr property.
|
|
func (_agcc ViewProperties )NormalViewPr ()*_bd .CT_NormalViewProperties {return _agcc ._dccb .NormalViewPr ;};
|
|
|
|
// ValidateWithPath validates the slide passing path informaton for a better
|
|
// error message.
|
|
func (_deda Slide )ValidateWithPath (path string )error {if _cgbb :=_deda ._agcb .ValidateWithPath (path );_cgbb !=nil {return _cgbb ;};for _ ,_cfbbf :=range _deda ._agcb .CSld .SpTree .Choice {for _ ,_gbge :=range _cfbbf .Sp {if _gbge .TxBody !=nil {if len (_gbge .TxBody .P )==0{return _fg .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 ;};
|
|
|
|
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
|
|
// slide.
|
|
func (_gggcg *Slide )GetChartSpaceByRelId (relId string )*_e .ChartSpace {_dgcc :=_gggcg .getSlideRels ();if (_dgcc ==_c .Relationships {}){return nil ;};_gec :=_dgcc .GetTargetByRelId (relId );for _ ,_cdc :=range _gggcg ._gggc ._ccec {if _gec ==_cdc .Target (){return _cdc ._fgb ;};};return nil ;};
|
|
|
|
// ShowPr returns the ShowPr property.
|
|
func (_dee PresentationProperties )ShowPr ()*_bd .CT_ShowProperties {return _dee ._fdg .ShowPr };
|
|
|
|
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
|
|
func (_gbd *Presentation )SaveAsTemplate (w _ga .Writer )error {return _gbd .save (w ,true )};
|
|
|
|
// ViewProperties contains presentation specific properties.
|
|
type ViewProperties struct{_dccb *_bd .ViewPr };
|
|
|
|
// 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 (_cfa PlaceHolder )Clear (){_cfa .ClearAll ();_gaeg :=_ef .NewCT_TextParagraph ();_cfa ._dfab .TxBody .P =[]*_ef .CT_TextParagraph {_gaeg };_gaeg .EndParaRPr =_ef .NewCT_TextCharacterProperties ();_gaeg .EndParaRPr .LangAttr =_ba .String ("\u0065\u006e\u002dU\u0053");};
|
|
|
|
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
|
|
type PresentationText struct{Slides []*SlideText ;};
|
|
|
|
// Type returns the placeholder type
|
|
func (_ged PlaceHolder )Type ()_bd .ST_PlaceholderType {return _ged ._dfab .NvSpPr .NvPr .Ph .TypeAttr };
|
|
|
|
// AddParagraph adds a new paragraph to a placeholder.
|
|
func (_gac PlaceHolder )AddParagraph ()_ae .Paragraph {_bfe :=_ae .MakeParagraph (_ef .NewCT_TextParagraph ());_gac ._dfab .TxBody .P =append (_gac ._dfab .TxBody .P ,_bfe .X ());return _bfe ;};
|
|
|
|
// SlideViewPr returns the SlideViewPr property.
|
|
func (_agga ViewProperties )SlideViewPr ()*_bd .CT_SlideViewProperties {return _agga ._dccb .SlideViewPr };
|
|
|
|
// SetTextAnchor controls the text anchoring
|
|
func (_acdfg TextBox )SetTextAnchor (a _ef .ST_TextAnchoringType ){_acdfg ._abca .TxBody .BodyPr =_ef .NewCT_TextBodyProperties ();_acdfg ._abca .TxBody .BodyPr .AnchorAttr =a ;};
|
|
|
|
// 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 (_ccce *Presentation )AddDefaultSlideWithLayout (l SlideLayout )(Slide ,error ){_dgf ,_fgba :=_ccce .AddSlideWithLayout (l );for _ ,_cdg :=range _dgf .PlaceHolders (){_cdg .Clear ();switch _cdg .Type (){case _bd .ST_PlaceholderTypeFtr ,_bd .ST_PlaceholderTypeDt ,_bd .ST_PlaceholderTypeSldNum :_cdg .Remove ();};};return _dgf ,_fgba ;};
|
|
|
|
// SorterViewPr returns the SorterViewPr property.
|
|
func (_daba ViewProperties )SorterViewPr ()*_bd .CT_SlideSorterViewProperties {return _daba ._dccb .SorterViewPr ;};
|
|
|
|
// SlideMaster is the slide master for a presentation.
|
|
type SlideMaster struct{_fbdf *Presentation ;_ffdg _c .Relationships ;_ecgbe *_bd .SldMaster ;};
|
|
|
|
// NewViewProperties constructs a new ViewProperties.
|
|
func NewViewProperties ()ViewProperties {return ViewProperties {_dccb :_bd .NewViewPr ()}};
|
|
|
|
// AddSlide adds a new slide to the presentation.
|
|
func (_dcc *Presentation )AddSlide ()Slide {_cda :=_bd .NewCT_SlideIdListEntry ();_cda .IdAttr =_dcc .nextSlideID ();_dcc ._bag .SldIdLst .SldId =append (_dcc ._bag .SldIdLst .SldId ,_cda );_ce :=_bd .NewSld ();_ce .CSld .SpTree .NvGrpSpPr .CNvPr .IdAttr =1;_ce .CSld .SpTree .GrpSpPr .Xfrm =_ef .NewCT_GroupTransform2D ();_ce .CSld .SpTree .GrpSpPr .Xfrm .Off =_ef .NewCT_Point2D ();_ce .CSld .SpTree .GrpSpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_ba .Int64 (0);_ce .CSld .SpTree .GrpSpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_ba .Int64 (0);_ce .CSld .SpTree .GrpSpPr .Xfrm .Ext =_ef .NewCT_PositiveSize2D ();_ce .CSld .SpTree .GrpSpPr .Xfrm .Ext .CxAttr =int64 (0*_fc .Point );_ce .CSld .SpTree .GrpSpPr .Xfrm .Ext .CyAttr =int64 (0*_fc .Point );_ce .CSld .SpTree .GrpSpPr .Xfrm .ChOff =_ce .CSld .SpTree .GrpSpPr .Xfrm .Off ;_ce .CSld .SpTree .GrpSpPr .Xfrm .ChExt =_ce .CSld .SpTree .GrpSpPr .Xfrm .Ext ;_dcc ._cce =append (_dcc ._cce ,_ce );_bfc :=_dcc ._bebf .AddAutoRelationship (_ba .DocTypePresentation ,_ba .OfficeDocumentType ,len (_dcc ._cce ),_ba .SlideType );_cda .RIdAttr =_bfc .ID ();_dcd :=_ba .AbsoluteFilename (_ba .DocTypePresentation ,_ba .SlideType ,len (_dcc ._cce ));_dcc .ContentTypes .AddOverride (_dcd ,_ba .SlideContentType );_ebee :=_c .NewRelationships ();_dcc ._adda =append (_dcc ._adda ,_ebee );_ebee .AddAutoRelationship (_ba .DocTypePresentation ,_ba .SlideType ,len (_dcc ._ddcg ),_ba .SlideLayoutType );return Slide {_cda ,_ce ,_dcc ,nil };};
|
|
|
|
// NewPresentationProperties constructs a new PresentationProperties.
|
|
func NewPresentationProperties ()PresentationProperties {return PresentationProperties {_fdg :_bd .NewPresentationPr ()};}; |