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
35c6bd77
Kaydet (Commit)
35c6bd77
authored
Kas 23, 2012
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
String to OUString in conditio.[ch]xx
Change-Id: Iea2da3947a76e45fb323abed3b9a14ccc3fdfbdc
üst
f8eed7ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
48 deletions
+52
-48
conditio.hxx
sc/inc/conditio.hxx
+16
-16
conditio.cxx
sc/source/core/data/conditio.cxx
+36
-32
No files found.
sc/inc/conditio.hxx
Dosyayı görüntüle @
35c6bd77
...
...
@@ -161,10 +161,10 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
sal_uInt16
nOptions
;
double
nVal1
;
// input or calculated
double
nVal2
;
String
aStrVal1
;
// input or calculated
String
aStrVal2
;
String
aStrNmsp1
;
// namespace to be used on (re)compilation, e.g. in XML import
String
aStrNmsp2
;
// namespace to be used on (re)compilation, e.g. in XML import
rtl
::
OU
String
aStrVal1
;
// input or calculated
rtl
::
OU
String
aStrVal2
;
rtl
::
OU
String
aStrNmsp1
;
// namespace to be used on (re)compilation, e.g. in XML import
rtl
::
OU
String
aStrNmsp2
;
// namespace to be used on (re)compilation, e.g. in XML import
formula
::
FormulaGrammar
::
Grammar
eTempGrammar1
;
// grammar to be used on (re)compilation, e.g. in XML import
formula
::
FormulaGrammar
::
Grammar
eTempGrammar2
;
// grammar to be used on (re)compilation, e.g. in XML import
bool
bIsStr1
;
// for recognition of empty strings
...
...
@@ -173,7 +173,7 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
ScTokenArray
*
pFormula2
;
ScAddress
aSrcPos
;
// source position for formulas
// temporary data:
String
aSrcString
;
// formula source position as text during XML import
rtl
::
OU
String
aSrcString
;
// formula source position as text during XML import
ScFormulaCell
*
pFCell1
;
ScFormulaCell
*
pFCell2
;
bool
bRelRef1
;
...
...
@@ -181,8 +181,8 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
bool
bFirstRun
;
void
MakeCells
(
const
ScAddress
&
rPos
);
void
Compile
(
const
String
&
rExpr1
,
const
String
&
rExpr2
,
const
String
&
rExprNmsp1
,
const
String
&
rExprNmsp2
,
void
Compile
(
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
const
rtl
::
OUString
&
rExprNmsp1
,
const
rtl
::
OU
String
&
rExprNmsp2
,
formula
::
FormulaGrammar
::
Grammar
eGrammar1
,
formula
::
FormulaGrammar
::
Grammar
eGrammar2
,
bool
bTextToReal
);
...
...
@@ -193,9 +193,9 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
public
:
ScConditionEntry
(
ScConditionMode
eOper
,
const
String
&
rExpr1
,
const
String
&
rExpr2
,
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rExprNmsp1
,
const
String
&
rExprNmsp2
,
const
rtl
::
OUString
&
rExprNmsp1
,
const
rtl
::
OU
String
&
rExprNmsp2
,
formula
::
FormulaGrammar
::
Grammar
eGrammar1
,
formula
::
FormulaGrammar
::
Grammar
eGrammar2
);
ScConditionEntry
(
ScConditionMode
eOper
,
...
...
@@ -219,12 +219,12 @@ public:
ScAddress
GetValidSrcPos
()
const
;
// adjusted to allow textual representation of expressions
void
SetSrcString
(
const
String
&
rNew
);
// for XML import
void
SetSrcString
(
const
rtl
::
OU
String
&
rNew
);
// for XML import
void
SetFormula1
(
const
ScTokenArray
&
rArray
);
void
SetFormula2
(
const
ScTokenArray
&
rArray
);
String
GetExpression
(
const
ScAddress
&
rCursor
,
sal_uInt16
nPos
,
sal_uLong
nNumFmt
=
0
,
rtl
::
OU
String
GetExpression
(
const
ScAddress
&
rCursor
,
sal_uInt16
nPos
,
sal_uLong
nNumFmt
=
0
,
const
formula
::
FormulaGrammar
::
Grammar
eGrammar
=
formula
::
FormulaGrammar
::
GRAM_DEFAULT
)
const
;
ScTokenArray
*
CreateTokenArry
(
sal_uInt16
nPos
)
const
;
...
...
@@ -300,17 +300,17 @@ class SC_DLLPUBLIC ScCondFormatEntry : public ScConditionEntry
public
:
ScCondFormatEntry
(
ScConditionMode
eOper
,
const
String
&
rExpr1
,
const
String
&
rExpr2
,
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rStyle
,
const
String
&
rExprNmsp1
=
EMPTY_STRING
,
const
String
&
rExprNmsp2
=
EMPTY_STRING
,
const
rtl
::
OU
String
&
rStyle
,
const
rtl
::
OU
String
&
rExprNmsp1
=
EMPTY_STRING
,
const
rtl
::
OU
String
&
rExprNmsp2
=
EMPTY_STRING
,
formula
::
FormulaGrammar
::
Grammar
eGrammar1
=
formula
::
FormulaGrammar
::
GRAM_DEFAULT
,
formula
::
FormulaGrammar
::
Grammar
eGrammar2
=
formula
::
FormulaGrammar
::
GRAM_DEFAULT
);
ScCondFormatEntry
(
ScConditionMode
eOper
,
const
ScTokenArray
*
pArr1
,
const
ScTokenArray
*
pArr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rStyle
);
const
rtl
::
OU
String
&
rStyle
);
ScCondFormatEntry
(
const
ScCondFormatEntry
&
r
);
ScCondFormatEntry
(
ScDocument
*
pDocument
,
const
ScCondFormatEntry
&
r
);
virtual
~
ScCondFormatEntry
();
...
...
sc/source/core/data/conditio.cxx
Dosyayı görüntüle @
35c6bd77
...
...
@@ -216,12 +216,12 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
}
ScConditionEntry
::
ScConditionEntry
(
ScConditionMode
eOper
,
const
String
&
rExpr1
,
const
String
&
rExpr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rExprNmsp1
,
const
String
&
rExprNmsp2
,
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
rtl
::
OUString
&
rExprNmsp1
,
const
rtl
::
OU
String
&
rExprNmsp2
,
FormulaGrammar
::
Grammar
eGrammar1
,
FormulaGrammar
::
Grammar
eGrammar2
)
:
ScFormatEntry
(
pDocument
),
eOp
(
eOper
),
nOptions
(
0
),
// spaeter...
nOptions
(
0
),
nVal1
(
0.0
),
nVal2
(
0.0
),
aStrNmsp1
(
rExprNmsp1
),
...
...
@@ -250,7 +250,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
)
:
ScFormatEntry
(
pDocument
),
eOp
(
eOper
),
nOptions
(
0
),
// spaeter...
nOptions
(
0
),
nVal1
(
0.0
),
nVal2
(
0.0
),
eTempGrammar1
(
FormulaGrammar
::
GRAM_DEFAULT
),
...
...
@@ -328,15 +328,15 @@ ScConditionEntry::~ScConditionEntry()
delete
pFormula2
;
}
void
ScConditionEntry
::
Compile
(
const
String
&
rExpr1
,
const
String
&
rExpr2
,
const
String
&
rExprNmsp1
,
const
String
&
rExprNmsp2
,
void
ScConditionEntry
::
Compile
(
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
const
rtl
::
OUString
&
rExprNmsp1
,
const
rtl
::
OU
String
&
rExprNmsp2
,
FormulaGrammar
::
Grammar
eGrammar1
,
FormulaGrammar
::
Grammar
eGrammar2
,
bool
bTextToReal
)
{
if
(
rExpr1
.
Len
()
||
rExpr2
.
Len
()
)
if
(
!
rExpr1
.
isEmpty
()
||
!
rExpr2
.
isEmpty
()
)
{
ScCompiler
aComp
(
mpDoc
,
aSrcPos
);
if
(
rExpr1
.
Len
()
)
if
(
!
rExpr1
.
isEmpty
()
)
{
aComp
.
SetGrammar
(
eGrammar1
);
if
(
mpDoc
->
IsImportingXML
()
&&
!
bTextToReal
)
...
...
@@ -373,7 +373,7 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
}
}
if
(
rExpr2
.
Len
()
)
if
(
!
rExpr2
.
isEmpty
()
)
{
aComp
.
SetGrammar
(
eGrammar2
);
if
(
mpDoc
->
IsImportingXML
()
&&
!
bTextToReal
)
...
...
@@ -453,7 +453,7 @@ void ScConditionEntry::CompileXML()
{
// First parse the formula source position if it was stored as text
if
(
aSrcString
.
Len
()
)
if
(
!
aSrcString
.
isEmpty
()
)
{
ScAddress
aNew
;
/* XML is always in OOo:A1 format, although R1C1 would be more amenable
...
...
@@ -461,7 +461,7 @@ void ScConditionEntry::CompileXML()
if
(
aNew
.
Parse
(
aSrcString
,
mpDoc
)
&
SCA_VALID
)
aSrcPos
=
aNew
;
// if the position is invalid, there isn't much we can do at this time
aSrcString
.
Erase
();
aSrcString
=
rtl
::
OUString
();
}
// Convert the text tokens that were created during XML import into real tokens.
...
...
@@ -471,7 +471,7 @@ void ScConditionEntry::CompileXML()
aStrNmsp1
,
aStrNmsp2
,
eTempGrammar1
,
eTempGrammar2
,
true
);
}
void
ScConditionEntry
::
SetSrcString
(
const
String
&
rNew
)
void
ScConditionEntry
::
SetSrcString
(
const
rtl
::
OU
String
&
rNew
)
{
// aSrcString is only evaluated in CompileXML
OSL_ENSURE
(
mpDoc
->
IsImportingXML
(),
"SetSrcString is only valid for XML import"
);
...
...
@@ -671,7 +671,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
{
bIsStr1
=
false
;
nVal1
=
pEff1
->
GetValue
();
aStrVal1
.
Erase
();
aStrVal1
=
rtl
::
OUString
();
}
else
{
...
...
@@ -700,7 +700,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
{
bIsStr2
=
false
;
nVal2
=
pEff2
->
GetValue
();
aStrVal2
.
Erase
();
aStrVal2
=
rtl
::
OUString
();
}
else
{
...
...
@@ -1098,7 +1098,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const
bValid
=
!
bValid
;
break
;
case
SC_COND_BEGINS_WITH
:
if
(
!
aStrVal1
.
Len
())
if
(
aStrVal1
.
isEmpty
())
{
rtl
::
OUString
aStr
=
rtl
::
OUString
::
valueOf
(
nVal1
);
rtl
::
OUString
aStr2
=
rtl
::
OUString
::
valueOf
(
nArg
);
...
...
@@ -1110,7 +1110,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const
bValid
=
aStr2
.
indexOf
(
aStrVal1
)
==
0
;
}
case
SC_COND_ENDS_WITH
:
if
(
!
aStrVal1
.
Len
())
if
(
aStrVal1
.
isEmpty
())
{
rtl
::
OUString
aStr
=
rtl
::
OUString
::
valueOf
(
nVal1
);
rtl
::
OUString
aStr2
=
rtl
::
OUString
::
valueOf
(
nArg
);
...
...
@@ -1123,7 +1123,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const
}
case
SC_COND_CONTAINS_TEXT
:
case
SC_COND_NOT_CONTAINS_TEXT
:
if
(
!
aStrVal1
.
Len
())
if
(
aStrVal1
.
isEmpty
())
{
rtl
::
OUString
aStr
=
rtl
::
OUString
::
valueOf
(
nVal1
);
rtl
::
OUString
aStr2
=
rtl
::
OUString
::
valueOf
(
nArg
);
...
...
@@ -1180,7 +1180,7 @@ bool ScConditionEntry::IsValidStr( const rtl::OUString& rArg, const ScAddress& r
==
COMPARE_GREATER
)
{
// richtige Reihenfolge fuer Wertebereich
String
aTemp
(
aUpVal1
);
aUpVal1
=
aUpVal2
;
aUpVal2
=
aTemp
;
rtl
::
OU
String
aTemp
(
aUpVal1
);
aUpVal1
=
aUpVal2
;
aUpVal2
=
aTemp
;
}
switch
(
eOp
)
...
...
@@ -1269,11 +1269,11 @@ bool ScConditionEntry::IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) c
return
IsValidStr
(
aArgStr
,
rPos
);
}
String
ScConditionEntry
::
GetExpression
(
const
ScAddress
&
rCursor
,
sal_uInt16
nIndex
,
rtl
::
OU
String
ScConditionEntry
::
GetExpression
(
const
ScAddress
&
rCursor
,
sal_uInt16
nIndex
,
sal_uLong
nNumFmt
,
const
FormulaGrammar
::
Grammar
eGrammar
)
const
{
String
aRet
;
rtl
::
OU
String
aRet
;
if
(
FormulaGrammar
::
isEnglish
(
eGrammar
)
&&
nNumFmt
==
0
)
nNumFmt
=
mpDoc
->
GetFormatTable
()
->
GetStandardIndex
(
LANGUAGE_ENGLISH_US
);
...
...
@@ -1284,13 +1284,15 @@ String ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 nIn
{
ScCompiler
aComp
(
mpDoc
,
rCursor
,
*
pFormula1
);
aComp
.
SetGrammar
(
eGrammar
);
aComp
.
CreateStringFromTokenArray
(
aRet
);
rtl
::
OUStringBuffer
aBuffer
;
aComp
.
CreateStringFromTokenArray
(
aBuffer
);
aRet
=
aBuffer
.
makeStringAndClear
();
}
else
if
(
bIsStr1
)
{
aRet
=
'"'
;
aRet
=
""""
;
aRet
+=
aStrVal1
;
aRet
+=
'"'
;
aRet
+=
""""
;
}
else
mpDoc
->
GetFormatTable
()
->
GetInputLineString
(
nVal1
,
nNumFmt
,
aRet
);
...
...
@@ -1301,13 +1303,15 @@ String ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 nIn
{
ScCompiler
aComp
(
mpDoc
,
rCursor
,
*
pFormula2
);
aComp
.
SetGrammar
(
eGrammar
);
aComp
.
CreateStringFromTokenArray
(
aRet
);
rtl
::
OUStringBuffer
aBuffer
;
aComp
.
CreateStringFromTokenArray
(
aBuffer
);
aRet
=
aBuffer
.
makeStringAndClear
();
}
else
if
(
bIsStr2
)
{
aRet
=
'"'
;
aRet
=
""""
;
aRet
+=
aStrVal2
;
aRet
+=
'"'
;
aRet
+=
""""
;
}
else
mpDoc
->
GetFormatTable
()
->
GetInputLineString
(
nVal2
,
nNumFmt
,
aRet
);
...
...
@@ -1333,7 +1337,7 @@ ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const
{
pRet
=
new
ScTokenArray
();
if
(
bIsStr1
)
pRet
->
AddString
(
aStrVal1
.
GetBuffer
()
);
pRet
->
AddString
(
aStrVal1
);
else
pRet
->
AddDouble
(
nVal1
);
}
...
...
@@ -1346,7 +1350,7 @@ ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const
{
pRet
=
new
ScTokenArray
();
if
(
bIsStr2
)
pRet
->
AddString
(
aStrVal2
.
GetBuffer
()
);
pRet
->
AddString
(
aStrVal2
);
else
pRet
->
AddDouble
(
nVal2
);
}
...
...
@@ -1573,10 +1577,10 @@ void ScConditionEntry::endRendering()
//------------------------------------------------------------------------
ScCondFormatEntry
::
ScCondFormatEntry
(
ScConditionMode
eOper
,
const
String
&
rExpr1
,
const
String
&
rExpr2
,
const
rtl
::
OUString
&
rExpr1
,
const
rtl
::
OU
String
&
rExpr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rStyle
,
const
String
&
rExprNmsp1
,
const
String
&
rExprNmsp2
,
const
rtl
::
OU
String
&
rStyle
,
const
rtl
::
OUString
&
rExprNmsp1
,
const
rtl
::
OU
String
&
rExprNmsp2
,
FormulaGrammar
::
Grammar
eGrammar1
,
FormulaGrammar
::
Grammar
eGrammar2
)
:
ScConditionEntry
(
eOper
,
rExpr1
,
rExpr2
,
pDocument
,
rPos
,
rExprNmsp1
,
rExprNmsp2
,
eGrammar1
,
eGrammar2
),
...
...
@@ -1587,7 +1591,7 @@ ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
ScCondFormatEntry
::
ScCondFormatEntry
(
ScConditionMode
eOper
,
const
ScTokenArray
*
pArr1
,
const
ScTokenArray
*
pArr2
,
ScDocument
*
pDocument
,
const
ScAddress
&
rPos
,
const
String
&
rStyle
)
:
const
rtl
::
OU
String
&
rStyle
)
:
ScConditionEntry
(
eOper
,
pArr1
,
pArr2
,
pDocument
,
rPos
),
aStyleName
(
rStyle
)
{
...
...
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