unioffice/internal/convertutils/convertutils.go

12 lines
41 KiB
Go
Raw Normal View History

2021-08-23 20:44:48 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2023-09-16 17:56:36 +00:00
package convertutils ;import (_d "bytes";_ef "errors";_e "fmt";_bc "github.com/unidoc/unioffice/common/logger";_aa "github.com/unidoc/unioffice/measurement";_fba "github.com/unidoc/unioffice/schema/soo/dml";_bd "github.com/unidoc/unioffice/schema/soo/dml/chart";_fb "github.com/unidoc/unioffice/spreadsheet/format";_gg "github.com/unidoc/unipdf/v3/creator";_ce "github.com/unidoc/unipdf/v3/model";_adc "github.com/unidoc/unipdf/v3/render";_bb "github.com/unidoc/unitype";_c "image";_ad "math";_g "os";_ba "sort";_ge "strconv";_fe "strings";_b "sync";_f "unicode";);func (_dac barSerByOrder )Swap (i ,j int ){_dac [i ],_dac [j ]=_dac [j ],_dac [i ]};func FromSTCoordinate (st _fba .ST_Coordinate )int64 {if _babg :=st .ST_CoordinateUnqualified ;_babg !=nil {return *_babg ;};return 0;};type legendItem struct{_acd string ;_afc *_fba .CT_ShapeProperties ;};func GetRegisteredFont (name string ,style FontStyle )*_ce .PdfFont {_cdac ._adec .Lock ();defer _cdac ._adec .Unlock ();if _aaab ,_fagb :=_cdac ._cgdg [name ];_fagb {if _gggg ,_feeg :=_aaab [style ];_feeg {return _gggg ;};};return nil ;};var _bg =_ebfa (1.5);var _gfbe =_ebfa (1.5);type serCategory struct{_ece string ;_aeda []serValue ;};var _ggbc =_ebfa (5);func _cbg (_gaag *_bd .CT_ValAx )(uint32 ,_bd .ST_AxPos ,_bd .ST_TickMark ,_bd .ST_TickLblPos ,*_bd .CT_ChartLines ,uint32 ,*_fba .CT_ShapeProperties ,error ){var _bef ,_bbae uint32 ;var _befg _bd .ST_AxPos ;var _gdfc _bd .ST_TickMark ;var _ecb *_bd .CT_ChartLines ;var _dbbf _bd .ST_TickLblPos ;if _gaag .AxId ==nil {return _bef ,_befg ,_gdfc ,_dbbf ,_ecb ,_bbae ,_gaag .SpPr ,_ef .New ("\u004e\u006f\u0020x\u0020\u0061\u0078\u0069\u0073\u0020\u0049\u0044");}else {_bef =_gaag .AxId .ValAttr ;};if _gaag .AxPos ==nil {return _bef ,_befg ,_gdfc ,_dbbf ,_ecb ,_bbae ,_gaag .SpPr ,_ef .New ("\u004eo\u0020x\u0020\u0061\u0078\u0069\u0073 \u0070\u006fs\u0069\u0074\u0069\u006f\u006e");}else {_befg =_gaag .AxPos .ValAttr ;};if _gaag .MajorTickMark !=nil {_gdfc =_gaag .MajorTickMark .ValAttr ;};if _gaag .TickLblPos !=nil {_dbbf =_gaag .TickLblPos .ValAttr ;};if _gaag .CrossAx ==nil {return _bef ,_befg ,_gdfc ,_dbbf ,_ecb ,_bbae ,_gaag .SpPr ,_ef .New ("\u004e\u006f \u0063\u0072\u006fs\u0073\u0020\u0061\u0078\u0069\u0073\u0020\u0049\u0044");}else {_bbae =_gaag .CrossAx .ValAttr ;};_ecb =_gaag .MajorGridlines ;return _bef ,_befg ,_gdfc ,_dbbf ,_ecb ,_bbae ,_gaag .SpPr ,nil ;};func MakeImageFromChartSpace (cs *_bd .ChartSpace ,width ,height float64 ,theme *_fba .Theme )(_c .Image ,error ){_dae ,_fgbf :=_ebf (cs ,width ,height ,theme ,true );if _fgbf !=nil {return nil ,_fgbf ;};_baf ,_fgbf :=GetPageFromCreator (_dae );if _fgbf !=nil {return nil ,_fgbf ;};return _adc .NewImageDevice ().Render (_baf );};func RegisterFont (name string ,style FontStyle ,font *_ce .PdfFont ){_cdac ._adec .Lock ();if _cdac ._cgdg [name ]==nil {_cdac ._cgdg [name ]=map[FontStyle ]*_ce .PdfFont {};};_cdac ._cgdg [name ][style ]=font ;_cdac ._adec .Unlock ();};func FromSTCoordinate32 (st _fba .ST_Coordinate32 )int64 {if _edb :=st .ST_Coordinate32Unqualified ;_edb !=nil {return int64 (*_edb );};return 0;};var _fbb =_ebfa (1.5);func DrawRectangle (c *_gg .Creator ,r *Rectangle ,w float64 ,color _gg .Color ){if color ==nil {return ;};DrawLine (c ,r .Left ,r .Top ,r .Right ,r .Top ,w ,color );DrawLine (c ,r .Left ,r .Top ,r .Left ,r .Bottom ,w ,color );DrawLine (c ,r .Left ,r .Bottom ,r .Right ,r .Bottom ,w ,color );DrawLine (c ,r .Right ,r .Top ,r .Right ,r .Bottom ,w ,color );};func (_bdbf *Rectangle )Translate (x ,y float64 ){_bdbf .Left +=x ;_bdbf .Right +=x ;_bdbf .Top +=y ;_bdbf .Bottom +=y ;};func (_dgac *Rectangle )scale (_afde float64 ){_dgac .Top *=_afde ;_dgac .Bottom *=_afde ;_dgac .Left *=_afde ;_dgac .Right *=_afde ;};type FontStyle byte ;const (FontStyle_Regular FontStyle =0;FontStyle_Bold FontStyle =1;FontStyle_Italic FontStyle =2;FontStyle_BoldItalic FontStyle =3;);func _efe (_bbb *_bd .CT_DateAx )(uint32 ,_bd .ST_AxPos ,_bd .ST_TickMark ,_bd .ST_TickLblPos ,*_bd .CT_ChartLines ,uint32 ,*_fba .CT_ShapeProperties ,error ){var _fbbcf ,_gabae uint32 ;var _dgb _b