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
cbe46bbe
Kaydet (Commit)
cbe46bbe
authored
Kas 08, 2011
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplified the filter test a bit, and clear the filter afterward.
üst
97453f1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
30 deletions
+41
-30
ucalc.cxx
sc/qa/unit/ucalc.cxx
+38
-26
queryparam.cxx
sc/source/core/tool/queryparam.cxx
+3
-4
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
cbe46bbe
...
...
@@ -45,6 +45,7 @@
#include "undoblk.hxx"
#include "queryentry.hxx"
#include "postit.hxx"
#include "attrib.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
...
...
@@ -2194,53 +2195,64 @@ void Test::testToggleRefFlag()
void
Test
::
testAutofilter
()
{
OUString
aTabName
(
RTL_CONSTASCII_USTRINGPARAM
(
"Test"
));
OUString
aDBName
(
RTL_CONSTASCII_USTRINGPARAM
(
"NONAME"
));
m_pDoc
->
InsertTab
(
0
,
aTabName
);
OUString
aCol1
(
RTL_CONSTASCII_USTRINGPARAM
(
"COL1"
));
OUString
aCol2
(
RTL_CONSTASCII_USTRINGPARAM
(
"COL2"
));
OUString
aDBName
(
RTL_CONSTASCII_USTRINGPARAM
(
"NONAME"
));
// cell contents (0 = empty cell)
const
char
*
aData
[][
3
]
=
{
{
"C1"
,
"C2"
,
"C3"
},
{
"0"
,
"1"
,
"A"
},
{
"1"
,
"2"
,
0
},
{
"1"
,
"2"
,
"B"
},
{
"0"
,
"2"
,
"B"
}
};
//set column headers
m_pDoc
->
SetString
(
0
,
0
,
0
,
aCol1
);
m_pDoc
->
SetString
(
1
,
0
,
0
,
aCol2
);
SCCOL
nCols
=
SAL_N_ELEMENTS
(
aData
[
0
]);
SCROW
nRows
=
SAL_N_ELEMENTS
(
aData
);
//set values
m_pDoc
->
SetValue
(
0
,
1
,
0
,
0
);
m_pDoc
->
SetValue
(
1
,
1
,
0
,
1
);
m_pDoc
->
SetValue
(
0
,
2
,
0
,
1
);
m_pDoc
->
SetValue
(
1
,
2
,
0
,
3
);
m_pDoc
->
SetValue
(
0
,
3
,
0
,
1
);
m_pDoc
->
SetValue
(
1
,
3
,
0
,
2
);
// Populate cells.
for
(
SCROW
i
=
0
;
i
<
nRows
;
++
i
)
for
(
SCCOL
j
=
0
;
j
<
nCols
;
++
j
)
if
(
aData
[
i
][
j
])
m_pDoc
->
SetString
(
j
,
i
,
0
,
rtl
::
OUString
::
createFromAscii
(
aData
[
i
][
j
]));
//create db data and set it to autofilter
ScDBData
*
pDBData
=
new
ScDBData
(
aDBName
,
0
,
0
,
0
,
1
,
3
);
ScDBData
*
pDBData
=
new
ScDBData
(
aDBName
,
0
,
0
,
0
,
nCols
-
1
,
nRows
-
1
);
m_pDoc
->
SetAnonymousDBData
(
0
,
pDBData
);
pDBData
->
SetAutoFilter
(
true
);
ScRange
aRange
;
pDBData
->
GetArea
(
aRange
);
m_pDoc
->
ApplyFlagsTab
(
aRange
.
aStart
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aEnd
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aStart
.
Tab
(),
4
);
aRange
.
aEnd
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aStart
.
Tab
(),
SC_MF_AUTO
);
//create the query param
ScQueryParam
aParam
;
aParam
.
Resize
(
1
);
ScQueryEntry
&
aEntry
=
aParam
.
GetEntry
(
0
);
aEntry
.
bDoQuery
=
true
;
aEntry
.
eOp
=
SC_EQUAL
;
aEntry
.
GetQueryItem
().
mfVal
=
0
;
//add queryParam to autofilter
pDBData
->
GetQueryParam
(
aParam
);
ScQueryEntry
&
rEntry
=
aParam
.
GetEntry
(
0
);
rEntry
.
bDoQuery
=
true
;
rEntry
.
nField
=
0
;
rEntry
.
eOp
=
SC_EQUAL
;
rEntry
.
GetQueryItem
().
mfVal
=
0
;
// add queryParam to database range.
pDBData
->
SetQueryParam
(
aParam
);
//perform the query
ScDBDocFunc
aDBFunc
(
*
m_xDocShRef
);
aDBFunc
.
RepeatDB
(
aCol1
,
true
,
true
,
true
,
0
);
// perform the query.
m_pDoc
->
Query
(
0
,
aParam
,
true
);
//control output
SCROW
nRow1
,
nRow2
;
bool
bHidden
=
m_pDoc
->
RowHidden
(
2
,
0
,
&
nRow1
,
&
nRow2
);
CPPUNIT_ASSERT_MESSAGE
(
"rows 2 & 3 should be hidden"
,
bHidden
&&
nRow1
==
2
&&
nRow2
==
3
);
// Remove filtering.
aParam
.
GetEntry
(
0
).
Clear
();
pDBData
->
SetQueryParam
(
aParam
);
m_pDoc
->
Query
(
0
,
aParam
,
true
);
bHidden
=
m_pDoc
->
RowHidden
(
0
,
0
,
&
nRow1
,
&
nRow2
);
CPPUNIT_ASSERT_MESSAGE
(
"All rows should be shown."
,
!
bHidden
&&
nRow1
==
0
&&
nRow2
==
MAXROW
);
m_pDoc
->
DeleteTab
(
0
);
}
...
...
sc/source/core/tool/queryparam.cxx
Dosyayı görüntüle @
cbe46bbe
...
...
@@ -229,10 +229,9 @@ void ScQueryParam::Clear()
bHasHeader
=
bCaseSens
=
bRegExp
=
bMixedComparison
=
false
;
bInplace
=
bByRow
=
bDuplicate
=
sal_True
;
boost
::
ptr_vector
<
ScQueryEntry
>
aNewEntries
;
for
(
size_t
i
=
0
;
i
<
MAXQUERY
;
++
i
)
aNewEntries
.
push_back
(
new
ScQueryEntry
);
maEntries
.
swap
(
aNewEntries
);
boost
::
ptr_vector
<
ScQueryEntry
>::
iterator
itr
=
maEntries
.
begin
(),
itrEnd
=
maEntries
.
end
();
for
(;
itr
!=
itrEnd
;
++
itr
)
itr
->
Clear
();
ClearDestParams
();
}
...
...
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