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