forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabsoluteanchor.go
67 lines (54 loc) · 1.96 KB
/
absoluteanchor.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
// 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"
)
// AbsoluteAnchor has a fixed top-left corner in distance units as well as a
// fixed height/width.
type AbsoluteAnchor struct {
x *sd.CT_AbsoluteAnchor
}
// SetColOffset sets the column offset of the top-left of the image in fixed units.
func (a AbsoluteAnchor) SetColOffset(m measurement.Distance) {
a.x.Pos.XAttr.ST_CoordinateUnqualified = unioffice.Int64(int64(m / measurement.EMU))
}
// SetRowOffset sets the row offset of the top-left of the image in fixed units.
func (a AbsoluteAnchor) SetRowOffset(m measurement.Distance) {
a.x.Pos.YAttr.ST_CoordinateUnqualified = unioffice.Int64(int64(m / measurement.EMU))
}
// SetHeight sets the height of the anchored object.
func (a AbsoluteAnchor) SetHeight(h measurement.Distance) {
a.x.Ext.CyAttr = int64(h / measurement.EMU)
}
// SetWidth sets the width of the anchored object.
func (a AbsoluteAnchor) SetWidth(w measurement.Distance) {
a.x.Ext.CxAttr = int64(w / measurement.EMU)
}
// SetHeightCells is a no-op.
func (a AbsoluteAnchor) SetHeightCells(int32) {
}
// TopLeft is a no-op.
func (a AbsoluteAnchor) TopLeft() CellMarker {
return CellMarker{}
}
// BottomRight is a no-op.
func (a AbsoluteAnchor) BottomRight() CellMarker {
return CellMarker{}
}
// MoveTo is a no-op.
func (a AbsoluteAnchor) MoveTo(x, y int32) {
}
// SetWidthCells is a no-op.
func (a AbsoluteAnchor) SetWidthCells(int32) {
}
// Type returns the type of anchor
func (a AbsoluteAnchor) Type() AnchorType {
return AnchorTypeAbsolute
}