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
929f0aab
Commit
929f0aab
authored
Aug 10, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
36ababec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
310 additions
and
123 deletions
+310
-123
cell/api.js
cell/api.js
+1
-0
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+61
-13
cell/model/Workbook.js
cell/model/Workbook.js
+184
-100
cell/utils/utils.js
cell/utils/utils.js
+52
-7
common/commonDefines.js
common/commonDefines.js
+12
-3
No files found.
cell/api.js
View file @
929f0aab
...
...
@@ -407,6 +407,7 @@ var editor;
AscCommonExcel
.
g_oUndoRedoRow
=
new
AscCommonExcel
.
UndoRedoRowCol
(
wbModel
,
true
);
AscCommonExcel
.
g_oUndoRedoComment
=
new
AscCommonExcel
.
UndoRedoComment
(
wbModel
);
AscCommonExcel
.
g_oUndoRedoAutoFilters
=
new
AscCommonExcel
.
UndoRedoAutoFilters
(
wbModel
);
AscCommonExcel
.
g_DefNameWorksheet
=
new
AscCommonExcel
.
Woorksheet
(
wbModel
,
-
1
);
};
spreadsheet_api
.
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
)
{
//передаем число соответствующее своему формату. например c_oAscFileType.XLSX
...
...
cell/model/FormulaObjects/parserFormula.js
View file @
929f0aab
...
...
@@ -3584,6 +3584,13 @@ function parserFormula( formula, parent, _ws ) {
this
.
isDirty
=
isDirty
;
};
parserFormula
.
prototype
.
notify
=
function
(
data
)
{
var
eventData
=
{
notifyData
:
data
,
assembleType
:
AscCommon
.
c_oNotifyParentAssemble
.
Normal
,
isRebuild
:
false
};
if
(
this
.
parent
&&
this
.
parent
.
onFormulaEvent
)
{
var
checkCanDo
=
this
.
parent
.
onFormulaEvent
(
AscCommon
.
c_oNotifyParentType
.
CanDo
,
eventData
);
if
(
!
checkCanDo
){
return
;
}
}
if
(
AscCommon
.
c_oNotifyType
.
Dirty
===
data
.
type
)
{
if
(
!
this
.
isDirty
)
{
this
.
isDirty
=
true
;
...
...
@@ -3600,10 +3607,19 @@ function parserFormula( formula, parent, _ws ) {
if
(
AscCommon
.
c_oNotifyType
.
Shift
===
data
.
type
||
AscCommon
.
c_oNotifyType
.
Move
===
data
.
type
||
AscCommon
.
c_oNotifyType
.
Delete
===
data
.
type
)
{
this
.
shiftCells
(
data
.
type
,
data
.
sheetId
,
data
.
bbox
,
data
.
offset
);
eventData
.
assembleType
=
AscCommon
.
c_oNotifyParentAssemble
.
Flag
;
}
else
if
(
AscCommon
.
c_oNotifyType
.
ChangeDefName
===
data
.
type
)
{
if
(
!
data
.
to
)
{
this
.
removeTableName
(
data
.
from
);
}
else
if
(
data
.
from
.
Name
!=
data
.
to
.
Name
)
{
this
.
changeDefName
(
data
.
from
,
data
.
to
);
}
else
if
(
data
.
from
.
isTable
)
{
eventData
.
assembleType
=
AscCommon
.
c_oNotifyParentAssemble
.
Current
;
eventData
.
isRebuild
=
true
;
}
}
else
if
(
AscCommon
.
c_oNotifyType
.
Rebuild
===
data
.
type
)
{
;
eventData
.
assembleType
=
AscCommon
.
c_oNotifyParentAssemble
.
Assemble
;
eventData
.
isRebuild
=
true
;
}
else
if
(
AscCommon
.
c_oNotifyType
.
ChangeSheet
===
data
.
type
)
{
if
(
this
.
is3D
)
{
var
changeData
=
data
.
data
;
...
...
@@ -3619,7 +3635,7 @@ function parserFormula( formula, parent, _ws ) {
}
}
if
(
this
.
parent
&&
this
.
parent
.
onFormulaEvent
)
{
this
.
parent
.
onFormulaEvent
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
);
this
.
parent
.
onFormulaEvent
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
,
eventData
);
}
}
};
...
...
@@ -4400,14 +4416,20 @@ parserFormula.prototype.getRef = function() {
}
}
};
parserFormula
.
prototype
.
shiftCells
=
function
(
notifyType
,
sheetId
,
bbox
,
offset
)
{
var
isHor
=
0
!=
offset
.
offsetCol
;
var
oShiftGetBBox
;
if
(
AscCommon
.
c_oNotifyType
.
Shift
==
notifyType
)
{
oShiftGetBBox
=
AscCommonExcel
.
shiftGetBBox
(
bbox
,
isHor
);
}
else
{
oShiftGetBBox
=
bbox
;
parserFormula
.
prototype
.
removeTableName
=
function
(
defName
)
{
var
i
,
elem
,
LocalSheetId
;
for
(
i
=
0
;
i
<
this
.
outStack
.
length
;
i
++
)
{
elem
=
this
.
outStack
[
i
];
if
(
elem
.
type
==
cElementType
.
table
)
{
LocalSheetId
=
elem
.
ws
?
elem
.
ws
.
getIndex
()
:
null
;
if
(
elem
.
tableName
==
defName
.
Name
&&
(
null
==
defName
.
LocalSheetId
||
LocalSheetId
==
defName
.
LocalSheetId
))
{
this
.
outStack
[
i
]
=
elem
.
toRef
();
}
}
}
};
parserFormula
.
prototype
.
shiftCells
=
function
(
notifyType
,
sheetId
,
bbox
,
offset
)
{
var
isHor
=
offset
&&
0
!=
offset
.
offsetCol
;
var
elem
;
for
(
var
i
=
0
;
i
<
this
.
outStack
.
length
;
i
++
)
{
elem
=
this
.
outStack
[
i
];
...
...
@@ -4429,9 +4451,12 @@ parserFormula.prototype.getRef = function() {
var
_cellsBbox
=
AscCommonExcel
.
g_oRangeCache
.
getAscRange
(
_cells
.
replace
(
this
.
regSpace
,
""
));
var
isIntersect
;
if
(
AscCommon
.
c_oNotifyType
.
Shift
==
notifyType
)
{
isIntersect
=
oShiftGetBBox
.
isIntersectForShift
(
_cellsBbox
,
isHor
);
}
else
{
isIntersect
=
oShiftGetBBox
.
containsRange
(
_cellsBbox
);
isIntersect
=
bbox
.
isIntersectForShift
(
_cellsBbox
,
offset
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Move
==
notifyType
)
{
isIntersect
=
bbox
.
containsRange
(
_cellsBbox
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Delete
==
notifyType
)
{
//isIntersect = bbox.isIntersect(_cellsBbox);
isIntersect
=
bbox
.
containsRange
(
_cellsBbox
);
}
if
(
isIntersect
)
{
var
isNoDelete
;
...
...
@@ -4439,9 +4464,32 @@ parserFormula.prototype.getRef = function() {
_cellsBbox
=
_cellsBbox
.
clone
();
isNoDelete
=
_cellsBbox
.
forShift
(
bbox
,
offset
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Move
==
notifyType
)
{
_cellsBbox
=
_cellsBbox
.
clone
();
_cellsBbox
.
setOffset
(
offset
);
isNoDelete
=
true
;
}
else
if
(
AscCommon
.
c_oNotifyType
.
Delete
==
notifyType
)
{
isNoDelete
=
false
;
// if (bbox.containsRange(_cellsBbox)) {
// isNoDelete = false;
// } else {
// isNoDelete = true;
// if (!_cellsBbox.containsRange(bbox)) {
// var ltIn = bbox.contains(_cellsBbox.c1, _cellsBbox.r1);
// var rtIn = bbox.contains(_cellsBbox.c2, _cellsBbox.r1);
// var lbIn = bbox.contains(_cellsBbox.c1, _cellsBbox.r2);
// var rbIn = bbox.contains(_cellsBbox.c2, _cellsBbox.r2);
// _cellsBbox = _cellsBbox.clone();
// if (ltIn && rtIn) {
// _cellsBbox.setOffsetFirst({offsetCol: 0, offsetRow: bbox.r2 - _cellsBbox.r1 + 1});
// } else if (rtIn && rbIn) {
// _cellsBbox.setOffsetLast({offsetCol: bbox.c1 - _cellsBbox.c2 - 1, offsetRow: 0});
// } else if (rbIn && lbIn) {
// _cellsBbox.setOffsetLast({offsetCol: 0, offsetRow: bbox.r1 - _cellsBbox.r2 - 1});
// } else if (lbIn && ltIn) {
// _cellsBbox.setOffsetFirst({offsetCol: bbox.c2 - _cellsBbox.c1 + 1, offsetRow: 0});
// }
// }
// }
}
if
(
isNoDelete
)
{
elem
.
value
=
elem
.
_cells
=
...
...
cell/model/Workbook.js
View file @
929f0aab
...
...
@@ -188,9 +188,7 @@ function getRangeType(oBBox){
this
.
isLock
=
null
;
this
.
parsedRef
=
null
;
if
(
this
.
ref
)
{
//все ссылки должны быть 3d поэтому без разницы какой sheet предавать
this
.
parsedRef
=
new
parserFormula
(
this
.
ref
,
this
,
this
.
wb
.
getWorksheet
(
0
));
this
.
wb
.
dependencyFormulas
.
addToBuildDependencyDefName
(
this
);
this
.
setRef
(
this
.
ref
,
true
);
}
}
...
...
@@ -198,7 +196,17 @@ function getRangeType(oBBox){
removeDependencies
:
function
()
{
if
(
this
.
parsedRef
)
{
this
.
parsedRef
.
removeDependencies
();
this
.
parsedRef
=
null
;
}
},
setRef
:
function
(
ref
,
opt_noRemoveDependencies
)
{
if
(
!
opt_noRemoveDependencies
){
this
.
removeDependencies
();
}
this
.
ref
=
ref
;
//all ref should be 3d, so worksheet can be anyone
this
.
parsedRef
=
new
parserFormula
(
ref
,
this
,
AscCommonExcel
.
g_DefNameWorksheet
);
this
.
wb
.
dependencyFormulas
.
addToBuildDependencyDefName
(
this
);
},
getNodeId
:
function
()
{
return
getDefNameId
(
this
.
sheetId
,
this
.
name
);
...
...
@@ -211,19 +219,49 @@ function getRangeType(oBBox){
}
return
new
Asc
.
asc_CDefName
(
this
.
name
,
this
.
ref
,
index
,
this
.
isTable
,
this
.
hidden
,
this
.
isLock
);
},
onFormulaEvent
:
function
(
type
,
data
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
setAscCDefName
:
function
(
newAscName
)
{
this
.
name
=
newAscName
.
Name
;
this
.
sheetId
=
this
.
wb
.
getSheetIdByIndex
(
newAscName
.
LocalSheetId
);
this
.
hidden
=
newAscName
.
Hidden
;
this
.
isTable
=
newAscName
.
isTable
;
if
(
this
.
ref
!=
newAscName
.
Ref
){
this
.
setRef
(
newAscName
.
Ref
);
}
},
onFormulaEvent
:
function
(
type
,
eventData
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
CanDo
===
type
)
{
var
type
=
eventData
.
notifyData
.
type
;
return
!
(
this
.
isTable
&&
(
AscCommon
.
c_oNotifyType
.
Shift
===
type
||
AscCommon
.
c_oNotifyType
.
Move
===
type
||
AscCommon
.
c_oNotifyType
.
Delete
===
type
));
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
this
.
wb
.
dependencyFormulas
.
addToChangedDefName
(
this
);
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
===
type
)
{
var
oldAscName
=
this
.
getAscCDefName
();
var
assemb
;
switch
(
eventData
.
assembleType
)
{
case
AscCommon
.
c_oNotifyParentAssemble
.
Normal
:
assemb
=
this
.
parsedRef
.
assemble
();
break
;
case
AscCommon
.
c_oNotifyParentAssemble
.
Flag
:
assemb
=
this
.
parsedRef
.
assemble
(
true
);
break
;
case
AscCommon
.
c_oNotifyParentAssemble
.
Current
:
assemb
=
this
.
parsedRef
.
Formula
;
break
;
}
if
(
eventData
.
isRebuild
)
{
this
.
setRef
(
assemb
,
true
);
}
else
{
this
.
ref
=
this
.
parsedRef
.
Formula
=
assemb
;
this
.
parsedRef
.
buildDependencies
();
this
.
parsedRef
.
Formula
=
this
.
parsedRef
.
assemble
(
);
this
.
ref
=
this
.
parsedRef
.
Formula
;
this
.
wb
.
dependencyFormulas
.
addToChangedDefName
(
this
);
}
var
newAscName
=
this
.
getAscCDefName
();
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorkbook
,
AscCH
.
historyitem_Workbook_DefinedNamesChangeUndo
,
null
,
null
,
new
UndoRedoData_DefinedNamesChange
(
oldAscName
,
newAscName
),
true
);
this
.
wb
.
dependencyFormulas
.
addToChangedDefName
(
this
);
}
return
true
;
}
};
...
...
@@ -373,16 +411,21 @@ function getRangeType(oBBox){
//обязательно, формула не в зависимостях не сдвинутся
this
.
buildDependency
();
this
.
_shiftMoveDelete
(
AscCommon
.
c_oNotifyType
.
Delete
,
sheetId
,
bbox
,
null
);
this
.
addToChangedRange
(
sheetId
,
bbox
);
},
shift
:
function
(
sheetId
,
bbox
,
offset
)
{
//обязательно, формула не в зависимостях не сдвинутся
this
.
buildDependency
();
this
.
_shiftMoveDelete
(
AscCommon
.
c_oNotifyType
.
Shift
,
sheetId
,
bbox
,
offset
);
var
bHor
=
0
!=
offset
.
offsetCol
;
var
bboxShift
=
AscCommonExcel
.
shiftGetBBox
(
bbox
,
bHor
);
this
.
addToChangedRange
(
sheetId
,
bboxShift
);
},
move
:
function
(
sheetId
,
bboxFrom
,
offset
)
{
//обязательно, формула не в зависимостях не сдвинутся
this
.
buildDependency
();
this
.
_shiftMoveDelete
(
AscCommon
.
c_oNotifyType
.
Move
,
sheetId
,
bboxFrom
,
offset
);
this
.
addToChangedRange
(
sheetId
,
bboxFrom
);
},
changeSheet
:
function
(
sheetId
,
data
)
{
this
.
buildDependency
();
...
...
@@ -396,7 +439,7 @@ function getRangeType(oBBox){
}
}
for
(
var
vertexIndex
in
sheetContainer
.
areaMap
)
{
var
areaSheetElem
=
sheetContainer
.
cell
Map
[
vertexIndex
];
var
areaSheetElem
=
sheetContainer
.
area
Map
[
vertexIndex
];
for
(
var
listenerId
in
areaSheetElem
.
listeners
)
{
listeners
[
listenerId
]
=
areaSheetElem
.
listeners
[
listenerId
];
}
...
...
@@ -498,23 +541,9 @@ function getRangeType(oBBox){
return
names
.
sort
(
sort
);
},
addDefNameOpen
:
function
(
name
,
ref
,
sheetIndex
,
hidden
,
isTable
)
{
var
nameIndex
=
getDefNameIndex
(
name
);
var
container
;
var
sheetId
=
this
.
wb
.
getSheetIdByIndex
(
sheetIndex
);
if
(
sheetId
)
{
container
=
this
.
defNames
.
sheet
[
sheetId
];
if
(
!
container
)
{
container
=
{};
this
.
defNames
.
sheet
[
sheetId
]
=
container
;
}
}
else
{
container
=
this
.
defNames
.
wb
;
}
var
res
=
container
[
nameIndex
];
if
(
!
res
)
{
res
=
new
DefName
(
this
.
wb
,
name
,
ref
,
sheetId
,
hidden
,
isTable
);
container
[
nameIndex
]
=
res
;
}
var
res
=
new
DefName
(
this
.
wb
,
name
,
ref
,
sheetId
,
hidden
,
isTable
);
this
.
_addDefName
(
res
);
return
res
;
},
removeDefName
:
function
(
sheetIndex
,
name
)
{
...
...
@@ -527,7 +556,6 @@ function getRangeType(oBBox){
defName
.
removeDependencies
();
this
.
addToChangedDefName
(
defName
);
this
.
calcTree
();
}
},
editDefinesNames
:
function
(
oldAscName
,
newAscName
)
{
...
...
@@ -543,27 +571,27 @@ function getRangeType(oBBox){
false
);
}
if
(
res
)
{
if
(
res
&&
oldAscName
)
{
History
.
Create_NewPoint
();
this
.
_delDefName
(
res
.
name
,
res
.
sheetId
);
res
=
this
.
addDefNameOpen
(
newAscName
.
Name
,
newAscName
.
Ref
,
newAscName
.
LocalSheetId
,
newAscName
.
Hidden
,
newAscName
.
isTable
);
if
(
oldAscName
&&
oldAscName
.
Name
!=
newAscName
.
Name
)
{
if
(
oldAscName
.
Name
!=
newAscName
.
Name
)
{
this
.
buildDependency
();
res
=
this
.
_delDefName
(
res
.
name
,
res
.
sheetId
);
res
.
setAscCDefName
(
newAscName
);
this
.
_addDefName
(
res
);
var
notifyData
=
{
type
:
AscCommon
.
c_oNotifyType
.
ChangeDefName
,
from
:
oldAscName
,
to
:
newAscName
};
this
.
_broadcastDefName
(
oldAscName
.
Name
,
notifyData
);
this
.
addToChangedDefName
(
res
);
}
else
{
res
.
setAscCDefName
(
newAscName
);
}
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorkbook
,
AscCH
.
historyitem_Workbook_DefinedNamesChange
,
null
,
null
,
new
UndoRedoData_DefinedNamesChange
(
oldAscName
,
newAscName
));
this
.
addToChangedDefName
(
res
);
}
this
.
calcTree
();
return
res
;
},
checkDefName
:
function
(
name
,
sheetIndex
)
{
...
...
@@ -617,20 +645,20 @@ function getRangeType(oBBox){
},
saveDefName
:
function
()
{
var
list
=
[];
this
.
_foreachDefName
(
function
(
defName
,
container
)
{
if
(
!
defName
.
isTable
&&
defName
.
R
ef
)
{
this
.
_foreachDefName
(
function
(
defName
)
{
if
(
!
defName
.
isTable
&&
defName
.
r
ef
)
{
list
.
push
(
defName
.
getAscCDefName
());
}
});
return
list
;
},
unlockDefName
:
function
()
{
this
.
_foreachDefName
(
function
(
defName
,
container
)
{
this
.
_foreachDefName
(
function
(
defName
)
{
defName
.
isLock
=
null
;
});
},
checkDefNameLock
:
function
()
{
return
this
.
_foreachDefName
(
function
(
defName
,
container
)
{
return
this
.
_foreachDefName
(
function
(
defName
)
{
return
defName
.
isLock
;
});
},
...
...
@@ -668,19 +696,21 @@ function getRangeType(oBBox){
var
defNameRef
=
parserHelp
.
get3DRef
(
ws
.
getName
(),
refClone
.
getAbsName
());
this
.
addDefNameOpen
(
sName
,
defNameRef
,
null
,
null
,
true
);
}
else
{
defName
.
R
ef
=
defNameRef
;
defName
.
r
ef
=
defNameRef
;
}
},
changeTableRef
:
function
(
tableName
,
newRef
)
{
History
.
TurnOff
();
var
defName
=
this
.
getDefNameByName
(
tableName
,
null
);
if
(
defName
)
{
var
oldAscName
=
defName
.
getAscCDefName
();
var
newAscName
=
defName
.
getAscCDefName
();
newAscName
.
Ref
=
newRef
;
History
.
TurnOff
();
newAscName
.
Ref
=
defName
.
ref
.
split
(
'
!
'
)[
0
]
+
'
!
'
+
newRef
.
getAbsName
();
this
.
editDefinesNames
(
oldAscName
,
newAscName
);
History
.
TurnOn
();
var
notifyData
=
{
type
:
AscCommon
.
c_oNotifyType
.
ChangeDefName
,
from
:
oldAscName
,
to
:
newAscName
};
this
.
_broadcastDefName
(
defName
.
name
,
notifyData
);
}
History
.
TurnOn
();
},
changeTableName
:
function
(
tableName
,
newName
)
{
var
defName
=
this
.
getDefNameByName
(
tableName
,
null
);
...
...
@@ -695,6 +725,9 @@ function getRangeType(oBBox){
},
delTableName
:
function
(
tableName
)
{
this
.
_delDefName
(
tableName
,
null
);
//todo make ref
// var notifyData = {type: AscCommon.c_oNotifyType.ChangeDefName, from: defName.getAscCDefName(), to: null};
// this._broadcastDefName(tableName, notifyData);
},
rebuildTable
:
function
(
tableName
)
{
var
defName
=
this
.
getDefNameByName
(
tableName
,
null
);
...
...
@@ -857,6 +890,25 @@ function getRangeType(oBBox){
this
.
calcTree
();
},
//internal
_addDefName
:
function
(
defName
)
{
var
nameIndex
=
getDefNameIndex
(
defName
.
name
);
var
container
;
var
sheetId
=
defName
.
sheetId
;
if
(
sheetId
)
{
container
=
this
.
defNames
.
sheet
[
sheetId
];
if
(
!
container
)
{
container
=
{};
this
.
defNames
.
sheet
[
sheetId
]
=
container
;
}
}
else
{
container
=
this
.
defNames
.
wb
;
}
var
cur
=
container
[
nameIndex
];
if
(
cur
)
{
cur
.
removeDependencies
();
}
container
[
nameIndex
]
=
defName
;
},
_delDefName
:
function
(
name
,
sheetId
)
{
var
res
=
null
;
var
nameIndex
=
getDefNameIndex
(
name
);
...
...
@@ -996,19 +1048,18 @@ function getRangeType(oBBox){
this
.
tempGetByCells
=
[];
},
_shiftMoveDelete
:
function
(
notifyType
,
sheetId
,
bbox
,
offset
)
{
var
isHor
=
offset
&&
0
!=
offset
.
offsetCol
;
var
oShiftGetBBox
;
if
(
AscCommon
.
c_oNotifyType
.
Shift
==
notifyType
)
{
oShiftGetBBox
=
AscCommonExcel
.
shiftGetBBox
(
bbox
,
isHor
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Move
==
notifyType
||
AscCommon
.
c_oNotifyType
.
Delete
==
notifyType
)
{
oShiftGetBBox
=
bbox
;
}
var
sheetContainer
=
this
.
sheetListeners
[
sheetId
];
if
(
sheetContainer
)
{
var
listeners
=
{};
var
isIntersect
;
for
(
var
cellIndex
in
sheetContainer
.
cellMap
)
{
getFromCellIndex
(
cellIndex
);
if
(
oShiftGetBBox
.
contains
(
g_FCI
.
col
,
g_FCI
.
row
))
{
if
(
AscCommon
.
c_oNotifyType
.
Shift
==
notifyType
)
{
isIntersect
=
bbox
.
isIntersectForShiftCell
(
g_FCI
.
col
,
g_FCI
.
row
,
offset
);
}
else
{
isIntersect
=
bbox
.
contains
(
g_FCI
.
col
,
g_FCI
.
row
);
}
if
(
isIntersect
)
{
var
cellMapElem
=
sheetContainer
.
cellMap
[
cellIndex
];
for
(
var
listenerId
in
cellMapElem
.
listeners
)
{
listeners
[
listenerId
]
=
cellMapElem
.
listeners
[
listenerId
];
...
...
@@ -1017,11 +1068,13 @@ function getRangeType(oBBox){
}
for
(
var
areaIndex
in
sheetContainer
.
areaMap
)
{
var
areaMapElem
=
sheetContainer
.
areaMap
[
areaIndex
];
var
isIntersect
;
if
(
AscCommon
.
c_oNotifyType
.
Shift
==
notifyType
)
{
isIntersect
=
oShiftGetBBox
.
isIntersectForShift
(
areaMapElem
.
bbox
,
isHor
)
}
else
{
isIntersect
=
oShiftGetBBox
.
containsRange
(
areaMapElem
.
bbox
);
isIntersect
=
bbox
.
isIntersectForShift
(
areaMapElem
.
bbox
,
offset
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Move
==
notifyType
)
{
isIntersect
=
bbox
.
containsRange
(
areaMapElem
.
bbox
);
}
else
if
(
AscCommon
.
c_oNotifyType
.
Delete
==
notifyType
)
{
//isIntersect = bbox.isIntersect(areaMapElem.bbox);
isIntersect
=
bbox
.
containsRange
(
areaMapElem
.
bbox
);
}
if
(
isIntersect
)
{
for
(
var
listenerId
in
areaMapElem
.
listeners
)
{
...
...
@@ -1044,14 +1097,18 @@ function getRangeType(oBBox){
RangeTree
.
prototype
=
{
add
:
function
(
bbox
,
data
)
{
var
top
=
this
.
yTree
.
insertOrGet
(
new
Asc
.
TreeRBNode
(
bbox
.
r1
,
{
count
:
0
,
vals
:
{}}));
var
bottom
=
this
.
yTree
.
insertOrGet
(
new
Asc
.
TreeRBNode
(
bbox
.
r2
,
{
count
:
0
,
vals
:
{}}));
data
.
id
=
this
.
id
++
;
var
startFlag
=
bbox
.
r1
!==
bbox
.
r2
?
1
:
3
;
var
dataWrap
=
{
bbox
:
bbox
,
data
:
data
,
isOutput
:
false
};
top
.
storedValue
.
vals
[
data
.
id
]
=
{
isStart
:
true
,
dataWrap
:
dataWrap
};
var
top
=
this
.
yTree
.
insertOrGet
(
new
Asc
.
TreeRBNode
(
bbox
.
r1
,
{
count
:
0
,
vals
:
{}}));
top
.
storedValue
.
vals
[
data
.
id
]
=
{
startFlag
:
startFlag
,
dataWrap
:
dataWrap
};
top
.
storedValue
.
count
++
;
bottom
.
storedValue
.
vals
[
data
.
id
]
=
{
isStart
:
false
,
dataWrap
:
dataWrap
};
if
(
bbox
.
r1
!=
bbox
.
r2
)
{
startFlag
=
2
;
var
bottom
=
this
.
yTree
.
insertOrGet
(
new
Asc
.
TreeRBNode
(
bbox
.
r2
,
{
count
:
0
,
vals
:
{}}));
bottom
.
storedValue
.
vals
[
data
.
id
]
=
{
startFlag
:
startFlag
,
dataWrap
:
dataWrap
};
bottom
.
storedValue
.
count
++
;
}
},
remove
:
function
(
bbox
,
data
)
{
var
top
=
this
.
yTree
.
getElem
(
bbox
.
r1
);
...
...
@@ -1082,7 +1139,7 @@ function getRangeType(oBBox){
console
.
time
(
'
forin
'
);
var
cellArr
=
[];
for
(
var
cellIndex
in
cells
)
{
cellArr
.
push
(
cellIndex
);
cellArr
.
push
(
cellIndex
-
0
);
}
console
.
timeEnd
(
'
forin
'
);
console
.
time
(
'
sort
'
);
...
...
@@ -1106,7 +1163,7 @@ function getRangeType(oBBox){
curY
=
curNodeY
.
key
;
for
(
var
id
in
curNodeY
.
storedValue
.
vals
)
{
var
elem
=
curNodeY
.
storedValue
.
vals
[
id
];
if
(
elem
.
isStart
&&
!
elem
.
dataWrap
.
isOutput
)
{
if
(
0
!==
(
1
&
elem
.
startFlag
)
&&
!
elem
.
dataWrap
.
isOutput
)
{
curNodes
[
id
]
=
elem
;
}
}
...
...
@@ -1132,7 +1189,7 @@ function getRangeType(oBBox){
}
else
{
for
(
var
id
in
curNodeY
.
storedValue
.
vals
)
{
var
elem
=
curNodeY
.
storedValue
.
vals
[
id
];
if
(
!
elem
.
isStart
&&
!
elem
.
dataWrap
.
isOutput
)
{
if
(
0
!==
(
2
&
elem
.
startFlag
)
&&
!
elem
.
dataWrap
.
isOutput
)
{
delete
curNodes
[
id
];
}
}
...
...
@@ -1199,7 +1256,6 @@ function getUniqueKeys(array) {
function
Workbook
(
eventsHandlers
,
oApi
){
this
.
oApi
=
oApi
;
this
.
handlers
=
eventsHandlers
;
this
.
needRecalc
=
{
nodes
:
{},
length
:
0
};
this
.
dependencyFormulas
=
new
DependencyGraph
(
this
);
this
.
nActive
=
0
;
...
...
@@ -1630,9 +1686,12 @@ Workbook.prototype.getDefinesNames = function ( name, sheetId ) {
};
Workbook
.
prototype
.
delDefinesNames
=
function
(
defName
)
{
this
.
dependencyFormulas
.
removeDefName
(
defName
.
LocalSheetId
,
defName
.
Name
);
this
.
dependencyFormulas
.
calcTree
();
};
Workbook
.
prototype
.
editDefinesNames
=
function
(
oldName
,
newName
,
bUndo
)
{
return
this
.
dependencyFormulas
.
editDefinesNames
(
oldName
,
newName
,
bUndo
);
Workbook
.
prototype
.
editDefinesNames
=
function
(
oldName
,
newName
)
{
var
res
=
this
.
dependencyFormulas
.
editDefinesNames
(
oldName
,
newName
);
this
.
dependencyFormulas
.
calcTree
();
return
res
;
};
Workbook
.
prototype
.
findDefinesNames
=
function
(
ref
,
sheetId
)
{
return
this
.
dependencyFormulas
.
getDefNameByRef
(
ref
,
sheetId
);
...
...
@@ -2698,9 +2757,7 @@ Woorksheet.prototype._removeRows=function(start, stop){
History
.
Create_NewPoint
();
//start, stop 0 based
var
nDif
=
-
(
stop
-
start
+
1
);
var
oActualRange
=
{
r1
:
start
,
c1
:
0
,
r2
:
stop
,
c2
:
gc_nMaxCol0
};
var
oActualRange
=
new
Asc
.
Range
(
0
,
start
,
gc_nMaxCol0
,
stop
);
this
.
renameDependencyNodes
({
offsetRow
:
nDif
,
offsetCol
:
0
},
oActualRange
);
var
i
,
j
,
length
,
nIndex
,
aIndexes
=
[];
for
(
i
in
this
.
aGCells
)
{
...
...
@@ -2740,7 +2797,8 @@ Woorksheet.prototype._removeRows=function(start, stop){
}
delete
this
.
aGCells
[
nIndex
];
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
nDif
,
offsetCol
:
0
},
oActualRange
);
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
);
...
...
@@ -2757,8 +2815,6 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){
this
.
workbook
.
dependencyFormulas
.
lockRecal
();
var
oActualRange
=
{
r1
:
index
,
c1
:
0
,
r2
:
index
+
count
-
1
,
c2
:
gc_nMaxCol0
};
History
.
Create_NewPoint
();
this
.
renameDependencyNodes
({
offsetRow
:
count
,
offsetCol
:
0
},
oActualRange
);
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
));
//index 0 based
var
aIndexes
=
[];
for
(
var
i
in
this
.
aGCells
)
...
...
@@ -2796,6 +2852,10 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){
}
History
.
LocalChange
=
false
;
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
count
,
offsetCol
:
0
},
oActualRange
);
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
);
...
...
@@ -2826,7 +2886,6 @@ Woorksheet.prototype._removeCols=function(start, stop){
//start, stop 0 based
var
nDif
=
-
(
stop
-
start
+
1
),
i
,
j
,
length
,
nIndex
;
var
oActualRange
=
{
r1
:
0
,
c1
:
start
,
r2
:
gc_nMaxRow0
,
c2
:
stop
};
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
nDif
},
oActualRange
);
for
(
i
in
this
.
aGCells
)
{
var
nRowIndex
=
i
-
0
;
...
...
@@ -2854,7 +2913,6 @@ Woorksheet.prototype._removeCols=function(start, stop){
}
}
}
var
oDefColPr
=
new
AscCommonExcel
.
UndoRedoData_ColProp
();
for
(
i
=
start
;
i
<=
stop
;
++
i
)
{
...
...
@@ -2874,7 +2932,8 @@ Woorksheet.prototype._removeCols=function(start, stop){
if
(
null
!=
elem
)
elem
.
moveHor
(
nDif
);
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
nDif
},
oActualRange
);
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
));
...
...
@@ -2891,8 +2950,6 @@ Woorksheet.prototype._insertColsBefore=function(index, count){
this
.
workbook
.
dependencyFormulas
.
lockRecal
();
var
oActualRange
=
{
r1
:
0
,
c1
:
index
,
r2
:
gc_nMaxRow0
,
c2
:
index
+
count
-
1
};
History
.
Create_NewPoint
();
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
count
},
oActualRange
);
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
));
//index 0 based
for
(
var
i
in
this
.
aGCells
)
{
...
...
@@ -2913,6 +2970,10 @@ Woorksheet.prototype._insertColsBefore=function(index, count){
this
.
_moveCellHor
(
nRowIndex
,
nIndex
,
count
,
oActualRange
);
}
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
count
},
oActualRange
);
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
);
...
...
@@ -3756,12 +3817,8 @@ Woorksheet.prototype._moveRange=function(oBBoxFrom, oBBoxTo, copyRange){
if
(
!
copyRange
){
var
sBBoxFromName
=
oBBoxFrom
.
getName
();
this
.
workbook
.
needRecalc
.
nodes
[
getVertexId
(
this
.
getId
(),
sBBoxFromName
)]
=
[
this
.
getId
(),
sBBoxFromName
];
this
.
workbook
.
needRecalc
.
length
++
;
}
var
sBBoxToName
=
oBBoxTo
.
getName
();
this
.
workbook
.
needRecalc
.
nodes
[
getVertexId
(
this
.
getId
(),
sBBoxToName
)]
=
[
this
.
getId
(),
sBBoxToName
];
this
.
workbook
.
needRecalc
.
length
++
;
this
.
workbook
.
sortDependency
();
if
(
true
==
this
.
workbook
.
bUndoChanges
||
true
==
this
.
workbook
.
bRedoChanges
)
...
...
@@ -3781,7 +3838,6 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
var
nLeft
=
oBBox
.
c1
;
var
nRight
=
oBBox
.
c2
;
var
dif
=
nLeft
-
nRight
-
1
;
this
.
renameDependencyNodes
(
{
offsetRow
:
0
,
offsetCol
:
dif
},
oBBox
);
for
(
var
i
=
oBBox
.
r1
;
i
<=
oBBox
.
r2
;
i
++
){
var
row
=
this
.
aGCells
[
i
];
if
(
row
){
...
...
@@ -3807,6 +3863,8 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
}
}
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
(
{
offsetRow
:
0
,
offsetCol
:
dif
},
oBBox
);
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
);
...
...
@@ -3816,7 +3874,6 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
var
nTop
=
oBBox
.
r1
;
var
nBottom
=
oBBox
.
r2
;
var
dif
=
nTop
-
nBottom
-
1
;
this
.
renameDependencyNodes
({
offsetRow
:
dif
,
offsetCol
:
0
},
oBBox
);
var
aIndexes
=
[];
for
(
var
i
in
this
.
aGCells
)
{
...
...
@@ -3846,6 +3903,8 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
}
}
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
dif
,
offsetCol
:
0
},
oBBox
);
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
);
...
...
@@ -3855,7 +3914,7 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox, displayNameFormatTable){
var
nLeft
=
oBBox
.
c1
;
var
nRight
=
oBBox
.
c2
;
var
dif
=
nRight
-
nLeft
+
1
;
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
dif
},
oBBox
);
for
(
var
i
=
oBBox
.
r1
;
i
<=
oBBox
.
r2
;
i
++
){
var
row
=
this
.
aGCells
[
i
];
if
(
row
){
...
...
@@ -3880,6 +3939,8 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox, displayNameFormatTable){
}
}
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
0
,
offsetCol
:
dif
},
oBBox
);
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
);
...
...
@@ -3889,7 +3950,6 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox, displayNameFormatTable){
var
nBottom
=
oBBox
.
r2
;
var
dif
=
nBottom
-
nTop
+
1
;
var
aIndexes
=
[];
this
.
renameDependencyNodes
({
offsetRow
:
dif
,
offsetCol
:
0
},
oBBox
);
for
(
var
i
in
this
.
aGCells
){
var
rowInd
=
i
-
0
;
if
(
rowInd
>=
nTop
)
...
...
@@ -3911,6 +3971,8 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox, displayNameFormatTable){
}
}
}
//renameDependencyNodes after move cells because addToChanged has to add new locations
this
.
renameDependencyNodes
({
offsetRow
:
dif
,
offsetCol
:
0
},
oBBox
);
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
));
this
.
autoFilters
.
insertRows
(
"
insCell
"
,
oBBox
,
c_oAscInsertOptions
.
InsertCellsAndShiftDown
,
displayNameFormatTable
);
...
...
@@ -4697,24 +4759,43 @@ Cell.prototype.setValueData = function(Val){
}
}
};
Cell
.
prototype
.
onFormulaEvent
=
function
(
type
,
data
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
Cell
.
prototype
.
onFormulaEvent
=
function
(
type
,
eventData
)
{
if
(
AscCommon
.
c_oNotifyParentType
.
CanDo
===
type
)
{
;
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
Change
===
type
)
{
this
.
ws
.
workbook
.
dependencyFormulas
.
addToChangedCell
(
this
);
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
ChangeFormula
===
type
)
{
var
DataOld
=
this
.
getValueData
();
var
assemb
;
switch
(
eventData
.
assembleType
)
{
case
AscCommon
.
c_oNotifyParentAssemble
.
Normal
:
assemb
=
this
.
formulaParsed
.
assemble
();
break
;
case
AscCommon
.
c_oNotifyParentAssemble
.
Flag
:
assemb
=
this
.
formulaParsed
.
assemble
(
true
);
break
;
case
AscCommon
.
c_oNotifyParentAssemble
.
Current
:
assemb
=
this
.
formulaParsed
.
Formula
;
break
;
}
if
(
eventData
.
isRebuild
)
{
this
.
setValue
(
'
=
'
+
assemb
);
}
else
{
this
.
formulaParsed
.
Formula
=
assemb
;
this
.
formulaParsed
.
buildDependencies
();
this
.
formulaParsed
.
Formula
=
this
.
formulaParsed
.
assemble
(
);
this
.
ws
.
workbook
.
dependencyFormulas
.
addToChangedCell
(
this
);
var
DataNew
=
this
.
getValueData
();
if
(
false
==
DataOld
.
isEqual
(
DataNew
))
{
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCell
,
AscCH
.
historyitem_Cell_ChangeValueUndo
,
this
.
ws
.
getId
(),
new
Asc
.
Range
(
this
.
nCol
,
this
.
nRow
,
this
.
nCol
,
this
.
nRow
),
new
UndoRedoData_CellSimpleData
(
this
.
nRow
,
this
.
nCol
,
DataOld
,
DataNew
),
true
);
this
.
oValue
.
cleanCache
();
this
.
ws
.
workbook
.
dependencyFormulas
.
addToChangedCell
(
this
);
}
}
}
else
if
(
AscCommon
.
c_oNotifyParentType
.
EndCalculate
===
type
)
{
this
.
_updateCellValue
();
}
return
true
;
};
Cell
.
prototype
.
_calculateRefType
=
function
(
cell
)
{
var
val
=
this
.
formulaParsed
.
value
;
...
...
@@ -7568,9 +7649,11 @@ Range.prototype._sortByArray=function(oBBox, aSortData, bUndo){
oCurCell
.
moveVer
(
shift
);
rowTo
.
c
[
i
]
=
oCurCell
;
if
(
oCurCell
.
formulaParsed
)
{
History
.
TurnOff
();
var
_p_
=
oCurCell
.
formulaParsed
.
clone
(
null
,
oCurCell
,
this
);
var
assemb
=
_p_
.
changeOffset
({
offsetCol
:
0
,
offsetRow
:
shift
}).
assemble
();
oCurCell
.
setValue
(
"
=
"
+
assemb
);
History
.
TurnOn
();
}
}
else
...
...
@@ -8615,6 +8698,7 @@ DrawingObjectsManager.prototype.rebuildCharts = function(data)
window
[
'
AscCommonExcel
'
].
oDefaultMetrics
=
oDefaultMetrics
;
window
[
'
AscCommonExcel
'
].
g_nAllColIndex
=
g_nAllColIndex
;
window
[
'
AscCommonExcel
'
].
g_nAllRowIndex
=
g_nAllRowIndex
;
window
[
'
AscCommonExcel
'
].
g_DefNameWorksheet
;
window
[
'
AscCommonExcel
'
].
aStandartNumFormats
=
aStandartNumFormats
;
window
[
'
AscCommonExcel
'
].
aStandartNumFormatsId
=
aStandartNumFormatsId
;
window
[
'
AscCommonExcel
'
].
oFormulaLocaleInfo
=
oFormulaLocaleInfo
;
...
...
cell/utils/utils.js
View file @
929f0aab
...
...
@@ -305,11 +305,38 @@
return
bRes
;
},
isIntersectForShift
:
function
(
range
,
isHor
)
{
isIntersectForShift
:
function
(
range
,
offset
)
{
var
isHor
=
offset
&&
0
!=
offset
.
offsetCol
;
var
toDelete
=
offset
&&
(
offset
.
offsetCol
<
0
||
offset
.
offsetRow
<
0
);
if
(
isHor
)
{
return
this
.
r1
<=
range
.
r1
&&
range
.
r2
<=
this
.
r2
&&
this
.
c1
<=
range
.
c2
;
if
(
this
.
r1
<=
range
.
r1
&&
range
.
r2
<=
this
.
r2
&&
this
.
c1
<=
range
.
c2
)
{
return
true
;
}
else
if
(
toDelete
&&
this
.
c1
<=
range
.
c1
&&
range
.
c2
<=
this
.
c2
)
{
var
topIn
=
this
.
r1
<=
range
.
r1
&&
range
.
r1
<=
this
.
r2
;
var
bottomIn
=
this
.
r1
<=
range
.
r2
&&
range
.
r2
<=
this
.
r2
;
return
topIn
||
bottomIn
;
}
else
{
return
this
.
c1
<=
range
.
c1
&&
range
.
c2
<=
this
.
c2
&&
this
.
r1
<=
range
.
r2
;
return
false
;
}
}
else
{
if
(
this
.
c1
<=
range
.
c1
&&
range
.
c2
<=
this
.
c2
&&
this
.
r1
<=
range
.
r2
)
{
return
true
;
}
else
if
(
toDelete
&&
this
.
r1
<=
range
.
r1
&&
range
.
r2
<=
this
.
r2
)
{
var
leftIn
=
this
.
c1
<=
range
.
c1
&&
range
.
c1
<=
this
.
c2
;
var
rightIn
=
this
.
c1
<=
range
.
c2
&&
range
.
c2
<=
this
.
c2
;
return
leftIn
||
rightIn
;
}
else
{
return
false
;
}
}
},
isIntersectForShiftCell
:
function
(
col
,
row
,
offset
)
{
var
isHor
=
offset
&&
0
!=
offset
.
offsetCol
;
if
(
isHor
)
{
return
this
.
r1
<=
row
&&
row
<=
this
.
r2
&&
this
.
c1
<=
col
;
}
else
{
return
this
.
c1
<=
col
&&
col
<=
this
.
c2
&&
this
.
r1
<=
row
;
}
},
...
...
@@ -328,9 +355,18 @@
}
}
else
if
(
this
.
c1
<=
bbox
.
c2
)
{
if
(
this
.
c2
<=
bbox
.
c2
)
{
var
topIn
=
bbox
.
r1
<=
this
.
r1
&&
this
.
r1
<=
bbox
.
r2
;
var
bottomIn
=
bbox
.
r1
<=
this
.
r2
&&
this
.
r2
<=
bbox
.
r2
;
if
(
topIn
&&
bottomIn
)
{
isNoDelete
=
false
;
}
else
if
(
topIn
)
{
this
.
setOffsetFirst
({
offsetCol
:
0
,
offsetRow
:
bbox
.
r2
-
this
.
r1
+
1
});
}
else
if
(
bottomIn
)
{
this
.
setOffsetLast
({
offsetCol
:
0
,
offsetRow
:
bbox
.
r1
-
this
.
r2
-
1
});
}
}
else
{
this
.
setOffsetFirst
({
offsetCol
:
bbox
.
c2
-
this
.
c1
+
1
,
offsetRow
:
0
});
this
.
setOffsetFirst
({
offsetCol
:
bbox
.
c1
-
this
.
c1
,
offsetRow
:
0
});
this
.
setOffsetLast
(
offset
);
}
}
else
{
this
.
setOffset
(
offset
);
...
...
@@ -352,9 +388,18 @@
}
}
else
if
(
this
.
r1
<=
bbox
.
r2
)
{
if
(
this
.
r2
<=
bbox
.
r2
)
{
var
leftIn
=
bbox
.
c1
<=
this
.
c1
&&
this
.
c1
<=
bbox
.
c2
;
var
rightIn
=
bbox
.
c1
<=
this
.
c2
&&
this
.
c2
<=
bbox
.
c2
;
if
(
leftIn
&&
rightIn
)
{
isNoDelete
=
false
;
}
else
if
(
leftIn
)
{
this
.
setOffsetFirst
({
offsetCol
:
bbox
.
c2
-
this
.
c1
+
1
,
offsetRow
:
0
});
}
else
if
(
rightIn
)
{
this
.
setOffsetLast
({
offsetCol
:
bbox
.
c1
-
this
.
c2
-
1
,
offsetRow
:
0
});
}
}
else
{
this
.
setOffsetFirst
({
offsetCol
:
0
,
offsetRow
:
bbox
.
r2
-
this
.
r1
+
1
});
this
.
setOffsetFirst
({
offsetCol
:
0
,
offsetRow
:
bbox
.
r1
-
this
.
r1
});
this
.
setOffsetLast
(
offset
);
}
}
else
{
this
.
setOffset
(
offset
);
...
...
common/commonDefines.js
View file @
929f0aab
...
...
@@ -823,9 +823,16 @@ var c_oAscPrintDefaultSettings = {
};
var
c_oNotifyParentType
=
{
Change
:
0
,
ChangeFormula
:
1
,
EndCalculate
:
2
CanDo
:
0
,
Change
:
1
,
ChangeFormula
:
2
,
EndCalculate
:
3
};
var
c_oNotifyParentAssemble
=
{
Normal
:
0
,
Flag
:
1
,
Current
:
2
};
var
c_oDashType
=
{
...
...
@@ -1480,6 +1487,8 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
window
[
"
AscCommon
"
].
c_oZoomType
=
c_oZoomType
;
window
[
"
AscCommon
"
].
c_oNotifyType
=
c_oNotifyType
;
window
[
"
AscCommon
"
].
c_oNotifyParentType
=
c_oNotifyParentType
;
window
[
"
AscCommon
"
].
c_oNotifyParentAssemble
=
c_oNotifyParentAssemble
;
window
[
"
AscCommon
"
].
c_oAscEncodings
=
c_oAscEncodings
;
window
[
"
AscCommon
"
].
c_oAscEncodingsMap
=
c_oAscEncodingsMap
;
window
[
"
AscCommon
"
].
c_oAscCodePageUtf8
=
c_oAscCodePageUtf8
;
...
...
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