13#include <com/sun/star/beans/XPropertySet.hpp>
14#include <com/sun/star/sheet/XDatabaseRange.hpp>
15#include <com/sun/star/table/CellRangeAddress.hpp>
16#include <com/sun/star/uno/Reference.hxx>
18#include <cppunit/TestAssert.h>
27 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
29 static constexpr OUStringLiteral propName(
u"MoveCells");
31 bool bMoveCells =
true;
32 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells);
33 CPPUNIT_ASSERT_MESSAGE(
"Default MoveCells already changed", !bMoveCells);
36 aNewMoveCells <<=
true;
37 xDatabaseRange->setPropertyValue(propName, aNewMoveCells);
38 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells);
39 CPPUNIT_ASSERT_MESSAGE(
"Value of MoveCells wasn't changed", bMoveCells);
44 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
46 static constexpr OUStringLiteral propName(
u"KeepFormats");
48 bool bKeepFormats =
true;
49 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats);
50 CPPUNIT_ASSERT_MESSAGE(
"Default KeepFormats already changed", !bKeepFormats);
53 aNewKeepFormats <<=
true;
54 xDatabaseRange->setPropertyValue(propName, aNewKeepFormats);
55 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats);
56 CPPUNIT_ASSERT_MESSAGE(
"Value of KeepFormats wasn't changed", bKeepFormats);
61 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
63 static constexpr OUStringLiteral propName(
u"StripData");
65 bool bStripData =
true;
66 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData);
67 CPPUNIT_ASSERT_MESSAGE(
"Default StripData already changed", !bStripData);
70 aNewStripData <<=
true;
71 xDatabaseRange->setPropertyValue(propName, aNewStripData);
72 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData);
73 CPPUNIT_ASSERT_MESSAGE(
"Value of StripData wasn't changed", bStripData);
78 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
80 static constexpr OUStringLiteral propName(
u"AutoFilter");
82 bool bAutoFilter =
true;
83 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter);
84 CPPUNIT_ASSERT_MESSAGE(
"Default AutoFilter already changed", !bAutoFilter);
87 aNewAutoFilter <<=
true;
88 xDatabaseRange->setPropertyValue(propName, aNewAutoFilter);
89 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter);
90 CPPUNIT_ASSERT_MESSAGE(
"Value of AutoFilter wasn't changed", bAutoFilter);
95 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
97 static constexpr OUStringLiteral propName(
u"UseFilterCriteriaSource");
99 bool bUseFilterCriteriaSource =
true;
100 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource);
101 CPPUNIT_ASSERT_MESSAGE(
"Default UseFilterCriteriaSource already changed",
102 !bUseFilterCriteriaSource);
104 uno::Any aNewUseFilterCriteriaSource;
105 aNewUseFilterCriteriaSource <<=
true;
106 xDatabaseRange->setPropertyValue(propName, aNewUseFilterCriteriaSource);
107 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource);
108 CPPUNIT_ASSERT_MESSAGE(
"Value of UseFilterCriteriaSource wasn't changed",
109 bUseFilterCriteriaSource);
114 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
116 static constexpr OUStringLiteral propName(
u"FilterCriteriaSource");
118 table::CellRangeAddress cellRangeAddress;
119 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress);
120 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Default RefreshPeriod already changed",
121 table::CellRangeAddress(0, 0, 0, 0, 0), cellRangeAddress);
124 aFilterCriteriaSource <<= table::CellRangeAddress(1, 1, 1, 1, 1);
125 xDatabaseRange->setPropertyValue(propName, aFilterCriteriaSource);
126 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress);
127 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Value of FilterCriteriaSource wasn't changed",
128 table::CellRangeAddress(1, 1, 1, 1, 1), cellRangeAddress);
133 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
135 static constexpr OUStringLiteral propName(
u"RefreshPeriod");
137 sal_Int32 aRefreshPeriod = 1;
138 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod);
139 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Default RefreshPeriod already changed", sal_Int32(0),
143 aNewRefreshPeriod <<= static_cast<sal_Int32>(42);
144 xDatabaseRange->setPropertyValue(propName, aNewRefreshPeriod);
145 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod);
146 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Value of RefreshPeriod wasn't changed", sal_Int32(42),
152 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
154 static constexpr OUStringLiteral propName(
u"FromSelection");
156 bool bFromSelection =
true;
157 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection);
158 CPPUNIT_ASSERT_MESSAGE(
"Default FromSelection already changed", !bFromSelection);
161 aNewFromSelection <<=
true;
162 xDatabaseRange->setPropertyValue(propName, aNewFromSelection);
163 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection);
164 CPPUNIT_ASSERT_MESSAGE(
"Value of FromSelection wasn't changed", bFromSelection);
169 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
171 static constexpr OUStringLiteral propName(
u"TokenIndex");
173 sal_Int32 aTokenIndex = 0;
174 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex);
175 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Default TotalIndex already changed", sal_Int32(1), aTokenIndex);
178 aNewTokenIndex <<= static_cast<sal_Int32>(42);
179 xDatabaseRange->setPropertyValue(propName, aNewTokenIndex);
180 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex);
181 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Value of TotalIndex was changed", sal_Int32(1), aTokenIndex);
186 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
188 static constexpr OUStringLiteral propName(
u"TotalsRow");
190 bool bTotalsRow =
true;
191 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow);
192 CPPUNIT_ASSERT_MESSAGE(
"Default TotalsRow already changed", !bTotalsRow);
195 aNewTotalsRow <<=
true;
196 xDatabaseRange->setPropertyValue(propName, aNewTotalsRow);
197 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow);
198 CPPUNIT_ASSERT_MESSAGE(
"Value of TotalsRow wasn't changed", bTotalsRow);
203 uno::Reference<beans::XPropertySet> xDatabaseRange(
init(
"DataArea"), UNO_QUERY_THROW);
205 static constexpr OUStringLiteral propName(
u"ContainsHeader");
207 bool bContainsHeader =
false;
208 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader);
209 CPPUNIT_ASSERT_MESSAGE(
"Default ContainsHeader already changed", bContainsHeader);
212 aNewContainsHeader <<=
false;
213 xDatabaseRange->setPropertyValue(propName, aNewContainsHeader);
214 CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader);
215 CPPUNIT_ASSERT_MESSAGE(
"Value of ContainsHeader wasn't changed", !bContainsHeader);
virtual css::uno::Reference< css::uno::XInterface > init(const OUString &rDBName)=0
void testFilterCriteriaSource()
void testUseFilterCriteriaSource()
void testContainsHeader()