mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +08:00
269 lines
61 KiB
Go
269 lines
61 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 (_efb "archive/zip";_bbc "bytes";_ee "encoding/xml";_bce "errors";_gde "fmt";_bgc "github.com/unidoc/unioffice";_cebf "github.com/unidoc/unioffice/common";_fab "github.com/unidoc/unioffice/common/license";_egf "github.com/unidoc/unioffice/common/tempstorage";_abfe "github.com/unidoc/unioffice/drawing";_dab "github.com/unidoc/unioffice/measurement";_eac "github.com/unidoc/unioffice/schema/soo/dml";_bdb "github.com/unidoc/unioffice/schema/soo/dml/chart";_ec "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_baa "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_dfa "github.com/unidoc/unioffice/schema/soo/pml";_eb "github.com/unidoc/unioffice/zippkg";_ccd "image";_bbe "image/jpeg";_bbg "io";_egbb "log";_fbe "os";_af "path";_ebc "runtime/debug";_bbfe "strconv";_effee "strings";);func (_cce *Presentation )addCustomRelationships (){_cce .ContentTypes .AddOverride ("/\u0064o\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0063u\u0073\u0074\u006f\u006d.x\u006d\u006c","\u0061\u0070\u0070\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002fv\u006e\u0064\u002e\u006f\u0070\u0065n\u0078\u006d\u006c\u0066\u006fr\u006d\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0063\u0075\u0073\u0074\u006f\u006d\u002d\u0070r\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073+\u0078\u006d\u006c");_cce .Rels .AddRelationship ("\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c",_bgc .CustomPropertiesType );};
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_bcc PresentationProperties )ExtLst ()*_dfa .CT_ExtensionList {return _bcc ._aff .ExtLst };func (_gfba *Presentation )onNewRelationship (_ce *_eb .DecodeMap ,_dfb ,_edab string ,_daa []*_efb .File ,_ddd *_baa .Relationship ,_gdda _eb .Target )error {_afd :=_bgc .DocTypePresentation ;switch _edab {case _bgc .OfficeDocumentType :_gfba ._ggc =_dfa .NewPresentation ();_ce .AddTarget (_dfb ,_gfba ._ggc ,_edab ,0);_ce .AddTarget (_eb .RelationsPathFor (_dfb ),_gfba ._gfbag .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .CorePropertiesType :_ce .AddTarget (_dfb ,_gfba .CoreProperties .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .CustomPropertiesType :_ce .AddTarget (_dfb ,_gfba .CustomProperties .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .PresentationPropertiesType :_ce .AddTarget (_dfb ,_gfba ._eeac .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .ViewPropertiesType :_ce .AddTarget (_dfb ,_gfba ._agce .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .TableStylesType :_ce .AddTarget (_dfb ,_gfba ._gfb .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .HyperLinkType :_cea :=_eac .NewCT_Hyperlink ();_da :=uint32 (len (_gfba ._fad ));_ce .AddTarget (_dfb ,_cea ,_edab ,_da );_gfba ._fad =append (_gfba ._fad ,_cea );case _bgc .CustomXMLType :_bec :=&_bgc .XSDAny {};_agcf :=uint32 (len (_gfba ._aag ));_ce .AddTarget (_dfb ,_bec ,_edab ,_agcf );_gfba ._aag =append (_gfba ._aag ,_bec );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._aag ));case _bgc .ChartType :_cca :=_bdb .NewChartSpace ();_effe :=uint32 (len (_gfba ._cgc ));_ce .AddTarget (_dfb ,_cca ,_edab ,_effe );_gfba ._cgc =append (_gfba ._cgc ,_cca );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._cgc ));case _bgc .HandoutMasterType :_cdd :=_dfa .NewHandoutMaster ();_gcd :=uint32 (len (_gfba ._gea ));_ce .AddTarget (_dfb ,_cdd ,_edab ,_gcd );_gfba ._gea =append (_gfba ._gea ,_cdd );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._gea ));case _bgc .NotesMasterType :_aaa :=_dfa .NewNotesMaster ();_aac :=uint32 (len (_gfba ._ace ));_ce .AddTarget (_dfb ,_aaa ,_edab ,_aac );_gfba ._ace =append (_gfba ._ace ,_aaa );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._ace ));case _bgc .ExtendedPropertiesType :_ce .AddTarget (_dfb ,_gfba .AppProperties .X (),_edab ,0);_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,0);case _bgc .SlideType :_cfa :=_dfa .NewSld ();_gfba ._aaca =append (_gfba ._aaca ,_cfa );_ce .AddTarget (_dfb ,_cfa ,_edab ,uint32 (len (_gfba ._aaca )));_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._aaca ));_cefa :=_cebf .NewRelationships ();_ce .AddTarget (_eb .RelationsPathFor (_dfb ),_cefa .X (),_edab ,0);_gfba ._acd =append (_gfba ._acd ,_cefa );case _bgc .SlideMasterType :_dbb :=_dfa .NewSldMaster ();if !_ce .AddTarget (_dfb ,_dbb ,_edab ,uint32 (len (_gfba ._cga )+1)){return nil ;};_gfba ._cga =append (_gfba ._cga ,_dbb );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._cga ));_cdg :=_cebf .NewRelationships ();_ce .AddTarget (_eb .RelationsPathFor (_dfb ),_cdg .X (),_edab ,0);_gfba ._cfbd =append (_gfba ._cfbd ,_cdg );case _bgc .SlideLayoutType :_beg :=_dfa .NewSldLayout ();if !_ce .AddTarget (_dfb ,_beg ,_edab ,uint32 (len (_gfba ._agfb )+1)){return nil ;};_gfba ._agfb =append (_gfba ._agfb ,_beg );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._agfb ));_c :=_cebf .NewRelationships ();_ce .AddTarget (_eb .RelationsPathFor (_dfb ),_c .X (),_edab ,0);_gfba ._fcf =append (_gfba ._fcf ,_c );case _bgc .ThumbnailType :for _efed ,_dbga :=range _daa {if _dbga ==nil {continue ;};if _dbga .Name ==_dfb {_fgfg ,_ecb :=_dbga .Open ();if _ecb !=nil {return _gde .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_ecb );};_gfba .Thumbnail ,_ ,_ecb =_ccd .Decode (_fgfg );_fgfg .Close ();if _ecb !=nil {return _gde .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",_ecb );};_daa [_efed ]=nil ;};};case _bgc .ThemeType :_df :=_eac .NewTheme ();if !_ce .AddTarget (_dfb ,_df ,_edab ,uint32 (len (_gfba ._ece )+1)){return nil ;};_gfba ._ece =append (_gfba ._ece ,_df );_ddd .TargetAttr =_bgc .RelativeFilename (_afd ,_gdda .Typ ,_edab ,len (_gfba ._ece ));_gffd :=_cebf .NewRelationships ();_ce .AddTarget (_eb .RelationsPathFor (_dfb ),_gffd .X (),_edab ,0);_gfba ._dgg =append (_gfba ._dgg ,_gffd );case _bgc .ImageType :_dfb =_af .Clean (_dfb );if _baf ,_aedb :=_gfba ._ecbe [_dfb ];_aedb {_ddd .TargetAttr =_baf ;return nil ;};_gad :="";for _efffg ,_gdd :=range _daa {if _gdd ==nil {continue ;};if _gdd .Name ==_dfb {_cg ,_bgag :=_eb .ExtractToDiskTmp (_gdd ,_gfba .TmpPath );if _bgag !=nil {return _bgag ;};_cfe ,_bgag :=_cebf .ImageFromStorage (_cg );if _bgag !=nil {return _bgag ;};_gad =_cfe .Format ;_caf :=_cebf .MakeImageRef (_cfe ,&_gfba .DocBase ,_gfba ._gfbag );_gfba .Images =append (_gfba .Images ,_caf );_daa [_efffg ]=nil ;_ce .RecordIndex (_dfb ,len (_gfba .Images ));break ;};};_aab :=_ce .IndexFor (_dfb );_ddd .TargetAttr =_bgc .RelativeImageFilename (_afd ,_gdda .Typ ,_edab ,_aab ,_gad );_gfba ._ecbe [_dfb ]=_ddd .TargetAttr ;default:_bgc .Log ("\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",_edab ,_dfb );};return nil ;};
|
|
|
|
// Type returns the placeholder type
|
|
func (_agc PlaceHolder )Type ()_dfa .ST_PlaceholderType {return _agc ._agg .NvSpPr .NvPr .Ph .TypeAttr };
|
|
|
|
// AddParagraph adds a new paragraph to a placeholder.
|
|
func (_cbb PlaceHolder )AddParagraph ()_abfe .Paragraph {_f :=_abfe .MakeParagraph (_eac .NewCT_TextParagraph ());_cbb ._agg .TxBody .P =append (_cbb ._agg .TxBody .P ,_f .X ());return _f ;};func init (){_fbaf ()};
|
|
|
|
// Remove removes a placeholder from a presentation.
|
|
func (_dee PlaceHolder )Remove ()error {for _daaa ,_gcdba :=range _dee ._gc .CSld .SpTree .Choice {for _ ,_ab :=range _gcdba .Sp {if _ab ==_dee ._agg {copy (_dee ._gc .CSld .SpTree .Choice [_daaa :],_dee ._gc .CSld .SpTree .Choice [_daaa +1:]);_dee ._gc .CSld .SpTree .Choice =_dee ._gc .CSld .SpTree .Choice [0:len (_dee ._gc .CSld .SpTree .Choice )-1];return nil ;};};};return _bce .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");};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_gdcc *Presentation )X ()*_dfa .Presentation {return _gdcc ._ggc };
|
|
|
|
// SlideViewPr returns the SlideViewPr property.
|
|
func (_gcca ViewProperties )SlideViewPr ()*_dfa .CT_SlideViewProperties {return _gcca ._abfa .SlideViewPr ;};
|
|
|
|
// Presentation is the a presentation base document.
|
|
type Presentation struct{_cebf .DocBase ;_ggc *_dfa .Presentation ;_gfbag _cebf .Relationships ;_aaca []*_dfa .Sld ;_acd []_cebf .Relationships ;_cga []*_dfa .SldMaster ;_cfbd []_cebf .Relationships ;_agfb []*_dfa .SldLayout ;_fcf []_cebf .Relationships ;_ece []*_eac .Theme ;_dgg []_cebf .Relationships ;_gfb _cebf .TableStyles ;_eeac PresentationProperties ;_agce ViewProperties ;_fad []*_eac .CT_Hyperlink ;_cgc []*_bdb .ChartSpace ;_gea []*_dfa .HandoutMaster ;_ace []*_dfa .NotesMaster ;_aag []*_bgc .XSDAny ;_ecbe map[string ]string ;};
|
|
|
|
// PresentationProperties contains document specific properties.
|
|
type PresentationProperties struct{_aff *_dfa .PresentationPr };
|
|
|
|
// SetTextAnchor controls the text anchoring
|
|
func (_bagg TextBox )SetTextAnchor (a _eac .ST_TextAnchoringType ){_bagg ._cbc .TxBody .BodyPr =_eac .NewCT_TextBodyProperties ();_bagg ._cbc .TxBody .BodyPr .AnchorAttr =a ;};
|
|
|
|
// ShowCommentsAttr returns the WebPr property.
|
|
func (_ebe ViewProperties )ShowCommentsAttr ()*bool {return _ebe ._abfa .ShowCommentsAttr };
|
|
|
|
// GetLayoutByName retrieves a slide layout given a layout name.
|
|
func (_gdc *Presentation )GetLayoutByName (name string )(SlideLayout ,error ){for _ ,_dgfd :=range _gdc ._agfb {if _dgfd .CSld .NameAttr !=nil &&name ==*_dgfd .CSld .NameAttr {return SlideLayout {_dgfd },nil ;};};return SlideLayout {},_bce .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");};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_cefb *Presentation )GetImageByRelID (relID string )(_cebf .ImageRef ,bool ){for _ ,_fce :=range _cefb .Images {if _fce .RelID ()==relID {return _fce ,true ;};};return _cebf .ImageRef {},false ;};
|
|
|
|
// NewPresentationProperties constructs a new PresentationProperties.
|
|
func NewPresentationProperties ()PresentationProperties {return PresentationProperties {_aff :_dfa .NewPresentationPr ()};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_be PresentationProperties )X ()*_dfa .PresentationPr {return _be ._aff };func _bdg (_abd []*_dfa .CT_GroupShapeChoice )[]*_dfa .CT_GroupShapeChoice {var _ef []*_dfa .CT_GroupShapeChoice ;for _ ,_acb :=range _abd {if len (_acb .Pic )==0{_ef =append (_ef ,_acb );};};return _ef ;};
|
|
|
|
// Type returns the type of the slide layout.
|
|
func (_bgfa SlideLayout )Type ()_dfa .ST_SlideLayoutType {return _bgfa ._gee .TypeAttr };
|
|
|
|
// NormalViewPr returns the NormalViewPr property.
|
|
func (_fcg ViewProperties )NormalViewPr ()*_dfa .CT_NormalViewProperties {return _fcg ._abfa .NormalViewPr ;};
|
|
|
|
// GetTextBoxes returns a list of all text boxes from a slide.
|
|
func (_cbd Slide )GetTextBoxes ()[]*TextBox {_ceb :=[]*TextBox {};_baaf :=_cbd ._gdge .CSld .SpTree .Choice ;for _ ,_dca :=range _baaf {for _ ,_edad :=range _dca .Sp {if _edad .NvSpPr .CNvSpPr .TxBoxAttr !=nil &&*_edad .NvSpPr .CNvSpPr .TxBoxAttr {_ceb =append (_ceb ,&TextBox {_edad });};};};return _ceb ;};
|
|
|
|
// SlideLayout is a layout from which slides can be created.
|
|
type SlideLayout struct{_gee *_dfa .SldLayout };var _dac =false ;
|
|
|
|
// OpenTemplate opens a template file.
|
|
func OpenTemplate (fn string )(*Presentation ,error ){_bbga ,_gega :=Open (fn );if _gega !=nil {return nil ,_gega ;};return _bbga ,nil ;};
|
|
|
|
// Close closes the presentation, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_gbfa *Presentation )Close ()error {if _gbfa .TmpPath !=""{return _egf .RemoveAll (_gbfa .TmpPath );};return nil ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_fc TextBox )Properties ()_abfe .ShapeProperties {if _fc ._cbc .SpPr ==nil {_fc ._cbc .SpPr =_eac .NewCT_ShapeProperties ();};return _abfe .MakeShapeProperties (_fc ._cbc .SpPr );};func (_ccdc *Presentation )Validate ()error {if _adfa :=_ccdc ._ggc .Validate ();_adfa !=nil {return _adfa ;};for _gbf ,_dff :=range _ccdc .Slides (){if _adba :=_dff .ValidateWithPath (_gde .Sprintf ("\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]",_gbf ));_adba !=nil {return _adba ;};};for _gcc ,_dacg :=range _ccdc ._cga {if _fdf :=_dacg .ValidateWithPath (_gde .Sprintf ("\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d",_gcc ));_fdf !=nil {return _fdf ;};};for _dag ,_ebg :=range _ccdc ._agfb {if _bc :=_ebg .ValidateWithPath (_gde .Sprintf ("\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d",_dag ));_bc !=nil {return _bc ;};};return nil ;};func (_bdea TextBox )getOff ()*_eac .CT_Point2D {if _bdea ._cbc .SpPr ==nil {_bdea ._cbc .SpPr =_eac .NewCT_ShapeProperties ();};if _bdea ._cbc .SpPr .Xfrm ==nil {_bdea ._cbc .SpPr .Xfrm =_eac .NewCT_Transform2D ();};if _bdea ._cbc .SpPr .Xfrm .Off ==nil {_bdea ._cbc .SpPr .Xfrm .Off =_eac .NewCT_Point2D ();};return _bdea ._cbc .SpPr .Xfrm .Off ;};
|
|
|
|
// 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 (_ecg PlaceHolder )Clear (){_ecg .ClearAll ();_bafg :=_eac .NewCT_TextParagraph ();_ecg ._agg .TxBody .P =[]*_eac .CT_TextParagraph {_bafg };_bafg .EndParaRPr =_eac .NewCT_TextCharacterProperties ();_bafg .EndParaRPr .LangAttr =_bgc .String ("\u0065\u006e\u002dU\u0053");};
|
|
|
|
// 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 (_dfad *Presentation )AddImage (i _cebf .Image )(_cebf .ImageRef ,error ){_edc :=_cebf .MakeImageRef (i ,&_dfad .DocBase ,_dfad ._gfbag );if i .Data ==nil &&i .Path ==""{return _edc ,_bce .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 _edc ,_bce .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 _edc ,_bce .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 !=""{_ca :=_egf .Add (i .Path );if _ca !=nil {return _edc ,_ca ;};};_dfad .Images =append (_dfad .Images ,_edc );_dfad .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_dfad .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_dfad .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_dfad .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_dfad .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );return _edc ,nil ;};
|
|
|
|
// New initializes and reurns a new presentation
|
|
func New ()*Presentation {_aaaeg :=_bfd ();_aaaeg .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");_aaaeg .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");_aaaeg .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");_aaaeg .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");_aaaeg .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");_aaaeg .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");_aaaeg .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");_aaaeg ._ggc .SldMasterIdLst =_dfa .NewCT_SlideMasterIdList ();_ffgf :=_dfa .NewSldMaster ();_ffgf .ClrMap .Bg1Attr =_eac .ST_ColorSchemeIndexLt1 ;_ffgf .ClrMap .Bg2Attr =_eac .ST_ColorSchemeIndexLt2 ;_ffgf .ClrMap .Tx1Attr =_eac .ST_ColorSchemeIndexDk1 ;_ffgf .ClrMap .Tx2Attr =_eac .ST_ColorSchemeIndexDk2 ;_ffgf .ClrMap .Accent1Attr =_eac .ST_ColorSchemeIndexAccent1 ;_ffgf .ClrMap .Accent2Attr =_eac .ST_ColorSchemeIndexAccent2 ;_ffgf .ClrMap .Accent3Attr =_eac .ST_ColorSchemeIndexAccent3 ;_ffgf .ClrMap .Accent4Attr =_eac .ST_ColorSchemeIndexAccent4 ;_ffgf .ClrMap .Accent5Attr =_eac .ST_ColorSchemeIndexAccent5 ;_ffgf .ClrMap .Accent6Attr =_eac .ST_ColorSchemeIndexAccent6 ;_ffgf .ClrMap .HlinkAttr =_eac .ST_ColorSchemeIndexHlink ;_ffgf .ClrMap .FolHlinkAttr =_eac .ST_ColorSchemeIndexFolHlink ;_aaaeg ._cga =append (_aaaeg ._cga ,_ffgf );_cbfc :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideMasterType ,1);_aaaeg .ContentTypes .AddOverride (_cbfc ,_bgc .SlideMasterContentType );_ddc :=_aaaeg ._gfbag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .OfficeDocumentType ,1,_bgc .SlideMasterType );_ffa :=_dfa .NewCT_SlideMasterIdListEntry ();_ffa .IdAttr =_bgc .Uint32 (2147483648);_ffa .RIdAttr =_ddc .ID ();_aaaeg ._ggc .SldMasterIdLst .SldMasterId =append (_aaaeg ._ggc .SldMasterIdLst .SldMasterId ,_ffa );_bag :=_cebf .NewRelationships ();_aaaeg ._cfbd =append (_aaaeg ._cfbd ,_bag );_egd :=_dfa .NewSldLayout ();_dd :=_bag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .SlideMasterType ,1,_bgc .SlideLayoutType );_befe :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideLayoutType ,1);_aaaeg .ContentTypes .AddOverride (_befe ,_bgc .SlideLayoutContentType );_bag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .SlideMasterType ,1,_bgc .ThemeType );_aaaeg ._agfb =append (_aaaeg ._agfb ,_egd );_ffgf .SldLayoutIdLst =_dfa .NewCT_SlideLayoutIdList ();_fbf :=_dfa .NewCT_SlideLayoutIdListEntry ();_fbf .IdAttr =_bgc .Uint32 (2147483649);_fbf .RIdAttr =_dd .ID ();_ffgf .SldLayoutIdLst .SldLayoutId =append (_ffgf .SldLayoutIdLst .SldLayoutId ,_fbf );_cdee :=_cebf .NewRelationships ();_aaaeg ._fcf =append (_aaaeg ._fcf ,_cdee );_cdee .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .SlideType ,1,_bgc .SlideMasterType );_aaaeg ._ggc .NotesSz .CxAttr =6858000;_aaaeg ._ggc .NotesSz .CyAttr =9144000;_gbe :=_eac .NewTheme ();_gbe .NameAttr =_bgc .String ("\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065");_gbe .ThemeElements .ClrScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gbe .ThemeElements .ClrScheme .Dk1 .SysClr =_eac .NewCT_SystemColor ();_gbe .ThemeElements .ClrScheme .Dk1 .SysClr .LastClrAttr =_bgc .String ("\u0030\u0030\u0030\u0030\u0030\u0030");_gbe .ThemeElements .ClrScheme .Dk1 .SysClr .ValAttr =_eac .ST_SystemColorValWindowText ;_gbe .ThemeElements .ClrScheme .Lt1 .SysClr =_eac .NewCT_SystemColor ();_gbe .ThemeElements .ClrScheme .Lt1 .SysClr .LastClrAttr =_bgc .String ("\u0066\u0066\u0066\u0066\u0066\u0066");_gbe .ThemeElements .ClrScheme .Lt1 .SysClr .ValAttr =_eac .ST_SystemColorValWindow ;_gbe .ThemeElements .ClrScheme .Dk2 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Dk2 .SrgbClr .ValAttr ="\u0034\u0034\u0035\u0034\u0036\u0061";_gbe .ThemeElements .ClrScheme .Lt2 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Lt2 .SrgbClr .ValAttr ="\u0065\u0037\u0065\u0037\u0065\u0036";_gbe .ThemeElements .ClrScheme .Accent1 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent1 .SrgbClr .ValAttr ="\u0034\u0034\u0037\u0032\u0063\u0034";_gbe .ThemeElements .ClrScheme .Accent2 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent2 .SrgbClr .ValAttr ="\u0065\u0064\u0037\u0064\u0033\u0031";_gbe .ThemeElements .ClrScheme .Accent3 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent3 .SrgbClr .ValAttr ="\u0061\u0035\u0061\u0035\u0061\u0035";_gbe .ThemeElements .ClrScheme .Accent4 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent4 .SrgbClr .ValAttr ="\u0066\u0066\u0063\u0030\u0030\u0030";_gbe .ThemeElements .ClrScheme .Accent5 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent5 .SrgbClr .ValAttr ="\u0035\u0062\u0039\u0062\u0064\u0035";_gbe .ThemeElements .ClrScheme .Accent6 .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Accent6 .SrgbClr .ValAttr ="\u0037\u0030\u0061\u0064\u0034\u0037";_gbe .ThemeElements .ClrScheme .Hlink .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .Hlink .SrgbClr .ValAttr ="\u0030\u0035\u0036\u0033\u0063\u0031";_gbe .ThemeElements .ClrScheme .FolHlink .SrgbClr =_eac .NewCT_SRgbColor ();_gbe .ThemeElements .ClrScheme .FolHlink .SrgbClr .ValAttr ="\u0039\u0035\u0034\u0066\u0037\u0032";_gbe .ThemeElements .FontScheme .NameAttr ="\u004f\u0066\u0066\u0069\u0063\u0065";_gbe .ThemeElements .FontScheme .MajorFont .Latin .TypefaceAttr ="\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074";_gbe .ThemeElements .FontScheme .MinorFont .Latin .TypefaceAttr ="\u0043a\u006c\u0069\u0062\u0072\u0069";_gbe .ThemeElements .FmtScheme .NameAttr =_bgc .String ("\u004f\u0066\u0066\u0069\u0063\u0065");_efcg :=_eac .NewEG_FillProperties ();_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_efcg );_efcg .SolidFill =&_eac .CT_SolidColorFillProperties {SchemeClr :&_eac .CT_SchemeColor {ValAttr :_eac .ST_SchemeColorValPhClr }};_efcg =_eac .NewEG_FillProperties ();_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_efcg );_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .FillStyleLst .EG_FillProperties ,_efcg );_efcg .GradFill =&_eac .CT_GradientFillProperties {RotWithShapeAttr :_bgc .Bool (true ),GsLst :&_eac .CT_GradientStopList {},Lin :&_eac .CT_LinearShadeProperties {}};_efcg .GradFill .Lin .AngAttr =_bgc .Int32 (5400000);_efcg .GradFill .Lin .ScaledAttr =_bgc .Bool (false );_dfg :=_eac .NewCT_GradientStop ();_dfg .PosAttr .ST_PositiveFixedPercentageDecimal =_bgc .Int32 (0);_dfg .SchemeClr =&_eac .CT_SchemeColor {ValAttr :_eac .ST_SchemeColorValPhClr };_efcg .GradFill .GsLst .Gs =append (_efcg .GradFill .GsLst .Gs ,_dfg );_dfg =_eac .NewCT_GradientStop ();_dfg .PosAttr .ST_PositiveFixedPercentageDecimal =_bgc .Int32 (50000);_dfg .SchemeClr =&_eac .CT_SchemeColor {ValAttr :_eac .ST_SchemeColorValPhClr };_efcg .GradFill .GsLst .Gs =append (_efcg .GradFill .GsLst .Gs ,_dfg );_gbe .ThemeElements .FmtScheme .LnStyleLst =_eac .NewCT_LineStyleList ();for _efa :=0;_efa < 3;_efa ++{_ea :=_eac .NewCT_LineProperties ();_ea .WAttr =_bgc .Int32 (int32 (6350*(_efa +1)));_ea .CapAttr =_eac .ST_LineCapFlat ;_ea .CmpdAttr =_eac .ST_CompoundLineSng ;_ea .AlgnAttr =_eac .ST_PenAlignmentCtr ;_gbe .ThemeElements .FmtScheme .LnStyleLst .Ln =append (_gbe .ThemeElements .FmtScheme .LnStyleLst .Ln ,_ea );};_gbe .ThemeElements .FmtScheme .EffectStyleLst =_eac .NewCT_EffectStyleList ();for _gf :=0;_gf < 3;_gf ++{_bfbe :=_eac .NewCT_EffectStyleItem ();_bfbe .EffectLst =_eac .NewCT_EffectList ();_gbe .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle =append (_gbe .ThemeElements .FmtScheme .EffectStyleLst .EffectStyle ,_bfbe );};_bdff :=_eac .NewEG_FillProperties ();_bdff .SolidFill =&_eac .CT_SolidColorFillProperties {SchemeClr :&_eac .CT_SchemeColor {ValAttr :_eac .ST_SchemeColorValPhClr }};_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_bdff );_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_bdff );_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties =append (_gbe .ThemeElements .FmtScheme .BgFillStyleLst .EG_FillProperties ,_efcg );_aaaeg ._ece =append (_aaaeg ._ece ,_gbe );_edd :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .ThemeType ,1);_aaaeg .ContentTypes .AddOverride (_edd ,_bgc .ThemeContentType );_aaaeg ._gfbag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .OfficeDocumentType ,1,_bgc .ThemeType );_aca :=_cebf .NewRelationships ();_aaaeg ._dgg =append (_aaaeg ._dgg ,_aca );return _aaaeg ;};
|
|
|
|
// AddTextBox adds an empty textbox to a slide.
|
|
func (_fdc Slide )AddTextBox ()TextBox {_ecf :=_dfa .NewCT_GroupShapeChoice ();_fdc ._gdge .CSld .SpTree .Choice =append (_fdc ._gdge .CSld .SpTree .Choice ,_ecf );_dba :=_dfa .NewCT_Shape ();_ecf .Sp =append (_ecf .Sp ,_dba );_dba .SpPr =_eac .NewCT_ShapeProperties ();_dba .SpPr .Xfrm =_eac .NewCT_Transform2D ();_dba .SpPr .PrstGeom =_eac .NewCT_PresetGeometry2D ();_dba .SpPr .PrstGeom .PrstAttr =_eac .ST_ShapeTypeRect ;_dba .NvSpPr =_dfa .NewCT_ShapeNonVisual ();_dba .NvSpPr .CNvSpPr =_eac .NewCT_NonVisualDrawingShapeProps ();_gdg :=true ;_dba .NvSpPr .CNvSpPr .TxBoxAttr =&_gdg ;_dba .TxBody =_eac .NewCT_TextBody ();_dba .TxBody .BodyPr =_eac .NewCT_TextBodyProperties ();_dba .TxBody .BodyPr .WrapAttr =_eac .ST_TextWrappingTypeSquare ;_dba .TxBody .BodyPr .SpAutoFit =_eac .NewCT_TextShapeAutofit ();_dc :=TextBox {_dba };_dc .Properties ().SetWidth (3*_dab .Inch );_dc .Properties ().SetHeight (1*_dab .Inch );_dc .Properties ().SetPosition (0,0);return _dc ;};
|
|
|
|
// AddSlide adds a new slide to the presentation.
|
|
func (_dg *Presentation )AddSlide ()Slide {_bdf :=_dfa .NewCT_SlideIdListEntry ();_bdf .IdAttr =_dg .nextSlideID ();_dg ._ggc .SldIdLst .SldId =append (_dg ._ggc .SldIdLst .SldId ,_bdf );_bca :=_dfa .NewSld ();_bca .CSld .SpTree .NvGrpSpPr .CNvPr .IdAttr =1;_bca .CSld .SpTree .GrpSpPr .Xfrm =_eac .NewCT_GroupTransform2D ();_bca .CSld .SpTree .GrpSpPr .Xfrm .Off =_eac .NewCT_Point2D ();_bca .CSld .SpTree .GrpSpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_bgc .Int64 (0);_bca .CSld .SpTree .GrpSpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_bgc .Int64 (0);_bca .CSld .SpTree .GrpSpPr .Xfrm .Ext =_eac .NewCT_PositiveSize2D ();_bca .CSld .SpTree .GrpSpPr .Xfrm .Ext .CxAttr =int64 (0*_dab .Point );_bca .CSld .SpTree .GrpSpPr .Xfrm .Ext .CyAttr =int64 (0*_dab .Point );_bca .CSld .SpTree .GrpSpPr .Xfrm .ChOff =_bca .CSld .SpTree .GrpSpPr .Xfrm .Off ;_bca .CSld .SpTree .GrpSpPr .Xfrm .ChExt =_bca .CSld .SpTree .GrpSpPr .Xfrm .Ext ;_dg ._aaca =append (_dg ._aaca ,_bca );_ffb :=_dg ._gfbag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .OfficeDocumentType ,len (_dg ._aaca ),_bgc .SlideType );_bdf .RIdAttr =_ffb .ID ();_ga :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideType ,len (_dg ._aaca ));_dg .ContentTypes .AddOverride (_ga ,_bgc .SlideContentType );_cdca :=_cebf .NewRelationships ();_dg ._acd =append (_dg ._acd ,_cdca );_cdca .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .SlideType ,len (_dg ._agfb ),_bgc .SlideLayoutType );return Slide {_bdf ,_bca ,_dg };};
|
|
|
|
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
|
|
func (_bge TextBox )SetOffsetX (offX float64 ){_ddb :=_bge .getOff ();_fcd :=_dab .ToEMU (offX );_ddb .XAttr =_eac .ST_Coordinate {ST_CoordinateUnqualified :&_fcd };};func (_cbe *Presentation )saveToFile (_afg string ,_deeb bool )error {_bdffd ,_eeg :=_fbe .Create (_afg );if _eeg !=nil {return _eeg ;};defer _bdffd .Close ();return _cbe .save (_bdffd ,_deeb );};
|
|
|
|
// TextBox is a text box within a slide.
|
|
type TextBox struct{_cbc *_dfa .CT_Shape };
|
|
|
|
// Image is an image within a slide.
|
|
type Image struct{_bgad *_dfa .CT_Picture };
|
|
|
|
// PlaceHolder is a place holder from a slide.
|
|
type PlaceHolder struct{_agg *_dfa .CT_Shape ;_gc *_dfa .Sld ;};
|
|
|
|
// ValidateWithPath validates the slide passing path informaton for a better
|
|
// error message.
|
|
func (_bf Slide )ValidateWithPath (path string )error {if _fded :=_bf ._gdge .ValidateWithPath (path );_fded !=nil {return _fded ;};for _ ,_fe :=range _bf ._gdge .CSld .SpTree .Choice {for _ ,_gff :=range _fe .Sp {if _gff .TxBody !=nil {if len (_gff .TxBody .P )==0{return _bce .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 ;};
|
|
|
|
// ClrMru returns the ClrMru property.
|
|
func (_faa PresentationProperties )ClrMru ()*_eac .CT_ColorMRU {return _faa ._aff .ClrMru };func (_fa *Presentation )nextSlideID ()uint32 {_gdga :=uint32 (256);for _ ,_fbd :=range _fa ._ggc .SldIdLst .SldId {if _fbd .IdAttr >=_gdga {_gdga =_fbd .IdAttr +1;};};return _gdga ;};
|
|
|
|
// SlideLayouts returns the slide layouts defined in the presentation.
|
|
func (_ccgb *Presentation )SlideLayouts ()[]SlideLayout {_aaaf :=[]SlideLayout {};for _ ,_efea :=range _ccgb ._agfb {_aaaf =append (_aaaf ,SlideLayout {_efea });};return _aaaf ;};
|
|
|
|
// PrnPr returns the PrnPr property.
|
|
func (_cafe PresentationProperties )PrnPr ()*_dfa .CT_PrintProperties {return _cafe ._aff .PrnPr };
|
|
|
|
// SorterViewPr returns the SorterViewPr property.
|
|
func (_egfd ViewProperties )SorterViewPr ()*_dfa .CT_SlideSorterViewProperties {return _egfd ._abfa .SorterViewPr ;};func (_fdg *Presentation )createCustomProperties (){_fdg .CustomProperties =_cebf .NewCustomProperties ();_fdg .addCustomRelationships ();};
|
|
|
|
// Index returns the placeholder index
|
|
func (_aaae PlaceHolder )Index ()uint32 {if _aaae ._agg .NvSpPr .NvPr .Ph .IdxAttr ==nil {return 0;};return *_aaae ._agg .NvSpPr .NvPr .Ph .IdxAttr ;};
|
|
|
|
// PlaceHolders returns all of the content place holders within a given slide.
|
|
func (_fb Slide )PlaceHolders ()[]PlaceHolder {_egeb :=[]PlaceHolder {};for _ ,_ceg :=range _fb ._gdge .CSld .SpTree .Choice {for _ ,_aa :=range _ceg .Sp {if _aa .NvSpPr !=nil &&_aa .NvSpPr .NvPr !=nil &&_aa .NvSpPr .NvPr .Ph !=nil {_egeb =append (_egeb ,PlaceHolder {_aa ,_fb ._gdge });};};};return _egeb ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ccc SlideLayout )X ()*_dfa .SldLayout {return _ccc ._gee };
|
|
|
|
// X returns TextBox's underlying *pml.CT_Shape.
|
|
func (_cdfc TextBox )X ()*_dfa .CT_Shape {return _cdfc ._cbc };
|
|
|
|
// ShowPr returns the ShowPr property.
|
|
func (_fgg PresentationProperties )ShowPr ()*_dfa .CT_ShowProperties {return _fgg ._aff .ShowPr };
|
|
|
|
// Open opens and reads a document from a file (.pptx).
|
|
func Open (filename string )(*Presentation ,error ){_fd ,_dec :=_fbe .Open (filename );if _dec !=nil {return nil ,_gde .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_dec );};defer _fd .Close ();_ded ,_dec :=_fbe .Stat (filename );if _dec !=nil {return nil ,_gde .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_dec );};_ =_ded ;return Read (_fd ,_ded .Size ());};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bac Slide )X ()*_dfa .Sld {return _bac ._gdge };
|
|
|
|
// ExtLst returns the ExtLst property.
|
|
func (_egb ViewProperties )ExtLst ()*_dfa .CT_ExtensionList {return _egb ._abfa .ExtLst };
|
|
|
|
// Name returns the name of the slide layout.
|
|
func (_gdaa SlideLayout )Name ()string {if _gdaa ._gee .CSld !=nil &&_gdaa ._gee .CSld .NameAttr !=nil {return *_gdaa ._gee .CSld .NameAttr ;};return "";};
|
|
|
|
// Read reads a document from an io.Reader.
|
|
func Read (r _bbg .ReaderAt ,size int64 )(*Presentation ,error ){_fgf :=_bfd ();_cb ,_baae :=_egf .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078");if _baae !=nil {return nil ,_baae ;};_fgf .TmpPath =_cb ;_dbd ,_baae :=_efb .NewReader (r ,size );if _baae !=nil {return nil ,_gde .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_baae );};_ff :=[]*_efb .File {};_ff =append (_ff ,_dbd .File ...);_cdcf :=false ;for _ ,_feef :=range _ff {if _feef .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_cdcf =true ;break ;};};if _cdcf {_fgf .createCustomProperties ();};_bde :=_eb .DecodeMap {};_bde .SetOnNewRelationshipFunc (_fgf .onNewRelationship );_bde .AddTarget (_bgc .ContentTypesFilename ,_fgf .ContentTypes .X (),"",0);_bde .AddTarget (_bgc .BaseRelsFilename ,_fgf .Rels .X (),"",0);if _eff :=_bde .Decode (_ff );_eff !=nil {return nil ,_eff ;};for _ ,_abfc :=range _ff {if _abfc ==nil {continue ;};if _cff :=_fgf .AddExtraFileFromZip (_abfc );_cff !=nil {return nil ,_cff ;};};if _cdcf {_bbbb :=false ;for _ ,_gcf :=range _fgf .Rels .X ().Relationship {if _gcf .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_bbbb =true ;break ;};};if !_bbbb {_fgf .addCustomRelationships ();};};return _fgf ,nil ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_beb SlideMaster )X ()*_dfa .SldMaster {return _beb ._eec };
|
|
|
|
// RemoveSlide removes a slide from a presentation.
|
|
func (_ffba *Presentation )RemoveSlide (s Slide )error {_fag :=false ;_ced :=0;for _cd ,_gbg :=range _ffba ._aaca {if _gbg ==s ._gdge {if _ffba ._ggc .SldIdLst .SldId [_cd ]!=s ._bfc {return _bce .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 (_ffba ._aaca [_cd :],_ffba ._aaca [_cd +1:]);_ffba ._aaca =_ffba ._aaca [0:len (_ffba ._aaca )-1];copy (_ffba ._acd [_cd :],_ffba ._acd [_cd +1:]);_ffba ._acd =_ffba ._acd [0:len (_ffba ._acd )-1];copy (_ffba ._ggc .SldIdLst .SldId [_cd :],_ffba ._ggc .SldIdLst .SldId [_cd +1:]);_ffba ._ggc .SldIdLst .SldId =_ffba ._ggc .SldIdLst .SldId [0:len (_ffba ._ggc .SldIdLst .SldId )-1];_fag =true ;_ced =_cd ;};};if !_fag {return _bce .New ("u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065");};_efc :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideType ,0);return _ffba .ContentTypes .RemoveOverrideByIndex (_efc ,_ced );};
|
|
|
|
// SlideMasters returns the slide masters defined in the presentation.
|
|
func (_eecc *Presentation )SlideMasters ()[]SlideMaster {_fegf :=[]SlideMaster {};for _bcce ,_ag :=range _eecc ._cga {_fegf =append (_fegf ,SlideMaster {_eecc ,_eecc ._cfbd [_bcce ],_ag });};return _fegf ;};func _fbaf (){_bgg ,_adb :=_ebc .ReadBuildInfo ();if !_adb {if !_dac {_gde .Printf ("\u0042\u0075il\u0064\u0020\u0069n\u0066\u006f\u0072\u006dati\u006fn \u006d\u0069\u0073\u0073\u0069\u006e\u0067 -\u0020\u0045\u0078\u0069\u0074\u0069\u006eg\u000a");_fbe .Exit (1);}else {return ;};};_d :=0;for _ ,_gab :=range _bgg .Deps {if _gab .Path =="g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065"&&_gab .Replace ==nil {_d =1;};};_eda :=_dac ;if _effee .HasPrefix (_bgg .Path ,"\u0067i\u0074h\u0075\u0062\u002e\u0063\u006fm\u002f\u0075n\u0069\u0064\u006f\u0063\u002f"){_eda =true ;};if _d !=1&&!_eda {_gde .Printf ("\u0050\u0061\u0063\u006b\u0061\u0067\u0065\u0020\u0069\u006e\u0066\u006f\u0072\u006d\u0061\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u002d\u0020E\u0078\u0069t\u0069\u006e\u0067\u000a");_fbe .Exit (1);};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdfg PlaceHolder )X ()*_dfa .CT_Shape {return _cdfg ._agg };
|
|
|
|
// ViewProperties contains presentation specific properties.
|
|
type ViewProperties struct{_abfa *_dfa .ViewPr };
|
|
|
|
// AddImage adds an image textbox to a slide.
|
|
func (_caa Slide )AddImage (img _cebf .ImageRef )Image {_fgd :=_dfa .NewCT_GroupShapeChoice ();_caa ._gdge .CSld .SpTree .Choice =append (_caa ._gdge .CSld .SpTree .Choice ,_fgd );_dbba :=_dfa .NewCT_Picture ();_fgd .Pic =append (_fgd .Pic ,_dbba );_dbba .NvPicPr .CNvPicPr =_eac .NewCT_NonVisualPictureProperties ();_dbba .NvPicPr .CNvPicPr .PicLocks =_eac .NewCT_PictureLocking ();_dbba .NvPicPr .CNvPicPr .PicLocks .NoChangeAspectAttr =_bgc .Bool (true );_dbba .BlipFill =_eac .NewCT_BlipFillProperties ();_dbba .BlipFill .Blip =_eac .NewCT_Blip ();_eeab :=_caa .AddImageToRels (img );_dbba .BlipFill .Blip .EmbedAttr =_bgc .String (_eeab );_dbba .BlipFill .Stretch =_eac .NewCT_StretchInfoProperties ();_dbba .BlipFill .Stretch .FillRect =_eac .NewCT_RelativeRect ();_dbba .SpPr =_eac .NewCT_ShapeProperties ();_dbba .SpPr .PrstGeom =_eac .NewCT_PresetGeometry2D ();_dbba .SpPr .PrstGeom .PrstAttr =_eac .ST_ShapeTypeRect ;_dbf :=Image {_dbba };_cdf :=img .Size ();_dbf .Properties ().SetWidth (_dab .Distance (_cdf .X )*_dab .Pixel72 );_dbf .Properties ().SetHeight (_dab .Distance (_cdf .Y )*_dab .Pixel72 );_dbf .Properties ().SetPosition (0,0);return _dbf ;};
|
|
|
|
// ClearAll completely clears a placeholder. To be useable, at least one
|
|
// paragraph must be added after ClearAll via AddParagraph.
|
|
func (_feg PlaceHolder )ClearAll (){_feg ._agg .SpPr =_eac .NewCT_ShapeProperties ();_feg ._agg .TxBody =_eac .NewCT_TextBody ();_feg ._agg .TxBody .LstStyle =_eac .NewCT_TextListStyle ();};func (_fadd *Presentation )save (_bgb _bbg .Writer ,_cef bool )error {if _efe :=_fadd ._ggc .Validate ();_efe !=nil {_egbb .Printf ("\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",_efe );};if !_fab .GetLicenseKey ().IsLicensed ()&&!_dac {_gde .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");_gde .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 _bce .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 _cef {_fadd .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");_fadd .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 {_fadd .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");_fadd .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");};_gfff :=_bgc .DocTypePresentation ;_efbd :=_efb .NewWriter (_bgb );defer _efbd .Close ();if _fdd :=_eb .MarshalXML (_efbd ,_bgc .BaseRelsFilename ,_fadd .Rels .X ());_fdd !=nil {return _fdd ;};if _eea :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .ExtendedPropertiesType ,_fadd .AppProperties .X ());_eea !=nil {return _eea ;};if _gfg :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .CorePropertiesType ,_fadd .CoreProperties .X ());_gfg !=nil {return _gfg ;};if _dea :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .PresentationPropertiesType ,_fadd ._eeac .X ());_dea !=nil {return _dea ;};if _dbg :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .ViewPropertiesType ,_fadd ._agce .X ());_dbg !=nil {return _dbg ;};if _gb :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .TableStylesType ,_fadd ._gfb .X ());_gb !=nil {return _gb ;};if _fadd .CustomProperties .X ()!=nil {if _edag :=_eb .MarshalXMLByType (_efbd ,_gfff ,_bgc .CustomPropertiesType ,_fadd .CustomProperties .X ());_edag !=nil {return _edag ;};};if _fadd .Thumbnail !=nil {_abf ,_bdgg :=_efbd .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _bdgg !=nil {return _bdgg ;};if _ba :=_bbe .Encode (_abf ,_fadd .Thumbnail ,nil );_ba !=nil {return _ba ;};};_fbfe :=_bgc .AbsoluteFilename (_gfff ,_bgc .OfficeDocumentType ,0);if _bdge :=_eb .MarshalXML (_efbd ,_fbfe ,_fadd ._ggc );_bdge !=nil {return _bdge ;};if _aaf :=_eb .MarshalXML (_efbd ,_eb .RelationsPathFor (_fbfe ),_fadd ._gfbag .X ());_aaf !=nil {return _aaf ;};for _fcfe ,_ge :=range _fadd ._aaca {_aeb :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideType ,_fcfe +1);_eb .MarshalXML (_efbd ,_aeb ,_ge );if !_fadd ._acd [_fcfe ].IsEmpty (){_ecgd :=_eb .RelationsPathFor (_aeb );_eb .MarshalXML (_efbd ,_ecgd ,_fadd ._acd [_fcfe ].X ());};};for _bed ,_cbf :=range _fadd ._cga {_gef :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideMasterType ,_bed +1);_eb .MarshalXML (_efbd ,_gef ,_cbf );if !_fadd ._cfbd [_bed ].IsEmpty (){_cfag :=_eb .RelationsPathFor (_gef );_eb .MarshalXML (_efbd ,_cfag ,_fadd ._cfbd [_bed ].X ());};};for _agf ,_ege :=range _fadd ._agfb {_agee :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideLayoutType ,_agf +1);_eb .MarshalXML (_efbd ,_agee ,_ege );if !_fadd ._fcf [_agf ].IsEmpty (){_de :=_eb .RelationsPathFor (_agee );_eb .MarshalXML (_efbd ,_de ,_fadd ._fcf [_agf ].X ());};};for _aba ,_gag :=range _fadd ._ece {_eed :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .ThemeType ,_aba +1);_eb .MarshalXML (_efbd ,_eed ,_gag );if !_fadd ._dgg [_aba ].IsEmpty (){_b :=_eb .RelationsPathFor (_eed );_eb .MarshalXML (_efbd ,_b ,_fadd ._dgg [_aba ].X ());};};for _aagc ,_ageg :=range _fadd ._cgc {_cf :=_bgc .AbsoluteFilename (_gfff ,_bgc .ChartType ,_aagc +1);_eb .MarshalXML (_efbd ,_cf ,_ageg );};for _fda ,_ffg :=range _fadd ._gea {_bg :=_bgc .AbsoluteFilename (_gfff ,_bgc .HandoutMasterType ,_fda +1);_eb .MarshalXML (_efbd ,_bg ,_ffg );};for _gcdb ,_fee :=range _fadd ._ace {_bbd :=_bgc .AbsoluteFilename (_gfff ,_bgc .NotesMasterType ,_gcdb +1);_eb .MarshalXML (_efbd ,_bbd ,_fee );};for _ccee ,_adg :=range _fadd ._aag {_ede :=_bgc .AbsoluteFilename (_gfff ,_bgc .CustomXMLType ,_ccee +1);_eb .MarshalXML (_efbd ,_ede ,_adg );};for _gba ,_cdcg :=range _fadd .Images {if _dfbd :=_cebf .AddImageToZip (_efbd ,_cdcg ,_gba +1,_bgc .DocTypePresentation );_dfbd !=nil {return _dfbd ;};};_fadd .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_fadd .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadd .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadd .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");if _efedb :=_eb .MarshalXML (_efbd ,_bgc .ContentTypesFilename ,_fadd .ContentTypes .X ());_efedb !=nil {return _efedb ;};if _baad :=_fadd .WriteExtraFiles (_efbd );_baad !=nil {return _baad ;};return nil ;};
|
|
|
|
// 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 (_db *Presentation )AddDefaultSlideWithLayout (l SlideLayout )(Slide ,error ){_gda ,_gdf :=_db .AddSlideWithLayout (l );for _ ,_eacf :=range _gda .PlaceHolders (){_eacf .Clear ();switch _eacf .Type (){case _dfa .ST_PlaceholderTypeFtr ,_dfa .ST_PlaceholderTypeDt ,_dfa .ST_PlaceholderTypeSldNum :_eacf .Remove ();};};return _gda ,_gdf ;};
|
|
|
|
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
|
|
func (_ecc Slide )AddImageToRels (img _cebf .ImageRef )string {_bgf :=0;for _dgd ,_cdcd :=range _ecc ._bbf .Images {if _cdcd ==img {_bgf =_dgd +1;break ;};};var _eag string ;for _bbb ,_a :=range _ecc ._bbf .Slides (){if _a ._gdge ==_ecc ._gdge {_bga :=_gde .Sprintf ("\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",_bgf ,img .Format ());_adga :=_ecc ._bbf ._acd [_bbb ].AddRelationship (_bga ,_bgc .ImageType );_eag =_adga .ID ();};};return _eag ;};
|
|
|
|
// OutlineViewPr returns the OutlineViewPr property.
|
|
func (_cde ViewProperties )OutlineViewPr ()*_dfa .CT_OutlineViewProperties {return _cde ._abfa .OutlineViewPr ;};
|
|
|
|
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
|
|
func (_ebb *Presentation )SaveAsTemplate (w _bbg .Writer )error {return _ebb .save (w ,true )};
|
|
|
|
// Slides returns the slides in the presentation.
|
|
func (_ffe *Presentation )Slides ()[]Slide {_deb :=[]Slide {};for _gfc ,_gca :=range _ffe ._aaca {_deb =append (_deb ,Slide {_ffe ._ggc .SldIdLst .SldId [_gfc ],_gca ,_ffe });};return _deb ;};
|
|
|
|
// 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 (_ebd Slide )GetPlaceholderByIndex (idx uint32 )(PlaceHolder ,error ){for _ ,_bdba :=range _ebd ._gdge .CSld .SpTree .Choice {for _ ,_gbb :=range _bdba .Sp {if _gbb .NvSpPr !=nil &&_gbb .NvSpPr .NvPr !=nil &&_gbb .NvSpPr .NvPr .Ph !=nil {if (idx ==0&&_gbb .NvSpPr .NvPr .Ph .IdxAttr ==nil )||(_gbb .NvSpPr .NvPr .Ph .IdxAttr !=nil &&*_gbb .NvSpPr .NvPr .Ph .IdxAttr ==idx ){return PlaceHolder {_gbb ,_ebd ._gdge },nil ;};};};};return PlaceHolder {},_bce .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");};
|
|
|
|
// Slide represents a slide of a presentation.
|
|
type Slide struct{_bfc *_dfa .CT_SlideIdListEntry ;_gdge *_dfa .Sld ;_bbf *Presentation ;};func _bfd ()*Presentation {_gccg :=&Presentation {_ggc :_dfa .NewPresentation ()};_gccg ._ggc .SldIdLst =_dfa .NewCT_SlideIdList ();_gccg ._ggc .ConformanceAttr =_ec .ST_ConformanceClassTransitional ;_gccg .AppProperties =_cebf .NewAppProperties ();_gccg .CoreProperties =_cebf .NewCoreProperties ();_gccg ._gfb =_cebf .NewTableStyles ();_gccg .ContentTypes =_cebf .NewContentTypes ();_gccg .Rels =_cebf .NewRelationships ();_gccg ._gfbag =_cebf .NewRelationships ();_gccg ._eeac =NewPresentationProperties ();_gccg ._agce =NewViewProperties ();_gccg ._ecbe =map[string ]string {};return _gccg ;};
|
|
|
|
// NotesViewPr returns the NotesViewPr property.
|
|
func (_adbab ViewProperties )NotesViewPr ()*_dfa .CT_NotesViewProperties {return _adbab ._abfa .NotesViewPr ;};
|
|
|
|
// SlideLayouts returns a slice of all layouts in SlideMaster.
|
|
func (_efff SlideMaster )SlideLayouts ()[]SlideLayout {_bab :=map[string ]int {};_aef :=[]SlideLayout {};for _ ,_edf :=range _efff ._cdb .Relationships (){_afe :=_effee .Replace (_edf .Target (),".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074","",-1);_afe =_effee .Replace (_afe ,"\u002e\u0078\u006d\u006c","",-1);if _ecbec ,_ccdg :=_bbfe .ParseInt (_afe ,10,32);_ccdg ==nil {_bab [_edf .ID ()]=int (_ecbec );};};for _ ,_aae :=range _efff ._eec .SldLayoutIdLst .SldLayoutId {if _cfb ,_eg :=_bab [_aae .RIdAttr ];_eg {_fbaa :=_efff ._daf ._agfb [_cfb -1];_aef =append (_aef ,SlideLayout {_fbaa });};};return _aef ;};
|
|
|
|
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first)
|
|
func (_e *Presentation )GetOrCreateCustomProperties ()_cebf .CustomProperties {if _e .CustomProperties .X ()==nil {_e .createCustomProperties ();};return _e .CustomProperties ;};
|
|
|
|
// Save writes the presentation out to a writer in the Zip package format
|
|
func (_ad *Presentation )Save (w _bbg .Writer )error {return _ad .save (w ,false )};
|
|
|
|
// HtmlPubPr returns the HtmlPubPr property.
|
|
func (_bef PresentationProperties )HtmlPubPr ()*_dfa .CT_HtmlPublishProperties {return _bef ._aff .HtmlPubPr ;};
|
|
|
|
// Properties returns the properties of the TextBox.
|
|
func (_dde Image )Properties ()_abfe .ShapeProperties {if _dde ._bgad .SpPr ==nil {_dde ._bgad .SpPr =_eac .NewCT_ShapeProperties ();};return _abfe .MakeShapeProperties (_dde ._bgad .SpPr );};
|
|
|
|
// Paragraphs returns the paragraphs defined in the placeholder.
|
|
func (_bb PlaceHolder )Paragraphs ()[]_abfe .Paragraph {_ae :=[]_abfe .Paragraph {};for _ ,_gbbb :=range _bb ._agg .TxBody .P {_ae =append (_ae ,_abfe .MakeParagraph (_gbbb ));};return _ae ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ebdf ViewProperties )X ()*_dfa .ViewPr {return _ebdf ._abfa };
|
|
|
|
// 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 (_abb *Presentation )AddSlideWithLayout (l SlideLayout )(Slide ,error ){_eaa :=_dfa .NewCT_SlideIdListEntry ();_eaa .IdAttr =256;for _ ,_ddg :=range _abb ._ggc .SldIdLst .SldId {if _ddg .IdAttr >=_eaa .IdAttr {_eaa .IdAttr =_ddg .IdAttr +1;};};_abb ._ggc .SldIdLst .SldId =append (_abb ._ggc .SldIdLst .SldId ,_eaa );_bae :=_dfa .NewSld ();_age :=_bbc .Buffer {};_egg :=_ee .NewEncoder (&_age );_fadg :=_ee .StartElement {Name :_ee .Name {Local :"\u0073\u006c\u0069d\u0065"}};_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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"});_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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"});_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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"});_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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"});_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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"});_fadg .Attr =append (_fadg .Attr ,_ee .Attr {Name :_ee .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 _cffd :=l ._gee .CSld .MarshalXML (_egg ,_fadg );_cffd !=nil {return Slide {},_cffd ;};_egg .Flush ();_aga :=_ee .NewDecoder (&_age );_bae .CSld =_dfa .NewCT_CommonSlideData ();if _egdb :=_aga .Decode (_bae .CSld );_egdb !=nil {return Slide {},_egdb ;};_bae .CSld .NameAttr =nil ;_bae .CSld .SpTree .Choice =_bdg (_bae .CSld .SpTree .Choice );_abb ._aaca =append (_abb ._aaca ,_bae );_gga :=_abb ._gfbag .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .OfficeDocumentType ,len (_abb ._aaca ),_bgc .SlideType );_eaa .RIdAttr =_gga .ID ();_ccg :=_bgc .AbsoluteFilename (_bgc .DocTypePresentation ,_bgc .SlideType ,len (_abb ._aaca ));_abb .ContentTypes .AddOverride (_ccg ,_bgc .SlideContentType );_aed :=_cebf .NewRelationships ();_abb ._acd =append (_abb ._acd ,_aed );_egbd :=len (_abb ._acd )-1;for _ed ,_ega :=range _abb ._agfb {if _ega ==l .X (){_bacc :=_abb ._fcf [_ed ];for _ ,_bfg :=range _bacc .X ().Relationship {if _bfg .TypeAttr !=_bgc .SlideMasterType {_abb ._acd [_egbd ].X ().Relationship =append (_abb ._acd [_egbd ].X ().Relationship ,_bfg );};};_aed .AddAutoRelationship (_bgc .DocTypePresentation ,_bgc .SlideType ,_ed +1,_bgc .SlideLayoutType );};};_gcg :=Slide {_eaa ,_bae ,_abb };return _gcg ,nil ;};
|
|
|
|
// GridSpacing returns the GridSpacing property.
|
|
func (_fba ViewProperties )GridSpacing ()*_eac .CT_PositiveSize2D {return _fba ._abfa .GridSpacing };
|
|
|
|
// AddParagraph adds a paragraph to the text box
|
|
func (_eedg TextBox )AddParagraph ()_abfe .Paragraph {_fbc :=_eac .NewCT_TextParagraph ();_eedg ._cbc .TxBody .P =append (_eedg ._cbc .TxBody .P ,_fbc );return _abfe .MakeParagraph (_fbc );};
|
|
|
|
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
|
|
func (_adf *Presentation )SaveToFileAsTemplate (path string )error {return _adf .saveToFile (path ,true )};
|
|
|
|
// WebPr returns the WebPr property.
|
|
func (_dcab PresentationProperties )WebPr ()*_dfa .CT_WebProperties {return _dcab ._aff .WebPr };
|
|
|
|
// 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 (_fbb Slide )GetPlaceholder (t _dfa .ST_PlaceholderType )(PlaceHolder ,error ){for _ ,_efcge :=range _fbb ._gdge .CSld .SpTree .Choice {for _ ,_gd :=range _efcge .Sp {if _gd .NvSpPr !=nil &&_gd .NvSpPr .NvPr !=nil &&_gd .NvSpPr .NvPr .Ph !=nil {if _gd .NvSpPr .NvPr .Ph .TypeAttr ==t {return PlaceHolder {_gd ,_fbb ._gdge },nil ;};};};};return PlaceHolder {},_bce .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");};
|
|
|
|
// NotesTextViewPr returns the NotesTextViewPr property.
|
|
func (_cedf ViewProperties )NotesTextViewPr ()*_dfa .CT_NotesTextViewProperties {return _cedf ._abfa .NotesTextViewPr ;};
|
|
|
|
// SaveToFile writes the Presentation out to a file.
|
|
func (_eeb *Presentation )SaveToFile (path string )error {return _eeb .saveToFile (path ,false )};
|
|
|
|
// NewViewProperties constructs a new ViewProperties.
|
|
func NewViewProperties ()ViewProperties {return ViewProperties {_abfa :_dfa .NewViewPr ()}};
|
|
|
|
// SlideMaster is the slide master for a presentation.
|
|
type SlideMaster struct{_daf *Presentation ;_cdb _cebf .Relationships ;_eec *_dfa .SldMaster ;};
|
|
|
|
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
|
|
func (_gedg TextBox )SetOffsetY (offY float64 ){_fde :=_gedg .getOff ();_ccb :=_dab .ToEMU (offY );_fde .YAttr =_eac .ST_Coordinate {ST_CoordinateUnqualified :&_ccb };};
|
|
|
|
// 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 (_cad PlaceHolder )SetText (text string ){_cad .Clear ();_eddg :=_eac .NewEG_TextRun ();_eddg .R =_eac .NewCT_RegularTextRun ();_eddg .R .T =text ;if len (_cad ._agg .TxBody .P )==0{_cad ._agg .TxBody .P =append (_cad ._agg .TxBody .P ,_eac .NewCT_TextParagraph ());};_cad ._agg .TxBody .P [0].EG_TextRun =nil ;_cad ._agg .TxBody .P [0].EG_TextRun =append (_cad ._agg .TxBody .P [0].EG_TextRun ,_eddg );};
|
|
|
|
// LastViewAttr returns the LastViewAttr property.
|
|
func (_ged ViewProperties )LastViewAttr ()_dfa .ST_ViewType {return _ged ._abfa .LastViewAttr }; |