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
ef40722d
Commit
ef40722d
authored
Dec 26, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function Workbook.recalcWB for test reason
parent
c71c2431
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
52 deletions
+91
-52
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+5
-0
cell/model/Workbook.js
cell/model/Workbook.js
+69
-47
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+10
-0
cell/view/EventsController.js
cell/view/EventsController.js
+1
-1
cell/view/WorkbookView.js
cell/view/WorkbookView.js
+6
-4
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
ef40722d
...
...
@@ -3996,6 +3996,11 @@ parserFormula.prototype.setFormula = function(formula) {
this
.
parenthesesNotEnough
=
false
;
this
.
f
=
[];
this
.
countRef
=
0
;
this
.
ca
=
false
;
this
.
isDirty
=
false
;
this
.
isCalculate
=
false
;
this
.
isTable
=
false
;
this
.
isInDependencies
=
false
;
};
parserFormula
.
prototype
.
parse
=
function
(
local
,
digitDelim
)
{
...
...
cell/model/Workbook.js
View file @
ef40722d
...
...
@@ -838,6 +838,12 @@
this
.
cleanCellCache
[
sheetId
]
=
Asc
.
Range
(
col
,
row
,
col
,
row
);
}
},
notifyChanged
:
function
(
changedFormulas
)
{
var
notifyData
=
{
type
:
AscCommon
.
c_oNotifyType
.
Changed
};
for
(
var
listenerId
in
changedFormulas
)
{
changedFormulas
[
listenerId
].
notify
(
notifyData
);
}
},
//build, calc
buildDependency
:
function
()
{
for
(
var
sheetId
in
this
.
buildCell
)
{
...
...
@@ -897,29 +903,6 @@
AscCommonExcel
.
g_oVLOOKUPCache
.
clean
();
AscCommonExcel
.
g_oHLOOKUPCache
.
clean
();
},
calcAll
:
function
(
sheetId
){
var
worksheets
=
[];
if
(
sheetId
)
{
worksheets
.
push
(
this
.
wb
.
getWorksheetById
(
sheetId
));
}
else
{
var
wsCount
=
this
.
wb
.
getWorksheetCount
();
for
(
var
i
=
0
;
i
<
wsCount
;
++
i
)
{
worksheets
.
push
(
this
.
wb
.
getWorksheet
(
i
));
}
}
for
(
var
i
=
0
;
i
<
worksheets
.
length
;
++
i
)
{
var
ws
=
worksheets
[
i
];
if
(
ws
)
{
var
cwf
=
ws
.
getCwf
();
for
(
var
i
in
cwf
)
{
var
ca
=
g_oCellAddressUtils
.
getCellAddress
(
i
);
var
c
=
ws
.
_getCellNoEmpty
(
ca
.
getRow0
(),
ca
.
getCol0
());
this
.
addToChangedCell
(
c
);
}
}
}
this
.
calcTree
();
},
initOpen
:
function
()
{
this
.
_foreachDefName
(
function
(
defName
)
{
defName
.
setRef
(
defName
.
ref
,
true
,
true
);
...
...
@@ -935,6 +918,13 @@
res
.
tableNameIndex
=
this
.
tableNameIndex
;
return
res
;
},
getAllFormulas
:
function
(
formulas
)
{
this
.
_foreachDefName
(
function
(
defName
)
{
if
(
!
defName
.
isTable
&&
defName
.
parsedRef
)
{
formulas
.
push
(
defName
.
parsedRef
);
}
});
},
//internal
_addDefName
:
function
(
defName
)
{
var
nameIndex
=
getDefNameIndex
(
defName
.
name
);
...
...
@@ -1766,8 +1756,26 @@
this
.
aWorksheets
[
i
].
reassignImageUrls
(
oImages
);
}
};
Workbook
.
prototype
.
recalcWB
=
function
(
isRecalcWB
){
//todo
Workbook
.
prototype
.
recalcWB
=
function
(
rebuild
,
opt_sheetId
)
{
var
formulas
;
if
(
rebuild
)
{
formulas
=
this
.
getAllFormulas
();
for
(
var
i
=
0
;
i
<
formulas
.
length
;
++
i
)
{
var
formula
=
formulas
[
i
];
formula
.
removeDependencies
();
formula
.
setFormula
(
formula
.
getFormula
());
formula
.
parse
();
formula
.
buildDependencies
();
}
}
else
if
(
opt_sheetId
)
{
formulas
=
[];
var
ws
=
this
.
wb
.
getWorksheetById
(
opt_sheetId
);
ws
.
getAllFormulas
(
formulas
);
}
else
{
formulas
=
this
.
getAllFormulas
();
}
this
.
dependencyFormulas
.
notifyChanged
(
formulas
);
this
.
dependencyFormulas
.
calcTree
();
};
Workbook
.
prototype
.
checkDefName
=
function
(
checkName
,
scope
)
{
return
this
.
dependencyFormulas
.
checkDefName
(
checkName
,
scope
);
...
...
@@ -1854,6 +1862,14 @@
wb
.
init
({},
true
,
false
);
return
wb
;
};
Workbook
.
prototype
.
getAllFormulas
=
function
()
{
var
res
=
[];
this
.
dependencyFormulas
.
getAllFormulas
(
res
);
for
(
var
i
=
0
;
i
<
this
.
aWorksheets
.
length
;
++
i
)
{
this
.
aWorksheets
[
i
].
getAllFormulas
(
res
);
}
return
res
;
};
Workbook
.
prototype
.
_forwardTransformation
=
function
(
wbSnapshot
,
changesMine
,
changesTheir
)
{
History
.
TurnOff
();
//first mine changes to resolve conflict sheet names
...
...
@@ -3048,8 +3064,8 @@
}
delete
this
.
aGCells
[
nIndex
];
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_RemoveRows
,
this
.
getId
(),
new
Asc
.
Range
(
0
,
start
,
gc_nMaxCol0
,
gc_nMaxRow0
),
new
UndoRedoData_FromToRowCol
(
true
,
start
,
stop
));
this
.
autoFilters
.
insertRows
(
"
delCell
"
,
new
Asc
.
Range
(
0
,
start
,
gc_nMaxCol0
,
stop
),
c_oAscDeleteOptions
.
DeleteRows
);
...
...
@@ -3104,8 +3120,8 @@
}
History
.
LocalChange
=
false
;
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_AddRows
,
this
.
getId
(),
new
Asc
.
Range
(
0
,
index
,
gc_nMaxCol0
,
gc_nMaxRow0
),
new
UndoRedoData_FromToRowCol
(
true
,
index
,
index
+
count
-
1
));
this
.
autoFilters
.
insertRows
(
"
insCell
"
,
new
Asc
.
Range
(
0
,
index
,
gc_nMaxCol0
,
index
+
count
-
1
),
c_oAscInsertOptions
.
InsertColumns
);
...
...
@@ -3185,8 +3201,8 @@
if
(
null
!=
elem
)
elem
.
moveHor
(
nDif
);
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_RemoveCols
,
this
.
getId
(),
new
Asc
.
Range
(
start
,
0
,
gc_nMaxCol0
,
gc_nMaxRow0
),
new
UndoRedoData_FromToRowCol
(
false
,
start
,
stop
));
this
.
autoFilters
.
insertColumn
(
"
delCell
"
,
new
Asc
.
Range
(
start
,
0
,
stop
,
gc_nMaxRow0
),
c_oAscInsertOptions
.
InsertColumns
);
...
...
@@ -3224,8 +3240,8 @@
this
.
_moveCellHor
(
nRowIndex
,
nIndex
,
count
,
oActualRange
);
}
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_AddCols
,
this
.
getId
(),
new
Asc
.
Range
(
index
,
0
,
gc_nMaxCol0
,
gc_nMaxRow0
),
new
UndoRedoData_FromToRowCol
(
false
,
index
,
index
+
count
-
1
));
this
.
autoFilters
.
insertColumn
(
"
insCells
"
,
new
Asc
.
Range
(
index
,
0
,
index
+
count
-
1
,
gc_nMaxRow0
),
c_oAscInsertOptions
.
InsertColumns
);
...
...
@@ -4114,8 +4130,8 @@
}
}
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_ShiftCellsLeft
,
this
.
getId
(),
new
Asc
.
Range
(
nLeft
,
oBBox
.
r1
,
gc_nMaxCol0
,
oBBox
.
r2
),
new
UndoRedoData_BBox
(
oBBox
));
this
.
autoFilters
.
insertColumn
(
"
delCell
"
,
oBBox
,
c_oAscDeleteOptions
.
DeleteCellsAndShiftLeft
);
//todo проверить не уменьшились ли границы таблицы
...
...
@@ -4155,8 +4171,8 @@
}
}
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_ShiftCellsTop
,
this
.
getId
(),
new
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
,
oBBox
.
c2
,
gc_nMaxRow0
),
new
UndoRedoData_BBox
(
oBBox
));
this
.
autoFilters
.
insertRows
(
"
delCell
"
,
oBBox
,
c_oAscDeleteOptions
.
DeleteCellsAndShiftTop
);
//todo проверить не уменьшились ли границы таблицы
...
...
@@ -4191,8 +4207,8 @@
}
}
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_ShiftCellsRight
,
this
.
getId
(),
new
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
,
gc_nMaxCol0
,
oBBox
.
r2
),
new
UndoRedoData_BBox
(
oBBox
));
this
.
autoFilters
.
insertColumn
(
"
insCells
"
,
oBBox
,
c_oAscInsertOptions
.
InsertCellsAndShiftRight
,
displayNameFormatTable
);
};
...
...
@@ -4224,8 +4240,8 @@
}
}
}
//
renameDependencyNodes
Changed after move cells to get new locations
this
.
renameDependencyNodes
Changed
(
changedFormulas
);
//
notify
Changed after move cells to get new locations
this
.
workbook
.
dependencyFormulas
.
notify
Changed
(
changedFormulas
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_ShiftCellsBottom
,
this
.
getId
(),
new
Asc
.
Range
(
oBBox
.
c1
,
oBBox
.
r1
,
oBBox
.
c2
,
gc_nMaxRow0
),
new
UndoRedoData_BBox
(
oBBox
));
if
(
!
this
.
workbook
.
bUndoChanges
)
...
...
@@ -4344,12 +4360,6 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
Woorksheet
.
prototype
.
renameDependencyNodes
=
function
(
offset
,
oBBox
,
rec
,
noDelete
){
return
this
.
workbook
.
dependencyFormulas
.
shift
(
this
.
Id
,
oBBox
,
offset
);
};
Woorksheet
.
prototype
.
renameDependencyNodesChanged
=
function
(
changedFormulas
){
var
notifyData
=
{
type
:
AscCommon
.
c_oNotifyType
.
Changed
};
for
(
var
listenerId
in
changedFormulas
)
{
changedFormulas
[
listenerId
].
notify
(
notifyData
);
}
};
Woorksheet
.
prototype
.
getAllCol
=
function
(){
if
(
null
==
this
.
oAllCol
)
this
.
oAllCol
=
new
AscCommonExcel
.
Col
(
this
,
g_nAllColIndex
);
...
...
@@ -4473,6 +4483,18 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
});
return
cwf
;
};
Woorksheet
.
prototype
.
getAllFormulas
=
function
(
formulas
)
{
var
range
=
this
.
getRange3
(
0
,
0
,
gc_nMaxRow0
,
gc_nMaxCol0
);
range
.
_setPropertyNoEmpty
(
null
,
null
,
function
(
cell
)
{
if
(
cell
.
formulaParsed
)
{
formulas
.
push
(
cell
.
formulaParsed
);
}
});
for
(
var
i
=
0
;
i
<
this
.
TableParts
.
length
;
++
i
)
{
var
table
=
this
.
TableParts
[
i
];
table
.
getAllFormulas
(
formulas
);
}
};
Woorksheet
.
prototype
.
setTableStyleAfterOpen
=
function
()
{
if
(
this
.
TableParts
&&
this
.
TableParts
.
length
)
{
for
(
var
i
=
0
;
i
<
this
.
TableParts
.
length
;
i
++
)
{
...
...
cell/model/WorkbookElems.js
View file @
ef40722d
...
...
@@ -5736,6 +5736,11 @@ TablePart.prototype.clone = function() {
this
.
TableColumns
[
i
].
buildDependencies
();
}
};
TablePart
.
prototype
.
getAllFormulas
=
function
(
formulas
)
{
for
(
var
i
=
0
;
i
<
this
.
TableColumns
.
length
;
++
i
)
{
this
.
TableColumns
[
i
].
getAllFormulas
(
formulas
);
}
};
TablePart
.
prototype
.
moveRef
=
function
(
col
,
row
)
{
var
ref
=
this
.
Ref
.
clone
();
ref
.
setOffset
({
offsetCol
:
col
?
col
:
0
,
offsetRow
:
row
?
row
:
0
});
...
...
@@ -6353,6 +6358,11 @@ function TableColumn() {
this
.
TotalsRowFormula
.
removeDependencies
();
}
};
TableColumn
.
prototype
.
getAllFormulas
=
function
(
formulas
)
{
if
(
this
.
TotalsRowFormula
)
{
formulas
.
push
(
this
.
TotalsRowFormula
);
}
};
TableColumn
.
prototype
.
clone
=
function
()
{
var
res
=
new
TableColumn
();
res
.
Name
=
this
.
Name
;
...
...
cell/view/EventsController.js
View file @
ef40722d
...
...
@@ -720,7 +720,7 @@
switch
(
event
.
which
)
{
case
120
:
// F9
t
.
handlers
.
trigger
(
"
calcAll
"
,
shiftKey
);
t
.
handlers
.
trigger
(
"
calcAll
"
,
ctrlKey
,
event
.
altKey
,
shiftKey
);
return
result
;
case
113
:
// F2
...
...
cell/view/WorkbookView.js
View file @
ef40722d
...
...
@@ -456,12 +456,14 @@
},
//calcAll
'
calcAll
'
:
function
(
shiftKey
)
{
if
(
shiftKey
){
'
calcAll
'
:
function
(
ctrlKey
,
altKey
,
shiftKey
)
{
if
(
ctrlKey
&&
altKey
&&
shiftKey
){
self
.
model
.
recalcWB
(
true
);
}
else
if
(
shiftKey
){
var
ws
=
self
.
model
.
getActiveWs
();
self
.
model
.
dependencyFormulas
.
calcAll
(
ws
.
getId
());
self
.
model
.
recalcWB
(
false
,
ws
.
getId
());
}
else
{
self
.
model
.
dependencyFormulas
.
calcAll
(
);
self
.
model
.
recalcWB
(
false
);
}
},
});
...
...
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