12#include <com/sun/star/beans/XPropertySet.hpp>
13#include <com/sun/star/util/Color.hpp>
14#include <com/sun/star/uno/Any.hxx>
15#include <com/sun/star/uno/Reference.hxx>
17#include <cppunit/TestAssert.h>
26 uno::Reference<beans::XPropertySet> xSpreadsheetViewSettings(
init(), UNO_QUERY_THROW);
30 propName =
"ShowFormulas";
31 bool aShowFormulas =
true;
32 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowFormulas);
33 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowFormulas", !aShowFormulas);
36 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
37 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowFormulas);
38 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowFormulas", aShowFormulas);
40 propName =
"ShowZeroValues";
41 bool aShowZeroValues =
false;
42 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowZeroValues);
43 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowZeroValues", aShowZeroValues);
46 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
47 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowZeroValues);
48 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowZeroValues", !aShowZeroValues);
50 propName =
"IsValueHighlightingEnabled";
51 bool aIsValueHighlightingEnabled =
true;
52 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName)
53 >>= aIsValueHighlightingEnabled);
54 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue IsValueHighlightingEnabled",
55 !aIsValueHighlightingEnabled);
58 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
59 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName)
60 >>= aIsValueHighlightingEnabled);
61 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue IsValueHighlightingEnabled",
62 aIsValueHighlightingEnabled);
64 propName =
"ShowNotes";
65 bool aShowNotes =
false;
66 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowNotes);
67 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowNotes", aShowNotes);
70 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
71 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowNotes);
72 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowNotes", !aShowNotes);
74 propName =
"HasVerticalScrollBar";
75 bool aHasVerticalScrollBar =
false;
76 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasVerticalScrollBar);
77 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue HasVerticalScrollBar",
78 aHasVerticalScrollBar);
81 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
82 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasVerticalScrollBar);
83 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue HasVerticalScrollBar",
84 !aHasVerticalScrollBar);
86 propName =
"HasHorizontalScrollBar";
87 bool aHasHorizontalScrollBar =
false;
88 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName)
89 >>= aHasHorizontalScrollBar);
90 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue HasHorizontalScrollBar",
91 aHasHorizontalScrollBar);
94 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
95 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName)
96 >>= aHasHorizontalScrollBar);
97 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue HasHorizontalScrollBar",
98 !aHasHorizontalScrollBar);
100 propName =
"HasSheetTabs";
101 bool aHasSheetTabs =
false;
102 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasSheetTabs);
103 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue HasSheetTabs", aHasSheetTabs);
106 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
107 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasSheetTabs);
108 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue HasSheetTabs", !aHasSheetTabs);
110 propName =
"IsOutlineSymbolsSet";
111 bool aIsOutlineSymbolsSet =
false;
112 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet);
113 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue IsOutlineSymbolsSet", aIsOutlineSymbolsSet);
116 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
117 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet);
118 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue IsOutlineSymbolsSet",
119 !aIsOutlineSymbolsSet);
121 propName =
"HasColumnRowHeaders";
122 bool aHasColumnRowHeaders =
false;
123 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders);
124 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue HasColumnRowHeaders", aHasColumnRowHeaders);
127 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
128 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders);
129 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue HasColumnRowHeaders",
130 !aHasColumnRowHeaders);
132 propName =
"ShowGrid";
133 bool aShowGrid =
false;
134 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowGrid);
135 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowGrid", aShowGrid);
138 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
139 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowGrid);
140 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowGrid", !aShowGrid);
142 propName =
"GridColor";
143 util::Color aGridColor;
144 xSpreadsheetViewSettings->getPropertyValue(propName) >>= aGridColor;
145 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to get PropertyValue GridColor", sal_Int32(12632256),
148 aNewValue <<= sal_Int32(42);
149 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
150 xSpreadsheetViewSettings->getPropertyValue(propName) >>= aGridColor;
151 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue GridColor", sal_Int32(42),
154 propName =
"ShowHelpLines";
155 bool aShowHelpLines =
true;
156 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowHelpLines);
157 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowHelpLines", !aShowHelpLines);
160 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
161 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowHelpLines);
162 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowHelpLines", aShowHelpLines);
164 propName =
"ShowAnchor";
165 bool aShowAnchor =
false;
166 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowAnchor);
167 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowAnchor", aShowAnchor);
170 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
171 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowAnchor);
172 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowAnchor", !aShowAnchor);
174 propName =
"ShowPageBreaks";
175 bool aShowPageBreaks =
false;
176 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowPageBreaks);
177 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue ShowPageBreaks", aShowPageBreaks);
180 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
181 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowPageBreaks);
182 CPPUNIT_ASSERT_MESSAGE(
"Unable to set PropertyValue ShowPageBreaks", !aShowPageBreaks);
184 propName =
"ShowObjects";
185 sal_Int16 aShowObjects = 42;
186 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowObjects);
187 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to get PropertyValue ShowObjects", sal_Int16(0),
190 aNewValue <<= sal_Int16(1);
191 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
192 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowObjects);
193 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue ShowObjects", sal_Int16(1),
196 propName =
"ShowCharts";
197 sal_Int16 aShowCharts = 42;
198 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowCharts);
199 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to get PropertyValue ShowCharts", sal_Int16(0),
202 aNewValue <<= sal_Int16(1);
203 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
204 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowCharts);
205 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue ShowCharts", sal_Int16(1),
208 propName =
"ShowDrawing";
209 sal_Int16 aShowDrawing = 42;
210 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowDrawing);
211 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to get PropertyValue ShowDrawing", sal_Int16(0),
214 aNewValue <<= sal_Int16(1);
215 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
216 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowDrawing);
217 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue ShowDrawing", sal_Int16(1),
220 propName =
"ZoomType";
221 sal_Int16 aZoomType = 42;
222 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomType);
223 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to get PropertyValue ZoomType", sal_Int16(3), aZoomType);
225 aNewValue <<= sal_Int16(1);
226 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
227 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomType);
228 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue ZoomType", sal_Int16(1), aZoomType);
230 propName =
"ZoomValue";
231 sal_Int16 aZoomValue = 42;
232 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomValue);
234 aNewValue <<= sal_Int16(1);
235 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
236 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomValue);
237 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue ZoomValue", sal_Int16(1), aZoomValue);
239 propName =
"FormulaBarHeight";
240 sal_Int16 aFormulaBarHeight;
241 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aFormulaBarHeight);
243 aNewValue <<= sal_Int16(15);
244 xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue);
245 CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aFormulaBarHeight);
246 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue FormulaBarHeight", sal_Int16(15),
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testSpreadsheetViewSettingsProperties()