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/
2024-02-17 03:37:07 +00:00
package presentation ; import ( _de "archive/zip" ; _cf "bytes" ; _dde "encoding/xml" ; _eb "errors" ; _bf "fmt" ; _fd "github.com/unidoc/unioffice" ; _cd "github.com/unidoc/unioffice/common" ; _ef "github.com/unidoc/unioffice/common/logger" ; _ca "github.com/unidoc/unioffice/common/tempstorage" ;
_ag "github.com/unidoc/unioffice/drawing" ; _da "github.com/unidoc/unioffice/internal/formatutils" ; _e "github.com/unidoc/unioffice/internal/license" ; _a "github.com/unidoc/unioffice/measurement" ; _bd "github.com/unidoc/unioffice/schema/soo/dml" ; _g "github.com/unidoc/unioffice/schema/soo/dml/chart" ;
_f "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _gg "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _db "github.com/unidoc/unioffice/schema/soo/pml" ; _gf "github.com/unidoc/unioffice/zippkg" ; _gfg "image" ; _ec "image/jpeg" ; _ea "io" ;
_efd "math" ; _eg "os" ; _b "path" ; _bb "sort" ; _dd "strconv" ; _d "strings" ; ) ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// Width returns slide screen size width in EMU units.
func ( _dcd * SlideScreenSize ) Width ( ) int32 { return _dcd [ 0 ] } ; func ( _degc * Slide ) getSlideLayoutRels ( ) _cd . Relationships { _dfdd := _degc . _bfc ; for _accg , _gcaa := range _dfdd . SlideLayouts ( ) { if * _degc . GetSlideLayout ( ) . CSld == * _gcaa . _fffe . CSld { return _dfdd . _ddgc [ _accg ] ;
} ; } ; return _cd . Relationships { } ; } ;
2023-03-01 18:42:44 +00:00
2024-02-17 03:37:07 +00:00
// Slide represents a slide of a presentation.
type Slide struct { _egdg * _db . CT_SlideIdListEntry ; _dfee * _db . Sld ; _bfc * Presentation ; _bgbf * _bd . CT_ColorMapping ; } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template
func ( _gcf * Presentation ) SaveAsTemplate ( w _ea . Writer ) error { return _gcf . save ( w , true ) } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// OpenTemplate opens a template file.
func OpenTemplate ( fn string ) ( * Presentation , error ) { _gb , _bgb := Open ( fn ) ; if _bgb != nil { return nil , _bgb ; } ; return _gb , nil ; } ; func ( _ddec * Presentation ) nextSlideID ( ) uint32 { _bgfb := uint32 ( 256 ) ; for _ , _agfg := range _ddec . _bec . SldIdLst . SldId { if _agfg . IdAttr >= _bgfb { _bgfb = _agfg . IdAttr + 1 ;
} ; } ; return _bgfb ; } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// SetTextAnchor controls the text anchoring
func ( _ddfb TextBox ) SetTextAnchor ( a _bd . ST_TextAnchoringType ) { _ddfb . _ebag . TxBody . BodyPr = _bd . NewCT_TextBodyProperties ( ) ; _ddfb . _ebag . TxBody . BodyPr . AnchorAttr = a ; } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// Slides returns the slides in the presentation.
func ( _gbc * Presentation ) Slides ( ) [ ] Slide { _ddgb := [ ] Slide { } ; for _eeaa , _gccb := range _gbc . _gcec { _ddgb = append ( _ddgb , Slide { _gbc . _bec . SldIdLst . SldId [ _eeaa ] , _gccb , _gbc , nil } ) ; } ; return _ddgb ; } ;
2023-05-26 09:49:04 +00:00
2024-02-17 03:37:07 +00:00
// SorterViewPr returns the SorterViewPr property.
func ( _adb ViewProperties ) SorterViewPr ( ) * _db . CT_SlideSorterViewProperties { return _adb . _efda . SorterViewPr ; } ;
2023-07-04 11:04:03 +00:00
2024-02-17 03:37:07 +00:00
// ExtractText returns text from a slide as a SlideText object.
func ( _ac * Slide ) ExtractText ( ) * SlideText { _ff := _fb ( _ac . _bfc , _ac . _dfee . CSld . SpTree . Choice , [ ] rectangle { } , [ ] * TextItem { } ) ; _bb . Sort ( sort2d ( _ff ) ) ; return & SlideText { Items : _ff } ; } ; func ( _cdb * Presentation ) saveToFile ( _dbc string , _ccb bool ) error { _gge , _eca := _eg . Create ( _dbc ) ;
if _eca != nil { return _eca ; } ; defer _gge . Close ( ) ; return _cdb . save ( _gge , _ccb ) ; } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// AddParagraph adds a paragraph to the text box
func ( _aede TextBox ) AddParagraph ( ) _ag . Paragraph { _fabe := _bd . NewCT_TextParagraph ( ) ; _aede . _ebag . TxBody . P = append ( _aede . _ebag . TxBody . P , _fabe ) ; return _ag . MakeParagraph ( _fabe ) ; } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// SetSize sets the slide size, take argument of SlideScreenSize.
func ( _fdag * SlideSize ) SetSize ( sz SlideScreenSize ) { _fdag . _eage . CxAttr = sz [ 0 ] ; _fdag . _eage . CyAttr = sz [ 1 ] ; } ; func _ecd ( _cbf * Presentation , _cfe * _db . CT_Shape , _deg * _db . CT_GraphicalObjectFrame , _acf * TableInfo , _afgg * _bd . CT_Transform2D , _eff int , _ccaf [ ] rectangle , _agc [ ] * _bd . CT_TextParagraph ) [ ] * TextItem { _bdc := [ ] * TextItem { } ;
var _ada , _fa , _bae , _bgg , _ae , _cab int64 ; _be := _afgg == nil ; _fe := 0 ; for _ , _cdc := range _agc { for _ , _ddg := range _cdc . EG_TextRun { if _dae := _ddg . R ; _dae != nil { if ! _be { if _afgg . Off != nil { if _daa := _afgg . Ext ; _daa != nil { _ae , _cab = _daa . CxAttr , _daa . CyAttr ;
} ; if _effa := _afgg . Off . XAttr . ST_CoordinateUnqualified ; _effa != nil { _ada = * _effa ; _fa = _ada + _ae ; _be = true ; } ; if _dfc := _afgg . Off . YAttr . ST_CoordinateUnqualified ; _dfc != nil { _bae = * _dfc ; _bgg = _bae + _cab ; _be = true ; } ; } ; } ; _def := append ( [ ] rectangle { } , _ccaf ... ) ;
_def = append ( _def , rectangle { _aff : _ada , _bg : _fa , _afga : _bae , _gc : _bgg } ) ; _bdc = append ( _bdc , & TextItem { Presentation : _cbf , Shape : _cfe , GraphicFrame : _deg , TableInfo : _acf , Paragraph : _cdc , Run : _dae , Text : _dae . T , _bfd : _def , _afg : _eff , _deb : _fe } ) ;
_fe ++ ; } ; } ; } ; return _bdc ; } ;
2022-01-15 21:17:38 +00:00
2024-02-17 03:37:07 +00:00
// Remove removes a placeholder from a presentation.
func ( _bgbd PlaceHolder ) Remove ( ) error { for _fdf , _cfa := range _bgbd . _ddae . CSld . SpTree . Choice { for _ , _gce := range _cfa . Sp { if _gce == _bgbd . _bggb { copy ( _bgbd . _ddae . CSld . SpTree . Choice [ _fdf : ] , _bgbd . _ddae . CSld . SpTree . Choice [ _fdf + 1 : ] ) ; _bgbd . _ddae . CSld . SpTree . Choice = _bgbd . _ddae . CSld . SpTree . Choice [ 0 : len ( _bgbd . _ddae . CSld . SpTree . Choice ) - 1 ] ;
return nil ; } ; } ; } ; return _eb . 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" ) ; } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// GetTableStyleById returns *dml.CT_TableStyle by its style id.
func ( _fcb * Presentation ) GetTableStyleById ( id string ) * _bd . CT_TableStyle { _bdgd := _fcb . _ecef . TblStyle ( ) ; for _ , _gcaf := range _bdgd { if _gcaf . StyleIdAttr == id { return _gcaf ; } ; } ; return nil ; } ;
2020-11-09 01:00:18 +00:00
2024-02-17 03:37:07 +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 ( _cde * Presentation ) AddDefaultSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _fgd , _gbb := _cde . AddSlideWithLayout ( l ) ; for _ , _daad := range _fgd . PlaceHolders ( ) { _daad . Clear ( ) ; switch _daad . Type ( ) { case _db . ST_PlaceholderTypeFtr , _db . ST_PlaceholderTypeDt , _db . ST_PlaceholderTypeSldNum : _daad . Remove ( ) ;
} ; } ; return _fgd , _gbb ; } ;
2021-03-16 20:51:18 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _fdc Slide ) X ( ) * _db . Sld { return _fdc . _dfee } ;
// Presentation is the a presentation base document.
type Presentation struct { _cd . DocBase ; _bec * _db . Presentation ; _ddcc _cd . Relationships ; _gcec [ ] * _db . Sld ; _gcb [ ] _cd . Relationships ; _abb [ ] * _db . SldMaster ; _edd [ ] _cd . Relationships ; _cee [ ] * _db . SldLayout ; _ddgc [ ] _cd . Relationships ; _bebg [ ] * _bd . Theme ;
_cfb [ ] _cd . Relationships ; _ecef _cd . TableStyles ; _bbg PresentationProperties ; _eba ViewProperties ; _ffc [ ] * _bd . CT_Hyperlink ; _abd [ ] * chart ; _fee [ ] * _db . HandoutMaster ; _gdb [ ] * _db . NotesMaster ; _agg [ ] * _fd . XSDAny ; _bgc map [ string ] string ; _cge string ;
} ;
// SlideSize represents a slide size of a presentation.
type SlideSize struct { _eage * _db . CT_SlideSize ; _aeac * Presentation ; } ;
2023-05-26 09:49:04 +00:00
2023-12-28 15:53:06 +00:00
// SlideScreenSize represents the slide screen size as a 2 element array
// representing the width and height in EMU units.
type SlideScreenSize [ 2 ] int32 ;
2022-02-25 19:20:45 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _aeb SlideLayout ) X ( ) * _db . SldLayout { return _aeb . _fffe } ; func _dgb ( ) * Presentation { _cce := & Presentation { _bec : _db . NewPresentation ( ) } ; _cce . _bec . SldIdLst = _db . NewCT_SlideIdList ( ) ; _cce . _bec . ConformanceAttr = _f . ST_ConformanceClassTransitional ;
_cce . AppProperties = _cd . NewAppProperties ( ) ; _cce . CoreProperties = _cd . NewCoreProperties ( ) ; _cce . _ecef = _cd . NewTableStyles ( ) ; _cce . ContentTypes = _cd . NewContentTypes ( ) ; _cce . Rels = _cd . NewRelationships ( ) ; _cce . _ddcc = _cd . NewRelationships ( ) ; _cce . _bbg = NewPresentationProperties ( ) ;
_cce . _eba = NewViewProperties ( ) ; _cce . _bgc = map [ string ] string { } ; return _cce ; } ; type sort2d [ ] * TextItem ; func ( _gdd * Slide ) getSlideRels ( ) _cd . Relationships { _ebfg := _gdd . _bfc ; for _deef , _fad := range _ebfg . Slides ( ) { if * _gdd . _dfee == * _fad . _dfee { return _ebfg . _gcb [ _deef ] ;
} ; } ; return _cd . Relationships { } ; } ; func ( _fdb sort2d ) Len ( ) int { return len ( _fdb ) } ;
2021-08-23 20:44:48 +00:00
2024-02-17 03:37:07 +00:00
// ClrMru returns the ClrMru property.
func ( _fga PresentationProperties ) ClrMru ( ) * _bd . CT_ColorMRU { return _fga . _eee . ClrMru } ;
2021-11-10 11:45:21 +00:00
2024-02-17 03:37:07 +00:00
// SlideLayout is a layout from which slides can be created.
type SlideLayout struct { _fffe * _db . SldLayout } ;
2021-06-16 07:10:52 +00:00
2024-02-17 03:37:07 +00:00
// NotesTextViewPr returns the NotesTextViewPr property.
func ( _dbf ViewProperties ) NotesTextViewPr ( ) * _db . CT_NotesTextViewProperties { return _dbf . _efda . NotesTextViewPr ; } ;
2021-01-04 16:11:39 +00:00
2024-02-17 03:37:07 +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 ( _eagd Slide ) GetPlaceholder ( t _db . ST_PlaceholderType ) ( PlaceHolder , error ) { for _ , _ffda := range _eagd . _dfee . CSld . SpTree . Choice { for _ , _aafd := range _ffda . Sp { if _aafd . NvSpPr != nil && _aafd . NvSpPr . NvPr != nil && _aafd . NvSpPr . NvPr . Ph != nil { if _aafd . NvSpPr . NvPr . Ph . TypeAttr == t { return PlaceHolder { _aafd , _eagd . _dfee } , nil ;
} ; } ; } ; } ; return PlaceHolder { } , _eb . 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 ( _fdg * chart ) RelId ( ) string { return _fdg . _dba } ;
2021-01-04 16:11:39 +00:00
2024-02-17 03:37:07 +00:00
// Save writes the presentation out to a writer in the Zip package format
func ( _eab * Presentation ) Save ( w _ea . Writer ) error { return _eab . save ( w , false ) } ;
2021-01-04 16:11:39 +00:00
2024-02-17 03:37:07 +00:00
// GetSlideLayout returns a slide layout related to the slide.
func ( _egac * Slide ) GetSlideLayout ( ) * _db . SldLayout { _ecc := _egac . getSlideRels ( ) ; for _ , _bfa := range _ecc . Relationships ( ) { if _bfa . Type ( ) == _fd . SlideLayoutType { if _ccge , _dcf := _da . StringToNumbers ( _bfa . Target ( ) ) ; _dcf { return _egac . _bfc . _cee [ _ccge - 1 ] ;
} ; return nil ; } ; } ; return nil ; } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// Sid returns the sid of slide
func ( _baddd Slide ) Sid ( ) * _db . CT_SlideIdListEntry { return _baddd . _egdg } ;
2022-01-15 21:17:38 +00:00
2024-02-17 03:37:07 +00:00
// AddTextBox adds an empty textbox to a slide.
func ( _dec Slide ) AddTextBox ( ) TextBox { _cdce := _db . NewCT_GroupShapeChoice ( ) ; _dec . _dfee . CSld . SpTree . Choice = append ( _dec . _dfee . CSld . SpTree . Choice , _cdce ) ; _adf := _db . NewCT_Shape ( ) ; _cdce . Sp = append ( _cdce . Sp , _adf ) ; _adf . SpPr = _bd . NewCT_ShapeProperties ( ) ;
_adf . SpPr . Xfrm = _bd . NewCT_Transform2D ( ) ; _adf . SpPr . PrstGeom = _bd . NewCT_PresetGeometry2D ( ) ; _adf . SpPr . PrstGeom . PrstAttr = _bd . ST_ShapeTypeRect ; _adf . NvSpPr = _db . NewCT_ShapeNonVisual ( ) ; _adf . NvSpPr . CNvSpPr = _bd . NewCT_NonVisualDrawingShapeProps ( ) ;
_eec := true ; _adf . NvSpPr . CNvSpPr . TxBoxAttr = & _eec ; _adf . TxBody = _bd . NewCT_TextBody ( ) ; _adf . TxBody . BodyPr = _bd . NewCT_TextBodyProperties ( ) ; _adf . TxBody . BodyPr . WrapAttr = _bd . ST_TextWrappingTypeSquare ; _adf . TxBody . BodyPr . SpAutoFit = _bd . NewCT_TextShapeAutofit ( ) ;
_edff := TextBox { _adf } ; _edff . Properties ( ) . SetWidth ( 3 * _a . Inch ) ; _edff . Properties ( ) . SetHeight ( 1 * _a . Inch ) ; _edff . Properties ( ) . SetPosition ( 0 , 0 ) ; return _edff ; } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// Text returns text from a slide as one string separated with line breaks.
func ( _beg * SlideText ) Text ( ) string { _cba := _cf . NewBuffer ( [ ] byte { } ) ; for _ , _ega := range _beg . Items { if _ega . Text != "" { _cba . WriteString ( _ega . Text ) ; _cba . WriteString ( "\u000a" ) ; } ; } ; return _cba . String ( ) ; } ;
2022-02-25 19:20:45 +00:00
2023-12-28 15:53:06 +00:00
// X returns the inner wrapped XML type.
2024-02-17 03:37:07 +00:00
func ( _fac * Presentation ) X ( ) * _db . Presentation { return _fac . _bec } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// OutlineViewPr returns the OutlineViewPr property.
func ( _dbca ViewProperties ) OutlineViewPr ( ) * _db . CT_OutlineViewProperties { return _dbca . _efda . OutlineViewPr ; } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// Type returns the placeholder type
func ( _feg PlaceHolder ) Type ( ) _db . ST_PlaceholderType { return _feg . _bggb . NvSpPr . NvPr . Ph . TypeAttr } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// Height returns slide screen size height in EMU units.
func ( _ccafd * SlideScreenSize ) Height ( ) int32 { return _ccafd [ 1 ] } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _dade * SlideSize ) X ( ) * _db . CT_SlideSize { return _dade . _eage } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +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 ( _acg * Presentation ) AddImage ( i _cd . Image ) ( _cd . ImageRef , error ) { _fca := _cd . MakeImageRef ( i , & _acg . DocBase , _acg . _ddcc ) ; if i . Data == nil && i . Path == "" { return _fca , _eb . 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 _fca , _eb . 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 _fca , _eb . 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 != "" { _fff := _ca . Add ( i . Path ) ; if _fff != nil { return _fca , _fff ; } ; } ; _acg . Images = append ( _acg . Images , _fca ) ; _acg . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _acg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ;
_acg . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _acg . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _acg . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ;
return _fca , nil ; } ;
2020-08-23 14:15:53 +00:00
2024-02-17 03:37:07 +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 ( _fae PlaceHolder ) SetText ( text string ) { _fae . Clear ( ) ; _efg := _bd . NewEG_TextRun ( ) ; _efg . R = _bd . NewCT_RegularTextRun ( ) ; _efg . R . T = text ; if len ( _fae . _bggb . TxBody . P ) == 0 { _fae . _bggb . TxBody . P = append ( _fae . _bggb . TxBody . P , _bd . NewCT_TextParagraph ( ) ) ;
} ; _fae . _bggb . TxBody . P [ 0 ] . EG_TextRun = nil ; _fae . _bggb . TxBody . P [ 0 ] . EG_TextRun = append ( _fae . _bggb . TxBody . P [ 0 ] . EG_TextRun , _efg ) ; } ;
2021-04-23 20:00:00 +00:00
2024-02-17 03:37:07 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// slide.
func ( _dgag * Slide ) GetChartSpaceByRelId ( relId string ) * _g . ChartSpace { _ddde := _dgag . getSlideRels ( ) ; if ( _ddde == _cd . Relationships { } ) { return nil ; } ; _egb := _ddde . GetTargetByRelId ( relId ) ; for _ , _fecdc := range _dgag . _bfc . _abd { if _egb == _fecdc . Target ( ) { return _fecdc . _af ;
} ; } ; return nil ; } ;
2020-06-07 20:13:15 +07:00
2024-02-17 03:37:07 +00:00
// ValidateWithPath validates the slide passing path informaton for a better
// error message.
func ( _agfe Slide ) ValidateWithPath ( path string ) error { if _ddb := _agfe . _dfee . ValidateWithPath ( path ) ; _ddb != nil { return _ddb ; } ; for _ , _gbgg := range _agfe . _dfee . CSld . SpTree . Choice { for _ , _daeb := range _gbgg . Sp { if _daeb . TxBody != nil { if len ( _daeb . TxBody . P ) == 0 { return _eb . 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 ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// SlideMasters returns the slide masters defined in the presentation.
func ( _ddgg * Presentation ) SlideMasters ( ) [ ] SlideMaster { _gfb := [ ] SlideMaster { } ; for _gbe , _ddf := range _ddgg . _abb { _gfb = append ( _gfb , SlideMaster { _ddgg , _ddgg . _edd [ _gbe ] , _ddf } ) ; } ; return _gfb ; } ;
2017-10-03 09:55:27 -05:00
2024-02-17 03:37:07 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _gbf * Presentation ) GetImageByRelID ( relID string ) ( _cd . ImageRef , bool ) { for _ , _ffa := range _gbf . Images { if _ffa . RelID ( ) == relID { return _ffa , true ; } ; } ; return _cd . ImageRef { } , false ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _faa PresentationProperties ) X ( ) * _db . PresentationPr { return _faa . _eee } ;
2021-01-04 16:11:39 +00:00
2023-12-28 15:53:06 +00:00
// PlaceHolder is a place holder from a slide.
2024-02-17 03:37:07 +00:00
type PlaceHolder struct { _bggb * _db . CT_Shape ; _ddae * _db . Sld ; } ;
2021-01-04 16:11:39 +00:00
2024-02-17 03:37:07 +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 ( _edfff * Slide ) GetColorBySchemeColor ( schClr _bd . ST_SchemeColorVal ) * _bd . CT_Color { _edfff . ensureClrMap ( ) ; _gba := _edfff . _bgbf ; if _gba == nil { return nil ; } ; var _aegc _bd . ST_ColorSchemeIndex ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _aegc = _gba . Bg1Attr ;
case "\u0062\u0067\u0032" : _aegc = _gba . Bg2Attr ; case "\u0074\u0078\u0031" : _aegc = _gba . Tx1Attr ; case "\u0074\u0078\u0032" : _aegc = _gba . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _aegc = _gba . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _aegc = _gba . Accent2Attr ;
case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _aegc = _gba . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _aegc = _gba . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _aegc = _gba . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _aegc = _gba . Accent6Attr ;
case "\u0068\u006c\u0069n\u006b" : _aegc = _gba . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _aegc = _gba . FolHlinkAttr ; case "\u0064\u006b\u0031" : _aegc = _bd . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _aegc = _bd . ST_ColorSchemeIndexDk2 ;
case "\u006c\u0074\u0031" : _aegc = _bd . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _aegc = _bd . ST_ColorSchemeIndexLt2 ; default : _aegc = _bd . ST_ColorSchemeIndexUnset ; } ; _bgca := _edfff . _bfc . _bebg [ 0 ] ; _dgg := _bgca . ThemeElements ; if _dgg == nil { return nil ;
} ; var _abca * _bd . CT_Color ; _dafb := _dgg . ClrScheme ; switch _aegc . String ( ) { case "\u0064\u006b\u0031" : _abca = _dafb . Dk1 ; case "\u0064\u006b\u0032" : _abca = _dafb . Dk2 ; case "\u006c\u0074\u0031" : _abca = _dafb . Lt1 ; case "\u006c\u0074\u0032" : _abca = _dafb . Lt2 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _abca = _dafb . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _abca = _dafb . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _abca = _dafb . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _abca = _dafb . Accent4 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _abca = _dafb . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _abca = _dafb . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _abca = _dafb . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _abca = _dafb . FolHlink ;
default : return nil ; } ; return _abca ; } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// NormalViewPr returns the NormalViewPr property.
func ( _cdca ViewProperties ) NormalViewPr ( ) * _db . CT_NormalViewProperties { return _cdca . _efda . NormalViewPr ; } ;
2021-05-31 16:22:30 +00:00
2024-02-17 03:37:07 +00:00
// Close closes the presentation, removing any temporary files that might have been
// created when opening a document.
func ( _eae * Presentation ) Close ( ) error { if _eae . TmpPath != "" { return _ca . RemoveAll ( _eae . TmpPath ) ; } ; return nil ; } ;
2022-09-02 11:46:53 +00:00
2024-02-17 03:37:07 +00:00
// AddSlide adds a new slide to the presentation.
func ( _abag * Presentation ) AddSlide ( ) Slide { _efad := _db . NewCT_SlideIdListEntry ( ) ; _efad . IdAttr = _abag . nextSlideID ( ) ; _abag . _bec . SldIdLst . SldId = append ( _abag . _bec . SldIdLst . SldId , _efad ) ; _cdag := _db . NewSld ( ) ; _cdag . CSld . SpTree . NvGrpSpPr . CNvPr . IdAttr = 1 ;
_cdag . CSld . SpTree . GrpSpPr . Xfrm = _bd . NewCT_GroupTransform2D ( ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . Off = _bd . NewCT_Point2D ( ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _fd . Int64 ( 0 ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _fd . Int64 ( 0 ) ;
_cdag . CSld . SpTree . GrpSpPr . Xfrm . Ext = _bd . NewCT_PositiveSize2D ( ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . Ext . CxAttr = int64 ( 0 * _a . Point ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . Ext . CyAttr = int64 ( 0 * _a . Point ) ; _cdag . CSld . SpTree . GrpSpPr . Xfrm . ChOff = _cdag . CSld . SpTree . GrpSpPr . Xfrm . Off ;
_cdag . CSld . SpTree . GrpSpPr . Xfrm . ChExt = _cdag . CSld . SpTree . GrpSpPr . Xfrm . Ext ; _abag . _gcec = append ( _abag . _gcec , _cdag ) ; _aad := _abag . _ddcc . AddAutoRelationship ( _fd . DocTypePresentation , _fd . OfficeDocumentType , len ( _abag . _gcec ) , _fd . SlideType ) ;
_efad . RIdAttr = _aad . ID ( ) ; _ccg := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideType , len ( _abag . _gcec ) ) ; _abag . ContentTypes . AddOverride ( _ccg , _fd . SlideContentType ) ; _dffc := _cd . NewRelationships ( ) ; _abag . _gcb = append ( _abag . _gcb , _dffc ) ;
_dffc . AddAutoRelationship ( _fd . DocTypePresentation , _fd . SlideType , len ( _abag . _cee ) , _fd . SlideLayoutType ) ; return Slide { _efad , _cdag , _abag , nil } ; } ;
2022-09-02 11:46:53 +00:00
2024-02-17 03:37:07 +00:00
// Properties returns the properties of the TextBox.
func ( _dbb Image ) Properties ( ) _ag . ShapeProperties { if _dbb . _gag . SpPr == nil { _dbb . _gag . SpPr = _bd . NewCT_ShapeProperties ( ) ; } ; return _ag . MakeShapeProperties ( _dbb . _gag . SpPr ) ; } ;
2023-12-28 15:53:06 +00:00
2024-02-17 03:37:07 +00:00
// ExtractText returns text from a presentation as a PresentationText object.
func ( _dc * Presentation ) ExtractText ( ) * PresentationText { _cc := [ ] * SlideText { } ; for _ , _ba := range _dc . Slides ( ) { _bfe := _ba . ExtractText ( ) ; if _bfe != nil { _cc = append ( _cc , _bfe ) ; } ; } ; return & PresentationText { Slides : _cc } ; } ; func ( _afb * Presentation ) save ( _gdcf _ea . Writer , _bed bool ) error { const _geb = "\u0050\u0072\u0065\u0073en\u0074\u0061\u0074\u0069\u006f\u006e\u003a\u0070\u002e\u0053\u0061\u0076\u0065" ;
if _dca := _afb . _bec . Validate ( ) ; _dca != nil { _ef . 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" , _dca ) ;
} ; if ! _e . GetLicenseKey ( ) . IsLicensed ( ) && ! _gfce { _bf . 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" ) ; _bf . 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 _eb . 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 ( _afb . _cge ) == 0 { _fddf , _dge := _e . GenRefId ( "\u0070\u0077" ) ; if _dge != nil { _ef . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _dge ) ;
return _dge ; } ; _afb . _cge = _fddf ; } ; if _fbb := _e . Track ( _afb . _cge , _geb ) ; _fbb != nil { _ef . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _fbb ) ; return _fbb ; } ; if _bed { _afb . 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" ) ;
_afb . 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 { _afb . 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" ) ;
_afb . 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" ) ;
} ; _eeg := _fd . DocTypePresentation ; _fega := _de . NewWriter ( _gdcf ) ; defer _fega . Close ( ) ; if _fef := _gf . MarshalXML ( _fega , _fd . BaseRelsFilename , _afb . Rels . X ( ) ) ; _fef != nil { return _fef ; } ; if _cdec := _gf . MarshalXMLByType ( _fega , _eeg , _fd . ExtendedPropertiesType , _afb . AppProperties . X ( ) ) ;
_cdec != nil { return _cdec ; } ; if _gcbg := _gf . MarshalXMLByType ( _fega , _eeg , _fd . CorePropertiesType , _afb . CoreProperties . X ( ) ) ; _gcbg != nil { return _gcbg ; } ; if _bedc := _gf . MarshalXMLByType ( _fega , _eeg , _fd . PresentationPropertiesType , _afb . _bbg . X ( ) ) ;
_bedc != nil { return _bedc ; } ; if _baf := _gf . MarshalXMLByType ( _fega , _eeg , _fd . ViewPropertiesType , _afb . _eba . X ( ) ) ; _baf != nil { return _baf ; } ; if _afge := _gf . MarshalXMLByType ( _fega , _eeg , _fd . TableStylesType , _afb . _ecef . X ( ) ) ; _afge != nil { return _afge ;
} ; if _afb . CustomProperties . X ( ) != nil { if _egg := _gf . MarshalXMLByType ( _fega , _eeg , _fd . CustomPropertiesType , _afb . CustomProperties . X ( ) ) ; _egg != nil { return _egg ; } ; } ; if _afb . Thumbnail != nil { _bdf , _cbee := _fega . Create ( "\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067" ) ;
if _cbee != nil { return _cbee ; } ; if _ffba := _ec . Encode ( _bdf , _afb . Thumbnail , nil ) ; _ffba != nil { return _ffba ; } ; } ; _gfa := _fd . AbsoluteFilename ( _eeg , _fd . OfficeDocumentType , 0 ) ; if _cec := _gf . MarshalXML ( _fega , _gfa , _afb . _bec ) ; _cec != nil { return _cec ;
} ; if _bea := _gf . MarshalXML ( _fega , _gf . RelationsPathFor ( _gfa ) , _afb . _ddcc . X ( ) ) ; _bea != nil { return _bea ; } ; for _cac , _gdfa := range _afb . _gcec { _dcebd := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideType , _cac + 1 ) ; _gf . MarshalXML ( _fega , _dcebd , _gdfa ) ;
if ! _afb . _gcb [ _cac ] . IsEmpty ( ) { _accf := _gf . RelationsPathFor ( _dcebd ) ; _gf . MarshalXML ( _fega , _accf , _afb . _gcb [ _cac ] . X ( ) ) ; } ; } ; for _fggf , _cfbg := range _afb . _abb { _ebcd := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideMasterType , _fggf + 1 ) ;
_gf . MarshalXML ( _fega , _ebcd , _cfbg ) ; if ! _afb . _edd [ _fggf ] . IsEmpty ( ) { _dbea := _gf . RelationsPathFor ( _ebcd ) ; _gf . MarshalXML ( _fega , _dbea , _afb . _edd [ _fggf ] . X ( ) ) ; } ; } ; for _ebf , _eeeb := range _afb . _cee { _abad := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideLayoutType , _ebf + 1 ) ;
_gf . MarshalXML ( _fega , _abad , _eeeb ) ; if ! _afb . _ddgc [ _ebf ] . IsEmpty ( ) { _badd := _gf . RelationsPathFor ( _abad ) ; _gf . MarshalXML ( _fega , _badd , _afb . _ddgc [ _ebf ] . X ( ) ) ; } ; } ; for _cgb , _ddaee := range _afb . _bebg { _cfde := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . ThemeType , _cgb + 1 ) ;
_gf . MarshalXML ( _fega , _cfde , _ddaee ) ; if ! _afb . _cfb [ _cgb ] . IsEmpty ( ) { _cadc := _gf . RelationsPathFor ( _cfde ) ; _gf . MarshalXML ( _fega , _cadc , _afb . _cfb [ _cgb ] . X ( ) ) ; } ; } ; for _ecf , _gab := range _afb . _abd { _aae := _fd . AbsoluteFilename ( _eeg , _fd . ChartType , _ecf + 1 ) ;
_gf . MarshalXML ( _fega , _aae , _gab ) ; } ; for _fda , _eac := range _afb . _fee { _gca := _fd . AbsoluteFilename ( _eeg , _fd . HandoutMasterType , _fda + 1 ) ; _gf . MarshalXML ( _fega , _gca , _eac ) ; } ; for _caec , _fbeg := range _afb . _gdb { _bcf := _fd . AbsoluteFilename ( _eeg , _fd . NotesMasterType , _caec + 1 ) ;
_gf . MarshalXML ( _fega , _bcf , _fbeg ) ; } ; for _ddaf , _ddd := range _afb . _agg { _abde := _fd . AbsoluteFilename ( _eeg , _fd . CustomXMLType , _ddaf + 1 ) ; _gf . MarshalXML ( _fega , _abde , _ddd ) ; } ; for _afdd , _acd := range _afb . Images { _ecg := _afdd + 1 ; if _bgbg , _cfec := _da . StringToNumbers ( _acd . Target ( ) ) ;
_cfec && _ecg != _bgbg { _ecg = _bgbg ; } ; if _efe := _cd . AddImageToZip ( _fega , _acd , _ecg , _fd . DocTypePresentation ) ; _efe != nil { return _efe ; } ; } ; _afb . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _afb . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ;
_afb . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _afb . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; if _aga := _gf . MarshalXML ( _fega , _fd . ContentTypesFilename , _afb . ContentTypes . X ( ) ) ;
_aga != nil { return _aga ; } ; if _feae := _afb . WriteExtraFiles ( _fega ) ; _feae != nil { return _feae ; } ; return nil ; } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// HtmlPubPr returns the HtmlPubPr property.
func ( _baa PresentationProperties ) HtmlPubPr ( ) * _db . CT_HtmlPublishProperties { return _baa . _eee . HtmlPubPr ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +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 ( _ffe sort2d ) Less ( i , j int ) bool { _fgc , _cfd := _ffe [ i ] , _ffe [ j ] ; _ed , _egd := _fgc . _bfd , _cfd . _bfd ; _ggg , _aeg := len ( _ed ) - 1 , len ( _egd ) - 1 ; _cbe , _gdg := 0 , 0 ; for { _agda , _dda , _daf , _egc , _begc , _edb , _bc , _gggc := _ed [ _cbe ] . _afga , _egd [ _gdg ] . _afga , _ed [ _cbe ] . _gc , _egd [ _gdg ] . _gc , _ed [ _cbe ] . _aff , _egd [ _gdg ] . _aff , _ed [ _cbe ] . _bg , _egd [ _gdg ] . _bg ;
if _agda == _dda || ( ( _efd . Abs ( float64 ( _agda ) - float64 ( _dda ) ) < _ga ) && ( ( _agda >= _dda && _agda <= _egc ) || ( _dda >= _agda && _dda <= _daf ) ) && ( _bc < _edb || _begc > _gggc ) ) { if _begc == _edb { if _cbe < _ggg && _gdg < _aeg { _cbe ++ ; _gdg ++ ; continue ; } ; if _cbe >= _ggg && _gdg >= _aeg { break ;
} ; return _cbe >= _ggg ; } else { return _begc < _edb ; } ; } else { return _agda < _dda ; } ; } ; _fbf , _acc , _ege , _ffdf := _fgc . _afg , _cfd . _afg , _fgc . _deb , _cfd . _deb ; if _fbf == _acc { return _ege <= _ffdf ; } ; return _fbf < _acc ; } ; func ( _ce sort2d ) Swap ( i , j int ) { _ce [ i ] , _ce [ j ] = _ce [ j ] , _ce [ i ] } ;
2021-09-22 16:41:01 +00:00
2023-12-28 15:53:06 +00:00
2024-02-17 03:37:07 +00:00
// AddTable adds a new table to a placeholder.
func ( _dcge PlaceHolder ) AddTable ( ) * _cd . Table { _dcge . Clear ( ) ; _adc := _db . NewCT_GroupShapeChoice ( ) ; _dcge . _ddae . CSld . SpTree . Choice = append ( _dcge . _ddae . CSld . SpTree . Choice , _adc ) ; _gcc := _db . NewCT_GraphicalObjectFrame ( ) ; _adc . GraphicFrame = append ( _adc . GraphicFrame , _gcc ) ;
_gcc . Xfrm . Off = _bd . NewCT_Point2D ( ) ; _bdg := int64 ( 1 ) ; _gcc . Xfrm . Off . XAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _bdg } ; _gcc . Xfrm . Off . YAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _bdg } ; _ccd := _gcc . Graphic . CT_GraphicalObject . GraphicData ;
_ccd . 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" ;
_cea := _cd . NewTableWithXfrm ( _gcc . Xfrm ) ; _ccd . Any = append ( _ccd . Any , _cea . X ( ) ) ; return _cea ; } ;
2023-05-26 09:49:04 +00:00
2024-02-17 03:37:07 +00:00
// Index returns the placeholder index
func ( _ceg PlaceHolder ) Index ( ) uint32 { if _ceg . _bggb . NvSpPr . NvPr . Ph . IdxAttr == nil { return 0 ; } ; return * _ceg . _bggb . NvSpPr . NvPr . Ph . IdxAttr ; } ; type chart struct { _af * _g . ChartSpace ; _dba string ; _cg string ; } ; var _gfce = false ;
2023-12-28 15:53:06 +00:00
2024-02-17 03:37:07 +00:00
// ViewProperties contains presentation specific properties.
type ViewProperties struct { _efda * _db . ViewPr } ; func ( _ggef * Slide ) ensureClrMap ( ) { if len ( _ggef . _bfc . _abb ) == 0 || len ( _ggef . _bfc . _bebg ) == 0 { return ; } ; _ffdab := _ggef . _bfc . _abb [ 0 ] ; _bffe := _ffdab . ClrMap ; if _adad := _ggef . _dfee . ClrMapOvr ; _adad != nil { if _bdb := _adad . Choice ;
_bdb != nil { if _bdb . MasterClrMapping == nil { if _bacb := _bdb . OverrideClrMapping ; _bacb != nil { if _bacb . Bg1Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Bg1Attr = _bacb . Bg1Attr ; } ; if _bacb . Tx1Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Tx1Attr = _bacb . Tx1Attr ;
} ; if _bacb . Bg2Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Bg2Attr = _bacb . Bg2Attr ; } ; if _bacb . Tx2Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Tx2Attr = _bacb . Tx2Attr ; } ; if _bacb . Accent1Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent1Attr = _bacb . Accent1Attr ;
} ; if _bacb . Accent2Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent2Attr = _bacb . Accent2Attr ; } ; if _bacb . Accent3Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent3Attr = _bacb . Accent3Attr ; } ; if _bacb . Accent4Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent4Attr = _bacb . Accent4Attr ;
} ; if _bacb . Accent5Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent5Attr = _bacb . Accent5Attr ; } ; if _bacb . Accent6Attr != _bd . ST_ColorSchemeIndexUnset { _bffe . Accent6Attr = _bacb . Accent6Attr ; } ; if _bacb . HlinkAttr != _bd . ST_ColorSchemeIndexUnset { _bffe . HlinkAttr = _bacb . HlinkAttr ;
} ; if _bacb . FolHlinkAttr != _bd . ST_ColorSchemeIndexUnset { _bffe . FolHlinkAttr = _bacb . FolHlinkAttr ; } ; } ; } ; } ; } ; _ggef . _bgbf = _bffe ; } ;
2023-12-28 15:53:06 +00:00
2024-02-17 03:37:07 +00:00
// PresentationText is an array of extracted text items which has some methods for representing extracted text.
type PresentationText struct { Slides [ ] * SlideText ; } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// GridSpacing returns the GridSpacing property.
func ( _gcag ViewProperties ) GridSpacing ( ) * _bd . CT_PositiveSize2D { return _gcag . _efda . GridSpacing } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// PrnPr returns the PrnPr property.
func ( _bee PresentationProperties ) PrnPr ( ) * _db . CT_PrintProperties { return _bee . _eee . PrnPr } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// AddImageToRels adds an image relationship to a slide without putting image on the slide.
func ( _fdbb Slide ) AddImageToRels ( img _cd . ImageRef ) string { _eefe := 0 ; for _ebce , _bdfa := range _fdbb . _bfc . Images { if _bdfa == img { _eefe = _ebce + 1 ; break ; } ; } ; var _ffcg string ; for _adcd , _dcb := range _fdbb . _bfc . Slides ( ) { if _dcb . _dfee == _fdbb . _dfee { _ggga := _bf . Sprintf ( "\u002e\u002e\u002f\u006ded\u0069\u0061\u002f\u0069\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , _eefe , img . Format ( ) ) ;
_acfb := _fdbb . _bfc . _gcb [ _adcd ] . AddRelationship ( _ggga , _fd . ImageType ) ; _ffcg = _acfb . ID ( ) ; } ; } ; return _ffcg ; } ; func ( _bda * chart ) Target ( ) string { return _bda . _cg } ;
2022-09-02 11:46:53 +00:00
2024-02-17 03:37:07 +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 ( _faf * Presentation ) AddSlideWithLayout ( l SlideLayout ) ( Slide , error ) { _bgd := _db . NewCT_SlideIdListEntry ( ) ; _bgd . IdAttr = 256 ; for _ , _dbe := range _faf . _bec . SldIdLst . SldId { if _dbe . IdAttr >= _bgd . IdAttr { _bgd . IdAttr = _dbe . IdAttr + 1 ; } ; } ; _faf . _bec . SldIdLst . SldId = append ( _faf . _bec . SldIdLst . SldId , _bgd ) ;
_ffb := _db . NewSld ( ) ; _gee := _cf . Buffer { } ; _faea := _dde . NewEncoder ( & _gee ) ; _feed := _dde . StartElement { Name : _dde . Name { Local : "\u0073\u006c\u0069d\u0065" } } ; _feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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" } ) ;
_feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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" } ) ;
_feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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" } ) ;
_feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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" } ) ;
_feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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" } ) ;
_feed . Attr = append ( _feed . Attr , _dde . Attr { Name : _dde . 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 _edf := l . _fffe . CSld . MarshalXML ( _faea , _feed ) ; _edf != nil { return Slide { } , _edf ; } ; _faea . Flush ( ) ; _afa := _dde . NewDecoder ( & _gee ) ; _ffb . CSld = _db . NewCT_CommonSlideData ( ) ; if _gcea := _afa . Decode ( _ffb . CSld ) ; _gcea != nil { return Slide { } , _gcea ;
} ; _ffb . CSld . NameAttr = nil ; _ffb . CSld . SpTree . Choice = _cga ( _ffb . CSld . SpTree . Choice ) ; _faf . _gcec = append ( _faf . _gcec , _ffb ) ; _cabg := _faf . _ddcc . AddAutoRelationship ( _fd . DocTypePresentation , _fd . OfficeDocumentType , len ( _faf . _gcec ) , _fd . SlideType ) ;
_bgd . RIdAttr = _cabg . ID ( ) ; _cff := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideType , len ( _faf . _gcec ) ) ; _faf . ContentTypes . AddOverride ( _cff , _fd . SlideContentType ) ; _fdff := _cd . NewRelationships ( ) ; _faf . _gcb = append ( _faf . _gcb , _fdff ) ;
_babf := len ( _faf . _gcb ) - 1 ; for _dege , _efc := range _faf . _cee { if _efc == l . X ( ) { _fea := _faf . _ddgc [ _dege ] ; for _ , _cdfe := range _fea . X ( ) . Relationship { if _cdfe . TypeAttr != _fd . SlideMasterType { _faf . _gcb [ _babf ] . X ( ) . Relationship = append ( _faf . _gcb [ _babf ] . X ( ) . Relationship , _cdfe ) ;
} ; } ; _fdff . AddAutoRelationship ( _fd . DocTypePresentation , _fd . SlideType , _dege + 1 , _fd . SlideLayoutType ) ; } ; } ; _ebc := Slide { _bgd , _ffb , _faf , nil } ; return _ebc , nil ; } ;
2022-09-02 11:46:53 +00:00
2024-02-17 03:37:07 +00:00
// GetTextBoxes returns a list of all text boxes from a slide.
func ( _dbeg Slide ) GetTextBoxes ( ) [ ] * TextBox { _cfgc := [ ] * TextBox { } ; _cafd := _dbeg . _dfee . CSld . SpTree . Choice ; for _ , _add := range _cafd { for _ , _dag := range _add . Sp { if _dag . NvSpPr . CNvSpPr . TxBoxAttr != nil && * _dag . NvSpPr . CNvSpPr . TxBoxAttr { _cfgc = append ( _cfgc , & TextBox { _dag } ) ;
} ; } ; } ; return _cfgc ; } ;
2022-12-06 11:56:49 +00:00
2024-02-17 03:37:07 +00:00
// ShowPr returns the ShowPr property.
func ( _bab PresentationProperties ) ShowPr ( ) * _db . CT_ShowProperties { return _bab . _eee . ShowPr } ; type rectangle struct { _aff int64 ; _afga int64 ; _bg int64 ; _gc int64 ; } ;
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// SlideLayouts returns the slide layouts defined in the presentation.
func ( _fde * Presentation ) SlideLayouts ( ) [ ] SlideLayout { _eda := [ ] SlideLayout { } ; for _ , _cbd := range _fde . _cee { _eda = append ( _eda , SlideLayout { _cbd } ) ; } ; return _eda ; } ;
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// SetHeight sets height of slide screen size with given value in EMU units.
func ( _eacc * SlideScreenSize ) SetHeight ( val int32 ) { _eacc [ 1 ] = val } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +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 ( _bbc * Presentation ) GetColorBySchemeColor ( schClr _bd . ST_SchemeColorVal ) * _bd . CT_Color { if len ( _bbc . _abb ) == 0 || len ( _bbc . _bebg ) == 0 { return nil ; } ; var _afad _bd . ST_ColorSchemeIndex ; _bfga := _bbc . _abb [ 0 ] ; _egfc := _bfga . ClrMap ; switch schClr . String ( ) { case "\u0062\u0067\u0031" : _afad = _egfc . Bg1Attr ;
case "\u0062\u0067\u0032" : _afad = _egfc . Bg2Attr ; case "\u0074\u0078\u0031" : _afad = _egfc . Tx1Attr ; case "\u0074\u0078\u0032" : _afad = _egfc . Tx2Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _afad = _egfc . Accent1Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _afad = _egfc . Accent2Attr ;
case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _afad = _egfc . Accent3Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _afad = _egfc . Accent4Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _afad = _egfc . Accent5Attr ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _afad = _egfc . Accent6Attr ;
case "\u0068\u006c\u0069n\u006b" : _afad = _egfc . HlinkAttr ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _afad = _egfc . FolHlinkAttr ; case "\u0064\u006b\u0031" : _afad = _bd . ST_ColorSchemeIndexDk1 ; case "\u0064\u006b\u0032" : _afad = _bd . ST_ColorSchemeIndexDk2 ;
case "\u006c\u0074\u0031" : _afad = _bd . ST_ColorSchemeIndexLt1 ; case "\u006c\u0074\u0032" : _afad = _bd . ST_ColorSchemeIndexLt2 ; default : _afad = _bd . ST_ColorSchemeIndexUnset ; } ; _bege := _bbc . _bebg [ 0 ] ; _cagg := _bege . ThemeElements ; if _cagg == nil { return nil ;
} ; var _debf * _bd . CT_Color ; _ceee := _cagg . ClrScheme ; switch _afad . String ( ) { case "\u0064\u006b\u0031" : _debf = _ceee . Dk1 ; case "\u0064\u006b\u0032" : _debf = _ceee . Dk2 ; case "\u006c\u0074\u0031" : _debf = _ceee . Lt1 ; case "\u006c\u0074\u0032" : _debf = _ceee . Lt2 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0031" : _debf = _ceee . Accent1 ; case "\u0061c\u0063\u0065\u006e\u0074\u0032" : _debf = _ceee . Accent2 ; case "\u0061c\u0063\u0065\u006e\u0074\u0033" : _debf = _ceee . Accent3 ; case "\u0061c\u0063\u0065\u006e\u0074\u0034" : _debf = _ceee . Accent4 ;
case "\u0061c\u0063\u0065\u006e\u0074\u0035" : _debf = _ceee . Accent5 ; case "\u0061c\u0063\u0065\u006e\u0074\u0036" : _debf = _ceee . Accent6 ; case "\u0068\u006c\u0069n\u006b" : _debf = _ceee . Hlink ; case "\u0066\u006f\u006c\u0048\u006c\u0069\u006e\u006b" : _debf = _ceee . FolHlink ;
default : return nil ; } ; return _debf ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// SetWidth sets width of slide screen size with given value in EMU units.
func ( _ffg * SlideScreenSize ) SetWidth ( val int32 ) { _ffg [ 0 ] = val } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +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 * _bd . CT_Table ; Row * _bd . CT_TableRow ; Cell * _bd . CT_TableCell ; RowIndex int ; ColIndex int ; } ;
2021-09-22 16:41:01 +00:00
2024-02-17 03:37:07 +00:00
// Properties returns the properties of the TextBox.
func ( _gbggg TextBox ) Properties ( ) _ag . ShapeProperties { if _gbggg . _ebag . SpPr == nil { _gbggg . _ebag . SpPr = _bd . NewCT_ShapeProperties ( ) ; } ; return _ag . MakeShapeProperties ( _gbggg . _ebag . SpPr ) ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// AddTable adds an empty table to a slide.
func ( _bac Slide ) AddTable ( ) * _cd . Table { _aabe := _db . NewCT_GroupShapeChoice ( ) ; _bac . _dfee . CSld . SpTree . Choice = append ( _bac . _dfee . CSld . SpTree . Choice , _aabe ) ; _gbbb := _db . NewCT_GraphicalObjectFrame ( ) ; _aabe . GraphicFrame = append ( _aabe . GraphicFrame , _gbbb ) ;
_gbbb . Xfrm . Off = _bd . NewCT_Point2D ( ) ; _cffa := int64 ( 1 ) ; _gbbb . Xfrm . Off . XAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _cffa } ; _gbbb . Xfrm . Off . YAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _cffa } ; _agcb := _gbbb . Graphic . CT_GraphicalObject . GraphicData ;
_agcb . 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" ;
_gac := _cd . NewTableWithXfrm ( _gbbb . Xfrm ) ; _agcb . Any = append ( _agcb . Any , _gac . X ( ) ) ; return _gac ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.
func NewSlideScreenSize ( ) SlideScreenSize { return NewSlideScreenSizeWithValue ( SlideScreenSize16x9 [ 0 ] , SlideScreenSize16x9 [ 1 ] ) ; } ; func ( _cgcb * Presentation ) onNewRelationship ( _feb * _gf . DecodeMap , _fddb , _ceef string , _ggeg [ ] * _de . File , _ebda * _gg . Relationship , _eabc _gf . Target ) error { _ebfc := _fd . DocTypePresentation ;
switch _ceef { case _fd . OfficeDocumentType : _cgcb . _bec = _db . NewPresentation ( ) ; _feb . AddTarget ( _fddb , _cgcb . _bec , _ceef , 0 ) ; _feb . AddTarget ( _gf . RelationsPathFor ( _fddb ) , _cgcb . _ddcc . X ( ) , _ceef , 0 ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ;
case _fd . CorePropertiesType : _feb . AddTarget ( _fddb , _cgcb . CoreProperties . X ( ) , _ceef , 0 ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . CustomPropertiesType : _feb . AddTarget ( _fddb , _cgcb . CustomProperties . X ( ) , _ceef , 0 ) ;
_ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . PresentationPropertiesType : _feb . AddTarget ( _fddb , _cgcb . _bbg . X ( ) , _ceef , 0 ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . ViewPropertiesType : _feb . AddTarget ( _fddb , _cgcb . _eba . X ( ) , _ceef , 0 ) ;
_ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . TableStylesType : _feb . AddTarget ( _fddb , _cgcb . _ecef . X ( ) , _ceef , 0 ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . HyperLinkType : _babfa := _bd . NewCT_Hyperlink ( ) ;
_gfe := uint32 ( len ( _cgcb . _ffc ) ) ; _feb . AddTarget ( _fddb , _babfa , _ceef , _gfe ) ; _cgcb . _ffc = append ( _cgcb . _ffc , _babfa ) ; case _fd . CustomXMLType : _fecd := & _fd . XSDAny { } ; _agca := uint32 ( len ( _cgcb . _agg ) ) ; _feb . AddTarget ( _fddb , _fecd , _ceef , _agca ) ;
_cgcb . _agg = append ( _cgcb . _agg , _fecd ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _agg ) ) ; case _fd . ChartType : _eaf := chart { _af : _g . NewChartSpace ( ) } ; _gfac := uint32 ( len ( _cgcb . _abd ) ) ; _feb . AddTarget ( _fddb , _eaf . _af , _ceef , _gfac ) ;
_cgcb . _abd = append ( _cgcb . _abd , & _eaf ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _abd ) ) ; _eaf . _cg = _ebda . TargetAttr ; case _fd . HandoutMasterType : _fegc := _db . NewHandoutMaster ( ) ; _dced := uint32 ( len ( _cgcb . _fee ) ) ;
_feb . AddTarget ( _fddb , _fegc , _ceef , _dced ) ; _cgcb . _fee = append ( _cgcb . _fee , _fegc ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _fee ) ) ; case _fd . NotesMasterType : _gagd := _db . NewNotesMaster ( ) ; _beag := uint32 ( len ( _cgcb . _gdb ) ) ;
_feb . AddTarget ( _fddb , _gagd , _ceef , _beag ) ; _cgcb . _gdb = append ( _cgcb . _gdb , _gagd ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _gdb ) ) ; case _fd . ExtendedPropertiesType : _feb . AddTarget ( _fddb , _cgcb . AppProperties . X ( ) , _ceef , 0 ) ;
_ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , 0 ) ; case _fd . SlideType : if _eea , _gfed := _da . StringToNumbers ( _fddb ) ; _gfed { if len ( _cgcb . _gcec ) < _eea { _bfg := _db . NewSld ( ) ; _cgcb . _gcec = append ( _cgcb . _gcec , _bfg ) ; _feb . AddTarget ( _fddb , _bfg , _ceef , uint32 ( _eea ) ) ;
_ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , _eea ) ; _efcc := _cd . NewRelationships ( ) ; _feb . AddTarget ( _gf . RelationsPathFor ( _fddb ) , _efcc . X ( ) , _ceef , 0 ) ; if len ( _cgcb . _gcb ) >= _eea { _cgcb . _gcb [ _eea - 1 ] = _efcc ; } else { _cgcb . _gcb = append ( _cgcb . _gcb , _efcc ) ;
} ; } ; } ; case _fd . SlideMasterType : _cag := _db . NewSldMaster ( ) ; if ! _feb . AddTarget ( _fddb , _cag , _ceef , uint32 ( len ( _cgcb . _abb ) + 1 ) ) { return nil ; } ; _cgcb . _abb = append ( _cgcb . _abb , _cag ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _abb ) ) ;
_ffbf := _cd . NewRelationships ( ) ; _feb . AddTarget ( _gf . RelationsPathFor ( _fddb ) , _ffbf . X ( ) , _ceef , 0 ) ; _cgcb . _edd = append ( _cgcb . _edd , _ffbf ) ; case _fd . SlideLayoutType : _gdca := _db . NewSldLayout ( ) ; if ! _feb . AddTarget ( _fddb , _gdca , _ceef , uint32 ( len ( _cgcb . _cee ) + 1 ) ) { return nil ;
} ; _cgcb . _cee = append ( _cgcb . _cee , _gdca ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _cee ) ) ; _dcc := _cd . NewRelationships ( ) ; _feb . AddTarget ( _gf . RelationsPathFor ( _fddb ) , _dcc . X ( ) , _ceef , 0 ) ; _cgcb . _ddgc = append ( _cgcb . _ddgc , _dcc ) ;
case _fd . ThumbnailType : for _egca , _gggd := range _ggeg { if _gggd == nil { continue ; } ; if _gggd . Name == _fddb { _dfb , _aec := _gggd . Open ( ) ; if _aec != nil { return _bf . Errorf ( "e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073" , _aec ) ;
} ; _cgcb . Thumbnail , _ , _aec = _gfg . Decode ( _dfb ) ; _dfb . Close ( ) ; if _aec != nil { return _bf . Errorf ( "\u0065\u0072\u0072\u006fr\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020t\u0068u\u006d\u0062\u006e\u0061\u0069\u006c\u003a \u0025\u0073" , _aec ) ;
} ; _ggeg [ _egca ] = nil ; } ; } ; case _fd . ThemeType : _afdg := _bd . NewTheme ( ) ; if ! _feb . AddTarget ( _fddb , _afdg , _ceef , uint32 ( len ( _cgcb . _bebg ) + 1 ) ) { return nil ; } ; _cgcb . _bebg = append ( _cgcb . _bebg , _afdg ) ; _ebda . TargetAttr = _fd . RelativeFilename ( _ebfc , _eabc . Typ , _ceef , len ( _cgcb . _bebg ) ) ;
_eafb := _cd . NewRelationships ( ) ; _feb . AddTarget ( _gf . RelationsPathFor ( _fddb ) , _eafb . X ( ) , _ceef , 0 ) ; _cgcb . _cfb = append ( _cgcb . _cfb , _eafb ) ; case _fd . ImageType : _fddb = _b . Clean ( _fddb ) ; if _gbg , _dgf := _cgcb . _bgc [ _fddb ] ; _dgf { _ebda . TargetAttr = _gbg ;
return nil ; } ; _ggc := "" ; for _fbfd , _bfgd := range _ggeg { if _bfgd == nil { continue ; } ; if _bfgd . Name == _fddb { _eedf , _fcc := _gf . ExtractToDiskTmp ( _bfgd , _cgcb . TmpPath ) ; if _fcc != nil { return _fcc ; } ; _bcfd , _fcc := _cd . ImageFromStorage ( _eedf ) ; if _fcc != nil { return _fcc ;
} ; _ggc = _bcfd . Format ; _fgad := _cd . MakeImageRef ( _bcfd , & _cgcb . DocBase , _cgcb . _ddcc ) ; _fgad . SetTarget ( "\u002e\u002e\u002f" + _fddb [ 4 : ] ) ; _cgcb . Images = append ( _cgcb . Images , _fgad ) ; _ggeg [ _fbfd ] = nil ; _faaa := len ( _cgcb . Images ) ; if _dfe , _dga := _da . StringToNumbers ( _fddb ) ;
_dga { _faaa = _dfe ; } ; _feb . RecordIndex ( _fddb , _faaa ) ; break ; } ; } ; _cgeg := _feb . IndexFor ( _fddb ) ; _ebda . TargetAttr = _fd . RelativeImageFilename ( _ebfc , _eabc . Typ , _ceef , _cgeg , _ggc ) ; _cgcb . _bgc [ _fddb ] = _ebda . TargetAttr ; default : _ef . Log . Debug ( "\u0075\u006e\u0073\u0075\u0070p\u006f\u0072\u0074\u0065\u0064\u0020\u0072\u0065\u006c\u0061\u0074\u0069\u006fn\u0073\u0068\u0069\u0070\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0073\u0020\u0074\u0067\u0074\u003a\u0020\u0025\u0073" , _ceef , _fddb ) ;
} ; return nil ; } ;
2021-11-10 11:45:21 +00:00
2024-02-17 03:37:07 +00:00
// WebPr returns the WebPr property.
func ( _ccc PresentationProperties ) WebPr ( ) * _db . CT_WebProperties { return _ccc . _eee . WebPr } ;
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// X returns TextBox's underlying *pml.CT_Shape.
func ( _ggb TextBox ) X ( ) * _db . CT_Shape { return _ggb . _ebag } ;
2022-04-09 14:27:46 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _fdcg ViewProperties ) X ( ) * _db . ViewPr { return _fdcg . _efda } ;
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// Read reads a document from an io.Reader.
func Read ( r _ea . ReaderAt , size int64 ) ( * Presentation , error ) { const _gbcf = "\u0070\u0072\u0065\u0073\u0065\u006e\u0074\u0061\u0074\u0069\u006f\u006e:\u0052\u0065\u0061\u0064" ; if ! _e . GetLicenseKey ( ) . IsLicensed ( ) && ! _gfce { _bf . 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" ) ;
_bf . 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 , _eb . 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" ) ; } ; _cada := _dgb ( ) ; _cfg , _afade := _e . GenRefId ( "\u0070\u0072" ) ; if _afade != nil { _ef . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _afade ) ;
return nil , _afade ; } ; _cada . _cge = _cfg ; if _cdeb := _e . Track ( _cada . _cge , _gbcf ) ; _cdeb != nil { _ef . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _cdeb ) ; return nil , _cdeb ; } ; _dab , _afade := _ca . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0070\u0070\u0074\u0078" ) ;
if _afade != nil { return nil , _afade ; } ; _cada . TmpPath = _dab ; _efaa , _afade := _de . NewReader ( r , size ) ; if _afade != nil { return nil , _bf . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _afade ) ; } ; _bbgg := [ ] * _de . File { } ;
_bbgg = append ( _bbgg , _efaa . File ... ) ; _fegab := false ; for _ , _deed := range _bbgg { if _deed . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _fegab = true ; break ; } ; } ; if _fegab { _cada . CreateCustomProperties ( ) ;
} ; _ade := _gf . DecodeMap { } ; _ade . SetOnNewRelationshipFunc ( _cada . onNewRelationship ) ; _ade . AddTarget ( _fd . ContentTypesFilename , _cada . ContentTypes . X ( ) , "" , 0 ) ; _ade . AddTarget ( _fd . BaseRelsFilename , _cada . Rels . X ( ) , "" , 0 ) ; if _adcb := _ade . Decode ( _bbgg ) ;
_adcb != nil { return nil , _adcb ; } ; for _ , _fbegg := range _bbgg { if _fbegg == nil { continue ; } ; if _ead := _cada . AddExtraFileFromZip ( _fbegg ) ; _ead != nil { return nil , _ead ; } ; } ; if _fegab { _cead := false ; for _ , _dabb := range _cada . Rels . X ( ) . Relationship { if _dabb . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _cead = true ;
break ; } ; } ; if ! _cead { _cada . AddCustomRelationships ( ) ; } ; } ; return _cada , nil ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +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 * _db . CT_Shape ; GraphicFrame * _db . CT_GraphicalObjectFrame ; Paragraph * _bd . CT_TextParagraph ; Run * _bd . CT_RegularTextRun ; TableInfo * TableInfo ; _bfd [ ] rectangle ; _afg int ; _deb int ; } ;
2023-09-16 17:56:36 +00:00
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// Presentation returns a slide's presentation.
func ( _ecgc Slide ) Presentation ( ) * Presentation { return _ecgc . _bfc } ;
2022-02-05 13:05:36 +00:00
2024-02-17 03:37:07 +00:00
// SlideViewPr returns the SlideViewPr property.
func ( _gafe ViewProperties ) SlideViewPr ( ) * _db . CT_SlideViewProperties { return _gafe . _efda . SlideViewPr } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// Name returns the name of the slide layout.
func ( _bade SlideLayout ) Name ( ) string { if _bade . _fffe . CSld != nil && _bade . _fffe . CSld . NameAttr != nil { return * _bade . _fffe . CSld . NameAttr ; } ; return "" ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// SetOffsetY sets vertical offset of text box in distance units (see measurement package).
func ( _bbf TextBox ) SetOffsetY ( offY float64 ) { _ede := _bbf . getOff ( ) ; _bgcf := _a . ToEMU ( offY ) ; _ede . YAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _bgcf } ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// ExtLst returns the ExtLst property.
func ( _cagfb ViewProperties ) ExtLst ( ) * _db . CT_ExtensionList { return _cagfb . _efda . ExtLst } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// slide.
func ( _gacb * Slide ) GetImageByRelID ( relID string ) ( _cd . ImageRef , bool ) { _gagg := _gacb . getSlideRels ( ) ; if ( _gagg == _cd . Relationships { } ) { return _cd . ImageRef { } , false ; } ; _cabc := _gagg . GetTargetByRelId ( relID ) ; for _ , _cbfc := range _gacb . _bfc . Images { if _cbfc . Target ( ) == _cabc { return _cbfc , true ;
} ; } ; return _cd . ImageRef { } , false ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// TextBox is a text box within a slide.
type TextBox struct { _ebag * _db . CT_Shape } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// AddParagraph adds a new paragraph to a placeholder.
func ( _gdc PlaceHolder ) AddParagraph ( ) _ag . Paragraph { _beb := _ag . MakeParagraph ( _bd . NewCT_TextParagraph ( ) ) ; _gdc . _bggb . TxBody . P = append ( _gdc . _bggb . TxBody . P , _beb . X ( ) ) ; return _beb ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// SaveToFile writes the Presentation out to a file.
func ( _eag * Presentation ) SaveToFile ( path string ) error { return _eag . saveToFile ( path , false ) } ; const _ga float64 = 500000 ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// SetOffsetX sets horizontal offset of text box in distance units (see measurement package).
func ( _ceda TextBox ) SetOffsetX ( offX float64 ) { _dacc := _ceda . getOff ( ) ; _abe := _a . ToEMU ( offX ) ; _dacc . XAttr = _bd . ST_Coordinate { ST_CoordinateUnqualified : & _abe } ; } ; func ( _ebe TextBox ) getOff ( ) * _bd . CT_Point2D { if _ebe . _ebag . SpPr == nil { _ebe . _ebag . SpPr = _bd . NewCT_ShapeProperties ( ) ;
} ; if _ebe . _ebag . SpPr . Xfrm == nil { _ebe . _ebag . SpPr . Xfrm = _bd . NewCT_Transform2D ( ) ; } ; if _ebe . _ebag . SpPr . Xfrm . Off == nil { _ebe . _ebag . SpPr . Xfrm . Off = _bd . NewCT_Point2D ( ) ; } ; return _ebe . _ebag . SpPr . Xfrm . Off ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// PresentationProperties contains document specific properties.
type PresentationProperties struct { _eee * _db . PresentationPr } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// Text returns text from a presentation as one string separated with line breaks.
func ( _efa * PresentationText ) Text ( ) string { _aba := _cf . NewBuffer ( [ ] byte { } ) ; for _ , _acb := range _efa . Slides { _aba . WriteString ( _acb . Text ( ) ) ; } ; return _aba . String ( ) ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// SlideSize returns presentation slide size.
func ( _aed * Presentation ) SlideSize ( ) SlideSize { if _aed . _bec . SldSz == nil { _aed . _bec . SldSz = _db . NewCT_SlideSize ( ) ; } ; return SlideSize { _aed . _bec . SldSz , _aed } ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// Size returns slide size value as SlideScreenSize.
func ( _ecdc * SlideSize ) Size ( ) SlideScreenSize { return SlideScreenSize { _ecdc . _eage . CxAttr , _ecdc . _eage . CyAttr } ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// ClearAll completely clears a placeholder. To be useable, at least one
// paragraph must be added after ClearAll via AddParagraph.
func ( _gad PlaceHolder ) ClearAll ( ) { _gad . _bggb . SpPr = _bd . NewCT_ShapeProperties ( ) ; _gad . _bggb . TxBody = _bd . NewCT_TextBody ( ) ; _gad . _bggb . TxBody . LstStyle = _bd . NewCT_TextListStyle ( ) ; } ;
2023-04-15 17:27:31 +00:00
2024-02-17 03:37:07 +00:00
// GetLayoutImageByRelID returns an ImageRef with the associated relation ID in the
// slide layout.
func ( _dac * Slide ) GetLayoutImageByRelID ( relID string ) ( _cd . ImageRef , bool ) { _gddb := _dac . getSlideLayoutRels ( ) ; if ( _gddb == _cd . Relationships { } ) { return _cd . ImageRef { } , false ; } ; _caga := _gddb . GetTargetByRelId ( relID ) ; for _ , _eebc := range _dac . _bfc . Images { if _eebc . Target ( ) == _caga { return _eebc , true ;
} ; } ; return _cd . ImageRef { } , false ; } ;
2023-06-10 07:12:37 +00:00
2024-02-17 03:37:07 +00:00
// Image is an image within a slide.
type Image struct { _gag * _db . CT_Picture } ;
2023-06-10 07:12:37 +00:00
2024-02-17 03:37:07 +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 ; } ; func _fb ( _fg * Presentation , _caf [ ] * _db . CT_GroupShapeChoice , _cdf [ ] rectangle , _ge [ ] * TextItem ) [ ] * TextItem { for _ , _fgf := range _caf { _ece := append ( [ ] rectangle { } , _cdf ... ) ; for _ , _dff := range _fgf . Sp { _ge = append ( _ge , _ecd ( _fg , _dff , nil , nil , _dff . SpPr . Xfrm , 0 , _cdf , _dff . TxBody . P ) ... ) ;
} ; for _ , _dg := range _fgf . GraphicFrame { if _dg != nil && _dg . Graphic != nil && _dg . Graphic . GraphicData != nil { _fgg := _dg . Xfrm ; for _ , _gef := range _dg . Graphic . GraphicData . Any { if _ffd , _cgc := _gef . ( * _bd . Tbl ) ; _cgc { _dcg := & _ffd . CT_Table ; _cb := 0 ;
for _dad , _fbe := range _ffd . Tr { for _dce , _agd := range _fbe . Tc { _ad := & TableInfo { Table : _dcg , Row : _fbe , Cell : _agd , RowIndex : _dad , ColIndex : _dce } ; _ge = append ( _ge , _ecd ( _fg , nil , _dg , _ad , _fgg , _cb , _cdf , _agd . TxBody . P ) ... ) ; _cb ++ ; } ; } ; } ; } ; } ;
} ; for _ , _ace := range _fgf . GrpSp { if _ace . GrpSpPr != nil { _bge := _ace . GrpSpPr . Xfrm ; var _afe , _bbd int64 ; if _bge . Off != nil { _agf , _gd := _bge . Off . XAttr . ST_CoordinateUnqualified , _bge . Off . YAttr . ST_CoordinateUnqualified ; if _agf != nil && _gd != nil { if _fc := _bge . Ext ;
_fc != nil { _afe , _bbd = _fc . CxAttr , _fc . CyAttr ; } ; _ece = append ( _ece , rectangle { _aff : * _agf , _afga : * _gd , _bg : * _agf + _afe , _gc : * _gd + _bbd } ) ; } ; } ; } ; _ge = _fb ( _fg , _ace . Choice , _ece , _ge ) ; } ; } ; return _ge ; } ; func ( _ee * chart ) X ( ) * _g . ChartSpace { return _ee . _af } ;
var ( SlideScreenSize16x9 = SlideScreenSize { 12192000 , 6858000 } ; SlideScreenSize4x3 = SlideScreenSize { 9144000 , 6858000 } ; SlideScreenSizeA4 = SlideScreenSize { 9906000 , 6858000 } ; ) ; func _cga ( _gfc [ ] * _db . CT_GroupShapeChoice ) [ ] * _db . CT_GroupShapeChoice { var _efga [ ] * _db . CT_GroupShapeChoice ;
for _ , _fec := range _gfc { if len ( _fec . Pic ) == 0 { _efga = append ( _efga , _fec ) ; } ; } ; return _efga ; } ;
2023-08-06 17:57:53 +00:00
2023-12-28 15:53:06 +00:00
// ExtLst returns the ExtLst property.
2024-02-17 03:37:07 +00:00
func ( _ebd PresentationProperties ) ExtLst ( ) * _db . CT_ExtensionList { return _ebd . _eee . ExtLst } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// Themes returns an array of presentation themes.
func ( _dee * Presentation ) Themes ( ) [ ] * _bd . Theme { return _dee . _bebg } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// NotesViewPr returns the NotesViewPr property.
func ( _ebfd ViewProperties ) NotesViewPr ( ) * _db . CT_NotesViewProperties { return _ebfd . _efda . NotesViewPr } ;
2023-08-06 17:57:53 +00:00
2024-02-17 03:37:07 +00:00
// NewPresentationProperties constructs a new PresentationProperties.
func NewPresentationProperties ( ) PresentationProperties { return PresentationProperties { _eee : _db . NewPresentationPr ( ) } ; } ;
2023-08-06 17:57:53 +00:00
2024-02-17 03:37:07 +00:00
// ShowCommentsAttr returns the WebPr property.
func ( _efb ViewProperties ) ShowCommentsAttr ( ) * bool { return _efb . _efda . ShowCommentsAttr } ;
2023-06-10 07:12:37 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _fadg SlideMaster ) X ( ) * _db . SldMaster { return _fadg . _fcgb } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// LastViewAttr returns the LastViewAttr property.
func ( _dcedd ViewProperties ) LastViewAttr ( ) _db . ST_ViewType { return _dcedd . _efda . LastViewAttr } ;
2023-08-06 17:57:53 +00:00
2023-12-28 15:53:06 +00:00
// NewViewProperties constructs a new ViewProperties.
2024-02-17 03:37:07 +00:00
func NewViewProperties ( ) ViewProperties { return ViewProperties { _efda : _db . NewViewPr ( ) } } ;
2023-08-06 17:57:53 +00:00
2024-02-17 03:37:07 +00:00
// Type returns the type of the slide layout.
func ( _gbcg SlideLayout ) Type ( ) _db . ST_SlideLayoutType { return _gbcg . _fffe . TypeAttr } ;
2023-06-10 07:12:37 +00:00
2024-02-17 03:37:07 +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.
func ( _fbed Slide ) GetPlaceholderByIndex ( idx uint32 ) ( PlaceHolder , error ) { for _ , _cagf := range _fbed . _dfee . CSld . SpTree . Choice { for _ , _bbb := range _cagf . Sp { if _bbb . NvSpPr != nil && _bbb . NvSpPr . NvPr != nil && _bbb . NvSpPr . NvPr . Ph != nil { if ( idx == 0 && _bbb . NvSpPr . NvPr . Ph . IdxAttr == nil ) || ( _bbb . NvSpPr . NvPr . Ph . IdxAttr != nil && * _bbb . NvSpPr . NvPr . Ph . IdxAttr == idx ) { return PlaceHolder { _bbb , _fbed . _dfee } , nil ;
} ; } ; } ; } ; return PlaceHolder { } , _eb . 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" ) ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// GetLayoutByName retrieves a slide layout given a layout name.
func ( _ebcc * Presentation ) GetLayoutByName ( name string ) ( SlideLayout , error ) { for _ , _aabc := range _ebcc . _cee { if _aabc . CSld . NameAttr != nil && name == * _aabc . CSld . NameAttr { return SlideLayout { _aabc } , nil ; } ; } ; return SlideLayout { } , _eb . 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" ) ;
} ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// RemoveSlide removes a slide from a presentation.
func ( _feaa * Presentation ) RemoveSlide ( s Slide ) error { _ccdc := false ; _eef := 0 ; for _dbeaa , _aab := range _feaa . _gcec { if _aab == s . _dfee { if _feaa . _bec . SldIdLst . SldId [ _dbeaa ] != s . _egdg { return _eb . 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 ( _feaa . _gcec [ _dbeaa : ] , _feaa . _gcec [ _dbeaa + 1 : ] ) ; _feaa . _gcec = _feaa . _gcec [ 0 : len ( _feaa . _gcec ) - 1 ] ; copy ( _feaa . _gcb [ _dbeaa : ] , _feaa . _gcb [ _dbeaa + 1 : ] ) ; _feaa . _gcb = _feaa . _gcb [ 0 : len ( _feaa . _gcb ) - 1 ] ; copy ( _feaa . _bec . SldIdLst . SldId [ _dbeaa : ] , _feaa . _bec . SldIdLst . SldId [ _dbeaa + 1 : ] ) ;
_feaa . _bec . SldIdLst . SldId = _feaa . _bec . SldIdLst . SldId [ 0 : len ( _feaa . _bec . SldIdLst . SldId ) - 1 ] ; _ccdc = true ; _eef = _dbeaa ; } ; } ; if ! _ccdc { return _eb . New ( "u\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066i\u006e\u0064\u0020\u0073li\u0064\u0065" ) ;
} ; _gggca := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideType , 0 ) ; return _feaa . ContentTypes . RemoveOverrideByIndex ( _gggca , _eef ) ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// AddImage adds an image textbox to a slide.
func ( _gff Slide ) AddImage ( img _cd . ImageRef ) Image { _bfdb := _db . NewCT_GroupShapeChoice ( ) ; _gff . _dfee . CSld . SpTree . Choice = append ( _gff . _dfee . CSld . SpTree . Choice , _bfdb ) ; _eeae := _db . NewCT_Picture ( ) ; _bfdb . Pic = append ( _bfdb . Pic , _eeae ) ; _eeae . NvPicPr . CNvPicPr = _bd . NewCT_NonVisualPictureProperties ( ) ;
_eeae . NvPicPr . CNvPicPr . PicLocks = _bd . NewCT_PictureLocking ( ) ; _eeae . NvPicPr . CNvPicPr . PicLocks . NoChangeAspectAttr = _fd . Bool ( true ) ; _eeae . BlipFill = _bd . NewCT_BlipFillProperties ( ) ; _eeae . BlipFill . Blip = _bd . NewCT_Blip ( ) ; _egce := _gff . AddImageToRels ( img ) ;
_eeae . BlipFill . Blip . EmbedAttr = _fd . String ( _egce ) ; _eeae . BlipFill . Stretch = _bd . NewCT_StretchInfoProperties ( ) ; _eeae . BlipFill . Stretch . FillRect = _bd . NewCT_RelativeRect ( ) ; _eeae . SpPr = _bd . NewCT_ShapeProperties ( ) ; _eeae . SpPr . PrstGeom = _bd . NewCT_PresetGeometry2D ( ) ;
_eeae . SpPr . PrstGeom . PrstAttr = _bd . ST_ShapeTypeRect ; _ded := Image { _eeae } ; _dbge := img . Size ( ) ; _ded . Properties ( ) . SetWidth ( _a . Distance ( _dbge . X ) * _a . Pixel72 ) ; _ded . Properties ( ) . SetHeight ( _a . Distance ( _dbge . Y ) * _a . Pixel72 ) ; _ded . Properties ( ) . SetPosition ( 0 , 0 ) ;
return _ded ; } ;
2023-06-10 07:12:37 +00:00
2024-02-17 03:37:07 +00:00
// SlideMaster is the slide master for a presentation.
type SlideMaster struct { _gggag * Presentation ; _dbd _cd . Relationships ; _fcgb * _db . SldMaster ; } ; func ( _eed * Presentation ) Validate ( ) error { if _feea := _eed . _bec . Validate ( ) ; _feea != nil { return _feea ; } ; for _ebg , _cdfd := range _eed . Slides ( ) { if _afac := _cdfd . ValidateWithPath ( _bf . Sprintf ( "\u0053l\u0069\u0064\u0065\u005b\u0025\u0064]" , _ebg ) ) ;
_afac != nil { return _afac ; } ; } ; for _edba , _fab := range _eed . _abb { if _ggag := _fab . ValidateWithPath ( _bf . Sprintf ( "\u0053l\u0069d\u0065\u004d\u0061\u0073\u0074\u0065\u0072\u005b\u0025\u0064\u005d" , _edba ) ) ; _ggag != nil { return _ggag ; } ; } ; for _eaag , _daee := range _eed . _cee { if _ccde := _daee . ValidateWithPath ( _bf . Sprintf ( "\u0053l\u0069d\u0065\u004c\u0061\u0079\u006f\u0075\u0074\u005b\u0025\u0064\u005d" , _eaag ) ) ;
_ccde != nil { return _ccde ; } ; } ; return nil ; } ;
2023-08-06 17:57:53 +00:00
2024-02-17 03:37:07 +00:00
// NewSlideScreenSizeWithValue returns slide screen size with given width and height.
// Width and Height value is in EMU units, use our measurement.ToEMU to convert the -
// width and height value.
func NewSlideScreenSizeWithValue ( width , height int32 ) SlideScreenSize { return SlideScreenSize { width , height } ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// X returns the inner wrapped XML type.
func ( _bff PlaceHolder ) X ( ) * _db . CT_Shape { return _bff . _bggb } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// Open opens and reads a document from a file (.pptx).
func Open ( filename string ) ( * Presentation , error ) { _dbg , _gdf := _eg . Open ( filename ) ; if _gdf != nil { return nil , _bf . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gdf ) ; } ; defer _dbg . Close ( ) ;
_dfdb , _gdf := _eg . Stat ( filename ) ; if _gdf != nil { return nil , _bf . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gdf ) ; } ; _ = _dfdb ; return Read ( _dbg , _dfdb . Size ( ) ) ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// New initializes and reurns a new presentation
func New ( ) * Presentation { _dceb := _dgb ( ) ; _dceb . 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" ) ;
_dceb . 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" ) ;
_dceb . 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" ) ;
_dceb . 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" ) ;
_dceb . 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" ) ;
_dceb . 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" ) ;
_dceb . Rels . AddRelationship ( "\u0070\u0070\u0074\u002fta\u0062\u006c\u0065\u0053\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c" , "\u0068\u0074\u0074\u0070\u003a\u002f\u002fs\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006cf\u006fr\u006d\u0061\u0074\u0073\u002e\u006fr\u0067\u002f\u006f\u0066\u0066\u0069\u0063e\u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002f\u0032\u0030\u0030\u0036\u002f\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073h\u0069\u0070\u0073\u002f\u0074\u0061\u0062\u006c\u0065\u0053\u0074\u0079\u006ce\u0073" ) ;
_dceb . _bec . SldMasterIdLst = _db . NewCT_SlideMasterIdList ( ) ; _ced := _db . NewSldMaster ( ) ; _ced . ClrMap . Bg1Attr = _bd . ST_ColorSchemeIndexLt1 ; _ced . ClrMap . Bg2Attr = _bd . ST_ColorSchemeIndexLt2 ; _ced . ClrMap . Tx1Attr = _bd . ST_ColorSchemeIndexDk1 ; _ced . ClrMap . Tx2Attr = _bd . ST_ColorSchemeIndexDk2 ;
_ced . ClrMap . Accent1Attr = _bd . ST_ColorSchemeIndexAccent1 ; _ced . ClrMap . Accent2Attr = _bd . ST_ColorSchemeIndexAccent2 ; _ced . ClrMap . Accent3Attr = _bd . ST_ColorSchemeIndexAccent3 ; _ced . ClrMap . Accent4Attr = _bd . ST_ColorSchemeIndexAccent4 ; _ced . ClrMap . Accent5Attr = _bd . ST_ColorSchemeIndexAccent5 ;
_ced . ClrMap . Accent6Attr = _bd . ST_ColorSchemeIndexAccent6 ; _ced . ClrMap . HlinkAttr = _bd . ST_ColorSchemeIndexHlink ; _ced . ClrMap . FolHlinkAttr = _bd . ST_ColorSchemeIndexFolHlink ; _dceb . _abb = append ( _dceb . _abb , _ced ) ; _eeb := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideMasterType , 1 ) ;
_dceb . ContentTypes . AddOverride ( _eeb , _fd . SlideMasterContentType ) ; _aace := _dceb . _ddcc . AddAutoRelationship ( _fd . DocTypePresentation , _fd . OfficeDocumentType , 1 , _fd . SlideMasterType ) ; _aea := _db . NewCT_SlideMasterIdListEntry ( ) ; _aea . IdAttr = _fd . Uint32 ( 2147483648 ) ;
_aea . RIdAttr = _aace . ID ( ) ; _dceb . _bec . SldMasterIdLst . SldMasterId = append ( _dceb . _bec . SldMasterIdLst . SldMasterId , _aea ) ; _bad := _cd . NewRelationships ( ) ; _dceb . _edd = append ( _dceb . _edd , _bad ) ; _cda := _db . NewSldLayout ( ) ; _cfba := _bad . AddAutoRelationship ( _fd . DocTypePresentation , _fd . SlideMasterType , 1 , _fd . SlideLayoutType ) ;
_abc := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . SlideLayoutType , 1 ) ; _dceb . ContentTypes . AddOverride ( _abc , _fd . SlideLayoutContentType ) ; _bad . AddAutoRelationship ( _fd . DocTypePresentation , _fd . SlideMasterType , 1 , _fd . ThemeType ) ; _dceb . _cee = append ( _dceb . _cee , _cda ) ;
_ced . SldLayoutIdLst = _db . NewCT_SlideLayoutIdList ( ) ; _cdd := _db . NewCT_SlideLayoutIdListEntry ( ) ; _cdd . IdAttr = _fd . Uint32 ( 2147483649 ) ; _cdd . RIdAttr = _cfba . ID ( ) ; _ced . SldLayoutIdLst . SldLayoutId = append ( _ced . SldLayoutIdLst . SldLayoutId , _cdd ) ; _degg := _cd . NewRelationships ( ) ;
_dceb . _ddgc = append ( _dceb . _ddgc , _degg ) ; _degg . AddAutoRelationship ( _fd . DocTypePresentation , _fd . SlideType , 1 , _fd . SlideMasterType ) ; _dceb . _bec . NotesSz . CxAttr = 6858000 ; _dceb . _bec . NotesSz . CyAttr = 9144000 ; _gga := _bd . NewTheme ( ) ; _gga . NameAttr = _fd . String ( "\u0075n\u0069o\u0066\u0066\u0069\u0063\u0065\u0020\u0054\u0068\u0065\u006d\u0065" ) ;
_gga . ThemeElements . ClrScheme . NameAttr = "\u004f\u0066\u0066\u0069\u0063\u0065" ; _gga . ThemeElements . ClrScheme . Dk1 . SysClr = _bd . NewCT_SystemColor ( ) ; _gga . ThemeElements . ClrScheme . Dk1 . SysClr . LastClrAttr = _fd . String ( "\u0030\u0030\u0030\u0030\u0030\u0030" ) ;
_gga . ThemeElements . ClrScheme . Dk1 . SysClr . ValAttr = _bd . ST_SystemColorValWindowText ; _gga . ThemeElements . ClrScheme . Lt1 . SysClr = _bd . NewCT_SystemColor ( ) ; _gga . ThemeElements . ClrScheme . Lt1 . SysClr . LastClrAttr = _fd . String ( "\u0066\u0066\u0066\u0066\u0066\u0066" ) ;
_gga . ThemeElements . ClrScheme . Lt1 . SysClr . ValAttr = _bd . ST_SystemColorValWindow ; _gga . ThemeElements . ClrScheme . Dk2 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Dk2 . SrgbClr . ValAttr = "\u0034\u0034\u0035\u0034\u0036\u0061" ; _gga . ThemeElements . ClrScheme . Lt2 . SrgbClr = _bd . NewCT_SRgbColor ( ) ;
_gga . ThemeElements . ClrScheme . Lt2 . SrgbClr . ValAttr = "\u0065\u0037\u0065\u0037\u0065\u0036" ; _gga . ThemeElements . ClrScheme . Accent1 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent1 . SrgbClr . ValAttr = "\u0034\u0034\u0037\u0032\u0063\u0034" ;
_gga . ThemeElements . ClrScheme . Accent2 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent2 . SrgbClr . ValAttr = "\u0065\u0064\u0037\u0064\u0033\u0031" ; _gga . ThemeElements . ClrScheme . Accent3 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent3 . SrgbClr . ValAttr = "\u0061\u0035\u0061\u0035\u0061\u0035" ;
_gga . ThemeElements . ClrScheme . Accent4 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent4 . SrgbClr . ValAttr = "\u0066\u0066\u0063\u0030\u0030\u0030" ; _gga . ThemeElements . ClrScheme . Accent5 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent5 . SrgbClr . ValAttr = "\u0035\u0062\u0039\u0062\u0064\u0035" ;
_gga . ThemeElements . ClrScheme . Accent6 . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Accent6 . SrgbClr . ValAttr = "\u0037\u0030\u0061\u0064\u0034\u0037" ; _gga . ThemeElements . ClrScheme . Hlink . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . Hlink . SrgbClr . ValAttr = "\u0030\u0035\u0036\u0033\u0063\u0031" ;
_gga . ThemeElements . ClrScheme . FolHlink . SrgbClr = _bd . NewCT_SRgbColor ( ) ; _gga . ThemeElements . ClrScheme . FolHlink . SrgbClr . ValAttr = "\u0039\u0035\u0034\u0066\u0037\u0032" ; _gga . ThemeElements . FontScheme . NameAttr = "\u004f\u0066\u0066\u0069\u0063\u0065" ;
_gga . ThemeElements . FontScheme . MajorFont . Latin . TypefaceAttr = "\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0020\u004c\u0069\u0067\u0068\u0074" ; _gga . ThemeElements . FontScheme . MinorFont . Latin . TypefaceAttr = "\u0043a\u006c\u0069\u0062\u0072\u0069" ; _gga . ThemeElements . FmtScheme . NameAttr = _fd . String ( "\u004f\u0066\u0066\u0069\u0063\u0065" ) ;
_eddf := _bd . NewEG_FillProperties ( ) ; _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _eddf ) ; _eddf . SolidFill = & _bd . CT_SolidColorFillProperties { SchemeClr : & _bd . CT_SchemeColor { ValAttr : _bd . ST_SchemeColorValPhClr } } ;
_eddf = _bd . NewEG_FillProperties ( ) ; _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _eddf ) ; _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . FillStyleLst . EG_FillProperties , _eddf ) ;
_eddf . GradFill = & _bd . CT_GradientFillProperties { RotWithShapeAttr : _fd . Bool ( true ) , GsLst : & _bd . CT_GradientStopList { } , Lin : & _bd . CT_LinearShadeProperties { } } ; _eddf . GradFill . Lin . AngAttr = _fd . Int32 ( 5400000 ) ; _eddf . GradFill . Lin . ScaledAttr = _fd . Bool ( false ) ;
_bffb := _bd . NewCT_GradientStop ( ) ; _bffb . PosAttr . ST_PositiveFixedPercentageDecimal = _fd . Int32 ( 0 ) ; _bffb . SchemeClr = & _bd . CT_SchemeColor { ValAttr : _bd . ST_SchemeColorValPhClr } ; _eddf . GradFill . GsLst . Gs = append ( _eddf . GradFill . GsLst . Gs , _bffb ) ;
_bffb = _bd . NewCT_GradientStop ( ) ; _bffb . PosAttr . ST_PositiveFixedPercentageDecimal = _fd . Int32 ( 50000 ) ; _bffb . SchemeClr = & _bd . CT_SchemeColor { ValAttr : _bd . ST_SchemeColorValPhClr } ; _eddf . GradFill . GsLst . Gs = append ( _eddf . GradFill . GsLst . Gs , _bffb ) ;
_gga . ThemeElements . FmtScheme . LnStyleLst = _bd . NewCT_LineStyleList ( ) ; for _gaf := 0 ; _gaf < 3 ; _gaf ++ { _egf := _bd . NewCT_LineProperties ( ) ; _egf . WAttr = _fd . Int32 ( int32 ( 6350 * ( _gaf + 1 ) ) ) ; _egf . CapAttr = _bd . ST_LineCapFlat ; _egf . CmpdAttr = _bd . ST_CompoundLineSng ;
_egf . AlgnAttr = _bd . ST_PenAlignmentCtr ; _gga . ThemeElements . FmtScheme . LnStyleLst . Ln = append ( _gga . ThemeElements . FmtScheme . LnStyleLst . Ln , _egf ) ; } ; _gga . ThemeElements . FmtScheme . EffectStyleLst = _bd . NewCT_EffectStyleList ( ) ; for _baaa := 0 ; _baaa < 3 ;
_baaa ++ { _fcg := _bd . NewCT_EffectStyleItem ( ) ; _fcg . EffectLst = _bd . NewCT_EffectList ( ) ; _gga . ThemeElements . FmtScheme . EffectStyleLst . EffectStyle = append ( _gga . ThemeElements . FmtScheme . EffectStyleLst . EffectStyle , _fcg ) ; } ; _cae := _bd . NewEG_FillProperties ( ) ;
_cae . SolidFill = & _bd . CT_SolidColorFillProperties { SchemeClr : & _bd . CT_SchemeColor { ValAttr : _bd . ST_SchemeColorValPhClr } } ; _gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _cae ) ;
_gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _cae ) ; _gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties = append ( _gga . ThemeElements . FmtScheme . BgFillStyleLst . EG_FillProperties , _eddf ) ;
_dceb . _bebg = append ( _dceb . _bebg , _gga ) ; _cfc := _fd . AbsoluteFilename ( _fd . DocTypePresentation , _fd . ThemeType , 1 ) ; _dceb . ContentTypes . AddOverride ( _cfc , _fd . ThemeContentType ) ; _dceb . _ddcc . AddAutoRelationship ( _fd . DocTypePresentation , _fd . OfficeDocumentType , 1 , _fd . ThemeType ) ;
_bfef := _cd . NewRelationships ( ) ; _dceb . _cfb = append ( _dceb . _cfb , _bfef ) ; return _dceb ; } ;
2023-09-16 17:56:36 +00:00
2024-02-17 03:37:07 +00:00
// Paragraphs returns the paragraphs defined in the placeholder.
func ( _aac PlaceHolder ) Paragraphs ( ) [ ] _ag . Paragraph { _eaa := [ ] _ag . Paragraph { } ; for _ , _gdgb := range _aac . _bggb . TxBody . P { _eaa = append ( _eaa , _ag . MakeParagraph ( _gdgb ) ) ; } ; return _eaa ; } ;
2023-12-12 23:20:29 +00:00
2024-02-17 03:37:07 +00:00
// SaveToFileAsTemplate writes the Presentation out to a file as a template.
func ( _dgbf * Presentation ) SaveToFileAsTemplate ( path string ) error { return _dgbf . saveToFile ( path , true ) ; } ;
2023-12-28 15:53:06 +00:00
2024-02-17 03:37:07 +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 ( _cad PlaceHolder ) Clear ( ) { _cad . ClearAll ( ) ; _efac := _bd . NewCT_TextParagraph ( ) ; _cad . _bggb . TxBody . P = [ ] * _bd . CT_TextParagraph { _efac } ; _efac . EndParaRPr = _bd . NewCT_TextCharacterProperties ( ) ; _efac . EndParaRPr . LangAttr = _fd . String ( "\u0065\u006e\u002dU\u0053" ) ;
} ;
// SlideLayouts returns a slice of all layouts in SlideMaster.
func ( _bdfg SlideMaster ) SlideLayouts ( ) [ ] SlideLayout { _bfff := map [ string ] int { } ; _gaa := [ ] SlideLayout { } ; for _ , _edag := range _bdfg . _dbd . Relationships ( ) { _efaab := _d . Replace ( _edag . Target ( ) , ".\u002e\u002f\u0073\u006c\u0069\u0064e\u004c\u0061\u0079\u006f\u0075\u0074\u0073\u002f\u0073l\u0069\u0064\u0065L\u0061y\u006f\u0075\u0074" , "" , - 1 ) ;
_efaab = _d . Replace ( _efaab , "\u002e\u0078\u006d\u006c" , "" , - 1 ) ; if _cbdf , _gcca := _dd . ParseInt ( _efaab , 10 , 32 ) ; _gcca == nil { _bfff [ _edag . ID ( ) ] = int ( _cbdf ) ; } ; } ; for _ , _dfbb := range _bdfg . _fcgb . SldLayoutIdLst . SldLayoutId { if _gagc , _fcab := _bfff [ _dfbb . RIdAttr ] ;
_fcab { _dadd := _bdfg . _gggag . _cee [ _gagc - 1 ] ; _gaa = append ( _gaa , SlideLayout { _dadd } ) ; } ; } ; return _gaa ; } ;
// PlaceHolders returns all of the content place holders within a given slide.
func ( _gcd Slide ) PlaceHolders ( ) [ ] PlaceHolder { _eaeb := [ ] PlaceHolder { } ; for _ , _cegg := range _gcd . _dfee . CSld . SpTree . Choice { for _ , _cfcb := range _cegg . Sp { if _cfcb . NvSpPr != nil && _cfcb . NvSpPr . NvPr != nil && _cfcb . NvSpPr . NvPr . Ph != nil { _eaeb = append ( _eaeb , PlaceHolder { _cfcb , _gcd . _dfee } ) ;
} ; } ; } ; return _eaeb ; } ;