diff options
| author | xuri <xuri.me@gmail.com> | 2020-05-22 16:53:46 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-22 16:53:46 +0800 |
| commit | ec14de32f0c06f7a26b6b79578f666c0cc50b72c (patch) | |
| tree | c6ebd61a7d9a7da5b993ffb82e4fb6c036e75d6a /xmlDecodeDrawing.go | |
| parent | aa7eadbffe6ae2f9f86201bbaaa4c1d1e8829cae (diff) | |
| parent | 2efc7107ff30dc7f1e1a798082616ee488f99489 (diff) | |
Merge branch 'master' into fix/cell_lock
Diffstat (limited to 'xmlDecodeDrawing.go')
| -rw-r--r-- | xmlDecodeDrawing.go | 115 |
1 files changed, 76 insertions, 39 deletions
diff --git a/xmlDecodeDrawing.go b/xmlDecodeDrawing.go index eead575..93e0e82 100644 --- a/xmlDecodeDrawing.go +++ b/xmlDecodeDrawing.go @@ -1,29 +1,65 @@ -// Copyright 2016 - 2019 The excelize Authors. All rights reserved. Use of +// Copyright 2016 - 2020 The excelize Authors. All rights reserved. Use of // this source code is governed by a BSD-style license that can be found in // the LICENSE file. // // Package excelize providing a set of functions that allow you to write to // and read from XLSX files. Support reads and writes XLSX file generated by // Microsoft Excelâ„¢ 2007 and later. Support save file without losing original -// charts of XLSX. This library needs Go version 1.8 or later. +// charts of XLSX. This library needs Go version 1.10 or later. package excelize import "encoding/xml" -// decodeCellAnchor directly maps the oneCellAnchor (One Cell Anchor Shape Size) -// and twoCellAnchor (Two Cell Anchor Shape Size). This element specifies a two -// cell anchor placeholder for a group, a shape, or a drawing element. It moves -// with cells and its extents are in EMU units. +// decodeCellAnchor directly maps the oneCellAnchor (One Cell Anchor Shape +// Size) and twoCellAnchor (Two Cell Anchor Shape Size). This element +// specifies a two cell anchor placeholder for a group, a shape, or a drawing +// element. It moves with cells and its extents are in EMU units. type decodeCellAnchor struct { - EditAs string `xml:"editAs,attr,omitempty"` - Content string `xml:",innerxml"` + EditAs string `xml:"editAs,attr,omitempty"` + From *decodeFrom `xml:"from"` + To *decodeTo `xml:"to"` + Sp *decodeSp `xml:"sp"` + ClientData *decodeClientData `xml:"clientData"` + Content string `xml:",innerxml"` +} + +// xdrSp (Shape) directly maps the sp element. This element specifies the +// existence of a single shape. A shape can either be a preset or a custom +// geometry, defined using the SpreadsheetDrawingML framework. In addition to +// a geometry each shape can have both visual and non-visual properties +// attached. Text and corresponding styling information can also be attached +// to a shape. This shape is specified along with all other shapes within +// either the shape tree or group shape elements. +type decodeSp struct { + NvSpPr *decodeNvSpPr `xml:"nvSpPr"` + SpPr *decodeSpPr `xml:"spPr"` +} + +// decodeSp (Non-Visual Properties for a Shape) directly maps the nvSpPr +// element. This element specifies all non-visual properties for a shape. This +// element is a container for the non-visual identification properties, shape +// properties and application properties that are to be associated with a +// shape. This allows for additional information that does not affect the +// appearance of the shape to be stored. +type decodeNvSpPr struct { + CNvPr *decodeCNvPr `xml:"cNvPr"` + ExtLst *decodeExt `xml:"extLst"` + CNvSpPr *decodeCNvSpPr `xml:"cNvSpPr"` +} + +// decodeCNvSpPr (Connection Non-Visual Shape Properties) directly maps the +// cNvSpPr element. This element specifies the set of non-visual properties +// for a connection shape. These properties specify all data about the +// connection shape which do not affect its display within a spreadsheet. +type decodeCNvSpPr struct { + TxBox bool `xml:"txBox,attr"` } // decodeWsDr directly maps the root element for a part of this content type -// shall wsDr. In order to solve the problem that the label structure is changed -// after serialization and deserialization, two different structures are -// defined. decodeWsDr just for deserialization. +// shall wsDr. In order to solve the problem that the label structure is +// changed after serialization and deserialization, two different structures +// are defined. decodeWsDr just for deserialization. type decodeWsDr struct { A string `xml:"xmlns a,attr"` Xdr string `xml:"xmlns xdr,attr"` @@ -34,9 +70,9 @@ type decodeWsDr struct { } // decodeTwoCellAnchor directly maps the oneCellAnchor (One Cell Anchor Shape -// Size) and twoCellAnchor (Two Cell Anchor Shape Size). This element specifies -// a two cell anchor placeholder for a group, a shape, or a drawing element. It -// moves with cells and its extents are in EMU units. +// Size) and twoCellAnchor (Two Cell Anchor Shape Size). This element +// specifies a two cell anchor placeholder for a group, a shape, or a drawing +// element. It moves with cells and its extents are in EMU units. type decodeTwoCellAnchor struct { From *decodeFrom `xml:"from"` To *decodeTo `xml:"to"` @@ -46,7 +82,8 @@ type decodeTwoCellAnchor struct { // decodeCNvPr directly maps the cNvPr (Non-Visual Drawing Properties). This // element specifies non-visual canvas properties. This allows for additional -// information that does not affect the appearance of the picture to be stored. +// information that does not affect the appearance of the picture to be +// stored. type decodeCNvPr struct { ID int `xml:"id,attr"` Name string `xml:"name,attr"` @@ -55,8 +92,8 @@ type decodeCNvPr struct { } // decodePicLocks directly maps the picLocks (Picture Locks). This element -// specifies all locking properties for a graphic frame. These properties inform -// the generating application about specific properties that have been +// specifies all locking properties for a graphic frame. These properties +// inform the generating application about specific properties that have been // previously locked and thus should not be changed. type decodePicLocks struct { NoAdjustHandles bool `xml:"noAdjustHandles,attr,omitempty"` @@ -82,9 +119,9 @@ type decodeBlip struct { R string `xml:"r,attr"` } -// decodeStretch directly maps the stretch element. This element specifies that -// a BLIP should be stretched to fill the target rectangle. The other option is -// a tile where a BLIP is tiled to fill the available area. +// decodeStretch directly maps the stretch element. This element specifies +// that a BLIP should be stretched to fill the target rectangle. The other +// option is a tile where a BLIP is tiled to fill the available area. type decodeStretch struct { FillRect string `xml:"fillRect"` } @@ -128,12 +165,12 @@ type decodeCNvPicPr struct { PicLocks decodePicLocks `xml:"picLocks"` } -// directly maps the nvPicPr (Non-Visual Properties for a Picture). This element -// specifies all non-visual properties for a picture. This element is a -// container for the non-visual identification properties, shape properties and -// application properties that are to be associated with a picture. This allows -// for additional information that does not affect the appearance of the picture -// to be stored. +// directly maps the nvPicPr (Non-Visual Properties for a Picture). This +// element specifies all non-visual properties for a picture. This element is +// a container for the non-visual identification properties, shape properties +// and application properties that are to be associated with a picture. This +// allows for additional information that does not affect the appearance of +// the picture to be stored. type decodeNvPicPr struct { CNvPr decodeCNvPr `xml:"cNvPr"` CNvPicPr decodeCNvPicPr `xml:"cNvPicPr"` @@ -148,20 +185,20 @@ type decodeBlipFill struct { Stretch decodeStretch `xml:"stretch"` } -// decodeSpPr directly maps the spPr (Shape Properties). This element specifies -// the visual shape properties that can be applied to a picture. These are the -// same properties that are allowed to describe the visual properties of a shape -// but are used here to describe the visual appearance of a picture within a -// document. +// decodeSpPr directly maps the spPr (Shape Properties). This element +// specifies the visual shape properties that can be applied to a picture. +// These are the same properties that are allowed to describe the visual +// properties of a shape but are used here to describe the visual appearance +// of a picture within a document. type decodeSpPr struct { - Xfrm decodeXfrm `xml:"a:xfrm"` - PrstGeom decodePrstGeom `xml:"a:prstGeom"` + Xfrm decodeXfrm `xml:"xfrm"` + PrstGeom decodePrstGeom `xml:"prstGeom"` } -// decodePic elements encompass the definition of pictures within the DrawingML -// framework. While pictures are in many ways very similar to shapes they have -// specific properties that are unique in order to optimize for picture- -// specific scenarios. +// decodePic elements encompass the definition of pictures within the +// DrawingML framework. While pictures are in many ways very similar to shapes +// they have specific properties that are unique in order to optimize for +// picture- specific scenarios. type decodePic struct { NvPicPr decodeNvPicPr `xml:"nvPicPr"` BlipFill decodeBlipFill `xml:"blipFill"` @@ -184,8 +221,8 @@ type decodeTo struct { RowOff int `xml:"rowOff"` } -// decodeClientData directly maps the clientData element. An empty element which -// specifies (via attributes) certain properties related to printing and +// decodeClientData directly maps the clientData element. An empty element +// which specifies (via attributes) certain properties related to printing and // selection of the drawing object. The fLocksWithSheet attribute (either true // or false) determines whether to disable selection when the sheet is // protected, and fPrintsWithSheet attribute (either true or false) determines |
