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
b9c29090
Commit
b9c29090
authored
Mar 13, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 19769
parent
657a1cce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
30 deletions
+51
-30
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+4
-4
cell/model/Workbook.js
cell/model/Workbook.js
+31
-18
cell/utils/utils.js
cell/utils/utils.js
+16
-8
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
b9c29090
...
...
@@ -4938,13 +4938,13 @@ parserFormula.prototype.parse = function(local, digitDelim) {
};
/* Для обратной сборки функции иногда необходимо поменять ссылки на ячейки */
parserFormula
.
prototype
.
changeOffset
=
function
(
offset
)
{
//offset = AscCommonExcel.CRangeOffset
parserFormula
.
prototype
.
changeOffset
=
function
(
offset
,
canResize
)
{
//offset = AscCommonExcel.CRangeOffset
for
(
var
i
=
0
;
i
<
this
.
outStack
.
length
;
i
++
)
{
this
.
changeOffsetElem
(
this
.
outStack
[
i
],
this
.
outStack
,
i
,
offset
);
this
.
changeOffsetElem
(
this
.
outStack
[
i
],
this
.
outStack
,
i
,
offset
,
canResize
);
}
return
this
;
};
parserFormula
.
prototype
.
changeOffsetElem
=
function
(
elem
,
container
,
index
,
offset
)
{
//offset =
parserFormula
.
prototype
.
changeOffsetElem
=
function
(
elem
,
container
,
index
,
offset
,
canResize
)
{
//offset =
// AscCommonExcel.CRangeOffset
var
range
,
bbox
=
null
,
isErr
=
false
;
if
(
cElementType
.
cell
===
elem
.
type
||
cElementType
.
cell3D
===
elem
.
type
||
...
...
@@ -4959,7 +4959,7 @@ parserFormula.prototype.parse = function(local, digitDelim) {
bbox
=
elem
.
getBBox0
();
}
if
(
bbox
)
{
if
(
bbox
.
setOffsetWithAbs
(
offset
))
{
if
(
bbox
.
setOffsetWithAbs
(
offset
,
canResize
))
{
isErr
=
false
;
if
(
cElementType
.
cellsRange3D
===
elem
.
type
)
{
elem
.
bbox
=
bbox
;
...
...
cell/model/Workbook.js
View file @
b9c29090
...
...
@@ -4080,13 +4080,13 @@
row
.
c
[
j
]
=
oTempCell
;
if
(
oTempCell
.
formulaParsed
)
{
if
(
copyRange
)
{
oTempCell
.
formulaParsed
.
removeDependencies
();
oTempCell
.
formulaParsed
.
changeOffset
(
offset
);
oTempCell
.
formulaParsed
.
Formula
=
oTempCell
.
formulaParsed
.
assemble
(
true
);
this
.
workbook
.
dependencyFormulas
.
addToBuildDependencyCell
(
oTempCell
);
}
else
{
this
.
workbook
.
dependencyFormulas
.
addToChangedCell
(
oTempCell
);
//todo rework after clone formulaParsed unparsed
oTempCell
.
formulaParsed
.
parse
();
History
.
TurnOff
();
oTempCell
.
changeOffset
(
offset
,
false
,
true
);
History
.
TurnOn
();
}
this
.
workbook
.
dependencyFormulas
.
addToBuildDependencyCell
(
oTempCell
);
}
}
}
...
...
@@ -4863,16 +4863,17 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
cell
.
removeHyperlink
();
}
};
Cell
.
prototype
.
setFormula
=
function
(
formula
,
bHistoryUndo
)
{
Cell
.
prototype
.
setFormula
Template
=
function
(
bHistoryUndo
,
action
)
{
var
DataOld
=
null
;
var
DataNew
=
null
;
if
(
History
.
Is_On
())
DataOld
=
this
.
getValueData
();
this
.
removeDependencies
();
this
.
oValue
.
clean
();
this
.
formulaParsed
=
new
parserFormula
(
formula
,
this
,
this
.
ws
);
this
.
ws
.
workbook
.
dependencyFormulas
.
addToBuildDependencyCell
(
this
);
if
(
this
.
formulaParsed
)
{
this
.
formulaParsed
.
removeDependencies
();
}
action
(
this
);
if
(
History
.
Is_On
())
{
DataNew
=
this
.
getValueData
();
...
...
@@ -4882,6 +4883,19 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
}
};
Cell
.
prototype
.
setFormula
=
function
(
formula
,
bHistoryUndo
)
{
this
.
setFormulaTemplate
(
bHistoryUndo
,
function
(
cell
){
cell
.
formulaParsed
=
new
parserFormula
(
formula
,
cell
,
cell
.
ws
);
cell
.
ws
.
workbook
.
dependencyFormulas
.
addToBuildDependencyCell
(
cell
);
});
};
Cell
.
prototype
.
changeOffset
=
function
(
offset
,
canResize
,
bHistoryUndo
)
{
this
.
setFormulaTemplate
(
bHistoryUndo
,
function
(
cell
){
cell
.
formulaParsed
.
changeOffset
(
offset
,
canResize
);
cell
.
formulaParsed
.
Formula
=
cell
.
formulaParsed
.
assemble
(
true
);
cell
.
formulaParsed
.
buildDependencies
();
});
};
Cell
.
prototype
.
removeDependencies
=
function
()
{
//удаляем сторое значение
if
(
this
.
formulaParsed
)
{
...
...
@@ -8005,8 +8019,8 @@ Range.prototype._foreachNoEmpty=function(action, excludeHiddenRows){
}
var
oUndoRedoBBox
=
new
UndoRedoData_BBox
({
r1
:
nRowFirst0
,
c1
:
nColFirst0
,
r2
:
nLastRow0
,
c2
:
nLastCol0
});
oRes
=
new
AscCommonExcel
.
UndoRedoData_SortData
(
oUndoRedoBBox
,
aSortData
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_Sort
,
this
.
worksheet
.
getId
(),
new
Asc
.
Range
(
0
,
nRowFirst0
,
gc_nMaxCol0
,
nLastRow0
),
oRes
);
this
.
_sortByArray
(
oUndoRedoBBox
,
aSortData
);
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_Sort
,
this
.
worksheet
.
getId
(),
new
Asc
.
Range
(
0
,
nRowFirst0
,
gc_nMaxCol0
,
nLastRow0
),
oRes
);
}
this
.
worksheet
.
workbook
.
dependencyFormulas
.
unlockRecal
();
return
oRes
;
...
...
@@ -8079,15 +8093,14 @@ Range.prototype._foreachNoEmpty=function(action, excludeHiddenRows){
oTempCellsTo
[
nIndexTo
]
=
rowTo
.
c
[
i
];
if
(
null
!=
oCurCell
)
{
var
lastName
=
oCurCell
.
getName
();
if
(
oCurCell
.
formulaParsed
)
{
oCurCell
.
changeOffset
({
offsetCol
:
0
,
offsetRow
:
shift
},
true
,
true
);
}
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
(
true
);
oCurCell
.
setFormula
(
assemb
);
History
.
TurnOn
();
if
(
oCurCell
&&
oCurCell
.
getFormula
())
{
//for #Ref
this
.
worksheet
.
workbook
.
dependencyFormulas
.
addToChangedCell
(
oCurCell
);
}
}
else
...
...
cell/utils/utils.js
View file @
b9c29090
...
...
@@ -502,7 +502,7 @@
this
.
r1
=
Math
.
min
(
this
.
r1
,
r
);
this
.
r2
=
Math
.
max
(
this
.
r2
,
r
);
};
Range
.
prototype
.
setOffsetWithAbs
=
function
(
offset
)
{
Range
.
prototype
.
setOffsetWithAbs
=
function
(
offset
,
canResize
)
{
var
temp
;
var
offsetRow
=
offset
.
offsetRow
;
var
offsetCol
=
offset
.
offsetCol
;
...
...
@@ -520,8 +520,10 @@
this
.
r1
+=
offsetRow
;
if
(
this
.
r1
<
0
)
{
this
.
r1
=
0
;
if
(
!
canResize
)
{
return
false
;
}
}
if
(
this
.
r1
>
gc_nMaxRow0
)
{
this
.
r1
=
gc_nMaxRow0
;
return
false
;
...
...
@@ -531,8 +533,10 @@
this
.
c1
+=
offsetCol
;
if
(
this
.
c1
<
0
)
{
this
.
c1
=
0
;
if
(
!
canResize
)
{
return
false
;
}
}
if
(
this
.
c1
>
gc_nMaxCol0
)
{
this
.
c1
=
gc_nMaxCol0
;
return
false
;
...
...
@@ -546,9 +550,11 @@
}
if
(
this
.
r2
>
gc_nMaxRow0
)
{
this
.
r2
=
gc_nMaxRow0
;
if
(
!
canResize
)
{
return
false
;
}
}
}
if
(
!
isAbsCol2
)
{
this
.
c2
+=
offsetCol
;
if
(
this
.
c2
<
0
)
{
...
...
@@ -557,9 +563,11 @@
}
if
(
this
.
c2
>
gc_nMaxCol0
)
{
this
.
c2
=
gc_nMaxCol0
;
if
(
!
canResize
)
{
return
false
;
}
}
}
//switch abs flag
if
(
this
.
r1
>
this
.
r2
)
{
temp
=
this
.
r1
;
...
...
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