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 (_d "archive/zip";_fa "bytes";_cd "encoding/xml";_gg "errors";_fg "fmt";_ea "github.com/unidoc/unioffice";_ef "github.com/unidoc/unioffice/common";_eb "github.com/unidoc/unioffice/common/logger";_bd "github.com/unidoc/unioffice/common/tempstorage";_fc "github.com/unidoc/unioffice/drawing";_f "github.com/unidoc/unioffice/internal/license";_ac "github.com/unidoc/unioffice/measurement";_cgg "github.com/unidoc/unioffice/schema/soo/dml";_c "github.com/unidoc/unioffice/schema/soo/dml/chart";_ed "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_e "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_db "github.com/unidoc/unioffice/schema/soo/pml";_cg "github.com/unidoc/unioffice/zippkg";_gc "image";_cc "image/jpeg";_g "io";_da "math";_gce "os";_eg "path";_acb "sort";_ca "strconv";_b "strings";);
|
|
|
|
// ExtractText returns text from a presentation as a PresentationText object.
|
|
func (_ab *Presentation )ExtractText ()*PresentationText {_ff :=[]*SlideText {};for _ ,_ffg :=range _ab .Slides (){_ebd :=_ffg .ExtractText ();if _ebd !=nil {_ff =append (_ff ,_ebd );};};return &PresentationText {Slides :_ff };};
|
|
|
|
// SlideSize returns presentation slide size.
|
|
func (_ded *Presentation )SlideSize ()SlideSize {if _ded ._cbd .SldSz ==nil {_ded ._cbd .SldSz =_db .NewCT_SlideSize ();};return SlideSize {_ded ._cbd .SldSz ,_ded };};
|
|
|
|
// TextBox is a text box within a slide.
|
|
type TextBox struct{_deac *_db .CT_Shape };
|
|
|
|
// OutlineViewPr returns the OutlineViewPr property.
|
|
func (_ggg ViewProperties )OutlineViewPr ()*_db .CT_OutlineViewProperties {return _ggg ._gfga .OutlineViewPr ;};
|
|
|
|
// 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 };};
|
|
|
|
// GetPlaceholder returns a placeholder given its type. If there are multiplace
|
|
// placeholders of the same type, this method returns the first one. You must use the
|
|
// PlaceHolders() method to access the others.
|
|
func (_adcg Slide )GetPlaceholder (t _db .ST_PlaceholderType )(PlaceHolder ,error ){for _ ,_efcf :=range _adcg ._egd .CSld .SpTree .Choice {for _ ,_ggcc :=range _efcf .Sp {if _ggcc .NvSpPr !=nil &&_ggcc .NvSpPr .NvPr !=nil &&_ggcc .NvSpPr .NvPr .Ph !=nil {if _ggcc .NvSpPr .NvPr .Ph .TypeAttr ==t {return PlaceHolder {_ggcc ,_adcg ._egd },nil ;};};};};return PlaceHolder {},_gg .New ("\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0070\u006c\u0061\u0063\u0065\u0068\u006fl\u0064\u0065\u0072");};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_abg PresentationProperties )X ()*_db .PresentationPr {return _abg ._bcd };
|
|
|
|
// AddImage adds an image textbox to a slide.
|
|
func (_ggd Slide )AddImage (img _ef .ImageRef )Image {_ccabf :=_db .NewCT_GroupShapeChoice ();_ggd ._egd .CSld .SpTree .Choice =append (_ggd ._egd .CSld .SpTree .Choice ,_ccabf );_ggdd :=_db .NewCT_Picture ();_ccabf .Pic =append (_ccabf .Pic ,_ggdd );_ggdd .NvPicPr .CNvPicPr =_cgg .NewCT_NonVisualPictureProperties ();_ggdd .NvPicPr .CNvPicPr .PicLocks =_cgg .NewCT_PictureLocking ();_ggdd .NvPicPr .CNvPicPr .PicLocks .NoChangeAspectAttr =_ea .Bool (true );_ggdd .BlipFill =_cgg .NewCT_BlipFillProperties ();_ggdd .BlipFill .Blip =_cgg .NewCT_Blip ();_dffe :=_ggd .AddImageToRels (img );_ggdd .BlipFill .Blip .EmbedAttr =_ea .String (_dffe );_ggdd .BlipFill .Stretch =_cgg .NewCT_StretchInfoProperties ();_ggdd .BlipFill .Stretch .FillRect =_cgg .NewCT_RelativeRect ();_ggdd .SpPr =_cgg .NewCT_ShapeProperties ();_ggdd .SpPr .PrstGeom =_cgg .NewCT_PresetGeometry2D ();_ggdd .SpPr .PrstGeom .PrstAttr =_cgg .ST_ShapeTypeRect ;_ecfe :=Image {_ggdd };_cef :=img .Size ();_ecfe .Properties ().SetWidth (_ac .Distance (_cef .X )*_ac .Pixel72 );_ecfe .Properties ().SetHeight (_ac .Distance (_cef .Y )*_ac .Pixel72 );_ecfe .Properties ().SetPosition (0,0);return _ecfe ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ggbf SlideMaster )X ()*_db .SldMaster {return _ggbf ._bafec };
|
|
|
|
// Paragraphs returns the paragraphs defined in the placeholder.
|
|
func (_ggcg PlaceHolder )Paragraphs ()[]_fc .Paragraph {_edb :=[]_fc .Paragraph {};for _ ,_daga :=range _ggcg ._efg .TxBody .P {_edb =append (_edb ,_fc .MakeParagraph (_daga ));};return _edb ;};
|
|
|
|
// Read reads a document from an io.Reader.
|
|
func Read (r _g .ReaderAt ,size int64 )(*Presentation ,error ){const _acc ="\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064";if !_f .GetLicenseKey ().IsLicensed ()&&!_bdb {_fg .Println ("\u0055\u006e\u006ci\u0063\u0065\u006e\u0073e\u0064\u0020\u0076\u0065\u0072\u0073\u0069o\u006e\u0020\u006f\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065");_fg .Println ("\u002d\u0020\u0047e\u0074\u0020\u0061\u0020\u0074\u0072\u0069\u0061\u006c\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f");return nil ,_gg .New ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064");};_efb :=_aff ();_dgcf ,_fcfc :=_f .GenRefId ("\u0070\u0072");if _fcfc !=nil {_eb .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_fcfc );return nil ,_fcfc ;};_efb ._ecd =_dgcf ;if _bcdd :=_f .Track (_efb ._ecd ,_acc );_bcdd !=nil {_eb .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_bcdd );return nil ,_bcdd ;};_gffa ,_fcfc :=_bd .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078");if _fcfc !=nil {return nil ,_fcfc ;};_efb .TmpPath =_gffa ;_gagg ,_fcfc :=_d .NewReader (r ,size );if _fcfc !=nil {return nil ,_fg .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_fcfc );};_ccd :=[]*_d .File {};_ccd =append (_ccd ,_gagg .File ...);_debc :=false ;for _ ,_bad :=range _ccd {if _bad .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_debc =true ;break ;};};if _debc {_efb .CreateCustomProperties ();};_ggcd :=_cg .DecodeMap {};_ggcd .SetOnNewRelationshipFunc (_efb .onNewRelationship );_ggcd .AddTarget (_ea .ContentTypesFilename ,_efb .ContentTypes .X (),"",0);_ggcd .AddTarget (_ea .BaseRelsFilename ,_efb .Rels .X (),"",0);if _gfdd :=_ggcd .Decode (_ccd );_gfdd !=nil {return nil ,_gfdd ;};for _ ,_cgcgb :=range _ccd {if _cgcgb ==nil {continue ;};if _acbd :=_efb .AddExtraFileFromZip (_cgcgb );_acbd !=nil {return nil ,_acbd ;};};if _debc {_aab :=false ;for _ ,_bceb :=range _efb .Rels .X ().Relationship {if _bceb .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_aab =true ;break ;};};if !_aab {_efb .AddCustomRelationships ();};};return _efb ,nil ;};func (_gf *chart )X ()*_c .ChartSpace {return _gf ._bg };
|
|
|
|
// SlideViewPr returns the SlideViewPr property.
|
|
func (_affa ViewProperties )SlideViewPr ()*_db .CT_SlideViewProperties {return _affa ._gfga .SlideViewPr };
|
|
|
|
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
|
|
func (_cfba *Presentation )SaveToFileAsTemplate (path string )error {return _cfba .saveToFile (path ,true );};const _gbc float64 =500000;
|
|
|
|
// RemoveSlide removes a slide from a presentation.
|
|
func (_adgc *Presentation )RemoveSlide (s Slide )error {_fced :=false ;_cdba :=0;for _adf ,_fbf :=range _adgc ._gaaa {if _fbf ==s ._egd {if _adgc ._cbd .SldIdLst .SldId [_adf ]!=s ._bfef {return _gg .New ("i\u006e\u0063\u006f\u006e\u0073\u0069s\u0074\u0065\u006e\u0063\u0079\u0020i\u006e\u0020\u0073\u006c\u0069\u0064\u0065s\u0020\u0061\u006e\u0064\u0020\u0049\u0044\u0020\u006c\u0069s\u0074");};copy (_adgc ._gaaa [_adf :],_adgc ._gaaa [_adf +1:]);_adgc ._gaaa =_adgc ._gaaa [0:len (_adgc ._gaaa )-1];copy (_adgc ._fdbe [_adf :],_adgc ._fdbe [_adf +1:]);_adgc ._fdbe =_adgc ._fdbe [0:len (_adgc ._fdbe )-1];copy (_adgc ._cbd .SldIdLst .SldId [_adf :],_adgc ._cbd .SldIdLst .SldId [_adf +1:]);_adgc ._cbd .SldIdLst .SldId =_adgc ._cbd .SldIdLst .SldId [0:len (_adgc ._cbd .SldIdLst .SldId )-1];_fced =true ;_cdba =_adf ;};};if !_fced {return _gg .New ("u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065");};_eadb :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideType ,0);return _adgc .ContentTypes .RemoveOverrideByIndex (_eadb ,_cdba );};
|
|
|
|
// Presentation is the a presentation base document.
|
|
type Presentation struct{_ef .DocBase ;_cbd *_db .Presentation ;_dca _ef .Relationships ;_gaaa []*_db .Sld ;_fdbe []_ef .Relationships ;_cee []*_db .SldMaster ;_gaf []_ef .Relationships ;_bfae []*_db .SldLayout ;_gag []_ef .Relationships ;_bfgf []*_cgg .Theme ;_agb []_ef .Relationships ;_gga _ef .TableStyles ;_fad PresentationProperties ;_cgbc ViewProperties ;_deg []*_cgg .CT_Hyperlink ;_gde []*chart ;_cdb []*_db .HandoutMaster ;_dgf []*_db .NotesMaster ;_afb []*_ea .XSDAny ;_dfd map[string ]string ;_ecd string ;};
|
|
|
|
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
|
|
func (_gdef Slide )AddImageToRels (img _ef .ImageRef )string {_ccbc :=0;for _eaec ,_deaf :=range _gdef ._gdee .Images {if _deaf ==img {_ccbc =_eaec +1;break ;};};var _fga string ;for _gfad ,_geef :=range _gdef ._gdee .Slides (){if _geef ._egd ==_gdef ._egd {_edgd :=_fg .Sprintf ("\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",_ccbc ,img .Format ());_fedb :=_gdef ._gdee ._fdbe [_gfad ].AddRelationship (_edgd ,_ea .ImageType );_fga =_fedb .ID ();};};return _fga ;};type rectangle struct{_aa int64 ;_gfe int64 ;_be int64 ;_faf int64 ;};type sort2d []*TextItem ;
|
|
|
|
// Image is an image within a slide.
|
|
type Image struct{_dgb *_db .CT_Picture };
|
|
|
|
// Name returns the name of the slide layout.
|
|
func (_fae SlideLayout )Name ()string {if _fae ._afc .CSld !=nil &&_fae ._afc .CSld .NameAttr !=nil {return *_fae ._afc .CSld .NameAttr ;};return "";};
|
|
|
|
// Text returns text from a presentation as one string separated with line breaks.
|
|
func (_bfaa *PresentationText )Text ()string {_fcg :=_fa .NewBuffer ([]byte {});for _ ,_cb :=range _bfaa .Slides {_fcg .WriteString (_cb .Text ());};return _fcg .String ();};
|
|
|
|
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
|
|
// slide.
|
|
func (_aaea *Slide )GetChartSpaceByRelId (relId string )*_c .ChartSpace {_gbgc :=_aaea .getSlideRels ();if (_gbgc ==_ef .Relationships {}){return nil ;};_gad :=_gbgc .GetTargetByRelId (relId );for _ ,_acbb :=range _aaea ._gdee ._gde {if _gad ==_acbb .Target (){return _acbb ._bg ;};};return nil ;};func _aff ()*Presentation {_cba :=&Presentation {_cbd :_db .NewPresentation ()};_cba ._cbd .SldIdLst =_db .NewCT_SlideIdList ();_cba ._cbd .ConformanceAttr =_ed .ST_ConformanceClassTransitional ;_cba .AppProperties =_ef .NewAppProperties ();_cba .CoreProperties =_ef .NewCoreProperties ();_cba ._gga =_ef .NewTableStyles ();_cba .ContentTypes =_ef .NewContentTypes ();_cba .Rels =_ef .NewRelationships ();_cba ._dca =_ef .NewRelationships ();_cba ._fad =NewPresentationProperties ();_cba ._cgbc =NewViewProperties ();_cba ._dfd =map[string ]string {};return _cba ;};
|
|
|
|
// ClearAll completely clears a placeholder. To be useable, at least one
|
|
// paragraph must be added after ClearAll via AddParagraph.
|
|
func (_bcb PlaceHolder )ClearAll (){_bcb ._efg .SpPr =_cgg .NewCT_ShapeProperties ();_bcb ._efg .TxBody =_cgg .NewCT_TextBody ();_bcb ._efg .TxBody .LstStyle =_cgg .NewCT_TextListStyle ();};
|
|
|
|
// SetSize sets the slide size, take argument of SlideScreenSize.
|
|
func (_dee *SlideSize )SetSize (sz SlideScreenSize ){_dee ._gae .CxAttr =sz [0];_dee ._gae .CyAttr =sz [1];};
|
|
|
|
// Slides returns the slides in the presentation.
|
|
func (_ccec *Presentation )Slides ()[]Slide {_dage :=[]Slide {};for _feda ,_adca :=range _ccec ._gaaa {_dage =append (_dage ,Slide {_ccec ._cbd .SldIdLst .SldId [_feda ],_adca ,_ccec ,nil });};return _dage ;};
|
|
|
|
// SetHeight sets height of slide screen size with given value in EMU units.
|
|
func (_ddeg *SlideScreenSize )SetHeight (val int32 ){_ddeg [1]=val };
|
|
|
|
// SetWidth sets width of slide screen size with given value in EMU units.
|
|
func (_caac *SlideScreenSize )SetWidth (val int32 ){_caac [0]=val };func (_eef *Slide )getSlideRels ()_ef .Relationships {_ccgc :=_eef ._gdee ;for _ebdd ,_fgg :=range _ccgc .Slides (){if *_eef ._egd ==*_fgg ._egd {return _ccgc ._fdbe [len (_ccgc ._fdbe )-_ebdd -1];};};return _ef .Relationships {};};
|
|
|
|
// ShowPr returns the ShowPr property.
|
|
func (_efdd PresentationProperties )ShowPr ()*_db .CT_ShowProperties {return _efdd ._bcd .ShowPr };func (_cede *Presentation )Validate ()error {if _fbgec :=_cede ._cbd .Validate ();_fbgec !=nil {return _fbgec ;};for _faad ,_bfac :=range _cede .Slides (){if _fdbef :=_bfac .ValidateWithPath (_fg .Sprintf ("\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]",_faad ));_fdbef !=nil {return _fdbef ;};};for _caf ,_gac :=range _cede ._cee {if _ggce :=_gac .ValidateWithPath (_fg .Sprintf ("\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d",_caf ));_ggce !=nil {return _ggce ;};};for _eadd ,_bdbe :=range _cede ._bfae {if _bfgg :=_bdbe .ValidateWithPath (_fg .Sprintf ("\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d",_eadd ));_bfgg !=nil {return _bfgg ;};};return nil ;};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_bdbf *Presentation )GetColorBySchemeColor (schClr _cgg .ST_SchemeColorVal )*_cgg .CT_Color {if len (_bdbf ._cee )==0||len (_bdbf ._bfgf )==0{return nil ;};var _eabf _cgg .ST_ColorSchemeIndex ;_ffbc :=_bdbf ._cee [0];_efc :=_ffbc .ClrMap ;switch schClr .String (){case "\u0062\u0067\u0031":_eabf =_efc .Bg1Attr ;case "\u0062\u0067\u0032":_eabf =_efc .Bg2Attr ;case "\u0074\u0078\u0031":_eabf =_efc .Tx1Attr ;case "\u0074\u0078\u0032":_eabf =_efc .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_eabf =_efc .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_eabf =_efc .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_eabf =_efc .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_eabf =_efc .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_eabf =_efc .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_eabf =_efc .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_eabf =_efc .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_eabf =_efc .FolHlinkAttr ;case "\u0064\u006b\u0031":_eabf =_cgg .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_eabf =_cgg .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_eabf =_cgg .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_eabf =_cgg .ST_ColorSchemeIndexLt2 ;default:_eabf =_cgg .ST_ColorSchemeIndexUnset ;};_dgc :=_bdbf ._bfgf [0];_abag :=_dgc .ThemeElements ;if _abag ==nil {return nil ;};var _cda *_cgg .CT_Color ;_gcca :=_abag .ClrScheme ;switch _eabf .String (){case "\u0064\u006b\u0031":_cda =_gcca .Dk1 ;case "\u0064\u006b\u0032":_cda =_gcca .Dk2 ;case "\u006c\u0074\u0031":_cda =_gcca .Lt1 ;case "\u006c\u0074\u0032":_cda =_gcca .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_cda =_gcca .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_cda =_gcca .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_cda =_gcca .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_cda =_gcca .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_cda =_gcca .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_cda =_gcca .Accent6 ;case "\u0068\u006c\u0069n\u006b":_cda =_gcca .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_cda =_gcca .FolHlink ;default:return nil ;};return _cda ;};
|
|
|
|
// PlaceHolders returns all of the content place holders within a given slide.
|
|
func (_bebcb Slide )PlaceHolders ()[]PlaceHolder {_beba :=[]PlaceHolder {};for _ ,_gdfd :=range _bebcb ._egd .CSld .SpTree .Choice {for _ ,_fadf :=range _gdfd .Sp {if _fadf .NvSpPr !=nil &&_fadf .NvSpPr .NvPr !=nil &&_fadf .NvSpPr .NvPr .Ph !=nil {_beba =append (_beba ,PlaceHolder {_fadf ,_bebcb ._egd });};};};return _beba ;};
|
|
|
|
// SlideMaster is the slide master for a presentation.
|
|
type SlideMaster struct{_cga *Presentation ;_cfaa _ef .Relationships ;_bafec *_db .SldMaster ;};
|
|
|
|
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
|
|
type TableInfo struct{Table *_cgg .CT_Table ;Row *_cgg .CT_TableRow ;Cell *_cgg .CT_TableCell ;RowIndex int ;ColIndex int ;};
|
|
|
|
// Remove removes a placeholder from a presentation.
|
|
func (_adc PlaceHolder )Remove ()error {for _eca ,_feb :=range _adc ._fbg .CSld .SpTree .Choice {for _ ,_fafe :=range _feb .Sp {if _fafe ==_adc ._efg {copy (_adc ._fbg .CSld .SpTree .Choice [_eca :],_adc ._fbg .CSld .SpTree .Choice [_eca +1:]);_adc ._fbg .CSld .SpTree .Choice =_adc ._fbg .CSld .SpTree .Choice [0:len (_adc ._fbg .CSld .SpTree .Choice )-1];return nil ;};};};return _gg .New ("\u0070\u006c\u0061\u0063\u0065\u0068\u006f\u006c\u0064\u0065r\u0020\u006e\u006f\u0074\u0020\u0066\u006fu\u006e\u0064\u0020\u0069\u006e\u0020\u0073\u006c\u0069\u0064\u0065");};
|
|
|
|
// Type returns the type of the slide layout.
|
|
func (_fgaf SlideLayout )Type ()_db .ST_SlideLayoutType {return _fgaf ._afc .TypeAttr };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_edd Slide )X ()*_db .Sld {return _edd ._egd };
|
|
|
|
// AddParagraph adds a new paragraph to a placeholder.
|
|
func (_cbg PlaceHolder )AddParagraph ()_fc .Paragraph {_fcge :=_fc .MakeParagraph (_cgg .NewCT_TextParagraph ());_cbg ._efg .TxBody .P =append (_cbg ._efg .TxBody .P ,_fcge .X ());return _fcge ;};
|
|
|
|
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
|
|
type PresentationText struct{Slides []*SlideText ;};
|
|
|
|
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
|
|
func (_ffd *Presentation )SaveAsTemplate (w _g .Writer )error {return _ffd .save (w ,true )};
|
|
|
|
// ClrMru returns the ClrMru property.
|
|
func (_eag PresentationProperties )ClrMru ()*_cgg .CT_ColorMRU {return _eag ._bcd .ClrMru };
|
|
|
|
// LastViewAttr returns the LastViewAttr property.
|
|
func (_cbgdb ViewProperties )LastViewAttr ()_db .ST_ViewType {return _cbgdb ._gfga .LastViewAttr };
|
|
|
|
// Slide represents a slide of a presentation.
|
|
type Slide struct{_bfef *_db .CT_SlideIdListEntry ;_egd *_db .Sld ;_gdee *Presentation ;_geda *_cgg .CT_ColorMapping ;};func (_ffc TextBox )getOff ()*_cgg .CT_Point2D {if _ffc ._deac .SpPr ==nil {_ffc ._deac .SpPr =_cgg .NewCT_ShapeProperties ();};if _ffc ._deac .SpPr .Xfrm ==nil {_ffc ._deac .SpPr .Xfrm =_cgg .NewCT_Transform2D ();};if _ffc ._deac .SpPr .Xfrm .Off ==nil {_ffc ._deac .SpPr .Xfrm .Off =_cgg .NewCT_Point2D ();};return _ffc ._deac .SpPr .Xfrm .Off ;};func (_bdg *chart )Target ()string {return _bdg ._bb };func _bbad (_fdac []*_db .CT_GroupShapeChoice )[]*_db .CT_GroupShapeChoice {var _fdg []*_db .CT_GroupShapeChoice ;for _ ,_ged :=range _fdac {if len (_ged .Pic )==0{_fdg =append (_fdg ,_ged );};};return _fdg ;};func (_fbge *Presentation )saveToFile (_daef string ,_egg bool )error {_aba ,_abc :=_gce .Create (_daef );if _abc !=nil {return _abc ;};defer _aba .Close ();return _fbge .save (_aba ,_egg );};
|
|
|
|
// GetPlaceholderByIndex returns a placeholder given its index. If there are multiplace
|
|
// placeholders of the same index, this method returns the first one. You must use the
|
|
// PlaceHolders() method to access the others.
|
|
func (_defb Slide )GetPlaceholderByIndex (idx uint32 )(PlaceHolder ,error ){for _ ,_adff :=range _defb ._egd .CSld .SpTree .Choice {for _ ,_adfc :=range _adff .Sp {if _adfc .NvSpPr !=nil &&_adfc .NvSpPr .NvPr !=nil &&_adfc .NvSpPr .NvPr .Ph !=nil {if (idx ==0&&_adfc .NvSpPr .NvPr .Ph .IdxAttr ==nil )||(_adfc .NvSpPr .NvPr .Ph .IdxAttr !=nil &&*_adfc .NvSpPr .NvPr .Ph .IdxAttr ==idx ){return PlaceHolder {_adfc ,_defb ._egd },nil ;};};};};return PlaceHolder {},_gg .New ("\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0070\u006c\u0061\u0063\u0065\u0068\u006fl\u0064\u0065\u0072");};
|
|
|
|
// SlideText is an array of extracted text items which has some methods for representing extracted text from a slide.
|
|
type SlideText struct{Items []*TextItem ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cgbed ViewProperties )X ()*_db .ViewPr {return _cgbed ._gfga };
|
|
|
|
// PrnPr returns the PrnPr property.
|
|
func (_ega PresentationProperties )PrnPr ()*_db .CT_PrintProperties {return _ega ._bcd .PrnPr };
|
|
|
|
// SetTextAnchor controls the text anchoring
|
|
func (_cggd TextBox )SetTextAnchor (a _cgg .ST_TextAnchoringType ){_cggd ._deac .TxBody .BodyPr =_cgg .NewCT_TextBodyProperties ();_cggd ._deac .TxBody .BodyPr .AnchorAttr =a ;};func (_geb sort2d )Len ()int {return len (_geb )};func (_cad *chart )RelId ()string {return _cad ._gge };
|
|
|
|
// PlaceHolder is a place holder from a slide.
|
|
type PlaceHolder struct{_efg *_db .CT_Shape ;_fbg *_db .Sld ;};
|
|
|
|
// PresentationProperties contains document specific properties.
|
|
type PresentationProperties struct{_bcd *_db .PresentationPr };
|
|
|
|
// Themes returns an array of presentation themes.
|
|
func (_cfbaa *Presentation )Themes ()[]*_cgg .Theme {return _cfbaa ._bfgf };
|
|
|
|
// 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 (_fdc PlaceHolder )Clear (){_fdc .ClearAll ();_bbcc :=_cgg .NewCT_TextParagraph ();_fdc ._efg .TxBody .P =[]*_cgg .CT_TextParagraph {_bbcc };_bbcc .EndParaRPr =_cgg .NewCT_TextCharacterProperties ();_bbcc .EndParaRPr .LangAttr =_ea .String ("\u0065\u006e\u002dU\u0053");};
|
|
|
|
// AddTable adds an empty table to a slide.
|
|
func (_dgd Slide )AddTable ()*_ef .Table {_fagf :=_db .NewCT_GroupShapeChoice ();_dgd ._egd .CSld .SpTree .Choice =append (_dgd ._egd .CSld .SpTree .Choice ,_fagf );_eeaa :=_db .NewCT_GraphicalObjectFrame ();_fagf .GraphicFrame =append (_fagf .GraphicFrame ,_eeaa );_eeaa .Xfrm .Off =_cgg .NewCT_Point2D ();_cbac :=int64 (1);_eeaa .Xfrm .Off .XAttr =_cgg .ST_Coordinate {ST_CoordinateUnqualified :&_cbac };_eeaa .Xfrm .Off .YAttr =_cgg .ST_Coordinate {ST_CoordinateUnqualified :&_cbac };_abb :=_eeaa .Graphic .CT_GraphicalObject .GraphicData ;_abb .UriAttr ="\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002eo\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073.\u006f\u0072\u0067\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067\u006dl/\u0032\u0030\u0030\u0036\u002f\u0074\u0061\u0062\u006c\u0065";_bdaa :=_ef .NewTableWithXfrm (_eeaa .Xfrm );_abb .Any =append (_abb .Any ,_bdaa .X ());return _bdaa ;};
|
|
|
|
// NotesTextViewPr returns the NotesTextViewPr property.
|
|
func (_bag ViewProperties )NotesTextViewPr ()*_db .CT_NotesTextViewProperties {return _bag ._gfga .NotesTextViewPr ;};
|
|
|
|
// SorterViewPr returns the SorterViewPr property.
|
|
func (_fgcf ViewProperties )SorterViewPr ()*_db .CT_SlideSorterViewProperties {return _fgcf ._gfga .SorterViewPr ;};
|
|
|
|
// Width returns slide screen size width in EMU units.
|
|
func (_gbce *SlideScreenSize )Width ()int32 {return _gbce [0]};
|
|
|
|
// New initializes and reurns a new presentation
|
|
func New ()*Presentation {_gbg :=_aff ();_gbg .ContentTypes .AddOverride ("/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c","\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c");_gbg .Rels .AddRelationship ("\u0064\u006f\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0063\u006f\u0072e\u002e\u0078\u006d\u006c","\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061s\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0070\u0061\u0063\u006ba\u0067\u0065\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068\u0069\u0070\u0073\u002f\u006d\u0065\u0074\u0061\u0064\u0061\u0074\u0061/\u0063\u006f\u0072\u0065\u002d\u0070\u0072\u006f\u0070e\u0072\u0074i\u0065\u0073");_gbg .Rels .AddRelationship ("\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c","\u0068t\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002eo\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073.\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074i\u006f\u006e\u0073\u0068\u0069p\u0073\u002f\u0065x\u0074\u0065\u006e\u0064\u0065d\u002d\u0070\u0072\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073");_gbg .Rels .AddRelationship ("p\u0070t\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074a\u0074\u0069\u006f\u006e.x\u006d\u006c","\u0068\u0074\u0074\u0070\u003a\u002f\u002fs\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072g\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006fc\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068\u0069\u0070\u0073\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074");_gbg .Rels .AddRelationship ("\u0070\u0070\u0074\u002f\u0070\u0072\u0065\u0073\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c","ht\u0074\u0070\u003a\u002f\u002f\u0073\u0063he\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006et\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068i\u0070s\u002f\u0070\u0072\u0065\u0073\u0050\u0072\u006f\u0070\u0073");_gbg .Rels .AddRelationship ("\u0070\u0070\u0074\u002f\u0076\u0069\u0065\u0077\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c","ht\u0074\u0070\u003a\u002f\u002f\u0073\u0063he\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006da\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006et\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068i\u0070s\u002f\u0076\u0069\u0065\u0077\u0050\u0072\u006f\u0070\u0073");_gbg .Rels .AddRelationship ("\u0070\u0070\u0074\u002fta\u0062\u006c\u0065\u0053\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c","\u0068\u0074\u0074\u0070\u003a\u002f\u002fs\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006cf\u006fr\u006d\u0061\u0074\u0073\u002e\u006fr\u0067\u002f\u006f\u0066\u0066\u0069\u0063e\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073h\u0069\u0070\u0073\u002f\u0074\u0061\u0062\u006c\u0065\u0053\u0074\u0079\u006ce\u0073");_gbg ._cbd .SldMasterIdLst =_db .NewCT_SlideMasterIdList ();_bbb :=_db .NewSldMaster ();_bbb .ClrMap .Bg1Attr =_cgg .ST_ColorSchemeIndexLt1 ;_bbb .ClrMap .Bg2Attr =_cgg .ST_ColorSchemeIndexLt2 ;_bbb .ClrMap .Tx1Attr =_cgg .ST_ColorSchemeIndexDk1 ;_bbb .ClrMap .Tx2Attr =_cgg .ST_ColorSchemeIndexDk2 ;_bbb .ClrMap .Accent1Attr =_cgg .ST_ColorSchemeIndexAccent1 ;_bbb .ClrMap .Accent2Attr =_cgg .ST_ColorSchemeIndexAccent2 ;_bbb .ClrMap .Accent3Attr =_cgg .ST_ColorSchemeIndexAccent3 ;_bbb .ClrMap .Accent4Attr =_cgg .ST_ColorSchemeIndexAccent4 ;_bbb .ClrMap .Accent5Attr =_cgg .ST_ColorSchemeIndexAccent5 ;_bbb .ClrMap .Accent6Attr =_cgg .ST_ColorSchemeIndexAccent6 ;_bbb .ClrMap .HlinkAttr =_cgg .ST_ColorSchemeIndexHlink ;_bbb .ClrMap .FolHlinkAttr =_cgg .ST_ColorSchemeIndexFolHlink ;_gbg ._cee =append (_gbg ._cee ,_bbb );_aeg :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideMasterType ,1);_gbg .ContentTypes .AddOverride (_aeg ,_ea .SlideMasterContentType );_bfgb :=_gbg ._dca .AddAutoRelationship (_ea .DocTypePresentation ,_ea .OfficeDocumentType ,1,_ea .SlideMasterType );_aec :=_db .NewCT_SlideMasterIdListEntry ();_aec .IdAttr =_ea .Uint32 (2147483648);_aec .RIdAttr =_bfgb .ID ();_gbg ._cbd .SldMasterIdLst .SldMasterId =append (_gbg ._cbd .SldMasterIdLst .SldMasterId ,_aec );_debd :=_ef .NewRelationships ();_gbg ._gaf =append (_gbg ._gaf ,_debd );_ceeb :=_db .NewSldLayout ();_efgg :=_debd .AddAutoRelationship (_ea .DocTypePresentation ,_ea .SlideMasterType ,1,_ea .SlideLayoutType );_aaeg :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideLayoutType ,1);_gbg .ContentTypes .AddOverride (_aaeg ,_ea .SlideLayoutContentType );_debd .AddAutoRelationship (_ea .DocTypePresentation ,_ea .SlideMasterType ,1,_ea .ThemeType );_gbg ._bfae =append (_gbg ._bfae ,_ceeb );_bbb .SldLayoutIdLst =_db .NewCT_SlideLayoutIdList ();_dfa :=_db .NewCT_SlideLayoutIdListEntry ();_dfa .IdAttr =_ea .Uint32 (2147483649);_dfa .RIdAttr =_efgg .ID ();_bbb .SldLayoutIdLst .SldLayoutId =append (_bbb .SldLayoutIdLst .SldLayoutId ,_dfa );_gcc :=_ef .NewRelationships ();_gbg ._gag =append (_gbg ._gag ,_gcc );_gcc .AddAutoRelationship (_ea .DocTypePresentation ,_ea .SlideType ,1,_ea .SlideMasterType );_gbg ._cbd .NotesSz .CxAttr =6858000;_gbg ._cbd .NotesSz .CyAttr =9144000;_gdb :=_cgg .NewTheme ();_gdb .NameAttr =_ea .String ("\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065");_gdb .ThemeElements .ClrScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gdb .ThemeElements .ClrScheme .Dk1 .SysClr =_cgg .NewCT_SystemColor ();_gdb .ThemeElements .ClrScheme .Dk1 .SysClr .LastClrAttr =_ea .String ("\u0030\u0030\u0030\u0030\u0030\u0030");_gdb .ThemeElements .ClrScheme .Dk1 .SysClr .ValAttr =_cgg .ST_SystemColorValWindowText ;_gdb .ThemeElements .ClrScheme .Lt1 .SysClr =_cgg .NewCT_SystemColor ();_gdb .ThemeElements .ClrScheme .Lt1 .SysClr .LastClrAttr =_ea .String ("\u0066\u0066\u0066\u0066\u0066\u0066");_gdb .ThemeElements .ClrScheme .Lt1 .SysClr .ValAttr =_cgg .ST_SystemColorValWindow ;_gdb .ThemeElements .ClrScheme .Dk2 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Dk2 .SrgbClr .ValAttr ="\u0034\u0034\u0035\u0034\u0036\u0061";_gdb .ThemeElements .ClrScheme .Lt2 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Lt2 .SrgbClr .ValAttr ="\u0065\u0037\u0065\u0037\u0065\u0036";_gdb .ThemeElements .ClrScheme .Accent1 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent1 .SrgbClr .ValAttr ="\u0034\u0034\u0037\u0032\u0063\u0034";_gdb .ThemeElements .ClrScheme .Accent2 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent2 .SrgbClr .ValAttr ="\u0065\u0064\u0037\u0064\u0033\u0031";_gdb .ThemeElements .ClrScheme .Accent3 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent3 .SrgbClr .ValAttr ="\u0061\u0035\u0061\u0035\u0061\u0035";_gdb .ThemeElements .ClrScheme .Accent4 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent4 .SrgbClr .ValAttr ="\u0066\u0066\u0063\u0030\u0030\u0030";_gdb .ThemeElements .ClrScheme .Accent5 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent5 .SrgbClr .ValAttr ="\u0035\u0062\u0039\u0062\u0064\u0035";_gdb .ThemeElements .ClrScheme .Accent6 .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Accent6 .SrgbClr .ValAttr ="\u0037\u0030\u0061\u0064\u0034\u0037";_gdb .ThemeElements .ClrScheme .Hlink .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .Hlink .SrgbClr .ValAttr ="\u0030\u0035\u0036\u0033\u0063\u0031";_gdb .ThemeElements .ClrScheme .FolHlink .SrgbClr =_cgg .NewCT_SRgbColor ();_gdb .ThemeElements .ClrScheme .FolHlink .SrgbClr .ValAttr ="\u0039\u0035\u0034\u0066\u0037\u0032";_gdb .ThemeElements .FontScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gdb .ThemeElements .FontScheme .MajorFont .Latin .TypefaceAttr ="\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074";_gdb .ThemeElements .FontScheme .MinorFont .Latin .TypefaceAttr ="\u0043a\u006c\u0069\u0062\u0072\u0069";_gdb .ThemeElements .FmtScheme .NameAttr =_ea .String ("\u004f\u0066\u0066\u0069\u0063\u0065");_fce :=_cgg .NewEG_FillProperties ();_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_fce );_fce .SolidFill =&_cgg .CT_SolidColorFillProperties {SchemeClr :&_cgg .CT_SchemeColor {ValAttr :_cgg .ST_SchemeColorValPhClr }};_fce =_cgg .NewEG_FillProperties ();_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_fce );_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_fce );_fce .GradFill =&_cgg .CT_GradientFillProperties {RotWithShapeAttr :_ea .Bool (true ),GsLst :&_cgg .CT_GradientStopList {},Lin :&_cgg .CT_LinearShadeProperties {}};_fce .GradFill .Lin .AngAttr =_ea .Int32 (5400000);_fce .GradFill .Lin .ScaledAttr =_ea .Bool (false );_bac :=_cgg .NewCT_GradientStop ();_bac .PosAttr .ST_PositiveFixedPercentageDecimal =_ea .Int32 (0);_bac .SchemeClr =&_cgg .CT_SchemeColor {ValAttr :_cgg .ST_SchemeColorValPhClr };_fce .GradFill .GsLst .Gs =append (_fce .GradFill .GsLst .Gs ,_bac );_bac =_cgg .NewCT_GradientStop ();_bac .PosAttr .ST_PositiveFixedPercentageDecimal =_ea .Int32 (50000);_bac .SchemeClr =&_cgg .CT_SchemeColor {ValAttr :_cgg .ST_SchemeColorValPhClr };_fce .GradFill .GsLst .Gs =append (_fce .GradFill .GsLst .Gs ,_bac );_gdb .ThemeElements .FmtScheme .LnStyleLst =_cgg .NewCT_LineStyleList ();for _cac :=0;_cac < 3;_cac ++{_fbga :=_cgg .NewCT_LineProperties ();_fbga .WAttr =_ea .Int32 (int32 (6350*(_cac +1)));_fbga .CapAttr =_cgg .ST_LineCapFlat ;_fbga .CmpdAttr =_cgg .ST_CompoundLineSng ;_fbga .AlgnAttr =_cgg .ST_PenAlignmentCtr ;_gdb .ThemeElements .FmtScheme .LnStyleLst .Ln =append (_gdb .ThemeElements .FmtScheme .LnStyleLst .Ln ,_fbga );};_gdb .ThemeElements .FmtScheme .EffectStyleLst =_cgg .NewCT_EffectStyleList ();for _ecb :=0;_ecb < 3;_ecb ++{_ecbg :=_cgg .NewCT_EffectStyleItem ();_ecbg .EffectLst =_cgg .NewCT_EffectList ();_gdb .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle =append (_gdb .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle ,_ecbg );};_efac :=_cgg .NewEG_FillProperties ();_efac .SolidFill =&_cgg .CT_SolidColorFillProperties {SchemeClr :&_cgg .CT_SchemeColor {ValAttr :_cgg .ST_SchemeColorValPhClr }};_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_efac );_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_efac );_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gdb .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_fce );_gbg ._bfgf =append (_gbg ._bfgf ,_gdb );_bde :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .ThemeType ,1);_gbg .ContentTypes .AddOverride (_bde ,_ea .ThemeContentType );_gbg ._dca .AddAutoRelationship (_ea .DocTypePresentation ,_ea .OfficeDocumentType ,1,_ea .ThemeType );_ecbc :=_ef .NewRelationships ();_gbg ._agb =append (_gbg ._agb ,_ecbc );return _gbg ;};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_bbbg *Presentation )GetImageByRelID (relID string )(_ef .ImageRef ,bool ){for _ ,_ffgf :=range _bbbg .Images {if _ffgf .RelID ()==relID {return _ffgf ,true ;};};return _ef .ImageRef {},false ;};func _dg (_dbdc *Presentation ,_ggb []*_db .CT_GroupShapeChoice ,_aae []rectangle ,_gd []*TextItem )[]*TextItem {for _ ,_aaf :=range _ggb {_eff :=append ([]rectangle {},_aae ...);for _ ,_bc :=range _aaf .Sp {_gd =append (_gd ,_ba (_dbdc ,_bc ,nil ,nil ,_bc .SpPr .Xfrm ,0,_aae ,_bc .TxBody .P )...);};for _ ,_ccb :=range _aaf .GraphicFrame {if _ccb !=nil &&_ccb .Graphic !=nil &&_ccb .Graphic .GraphicData !=nil {_dd :=_ccb .Xfrm ;for _ ,_fb :=range _ccb .Graphic .GraphicData .Any {if _bbc ,_ace :=_fb .(*_cgg .Tbl );_ace {_ede :=&_bbc .CT_Table ;_bfa :=0;for _gdc ,_dea :=range _bbc .Tr {for _agd ,_def :=range _dea .Tc {_agg :=&TableInfo {Table :_ede ,Row :_dea ,Cell :_def ,RowIndex :_gdc ,ColIndex :_agd };_gd =append (_gd ,_ba (_dbdc ,nil ,_ccb ,_agg ,_dd ,_bfa ,_aae ,_def .TxBody .P )...);_bfa ++;};};};};};};for _ ,_ec :=range _aaf .GrpSp {if _ec .GrpSpPr !=nil {_eae :=_ec .GrpSpPr .Xfrm ;var _ga ,_fd int64 ;if _eae .Off !=nil {_ee ,_af :=_eae .Off .XAttr .ST_CoordinateUnqualified ,_eae .Off .YAttr .ST_CoordinateUnqualified ;if _ee !=nil &&_af !=nil {if _bef :=_eae .Ext ;_bef !=nil {_ga ,_fd =_bef .CxAttr ,_bef .CyAttr ;};_eff =append (_eff ,rectangle {_aa :*_ee ,_gfe :*_af ,_be :*_ee +_ga ,_faf :*_af +_fd });};};};_gd =_dg (_dbdc ,_ec .Choice ,_eff ,_gd );};};return _gd ;};
|
|
|
|
// Index returns the placeholder index
|
|
func (_fda PlaceHolder )Index ()uint32 {if _fda ._efg .NvSpPr .NvPr .Ph .IdxAttr ==nil {return 0;};return *_fda ._efg .NvSpPr .NvPr .Ph .IdxAttr ;};
|
|
|
|
// GetTextBoxes returns a list of all text boxes from a slide.
|
|
func (_cbaa Slide )GetTextBoxes ()[]*TextBox {_eeea :=[]*TextBox {};_edge :=_cbaa ._egd .CSld .SpTree .Choice ;for _ ,_gbcf :=range _edge {for _ ,_afdb :=range _gbcf .Sp {if _afdb .NvSpPr .CNvSpPr .TxBoxAttr !=nil &&*_afdb .NvSpPr .CNvSpPr .TxBoxAttr {_eeea =append (_eeea ,&TextBox {_afdb });};};};return _eeea ;};
|
|
|
|
// Open opens and reads a document from a file (.pptx).
|
|
func Open (filename string )(*Presentation ,error ){_bda ,_fdf :=_gce .Open (filename );if _fdf !=nil {return nil ,_fg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_fdf );};defer _bda .Close ();_efd ,_fdf :=_gce .Stat (filename );if _fdf !=nil {return nil ,_fg .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_fdf );};_ =_efd ;return Read (_bda ,_efd .Size ());};
|
|
|
|
// SlideMasters returns the slide masters defined in the presentation.
|
|
func (_adg *Presentation )SlideMasters ()[]SlideMaster {_dbdb :=[]SlideMaster {};for _daefa ,_eecc :=range _adg ._cee {_dbdb =append (_dbdb ,SlideMaster {_adg ,_adg ._gaf [_daefa ],_eecc });};return _dbdb ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aagg *SlideSize )X ()*_db .CT_SlideSize {return _aagg ._gae };
|
|
|
|
// Presentation returns a slide's presentation.
|
|
func (_cbc Slide )Presentation ()*Presentation {return _cbc ._gdee };
|
|
|
|
// GetSlideLayout returns a slide layout related to the slide.
|
|
func (_daa *Slide )GetSlideLayout ()*_db .SldLayout {for _acef ,_dfdb :=range _daa ._gdee .Slides (){if *_daa ==_dfdb {return _daa ._gdee ._bfae [len (_daa ._gdee .Slides ())-_acef -1];};};return nil ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fafa *Presentation )X ()*_db .Presentation {return _fafa ._cbd };
|
|
|
|
// SlideLayouts returns the slide layouts defined in the presentation.
|
|
func (_ddee *Presentation )SlideLayouts ()[]SlideLayout {_ddfc :=[]SlideLayout {};for _ ,_dbdg :=range _ddee ._bfae {_ddfc =append (_ddfc ,SlideLayout {_dbdg });};return _ddfc ;};
|
|
|
|
// AddTextBox adds an empty textbox to a slide.
|
|
func (_bcf Slide )AddTextBox ()TextBox {_baff :=_db .NewCT_GroupShapeChoice ();_bcf ._egd .CSld .SpTree .Choice =append (_bcf ._egd .CSld .SpTree .Choice ,_baff );_eeec :=_db .NewCT_Shape ();_baff .Sp =append (_baff .Sp ,_eeec );_eeec .SpPr =_cgg .NewCT_ShapeProperties ();_eeec .SpPr .Xfrm =_cgg .NewCT_Transform2D ();_eeec .SpPr .PrstGeom =_cgg .NewCT_PresetGeometry2D ();_eeec .SpPr .PrstGeom .PrstAttr =_cgg .ST_ShapeTypeRect ;_eeec .NvSpPr =_db .NewCT_ShapeNonVisual ();_eeec .NvSpPr .CNvSpPr =_cgg .NewCT_NonVisualDrawingShapeProps ();_aaec :=true ;_eeec .NvSpPr .CNvSpPr .TxBoxAttr =&_aaec ;_eeec .TxBody =_cgg .NewCT_TextBody ();_eeec .TxBody .BodyPr =_cgg .NewCT_TextBodyProperties ();_eeec .TxBody .BodyPr .WrapAttr =_cgg .ST_TextWrappingTypeSquare ;_eeec .TxBody .BodyPr .SpAutoFit =_cgg .NewCT_TextShapeAutofit ();_fgb :=TextBox {_eeec };_fgb .Properties ().SetWidth (3*_ac .Inch );_fgb .Properties ().SetHeight (1*_ac .Inch );_fgb .Properties ().SetPosition (0,0);return _fgb ;};
|
|
|
|
// Close closes the presentation, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_dgfb *Presentation )Close ()error {if _dgfb .TmpPath !=""{return _bd .RemoveAll (_dgfb .TmpPath );};return nil ;};
|
|
|
|
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
|
|
func (_aaa *Presentation )GetTableStyleById (id string )*_cgg .CT_TableStyle {_dcbe :=_aaa ._gga .TblStyle ();for _ ,_cea :=range _dcbe {if _cea .StyleIdAttr ==id {return _cea ;};};return nil ;};func (_bgb *Slide )ensureClrMap (){if len (_bgb ._gdee ._cee )==0||len (_bgb ._gdee ._bfgf )==0{return ;};_cae :=_bgb ._gdee ._cee [0];_gba :=_cae .ClrMap ;if _cbef :=_bgb ._egd .ClrMapOvr ;_cbef !=nil {if _bea :=_cbef .Choice ;_bea !=nil {if _bea .MasterClrMapping ==nil {if _gddb :=_bea .OverrideClrMapping ;_gddb !=nil {if _gddb .Bg1Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Bg1Attr =_gddb .Bg1Attr ;};if _gddb .Tx1Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Tx1Attr =_gddb .Tx1Attr ;};if _gddb .Bg2Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Bg2Attr =_gddb .Bg2Attr ;};if _gddb .Tx2Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Tx2Attr =_gddb .Tx2Attr ;};if _gddb .Accent1Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent1Attr =_gddb .Accent1Attr ;};if _gddb .Accent2Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent2Attr =_gddb .Accent2Attr ;};if _gddb .Accent3Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent3Attr =_gddb .Accent3Attr ;};if _gddb .Accent4Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent4Attr =_gddb .Accent4Attr ;};if _gddb .Accent5Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent5Attr =_gddb .Accent5Attr ;};if _gddb .Accent6Attr !=_cgg .ST_ColorSchemeIndexUnset {_gba .Accent6Attr =_gddb .Accent6Attr ;};if _gddb .HlinkAttr !=_cgg .ST_ColorSchemeIndexUnset {_gba .HlinkAttr =_gddb .HlinkAttr ;};if _gddb .FolHlinkAttr !=_cgg .ST_ColorSchemeIndexUnset {_gba .FolHlinkAttr =_gddb .FolHlinkAttr ;};};};};};_bgb ._geda =_gba ;};func (_dbe sort2d )Swap (i ,j int ){_dbe [i ],_dbe [j ]=_dbe [j ],_dbe [i ]};
|
|
|
|
// GridSpacing returns the GridSpacing property.
|
|
func (_ebf ViewProperties )GridSpacing ()*_cgg .CT_PositiveSize2D {return _ebf ._gfga .GridSpacing };func (_cfgd *Presentation )save (_ddbf _g .Writer ,_gfd bool )error {const _cggg ="\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065";if _dcb :=_cfgd ._cbd .Validate ();_dcb !=nil {_eb .Log .Debug ("\u0076\u0061\u006c\u0069\u0064\u0061\u0074\u0069\u006f\u006e\u0020\u0065\u0072\u0072\u006fr\u0020i\u006e\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020\u0025\u0073",_dcb );};if !_f .GetLicenseKey ().IsLicensed ()&&!_bdb {_fg .Println ("\u0055\u006e\u006ci\u0063\u0065\u006e\u0073e\u0064\u0020\u0076\u0065\u0072\u0073\u0069o\u006e\u0020\u006f\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065");_fg .Println ("\u002d\u0020\u0047e\u0074\u0020\u0061\u0020\u0074\u0072\u0069\u0061\u006c\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f");return _gg .New ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064");};if len (_cfgd ._ecd )==0{_fff ,_dbc :=_f .GenRefId ("\u0070\u0077");if _dbc !=nil {_eb .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dbc );return _dbc ;};_cfgd ._ecd =_fff ;};if _dba :=_f .Track (_cfgd ._ecd ,_cggg );_dba !=nil {_eb .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dba );return _dba ;};if _gfd {_cfgd .ContentTypes .RemoveOverride ("\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c");_cfgd .ContentTypes .EnsureOverride ("/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c","\u0061\u0070pl\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074s\u002d\u006f\u0066\u0066ic\u0065\u0064o\u0063u\u006d\u0065\u006e\u0074\u002e\u0070r\u0065\u0073\u0065n\u0074\u0061t\u0069\u006f\u006e\u006d\u006c\u002e\u0074\u0065\u006d\u0070\u006c\u0061\u0074\u0065.\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c");}else {_cfgd .ContentTypes .RemoveOverride ("\u0061\u0070pl\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074s\u002d\u006f\u0066\u0066ic\u0065\u0064o\u0063u\u006d\u0065\u006e\u0074\u002e\u0070r\u0065\u0073\u0065n\u0074\u0061t\u0069\u006f\u006e\u006d\u006c\u002e\u0074\u0065\u006d\u0070\u006c\u0061\u0074\u0065.\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c");_cfgd .ContentTypes .EnsureOverride ("/\u0070\u0070\u0074\u002fpr\u0065s\u0065\u006e\u0074\u0061\u0074i\u006f\u006e\u002e\u0078\u006d\u006c","\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006ff\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006de\u006e\u0074\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u006d\u006c\u002e\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e\u002e\u006d\u0061\u0069\u006e\u002b\u0078\u006d\u006c");};_dge :=_ea .DocTypePresentation ;_egf :=_d .NewWriter (_ddbf );defer _egf .Close ();if _cag :=_cg .MarshalXML (_egf ,_ea .BaseRelsFilename ,_cfgd .Rels .X ());_cag !=nil {return _cag ;};if _ggbg :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .ExtendedPropertiesType ,_cfgd .AppProperties .X ());_ggbg !=nil {return _ggbg ;};if _cgca :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .CorePropertiesType ,_cfgd .CoreProperties .X ());_cgca !=nil {return _cgca ;};if _eaa :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .PresentationPropertiesType ,_cfgd ._fad .X ());_eaa !=nil {return _eaa ;};if _cdbg :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .ViewPropertiesType ,_cfgd ._cgbc .X ());_cdbg !=nil {return _cdbg ;};if _agdg :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .TableStylesType ,_cfgd ._gga .X ());_agdg !=nil {return _agdg ;};if _cfgd .CustomProperties .X ()!=nil {if _ceb :=_cg .MarshalXMLByType (_egf ,_dge ,_ea .CustomPropertiesType ,_cfgd .CustomProperties .X ());_ceb !=nil {return _ceb ;};};if _cfgd .Thumbnail !=nil {_ead ,_gdg :=_egf .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _gdg !=nil {return _gdg ;};if _bfca :=_cc .Encode (_ead ,_cfgd .Thumbnail ,nil );_bfca !=nil {return _bfca ;};};_abf :=_ea .AbsoluteFilename (_dge ,_ea .OfficeDocumentType ,0);if _bgcc :=_cg .MarshalXML (_egf ,_abf ,_cfgd ._cbd );_bgcc !=nil {return _bgcc ;};if _dcd :=_cg .MarshalXML (_egf ,_cg .RelationsPathFor (_abf ),_cfgd ._dca .X ());_dcd !=nil {return _dcd ;};for _fed ,_gfb :=range _cfgd ._gaaa {_dbb :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideType ,_fed +1);_cg .MarshalXML (_egf ,_dbb ,_gfb );if !_cfgd ._fdbe [_fed ].IsEmpty (){_dde :=_cg .RelationsPathFor (_dbb );_cg .MarshalXML (_egf ,_dde ,_cfgd ._fdbe [_fed ].X ());};};for _abfe ,_cbdd :=range _cfgd ._cee {_bbca :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideMasterType ,_abfe +1);_cg .MarshalXML (_egf ,_bbca ,_cbdd );if !_cfgd ._gaf [_abfe ].IsEmpty (){_acf :=_cg .RelationsPathFor (_bbca );_cg .MarshalXML (_egf ,_acf ,_cfgd ._gaf [_abfe ].X ());};};for _dcg ,_aca :=range _cfgd ._bfae {_eec :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideLayoutType ,_dcg +1);_cg .MarshalXML (_egf ,_eec ,_aca );if !_cfgd ._gag [_dcg ].IsEmpty (){_ebb :=_cg .RelationsPathFor (_eec );_cg .MarshalXML (_egf ,_ebb ,_cfgd ._gag [_dcg ].X ());};};for _bfbb ,_aga :=range _cfgd ._bfgf {_fgef :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .ThemeType ,_bfbb +1);_cg .MarshalXML (_egf ,_fgef ,_aga );if !_cfgd ._agb [_bfbb ].IsEmpty (){_bdac :=_cg .RelationsPathFor (_fgef );_cg .MarshalXML (_egf ,_bdac ,_cfgd ._agb [_bfbb ].X ());};};for _adaa ,_fee :=range _cfgd ._gde {_bdab :=_ea .AbsoluteFilename (_dge ,_ea .ChartType ,_adaa +1);_cg .MarshalXML (_egf ,_bdab ,_fee );};for _cadf ,_ced :=range _cfgd ._cdb {_degd :=_ea .AbsoluteFilename (_dge ,_ea .HandoutMasterType ,_cadf +1);_cg .MarshalXML (_egf ,_degd ,_ced );};for _gdd ,_fde :=range _cfgd ._dgf {_fafed :=_ea .AbsoluteFilename (_dge ,_ea .NotesMasterType ,_gdd +1);_cg .MarshalXML (_egf ,_fafed ,_fde );};for _dec ,_ddf :=range _cfgd ._afb {_cdf :=_ea .AbsoluteFilename (_dge ,_ea .CustomXMLType ,_dec +1);_cg .MarshalXML (_egf ,_cdf ,_ddf );};for _ebe ,_dda :=range _cfgd .Images {if _gec :=_ef .AddImageToZip (_egf ,_dda ,_ebe +1,_ea .DocTypePresentation );_gec !=nil {return _gec ;};};_cfgd .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_cfgd .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_cfgd .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_cfgd .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");if _ceec :=_cg .MarshalXML (_egf ,_ea .ContentTypesFilename ,_cfgd .ContentTypes .X ());_ceec !=nil {return _ceec ;};if _ccab :=_cfgd .WriteExtraFiles (_egf );_ccab !=nil {return _ccab ;};return nil ;};
|
|
|
|
// ShowCommentsAttr returns the WebPr property.
|
|
func (_bafff ViewProperties )ShowCommentsAttr ()*bool {return _bafff ._gfga .ShowCommentsAttr };
|
|
|
|
// SlideScreenSize represents the slide screen size as a 2 element array
|
|
// representing the width and height in EMU units.
|
|
type SlideScreenSize [2]int32 ;
|
|
|
|
// AddSlide adds a new slide to the presentation.
|
|
func (_fgc *Presentation )AddSlide ()Slide {_bebc :=_db .NewCT_SlideIdListEntry ();_bebc .IdAttr =_fgc .nextSlideID ();_fgc ._cbd .SldIdLst .SldId =append (_fgc ._cbd .SldIdLst .SldId ,_bebc );_cfge :=_db .NewSld ();_cfge .CSld .SpTree .NvGrpSpPr .CNvPr .IdAttr =1;_cfge .CSld .SpTree .GrpSpPr .Xfrm =_cgg .NewCT_GroupTransform2D ();_cfge .CSld .SpTree .GrpSpPr .Xfrm .Off =_cgg .NewCT_Point2D ();_cfge .CSld .SpTree .GrpSpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_ea .Int64 (0);_cfge .CSld .SpTree .GrpSpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_ea .Int64 (0);_cfge .CSld .SpTree .GrpSpPr .Xfrm .Ext =_cgg .NewCT_PositiveSize2D ();_cfge .CSld .SpTree .GrpSpPr .Xfrm .Ext .CxAttr =int64 (0*_ac .Point );_cfge .CSld .SpTree .GrpSpPr .Xfrm .Ext .CyAttr =int64 (0*_ac .Point );_cfge .CSld .SpTree .GrpSpPr .Xfrm .ChOff =_cfge .CSld .SpTree .GrpSpPr .Xfrm .Off ;_cfge .CSld .SpTree .GrpSpPr .Xfrm .ChExt =_cfge .CSld .SpTree .GrpSpPr .Xfrm .Ext ;_fgc ._gaaa =append (_fgc ._gaaa ,_cfge );_cbf :=_fgc ._dca .AddAutoRelationship (_ea .DocTypePresentation ,_ea .OfficeDocumentType ,len (_fgc ._gaaa ),_ea .SlideType );_bebc .RIdAttr =_cbf .ID ();_eac :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideType ,len (_fgc ._gaaa ));_fgc .ContentTypes .AddOverride (_eac ,_ea .SlideContentType );_gdba :=_ef .NewRelationships ();_fgc ._fdbe =append (_fgc ._fdbe ,_gdba );_gdba .AddAutoRelationship (_ea .DocTypePresentation ,_ea .SlideType ,len (_fgc ._bfae ),_ea .SlideLayoutType );return Slide {_bebc ,_cfge ,_fgc ,nil };};
|
|
|
|
// Height returns slide screen size height in EMU units.
|
|
func (_effd *SlideScreenSize )Height ()int32 {return _effd [1]};
|
|
|
|
// X returns TextBox's underlying *pml.CT_Shape.
|
|
func (_fcd TextBox )X ()*_db .CT_Shape {return _fcd ._deac };
|
|
|
|
// Type returns the placeholder type
|
|
func (_deb PlaceHolder )Type ()_db .ST_PlaceholderType {return _deb ._efg .NvSpPr .NvPr .Ph .TypeAttr };func _ba (_ccbf *Presentation ,_fgd *_db .CT_Shape ,_cge *_db .CT_GraphicalObjectFrame ,_dae *TableInfo ,_cf *_cgg .CT_Transform2D ,_fdb int ,_gb []rectangle ,_cgd []*_cgg .CT_TextParagraph )[]*TextItem {_cfb :=[]*TextItem {};var _cfbd ,_bgf ,_bfg ,_bbf ,_efa ,_eba int64 ;_dc :=_cf ==nil ;_bfd :=0;for _ ,_fge :=range _cgd {for _ ,_ffb :=range _fge .EG_TextRun {if _edeg :=_ffb .R ;_edeg !=nil {if !_dc {if _cf .Off !=nil {if _bfb :=_cf .Ext ;_bfb !=nil {_efa ,_eba =_bfb .CxAttr ,_bfb .CyAttr ;};if _df :=_cf .Off .XAttr .ST_CoordinateUnqualified ;_df !=nil {_cfbd =*_df ;_bgf =_cfbd +_efa ;_dc =true ;};if _cce :=_cf .Off .YAttr .ST_CoordinateUnqualified ;_cce !=nil {_bfg =*_cce ;_bbf =_bfg +_eba ;_dc =true ;};};};_ffe :=append ([]rectangle {},_gb ...);_ffe =append (_ffe ,rectangle {_aa :_cfbd ,_be :_bgf ,_gfe :_bfg ,_faf :_bbf });_cfb =append (_cfb ,&TextItem {Presentation :_ccbf ,Shape :_fgd ,GraphicFrame :_cge ,TableInfo :_dae ,Paragraph :_fge ,Run :_edeg ,Text :_edeg .T ,_de :_ffe ,_ggec :_fdb ,_gfg :_bfd });_bfd ++;};};};return _cfb ;};func (_bbbd *Presentation )onNewRelationship (_agab *_cg .DecodeMap ,_eggd ,_gbe string ,_aef []*_d .File ,_efdc *_e .Relationship ,_eaef _cg .Target )error {_fcb :=_ea .DocTypePresentation ;switch _gbe {case _ea .OfficeDocumentType :_bbbd ._cbd =_db .NewPresentation ();_agab .AddTarget (_eggd ,_bbbd ._cbd ,_gbe ,0);_agab .AddTarget (_cg .RelationsPathFor (_eggd ),_bbbd ._dca .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .CorePropertiesType :_agab .AddTarget (_eggd ,_bbbd .CoreProperties .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .CustomPropertiesType :_agab .AddTarget (_eggd ,_bbbd .CustomProperties .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .PresentationPropertiesType :_agab .AddTarget (_eggd ,_bbbd ._fad .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .ViewPropertiesType :_agab .AddTarget (_eggd ,_bbbd ._cgbc .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .TableStylesType :_agab .AddTarget (_eggd ,_bbbd ._gga .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .HyperLinkType :_dff :=_cgg .NewCT_Hyperlink ();_abcb :=uint32 (len (_bbbd ._deg ));_agab .AddTarget (_eggd ,_dff ,_gbe ,_abcb );_bbbd ._deg =append (_bbbd ._deg ,_dff );case _ea .CustomXMLType :_eee :=&_ea .XSDAny {};_gee :=uint32 (len (_bbbd ._afb ));_agab .AddTarget (_eggd ,_eee ,_gbe ,_gee );_bbbd ._afb =append (_bbbd ._afb ,_eee );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._afb ));case _ea .ChartType :_ceg :=chart {_bg :_c .NewChartSpace ()};_fagg :=uint32 (len (_bbbd ._gde ));_agab .AddTarget (_eggd ,_ceg ._bg ,_gbe ,_fagg );_bbbd ._gde =append (_bbbd ._gde ,&_ceg );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._gde ));_ceg ._bb =_efdc .TargetAttr ;case _ea .HandoutMasterType :_cfd :=_db .NewHandoutMaster ();_gcd :=uint32 (len (_bbbd ._cdb ));_agab .AddTarget (_eggd ,_cfd ,_gbe ,_gcd );_bbbd ._cdb =append (_bbbd ._cdb ,_cfd );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._cdb ));case _ea .NotesMasterType :_cagg :=_db .NewNotesMaster ();_cdc :=uint32 (len (_bbbd ._dgf ));_agab .AddTarget (_eggd ,_cagg ,_gbe ,_cdc );_bbbd ._dgf =append (_bbbd ._dgf ,_cagg );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._dgf ));case _ea .ExtendedPropertiesType :_agab .AddTarget (_eggd ,_bbbd .AppProperties .X (),_gbe ,0);_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,0);case _ea .SlideType :_adb :=_db .NewSld ();_bbbd ._gaaa =append (_bbbd ._gaaa ,_adb );_agab .AddTarget (_eggd ,_adb ,_gbe ,uint32 (len (_bbbd ._gaaa )));_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._gaaa ));_acbe :=_ef .NewRelationships ();_agab .AddTarget (_cg .RelationsPathFor (_eggd ),_acbe .X (),_gbe ,0);_bbbd ._fdbe =append (_bbbd ._fdbe ,_acbe );case _ea .SlideMasterType :_fgce :=_db .NewSldMaster ();if !_agab .AddTarget (_eggd ,_fgce ,_gbe ,uint32 (len (_bbbd ._cee )+1)){return nil ;};_bbbd ._cee =append (_bbbd ._cee ,_fgce );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._cee ));_acae :=_ef .NewRelationships ();_agab .AddTarget (_cg .RelationsPathFor (_eggd ),_acae .X (),_gbe ,0);_bbbd ._gaf =append (_bbbd ._gaf ,_acae );case _ea .SlideLayoutType :_agf :=_db .NewSldLayout ();if !_agab .AddTarget (_eggd ,_agf ,_gbe ,uint32 (len (_bbbd ._bfae )+1)){return nil ;};_bbbd ._bfae =append (_bbbd ._bfae ,_agf );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._bfae ));_fbb :=_ef .NewRelationships ();_agab .AddTarget (_cg .RelationsPathFor (_eggd ),_fbb .X (),_gbe ,0);_bbbd ._gag =append (_bbbd ._gag ,_fbb );case _ea .ThumbnailType :for _cdbd ,_gaga :=range _aef {if _gaga ==nil {continue ;};if _gaga .Name ==_eggd {_bdde ,_adbf :=_gaga .Open ();if _adbf !=nil {return _fg .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_adbf );};_bbbd .Thumbnail ,_ ,_adbf =_gc .Decode (_bdde );_bdde .Close ();if _adbf !=nil {return _fg .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",_adbf );};_aef [_cdbd ]=nil ;};};case _ea .ThemeType :_afa :=_cgg .NewTheme ();if !_agab .AddTarget (_eggd ,_afa ,_gbe ,uint32 (len (_bbbd ._bfgf )+1)){return nil ;};_bbbd ._bfgf =append (_bbbd ._bfgf ,_afa );_efdc .TargetAttr =_ea .RelativeFilename (_fcb ,_eaef .Typ ,_gbe ,len (_bbbd ._bfgf ));_aggf :=_ef .NewRelationships ();_agab .AddTarget (_cg .RelationsPathFor (_eggd ),_aggf .X (),_gbe ,0);_bbbd ._agb =append (_bbbd ._agb ,_aggf );case _ea .ImageType :_eggd =_eg .Clean (_eggd );if _efe ,_bgef :=_bbbd ._dfd [_eggd ];_bgef {_efdc .TargetAttr =_efe ;return nil ;};_decd :="";for _beg ,_afd :=range _aef {if _afd ==nil {continue ;};if _afd .Name ==_eggd {_fcf ,_cbgb :=_cg .ExtractToDiskTmp (_afd ,_bbbd .TmpPath );if _cbgb !=nil {return _cbgb ;};_eggdg ,_cbgb :=_ef .ImageFromStorage (_fcf );if _cbgb !=nil {return _cbgb ;};_decd =_eggdg .Format ;_dcgf :=_ef .MakeImageRef (_eggdg ,&_bbbd .DocBase ,_bbbd ._dca );_dcgf .SetTarget ("\u002e\u002e\u002f"+_eggd [4:]);_bbbd .Images =append (_bbbd .Images ,_dcgf );_aef [_beg ]=nil ;_agab .RecordIndex (_eggd ,len (_bbbd .Images ));break ;};};_ecf :=_agab .IndexFor (_eggd );_efdc .TargetAttr =_ea .RelativeImageFilename (_fcb ,_eaef .Typ ,_gbe ,_ecf ,_decd );_bbbd ._dfd [_eggd ]=_efdc .TargetAttr ;default:_eb .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",_gbe ,_eggd );};return nil ;};
|
|
|
|
// ExtractText returns text from a slide as a SlideText object.
|
|
func (_faa *Slide )ExtractText ()*SlideText {_bf :=_dg (_faa ._gdee ,_faa ._egd .CSld .SpTree .Choice ,[]rectangle {},[]*TextItem {});_acb .Sort (sort2d (_bf ));return &SlideText {Items :_bf };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_efed SlideLayout )X ()*_db .SldLayout {return _efed ._afc };var (SlideScreenSize16x9 =SlideScreenSize {12192000,6858000};SlideScreenSize4x3 =SlideScreenSize {9144000,6858000};SlideScreenSizeA4 =SlideScreenSize {9906000,6858000};);
|
|
|
|
// OpenTemplate opens a template file.
|
|
func OpenTemplate (fn string )(*Presentation ,error ){_ggc ,_dag :=Open (fn );if _dag !=nil {return nil ,_dag ;};return _ggc ,nil ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_cfg Image )Properties ()_fc .ShapeProperties {if _cfg ._dgb .SpPr ==nil {_cfg ._dgb .SpPr =_cgg .NewCT_ShapeProperties ();};return _fc .MakeShapeProperties (_cfg ._dgb .SpPr );};
|
|
|
|
// Save writes the presentation out to a writer in the Zip package format
|
|
func (_fgcg *Presentation )Save (w _g .Writer )error {return _fgcg .save (w ,false )};
|
|
|
|
// SetText sets the text of a placeholder for the initial paragraph. This is a
|
|
// shortcut method that is useful for things like titles which only contain a
|
|
// single paragraph.
|
|
func (_eaeg PlaceHolder )SetText (text string ){_eaeg .Clear ();_bfdf :=_cgg .NewEG_TextRun ();_bfdf .R =_cgg .NewCT_RegularTextRun ();_bfdf .R .T =text ;if len (_eaeg ._efg .TxBody .P )==0{_eaeg ._efg .TxBody .P =append (_eaeg ._efg .TxBody .P ,_cgg .NewCT_TextParagraph ());};_eaeg ._efg .TxBody .P [0].EG_TextRun =nil ;_eaeg ._efg .TxBody .P [0].EG_TextRun =append (_eaeg ._efg .TxBody .P [0].EG_TextRun ,_bfdf );};
|
|
|
|
// AddDefaultSlideWithLayout tries to replicate what PowerPoint does when
|
|
// inserting a slide with a new style by clearing placeholder content and removing
|
|
// some placeholders. Use AddSlideWithLayout if you need more control.
|
|
func (_gfa *Presentation )AddDefaultSlideWithLayout (l SlideLayout )(Slide ,error ){_cca ,_efdda :=_gfa .AddSlideWithLayout (l );for _ ,_bae :=range _cca .PlaceHolders (){_bae .Clear ();switch _bae .Type (){case _db .ST_PlaceholderTypeFtr ,_db .ST_PlaceholderTypeDt ,_db .ST_PlaceholderTypeSldNum :_bae .Remove ();};};return _cca ,_efdda ;};
|
|
|
|
// Size returns slide size value as SlideScreenSize.
|
|
func (_febc *SlideSize )Size ()SlideScreenSize {return SlideScreenSize {_febc ._gae .CxAttr ,_febc ._gae .CyAttr };};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_fbgg PresentationProperties )ExtLst ()*_db .CT_ExtensionList {return _fbgg ._bcd .ExtLst };
|
|
|
|
// WebPr returns the WebPr property.
|
|
func (_abd PresentationProperties )WebPr ()*_db .CT_WebProperties {return _abd ._bcd .WebPr };
|
|
|
|
// SaveToFile writes the Presentation out to a file.
|
|
func (_cgbcf *Presentation )SaveToFile (path string )error {return _cgbcf .saveToFile (path ,false )};
|
|
|
|
// AddSlideWithLayout adds a new slide with content copied from a layout. Normally you should
|
|
// use AddDefaultSlideWithLayout as it will do some post processing similar to PowerPoint to
|
|
// clear place holder text, etc.
|
|
func (_abdg *Presentation )AddSlideWithLayout (l SlideLayout )(Slide ,error ){_gff :=_db .NewCT_SlideIdListEntry ();_gff .IdAttr =256;for _ ,_cacg :=range _abdg ._cbd .SldIdLst .SldId {if _cacg .IdAttr >=_gff .IdAttr {_gff .IdAttr =_cacg .IdAttr +1;};};_abdg ._cbd .SldIdLst .SldId =append (_abdg ._cbd .SldIdLst .SldId ,_gff );_eace :=_db .NewSld ();_eab :=_fa .Buffer {};_bgc :=_cd .NewEncoder (&_eab );_gbd :=_cd .StartElement {Name :_cd .Name {Local :"\u0073\u006c\u0069d\u0065"}};_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078\u006d\u006cn\u0073"},Value :"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002eo\u0072\u0067\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069o\u006e\u006d\u006c\u002f\u0032\u00300\u0036\u002f\u006da\u0069\u006e"});_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0061"},Value :"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065m\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006cf\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067m\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u006d\u0061\u0069\u006e"});_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0070"},Value :"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002eo\u0072\u0067\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069o\u006e\u006d\u006c\u002f\u0032\u00300\u0036\u002f\u006da\u0069\u006e"});_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0072"},Value :"\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068\u0065\u006da\u0073\u002e\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006f\u0066\u0066\u0069c\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002fr\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073h\u0069\u0070\u0073"});_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078\u006d\u006c\u006e\u0073\u003a\u0073\u0068"},Value :"\u0068\u0074\u0074\u0070\u003a/\u002f\u0073\u0063\u0068\u0065m\u0061s\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067/\u006f\u0066\u0066\u0069\u0063\u0065\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0073\u0068\u0061\u0072e\u0064\u0054\u0079\u0070\u0065\u0073"});_gbd .Attr =append (_gbd .Attr ,_cd .Attr {Name :_cd .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0078\u006dl"},Value :"\u0068\u0074tp\u003a\u002f\u002fw\u0077\u0077\u002e\u00773.o\u0072g/\u0058\u004d\u004c\u002f\u0031\u0039\u00398/\u006e\u0061\u006d\u0065\u0073\u0070\u0061c\u0065"});if _dcab :=l ._afc .CSld .MarshalXML (_bgc ,_gbd );_dcab !=nil {return Slide {},_dcab ;};_bgc .Flush ();_bfc :=_cd .NewDecoder (&_eab );_eace .CSld =_db .NewCT_CommonSlideData ();if _daed :=_bfc .Decode (_eace .CSld );_daed !=nil {return Slide {},_daed ;};_eace .CSld .NameAttr =nil ;_eace .CSld .SpTree .Choice =_bbad (_eace .CSld .SpTree .Choice );_abdg ._gaaa =append (_abdg ._gaaa ,_eace );_acea :=_abdg ._dca .AddAutoRelationship (_ea .DocTypePresentation ,_ea .OfficeDocumentType ,len (_abdg ._gaaa ),_ea .SlideType );_gff .RIdAttr =_acea .ID ();_baf :=_ea .AbsoluteFilename (_ea .DocTypePresentation ,_ea .SlideType ,len (_abdg ._gaaa ));_abdg .ContentTypes .AddOverride (_baf ,_ea .SlideContentType );_dgfd :=_ef .NewRelationships ();_abdg ._fdbe =append (_abdg ._fdbe ,_dgfd );_ebc :=len (_abdg ._fdbe )-1;for _cfe ,_edg :=range _abdg ._bfae {if _edg ==l .X (){_ggf :=_abdg ._gag [_cfe ];for _ ,_gbf :=range _ggf .X ().Relationship {if _gbf .TypeAttr !=_ea .SlideMasterType {_abdg ._fdbe [_ebc ].X ().Relationship =append (_abdg ._fdbe [_ebc ].X ().Relationship ,_gbf );};};_dgfd .AddAutoRelationship (_ea .DocTypePresentation ,_ea .SlideType ,_cfe +1,_ea .SlideLayoutType );};};_ada :=Slide {_gff ,_eace ,_abdg ,nil };return _ada ,nil ;};
|
|
|
|
// NewPresentationProperties constructs a new PresentationProperties.
|
|
func NewPresentationProperties ()PresentationProperties {return PresentationProperties {_bcd :_db .NewPresentationPr ()};};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// slide.
|
|
func (_fea *Slide )GetImageByRelID (relID string )(_ef .ImageRef ,bool ){_cebe :=_fea .getSlideRels ();if (_cebe ==_ef .Relationships {}){return _ef .ImageRef {},false ;};var _gdfdg string ;for _ ,_dcbb :=range _cebe .X ().Relationship {if _dcbb .IdAttr ==relID {_gdfdg =_dcbb .TargetAttr ;break ;};};for _ ,_ddec :=range _fea ._gdee .Images {if _ddec .Target ()==_gdfdg {return _ddec ,true ;};};return _ef .ImageRef {},false ;};
|
|
|
|
// SlideSize represents a slide size of a presentation.
|
|
type SlideSize struct{_gae *_db .CT_SlideSize ;_gccc *Presentation ;};
|
|
|
|
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
|
|
func NewSlideScreenSize ()SlideScreenSize {return NewSlideScreenSizeWithValue (SlideScreenSize16x9 [0],SlideScreenSize16x9 [1]);};
|
|
|
|
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
|
|
func (_eabc TextBox )SetOffsetY (offY float64 ){_gagc :=_eabc .getOff ();_bcgb :=_ac .ToEMU (offY );_gagc .YAttr =_cgg .ST_Coordinate {ST_CoordinateUnqualified :&_bcgb };};func (_agc *Presentation )nextSlideID ()uint32 {_ddc :=uint32 (256);for _ ,_bced :=range _agc ._cbd .SldIdLst .SldId {if _bced .IdAttr >=_ddc {_ddc =_bced .IdAttr +1;};};return _ddc ;};
|
|
|
|
// TextItem is used for keeping text with references to a paragraph and run, a shape or a table, a row and a cell where it is located.
|
|
type TextItem struct{Text string ;Presentation *Presentation ;Shape *_db .CT_Shape ;GraphicFrame *_db .CT_GraphicalObjectFrame ;Paragraph *_cgg .CT_TextParagraph ;Run *_cgg .CT_RegularTextRun ;TableInfo *TableInfo ;_de []rectangle ;_ggec int ;_gfg int ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bgg PlaceHolder )X ()*_db .CT_Shape {return _bgg ._efg };
|
|
|
|
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
|
|
func (_ffbcf TextBox )SetOffsetX (offX float64 ){_egac :=_ffbcf .getOff ();_gadg :=_ac .ToEMU (offX );_egac .XAttr =_cgg .ST_Coordinate {ST_CoordinateUnqualified :&_gadg };};type chart struct{_bg *_c .ChartSpace ;_gge string ;_bb string ;};
|
|
|
|
// AddParagraph adds a paragraph to the text box
|
|
func (_bcgf TextBox )AddParagraph ()_fc .Paragraph {_bfbe :=_cgg .NewCT_TextParagraph ();_bcgf ._deac .TxBody .P =append (_bcgf ._deac .TxBody .P ,_bfbe );return _fc .MakeParagraph (_bfbe );};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_egeg ViewProperties )ExtLst ()*_db .CT_ExtensionList {return _egeg ._gfga .ExtLst };var _bdb =false ;
|
|
|
|
// ValidateWithPath validates the slide passing path informaton for a better
|
|
// error message.
|
|
func (_bcg Slide )ValidateWithPath (path string )error {if _gcg :=_bcg ._egd .ValidateWithPath (path );_gcg !=nil {return _gcg ;};for _ ,_fbc :=range _bcg ._egd .CSld .SpTree .Choice {for _ ,_dga :=range _fbc .Sp {if _dga .TxBody !=nil {if len (_dga .TxBody .P )==0{return _gg .New (path +"\u0020\u003a \u0073\u006c\u0069\u0064\u0065 \u0073\u0068\u0061\u0070\u0065 \u0077\u0069\u0074\u0068\u0020\u0061\u0020\u0074\u0078\u0062\u006f\u0064\u0079\u0020\u006d\u0075\u0073\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0020\u0070\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0073");};};};};return nil ;};
|
|
|
|
// SlideLayout is a layout from which slides can be created.
|
|
type SlideLayout struct{_afc *_db .SldLayout };
|
|
|
|
// AddImage adds an image to the document package, returning a reference that
|
|
// can be used to add the image to a run and place it in the document contents.
|
|
func (_dbg *Presentation )AddImage (i _ef .Image )(_ef .ImageRef ,error ){_bfe :=_ef .MakeImageRef (i ,&_dbg .DocBase ,_dbg ._dca );if i .Data ==nil &&i .Path ==""{return _bfe ,_gg .New ("\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0064\u0061t\u0061\u0020\u006f\u0072\u0020\u0061\u0020\u0070\u0061\u0074\u0068");};if i .Format ==""{return _bfe ,_gg .New ("\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0061\u0020v\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074");};if i .Size .X ==0||i .Size .Y ==0{return _bfe ,_gg .New ("\u0069\u006d\u0061\u0067e\u0020\u006d\u0075\u0073\u0074\u0020\u0068\u0061\u0076\u0065 \u0061 \u0076\u0061\u006c\u0069\u0064\u0020\u0073i\u007a\u0065");};if i .Path !=""{_dbfg :=_bd .Add (i .Path );if _dbfg !=nil {return _bfe ,_dbfg ;};};_dbg .Images =append (_dbg .Images ,_bfe );_dbg .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_dbg .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_dbg .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_dbg .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_dbg .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );return _bfe ,nil ;};
|
|
|
|
// ViewProperties contains presentation specific properties.
|
|
type ViewProperties struct{_gfga *_db .ViewPr };
|
|
|
|
// GetLayoutByName retrieves a slide layout given a layout name.
|
|
func (_eea *Presentation )GetLayoutByName (name string )(SlideLayout ,error ){for _ ,_agff :=range _eea ._bfae {if _agff .CSld .NameAttr !=nil &&name ==*_agff .CSld .NameAttr {return SlideLayout {_agff },nil ;};};return SlideLayout {},_gg .New ("\u0075\u006eab\u006c\u0065\u0020t\u006f\u0020\u0066\u0069nd \u006cay\u006f\u0075\u0074\u0020\u0077\u0069\u0074h \u0074\u0068\u0061\u0074\u0020\u006e\u0061m\u0065");};
|
|
|
|
// NewViewProperties constructs a new ViewProperties.
|
|
func NewViewProperties ()ViewProperties {return ViewProperties {_gfga :_db .NewViewPr ()}};
|
|
|
|
// HtmlPubPr returns the HtmlPubPr property.
|
|
func (_ae PresentationProperties )HtmlPubPr ()*_db .CT_HtmlPublishProperties {return _ae ._bcd .HtmlPubPr ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_edgeb TextBox )Properties ()_fc .ShapeProperties {if _edgeb ._deac .SpPr ==nil {_edgeb ._deac .SpPr =_cgg .NewCT_ShapeProperties ();};return _fc .MakeShapeProperties (_edgeb ._deac .SpPr );};
|
|
|
|
// NotesViewPr returns the NotesViewPr property.
|
|
func (_edgef ViewProperties )NotesViewPr ()*_db .CT_NotesViewProperties {return _edgef ._gfga .NotesViewPr ;};
|
|
|
|
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
|
|
func (_dgfdb *Slide )GetColorBySchemeColor (schClr _cgg .ST_SchemeColorVal )*_cgg .CT_Color {_dgfdb .ensureClrMap ();_fggf :=_dgfdb ._geda ;if _fggf ==nil {return nil ;};var _bafe _cgg .ST_ColorSchemeIndex ;switch schClr .String (){case "\u0062\u0067\u0031":_bafe =_fggf .Bg1Attr ;case "\u0062\u0067\u0032":_bafe =_fggf .Bg2Attr ;case "\u0074\u0078\u0031":_bafe =_fggf .Tx1Attr ;case "\u0074\u0078\u0032":_bafe =_fggf .Tx2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_bafe =_fggf .Accent1Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_bafe =_fggf .Accent2Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_bafe =_fggf .Accent3Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_bafe =_fggf .Accent4Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_bafe =_fggf .Accent5Attr ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_bafe =_fggf .Accent6Attr ;case "\u0068\u006c\u0069n\u006b":_bafe =_fggf .HlinkAttr ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_bafe =_fggf .FolHlinkAttr ;case "\u0064\u006b\u0031":_bafe =_cgg .ST_ColorSchemeIndexDk1 ;case "\u0064\u006b\u0032":_bafe =_cgg .ST_ColorSchemeIndexDk2 ;case "\u006c\u0074\u0031":_bafe =_cgg .ST_ColorSchemeIndexLt1 ;case "\u006c\u0074\u0032":_bafe =_cgg .ST_ColorSchemeIndexLt2 ;default:_bafe =_cgg .ST_ColorSchemeIndexUnset ;};_bbd :=_dgfdb ._gdee ._bfgf [0];_cbgd :=_bbd .ThemeElements ;if _cbgd ==nil {return nil ;};var _cecg *_cgg .CT_Color ;_bede :=_cbgd .ClrScheme ;switch _bafe .String (){case "\u0064\u006b\u0031":_cecg =_bede .Dk1 ;case "\u0064\u006b\u0032":_cecg =_bede .Dk2 ;case "\u006c\u0074\u0031":_cecg =_bede .Lt1 ;case "\u006c\u0074\u0032":_cecg =_bede .Lt2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0031":_cecg =_bede .Accent1 ;case "\u0061c\u0063\u0065\u006e\u0074\u0032":_cecg =_bede .Accent2 ;case "\u0061c\u0063\u0065\u006e\u0074\u0033":_cecg =_bede .Accent3 ;case "\u0061c\u0063\u0065\u006e\u0074\u0034":_cecg =_bede .Accent4 ;case "\u0061c\u0063\u0065\u006e\u0074\u0035":_cecg =_bede .Accent5 ;case "\u0061c\u0063\u0065\u006e\u0074\u0036":_cecg =_bede .Accent6 ;case "\u0068\u006c\u0069n\u006b":_cecg =_bede .Hlink ;case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b":_cecg =_bede .FolHlink ;default:return nil ;};return _cecg ;};
|
|
|
|
// Text returns text from a slide as one string separated with line breaks.
|
|
func (_ge *SlideText )Text ()string {_bge :=_fa .NewBuffer ([]byte {});for _ ,_cgc :=range _ge .Items {if _cgc .Text !=""{_bge .WriteString (_cgc .Text );_bge .WriteString ("\u000a");};};return _bge .String ();};
|
|
|
|
// SlideLayouts returns a slice of all layouts in SlideMaster.
|
|
func (_edce SlideMaster )SlideLayouts ()[]SlideLayout {_deea :=map[string ]int {};_ggfb :=[]SlideLayout {};for _ ,_eaea :=range _edce ._cfaa .Relationships (){_cgbe :=_b .Replace (_eaea .Target (),".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074","",-1);_cgbe =_b .Replace (_cgbe ,"\u002e\u0078\u006d\u006c","",-1);if _afca ,_bgfg :=_ca .ParseInt (_cgbe ,10,32);_bgfg ==nil {_deea [_eaea .ID ()]=int (_afca );};};for _ ,_cefa :=range _edce ._bafec .SldLayoutIdLst .SldLayoutId {if _dbfd ,_bcaf :=_deea [_cefa .RIdAttr ];_bcaf {_bdacc :=_edce ._cga ._bfae [_dbfd -1];_ggfb =append (_ggfb ,SlideLayout {_bdacc });};};return _ggfb ;};
|
|
|
|
// NormalViewPr returns the NormalViewPr property.
|
|
func (_aegd ViewProperties )NormalViewPr ()*_db .CT_NormalViewProperties {return _aegd ._gfga .NormalViewPr ;};
|
|
|
|
// Less is for implementing sorting of two locations. Symbols share the same location if they are in the same paragraph or table. One location is 'less' than another first by y coordinate, if y coordinates are equal or differ by less than yEpsilon, then x coordinates are compared, then if they are also equal, indexes of locations in the table are compared, then positions of locations in a paragraph.
|
|
func (_egc sort2d )Less (i ,j int )bool {_dad ,_dbdcg :=_egc [i ],_egc [j ];_fca ,_ggbd :=_dad ._de ,_dbdcg ._de ;_bba ,_efad :=len (_fca )-1,len (_ggbd )-1;_cgb ,_gcb :=0,0;for {_cdg ,_ce ,_bdf ,_befa ,_acec ,_cbe ,_cec ,_ddb :=_fca [_cgb ]._gfe ,_ggbd [_gcb ]._gfe ,_fca [_cgb ]._faf ,_ggbd [_gcb ]._faf ,_fca [_cgb ]._aa ,_ggbd [_gcb ]._aa ,_fca [_cgb ]._be ,_ggbd [_gcb ]._be ;if _cdg ==_ce ||((_da .Abs (float64 (_cdg )-float64 (_ce ))< _gbc )&&((_cdg >=_ce &&_cdg <=_befa )||(_ce >=_cdg &&_ce <=_bdf ))&&(_cec < _cbe ||_acec > _ddb )){if _acec ==_cbe {if _cgb < _bba &&_gcb < _efad {_cgb ++;_gcb ++;continue ;};if _cgb >=_bba &&_gcb >=_efad {break ;};return _cgb >=_bba ;}else {return _acec < _cbe ;};}else {return _cdg < _ce ;};};_aceb ,_ad ,_bca ,_gebe :=_dad ._ggec ,_dbdcg ._ggec ,_dad ._gfg ,_dbdcg ._gfg ;if _aceb ==_ad {return _bca <=_gebe ;};return _aceb < _ad ;}; |