1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "PrintOptTest.hxx"
25 
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 
28 #include <unotools/processfactory.hxx>
29 #include <comphelper/configurationhelper.hxx>
30 
31 namespace css = ::com::sun::star;
32 
33 // using test  only
34 #define ROOTNODE_PRINTOPTION                            rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option")
35 #define	PROPERTYNAME_REDUCETRANSPARENCY	                rtl::OUString::createFromAscii("ReduceTransparency")
36 #define	PROPERTYNAME_REDUCEDTRANSPARENCYMODE	        rtl::OUString::createFromAscii("ReducedTransparencyMode")
37 #define	PROPERTYNAME_REDUCEGRADIENTS		            rtl::OUString::createFromAscii("ReduceGradients")
38 #define	PROPERTYNAME_REDUCEDGRADIENTMODE		        rtl::OUString::createFromAscii("ReducedGradientMode")
39 #define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT           rtl::OUString::createFromAscii("ReducedGradientStepCount")
40 #define PROPERTYNAME_REDUCEBITMAPS                      rtl::OUString::createFromAscii("ReduceBitmaps")
41 #define PROPERTYNAME_REDUCEDBITMAPMODE                  rtl::OUString::createFromAscii("ReducedBitmapMode")
42 #define PROPERTYNAME_REDUCEDBITMAPRESOLUTION            rtl::OUString::createFromAscii("ReducedBitmapResolution")
43 #define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY  rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency")
44 #define PROPERTYNAME_CONVERTTOGREYSCALES                rtl::OUString::createFromAscii("ConvertToGreyscales")
45 
PrintOptTest()46 PrintOptTest::PrintOptTest()
47 {
48 	m_xCfg = css::uno::Reference< css::container::XNameAccess >(
49 			::comphelper::ConfigurationHelper::openConfig(
50 			::utl::getProcessServiceFactory(),
51 			rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"),
52 			::comphelper::ConfigurationHelper::E_STANDARD),
53 			css::uno::UNO_QUERY);
54 
55 		if (m_xCfg.is())
56 		{
57 			//UniString  sTmp = UniString("printer");
58 			//xub_StrLen nTokenCount = sTmp.GetTokenCount('/');
59 			//sTmp = sTmp.GetToken(nTokenCount - 1, '/');
60 			m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode;
61 		}
62 }
63 
impl_GetReducedTransparencyMode() const64 sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const
65 {
66 	sal_Int16 nRet = 0;
67 	if (m_xNode.is())
68 	{
69 		css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
70 		if (xSet.is())
71 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet;
72 	}
73 	return  nRet;
74 }
impl_SetReducedTransparencyMode(sal_Int16 nMode)75 void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode )
76 {
77 	if (m_xNode.is())
78 	{
79 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
80 		if (xSet.is())
81 		{
82 			sal_Int16 nUpdate;
83 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate;
84 			if (nUpdate != nMode)
85 			{
86 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode));
87 				::comphelper::ConfigurationHelper::flush(m_xCfg);
88 			}
89 		}
90 	}
91 }
92 
impl_IsReduceTransparency() const93 sal_Bool PrintOptTest::impl_IsReduceTransparency() const
94 {
95 	sal_Bool bRet = sal_False;
96 	if (m_xNode.is())
97 	{
98 		css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
99 		if (xSet.is())
100 			xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet;
101 	}
102 	return bRet;
103 }
impl_SetReduceTransparency(sal_Bool bState)104 void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState )
105 {
106 	if (m_xNode.is())
107 	{
108 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
109 		if (xSet.is())
110 		{
111 			sal_Bool bUpdate;
112 			xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate;
113 			if (bUpdate != bState)
114 			{
115 				xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState));
116 				::comphelper::ConfigurationHelper::flush(m_xCfg);
117 			}
118 		}
119 	}
120 }
121 
impl_IsReduceGradients() const122 sal_Bool PrintOptTest::impl_IsReduceGradients() const
123 {
124 	sal_Bool bRet = sal_False;
125 	if (m_xNode.is())
126 	{
127 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
128 		if (xSet.is())
129 		{
130 			xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet;
131 		}
132 	}
133 	return bRet;
134 }
135 
impl_SetReduceGradients(sal_Bool bState)136 void PrintOptTest::impl_SetReduceGradients(sal_Bool bState )
137 {
138 	if (m_xNode.is())
139 	{
140 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
141 		if (xSet.is())
142 		{
143 			sal_Bool bUpdate;
144 			xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate;
145 			if (bUpdate != bState)
146 			{
147 				xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState));
148 				::comphelper::ConfigurationHelper::flush(m_xCfg);
149 			}
150 		}
151 	}
152 }
153 
impl_GetReducedGradientMode() const154 sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const
155 {
156 	sal_Int16 nRet = 0;
157 	if (m_xNode.is())
158 	{
159 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
160 		if (xSet.is())
161 		{
162 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet;
163 		}
164 	}
165 	return nRet;
166 }
167 
impl_SetReducedGradientMode(sal_Int16 nMode)168 void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode )
169 {
170 	if (m_xNode.is())
171 	{
172 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
173 		if (xSet.is())
174 		{
175 			sal_Int16 nUpdate;
176 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate;
177 			if (nUpdate != nMode)
178 			{
179 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode));
180 				::comphelper::ConfigurationHelper::flush(m_xCfg);
181 			}
182 		}
183 	}
184 }
185 
impl_GetReducedGradientStepCount() const186 sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const
187 {
188 	sal_Int16 nRet = 64;
189 	if (m_xNode.is())
190 	{
191 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
192 		if (xSet.is())
193 		{
194 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet;
195 		}
196 	}
197 	return nRet;
198 }
impl_SetReducedGradientStepCount(sal_Int16 nStepCount)199 void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount )
200 {
201 	if (m_xNode.is())
202 	{
203 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
204 		if (xSet.is())
205 		{
206 			sal_Int16 nUpdate;
207 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate;
208 			if (nUpdate != nStepCount)
209 			{
210 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount));
211 				::comphelper::ConfigurationHelper::flush(m_xCfg);
212 			}
213 		}
214 	}
215 }
216 
impl_IsReduceBitmaps() const217 sal_Bool PrintOptTest::impl_IsReduceBitmaps() const
218 {
219 	sal_Bool bRet = sal_False;
220 	if (m_xNode.is())
221 	{
222 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
223 		if (xSet.is())
224 		{
225 			xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet;
226 		}
227 	}
228 	return bRet;
229 }
230 
impl_SetReduceBitmaps(sal_Bool bState)231 void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState )
232 {
233 	if (m_xNode.is())
234 	{
235 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
236 		if (xSet.is())
237 		{
238 			sal_Bool bUpdate;
239 			xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate;
240 			if (bUpdate != bState)
241 			{
242 				xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState));
243 				::comphelper::ConfigurationHelper::flush(m_xCfg);
244 			}
245 		}
246 	}
247 }
248 
impl_GetReducedBitmapMode() const249 sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const
250 {
251 	sal_Int16 nRet = 1;
252 	if (m_xNode.is())
253 	{
254 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
255 		if (xSet.is())
256 		{
257 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet;
258 		}
259 	}
260 	return nRet;
261 }
262 
impl_SetReducedBitmapMode(sal_Int16 nMode)263 void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode )
264 {
265 	if (m_xNode.is())
266 	{
267 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
268 		if (xSet.is())
269 		{
270 			sal_Int16 nUpdate;
271 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate;
272 			if (nUpdate != nMode)
273 			{
274 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode));
275 				::comphelper::ConfigurationHelper::flush(m_xCfg);
276 			}
277 		}
278 	}
279 }
280 
impl_GetReducedBitmapResolution() const281 sal_Int16  PrintOptTest::impl_GetReducedBitmapResolution() const
282 {
283 	sal_Int16 nRet = 3;
284 	if (m_xNode.is())
285 	{
286 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
287 		if (xSet.is())
288 		{
289 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet;
290 		}
291 	}
292 	return  nRet;
293 }
294 
impl_SetReducedBitmapResolution(sal_Int16 nResolution)295 void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution )
296 {
297 	if (m_xNode.is())
298 	{
299 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
300 		if (xSet.is())
301 		{
302 			sal_Int16 nUpdate;
303 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate;
304 			if (nUpdate != nResolution)
305 			{
306 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution));
307 				::comphelper::ConfigurationHelper::flush(m_xCfg);
308 			}
309 		}
310 	}
311 }
312 
impl_IsReducedBitmapIncludesTransparency() const313 sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const
314 {
315 	sal_Bool bRet = sal_True;
316 	if (m_xNode.is())
317 	{
318 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
319 		if (xSet.is())
320 		{
321 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet;
322 		}
323 	}
324 	return  bRet;
325 }
326 
impl_SetReducedBitmapIncludesTransparency(sal_Bool bState)327 void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState )
328 {
329 	if (m_xNode.is())
330 	{
331 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
332 		if (xSet.is())
333 		{
334 			sal_Bool bUpdate;
335 			xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate;
336 			if (bUpdate != bState)
337 			{
338 				xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState));
339 				::comphelper::ConfigurationHelper::flush(m_xCfg);
340 			}
341 		}
342 	}
343 }
344 
impl_IsConvertToGreyscales() const345 sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const
346 {
347 	sal_Bool bRet = sal_False;
348 	if (m_xNode.is())
349 	{
350 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
351 		if (xSet.is())
352 		{
353 			xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet;
354 		}
355 	}
356 	return  bRet;
357 }
358 
impl_SetConvertToGreyscales(sal_Bool bState)359 void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState )
360 {
361 	if (m_xNode.is())
362 	{
363 		css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
364 		if (xSet.is())
365 		{
366 			sal_Bool bUpdate;
367 			xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate;
368 			if (bUpdate != bState)
369 			{
370 				xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState));
371 				::comphelper::ConfigurationHelper::flush(m_xCfg);
372 			}
373 		}
374 	}
375 }
376 
377 
~PrintOptTest()378 PrintOptTest::~PrintOptTest()
379 {
380 }
381 
impl_checkPrint()382 void PrintOptTest::impl_checkPrint()
383 {
384 	//test SetReduceTransparency()
385 	sal_Bool bNewValue = sal_False;
386 	sal_Bool bOldValue = sal_False;
387 	bOldValue = PrintOptTest::impl_IsReduceTransparency();
388 	bNewValue = !bOldValue;
389 	aPrintOpt.SetReduceTransparency(bNewValue) ;
390 	bNewValue = impl_IsReduceTransparency();
391    // if(bNewValue != bOldValue) // test the old source
392 	if ( bNewValue == bOldValue ) // test the new source
393 	{
394 		throw css::uno::RuntimeException(
395 			rtl::OUString::createFromAscii(
396 			"null com.sun.star.configuration."
397 			"the SetReduceTransparency() error!"),
398 			0);
399 	}
400 
401 	//test IsReduceTransparemcy()
402 	bNewValue = bOldValue = sal_False;
403 	bOldValue = impl_IsReduceTransparency();
404 	bNewValue = !bOldValue;
405     impl_SetReduceTransparency(bNewValue);
406 	bNewValue = aPrintOpt.IsReduceTransparency();
407 	//if(bNewValue != bOldValue) // test the old source
408 	if(bNewValue == bOldValue) // test the new source
409 	{
410 		throw css::uno::RuntimeException(
411 			rtl::OUString::createFromAscii(
412 			"null com.sun.star.configuration."
413 			"the IsReduceTransparency() error!"),
414 			0);
415 	}
416 
417 	// test SetReducedTransparencyMode()
418 	sal_Int16 nOldMode, nNewMode;
419 	nOldMode = nNewMode = 0;
420     nOldMode = impl_GetReducedTransparencyMode();
421 	nNewMode = nOldMode + 1;
422 	aPrintOpt.SetReducedTransparencyMode( nNewMode );
423 	nNewMode = impl_GetReducedTransparencyMode();
424 	//if(nNewMode != nOldMode)      // test the old source
425 	if ( nNewMode == nOldMode ) // test the new source
426 	{
427 		throw css::uno::RuntimeException(
428 			rtl::OUString::createFromAscii(
429 			"null com.sun.star.configuration."
430 			"the SetReducedTransparencyMode() error!"),
431 			0);
432 	}
433 
434 	//test IsReducedTransparencyMode()
435 	nOldMode = nNewMode = 0;
436 	nOldMode = impl_GetReducedTransparencyMode();
437 	nNewMode = nOldMode + 1;
438 	impl_SetReducedTransparencyMode(nNewMode);
439 	nNewMode = aPrintOpt.GetReducedTransparencyMode();
440 	//if(nNewMode != nOldMode)    // test the old source
441 	if(nNewMode == nOldMode)  // test the new source
442 	{
443 		throw css::uno::RuntimeException(
444 			rtl::OUString::createFromAscii(
445 			"null com.sun.star.configuration."
446 			"the IsReducedTransparencyMode() error!"
447 			"nOldMode's value is :"),
448 			0);
449 	}
450 
451 	// test the SetReduceGradients()
452 	bNewValue = bOldValue = sal_False;
453 	bOldValue = impl_IsReduceGradients();
454 	bNewValue = !bOldValue;
455 	aPrintOpt.SetReduceGradients(bNewValue);
456 	bNewValue = impl_IsReduceGradients();
457 	//if (bNewValue != bOldValue)   //test the old source
458 	if (bNewValue == bOldValue)   //test the new source
459 	{
460 		throw css::uno::RuntimeException(
461 			rtl::OUString::createFromAscii(
462 			"null com.sun.star.configuration."
463 			"the SetReduceGradients() error!"),
464 			0);
465 
466 	}
467 
468 	// test the IsReduceGradients()
469 	bNewValue = bOldValue = sal_False;
470 	bOldValue = impl_IsReduceGradients();
471 	bNewValue = !bOldValue;
472 	this->impl_SetReduceGradients(bNewValue);
473 	bNewValue = aPrintOpt.IsReduceGradients();
474    // if (bNewValue != bOldValue)   // test the old source
475 	if (bNewValue == bOldValue) // test the new source
476     {
477 		throw css::uno::RuntimeException(
478 			rtl::OUString::createFromAscii(
479 			"null com.sun.star.configuration."
480 			"the IsReduceGradients() error!"),
481 			0);
482 
483     }
484 
485 	//test SetRedecedGradientMode()
486 	nOldMode = nNewMode = 0;
487     nOldMode = this->impl_GetReducedGradientMode();
488 	nNewMode = nOldMode + 1;
489     aPrintOpt.SetReducedGradientMode(nNewMode);
490     nNewMode = this->impl_GetReducedGradientMode();
491 	//if (nNewMode != nOldMode)  // test the old source
492 	if (nNewMode == nOldMode)// test the new source
493 	{
494 		throw css::uno::RuntimeException(
495 			rtl::OUString::createFromAscii(
496 			"null com.sun.star.configuration."
497 			"the SetRedecedGradientMode() error!"),
498 			0);
499 	}
500 
501 	// test GetReducedGradientMode()
502 	nOldMode = nNewMode = 0;
503     nOldMode = this->impl_GetReducedGradientMode();
504 	nNewMode = nOldMode + 1;
505 	this->impl_SetReducedGradientMode(nNewMode);
506 	nNewMode = aPrintOpt.GetReducedGradientMode();
507 	//if (nNewMode != nOldMode) // test the old source
508 	if (nNewMode == nOldMode) // test the new source
509 	{
510 		throw css::uno::RuntimeException(
511 			rtl::OUString::createFromAscii(
512 			"null com.sun.star.configuration."
513 			"the GetReducedGradientMode() error!"),
514 			0);
515 
516 	}
517 
518 	//test the SetReducedGradientStepCount()
519     sal_Int16 nNewStepCount;
520 	sal_Int16 nOldStepCount;
521 	nNewStepCount = nOldStepCount = 0;
522 	nOldStepCount = this->impl_GetReducedGradientStepCount();
523 	nNewStepCount = nOldStepCount + 1;
524 	aPrintOpt.SetReducedGradientStepCount(nNewStepCount);
525 	nNewStepCount = this->impl_GetReducedGradientStepCount();
526    // if (nNewStepCount != nOldStepCount) // test the old source
527 	if (nNewStepCount == nOldStepCount) // test the new source
528     {
529 		throw css::uno::RuntimeException(
530 			rtl::OUString::createFromAscii(
531 			"null com.sun.star.configuration."
532 			"the SetReducedGradientStepCount() error!"),
533 			0);
534 
535     }
536 
537 	// test the GetReduceGradientStepCount()
538     nNewStepCount = nOldStepCount = 0;
539 	nOldStepCount = this->impl_GetReducedGradientStepCount();
540 	nNewStepCount = nOldStepCount + 1;
541     this->impl_SetReducedGradientStepCount(nNewStepCount);
542 	nNewStepCount = aPrintOpt.GetReducedGradientStepCount();
543    // if (nNewStepCount != nOldStepCount)  //test the old source
544 	if (nNewStepCount == nOldStepCount)  //test the new source
545     {
546 		throw css::uno::RuntimeException(
547 			rtl::OUString::createFromAscii(
548 			"null com.sun.star.configuration."
549 			"the GetReduceGradientStepCount() error!"),
550 			0);
551     }
552 
553     // test the SetReduceBitmaps()
554 	bNewValue = bOldValue = sal_False;
555 	bOldValue = this->impl_IsReduceBitmaps();
556 	bNewValue = !bOldValue;
557 	aPrintOpt.SetReduceBitmaps(bNewValue);
558 	bNewValue = this->impl_IsReduceBitmaps();
559 	//if (bNewValue != bOldValue) // test the old source
560 	if (bNewValue == bOldValue) // test the new source
561 	{
562 		throw css::uno::RuntimeException(
563 			rtl::OUString::createFromAscii(
564 			"null com.sun.star.configuration."
565 			"the SetReduceBitmaps() error!"),
566 			0);
567 	}
568 
569 	// test the IsReduceBitmaps()
570 	bNewValue = bOldValue = sal_False;
571 	bOldValue = this->impl_IsReduceBitmaps();
572 	bNewValue = !bOldValue;
573 	this->impl_SetReduceBitmaps(bNewValue);
574 	bNewValue = aPrintOpt.IsReduceBitmaps();
575 	//if (bNewValue != bOldValue)   // test the old source
576 	if (bNewValue == bOldValue) // test the new source
577 	{
578 		throw css::uno::RuntimeException(
579 			rtl::OUString::createFromAscii(
580 			"null com.sun.star.configuration."
581 			"the IsReduceBitmaps() error!"),
582 			0);
583 	}
584 
585 	// test the SetReduceBitmap()
586 	nNewMode = nOldMode = 0;
587 	nOldMode = impl_GetReducedBitmapMode();
588 	nNewMode = nOldMode + 1;
589 	aPrintOpt.SetReducedBitmapMode(nNewMode);
590 	nNewMode = impl_GetReducedBitmapMode();
591 	//if (nNewMode != nOldMode)  // test the old source
592 	if (nNewMode == nOldMode)// test the new source
593 	{
594 		throw css::uno::RuntimeException(
595 			rtl::OUString::createFromAscii(
596 			"null com.sun.star.configuration."
597 			"the SetReduceBitmap() error!"),
598 			0);
599 	}
600 
601 	// test the SetReduceBitmapMode()
602 	nNewMode = nOldMode = 0;
603 	nOldMode = this->impl_GetReducedBitmapMode();
604 	nNewMode = nOldMode + 1;
605 	aPrintOpt.SetReducedBitmapMode(nNewMode);
606 	nNewMode = this->impl_GetReducedBitmapMode();
607     //if (nNewMode != nOldMode) // test the old source
608 	if (nNewMode == nOldMode)  // test the new source
609     {
610 		throw css::uno::RuntimeException(
611 			rtl::OUString::createFromAscii(
612 			"null com.sun.star.configuration."
613 			"the SetReduceBitmapMode() error!"),
614 			0);
615     }
616 
617     // test the GetReduceBitmapMode()
618 	nNewMode = nOldMode = 0;
619 	nOldMode = this->impl_GetReducedBitmapMode();
620 	nNewMode = nOldMode + 1;
621 	this->impl_SetReducedBitmapMode(nNewMode);
622 	nNewMode = aPrintOpt.GetReducedBitmapMode();
623 	//if (nNewMode != nOldMode)  // test the old source
624 	if (nNewMode == nOldMode)// test the new source
625 	{
626 		throw css::uno::RuntimeException(
627 			rtl::OUString::createFromAscii(
628 			"null com.sun.star.configuration."
629 			"the GetReduceBitmapMode() error!"),
630 			0);
631 
632 	}
633 
634 	// test the SetReducedBitmapResolution()
635 	sal_Int16 nOldResolution ;
636     sal_Int16 nNewResolution ;
637 	nNewResolution = nOldResolution = 0;
638     nOldResolution = impl_GetReducedBitmapResolution();
639 	nNewResolution = nOldResolution + 1;
640 	aPrintOpt.SetReducedBitmapResolution(nNewResolution);
641     nNewResolution = impl_GetReducedBitmapResolution();
642 	//if (nNewResolution != nOldResolution)  // test the old source
643 	if (nNewResolution == nOldResolution)// test the new source
644 	{
645 		throw css::uno::RuntimeException(
646 			rtl::OUString::createFromAscii(
647 			"null com.sun.star.configuration."
648 			"the SetReducedBitmapResolution() error!"),
649 			0);
650 	}
651 
652 	// test the GetReduceBitmapResolution()
653     nNewResolution = nOldResolution = 0;
654 	nOldResolution = impl_GetReducedBitmapResolution();
655 	nNewResolution = nOldResolution + 1;
656 	impl_SetReducedBitmapResolution(nNewResolution);
657     nNewResolution = impl_GetReducedBitmapResolution();
658 	//if (nNewResolution != nOldResolution)   // test the old source
659 	if (nNewResolution == nOldResolution) // test the new source
660 	{
661 		throw css::uno::RuntimeException(
662 			rtl::OUString::createFromAscii(
663 			"null com.sun.star.configuration."
664 			"the GetReduceBitmapResolution() error!"),
665 			0);
666 	}
667 
668 	// test SetReducedBitmapIncludesTransparency()
669 	bNewValue = bOldValue = sal_False;
670     bOldValue = impl_IsReducedBitmapIncludesTransparency();
671 	bNewValue = !bOldValue;
672 	aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue);
673 	bNewValue = impl_IsReducedBitmapIncludesTransparency();
674 	//if (bNewValue != bOldValue) // test the new source
675 	if (bNewValue == bOldValue) // test the old source
676 	{
677 		throw css::uno::RuntimeException(
678 			rtl::OUString::createFromAscii(
679 			"null com.sun.star.configuration."
680 			"the SetReducedBitmapIncludesTransparency() error!"),
681 			0);
682 	}
683 
684 	// test the IsReducedBitmapIncludesTransparency()
685 	bNewValue = bOldValue = sal_False;
686 	bOldValue = impl_IsReducedBitmapIncludesTransparency();
687 	bNewValue = !bOldValue;
688 	impl_SetReducedBitmapIncludesTransparency(bNewValue);
689 	bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency();
690 	//if (bNewValue != bOldValue)   // test the old source
691 	if (bNewValue == bOldValue) // test the new source
692 	{
693 		throw css::uno::RuntimeException(
694 			rtl::OUString::createFromAscii(
695 			"null com.sun.star.configuration."
696 			"the IsReducedBitmapIncludesTransparency() error!"),
697 			0);
698 	}
699 
700 	// test the SetConvertToGreyscales()
701 	bNewValue = bOldValue = sal_False;
702     bOldValue = this->impl_IsConvertToGreyscales();
703 	bNewValue = !bOldValue;
704 	aPrintOpt.SetConvertToGreyscales(bNewValue);
705 	bNewValue = this->impl_IsConvertToGreyscales();
706 	//if (bNewValue != bOldValue) // test the old source
707 	if (bNewValue == bOldValue) // test the new source
708 	{
709 		throw css::uno::RuntimeException(
710 			rtl::OUString::createFromAscii(
711 			"null com.sun.star.configuration."
712 			"the SetConvertToGreyscales() error!"),
713 			0);
714 	}
715 
716     // test the IsConvertToGreyscales()
717 	bNewValue = bOldValue = sal_False;
718 	bOldValue = this->impl_IsConvertToGreyscales();
719 	bNewValue = !bOldValue;
720     impl_SetConvertToGreyscales(bNewValue);
721 	bNewValue = aPrintOpt.IsConvertToGreyscales();
722 	//if (bNewValue != bOldValue) // test the old source
723 	if (bNewValue == bOldValue) // test the new source
724 	{
725 		throw css::uno::RuntimeException(
726 			rtl::OUString::createFromAscii(
727 			"null com.sun.star.configuration."
728 			"the IsConvertToGreyscales() error!"),
729 			0);
730 	}
731 }
732