12#include <com/sun/star/beans/XPropertySet.hpp>
13#include <com/sun/star/sheet/FilterOperator.hpp>
14#include <com/sun/star/sheet/TableFilterField.hpp>
15#include <com/sun/star/sheet/XSheetFilterable.hpp>
16#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
17#include <com/sun/star/sheet/XSpreadsheet.hpp>
18#include <com/sun/star/table/XColumnRowRange.hpp>
19#include <com/sun/star/table/XTableRows.hpp>
20#include <com/sun/star/uno/Reference.hxx>
21#include <com/sun/star/uno/Sequence.hxx>
23#include <cppunit/TestAssert.h>
26using namespace css::uno;
32 uno::Reference< sheet::XSheetFilterable > xFA(
init(), UNO_QUERY_THROW);
33 uno::Reference< sheet::XSheetFilterDescriptor > xSFD = xFA->createFilterDescriptor(
true);
35 uno::Sequence< sheet::TableFilterField > xTFF{
38 sheet::FilterOperator_GREATER_EQUAL,
44 sheet::FilterOperator_LESS,
50 CPPUNIT_ASSERT_NO_THROW_MESSAGE(
"Unable to create XSheetFilterDescriptor", xSFD->setFilterFields(xTFF));
55 uno::Reference< sheet::XSpreadsheet > xSheet(
getXSpreadsheet(), UNO_QUERY_THROW);
57 uno::Reference< sheet::XSheetFilterable > xFA(xSheet, UNO_QUERY_THROW);
58 uno::Reference< sheet::XSheetFilterDescriptor > xSFD = xFA->createFilterDescriptor(
true);
60 uno::Sequence< sheet::TableFilterField > xTFF{
63 sheet::FilterOperator_GREATER_EQUAL,
69 sheet::FilterOperator_LESS,
74 xSFD->setFilterFields(xTFF);
76 xSheet->getCellByPosition(0, 0)->setValue(1);
77 xSheet->getCellByPosition(0, 1)->setValue(2);
78 xSheet->getCellByPosition(0, 2)->setValue(3);
79 xSheet->getCellByPosition(1, 0)->setFormula(
"A");
80 xSheet->getCellByPosition(1, 1)->setFormula(
"B");
81 xSheet->getCellByPosition(1, 2)->setFormula(
"C");
84 uno::Reference< table::XColumnRowRange > xColRowRange(xSheet, UNO_QUERY_THROW);
85 uno::Reference< table::XTableRows > xTableRows = xColRowRange->getRows();
86 uno::Reference< beans::XPropertySet > xRowProps(xTableRows->getByIndex(0), UNO_QUERY_THROW);
87 bool bIsVisible =
true;
88 CPPUNIT_ASSERT(xRowProps->getPropertyValue(
"IsVisible") >>= bIsVisible);
90 CPPUNIT_ASSERT_MESSAGE(
"Row 1 should be invisible", !bIsVisible);
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet()=0
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testCreateFilterDescriptor()