Skip to content

Commit

Permalink
Rename package name to unioffice (unidoc#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnsth authored May 4, 2019
1 parent e8bf6a3 commit 270664c
Show file tree
Hide file tree
Showing 1,262 changed files with 3,606 additions and 3,606 deletions.
4 changes: 2 additions & 2 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Thank you for your interest in contributing to gooxml ("We" or "Us").
Thank you for your interest in contributing to unioffice ("We" or "Us").

The purpose of this contributor agreement ("Agreement") is to clarify and
document the rights granted by contributors to Us.
Expand All @@ -15,7 +15,7 @@ document.
documentation) including any modifications or additions to an existing work,
Submitted by You to Us, in which You own the Copyright. If You do not own the
Copyright in the entire work of authorship, please contact Us at
[email protected].
[email protected].

"COPYRIGHT" means all rights protecting works of authorship owned or controlled
by You, including copyright, moral and neighboring rights, as appropriate, for
Expand Down
34 changes: 17 additions & 17 deletions chart/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ func (c Chart) AddLineChart() LineChart {
func setup3DChart(c *crt.CT_Chart) {
c.View3D = crt.NewCT_View3D()
c.View3D.RotX = crt.NewCT_RotX()
c.View3D.RotX.ValAttr = gooxml.Int8(15)
c.View3D.RotX.ValAttr = unioffice.Int8(15)
c.View3D.RotY = crt.NewCT_RotY()
c.View3D.RotY.ValAttr = gooxml.Uint16(20)
c.View3D.RotY.ValAttr = unioffice.Uint16(20)
c.View3D.RAngAx = crt.NewCT_Boolean()
c.View3D.RAngAx.ValAttr = gooxml.Bool(false)
c.View3D.RAngAx.ValAttr = unioffice.Bool(false)

c.Floor = crt.NewCT_Surface()
c.Floor.Thickness = crt.NewCT_Thickness()
c.Floor.Thickness.ValAttr.Uint32 = gooxml.Uint32(0)
c.Floor.Thickness.ValAttr.Uint32 = unioffice.Uint32(0)

c.SideWall = crt.NewCT_Surface()
c.SideWall.Thickness = crt.NewCT_Thickness()
c.SideWall.Thickness.ValAttr.Uint32 = gooxml.Uint32(0)
c.SideWall.Thickness.ValAttr.Uint32 = unioffice.Uint32(0)

c.BackWall = crt.NewCT_Surface()
c.BackWall.Thickness = crt.NewCT_Thickness()
c.BackWall.Thickness.ValAttr.Uint32 = gooxml.Uint32(0)
c.BackWall.Thickness.ValAttr.Uint32 = unioffice.Uint32(0)

}

Expand Down Expand Up @@ -180,10 +180,10 @@ func (c Chart) AddSurfaceChart() SurfaceChart {
// The surface chart is in 3d, only rotated to an initial straight down view and
// perspective = 0
setup3DChart(c.x.Chart)
c.x.Chart.View3D.RotX.ValAttr = gooxml.Int8(90)
c.x.Chart.View3D.RotY.ValAttr = gooxml.Uint16(0)
c.x.Chart.View3D.RotX.ValAttr = unioffice.Int8(90)
c.x.Chart.View3D.RotY.ValAttr = unioffice.Uint16(0)
c.x.Chart.View3D.Perspective = crt.NewCT_Perspective()
c.x.Chart.View3D.Perspective.ValAttr = gooxml.Uint8(0)
c.x.Chart.View3D.Perspective.ValAttr = unioffice.Uint8(0)

b := SurfaceChart{x: chc.SurfaceChart}
b.InitializeDefaults()
Expand Down Expand Up @@ -270,7 +270,7 @@ func (c Chart) AddValueAxis() ValueAxis {
c.x.Chart.PlotArea.CChoice.ValAx = append(c.x.Chart.PlotArea.CChoice.ValAx, va)

va.Delete = crt.NewCT_Boolean()
va.Delete.ValAttr = gooxml.Bool(false)
va.Delete.ValAttr = unioffice.Bool(false)

va.Scaling = crt.NewCT_Scaling()
va.Scaling.Orientation = crt.NewCT_Orientation()
Expand Down Expand Up @@ -306,10 +306,10 @@ func (c Chart) AddCategoryAxis() CategoryAxis {
c.x.Chart.PlotArea.CChoice.CatAx = append(c.x.Chart.PlotArea.CChoice.CatAx, ca)

ca.Auto = crt.NewCT_Boolean()
ca.Auto.ValAttr = gooxml.Bool(true)
ca.Auto.ValAttr = unioffice.Bool(true)

ca.Delete = crt.NewCT_Boolean()
ca.Delete.ValAttr = gooxml.Bool(false)
ca.Delete.ValAttr = unioffice.Bool(false)

cax := MakeCategoryAxis(ca)
cax.InitializeDefaults()
Expand All @@ -328,7 +328,7 @@ func (c Chart) AddDateAxis() DateAxis {
c.x.Chart.PlotArea.CChoice.DateAx = append(c.x.Chart.PlotArea.CChoice.DateAx, va)

va.Delete = crt.NewCT_Boolean()
va.Delete.ValAttr = gooxml.Bool(false)
va.Delete.ValAttr = unioffice.Bool(false)

va.Scaling = crt.NewCT_Scaling()
va.Scaling.Orientation = crt.NewCT_Orientation()
Expand Down Expand Up @@ -359,7 +359,7 @@ func (c Chart) AddSeriesAxis() SeriesAxis {
c.x.Chart.PlotArea.CChoice.SerAx = append(c.x.Chart.PlotArea.CChoice.SerAx, sa)

sa.Delete = crt.NewCT_Boolean()
sa.Delete.ValAttr = gooxml.Bool(false)
sa.Delete.ValAttr = unioffice.Bool(false)

sax := MakeSeriesAxis(sa)
sax.InitializeDefaults()
Expand All @@ -384,17 +384,17 @@ func (c Chart) AddLegend() Legend {
func (c Chart) RemoveTitle() {
c.x.Chart.Title = nil
c.x.Chart.AutoTitleDeleted = crt.NewCT_Boolean()
c.x.Chart.AutoTitleDeleted.ValAttr = gooxml.Bool(true)
c.x.Chart.AutoTitleDeleted.ValAttr = unioffice.Bool(true)
}

// AddTitle sets a new title on the chart.
func (c Chart) AddTitle() Title {
c.x.Chart.Title = crt.NewCT_Title()
c.x.Chart.Title.Overlay = crt.NewCT_Boolean()
c.x.Chart.Title.Overlay.ValAttr = gooxml.Bool(false)
c.x.Chart.Title.Overlay.ValAttr = unioffice.Bool(false)

c.x.Chart.AutoTitleDeleted = crt.NewCT_Boolean()
c.x.Chart.AutoTitleDeleted.ValAttr = gooxml.Bool(false)
c.x.Chart.AutoTitleDeleted.ValAttr = unioffice.Bool(false)

title := MakeTitle(c.x.Chart.Title)
title.InitializeDefaults()
Expand Down
12 changes: 6 additions & 6 deletions chart/datalabels.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,35 @@ func (d DataLabels) SetPosition(p crt.ST_DLblPos) {
func (d DataLabels) SetShowLegendKey(b bool) {
d.ensureChoice()
d.x.Choice.ShowLegendKey = crt.NewCT_Boolean()
d.x.Choice.ShowLegendKey.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowLegendKey.ValAttr = unioffice.Bool(b)
}

func (d DataLabels) SetShowValue(b bool) {
d.ensureChoice()
d.x.Choice.ShowVal = crt.NewCT_Boolean()
d.x.Choice.ShowVal.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowVal.ValAttr = unioffice.Bool(b)
}

func (d DataLabels) SetShowCategoryName(b bool) {
d.ensureChoice()
d.x.Choice.ShowCatName = crt.NewCT_Boolean()
d.x.Choice.ShowCatName.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowCatName.ValAttr = unioffice.Bool(b)
}

func (d DataLabels) SetShowSeriesName(b bool) {
d.ensureChoice()
d.x.Choice.ShowSerName = crt.NewCT_Boolean()
d.x.Choice.ShowSerName.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowSerName.ValAttr = unioffice.Bool(b)
}

func (d DataLabels) SetShowPercent(b bool) {
d.ensureChoice()
d.x.Choice.ShowPercent = crt.NewCT_Boolean()
d.x.Choice.ShowPercent.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowPercent.ValAttr = unioffice.Bool(b)
}

func (d DataLabels) SetShowLeaderLines(b bool) {
d.ensureChoice()
d.x.Choice.ShowLeaderLines = crt.NewCT_Boolean()
d.x.Choice.ShowLeaderLines.ValAttr = gooxml.Bool(b)
d.x.Choice.ShowLeaderLines.ValAttr = unioffice.Bool(b)
}
4 changes: 2 additions & 2 deletions chart/doughnutchart.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ func (c DoughnutChart) X() *crt.CT_DoughnutChart {
// InitializeDefaults the bar chart to its defaults
func (c DoughnutChart) InitializeDefaults() {
c.x.VaryColors = crt.NewCT_Boolean()
c.x.VaryColors.ValAttr = gooxml.Bool(true)
c.x.VaryColors.ValAttr = unioffice.Bool(true)
c.x.HoleSize = crt.NewCT_HoleSize()
c.x.HoleSize.ValAttr = &crt.ST_HoleSize{}
c.x.HoleSize.ValAttr.ST_HoleSizeUByte = gooxml.Uint8(50)
c.x.HoleSize.ValAttr.ST_HoleSizeUByte = unioffice.Uint8(50)
}

// SetHoleSize controls the hole size in the pie chart and is measured in percent.
Expand Down
2 changes: 1 addition & 1 deletion chart/legend.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (l Legend) SetPosition(p crt.ST_LegendPos) {

func (l Legend) SetOverlay(b bool) {
l.x.Overlay = crt.NewCT_Boolean()
l.x.Overlay.ValAttr = gooxml.Bool(b)
l.x.Overlay.ValAttr = unioffice.Bool(b)
}

func (l Legend) Properties() drawing.ShapeProperties {
Expand Down
2 changes: 1 addition & 1 deletion chart/pie3dchart.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c Pie3DChart) X() *crt.CT_Pie3DChart {
// InitializeDefaults the bar chart to its defaults
func (c Pie3DChart) InitializeDefaults() {
c.x.VaryColors = crt.NewCT_Boolean()
c.x.VaryColors.ValAttr = gooxml.Bool(true)
c.x.VaryColors.ValAttr = unioffice.Bool(true)
}

// AddSeries adds a default series to an Pie3D chart.
Expand Down
2 changes: 1 addition & 1 deletion chart/piechart.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c PieChart) X() *crt.CT_PieChart {
// InitializeDefaults the bar chart to its defaults
func (c PieChart) InitializeDefaults() {
c.x.VaryColors = crt.NewCT_Boolean()
c.x.VaryColors.ValAttr = gooxml.Bool(true)
c.x.VaryColors.ValAttr = unioffice.Bool(true)

}

Expand Down
4 changes: 2 additions & 2 deletions chart/pieofpiechart.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func (c PieOfPieChart) X() *crt.CT_OfPieChart {
// InitializeDefaults the bar chart to its defaults
func (c PieOfPieChart) InitializeDefaults() {
c.x.VaryColors = crt.NewCT_Boolean()
c.x.VaryColors.ValAttr = gooxml.Bool(true)
c.x.VaryColors.ValAttr = unioffice.Bool(true)
c.SetType(crt.ST_OfPieTypePie)
c.x.SecondPieSize = crt.NewCT_SecondPieSize()
c.x.SecondPieSize.ValAttr = &crt.ST_SecondPieSize{}
c.x.SecondPieSize.ValAttr.ST_SecondPieSizeUShort = gooxml.Uint16(75)
c.x.SecondPieSize.ValAttr.ST_SecondPieSizeUShort = unioffice.Uint16(75)
cl := crt.NewCT_ChartLines()
cl.SpPr = dml.NewCT_ShapeProperties()
sp := drawing.MakeShapeProperties(cl.SpPr)
Expand Down
2 changes: 1 addition & 1 deletion chart/stockchart.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c StockChart) InitializeDefaults() {
c.x.UpDownBars = crt.NewCT_UpDownBars()
c.x.UpDownBars.GapWidth = crt.NewCT_GapAmount()
c.x.UpDownBars.GapWidth.ValAttr = &crt.ST_GapAmount{}
c.x.UpDownBars.GapWidth.ValAttr.ST_GapAmountUShort = gooxml.Uint16(150)
c.x.UpDownBars.GapWidth.ValAttr.ST_GapAmountUShort = unioffice.Uint16(150)
c.x.UpDownBars.UpBars = crt.NewCT_UpDownBar()
c.x.UpDownBars.DownBars = crt.NewCT_UpDownBar()
}
Expand Down
2 changes: 1 addition & 1 deletion chart/surface3dchart.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c Surface3DChart) X() *crt.CT_Surface3DChart {

func (c Surface3DChart) InitializeDefaults() {
c.x.Wireframe = crt.NewCT_Boolean()
c.x.Wireframe.ValAttr = gooxml.Bool(false)
c.x.Wireframe.ValAttr = unioffice.Bool(false)

c.x.BandFmts = crt.NewCT_BandFmts()
for i := 0; i < 15; i++ {
Expand Down
2 changes: 1 addition & 1 deletion chart/surfacechart.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c SurfaceChart) X() *crt.CT_SurfaceChart {

func (c SurfaceChart) InitializeDefaults() {
c.x.Wireframe = crt.NewCT_Boolean()
c.x.Wireframe.ValAttr = gooxml.Bool(false)
c.x.Wireframe.ValAttr = unioffice.Bool(false)

c.x.BandFmts = crt.NewCT_BandFmts()
for i := 0; i < 15; i++ {
Expand Down
4 changes: 2 additions & 2 deletions color/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func (c Color) IsAuto() bool {
// AsRGBString is used by the various wrappers to return a pointer
// to a string containing a six digit hex RGB value.
func (c Color) AsRGBString() *string {
return gooxml.Stringf("%02x%02x%02x", c.r, c.g, c.b)
return unioffice.Stringf("%02x%02x%02x", c.r, c.g, c.b)
}

// AsRGBAString is used by the various wrappers to return a pointer
// to a string containing a six digit hex RGB value.
func (c Color) AsRGBAString() *string {
return gooxml.Stringf("%02x%02x%02x%02x", c.a, c.r, c.g, c.b)
return unioffice.Stringf("%02x%02x%02x%02x", c.a, c.r, c.g, c.b)
}
6 changes: 3 additions & 3 deletions common/appproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewAppProperties() AppProperties {
p.SetDocSecurity(0)
p.SetLinksUpToDate(false)
// trim the 'v'
ver := strings.Replace(gooxml.ReleaseVersion, "v", "", -1)
ver := strings.Replace(unioffice.ReleaseVersion, "v", "", -1)
f, _ := strconv.ParseFloat(ver, 64)
p.SetApplicationVersion(fmt.Sprintf("%07.4f", f))
return p
Expand All @@ -47,12 +47,12 @@ func (a AppProperties) Application() string {

// SetLinksUpToDate sets the links up to date flag.
func (a AppProperties) SetLinksUpToDate(v bool) {
a.x.LinksUpToDate = gooxml.Bool(v)
a.x.LinksUpToDate = unioffice.Bool(v)
}

// SetDocSecurity sets the document security flag.
func (a AppProperties) SetDocSecurity(v int32) {
a.x.DocSecurity = gooxml.Int32(v)
a.x.DocSecurity = unioffice.Int32(v)
}

// SetApplication sets the name of the application that created the document.
Expand Down
2 changes: 1 addition & 1 deletion common/appproperties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestNewAppDefaultProperties(t *testing.T) {
t.Errorf("unexpected application: %s", got)
}

fv, _ := strconv.ParseFloat(strings.Replace(gooxml.ReleaseVersion, "v", "", -1), 64)
fv, _ := strconv.ParseFloat(strings.Replace(unioffice.ReleaseVersion, "v", "", -1), 64)
if got := ap.ApplicationVersion(); got != fmt.Sprintf("%07.4f", fv) {
t.Errorf("unexpected application version: %s", got)
}
Expand Down
4 changes: 2 additions & 2 deletions common/contenttypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c ContentTypes) AddOverride(path, contentType string) {
path = "/" + path
}
if strings.HasPrefix(contentType, "http") {
gooxml.Log("content type '%s' is incorrect, must not start with http", contentType)
unioffice.Log("content type '%s' is incorrect, must not start with http", contentType)
}
or := content_types.NewOverride()
or.PartNameAttr = path
Expand Down Expand Up @@ -85,7 +85,7 @@ func (c ContentTypes) EnsureOverride(path, contentType string) {
// found one, so just ensure the content type matches and bail
if ovr.PartNameAttr == path {
if strings.HasPrefix(contentType, "http") {
gooxml.Log("content type '%s' is incorrect, must not start with http", contentType)
unioffice.Log("content type '%s' is incorrect, must not start with http", contentType)
}
ovr.ContentTypeAttr = contentType
return
Expand Down
16 changes: 8 additions & 8 deletions common/coreproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c CoreProperties) Author() string {
// SetAuthor records the author of the document.
func (c CoreProperties) SetAuthor(s string) {
if c.x.Creator == nil {
c.x.Creator = &gooxml.XSDAny{XMLName: xml.Name{Local: "dc:creator"}}
c.x.Creator = &unioffice.XSDAny{XMLName: xml.Name{Local: "dc:creator"}}
}
c.x.Creator.Data = []byte(s)
}
Expand All @@ -87,13 +87,13 @@ func (c CoreProperties) SetLastModifiedBy(s string) {

// SetLanguage records the language of the document.
func (c CoreProperties) SetLanguage(s string) {
c.x.Language = &gooxml.XSDAny{XMLName: xml.Name{Local: "dc:language"}}
c.x.Language = &unioffice.XSDAny{XMLName: xml.Name{Local: "dc:language"}}
c.x.Language.Data = []byte(s)
}

const cpTimeFormatW3CDTF = "2006-01-02T15:04:05Z"

func parseTime(x *gooxml.XSDAny) time.Time {
func parseTime(x *unioffice.XSDAny) time.Time {
if x == nil {
return time.Time{}
}
Expand All @@ -105,7 +105,7 @@ func parseTime(x *gooxml.XSDAny) time.Time {

t, err := time.Parse(cpTimeFormatW3CDTF, string(x.Data))
if err != nil {
gooxml.Log("error parsing time from %s: %s", string(x.Data), err)
unioffice.Log("error parsing time from %s: %s", string(x.Data), err)
}
return t
}
Expand All @@ -115,8 +115,8 @@ func (c CoreProperties) Created() time.Time {
return parseTime(c.x.Created)
}

func cpSetTime(t time.Time, name string) *gooxml.XSDAny {
x := &gooxml.XSDAny{XMLName: xml.Name{Local: name}}
func cpSetTime(t time.Time, name string) *unioffice.XSDAny {
x := &unioffice.XSDAny{XMLName: xml.Name{Local: name}}
x.Attrs = append(x.Attrs,
xml.Attr{Name: xml.Name{Local: "xsi:type"}, Value: "dcterms:W3CDTF"})
x.Attrs = append(x.Attrs,
Expand Down Expand Up @@ -153,7 +153,7 @@ func (c CoreProperties) Title() string {
// SetTitle records the title of the document.
func (c CoreProperties) SetTitle(s string) {
if c.x.Title == nil {
c.x.Title = &gooxml.XSDAny{XMLName: xml.Name{Local: "dc:title"}}
c.x.Title = &unioffice.XSDAny{XMLName: xml.Name{Local: "dc:title"}}
}
c.x.Title.Data = []byte(s)
}
Expand All @@ -169,7 +169,7 @@ func (c CoreProperties) Description() string {
// SetDescription records the description of the document.
func (c CoreProperties) SetDescription(s string) {
if c.x.Description == nil {
c.x.Description = &gooxml.XSDAny{XMLName: xml.Name{Local: "dc:description"}}
c.x.Description = &unioffice.XSDAny{XMLName: xml.Name{Local: "dc:description"}}
}
c.x.Description.Data = []byte(s)
}
8 changes: 4 additions & 4 deletions common/relationships.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ func (r Relationships) FindRIDForN(i int, t string) string {
// AddAutoRelationship adds a relationship with an automatically generated
// filename based off of the type. It should be preferred over AddRelationship
// to ensure consistent filenames are maintained.
func (r Relationships) AddAutoRelationship(dt gooxml.DocType, src string, idx int, ctype string) Relationship {
return r.AddRelationship(gooxml.RelativeFilename(dt, src, ctype, idx), ctype)
func (r Relationships) AddAutoRelationship(dt unioffice.DocType, src string, idx int, ctype string) Relationship {
return r.AddRelationship(unioffice.RelativeFilename(dt, src, ctype, idx), ctype)
}

// AddRelationship adds a relationship.
func (r Relationships) AddRelationship(target, ctype string) Relationship {
if !strings.HasPrefix(ctype, "http://") {
gooxml.Log("relationship type %s should start with 'http://'", ctype)
unioffice.Log("relationship type %s should start with 'http://'", ctype)
}
rel := relationships.NewRelationship()
nextID := len(r.x.Relationship) + 1
Expand Down Expand Up @@ -102,7 +102,7 @@ type Hyperlink Relationship

// AddHyperlink adds an external hyperlink relationship.
func (r Relationships) AddHyperlink(target string) Hyperlink {
rel := r.AddRelationship(target, gooxml.HyperLinkType)
rel := r.AddRelationship(target, unioffice.HyperLinkType)
rel.x.TargetModeAttr = relationships.ST_TargetModeExternal
return Hyperlink(rel)
}
Expand Down
Loading

0 comments on commit 270664c

Please sign in to comment.