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
24ddf0d9
Kaydet (Commit)
24ddf0d9
authored
Kas 15, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle named database ranges in CreateString().
Change-Id: I6904b9de0f7d711252797bb2e33ba4c462476b2d
üst
b73b5750
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
3 deletions
+54
-3
tokenstringcontext.hxx
sc/inc/tokenstringcontext.hxx
+1
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+28
-1
token.cxx
sc/source/core/tool/token.cxx
+9
-2
tokenstringcontext.cxx
sc/source/core/tool/tokenstringcontext.cxx
+16
-0
No files found.
sc/inc/tokenstringcontext.hxx
Dosyayı görüntüle @
24ddf0d9
...
...
@@ -35,6 +35,7 @@ struct SC_DLLPUBLIC TokenStringContext
std
::
vector
<
OUString
>
maTabNames
;
IndexNameMapType
maGlobalRangeNames
;
IndexNameMapType
maNamedDBs
;
TokenStringContext
(
const
ScDocument
*
pDoc
,
formula
::
FormulaGrammar
::
Grammar
eGram
);
};
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
24ddf0d9
...
...
@@ -23,6 +23,7 @@
#include "docfunc.hxx"
#include "paramisc.hxx"
#include "tokenstringcontext.hxx"
#include "dbdata.hxx"
#include "formula/vectortoken.hxx"
...
...
@@ -65,6 +66,31 @@ void Test::testFormulaCreateStringFromTokens()
CPPUNIT_ASSERT_MESSAGE
(
"Failed to insert a new name."
,
bInserted
);
}
// Insert DB ranges.
struct
{
const
char
*
pName
;
SCTAB
nTab
;
SCCOL
nCol1
;
SCROW
nRow1
;
SCCOL
nCol2
;
SCROW
nRow2
;
}
aDBs
[]
=
{
{
"Table1"
,
0
,
0
,
0
,
10
,
10
},
{
"Table2"
,
1
,
0
,
0
,
10
,
10
},
{
"Table3"
,
2
,
0
,
0
,
10
,
10
}
};
ScDBCollection
*
pDBs
=
m_pDoc
->
GetDBCollection
();
CPPUNIT_ASSERT_MESSAGE
(
"Failed to fetch DB collection object."
,
pDBs
);
for
(
size_t
i
=
0
,
n
=
SAL_N_ELEMENTS
(
aDBs
);
i
<
n
;
++
i
)
{
ScDBData
*
pData
=
new
ScDBData
(
OUString
::
createFromAscii
(
aDBs
[
i
].
pName
),
aDBs
[
i
].
nTab
,
aDBs
[
i
].
nCol1
,
aDBs
[
i
].
nRow1
,
aDBs
[
i
].
nCol2
,
aDBs
[
i
].
nRow2
);
pDBs
->
getNamedDBs
().
insert
(
pData
);
}
const
char
*
aTests
[]
=
{
"1+2"
,
"SUM(A1:A10;B1:B10;C5;D6)"
,
...
...
@@ -72,7 +98,8 @@ void Test::testFormulaCreateStringFromTokens()
"AVERAGE('2013'.B10:C20)"
,
"'Kevin''s Data'.B10"
,
"'Past Data'.B1+'2013'.B2*(1+'Kevin''s Data'.C10)"
,
"x+y*z"
"x+y*z"
,
// named ranges
"MAX(Table1)+MIN(Table2)*SUM(Table3)"
// database ranges
};
boost
::
scoped_ptr
<
ScTokenArray
>
pArray
;
...
...
sc/source/core/tool/token.cxx
Dosyayı görüntüle @
24ddf0d9
...
...
@@ -40,6 +40,7 @@
#include "refupdatecontext.hxx"
#include "tokenstringcontext.hxx"
#include "types.hxx"
#include "globstr.hrc"
#include "svl/sharedstring.hxx"
using
::
std
::
vector
;
...
...
@@ -3273,9 +3274,15 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
rBuf
.
append
(
it
->
second
);
}
break
;
// TODO : Handle other name types.
case
ocDBArea
:
{
sc
::
TokenStringContext
::
IndexNameMapType
::
const_iterator
it
=
rCxt
.
maNamedDBs
.
find
(
nIndex
);
if
(
it
!=
rCxt
.
maNamedDBs
.
end
())
rBuf
.
append
(
it
->
second
);
}
break
;
default
:
;
rBuf
.
append
(
ScGlobal
::
GetRscString
(
STR_NO_NAME_REF
))
;
}
}
break
;
...
...
sc/source/core/tool/tokenstringcontext.cxx
Dosyayı görüntüle @
24ddf0d9
...
...
@@ -10,6 +10,7 @@
#include "tokenstringcontext.hxx"
#include "compiler.hxx"
#include "document.hxx"
#include "dbdata.hxx"
using
namespace
com
::
sun
::
star
;
...
...
@@ -26,6 +27,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
if
(
pDoc
)
{
// Fetch all sheet names.
maTabNames
=
pDoc
->
GetAllTableNames
();
{
std
::
vector
<
OUString
>::
iterator
it
=
maTabNames
.
begin
(),
itEnd
=
maTabNames
.
end
();
...
...
@@ -33,6 +35,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
ScCompiler
::
CheckTabQuotes
(
*
it
,
formula
::
FormulaGrammar
::
extractRefConvention
(
eGram
));
}
// Fetch all named range names.
const
ScRangeName
*
pNames
=
pDoc
->
GetRangeName
();
if
(
pNames
)
{
...
...
@@ -43,6 +46,19 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
maGlobalRangeNames
.
insert
(
IndexNameMapType
::
value_type
(
pData
->
GetIndex
(),
pData
->
GetName
()));
}
}
// Fetch all named database ranges names.
const
ScDBCollection
*
pDBs
=
pDoc
->
GetDBCollection
();
if
(
pDBs
)
{
const
ScDBCollection
::
NamedDBs
&
rNamedDBs
=
pDBs
->
getNamedDBs
();
ScDBCollection
::
NamedDBs
::
const_iterator
it
=
rNamedDBs
.
begin
(),
itEnd
=
rNamedDBs
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
const
ScDBData
&
rData
=
*
it
;
maNamedDBs
.
insert
(
IndexNameMapType
::
value_type
(
rData
.
GetIndex
(),
rData
.
GetName
()));
}
}
}
}
...
...
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