forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcellmarker.go
70 lines (58 loc) · 2 KB
/
cellmarker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2017 FoxyUtils ehf. 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 on https://unidoc.io.
package spreadsheet
import (
"github.com/unidoc/unioffice"
"github.com/unidoc/unioffice/measurement"
sd "github.com/unidoc/unioffice/schema/soo/dml/spreadsheetDrawing"
)
// CellMarker represents a cell position
type CellMarker struct {
x *sd.CT_Marker
}
// X returns the inner wrapped XML type.
func (c CellMarker) X() *sd.CT_Marker {
return c.x
}
// Col returns the column of the cell marker.
func (c CellMarker) Col() int32 {
return c.x.Col
}
// SetCol set the column of the cell marker.
func (c CellMarker) SetCol(col int32) {
c.x.Col = col
}
// Row returns the row of the cell marker.
func (c CellMarker) Row() int32 {
return c.x.Row
}
// SetRow set the row of the cell marker.
func (c CellMarker) SetRow(row int32) {
c.x.Row = row
}
// SetColOffset sets a column offset in absolute distance.
func (c CellMarker) SetColOffset(m measurement.Distance) {
c.x.ColOff.ST_CoordinateUnqualified = unioffice.Int64(int64(m / measurement.EMU))
}
// ColOffset returns the offset from the row cell.
func (c CellMarker) ColOffset() measurement.Distance {
if c.x.RowOff.ST_CoordinateUnqualified == nil {
return 0
}
return measurement.Distance(float64(*c.x.ColOff.ST_CoordinateUnqualified) * measurement.EMU)
}
// SetRowOffset sets a column offset in absolute distance.
func (c CellMarker) SetRowOffset(m measurement.Distance) {
c.x.RowOff.ST_CoordinateUnqualified = unioffice.Int64(int64(m / measurement.EMU))
}
// RowOffset returns the offset from the row cell.
func (c CellMarker) RowOffset() measurement.Distance {
if c.x.RowOff.ST_CoordinateUnqualified == nil {
return 0
}
return measurement.Distance(float64(*c.x.RowOff.ST_CoordinateUnqualified) * measurement.EMU)
}