unioffice/common/appproperties.go

74 lines
2.1 KiB
Go
Raw Normal View History

2017-08-28 20:56:18 -05:00
// 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 sales@baliance.com.
package common
import (
2017-09-23 08:43:39 -05:00
"baliance.com/gooxml/schema/soo/ofc/extended_properties"
2017-08-28 20:56:18 -05:00
)
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct {
x *extended_properties.Properties
}
// NewAppProperties constructs a new AppProperties.
func NewAppProperties() AppProperties {
p := AppProperties{x: extended_properties.NewProperties()}
2017-09-02 13:45:42 -05:00
p.SetApplication("baliance.com/gooxml")
p.SetApplicationVersion("0.1")
2017-08-28 20:56:18 -05:00
return p
}
2017-09-02 13:45:42 -05:00
// Application returns the name of the application that created the document.
// For gooxml created documents, it defaults to baliance.com/gooxml
func (a AppProperties) Application() string {
if a.x.Application != nil {
return *a.x.Application
}
return ""
}
// SetApplication sets the name of the application that created the document.
func (a AppProperties) SetApplication(s string) {
a.x.Application = &s
}
// ApplicationVersion returns the version of the application that created the
// document.
func (a AppProperties) ApplicationVersion() string {
if a.x.AppVersion != nil {
return *a.x.AppVersion
}
return ""
}
// SetApplicationVersion sets the version of the application that created the document.
func (a AppProperties) SetApplicationVersion(s string) {
a.x.AppVersion = &s
}
2017-08-28 20:56:18 -05:00
// X returns the inner wrapped XML type.
func (a AppProperties) X() *extended_properties.Properties {
return a.x
}
2017-09-02 13:45:42 -05:00
// Company returns the name of the company that created the document.
// For gooxml created documents, it defaults to baliance.com/gooxml
func (a AppProperties) Company() string {
if a.x.Company != nil {
return *a.x.Company
}
return ""
}
// SetCompany sets the name of the company that created the document.
func (a AppProperties) SetCompany(s string) {
a.x.Company = &s
}