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
a77223b2
Kaydet (Commit)
a77223b2
authored
Eki 01, 2016
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
rearrange SwCalc some more
Change-Id: Ib1ffc112ddd006102b29536f7433a3f16bf63a3f
üst
9b2a24b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
19 deletions
+45
-19
calc.hxx
sw/inc/calc.hxx
+1
-0
calc.cxx
sw/source/core/bastyp/calc.cxx
+44
-19
No files found.
sw/inc/calc.hxx
Dosyayı görüntüle @
a77223b2
...
@@ -174,6 +174,7 @@ class SwCalc
...
@@ -174,6 +174,7 @@ class SwCalc
SwCalcOper
GetToken
();
SwCalcOper
GetToken
();
SwSbxValue
Expr
();
SwSbxValue
Expr
();
SwSbxValue
Term
();
SwSbxValue
Term
();
SwSbxValue
PrimFunc
(
bool
&
rChkPow
);
SwSbxValue
Prim
();
SwSbxValue
Prim
();
SwSbxValue
StdFunc
(
pfCalc
pFnc
,
bool
bChkTrig
);
SwSbxValue
StdFunc
(
pfCalc
pFnc
,
bool
bChkTrig
);
...
...
sw/source/core/bastyp/calc.cxx
Dosyayı görüntüle @
a77223b2
...
@@ -1042,36 +1042,34 @@ SwSbxValue SwCalc::StdFunc(pfCalc pFnc, bool bChkTrig)
...
@@ -1042,36 +1042,34 @@ SwSbxValue SwCalc::StdFunc(pfCalc pFnc, bool bChkTrig)
return
nErg
;
return
nErg
;
}
}
SwSbxValue
SwCalc
::
Prim
(
)
SwSbxValue
SwCalc
::
Prim
Func
(
bool
&
rChkPow
)
{
{
SwSbxValue
nErg
;
rChkPow
=
false
;
bool
bChkPow
=
false
;
switch
(
m_eCurrOper
)
switch
(
m_eCurrOper
)
{
{
case
CALC_SIN
:
case
CALC_SIN
:
nErg
=
StdFunc
(
&
sin
,
false
);
return
StdFunc
(
&
sin
,
false
);
break
;
break
;
case
CALC_COS
:
case
CALC_COS
:
nErg
=
StdFunc
(
&
cos
,
false
);
return
StdFunc
(
&
cos
,
false
);
break
;
break
;
case
CALC_TAN
:
case
CALC_TAN
:
nErg
=
StdFunc
(
&
tan
,
false
);
return
StdFunc
(
&
tan
,
false
);
break
;
break
;
case
CALC_ATAN
:
case
CALC_ATAN
:
nErg
=
StdFunc
(
&
atan
,
false
);
return
StdFunc
(
&
atan
,
false
);
break
;
break
;
case
CALC_ASIN
:
case
CALC_ASIN
:
nErg
=
StdFunc
(
&
asin
,
true
);
return
StdFunc
(
&
asin
,
true
);
break
;
break
;
case
CALC_ACOS
:
case
CALC_ACOS
:
nErg
=
StdFunc
(
&
acos
,
true
);
return
StdFunc
(
&
acos
,
true
);
break
;
break
;
case
CALC_NOT
:
case
CALC_NOT
:
{
{
GetToken
();
GetToken
();
nErg
=
Prim
();
SwSbxValue
nErg
=
Prim
();
if
(
SbxSTRING
==
nErg
.
GetType
()
)
if
(
SbxSTRING
==
nErg
.
GetType
()
)
{
{
nErg
.
PutBool
(
nErg
.
GetOUString
().
isEmpty
()
);
nErg
.
PutBool
(
nErg
.
GetOUString
().
isEmpty
()
);
...
@@ -1092,10 +1090,12 @@ SwSbxValue SwCalc::Prim()
...
@@ -1092,10 +1090,12 @@ SwSbxValue SwCalc::Prim()
//!! computes a binary NOT
//!! computes a binary NOT
nErg
.
Compute
(
SbxNOT
,
nErg
);
nErg
.
Compute
(
SbxNOT
,
nErg
);
}
}
return
nErg
;
break
;
break
;
}
}
case
CALC_NUMBER
:
case
CALC_NUMBER
:
{
{
SwSbxValue
nErg
;
if
(
GetToken
()
==
CALC_PHD
)
if
(
GetToken
()
==
CALC_PHD
)
{
{
double
aTmp
=
m_nNumberValue
.
GetDouble
();
double
aTmp
=
m_nNumberValue
.
GetDouble
();
...
@@ -1110,12 +1110,14 @@ SwSbxValue SwCalc::Prim()
...
@@ -1110,12 +1110,14 @@ SwSbxValue SwCalc::Prim()
else
else
{
{
nErg
=
m_nNumberValue
;
nErg
=
m_nNumberValue
;
b
ChkPow
=
true
;
r
ChkPow
=
true
;
}
}
return
nErg
;
break
;
break
;
}
}
case
CALC_NAME
:
case
CALC_NAME
:
{
{
SwSbxValue
nErg
;
switch
(
SwCalcOper
eOper
=
GetToken
())
switch
(
SwCalcOper
eOper
=
GetToken
())
{
{
case
CALC_ASSIGN
:
case
CALC_ASSIGN
:
...
@@ -1132,19 +1134,24 @@ SwSbxValue SwCalc::Prim()
...
@@ -1132,19 +1134,24 @@ SwSbxValue SwCalc::Prim()
if
(
nErg
.
IsVoidValue
()
&&
(
eOper
==
CALC_LP
))
if
(
nErg
.
IsVoidValue
()
&&
(
eOper
==
CALC_LP
))
m_eError
=
CALC_SYNTAX
;
m_eError
=
CALC_SYNTAX
;
else
else
b
ChkPow
=
true
;
r
ChkPow
=
true
;
break
;
break
;
}
}
return
nErg
;
break
;
break
;
}
}
case
CALC_MINUS
:
case
CALC_MINUS
:
{
SwSbxValue
nErg
;
GetToken
();
GetToken
();
nErg
.
PutDouble
(
-
(
Prim
().
GetDouble
())
);
nErg
.
PutDouble
(
-
(
Prim
().
GetDouble
())
);
return
nErg
;
break
;
break
;
}
case
CALC_LP
:
case
CALC_LP
:
{
{
GetToken
();
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
if
(
m_eCurrOper
!=
CALC_RP
)
if
(
m_eCurrOper
!=
CALC_RP
)
{
{
m_eError
=
CALC_BRACK
;
m_eError
=
CALC_BRACK
;
...
@@ -1152,46 +1159,64 @@ SwSbxValue SwCalc::Prim()
...
@@ -1152,46 +1159,64 @@ SwSbxValue SwCalc::Prim()
else
else
{
{
GetToken
();
GetToken
();
b
ChkPow
=
true
;
// in order for =(7)^2 to work
r
ChkPow
=
true
;
// in order for =(7)^2 to work
}
}
return
nErg
;
break
;
break
;
}
}
case
CALC_MEAN
:
case
CALC_MEAN
:
{
{
m_nListPor
=
1
;
m_nListPor
=
1
;
GetToken
();
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
double
aTmp
=
nErg
.
GetDouble
();
double
aTmp
=
nErg
.
GetDouble
();
aTmp
/=
m_nListPor
;
aTmp
/=
m_nListPor
;
nErg
.
PutDouble
(
aTmp
);
nErg
.
PutDouble
(
aTmp
);
return
nErg
;
break
;
break
;
}
}
case
CALC_SQRT
:
case
CALC_SQRT
:
{
{
GetToken
();
GetToken
();
nErg
=
Prim
();
SwSbxValue
nErg
=
Prim
();
if
(
nErg
.
GetDouble
()
<
0
)
if
(
nErg
.
GetDouble
()
<
0
)
m_eError
=
CALC_OVERFLOW
;
m_eError
=
CALC_OVERFLOW
;
else
else
nErg
.
PutDouble
(
sqrt
(
nErg
.
GetDouble
()
));
nErg
.
PutDouble
(
sqrt
(
nErg
.
GetDouble
()
));
return
nErg
;
break
;
break
;
}
}
case
CALC_SUM
:
case
CALC_SUM
:
case
CALC_DATE
:
case
CALC_DATE
:
case
CALC_MIN
:
case
CALC_MIN
:
case
CALC_MAX
:
case
CALC_MAX
:
{
GetToken
();
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
return
nErg
;
break
;
break
;
}
case
CALC_ENDCALC
:
case
CALC_ENDCALC
:
{
SwSbxValue
nErg
;
nErg
.
Clear
();
nErg
.
Clear
();
return
nErg
;
break
;
break
;
}
default
:
default
:
m_eError
=
CALC_SYNTAX
;
m_eError
=
CALC_SYNTAX
;
break
;
break
;
}
}
if
(
bChkPow
&&
m_eCurrOper
==
CALC_POW
)
return
SwSbxValue
();
}
SwSbxValue
SwCalc
::
Prim
()
{
bool
bChkPow
;
SwSbxValue
nErg
=
PrimFunc
(
bChkPow
);
if
(
bChkPow
&&
m_eCurrOper
==
CALC_POW
)
{
{
double
dleft
=
nErg
.
GetDouble
();
double
dleft
=
nErg
.
GetDouble
();
GetToken
();
GetToken
();
...
...
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