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