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
151e5451
Commit
151e5451
authored
Oct 27, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for ChangeColumnName, Workbook.onFormulaEvent move to class ForwardTransformationFormula
parent
353121c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
32 deletions
+42
-32
cell/model/Serialize.js
cell/model/Serialize.js
+1
-1
cell/model/UndoRedo.js
cell/model/UndoRedo.js
+1
-1
cell/model/Workbook.js
cell/model/Workbook.js
+40
-30
No files found.
cell/model/Serialize.js
View file @
151e5451
...
...
@@ -7204,7 +7204,7 @@
if
(
c_oSerConstants
.
ReadOk
==
res
)
res
=
(
new
Binary_WorkbookTableReader
(
this
.
stream
,
wb
)).
Read
();
}
wb
.
init
(
this
.
oReadResult
.
tableCustomFunc
);
wb
.
init
(
this
.
oReadResult
.
tableCustomFunc
,
false
,
true
);
}
else
if
(
window
[
"
Asc
"
]
&&
window
[
"
Asc
"
][
"
editor
"
]
!==
undefined
){
wb
.
init
(
this
.
oReadResult
.
tableCustomFunc
,
true
);
}
...
...
cell/model/UndoRedo.js
View file @
151e5451
...
...
@@ -3858,7 +3858,7 @@ UndoRedoAutoFilters.prototype = {
},
forwardTransformationIsAffect
:
function
(
Type
)
{
return
AscCH
.
historyitem_AutoFilter_Add
===
Type
||
AscCH
.
historyitem_AutoFilter_ChangeTableName
===
Type
||
AscCH
.
historyitem_AutoFilter_Empty
===
Type
;
AscCH
.
historyitem_AutoFilter_Empty
===
Type
||
AscCH
.
historyitem_AutoFilter_ChangeColumnName
===
Type
;
}
};
...
...
cell/model/Workbook.js
View file @
151e5451
...
...
@@ -1263,6 +1263,29 @@ function getRangeType(oBBox){
}
};
function
ForwardTransformationFormula
(
elem
,
formula
,
parsed
)
{
this
.
elem
=
elem
;
this
.
formula
=
formula
;
this
.
parsed
=
parsed
;
}
ForwardTransformationFormula
.
prototype
=
{
onFormulaEvent
:
function
(
type
,
eventData
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
CanDo
===
type
)
{
return
true
;
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
this
.
parsed
.
setIsDirty
(
false
);
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
===
type
)
{
if
(
eventData
.
isRebuild
)
{
this
.
parsed
=
new
AscCommonExcel
.
parserFormula
(
eventData
.
assemble
,
this
,
this
.
parsed
.
ws
);
this
.
parsed
.
parse
();
}
else
{
this
.
parsed
.
Formula
=
eventData
.
assemble
;
}
this
.
formula
=
eventData
.
assemble
;
this
.
parsed
.
buildDependencies
();
}
}
};
function
angleFormatToInterface
(
val
)
{
var
nRes
=
0
;
...
...
@@ -1329,7 +1352,7 @@ function Workbook(eventsHandlers, oApi){
this
.
maxDigitWidth
=
0
;
this
.
paddingPlusBorder
=
0
;
}
Workbook
.
prototype
.
init
=
function
(
tableCustomFunc
,
bNoBuildDep
){
Workbook
.
prototype
.
init
=
function
(
tableCustomFunc
,
bNoBuildDep
,
bSnapshot
){
if
(
this
.
nActive
<
0
)
this
.
nActive
=
0
;
if
(
this
.
nActive
>=
this
.
aWorksheets
.
length
)
...
...
@@ -1374,7 +1397,9 @@ Workbook.prototype.init=function(tableCustomFunc, bNoBuildDep){
this
.
dependencyFormulas
.
initOpen
();
this
.
dependencyFormulas
.
calcTree
();
}
this
.
snapshot
=
this
.
_getSnapshot
();
if
(
bSnapshot
)
{
this
.
snapshot
=
this
.
_getSnapshot
();
}
};
Workbook
.
prototype
.
rebuildColors
=
function
(){
AscCommonExcel
.
g_oColorManager
.
rebuildColors
();
...
...
@@ -1838,6 +1863,8 @@ Workbook.prototype.SerializeHistory = function(){
wb
.
aWorksheets
.
push
(
ws
);
wb
.
aWorksheetsById
[
ws
.
getId
()]
=
ws
;
}
//init trigger
wb
.
init
({},
true
,
false
);
return
wb
;
};
Workbook
.
prototype
.
_forwardTransformation
=
function
(
wbSnapshot
,
changesMine
,
changesTheir
)
{
...
...
@@ -1890,7 +1917,7 @@ Workbook.prototype.SerializeHistory = function(){
var
getRes
=
elem
.
oClass
.
forwardTransformationGet
(
elem
.
nActionType
,
elem
.
oData
,
elem
.
nSheetId
);
if
(
getRes
&&
getRes
.
formula
)
{
//inserted formulas
formulas
.
push
(
{
elem
:
elem
,
formula
:
getRes
.
formula
,
parsed
:
null
}
);
formulas
.
push
(
new
ForwardTransformationFormula
(
elem
,
getRes
.
formula
,
null
)
);
}
if
(
getRes
&&
getRes
.
name
)
{
//add/rename sheet
...
...
@@ -1952,15 +1979,15 @@ Workbook.prototype.SerializeHistory = function(){
};
Workbook
.
prototype
.
_forwardTransformationFormula
=
function
(
wbSnapshot
,
formulas
,
changes
,
res
)
{
if
(
formulas
.
length
>
0
)
{
var
i
,
elem
,
elemWrap
,
ws
;
var
i
,
elem
,
ftFormula
,
ws
;
//parse formulas
for
(
i
=
0
;
i
<
formulas
.
length
;
++
i
)
{
elemWrap
=
formulas
[
i
];
ws
=
wbSnapshot
.
getWorksheetById
(
elemWrap
.
elem
.
nSheetId
);
ftFormula
=
formulas
[
i
];
ws
=
wbSnapshot
.
getWorksheetById
(
ftFormula
.
elem
.
nSheetId
);
if
(
ws
)
{
elemWrap
.
parsed
=
new
parserFormula
(
elemWrap
.
formula
,
wbSnapshot
,
ws
);
elemWrap
.
parsed
.
parse
();
elemWrap
.
parsed
.
buildDependencies
();
ftFormula
.
parsed
=
new
parserFormula
(
ftFormula
.
formula
,
ftFormula
,
ws
);
ftFormula
.
parsed
.
parse
();
ftFormula
.
parsed
.
buildDependencies
();
}
}
//rename sheet first to prevent name conflict
...
...
@@ -1977,31 +2004,14 @@ Workbook.prototype.SerializeHistory = function(){
}
//assemble
for
(
i
=
0
;
i
<
formulas
.
length
;
++
i
)
{
elemWrap
=
formulas
[
i
];
if
(
elemWrap
.
parsed
)
{
elem
=
elemWrap
.
elem
;
elemWrap
.
parsed
.
removeDependencies
();
elemWrap
.
formula
=
elemWrap
.
parsed
.
Formula
;
res
.
modify
.
push
(
elemWrap
);
ftFormula
=
formulas
[
i
];
if
(
ftFormula
.
parsed
)
{
ftFormula
.
parsed
.
removeDependencies
();
res
.
modify
.
push
(
ftFormula
);
}
}
}
};
Workbook
.
prototype
.
onFormulaEvent
=
function
(
type
,
eventData
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
CanDo
===
type
)
{
return
true
;
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
eventData
.
formula
.
setIsDirty
(
false
);
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
===
type
)
{
if
(
eventData
.
isRebuild
)
{
eventData
.
formula
=
new
AscCommonExcel
.
parserFormula
(
eventData
.
assemble
,
this
,
eventData
.
formula
.
ws
);
eventData
.
formula
.
parse
();
}
else
{
eventData
.
formula
.
Formula
=
eventData
.
assemble
;
}
eventData
.
formula
.
buildDependencies
();
}
};
Workbook
.
prototype
.
DeserializeHistory
=
function
(
aChanges
,
fCallback
){
var
oThis
=
this
;
//сохраняем те изменения, которые были до приема данных, потому что дальше undo/redo будет очищено
...
...
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