2017-08-28 20:56:18 -05:00
//
2020-08-23 14:15:53 +00:00
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2022-01-15 21:17:38 +00:00
package presentation ; import ( _a "archive/zip" ; _dd "bytes" ; _fc "encoding/xml" ; _ded "errors" ; _df "fmt" ; _fgg "github.com/unidoc/unioffice" ; _gf "github.com/unidoc/unioffice/common" ; _ff "github.com/unidoc/unioffice/common/logger" ; _ba "github.com/unidoc/unioffice/common/tempstorage" ; _bd "github.com/unidoc/unioffice/drawing" ; _fa "github.com/unidoc/unioffice/internal/license" ; _fg "github.com/unidoc/unioffice/measurement" ; _fcc "github.com/unidoc/unioffice/schema/soo/dml" ; _fe "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _bg "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _g "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _cg "github.com/unidoc/unioffice/schema/soo/pml" ; _b "github.com/unidoc/unioffice/zippkg" ; _eb "image" ; _de "image/jpeg" ; _cc "io" ; _ef "math" ; _ffd "os" ; _e "path" ; _fgc "sort" ; _d "strconv" ; _c "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2021-11-10 11:45:21 +00:00
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
2022-01-15 21:17:38 +00:00
func ( _gdcb * Slide ) GetColorBySchemeColor ( schClr _fcc . ST_SchemeColorVal ) * _fcc . CT_Color { _gdcb . ensureClrMap ( ) ; _gdg := _gdcb . _bgd ; if _gdg == nil { return nil ; } ; var _cbfg _fcc . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _cbfg = _gdg . Bg1Attr ; case "\u0062\u0067\u0032" : _cbfg = _gdg . Bg2Attr ; case "\u0074\u0078\u0031" : _cbfg = _gdg . Tx1Attr ; case "\u0074\u0078\u0032" : _cbfg = _gdg . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _cbfg = _gdg . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _cbfg = _gdg . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _cbfg = _gdg . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _cbfg = _gdg . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _cbfg = _gdg . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _cbfg = _gdg . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _cbfg = _gdg . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _cbfg = _gdg . FolHlinkAttr ; case "\u0064\u006b\u0031" : _cbfg = _fcc . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _cbfg = _fcc . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _cbfg = _fcc . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _cbfg = _fcc . ST_ColorSchemeIndexLt2 ; default : _cbfg = _fcc . ST_ColorSchemeIndexUnset ; } ; _ggba := _gdcb . _gggf . _aag [ 0 ] ; _fgde := _ggba . ThemeElements ; if _fgde == nil { return nil ; } ; var _defb * _fcc . CT_Color ; _decf := _fgde . ClrScheme ; switch _cbfg . String ( ) { case "\u0064\u006b\u0031" : _defb = _decf . Dk1 ; case "\u0064\u006b\u0032" : _defb = _decf . Dk2 ; case "\u006c\u0074\u0031" : _defb = _decf . Lt1 ; case "\u006c\u0074\u0032" : _defb = _decf . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _defb = _decf . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _defb = _decf . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _defb = _decf . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _defb = _decf . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _defb = _decf . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _defb = _decf . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _defb = _decf . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _defb = _decf . FolHlink ; default : return nil ; } ; return _defb ; } ;
2017-11-18 11:43:37 -06:00
2022-01-15 21:17:38 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _efc * Presentation ) AddImage ( i _gf . Image ) ( _gf . ImageRef , error ) { _edf := _gf . MakeImageRef ( i , & _efc . DocBase , _efc . _acf ) ; if i . Data == nil && i . Path == "" { return _edf , _ded . 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 _edf , _ded . 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 _edf , _ded . 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 != "" { _begee := _ba . Add ( i . Path ) ; if _begee != nil { return _edf , _begee ; } ; } ; _efc . Images = append ( _efc . Images , _edf ) ; _efc . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _efc . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _efc . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _efc . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _efc . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; return _edf , nil ; } ;
2021-05-31 16:22:30 +00:00
2022-01-15 21:17:38 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _aad : _cg . NewPresentationPr ( ) } ; } ;
2021-05-31 16:22:30 +00:00
2022-01-15 21:17:38 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _aad * _cg . PresentationPr } ;
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _eca * _cg . CT_Shape ; _ecg * _cg . Sld ; } ;
2020-08-23 14:15:53 +00:00
2021-11-10 11:45:21 +00:00
// AddDefaultSlideWithLayout tries to replicate what PowerPoint does when
// inserting a slide with a new style by clearing placeholder content and removing
// some placeholders. Use AddSlideWithLayout if you need more control.
2022-01-15 21:17:38 +00:00
func ( _degf * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _fgdb , _ccac := _degf . AddSlideWithLayout ( l ) ; for _ , _gga := range _fgdb . PlaceHolders ( ) { _gga . Clear ( ) ; switch _gga . Type ( ) { case _cg . ST_PlaceholderTypeFtr , _cg . ST_PlaceholderTypeDt , _cg . ST_PlaceholderTypeSldNum : _gga . Remove ( ) ; } ; } ; return _fgdb , _ccac ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// WebPr returns the WebPr property.
func ( _cgdea PresentationProperties ) WebPr ( ) * _cg . CT_WebProperties { return _cgdea . _aad . WebPr } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _bacb ViewProperties ) X ( ) * _cg . ViewPr { return _bacb . _gca } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// GetPlaceholder returns a placeholder given its type. If there are multiplace
// placeholders of the same type, this method returns the first one. You must use the
// PlaceHolders() method to access the others.
func ( _dbdf Slide ) GetPlaceholder ( t _cg . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _fabc := range _dbdf . _eed . CSld . SpTree . Choice { for _ , _dbb := range _fabc . Sp { if _dbb . NvSpPr != nil && _dbb . NvSpPr . NvPr != nil && _dbb . NvSpPr . NvPr . Ph != nil { if _dbb . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _dbb , _dbdf . _eed } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ded . 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" ) ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// ExtLst returns the ExtLst property.
func ( _dgd PresentationProperties ) ExtLst ( ) * _cg . CT_ExtensionList { return _dgd . _aad . ExtLst } ;
2020-11-09 01:00:18 +00:00
2022-01-15 21:17:38 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _fgdgc * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _eceb := range _fgdgc . _ca { if _eceb . CSld . NameAttr != nil && name == * _eceb . CSld . NameAttr { return SlideLayout { _eceb } , nil ; } ; } ; return SlideLayout { } , _ded . 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" ) ; } ;
2021-05-31 16:22:30 +00:00
2022-01-15 21:17:38 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _gadg SlideMaster ) X ( ) * _cg . SldMaster { return _gadg . _fdcg } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Image is an image within a slide.
type Image struct { _gec * _cg . CT_Picture } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Type returns the type of the slide layout.
func ( _gbc SlideLayout ) Type ( ) _cg . ST_SlideLayoutType { return _gbc . _cdg . TypeAttr } ;
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _ffbg TextBox ) SetOffsetX ( offX float64 ) { _agag := _ffbg . getOff ( ) ; _fagc := _fg . ToEMU ( offX ) ; _agag . XAttr = _fcc . ST_Coordinate { ST_CoordinateUnqualified : & _fagc } ; } ; var _ffdd = false ;
2020-08-23 14:15:53 +00:00
2021-11-10 11:45:21 +00:00
// SlideMaster is the slide master for a presentation.
2022-01-15 21:17:38 +00:00
type SlideMaster struct { _fcdf * Presentation ; _dbae _gf . Relationships ; _fdcg * _cg . SldMaster ; } ; func _dab ( _ggb [ ] * _cg . CT_GroupShapeChoice ) [ ] * _cg . CT_GroupShapeChoice { var _ddf [ ] * _cg . CT_GroupShapeChoice ; for _ , _afg := range _ggb { if len ( _afg . Pic ) == 0 { _ddf = append ( _ddf , _afg ) ; } ; } ; return _ddf ; } ;
2020-11-09 01:00:18 +00:00
2022-01-15 21:17:38 +00:00
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _bgaf TextBox ) SetOffsetY ( offY float64 ) { _dbdfb := _bgaf . getOff ( ) ; _cdbf := _fg . ToEMU ( offY ) ; _dbdfb . YAttr = _fcc . ST_Coordinate { ST_CoordinateUnqualified : & _cdbf } ; } ;
2021-03-16 20:51:18 +00:00
2022-01-15 21:17:38 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _be * Presentation ) ExtractText ( ) * PresentationText { _af := [ ] * SlideText { } ; for _ , _fgge := range _be . Slides ( ) { _bbf := _fgge . ExtractText ( ) ; if _bbf != nil { _af = append ( _af , _bbf ) ; } ; } ; return & PresentationText { Slides : _af } ; } ;
2020-08-23 14:15:53 +00:00
2021-11-10 11:45:21 +00:00
// SlideMasters returns the slide masters defined in the presentation.
2022-01-15 21:17:38 +00:00
func ( _ffg * Presentation ) SlideMasters ( ) [ ] SlideMaster { _babd := [ ] SlideMaster { } ; for _caa , _bdga := range _ffg . _gdf { _babd = append ( _babd , SlideMaster { _ffg , _ffg . _daa [ _caa ] , _bdga } ) ; } ; return _babd ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _cae ViewProperties ) NotesViewPr ( ) * _cg . CT_NotesViewProperties { return _cae . _gca . NotesViewPr } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _ged Slide ) ValidateWithPath ( path string ) error { if _edga := _ged . _eed . ValidateWithPath ( path ) ; _edga != nil { return _edga ; } ; for _ , _aggf := range _ged . _eed . CSld . SpTree . Choice { for _ , _ebbb := range _aggf . Sp { if _ebbb . TxBody != nil { if len ( _ebbb . TxBody . P ) == 0 { return _ded . 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 ; } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// Properties returns the properties of the TextBox.
func ( _baa TextBox ) Properties ( ) _bd . ShapeProperties { if _baa . _eef . SpPr == nil { _baa . _eef . SpPr = _fcc . NewCT_ShapeProperties ( ) ; } ; return _bd . MakeShapeProperties ( _baa . _eef . SpPr ) ; } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// AddParagraph adds a paragraph to the text box
func ( _bfb TextBox ) AddParagraph ( ) _bd . Paragraph { _gdea := _fcc . NewCT_TextParagraph ( ) ; _bfb . _eef . TxBody . P = append ( _bfb . _eef . TxBody . P , _gdea ) ; return _bd . MakeParagraph ( _gdea ) ; } ;
2021-11-10 11:45:21 +00:00
2022-01-15 21:17:38 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _agde ViewProperties ) LastViewAttr ( ) _cg . ST_ViewType { return _agde . _gca . LastViewAttr } ; func ( _add * Slide ) ensureClrMap ( ) { if len ( _add . _gggf . _gdf ) == 0 || len ( _add . _gggf . _aag ) == 0 { return ; } ; _gfa := _add . _gggf . _gdf [ 0 ] ; _bgfg := _gfa . ClrMap ; if _beee := _add . _eed . ClrMapOvr ; _beee != nil { if _gdde := _beee . Choice ; _gdde != nil { if _gdde . MasterClrMapping == nil { if _aebd := _gdde . OverrideClrMapping ; _aebd != nil { if _aebd . Bg1Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Bg1Attr = _aebd . Bg1Attr ; } ; if _aebd . Tx1Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Tx1Attr = _aebd . Tx1Attr ; } ; if _aebd . Bg2Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Bg2Attr = _aebd . Bg2Attr ; } ; if _aebd . Tx2Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Tx2Attr = _aebd . Tx2Attr ; } ; if _aebd . Accent1Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent1Attr = _aebd . Accent1Attr ; } ; if _aebd . Accent2Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent2Attr = _aebd . Accent2Attr ; } ; if _aebd . Accent3Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent3Attr = _aebd . Accent3Attr ; } ; if _aebd . Accent4Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent4Attr = _aebd . Accent4Attr ; } ; if _aebd . Accent5Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent5Attr = _aebd . Accent5Attr ; } ; if _aebd . Accent6Attr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . Accent6Attr = _aebd . Accent6Attr ; } ; if _aebd . HlinkAttr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . HlinkAttr = _aebd . HlinkAttr ; } ; if _aebd . FolHlinkAttr != _fcc . ST_ColorSchemeIndexUnset { _bgfg . FolHlinkAttr = _aebd . FolHlinkAttr ; } ; } ; } ; } ; } ; _add . _bgd = _bgfg ; } ; func _fag ( _gea * Presentation , _adc * _cg . CT_Shape , _edef * _cg . CT_GraphicalObjectFrame , _fbc * TableInfo , _ccg * _fcc . CT_Transform2D , _eeb int , _bbg [ ] rectangle , _gc [ ] * _fcc . CT_TextParagraph ) [ ] * TextItem { _gd := [ ] * TextItem { } ; var _dcc , _cb , _feeg , _bc , _bgf , _gfb int64 ; _gad := _ccg == nil ; _bdg := 0 ; for _ , _gaa := range _gc { for _ , _cgb := range _gaa . EG_TextRun { if _fabg := _cgb . R ; _fabg != nil { if ! _gad { if _ccg . Off != nil { if _cgce := _ccg . Ext ; _cgce != nil { _bgf , _gfb = _cgce . CxAttr , _cgce . CyAttr ; } ; if _ddd := _ccg . Off . XAttr . ST_CoordinateUnqualified ; _ddd != nil { _dcc = * _ddd ; _cb = _dcc + _bgf ; _gad = true ; } ; if _afc := _ccg . Off . YAttr . ST_CoordinateUnqualified ; _afc != nil { _feeg = * _afc ; _bc = _feeg + _gfb ; _gad = true ; } ; } ; } ; _egg := append ( [ ] rectangle { } , _bbg ... ) ; _egg = append ( _egg , rectangle { _ge : _dcc , _ed : _cb , _dcf : _feeg , _gb : _bc } ) ; _gd = append ( _gd , & TextItem { Presentation : _gea , Shape : _adc , GraphicFrame : _edef , TableInfo : _fbc , Paragraph : _gaa , Run : _fabg , Text : _fabg . T , _bb : _egg , _ee : _eeb , _ag : _bdg } ) ; _bdg ++ ; } ; } ; } ; return _gd ; } ;
2021-11-10 11:45:21 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _dec Slide ) X ( ) * _cg . Sld { return _dec . _eed } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _fgdg := _bfa ( ) ; _fgdg . 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" ) ; _fgdg . 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" ) ; _fgdg . 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" ) ; _fgdg . 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" ) ; _fgdg . 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" ) ; _fgdg . 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" ) ; _fgdg . 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 \ u0
2020-12-17 22:07:08 +00:00
2022-01-15 21:17:38 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _dfb ViewProperties ) ShowCommentsAttr ( ) * bool { return _dfb . _gca . ShowCommentsAttr } ;
2021-06-16 07:10:52 +00:00
2022-01-15 21:17:38 +00:00
// Name returns the name of the slide layout.
func ( _efa SlideLayout ) Name ( ) string { if _efa . _cdg . CSld != nil && _efa . _cdg . CSld . NameAttr != nil { return * _efa . _cdg . CSld . NameAttr ; } ; return "" ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// GetSlideLayout returns a slide layout related to the slide.
func ( _daaag * Slide ) GetSlideLayout ( ) * _cg . SldLayout { for _feec , _bccc := range _daaag . _gggf . Slides ( ) { if * _daaag == _bccc { return _daaag . _gggf . _ca [ len ( _daaag . _gggf . Slides ( ) ) - _feec - 1 ] ; } ; } ; return nil ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _fcd SlideLayout ) X ( ) * _cg . SldLayout { return _fcd . _cdg } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// NormalViewPr returns the NormalViewPr property.
func ( _baec ViewProperties ) NormalViewPr ( ) * _cg . CT_NormalViewProperties { return _baec . _gca . NormalViewPr ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// Properties returns the properties of the TextBox.
func ( _aed Image ) Properties ( ) _bd . ShapeProperties { if _aed . _gec . SpPr == nil { _aed . _gec . SpPr = _fcc . NewCT_ShapeProperties ( ) ; } ; return _bd . MakeShapeProperties ( _aed . _gec . SpPr ) ; } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _fdbfg ViewProperties ) SlideViewPr ( ) * _cg . CT_SlideViewProperties { return _fdbfg . _gca . SlideViewPr ; } ; func ( _bac sort2d ) Swap ( i , j int ) { _bac [ i ] , _bac [ j ] = _bac [ j ] , _bac [ i ] } ; func _ede ( _dea * Presentation , _bec [ ] * _cg . CT_GroupShapeChoice , _cd [ ] rectangle , _afb [ ] * TextItem ) [ ] * TextItem { for _ , _bbc := range _bec { _fgb := append ( [ ] rectangle { } , _cd ... ) ; for _ , _ce := range _bbc . Sp { _afb = append ( _afb , _fag ( _dea , _ce , nil , nil , _ce . SpPr . Xfrm , 0 , _cd , _ce . TxBody . P ) ... ) ; } ; for _ , _cda := range _bbc . GraphicFrame { if _cda != nil && _cda . Graphic != nil && _cda . Graphic . GraphicData != nil { _fee := _cda . Xfrm ; for _ , _age := range _cda . Graphic . GraphicData . Any { if _eg , _bbce := _age . ( * _fcc . Tbl ) ; _bbce { _bbd := & _eg . CT_Table ; _deb := 0 ; for _cgc , _da := range _eg . Tr { for _becf , _bf := range _da . Tc { _ccc := & TableInfo { Table : _bbd , Row : _da , Cell : _bf , RowIndex : _cgc , ColIndex : _becf } ; _afb = append ( _afb , _fag ( _dea , nil , _cda , _ccc , _fee , _deb , _cd , _bf . TxBody . P ) ... ) ; _deb ++ ; } ; } ; } ; } ; } ; } ; for _ , _fb := range _bbc . GrpSp { if _fb . GrpSpPr != nil { _bga := _fb . GrpSpPr . Xfrm ; var _ab , _aa int64 ; if _bga . Off != nil { _fcb , _cgf := _bga . Off . XAttr . ST_CoordinateUnqualified , _bga . Off . YAttr . ST_CoordinateUnqualified ; if _fcb != nil && _cgf != nil { if _fab := _bga . Ext ; _fab != nil { _ab , _aa = _fab . CxAttr , _fab . CyAttr ; } ; _fgb = append ( _fgb , rectangle { _ge : * _fcb , _dcf : * _cgf , _ed : * _fcb + _ab , _gb : * _cgf + _aa } ) ; } ; } ; } ; _afb = _ede ( _dea , _fb . Choice , _fgb , _afb ) ; } ; } ; return _afb ; } ;
// 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 ( _ffdf * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _bfgf := _cg . NewCT_SlideIdListEntry ( ) ; _bfgf . IdAttr = 256 ; for _ , _cgdb := range _ffdf . _eebd . SldIdLst . SldId { if _cgdb . IdAttr >= _bfgf . IdAttr { _bfgf . IdAttr = _cgdb . IdAttr + 1 ; } ; } ; _ffdf . _eebd . SldIdLst . SldId = append ( _ffdf . _eebd . SldIdLst . SldId , _bfgf ) ; _gdc := _cg . NewSld ( ) ; _cab := _dd . Buffer { } ; _bcad := _fc . NewEncoder ( & _cab ) ; _fcg := _fc . StartElement { Name : _fc . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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" } ) ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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" } ) ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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" } ) ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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" } ) ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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" } ) ; _fcg . Attr = append ( _fcg . Attr , _fc . Attr { Name : _fc . 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 _dgda := l . _cdg . CSld . MarshalXML ( _bcad , _fcg ) ; _dgda != nil { return Slide { } , _dgda ; } ; _bcad . Flush ( ) ; _acb := _fc . NewDecoder ( & _cab ) ; _gdc . CSld = _cg . NewCT_CommonSlideData ( ) ; if _ddcd := _acb . Decode ( _gdc . CSld ) ; _ddcd != nil { return Slide { } , _ddcd ; } ; _gdc . CSld . NameAttr = nil ; _gdc . CSld . SpTree . Choice = _dab ( _gdc . CSld . SpTree . Choice ) ; _ffdf . _fba = append ( _ffdf . _fba , _gdc ) ; _cbc := _ffdf . _acf . AddAutoRelationship ( _fgg . DocTypePresentation , _fgg . OfficeDocumentType , len ( _ffdf . _fba ) , _fgg . SlideType ) ; _bfgf . RIdAttr = _cbc . ID ( ) ; _debg := _fgg . AbsoluteFilename ( _fgg . DocTypePresentation , _fgg . SlideType , len ( _ffdf . _fba ) ) ; _ffdf . ContentTypes . AddOverride ( _debg , _fgg . SlideContentType ) ; _cba := _gf . NewRelationships ( ) ; _ffdf . _cgfe = append ( _ffdf . _cgfe , _cba ) ; _feef := len ( _ffdf . _cgfe ) - 1 ; for _fgfb , _bab := range _ffdf . _ca { if _bab == l . X ( ) { _geaa := _ffdf . _aca [ _fgfb ] ; for _ , _bdc := range _geaa . X ( ) . Relationship { if _bdc . TypeAttr != _fgg . SlideMasterType { _ffdf . _cgfe [ _feef ] . X ( ) . Relationship = append ( _ffdf
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _fgd , _dce := Open ( fn ) ; if _dce != nil { return nil , _dce ; } ; return _fgd , nil ; } ;
2021-01-04 16:11:39 +00:00
2021-11-10 11:45:21 +00:00
// Slide represents a slide of a presentation.
2022-01-15 21:17:38 +00:00
type Slide struct { _ggf * _cg . CT_SlideIdListEntry ; _eed * _cg . Sld ; _gggf * Presentation ; _bgd * _fcc . CT_ColorMapping ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _dcaf Slide ) GetTextBoxes ( ) [ ] * TextBox { _gdca := [ ] * TextBox { } ; _dcgf := _dcaf . _eed . CSld . SpTree . Choice ; for _ , _gfcc := range _dcgf { for _ , _bgdg := range _gfcc . Sp { if _bgdg . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _bgdg . NvSpPr . CNvSpPr . TxBoxAttr { _gdca = append ( _gdca , & TextBox { _bgdg } ) ; } ; } ; } ; return _gdca ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// PrnPr returns the PrnPr property.
func ( _baf PresentationProperties ) PrnPr ( ) * _cg . CT_PrintProperties { return _baf . _aad . PrnPr } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// ExtLst returns the ExtLst property.
func ( _fecf ViewProperties ) ExtLst ( ) * _cg . CT_ExtensionList { return _fecf . _gca . ExtLst } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _daaa * Presentation ) SaveAsTemplate ( w _cc . Writer ) error { return _daaa . save ( w , true ) } ; func ( _dbge * Presentation ) nextSlideID ( ) uint32 { _egad := uint32 ( 256 ) ; for _ , _gbge := range _dbge . _eebd . SldIdLst . SldId { if _gbge . IdAttr >= _egad { _egad = _gbge . IdAttr + 1 ; } ; } ; return _egad ; } ;
2021-08-23 20:44:48 +00:00
2022-01-15 21:17:38 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _dbbf ViewProperties ) OutlineViewPr ( ) * _cg . CT_OutlineViewProperties { return _dbbf . _gca . OutlineViewPr ; } ;
// RemoveSlide removes a slide from a presentation.
func ( _efg * Presentation ) RemoveSlide ( s Slide ) error { _geac := false ; _efdf := 0 ; for _cff , _gcg := range _efg . _fba { if _gcg == s . _eed { if _efg . _eebd . SldIdLst . SldId [ _cff ] != s . _ggf { return _ded . 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 ( _efg . _fba [ _cff : ] , _efg . _fba [ _cff + 1 : ] ) ; _efg . _fba = _efg . _fba [ 0 : len ( _efg . _fba ) - 1 ] ; copy ( _efg . _cgfe [ _cff : ] , _efg . _cgfe [ _cff + 1 : ] ) ; _efg . _cgfe = _efg . _cgfe [ 0 : len ( _efg . _cgfe ) - 1 ] ; copy ( _efg . _eebd . SldIdLst . SldId [ _cff : ] , _efg . _eebd . SldIdLst . SldId [ _cff + 1 : ] ) ; _efg . _eebd . SldIdLst . SldId = _efg . _eebd . SldIdLst . SldId [ 0 : len ( _efg . _eebd . SldIdLst . SldId ) - 1 ] ; _geac = true ; _efdf = _cff ; } ; } ; if ! _geac { return _ded . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ; } ; _ggbd := _fgg . AbsoluteFilename ( _fgg . DocTypePresentation , _fgg . SlideType , 0 ) ; return _efg . ContentTypes . RemoveOverrideByIndex ( _ggbd , _efdf ) ; } ;
// AddSlide adds a new slide to the presentation.
func ( _dbc * Presentation ) AddSlide ( ) Slide { _cgfee := _cg . NewCT_SlideIdListEntry ( ) ; _cgfee . IdAttr = _dbc . nextSlideID ( ) ; _dbc . _eebd . SldIdLst . SldId = append ( _dbc . _eebd . SldIdLst . SldId , _cgfee ) ; _aba := _cg . NewSld ( ) ; _aba . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ; _aba . CSld . SpTree . GrpSpPr . Xfrm = _fcc . NewCT_GroupTransform2D ( ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Off = _fcc . NewCT_Point2D ( ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _fgg . Int64 ( 0 ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _fgg . Int64 ( 0 ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Ext = _fcc . NewCT_PositiveSize2D ( ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _fg . Point ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _fg . Point ) ; _aba . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _aba . CSld . SpTree . GrpSpPr . Xfrm . Off ; _aba . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _aba . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _dbc . _fba = append ( _dbc . _fba , _aba ) ; _adbd := _dbc . _acf . AddAutoRelationship ( _fgg . DocTypePresentation , _fgg . OfficeDocumentType , len ( _dbc . _fba ) , _fgg . SlideType ) ; _cgfee . RIdAttr = _adbd . ID ( ) ; _gfde := _fgg . AbsoluteFilename ( _fgg . DocTypePresentation , _fgg . SlideType , len ( _dbc . _fba ) ) ; _dbc . ContentTypes . AddOverride ( _gfde , _fgg . SlideContentType ) ; _ebg := _gf . NewRelationships ( ) ; _dbc . _cgfe = append ( _dbc . _cgfe , _ebg ) ; _ebg . AddAutoRelationship ( _fgg . DocTypePresentation , _fgg . SlideType , len ( _dbc . _ca ) , _fgg . SlideLayoutType ) ; return Slide { _cgfee , _aba , _dbc , nil } ; } ;
// PlaceHolders returns all of the content place holders within a given slide.
func ( _ddfa Slide ) PlaceHolders ( ) [ ] PlaceHolder { _eda := [ ] PlaceHolder { } ; for _ , _gcgb := range _ddfa . _eed . CSld . SpTree . Choice { for _ , _ffgc := range _gcgb . Sp { if _ffgc . NvSpPr != nil && _ffgc . NvSpPr . NvPr != nil && _ffgc . NvSpPr . NvPr . Ph != nil { _eda = append ( _eda , PlaceHolder { _ffgc , _ddfa . _eed } ) ; } ; } ; } ; return _eda ; } ;
// TextBox is a text box within a slide.
type TextBox struct { _eef * _cg . CT_Shape } ;
2021-08-23 20:44:48 +00:00
2021-11-10 11:45:21 +00:00
// 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.
2022-01-15 21:17:38 +00:00
func ( _dde Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _ggc := range _dde . _eed . CSld . SpTree . Choice { for _ , _fgeb := range _ggc . Sp { if _fgeb . NvSpPr != nil && _fgeb . NvSpPr . NvPr != nil && _fgeb . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _fgeb . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _fgeb . NvSpPr . NvPr . Ph . IdxAttr != nil && * _fgeb . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _fgeb , _dde . _eed } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _ded . New ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0070\u006c\u0061\u0063\u0065\u0068\u006fl\u0064\u0065\u0072" ) ; } ; func ( _acfg * Presentation ) Validate ( ) error { if _bege := _acfg . _eebd . Validate ( ) ; _bege != nil { return _bege ; } ; for _ebe , _acga := range _acfg . Slides ( ) { if _bbb := _acga . ValidateWithPath ( _df . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _ebe ) ) ; _bbb != nil { return _bbb ; } ; } ; for _cdd , _egaa := range _acfg . _gdf { if _fcgb := _egaa . ValidateWithPath ( _df . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _cdd ) ) ; _fcgb != nil { return _fcgb ; } ; } ; for _cfg , _fbf := range _acfg . _ca { if _ada := _fbf . ValidateWithPath ( _df . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _cfg ) ) ; _ada != nil { return _ada ; } ; } ; return nil ; } ; func _bfa ( ) * Presentation { _bca := & Presentation { _eebd : _cg . NewPresentation ( ) } ; _bca . _eebd . SldIdLst = _cg . NewCT_SlideIdList ( ) ; _bca . _eebd . ConformanceAttr = _bg . ST_ConformanceClassTransitional ; _bca . AppProperties = _gf . NewAppProperties ( ) ; _bca . CoreProperties = _gf . NewCoreProperties ( ) ; _bca . _acfd = _gf . NewTableStyles ( ) ; _bca . ContentTypes = _gf . NewContentTypes ( ) ; _bca . Rels = _gf . NewRelationships ( ) ; _bca . _acf = _gf . NewRelationships ( ) ; _bca . _aaee = NewPresentationProperties ( ) ; _bca . _gcd = NewViewProperties ( ) ; _bca . _ddc = map [ string ] string { } ; return _bca ; } ;
2020-08-31 22:58:25 +00:00
2022-01-15 21:17:38 +00:00
// Clear clears the placeholder contents and adds a single empty paragraph. The
// empty paragrah is required by PowerPoint or it will report the file as being
// invalid.
func ( _fdc PlaceHolder ) Clear ( ) { _fdc . ClearAll ( ) ; _fgf := _fcc . NewCT_TextParagraph ( ) ; _fdc . _eca . TxBody . P = [ ] * _fcc . CT_TextParagraph { _fgf } ; _fgf . EndParaRPr = _fcc . NewCT_TextCharacterProperties ( ) ; _fgf . EndParaRPr . LangAttr = _fgg . String ( "\u0065\u006e\u002dU\u0053" ) ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// TextItem is used for keeping text with references to a paragraph and run, a shape or a table, a row and a cell where it is located.
type TextItem struct { Text string ; Presentation * Presentation ; Shape * _cg . CT_Shape ; GraphicFrame * _cg . CT_GraphicalObjectFrame ; Paragraph * _fcc . CT_TextParagraph ; Run * _fcc . CT_RegularTextRun ; TableInfo * TableInfo ; _bb [ ] rectangle ; _ee int ; _ag int ; } ;
2020-08-31 22:58:25 +00:00
2022-01-15 21:17:38 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _deg * PresentationText ) Text ( ) string { _cde := _dd . NewBuffer ( [ ] byte { } ) ; for _ , _ebc := range _deg . Slides { _cde . WriteString ( _ebc . Text ( ) ) ; } ; return _cde . String ( ) ; } ;
2019-06-21 21:37:04 +02:00
2022-01-15 21:17:38 +00:00
// Save writes the presentation out to a writer in the Zip package format
func ( _cgdd * Presentation ) Save ( w _cc . Writer ) error { return _cgdd . save ( w , false ) } ;
2017-10-03 09:55:27 -05:00
2022-01-15 21:17:38 +00:00
// SlideText is an array of extracted text items which has some methods for representing extracted text from a slide.
type SlideText struct { Items [ ] * TextItem ; } ;
2017-08-28 20:56:18 -05:00
2022-01-15 21:17:38 +00:00
// AddImage adds an image textbox to a slide.
func ( _bfdf Slide ) AddImage ( img _gf . ImageRef ) Image { _fabf := _cg . NewCT_GroupShapeChoice ( ) ; _bfdf . _eed . CSld . SpTree . Choice = append ( _bfdf . _eed . CSld . SpTree . Choice , _fabf ) ; _efe := _cg . NewCT_Picture ( ) ; _fabf . Pic = append ( _fabf . Pic , _efe ) ; _efe . NvPicPr . CNvPicPr = _fcc . NewCT_NonVisualPictureProperties ( ) ; _efe . NvPicPr . CNvPicPr . PicLocks = _fcc . NewCT_PictureLocking ( ) ; _efe . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _fgg . Bool ( true ) ; _efe . BlipFill = _fcc . NewCT_BlipFillProperties ( ) ; _efe . BlipFill . Blip = _fcc . NewCT_Blip ( ) ; _faf := _bfdf . AddImageToRels ( img ) ; _efe . BlipFill . Blip . EmbedAttr = _fgg . String ( _faf ) ; _efe . BlipFill . Stretch = _fcc . NewCT_StretchInfoProperties ( ) ; _efe . BlipFill . Stretch . FillRect = _fcc . NewCT_RelativeRect ( ) ; _efe . SpPr = _fcc . NewCT_ShapeProperties ( ) ; _efe . SpPr . PrstGeom = _fcc . NewCT_PresetGeometry2D ( ) ; _efe . SpPr . PrstGeom . PrstAttr = _fcc . ST_ShapeTypeRect ; _ebcf := Image { _efe } ; _ced := img . Size ( ) ; _ebcf . Properties ( ) . SetWidth ( _fg . Distance ( _ced . X ) * _fg . Pixel72 ) ; _ebcf . Properties ( ) . SetHeight ( _fg . Distance ( _ced . Y ) * _fg . Pixel72 ) ; _ebcf . Properties ( ) . SetPosition ( 0 , 0 ) ; return _ebcf ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Slides returns the slides in the presentation.
func ( _eeea * Presentation ) Slides ( ) [ ] Slide { _dedg := [ ] Slide { } ; for _fdbf , _daad := range _eeea . _fba { _dedg = append ( _dedg , Slide { _eeea . _eebd . SldIdLst . SldId [ _fdbf ] , _daad , _eeea , nil } ) ; } ; return _dedg ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Less is for implementing sorting of two locations. Symbols share the same location if they are in the same paragraph or table. One location is 'less' than another first by y coordinate, if y coordinates are equal or differ by less than yEpsilon, then x coordinates are compared, then if they are also equal, indexes of locations in the table are compared, then positions of locations in a paragraph.
func ( _ea sort2d ) Less ( i , j int ) bool { _agd , _fd := _ea [ i ] , _ea [ j ] ; _cca , _egf := _agd . _bb , _fd . _bb ; _bgag , _cgd := len ( _cca ) - 1 , len ( _egf ) - 1 ; _cf , _gef := 0 , 0 ; for { _edd , _bea , _ec , _ead , _cgba , _cce , _dff , _gg := _cca [ _cf ] . _dcf , _egf [ _gef ] . _dcf , _cca [ _cf ] . _gb , _egf [ _gef ] . _gb , _cca [ _cf ] . _ge , _egf [ _gef ] . _ge , _cca [ _cf ] . _ed , _egf [ _gef ] . _ed ; if _edd == _bea || ( ( _ef . Abs ( float64 ( _edd ) - float64 ( _bea ) ) < _db ) && ( ( _edd >= _bea && _edd <= _ead ) || ( _bea >= _edd && _bea <= _ec ) ) && ( _dff < _cce || _cgba > _gg ) ) { if _cgba == _cce { if _cf < _bgag && _gef < _cgd { _cf ++ ; _gef ++ ; continue ; } ; if _cf >= _bgag && _gef >= _cgd { break ; } ; return _cf >= _bgag ; } else { return _cgba < _cce ; } ; } else { return _edd < _bea ; } ; } ; _dbg , _egc , _ebd , _dbd := _agd . _ee , _fd . _ee , _agd . _ag , _fd . _ag ; if _dbg == _egc { return _ebd <= _dbd ; } ; return _dbg < _egc ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// ClrMru returns the ClrMru property.
func ( _fbbc PresentationProperties ) ClrMru ( ) * _fcc . CT_ColorMRU { return _fbbc . _aad . ClrMru } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _dacf ViewProperties ) SorterViewPr ( ) * _cg . CT_SlideSorterViewProperties { return _dacf . _gca . SorterViewPr ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Themes returns an array of presentation themes.
func ( _dffcf * Presentation ) Themes ( ) [ ] * _fcc . Theme { return _dffcf . _aag } ; func ( _cfcg TextBox ) getOff ( ) * _fcc . CT_Point2D { if _cfcg . _eef . SpPr == nil { _cfcg . _eef . SpPr = _fcc . NewCT_ShapeProperties ( ) ; } ; if _cfcg . _eef . SpPr . Xfrm == nil { _cfcg . _eef . SpPr . Xfrm = _fcc . NewCT_Transform2D ( ) ; } ; if _cfcg . _eef . SpPr . Xfrm . Off == nil { _cfcg . _eef . SpPr . Xfrm . Off = _fcc . NewCT_Point2D ( ) ; } ; return _cfcg . _eef . SpPr . Xfrm . Off ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _geb * Presentation ) SaveToFile ( path string ) error { return _geb . saveToFile ( path , false ) } ; func ( _fga * chart ) Target ( ) string { return _fga . _dg } ; type rectangle struct { _ge int64 ; _dcf int64 ; _ed int64 ; _gb int64 ; } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _agcd * Slide ) GetChartSpaceByRelId ( relId string ) * _fe . ChartSpace { _abcd := _agcd . getSlideRels ( ) ; if ( _abcd == _gf . Relationships { } ) { return nil ; } ; _bace := _abcd . GetTargetByRelId ( relId ) ; for _ , _eag := range _agcd . _gggf . _adbf { if _bace == _eag . Target ( ) { return _eag . _gff ; } ; } ; return nil ; } ; type sort2d [ ] * TextItem ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Type returns the placeholder type
func ( _eff PlaceHolder ) Type ( ) _cg . ST_PlaceholderType { return _eff . _eca . NvSpPr . NvPr . Ph . TypeAttr } ; func ( _dc * chart ) RelId ( ) string { return _dc . _ga } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _gca * _cg . ViewPr } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _gca : _cg . NewViewPr ( ) } } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _eead TextBox ) X ( ) * _cg . CT_Shape { return _eead . _eef } ;
2020-08-23 14:15:53 +00:00
2022-01-15 21:17:38 +00:00
// Presentation returns a slide's presentation.
func ( _fadg Slide ) Presentation ( ) * Presentation { return _fadg . _gggf } ;
2021-04-23 20:00:00 +00:00
2022-01-15 21:17:38 +00:00
// GridSpacing returns the GridSpacing property.
func ( _adbb ViewProperties ) GridSpacing ( ) * _fcc . CT_PositiveSize2D { return _adbb . _gca . GridSpacing } ;
2020-06-07 20:13:15 +07:00
2022-01-15 21:17:38 +00:00
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
type TableInfo struct { Table * _fcc . CT_Table ; Row * _fcc . CT_TableRow ; Cell * _fcc . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2017-10-03 09:55:27 -05:00
2021-09-22 16:41:01 +00:00
// Presentation is the a presentation base document.
2022-01-15 21:17:38 +00:00
type Presentation struct { _gf . DocBase ; _eebd * _cg . Presentation ; _acf _gf . Relationships ; _fba [ ] * _cg . Sld ; _cgfe [ ] _gf . Relationships ; _gdf [ ] * _cg . SldMaster ; _daa [ ] _gf . Relationships ; _ca [ ] * _cg . SldLayout ; _aca [ ] _gf . Relationships ; _aag [ ] * _fcc . Theme ; _bdb [ ] _gf . Relationships ; _acfd _gf . TableStyles ; _aaee PresentationProperties ; _gcd ViewProperties ; _ecc [ ] * _fcc . CT_Hyperlink ; _adbf [ ] * chart ; _cbb [ ] * _cg . HandoutMaster ; _aac [ ] * _cg . NotesMaster ; _fac [ ] * _fgg . XSDAny ; _ddc map [ string ] string ; _dcd string ; } ;
2017-10-03 09:55:27 -05:00
2022-01-15 21:17:38 +00:00
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _bfc SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _gcfd := map [ string ] int { } ; _eebe := [ ] SlideLayout { } ; for _ , _ggbae := range _bfc . _dbae . Relationships ( ) { _egbg := _c . Replace ( _ggbae . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ; _egbg = _c . Replace ( _egbg , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _ggfb , _dfa := _d . ParseInt ( _egbg , 10 , 32 ) ; _dfa == nil { _gcfd [ _ggbae . ID ( ) ] = int ( _ggfb ) ; } ; } ; for _ , _bddg := range _bfc . _fdcg . SldLayoutIdLst . SldLayoutId { if _dbcf , _cafb := _gcfd [ _bddg . RIdAttr ] ; _cafb { _agdf := _bfc . _fcdf . _ca [ _dbcf - 1 ] ; _eebe = append ( _eebe , SlideLayout { _agdf } ) ; } ; } ; return _eebe ; } ; type chart struct { _gff * _fe . ChartSpace ; _ga string ; _dg string ; } ;
2017-11-20 18:24:12 -06:00
2022-01-15 21:17:38 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _cdecg * Presentation ) GetTableStyleById ( id string ) * _fcc . CT_TableStyle { _agc := _cdecg . _acfd . TblStyle ( ) ; for _ , _edfe := range _agc { if _edfe . StyleIdAttr == id { return _edfe ; } ; } ; return nil ; } ;
2020-06-07 20:42:27 +07:00
2022-01-15 21:17:38 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _aae * SlideText ) Text ( ) string { _ac := _dd . NewBuffer ( [ ] byte { } ) ; for _ , _gee := range _aae . Items { if _gee . Text != "" { _ac . WriteString ( _gee . Text ) ; _ac . WriteString ( "\u000a" ) ; } ; } ; return _ac . String ( ) ; } ;
2020-10-12 13:59:12 +00:00
2022-01-15 21:17:38 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _ebec * Presentation ) Close ( ) error { if _ebec . TmpPath != "" { return _ba . RemoveAll ( _ebec . TmpPath ) ; } ; return nil ; } ;
2021-07-30 17:03:26 +00:00
2022-01-15 21:17:38 +00:00
// AddTable adds an empty table to a slide.
func ( _acca Slide ) AddTable ( ) * _gf . Table { _dcec := _cg . NewCT_GroupShapeChoice ( ) ; _acca . _eed . CSld . SpTree . Choice = append ( _acca . _eed . CSld . SpTree . Choice , _dcec ) ; _fgba := _cg . NewCT_GraphicalObjectFrame ( ) ; _dcec . GraphicFrame = append ( _dcec . GraphicFrame , _fgba ) ; _fgba . Xfrm . Off = _fcc . NewCT_Point2D ( ) ; _abdg := int64 ( 1 ) ; _fgba . Xfrm . Off . XAttr = _fcc . ST_Coordinate { ST_CoordinateUnqualified : & _abdg } ; _fgba . Xfrm . Off . YAttr = _fcc . ST_Coordinate { ST_CoordinateUnqualified : & _abdg } ; _ccb := _fgba . Graphic . CT_GraphicalObject . GraphicData ; _ccb . 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" ; _bbde := _gf . NewTableWithXfrm ( _fgba . Xfrm ) ; _ccb . Any = append ( _ccb . Any , _bbde . X ( ) ) ; return _bbde ; } ; func ( _egccc * Slide ) getSlideRels ( ) _gf . Relationships { _gaff := _egccc . _gggf ; for _defa , _bacc := range _gaff . Slides ( ) { if * _egccc . _eed == * _bacc . _eed { return _gaff . _cgfe [ len ( _gaff . _cgfe ) - _defa - 1 ] ; } ; } ; return _gf . Relationships { } ; } ;
2021-07-30 17:03:26 +00:00
2022-01-15 21:17:38 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _abce ViewProperties ) NotesTextViewPr ( ) * _cg . CT_NotesTextViewProperties { return _abce . _gca . NotesTextViewPr ; } ;
2020-12-17 22:07:08 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _cdb PresentationProperties ) X ( ) * _cg . PresentationPr { return _cdb . _aad } ;
2020-12-17 22:07:08 +00:00
2022-01-15 21:17:38 +00:00
// GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.
func ( _cgbf * Presentation ) GetColorBySchemeColor ( schClr _fcc . ST_SchemeColorVal ) * _fcc . CT_Color { if len ( _cgbf . _gdf ) == 0 || len ( _cgbf . _aag ) == 0 { return nil ; } ; var _degfg _fcc . ST_ColorSchemeIndex ; _aceg := _cgbf . _gdf [ 0 ] ; _bcb := _aceg . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _degfg = _bcb . Bg1Attr ; case "\u0062\u0067\u0032" : _degfg = _bcb . Bg2Attr ; case "\u0074\u0078\u0031" : _degfg = _bcb . Tx1Attr ; case "\u0074\u0078\u0032" : _degfg = _bcb . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _degfg = _bcb . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _degfg = _bcb . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _degfg = _bcb . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _degfg = _bcb . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _degfg = _bcb . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _degfg = _bcb . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _degfg = _bcb . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _degfg = _bcb . FolHlinkAttr ; case "\u0064\u006b\u0031" : _degfg = _fcc . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _degfg = _fcc . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _degfg = _fcc . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _degfg = _fcc . ST_ColorSchemeIndexLt2 ; default : _degfg = _fcc . ST_ColorSchemeIndexUnset ; } ; _adff := _cgbf . _aag [ 0 ] ; _dbe := _adff . ThemeElements ; if _dbe == nil { return nil ; } ; var _bdcf * _fcc . CT_Color ; _gefge := _dbe . ClrScheme ; switch _degfg . String ( ) { case "\u0064\u006b\u0031" : _bdcf = _gefge . Dk1 ; case "\u0064\u006b\u0032" : _bdcf = _gefge . Dk2 ; case "\u006c\u0074\u0031" : _bdcf = _gefge . Lt1 ; case "\u006c\u0074\u0032" : _bdcf = _gefge . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _bdcf = _gefge . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _bdcf = _gefge . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _bdcf = _gefge . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _bdcf = _gefge . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _bdcf = _gefge . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _bdcf = _gefge . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _bdcf = _gefge . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _bdcf = _gefge . FolHlink ; default : return nil ; } ; return _bdcf ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _bccd Slide ) AddTextBox ( ) TextBox { _gadd := _cg . NewCT_GroupShapeChoice ( ) ; _bccd . _eed . CSld . SpTree . Choice = append ( _bccd . _eed . CSld . SpTree . Choice , _gadd ) ; _bafa := _cg . NewCT_Shape ( ) ; _gadd . Sp = append ( _gadd . Sp , _bafa ) ; _bafa . SpPr = _fcc . NewCT_ShapeProperties ( ) ; _bafa . SpPr . Xfrm = _fcc . NewCT_Transform2D ( ) ; _bafa . SpPr . PrstGeom = _fcc . NewCT_PresetGeometry2D ( ) ; _bafa . SpPr . PrstGeom . PrstAttr = _fcc . ST_ShapeTypeRect ; _bafa . NvSpPr = _cg . NewCT_ShapeNonVisual ( ) ; _bafa . NvSpPr . CNvSpPr = _fcc . NewCT_NonVisualDrawingShapeProps ( ) ; _debe := true ; _bafa . NvSpPr . CNvSpPr . TxBoxAttr = & _debe ; _bafa . TxBody = _fcc . NewCT_TextBody ( ) ; _bafa . TxBody . BodyPr = _fcc . NewCT_TextBodyProperties ( ) ; _bafa . TxBody . BodyPr . WrapAttr = _fcc . ST_TextWrappingTypeSquare ; _bafa . TxBody . BodyPr . SpAutoFit = _fcc . NewCT_TextShapeAutofit ( ) ; _caf := TextBox { _bafa } ; _caf . Properties ( ) . SetWidth ( 3 * _fg . Inch ) ; _caf . Properties ( ) . SetHeight ( 1 * _fg . Inch ) ; _caf . Properties ( ) . SetPosition ( 0 , 0 ) ; return _caf ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _gefg * Presentation ) X ( ) * _cg . Presentation { return _gefg . _eebd } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _gcb PlaceHolder ) Paragraphs ( ) [ ] _bd . Paragraph { _bfg := [ ] _bd . Paragraph { } ; for _ , _bcg := range _gcb . _eca . TxBody . P { _bfg = append ( _bfg , _bd . MakeParagraph ( _bcg ) ) ; } ; return _bfg ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// Read reads a document from an io.Reader.
func Read ( r _cc . ReaderAt , size int64 ) ( * Presentation , error ) { const _aga = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _fa . GetLicenseKey ( ) . IsLicensed ( ) && ! _ffdd { _df . 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" ) ; _df . 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 , _ded . 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" ) ; } ; _faa := _bfa ( ) ; _ffeb , _cdc := _fa . GenRefId ( "\u0070\u0072" ) ; if _cdc != nil { _ff . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _cdc ) ; return nil , _cdc ; } ; _faa . _dcd = _ffeb ; if _fge := _fa . Track ( _faa . _dcd , _aga ) ; _fge != nil { _ff . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fge ) ; return nil , _fge ; } ; _faag , _cdc := _ba . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ; if _cdc != nil { return nil , _cdc ; } ; _faa . TmpPath = _faag ; _gcfa , _cdc := _a . NewReader ( r , size ) ; if _cdc != nil { return nil , _df . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _cdc ) ; } ; _dcbe := [ ] * _a . File { } ; _dcbe = append ( _dcbe , _gcfa . File ... ) ; _ege := false ; for _ , _acgg := range _dcbe { if _acgg . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _ege = true ; break ; } ; } ; if _ege { _faa . CreateCustomProperties ( ) ; } ; _bcge := _b . DecodeMap { } ; _bcge . SetOnNewRelationshipFunc ( _faa . onNewRelationship ) ; _bcge . AddTarget ( _fgg . ContentTypesFilename , _faa . ContentTypes . X ( ) , "" , 0 ) ; _bcge . AddTarget ( _fgg . BaseRelsFilename , _faa . Rels . X ( ) , "" , 0 ) ; if _ggg := _bcge . Decode ( _dcbe ) ; _ggg != nil { return nil , _ggg ; } ; for _ , _acd := range _dcbe { if _acd == nil { continue ; } ; if _cgda := _faa . AddExtraFileFromZip ( _acd ) ; _cgda != nil { return nil , _cgda ; } ; } ; if _ege { _fgga := false ; for _ , _bdf := range _faa . Rels . X ( ) . Relationship { if _bdf . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _fgga = true ; break ; } ; } ; if ! _fgga { _faa . AddCustomRelationships ( ) ; } ; } ; return _faa , nil ; } ;
2021-01-04 16:11:39 +00:00
2022-01-15 21:17:38 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _bfd * Presentation ) GetImageByRelID ( relID string ) ( _gf . ImageRef , bool ) { for _ , _cbbbc := range _bfd . Images { if _cbbbc . RelID ( ) == relID { return _cbbbc , true ; } ; } ; return _gf . ImageRef { } , false ; } ;
2021-03-16 20:51:18 +00:00
2022-01-15 21:17:38 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _gaf PlaceHolder ) ClearAll ( ) { _gaf . _eca . SpPr = _fcc . NewCT_ShapeProperties ( ) ; _gaf . _eca . TxBody = _fcc . NewCT_TextBody ( ) ; _gaf . _eca . TxBody . LstStyle = _fcc . NewCT_TextListStyle ( ) ; } ;
2021-03-16 20:51:18 +00:00
2021-11-10 11:45:21 +00:00
// Open opens and reads a document from a file (.pptx).
2022-01-15 21:17:38 +00:00
func Open ( filename string ) ( * Presentation , error ) { _acg , _eec := _ffd . Open ( filename ) ; if _eec != nil { return nil , _df . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _eec ) ; } ; defer _acg . Close ( ) ; _dca , _eec := _ffd . Stat ( filename ) ; if _eec != nil { return nil , _df . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _eec ) ; } ; _ = _dca ; return Read ( _acg , _dca . Size ( ) ) ; } ;
2021-04-23 20:00:00 +00:00
2022-01-15 21:17:38 +00:00
// SetText sets the text of a placeholder for the initial paragraph. This is a
// shortcut method that is useful for things like titles which only contain a
// single paragraph.
func ( _bef PlaceHolder ) SetText ( text string ) { _bef . Clear ( ) ; _dac := _fcc . NewEG_TextRun ( ) ; _dac . R = _fcc . NewCT_RegularTextRun ( ) ; _dac . R . T = text ; if len ( _bef . _eca . TxBody . P ) == 0 { _bef . _eca . TxBody . P = append ( _bef . _eca . TxBody . P , _fcc . NewCT_TextParagraph ( ) ) ; } ; _bef . _eca . TxBody . P [ 0 ] . EG_TextRun = nil ; _bef . _eca . TxBody . P [ 0 ] . EG_TextRun = append ( _bef . _eca . TxBody . P [ 0 ] . EG_TextRun , _dac ) ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// Index returns the placeholder index
func ( _cfd PlaceHolder ) Index ( ) uint32 { if _cfd . _eca . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _cfd . _eca . NvSpPr . NvPr . Ph . IdxAttr ; } ;
2021-05-31 16:22:30 +00:00
2022-01-15 21:17:38 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _gdcc * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _egfc := [ ] SlideLayout { } ; for _ , _fdcc := range _gdcc . _ca { _egfc = append ( _egfc , SlideLayout { _fdcc } ) ; } ; return _egfc ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// ShowPr returns the ShowPr property.
func ( _bcd PresentationProperties ) ShowPr ( ) * _cg . CT_ShowProperties { return _bcd . _aad . ShowPr } ; func ( _fff * chart ) X ( ) * _fe . ChartSpace { return _fff . _gff } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _cdg * _cg . SldLayout } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _bbcb PlaceHolder ) AddParagraph ( ) _bd . Paragraph { _cfdb := _bd . MakeParagraph ( _fcc . NewCT_TextParagraph ( ) ) ; _bbcb . _eca . TxBody . P = append ( _bbcb . _eca . TxBody . P , _cfdb . X ( ) ) ; return _cfdb ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _bbdc * Presentation ) SaveToFileAsTemplate ( path string ) error { return _bbdc . saveToFile ( path , true ) ; } ; func ( _bbe * Presentation ) save ( _gbf _cc . Writer , _afe bool ) error { const _gbb = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ; if _debf := _bbe . _eebd . Validate ( ) ; _debf != nil { _ff . 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" , _debf ) ; } ; if ! _fa . GetLicenseKey ( ) . IsLicensed ( ) && ! _ffdd { _df . 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" ) ; _df . 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 _ded . 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 ( _bbe . _dcd ) == 0 { _cfdd , _adbfg := _fa . GenRefId ( "\u0070\u0077" ) ; if _adbfg != nil { _ff . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _adbfg ) ; return _adbfg ; } ; _bbe . _dcd = _cfdd ; } ; if _def := _fa . Track ( _bbe . _dcd , _gbb ) ; _def != nil { _ff . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _def ) ; return _def ; } ; if _afe { _bbe . 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" ) ; _bbe . 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 { _bbe . 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" ) ; _bbe . 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" ) ; } ; _fec := _fgg . DocTypePresentation ; _fbg := _a . NewWriter ( _gbf ) ; defer _fbg . Close ( ) ; if _dfg := _b . MarshalXML ( _fbg , _fgg . BaseRelsFilename , _bbe . Rels . X ( ) ) ; _dfg != nil { return _dfg ; } ; if _cbg := _b . MarshalXMLByType ( _fbg , _fec , _fgg . ExtendedPropertiesType , _bbe . AppProperties . X ( ) ) ; _cbg != nil { return _cbg ; } ; if _gfg := _b . MarshalXMLByType ( _fbg , _fec , _fgg . CorePropertiesType , _b
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _eee * Slide ) ExtractText ( ) * SlideText { _agf := _ede ( _eee . _gggf , _eee . _eed . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _fgc . Sort ( sort2d ( _agf ) ) ; return & SlideText { Items : _agf } ; } ; func ( _gfd sort2d ) Len ( ) int { return len ( _gfd ) } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _ccf PresentationProperties ) HtmlPubPr ( ) * _cg . CT_HtmlPublishProperties { return _ccf . _aad . HtmlPubPr ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
func ( _fbb PlaceHolder ) X ( ) * _cg . CT_Shape { return _fbb . _eca } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _cgfg Slide ) AddImageToRels ( img _gf . ImageRef ) string { _fdga := 0 ; for _aagc , _bafd := range _cgfg . _gggf . Images { if _bafd == img { _fdga = _aagc + 1 ; break ; } ; } ; var _bfdb string ; for _bae , _abc := range _cgfg . _gggf . Slides ( ) { if _abc . _eed == _cgfg . _eed { _cfab := _df . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _fdga , img . Format ( ) ) ; _gffba := _cgfg . _gggf . _cgfe [ _bae ] . AddRelationship ( _cfab , _fgg . ImageType ) ; _bfdb = _gffba . ID ( ) ; } ; } ; return _bfdb ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
func ( _deeg * Slide ) GetImageByRelID ( relID string ) ( _gf . ImageRef , bool ) { _gbe := _deeg . getSlideRels ( ) ; if ( _gbe == _gf . Relationships { } ) { return _gf . ImageRef { } , false ; } ; var _edfg string ; for _ , _gfe := range _gbe . X ( ) . Relationship { if _gfe . IdAttr == relID { _edfg = _gfe . TargetAttr ; break ; } ; } ; for _ , _gddd := range _deeg . _gggf . Images { if _gddd . Target ( ) == _edfg { return _gddd , true ; } ; } ; return _gf . ImageRef { } , false ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// SetTextAnchor controls the text anchoring
func ( _fbaf TextBox ) SetTextAnchor ( a _fcc . ST_TextAnchoringType ) { _fbaf . _eef . TxBody . BodyPr = _fcc . NewCT_TextBodyProperties ( ) ; _fbaf . _eef . TxBody . BodyPr . AnchorAttr = a ; } ;
2021-11-10 11:45:21 +00:00
2022-01-15 21:17:38 +00:00
// Remove removes a placeholder from a presentation.
func ( _cgde PlaceHolder ) Remove ( ) error { for _gbd , _edc := range _cgde . _ecg . CSld . SpTree . Choice { for _ , _bge := range _edc . Sp { if _bge == _cgde . _eca { copy ( _cgde . _ecg . CSld . SpTree . Choice [ _gbd : ] , _cgde . _ecg . CSld . SpTree . Choice [ _gbd + 1 : ] ) ; _cgde . _ecg . CSld . SpTree . Choice = _cgde . _ecg . CSld . SpTree . Choice [ 0 : len ( _cgde . _ecg . CSld . SpTree . Choice ) - 1 ] ; return nil ; } ; } ; } ; return _ded . 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" ) ; } ;