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-02-25 19:20:45 +00:00
package presentation ; import ( _ee "archive/zip" ; _gbg "bytes" ; _fg "encoding/xml" ; _fb "errors" ; _ec "fmt" ; _dd "github.com/unidoc/unioffice" ; _ebb "github.com/unidoc/unioffice/common" ; _gb "github.com/unidoc/unioffice/common/logger" ; _gf "github.com/unidoc/unioffice/common/tempstorage" ; _bf "github.com/unidoc/unioffice/drawing" ; _df "github.com/unidoc/unioffice/internal/license" ; _ef "github.com/unidoc/unioffice/measurement" ; _a "github.com/unidoc/unioffice/schema/soo/dml" ; _c "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _f "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _eb "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _dc "github.com/unidoc/unioffice/schema/soo/pml" ; _e "github.com/unidoc/unioffice/zippkg" ; _fc "image" ; _ba "image/jpeg" ; _b "io" ; _cd "math" ; _ea "os" ; _efe "path" ; _bff "sort" ; _ce "strconv" ; _d "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// Name returns the name of the slide layout.
func ( _afaaf SlideLayout ) Name ( ) string { if _afaaf . _feec . CSld != nil && _afaaf . _feec . CSld . NameAttr != nil { return * _afaaf . _feec . CSld . NameAttr ; } ; return "" ; } ;
2017-11-18 11:43:37 -06:00
2022-02-25 19:20:45 +00:00
// 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 ( _ead * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _dag := _dc . NewCT_SlideIdListEntry ( ) ; _dag . IdAttr = 256 ; for _ , _eddb := range _ead . _bae . SldIdLst . SldId { if _eddb . IdAttr >= _dag . IdAttr { _dag . IdAttr = _eddb . IdAttr + 1 ; } ; } ; _ead . _bae . SldIdLst . SldId = append ( _ead . _bae . SldIdLst . SldId , _dag ) ; _dbgg := _dc . NewSld ( ) ; _egf := _gbg . Buffer { } ; _gfd := _fg . NewEncoder ( & _egf ) ; _egb := _fg . StartElement { Name : _fg . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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" } ) ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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" } ) ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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" } ) ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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" } ) ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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" } ) ; _egb . Attr = append ( _egb . Attr , _fg . Attr { Name : _fg . 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 _afg := l . _feec . CSld . MarshalXML ( _gfd , _egb ) ; _afg != nil { return Slide { } , _afg ; } ; _gfd . Flush ( ) ; _dcd := _fg . NewDecoder ( & _egf ) ; _dbgg . CSld = _dc . NewCT_CommonSlideData ( ) ; if _fbb := _dcd . Decode ( _dbgg . CSld ) ; _fbb != nil { return Slide { } , _fbb ; } ; _dbgg . CSld . NameAttr = nil ; _dbgg . CSld . SpTree . Choice = _dbf ( _dbgg . CSld . SpTree . Choice ) ; _ead . _cad = append ( _ead . _cad , _dbgg ) ; _fee := _ead . _deb . AddAutoRelationship ( _dd . DocTypePresentation , _dd . OfficeDocumentType , len ( _ead . _cad ) , _dd . SlideType ) ; _dag . RIdAttr = _fee . ID ( ) ; _gac := _dd . AbsoluteFilename ( _dd . DocTypePresentation , _dd . SlideType , len ( _ead . _cad ) ) ; _ead . ContentTypes . AddOverride ( _gac , _dd . SlideContentType ) ; _debf := _ebb . NewRelationships ( ) ; _ead . _gfe = append ( _ead . _gfe , _debf ) ; _dfdb := len ( _ead . _gfe ) - 1 ; for _aag , _dab := range _ead . _cgd { if _dab == l . X ( ) { _bde := _ead . _bbad [ _aag ] ; for _ , _ffaf := range _bde . X ( ) . Relationship { if _ffaf . TypeAttr != _dd . SlideMasterType { _ead . _gfe [ _dfdb ] . X ( ) . Relationship = append ( _ead . _gfe [ _dfdb ] . X ( ) . Relationship , _f
2021-05-31 16:22:30 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
func ( _gef PlaceHolder ) X ( ) * _dc . CT_Shape { return _gef . _afca } ;
2021-05-31 16:22:30 +00:00
2022-02-25 19:20:45 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _ege * Presentation ) ExtractText ( ) * PresentationText { _dg := [ ] * SlideText { } ; for _ , _cf := range _ege . Slides ( ) { _dgf := _cf . ExtractText ( ) ; if _dgf != nil { _dg = append ( _dg , _dgf ) ; } ; } ; return & PresentationText { Slides : _dg } ; } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _acd Slide ) ValidateWithPath ( path string ) error { if _gcfc := _acd . _fafb . ValidateWithPath ( path ) ; _gcfc != nil { return _gcfc ; } ; for _ , _ebdc := range _acd . _fafb . CSld . SpTree . Choice { for _ , _eaba := range _ebdc . Sp { if _eaba . TxBody != nil { if len ( _eaba . TxBody . P ) == 0 { return _fb . 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 ; } ; func _dbf ( _dec [ ] * _dc . CT_GroupShapeChoice ) [ ] * _dc . CT_GroupShapeChoice { var _dgfd [ ] * _dc . CT_GroupShapeChoice ; for _ , _ffbb := range _dec { if len ( _ffbb . Pic ) == 0 { _dgfd = append ( _dgfd , _ffbb ) ; } ; } ; return _dgfd ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +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 ( _dgc * Presentation ) GetColorBySchemeColor ( schClr _a . ST_SchemeColorVal ) * _a . CT_Color { if len ( _dgc . _ddd ) == 0 || len ( _dgc . _beg ) == 0 { return nil ; } ; var _dac _a . ST_ColorSchemeIndex ; _feg := _dgc . _ddd [ 0 ] ; _adbb := _feg . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _dac = _adbb . Bg1Attr ; case "\u0062\u0067\u0032" : _dac = _adbb . Bg2Attr ; case "\u0074\u0078\u0031" : _dac = _adbb . Tx1Attr ; case "\u0074\u0078\u0032" : _dac = _adbb . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _dac = _adbb . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _dac = _adbb . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _dac = _adbb . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _dac = _adbb . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _dac = _adbb . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _dac = _adbb . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _dac = _adbb . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _dac = _adbb . FolHlinkAttr ; case "\u0064\u006b\u0031" : _dac = _a . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _dac = _a . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _dac = _a . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _dac = _a . ST_ColorSchemeIndexLt2 ; default : _dac = _a . ST_ColorSchemeIndexUnset ; } ; _gfef := _dgc . _beg [ 0 ] ; _gebg := _gfef . ThemeElements ; if _gebg == nil { return nil ; } ; var _defa * _a . CT_Color ; _fabg := _gebg . ClrScheme ; switch _dac . String ( ) { case "\u0064\u006b\u0031" : _defa = _fabg . Dk1 ; case "\u0064\u006b\u0032" : _defa = _fabg . Dk2 ; case "\u006c\u0074\u0031" : _defa = _fabg . Lt1 ; case "\u006c\u0074\u0032" : _defa = _fabg . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _defa = _fabg . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _defa = _fabg . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _defa = _fabg . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _defa = _fabg . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _defa = _fabg . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _defa = _fabg . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _defa = _fabg . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _defa = _fabg . FolHlink ; default : return nil ; } ; return _defa ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// AddTable adds an empty table to a slide.
func ( _bfbg Slide ) AddTable ( ) * _ebb . Table { _cece := _dc . NewCT_GroupShapeChoice ( ) ; _bfbg . _fafb . CSld . SpTree . Choice = append ( _bfbg . _fafb . CSld . SpTree . Choice , _cece ) ; _fdda := _dc . NewCT_GraphicalObjectFrame ( ) ; _cece . GraphicFrame = append ( _cece . GraphicFrame , _fdda ) ; _fdda . Xfrm . Off = _a . NewCT_Point2D ( ) ; _cbd := int64 ( 1 ) ; _fdda . Xfrm . Off . XAttr = _a . ST_Coordinate { ST_CoordinateUnqualified : & _cbd } ; _fdda . Xfrm . Off . YAttr = _a . ST_Coordinate { ST_CoordinateUnqualified : & _cbd } ; _cbc := _fdda . Graphic . CT_GraphicalObject . GraphicData ; _cbc . 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" ; _abaf := _ebb . NewTableWithXfrm ( _fdda . Xfrm ) ; _cbc . Any = append ( _cbc . Any , _abaf . X ( ) ) ; return _abaf ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// SetTextAnchor controls the text anchoring
func ( _aae TextBox ) SetTextAnchor ( a _a . ST_TextAnchoringType ) { _aae . _dbef . TxBody . BodyPr = _a . NewCT_TextBodyProperties ( ) ; _aae . _dbef . TxBody . BodyPr . AnchorAttr = a ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +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 ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _gfa * Slide ) ExtractText ( ) * SlideText { _fe := _ffg ( _gfa . _ddf , _gfa . _fafb . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _bff . Sort ( sort2d ( _fe ) ) ; return & SlideText { Items : _fe } ; } ;
2020-11-09 01:00:18 +00:00
2022-02-25 19:20:45 +00:00
// NormalViewPr returns the NormalViewPr property.
func ( _ebbc ViewProperties ) NormalViewPr ( ) * _dc . CT_NormalViewProperties { return _ebbc . _gecd . NormalViewPr ; } ;
// Remove removes a placeholder from a presentation.
func ( _ceb PlaceHolder ) Remove ( ) error { for _dcae , _befb := range _ceb . _aef . CSld . SpTree . Choice { for _ , _egaf := range _befb . Sp { if _egaf == _ceb . _afca { copy ( _ceb . _aef . CSld . SpTree . Choice [ _dcae : ] , _ceb . _aef . CSld . SpTree . Choice [ _dcae + 1 : ] ) ; _ceb . _aef . CSld . SpTree . Choice = _ceb . _aef . CSld . SpTree . Choice [ 0 : len ( _ceb . _aef . CSld . SpTree . Choice ) - 1 ] ; return nil ; } ; } ; } ; return _fb . 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" ) ; } ;
2021-05-31 16:22:30 +00:00
2022-02-05 13:05:36 +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.
2022-02-25 19:20:45 +00:00
func ( _adg * Presentation ) AddImage ( i _ebb . Image ) ( _ebb . ImageRef , error ) { _bdef := _ebb . MakeImageRef ( i , & _adg . DocBase , _adg . _deb ) ; if i . Data == nil && i . Path == "" { return _bdef , _fb . 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 _bdef , _fb . 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 _bdef , _fb . 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 != "" { _baeg := _gf . Add ( i . Path ) ; if _baeg != nil { return _bdef , _baeg ; } ; } ; _adg . Images = append ( _adg . Images , _bdef ) ; _adg . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _adg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _adg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _adg . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _adg . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; return _bdef , nil ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _gfg * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _bfb := [ ] SlideLayout { } ; for _ , _ada := range _gfg . _cgd { _bfb = append ( _bfb , SlideLayout { _ada } ) ; } ; return _bfb ; } ; func _fgd ( ) * Presentation { _fd := & Presentation { _bae : _dc . NewPresentation ( ) } ; _fd . _bae . SldIdLst = _dc . NewCT_SlideIdList ( ) ; _fd . _bae . ConformanceAttr = _f . ST_ConformanceClassTransitional ; _fd . AppProperties = _ebb . NewAppProperties ( ) ; _fd . CoreProperties = _ebb . NewCoreProperties ( ) ; _fd . _gfb = _ebb . NewTableStyles ( ) ; _fd . ContentTypes = _ebb . NewContentTypes ( ) ; _fd . Rels = _ebb . NewRelationships ( ) ; _fd . _deb = _ebb . NewRelationships ( ) ; _fd . _eefa = NewPresentationProperties ( ) ; _fd . _fgab = NewViewProperties ( ) ; _fd . _caf = map [ string ] string { } ; return _fd ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// ExtLst returns the ExtLst property.
func ( _baad ViewProperties ) ExtLst ( ) * _dc . CT_ExtensionList { return _baad . _gecd . ExtLst } ;
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _bega TextBox ) SetOffsetY ( offY float64 ) { _fca := _bega . getOff ( ) ; _abc := _ef . ToEMU ( offY ) ; _fca . YAttr = _a . ST_Coordinate { ST_CoordinateUnqualified : & _abc } ; } ;
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _ddc : _dc . NewPresentationPr ( ) } ; } ;
// X returns the inner wrapped XML type.
func ( _aab SlideMaster ) X ( ) * _dc . SldMaster { return _aab . _egcg } ;
2020-08-23 14:15:53 +00:00
2022-02-05 13:05:36 +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.
2022-02-25 19:20:45 +00:00
func ( _dfa Slide ) GetPlaceholder ( t _dc . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _dcgf := range _dfa . _fafb . CSld . SpTree . Choice { for _ , _dabc := range _dcgf . Sp { if _dabc . NvSpPr != nil && _dabc . NvSpPr . NvPr != nil && _dabc . NvSpPr . NvPr . Ph != nil { if _dabc . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _dabc , _dfa . _fafb } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _fb . 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" ) ; } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// GetSlideLayout returns a slide layout related to the slide.
func ( _befa * Slide ) GetSlideLayout ( ) * _dc . SldLayout { for _afeb , _fbec := range _befa . _ddf . Slides ( ) { if * _befa == _fbec { return _befa . _ddf . _cgd [ len ( _befa . _ddf . Slides ( ) ) - _afeb - 1 ] ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// AddSlide adds a new slide to the presentation.
func ( _cb * Presentation ) AddSlide ( ) Slide { _eeea := _dc . NewCT_SlideIdListEntry ( ) ; _eeea . IdAttr = _cb . nextSlideID ( ) ; _cb . _bae . SldIdLst . SldId = append ( _cb . _bae . SldIdLst . SldId , _eeea ) ; _faa := _dc . NewSld ( ) ; _faa . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ; _faa . CSld . SpTree . GrpSpPr . Xfrm = _a . NewCT_GroupTransform2D ( ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Off = _a . NewCT_Point2D ( ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _dd . Int64 ( 0 ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _dd . Int64 ( 0 ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Ext = _a . NewCT_PositiveSize2D ( ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _ef . Point ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _ef . Point ) ; _faa . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _faa . CSld . SpTree . GrpSpPr . Xfrm . Off ; _faa . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _faa . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _cb . _cad = append ( _cb . _cad , _faa ) ; _gcf := _cb . _deb . AddAutoRelationship ( _dd . DocTypePresentation , _dd . OfficeDocumentType , len ( _cb . _cad ) , _dd . SlideType ) ; _eeea . RIdAttr = _gcf . ID ( ) ; _dbg := _dd . AbsoluteFilename ( _dd . DocTypePresentation , _dd . SlideType , len ( _cb . _cad ) ) ; _cb . ContentTypes . AddOverride ( _dbg , _dd . SlideContentType ) ; _fba := _ebb . NewRelationships ( ) ; _cb . _gfe = append ( _cb . _gfe , _fba ) ; _fba . AddAutoRelationship ( _dd . DocTypePresentation , _dd . SlideType , len ( _cb . _cgd ) , _dd . SlideLayoutType ) ; return Slide { _eeea , _faa , _cb , nil } ; } ;
2020-11-09 01:00:18 +00:00
2022-02-25 19:20:45 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _dagg Slide ) GetTextBoxes ( ) [ ] * TextBox { _cbg := [ ] * TextBox { } ; _bagf := _dagg . _fafb . CSld . SpTree . Choice ; for _ , _dgef := range _bagf { for _ , _aec := range _dgef . Sp { if _aec . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _aec . NvSpPr . CNvSpPr . TxBoxAttr { _cbg = append ( _cbg , & TextBox { _aec } ) ; } ; } ; } ; return _cbg ; } ;
2021-03-16 20:51:18 +00:00
2022-02-25 19:20:45 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _gecd * _dc . ViewPr } ; func ( _ecb * Slide ) ensureClrMap ( ) { if len ( _ecb . _ddf . _ddd ) == 0 || len ( _ecb . _ddf . _beg ) == 0 { return ; } ; _fdc := _ecb . _ddf . _ddd [ 0 ] ; _daeb := _fdc . ClrMap ; if _bgf := _ecb . _fafb . ClrMapOvr ; _bgf != nil { if _agdbe := _bgf . Choice ; _agdbe != nil { if _agdbe . MasterClrMapping == nil { if _feb := _agdbe . OverrideClrMapping ; _feb != nil { if _feb . Bg1Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Bg1Attr = _feb . Bg1Attr ; } ; if _feb . Tx1Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Tx1Attr = _feb . Tx1Attr ; } ; if _feb . Bg2Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Bg2Attr = _feb . Bg2Attr ; } ; if _feb . Tx2Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Tx2Attr = _feb . Tx2Attr ; } ; if _feb . Accent1Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent1Attr = _feb . Accent1Attr ; } ; if _feb . Accent2Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent2Attr = _feb . Accent2Attr ; } ; if _feb . Accent3Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent3Attr = _feb . Accent3Attr ; } ; if _feb . Accent4Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent4Attr = _feb . Accent4Attr ; } ; if _feb . Accent5Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent5Attr = _feb . Accent5Attr ; } ; if _feb . Accent6Attr != _a . ST_ColorSchemeIndexUnset { _daeb . Accent6Attr = _feb . Accent6Attr ; } ; if _feb . HlinkAttr != _a . ST_ColorSchemeIndexUnset { _daeb . HlinkAttr = _feb . HlinkAttr ; } ; if _feb . FolHlinkAttr != _a . ST_ColorSchemeIndexUnset { _daeb . FolHlinkAttr = _feb . FolHlinkAttr ; } ; } ; } ; } ; } ; _ecb . _geff = _daeb ; } ;
// PlaceHolder is a place holder from a slide.
type PlaceHolder struct { _afca * _dc . CT_Shape ; _aef * _dc . Sld ; } ;
// 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 ( _dage Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _gefg := range _dage . _fafb . CSld . SpTree . Choice { for _ , _cgg := range _gefg . Sp { if _cgg . NvSpPr != nil && _cgg . NvSpPr . NvPr != nil && _cgg . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _cgg . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _cgg . NvSpPr . NvPr . Ph . IdxAttr != nil && * _cgg . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _cgg , _dage . _fafb } , nil ; } ; } ; } ; } ; return PlaceHolder { } , _fb . 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" ) ; } ;
// Presentation returns a slide's presentation.
func ( _fabe Slide ) Presentation ( ) * Presentation { return _fabe . _ddf } ;
2020-08-23 14:15:53 +00:00
2022-02-05 13:05:36 +00:00
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
2022-02-25 19:20:45 +00:00
type TableInfo struct { Table * _a . CT_Table ; Row * _a . CT_TableRow ; Cell * _a . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// AddParagraph adds a paragraph to the text box
func ( _efbc TextBox ) AddParagraph ( ) _bf . Paragraph { _gaed := _a . NewCT_TextParagraph ( ) ; _efbc . _dbef . TxBody . P = append ( _efbc . _dbef . TxBody . P , _gaed ) ; return _bf . MakeParagraph ( _gaed ) ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _degg ViewProperties ) NotesTextViewPr ( ) * _dc . CT_NotesTextViewProperties { return _degg . _gecd . NotesTextViewPr ; } ; func _bfad ( _bgb * Presentation , _bec * _dc . CT_Shape , _fgb * _dc . CT_GraphicalObjectFrame , _ge * TableInfo , _gbc * _a . CT_Transform2D , _adb int , _ffeb [ ] rectangle , _gga [ ] * _a . CT_TextParagraph ) [ ] * TextItem { _fcb := [ ] * TextItem { } ; var _ggb , _bgbe , _eca , _afc , _gee , _ffb int64 ; _dad := _gbc == nil ; _fgg := 0 ; for _ , _efc := range _gga { for _ , _egg := range _efc . EG_TextRun { if _bcg := _egg . R ; _bcg != nil { if ! _dad { if _gbc . Off != nil { if _cea := _gbc . Ext ; _cea != nil { _gee , _ffb = _cea . CxAttr , _cea . CyAttr ; } ; if _gd := _gbc . Off . XAttr . ST_CoordinateUnqualified ; _gd != nil { _ggb = * _gd ; _bgbe = _ggb + _gee ; _dad = true ; } ; if _dcc := _gbc . Off . YAttr . ST_CoordinateUnqualified ; _dcc != nil { _eca = * _dcc ; _afc = _eca + _ffb ; _dad = true ; } ; } ; } ; _fbd := append ( [ ] rectangle { } , _ffeb ... ) ; _fbd = append ( _fbd , rectangle { _ffa : _ggb , _da : _bgbe , _bg : _eca , _fgc : _afc } ) ; _fcb = append ( _fcb , & TextItem { Presentation : _bgb , Shape : _bec , GraphicFrame : _fgb , TableInfo : _ge , Paragraph : _efc , Run : _bcg , Text : _bcg . T , _eg : _fbd , _ff : _adb , _bfa : _fgg } ) ; _fgg ++ ; } ; } ; } ; return _fcb ; } ;
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// Image is an image within a slide.
type Image struct { _faf * _dc . CT_Picture } ;
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// PrnPr returns the PrnPr property.
func ( _bbd PresentationProperties ) PrnPr ( ) * _dc . CT_PrintProperties { return _bbd . _ddc . PrnPr } ;
2021-11-10 11:45:21 +00:00
2022-02-25 19:20:45 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _gag * Presentation ) SaveToFile ( path string ) error { return _gag . saveToFile ( path , false ) } ;
2021-11-10 11:45:21 +00:00
2022-02-25 19:20:45 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _cfgd ViewProperties ) SorterViewPr ( ) * _dc . CT_SlideSorterViewProperties { return _cfgd . _gecd . SorterViewPr ; } ;
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
func ( _cedg SlideLayout ) X ( ) * _dc . SldLayout { return _cedg . _feec } ; func ( _ebg * chart ) X ( ) * _c . ChartSpace { return _ebg . _eac } ;
2020-12-17 22:07:08 +00:00
2022-02-25 19:20:45 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
func ( _cbdd * Slide ) GetImageByRelID ( relID string ) ( _ebb . ImageRef , bool ) { _cfgc := _cbdd . getSlideRels ( ) ; if ( _cfgc == _ebb . Relationships { } ) { return _ebb . ImageRef { } , false ; } ; var _beb string ; for _ , _bbdb := range _cfgc . X ( ) . Relationship { if _bbdb . IdAttr == relID { _beb = _bbdb . TargetAttr ; break ; } ; } ; for _ , _fbea := range _cbdd . _ddf . Images { if _fbea . Target ( ) == _beb { return _fbea , true ; } ; } ; return _ebb . ImageRef { } , false ; } ; type sort2d [ ] * TextItem ;
2021-06-16 07:10:52 +00:00
2022-02-25 19:20:45 +00:00
// WebPr returns the WebPr property.
func ( _fcg PresentationProperties ) WebPr ( ) * _dc . CT_WebProperties { return _fcg . _ddc . WebPr } ;
2021-01-04 16:11:39 +00:00
2022-02-05 13:05:36 +00:00
// AddImage adds an image textbox to a slide.
2022-02-25 19:20:45 +00:00
func ( _gbf Slide ) AddImage ( img _ebb . ImageRef ) Image { _eec := _dc . NewCT_GroupShapeChoice ( ) ; _gbf . _fafb . CSld . SpTree . Choice = append ( _gbf . _fafb . CSld . SpTree . Choice , _eec ) ; _bdea := _dc . NewCT_Picture ( ) ; _eec . Pic = append ( _eec . Pic , _bdea ) ; _bdea . NvPicPr . CNvPicPr = _a . NewCT_NonVisualPictureProperties ( ) ; _bdea . NvPicPr . CNvPicPr . PicLocks = _a . NewCT_PictureLocking ( ) ; _bdea . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _dd . Bool ( true ) ; _bdea . BlipFill = _a . NewCT_BlipFillProperties ( ) ; _bdea . BlipFill . Blip = _a . NewCT_Blip ( ) ; _bag := _gbf . AddImageToRels ( img ) ; _bdea . BlipFill . Blip . EmbedAttr = _dd . String ( _bag ) ; _bdea . BlipFill . Stretch = _a . NewCT_StretchInfoProperties ( ) ; _bdea . BlipFill . Stretch . FillRect = _a . NewCT_RelativeRect ( ) ; _bdea . SpPr = _a . NewCT_ShapeProperties ( ) ; _bdea . SpPr . PrstGeom = _a . NewCT_PresetGeometry2D ( ) ; _bdea . SpPr . PrstGeom . PrstAttr = _a . ST_ShapeTypeRect ; _eed := Image { _bdea } ; _fad := img . Size ( ) ; _eed . Properties ( ) . SetWidth ( _ef . Distance ( _fad . X ) * _ef . Pixel72 ) ; _eed . Properties ( ) . SetHeight ( _ef . Distance ( _fad . Y ) * _ef . Pixel72 ) ; _eed . Properties ( ) . SetPosition ( 0 , 0 ) ; return _eed ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _gbad * _dc . CT_SlideIdListEntry ; _fafb * _dc . Sld ; _ddf * Presentation ; _geff * _a . CT_ColorMapping ; } ; func ( _abcb TextBox ) getOff ( ) * _a . CT_Point2D { if _abcb . _dbef . SpPr == nil { _abcb . _dbef . SpPr = _a . NewCT_ShapeProperties ( ) ; } ; if _abcb . _dbef . SpPr . Xfrm == nil { _abcb . _dbef . SpPr . Xfrm = _a . NewCT_Transform2D ( ) ; } ; if _abcb . _dbef . SpPr . Xfrm . Off == nil { _abcb . _dbef . SpPr . Xfrm . Off = _a . NewCT_Point2D ( ) ; } ; return _abcb . _dbef . SpPr . Xfrm . Off ; } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _fgba * Presentation ) SaveAsTemplate ( w _b . Writer ) error { return _fgba . save ( w , true ) } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// NewViewProperties constructs a new ViewProperties.
func NewViewProperties ( ) ViewProperties { return ViewProperties { _gecd : _dc . NewViewPr ( ) } } ; func ( _af * chart ) Target ( ) string { return _af . _ag } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _ecag ViewProperties ) SlideViewPr ( ) * _dc . CT_SlideViewProperties { return _ecag . _gecd . SlideViewPr } ; func ( _gad * Presentation ) save ( _edc _b . Writer , _ccbf bool ) error { const _fafg = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ; if _edb := _gad . _bae . Validate ( ) ; _edb != nil { _gb . 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" , _edb ) ; } ; if ! _df . GetLicenseKey ( ) . IsLicensed ( ) && ! _dbgd { _ec . 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" ) ; _ec . 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 _fb . 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 ( _gad . _bga ) == 0 { _dgbg , _fbbe := _df . GenRefId ( "\u0070\u0077" ) ; if _fbbe != nil { _gb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fbbe ) ; return _fbbe ; } ; _gad . _bga = _dgbg ; } ; if _dbfa := _df . Track ( _gad . _bga , _fafg ) ; _dbfa != nil { _gb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dbfa ) ; return _dbfa ; } ; if _ccbf { _gad . 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" ) ; _gad . 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 { _gad . 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" ) ; _gad . 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" ) ; } ; _dae := _dd . DocTypePresentation ; _gggg := _ee . NewWriter ( _edc ) ; defer _gggg . Close ( ) ; if _dfba := _e . MarshalXML ( _gggg , _dd . BaseRelsFilename , _gad . Rels . X ( ) ) ; _dfba != nil { return _dfba ; } ; if _dce := _e . MarshalXMLByType ( _gggg , _dae , _dd . ExtendedPropertiesType , _gad . AppProperties . X ( ) ) ; _dce != nil { return _dce ; } ; if _daa := _e . MarshalXMLByType ( _gggg , _dae , _dd . CorePropertiesType , _g
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// PlaceHolders returns all of the content place holders within a given slide.
func ( _egde Slide ) PlaceHolders ( ) [ ] PlaceHolder { _bbdc := [ ] PlaceHolder { } ; for _ , _ceab := range _egde . _fafb . CSld . SpTree . Choice { for _ , _fbg := range _ceab . Sp { if _fbg . NvSpPr != nil && _fbg . NvSpPr . NvPr != nil && _fbg . NvSpPr . NvPr . Ph != nil { _bbdc = append ( _bbdc , PlaceHolder { _fbg , _egde . _fafb } ) ; } ; } ; } ; return _bbdc ; } ; func ( _cebe * Presentation ) onNewRelationship ( _agga * _e . DecodeMap , _bfae , _bgda string , _fbac [ ] * _ee . File , _fdff * _eb . Relationship , _ffbd _e . Target ) error { _abb := _dd . DocTypePresentation ; switch _bgda { case _dd . OfficeDocumentType : _cebe . _bae = _dc . NewPresentation ( ) ; _agga . AddTarget ( _bfae , _cebe . _bae , _bgda , 0 ) ; _agga . AddTarget ( _e . RelationsPathFor ( _bfae ) , _cebe . _deb . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . CorePropertiesType : _agga . AddTarget ( _bfae , _cebe . CoreProperties . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . CustomPropertiesType : _agga . AddTarget ( _bfae , _cebe . CustomProperties . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . PresentationPropertiesType : _agga . AddTarget ( _bfae , _cebe . _eefa . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . ViewPropertiesType : _agga . AddTarget ( _bfae , _cebe . _fgab . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . TableStylesType : _agga . AddTarget ( _bfae , _cebe . _gfb . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . HyperLinkType : _efdg := _a . NewCT_Hyperlink ( ) ; _aeea := uint32 ( len ( _cebe . _dgfe ) ) ; _agga . AddTarget ( _bfae , _efdg , _bgda , _aeea ) ; _cebe . _dgfe = append ( _cebe . _dgfe , _efdg ) ; case _dd . CustomXMLType : _acf := & _dd . XSDAny { } ; _adcb := uint32 ( len ( _cebe . _fab ) ) ; _agga . AddTarget ( _bfae , _acf , _bgda , _adcb ) ; _cebe . _fab = append ( _cebe . _fab , _acf ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _fab ) ) ; case _dd . ChartType : _bgg := chart { _eac : _c . NewChartSpace ( ) } ; _afad := uint32 ( len ( _cebe . _ffea ) ) ; _agga . AddTarget ( _bfae , _bgg . _eac , _bgda , _afad ) ; _cebe . _ffea = append ( _cebe . _ffea , & _bgg ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _ffea ) ) ; _bgg . _ag = _fdff . TargetAttr ; case _dd . HandoutMasterType : _agdb := _dc . NewHandoutMaster ( ) ; _ebbd := uint32 ( len ( _cebe . _gab ) ) ; _agga . AddTarget ( _bfae , _agdb , _bgda , _ebbd ) ; _cebe . _gab = append ( _cebe . _gab , _agdb ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _gab ) ) ; case _dd . NotesMasterType : _abba := _dc . NewNotesMaster ( ) ; _edbd := uint32 ( len ( _cebe . _bdd ) ) ; _agga . AddTarget ( _bfae , _abba , _bgda , _edbd ) ; _cebe . _bdd = append ( _cebe . _bdd , _abba ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _bdd ) ) ; case _dd . ExtendedPropertiesType : _agga . AddTarget ( _bfae , _cebe . AppProperties . X ( ) , _bgda , 0 ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , 0 ) ; case _dd . SlideType : _fdbf := _dc . NewSld ( ) ; _cebe . _cad = append ( _cebe . _cad , _fdbf ) ; _agga . AddTarget ( _bfae , _fdbf , _bgda , uint32 ( len ( _cebe . _cad ) ) ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _cad ) ) ; _cba := _ebb . NewRelationships ( ) ; _agga . AddTarget ( _e . RelationsPathFor ( _bfae ) , _cba . X ( ) , _bgda , 0 ) ; _cebe . _gfe = append ( _cebe . _gfe , _cba ) ; case _dd . SlideMasterType : _ggf := _dc . NewSldMaster ( ) ; if ! _agga . AddTarget ( _bfae , _ggf , _bgda , uint32 ( len ( _cebe . _ddd ) + 1 ) ) { return nil ; } ; _cebe . _ddd = append ( _cebe . _ddd , _ggf ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bgda , len ( _cebe . _ddd ) ) ; _cef := _ebb . NewRelationships ( ) ; _agga . AddTarget ( _e . RelationsPathFor ( _bfae ) , _cef . X ( ) , _bgda , 0 ) ; _cebe . _bba = append ( _cebe . _bba , _cef ) ; case _dd . SlideLayoutType : _gcd := _dc . NewSldLayout ( ) ; if ! _agga . AddTarget ( _bfae , _gcd , _bgda , uint32 ( len ( _cebe . _cgd ) + 1 ) ) { return nil ; } ; _cebe . _cgd = append ( _cebe . _cgd , _gcd ) ; _fdff . TargetAttr = _dd . RelativeFilename ( _abb , _ffbd . Typ , _bg
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _ddfd ViewProperties ) ShowCommentsAttr ( ) * bool { return _ddfd . _gecd . ShowCommentsAttr } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _dbef * _dc . CT_Shape } ; func ( _gfc sort2d ) Len ( ) int { return len ( _gfc ) } ; func ( _cc * chart ) RelId ( ) string { return _cc . _fga } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _ggfb Slide ) AddTextBox ( ) TextBox { _fgeb := _dc . NewCT_GroupShapeChoice ( ) ; _ggfb . _fafb . CSld . SpTree . Choice = append ( _ggfb . _fafb . CSld . SpTree . Choice , _fgeb ) ; _abab := _dc . NewCT_Shape ( ) ; _fgeb . Sp = append ( _fgeb . Sp , _abab ) ; _abab . SpPr = _a . NewCT_ShapeProperties ( ) ; _abab . SpPr . Xfrm = _a . NewCT_Transform2D ( ) ; _abab . SpPr . PrstGeom = _a . NewCT_PresetGeometry2D ( ) ; _abab . SpPr . PrstGeom . PrstAttr = _a . ST_ShapeTypeRect ; _abab . NvSpPr = _dc . NewCT_ShapeNonVisual ( ) ; _abab . NvSpPr . CNvSpPr = _a . NewCT_NonVisualDrawingShapeProps ( ) ; _ged := true ; _abab . NvSpPr . CNvSpPr . TxBoxAttr = & _ged ; _abab . TxBody = _a . NewCT_TextBody ( ) ; _abab . TxBody . BodyPr = _a . NewCT_TextBodyProperties ( ) ; _abab . TxBody . BodyPr . WrapAttr = _a . ST_TextWrappingTypeSquare ; _abab . TxBody . BodyPr . SpAutoFit = _a . NewCT_TextShapeAutofit ( ) ; _aed := TextBox { _abab } ; _aed . Properties ( ) . SetWidth ( 3 * _ef . Inch ) ; _aed . Properties ( ) . SetHeight ( 1 * _ef . Inch ) ; _aed . Properties ( ) . SetPosition ( 0 , 0 ) ; return _aed ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// Index returns the placeholder index
func ( _gec PlaceHolder ) Index ( ) uint32 { if _gec . _afca . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _gec . _afca . NvSpPr . NvPr . Ph . IdxAttr ; } ;
2020-08-23 14:15:53 +00:00
2022-02-05 13:05:36 +00:00
// X returns the inner wrapped XML type.
2022-02-25 19:20:45 +00:00
func ( _dfd * Presentation ) X ( ) * _dc . Presentation { return _dfd . _bae } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// Slides returns the slides in the presentation.
func ( _gcdf * Presentation ) Slides ( ) [ ] Slide { _gfbd := [ ] Slide { } ; for _geg , _ffd := range _gcdf . _cad { _gfbd = append ( _gfbd , Slide { _gcdf . _bae . SldIdLst . SldId [ _geg ] , _ffd , _gcdf , nil } ) ; } ; return _gfbd ; } ;
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _ccbc * Slide ) GetChartSpaceByRelId ( relId string ) * _c . ChartSpace { _dbcb := _ccbc . getSlideRels ( ) ; if ( _dbcb == _ebb . Relationships { } ) { return nil ; } ; _eadd := _dbcb . GetTargetByRelId ( relId ) ; for _ , _ggcg := range _ccbc . _ddf . _ffea { if _eadd == _ggcg . Target ( ) { return _ggcg . _eac ; } ; } ; return nil ; } ; func ( _dcabf * Presentation ) Validate ( ) error { if _fcbgc := _dcabf . _bae . Validate ( ) ; _fcbgc != nil { return _fcbgc ; } ; for _fdd , _gae := range _dcabf . Slides ( ) { if _bbg := _gae . ValidateWithPath ( _ec . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _fdd ) ) ; _bbg != nil { return _bbg ; } ; } ; for _dcad , _efb := range _dcabf . _ddd { if _ebge := _efb . ValidateWithPath ( _ec . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _dcad ) ) ; _ebge != nil { return _ebge ; } ; } ; for _eaeg , _ggd := range _dcabf . _cgd { if _eddd := _ggd . ValidateWithPath ( _ec . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _eaeg ) ) ; _eddd != nil { return _eddd ; } ; } ; return nil ; } ;
2021-08-23 20:44:48 +00:00
2022-02-25 19:20:45 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
func ( _cedf ViewProperties ) X ( ) * _dc . ViewPr { return _cedf . _gecd } ;
2022-01-15 21:17:38 +00:00
2022-02-25 19:20:45 +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 ( _ffag PlaceHolder ) SetText ( text string ) { _ffag . Clear ( ) ; _gc := _a . NewEG_TextRun ( ) ; _gc . R = _a . NewCT_RegularTextRun ( ) ; _gc . R . T = text ; if len ( _ffag . _afca . TxBody . P ) == 0 { _ffag . _afca . TxBody . P = append ( _ffag . _afca . TxBody . P , _a . NewCT_TextParagraph ( ) ) ; } ; _ffag . _afca . TxBody . P [ 0 ] . EG_TextRun = nil ; _ffag . _afca . TxBody . P [ 0 ] . EG_TextRun = append ( _ffag . _afca . TxBody . P [ 0 ] . EG_TextRun , _gc ) ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// Save writes the presentation out to a writer in the Zip package format
func ( _edf * Presentation ) Save ( w _b . Writer ) error { return _edf . save ( w , false ) } ;
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _feec * _dc . SldLayout } ;
2020-08-31 22:58:25 +00:00
2022-02-05 13:05:36 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
2022-02-25 19:20:45 +00:00
func ( _cag PlaceHolder ) ClearAll ( ) { _cag . _afca . SpPr = _a . NewCT_ShapeProperties ( ) ; _cag . _afca . TxBody = _a . NewCT_TextBody ( ) ; _cag . _afca . TxBody . LstStyle = _a . NewCT_TextListStyle ( ) ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _facc PresentationProperties ) HtmlPubPr ( ) * _dc . CT_HtmlPublishProperties { return _facc . _ddc . HtmlPubPr ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _ccgf * Presentation ; _cfdg _ebb . Relationships ; _egcg * _dc . SldMaster ; } ; type rectangle struct { _ffa int64 ; _bg int64 ; _da int64 ; _fgc int64 ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +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 ( _dbe PlaceHolder ) Clear ( ) { _dbe . ClearAll ( ) ; _edd := _a . NewCT_TextParagraph ( ) ; _dbe . _afca . TxBody . P = [ ] * _a . CT_TextParagraph { _edd } ; _edd . EndParaRPr = _a . NewCT_TextCharacterProperties ( ) ; _edd . EndParaRPr . LangAttr = _dd . String ( "\u0065\u006e\u002dU\u0053" ) ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _dfede * Presentation ) SlideMasters ( ) [ ] SlideMaster { _gdb := [ ] SlideMaster { } ; for _gfde , _bge := range _dfede . _ddd { _gdb = append ( _gdb , SlideMaster { _dfede , _dfede . _bba [ _gfde ] , _bge } ) ; } ; return _gdb ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +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.
func ( _dgb * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _gcfb , _age := _dgb . AddSlideWithLayout ( l ) ; for _ , _daf := range _gcfb . PlaceHolders ( ) { _daf . Clear ( ) ; switch _daf . Type ( ) { case _dc . ST_PlaceholderTypeFtr , _dc . ST_PlaceholderTypeDt , _dc . ST_PlaceholderTypeSldNum : _daf . Remove ( ) ; } ; } ; return _gcfb , _age ; } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _gca * Presentation ) SaveToFileAsTemplate ( path string ) error { return _gca . saveToFile ( path , true ) } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// ExtLst returns the ExtLst property.
func ( _cga PresentationProperties ) ExtLst ( ) * _dc . CT_ExtensionList { return _cga . _ddc . ExtLst } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// Type returns the placeholder type
func ( _dca PlaceHolder ) Type ( ) _dc . ST_PlaceholderType { return _dca . _afca . NvSpPr . NvPr . Ph . TypeAttr } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// GridSpacing returns the GridSpacing property.
func ( _fec ViewProperties ) GridSpacing ( ) * _a . CT_PositiveSize2D { return _fec . _gecd . GridSpacing } ;
2020-08-23 14:15:53 +00:00
2022-02-25 19:20:45 +00:00
// Properties returns the properties of the TextBox.
func ( _agg Image ) Properties ( ) _bf . ShapeProperties { if _agg . _faf . SpPr == nil { _agg . _faf . SpPr = _a . NewCT_ShapeProperties ( ) ; } ; return _bf . MakeShapeProperties ( _agg . _faf . SpPr ) ; } ;
2021-04-23 20:00:00 +00:00
2022-02-25 19:20:45 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _ddc * _dc . PresentationPr } ;
2020-06-07 20:13:15 +07:00
2022-02-25 19:20:45 +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 ( _eff sort2d ) Less ( i , j int ) bool { _cab , _ccb := _eff [ i ] , _eff [ j ] ; _adc , _eacc := _cab . _eg , _ccb . _eg ; _cecc , _fbe := len ( _adc ) - 1 , len ( _eacc ) - 1 ; _cdg , _ecd := 0 , 0 ; for { _bef , _bffd , _eee , _cge , _abf , _afa , _cdd , _fac := _adc [ _cdg ] . _bg , _eacc [ _ecd ] . _bg , _adc [ _cdg ] . _fgc , _eacc [ _ecd ] . _fgc , _adc [ _cdg ] . _ffa , _eacc [ _ecd ] . _ffa , _adc [ _cdg ] . _da , _eacc [ _ecd ] . _da ; if _bef == _bffd || ( ( _cd . Abs ( float64 ( _bef ) - float64 ( _bffd ) ) < _ega ) && ( ( _bef >= _bffd && _bef <= _cge ) || ( _bffd >= _bef && _bffd <= _eee ) ) && ( _cdd < _afa || _abf > _fac ) ) { if _abf == _afa { if _cdg < _cecc && _ecd < _fbe { _cdg ++ ; _ecd ++ ; continue ; } ; if _cdg >= _cecc && _ecd >= _fbe { break ; } ; return _cdg >= _cecc ; } else { return _abf < _afa ; } ; } else { return _bef < _bffd ; } ; } ; _fgac , _gfca , _dfeg , _eeb := _cab . _ff , _ccb . _ff , _cab . _bfa , _ccb . _bfa ; if _fgac == _gfca { return _dfeg <= _eeb ; } ; return _fgac < _gfca ; } ;
2017-10-03 09:55:27 -05:00
2022-02-25 19:20:45 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _cdb ViewProperties ) NotesViewPr ( ) * _dc . CT_NotesViewProperties { return _cdb . _gecd . NotesViewPr } ;
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.
2022-02-25 19:20:45 +00:00
func ( _agae SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _cgc := map [ string ] int { } ; _dff := [ ] SlideLayout { } ; for _ , _bdf := range _agae . _cfdg . Relationships ( ) { _cggg := _d . Replace ( _bdf . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ; _cggg = _d . Replace ( _cggg , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _adaa , _gcba := _ce . ParseInt ( _cggg , 10 , 32 ) ; _gcba == nil { _cgc [ _bdf . ID ( ) ] = int ( _adaa ) ; } ; } ; for _ , _egcgd := range _agae . _egcg . SldLayoutIdLst . SldLayoutId { if _caaf , _dfec := _cgc [ _egcgd . RIdAttr ] ; _dfec { _dcec := _agae . _ccgf . _cgd [ _caaf - 1 ] ; _dff = append ( _dff , SlideLayout { _dcec } ) ; } ; } ; return _dff ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// Type returns the type of the slide layout.
func ( _ede SlideLayout ) Type ( ) _dc . ST_SlideLayoutType { return _ede . _feec . TypeAttr } ;
2020-12-17 22:07:08 +00:00
2022-01-15 21:17:38 +00:00
// X returns the inner wrapped XML type.
2022-02-25 19:20:45 +00:00
func ( _fggc PresentationProperties ) X ( ) * _dc . PresentationPr { return _fggc . _ddc } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _cebb * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _cdge := range _cebb . _cgd { if _cdge . CSld . NameAttr != nil && name == * _cdge . CSld . NameAttr { return SlideLayout { _cdge } , nil ; } ; } ; return SlideLayout { } , _fb . 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-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _gcg TextBox ) X ( ) * _dc . CT_Shape { return _gcg . _dbef } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _bdc ViewProperties ) OutlineViewPr ( ) * _dc . CT_OutlineViewProperties { return _bdc . _gecd . OutlineViewPr ; } ;
2021-01-04 16:11:39 +00:00
2022-02-25 19:20:45 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _agc * Presentation ) Close ( ) error { if _agc . TmpPath != "" { return _gf . RemoveAll ( _agc . TmpPath ) ; } ; return nil ; } ; const _ega float64 = 500000 ;
2021-03-16 20:51:18 +00:00
2022-02-25 19:20:45 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _fgacc * Presentation ) GetImageByRelID ( relID string ) ( _ebb . ImageRef , bool ) { for _ , _ceg := range _fgacc . Images { if _ceg . RelID ( ) == relID { return _ceg , true ; } ; } ; return _ebb . ImageRef { } , false ; } ;
2021-03-16 20:51:18 +00:00
2022-02-25 19:20:45 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _bfg := _fgd ( ) ; _bfg . 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" ) ; _bfg . 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" ) ; _bfg . 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" ) ; _bfg . 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" ) ; _bfg . 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" ) ; _bfg . 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" ) ; _bfg . 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 \ u006
2021-04-23 20:00:00 +00:00
2022-02-25 19:20:45 +00:00
// ShowPr returns the ShowPr property.
func ( _cfda PresentationProperties ) ShowPr ( ) * _dc . CT_ShowProperties { return _cfda . _ddc . ShowPr } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _defb TextBox ) SetOffsetX ( offX float64 ) { _cff := _defb . getOff ( ) ; _ecca := _ef . ToEMU ( offX ) ; _cff . XAttr = _a . ST_Coordinate { ST_CoordinateUnqualified : & _ecca } ; } ;
2021-05-31 16:22:30 +00:00
2022-02-25 19:20:45 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _acfe ViewProperties ) LastViewAttr ( ) _dc . ST_ViewType { return _acfe . _gecd . LastViewAttr } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// ClrMru returns the ClrMru property.
func ( _ece PresentationProperties ) ClrMru ( ) * _a . CT_ColorMRU { return _ece . _ddc . ClrMru } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _aagb Slide ) AddImageToRels ( img _ebb . ImageRef ) string { _fda := 0 ; for _dgcb , _fdec := range _aagb . _ddf . Images { if _fdec == img { _fda = _dgcb + 1 ; break ; } ; } ; var _aeeac string ; for _dgce , _aaf := range _aagb . _ddf . Slides ( ) { if _aaf . _fafb == _aagb . _fafb { _fdfa := _ec . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _fda , img . Format ( ) ) ; _cceb := _aagb . _ddf . _gfe [ _dgce ] . AddRelationship ( _fdfa , _dd . ImageType ) ; _aeeac = _cceb . ID ( ) ; } ; } ; return _aeeac ; } ;
2021-09-22 16:41:01 +00:00
2022-01-15 21:17:38 +00:00
// AddParagraph adds a new paragraph to a placeholder.
2022-02-25 19:20:45 +00:00
func ( _dge PlaceHolder ) AddParagraph ( ) _bf . Paragraph { _bdb := _bf . MakeParagraph ( _a . NewCT_TextParagraph ( ) ) ; _dge . _afca . TxBody . P = append ( _dge . _afca . TxBody . P , _bdb . X ( ) ) ; return _bdb ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _adeg * Presentation ) GetTableStyleById ( id string ) * _a . CT_TableStyle { _gfaf := _adeg . _gfb . TblStyle ( ) ; for _ , _ebe := range _gfaf { if _ebe . StyleIdAttr == id { return _ebe ; } ; } ; return nil ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _cae , _cfb := Open ( fn ) ; if _cfb != nil { return nil , _cfb ; } ; return _cae , nil ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _add , _efd := _ea . Open ( filename ) ; if _efd != nil { return nil , _ec . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _efd ) ; } ; defer _add . Close ( ) ; _adca , _efd := _ea . Stat ( filename ) ; if _efd != nil { return nil , _ec . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _efd ) ; } ; _ = _adca ; return Read ( _add , _adca . Size ( ) ) ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// Presentation is the a presentation base document.
type Presentation struct { _ebb . DocBase ; _bae * _dc . Presentation ; _deb _ebb . Relationships ; _cad [ ] * _dc . Sld ; _gfe [ ] _ebb . Relationships ; _ddd [ ] * _dc . SldMaster ; _bba [ ] _ebb . Relationships ; _cgd [ ] * _dc . SldLayout ; _bbad [ ] _ebb . Relationships ; _beg [ ] * _a . Theme ; _dcab [ ] _ebb . Relationships ; _gfb _ebb . TableStyles ; _eefa PresentationProperties ; _fgab ViewProperties ; _dgfe [ ] * _a . CT_Hyperlink ; _ffea [ ] * chart ; _gab [ ] * _dc . HandoutMaster ; _bdd [ ] * _dc . NotesMaster ; _fab [ ] * _dd . XSDAny ; _caf map [ string ] string ; _bga string ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// Properties returns the properties of the TextBox.
func ( _accd TextBox ) Properties ( ) _bf . ShapeProperties { if _accd . _dbef . SpPr == nil { _accd . _dbef . SpPr = _a . NewCT_ShapeProperties ( ) ; } ; return _bf . MakeShapeProperties ( _accd . _dbef . SpPr ) ; } ;
2022-02-05 13:05:36 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
2022-02-25 19:20:45 +00:00
func ( _gbe PlaceHolder ) Paragraphs ( ) [ ] _bf . Paragraph { _cce := [ ] _bf . Paragraph { } ; for _ , _efa := range _gbe . _afca . TxBody . P { _cce = append ( _cce , _bf . MakeParagraph ( _efa ) ) ; } ; return _cce ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +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 ( _gge * Slide ) GetColorBySchemeColor ( schClr _a . ST_SchemeColorVal ) * _a . CT_Color { _gge . ensureClrMap ( ) ; _ccce := _gge . _geff ; if _ccce == nil { return nil ; } ; var _effc _a . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _effc = _ccce . Bg1Attr ; case "\u0062\u0067\u0032" : _effc = _ccce . Bg2Attr ; case "\u0074\u0078\u0031" : _effc = _ccce . Tx1Attr ; case "\u0074\u0078\u0032" : _effc = _ccce . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _effc = _ccce . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _effc = _ccce . Accent2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _effc = _ccce . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _effc = _ccce . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _effc = _ccce . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _effc = _ccce . Accent6Attr ; case "\u0068\u006c\u0069n\u006b" : _effc = _ccce . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _effc = _ccce . FolHlinkAttr ; case "\u0064\u006b\u0031" : _effc = _a . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _effc = _a . ST_ColorSchemeIndexDk2 ; case "\u006c\u0074\u0031" : _effc = _a . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _effc = _a . ST_ColorSchemeIndexLt2 ; default : _effc = _a . ST_ColorSchemeIndexUnset ; } ; _bbaa := _gge . _ddf . _beg [ 0 ] ; _gcbb := _bbaa . ThemeElements ; if _gcbb == nil { return nil ; } ; var _ecde * _a . CT_Color ; _ggeg := _gcbb . ClrScheme ; switch _effc . String ( ) { case "\u0064\u006b\u0031" : _ecde = _ggeg . Dk1 ; case "\u0064\u006b\u0032" : _ecde = _ggeg . Dk2 ; case "\u006c\u0074\u0031" : _ecde = _ggeg . Lt1 ; case "\u006c\u0074\u0032" : _ecde = _ggeg . Lt2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _ecde = _ggeg . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _ecde = _ggeg . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _ecde = _ggeg . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _ecde = _ggeg . Accent4 ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _ecde = _ggeg . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _ecde = _ggeg . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _ecde = _ggeg . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _ecde = _ggeg . FolHlink ; default : return nil ; } ; return _ecde ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _eagb * Presentation ) RemoveSlide ( s Slide ) error { _fbf := false ; _acfa := 0 ; for _edg , _bed := range _eagb . _cad { if _bed == s . _fafb { if _eagb . _bae . SldIdLst . SldId [ _edg ] != s . _gbad { return _fb . 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 ( _eagb . _cad [ _edg : ] , _eagb . _cad [ _edg + 1 : ] ) ; _eagb . _cad = _eagb . _cad [ 0 : len ( _eagb . _cad ) - 1 ] ; copy ( _eagb . _gfe [ _edg : ] , _eagb . _gfe [ _edg + 1 : ] ) ; _eagb . _gfe = _eagb . _gfe [ 0 : len ( _eagb . _gfe ) - 1 ] ; copy ( _eagb . _bae . SldIdLst . SldId [ _edg : ] , _eagb . _bae . SldIdLst . SldId [ _edg + 1 : ] ) ; _eagb . _bae . SldIdLst . SldId = _eagb . _bae . SldIdLst . SldId [ 0 : len ( _eagb . _bae . SldIdLst . SldId ) - 1 ] ; _fbf = true ; _acfa = _edg ; } ; } ; if ! _fbf { return _fb . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ; } ; _dfc := _dd . AbsoluteFilename ( _dd . DocTypePresentation , _dd . SlideType , 0 ) ; return _eagb . ContentTypes . RemoveOverrideByIndex ( _dfc , _acfa ) ; } ;
2021-09-22 16:41:01 +00:00
2022-02-25 19:20:45 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _fgge * PresentationText ) Text ( ) string { _cdf := _gbg . NewBuffer ( [ ] byte { } ) ; for _ , _cec := range _fgge . Slides { _cdf . WriteString ( _cec . Text ( ) ) ; } ; return _cdf . String ( ) ; } ; func ( _dfe sort2d ) Swap ( i , j int ) { _dfe [ i ] , _dfe [ j ] = _dfe [ j ] , _dfe [ i ] } ;
2021-11-10 11:45:21 +00:00
2022-02-25 19:20:45 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _cfd * SlideText ) Text ( ) string { _eda := _gbg . NewBuffer ( [ ] byte { } ) ; for _ , _fcbg := range _cfd . Items { if _fcbg . Text != "" { _eda . WriteString ( _fcbg . Text ) ; _eda . WriteString ( "\u000a" ) ; } ; } ; return _eda . String ( ) ; } ; type chart struct { _eac * _c . ChartSpace ; _fga string ; _ag string ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// Themes returns an array of presentation themes.
func ( _ggff * Presentation ) Themes ( ) [ ] * _a . Theme { return _ggff . _beg } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// X returns the inner wrapped XML type.
func ( _bdgcd Slide ) X ( ) * _dc . Sld { return _bdgcd . _fafb } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +00:00
// Read reads a document from an io.Reader.
func Read ( r _b . ReaderAt , size int64 ) ( * Presentation , error ) { const _ecdg = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _df . GetLicenseKey ( ) . IsLicensed ( ) && ! _dbgd { _ec . 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" ) ; _ec . 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 , _fb . 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" ) ; } ; _cege := _fgd ( ) ; _gfad , _aaaa := _df . GenRefId ( "\u0070\u0072" ) ; if _aaaa != nil { _gb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _aaaa ) ; return nil , _aaaa ; } ; _cege . _bga = _gfad ; if _ded := _df . Track ( _cege . _bga , _ecdg ) ; _ded != nil { _gb . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _ded ) ; return nil , _ded ; } ; _agge , _aaaa := _gf . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ; if _aaaa != nil { return nil , _aaaa ; } ; _cege . TmpPath = _agge ; _fde , _aaaa := _ee . NewReader ( r , size ) ; if _aaaa != nil { return nil , _ec . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _aaaa ) ; } ; _gba := [ ] * _ee . File { } ; _gba = append ( _gba , _fde . File ... ) ; _fce := false ; for _ , _egeg := range _gba { if _egeg . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _fce = true ; break ; } ; } ; if _fce { _cege . CreateCustomProperties ( ) ; } ; _becc := _e . DecodeMap { } ; _becc . SetOnNewRelationshipFunc ( _cege . onNewRelationship ) ; _becc . AddTarget ( _dd . ContentTypesFilename , _cege . ContentTypes . X ( ) , "" , 0 ) ; _becc . AddTarget ( _dd . BaseRelsFilename , _cege . Rels . X ( ) , "" , 0 ) ; if _aba := _becc . Decode ( _gba ) ; _aba != nil { return nil , _aba ; } ; for _ , _gbddc := range _gba { if _gbddc == nil { continue ; } ; if _gaf := _cege . AddExtraFileFromZip ( _gbddc ) ; _gaf != nil { return nil , _gaf ; } ; } ; if _fce { _afaa := false ; for _ , _fgcg := range _cege . Rels . X ( ) . Relationship { if _fgcg . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _afaa = true ; break ; } ; } ; if ! _afaa { _cege . AddCustomRelationships ( ) ; } ; } ; return _cege , nil ; } ; func _ffg ( _bfaf * Presentation , _egc [ ] * _dc . CT_GroupShapeChoice , _ad [ ] rectangle , _dgfc [ ] * TextItem ) [ ] * TextItem { for _ , _ffe := range _egc { _be := append ( [ ] rectangle { } , _ad ... ) ; for _ , _fgcf := range _ffe . Sp { _dgfc = append ( _dgfc , _bfad ( _bfaf , _fgcf , nil , nil , _fgcf . SpPr . Xfrm , 0 , _ad , _fgcf . TxBody . P ) ... ) ; } ; for _ , _gg := range _ffe . GraphicFrame { if _gg != nil && _gg . Graphic != nil && _gg . Graphic . GraphicData != nil { _cg := _gg . Xfrm ; for _ , _cca := range _gg . Graphic . GraphicData . Any { if _bc , _eeaf := _cca . ( * _a . Tbl ) ; _eeaf { _db := & _bc . CT_Table ; _de := 0 ; for _fa , _gbd := range _bc . Tr { for _ed , _dba := range _gbd . Tc { _cee := & TableInfo { Table : _db , Row : _gbd , Cell : _dba , RowIndex : _fa , ColIndex : _ed } ; _dgfc = append ( _dgfc , _bfad ( _bfaf , nil , _gg , _cee , _cg , _de , _ad , _dba . TxBody . P ) ... ) ; _de ++ ; } ; } ; } ; } ; } ; } ; for _ , _ga := range _ffe . GrpSp { if _ga . GrpSpPr != nil { _ecf := _ga . GrpSpPr . Xfrm ; var _ae , _dgg int64 ; if _ecf . Off != nil { _bcb , _eef := _ecf . Off . XAttr . ST_CoordinateUnqualified , _ecf . Off . YAttr . ST_CoordinateUnqualified ; if _bcb != nil && _eef != nil { if _ac := _ecf . Ext ; _ac != nil { _ae , _dgg = _ac . CxAttr , _ac . CyAttr ; } ; _be = append ( _be , rectangle { _ffa : * _bcb , _bg : * _eef , _da : * _bcb + _ae , _fgc : * _eef + _dgg } ) ; } ; } ; } ; _dgfc = _ffg ( _bfaf , _ga . Choice , _be , _dgfc ) ; } ; } ; return _dgfc ; } ;
2022-02-05 13:05:36 +00:00
2022-02-25 19:20:45 +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 * _dc . CT_Shape ; GraphicFrame * _dc . CT_GraphicalObjectFrame ; Paragraph * _a . CT_TextParagraph ; Run * _a . CT_RegularTextRun ; TableInfo * TableInfo ; _eg [ ] rectangle ; _ff int ; _bfa int ; } ;