13#include <com/sun/star/awt/XDevice.hpp>
14#include <com/sun/star/beans/XPropertySet.hpp>
15#include <com/sun/star/lang/Locale.hpp>
16#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
17#include <com/sun/star/util/Date.hpp>
18#include <com/sun/star/uno/Any.hxx>
19#include <com/sun/star/uno/Reference.hxx>
21#include <cppunit/TestAssert.h>
30 uno::Reference<beans::XPropertySet> xSpreadsheetDocumentSettings(
init(), UNO_QUERY_THROW);
34 propName =
"IsIterationEnabled";
37 propName =
"IterationCount";
40 propName =
"IterationEpsilon";
43 propName =
"StandardDecimals";
46 propName =
"NullDate";
47 util::Date aNullDateGet;
48 util::Date aNullDateSet;
49 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: NullDate",
50 xSpreadsheetDocumentSettings->getPropertyValue(propName)
53 aNewValue <<= util::Date(1, 1, 2000);
54 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
55 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= aNullDateSet);
56 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: NullDate", sal_Int16(2000),
59 propName =
"DefaultTabStop";
62 propName =
"IgnoreCase";
65 propName =
"CalcAsShown";
68 propName =
"MatchWholeCell";
71 propName =
"SpellOnline";
74 propName =
"LookUpLabels";
77 propName =
"RegularExpressions";
80 propName =
"ForbiddenCharacters";
81 uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersGet;
82 uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersSet;
83 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: ForbiddenCharacters",
84 xSpreadsheetDocumentSettings->getPropertyValue(propName)
85 >>= xForbiddenCharactersGet);
87 lang::Locale aForbiddenCharactersLocale;
88 aForbiddenCharactersLocale.Language =
"ru";
89 aForbiddenCharactersLocale.Country =
"RU";
91 uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersNew;
92 aNewValue <<= xForbiddenCharactersNew;
93 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
94 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName)
95 >>= xForbiddenCharactersSet);
96 CPPUNIT_ASSERT_EQUAL_MESSAGE(
97 "Able to set PropertyValue: ForbiddenCharacters",
98 xForbiddenCharactersGet->hasForbiddenCharacters(aForbiddenCharactersLocale),
99 xForbiddenCharactersSet->hasForbiddenCharacters(aForbiddenCharactersLocale));
101 propName =
"HasDrawPages";
104 propName =
"CharLocale";
105 lang::Locale aCharLocaleGet;
106 lang::Locale aCharLocaleSet;
107 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: CharLocale",
108 xSpreadsheetDocumentSettings->getPropertyValue(propName)
111 lang::Locale aCharLocaleNew;
112 aCharLocaleNew.Language =
"en";
113 aCharLocaleNew.Country =
"CA";
114 aNewValue <<= aCharLocaleNew;
115 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
116 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= aCharLocaleSet);
117 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: CharLocale", aCharLocaleNew.Country,
118 aCharLocaleSet.Country);
120 propName =
"CharLocaleAsian";
121 lang::Locale aCharLocaleAsianGet;
122 lang::Locale aCharLocaleAsianSet;
123 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: CharLocaleAsian",
124 xSpreadsheetDocumentSettings->getPropertyValue(propName)
125 >>= aCharLocaleAsianGet);
127 lang::Locale aCharLocaleAsianNew;
128 aCharLocaleAsianNew.Language =
"en";
129 aCharLocaleAsianNew.Country =
"CA";
130 aNewValue <<= aCharLocaleAsianNew;
131 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
132 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName)
133 >>= aCharLocaleAsianSet);
134 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: CharLocaleAsian",
135 aCharLocaleAsianNew.Country, aCharLocaleAsianSet.Country);
137 propName =
"CharLocaleComplex";
138 lang::Locale aCharLocaleComplexGet;
139 lang::Locale aCharLocaleComplexSet;
140 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: CharLocaleComplex",
141 xSpreadsheetDocumentSettings->getPropertyValue(propName)
142 >>= aCharLocaleComplexGet);
144 lang::Locale aCharLocaleComplexNew;
145 aCharLocaleComplexNew.Language =
"en";
146 aCharLocaleComplexNew.Country =
"CA";
147 aNewValue <<= aCharLocaleComplexNew;
148 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
149 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName)
150 >>= aCharLocaleComplexSet);
151 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: CharLocaleComplex",
152 aCharLocaleComplexNew.Country, aCharLocaleComplexSet.Country);
154 propName =
"IsLoaded";
157 propName =
"IsUndoEnabled";
160 propName =
"IsAdjustHeightEnabled";
163 propName =
"IsExecuteLinkEnabled";
166 propName =
"ReferenceDevice";
167 uno::Reference<awt::XDevice> xDeviceGet;
168 uno::Reference<awt::XDevice> xDeviceSet;
169 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: ReferenceDevice",
170 xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= xDeviceGet);
172 uno::Reference<awt::XDevice> xDeviceNew;
173 aNewValue <<= xDeviceNew;
174 xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue);
175 CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= xDeviceSet);
176 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Able to set PropertyValue: ReferenceDevice",
177 xDeviceSet->getInfo().Width, xDeviceGet->getInfo().Width);
179 propName =
"RecordChanges";
182 propName =
"IsRecordChangesProtected";
185 propName =
"Wildcards";
void testSpreadsheetDocumentSettingsProperties()
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testLongProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const sal_Int32 &nValue)
void testShortProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const sal_Int16 &nValue)
void testBooleanProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name)
void testDoubleProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const double &dValue)
void testBooleanReadonlyProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name)