Update ooo320-m1
[ooovba.git] / svtools / qa / complex / ConfigItems / helper / PrintOptTest.cxx
blob4fa2c2d88ec4332aac8be074b947256031da628e
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: PrintOptTest.cxx,v $
7 * $Revision: 1.1.4.2 $
9 * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 #include "PrintOptTest.hxx"
38 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <unotools/processfactory.hxx>
41 #include <comphelper/configurationhelper.hxx>
43 namespace css = ::com::sun::star;
45 // using test only
46 #define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option")
47 #define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency")
48 #define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode")
49 #define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients")
50 #define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode")
51 #define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount")
52 #define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps")
53 #define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode")
54 #define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution")
55 #define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency")
56 #define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales")
58 PrintOptTest::PrintOptTest()
60 m_xCfg = css::uno::Reference< css::container::XNameAccess >(
61 ::comphelper::ConfigurationHelper::openConfig(
62 ::utl::getProcessServiceFactory(),
63 rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"),
64 ::comphelper::ConfigurationHelper::E_STANDARD),
65 css::uno::UNO_QUERY);
67 if (m_xCfg.is())
69 //UniString sTmp = UniString("printer");
70 //xub_StrLen nTokenCount = sTmp.GetTokenCount('/');
71 //sTmp = sTmp.GetToken(nTokenCount - 1, '/');
72 m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode;
76 sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const
78 sal_Int16 nRet = 0;
79 if (m_xNode.is())
81 css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
82 if (xSet.is())
83 xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet;
85 return nRet;
87 void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode )
89 if (m_xNode.is())
91 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
92 if (xSet.is())
94 sal_Int16 nUpdate;
95 xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate;
96 if (nUpdate != nMode)
98 xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode));
99 ::comphelper::ConfigurationHelper::flush(m_xCfg);
105 sal_Bool PrintOptTest::impl_IsReduceTransparency() const
107 sal_Bool bRet = sal_False;
108 if (m_xNode.is())
110 css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
111 if (xSet.is())
112 xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet;
114 return bRet;
116 void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState )
118 if (m_xNode.is())
120 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
121 if (xSet.is())
123 sal_Bool bUpdate;
124 xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate;
125 if (bUpdate != bState)
127 xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState));
128 ::comphelper::ConfigurationHelper::flush(m_xCfg);
134 sal_Bool PrintOptTest::impl_IsReduceGradients() const
136 sal_Bool bRet = sal_False;
137 if (m_xNode.is())
139 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
140 if (xSet.is())
142 xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet;
145 return bRet;
148 void PrintOptTest::impl_SetReduceGradients(sal_Bool bState )
150 if (m_xNode.is())
152 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
153 if (xSet.is())
155 sal_Bool bUpdate;
156 xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate;
157 if (bUpdate != bState)
159 xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState));
160 ::comphelper::ConfigurationHelper::flush(m_xCfg);
166 sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const
168 sal_Int16 nRet = 0;
169 if (m_xNode.is())
171 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
172 if (xSet.is())
174 xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet;
177 return nRet;
180 void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode )
182 if (m_xNode.is())
184 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
185 if (xSet.is())
187 sal_Int16 nUpdate;
188 xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate;
189 if (nUpdate != nMode)
191 xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode));
192 ::comphelper::ConfigurationHelper::flush(m_xCfg);
198 sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const
200 sal_Int16 nRet = 64;
201 if (m_xNode.is())
203 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
204 if (xSet.is())
206 xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet;
209 return nRet;
211 void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount )
213 if (m_xNode.is())
215 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
216 if (xSet.is())
218 sal_Int16 nUpdate;
219 xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate;
220 if (nUpdate != nStepCount)
222 xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount));
223 ::comphelper::ConfigurationHelper::flush(m_xCfg);
229 sal_Bool PrintOptTest::impl_IsReduceBitmaps() const
231 sal_Bool bRet = sal_False;
232 if (m_xNode.is())
234 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
235 if (xSet.is())
237 xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet;
240 return bRet;
243 void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState )
245 if (m_xNode.is())
247 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
248 if (xSet.is())
250 sal_Bool bUpdate;
251 xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate;
252 if (bUpdate != bState)
254 xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState));
255 ::comphelper::ConfigurationHelper::flush(m_xCfg);
261 sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const
263 sal_Int16 nRet = 1;
264 if (m_xNode.is())
266 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
267 if (xSet.is())
269 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet;
272 return nRet;
275 void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode )
277 if (m_xNode.is())
279 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
280 if (xSet.is())
282 sal_Int16 nUpdate;
283 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate;
284 if (nUpdate != nMode)
286 xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode));
287 ::comphelper::ConfigurationHelper::flush(m_xCfg);
293 sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const
295 sal_Int16 nRet = 3;
296 if (m_xNode.is())
298 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
299 if (xSet.is())
301 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet;
304 return nRet;
307 void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution )
309 if (m_xNode.is())
311 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
312 if (xSet.is())
314 sal_Int16 nUpdate;
315 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate;
316 if (nUpdate != nResolution)
318 xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution));
319 ::comphelper::ConfigurationHelper::flush(m_xCfg);
325 sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const
327 sal_Bool bRet = sal_True;
328 if (m_xNode.is())
330 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
331 if (xSet.is())
333 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet;
336 return bRet;
339 void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState )
341 if (m_xNode.is())
343 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
344 if (xSet.is())
346 sal_Bool bUpdate;
347 xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate;
348 if (bUpdate != bState)
350 xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState));
351 ::comphelper::ConfigurationHelper::flush(m_xCfg);
357 sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const
359 sal_Bool bRet = sal_False;
360 if (m_xNode.is())
362 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
363 if (xSet.is())
365 xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet;
368 return bRet;
371 void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState )
373 if (m_xNode.is())
375 css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
376 if (xSet.is())
378 sal_Bool bUpdate;
379 xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate;
380 if (bUpdate != bState)
382 xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState));
383 ::comphelper::ConfigurationHelper::flush(m_xCfg);
390 PrintOptTest::~PrintOptTest()
394 void PrintOptTest::impl_checkPrint()
396 //test SetReduceTransparency()
397 sal_Bool bNewValue = sal_False;
398 sal_Bool bOldValue = sal_False;
399 bOldValue = PrintOptTest::impl_IsReduceTransparency();
400 bNewValue = !bOldValue;
401 aPrintOpt.SetReduceTransparency(bNewValue) ;
402 bNewValue = impl_IsReduceTransparency();
403 // if(bNewValue != bOldValue) // test the old source
404 if ( bNewValue == bOldValue ) // test the new source
406 throw css::uno::RuntimeException(
407 rtl::OUString::createFromAscii(
408 "null com.sun.star.configuration."
409 "the SetReduceTransparency() error!"),
413 //test IsReduceTransparemcy()
414 bNewValue = bOldValue = sal_False;
415 bOldValue = impl_IsReduceTransparency();
416 bNewValue = !bOldValue;
417 impl_SetReduceTransparency(bNewValue);
418 bNewValue = aPrintOpt.IsReduceTransparency();
419 //if(bNewValue != bOldValue) // test the old source
420 if(bNewValue == bOldValue) // test the new source
422 throw css::uno::RuntimeException(
423 rtl::OUString::createFromAscii(
424 "null com.sun.star.configuration."
425 "the IsReduceTransparency() error!"),
429 // test SetReducedTransparencyMode()
430 sal_Int16 nOldMode, nNewMode;
431 nOldMode = nNewMode = 0;
432 nOldMode = impl_GetReducedTransparencyMode();
433 nNewMode = nOldMode + 1;
434 aPrintOpt.SetReducedTransparencyMode( nNewMode );
435 nNewMode = impl_GetReducedTransparencyMode();
436 //if(nNewMode != nOldMode) // test the old source
437 if ( nNewMode == nOldMode ) // test the new source
439 throw css::uno::RuntimeException(
440 rtl::OUString::createFromAscii(
441 "null com.sun.star.configuration."
442 "the SetReducedTransparencyMode() error!"),
446 //test IsReducedTransparencyMode()
447 nOldMode = nNewMode = 0;
448 nOldMode = impl_GetReducedTransparencyMode();
449 nNewMode = nOldMode + 1;
450 impl_SetReducedTransparencyMode(nNewMode);
451 nNewMode = aPrintOpt.GetReducedTransparencyMode();
452 //if(nNewMode != nOldMode) // test the old source
453 if(nNewMode == nOldMode) // test the new source
455 throw css::uno::RuntimeException(
456 rtl::OUString::createFromAscii(
457 "null com.sun.star.configuration."
458 "the IsReducedTransparencyMode() error!"
459 "nOldMode's value is :"),
463 // test the SetReduceGradients()
464 bNewValue = bOldValue = sal_False;
465 bOldValue = impl_IsReduceGradients();
466 bNewValue = !bOldValue;
467 aPrintOpt.SetReduceGradients(bNewValue);
468 bNewValue = impl_IsReduceGradients();
469 //if (bNewValue != bOldValue) //test the old source
470 if (bNewValue == bOldValue) //test the new source
472 throw css::uno::RuntimeException(
473 rtl::OUString::createFromAscii(
474 "null com.sun.star.configuration."
475 "the SetReduceGradients() error!"),
480 // test the IsReduceGradients()
481 bNewValue = bOldValue = sal_False;
482 bOldValue = impl_IsReduceGradients();
483 bNewValue = !bOldValue;
484 this->impl_SetReduceGradients(bNewValue);
485 bNewValue = aPrintOpt.IsReduceGradients();
486 // if (bNewValue != bOldValue) // test the old source
487 if (bNewValue == bOldValue) // test the new source
489 throw css::uno::RuntimeException(
490 rtl::OUString::createFromAscii(
491 "null com.sun.star.configuration."
492 "the IsReduceGradients() error!"),
497 //test SetRedecedGradientMode()
498 nOldMode = nNewMode = 0;
499 nOldMode = this->impl_GetReducedGradientMode();
500 nNewMode = nOldMode + 1;
501 aPrintOpt.SetReducedGradientMode(nNewMode);
502 nNewMode = this->impl_GetReducedGradientMode();
503 //if (nNewMode != nOldMode) // test the old source
504 if (nNewMode == nOldMode)// test the new source
506 throw css::uno::RuntimeException(
507 rtl::OUString::createFromAscii(
508 "null com.sun.star.configuration."
509 "the SetRedecedGradientMode() error!"),
513 // test GetReducedGradientMode()
514 nOldMode = nNewMode = 0;
515 nOldMode = this->impl_GetReducedGradientMode();
516 nNewMode = nOldMode + 1;
517 this->impl_SetReducedGradientMode(nNewMode);
518 nNewMode = aPrintOpt.GetReducedGradientMode();
519 //if (nNewMode != nOldMode) // test the old source
520 if (nNewMode == nOldMode) // test the new source
522 throw css::uno::RuntimeException(
523 rtl::OUString::createFromAscii(
524 "null com.sun.star.configuration."
525 "the GetReducedGradientMode() error!"),
530 //test the SetReducedGradientStepCount()
531 sal_Int16 nNewStepCount;
532 sal_Int16 nOldStepCount;
533 nNewStepCount = nOldStepCount = 0;
534 nOldStepCount = this->impl_GetReducedGradientStepCount();
535 nNewStepCount = nOldStepCount + 1;
536 aPrintOpt.SetReducedGradientStepCount(nNewStepCount);
537 nNewStepCount = this->impl_GetReducedGradientStepCount();
538 // if (nNewStepCount != nOldStepCount) // test the old source
539 if (nNewStepCount == nOldStepCount) // test the new source
541 throw css::uno::RuntimeException(
542 rtl::OUString::createFromAscii(
543 "null com.sun.star.configuration."
544 "the SetReducedGradientStepCount() error!"),
549 // test the GetReduceGradientStepCount()
550 nNewStepCount = nOldStepCount = 0;
551 nOldStepCount = this->impl_GetReducedGradientStepCount();
552 nNewStepCount = nOldStepCount + 1;
553 this->impl_SetReducedGradientStepCount(nNewStepCount);
554 nNewStepCount = aPrintOpt.GetReducedGradientStepCount();
555 // if (nNewStepCount != nOldStepCount) //test the old source
556 if (nNewStepCount == nOldStepCount) //test the new source
558 throw css::uno::RuntimeException(
559 rtl::OUString::createFromAscii(
560 "null com.sun.star.configuration."
561 "the GetReduceGradientStepCount() error!"),
565 // test the SetReduceBitmaps()
566 bNewValue = bOldValue = sal_False;
567 bOldValue = this->impl_IsReduceBitmaps();
568 bNewValue = !bOldValue;
569 aPrintOpt.SetReduceBitmaps(bNewValue);
570 bNewValue = this->impl_IsReduceBitmaps();
571 //if (bNewValue != bOldValue) // test the old source
572 if (bNewValue == bOldValue) // test the new source
574 throw css::uno::RuntimeException(
575 rtl::OUString::createFromAscii(
576 "null com.sun.star.configuration."
577 "the SetReduceBitmaps() error!"),
581 // test the IsReduceBitmaps()
582 bNewValue = bOldValue = sal_False;
583 bOldValue = this->impl_IsReduceBitmaps();
584 bNewValue = !bOldValue;
585 this->impl_SetReduceBitmaps(bNewValue);
586 bNewValue = aPrintOpt.IsReduceBitmaps();
587 //if (bNewValue != bOldValue) // test the old source
588 if (bNewValue == bOldValue) // test the new source
590 throw css::uno::RuntimeException(
591 rtl::OUString::createFromAscii(
592 "null com.sun.star.configuration."
593 "the IsReduceBitmaps() error!"),
597 // test the SetReduceBitmap()
598 nNewMode = nOldMode = 0;
599 nOldMode = impl_GetReducedBitmapMode();
600 nNewMode = nOldMode + 1;
601 aPrintOpt.SetReducedBitmapMode(nNewMode);
602 nNewMode = impl_GetReducedBitmapMode();
603 //if (nNewMode != nOldMode) // test the old source
604 if (nNewMode == nOldMode)// test the new source
606 throw css::uno::RuntimeException(
607 rtl::OUString::createFromAscii(
608 "null com.sun.star.configuration."
609 "the SetReduceBitmap() error!"),
613 // test the SetReduceBitmapMode()
614 nNewMode = nOldMode = 0;
615 nOldMode = this->impl_GetReducedBitmapMode();
616 nNewMode = nOldMode + 1;
617 aPrintOpt.SetReducedBitmapMode(nNewMode);
618 nNewMode = this->impl_GetReducedBitmapMode();
619 //if (nNewMode != nOldMode) // test the old source
620 if (nNewMode == nOldMode) // test the new source
622 throw css::uno::RuntimeException(
623 rtl::OUString::createFromAscii(
624 "null com.sun.star.configuration."
625 "the SetReduceBitmapMode() error!"),
629 // test the GetReduceBitmapMode()
630 nNewMode = nOldMode = 0;
631 nOldMode = this->impl_GetReducedBitmapMode();
632 nNewMode = nOldMode + 1;
633 this->impl_SetReducedBitmapMode(nNewMode);
634 nNewMode = aPrintOpt.GetReducedBitmapMode();
635 //if (nNewMode != nOldMode) // test the old source
636 if (nNewMode == nOldMode)// test the new source
638 throw css::uno::RuntimeException(
639 rtl::OUString::createFromAscii(
640 "null com.sun.star.configuration."
641 "the GetReduceBitmapMode() error!"),
646 // test the SetReducedBitmapResolution()
647 sal_Int16 nOldResolution ;
648 sal_Int16 nNewResolution ;
649 nNewResolution = nOldResolution = 0;
650 nOldResolution = impl_GetReducedBitmapResolution();
651 nNewResolution = nOldResolution + 1;
652 aPrintOpt.SetReducedBitmapResolution(nNewResolution);
653 nNewResolution = impl_GetReducedBitmapResolution();
654 //if (nNewResolution != nOldResolution) // test the old source
655 if (nNewResolution == nOldResolution)// test the new source
657 throw css::uno::RuntimeException(
658 rtl::OUString::createFromAscii(
659 "null com.sun.star.configuration."
660 "the SetReducedBitmapResolution() error!"),
664 // test the GetReduceBitmapResolution()
665 nNewResolution = nOldResolution = 0;
666 nOldResolution = impl_GetReducedBitmapResolution();
667 nNewResolution = nOldResolution + 1;
668 impl_SetReducedBitmapResolution(nNewResolution);
669 nNewResolution = impl_GetReducedBitmapResolution();
670 //if (nNewResolution != nOldResolution) // test the old source
671 if (nNewResolution == nOldResolution) // test the new source
673 throw css::uno::RuntimeException(
674 rtl::OUString::createFromAscii(
675 "null com.sun.star.configuration."
676 "the GetReduceBitmapResolution() error!"),
680 // test SetReducedBitmapIncludesTransparency()
681 bNewValue = bOldValue = sal_False;
682 bOldValue = impl_IsReducedBitmapIncludesTransparency();
683 bNewValue = !bOldValue;
684 aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue);
685 bNewValue = impl_IsReducedBitmapIncludesTransparency();
686 //if (bNewValue != bOldValue) // test the new source
687 if (bNewValue == bOldValue) // test the old source
689 throw css::uno::RuntimeException(
690 rtl::OUString::createFromAscii(
691 "null com.sun.star.configuration."
692 "the SetReducedBitmapIncludesTransparency() error!"),
696 // test the IsReducedBitmapIncludesTransparency()
697 bNewValue = bOldValue = sal_False;
698 bOldValue = impl_IsReducedBitmapIncludesTransparency();
699 bNewValue = !bOldValue;
700 impl_SetReducedBitmapIncludesTransparency(bNewValue);
701 bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency();
702 //if (bNewValue != bOldValue) // test the old source
703 if (bNewValue == bOldValue) // test the new source
705 throw css::uno::RuntimeException(
706 rtl::OUString::createFromAscii(
707 "null com.sun.star.configuration."
708 "the IsReducedBitmapIncludesTransparency() error!"),
712 // test the SetConvertToGreyscales()
713 bNewValue = bOldValue = sal_False;
714 bOldValue = this->impl_IsConvertToGreyscales();
715 bNewValue = !bOldValue;
716 aPrintOpt.SetConvertToGreyscales(bNewValue);
717 bNewValue = this->impl_IsConvertToGreyscales();
718 //if (bNewValue != bOldValue) // test the old source
719 if (bNewValue == bOldValue) // test the new source
721 throw css::uno::RuntimeException(
722 rtl::OUString::createFromAscii(
723 "null com.sun.star.configuration."
724 "the SetConvertToGreyscales() error!"),
725 0);
728 // test the IsConvertToGreyscales()
729 bNewValue = bOldValue = sal_False;
730 bOldValue = this->impl_IsConvertToGreyscales();
731 bNewValue = !bOldValue;
732 impl_SetConvertToGreyscales(bNewValue);
733 bNewValue = aPrintOpt.IsConvertToGreyscales();
734 //if (bNewValue != bOldValue) // test the old source
735 if (bNewValue == bOldValue) // test the new source
737 throw css::uno::RuntimeException(
738 rtl::OUString::createFromAscii(
739 "null com.sun.star.configuration."
740 "the IsConvertToGreyscales() error!"),