Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
7ffeca0b
Commit
7ffeca0b
authored
Feb 03, 2017
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Bug 33882
parent
2de28ba9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
314 additions
and
68 deletions
+314
-68
cell/model/DrawingObjects/Format/ShapePrototype.js
cell/model/DrawingObjects/Format/ShapePrototype.js
+8
-0
common/Drawings/DrawingsChanges.js
common/Drawings/DrawingsChanges.js
+126
-35
common/Drawings/Format/Geometry.js
common/Drawings/Format/Geometry.js
+164
-30
common/Drawings/Format/Path.js
common/Drawings/Format/Path.js
+16
-3
No files found.
cell/model/DrawingObjects/Format/ShapePrototype.js
View file @
7ffeca0b
...
...
@@ -220,6 +220,10 @@ AscCommon.extendClass(CChangesDrawingObjectsAddToDrawingObjects, AscDFH.CChanges
this
.
Pos
=
Reader
.
GetLong
();
};
CChangesDrawingObjectsAddToDrawingObjects
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesDrawingObjectsRemoveFromDrawingObjects
(
this
.
Class
,
this
.
Pos
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_AutoShapes_AddToDrawingObjects
]
=
CChangesDrawingObjectsAddToDrawingObjects
;
function
CChangesDrawingObjectsRemoveFromDrawingObjects
(
Class
,
Pos
){
this
.
Type
=
AscDFH
.
historyitem_AutoShapes_RemoveFromDrawingObjects
;
...
...
@@ -240,6 +244,10 @@ AscCommon.extendClass(CChangesDrawingObjectsRemoveFromDrawingObjects, AscDFH.CCh
this
.
Pos
=
Reader
.
GetLong
();
};
CChangesDrawingObjectsRemoveFromDrawingObjects
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesDrawingObjectsAddToDrawingObjects
(
this
.
Class
,
this
.
Pos
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_AutoShapes_RemoveFromDrawingObjects
]
=
CChangesDrawingObjectsRemoveFromDrawingObjects
;
CShape
.
prototype
.
addToDrawingObjects
=
function
(
pos
)
...
...
common/Drawings/DrawingsChanges.js
View file @
7ffeca0b
...
...
@@ -28,6 +28,10 @@
this
.
Redo
();
this
.
RefreshRecalcData
();
};
CChangesDrawingsBool
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
New
,
this
.
Old
,
this
.
Color
);
};
CChangesDrawingsBool
.
prototype
.
ReadFromBinary
=
function
(
reader
)
{
reader
.
Seek2
(
reader
.
GetCurPos
()
-
4
);
...
...
@@ -44,8 +48,16 @@
CChangesDrawingsLong
.
superclass
.
constructor
.
call
(
this
,
Class
,
_OldPr
,
_NewPr
);
}
AscCommon
.
extendClass
(
CChangesDrawingsLong
,
AscDFH
.
CChangesBaseLongProperty
);
CChangesDrawingsLong
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
New
,
this
.
Old
,
this
.
Color
);
};
CChangesDrawingsLong
.
prototype
.
private_SetValue
=
private_SetValue
;
CChangesDrawingsLong
.
prototype
.
Load
=
function
(){
this
.
Redo
();
...
...
@@ -67,6 +79,11 @@
AscCommon
.
extendClass
(
CChangesDrawingsDouble
,
AscDFH
.
CChangesBaseDoubleProperty
);
CChangesDrawingsDouble
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
New
,
this
.
Old
,
this
.
Color
);
};
CChangesDrawingsDouble
.
prototype
.
private_SetValue
=
private_SetValue
;
CChangesDrawingsDouble
.
prototype
.
Load
=
function
(){
...
...
@@ -91,6 +108,11 @@
AscCommon
.
extendClass
(
CChangesDrawingsString
,
AscDFH
.
CChangesBaseStringProperty
);
CChangesDrawingsString
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
New
,
this
.
Old
,
this
.
Color
);
};
CChangesDrawingsString
.
prototype
.
private_SetValue
=
private_SetValue
;
CChangesDrawingsString
.
prototype
.
Load
=
function
(){
...
...
@@ -113,7 +135,12 @@
CChangesDrawingsObjectNoId
.
superclass
.
constructor
.
call
(
this
,
Class
,
_OldPr
,
_NewPr
);
}
AscCommon
.
extendClass
(
CChangesDrawingsObjectNoId
,
AscDFH
.
CChangesBaseObjectProperty
);
CChangesDrawingsObjectNoId
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
New
,
this
.
Old
,
this
.
Color
);
};
CChangesDrawingsObjectNoId
.
prototype
.
private_SetValue
=
private_SetValue
;
CChangesDrawingsObjectNoId
.
prototype
.
Load
=
function
(){
this
.
Redo
();
...
...
@@ -141,7 +168,13 @@
CChangesDrawingsObject
.
superclass
.
constructor
.
call
(
this
,
Class
,
_OldPr
,
_NewPr
);
}
AscCommon
.
extendClass
(
CChangesDrawingsObject
,
AscDFH
.
CChangesBaseStringProperty
);
CChangesDrawingsObject
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
AscCommon
.
g_oTableId
.
Get_ById
(
this
.
New
),
AscCommon
.
g_oTableId
.
Get_ById
(
this
.
Old
),
this
.
Color
);
};
window
[
'
AscDFH
'
].
CChangesDrawingsObject
=
CChangesDrawingsObject
;
CChangesDrawingsObject
.
prototype
.
ReadFromBinary
=
function
(
reader
)
{
reader
.
Seek2
(
reader
.
GetCurPos
()
-
4
);
...
...
@@ -175,10 +208,12 @@
reader
.
Seek2
(
reader
.
GetCurPos
()
-
4
);
this
.
Type
=
reader
.
GetLong
();
this
.
Add
=
reader
.
GetBool
();
this
.
Pos
=
reader
.
GetLong
();
CChangesDrawingsContent
.
superclass
.
ReadFromBinary
.
call
(
this
,
reader
);
};
CChangesDrawingsContent
.
prototype
.
WriteToBinary
=
function
(
writer
)
{
writer
.
WriteBool
(
this
.
IsAdd
());
writer
.
WriteLong
(
this
.
Pos
);
CChangesDrawingsContent
.
superclass
.
WriteToBinary
.
call
(
this
,
writer
);
};
...
...
@@ -206,7 +241,7 @@
};
CChangesDrawingsContent
.
prototype
.
private_InsertInArrayLoad
=
function
()
{
if
(
this
.
PosArray
.
length
<=
0
||
this
.
Items
.
length
<=
0
)
if
(
this
.
Items
.
length
<=
0
)
return
;
var
aChangedArray
=
this
.
private_GetChangedArray
();
...
...
@@ -214,10 +249,10 @@
var
oContentChanges
=
this
.
private_GetContentChanges
(),
nPos
;
for
(
var
i
=
0
;
i
<
this
.
Items
.
length
;
++
i
)
{
if
(
oContentChanges
)
{
nPos
=
oContentChanges
.
Check
(
AscCommon
.
contentchanges_Add
,
this
.
Pos
Array
[
i
]
);
nPos
=
oContentChanges
.
Check
(
AscCommon
.
contentchanges_Add
,
this
.
Pos
+
i
);
}
else
{
nPos
=
this
.
Pos
Array
[
i
]
;
nPos
=
this
.
Pos
+
i
;
}
var
oElement
=
this
.
Items
[
i
];
...
...
@@ -235,10 +270,10 @@
var
oContentChanges
=
this
.
private_GetContentChanges
(),
nPos
;
for
(
var
i
=
0
;
i
<
this
.
Items
.
length
;
++
i
)
{
if
(
oContentChanges
)
{
nPos
=
oContentChanges
.
Check
(
AscCommon
.
contentchanges_Remove
,
this
.
Pos
Array
[
i
]
);
nPos
=
oContentChanges
.
Check
(
AscCommon
.
contentchanges_Remove
,
this
.
Pos
+
i
);
}
else
{
nPos
=
this
.
Pos
Array
[
i
]
;
nPos
=
this
.
Pos
+
i
;
}
if
(
false
===
nPos
)
{
continue
;
...
...
@@ -299,6 +334,23 @@
CChangesDrawingsContent
.
prototype
.
IsContentChange
=
function
()
{
return
false
;
};
CChangesDrawingsContent
.
prototype
.
Copy
=
function
()
{
var
oChanges
=
new
this
.
constructor
(
this
.
Class
,
this
.
Type
,
this
.
Pos
,
this
.
Items
,
this
.
Add
);
oChanges
.
UseArray
=
this
.
UseArray
;
oChanges
.
Pos
=
this
.
Pos
;
for
(
var
nIndex
=
0
,
nCount
=
this
.
PosArray
.
length
;
nIndex
<
nCount
;
++
nIndex
)
oChanges
.
PosArray
[
nIndex
]
=
this
.
PosArray
[
nIndex
];
return
oChanges
;
};
CChangesDrawingsContent
.
prototype
.
CreateReverseChange
=
function
(){
var
oRet
=
this
.
private_CreateReverseChange
(
CChangesDrawingsContent
);
oRet
.
Type
=
this
.
Type
;
oRet
.
Pos
=
this
.
Pos
;
return
oRet
;
};
function
CChangesDrawingsContentNoId
(
Class
,
Type
,
Pos
,
Items
,
isAdd
){
...
...
@@ -342,12 +394,12 @@
CChangesDrawingsContentLongMap
.
prototype
.
private_InsertInArrayLoad
=
function
()
{
if
(
this
.
PosArray
.
length
<=
0
||
this
.
Items
.
length
<=
0
)
if
(
this
.
Items
.
length
<=
0
)
return
;
var
aChangedArray
=
this
.
private_GetChangedArray
();
if
(
null
!==
aChangedArray
)
{
for
(
var
i
=
0
;
i
<
this
.
Items
.
length
;
++
i
)
{
aChangedArray
[
this
.
Pos
Array
[
i
]
]
=
this
.
Items
[
i
];
aChangedArray
[
this
.
Pos
+
i
]
=
this
.
Items
[
i
];
}
}
};
...
...
@@ -356,8 +408,8 @@
var
aChangedArray
=
this
.
private_GetChangedArray
();
if
(
null
!==
aChangedArray
)
{
for
(
var
i
=
0
;
i
<
this
.
PosArray
.
length
;
++
i
)
{
aChangedArray
[
this
.
Pos
Array
[
i
]
]
=
null
;
for
(
var
i
=
0
;
i
<
this
.
Items
.
length
;
++
i
)
{
aChangedArray
[
this
.
Pos
+
i
]
=
null
;
}
}
};
...
...
@@ -427,6 +479,9 @@
this
.
RefreshRecalcData
();
};
CChangesDrawingChangeTheme
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesDrawingChangeTheme
(
this
.
Class
,
this
.
Type
,
this
.
aIndexes
);
};
window
[
'
AscDFH
'
].
CChangesDrawingChangeTheme
=
CChangesDrawingChangeTheme
;
...
...
@@ -480,6 +535,10 @@
this
.
Redo
();
this
.
RefreshRecalcData
();
};
CChangesDrawingTimingLocks
.
prototype
.
CreateReverseChange
=
function
()
{
return
new
this
.
constructor
(
this
.
Class
,
null
,
null
,
null
,
null
,
null
);
};
window
[
'
AscDFH
'
].
CChangesDrawingTimingLocks
=
CChangesDrawingTimingLocks
;
...
...
@@ -556,13 +615,18 @@
this
.
Redo
();
this
.
RefreshRecalcData
();
};
CChangesSparklinesChangeData
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesSparklinesChangeData
(
this
.
Class
,
this
.
NewPr
,
this
.
OldPr
);
};
window
[
'
AscDFH
'
].
CChangesSparklinesChangeData
=
CChangesSparklinesChangeData
;
function
CChangesSparklinesRemoveData
(
Class
,
oSparkline
){
function
CChangesSparklinesRemoveData
(
Class
,
oSparkline
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_Sparkline_RemoveData
;
this
.
sparkline
=
oSparkline
;
this
.
bReverse
=
bReverse
;
CChangesSparklinesRemoveData
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesSparklinesRemoveData
,
AscDFH
.
CChangesBase
);
...
...
@@ -576,6 +640,7 @@
Writer
.
WriteLong
(
this
.
sparkline
.
sqref
.
r1
);
Writer
.
WriteString2
(
this
.
sparkline
.
f
);
}
Writer
.
WriteBool
(
this
.
bReverse
===
true
);
};
CChangesSparklinesRemoveData
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
var
bIsObject
=
Reader
.
GetLong
();
...
...
@@ -586,13 +651,29 @@
this
.
sparkline
.
sqref
=
new
Asc
.
Range
(
col
,
row
,
col
,
row
);
this
.
sparkline
.
setF
(
Reader
.
GetString2
());
}
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesSparklinesRemoveData
.
prototype
.
Undo
=
function
(){
this
.
Class
.
arrSparklines
.
push
(
this
.
sparkline
);
if
(
this
.
bReverse
){
this
.
Class
.
remove
(
this
.
sparkline
.
sqref
);
}
else
{
this
.
Class
.
arrSparklines
.
push
(
this
.
sparkline
);
}
};
CChangesSparklinesRemoveData
.
prototype
.
Redo
=
function
(){
this
.
Class
.
remove
(
this
.
sparkline
.
sqref
);
if
(
this
.
bReverse
){
this
.
Class
.
arrSparklines
.
push
(
this
.
sparkline
);
}
else
{
this
.
Class
.
remove
(
this
.
sparkline
.
sqref
);
}
};
CChangesSparklinesRemoveData
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesSparklinesRemoveData
(
this
.
Class
,
this
.
sparkline
,
!
this
.
bReverse
);
};
...
...
@@ -685,50 +766,60 @@
break
;
}
};
CChangesDrawingsExcelColor
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesDrawingsExcelColor
(
this
.
Class
,
this
.
Type
,
this
.
NewPr
,
this
.
OldPr
);
};
AscDFH
.
CChangesDrawingsExcelColor
=
CChangesDrawingsExcelColor
;
function
CChangesDrawingsSparklinesRemove
(
Class
){
function
CChangesDrawingsSparklinesRemove
(
Class
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_Sparkline_RemoveSparkline
;
this
.
bReverse
=
bReverse
;
CChangesDrawingsSparklinesRemove
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesDrawingsSparklinesRemove
,
AscDFH
.
CChangesBase
);
CChangesDrawingsSparklinesRemove
.
prototype
.
Undo
=
function
(){
if
(
this
.
Class
.
worksheet
)
{
this
.
Class
.
worksheet
.
insertSparklineGroup
(
this
.
Class
);
if
(
this
.
bReverse
){
this
.
Class
.
worksheet
.
removeSparklineGroup
(
this
.
Class
.
Get_Id
());
}
else
{
this
.
Class
.
worksheet
.
insertSparklineGroup
(
this
.
Class
);
}
}
};
CChangesDrawingsSparklinesRemove
.
prototype
.
Redo
=
function
(){
if
(
this
.
Class
.
worksheet
)
{
this
.
Class
.
worksheet
.
removeSparklineGroup
(
this
.
Class
.
Get_Id
());
if
(
this
.
bReverse
){
this
.
Class
.
worksheet
.
insertSparklineGroup
(
this
.
Class
);
}
else
{
this
.
Class
.
worksheet
.
removeSparklineGroup
(
this
.
Class
.
Get_Id
());
}
}
};
CChangesDrawingsSparklinesRemove
.
prototype
.
WriteToBinary
=
function
(
Writer
){
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesDrawingsSparklinesRemove
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesDrawingsSparklinesRemove
.
prototype
.
Load
=
function
(){
this
.
Redo
();
this
.
RefreshRecalcData
();
};
window
[
'
AscDFH
'
].
CChangesDrawingsSparklinesRemove
=
CChangesDrawingsSparklinesRemove
;
function
CChangesDrawingsSparklineRemoveData
(
Class
,
Col
,
Row
){
this
.
Type
=
AscDFH
.
historyitem_Sparkline_RemoveData
;
this
.
Col
=
Col
;
this
.
Row
=
Row
;
CChangesDrawingsSparklineRemoveData
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
CChangesDrawingsSparklineRemoveData
.
prototype
.
WriteToBinary
=
function
(
Writer
){
Writer
.
WriteLong
(
this
.
Col
);
Writer
.
WriteLong
(
this
.
Row
);
};
CChangesDrawingsSparklineRemoveData
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
Col
=
Reader
.
GetLong
();
this
.
Row
=
Reader
.
GetLong
();
CChangesDrawingsSparklinesRemove
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesDrawingsSparklinesRemove
(
this
.
Class
,
!
this
.
bReverse
);
};
window
[
'
AscDFH
'
].
CChangesDrawingsSparklinesRemove
=
CChangesDrawingsSparklinesRemove
;
CChangesDrawingsSparklineRemoveData
.
prototype
.
Undo
=
function
(){
};
CChangesDrawingsSparklineRemoveData
.
prototype
.
Redo
=
function
(){
this
.
Class
.
remove
(
new
Asc
.
Range
(
this
.
Col
,
this
.
Row
,
this
.
Col
,
this
.
Row
));
};
...
...
common/Drawings/Format/Geometry.js
View file @
7ffeca0b
...
...
@@ -381,17 +381,30 @@ function CalculateAhPolarList(ahPolarListInfo, ahPolarLst, gdLst)
}
}
function
CChangesGeometryAddAdj
(
Class
,
Name
,
OldValue
,
NewValue
,
OldAvValue
){
function
CChangesGeometryAddAdj
(
Class
,
Name
,
OldValue
,
NewValue
,
OldAvValue
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddAdj
;
this
.
Name
=
Name
;
this
.
OldValue
=
OldValue
;
this
.
NewValue
=
NewValue
;
this
.
OldAvValue
=
OldAvValue
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddAdj
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddAdj
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddAdj
.
prototype
.
Undo
=
function
(){
CChangesGeometryAddAdj
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesGeometryAddAdj
(
this
.
Class
,
this
.
Name
,
this
.
OldValue
,
this
.
NewValue
,
this
.
OldAvValue
,
!
this
.
bReverse
)
};
CChangesGeometryAddAdj
.
prototype
.
AddAdj
=
function
(){
this
.
Class
.
gdLst
[
this
.
Name
]
=
parseInt
(
this
.
NewValue
);
this
.
Class
.
avLst
[
this
.
Name
]
=
true
;
};
CChangesGeometryAddAdj
.
prototype
.
RemoveAdj
=
function
(){
var
_OldValue
=
parseInt
(
this
.
OldValue
);
if
(
!
isNaN
(
_OldValue
)){
this
.
Class
.
gdLst
[
this
.
Name
]
=
_OldValue
;
...
...
@@ -402,38 +415,54 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
Class
.
avLst
[
this
.
Name
]
=
this
.
OldAvValue
;
};
CChangesGeometryAddAdj
.
prototype
.
Undo
=
function
(){
if
(
this
.
bReverse
){
this
.
AddAdj
();
}
else
{
this
.
RemoveAdj
();
}
};
CChangesGeometryAddAdj
.
prototype
.
Redo
=
function
(){
this
.
Class
.
gdLst
[
this
.
Name
]
=
parseInt
(
this
.
NewValue
);
this
.
Class
.
avLst
[
this
.
Name
]
=
true
;
if
(
this
.
bReverse
){
this
.
RemoveAdj
();
}
else
{
this
.
AddAdj
();
}
};
CChangesGeometryAddAdj
.
prototype
.
WriteToBinary
=
function
(
Writer
){
Writer
.
WriteString2
(
this
.
Name
);
Writer
.
WriteString2
(
this
.
NewValue
);
AscFormat
.
writeString
(
Writer
,
this
.
OldValue
);
AscFormat
.
writeBool
(
Writer
,
this
.
OldAvValue
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddAdj
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
Name
=
Reader
.
GetString2
();
this
.
NewValue
=
Reader
.
GetString2
();
this
.
OldValue
=
AscFormat
.
readString
(
Reader
);
this
.
OldAvValue
=
AscFormat
.
readBool
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddAdj
]
=
CChangesGeometryAddAdj
;
function
CChangesGeometryAddGuide
(
Class
,
Name
,
formula
,
x
,
y
,
z
){
function
CChangesGeometryAddGuide
(
Class
,
Name
,
formula
,
x
,
y
,
z
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddGuide
;
this
.
Name
=
Name
;
this
.
formula
=
formula
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
z
=
z
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddGuide
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddGuide
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddGuide
.
prototype
.
Undo
=
function
(){
CChangesGeometryAddGuide
.
prototype
.
RemoveGuide
=
function
(){
var
aGdLstInfo
=
this
.
Class
.
gdLstInfo
;
for
(
var
i
=
aGdLstInfo
.
length
-
1
;
i
>
-
1
;
--
i
){
var
oCurGd
=
aGdLstInfo
[
i
];
...
...
@@ -443,15 +472,34 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
}
}
};
CChangesGeometryAddGuide
.
prototype
.
Redo
=
function
(){
CChangesGeometryAddGuide
.
prototype
.
AddGuide
=
function
(){
this
.
Class
.
gdLstInfo
.
push
({
name
:
this
.
Name
,
formula
:
this
.
formula
,
x
:
this
.
x
,
y
:
this
.
y
,
z
:
this
.
z
});
};
CChangesGeometryAddGuide
.
prototype
.
Undo
=
function
(){
if
(
this
.
bReverse
){
this
.
AddGuide
();
}
else
{
this
.
RemoveGuide
();
}
};
CChangesGeometryAddGuide
.
prototype
.
Redo
=
function
(){
if
(
this
.
bReverse
){
this
.
RemoveGuide
();
}
else
{
this
.
AddGuide
();
}
};
CChangesGeometryAddGuide
.
prototype
.
WriteToBinary
=
function
(
Writer
){
Writer
.
WriteString2
(
this
.
Name
);
Writer
.
WriteLong
(
this
.
formula
);
AscFormat
.
writeString
(
Writer
,
this
.
x
);
AscFormat
.
writeString
(
Writer
,
this
.
y
);
AscFormat
.
writeString
(
Writer
,
this
.
z
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddGuide
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
Name
=
Reader
.
GetString2
();
...
...
@@ -459,20 +507,28 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
x
=
AscFormat
.
readString
(
Reader
);
this
.
y
=
AscFormat
.
readString
(
Reader
);
this
.
z
=
AscFormat
.
readString
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesGeometryAddGuide
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesGeometryAddGuide
(
this
.
Class
,
this
.
Name
,
this
.
formula
,
this
.
x
,
this
.
y
,
this
.
z
,
!
this
.
bReverse
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddGuide
]
=
CChangesGeometryAddGuide
;
function
CChangesGeometryAddCnx
(
Class
,
ang
,
x
,
y
){
function
CChangesGeometryAddCnx
(
Class
,
ang
,
x
,
y
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddCnx
;
this
.
ang
=
ang
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddCnx
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddCnx
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddCnx
.
prototype
.
Undo
=
function
(){
CChangesGeometryAddCnx
.
prototype
.
RemoveCnx
=
function
(){
var
aCnxLstInfo
=
this
.
Class
.
cnxLstInfo
;
for
(
var
i
=
aCnxLstInfo
.
length
-
1
;
i
>
-
1
;
--
i
){
var
oCurCnx
=
aCnxLstInfo
[
i
];
...
...
@@ -481,23 +537,46 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
}
}
};
CChangesGeometryAddCnx
.
prototype
.
Redo
=
function
(){
CChangesGeometryAddCnx
.
prototype
.
AddCnx
=
function
(){
this
.
Class
.
cnxLstInfo
.
push
({
ang
:
this
.
ang
,
x
:
this
.
x
,
y
:
this
.
y
});
};
CChangesGeometryAddCnx
.
prototype
.
Undo
=
function
(){
if
(
this
.
bReverse
){
this
.
AddCnx
();
}
else
{
this
.
RemoveCnx
();
}
};
CChangesGeometryAddCnx
.
prototype
.
Redo
=
function
(){
if
(
this
.
bReverse
){
this
.
RemoveCnx
();
}
else
{
this
.
AddCnx
();
}
};
CChangesGeometryAddCnx
.
prototype
.
WriteToBinary
=
function
(
Writer
){
AscFormat
.
writeString
(
Writer
,
this
.
ang
);
AscFormat
.
writeString
(
Writer
,
this
.
x
);
AscFormat
.
writeString
(
Writer
,
this
.
y
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddCnx
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
ang
=
AscFormat
.
readString
(
Reader
);
this
.
x
=
AscFormat
.
readString
(
Reader
);
this
.
y
=
AscFormat
.
readString
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesGeometryAddCnx
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesGeometryAddCnx
(
this
.
Class
,
this
.
ang
,
this
.
x
,
this
.
y
,
!
this
.
bReverse
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddCnx
]
=
CChangesGeometryAddCnx
;
function
CChangesGeometryAddHandleXY
(
Class
,
gdRefX
,
minX
,
maxX
,
gdRefY
,
minY
,
maxY
,
posX
,
posY
){
function
CChangesGeometryAddHandleXY
(
Class
,
gdRefX
,
minX
,
maxX
,
gdRefY
,
minY
,
maxY
,
posX
,
posY
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddHandleXY
;
this
.
gdRefX
=
gdRefX
;
this
.
minX
=
minX
;
...
...
@@ -507,25 +586,42 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
maxY
=
maxY
;
this
.
posX
=
posX
;
this
.
posY
=
posY
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddHandleXY
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddHandleXY
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddHandleXY
.
prototype
.
Undo
=
function
(){
CChangesGeometryAddHandleXY
.
prototype
.
RemoveHandleXY
=
function
(){
var
ahXYLstInfo
=
this
.
Class
.
ahXYLstInfo
;
for
(
var
i
=
ahXYLstInfo
.
length
-
1
;
i
>
-
1
;
--
i
){
var
oCurXY
=
ahXYLstInfo
[
i
];
if
(
oCurXY
.
gdRefX
==
this
.
gdRefX
&&
oCurXY
.
minX
==
this
.
minX
&&
oCurXY
.
maxX
==
this
.
maxX
&&
oCurXY
.
gdRefY
==
this
.
gdRefY
&&
oCurXY
.
minY
==
this
.
minY
&&
oCurXY
.
maxY
==
this
.
maxY
&&
oCurXY
.
posX
==
this
.
posX
&&
oCurXY
.
posY
==
this
.
posY
){
oCurXY
.
gdRefY
==
this
.
gdRefY
&&
oCurXY
.
minY
==
this
.
minY
&&
oCurXY
.
maxY
==
this
.
maxY
&&
oCurXY
.
posX
==
this
.
posX
&&
oCurXY
.
posY
==
this
.
posY
){
ahXYLstInfo
.
splice
(
i
,
1
);
}
}
};
CChangesGeometryAddHandleXY
.
prototype
.
Redo
=
function
(){
CChangesGeometryAddHandleXY
.
prototype
.
AddHandleXY
=
function
(){
this
.
Class
.
ahXYLstInfo
.
push
({
gdRefX
:
this
.
gdRefX
,
minX
:
this
.
minX
,
maxX
:
this
.
maxX
,
gdRefY
:
this
.
gdRefY
,
minY
:
this
.
minY
,
maxY
:
this
.
maxY
,
posX
:
this
.
posX
,
posY
:
this
.
posY
});
};
CChangesGeometryAddHandleXY
.
prototype
.
Undo
=
function
(){
if
(
this
.
bReverse
){
this
.
AddHandleXY
();
}
else
{
this
.
RemoveHandleXY
();
}
};
CChangesGeometryAddHandleXY
.
prototype
.
Redo
=
function
(){
if
(
this
.
bReverse
){
this
.
RemoveHandleXY
();
}
else
{
this
.
AddHandleXY
();
}
};
CChangesGeometryAddHandleXY
.
prototype
.
WriteToBinary
=
function
(
Writer
){
AscFormat
.
writeString
(
Writer
,
this
.
gdRefX
);
AscFormat
.
writeString
(
Writer
,
this
.
minX
);
...
...
@@ -535,6 +631,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
AscFormat
.
writeString
(
Writer
,
this
.
maxY
);
AscFormat
.
writeString
(
Writer
,
this
.
posX
);
AscFormat
.
writeString
(
Writer
,
this
.
posY
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddHandleXY
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
gdRefX
=
AscFormat
.
readString
(
Reader
);
...
...
@@ -545,10 +642,15 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
maxY
=
AscFormat
.
readString
(
Reader
);
this
.
posX
=
AscFormat
.
readString
(
Reader
);
this
.
posY
=
AscFormat
.
readString
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesGeometryAddHandleXY
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesGeometryAddHandleXY
(
this
.
Class
,
this
.
gdRefX
,
this
.
minX
,
this
.
maxX
,
this
.
gdRefY
,
this
.
minY
,
this
.
maxY
,
this
.
posX
,
this
.
posY
,
!
this
.
bReverse
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddHandleXY
]
=
CChangesGeometryAddHandleXY
;
function
CChangesGeometryAddHandlePolar
(
Class
,
gdRefR
,
minR
,
maxR
,
gdRefAng
,
minAng
,
maxAng
,
posX
,
posY
){
function
CChangesGeometryAddHandlePolar
(
Class
,
gdRefR
,
minR
,
maxR
,
gdRefAng
,
minAng
,
maxAng
,
posX
,
posY
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddHandleXY
;
this
.
gdRefAng
=
gdRefAng
;
this
.
minAng
=
minAng
;
...
...
@@ -558,25 +660,44 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
maxR
=
maxR
;
this
.
posX
=
posX
;
this
.
posY
=
posY
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddHandlePolar
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddHandlePolar
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddHandlePolar
.
prototype
.
Undo
=
function
(){
CChangesGeometryAddHandlePolar
.
prototype
.
RemoveHandlePolar
=
function
(){
var
ahPolarLstInfo
=
this
.
Class
.
ahPolarLstInfo
;
for
(
var
i
=
ahPolarLstInfo
.
length
-
1
;
i
>
-
1
;
--
i
){
var
oCurPolar
=
ahPolarLstInfo
[
i
];
if
(
oCurPolar
.
gdRefR
==
this
.
gdRefR
&&
oCurPolar
.
minR
==
this
.
minR
&&
oCurPolar
.
maxR
==
this
.
maxR
&&
oCurPolar
.
gdRefAng
==
this
.
gdRefAng
&&
oCurPolar
.
minAng
==
this
.
minAng
&&
oCurPolar
.
maxAng
==
this
.
maxAng
&&
oCurPolar
.
posX
==
this
.
posX
&&
oCurPolar
.
posY
==
this
.
posY
){
oCurPolar
.
gdRefAng
==
this
.
gdRefAng
&&
oCurPolar
.
minAng
==
this
.
minAng
&&
oCurPolar
.
maxAng
==
this
.
maxAng
&&
oCurPolar
.
posX
==
this
.
posX
&&
oCurPolar
.
posY
==
this
.
posY
){
ahPolarLstInfo
.
splice
(
i
,
1
);
}
}
};
CChangesGeometryAddHandlePolar
.
prototype
.
Redo
=
function
(){
CChangesGeometryAddHandlePolar
.
prototype
.
AddHandlePolar
=
function
(){
this
.
Class
.
ahPolarLstInfo
.
push
({
gdRefR
:
this
.
gdRefR
,
minR
:
this
.
minR
,
maxR
:
this
.
maxR
,
gdRefAng
:
this
.
gdRefAng
,
minAng
:
this
.
minAng
,
maxAng
:
this
.
maxAng
,
posX
:
this
.
posX
,
posY
:
this
.
posY
});
};
CChangesGeometryAddHandlePolar
.
prototype
.
Undo
=
function
(){
if
(
this
.
bReverse
){
this
.
AddHandlePolar
();
}
else
{
this
.
RemoveHandlePolar
();
}
};
CChangesGeometryAddHandlePolar
.
prototype
.
Redo
=
function
(){
if
(
this
.
bReverse
){
this
.
RemoveHandlePolar
();
}
else
{
this
.
AddHandlePolar
();
}
};
CChangesGeometryAddHandlePolar
.
prototype
.
WriteToBinary
=
function
(
Writer
){
AscFormat
.
writeString
(
Writer
,
this
.
gdRefR
);
AscFormat
.
writeString
(
Writer
,
this
.
minR
);
...
...
@@ -586,6 +707,7 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
AscFormat
.
writeString
(
Writer
,
this
.
maxAng
);
AscFormat
.
writeString
(
Writer
,
this
.
posX
);
AscFormat
.
writeString
(
Writer
,
this
.
posY
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddHandlePolar
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
gdRefR
=
AscFormat
.
readString
(
Reader
);
...
...
@@ -596,35 +718,53 @@ AscCommon.extendClass(CChangesGeometryAddAdj, AscDFH.CChangesBase);
this
.
maxAng
=
AscFormat
.
readString
(
Reader
);
this
.
posX
=
AscFormat
.
readString
(
Reader
);
this
.
posY
=
AscFormat
.
readString
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
CChangesGeometryAddHandlePolar
.
prototype
.
CreateReverseChange
=
function
(){
return
new
CChangesGeometryAddHandlePolar
(
this
.
Class
,
this
.
gdRefR
,
this
.
minR
,
this
.
maxR
,
this
.
gdRefAng
,
this
.
minAng
,
this
.
maxAng
,
this
.
posX
,
this
.
posY
,
!
this
.
bReverse
);
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddHandlePolar
]
=
CChangesGeometryAddHandlePolar
;
function
CChangesGeometryAddRect
(
Class
,
l
,
t
,
r
,
b
){
function
CChangesGeometryAddRect
(
Class
,
l
,
t
,
r
,
b
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_GeometryAddRect
;
this
.
l
=
l
;
this
.
t
=
t
;
this
.
r
=
r
;
this
.
b
=
b
;
this
.
bReverse
=
bReverse
;
CChangesGeometryAddRect
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesGeometryAddRect
,
AscDFH
.
CChangesBase
);
CChangesGeometryAddRect
.
prototype
.
Undo
=
function
(){
this
.
Class
.
rectS
=
null
;
if
(
this
.
bReverse
){
this
.
Class
.
rectS
=
{
l
:
this
.
l
,
t
:
this
.
t
,
r
:
this
.
r
,
b
:
this
.
b
};
}
else
{
this
.
Class
.
rectS
=
null
;
}
};
CChangesGeometryAddRect
.
prototype
.
Redo
=
function
(){
this
.
Class
.
rectS
=
{
l
:
this
.
l
,
t
:
this
.
t
,
r
:
this
.
r
,
b
:
this
.
b
};
if
(
this
.
bReverse
){
this
.
Class
.
rectS
=
null
;
}
else
{
this
.
Class
.
rectS
=
{
l
:
this
.
l
,
t
:
this
.
t
,
r
:
this
.
r
,
b
:
this
.
b
};
}
};
CChangesGeometryAddRect
.
prototype
.
WriteToBinary
=
function
(
Writer
){
AscFormat
.
writeString
(
Writer
,
this
.
l
);
AscFormat
.
writeString
(
Writer
,
this
.
t
);
AscFormat
.
writeString
(
Writer
,
this
.
r
);
AscFormat
.
writeString
(
Writer
,
this
.
b
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
};
CChangesGeometryAddRect
.
prototype
.
ReadFromBinary
=
function
(
Reader
){
this
.
l
=
AscFormat
.
readString
(
Reader
);
this
.
t
=
AscFormat
.
readString
(
Reader
);
this
.
r
=
AscFormat
.
readString
(
Reader
);
this
.
b
=
AscFormat
.
readString
(
Reader
);
this
.
bReverse
=
Reader
.
GetBool
();
};
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometryAddRect
]
=
CChangesGeometryAddRect
;
AscDFH
.
changesFactory
[
AscDFH
.
historyitem_GeometrySetPreset
]
=
AscDFH
.
CChangesDrawingsString
;
...
...
@@ -655,12 +795,6 @@ function Geometry()
this
.
parent
=
null
;
//коэффиценты линейной связи размеров автофигуры с размерами текстового ректа
this
.
kW
=
null
;
this
.
bW
=
null
;
this
.
kH
=
null
;
this
.
bH
=
null
;
this
.
bDrawSmart
=
false
;
...
...
common/Drawings/Format/Path.js
View file @
7ffeca0b
...
...
@@ -60,25 +60,37 @@ var MOVE_DELTA = AscFormat.MOVE_DELTA;
var
cToRad2
=
(
Math
.
PI
/
60000
)
/
180
;
function
CChangesDrawingsAddPathCommand
(
Class
,
oCommand
,
nIndex
){
function
CChangesDrawingsAddPathCommand
(
Class
,
oCommand
,
nIndex
,
bReverse
){
this
.
Type
=
AscDFH
.
historyitem_PathAddPathCommand
;
this
.
Command
=
oCommand
;
this
.
Index
=
nIndex
;
this
.
bReverse
=
bReverse
;
CChangesDrawingsAddPathCommand
.
superclass
.
constructor
.
call
(
this
,
Class
);
}
AscCommon
.
extendClass
(
CChangesDrawingsAddPathCommand
,
AscDFH
.
CChangesBase
);
CChangesDrawingsAddPathCommand
.
prototype
.
Undo
=
function
(){
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
1
);
if
(
this
.
bReverse
){
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
0
,
this
.
Command
);
}
else
{
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
1
);
}
};
CChangesDrawingsAddPathCommand
.
prototype
.
Redo
=
function
(){
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
0
,
this
.
Command
);
if
(
this
.
bReverse
){
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
1
);
}
else
{
this
.
Class
.
ArrPathCommandInfo
.
splice
(
this
.
Index
,
0
,
this
.
Command
);
}
};
CChangesDrawingsAddPathCommand
.
prototype
.
WriteToBinary
=
function
(
Writer
){
Writer
.
WriteLong
(
this
.
Index
);
Writer
.
WriteLong
(
this
.
Command
.
id
);
Writer
.
WriteBool
(
!!
this
.
bReverse
);
switch
(
this
.
Command
.
id
){
case
moveTo
:
case
lineTo
:
...
...
@@ -125,6 +137,7 @@ AscCommon.extendClass(CChangesDrawingsAddPathCommand, AscDFH.CChangesBase);
this
.
Index
=
Reader
.
GetLong
();
this
.
Command
=
{};
this
.
Command
.
id
=
Reader
.
GetLong
();
this
.
bReverse
=
Reader
.
GetBool
();
switch
(
this
.
Command
.
id
){
case
moveTo
:
case
lineTo
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment