Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
e38d20c1
Kaydet (Commit)
e38d20c1
authored
Nis 29, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle range references for group calculation. This is still untested.
Change-Id: I1eb1c217db66615028faa85720838579056dc150
üst
f07601a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
20 deletions
+72
-20
vectortoken.cxx
formula/source/core/api/vectortoken.cxx
+27
-7
vectortoken.hxx
include/formula/vectortoken.hxx
+11
-6
formulacell.cxx
sc/source/core/data/formulacell.cxx
+34
-7
No files found.
formula/source/core/api/vectortoken.cxx
Dosyayı görüntüle @
e38d20c1
...
@@ -12,11 +12,11 @@
...
@@ -12,11 +12,11 @@
namespace
formula
{
namespace
formula
{
SingleVectorRefToken
::
SingleVectorRefToken
(
const
double
*
pArray
,
size_t
nLength
)
:
SingleVectorRefToken
::
SingleVectorRefToken
(
const
double
*
pArray
,
size_t
nLength
)
:
FormulaToken
(
svSingleVectorRef
,
ocPush
),
mpArray
(
pArray
),
mnLength
(
nLength
)
{}
FormulaToken
(
svSingleVectorRef
,
ocPush
),
mpArray
(
pArray
),
mn
Array
Length
(
nLength
)
{}
FormulaToken
*
SingleVectorRefToken
::
Clone
()
const
FormulaToken
*
SingleVectorRefToken
::
Clone
()
const
{
{
return
new
SingleVectorRefToken
(
mpArray
,
mnLength
);
return
new
SingleVectorRefToken
(
mpArray
,
mn
Array
Length
);
}
}
const
double
*
SingleVectorRefToken
::
GetArray
()
const
const
double
*
SingleVectorRefToken
::
GetArray
()
const
...
@@ -24,19 +24,19 @@ const double* SingleVectorRefToken::GetArray() const
...
@@ -24,19 +24,19 @@ const double* SingleVectorRefToken::GetArray() const
return
mpArray
;
return
mpArray
;
}
}
size_t
SingleVectorRefToken
::
GetLength
()
const
size_t
SingleVectorRefToken
::
Get
Array
Length
()
const
{
{
return
mnLength
;
return
mn
Array
Length
;
}
}
DoubleVectorRefToken
::
DoubleVectorRefToken
(
DoubleVectorRefToken
::
DoubleVectorRefToken
(
const
std
::
vector
<
const
double
*>&
rArrays
,
size_t
n
RowSize
,
bool
bAbsStart
,
bool
bAbsEn
d
)
:
const
std
::
vector
<
const
double
*>&
rArrays
,
size_t
n
ArrayLength
,
size_t
nRefRowSize
,
bool
bStartFixed
,
bool
bEndFixe
d
)
:
FormulaToken
(
svDoubleVectorRef
,
ocPush
),
FormulaToken
(
svDoubleVectorRef
,
ocPush
),
maArrays
(
rArrays
),
mn
RowSize
(
nRowSize
),
mbAbsStart
(
bAbsStart
),
mbAbsEnd
(
bAbsEn
d
)
{}
maArrays
(
rArrays
),
mn
ArrayLength
(
nArrayLength
),
mnRefRowSize
(
nRefRowSize
),
mbStartFixed
(
bStartFixed
),
mbEndFixed
(
bEndFixe
d
)
{}
FormulaToken
*
DoubleVectorRefToken
::
Clone
()
const
FormulaToken
*
DoubleVectorRefToken
::
Clone
()
const
{
{
return
new
DoubleVectorRefToken
(
maArrays
,
mn
RowSize
,
mbAbsStart
,
mbAbsEn
d
);
return
new
DoubleVectorRefToken
(
maArrays
,
mn
ArrayLength
,
mnRefRowSize
,
mbStartFixed
,
mbEndFixe
d
);
}
}
const
std
::
vector
<
const
double
*>&
DoubleVectorRefToken
::
GetArrays
()
const
const
std
::
vector
<
const
double
*>&
DoubleVectorRefToken
::
GetArrays
()
const
...
@@ -44,6 +44,26 @@ const std::vector<const double*>& DoubleVectorRefToken::GetArrays() const
...
@@ -44,6 +44,26 @@ const std::vector<const double*>& DoubleVectorRefToken::GetArrays() const
return
maArrays
;
return
maArrays
;
}
}
size_t
DoubleVectorRefToken
::
GetArrayLength
()
const
{
return
mnArrayLength
;
}
size_t
DoubleVectorRefToken
::
GetRefRowSize
()
const
{
return
mnRefRowSize
;
}
bool
DoubleVectorRefToken
::
IsStartFixed
()
const
{
return
mbStartFixed
;
}
bool
DoubleVectorRefToken
::
IsEndFixed
()
const
{
return
mbEndFixed
;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
include/formula/vectortoken.hxx
Dosyayı görüntüle @
e38d20c1
...
@@ -17,7 +17,7 @@ namespace formula {
...
@@ -17,7 +17,7 @@ namespace formula {
class
FORMULA_DLLPUBLIC
SingleVectorRefToken
:
public
FormulaToken
class
FORMULA_DLLPUBLIC
SingleVectorRefToken
:
public
FormulaToken
{
{
const
double
*
mpArray
;
const
double
*
mpArray
;
size_t
mnLength
;
size_t
mn
Array
Length
;
public
:
public
:
SingleVectorRefToken
(
const
double
*
pArray
,
size_t
nLength
);
SingleVectorRefToken
(
const
double
*
pArray
,
size_t
nLength
);
...
@@ -25,7 +25,7 @@ public:
...
@@ -25,7 +25,7 @@ public:
virtual
FormulaToken
*
Clone
()
const
;
virtual
FormulaToken
*
Clone
()
const
;
const
double
*
GetArray
()
const
;
const
double
*
GetArray
()
const
;
size_t
GetLength
()
const
;
size_t
Get
Array
Length
()
const
;
};
};
/**
/**
...
@@ -36,18 +36,23 @@ class FORMULA_DLLPUBLIC DoubleVectorRefToken : public FormulaToken
...
@@ -36,18 +36,23 @@ class FORMULA_DLLPUBLIC DoubleVectorRefToken : public FormulaToken
{
{
std
::
vector
<
const
double
*>
maArrays
;
std
::
vector
<
const
double
*>
maArrays
;
size_t
mnRowSize
;
size_t
mnArrayLength
;
size_t
mnRefRowSize
;
bool
mb
AbsStart
:
1
;
/// whether or not the start row position is absolute.
bool
mb
StartFixed
:
1
;
/// whether or not the start row position is absolute.
bool
mb
AbsEn
d
:
1
;
/// whether or not the end row position is absolute.
bool
mb
EndFixe
d
:
1
;
/// whether or not the end row position is absolute.
public
:
public
:
DoubleVectorRefToken
(
DoubleVectorRefToken
(
const
std
::
vector
<
const
double
*>&
rArrays
,
size_t
n
RowSize
,
bool
bAbsStart
,
bool
bAbsEn
d
);
const
std
::
vector
<
const
double
*>&
rArrays
,
size_t
n
ArrayLength
,
size_t
nRefRowSize
,
bool
bStartFixed
,
bool
bEndFixe
d
);
virtual
FormulaToken
*
Clone
()
const
;
virtual
FormulaToken
*
Clone
()
const
;
const
std
::
vector
<
const
double
*>&
GetArrays
()
const
;
const
std
::
vector
<
const
double
*>&
GetArrays
()
const
;
size_t
GetArrayLength
()
const
;
size_t
GetRefRowSize
()
const
;
bool
IsStartFixed
()
const
;
bool
IsEndFixed
()
const
;
};
};
}
}
...
...
sc/source/core/data/formulacell.cxx
Dosyayı görüntüle @
e38d20c1
...
@@ -3030,24 +3030,25 @@ bool ScFormulaCell::InterpretFormulaGroup()
...
@@ -3030,24 +3030,25 @@ bool ScFormulaCell::InterpretFormulaGroup()
size_t
nCols
=
aRef
.
Ref2
.
nCol
-
aRef
.
Ref1
.
nCol
+
1
;
size_t
nCols
=
aRef
.
Ref2
.
nCol
-
aRef
.
Ref1
.
nCol
+
1
;
std
::
vector
<
const
double
*>
aArrays
;
std
::
vector
<
const
double
*>
aArrays
;
aArrays
.
reserve
(
nCols
);
aArrays
.
reserve
(
nCols
);
SCROW
nLength
=
xGroup
->
mnLength
;
SCROW
nArrayLength
=
xGroup
->
mnLength
;
SCROW
nRefRowSize
=
aRef
.
Ref2
.
nRow
-
aRef
.
Ref1
.
nRow
+
1
;
if
(
!
bAbsLast
)
if
(
!
bAbsLast
)
{
{
// range end position is relative. Extend
it
.
// range end position is relative. Extend
the array length
.
n
Length
+=
aRef
.
Ref2
.
nRow
-
aRef
.
Ref1
.
nRow
;
n
ArrayLength
+=
nRefRowSize
-
1
;
}
}
for
(
SCCOL
i
=
aRef
.
Ref1
.
nCol
;
i
<=
aRef
.
Ref2
.
nCol
;
++
i
)
for
(
SCCOL
i
=
aRef
.
Ref1
.
nCol
;
i
<=
aRef
.
Ref2
.
nCol
;
++
i
)
{
{
aRefPos
.
SetCol
(
i
);
aRefPos
.
SetCol
(
i
);
const
double
*
pArray
=
pDocument
->
FetchDoubleArray
(
aCxt
,
aRefPos
,
nLength
);
const
double
*
pArray
=
pDocument
->
FetchDoubleArray
(
aCxt
,
aRefPos
,
n
Array
Length
);
if
(
!
pArray
)
if
(
!
pArray
)
return
false
;
return
false
;
aArrays
.
push_back
(
pArray
);
aArrays
.
push_back
(
pArray
);
}
}
formula
::
DoubleVectorRefToken
aTok
(
aArrays
,
n
Length
,
bAbsFirst
,
bAbsLast
);
formula
::
DoubleVectorRefToken
aTok
(
aArrays
,
n
ArrayLength
,
nRefRowSize
,
bAbsFirst
,
bAbsLast
);
aCode
.
AddToken
(
aTok
);
aCode
.
AddToken
(
aTok
);
}
}
else
else
...
@@ -3088,11 +3089,37 @@ bool ScFormulaCell::InterpretFormulaGroup()
...
@@ -3088,11 +3089,37 @@ bool ScFormulaCell::InterpretFormulaGroup()
{
{
const
formula
::
SingleVectorRefToken
*
p2
=
static_cast
<
const
formula
::
SingleVectorRefToken
*>
(
p
);
const
formula
::
SingleVectorRefToken
*
p2
=
static_cast
<
const
formula
::
SingleVectorRefToken
*>
(
p
);
const
double
*
pArray
=
p2
->
GetArray
();
const
double
*
pArray
=
p2
->
GetArray
();
aCode2
.
AddDouble
(
pArray
[
i
]
);
aCode2
.
AddDouble
(
i
<
p2
->
GetArrayLength
()
?
pArray
[
i
]
:
0.0
);
}
}
break
;
break
;
case
svDoubleVectorRef
:
case
svDoubleVectorRef
:
return
false
;
{
const
formula
::
DoubleVectorRefToken
*
p2
=
static_cast
<
const
formula
::
DoubleVectorRefToken
*>
(
p
);
const
std
::
vector
<
const
double
*>&
rArrays
=
p2
->
GetArrays
();
size_t
nColSize
=
rArrays
.
size
();
size_t
nRowStart
=
p2
->
IsStartFixed
()
?
0
:
i
;
size_t
nRowEnd
=
p2
->
GetRefRowSize
()
-
1
;
if
(
!
p2
->
IsEndFixed
())
nRowEnd
+=
i
;
size_t
nRowSize
=
nRowEnd
-
nRowStart
+
1
;
ScMatrixRef
pMat
(
new
ScMatrix
(
nColSize
,
nRowSize
,
0.0
));
for
(
size_t
nCol
=
0
;
nCol
<
nColSize
;
++
nCol
)
{
const
double
*
pArray
=
rArrays
[
nCol
];
for
(
size_t
nRow
=
0
;
nRow
<
nRowSize
;
++
nRow
)
{
if
(
nRowStart
+
nRow
<
p2
->
GetArrayLength
())
{
double
fVal
=
pArray
[
nRowStart
+
nRow
];
pMat
->
PutDouble
(
fVal
,
nCol
,
nRow
);
}
}
}
ScMatrixToken
aTok
(
pMat
);
aCode2
.
AddToken
(
aTok
);
}
break
;
break
;
default
:
default
:
aCode2
.
AddToken
(
*
p
);
aCode2
.
AddToken
(
*
p
);
...
...
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