forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
presentation: support adding textboxes
Allow adding a textbox to a slide
- Loading branch information
Showing
7 changed files
with
177 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2017 Baliance. All rights reserved. | ||
// | ||
// Use of this source code is governed by the terms of the Affero GNU General | ||
// Public License version 3.0 as published by the Free Software Foundation and | ||
// appearing in the file LICENSE included in the packaging of this file. A | ||
// commercial license can be purchased by contacting [email protected]. | ||
|
||
package presentation | ||
|
||
import ( | ||
"baliance.com/gooxml/drawing" | ||
"baliance.com/gooxml/schema/soo/dml" | ||
"baliance.com/gooxml/schema/soo/pml" | ||
) | ||
|
||
// TextBox is a text box within a slide. | ||
type TextBox struct { | ||
x *pml.CT_Shape | ||
} | ||
|
||
// AddParagraph adds a paragraph to the text box | ||
func (t TextBox) AddParagraph() drawing.Paragraph { | ||
p := dml.NewCT_TextParagraph() | ||
t.x.TxBody.P = append(t.x.TxBody.P, p) | ||
return drawing.MakeParagraph(p) | ||
} | ||
|
||
// Properties returns the properties of the TextBox. | ||
func (t TextBox) Properties() drawing.ShapeProperties { | ||
if t.x.SpPr == nil { | ||
t.x.SpPr = dml.NewCT_ShapeProperties() | ||
} | ||
return drawing.MakeShapeProperties(t.x.SpPr) | ||
} |