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 @@
...
@@ -45,6 +45,7 @@
#include "undoblk.hxx"
#include "undoblk.hxx"
#include "queryentry.hxx"
#include "queryentry.hxx"
#include "postit.hxx"
#include "postit.hxx"
#include "attrib.hxx"
#include "docsh.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "docfunc.hxx"
...
@@ -2194,53 +2195,64 @@ void Test::testToggleRefFlag()
...
@@ -2194,53 +2195,64 @@ void Test::testToggleRefFlag()
void
Test
::
testAutofilter
()
void
Test
::
testAutofilter
()
{
{
OUString
aTabName
(
RTL_CONSTASCII_USTRINGPARAM
(
"Test"
));
OUString
aTabName
(
RTL_CONSTASCII_USTRINGPARAM
(
"Test"
));
OUString
aDBName
(
RTL_CONSTASCII_USTRINGPARAM
(
"NONAME"
));
m_pDoc
->
InsertTab
(
0
,
aTabName
);
m_pDoc
->
InsertTab
(
0
,
aTabName
);
OUString
aCol1
(
RTL_CONSTASCII_USTRINGPARAM
(
"COL1"
));
// cell contents (0 = empty cell)
OUString
aCol2
(
RTL_CONSTASCII_USTRINGPARAM
(
"COL2"
));
const
char
*
aData
[][
3
]
=
{
OUString
aDBName
(
RTL_CONSTASCII_USTRINGPARAM
(
"NONAME"
));
{
"C1"
,
"C2"
,
"C3"
},
{
"0"
,
"1"
,
"A"
},
{
"1"
,
"2"
,
0
},
{
"1"
,
"2"
,
"B"
},
{
"0"
,
"2"
,
"B"
}
};
//set column headers
SCCOL
nCols
=
SAL_N_ELEMENTS
(
aData
[
0
]);
m_pDoc
->
SetString
(
0
,
0
,
0
,
aCol1
);
SCROW
nRows
=
SAL_N_ELEMENTS
(
aData
);
m_pDoc
->
SetString
(
1
,
0
,
0
,
aCol2
);
//set values
// Populate cells.
m_pDoc
->
SetValue
(
0
,
1
,
0
,
0
);
for
(
SCROW
i
=
0
;
i
<
nRows
;
++
i
)
m_pDoc
->
SetValue
(
1
,
1
,
0
,
1
);
for
(
SCCOL
j
=
0
;
j
<
nCols
;
++
j
)
m_pDoc
->
SetValue
(
0
,
2
,
0
,
1
);
if
(
aData
[
i
][
j
])
m_pDoc
->
SetValue
(
1
,
2
,
0
,
3
);
m_pDoc
->
SetString
(
j
,
i
,
0
,
rtl
::
OUString
::
createFromAscii
(
aData
[
i
][
j
]));
m_pDoc
->
SetValue
(
0
,
3
,
0
,
1
);
m_pDoc
->
SetValue
(
1
,
3
,
0
,
2
);
//create db data and set it to autofilter
ScDBData
*
pDBData
=
new
ScDBData
(
aDBName
,
0
,
0
,
0
,
nCols
-
1
,
nRows
-
1
);
ScDBData
*
pDBData
=
new
ScDBData
(
aDBName
,
0
,
0
,
0
,
1
,
3
);
m_pDoc
->
SetAnonymousDBData
(
0
,
pDBData
);
m_pDoc
->
SetAnonymousDBData
(
0
,
pDBData
);
pDBData
->
SetAutoFilter
(
true
);
pDBData
->
SetAutoFilter
(
true
);
ScRange
aRange
;
ScRange
aRange
;
pDBData
->
GetArea
(
aRange
);
pDBData
->
GetArea
(
aRange
);
m_pDoc
->
ApplyFlagsTab
(
aRange
.
aStart
.
Col
(),
aRange
.
aStart
.
Row
(),
m_pDoc
->
ApplyFlagsTab
(
aRange
.
aStart
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aEnd
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aEnd
.
Col
(),
aRange
.
aStart
.
Row
(),
aRange
.
aStart
.
Tab
(),
4
);
aRange
.
aStart
.
Tab
(),
SC_MF_AUTO
);
//create the query param
//create the query param
ScQueryParam
aParam
;
ScQueryParam
aParam
;
aParam
.
Resize
(
1
);
pDBData
->
GetQueryParam
(
aParam
);
ScQueryEntry
&
aEntry
=
aParam
.
GetEntry
(
0
);
ScQueryEntry
&
rEntry
=
aParam
.
GetEntry
(
0
);
aEntry
.
bDoQuery
=
true
;
rEntry
.
bDoQuery
=
true
;
aEntry
.
eOp
=
SC_EQUAL
;
rEntry
.
nField
=
0
;
aEntry
.
GetQueryItem
().
mfVal
=
0
;
rEntry
.
eOp
=
SC_EQUAL
;
//add queryParam to autofilter
rEntry
.
GetQueryItem
().
mfVal
=
0
;
// add queryParam to database range.
pDBData
->
SetQueryParam
(
aParam
);
pDBData
->
SetQueryParam
(
aParam
);
//perform the query
ScDBDocFunc
aDBFunc
(
*
m_xDocShRef
);
// perform the query.
aDBFunc
.
RepeatDB
(
aCol1
,
true
,
true
,
true
,
0
);
m_pDoc
->
Query
(
0
,
aParam
,
true
);
//control output
//control output
SCROW
nRow1
,
nRow2
;
SCROW
nRow1
,
nRow2
;
bool
bHidden
=
m_pDoc
->
RowHidden
(
2
,
0
,
&
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
);
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
);
m_pDoc
->
DeleteTab
(
0
);
}
}
...
...
sc/source/core/tool/queryparam.cxx
Dosyayı görüntüle @
cbe46bbe
...
@@ -229,10 +229,9 @@ void ScQueryParam::Clear()
...
@@ -229,10 +229,9 @@ void ScQueryParam::Clear()
bHasHeader
=
bCaseSens
=
bRegExp
=
bMixedComparison
=
false
;
bHasHeader
=
bCaseSens
=
bRegExp
=
bMixedComparison
=
false
;
bInplace
=
bByRow
=
bDuplicate
=
sal_True
;
bInplace
=
bByRow
=
bDuplicate
=
sal_True
;
boost
::
ptr_vector
<
ScQueryEntry
>
aNewEntries
;
boost
::
ptr_vector
<
ScQueryEntry
>::
iterator
itr
=
maEntries
.
begin
(),
itrEnd
=
maEntries
.
end
();
for
(
size_t
i
=
0
;
i
<
MAXQUERY
;
++
i
)
for
(;
itr
!=
itrEnd
;
++
itr
)
aNewEntries
.
push_back
(
new
ScQueryEntry
);
itr
->
Clear
();
maEntries
.
swap
(
aNewEntries
);
ClearDestParams
();
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