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
Expand all
Hide 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
)
{
this
.
changeDefName
(
data
.
from
,
data
.
to
);
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
This diff is collapsed.
Click to expand it.
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
false
;
}
}
else
{
return
this
.
c1
<=
range
.
c1
&&
range
.
c2
<=
this
.
c2
&&
this
.
r1
<=
range
.
r2
;
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
)
{
isNoDelete
=
false
;
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
)
{
isNoDelete
=
false
;
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