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
Show 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
SwCalcOper
GetToken
();
SwSbxValue
Expr
();
SwSbxValue
Term
();
SwSbxValue
PrimFunc
(
bool
&
rChkPow
);
SwSbxValue
Prim
();
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)
return
nErg
;
}
SwSbxValue
SwCalc
::
Prim
(
)
SwSbxValue
SwCalc
::
Prim
Func
(
bool
&
rChkPow
)
{
SwSbxValue
nErg
;
bool
bChkPow
=
false
;
rChkPow
=
false
;
switch
(
m_eCurrOper
)
{
case
CALC_SIN
:
nErg
=
StdFunc
(
&
sin
,
false
);
return
StdFunc
(
&
sin
,
false
);
break
;
case
CALC_COS
:
nErg
=
StdFunc
(
&
cos
,
false
);
return
StdFunc
(
&
cos
,
false
);
break
;
case
CALC_TAN
:
nErg
=
StdFunc
(
&
tan
,
false
);
return
StdFunc
(
&
tan
,
false
);
break
;
case
CALC_ATAN
:
nErg
=
StdFunc
(
&
atan
,
false
);
return
StdFunc
(
&
atan
,
false
);
break
;
case
CALC_ASIN
:
nErg
=
StdFunc
(
&
asin
,
true
);
return
StdFunc
(
&
asin
,
true
);
break
;
case
CALC_ACOS
:
nErg
=
StdFunc
(
&
acos
,
true
);
return
StdFunc
(
&
acos
,
true
);
break
;
case
CALC_NOT
:
{
GetToken
();
nErg
=
Prim
();
SwSbxValue
nErg
=
Prim
();
if
(
SbxSTRING
==
nErg
.
GetType
()
)
{
nErg
.
PutBool
(
nErg
.
GetOUString
().
isEmpty
()
);
...
...
@@ -1092,10 +1090,12 @@ SwSbxValue SwCalc::Prim()
//!! computes a binary NOT
nErg
.
Compute
(
SbxNOT
,
nErg
);
}
return
nErg
;
break
;
}
case
CALC_NUMBER
:
{
SwSbxValue
nErg
;
if
(
GetToken
()
==
CALC_PHD
)
{
double
aTmp
=
m_nNumberValue
.
GetDouble
();
...
...
@@ -1110,12 +1110,14 @@ SwSbxValue SwCalc::Prim()
else
{
nErg
=
m_nNumberValue
;
b
ChkPow
=
true
;
r
ChkPow
=
true
;
}
return
nErg
;
break
;
}
case
CALC_NAME
:
{
SwSbxValue
nErg
;
switch
(
SwCalcOper
eOper
=
GetToken
())
{
case
CALC_ASSIGN
:
...
...
@@ -1132,19 +1134,24 @@ SwSbxValue SwCalc::Prim()
if
(
nErg
.
IsVoidValue
()
&&
(
eOper
==
CALC_LP
))
m_eError
=
CALC_SYNTAX
;
else
b
ChkPow
=
true
;
r
ChkPow
=
true
;
break
;
}
return
nErg
;
break
;
}
case
CALC_MINUS
:
{
SwSbxValue
nErg
;
GetToken
();
nErg
.
PutDouble
(
-
(
Prim
().
GetDouble
())
);
return
nErg
;
break
;
}
case
CALC_LP
:
{
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
if
(
m_eCurrOper
!=
CALC_RP
)
{
m_eError
=
CALC_BRACK
;
...
...
@@ -1152,46 +1159,64 @@ SwSbxValue SwCalc::Prim()
else
{
GetToken
();
b
ChkPow
=
true
;
// in order for =(7)^2 to work
r
ChkPow
=
true
;
// in order for =(7)^2 to work
}
return
nErg
;
break
;
}
case
CALC_MEAN
:
{
m_nListPor
=
1
;
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
double
aTmp
=
nErg
.
GetDouble
();
aTmp
/=
m_nListPor
;
nErg
.
PutDouble
(
aTmp
);
return
nErg
;
break
;
}
case
CALC_SQRT
:
{
GetToken
();
nErg
=
Prim
();
SwSbxValue
nErg
=
Prim
();
if
(
nErg
.
GetDouble
()
<
0
)
m_eError
=
CALC_OVERFLOW
;
else
nErg
.
PutDouble
(
sqrt
(
nErg
.
GetDouble
()
));
return
nErg
;
break
;
}
case
CALC_SUM
:
case
CALC_DATE
:
case
CALC_MIN
:
case
CALC_MAX
:
{
GetToken
();
nErg
=
Expr
();
SwSbxValue
nErg
=
Expr
();
return
nErg
;
break
;
}
case
CALC_ENDCALC
:
{
SwSbxValue
nErg
;
nErg
.
Clear
();
return
nErg
;
break
;
}
default
:
m_eError
=
CALC_SYNTAX
;
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
();
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